1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,319670,118191,e=>{"use strict";var t=e.i(846574),r=e.i(728056),n=e.i(598252),a=e.i(163483),i=e.i(892499),o=e.i(190794);let s=async(e,t)=>{let r=await (0,a.getV2)("/user-stats",{user:e},o.V2UserStatsResponseSchema,t);return r.data?(({trades:e,biggest_win:t,views:r,join_date:n,all_time_pnl:a})=>({trades:e,largestWin:t??0,views:r??0,joinDate:n?new Date(1e3*n).toISOString():null,volume:a?.volume??null,headlinePnl:a?i.ACTIVE_HEADLINE_PNL_METRIC.read(a):null}))(r.data):null};e.s(["DATA_API_GENESIS_SECONDS",0,0x5e0be100,"activityStartFromJoinDate",0,(e,t)=>{if(!e)return;let r=Date.parse(e);if(!Number.isFinite(r))return;let n=Math.floor(r/1e3);if(!(n<0x5e0be100)&&(void 0===t||!(n>t)))return n},"boundedActivityStart",0,(e,t=Math.floor(Date.now()/1e3))=>void 0!==e&&e<=t?e:void 0,"getProfileUserStatsFetcher",0,s],118191),e.s(["useUserStats",0,(e,a)=>{let i,o,c,l,u,d=(0,t.c)(13);d[0]!==a?(i=void 0===a?{}:a,d[0]=a,d[1]=i):i=d[1];let{enabled:h,staleTime:f,persist:p}=i,g=void 0===f?3e5:f,m=void 0!==p&&p;d[2]!==e?(o=["user-stats",e],c=()=>s(e),d[2]=e,d[3]=o,d[4]=c):(o=d[3],c=d[4]);let y=!!e&&e!==n.zeroAddress&&(void 0===h||h);return d[5]!==m?(l=m?{meta:{persist:!0}}:{},d[5]=m,d[6]=l):l=d[6],d[7]!==g||d[8]!==o||d[9]!==c||d[10]!==y||d[11]!==l?(u={queryKey:o,queryFn:c,enabled:y,refetchOnWindowFocus:!1,refetchOnReconnect:!1,gcTime:3e5,staleTime:g,retry:!1,...l},d[7]=g,d[8]=o,d[9]=c,d[10]=y,d[11]=l,d[12]=u):u=d[12],(0,r.useQuery)(u)}],319670)},534878,e=>{"use strict";e.s(["AuthenticationFlow",()=>h]);var t=e.i(303115),r=e.i(846574),n=e.i(518498),a=e.i(877762),i=e.i(871554),o=e.i(355664),s=e.i(194107),c=e.i(234461),l=e.i(287865),u=e.i(45806);let d=(0,a.default)(()=>e.A(261374).then(e=>e.AuthenticationFlowContent),{loadableGenerated:{modules:[846584]},ssr:!1});function h(e){let a,h,p,g,m,y,w,v,b,C,S,_,A,E,I=(0,r.c)(41),{onClose:k}=e,x=(0,c.useTranslations)(),{open:P,setOpen:R,connectorStatus:T,route:D,connector:O,preventClose:M,setPreventClose:L,setRoute:U,setConnectorStatus:N}=(0,o.useSiwx)(),{isOpenW3M:j}=(0,s.useWalletConnectModal)(),K=(0,u.useRef)(void 0);I[0]!==O.id||I[1]!==T||I[2]!==P||I[3]!==D?(a={open:P,connectorStatus:T,route:D,connectorId:O.id},I[0]=O.id,I[1]=T,I[2]=P,I[3]=D,I[4]=a):a=I[4];let W=(0,l.useLatest)(a);I[5]!==P?(h=()=>{P&&clearTimeout(K.current)},p=[P],I[5]=P,I[6]=h,I[7]=p):(h=I[6],p=I[7]),(0,u.useEffect)(h,p),I[8]===Symbol.for("react.memo_cache_sentinel")?(g=()=>()=>clearTimeout(K.current),m=[],I[8]=g,I[9]=m):(g=I[8],m=I[9]),(0,u.useEffect)(g,m);let F="magic"===O.id&&D===i.AuthRoute.CONNECT&&T===i.ConnectorStates.CONNECTING||D===i.AuthRoute.ONBOARDING||j||M;return I[10]!==O.id||I[11]!==T||I[12]!==W||I[13]!==k||I[14]!==F||I[15]!==D||I[16]!==N||I[17]!==R||I[18]!==L||I[19]!==U?(y=e=>{e||F||(R(!1),L(!1),clearTimeout(K.current),K.current=setTimeout(()=>{let e=W.current;e.open||e.connectorStatus!==T||e.connectorId!==O.id||e.route!==D||e.connectorStatus!==i.ConnectorStates.CONNECTED&&(U(i.AuthRoute.CONNECTORS),N(i.ConnectorStates.DISCONNECTED))},500),k())},I[10]=O.id,I[11]=T,I[12]=W,I[13]=k,I[14]=F,I[15]=D,I[16]=N,I[17]=R,I[18]=L,I[19]=U,I[20]=y):y=I[20],I[21]!==x?(w=x("auth.authentication"),I[21]=x,I[22]=w):w=I[22],I[23]!==w?(v=(0,t.jsx)(n.ModalTitle,{children:w}),I[23]=w,I[24]=v):v=I[24],I[25]!==x?(b=x("auth.authentication"),I[25]=x,I[26]=b):b=I[26],I[27]!==b?(C=(0,t.jsx)(n.ModalDescription,{children:b}),I[27]=b,I[28]=C):C=I[28],I[29]!==C||I[30]!==v?(S=(0,t.jsxs)("span",{className:"sr-only",children:[v,C]}),I[29]=C,I[30]=v,I[31]=S):S=I[31],I[32]!==k?(_=(0,t.jsx)(d,{onClose:k}),I[32]=k,I[33]=_):_=I[33],I[34]!==S||I[35]!==_?(A=(0,t.jsxs)(n.ModalContent,{onOpenAutoFocus:f,children:[S,_]}),I[34]=S,I[35]=_,I[36]=A):A=I[36],I[37]!==P||I[38]!==A||I[39]!==y?(E=(0,t.jsx)(n.Modal,{open:P,onOpenChange:y,children:A}),I[37]=P,I[38]=A,I[39]=y,I[40]=E):E=I[40],E}function f(e){e.preventDefault()}},396866,556784,57720,e=>{"use strict";var t,r=e.i(224098),n=e.i(427280),a=e.i(566344),i=e.i(910233),o=e.i(501596),s=((t={}).Inactive="notActive",t.Active="active",t),c=e.i(141781);let l="pm__oauth_",u=c.z.enum(["google","steam","telegram"]);e.s(["MagicOauthTypesEnum",0,u,"OAUTH_EMAIL_PREFIX",0,l],556784);let d=(e,t,r)=>{let n=Date.now(),{profile:a,...i}=e;return{username:a.name,pseudonym:a?.pseudonym??"",email:i?.email??"",displayUsern
1amePublic:!!a?.displayUsernamePublic,profile:a.id,blocked:!!i?.blocked,address:i?.address,proxyWallet:a.proxyWallet,userTag:"",profile_image:a?.profileImage??void 0,profile_image_optimized:a?.profileImageOptimized,bio:a?.bio??"",created_at:a?.createdAt??new Date().toISOString(),loggedIn:!0,authType:t,walletActivated:a?.walletActivated?s.Active:s.Inactive,profileCreationTime:a?.createdAt?new Date(a.createdAt).getTime():Date.now(),userId:i.id,lastSeen:n,lastRefreshed:n,xUsername:a?.xUsername,discordUsername:a?.discordUsername,displayDiscordUsernamePublic:a?.displayDiscordUsernamePublic,verifiedBadge:a?.verifiedBadge,takerTier:a?.takerTier,takerTierName:a?.takerTierName,termsAcceptedAt:a?.termsAcceptedAt,viewOnlyAcknowledgedAt:a?.viewOnlyAcknowledgedAt,..."magic"===t&&!!r&&{...r.oauthProvider&&{oauthProvider:u.parse(r.oauthProvider)},...!!r.email&&!r.oauthProvider&&{email:r.email},...!!r.email&&!!r.oauthProvider&&{email:`${l}${r.email}`}},isCloseOnly:a?.isCloseOnly,closeOnlyUntil:a?.closeOnlyUntil,closeOnlyReason:a?.closeOnlyReason,isCertReq:a?.isCertReq}};e.s(["parseGammaProfile",0,d,"parseGammaProfileAfterCreation",0,e=>{let t=Date.now(),{profile:r,user:n,authenticationType:a,magicUser:i}=e;return{username:r.name,pseudonym:r?.pseudonym??"",email:n?.email??"",displayUsernamePublic:!!r?.displayUsernamePublic,profile:r.id,blocked:!1,address:n?.address,proxyWallet:r.proxyWallet,userTag:"",profile_image:r?.profileImage??void 0,bio:r?.bio??"",created_at:r.createdAt,loggedIn:!0,authType:a,walletActivated:s.Active,profileCreationTime:r?.createdAt?new Date(r.createdAt).getTime():Date.now(),userId:n.id,isOnboarding:!0,lastSeen:t,lastRefreshed:t,xUsername:r?.xUsername,discordUsername:r?.discordUsername,takerTier:r?.takerTier,takerTierName:r?.takerTierName,termsAcceptedAt:r?.termsAcceptedAt,viewOnlyAcknowledgedAt:r?.viewOnlyAcknowledgedAt,..."magic"===a&&!!i&&{...i.oauthProvider&&{oauthProvider:u.parse(i.oauthProvider)},...!!i.email&&!i.oauthProvider&&{email:i.email},...!!i.email&&!!i.oauthProvider&&{email:`${l}${i.email}`}}}}],57720);var h=e.i(681663);let f=async()=>{let e=await (0,o.getGammaClient)().users.get();if("failure"===e.status)throw h.logger.error("[useAccountProfile > accountProfileFetcher]",{error:e.error}),e.error;let{user:t}=e.data,r=t.isExternalAuth?"eoa":"magic",n=d(t,r);return{...n,walletActivated:n.walletActivated===s.Active?s.Active:s.Inactive}},p=(0,n.queryOptions)({queryKey:a.queryKeys[i.QueryKey.Account].profile().queryKey,queryFn:f,refetchOnWindowFocus:!1,refetchOnReconnect:!1,placeholderData:r.keepPreviousData,retry:3,retryDelay:e=>Math.min(e>1?2**e*1e3:4e3,3e4),gcTime:6e5,staleTime:6e5,meta:{persist:!0,errorContext:{tag:"[useAccountProfile] /api/account/profile"}}});e.s(["accountProfileFetcher",0,f,"accountProfileQueryOptions",0,p],396866)},512402,982285,e=>{"use strict";e.s(["EVENT_TAG_PREFERENCES",()=>f,"default",()=>w],512402);var t=e.i(846574),r=e.i(669718),n=e.i(608114),a=e.i(728056),i=e.i(820399);e.i(45806);var o=e.i(501596),s=e.i(566344),c=e.i(910233),l=e.i(521280),u=e.i(822150),d=e.i(681663),h=e.i(901822);let f=[{id:"2",label:"Politics"},{id:"21",label:"Crypto"},{id:"1",label:"Sports"},{id:"107",label:"Business"},{id:"596",label:"Pop Culture"},{id:"74",label:"Science"},{id:"101110",label:"Creators"}];function p(e,t){let r=Number(e);if(!Number.isSafeInteger(r)||r<=0)throw Error(`Invalid ${t} id`);return r}let g=async()=>{let e=(0,r.createWalletCache)().state.value,[t,n]=await Promise.all([(0,o.getGammaClient)().preferences.get(),e?.type==="eoa"?(0,o.getGammaClient)().walletPreferences.get():void 0]);if("failure"===t.status)throw d.logger.error("[useAccountPreferences > getAccountPreferencesFetcher > preferences]",{error:t.error}),t.error;if(n?.status==="failure")throw d.logger.error("[useAccountPreferences > getAccountPreferencesFetcher > walletPreferences]",{error:n.error}),n.error;return{preferences:{id:p(t.data.id,"preferences"),marketInterests:t.data.marketInterests,emailN
1otificationPreferences:t.data.emailNotificationPreferences,appNotificationPreferences:t.data.appNotificationPreferences,subscriptionStatus:t.data.subscriptionStatus},...e?.type==="eoa"&&n?.status==="success"&&{walletPreferences:{...n.data,id:p(n.data.id,"wallet preferences")}}}},m=async e=>{let{id:t,marketInterests:r,emailNotificationPreferences:n,appNotificationPreferences:a,subscriptionStatus:i}=e,s=r?JSON.parse(r):void 0,c=n?JSON.parse(n):void 0,l=a?JSON.parse(a):void 0,u=await (0,o.getGammaClient)().preferences.update({id:p(t,"preferences"),...!!s&&{marketInterests:s},...!!c&&{emailNotificationPreferences:c},...!!l&&{appNotificationPreferences:l},...void 0!==i&&{subscriptionStatus:i}});if("failure"===u.status)throw d.logger.error("[useAccountPreferences > updateAccountPreferencesFetcher]",{error:u.error,variables:e}),u.error;return{marketInterests:s,emailNotificationPreferences:c,subscriptionStatus:i}},y=async e=>{let{id:t,gasPreference:r,customGasPrice:n,advancedMode:a}=e,i=await (0,o.getGammaClient)().walletPreferences.update({id:p(t,"wallet preferences").toString(),...!!r&&{gasPreference:r},...!!n&&{customGasPrice:n},...void 0!==a&&{advancedMode:a}});if("failure"===i.status)throw d.logger.error("[useAccountPreferences > updateAccountWalletPreferencesFetcher]",{error:i.error,variables:e}),i.error;return{gasPreference:r,customGasPrice:n,advancedMode:a}},w=(e,r,o,d,f)=>{let p,g,w,_,A,E,I,k,x,P,R,T,D,O,M=(0,t.c)(34),L=(0,i.useQueryClient)();M[0]===Symbol.for("react.memo_cache_sentinel")?(p=["authenticated","authenticationType","proxyAddress","isSessionLoading","isUserOnboarding"],M[0]=p):p=M[0];let{authenticated:U,authenticationType:N,proxyAddress:j,isSessionLoading:K,isUserOnboarding:W}=(0,l.useAccountContext)(p),F=o??j,q=(0,h.default)();M[1]===Symbol.for("react.memo_cache_sentinel")?(g=s.queryKeys[c.QueryKey.Account].preferences(),M[1]=g):g=M[1];let $=q&&!(d??K)&&(e??U)&&!!(r??N)&&!!F&&!(f??W);M[2]!==F?(w={persist:!0,errorContext:{proxyAddress:F,tag:"getAccountPreferences"}},M[2]=F,M[3]=w):w=M[3],M[4]!==$||M[5]!==w?(_={queryKey:g.queryKey,queryFn:v,enabled:$,refetchOnWindowFocus:!1,gcTime:6e5,staleTime:6e5,retry:2,meta:w,retryDelay:b},M[4]=$,M[5]=w,M[6]=_):_=M[6];let{data:G}=(0,a.useQuery)(_),B=G?.preferences,H=G?.walletPreferences;M[7]!==L?(A=async e=>{await L.cancelQueries({queryKey:s.queryKeys[c.QueryKey.Account].preferences._def});let t=L.getQueryData(s.queryKeys[c.QueryKey.Account].preferences().queryKey),r={...t,preferences:{...t?.preferences,...e,...e.marketInterests&&{marketInterests:JSON.parse(e.marketInterests)},...e.emailNotificationPreferences&&{emailNotificationPreferences:JSON.parse(e.emailNotificationPreferences)},...e.appNotificationPreferences&&{appNotificationPreferences:JSON.parse(e.appNotificationPreferences)}}};return L.setQueryData(s.queryKeys[c.QueryKey.Account].preferences().queryKey,r),{previousPreferences:t}},E=()=>L.invalidateQueries({queryKey:s.queryKeys[c.QueryKey.Account].preferences._def}),M[7]=L,M[8]=A,M[9]=E):(A=M[8],E=M[9]),M[10]!==F||M[11]!==L?(I=(e,t,r)=>{L.setQueryData(s.queryKeys[c.QueryKey.Account].preferences().queryKey,r?.previousPreferences),(0,u.handleError)(e,"updateAccountPreferences",F)},M[10]=F,M[11]=L,M[12]=I):I=M[12],M[13]!==A||M[14]!==E||M[15]!==I?(k={mutationKey:s.queryKeys[c.QueryKey.Account].preferences._def,mutationFn:m,retry:3,retryDelay:C,onMutate:A,onSettled:E,onError:I},M[13]=A,M[14]=E,M[15]=I,M[16]=k):k=M[16];let{mutateAsync:Q}=(0,n.useMutation)(k);M[17]!==L?(P=async e=>{await L.cancelQueries({queryKey:s.queryKeys[c.QueryKey.Account].preferences._def});let t=L.getQueryData(s.queryKeys[c.QueryKey.Account].preferences().queryKey),r={...t,walletPreferences:{...t?.walletPreferences,...e}};return L.setQueryData(s.queryKeys[c.QueryKey.Account].preferences().queryKey,r),{previousPreferences:t}},x=()=>L.invalidateQueries({queryKey:s.queryKeys[c.QueryKey.Account].preferences._def}),M[17]=L,M[18]=x,M[19]=P):(x=M[18],P=M[19]),M[20]!==F||M[21]!==L?(R=(e,t,r)=>{L.setQueryData(s.queryKeys[c.QueryKey.Account].preferences().queryKey,r?.previousPreferences),(0,u.handleError)(e,"updateWalletPreferences",F)},M[20]=F,M[21]=L,M[22]=R):R=M[22],M[23]!==x||M[24]!==R||M[25]!==P?(T={mutationKey:s.queryKeys[c.QueryKey.Account].walletPreferences._def,mutationFn:y,retry:3,retryDelay:S,onMutate:P,onSettled:x,onError:R},M[23]=x,M[24]=R,M[25]=P,M[26]=T):T=M[26];let{mutateAsync:J}=(0,n.useMutation)(T);M[27]!==J?(D=(e,t,r,n)=>J({id:e,gasPreference:t,customGasPrice:r,advancedMode:n}),M[27]=J,M[28]=D):D=M[28];let z=D;return M[29]!==B||M[30]!==H||M[31]!==Q||M[32]!==z?(O={accountPreferences:B,updateAccountPreferences:Q,accountWalletPreferences:H,updateAccountWalletPreferences:z},M[29]=B,M[30]=H,M[31]=Q,M[32]=z,M[33]=O):O=M[33],O};function v(){return g()}function b(e){return Math.min(e>1?2**e*1e3:1e3,3e4)}function C(e){return Math.min(e>1?2**e*1e3:1e3,3e4)}function S(e){return Math.min(e>1?2**e*1e3:1e3,3e4)}let _=async({attemptSignIn:e,signOutOfGamma:t})=>{let r=await e();if("failure"!==r.status||!("code"in r.error&&409===r.error.code))return r;d.logger.warn("[signInWithConflictRecovery] auth.login returned 409, clearing session and retrying",{event:"conflict_recovery_invoked"});try{await t()}catch(e){d.logger.warn("[signInWithConflictRecovery] gamma logout before retry failed; continuing to retry",{errorMessage:e instanceof Error?e.message:String(e)})}return e()};e.s(["signInWithConflictRecovery",0,_],982285)},237909,179116,e=>{"use strict";e.s(["default",()=>A,"updateComplianceTimestamps",()=>C],237909);var t=e.i(846574),r=e.i(608114),n=e.i(728056),a=e.i(842187),i=e.i(45806),o=e.i(566344),s=e.i(910233),c=e.i(501596),l=e.i(521280),u=e.i(822150),d=e.i(681663),h=e.i(910044);let f=e=>{h.axios.post("/api/account/profile/invalidate",{previousUsername:e}).catch(e=>
1d.logger.warn("Failed to invalidate profile cache",{error:e}))};e.s(["invalidateProfileCache",0,f],179116);var p=e.i(396866),g=e.i(820399),m=e.i(579533),y=e.i(606647),w=e.i(590672);let v=function(e,t,r){var n;return null==e?e:(n="function"==typeof r?r:w.default,(0,y.default)(e,t,n((0,m.default)(e,t)),void 0))},b="polymarket.account.metadataMap",C=async e=>{let t=await (0,c.getGammaClient)().profiles.update({id:e.profileId,userId:e.userId,...e.termsAcceptedAt&&{termsAcceptedAt:e.termsAcceptedAt},...e.viewOnlyAcknowledgedAt&&{viewOnlyAcknowledgedAt:e.viewOnlyAcknowledgedAt}});if("failure"===t.status)throw d.logger.error("[useAccountProfile > updateComplianceTimestamps]",{error:t.error,variables:e}),t.error},S=async e=>{let t=await fetch("/api/account/profile/image",{method:"PUT",body:e,credentials:"same-origin"});if(!t.ok){let e=Error(`Request failed with status code ${t.status}`);throw e.status=t.status,e}return(await t.json()).profileImage},_=async e=>{let{profileId:t,userId:r,username:n,bio:a,hasPhotoToUpload:i,formData:o}=e,s=i?await S(o):void 0,l=await (0,c.getGammaClient)().profiles.update({id:t,userId:r,...!!n&&{name:n},...void 0!==a&&{bio:a},...s&&{profileImage:s}});if("failure"===l.status)throw d.logger.error("[useAccountProfile > updateAccountProfileFull]",{error:l.error,variables:e}),l.error;return{profile_image:s,username:n,bio:a}},A=(e,c)=>{let d,h,m,y,w,C,S,A,I,k,x,P,R,T,D,O,M=(0,t.c)(45);M[0]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.createServerQueryClient)(),M[0]=d):d=M[0];let L=d,{mutateAccountMetadataMap:U}=(()=>{let e=(0,g.useQueryClient)(),{data:t}=(0,n.useQuery)({queryKey:o.queryKeys[s.QueryKey.Tracking].metadataMap().queryKey,queryFn:async()=>{let e=localStorage.getItem(b);return e?JSON.parse(e):{}},refetchOnWindowFocus:!1,refetchOnReconnect:!1,staleTime:1e4}),{mutate:a}=(0,r.useMutation)({mutationFn:async t=>{let r=e.getQueryData(o.queryKeys[s.QueryKey.Tracking].metadataMap().queryKey),n=Date.now(),a=r?v(r,t.address.toLowerCase(),e=>{let r=Date.now();return{...e,lastSeen:t.injectedTimestamps?.lastSeen!==void 0?t.injectedTimestamps.lastSeen:e.lastSeen??r,lastRefreshed:t.injectedTimestamps?.lastRefreshed!==void 0?t.injectedTimestamps.lastRefreshed:e.lastRefreshed??r}}):{[t.address.toLowerCase()]:{lastSeen:t.injectedTimestamps?.lastSeen??n,lastRefreshed:t.injectedTimestamps?.lastRefreshed??n}};return localStorage.setItem(b,JSON.stringify(a)),e.invalidateQueries({queryKey:o.queryKeys[s.QueryKey.Tracking].metadataMap._def}),a}});return(0,i.useMemo)(()=>({accountMetadataMap:t,mutateAccountMetadataMap:a}),[t,a])})();M[1]===Symbol.for("react.memo_cache_sentinel")?(h=["isSessionLoading","authenticated","proxyAddress","isUserOnboarding"],M[1]=h):h=M[1];let{isSessionLoading:N,authenticated:j,proxyAddress:K,isUserOnboarding:W}=(0,l.useAccountContext)(h);e?.isSessionLoading;let F=e?.isSessionLoading!==void 0?e?.isSessionLoading:N;M[2]!==j||M[3]!==e?.authenticated?(m=()=>e?.authenticated!==void 0?e?.authenticated:j,M[2]=j,M[3]=e?.authenticated,M[4]=m):m=M[4],e?.authenticated,M[5]!==m?(y=m(),M[5]=m,M[6]=y):y=M[6];let q=y;e?.proxyAddress;let $=e?.proxyAddress!==void 0?e?.proxyAddress:K;M[7]!==e?.isOnboarding||M[8]!==W?(w=()=>e?.isOnboarding!==void 0?e?.isOnboarding:W,M[7]=e?.isOnboarding,M[8]=W,M[9]=w):w=M[9],e?.isOnboarding,M[10]!==w?(C=w(),M[10]=w,M[11]=C):C=M[11];let G=C;c?.enabled;let B=c?.enabled||!F&&!G&&q&&!!$;M[12]!==B?(S={...p.accountProfileQueryOptions,enabled:B},M[12]=B,M[13]=S):S=M[13];let{data:H,refetch:Q,isPending:J}=(0,n.useQuery)(S),z=H?.address,V=H?.lastRefreshed,Z=H?.lastSeen;M[14]!==z||M[15]!==V||M[16]!==Z||M[17]!==c?.enableCallbacks||M[18]!==U?(A=()=>{c?.enableCallbacks&&z&&(V||Z)&&U({address:z,injectedTimestamps:{lastSeen:Z,lastRefreshed:V}})},M[14]=z,M[15]=V,M[16]=Z,M[17]=c?.enableCallbacks,M[18]=U,M[19]=A):A=M[19];let Y=c?.enableCallbacks;M[20]!==z||M[21]!==V||M[22]!==Z||M[23]!==U||M[24]!==Y?(I=[z,V,Z,Y,U],M[20]=z,M[21]=V,M[22]=Z,M[23]=U,M[24]=Y,M[25]=I):I=M[25],(0,i.useEffect)(A,I),M[26]===Symbol.for("react.memo_cache_sentinel")?(k=o.queryKeys[s.QueryKey.Account].profile(),M[26]=k):k=M[26],M[27]!==H?(x=async e=>{let t=H??await (0,p.accountProfileFetcher)();return _({profileId:t.profile.toString(),userId:t.userId,...e})},M[27]=H,M[28]=x):x=M[28],M[29]===Symbol.for("react.memo_cache_sentinel")?(P=e=>{let t=L.getQueryData(o.queryKeys[s.QueryKey.Account].profile().queryKey),r={...t,...e};return L.setQueryData(o.queryKeys[s.QueryKey.Account].profile().queryKey,r),{previousProfile:t}},M[29]=P):P=M[29],M[30]!==Q?(R=async(e,t,r)=>{let n=r?.previousProfile?.username;f(t.username&&n&&t.username!==n?n:void 0),await Q()},M[30]=Q,M[31]=R):R=M[31],M[32]!==$?(T=(e,t,r)=>(L.setQueryData(o.queryKeys[s.QueryKey.Account].profile().queryKey,r?.previousProfile),(0,u.handleError)(e,"updateAccountUsernamePublic",$),e),M[32]=$,M[33]=T):T=M[33],M[34]!==x||M[35]!==R||M[36]!==T?(D={mutationKey:k.queryKey,mutationFn:x,retry:1,retryDelay:E,onMutate:P,onSuccess:R,onError:T},M[34]=x,M[35]=R,M[36]=T,M[37]=D):D=M[37];let{mutateAsync:X,isPending:ee}=(0,r.useMutation)(D),et=!!H?.loggedIn;return M[38]!==Q||M[39]!==J||M[40]!==ee||M[41]!==H||M[42]!==et||M[43]!==X?(O={accountProfile:H,getAccountProfile:Q,isAccountProfilePending:J,updateProfile:X,isPendingUpdateProfile:ee,loggedIn:et},M[38]=Q,M[39]=J,M[40]=ee,M[41]=H,M[42]=et,M[43]=X,M[44]=O):O=M[44],O};function E(e){return Math.min(e>1?2**e*1e3:1e3,3e4)}},981239,942373,203111,46065,110452,e=>{"use strict";e.s(["default",()=>q,"useIsFavoriteEvent",()=>F],981239);var t=e.i(846574),r=e.i(224098),n=e.i(608114),a=e.i(728056),i=e.i(820399),o=e.i(137432),s=e.i(45806),c=e.i(501596),l=e.i(871554),u=e.i(355664),d=e.i(40494),h=e.i(828760);let f=()=>(0,h.useGeoStore)(p);function p(e){return e.hasFetchedLocation&&e.isUsa}e.s(["useIsUsaVisitor",0,f],942373);var g=e.i(251665),m=e.i(121964);let y="polymarket.store.us-geoblock",w="polymarket.us-geoblock.modal-dismissed",v=(0,g.create)()((0,m.persist)(e=>({modalDismissed:function(){try{return"u">typeof sessionStorage&&"1"===sessionStorage.getItem(w)}catch{return!1}}(),bannerDismissed:!1,promptSurface:null,promptHref:null,dismissModal:()=>{try{sessionStorage.setItem(w,"1")}catch{}e({modalDismissed:!0})},dismissBanner:()=>e({bannerDismissed:!0}),openPrompt:(t,r)=>e({promptSurface:t,promptHref:r??null}),closePrompt:()=>e({promptSurface:null,promptHref:null})}),{name:y,version:2,partialize:e=>({bannerDismissed:e.bannerDismissed}),migrate:e=>({bannerDismissed:!!e?.bannerDismissed})}));window.addEventListener("storage",e=>{e.key===y&&v.persist.rehydrate()}),e.s(["US_GEOBLOCK_MODAL_SESSION_KEY",0,w,"US_GEOBLOCK_STORAGE_KEY",0,y,"useUsGeoblockStore",0,v],203111);let b=(e,t)=>v.getState().openPrompt(e,t);function C(e){return e.modalDismissed}function S(e){return e.bannerDismissed}function _(e){return e.promptSurface}function A(e){return e.promptHref}e.s(["closeUsGeoblockPrompt",0,()=>v.getState().closePrompt(),"dismissUsGeoblockBanner",0,()=>
1v.getState().dismissBanner(),"dismissUsGeoblockModal",0,()=>v.getState().dismissModal(),"openUsGeoblockPrompt",0,b,"useUsGeoblockBannerDismissed",0,()=>v(S),"useUsGeoblockModalDismissed",0,()=>v(C),"useUsGeoblockPromptHref",0,()=>v(A),"useUsGeoblockPromptSurface",0,()=>v(_)],46065);var E=e.i(463659);function I(e,r){let n,a=(0,t.c)(4),i=(0,E.useAmplitudeAnalytics)();return a[0]!==i||a[1]!==r||a[2]!==e?(n=()=>{i.trackEvent(d.Events.UsGeoblockPromptOpened,{surface:e}),b(e,r?.())},a[0]=i,a[1]=r,a[2]=e,a[3]=n):n=a[3],n}function k(e){let t=f(),r=I(e);return t?r:null}e.s(["useOpenUsGeoblockModal",0,I,"useUsGeoblockPrompt",0,k],110452);var x=e.i(566344),P=e.i(910233),R=e.i(218424),T=e.i(521280),D=e.i(822150),O=e.i(681663);let M=x.queryKeys[P.QueryKey.Account].favoriteEvents().queryKey,L=async()=>{try{let e=[],t=0;for(;;){let r=await (0,c.getGammaClient)().favorites.events.list({limit:20,page:t});if("failure"===r.status)throw O.logger.error("[useFavoriteEvents > getFavoriteEventsFetcher]",{error:r.error,page:t}),r.error;let n=r.data??[];if(e.push(...n),n.length<20)break;t+=1}return e.reduce((e,t)=>(e[t.eventId]||(e[t.eventId]={favoriteId:parseInt(t.id,10)}),e),{})}catch(e){return O.logger.error("[useFavoriteEvents > getFavoriteEventsFetcher] Caught error",{error:e}),{}}},U=async e=>{try{let t=await (0,c.getGammaClient)().favorites.events.create({id:e.eventId});if("failure"===t.status)throw O.logger.error("[useFavoriteEvents > addFavoriteEventFetcher]",{error:t.error,variables:e}),t.error;return t.data}catch(t){throw O.logger.error("[useFavoriteEvents > addFavoriteEventFetcher] Caught error",{error:t,variables:e}),t}},N=async e=>{try{let t=await (0,c.getGammaClient)().favorites.events.delete({id:e.id});if("failure"===t.status)throw O.logger.error("[useFavoriteEvents > removeFavoriteEventFetcher]",{error:t.error,variables:e}),t.error;return t.data}catch(t){throw O.logger.error("[useFavoriteEvents > removeFavoriteEventFetcher] Caught error",{error:t,variables:e}),t}};function j(e,r,n,a){let i,o,s=(0,t.c)(6);s[0]===Symbol.for("react.memo_cache_sentinel")?(i=["authenticated","proxyAddress","isSessionLoading","isUserOnboarding"],s[0]=i):i=s[0];let{authenticated:c,proxyAddress:l,isSessionLoading:u,isUserOnboarding:d}=(0,T.useAccountContext)(i),h=e??c,f=r??l,p=n??u,g=a??d;return s[1]!==h||s[2]!==f||s[3]!==p||s[4]!==g?(o={authenticated:h,proxyAddress:f,isSessionLoading:p,isUserOnboarding:g},s[1]=h,s[2]=f,s[3]=p,s[4]=g,s[5]=o):o=s[5],o}function K(e,n,i,o,s){let c,l,u=(0,t.c)(6),{authenticated:d,proxyAddress:h,isSessionLoading:f,isUserOnboarding:p}=j(e,n,i,o),g=!f&&d&&!!h&&!p;return u[0]!==h?(c={persist:!0,errorContext:{tag:"getFavoriteEvents",proxyAddress:h}},u[0]=h,u[1]=c):c=u[1],u[2]!==s||u[3]!==g||u[4]!==c?(l={queryKey:M,queryFn:L,enabled:g,refetchOnWindowFocus:!1,gcTime:6e5,staleTime:6e5,placeholderData:r.keepPreviousData,retry:3,meta:c,retryDelay:W,select:s},u[2]=s,u[3]=g,u[4]=c,u[5]=l):l=u[5],(0,a.useQuery)(l)}function W(e){return Math.min(e>1?2**e*1e3:1e3,3e4)}function F(e,r,n,a,i){let o,s=(0,t.c)(2);s[0]!==e?(o=t=>!!(e&&void 0!==t[e]),s[0]=e,s[1]=o):o=s[1];let{data:c}=K(r,n,a,i,o);return void 0!==c&&c}let q=(e,r,a,c)=>{let h,f=(0,t.c)(3),{data:p}=K(e,r,a,c),g=function(e,t,r,a){let c=(0,i.useQueryClient)(),{setOpen:h,setConnectorRoute:f}=(0,u.useSiwx)(),p=k("favorite"),g=(0,E.useAmplitudeAnalytics)(),{authenticated:m,proxyAddress:y}=j(e,t,r,a),w=(0,s.useCallback)(()=>c.getQueryData(M),[c]),{mutateAsync:v}=(0,n.useMutation)({mutationKey:x.queryKeys[P.QueryKey.Account].favoriteEvents._def,mutationFn:U,retry:3,retryDelay:e=>Math.min(e>1?2**e*1e3:1e3,3e4),onMutate:async e=>{let t;await c.cancelQueries({queryKey:x.queryKeys[P.QueryKey.Account].favoriteEvents._def});let r=w(),n=0;return r?(Object.keys(r).forEach(e=>{n=Math.max(r[e].favoriteId,n)}),t={...r,[e.eventId]:{eventId:e.eventId,favoriteId:n+1}}):t={[e.eventId]:{eventId:e.eventId,favoriteId:n+1}},c.setQueryData(M,t),{previousFavoriteEvents:r}},onSettled:()=>(c.invalidateQueries({queryKey:["events","homepageFilters",!0]}),c.invalidateQueries({queryKey:x.queryKeys[P.QueryKey.Account].favoriteEvents._def})),onError:(e,t,r)=>{c.setQueryData(M,r?.previousFavoriteEvents),(0,D.handleError)(e,"addFavoriteEvent",
1y)}}),{mutateAsync:b}=(0,n.useMutation)({mutationKey:x.queryKeys[P.QueryKey.Account].favoriteEvents._def,mutationFn:N,retry:3,retryDelay:e=>Math.min(e>1?2**e*1e3:1e3,3e4),onMutate:async e=>{await c.cancelQueries({queryKey:x.queryKeys[P.QueryKey.Account].favoriteEvents._def});let t=w(),r={...t};delete r[e.eventId],c.setQueryData(M,r);let n=c.getQueriesData({queryKey:[P.QueryKey.Events,"filters"],predicate:e=>{let t=e.queryKey;return!0===t[t.length-1]}}),a=[];return n.forEach(([t,r])=>{let n=-1,i=-1;for(let o=0;o<r.pages.length;o++){let s=r.pages[o],c=s?.events.findIndex(t=>String(t.id)===e.eventId)??-1;if(-1!==c){n=o,i=c,a.push([t,r]);break}}-1!==n&&-1!==i&&c.setQueryData(t,e=>{let t=[...e.pages],r={...t[n]};return r.events=[...r.events],r.events.splice(i,1),t[n]=r,{...e,pages:t}})}),{previousFavoriteEvents:t,previousFilteredEvents:a}},onSettled:()=>(c.invalidateQueries({queryKey:["events","homepageFilters",!0]}),c.invalidateQueries({queryKey:x.queryKeys[P.QueryKey.Account].favoriteEvents._def})),onError:(e,t,r)=>{r?.previousFavoriteEvents&&c.setQueryData(M,r.previousFavoriteEvents),r?.previousFilteredEvents&&r.previousFilteredEvents.forEach(([e,t])=>{c.setQueryData(e,t)}),(0,D.handleError)(e,"removeFavoriteEvent",y)}}),C=(0,s.useCallback)(async e=>{try{return await v({eventId:e})}catch(t){return O.logger.error("[useFavoriteEvents > addFavoriteEventWrapper] Caught error",{error:t,eventId:e}),null}},[v]),S=(0,s.useCallback)(async(e,t)=>{try{return await b({id:e,eventId:t})}catch(r){return O.logger.error("[useFavoriteEvents > removeFavoriteEventWrapper] Caught error",{error:r,id:e,eventId:t}),null}},[b]),{run:_}=(0,o.useThrottleFn)(async({willBeFav:e,eventId:t})=>{try{if(m&&y){if(e)return void await C(t);let r=w()?.[t];if(!r)return;await S(r.favoriteId.toString(),t)}}catch(r){O.logger.error("[useFavoriteEvents > throttledToggleFavoriteEvent] Caught error",{error:r,willBeFav:e,eventId:t})}},{wait:500});return(0,s.useCallback)(e=>{try{if(!m){if(p)return void p();let e=Date.now();(0,R.markSignupPromptOpened)("favorite",{now:e,route:"signup"}),g.trackEvent(d.Events.SignupPromptOpened,(0,R.getSignupPromptOpenedEventProperties)({source:"favorite",route:"signup"})),f(l.ConnectorRoute.SIGNUP),h(!0);return}let t=w();if(void 0===t)return;_({eventId:e,willBeFav:void 0===t[e]})}catch(t){O.logger.error("[useFavoriteEvents > toggleFavoriteEvent] Caught error",{error:t,eventId:e})}},[m,g,_,h,f,p,w])}(e,r,a,c);return f[0]!==p||f[1]!==g?(h={favoriteEvents:p,toggleFavoriteEvent:g},f[0]=p,f[1]=g,f[2]=h):h=f[2],h}},222396,e=>{"use strict";e.s(["default",()=>S]);var t=e.i(846574),r=e.i(608114),n=e.i(728056),a=e.i(820399),i=e.i(154028);e.i(45806);var o=e.i(690507),s=e.i(501596),c=e.i(566344),l=e.i(910233),u=e.i(40494),d=e.i(910044),h=e.i(521280),f=e.i(822150),p=e.i(681663),g=e.i(519216),m=e.i(237909);let y=async e=>{let t=new o.BrowserAmplitudeAnalyticsAdapter;await t.initializeAdapter(),await t.trackEvent(u.Events.VerifyEmail,{hasEmail:!!e.email});let r=await d.axios.post("/api/account/verify-emails/create",{email:e.email});return{message:r.data.message,statusCode:r.status}},w=async e=>{let t=await (0,s.getGammaClient)().verifications.delete({id:e.id});if("failure"===t.status)throw p.logger.error("[userVerifyEmails > deleteEmailVerificationFetcher]",{error:t.error,variables:e}),t.error;return{message:`Verification record deleted with id: ${e.id}`}},v=async e=>d.axios.post("/api/account/verify-emails/check",{verifyToken:e.verifyToken}),b=async()=>{let{data:e}=await d.axios.get(`${g.GAMMA_API_URL}/verification_emails`,{withCredentials:!0}),t=e.toSorted((e,t)=>(0,i.compareDesc)(new Date(e.timestamp.split("+")[0]).getTime(),new Date(t.timestamp.split("+")[0]).getTime()));if(t?.length){let{email:e,timestamp:r,verified:n,id:a}=t[0];return{email:e,timestamp:r,verified:n,id:a}}return null},C=async()=>{let{data:e}=await d.axios.get(`${g.GAMMA_API_URL}/verification_emails`,{withCredentials:!0}),t=e.toSorted((e,t)=>(0,i.compareDesc)(new Date(e.timestamp.split("+")[0]).getTime(),new Date(t.timestamp.split("+")[0]).getTime())).filter(e=>e.verified);if(t.length){let{email:e,timestamp:r,verified:n,id:a}=t[0];return{email:e,timestamp:r,verified:n,id:a}}return null},S=()=>{let e,i,o,s,u,d,p,g,b,C,S,E,I,k,x,P,R,T,D,O,M,L,U=(0,t.c)(68),N=(0,a.useQueryClient)();U[0]===Symbol.for("react.memo_cache_sentinel")?(e=["proxyAddress","authenticationType","authenticated","isUserOnboarding"],U[0]=e):e=U[0];let{proxyAddress:j,authenticationType:K,authenticated:W,isUserOnboarding:F}=(0,h.useAccountContext)(e),{accountProfile:q}=(0,m.default)(),$=W&&"eoa"===K&&!!j&&!F;U[1]!==W||U[2]!==j?(i=["/api/account/verify-emails/last",W,j],U[1]=W,U[2]=j,U[3]=i):i=U[3],U[4]!==j?(o={errorContext:{tag:"[useVerifyEmails] /api/account/verify-emails/last last verification error",proxyAddress:j}}
1,U[4]=j,U[5]=o):o=U[5],U[6]!==$||U[7]!==i||U[8]!==o?(s={queryKey:i,queryFn:_,enabled:$,staleTime:1e4,retry:!1,meta:o},U[6]=$,U[7]=i,U[8]=o,U[9]=s):s=U[9];let G=(0,n.useQuery)(s),{data:B,refetch:H}=G;U[10]!==W||U[11]!==K||U[12]!==j?(u=["/api/account/verify-emails/last-verified",W,K,j],U[10]=W,U[11]=K,U[12]=j,U[13]=u):u=U[13],U[14]!==j?(d={errorContext:{tag:"[useVerifyEmails] /api/account/verify-emails/last-verified last-verified verification error",proxyAddress:j}},U[14]=j,U[15]=d):d=U[15],U[16]!==$||U[17]!==u||U[18]!==d?(p={queryKey:u,queryFn:A,enabled:$,staleTime:1e4,retry:!1,meta:d},U[16]=$,U[17]=u,U[18]=d,U[19]=p):p=U[19];let Q=(0,n.useQuery)(p),{data:J}=Q;U[20]!==W||U[21]!==K||U[22]!==j?(g=["/api/account/verify-emails/create",W,K,j],U[20]=W,U[21]=K,U[22]=j,U[23]=g):g=U[23],U[24]!==N?(b=()=>{N.invalidateQueries({queryKey:[["/api/account/verify-emails/last"]]})},U[24]=N,U[25]=b):b=U[25],U[26]!==j?(C=e=>{(0,f.handleError)(e,"[useVerifyEmails] /api/account/verify-emails/create create verification mutation error",j)},U[26]=j,U[27]=C):C=U[27],U[28]!==g||U[29]!==b||U[30]!==C?(S={mutationKey:g,mutationFn:y,retry:!1,onSuccess:b,onError:C},U[28]=g,U[29]=b,U[30]=C,U[31]=S):S=U[31];let{mutateAsync:z}=(0,r.useMutation)(S);U[32]!==W||U[33]!==K||U[34]!==j?(E=["/api/account/verify-emails/delete",W,K,j],U[32]=W,U[33]=K,U[34]=j,U[35]=E):E=U[35],U[36]!==j?(I=e=>{(0,f.handleError)(e,"[useVerifyEmails] /api/account/verify-emails/delete delete verification mutation error",j)},U[36]=j,U[37]=I):I=U[37],U[38]!==E||U[39]!==I?(k={mutationKey:E,mutationFn:w,retry:!1,onError:I},U[38]=E,U[39]=I,U[40]=k):k=U[40];let{mutateAsync:V}=(0,r.useMutation)(k);U[41]!==W||U[42]!==K||U[43]!==j?(x=["/api/account/verify-emails/verify",W,K,j],U[41]=W,U[42]=K,U[43]=j,U[44]=x):x=U[44],U[45]!==N?(P=()=>Promise.all([N.invalidateQueries({queryKey:["/api/account/verify-emails/last"]}),N.invalidateQueries({queryKey:["/api/account/verify-emails/last-verified"]}),N.invalidateQueries({queryKey:c.queryKeys[l.QueryKey.Account].profile().queryKey})]),U[45]=N,U[46]=P):P=U[46],U[47]!==j?(R=e=>{(0,f.handleError)(e,"[useVerifyEmails] /api/account/verify-emails/verify verify verification mutation error",j)},U[47]=j,U[48]=R):R=U[48],U[49]!==x||U[50]!==P||U[51]!==R?(T={mutationKey:x,mutationFn:v,retry:!1,onSettled:P,onError:R},U[49]=x,U[50]=P,U[51]=R,U[52]=T):T=U[52];let{mutateAsync:Z}=(0,r.useMutation)(T);U[53]!==q||U[54]!==z?(D=e=>z({email:e,userId:q.userId}),U[53]=q,U[54]=z,U[55]=D):D=U[55];let Y=D;U[56]!==V?(O=e=>V({id:e}),U[56]=V,U[57]=O):O=U[57];let X=O;U[58]!==Z?(M=e=>Z({verifyToken:e}),U[58]=Z,U[59]=M):M=U[59];let ee=M,et=!$||!G.isPending&&!Q.isPending;return U[60]!==Y||U[61]!==X||U[62]!==H||U[63]!==B||U[64]!==J||U[65]!==et||U[66]!==ee?(L={createEmailVerification:Y,deleteEmailVerification:X,verifyEmail:ee,getLastEmail:H,lastEmail:B,lastVerifiedEmail:J,verificationQueriesReady:et}
1,U[60]=Y,U[61]=X,U[62]=H,U[63]=B,U[64]=J,U[65]=et,U[66]=ee,U[67]=L):L=U[67],L};function _(){return b()}function A(){return C()}},452284,e=>{"use strict";var t=e.i(846574),r=e.i(728056),n=e.i(610077),a=e.i(566344),i=e.i(910233);e.s(["useMarketPositionsValue",0,(e,o)=>{let s,c,l,u,d,h=(0,t.c)(15),f=void 0===o?15e3:o,p=!!e;h[0]!==e?(s=a.queryKeys[i.QueryKey.Positions].value(e),h[0]=e,h[1]=s):s=h[1],h[2]!==e?(c=()=>e?(0,n.positionsValueFetcher)(e):Promise.resolve(void 0),h[2]=e,h[3]=c):c=h[3],h[4]===Symbol.for("react.memo_cache_sentinel")?(l={persist:!0},h[4]=l):l=h[4],h[5]!==p||h[6]!==f||h[7]!==s.queryKey||h[8]!==c?(u={queryKey:s.queryKey,queryFn:c,enabled:p,staleTime:f,refetchOnWindowFocus:!0,refetchOnReconnect:!0,refetchInterval:3e4,meta:l},h[5]=p,h[6]=f,h[7]=s.queryKey,h[8]=c,h[9]=u):u=h[9];let{data:g,isLoading:m,isPending:y,refetch:w}=(0,r.useQuery)(u);return h[10]!==g||h[11]!==m||h[12]!==y||h[13]!==w?(d={marketPositionsValue:g,isMarketPositionsValueLoading:m,isMarketPositionsValuePending:y,refetchMarketPositionsValue:w},h[10]=g,h[11]=m,h[12]=y,h[13]=w,h[14]=d):d=h[14],d}])},84394,855611,e=>{"use strict";e.s(["default",()=>y,"getChainSpecificUsdcAddress",()=>m],84394),e.s(["default",()=>d],855611);var t=e.i(598252),r=e.i(820399),n=e.i(45806),a=e.i(161469),i=e.i(745507),o=e.i(846574),s=e.i(728056),c=e.i(566344),l=e.i(910233),u=e.i(519216);let d=(e,t)=>{let n,a,d,h,f=(0,o.c)(12),p=(0,r.useQueryClient)(),{proxyAddress:g}=(0,i.useAccountState)(),m=e??u.MATIC_CONFIG.chainId;f[0]!==m||f[1]!==g?(n=c.queryKeys[l.QueryKey.PendingTransactions].count(g,m),f[0]=m,f[1]=g,f[2]=n):n=f[2],f[3]!==m||f[4]!==g||f[5]!==p?(a=()=>p.getQueryData(c.queryKeys[l.QueryKey.PendingTransactions].count(g,m).queryKey)||0,f[3]=m,f[4]=g,f[5]=p,f[6]=a):a=f[6];let y=!!g&&(void 0===t||t);f[7]===Symbol.for("react.memo_cache_sentinel")?(d={persist:!0},f[7]=d):d=f[7],f[8]!==n.queryKey||f[9]!==a||f[10]!==y?(h={queryKey:n.queryKey,queryFn:a,enabled:y,refetchOnWindowFocus:!0,refetchOnReconnect:!0,gcTime:864e5,meta:d,placeholderData:0},f[8]=n.queryKey,f[9]=a,f[10]=y,f[11]=h):h=f[11];let{data:w}=(0,s.useQuery)(h);return w||0};var h=e.i(957705),f=e.i(681663),p=u,g=e.i(664009);let m=e=>{switch(e){case 1:return h.ETHEREUM_USDC_ADDRESS;case 137:return h.USDC_ADDRESS;case 80001:return h.MUMBAI_TEST_USDC_ADDRESS;default:throw Error(`Unsupported chainId: ${e}`)}},y=(e,o=p.MATIC_CONFIG.chainId,s={})=>{let u=(0,r.useQueryClient)(),{proxyAddress:h,isSessionLoading:y}=(0,i.useAccountState)(),{disablePendingTxnSubscription:w,...v}=s,b=d(o,!w),C=(0,n.useRef)(void 0),S=e??h,{data:_,isFetching:A,isLoading:E,isPending:I,isFetched:k,isSuccess:x}=(0,g.default)(S??t.zeroAddress,m(o),o,p.USDC_DECIMALS,{...v,pendingTxnCount:b,...void 0===v.staleTime&&0===b&&{staleTime:3e5},enabled:(v.enabled??!0)&&!!S});(0,n.useEffect)(()=>{if(!S||_.current>=0){C.current=void 0;return}let e=[S,o,_.current,_.pending,b].join(":");C.current!==e&&(C.current=e,f.logger.warn("[useTrackedProxyUSDCBalance] negative cash balance",{proxyAddress:S,chainId:o,current:_.current,pending:_.pending,pendingTxnCount:b,isFetched:k,isFetching:A}))},[S,o,_,b,k,A]);let P=(0,n.useCallback)(async()=>{0===b&&await u.invalidateQueries({queryKey:c.queryKeys[l.QueryKey.TokenBalance].token(e??h??t.zeroAddress,m(o),o).queryKey})},[b,u,o,e,h]),R=(0,n.useMemo)(()=>({pendingBalance:(0,a.formatCurrency)(_.pending,{decimals:2}),currentBalance:(0,a.formatCurrency)(_.current>1e3?Math.round(_.current):_.current,{decimals:2}),presentationalPendingBalance:(0,a.formatCurrency)(Math.abs(_.pending),{decimals:2}),pendingDirectionDescription:_.pending>.001?"Incoming USDC":_.pending<-.001?"Outgoing USDC":"Pending USDC"}),[_]),T=(0,n.useMemo)(()=>b>0&&Math.abs(_.pending)>.001,[b,_]);return{trackedProxyUsdcBalance:_,proxyUsdcBalanceMetadata:R,refreshTrackedProxyUsdcBalance:P,hasPendingProxyUsdcBalance:T,isProxyUsdcBalanceLoading:E||y,isProxyUsdcBalancePending:I||y,isProxyUsdcBalanceFetching:A,isProxyUsdcBalanceFetched:k,isProxyUsdcBalanceSuccess:x}}},664009,e=>{"use strict";var t=e.i(846574),r=e.i(15165),n=e.i(728056),a=e.i(820399),i=e.i(167058),o=e.i(134320),s=e.i(566344),c=e.i(910233),l=e.i(519216);let u=async(e,t,n)=>{let a=(0,o.createChainAwarePublicClient)(),s=await a.readContract({address:t,abi:i.erc20Abi,functionName:"balanceOf",args:[e]});return{current:parseFloat(parseFloat((0,r.formatUnits)(s||0n,n)).toFixed(6)),pending:0}};e.s(["default",0,(e,r,i,o,d)=>{let h,f,p,g,m,y,w,v,b,C,S=(0,t.c)(32),_=(0,a.useQueryClient)(),A=i??l.MATIC_CONFIG.chainId,E=o??6;S[0]!==e||S[1]!==A||S[2]!==r?(h=s.queryKeys[c.QueryKey.TokenBalance].token(e,r,A),S[0]=e,S[1]=A,S[2]=r,S[3]=h):h=S[3];let I=h.queryKey;S[4]!==d?(f=d??{}
1,S[4]=d,S[5]=f):f=S[5],S[6]!==f?({pendingTxnCount:p,...g}=f,S[6]=f,S[7]=p,S[8]=g):(p=S[7],g=S[8]),S[9]!==e||S[10]!==E||S[11]!==p||S[12]!==_||S[13]!==I||S[14]!==r?(m=async()=>{let t=await u(e,r,E),n=_.getQueryData(I);return(({current:e,cachedBalance:t,preservePendingOverlay:r})=>({current:e,pending:r?t?.pending??0:0}))({current:t.current,cachedBalance:n,preservePendingOverlay:(p??0)>0})},S[9]=e,S[10]=E,S[11]=p,S[12]=_,S[13]=I,S[14]=r,S[15]=m):m=S[15],S[16]===Symbol.for("react.memo_cache_sentinel")?(y={persist:!0},S[16]=y):y=S[16];let k=g?.enabled??!0;S[17]===Symbol.for("react.memo_cache_sentinel")?(w={current:0,pending:0},S[17]=w):w=S[17],S[18]!==g||S[19]!==I||S[20]!==m||S[21]!==k?(v={queryKey:I,queryFn:m,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!0,refetchInterval:1e4,gcTime:864e5,staleTime:15e3,meta:y,...g,enabled:k,placeholderData:w},S[18]=g,S[19]=I,S[20]=m,S[21]=k,S[22]=v):v=S[22];let{data:x,isLoading:P,isPending:R,isFetching:T,isFetched:D,isSuccess:O}=(0,n.useQuery)(v);S[23]!==x?(b=x??{current:0,pending:0},S[23]=x,S[24]=b):b=S[24];let M=b;return S[25]!==D||S[26]!==T||S[27]!==P||S[28]!==R||S[29]!==O||S[30]!==M?(C={data:M,isLoading:P,isPending:R,isFetching:T,isFetched:D,isSuccess:O},S[25]=D,S[26]=T,S[27]=P,S[28]=R,S[29]=O,S[30]=M,S[31]=C):C=S[31],C},"tokenBalanceFetcher",0,u])},466954,e=>{"use strict";var t=e.i(256750);let r={account_created:"client_account_created",email_verified:"client_email_verified",newsletter_subscribed:"client_newsletter_subscribed",logged_in:"client_logged_in",session_started:"client_session_started",deposit_succeeded:"client_deposit_succeeded",trade_started:"client_trade_started",trade_executed:"client_trade_executed",trade_failed:"client_trade_failed",limit_order_initiated:"client_limit_order_placed",limit_order_filled:"client_limit_order_filled",fees_viewed:"client_fees_viewed",rewards_viewed:"client_rewards_viewed",taker_tier_badge_hovered:"client_taker_tier_badge_hovered",market_shared:"client_market_shared",market_searched:"client_market_searched",event_bookmarked:"client_event_bookmarked",watchlist_added:"client_watchlist_added",watchlist_removed:"client_watchlist_removed"};e.s(["trackClientEvent",0,function(e,n){(0,t.trackEvent)(r[e],n)}])},361381,187511,701095,139335,635791,900579,855348,e=>{"use strict";e.s(["FunkitContextProvider",()=>q,"useFunkitContext",()=>z],900579),e.s(["ComplianceEffects",()=>C],635791),e.s(["getProfileEmail",()=>i,"getTrackingEmail",()=>o,"useTrackingEmail",()=>s],361381);var t=e.i(846574),r=e.i(669718),n=e.i(237909),a=e.i(556784);function i(e){let t=e?.email;if(t)return t.startsWith(a.OAUTH_EMAIL_PREFIX)?t.substring(a.OAUTH_EMAIL_PREFIX.length):t}function o(e){let t=(0,r.createWalletCache)(),n=t.email.value;if(n)return n;let a=t.state.oauth?.email;return a||i(e)}function s(){let e,r=(0,t.c)(2),{accountProfile:a}=(0,n.default)();return r[0]!==a?(e=o(a),r[0]=a,r[1]=e):e=r[1],e}var c=e.i(534246),l=e.i(45806),u=e.i(871586);let d=[3e4,6e5,18e5,36e5,72e5],h=e=>(window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e)}),f=()=>navigator.onLine,p=()=>!1;e.s(["useSessionHealthObservability",0,function({accountKey:e,emit:t,gammaStatus:r,gammaAuthType:n,isLoggedIn:a,authenticated:i,isSessionLoading:o,authenticationStatus:s,connectorStatus:g,walletStatus:m,hasWalletAddress:y,walletMatchesGamma:w,walletRecoveryRequired:v,isInteractiveAuth:b}){let C=(0,c.useDocumentVisibility)(),S=(0,l.useSyncExternalStore)(h,f,p),_=(0,l.useRef)(void 0);(0,l.useEffect)(()=>{let c,l=performance.now(),h="visible"===C&&!0===S,f="success"===r&&a&&!!e,p={gammaStatus:r,gammaAuthType:n,isLoggedIn:a,authenticated:i,isSessionLoading:o,authenticationStatus:s,connectorStatus:g,walletStatus:m,hasWalletAddress:y,walletMatchesGamma:w,walletRecoveryRequired:v,isInteractiveAuth:b},A=(e,r,n={},a=p)=>{t(r,{healthSchemaVersion:1,durationMilestoneVersion:1,thresholdMs:3e4,observationId:e.id,wasAuthenticated:e.wasAuthenticated,...a,...n})},E=(e,t,r,n)=>{let a=d[t.nextMilestoneIndex];for(;void 0!==a&&r>=a;){t.nextMilestoneIndex+=1;let i=3e4===a;A(e,i?"session_health_stalled":"session_health_stall_milestone",{stallId:t.id,stallKind:t.kind,...i?{}:{milestoneMs:a},elapsedMs:Math.round(n-t.startedAt),visibleOnlineMs:Math.round(r)},e.snapshot),a=d[t.nextMilestoneIndex]}return a},I=(e,t,r=p)=>{let n=e.stall;n&&n.nextMilestoneIndex>0&&A(e,"session_health_stall_ended",{stallId:n.id,stallKind:n.kind,outcome:t,elapsedMs:Math.round(l-n.startedAt),visibleOnlineMs:Math.round(n.visibleOnlineMs)},r),e.stall=void 0},k=_.current;if(k?.stall&&k.stall.nextMilestoneIndex>0&&E(k,k.stall,k.stall.visibleOnlineMs,l),k&&k.accountKey!==e&&(I(k,e?"account_changed":"gamma_unconfirmed",e?k.snapshot:p),_.current=k=void 0),!k&&f&&h&&(_.current=k={accountKey:e,id:(0,u.createDiagnosticId)(),wasAuthenticated:i,snapshot:p},A(k,"session_health_observed")),!k)return;
1if(k.snapshot=p,k.wasAuthenticated||=i,!f||b||i)return void I(k,f?i?"authenticated":"interactive_auth":"gamma_unconfirmed");let x=o?"session_loading":"account_unavailable";k.stall&&k.stall.kind!==x&&I(k,"state_changed");let P=k.stall??={id:(0,u.createDiagnosticId)(),kind:x,startedAt:l,visibleOnlineMs:0,nextMilestoneIndex:0};if(!h)return;let R=()=>{if("visible"!==document.visibilityState||!navigator.onLine)return;let e=performance.now(),t=P.visibleOnlineMs+e-l,r=E(k,P,t,e);void 0!==r&&(c=setTimeout(R,r-t))};return R(),()=>{clearTimeout(c),P.visibleOnlineMs+=performance.now()-l}},[e,t,r,n,a,i,o,s,g,m,y,w,v,b,C,S])}],187511);var g=e.i(355664),m=e.i(90679);function y(){let e,r=(0,t.c)(2),n=(0,m.usePathname)();return r[0]!==n?(e="/perps"===n||n.startsWith("/perps/"),r[0]=n,r[1]=e):e=r[1],e}e.s(["useIsPerpsRoute",0,y],701095);var w=e.i(828760),v=e.i(64260);let b=({isUsa:e,isFrance:t,isUk:r,isOntario:n,isQuebec:a,isBritishColumbia:i,isAlberta:o,isCloseOnlyCountry:s})=>e||t||n||a||i||o||r||s;function C(){let e,r,a,i,o,s,c,u,d,h,f=(0,t.c)(49),{accountProfile:p}=(0,n.default)(),m=(0,w.useGeoStore)(U),C=(0,w.useGeoStore)(L),N=(0,w.useGeoStore)(M),j=(0,w.useGeoStore)(O),K=(0,w.useGeoStore)(D),W=(0,w.useGeoStore)(T),F=(0,w.useGeoStore)(R),q=(0,w.useGeoStore)(P),$=(0,w.useGeoStore)(x),{open:G}=(0,g.useSiwx)(),B=y(),H=(0,v.useComplianceStore)(k),Q=(0,v.useComplianceStore)(I),J=(0,v.useComplianceStore)(E),z=(0,v.useComplianceStore)(A),V=(0,v.useComplianceStore)(_),Z=(0,v.useComplianceStore)(S),Y=l.default.useRef(!1),X=l.default.useRef(!1),[ee,et]=l.default.useState(!1),[er,en]=l.default.useState(!1),[ea,ei]=l.default.useState(!1);f[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{en(!!window.localStorage.getItem(v.NON_US_IP_LS)),ei(!!window.localStorage.getItem(v.US_IP_VIEW_ONLY_LS))},r=[],f[0]=e,f[1]=r):(e=f[0],r=f[1]),l.default.useEffect(e,r);let eo=!!p?.termsAcceptedAt||er,es=!!p?.viewOnlyAcknowledgedAt||ea;f[2]!==eo||f[3]!==Q||f[4]!==H?(a=()=>{H(!eo),Q(!0)},i=[eo,H,Q],f[2]=eo,f[3]=Q,f[4]=H,f[5]=a,f[6]=i):(a=f[5],i=f[6]),l.default.useEffect(a,i),f[7]!==p||f[8]!==J?(o=()=>{window.localStorage.getItem(v.PROOF_OF_RESIDENCE_LS)&&(X.current=!0,et(!0)),p&&!X.current&&(X.current=!0,p.isCertReq&&(window.localStorage.setItem(v.PROOF_OF_RESIDENCE_LS,"true"),J(!0)),et(!0))},s=[p,J],f[7]=p,f[8]=J,f[9]=o,f[10]=s):(o=f[9],s=f[10]),l.default.useEffect(o,s),f[11]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{ei(!!window.localStorage.getItem(v.US_IP_VIEW_ONLY_LS))},f[11]=c):c=f[11],f[12]!==Z?(u=[Z],f[12]=Z,f[13]=u):u=f[13],l.default.useEffect(c,u),f[14]!==p||f[15]!==ee||f[16]!==es||f[17]!==m||f[18]!==q||f[19]!==F||f[20]!==$||f[21]!==N||f[22]!==K||f[23]!==B||f[24]!==W||f[25]!==G||f[26]!==j||f[27]!==C||f[28]!==z||f[29]!==V?(d=()=>{if(m&&p?.address&&!G&&!B&&ee&&!Y.current){if(V)return;let e=!!p?.profileCreationTime&&Date.now()-p.profileCreationTime>864e5;if(es||e||!b({isUsa:C,isFrance:N,isUk:j,isOntario:K,isQuebec:W,isBritishColumbia:F,isAlberta:q,isCloseOnlyCountry:$})){Y.current=!0;return}Y.current=!0,z(!0)}},f[14]=p,f[15]=ee,f[16]=es,f[17]=m,f[18]=q,f[19]=F,f[20]=$,f[21]=N,f[22]=K,f[23]=B,f[24]=W,f[25]=G,f[26]=j,f[27]=C,f[28]=z,f[29]=V,f[30]=d):d=f[30];let ec=p?.address,el=p?.profileCreationTime;return f[31]!==ee||f[32]!==es||f[33]!==m||f[34]!==q||f[35]!==F||f[36]!==$||f[37]!==N||f[38]!==K||f[39]!==B||f[40]!==W||f[41]!==G||f[42]!==j||f[43]!==C||f[44]!==z||f[45]!==V||f[46]!==el||f[47]!==ec?(h=[ee,m,C,N,j,K,W,F,q,$,G,B,ec,el,es,V,z],f[31]=ee,f[32]=es,f[33]=m,f[34]=q,f[35]=F,f[36]=$,f[37]=N,f[38]=K,f[39]=B,f[40]=W,f[41]=G,f[42]=j,f[43]=C,f[44]=z,f[45]=V,f[46]=el,f[47]=ec,f[48]=h):h=f[48],l.default.useEffect(d,h),null}function S(e){return e.showUsIpModal}function _(e){return e.showProofOfResidenceModal}function A(e){return e.setShowUsIpModal}function E(e){return e.setShowProofOfResidenceModal}function I(e){return e.setHasSyncedTermsAcceptance}function k(e){return e.setRequiresTermsAcceptance}function x(e){return e.isCloseOnlyCountry}function P(e){return e.isAlberta}function R(e){return e.isBritishColumbia}function T(e){return e.isQuebec}function D(e){return e.isOntario}function O(e){return e.isUk}function M(e){return e.isFrance}function L(e){return e.isUsa}function U(e){return e.hasFetchedLocation}
1e.s(["shouldShowViewOnly",0,b],139335);var N=e.i(303115),j=e.i(877762),K=e.i(521280);let W=(0,j.default)(()=>e.A(594670).then(e=>e.FunkitCheckout),{loadableGenerated:{modules:[716002]},ssr:!1}),F=(0,l.createContext)({onBeginCheckout:async()=>{throw Error("FunkitContext must export an `onBeginCheckout` function.")},onBeginPerpsTransfer:async()=>{throw Error("FunkitContext must export an `onBeginPerpsTransfer` function.")},onBeginWithdrawal:async()=>{throw Error("FunkitContext must export an `onBeginWithdrawal` function.")},isCheckoutOpen:!1});function q(e){let r,n,a,i,o,s,c=(0,t.c)(16),{children:u}=e;c[0]===Symbol.for("react.memo_cache_sentinel")?(r=["authenticated"],c[0]=r):r=c[0];let{authenticated:d}=(0,K.useAccountContext)(r),[h,f]=(0,l.useState)(d),[p,g]=(0,l.useState)(Q),[m,y]=(0,l.useState)(B),[w,v]=(0,l.useState)($),[b,C]=(0,l.useState)(!1);return c[1]!==d||c[2]!==h?(n=()=>{d&&!h&&f(!0)},a=[d,h],c[1]=d,c[2]=h,c[3]=n,c[4]=a):(n=c[3],a=c[4]),(0,l.useEffect)(n,a),c[5]!==p||c[6]!==m||c[7]!==w||c[8]!==b?(i={onBeginCheckout:p,onBeginPerpsTransfer:m,onBeginWithdrawal:w,isCheckoutOpen:b},c[5]=p,c[6]=m,c[7]=w,c[8]=b,c[9]=i):i=c[9],c[10]!==h?(o=h?(0,N.jsx)(W,{onCheckoutOpenChange:C,onSetBeginCheckout:e=>{g(()=>e)},onSetBeginPerpsTransfer:e=>{y(()=>e)},onSetBeginWithdrawal:e=>{v(()=>e)}}):null,c[10]=h,c[11]=o):o=c[11],c[12]!==u||c[13]!==i||c[14]!==o?(s=(0,N.jsxs)(F.Provider,{value:i,children:[o,u]}),c[12]=u,c[13]=i,c[14]=o,c[15]=s):s=c[15],s}function $(){return G}function G(){}function B(){return H}function H(){}function Q(){return J}function J(){}let z=()=>(0,l.useContext)(F);var V=e.i(285952),Z=e.i(479295);e.s(["useIntercomBubble",0,()=>{if(!V.INTERCOM_ENABLED)return;let e=!!window.Intercom,t=e&&!0===window.Intercom.booted;!e||t||(0,Z.isNarrowViewport)()||(window.intercomSettings={app_id:V.INTERCOM_APP_ID,hide_default_launcher:!0},window.Intercom("boot",{app_id:V.INTERCOM_APP_ID}))}],855348)},501596,510335,676322,e=>{"use strict";var t,r,n,a,i=e.i(332124),o=e.i(364331);async function s(e,t=e=>e){return t(await e())}async function c(e,{select:t=e=>e,transformError:r=e=>e}={}){try{return await s(e,t)}catch(e){throw r(e)}}var l=e.i(371857);class u{}class d extends Error{type;name;cause;constructor(e){super(e.message),this.type=e.type,this.name=e.name,this.cause=e.cause,e.stack&&(this.stack=e.stack),Object.setPrototypeOf(this,new.target.prototype)}}let h=200,f=404,p=-1,g=e=>{let t=e?.code??e?.response?.status;if(void 0!==t&&"number"==typeof t)return t;if(void 0!==t&&"string"==typeof t){let e=parseInt(t,10);if(Number.isFinite(e)&&!Number.isNaN(e))return e}return p},m="RestError";class y extends d{code;url;method;path;statusText;response;constructor({type:e,name:t,message:r,stack:n,cause:a,code:i,url:o,method:s,path:c,statusText:l,response:u}){super({type:e,name:t,message:r,stack:n,cause:a}),this.code=i,this.url=o,this.method=s,this.path=c,this.statusText=l,this.response=u}static castFromError(e,t={}){let{type:r=m,name:n="RestError",...a}=t;return new y({type:r,name:e.name??n,message:e.message,stack:e.stack,cause:e,code:g(e),...a})}static castFromUnknownError(e,t={}){let{type:r=m,name:n="RestError",...a}=t;return new y({type:r,name:n,message:"An unknown error occurred",cause:e,code:p,...a})}static init(e,t={}){return e instanceof Error?y.castFromError(e,t):y.castFromUnknownError(e,t)}static instanceOf(e){return e instanceof y}}let w=(e,t)=>{if(!t)return e;let r=t.startsWith("Bearer ")?t:`Bearer ${t}`;if("u">typeof Headers&&e instanceof Headers)return e.set("Authorization",r),e;if(Array.isArray(e)){let t=Object.fromEntries(e);return t.Authorization=r,t}return{...e,Authorization:r}},v=e=>(0,l.isAxiosError)(e)?new y({type:m,name:e.name??"RestError",message:e.message,stack:e.stack,cause:e,code:(e=>{if((0,l.isAxiosError)(e)){if(e.code){let t=parseInt(e.code,10);if(Number.isFinite(t)&&!Number.isNaN(t))return t}if(e.response?.status&&Number.isFinite(e.response.status)&&!Number.isNaN(e.response.status))return e.response.status}return g(e)})(e),statusText:e.response?.statusText,url:e.config?.url,method:e.config?.method,response:e.response?.data,transport:"axios"}):y.init(e,{transport:"axios"});class b extends u{instance;constructor({instance:e,...t}){super(),this.instance=e??this.createAxiosInstance(t)}execute(e,t,r={}){return c(...this.bindRequest(e,t,r))}bindRequest(e,t,r){return[async()=>{let n=((e,t,r)=>{if("post"===e||"put"===e){let{headers:e,auth:n,params:a,body:i,...o}=r;return[t,i,{headers:w(e,n?.token),...n?.credentialed&&{withCredentials:!0},params:a,...o}]}let{headers:n,auth:a,params:i,...o}=r;return[t,{headers:w(n,a?.token),withCredentials:a?.credentialed,params:i,...o}]})(e,t,r);return await this.instance[e](...n)},{select:e=>({status:e.status,data:e.data}),transformError:v}]}createAxiosInstance({url:e,options:t}){return(0,l.create)({baseURL:e,...t})}}class C{transport;constructor(e){this.transport=new b({url:e.url,...e.transport.options})}async get({path:e,options:t={}}){return this.transport.execute("get",e,t)}async put({path:e,options:t}){return this.transport.execute("put",e,t)}async post({path:e,options:t}){return this.transport.execute("post",e,t)}async delete({path:e,options:t}){return this.transport.execute("delete",e,t)}}var S=((t=S||{}).Execute="ExecuteRequestError",t.Parse="ParseResponseError",t.Select="SelectResponseError",t.Callbacks="CallbacksError",t.Log="LogError",t);class _ extends y{constructor({type:e,name:t,message:r,stack:n,cause:a,code:i,url:o,method:s,path:c,statusText:l,response:u}){super({type:e,name:t,message:r,stack:n,cause:a,code:i,url:o,method:s,path:c,statusText:l,response:u})}static init(e,t={}){let{type:r="RequestError",name:n="RequestError",...a}=t,i=y.init(e,{type:r,name:n,...a});return _.castRestError(i)}static instanceOf(e){return e instanceof _}static castRestError(e){return new _(e)}}async function A({operation:e,request:t,parse:r,log:n},a,i,o){let s=S.Execute;try{let c=await t(a);s=S.Parse;let l=r(c);s=S.Select;let u=o?o(l):l;return s=S.Callbacks,i?.onSuccess?.({data:u,variables:a}),s=S.Log,n?.("info",e,{variables:a}),{status:"success",data:u}}catch(r){let t=_.instanceOf(r)?r:_.init(r,{name:s});return i?.onError?.({error:t,variables:a}),n?.("error",e,{variables:a,error:t,step:s}),{status:"failure",error:t}}}let E=e=>"object"==typeof e&&null!==e&&("select"in e||"onSuccess"in e||"onError"in e),I=(e,t)=>{var r,n;let a;return r={log:t.log,operation:e.operation,request:e=>e.execute(t),parse:t=>e.parse(t)},n=(e,t)=>A(r,e,"function"==typeof t?.onSuccess||"function"==typeof t?.onError?{onSuccess:t?.onSuccess,onError:t?.onError}:void 0,"function"==typeof t?.select?t.select:void 0),a=(e,t,r)=>n(e,((e,t)=>
1{let r=E(e)?e:void 0,n=r?{onSuccess:({data:e})=>{r.onSuccess?.({data:e,variables:t})},onError:({error:e})=>{r.onError?.({error:e,variables:t})}}:void 0,a="function"==typeof r?.select,i=!!(r?.onSuccess||r?.onError);if(a||i)return{select:r?.select,onSuccess:n?.onSuccess,onError:n?.onError}})(r,t)),(...t)=>{let{rawVariables:r,optionsArg:n}=(e=>{let[t,r]=e,n=e.length>=2||1===e.length&&void 0!==t&&!E(t);return{rawVariables:n?t:void 0,optionsArg:n?r:t}})(t);return a(0===e.length&&void 0===r?new e:new e(r),r,n)}},k=({module:e,logger:t})=>(r,n,a)=>{t&&t[r]({title:(({module:e,operation:t})=>e?`${e} > ${t}`:t)({module:e,operation:n}),message:"info"===r?"Request succeeded":"Request failed",context:a})};var x=((r={}).Intl="international",r);class P{environment;id;constructor(e){const{id:t=crypto.randomUUID(),environment:r=x.Intl}=e??{};this.environment=r,this.id=t}}class R extends P{constructor(e){super({...e,id:e?.id??crypto.randomUUID()})}}class T extends R{token;auth;variables;constructor(e){super();const t=e??{};this.variables={...t,auth:void 0,..."token"in t&&"string"==typeof t.token&&{token:t.token}},this.auth=t.auth,"token"in t&&"string"==typeof t.token?this.token=t.token:this.token=""}initializeRequest(e={}){let t,{credentialed:r=!1,initialParams:n=new URLSearchParams,exclude:a=[]}=e,i=new URLSearchParams(n);return a.includes("id")||this.auth?.id===void 0||i.set("id",this.auth.id),a.includes("address")||this.auth?.address===void 0||i.set("address",this.auth.address),this.auth?.token!==void 0&&(t=this.auth.token),this.token&&""!==this.token&&(t=this.token),{params:i,auth:{credentialed:r,...t&&{token:t}}}}}class D extends T{static operation="challenge";static parse(e){return e.data}encode(){let e=this.initializeRequest({credentialed:!0});return{path:this.path,options:{body:{siwe:{address:this.variables.address}},...e}}}execute({client:e}){return e.post(this.encode())}get path(){return"/v1/challenge"}}let O=e=>{if("string"!=typeof e?.type||!e.type||"string"!=typeof e.address||!e.address)throw Error("Invalid authentication response");return{type:"magic"===e.type?"magic":"eoa",address:e.address}};class M extends T{static operation="login";static parse(e){return O(e.data)}encode(){let e=this.initializeRequest({credentialed:!0});return{path:this.path,options:e}}execute({client:e}){return e.post(this.encode())}get path(){return"/v1/login"}}class L extends T{static operation="logout";static parse(e){return e.data}constructor(e={}){super(e)}encode(){return{path:"/logout",options:this.initializeRequest({credentialed:!0})}}execute({client:e}){return e.get(this.encode())}get path(){return"/logout"}}class U extends T{static operation="session-refresh";static parse(e){return O(e.data)}constructor(e={}){super(e)}encode(){let e={...this.initializeRequest({credentialed:!0}),...this.variables.signal&&{signal:this.variables.signal}};return{path:this.path,options:e}}execute({client:e}){return e.get(this.encode())}get path(){return"/session/refresh"}}class N extends T{static operation="session";static parse(e){return O(e.data)}constructor(e={}){super(e)}encode(){return{path:"/is-logged-in",options:this.initializeRequest({credentialed:!0})}}execute({client:e}){return e.get(this.encode())}get path(){return"/is-logged-in"}}let j=(e,t)=>void 0!==t&&e>t?t:e,K=e=>{if(0!==e.length)try{return[...e].sort((e,t)=>{let r=e.createdAt?new Date(e.createdAt).getTime():0,n=t.createdAt?new Date(t.createdAt).getTime():0;return r-n})[0]}catch{if(e.length>0)return e[0];return}},W=100,F=(e,t=W)=>{let r=Math.min(Math.max(1,t),W);return void 0===e||!Number.isFinite(e)||e<=0?r:Math.min(Math.trunc(e),W)},q=(e,t,r,n=e=>e)=>{r&&e.set(t,n(r))},$=(e,t,r,n=e=>e)=>{r&&e.append(t,n(r))},G=(e,t,r,n)=>{r&&r.forEach(r=>{$(e,t,r,n)})},B={"start-date":"startDate","start-time":"startTime","end-date":"endDate","closed-time":"closedTime",competitive:"competitive",liquidity:"liquidity",volume:"volume","daily-volume":"volume24hr"},H={monthly:"monthly",weekly:"weekly",daily:"daily",hourly:"hourly"},Q=(e,t)=>{if(Array.isArray(e))return e;if(!e)return t;try{return JSON.parse(e)}catch{return t}},J=(e,t={deduplicate:!0})=>{if(!Array.isArray(e))return[];let r=e.map(e=>
1({...e,markets:(e.markets??[]).map(({outcomes:e,outcomePrices:t,clobTokenIds:r,...n})=>({...n,outcomes:Q(e,["yes","no"]),outcomePrices:Q(t,["0.5","0.5"]),clobTokenIds:Q(r,null)}))}));if(t.deduplicate){let e=new Set,t=[];for(let n of r)e.has(n.id)||(e.add(n.id),t.push(n));return t}return r};class z extends T{static operation="list-events";static parse(e){if(Array.isArray(e.data))return{events:J(e.data),hasMore:!1,totalResults:e.data.length,tags:[]};let{data:t,pagination:r,tags:n}=e.data;return{events:J(t??[]),hasMore:!!r?.hasMore,totalResults:r?.totalResults??t?.length??0,tags:n??[]}}encode(){var e,t;let r,n,a,i,o,{params:s,...c}=this.initializeRequest({credentialed:this.variables.filters?.watchlist}),l=(e=this.variables,r=e.options??{},(n=new URLSearchParams(s)).set("limit",String(F(r.pagination?.limit,20))),a=e?.options?.overrides?.active!==void 0&&!1==!e?.options?.overrides?.active?"false":"true",i=e?.options?.overrides?.archived!==void 0&&e?.options?.overrides?.archived===!0?"true":"false",n.set("active",a),n.set("archived",i),n);return((e,t)=>{var r;let{pagination:n={}}=t??{};((e,{input:t,defaults:r,max:n})=>{let a=t?.limit??r?.limit??0,i=t?.offset??(t?.page!==void 0?t.page*a:0);e.set("offset",`${j(i,n?.offset)}`),e.set("limit",`${j(a,n?.limit)}`)})(e,{input:n,defaults:{limit:20},max:{limit:100,offset:500}});let a=(e=>{if(e)return B[e]})(t?.sort??null);void 0!==a&&q(e,"order",a),t?.sort==="competitive"&&q(e,"ascending","true");let i="asc"===(r=t?.sortDirection)||"desc"!==r&&void 0;void 0!==i&&q(e,"ascending",!0===i?"true":"false")})(l,this.variables.options),t=this.variables.filters,G(l,"id",t?.events?.include?.ids?.map(e=>`${e}`)),G(l,"slug",t?.events?.include?.slugs),G(l,"tag_slug",t?.tags?.include?.slugs),G(l,"tag_id",t?.tags?.include?.ids?.map(e=>`${e}`)),G(l,"exclude_tag_id",t?.tags?.omit?.ids?.map(e=>`${e}`)),t?.tags?.include?.ids?.length&&t.tags.related&&$(l,"related_tags","true"),G(l,"series_id",t?.series?.include?.ids?.map(e=>`${e}`)),G(l,"series_slug",t?.series?.include?.slugs),t?.sports&&(t?.sports?.games?.include?.ids?.length&&G(l,"game_id",t?.sports?.games?.include?.ids?.map(e=>`${e}`)),t?.sports?.includeBestLines&&$(l,"include_best_lines","true")),void 0!==(o=((e="active")=>"resolved"===e?"true":"active"===e?"false":void 0)(t?.status))&&q(l,"closed",o),$(l,"event_date",t?.eventDate),$(l,"event_week",t?.eventWeek?`${t?.eventWeek}`:void 0),t&&"startDate"in t&&t?.startDate&&(t?.startDate?.min&&$(l,"start_date_min",t.startDate.min),t?.startDate?.max&&$(l,"start_date_max",t.startDate.max)),t&&"startTime"in t&&t?.startTime&&(t?.startTime?.min&&$(l,"start_time_min",t.startTime.min),t?.startTime?.max&&$(l,"start_time_max",t.startTime.max)),t?.endDate&&(t?.endDate?.min&&$(l,"end_date_min",t.endDate.min),t?.endDate?.max&&$(l,"end_date_max",t.endDate.max)),t?.liquidity&&(t?.liquidity?.min&&$(l,"liquidity_min",t.liquidity.min.toString()),t?.liquidity?.max&&$(l,"liquidity_max",t.liquidity.max.toString())),t?.volume&&(t?.volume?.min&&$(l,"volume_min",t.volume.min.toString()),t?.volume?.max&&$(l,"volume_max",t.volume.max.toString())),t?.recurrence&&$(l,"recurrence",H[t.recurrence]),t?.category&&t?.category!=="all"&&$(l,"tag_slug",t?.category),t?.featured&&q(l,"featured","true"),{path:this.path,options:{params:l,...c}}}execute({client:e}){return e.get(this.encode())}get path(){return this.variables.filters?.watchlist?"/events/watchlist":"/events/pagination"}}var V=((n={}).Event="event",n);let Z=e=>({type:V.Event,id:e.id,eventId:e.event_id,userId:e.user_id,event:e.event});class Y extends T{static operation="create-favorite-event";static parse(e){let t=e.data;if(!t)throw Error("No favorite event found");return Z(t)}encode(){let e=this.initializeRequest({credentialed:!0});return{path:this.path,options:{body:{event_id:this.variables.id},...e}}}execute({client:e}){return e.post(this.encode())}get path(){return"/favorite_events"}}class X extends T{static operation="delete-favorite-event";static parse(e){return e.data}encode(){let e=this.initializeRequest({credentialed:!0});return{path:this.path,options:e}}execute({client:e}){return e.delete(this.encode())}get path(){return`/favorite_events/${this.variables.id}`}}class ee extends T{static operation="list-favorite-events";static parse(e){let t=e.data;if(!Array.isArray(t))throw Error("No favorite events found");return t.map(Z)}constructor(e={}){super(e)}encode(){let{limit:e,page:t}=this.variables,{params:r,...n}=this.initializeRequest({credentialed:!0}
1);if(e){let n=F(e);$(r,"limit",n.toString()),t&&$(r,"offset",(t*n).toString())}return{path:"/favorite_events",options:{params:r,...n}}}execute({client:e}){return e.get(this.encode())}get path(){return"/favorite_events"}}let et=(e,t=[])=>({generalEmail:{sendEmails:e},marketEmails:{sendEmails:e},newsletterEmails:{sendEmails:e},promotionalEmails:{sendEmails:e},eventEmails:{sendEmails:e,tagIds:t},orderFillEmails:{sendEmails:e,hideSmallFills:!0},resolutionEmails:{sendEmails:e}}),er=(e,t=[])=>({eventApp:{sendApp:e,tagIds:t},marketPriceChangeApp:{sendApp:e},orderFillApp:{sendApp:e,hideSmallFills:!0},resolutionApp:{sendApp:e}}),en=(e,t=!1,r=!0,n)=>{let{chartPreferences:a,emailNotificationPreferences:i=et(t,n),appNotificationPreferences:o=er(r,n),marketInterests:s=[],preferencesStatus:c="New/Existing - Created Prefs",subscriptionStatus:l=!0}=e;return{chartPreferences:a,emailNotificationPreferences:i,appNotificationPreferences:o,marketInterests:s,preferencesStatus:c,subscriptionStatus:l}},ea=e=>{var t;let r=new Date().toISOString();return{chartPreferences:(t=e.chartPreferences)?"string"==typeof t?JSON.parse(t):t:{defaultTimeScale:"1D"},createdAt:e.createdAt??r,emailNotificationPreferences:(e=>{try{if(!e)return et(!1);let t=JSON.parse(e);return{generalEmail:{sendEmails:t.generalEmail?.sendEmails??!1},marketEmails:{sendEmails:t.marketEmails?.sendEmails??!1},newsletterEmails:{sendEmails:t.newsletterEmails?.sendEmails??!1},promotionalEmails:{sendEmails:t.promotionalEmails?.sendEmails??!1},eventEmails:{sendEmails:t.eventEmails?.sendEmails??!1,tagIds:t.eventEmails?.tagIds??[]},orderFillEmails:{sendEmails:t.orderFillEmails?.sendEmails??!1,hideSmallFills:t.orderFillEmails?.hideSmallFills??!0},resolutionEmails:{sendEmails:t.resolutionEmails?.sendEmails??!1}}}catch{return et(!1)}})(e.emailNotificationPreferences),appNotificationPreferences:(e=>{try{if(!e)return er(!0);let t=JSON.parse(e);return{eventApp:{sendApp:t.eventApp?.sendApp??!0,tagIds:t.eventApp?.tagIds??[]},marketPriceChangeApp:{sendApp:t.marketPriceChangeApp?.sendApp??!0},orderFillApp:{sendApp:t.orderFillApp?.sendApp??!0,hideSmallFills:t.orderFillApp?.hideSmallFills??!0},resolutionApp:{sendApp:t.resolutionApp?.sendApp??!0}}}catch{return er(!0)}})(e.appNotificationPreferences),id:e.id,marketInterests:(e=>{try{if(!e)return[];let t=JSON.parse(e);if(Array.isArray(t))return t;return[]}catch{return[]}})(e.marketInterests),preferencesStatus:e.preferencesStatus,subscriptionStatus:e.subscriptionStatus,updatedAt:e.updatedAt??r,userID:e.userID}};class ei extends T{static operation="get";static parse(e){let t=e.data;if(!Array.isArray(t)||0===t.length)throw Error("No user preferences found");return ea(t[0])}constructor(e={}){super(e)}encode(){let e=this.initializeRequest({credentialed:!0});return{path:this.path,options:e}}execute({client:e}){return e.get(this.encode())}get path(){return"/preferences"}}class eo extends T{static operation="update";static parse(e){return e.data}encode(){let{auth:e,id:t,emailNotificationPreferences:r,appNotificationPreferences:n,marketInterests:a,...i}=this.variables,o=this.initializeRequest({credentialed:!0});return{path:this.path,options:{body:{...i,...r&&{emailNotificationPreferences:JSON.stringify(r)},...n&&{appNotificationPreferences:JSON.stringify(n)},...a&&{marketInterests:JSON.stringify(a)}},...o}}}async execute({client:e}){return e.put(this.encode())}get path(){return`/preferences/${this.variables.id}`}}let es=e=>{let{advancedMode:t=!1,customGasPrice:r="30",gasPreference:n="fast",walletPreferencesStatus:a="New/Existing - Created Wallet Prefs"}=e;return{advancedMode:t,customGasPrice:r,gasPreference:n,walletPreferencesStatus:a}},ec=e=>{if(void 0!==e)return null!==e?e:void 0},el=e=>({address:e.address,blocked:e.blocked??!1,confirmed:e.confirmed??!1,createdAt:e.createdAt,creator:e.creator??!1,email:e.email??void 0,id:e.id,isExternalAuth:e.isExternalAuth??!1,issuer:e.issuer??void 0,metamaskPreferenceID:e.metamaskPreferenceID??void 0,mod:e.mod??!1,password:e.password??void 0,preferencesID:ec(e.preferencesID),profileID:e.profileID,provider:e.provider??void 0,proxyWallet:e.proxyWallet,resetPasswordToken:e.resetPasswordToken??void 0,role:ec(e.role),updatedAt:e.updatedAt??new Date().toISOString(),userTag:e.userTag??void 0,username:e.username??void 0,walletPreferenceID:ec(e.walletPreferenceID),xUsername:e.xUsername??void 0}),eu=e=>{let t=new Date().toISOString();return{advancedMode:e.advancedMode??!1,createdAt:e.createdAt??t,customGasPrice:e.customGasPrice??"30",gasPreference:e.gasPreference??"fast",id:e.id,updatedAt:e.updatedAt??t,userID:e.userID,walletPreferencesStatus:e.walletPreferencesStatus??"New/Existing - Created Wallet Prefs"}},ed=({id:e,...t})=>({id:"string"==typeof e?parseInt(e,10):e,...t}
1),eh=e=>{let{users:t,...r}=e,n=K(t),a=n?.preferences?K(n.preferences):void 0,i=n?.walletPreferences?K(n.walletPreferences):void 0;if(n&&a)return{...ed(r),...n&&{user:el(n)},...a&&{preference:ea(a)},...i&&{walletPreference:eu(i)}}};class ef extends T{static operation="create";static parse(e){let t=eh(e.data);if(!t)throw new _({type:"RequestError",name:"ProfileParseError",code:p,message:"Failed to parse profile"});return t}encode(){let e=this.initializeRequest({credentialed:!0});return{path:this.path,options:{body:this.createCreateProfileBody(this.variables),...e}}}async execute({client:e}){let t=await e.post(this.encode());if(!t.data)throw new _({type:"RequestError",name:"ProfileNotCreated",code:t.status,message:"Profile not found"});return t}get path(){return"/profiles"}createCreateProfileBody(e){let{auth:t,authenticationType:r,user:n,preferences:a,walletPreferences:i,...o}=e,{displayUsernamePublic:s=!0,emailOptIn:c=!1,walletActivated:l=!1,...u}=o;return{displayUsernamePublic:s,emailOptIn:c,walletActivated:l,...u,...n&&{users:this.createProfileUsersProperty({authenticationType:r,emailOptIn:c,user:n,preferences:a,walletPreferences:i})}}}createProfileUsersProperty({authenticationType:e,emailOptIn:t,user:r,preferences:n,walletPreferences:a}){let{address:i,email:o="",proxyWallet:s,username:c}=r;return[{address:i,email:o,isExternalAuth:"eoa"===e,proxyWallet:s,username:c,..."eoa"===e&&{provider:"metamask"},preferences:[(e=>{let{chartPreferences:t,emailNotificationPreferences:r,appNotificationPreferences:n,marketInterests:a,...i}=e;return{...i,...t&&{chartPreferences:JSON.stringify(t)},...r&&{emailNotificationPreferences:JSON.stringify(r)},...n&&{appNotificationPreferences:JSON.stringify(n)},...a&&{marketInterests:JSON.stringify(a)}}})(en(n??{},t,!0))],..."eoa"===e&&{walletPreferences:[es(a??{})]}}]}}class ep extends T{static operation="get";static parse(e){let t=e.data?.[0];return t?eh(t)??null:null}constructor(e={}){super(e)}encode(){let e=this.initializeRequest({credentialed:!0});return{path:this.path,options:e}}async execute({client:e}){return e.get(this.encode())}get path(){return"/profiles"}}class eg extends T{static operation="get-public-profiles";static parse(e){return e.data}encode(){let e=this.initializeRequest({exclude:["address"]});return G(e.params,"address",this.variables.addresses),{path:this.path,options:e}}async execute({client:e}){return e.get(this.encode())}get path(){return"/public-profiles"}}class em extends T{static operation="update";static parse(e){return e.data}encode(){let{id:e,auth:t,userId:r,...n}=this.variables,a=this.initializeRequest({credentialed:!0});return{path:this.path,options:{body:{...n},...a}}}execute({client:e}){return e.put(this.encode())}get path(){return`/profiles/${this.variables.id}`}}var ey=e.i(106543),ew=e.i(995451),ev=e.i(767487),eb=e.i(550124);
1let eC=(0,eb.keccak256)((0,ew.encodePacked)(["string"],["polymarket-wallet-factory"])),eS=(0,eb.keccak256)("0x608060405234801561001057600080fd5b50610cc1806100206000396000f3fe60806040526004361061003f5760003560e01c806334ee9791146100445780638129fc1c1461006d578063bc197c8114610084578063f23a6e61146100b1575b600080fd5b6100576100523660046108fb565b6100d1565b6040516100649190610ad8565b60405180910390f35b34801561007957600080fd5b506100826101c2565b005b34801561009057600080fd5b506100a461009f3660046107e7565b6101fd565b6040516100649190610ae9565b3480156100bd57600080fd5b506100a46100cc3660046108a4565b61020e565b6060336100dc61021f565b6001600160a01b03161461010b5760405162461bcd60e51b815260040161010290610b08565b60405180910390fd5b815160405190808252806020026020018201604052801561014057816020015b606081526020019060019003908161012b5790505b50905060005b82518110156101bc576000606061016f85848151811061016257fe5b6020026020010151610244565b915091508161019a5761018181610350565b60405162461bcd60e51b81526004016101029190610af7565b808484815181106101a757fe5b60209081029190910101525050600101610146565b50919050565b60006101cc61021f565b6001600160a01b0316146101f25760405162461bcd60e51b815260040161010290610b18565b6101fb3361045d565b565b63bc197c8160e01b95945050505050565b63f23a6e6160e01b95945050505050565b7f734a2a5caf82146a5ddd5263d9af379f9f72724959f0567ddc9df2c40cf2cc205490565b6000606060028351600281111561025757fe5b14156102c85782602001516001600160a01b0316836060015160405161027d9190610ac5565b600060405180830381855af49150503d80600081146102b8576040519150601f19603f3d011682016040523d82523d6000602084013e6102bd565b606091505b50909250905061034b565b6001835160028111156102d757fe5b141561034b5782602001516001600160a01b0316836040015184606001516040516103029190610ac5565b60006040518083038185875af1925050503d806000811461033f576040519150601f19603f3d011682016040523d82523d6000602084013e610344565b606091505b5090925090505b915091565b6060815160001415610396575060408051808201909152601c81527f636170747572656420656d7074792072657665727420627566666572000000006020820152610458565b6308c379a06103b06103ab8460006004610481565b6104aa565b63ffffffff16146103db576040518060600160405280603f8152602001610c40603f91399050610458565b60606103f66103f184600463ffffffff6104bf16565b6104ec565b905080516000141561043d57505060408051808201909152601d81527f636170747572656420656d70747920726576657274206d6573736167650000006020820152610458565b6060818060200190516104539190810190610938565b925050505b919050565b7f734a2a5caf82146a5ddd5263d9af379f9f72724959f0567ddc9df2c40cf2cc2055565b6104896105ad565b6104938484610545565b815260208101919091526040810191909152919050565b8051602082015160009190610453828261054c565b6104c76105ad565b81835110156104d557825191505b6104e3838384865103610481565b90505b92915050565b60208082015160408051828152601f19601f8401168101909301905260609181801561051f576020820181803883390190505b508351909250600061053084610569565b905061053d81838561056f565b505050919050565b0160200190565b6000600180600884021b0380836020038503511691505092915050565b60200190565b5b6020811061058f578151835260209283019290910190601f1901610570565b600180600883602003021b0380845116811984511617845250505050565b60405180606001604052806000815260200160008152602001600081525090565b80356104e681610c12565b600082601f8301126105ea57600080fd5b81356105fd6105f882610b4f565b610b28565b81815260209384019390925082018360005b8381101561063b57813586016106258882610755565b845250602092830192919091019060010161060f565b5050505092915050565b600082601f83011261065657600080fd5b81356106646105f882610b4f565b9150818183526020840193506020810190508385602084028201111561068957600080fd5b60005b8381101561063b578161069f88826107dc565b845250602092830192919091019060010161068c565b600082601f8301126106c657600080fd5b81356106d46105f882610b70565b915080825260208301602083018583830111156106f057600080fd5b6106fb838284610bcc565b50505092915050565b80356104e681610c29565b600082601f83011261072057600080fd5b815161072e6105f882610b70565b9150808252602083016020830185838301111561074a57600080fd5b6106fb838284610bd8565b60006080828403121561076757600080fd5b6107716080610b28565b9050600061077f8484610704565b8252506020610790848483016105ce565b60208301525060406107a4848285016107dc565b604083015250606082013567ffffffffffffffff8111156107c457600080fd5b6107d0848285016106b5565b60608301525092915050565b80356104e681610c36565b
1600080600080600060a086880312156107ff57600080fd5b600061080b88886105ce565b955050602061081c888289016105ce565b945050604086013567ffffffffffffffff81111561083957600080fd5b61084588828901610645565b935050606086013567ffffffffffffffff81111561086257600080fd5b61086e88828901610645565b925050608086013567ffffffffffffffff81111561088b57600080fd5b610897888289016106b5565b9150509295509295909350565b600080600080600060a086880312156108bc57600080fd5b60006108c888886105ce565b95505060206108d9888289016105ce565b94505060406108ea888289016107dc565b935050606061086e888289016107dc565b60006020828403121561090d57600080fd5b813567ffffffffffffffff81111561092457600080fd5b610930848285016105d9565b949350505050565b60006020828403121561094a57600080fd5b815167ffffffffffffffff81111561096157600080fd5b6109308482850161070f565b60006104e383836109f6565b600061098482610b98565b61098e8185610b9c565b9350836020820285016109a085610569565b8060005b858110156109da57848403895281516109bd858261096d565b94506109c883610569565b60209a909a01999250506001016109a4565b5091979650505050505050565b6109f081610bb0565b82525050565b6000610a0182610b98565b610a0b8185610b9c565b9350610a1b818560208601610bd8565b610a2481610c08565b9093019392505050565b6000610a3982610b98565b610a438185610458565b9350610a53818560208601610bd8565b9290920192915050565b6000610a6a601783610b9c565b7f6d7573742062652063616c6c6564206265206f776e6572000000000000000000815260200192915050565b6000610aa3601383610b9c565b72185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b815260200192915050565b6000610ad18284610a2e565b9392505050565b602080825281016104e38184610979565b602081016104e682846109e7565b602080825281016104e381846109f6565b602080825281016104e681610a5d565b602080825281016104e681610a96565b60405181810167ffffffffffffffff81118282101715610b4757600080fd5b604052919050565b600067ffffffffffffffff821115610b6657600080fd5b5060209081020190565b600067ffffffffffffffff821115610b8757600080fd5b506020601f91909101601f19160190565b5190565b90815260200190565b60006104e682610bbd565b6001600160e01b03191690565b6001600160a01b031690565b90565b82818337506000910152565b60005b83811015610bf3578181015183820152602001610bdb565b83811115610c02576000848401525b50505050565b601f01601f191690565b610c1b81610ba5565b8114610c2657600080fd5b50565b60038110610c2657600080fd5b610c1b81610bc956fe6361707475726564206120726576657274206572726f722c2062757420697420646f65736e277420636f6e666f726d20746f20746865207374616e64617264a365627a7a7230582045d8d817563bf1ad2fc12429d13de585835405e2079059db7e3941a7b1bf5b6f6c6578706572696d656e74616cf564736f6c634300050a0040");var e_=e.i(85072);let eA={masterCopyAddressVersions:[{version:"1.3.0",address:"0xE51abdf814f8854941b9Fe8e3A4F65CAB4e7A4a8"}],proxyFactoryAddress:"0xaacFeEa03eb1561C4e67d661e40682Bd20E3541b",multiSendAddress:"0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761",fallbackHandlerAddress:"0xe16bA5bF81E5BB113e4752E4fdC20351d796fB24"},eE={1:eA,5:eA,137:eA,80001:eA};var eI=((a={})[a.Call=0]="Call",a[a.DelegateCall=1]="DelegateCall",a);e.s(["OperationType",()=>eI,"defaultNetworks",0,eE],510335);let ek=i.default.env.NEXT_PUBLIC_PROXY_WALLET_FACTORY_ADDRESS||"0xaB45c5A4B0c941a2F231C04C3f49182e1A254052",ex=i.default.env.NEXT_PUBLIC_EOA_PROXY_WALLET_INIT_CODE_HASH||"0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715ddb6fcecf",eP={magic:{factoryAddress:ek},eoa:{factoryAddress:i.default.env.NEXT_PUBLIC_EOA_PROXY_WALLET_FACTORY_ADDRESS||eE[137].proxyFactoryAddress,initCodeHash:ex}},eR=(e,t,r=eP)=>{if("magic"===t){var n;let t;return n=r.magic.factoryAddress,(0,ev.getCreate2Address)({from:n,salt:(0,eb.keccak256)((0,ew.encodePacked)(["address"],[e])),bytecodeHash:(0,eb.keccak256)((t=(0,ey.encodeAbiParameters)([{type:"bytes"}],["0x"]).slice(2),`0x3d3d606380380380913d393d73${n.slice(2).toLowerCase()}5af4602a57600080fd5b602d8060366000396000f3363d3d373d3d3d363d73${(0,ev.getCreate2Address)({from:n,salt:eC,bytecodeHash:eS}).slice(2).toLowerCase()}5af43d82803e903d91602b57fd5bf352e831dd${t}`))})}return(0,ev.getCreate2Address)({from:r.eoa.factoryAddress,salt:(0,eb.keccak256)((0,ey.encodeAbiParameters)((0,e_.parseAbiParameters)("address"),[e])),bytecodeHash:r.eoa.initCodeHash})};e.s(["deriveProxyAddress",0,eR],676322);class eT extends T{static operation="get";static parse(e){return e}constructor(e={}){super(e)}encode(){return{path:this.path,options:this.initializeRequest({credentialed:!0}
1)}}async execute({client:e,self:t}){let r=await this.getUser(e);if("success"===r.status){if("existing"===r.type)return{type:"existing",user:r.user};if("new"===r.type){let e=await t.users.register(this.encodeRegisterRequest(r.variables));if("success"===e.status)return{type:"new",user:e.data};throw e.error}}throw r.error}get path(){return"/users"}encodeRegisterRequest(e){return{authenticationType:e.type,address:e.address,proxyWallet:eR(e.address,e.type),auth:{token:this.token}}}async getUser(e){try{let t=await e.get(this.encode());if(t.status===h)if(t.data&&0!==t.data.length){let e=((e,t={withProfile:!0})=>{if(t.withProfile){let t=K(e.profiles);if(!t)return;let r=ed(t);if(!r)return;return{...el(e),profile:r}}return el(e)})(t.data[0],{withProfile:!0});if(e)return{status:"success",type:"existing",user:e};return{status:"failure",error:new y({type:"RestError",name:"GetUserError",code:p,message:"Failed to parse user"})}}else{if(this.variables?.register)return{status:"success",type:"new",variables:this.variables};return{status:"failure",error:new y({type:"RestError",name:"GetUserError",code:f,message:"User not found"})}}return{status:"failure",error:new y({type:"RestError",name:"GetUserError",code:t.status,message:"Failed to get user"})}}catch(e){return{status:"failure",error:e}}}}class eD extends T{static operation="register";static parse(e){let{user:t,preference:r,walletPreference:n,...a}=e;return{...t,profile:a,preferences:r,walletPreferences:n}}encode(){return{...this.extractProfile(this.variables),user:this.extractUser(this.variables),preferences:en({},this.variables.emailOptIn,!0),..."eoa"===this.variables.authenticationType&&{walletPreferences:es({})},auth:this.variables.auth}}async execute({self:e}){let t=await e.profiles.create(this.encode());if("failure"===t.status)throw t.error;return t.data}get path(){return new ef(this.encode()).path}extractUser(e){let{address:t,email:r,proxyWallet:n,username:a}=e;return{address:t,email:r,proxyWallet:n,username:a,..."eoa"===e.authenticationType&&{provider:"metamask"}}}extractProfile(e){let{username:t,pseudonym:r,emailOptIn:n=!1,proxyWallet:a}=e;return{authenticationType:e.authenticationType,displayUsernamePublic:!0,emailOptIn:n,name:t??a,proxyWallet:a,pseudonym:r??a,referral:"",utmCampaign:"",utmContent:"",utmMedium:"",utmSource:"",utmTerm:"",walletActivated:!1}}}class eO extends T{static operation="update";static parse(e){return e.data}encode(){let{auth:e,id:t,address:r,authenticationType:n,...a}=this.variables,{params:i,...o}=this.initializeRequest({credentialed:!0});return $(i,"address",r),{path:this.path,options:{params:i,body:{...a},...o}}}async execute({client:e}){return e.put(this.encode())}get path(){return`/users/${this.variables.id}`}}let eM=e=>{let{email:t,hash:r,timestamp:n,id:a,userID:i,updatedAt:o,verified:s}=e;if(void 0!==t&&void 0!==r&&void 0!==n&&void 0!==a&&void 0!==i)return{email:t,hash:r,id:a,timestamp:n.replace(" ","T"),updatedAt:o,userID:i,verified:s}};class eL extends T{static operation="create";static parse(e){let t=e.data;if(!t)throw Error("No verification email found");let r=eM(t);if(!r)throw Error("Failed to parse verification email");return r}encode(){let e=this.initializeRequest({credentialed:!0});return{path:this.path,options:{body:{hash:this.variables.hash,email:this.variables.email,timestamp:this.variables.timestamp??new Date().toISOString(),verified:this.variables.verified??!1},...e}}}async execute({client:e}){return e.post(this.encode())}get path(){return"/verification_emails"}}class eU extends T{static operation="delete";static parse(e){return e.data}encode(){let e=this.initializeRequest({credentialed:!0});return{path:this.path,options:e}}async execute({client:e}){return e.delete(this.encode())}get path(){return`/verification_emails/${this.variables.id}`}}class eN extends T{static operation="get";static parse(e){let t=e.data;if(!Array.isArray(t))throw Error("No verification emails found");return t.reduce((e,t)=>{let r=eM(t);return r&&e.push(r),e},[])}constructor(e={}){super(e)}encode(){let{params:e,...t}=this.initializeRequest({credentialed:!0});return{path:this.path,options:{params:e,...t}}}async execute({client:e}){return e.get(this.encode())}get path(){return"/verification_emails"}}class ej extends T{static operation="update";static parse(e){return e.data}encode(){let{auth:e,id:t,...r}=this.variables,n=this.initializeRequest({credentialed:!0}
1);return{path:this.path,options:{body:{...r},...n}}}async execute({client:e}){return e.put(this.encode())}get path(){return`/verification_emails/${this.variables.id}`}}class eK extends T{static operation="get";static parse(e){let t=e.data;if(!Array.isArray(t)||0===t.length)throw Error("No wallet preferences found");return eu(t[0])}constructor(e={}){super(e)}encode(){let e=this.initializeRequest({credentialed:!0});return{path:this.path,options:e}}async execute({client:e}){return e.get(this.encode())}get path(){return"/wallet_preferences"}}class eW extends T{static operation="update";static parse(e){return e.data}encode(){let{auth:e,id:t,...r}=this.variables,n=this.initializeRequest({credentialed:!0});return{path:this.path,options:{body:{...r},...n}}}async execute({client:e}){return e.put(this.encode())}get path(){return`/wallet_preferences/${this.variables.id}`}}class eF{constructor(e={}){const t=this.#e(e),r=e.client??new C({url:this.#t(e),transport:{type:"axios"}});this.auth=(({client:e,logger:t})=>{let r=k({module:"auth",logger:t});return{challenge:I(D,{client:e,log:r}),login:I(M,{client:e,log:r}),logout:I(L,{client:e,log:r}),refreshSession:I(U,{client:e,log:r}),session:I(N,{client:e,log:r})}})({client:r,logger:t}),this.events=(({client:e,logger:t})=>({list:I(z,{client:e,log:k({module:"events",logger:t})})}))({client:r,logger:t}),this.favorites=(e=>({events:(({client:e,logger:t})=>{let r=k({module:"favorite-events",logger:t});return{list:I(ee,{client:e,log:r}),create:I(Y,{client:e,log:r}),delete:I(X,{client:e,log:r})}})(e)}))({client:r,logger:t}),this.preferences=(({client:e,logger:t,self:r})=>{let n=k({module:"preferences",logger:t});return{get:I(ei,{client:e,log:n}),update:I(eo,{client:e,self:r,log:n})}})({client:r,logger:t,self:this}),this.profiles=(({client:e,logger:t})=>{let r=k({module:"profiles",logger:t});return{get:I(ep,{client:e,log:r}),getPublic:I(eg,{client:e,log:r}),create:I(ef,{client:e,log:r}),update:I(em,{client:e,log:r})}})({client:r,logger:t}),this.users=(({client:e,logger:t,self:r})=>{let n=k({module:"user",logger:t});return{get:I(eT,{client:e,self:r,log:n}),register:I(eD,{self:r,log:n}),update:I(eO,{client:e,log:n})}})({client:r,logger:t,self:this}),this.verifications=(({client:e,logger:t})=>{let r=k({module:"verification",logger:t});return{list:I(eN,{client:e,log:r}),create:I(eL,{client:e,log:r}),update:I(ej,{client:e,log:r}),delete:I(eU,{client:e,log:r})}})({client:r,logger:t}),this.walletPreferences=(({client:e,logger:t})=>{let r=k({module:"wallet-preferences",logger:t});return{get:I(eK,{client:e,log:r}),update:I(eW,{client:e,log:r})}})({client:r,logger:t})}auth;events;favorites;preferences;profiles;users;verifications;walletPreferences;#e(e){return e.logger?e.logger:(0,o.createLogger)({scope:"intl-gamma-client",level:"error"})}#t(e){if(e.url)return e.url;if(""!=="https://gamma-api.polymarket.com".trim())return"https://gamma-api.polymarket.com";throw Error("A Gamma API URL is required to be provided or `NEXT_PUBLIC_GAMMA_API_URL` to be set in the environment variables")}}var eq=e.i(519216);let e$=null;e.s(["getGammaClient",0,()=>(e$||(e$=new eF({url:eq.GAMMA_API_URL})),e$),"initGammaClient",0,e=>e$=new eF({url:eq.GAMMA_API_URL,logger:e.instance("intl-gamma-client")})],501596)},27090,437303,e=>{"use strict";var t=e.i(734804),r=e.i(45806),n=e.i(63922),a=e.i(508572),i=e.i(270903),o=e.i(479189),s=e.i(842757),c=e.i(748858);function l(e){return window._dubAnalytics?.v===e}function u(e,t){let r=!e||l(e),n=!t||document.cookie.includes("dclid=")||document.cookie.includes("dub_partner_data=");return r&&n}e.s(["DUB_COOKIE_POLL_MS",0,250,"DUB_TRACKING_MAX_ATTEMPTS",0,20,"hasCompletedDubTracking",0,u,"hasDubScriptConsumedVia",0,l],437303),e.s(["useDubIdCleaner",0,()=>{(0,r.useEffect)(()=>{let e,r,l=new URL(window.location.href),d=l.searchParams.get("dub_id"),h=l.searchParams.get("utm_source"),f=l.searchParams.get("utm_medium"),p=l.searchParams.get("utm_campaign"),g=l.searchParams.get("utm_content"),m=l.searchParams.get("utm_term"),y=l.searchParams.get("utmTerm"),w=l.searchParams.get("utm_id"),v=l.searchParams.get("campaign_id"),b=l.searchParams.get("ad_id"),C=l.searchParams.get("fbclid"),S=l.searchParams.get("r"),_=l.searchParams.get("via"),A=m||y||void 0;if(!(d||h||f||p||g||m||y||w||v||b||C||S||_))return;if(S){let e=(0,i.normalizeReferralCode)(S);if(e){let r=t.default.get(i.REFERRAL_ATTRIBUTION_COOKIE_NAME);(0,a.setReferralAttributionCookie)(e,{skipCookieWrite:r===e})}}if(d&&t.default.set("dub_id",d,{path:"/"}),h||f||p||g||m||y||w||v||b||C){let e={...(0,o.getLSUTMParameters)(),...h&&{utm_source:h},...f&&{utm_medium:f},...p&&{utm_campaign:p},...g&&{utm_content:g},...A&&{utm_term:A},...w&&{utm_id:w}
1,...v&&{campaign_id:v},...b&&{ad_id:b},...C&&{fbclid:C}};(0,o.setLSUTMParameters)(e);let{fbc:t,fbp:r}=(0,n.getClickIds)();(0,c.trackEvent)("marketingParams",{...e,pathname:l.pathname,fbc:t,fbp:r})}let E=()=>{let e=new URL(window.location.href);for(let t of["dub_id","utm_source","utm_medium","utm_campaign","utm_content","utm_term","utmTerm","utm_id","campaign_id","ad_id","fbclid","r","via"])e.searchParams.delete(t);let t=e.pathname+e.search;(0,s.replaceShallowUrl)(t)};if(_||d){let t=0;e=setInterval(()=>{t++,(u(_,d)||t>=20)&&(clearInterval(e),E())},250)}else r=setTimeout(E,100);return()=>{e&&clearInterval(e),r&&clearTimeout(r)}},[])}],27090)},256750,e=>{"use strict";var t=e.i(63922),r=e.i(734804),n=e.i(270903);let a="pm_eid";function i(){let e=r.default.get(n.EXTERNAL_ID_COOKIE_NAME);if(e){try{window.localStorage?.setItem(a,e)}catch{}return e}try{let e=window.localStorage?.getItem(a);if(e)return r.default.set(n.EXTERNAL_ID_COOKIE_NAME,e,{expires:400,path:"/",sameSite:"lax"}),e}catch{}}let o=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];function s({payload:e,next:r}){let n=e.obj.context=e.obj.context??{},a=i();a&&(n.external_id=a);let o=(0,t.getClickIds)();Object.keys(o).length>0&&(n.click_ids=o),r(e)}function c(e){let t=i();t&&e.setAnonymousId(t)}function l(){let e=window.htevents;if(e&&(e.invoked||e.initialize))return e;let t=window.htevents=window.htevents??[];for(let e of(t.invoked=!0,t.methods=o,t.factory=e=>(...r)=>(t.push([e,...r]),t),o))t[e]=t.factory(e);return t.load=(e,r)=>{let n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src="/api/_e/sdk.js";let a=document.getElementsByTagName("script")[0];a?.parentNode?a.parentNode.insertBefore(n,a):document.head.appendChild(n),t._loadOptions=r,t._writeKey=e},t.SNIPPET_VERSION="0.0.1",t.load("19964ee4ff9b8f7b09827702fb5d3b15bd3d0c6ff100251d2de23349fc362fbe",{apiHost:`${window.location.host}/api/_e`,protocol:"http:"===window.location.protocol?"http":"https"}),t.addSourceMiddleware(s),c(t),t}e.s(["identifyUser",0,function(e,r={}){try{let n=l();if(!n||!e)return;let a=i();n.identify(e,{...function(){let e={},r=(0,t.getFirstTouch)();if(r){let{click_ids:t,ts:n,...a}=r;for(let[t,r]of Object.entries(a))void 0!==r&&(e[`first_${t}`]=r);if(t)for(let[r,n]of Object.entries(t))void 0!==n&&(e[`first_${r}`]=n);n&&(e.first_touch_at=new Date(n).toISOString())}let n=(0,t.getLastTouch)();if(n){let{click_ids:t,ts:r,landing_page:a,...i}=n;for(let[t,r]of Object.entries(i))void 0!==r&&"referrer"!==t&&(e[t]=r)}return e}(),...a&&{external_id:a},...r}),c(n)}catch{}},"trackEvent",0,function(e,t){try{let r=l();if(!r)return;r.track(e,t)}catch{}},"trackPage",0,function(){try{let e=l();if(!e)return;e.page(),c(e)}catch{}}],256750)},334769,121356,174294,e=>{"use strict";e.s(["AuthenticationContextProvider",()=>eg,"useAuthenticationContext",()=>em,"useSignIn",()=>ey],334769);var t=e.i(303115),r=e.i(846574),n=e.i(766130),a=e.i(669718),i=e.i(668168),o=e.i(608114),s=e.i(820399),c=e.i(45806),l=e.i(822150),u=e.i(318594),d=e.i(590873),h=e.i(28168),f=e.i(566344),p=e.i(910233),g=e.i(40494),m=e.i(393171),y=e.i(202597),w=e.i(218424),v=e.i(320383),b=e.i(463659),C=e.i(681663),S=e.i(405299),_=e.i(584490),A=e.i(871554),E=e.i(974437),I=e.i(272580),k=e.i(732659),x=e.i(501596),P=e.i(512402),R=e.i(371135),T=e.i(982285),D=e.i(57720),O=e.i(557140),M=e.i(435248);let L=[({isCoinbaseSmartWallet:e})=>e?"coinbase_smart_wallet":null];class U extends Error{reason;constructor(e){super(`NEW_SIGNUP_BLOCKED:${e}`),this.name="NewSignupBlockedError",this.reason=e}}let N=e=>{if(!e||"object"!=typeof e||!("code"in e))return;let t=e.code;return"string"==typeof t||"number"==typeof t?t:void 0},j=e=>e instanceof Error?e.name:void 0,K=async e=>{let t=await (0,x.getGammaClient)().auth.login({token:`Bearer ${e}`});return"success"===t.status?{status:"success",type:t.data.type,address:t.data.address}:{status:"failure",error:t.error}};async function W(){await (0,x.getGammaClient)().auth.logout()}function F(e){let{id:t}=e;return t}function q(e){let{id:t}=e;return t}var $=e.i(90679),G=e.i(224565),B=e.i(782168);let H=async()=>{await (0,x.getGammaClient)().auth.logout()},Q=()=>{let e,t,n,a=(0,r.c)(10),i=(0,s.useQueryClient)(),c=(0,$.useRouter)(),l=(0,$.usePathname)(),{clearLocalAuthenticatedSession:u}=(0,B.useSignOutHelpers)();return a[0]!==u||a[1]!==i?(e=async()=>{await i.cancelQueries({queryKey:f.queryKeys[p.QueryKey.Auth].sessionRefresh._def}),await u()},a[0]=u,a[1]=i,a[2]=e):e=a[2],a[3]!==l||a[4]!==i||a[5]!==c?(t=()=>{i.setQueryData(f.queryKeys[p.QueryKey.Auth].isLoggedIn().queryKey,{status:"logged-out"}),(l.startsWith(G.Location.Portfolio)||l.startsWith(G.Location.Settings))&&c.push("/")},a[3]=l,a[4]=i,a[5]=c,a[6]=t):t=a[6],a[7]!==e||a[8]!==t?(n={mutationFn:J,onMutate:e,onSuccess:t,onError:z},a[7]=e,a[8]=t,a[9]=n):n=a[9],(0,o.useMutation)(n)};async function J(){return H()}async function z(e){C.logger.error("[useSignOutOfGamma > onError]",{error:e})}e.s(["useSignOut",0,Q],121356);let V=async e=>{let t=await (0,x.getGammaClient)().auth.challenge({address:e});return"success"===t.status?{status:"success",...t.data}:{status:"failure",error:t.error}},Z=async()=>{let e=await (0,x.getGammaClient)().auth.session();return"success"===e.status?{status:"success",data:e.data}:{status:"failure",error:e.error}},Y=async({conflictError:e,walletAddress:t,getSession:r=Z})=>{let n;if(409!==(e=>{if("code"in e)return"number"==typeof e.code?e.code:void 0})(e))return{status:"not-recovered",error:e,reason:"not_conflict"};try{n=await r()}catch(t){return{status:"not-recovered",error:e,reason:"session_check_threw",sessionError:t}}return"success"!==n.status?{status:"not-recovered",error:e,reason:"session_not_authenticated",sessionError:n.error}:"eoa"!==n.data.type?{status:"not-recovered",error:e,reason:"session_not_eoa",sessionUser:n.data}:n.data.address.toLowerCase()!==t.toLowerCase()?{status:"not-recovered",error:e,reason:"address_mismatch",sessionUser:n.data}:{status:"recovered",authenticatedUser:n.data}};var X=e.i(95293),ee=e.i(401512);let et="polymarket.oneTap.lastLogoutWasManual",er="polymarket:one-tap-eligibility-changed",en=["polymarket.auth.params","polymarket.auth.proxyWallet","polymarket.auth.cache.account","polymarket.auth.lastUsedEmail"],ea="polymarket.cache.wagmi.v2.",ei=()=>{window.dispatchEvent(new Event(er))},eo=()=>{try{window.localStorage.removeItem(et)}catch{}ei()},es=e=>{try{return!!window.localStorage.getItem(e)}catch{return!1}};e.s(["clearOneTapManualLogout",0,eo,"isOneTapLocalHistoryEligible",0,()=>(()=>{try{return"1"===window.localStorage.getItem(et)}catch{return!1}})()||!(en.some(es)||(()=>{try{for(let e=0;e<window.localStorage.length;e+=1){let t=window.localStorage.key(e);if(!t?.startsWith(ea))continue;if("polymarket.cache.wagmi.v2.store"!==t)return!0;let r=window.localStorage.getItem(t);if(!r)continue;let n=JSON.parse(r);if(n.state?.current||(n.state?.connections?.value?.length??0)>0)return!0}}catch{}return!1})()),"markOneTapManualLogout",0,({trigger:e})=>{try{window.localStorage.setItem(et,"1")}catch{}ei(),Promise.resolve((0,y.sendGroundcoverEvent)("auth.manual_logout",{...(0,R.getSafeAuthCacheContext)(),initiator:"user",logout_reason:"user_logout",logout_trigger:e,one_tap_manual_logout_eligible:!0,...{pathname:window.location.pathname}})).catch(()=>void 0)},"subscribeToOneTapEligibility",0,e=>{let t=t=>{(null===t.key||t.key===et||en.includes(t.key)||t.key.startsWith(ea))&&e()};return window.addEventListener(er,e),window.addEventListener("storage",t),()=>{window.removeEventListener(er,e),window.removeEventListener("storage",t)}}],174294);var ec=e.i(720909);let el=e=>{if(e.authAttemptId)return e.authAttemptId;let t=(0,R.getCurrentAuthAttemptId)()??(0,R.startAuthAttempt)();return e.authAttemptId=t,t},eu=c.default.createContext(null),ed=e=>{let t={...e};delete t.href,Promise.resolve((0,y.sendGroundcoverEvent)("auth.logout",t)).catch(()=>void 0)},eh=e=>({gammaUserId:e.userId,hasProxyWallet:!!e.proxyWallet,hasSignerAddress:!!e.address,profileId:e.profile}),ef=(e,t)=>"string"==typeof e&&e.includes(t),ep=({authAttemptId:e,initiator:t,reason:r,trigger:n,wasSessionPersisted:a})=>({...(0,R.getSafeAuthCacheContext)(),authAttemptId:e??(0,R.getCurrentAuthAttemptId)(),isReconnectRelated:ef(r,"reconnect")||ef(n,"reconnect")||ef(t,"reconnect"),isSessionRefreshRelated:ef(r,"session_refresh")||ef(n,"session_refresh")||ef(t,"session_refresh"),logout_reason:r,logout_source:t,logout_trigger:n,wasSessionPersisted:a}),eg=e=>{let y,$,G,B,H,J,z,Z,et,er,en,ea,ei,es,ef,eg,em,ey,ev,eb,eC,eS,e_,eA=(0,r.c)(118),{children:eE}=e,eI=(0,s.useQueryClient)(),ek=(0,b.useAmplitudeAnalytics)(),ex=c.default.useRef(!1),eP=c.default.useRef(void 0),eR=c.default.useRef(void 0),{setOpen:eT,setRoute:eD,setConnectorRoute:eO,options:eM,open:eL,setPreventClose:eU,connector:eN,magicOauthRedirectTimeout:ej,magicOauthPendingTimeout:eK,setAuthenticationStatus:eW,authenticationStatus:eF}=(0,ec.useSiwxContext)(),eq=(0,d.useConfig)(),{address:e$,connector:eG,chainId:eB,status:eH}=(0,h.useConnection)(),{mutateAsync:eQ}=(eS=(0,r.c)(2),e_=(0,s.useQueryClient)(),eS[0]!==e_?(eC={mutationFn:async e=>{let{token:t,authenticatedUser:r,blockNewSignup:n}=e,i=(0,a.createWalletCache)();if(!t&&!r)return{status:"failure",error:Error("no token or authenticatedUser")};let o=r;if(t){let e=await (0,T.signInWithConflictRecovery)({attemptSignIn:()=>K(t),signOutOfGamma:W});if("failure"===e.status)return{status:"failure",error:e.error};o={type:e.type,address:e.address},i.state.update({address:o.address.toLowerCase(),type:o.type}),C.logger.debug("[useSignIn > mutateAsync]",(0,R.getSafeAuthDiagnosticContext)({event:"gamma_auth_login_completed",authType:e.type,hasWalletAddress:!!e.address,status:e.status}))}if(!o)return{status:"failure",error:Error("no user")};let s=(0,O.getProxyAddress)(o.address,o.type);i.wallets.value=s;let c=await (0,x.getGammaClient)().users.get();if(C.logger.debug("[useSignIn > mutateAsync]",(0,R.getSafeAuthDiagnosticContext)({event:"gamma_user_get_completed",errorCode:"failure"===c.status?N(c.error):void 0,errorName:"failure"===c.status?j(c.error):void 0,hasGammaUser:"success"===c.status?!!c.data.user:void 0,status:c.status})),"success"===c.status){let e=c.data.user,t=(0,D.parseGammaProfile)(e,o.type);e_.setQueryData(f.queryKeys[p.QueryKey.Account].profile().queryKey,t),i.wallets.value=t.proxyWallet;let r=(0,O.matchDepositWalletAddress)(o.address,t.proxyWallet),n=r?"depositWallet":"magic"===o.type?"proxy":"safe";return C.logger.info("[useSignIn > mutateAsync > existing]",(0,R.getSafeAuthDiagnosticContext)({event:"wallet_state_snapshot",trigger:"sign_in_existing",authType:o.type,walletMode:n,gammaScheme:r?.mode,hasEoa:!!o.address,hasProxyWallet:!!t.proxyWallet,userId:t.userId,profileId:t.profile,createdAt:t.created_at})),{status:"success",data:t,isNew:!1}}let l="failure"===c.status&&"code"in c.error&&404===c.error.code,u=async()=>{let e=await (0,x.getGammaClient)().users.get();if("success"!==e.status)return null;let t=(0,D.parseGammaProfile)(e.data.user,o.type);return e_.setQueryData(f.queryKeys[p.QueryKey.Account].profile().queryKey,t),i.wallets.value=t.proxyWallet,{status:"success",data:t,isNew:!1}};if(l){if(n)return await (0,x.getGammaClient)().auth.logout(),i.wallets.clear(),i.state.clear(),{status:"failure",error:new U(n.reason)};let e=o.type,t="beacon",r=(0,O.getProxyAddress)(o.address,t);if("eoa"===e){let t,n=(0,O.getProxyAddress)(o.address,"eoa");try{t=await (0,O.isSafeDeployedOnChain)(n)}catch(t){return C.logger.error("[useSignIn] safe-deployment precheck failed; refusing to create deposit wallet profile",(0,R.getSafeAuthDiagnosticContext)({authType:e,errorMessage:t instanceof Error?t.message:String(t),hasDepositWallet:!!r,hasEoa:!!o.address,hasSafeAddress:!!n})),i.wallets.clear(),{status:"failure",error:Error("SAFE_CHECK_FAILED")}}if(t){if(!await (0,M.areLegacyProxiesEmpty)(o.address))return C.logger.error("[useSignIn] refusing to create deposit wallet profile: EOA has Safe deployed on-chain",(0,R.getSafeAuthDiagnosticContext)({authType:e,hasDepositWallet:!!r,hasEoa:!!o.address,hasSafeAddress:!!n})),i.wallets.clear(),{status:"failure",error:Error("SAFE_ALREADY_DEPLOYED")};C.logger.info("[useSignIn] legacy proxies hold no assets; continuing deposit wallet profile creation",(0,R.getSafeAuthDiagnosticContext)({event:"stranded_profile_recovery",authType:e,hasDepositWallet:!!r,hasEoa:!!o.address,hasSafeAddress:!!n}))}}if("magic"===e){let t,n=(0,O.getProxyAddress)(o.address,"magic");try{t=await (0,O.isSafeDeployedOnChain)(n)}catch(t){return C.logger.error("[useSignIn] magic-proxy precheck failed; refusing to create deposit wallet profile",(0,R.getSafeAuthDiagnosticContext)({authType:e,errorMessage:t instanceof Error?t.message:String(t),hasDepositWallet:!!r,hasEoa:!!o.address,hasMagicProxyAddress:!!n})),i.wallets.clear(),{status:"failure",error:Error("MAGIC_PROXY_CHECK_FAILED")}}if(t){if(!await (0,M.areLegacyProxiesEmpty)(o.address))return C.logger.error("[useSignIn] refusing to create deposit wallet profile: EOA has magic-proxy deployed on-chain",(0,R.getSafeAuthDiagnosticContext)({authType:e,hasDepositWallet:!!r,hasEoa:!!o.address,hasMagicProxyAddress:!!n})),i.wallets.clear(),{status:"failure",error:Error("MAGIC_PROXY_ALREADY_DEPLOYED")};C.logger.info("[useSignIn] legacy proxies hold no assets; continuing deposit wallet profile creation",(0,R.getSafeAuthDiagnosticContext)({event:"stranded_profile_recovery",authType:e,hasDepositWallet:!!r,hasEoa:!!o.address,hasMagicProxyAddress:!!n}))}}let a=(0,O.getProxyAddress)(o.address,"uups");if(!(0,k.isAddressEqual)(r,a)){let t;try{t=await (0,O.isSafeDeployedOnChain)(a)}catch(t){return C.logger.error("[useSignIn] legacy deposit-wallet precheck failed; refusing to create beacon deposit wallet profile",(0,R.getSafeAuthDiagnosticContext)({event:"dw_signup_legacy_check_failed",authType:e,hasEoa:!!o.address,hasDepositWallet:!!r,hasLegacyDepositWallet:!!a,errorMessage:(0,R.scrubAuthSensitiveText)(t instanceof Error?t.message:String(t))})),i.wallets.clear(),{status:"failure",error:Error("LEGACY_DW_CHECK_FAILED")}}if(t)return C.logger.error("[useSignIn] refusing to create beacon deposit wallet profile: EOA has legacy deposit wallet deployed on-chain",(0,R.getSafeAuthDiagnosticContext)({event:"dw_signup_blocked_legacy_deployed",authType:e,hasEoa:!!o.address,hasDepositWallet:!!r,hasLegacyDepositWallet:!!a})),i.wallets.clear(),{status:"failure",error:Error("LEGACY_DW_ALREADY_DEPLOYED")}}let s=`${r}-${Date.now()}
1`,c={generalEmail:{sendEmails:!1},marketEmails:{sendEmails:!1},newsletterEmails:{sendEmails:!1},promotionalEmails:{sendEmails:!1},eventEmails:{sendEmails:!1,tagIds:P.EVENT_TAG_PREFERENCES.map(F)},orderFillEmails:{sendEmails:!1,hideSmallFills:!0},resolutionEmails:{sendEmails:!1}},l={eventApp:{sendApp:!0,tagIds:P.EVENT_TAG_PREFERENCES.map(q)},marketPriceChangeApp:{sendApp:!0},orderFillApp:{sendApp:!0,hideSmallFills:!0},resolutionApp:{sendApp:!0}},d=[],h=await (0,x.getGammaClient)().profiles.create({authenticationType:e,name:s,pseudonym:r,proxyWallet:r,emailOptIn:!1,user:{address:o.address,..."magic"===o.type&&{email:i.state.magic?.email},proxyWallet:r,username:s,..."eoa"===o.type&&{provider:"metamask"}},preferences:{subscriptionStatus:!1,marketInterests:d,emailNotificationPreferences:c,appNotificationPreferences:l}});if(C.logger.debug("[useSignIn > mutateAsync]",(0,R.getSafeAuthDiagnosticContext)({event:"gamma_profile_create_completed",errorCode:"failure"===h.status?N(h.error):void 0,errorName:"failure"===h.status?j(h.error):void 0,hasPreference:"success"===h.status?!!h.data.preference:void 0,hasUser:"success"===h.status?!!h.data.user:void 0,status:h.status})),"failure"===h.status){if("code"in h.error&&409===h.error.code){let t=null,n=null;try{t=await u()}catch(e){n=e}if(C.logger.warn("[useSignIn] profile create returned 409, refetching existing user",(0,R.getSafeAuthDiagnosticContext)({event:"profile_already_exists",recovered:!!t,authType:e,hasEoa:!!o.address,hasProxyWallet:!!r,...n?{refetchErrorMessage:n instanceof Error?n.message:String(n)}:{}})),t)return t;if(n)throw n}return{status:"failure",error:h.error}}let{user:g,preference:m,walletPreference:y,...w}=h.data;if(!g)return{status:"failure",error:Error(`failed to create user (authType: ${e})`)};if(!m)return{status:"failure",error:Error(`failed to create all preference entities (authType: ${e})`)};let v=(0,D.parseGammaProfileAfterCreation)({profile:w,user:g,authenticationType:e});e_.setQueryData(f.queryKeys[p.QueryKey.Account].profile().queryKey,v),i.wallets.value=r;let b={preferences:{...m,id:parseInt(m.id,10),chartPreferences:void 0,emailNotificationPreferences:m.emailNotificationPreferences??c,appNotificationPreferences:m.appNotificationPreferences??l,marketInterests:m.marketInterests??d},walletPreferences:void 0};return e_.setQueryData(f.queryKeys[p.QueryKey.Account].preferences().queryKey,b),C.logger.info("[useSignIn > mutateAsync > new]",(0,R.getSafeAuthDiagnosticContext)({event:"wallet_state_snapshot",trigger:"sign_in_new",authType:e,walletMode:"depositWallet",gammaScheme:t,hasEoa:!!o.address,hasProxyWallet:!!v.proxyWallet,userId:v.userId,profileId:v.profile,createdAt:v.created_at})),{status:"success",data:v,isNew:!0}}return{status:"failure",error:c.error}}},eS[0]=e_,eS[1]=eC):eC=eS[1],(0,o.useMutation)(eC)),{mutateAsync:eJ}=Q(),[ez,eV]=c.default.useState(),{data:eZ,prefetchBalances:eY}=(0,E.useIsLoggedIn)(),eX=eG?.id;eA[0]!==e$||eA[1]!==eX||eA[2]!==eH||eA[3]!==eY?(y=()=>{"connected"===eH&&e$&&eX&&eY(e$,(0,i.isMagicConnector)(eX)?"magic":"eoa")},$=[e$,eX,eH,eY],eA[0]=e$,eA[1]=eX,eA[2]=eH,eA[3]=eY,eA[4]=y,eA[5]=$):(y=eA[4],$=eA[5]),c.default.useEffect(y,$),eA[6]!==eB||eA[7]!==eG||eA[8]!==eZ.authenticatedUser||eA[9]!==eZ.isLoggedIn||eA[10]!==eZ.isLoggedInPending?(G={authenticatedUser:eZ.authenticatedUser,chainId:eB,connector:eG,isLoggedIn:eZ.isLoggedIn,isLoggedInPending:eZ.isLoggedInPending},eA[6]=eB,eA[7]=eG,eA[8]=eZ.authenticatedUser,eA[9]=eZ.isLoggedIn,eA[10]=eZ.isLoggedInPending,eA[11]=G):G=eA[11],(0,I.useSessionRefresh)(G),eA[12]!==ek||eA[13]!==eN.id||eA[14]!==eZ.gamma||eA[15]!==eZ.isLoggedIn||eA[16]!==eZ.isLoggedInPending||eA[17]!==eM.nonceRefetchInterval||eA[18]!==ez?(B=()=>{if(ex.current||eZ.isLoggedInPending)return;if(!eZ.isLoggedIn&&"failure"===eZ.gamma.status){let e={gamma_failure_code:eZ.gamma.code,gamma_status:eZ.gamma.status,trigger:"detected_on_load"};C.logger.warn("[AuthenticationContext] Skipping detected_on_load logout; Gamma auth check failed",(0,R.getSafeAuthDiagnosticContext)(e)),(0,R.sendAuthDiagnosticEvent)("detected_on_load_gamma_failure",e),ex.current=!0;return}if(ex.current=!0,eZ.isLoggedIn)return;(0,v.removeSunbreakProofCredential)((0,a.createWalletCache)().state.value?.address),(0,m.setLogoutTrigger)({reason:"session_invali
1dated",initiator:"system",trigger:"detected_on_load"},{mode:"overwrite"});let e=(0,m.consumeLogoutTrigger)();if(!e?.proxyAddress)return;let t=Date.now(),r=(0,m.getLastTradeContext)(),n=r&&"number"==typeof r.at?Math.max(0,t-r.at):void 0,i=e?.extra?.id??e?.extra?.auth_type??(eN.id||void 0),o={...ep({authAttemptId:e.authAttemptId,initiator:e.initiator,reason:e.reason,trigger:e.trigger,wasSessionPersisted:ez}),logout_reason:e.reason,initiator:e.initiator,trigger:e.trigger,id:i,detected_on_load:!0,trigger_age_ms:Math.max(0,t-e.at),was_session_persisted:ez,nonce_refetch_interval_ms:eM.nonceRefetchInterval,gamma_status:eZ.gamma.status,time_since_last_trade_ms:n,last_trade_type:r?.event,last_trade_market_id:r?.market_id,last_trade_market_slug:r?.market_slug,last_trade_token_id:r?.token_id,...{hasSearch:window.location.search.length>0,pathname:window.location.pathname}};ek.trackEvent(g.Events.Logout,o,e.proxyAddress),C.logger.info("[AuthenticationContext] Tracked logout event (detected_on_load)",(0,R.getSafeAuthDiagnosticContext)({authAttemptId:o.authAttemptId,logout_reason:o.logout_reason,trigger:o.trigger,gamma_status:o.gamma_status,initiator:o.initiator,id:o.id})),ed(o)},eA[12]=ek,eA[13]=eN.id,eA[14]=eZ.gamma,eA[15]=eZ.isLoggedIn,eA[16]=eZ.isLoggedInPending,eA[17]=eM.nonceRefetchInterval,eA[18]=ez,eA[19]=B):B=eA[19],eA[20]!==ek||eA[21]!==eN.id||eA[22]!==eZ||eA[23]!==eM.nonceRefetchInterval||eA[24]!==ez?(H=[ek,eN.id,eZ,eM.nonceRefetchInterval,ez],eA[20]=ek,eA[21]=eN.id,eA[22]=eZ,eA[23]=eM.nonceRefetchInterval,eA[24]=ez,eA[25]=H):H=eA[25],c.default.useEffect(B,H),eA[26]!==ek||eA[27]!==eN.id||eA[28]!==eZ.gamma||eA[29]!==eZ.isLoggedIn||eA[30]!==eZ.isLoggedInPending||eA[31]!==eM.nonceRefetchInterval||eA[32]!==ez?(J=()=>{if(eZ.isLoggedInPending)return;let e=eP.current,t=eZ.isLoggedIn;if(eP.current=t,!0!==e||!1!==t)return;(0,v.removeSunbreakProofCredential)((0,a.createWalletCache)().state.value?.address);let r=Date.now(),n=(0,m.consumeLogoutTrigger)(r),i=eZ.gamma,o=(0,m.getLastTradeContext)(),s=o&&"number"==typeof o.at?Math.max(0,r-o.at):void 0,c=n?.extra?.id??n?.extra?.auth_type??(eN.id||void 0),l="logged-out"===i.status||"failure"===i.status&&401===i.code?"session_invalidated":"unknown",u={...ep({authAttemptId:n?.authAttemptId,initiator:n?.initiator??"system",reason:n?.reason??l,trigger:n?.trigger??"isLoggedIn_transition",wasSessionPersisted:ez}),logout_reason:n?.reason??l,initiator:n?.initiator??"system",trigger:n?.trigger??"isLoggedIn_transition",id:c,trigger_age_ms:n?Math.max(0,r-n.at):void 0,was_session_persisted:ez,nonce_refetch_interval_ms:eM.nonceRefetchInterval,gamma_status:i.status,..."failure"===i.status&&{gamma_failure_code:i.code},time_since_last_trade_ms:s,last_trade_type:o?.event,last_trade_market_id:o?.market_id,last_trade_market_slug:o?.market_slug,last_trade_token_id:o?.token_id,...{hasSearch:window.location.search.length>0,pathname:window.location.pathname}};ek.trackEvent(g.Events.Logout,u,n?.proxyAddress),C.logger.info("[AuthenticationContext] Tracked logout event (isLoggedIn transition)",(0,R.getSafeAuthDiagnosticContext)({authAttemptId:u.authAttemptId,logout_reason:u.logout_reason,trigger:u.trigger,gamma_status:u.gamma_status,gamma_failure_code:u.gamma_failure_code,initiator:u.initiator,id:u.id})),ed(u)},eA[26]=ek,eA[27]=eN.id,eA[28]=eZ.gamma,eA[29]=eZ.isLoggedIn,eA[30]=eZ.isLoggedInPending,eA[31]=eM.nonceRefetchInterval,eA[32]=ez,eA[33]=J):J=eA[33],eA[34]!==ek||eA[35]!==eN.id||eA[36]!==eZ||eA[37]!==eM.nonceRefetchInterval||eA[38]!==ez?(z=[ek,eN.id,eZ,eM.nonceRefetchInterval,ez],eA[34]=ek,eA[35]=eN.id,eA[36]=eZ,eA[37]=eM.nonceRefetchInterval,eA[38]=ez,eA[39]=z):z=eA[39],c.default.useEffect(J,z),eA[40]!==eJ?(Z=async()=>{let e=(0,a.createWalletCache)();e.state.clear(),e.wallets.clear(),await eJ()},eA[40]=eJ,eA[41]=Z):Z=eA[41],eA[42]!==eZ.authenticatedUser?.address||eA[43]!==eW?(et=()=>{let e=(0,R.getCurrentAuthAttemptId)();(0,m.setLogoutTrigger)({authAttemptId:e,reason:"unknown",initiator:"system",trigger:"signOut"},{mode:"if_unset"}),eW(A.AuthenticationStatusStates.IDLE),(0,v.removeSunbreakProofCredential)(eZ.authenticatedUser?.address),(0,R.clearCurrentAuthAttemptId)(e)},eA[42]=eZ.authenticatedUser?.address,eA[43]=eW,eA[44]=et):et=eA[44],eA[45]!==Z||eA[46]!==et?(er={mutationKey:f.queryKeys[p.QueryKey.Auth].signOut.queryKey,mutationFn:Z,onMutate:et},eA[45]=Z,eA[46]=et,eA[47]=er):er=eA[47];let{mutateAsync:e0}=(0,o.useMutation)(er);eA[48]!==eI?(en=()=>eI.isMutating({mutationKey:f.queryKeys[p.QueryKey.Auth].signOut.queryKey,exact:!0})>0,eA[48]=eI,eA[49]=en):en=eA[49];let e1=en;eA[50]!==ek||eA[51]!==eq||eA[52]!==eN.coercedConnector?.id||eA[53]!==eZ.authenticatedUser||eA[54]!==eZ.isLoggedIn||eA[55]!==eW||eA[56]!==eQ||eA[57]!==eJ?(ea=async e=>{let t,r=(0,a.createWalletCache)(),o=el(e),{account:s,connector:c,token:d,chainId:h}=e,f=e.authenticatedUser?.address?.toLowerCase()===s.toLowerCase()?e.authenticatedUser:void 0,p=(0,i.isMagicConnector)(c?.id),g=await (0,u.isCoinbaseSmartWalletConnection)(c,s),m=(e=>{for(let t of L){let r=t(e);
1if(r)return{blocked:!0,reason:r}}return{blocked:!1}})({connectorId:c?.id,coercedConnectorId:eN.coercedConnector?.id,authType:p?"magic":"eoa",isCoinbaseSmartWallet:g}),y=m.blocked?{reason:m.reason}:null,w=e.authenticatedUser??(eZ.isLoggedIn?eZ.authenticatedUser:void 0),b=!d&&!!w?.address&&w.address.toLowerCase()!==s.toLowerCase();(0,X.logAuthFlowStep)({authAttemptId:o,connectorId:c.id,data:{chainId:h,hasAuthenticatedUser:!!f,hasToken:!!d},step:"sign_in_started",walletAddress:s}),b&&(C.logger.info("[AuthenticationContext] Signing out stale Gamma session before nonce",(0,R.getSafeAuthDiagnosticContext)({authAttemptId:o,connectorId:c.id,hasNextAddress:!!s,hasPreviousAddress:!!w.address})),(0,v.removeSunbreakProofCredential)(w.address),r.state.clear(),r.wallets.clear(),await eJ());let S=r.state.value;(({attemptedConnectorId:e,cachedState:t})=>!(0,i.isMagicConnector)(e)&&!!t&&"magic"===t.type&&"ready"!==t.connectionState)({attemptedConnectorId:c.id,cachedState:S})&&(C.logger.info("[AuthenticationContext] Clearing stale Magic auth state before non-Magic signIn",(0,R.getSafeAuthDiagnosticContext)({authAttemptId:o,attemptedConnectorId:c.id,cachedConnectionState:S?.type==="magic"?S.connectionState:void 0,cachedMagicAuthType:S?.type==="magic"?S.magicAuthType:void 0,cachedOauthProvider:S?.type==="magic"&&"oauth"===S.magicAuthType?S.oauthProvider:void 0})),(0,v.removeSunbreakProofCredential)(S?.address),r.state.clear(),r.wallets.clear(),await eJ());let E=(0,_.getMobileAuthMode)(),I=async(e,t)=>{let r=E?void 0:await Y({conflictError:e,walletAddress:s});if(r?.status==="recovered"){(0,X.logAuthFlowStep)({authAttemptId:o,connectorId:c.id,data:{recoveredAddress:r.authenticatedUser.address,recoveredType:r.authenticatedUser.type},step:"nonce_conflict_recovered",walletAddress:s});let e=await eQ({authenticatedUser:r.authenticatedUser,blockNewSignup:y});if("failure"===e.status)throw(0,X.logAuthFlowError)({authStatus:"error",authAttemptId:o,connectorId:c.id,error:e.error,trigger:"gamma-login",walletAddress:s}),e.error;return(0,X.logAuthFlowStep)({authAttemptId:o,connectorId:c.id,data:{isNew:e.isNew},...eh(e.data),step:"gamma_login_succeeded",walletAddress:s}),{isNew:e.isNew,accountProfile:e.data}}throw(0,l.handleError)(e,t,s),(0,X.logAuthFlowError)({authStatus:"error",authAttemptId:o,connectorId:c.id,error:e,trigger:"gamma-login",walletAddress:s}),e};if(p)t=await (0,n.getMagicLoginToken)({chainId:h,connector:c,address:s});else{(0,X.logAuthFlowStep)({authAttemptId:o,connectorId:c.id,data:{chainId:h},step:"challenge_requested",walletAddress:s});let e=await V(s);if("failure"===e.status)return await I(e.error,"[getEoaChallenge]");(0,X.logAuthFlowStep)({authAttemptId:o,connectorId:c.id,data:{challengeChainId:e.fields.chainId,challengeDomain:e.fields.domain},step:"challenge_received",walletAddress:s}),t=await (0,n.getEoaTokenFromChallenge)({connector:c,config:eq,fields:e.fields,message:e.message})}if("failure"===t.status)throw p?(0,X.logAuthFlowError)({authStatus:"error",authAttemptId:o,connectorId:c.id,error:t.error,trigger:"signMessage",walletAddress:s}):"UserRejectedRequestError"===t.error.name?((0,X.logAuthFlowError)({authStatus:"rejected",authAttemptId:o,connectorId:c.id,error:t.error,trigger:"signMessage",walletAddress:s}),eW(A.AuthenticationStatusStates.REJECTED)):(C.logger.error("[AuthenticationContext > signMessageAsync > onError]",(0,R.getSafeAuthDiagnosticContext)({authAttemptId:o,connectorId:c.id,errorMessage:t.error instanceof Error?t.error.message:String(t.error),hasWalletAddress:!!s})),(0,X.logAuthFlowError)({authStatus:"error",authAttemptId:o,connectorId:c.id,error:t.error,trigger:"signMessage",walletAddress:s}),eW(A.AuthenticationStatusStates.ERROR)),(0,ee.tagAuthFailureStep)(t.error,"siwx_signature"),t.error;if((0,X.logAuthFlowStep)({authAttemptId:o,connectorId:c.id,data:{chainId:h,...t.magicTokenSource&&{magicTokenSource:t.magicTokenSource}},step:p?"magic_token_received":"eoa_token_received",walletAddress:s}),!p){let e=r.state.exists;r.state.value={address:s,type:"eoa",connectorId:c.id},C.logger.info("[AuthenticationContext] Set EOA auth cache state",(0,R.getSafeAuthDiagnosticContext)({authAttemptId:o,source:"token_success",hadState:e,connectorId:c.id,hasWalletAddress:!!s}))}
1E&&await (0,_.handleMobileAuthFlow)(t.data,c.id,ek);let k=await eQ({token:t.data,authenticatedUser:f,blockNewSignup:y});if("failure"===k.status)throw(0,X.logAuthFlowError)({authStatus:"error",authAttemptId:o,connectorId:c.id,error:k.error,trigger:"gamma-login",walletAddress:s}),k.error;return!p&&t.proof&&(0,v.saveSunbreakProofCredential)(s,t.proof),(0,X.logAuthFlowStep)({authAttemptId:o,connectorId:c.id,data:{isNew:k.isNew},...eh(k.data),step:"gamma_login_succeeded",walletAddress:s}),{isNew:k.isNew,accountProfile:k.data}},eA[50]=ek,eA[51]=eq,eA[52]=eN.coercedConnector?.id,eA[53]=eZ.authenticatedUser,eA[54]=eZ.isLoggedIn,eA[55]=eW,eA[56]=eQ,eA[57]=eJ,eA[58]=ea):ea=eA[58],eA[59]!==eI||eA[60]!==eW?(ei=async e=>{let t=el(e);await eI.cancelQueries({exact:!0,queryKey:f.queryKeys[p.QueryKey.Auth].isLoggedIn().queryKey});let r=(0,a.createWalletCache)();return r.state.oauthRedirected||eW(A.AuthenticationStatusStates.PENDING),(0,X.logAuthFlowStep)({authAttemptId:t,connectorId:e.connector.id,data:{canceledSessionProbe:!0,hasAuthenticatedUser:!!e.authenticatedUser,hasToken:!!e.token,oauthRedirected:r.state.oauthRedirected},step:"sign_in_mutating",walletAddress:e.account}),{authAttemptId:t}},eA[59]=eI,eA[60]=eW,eA[61]=ei):ei=eA[61],eA[62]!==eK||eA[63]!==ej||eA[64]!==eY||eA[65]!==eI||eA[66]!==eW||eA[67]!==eT||eA[68]!==eU||eA[69]!==eD?(es=(e,t,r)=>{let n=(0,a.createWalletCache)();ej.current&&clearTimeout(ej.current),eK.current&&clearTimeout(eK.current);let o=t.connector?.id==="magic"?"magic":"eoa";if(t.authenticatedUser?.address?.toLowerCase()!==t.account.toLowerCase()&&eI.setQueryData(f.queryKeys[p.QueryKey.Auth].isLoggedIn().queryKey,{status:"success",address:t.account,type:o}),n.wallets.value=e.accountProfile.proxyWallet,eY(t.account,o),!(0,i.isMagicConnector)(t.connector.id)){let e=n.state.exists;n.state.value={type:"eoa",connectorId:t.connector.id,address:t.account},C.logger.info("[AuthenticationContext] Set EOA auth cache state",(0,R.getSafeAuthDiagnosticContext)({authAttemptId:r.authAttemptId,source:"sign_in_success",hadState:e,connectorId:t.connector.id,hasWalletAddress:!!t.account}))}e.isNew?(eT(!0),eD(A.AuthRoute.ONBOARDING),eU(!0),(0,S.readImpactClickIdFromBrowser)()&&fetch("/api/account/mark-registered",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e.accountProfile.proxyWallet,event_id:`${e.accountProfile.proxyWallet}-register`})}).catch(ew)):((0,w.clearSignupPromptAttribution)(),eT(!1)),eW(A.AuthenticationStatusStates.SUCCESS),eo(),"magic"===t.connector.id&&n.state.update({connectionState:"ready"}),eV(!1);let s=r?.authAttemptId??t.authAttemptId??(0,R.getCurrentAuthAttemptId)();(0,X.logAuthFlowStep)({authAttemptId:s,connectorId:t.connector.id,data:{authenticationStatus:A.AuthenticationStatusStates.SUCCESS,isNew:e.isNew,openedOnboarding:e.isNew},...eh(e.accountProfile),step:"sign_in_completed",walletAddress:t.account}),(0,R.clearCurrentAuthAttemptId)(s)},eA[62]=eK,eA[63]=ej,eA[64]=eY,eA[65]=eI,eA[66]=eW,eA[67]=eT,eA[68]=eU,eA[69]=eD,eA[70]=es):es=eA[70],eA[71]!==ek||eA[72]!==eW||eA[73]!==eT||eA[74]!==eD?(ef=(e,t,r)=>{let n=r?.authAttemptId??t.authAttemptId??(0,R.getCurrentAuthAttemptId)();if(e instanceof U||e instanceof Error&&"NewSignupBlockedError"===e.name){eW(A.AuthenticationStatusStates.BLOCKED),eT(!0),eD(A.AuthRoute.CONNECT),(0,ee.trackWalletConnectFailed)({walletProvider:t.connector?.id,failureStep:"gamma_signin",failureReason:"coinbase_smart_wallet_signup_blocked"}),(0,R.clearCurrentAuthAttemptId)(n);return}if("UserRejectedRequestError"===e.name)(0,X.wasAuthFlowErrorLogged)(e,"rejected")||(0,X.logAuthFlowError)({authStatus:"rejected",authAttemptId:n,connectorId:t.connector?.id,error:e,trigger:"onError",walletAddress:t.account}),eW(A.AuthenticationStatusStates.REJECTED),(0,ee.trackWalletConnectFailed)({walletProvider:t.connector?.id,failureStep:"siwx_signature",failureReason:"user_rejected"});else{C.logger.error("[AuthenticationContext > onError]",(0,R.getSafeAuthDiagnosticContext)({authAttemptId:n,connectorId:t.connector?.id,errorMessage:e instanceof Error?e.message:String(e),hasWalletAddress:!!t.account})),ek.trackEvent(g.Events.GammaSignInError,{connectorId:t.connector?.id,errorCode:(e=>{if(!e||"object"!=typeof e||!("code"in e))return;let t=e.code;return"string"==typeof t||"number"==typeof t?t:void 0})(e),errorMessage:(0,R.scrubAuthSensitiveText)(e instanceof Error?e.message:String(e)),errorName:e instanceof Error?e.name:void 0,hasWalletAddress:!!t.account});let r="code"in e&&403===e.code&&"response"in e&&"object"==typeof e.response&&null!==e.response&&"error"in e.response&&"account deleted"===e.response.error;
1r||(0,ee.trackWalletConnectFailed)({walletProvider:t.connector?.id,failureStep:(0,ee.readAuthFailureStep)(e)??"gamma_signin",failureReason:(0,ee.normalizeAuthFailureReason)(e)});let a=r?"account_deleted":"error";(0,X.wasAuthFlowErrorLogged)(e,a)||(0,X.logAuthFlowError)({authStatus:a,authAttemptId:n,connectorId:t.connector?.id,error:e,trigger:"onError",walletAddress:t.account}),eW(r?A.AuthenticationStatusStates.ACCOUNT_DELETED:A.AuthenticationStatusStates.ERROR)}(0,R.clearCurrentAuthAttemptId)(n)},eA[71]=ek,eA[72]=eW,eA[73]=eT,eA[74]=eD,eA[75]=ef):ef=eA[75],eA[76]!==ea||eA[77]!==ei||eA[78]!==es||eA[79]!==ef?(eg={mutationFn:ea,onMutate:ei,onSuccess:es,onError:ef},eA[76]=ea,eA[77]=ei,eA[78]=es,eA[79]=ef,eA[80]=eg):eg=eA[80];let{mutate:e2}=(0,o.useMutation)(eg);eA[81]!==eF||eA[82]!==e$||eA[83]!==eB||eA[84]!==eG||eA[85]!==eH||eA[86]!==eZ.authenticatedUser||eA[87]!==eZ.isLoggedIn||eA[88]!==eZ.isLoggedInPending||eA[89]!==eL||eA[90]!==eO||eA[91]!==eT||eA[92]!==eU||eA[93]!==eD||eA[94]!==e2?(em=()=>{if(eL||"connected"!==eH||!e$||!eG||!eB||(0,i.isMagicConnector)(eG.id)||eZ.isLoggedInPending||!eZ.isLoggedIn||"eoa"!==eZ.authenticatedUser.type||eF!==A.AuthenticationStatusStates.SUCCESS)return;let e=e$.toLowerCase(),t=eZ.authenticatedUser.address?.toLowerCase();if(!t)return;if(e===t){eR.current=void 0;return}let r=`${eG.id}:${e}`;if(eR.current===r)return;eR.current=r,C.logger.info("[AuthenticationContext] Signing in connected account switch",(0,R.getSafeAuthDiagnosticContext)({connectorId:eG.id,hasAuthenticatedAddress:!!eZ.authenticatedUser.address,hasConnectedAddress:!!e$}));let n=eZ.authenticatedUser.address;e2({account:e$,connector:eG,chainId:eB},{onSuccess:()=>{(0,ee.trackWalletSwitched)({previousExternalWalletId:n,externalWalletId:e$,walletProvider:eG.id})},onError:()=>{eO(A.ConnectorRoute.SIGNUP),eD(A.AuthRoute.CONNECTORS),eU(!1),eT(!0)}})},eA[81]=eF,eA[82]=e$,eA[83]=eB,eA[84]=eG,eA[85]=eH,eA[86]=eZ.authenticatedUser,eA[87]=eZ.isLoggedIn,eA[88]=eZ.isLoggedInPending,eA[89]=eL,eA[90]=eO,eA[91]=eT,eA[92]=eU,eA[93]=eD,eA[94]=e2,eA[95]=em):em=eA[95],eA[96]!==eF||eA[97]!==e$||eA[98]!==eB||eA[99]!==eG||eA[100]!==eH||eA[101]!==eZ||eA[102]!==eL||eA[103]!==eO||eA[104]!==eT||eA[105]!==eU||eA[106]!==eD||eA[107]!==e2?(ey=[eF,e$,eB,eG,eH,eZ,eL,eO,eT,eU,eD,e2],eA[96]=eF,eA[97]=e$,eA[98]=eB,eA[99]=eG,eA[100]=eH,eA[101]=eZ,eA[102]=eL,eA[103]=eO,eA[104]=eT,eA[105]=eU,eA[106]=eD,eA[107]=e2,eA[108]=ey):ey=eA[108],c.default.useEffect(em,ey),eA[109]!==eZ||eA[110]!==e1||eA[111]!==e2||eA[112]!==e0||eA[113]!==ez?(ev={...eZ,signIn:e2,signOut:e0,isSigningOut:e1,wasSessionPersisted:ez,setWasSessionPersisted:eV},eA[109]=eZ,eA[110]=e1,eA[111]=e2,eA[112]=e0,eA[113]=ez,eA[114]=ev):ev=eA[114];let e6=ev;return eA[115]!==eE||eA[116]!==e6?(eb=(0,t.jsx)(eu.Provider,{value:e6,children:eE}),eA[115]=eE,eA[116]=e6,eA[117]=eb):eb=eA[117],eb},em=()=>{let e=c.default.useContext(eu);if(!e)throw Error("useAuthenticationContext Hook must be inside a Provider.");return e},ey=()=>{let e=c.default.useContext(eu);if(!e)throw Error("useSignIn Hook must be inside a Provider.");return e.signIn};function ew(){}},515796,194107,e=>{"use strict";e.s(["ConnectorContextProvider",()=>H,"useConnectorContext",()=>Q],515796),e.s(["useContextWalletConnectModal",()=>$,"useWalletConnectModal",()=>G],194107);var t=e.i(303115),r=e.i(846574),n=e.i(668168),a=e.i(918071),i=e.i(45806),o=e.i(681663),s=e.i(871554),c=e.i(969346),l=e.i(778377),u=e.i(708546),d=e.i(459028),h=e.i(669718),f=e.i(534246),p=e.i(406698),g=e.i(382928),m=e.i(504377),y=e.i(281351),w=e.i(734804),v=e.i(590873),b=e.i(28168),C=e.i(843812),S=e.i(927951),_=e.i(462017),A=e.i(393171),E=e.i(371135),I=e.i(334769),k=e.i(720909),x=e.i(871586),P=e.i(256490),R=e.i(95184),T=e.i(732659);function D(e,t){return!!e&&!!t&&!!(0,R.isAddress)(e)&&!!(0,R.isAddress)(t)&&(0,T.isAddressEqual)(e,t)}var O=e.i(176630),M=e.i(584564),L=e.i(863226),U=e.i(608114),N=e.i(238874),j=e.i(304695);let K=[2e3,4e3,8e3];var W=e.i(957078),F=e.i(519216),q=e.i(582855);function $(){let{options:e}=(0,k.useSiwxContext)(),{connectAsync:t}=(0,q.useConnect)(),r=(0,O.useConnectors)(),[a,s]=i.default.useState(!1);return{isOpen:a,open:async()=>{let a=document.createElement("style");a.innerHTML="w3m-modal, wcm-modal{ --wcm-z-index: 2147483647; --w3m-z-index:2147483647; }",document.head.appendChild(a);let i=r.find(e=>(0,n.isWalletConnectConnector)(e.id));if(i)try{let{projectId:r}=(await i.getProvider()).rpc,n=(0,W.walletConnect)({...i,showQrModal:!0,projectId:r});s(!0);try{await t({connector:n,chainId:e.initialChainId??F.MATIC_CONFIG.chainId})}
1catch(e){o.logger.error("[useWalletConnectModal > open]",{err:e})}s(!1),document.head.removeChild(a)}catch(e){o.logger.error("[useWalletConnectModal > Could not get provider]",{err:e})}else o.logger.debug("[useWalletConnectModal > No WalletConnect connector available]")}}}let G=()=>{let e,t=(0,r.c)(3),{isOpenW3M:n,openW3M:a}=Q();return t[0]!==n||t[1]!==a?(e={isOpenW3M:n,openW3M:a},t[0]=n,t[1]=a,t[2]=e):e=t[2],e},B=i.default.createContext({walletRecoveryRequired:!1,openW3M:()=>{throw Error("openW3M must be inside a Provider")},isOpenW3M:!1,getUri:()=>{throw Error("getUri must be inside a Provider")}});function H(e){let R,T,W,F,q,G,H,Q,J,z=(0,r.c)(24),{children:V}=e,{options:Z,connectorStatus:Y,connector:X}=(0,k.useSiwxContext)(),{isOpen:ee,open:et}=$(),[er,en]=i.default.useState(!1),ea=i.default.useRef(void 0);z[0]!==X||z[1]!==Y||z[2]!==ee||z[3]!==er?(R=er||ee||(0,n.isWalletConnectConnector)(X.id)&&Y===s.ConnectorStates.CONNECTING,z[0]=X,z[1]=Y,z[2]=ee,z[3]=er,z[4]=R):R=z[4],z[5]!==R?(T={enabled:R},z[5]=R,z[6]=T):T=z[6];let{uri:ei}=(0,c.useWalletConnectUri)(T);z[7]!==Z.bufferPolyfill?(W=()=>{Z.bufferPolyfill&&(window.Buffer=window.Buffer??a.Buffer)},F=[Z.bufferPolyfill],z[7]=Z.bufferPolyfill,z[8]=W,z[9]=F):(W=z[8],F=z[9]),i.default.useEffect(W,F),z[10]!==ei||z[11]!==er?(q=()=>{if(!ei)return;let e=!!ea.current;ea.current&&(ea.current.resolve(ei),ea.current=void 0),er&&(o.logger.info("[ConnectorContext] WalletConnect URI flow completed; disabling temporary flag",{hadDeferred:e}),en(!1))},G=[ei,er],z[10]=ei,z[11]=er,z[12]=q,z[13]=G):(q=z[12],G=z[13]),i.default.useEffect(q,G),z[14]!==ei?(H=()=>
1{if(ei)return Promise.resolve(ei);if(ea.current)return ea.current.p;let e=function(){let e,t=new Promise(t=>{e=t});if(!e)throw Error("resolve is undefined");return{p:t,resolve:e}}();return ea.current=e,o.logger.info("[ConnectorContext] Enabling WalletConnect URI flow",{hasDeferred:!0}),en(!0),e.p},z[14]=ei,z[15]=H):H=z[15];let eo=H;(0,l.useLongPendingOauth)(),(0,u.useOptimisticMagicReconnect)(),(0,d.usePreloadMagic)();let{walletRecoveryRequired:es}=function(){let{setAuthenticationStatus:e,setConnectorStatus:t,authenticationStatus:a,connectorStatus:c,open:l}=(0,k.useSiwxContext)(),{isLoggedIn:u,isLoggedInPending:d,authenticatedUser:R,gamma:T,setWasSessionPersisted:W,isSigningOut:F}=(0,I.useAuthenticationContext)(),q=(0,f.useDocumentVisibility)(),$=(0,v.useConfig)(),{connector:G,status:B,address:H,chainId:Q}=(0,b.useConnection)(),{disconnect:J}=(0,M.useDisconnect)(),{onConnect:z}=(0,L.useOnConnect)(),{onReconnect:V}=function(){let e,t,a,i,o,c=(0,r.c)(17),{setConnector:l,setAuthenticationStatus:u,setConnectorStatus:d}=(0,k.useSiwxContext)(),{signIn:f,authenticatedUser:p,isLoggedIn:g,setWasSessionPersisted:m}=(0,I.useAuthenticationContext)(),{disconnect:y}=(0,M.useDisconnect)();c[0]!==p||c[1]!==y||c[2]!==g||c[3]!==u||c[4]!==l||c[5]!==d||c[6]!==m||c[7]!==f?(e={mutationFn:async e=>{let{address:t,chainId:r,connector:a,isCurrent:i}=e;if(i&&!i())return;let o=(0,h.createWalletCache)();if((0,n.isMagicConnector)(a.id)||g&&D(p?.address,t)&&o.state.value?.connectorId===a.id){if(!o.state.exists&&(0,n.isMagicConnector)(a.id)){(0,A.setLogoutTrigger)({reason:"session_invalidated",initiator:"system",trigger:"on_reconnect_missing_auth_cache"}),y();return}(i||o.state.oauthRedirected)&&l({id:a.id,name:a.name}),o.state.oauthRedirected&&f({account:t,connector:a,chainId:r,authenticatedUser:p}),d(s.ConnectorStates.CONNECTED),o.state.oauthRedirected||u(s.AuthenticationStatusStates.SUCCESS),m(!0)}}},c[0]=p,c[1]=y,c[2]=g,c[3]=u,c[4]=l,c[5]=d,c[6]=m,c[7]=f,c[8]=e):e=c[8];let w=(0,U.useMutation)(e);return c[9]!==w?({mutate:t,mutateAsync:a,...i}=w,c[9]=w,c[10]=t,c[11]=a,c[12]=i):(t=c[10],a=c[11],i=c[12]),c[13]!==t||c[14]!==a||c[15]!==i?(o={onReconnect:t,onReconnectAsync:a,...i},c[13]=t,c[14]=a,c[15]=i,c[16]=o):o=c[16],o}(),{mutate:Z,mutateAsync:Y,connectionAttemptRef:X}=function(){let{setAuthenticationStatus:e,setConnectorStatus:t,setConnector:r}=(0,k.useSiwxContext)(),{authenticatedUser:n}=(0,I.useAuthenticationContext)(),{disconnect:a}=(0,M.useDisconnect)(),c=i.default.useRef(n);c.current=n;let l=(0,O.useConnectors)(),u=i.default.useRef(0);i.default.useEffect(()=>{let e=({type:e})=>{"connecting"===e&&(u.current+=1)};return l.forEach(t=>t.emitter.on("message",e)),()=>l.forEach(t=>t.emitter.off("message",e))},[l]);let d=e=>{let t=(0,h.createWalletCache)().state.value?.connectorId;return(0,P.getLogoutGuardDecision)({authenticatedUserType:n?.type,cacheConnectorId:t,connectorIds:[e]})},{mutate:f,mutateAsync:p}=(0,N.useReconnect)({mutation:{onMutate:()=>({address:n?.address,connectorId:(0,h.createWalletCache)().state.value?.connectorId,connectionAttempt:u.current}),onSuccess:async(i,l,f)=>{if(f?.connectionAttempt!==u.current||!D(f?.address,c.current?.address)||f?.connectorId!==(0,h.createWalletCache)().state.value?.connectorId)return;let p=l?.connectors?.length?l.connectors[0]:void 0,g=i.find(e=>e.connector.id===p?.id);if(g&&D(g.accounts[0],c.current?.address)){r({id:g.connector.id,name:g.connector.name}),t(s.ConnectorStates.CONNECTED);return}let m=p?.id;if(!n)return void o.logger.info("[useReconnect > onSuccess] Ignoring reconnect without connection; auth unresolved",{attemptedConnectorId:m});let y=d(m),w="magic_non_magic_connector"===y.reason?"magic_non_magic_reconnect":y.reason;y.shouldLogout?(o.logger.info("[useReconnect > onSuccess] Attempting connection from provided connectors",{connectorIds:l?.connectors?.map(e=>e.id)}),t(s.ConnectorStates.DISCONNECTED),e(s.AuthenticationStatusStates.IDLE),"eoa"!==n.type&&a({signOutOnDisconnect:!1}),o.logger.info("[useReconnect > onSuccess] No connection found; preserving session",{connectorIds:l?.connectors?.map(e=>e.id),attemptedConnectorId:m,authType:n.type,cacheConnectorId:y.cacheConnectorId})):o.logger.info("[useReconnect > onSuccess] Ignoring reconnect without connection",{attemptedConnectorId:m,authType:n.type,cacheConnectorId:y.cacheConnectorId,skipReason:w})},onError:(r,a,i)=>{if(i?.connectionAttempt!==u.current||!D(i?.address,c.current?.address)||i?.connectorId!==(0,h.createWalletCache)().state.value?.connectorId)return;let l=a?.connectors?.[0]?a.connectors[0].id:void 0;if(!n)return void o.logger.info("[useReconnect > reconnectAsync] Ignoring reconnect error; auth unresolved",{attemptedConnectorId:l,error:r});let f=d(l),p="magic_non_magic_connector"===f.reason?"magic_non_magic_reconnect":f.reason;f.shouldLogout?(o.logger.info("[useReconnect > reconnectAsync] Reconnect error; preserving session",{error:r,connectorIds:a?.connectors?.map(e=>e.id),attemptedConnectorId:l,authType:n.type,cacheConnectorId:f.cacheConnectorId,skipReason:p}
1),t(s.ConnectorStates.DISCONNECTED),e(s.AuthenticationStatusStates.IDLE)):o.logger.info("[useReconnect > reconnectAsync] Ignoring reconnect error",{attemptedConnectorId:l,authType:n.type,error:r,cacheConnectorId:f.cacheConnectorId,skipReason:p})}}});return{mutate:f,mutateAsync:p,connectionAttemptRef:u}}(),ee=(0,O.useConnectors)(),et=(0,g.usePrevious)(q),er=i.default.useRef(!1),en=i.default.useRef(!1),ea=i.default.useRef(!1),ei=i.default.useRef(!1),eo=i.default.useRef(null),[es,ec]=i.default.useState(!1),el=i.default.useRef(null),eu=i.default.useRef(!1),ed=(0,y.useUnmountedRef)(),[eh,ef]=i.default.useState(),[ep,eg]=i.default.useState(0),em=i.default.useRef(0),ey=i.default.useRef({isLoggedIn:u,authenticatedUser:R,gammaStatus:T.status});ey.current={isLoggedIn:u,authenticatedUser:R,gammaStatus:T.status};let ew=i.default.useRef({authenticationStatus:a,connectorStatus:c,isLoggedInPending:d,open:l});ew.current={authenticationStatus:a,connectorStatus:c,isLoggedInPending:d,open:l};let ev=i.default.useCallback(r=>r===X.current&&"logged-out"===ey.current.gammaStatus&&(e(s.AuthenticationStatusStates.IDLE),t(s.ConnectorStates.DISCONNECTED),ef(void 0),!0),[X,e,t]),eb=i.default.useCallback((e,t)=>{let r=$.state.connections.get(e.uid);if($.state.current===e.uid&&D(r?.accounts[0],t)){eu.current=!0;try{e.emitter.emit("disconnect")}finally{eu.current=!1}}},[$]),eC=i.default.useCallback(async(r,n)=>{let a=ey.current.authenticatedUser?.address;if(el.current||!a)return;let i={connectionAttempt:X.current};el.current=i;let o=(0,x.createDiagnosticId)(),c=Date.now();"retry"!==n&&(em.current=i.connectionAttempt,eg(0)),("boot"===n||"disconnect"===n)&&(t(s.ConnectorStates.RECONNECTING),e(s.AuthenticationStatusStates.PERSISTING)),(0,E.sendAuthDiagnosticEvent)("wallet_recovery_started",{recoveryAttemptId:o,connectorId:r.id,trigger:n});try{let l=await Y({connectors:[r]}).catch(()=>void 0);if(ed.current)return;let u=ey.current,d=(0,h.createWalletCache)().state.value;if(i.connectionAttempt!==X.current||!u.isLoggedIn||!D(u.authenticatedUser?.address,a)||d?.connectorId!==r.id){if(!ev(i.connectionAttempt)&&i.connectionAttempt===X.current&&u.isLoggedIn&&u.authenticatedUser?.type==="eoa"){let n=l?.find(e=>e.connector.id===r.id);n&&eb(r,n.accounts[0]),e(s.AuthenticationStatusStates.IDLE),t(s.ConnectorStates.DISCONNECTED),ef(u.authenticatedUser.address)}(0,E.sendAuthDiagnosticEvent)("wallet_recovery_discarded",{recoveryAttemptId:o,connectorId:r.id,trigger:n,durationMs:Date.now()-c});return}"boot"===n&&(er.current=!0);let f=l?.some(e=>e.connector.id===r.id&&D(e.accounts[0],a)),p=l?.find(e=>e.connector.id===r.id);!f&&p&&eb(r,p.accounts[0]),e(f?s.AuthenticationStatusStates.SUCCESS:s.AuthenticationStatusStates.IDLE),t(f?s.ConnectorStates.CONNECTED:s.ConnectorStates.DISCONNECTED),ef(f?void 0:a),(0,E.sendAuthDiagnosticEvent)("wallet_recovery_completed",{recoveryAttemptId:o,connectorId:r.id,trigger:n,outcome:f?"restored":"action_required",durationMs:Date.now()-c})}finally{el.current===i&&(el.current=null)}},[X,eb,Y,e,t,ev,ed]),eS="disconnected"===B,e_="connected"===B;i.default.useEffect(()=>{el.current&&ev(el.current.connectionAttempt)&&("connecting"===B||"reconnecting"===B)&&!H&&(0,S.disconnect)($)},[$,T.status,B,H,ev]),(0,C.useConnectionEffect)({onDisconnect:()=>{if(eu.current)return;let e=(0,h.createWalletCache)().state.value;if(!u||R?.type!=="eoa"||e?.type!=="eoa")return;let t=ee.find(t=>t.id===e.connectorId);t?.type==="injected"&&eC(t,"disconnect")},onConnect:({address:e,chainId:t,connector:r,isReconnected:a})=>{a&&((0,n.isMagicConnector)(r.id)&&(0,h.createWalletCache)().state.oauthRedirected&&(en.current=!0),V({address:e,connector:r,chainId:t}))}}),i.default.useEffect(()=>{!en.current&&G&&Q&&H&&(0,n.isMagicConnector)(G.id)&&(0,h.createWalletCache)().state.oauthReconnecting&&(en.current=!0,z({address:H,chainId:Q,connector:G,isReconnected:!1}))},[G,Q,H,z]),i.default.useEffect(()=>{if(!er.current&&!el.current&&!d&&a===s.AuthenticationStatusStates.PERSISTING){if(eS){let r=(0,h.createWalletCache)().state.value,n=(({isLoggedIn:e,authenticatedUserType:t,cachedEoaConnectorId:r,announcedConnectorIds:n,alreadyAttempted:a,waitExpired:i})=>e?a?{action:"settle_logged_out",reason:"already_attempted"}:"magic"===t?{action:"settle_logged_out",reason:"magic_session"}:r?n.includes(r)?{action:"reconnect",connectorId:r}:i?{action:"settle_logged_out",reason:"connector_wait_expired"}:{action:"wait",connectorId:r}:{action:"settle_logged_out",reason:"no_cached_eoa_connector"}:{action:"settle_logged_out",reason:"not_logged_in"})({isLoggedIn:u,authenticatedUserType:R?.type,cachedEoaConnectorId:r?.type==="eoa"?r.connectorId:void 0,announcedConnectorIds:ee.map(e=>e.id),alreadyAttempted:ei.current,waitExpired:es});if("reconnect"===n.action){ei.current=!0,o.logger.info("[useReconnection] Reconnecting cached EOA connector on boot",{connectorId:n.connectorId,authType:R?.type});let e=ee.find(e=>e.id===n.connectorId);e&&eC(e,"boot");return}if("wait"===n.action){eo.current||(eo.current=setTimeout(()=>{ec(!0)},4e3));return}er.current=!0,u&&R?.type==="eoa"&&(em.current=X.current,ef(R.address)),e(s.AuthenticationStatusStates.IDLE),t(s.ConnectorStates.DISCONNECTED),u&&o.logger.info("[useReconnection] Settling boot as disconnected with a live Gamma session",{reason:n.reason,authType:R?.type});return}if(e_&&!(0,h.createWalletCache)().state.oauthReconnecting)if(u){er.current=!0;let r=D(H,R?.address);e(r?s.AuthenticationStatusStates.SUCCESS:s.AuthenticationStatusStates.IDLE),t(r?s.
1ConnectorStates.CONNECTED:s.ConnectorStates.DISCONNECTED),r&&W(!0),!r&&R?.type==="eoa"&&(ef(R.address),G&&eb(G,H))}else"logged-out"===T.status?(er.current=!0,e(s.AuthenticationStatusStates.IDLE),t(s.ConnectorStates.DISCONNECTED),(0,A.setLogoutTrigger)({reason:"session_invalidated",initiator:"system",trigger:"reconnection_connected_not_logged_in"}),J()):"failure"===T.status&&(er.current=!0,e(s.AuthenticationStatusStates.SUCCESS),t(s.ConnectorStates.CONNECTED),o.logger.warn("[useReconnection] Preserving session on gamma auth check failure",{gammaStatus:T.status,gammaFailureCode:T.code,gammaFailureType:T.type,walletStatus:B}))}},[u,T,d,eS,e_,H,B,a,R,ee,eC,G,X,eb,es,e,t,W,J]),i.default.useEffect(()=>()=>{eo.current&&clearTimeout(eo.current)},[]),i.default.useEffect(()=>{if("hidden"===q){ea.current=!1;return}if("visible"===q&&"hidden"===et){if(ea.current)return;if(d)return void o.logger.info("[useReconnection] Skipping reconnect on visibility; auth still pending",{visibility:q,status:B});if(!u||"disconnected"!==B)return;let e=w.default.get(j.LAST_CONNECTOR_COOKIE_KEY),t=ee.find(t=>t.id===e);if(!t)return;if(!R)return void o.logger.info("[useReconnection] Skipping reconnect on visibility; authenticated user unresolved",{connectorId:t.id});let r=(0,h.createWalletCache)().state.value?.connectorId;if(!r)return void o.logger.info("[useReconnection] Skipping reconnect on visibility; missing cache connector",{authType:R.type,connectorId:t.id});let n=(0,P.getLogoutGuardDecision)({authenticatedUserType:R.type,cacheConnectorId:r,connectorIds:[t.id]}),i="magic_non_magic_connector"===n.reason?"magic_non_magic_reconnect":n.reason;if(!n.shouldLogout)return void o.logger.info("[useReconnection] Skipping reconnect for visibility guard",{authType:R.type,connectorId:t.id,cacheConnectorId:n.cacheConnectorId,skipReason:i});if(o.logger.info("[useReconnection] Reconnecting on visibility restore",{authType:R.type,connectorId:t.id,cacheConnectorId:n.cacheConnectorId}),ea.current=!0,"eoa"===R.type&&"injected"===t.type){if(l||a===s.AuthenticationStatusStates.PENDING)return;eC(t,"visibility")}else Z({connectors:[t]})}},[q,et,eC,ee,u,d,B,Z,R,l,a]);let eA=u&&R?.type==="eoa"&&D(eh,R.address)&&!(e_&&D(H,eh)&&c===s.ConnectorStates.CONNECTED&&a===s.AuthenticationStatusStates.SUCCESS);i.default.useEffect(()=>{if(!e_||!G||!(0,n.isMagicConnector)(G.id)||!H||!Q)return;let e=X.current,t=()=>{let t=ey.current,r=ew.current,n=(0,h.createWalletCache)(),a=n.state.getMagicState({connectionStates:["ready"]}),i=(0,_.getConnection)($);return!ed.current&&e===X.current&&!F()&&!r.isLoggedInPending&&!r.open&&"success"===t.gammaStatus&&t.isLoggedIn&&t.authenticatedUser?.type==="magic"&&D(t.authenticatedUser.address,H)&&"connected"===i.status&&i.connector?.uid===G.uid&&i.chainId===Q&&D(i.address,H)&&a?.connectorId===G.id&&(void 0===a.address||D(a.address,H))&&!n.state.oauthReconnecting&&!n.state.oauthRedirected&&(r.authenticationStatus===s.AuthenticationStatusStates.IDLE||r.authenticationStatus===s.AuthenticationStatusStates.PERSISTING||r.authenticationStatus===s.AuthenticationStatusStates.SUCCESS)&&(r.connectorStatus===s.ConnectorStates.DISCONNECTED||r.connectorStatus===s.ConnectorStates.RECONNECTING||r.connectorStatus===s.ConnectorStates.CONNECTED)&&(r.authenticationStatus!==s.AuthenticationStatusStates.SUCCESS||r.connectorStatus!==s.ConnectorStates.CONNECTED)};t()&&V({address:H,chainId:Q,connector:G,isCurrent:t})},[e_,G,H,Q,$,a,c,u,d,R?.address,R?.type,T.status,l,F,X,V,ed]);let eE=ee.find(e=>e.id===(0,h.createWalletCache)().state.value?.connectorId),eI=eA&&!d&&!l&&"hidden"!==q&&a===s.AuthenticationStatusStates.IDLE&&c===s.ConnectorStates.DISCONNECTED&&eE?.type==="injected",ek=em.current===X.current;i.default.useEffect(()=>{if(eI&&ek&&!el.current&&e_&&G&&H&&Q&&G.id===eE?.id){if(!D(H,eh))return void eb(G,H);V({address:H,chainId:Q,connector:G})}},[eI,ek,e_,G,H,Q,eE?.id,eh,eb,V]);let ex=e=>{if(eI&&eE&&"disconnected"===$.state.status&&!el.current){if("retry"===e){if(!ek)return;eg(e=>e+1)}eC(eE,e)}};return(0,p.useEventListener)("focus",()=>ex("focus")),(0,m.useTimeout)(()=>ex("retry"),eI&&ek&&eS?K[ep]:void 0),{walletRecoveryRequired:eA}}();z[16]!==eo||z[17]!==ee||z[18]!==et||z[19]!==es?(Q={walletRecoveryRequired:es,openW3M:et,isOpenW3M:ee,getUri:eo},z[16]=eo,z[17]=ee,z[18]=et,z[19]=es,z[20]=Q):Q=z[20];let ec=Q;return z[21]!==V||z[22]!==ec?(J=(0,t.jsx)(B.Provider,{value:ec,children:V}),z[21]=V,z[22]=ec,z[23]=J):J=z[23],J}let Q=()=>{let e=i.default.useContext(B);if(!e)throw Error("useConnectorContext Hook must be inside a Provider.");return e}},67165,e=>{"use strict";e.s(["SafeContextProvider",()=>g,"useSafeContext",()=>m],67165);var t=e.i(303115),r=e.i(846574),n=e.i(728056),a=e.i(45806),i=e.i(566344),o=e.i(910233),s=e.i(32221),c=e.i(681663),l=e.i(334769),u=e.i(371135),d=e.i(557140),h=e.i(435248),f=e.i(387281);let p=a.default.createContext(null);function g(e){let g,m,y,w,v,b,C=(0,r.c)(14),{children:S}=e,{proxyAddress:_,walletMode:A}=(0,f.useAccount)();(()=>{let{address:e,walletMode:t,depositWalletMode:r,proxyAddress:n,isConnected:i,isReconnecting:o,c
1onnector:p,authenticationType:g}=(0,f.useAccount)(),{isLoggedIn:m,isLoggedInPending:y}=(0,l.useAuthenticationContext)(),w=(0,s.useMisroutedDepositWalletStore)(e=>e.setMisroutedEoa),v=(0,s.useMisroutedDepositWalletStore)(e=>e.misroutedEoas),b=!!e&&!!v[e.toLowerCase()],C=m&&!y&&i&&!o&&!!e&&"depositWallet"===t;a.default.useEffect(()=>{if(!C||!e||b||"uups"!==r&&"beacon"!==r)return;let t=!1;return(async()=>{let a=[{kind:"magic-proxy",addr:(0,d.getProxyAddress)(e,"magic")},{kind:"safe",addr:(0,d.getProxyAddress)(e,"eoa")}];"beacon"===r&&a.push({kind:"deposit-wallet",addr:(0,d.getProxyAddress)(e,"uups")});let i=await Promise.all(a.map(async t=>{try{let[e,r]=await Promise.all([(0,d.isSafeDeployedOnChain)(t.addr),(0,h.getPusdBalance)(t.addr)]);return{kind:t.kind,misrouted:e&&r>0n}}catch(n){return c.logger.warn("[misrouted-deposit-wallet] misroute check failed; skipping candidate",(0,u.getSafeAuthDiagnosticContext)({misrouteKind:t.kind,gammaScheme:r,hasEoa:!!e,errorMessage:n instanceof Error?n.message:String(n)})),{kind:t.kind,misrouted:!1}}}));if(t)return;let o=i.filter(e=>e.misrouted);if(0!==o.length){for(let{kind:t}of o)c.logger.info("[misrouted-deposit-wallet] funded wallet detected outside gamma proxyWallet",(0,u.getSafeAuthDiagnosticContext)({event:"misroute_detected",misrouteKind:t,gammaScheme:r,hasFunds:!0,authType:g,walletMode:"depositWallet",connectorId:p?.id,hasDepositWallet:!!n,hasEoa:!!e}));w(e,!0)}})(),()=>{t=!0}},[e,n,r,b,C,w,g,p?.id])})(),C[0]!==_?(g=i.queryKeys[o.QueryKey.Auth].safeDeployed(_),C[0]=_,C[1]=g):g=C[1],C[2]!==_?(m=()=>(0,d.isSafeDeployedOnChain)(_),C[2]=_,C[3]=m):m=C[3];let E=!!_&&"safe"===A;C[4]===Symbol.for("react.memo_cache_sentinel")?(y={persist:!0},C[4]=y):y=C[4],C[5]!==g.queryKey||C[6]!==m||C[7]!==E?(w={queryKey:g.queryKey,queryFn:m,enabled:E,gcTime:0x7fffffff,staleTime:0x7fffffff,meta:y},C[5]=g.queryKey,C[6]=m,C[7]=E,C[8]=w):w=C[8];let{data:I}=(0,n.useQuery)(w),k=!!I;C[9]!==k?(v={isSafeDeployed:k},C[9]=k,C[10]=v):v=C[10];let x=v;return C[11]!==S||C[12]!==x?(b=(0,t.jsx)(p.Provider,{value:x,children:S}),C[11]=S,C[12]=x,C[13]=b):b=C[13],b}let m=()=>{let e=a.default.useContext(p);if(!e)throw Error("useSafeContext Hook must be inside a Provider.");return e}},720909,e=>{"use strict";e.s(["SiwxContextProvider",()=>f,"useSiwxContext",()=>p]);var t=e.i(303115),r=e.i(382928),n=e.i(669718),a=e.i(45806),i=e.i(244876),o=e.i(519216),s=e.i(871554),c=e.i(304695),l=e.i(334769),u=e.i(515796),d=e.i(67165);let h=a.default.createContext(null);function f({walletConnectCTA:e="both",bufferPolyfill:p=!0,initialChainId:g=o.MATIC_CONFIG.chainId,nonceRefetchInterval:m=9e5,signOutOnDisconnect:y=!0,children:w}){let v=a.default.useMemo(()=>({walletConnectCTA:e,bufferPolyfill:p,initialChainId:g,nonceRefetchInterval:m,signOutOnDisconnect:y}),[e,p,g,m,y]),[b,C]=a.default.useState(s.AuthenticationStatusStates.PERSISTING),[S,_]=a.default.useState({id:"",name:void 0,coercedConnector:void 0}),[A,E]=a.default.useState(!1),[I,k]=a.default.useState(s.AuthRoute.CONNECTORS),[x,P]=a.default.useState(s.ConnectorRoute.LOGIN),[R,T]=a.default.useState(s.OnboardingRoute.CREATEACCOUNT),[D,O]=a.default.useState(s.ConnectorStates.RECONNECTING),[M,L]=a.default.useState(!1),{lastConnectorId:U,updateLastConnectorId:N}=(0,c.useSingletonLastConnector)(),j=a.default.useRef(null),K=a.default.useRef(null),W=(0,r.usePrevious)(A);a.default.useEffect(()=>{let e;if(!A&&W){let t=b===s.AuthenticationStatusStates.REJECTED||b===s.AuthenticationStatusStates.ERROR||b===s.AuthenticationStatusStates.ACCOUNT_DELETED||b===s.AuthenticationStatusStates.BLOCKED?s.AuthenticationStatusStates.IDLE:void 0,r=!!(0,n.createWalletCache)().state.getMagicState({connectionStates:["requesting","redirect","after-redirect-result","pending"]}),a=D!==s.ConnectorStates.REJECTED&&D!==s.ConnectorStates.FAILED&&D!==s.ConnectorStates.UNAVAILABLE&&(D!==s.ConnectorStates.CONNECTING||r)?void 0:s.ConnectorStates.DISCONNECTED;e=setTimeout(()=>{k(s.AuthRoute.CONNECTORS),L(!1),a&&O(e=>e===D?a:e),t&&C(e=>e===b?t:e)},500)}return()=>{e&&clearTimeout(e)}},[A]);let F=a.default.useMemo(()=>({connector:S,connectorRoute:x,connectorStatus:D,lastConnectorId:U,magicOauthPendingTimeout:K,magicOauthRedirectTimeout:j,onboardingRoute:R,open:A,options:v,preventClose:M,route:I,setConnector:_,setConnectorRoute:P,setConnectorStatus:O,setOnboardingRoute:T,setOpen:E,setPreventClose:L,setRoute:k,updateLastConnectorId:N,authenticationStatus:b,setAuthenticationStatus:C}),[S,x,D,U,K,j,R,A,v,M,I,_,P,O,T,E,L,k,N,b,C]);return(0,t.jsx)(h.Provider,{value:F,children:(0,t.jsx)(l.AuthenticationContextProvider,{children:(0,t.jsx)(i.SunbreakAuthenticationProvider,{children:(0,t.jsx)(d.SafeContextProvider,{children:(0,t.jsx)(u.ConnectorContextProvider,{children:w})})})})})}let p=()=>{let e=a.default.useContext(h);if(!e)throw Error("useSiwxContext Hook must be inside a Provider.");return e}},745507,e=>{"use strict";e.s(["useAccountState",()=>c]);var t=e.i(45806),r=e.i(901822),n=e.i(871554),a=e.i(334769),i=e.i(720909),o=e.i(280042),s=e.i(387281);let c=()=>{let e=(0,r.default)(),{connectorStatus:c,authenticationStatus:l}=(0,i.useSiwxContext)(),{authenticatedUser:u,isLoggedIn:d,isLoggedInPending:h}=(0,a.useAuthenticationContext)(),{address:f,proxyAddress:p,authenticationType:g,walletMode:m,status:y}=(0,s.useAccount)({optimisticMagic:!0}),w=t.default.useRef(void 0);return e&&void 0===w.current&&(w.current=!!(0,o.getSessionHint)()),t.default.useMemo(()=>{let t=c===n.ConnectorStates.RECONNECTING||"reconnecting"===y&&!f,r=h||l===n.AuthenticationStatusStates.PERSISTING;if(e){let e=!!u?.address&&!!f&&u.address.toLowerCase()===f.toLowerCase();if(f&&u&&e&&d&&c===n.ConnectorStates.CONNECTED&&l===n.AuthenticationStatusStates.SUCCESS)return{baseAddress:f,proxyAddress:p,authenticated:!0,isSessionLoading:t||r,authenticationType:g,walletMode:m}}let a=w.current??!0;return{baseAddress:void 0,proxyAddress:void 0,authenticated:!1,isSessionLoading:!e||(t||r)&&a,authenticationType:void 0,walletMode:void 0}},[f,p,g,m,u,e,l,c,d,h,y])}},969346,863226,582855,176630,778377,e=>{"use strict";e.s(["useLongPendingOauth",()=>T],778377),e.s(["useWalletConnectUri",()=>R],969346),e.s(["useConnect",()=>I],582855),e.s(["useOnConnect",()=>E],863226);var t=e.i(846574),r=e.i(45806),n=e.i(28168),a=e.i(681663),i=e.i(519216),o=e.i(720909),s=e.i(669718),c=e.i(668168),l=e.i(443911),u=e.i(238874),d=e.i(830598),h=e.i(393171),f=e.i(37760),p=e.i(871554),g=e.i(334769),m=e.i(95293),y=e.i(401512),w=e.i(256490),v=e.i(304695),b=e.i(608114),C=e.i(748858),S=e.i(256750),_=e.i(990044),A=e.i(584564);function E(){let e,r,n,a,i,l=(0,t.c)(18),{setRoute:u,setConnector:d,setAuthenticationStatus:f,setConnectorStatus:m}=(0,o.useSiwxContext)(),{signIn:y,authenticatedUser:w}=(0,g.useAuthenticationContext)(),{emitConnectAnalytics:E}=(0,_.useWalletAnalytics)(),{disconnect:I}=(0,A.useDisconnect)(),{updateLastConnectorId:k}=(0,v.useLastConnector)();l[0]!==w||l[1]!==I||l[2]!==E||l[3]!==f||l[4]!==d||l[5]!==m||l[6]!==u||l[7]!==y||l[8]!==k?(e={mutationFn:async e=>{let{address:t,chainId:r,connector:n,isReconnected:a}=e,i=(0,s.createWalletCache)();if(a&&!i.state.exists&&(0,c.isMagicConnector)(n.id)){(0,h.setLogoutTrigger)({reason:"session_invali
1dated",initiator:"system",trigger:"on_connect_reconnect_missing_auth_cache"}),I();return}if(E({address:t,connector:n}),!a){let e=n.id;(0,c.isWalletConnectConnector)(n.id)&&(d(t=>{let r;return(0,c.isWalletConnectConnector)(t.id)||(e=(r={id:t.id,name:t.name}).id),{id:n.id,name:n.name,coercedConnector:r}}),u(p.AuthRoute.CONNECT)),k(e)}if(i.state.oauthRedirected||!a){d({id:n.id,name:n.name});let e=w?.address?.toLowerCase()===t.toLowerCase()?w:void 0;y({account:t,connector:n,chainId:r,authenticatedUser:e}),a||((0,C.trackEvent)("wallet_connected"),(0,S.trackEvent)("wallet_connected",{external_wallet_id:t,wallet_provider:n.id}))}m(p.ConnectorStates.CONNECTED),a&&!i.state.oauthRedirected&&f(p.AuthenticationStatusStates.SUCCESS)}},l[0]=w,l[1]=I,l[2]=E,l[3]=f,l[4]=d,l[5]=m,l[6]=u,l[7]=y,l[8]=k,l[9]=e):e=l[9];let x=(0,b.useMutation)(e);return l[10]!==x?({mutate:r,mutateAsync:n,...a}=x,l[10]=x,l[11]=r,l[12]=n,l[13]=a):(r=l[11],n=l[12],a=l[13]),l[14]!==r||l[15]!==n||l[16]!==a?(i={onConnect:r,onConnectAsync:n,...a},l[14]=r,l[15]=n,l[16]=a,l[17]=i):i=l[17],i}let I=e=>{let r,n,i,b,C,S,_,A,I,k,x,P,R,T,D,O,M,L,U=(0,t.c)(50);U[0]!==e?(r=void 0===e?{}:e,U[0]=e,U[1]=r):r=U[1],U[2]!==r?({mutation:n,reconnectOnAlreadyConnected:b,...i}=r,U[2]=r,U[3]=n,U[4]=i,U[5]=b):(n=U[3],i=U[4],b=U[5]);let N=void 0===b||b,{options:j,setConnectorStatus:K,setRoute:W}=(0,o.useSiwxContext)(),{authenticatedUser:F,isLoggedIn:q,signOut:$}=(0,g.useAuthenticationContext)(),{updateLastConnectorId:G}=(0,v.useLastConnector)(),{onConnect:B}=E();U[6]!==B||U[7]!==K?(C=e=>{if(e.length){let t=e[0];B({address:t.accounts[0],connector:t.connector,chainId:t.chainId,isReconnected:!1})}else K(p.ConnectorStates.FAILED)},U[6]=B,U[7]=K,U[8]=C):C=U[8],U[9]!==F||U[10]!==q||U[11]!==K||U[12]!==$?(S=(e,t)=>{if((0,f.isUserRejection)(e)){let r=t?.connectors?.[0]?t.connectors[0].id:void 0;(0,m.logAuthFlowError)({authStatus:"rejected",connectorId:r,error:e,trigger:"connect"}),K(p.ConnectorStates.REJECTED);return}if(!F)return;let r=t?.connectors?.[0]?t.connectors[0].id:void 0,n=(0,s.createWalletCache)().state.value?.connectorId,i=(0,w.getLogoutGuardDecision)({authenticatedUserType:F.type,cacheConnectorId:n,connectorIds:[r]}),o="magic_non_magic_connector"===i.reason?"magic_non_magic_reconnect":i.reason;q&&"eoa"===F.type?K(p.ConnectorStates.FAILED):i.shouldLogout?((0,h.setLogoutTrigger)({reason:"reconnect_error",initiator:"system",trigger:"connect_reconnect_error"}),$()):a.logger.info("[useConnect > reconnect] Skipping signOut for reconnect guard",{authType:F.type,attemptedConnectorId:r,cacheConnectorId:i.cacheConnectorId,skipReason:o})},U[9]=F,U[10]=q,U[11]=K,U[12]=$,U[13]=S):S=U[13],U[14]!==C||U[15]!==S?(_={mutation:{onSuccess:C,onError:S}},U[14]=C,U[15]=S,U[16]=_):_=U[16];let{mutate:H}=(0,u.useReconnect)(_);U[17]!==H||U[18]!==N||U[19]!==K||U[20]!==W?(A=(e,t)=>{if(N&&"ConnectorAlreadyConnectedError"===e.name)return void H({connectors:[t.connector]});let r=(0,s.createWalletCache)();if((0,c.isMagicConnector)(t.connector.id)){if(e instanceof l.GoogleOneTapDismissedError||"object"==typeof e&&null!==e&&"GoogleOneTapDismissedError"===e.name)return void K(p.ConnectorStates.DISCONNECTED);if(e instanceof l.GoogleOneTapUnavailableError||"object"==typeof e&&null!==e&&"GoogleOneTapUnavailableError"===e.name){(0,m.logAuthFlowError)({authStatus:"rejected",connectorId:t.connector.id,error:e,trigger:"connect"}),K(p.ConnectorStates.DISCONNECTED);return}if(-10005===e.code){W(p.AuthRoute.CONNECTORS),K(p.ConnectorStates.DISCONNECTED),r.state.clear(),r.wallets.clear();return}if(-32603===e.code||4001===e.code){r.state.update({connectionState:"requesting"}),K(p.ConnectorStates.REJECTED),(0,y.trackWalletConnectFailed)({walletProvider:t.connector.id,failureStep:"provider_connect",failureReason:"user_rejected"});return}if(r.state.getMagicState({connectionStates:["redirect"]}))return;(0,m.logAuthFlowError)({authStatus:"error",connectorId:t.connector.id,error:e,trigger:"connect"})}if((0,f.isUserRejection)(e)){K(p.ConnectorStates.REJECTED),(0,y.trackWalletConnectFailed)({walletProvider:t.connector.id,failureStep:"provider_connect",failureReason:"user_rejected"});return}
1K(p.ConnectorStates.FAILED),(0,y.trackWalletConnectFailed)({walletProvider:t.connector.id,failureStep:"provider_connect",failureReason:(0,y.normalizeAuthFailureReason)(e)}),a.logger.error("[useConnect > onError]",{error:e})},U[17]=H,U[18]=N,U[19]=K,U[20]=W,U[21]=A):A=U[21],U[22]!==B||U[23]!==K||U[24]!==G?(I=(e,t)=>{G(t.connector.id),K(p.ConnectorStates.CONNECTED),B({address:e.accounts[0],connector:t.connector,chainId:e.chainId,isReconnected:!1})},U[22]=B,U[23]=K,U[24]=G,U[25]=I):I=U[25],U[26]!==K?(k=e=>{let t=e.connector;(0,c.isWalletConnectConnector)(t.id)||(e.connector?K(p.ConnectorStates.CONNECTING):K(p.ConnectorStates.UNAVAILABLE))},U[26]=K,U[27]=k):k=U[27],U[28]!==n||U[29]!==A||U[30]!==I||U[31]!==k?(x={onError:A,onSuccess:I,onMutate:k,...n},U[28]=n,U[29]=A,U[30]=I,U[31]=k,U[32]=x):x=U[32],U[33]!==i||U[34]!==x?(P={mutation:x,...i},U[33]=i,U[34]=x,U[35]=P):P=U[35];let Q=(0,d.useConnect)(P);if(U[36]!==Q){let{mutate:e,mutateAsync:t,connect:r,connectAsync:n,connectors:a,...i}=Q;R=e,T=t,D=i,U[36]=Q,U[37]=R,U[38]=T,U[39]=D}else R=U[37],T=U[38],D=U[39];return U[40]!==R||U[41]!==j?.initialChainId?(O=e=>{let{connector:t,chainId:r,mutation:n}=e;return R({connector:t,chainId:r??j?.initialChainId},n)},U[40]=R,U[41]=j?.initialChainId,U[42]=O):O=U[42],U[43]!==T||U[44]!==j?.initialChainId?(M=async e=>{let{connector:t,chainId:r,mutation:n}=e;return T({connector:t,chainId:r??j?.initialChainId},n)},U[43]=T,U[44]=j?.initialChainId,U[45]=M):M=U[45],U[46]!==D||U[47]!==O||U[48]!==M?(L={connect:O,connectAsync:M,...D},U[46]=D,U[47]=O,U[48]=M,U[49]=L):L=U[49],L};var k=e.i(974917);let x=()=>{let e,r=(0,t.c)(2),n=(0,k.useConnectors)();return r[0]!==n?(e=n??[],r[0]=n,r[1]=e):e=r[1],e},P=()=>(e=>{let r,n=(0,t.c)(17),a=x();if("injected"===e){let t;if(n[7]!==a||n[8]!==e){let r;n[10]!==e?(r=t=>t.id===e&&t.name.includes("Injected"),n[10]=e,n[11]=r):r=n[11],t=a.find(r),n[7]=a,n[8]=e,n[9]=t}else t=n[9];return t}if(n[12]!==a||n[13]!==e){let t;n[15]!==e?(t=t=>t.id===e,n[15]=e,n[16]=t):t=n[16],r=a.find(t),n[12]=a,n[13]=e,n[14]=r}else r=n[14];return r})("walletConnect");function R(e){let s,c,l,u,d=(0,t.c)(12);d[0]!==e?(s=e??{},d[0]=e,d[1]=s):s=d[1];let{enabled:h}=s,f=void 0===h||h,[p,g]=r.default.useState(void 0),m=r.default.useRef(void 0),y=P(),{status:w}=(0,n.useConnection)(),v="disconnected"===w,b="connected"===w,{connectAsync:C}=I(),{options:S}=(0,o.useSiwxContext)();return d[2]!==C||d[3]!==f||d[4]!==b||d[5]!==v||d[6]!==S.initialChainId||d[7]!==y?(c=()=>{if(!f)return;let e=async function(e){let{type:t,data:r}=e;a.logger.debug("[useWalletConnectUri > WC Message]",{type:t,data:r}),"display_uri"===t&&(g(r),m.current=r)},t=async function(e){a.logger.debug("[useWalletConnectUri > connectWallet]");let t=await C({connector:e,chainId:S.initialChainId??i.MATIC_CONFIG.chainId});return!!t&&t},r=function(){a.logger.info("[useWalletConnectUri > handleDisconnect] WalletConnect disconnected",{connectorId:y?.id,isConnected:b,isDisconnected:v,hadUri:!!m.current,autoReconnect:!1}),g(void 0),m.current=void 0};async function n(e){a.logger.debug("[useWalletConnectUri > connectWalletConnect]");try{await t(e)}catch(t){a.logger.error("[useWalletConnectUri > connectWalletConnect]",{error:t}),t.code&&4001===t.code&&n(e)}}if(b){g(void 0),m.current=void 0;return}if(y)return v&&!m.current&&(a.logger.info("[useWalletConnectUri > connectWalletConnect] Starting URI generation",{connectorId:y.id,isConnected:b,isDisconnected:v}),n(y)),a.logger.debug("[useWalletConnectUri > add wc listeners]"),y.emitter.on("message",e),y.emitter.on("disconnect",r),()=>{a.logger.debug("[useWalletConnectUri > remove wc listeners]"),y.emitter.off("message",e),y.emitter.off("disconnect",r)}},l=[f,y,v,b,C,S.initialChainId],d[2]=C,d[3]=f,d[4]=b,d[5]=v,d[6]=S.initialChainId,d[7]=y,d[8]=c,d[9]=l):(c=d[8],l=d[9]),r.default.useEffect(c,l),d[10]!==p?(u={uri:p},d[10]=p,d[11]=u):u=d[11],u}e.s(["useConnectors",0,x,"useWalletConnectConnector",0,P],176630);let T=()=>{let{setConnectorStatus:e,magicOauthRedirectTimeout:t,magicOauthPendingTimeout:n,setAuthenticationStatus:i}=(0,o.useSiwxContext)(),{disconnect:c}=(0,A.useDisconnect)(),l=r.default.useCallback((t,r)=>{try{a.logger.error(`[useLongPendingOauth > handleResetConnectionStates] Magic oauth ${t} timeout`,{address:r}),(0,h.setLogoutTrigger)({reason:"magic_oauth_timeout",initiator:"system",trigger:`magic_oauth_${t}_timeout`}),e(p.ConnectorStates.DISCONNECTED),i(p.AuthenticationStatusStates.IDLE),c?.()}catch(e){a.logger.error(`[useLongPendingOauth > handleResetConnectionStates] error disconnecting after Magic oauth ${t} timeout`,{e})}},[e,c,i]);r.default.useEffect(()=>{let e=(0,s.createWalletCache)();return e.state.oauthReconnecting&&(t.current=setTimeout(()=>{let t=e.state.getMagicState({type:"oauth",connectionStates:["redirect"]});t&&l("redirect",t.address)},3e4),n.current=setTimeout(()=>{let t=e.state.getMagicState({type:"oauth",connectionStates:["after-redirect-result","pending"]});t&&l("pending",t.address)},4e4)),()=>{t.current&&clearTimeout(t.current),n.current&&clearTimeout(n.current)}},[])}},974437,166377,e=>{"use strict";e.s(["useIsLoggedIn",()=>k],974437);var t=e.i(43516),r=e.i(669718),n=e.i(728056),a=e.i(820399),i=e.i(45806),o=e.i(590873),s=e.i(92606),c=e.i(610077),l=e.i(396866),u=e.i(664009),d=e.i(84394),h=e.i(566344),f=e.i(910233),p=e.i(501596),g=e.i(681663),m=e.i(519216),y=e.i(957705),w=e.i(566592),v=e.i(371135),b=e.i(478542),C=e.i(557140),S=e.i(692827),_=e.i(280042);let A=({attempt:e,error:t,maxAttempts:r})=>{let n=t.response&&"object"==typeof t.response&&null!==t.response&&"type"in t.response&&"string"==typeof t.response.type?t.response.type:void 0;return(0,v.getSafeAuthDiagnosticContext)({attempt:e,errorMessage:t.message,errorName:t.name,gammaFailureCode:t.code,hasResponse:void 0!==t.response,maxAttempts:r,method:t.method,path:t.path,responseType:n,statusText:t.statusText})},E=async()=>{let e=await (0,p.getGammaClient)().auth.session();return"success"===e.status?{status:"success",type:e.data.type,address:e.data.address}:401===e.error.code?{status:"logged-out"}:{status:"failure",error:e.error,code:e.error.code,type:"other"}},I=async()=>{let e=b.IS_LOGGED_IN_RETRY_DELAYS_MS.length+1;for(let t=0;;t+=1){let r=t+1,n=await E();if("failure"!==n.status)return n;if(!(t<b.IS_LOGGED_IN_RETRY_DELAYS_MS.length&&(0,b.isRetryableIsLoggedInFailureCode)(n.code)))return g.logger.warn("[useIsLoggedIn] Gamma session probe failed",A({attempt:r,error:n.error,maxAttempts:e})),n;g.logger.info("[useIsLoggedIn] Retrying Gamma session probe after transient failure",A({attempt:r,error:n.error,maxAttempts:e})),await (0,w.wait)(b.IS_LOGGED_IN_RETRY_DELAYS_MS[t])}},k=()=>{let e=(0,a.useQueryClient)(),p=(0,o.useConfig)(),g=i.default.useRef(void 0),w=i.default.useRef(void 0),v=i.default.useCallback((n,a)=>{let i=e.getQueryData(l.accountProfileQueryOptions.queryKey),o=(0,C.matchDepositWalletAddress)(n,i?.proxyWallet)?.address??(0,C.matchDepositWalletAddress)(n,(0,r.createWalletCache)().wallets.value)?.address??(0,C.getProxyAddress)(n,a),g=`${n.toLowerCase()}:${o.toLowerCase()}`;if(w.current===g)return;w.current=g;let v=m.MATIC_CONFIG.chainId,b=(0,d.getChainSpecificUsdcAddress)(v);e.prefetchQuery({queryKey:h.queryKeys[f.QueryKey.Positions].value(o).queryKey,queryFn:()=>(0,c.positionsValueFetcher)(o),staleTime:15e3}),e.prefetchQuery({...(0,s.readContractsQueryOptions)(p,(0,S.getTokenBalanceParameters)({address:o,token:y.USDCE_ADDRESS,chainId:v})),staleTime:15e3}),e.prefetchQuery({queryKey:h.queryKeys[f.QueryKey.TokenBalance].token(o,b,v).queryKey,queryFn:()=>(0,u.tokenBalanceFetcher)(o,b,m.USDC_DECIMALS),staleTime:15e3}),(0,t.prefetchPerpsAccount)(e,n)},[p,e]);i.default.useEffect(()=>{let e=(0,_.getSessionHint)();e&&v(e.address,e.type)},[v]);let{data:b,error:A,isSuccess:E,refetch:k}=(0,n.useQuery)({queryKey:h.queryKeys[f.QueryKey.Auth].isLoggedIn().queryKey,queryFn:I,select:e=>"success"!==e.status||e.address?e:void 0,refetchOnMount:!0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1});return i.default.useEffect(()=>{if(!b){E&&k({cancelRefetch:!1}),A&&(w.current=void 0,(0,_.clearSessionHint)());return}if("success"!==b.status){w.current=void 0,(0,_.clearSessionHint)();return}(0,_.setSessionHint)(b.address,b.type),v(b.address,b.type)},[b,A,E,v,k]),{data:i.default.useMemo(()=>
1{if(!b&&!A)return{isLoggedIn:!1,isLoggedInPending:!0,authenticatedUser:void 0,gamma:{status:"pending"}};if(b?.status==="success"){let e={type:b.type,address:b.address};return g.current=e,{isLoggedIn:!0,isLoggedInPending:!1,authenticatedUser:e,gamma:{status:"success",type:b.type,address:b.address}}}return b?.status==="failure"?g.current?{isLoggedIn:!0,isLoggedInPending:!1,authenticatedUser:g.current,gamma:{status:"failure",code:b.code,type:b.type}}:{isLoggedIn:!1,isLoggedInPending:!1,authenticatedUser:void 0,gamma:{status:"failure",code:b.code,type:b.type}}:(g.current=void 0,{isLoggedIn:!1,isLoggedInPending:!1,authenticatedUser:void 0,gamma:{status:"logged-out"}})},[b,A]),prefetchBalances:v}},x=new Map;async function P(e,t){let r;if("u">typeof navigator&&navigator.locks)return navigator.locks.request(e,t);let n=x.get(e)??Promise.resolve(),a=new Promise(e=>{r=e}),i=n.then(()=>a);x.set(e,i),await n;try{return await t()}finally{r(),x.get(e)===i&&x.delete(e)}}e.s(["runWithLock",0,P],166377)},272580,969821,782168,e=>{"use strict";var t=e.i(728056),r=e.i(45806),n=e.i(566344),a=e.i(910233),i=e.i(501596),o=e.i(166377),s=e.i(681663),c=e.i(95293),l=e.i(371135),u=e.i(332124),d=e.i(766130),h=e.i(668168);let f=432e5,p=e=>{if("code"in e)return"number"==typeof e.code?e.code:void 0},g=async(e,t)=>{let r;if(!e)return t();let n=new AbortController,a=new Promise((t,a)=>{r=setTimeout(()=>{n.abort(Error("session refresh timed out")),a(Error("session refresh timed out"))},e)});try{return await Promise.race([t(n.signal),a])}finally{r&&clearTimeout(r)}},m=async({chainId:e,connector:t})=>(await t.ensureMagicSDK({chainId:e})).user.isLoggedIn(),y=({intervalMs:e,now:t,state:r})=>void 0!==r.lastFailureAt&&t-r.lastFailureAt<3e5?"failure_backoff":void 0!==r.lastRefreshAt&&t-r.lastRefreshAt<e?"not_due":void 0,w=e=>e(),v=async({authType:e,isCurrent:t,onStep:r,refreshSession:n,timeoutMs:a,variables:i})=>{let o=()=>g(a,e=>n(e?{...i,signal:e}:i)),s=await o();return"success"===s.status?s:500===p(s.error)&&t()&&(r?.("session_refresh_retrying",{authType:e,errorCode:p(s.error)}),t())?o():s},b=async({authenticatedUser:e,chainId:t,confirmSessionActive:r,connector:n,getMagicDidToken:a=d.getFreshMagicDidToken,intervalMs:i=f,isCurrent:o=()=>!0,isMagicLoggedIn:s=m,now:c=Date.now,onError:l,onSessionInvalidated:u,onStep:b,refreshSession:C,runExclusive:S=w,state:_,timeoutMs:A})=>{if(_.inFlight)return _.inFlight;let E=c(),I=y({intervalMs:i,now:E,state:_});if(I)return{status:"skipped",reason:I};if(!o())return{status:"skipped",reason:"stale_auth_state"};let k=S(async()=>{let d=y({intervalMs:i,now:c(),state:_});if(d)return{status:"skipped",reason:d};try{let r;if(!o())return{status:"skipped",reason:"stale_auth_state"};if(b?.("session_refresh_started",{authType:e.type}),"magic"===e.type){if(!t)return{status:"skipped",reason:"missing_chain_id"};if(!n||!(0,h.isMagicConnector)(n.id))return{status:"skipped",reason:"missing_magic_connector"};let i=await s({chainId:t,connector:n});if(!o())return{status:"skipped",reason:"stale_auth_state"};if(!i)return{status:"skipped",reason:"magic_logged_out"};let c=await a({chainId:t,connector:n});if(!o())return{status:"skipped",reason:"stale_auth_state"};if("failure"===c.status)throw c.error;r=c.data,b?.("magic_did_token_refreshed",{authType:e.type})}let i=await v({authType:e.type,isCurrent:o,onStep:b,refreshSession:C,timeoutMs:A,variables:r?{token:r}:void 0});if(!o())return{status:"skipped",reason:"stale_auth_state"};if("failure"===i.status)throw i.error;return _.lastFailureAt=void 0,_.lastRefreshAt=E,b?.("session_refresh_succeeded",{authType:e.type}),{status:"success",authenticatedUser:i.data}}catch(n){let t=n instanceof Error?n:Error(String(n));if(!o())return{status:"skipped",reason:"stale_auth_state"};if(_.lastFailureAt=E,401===p(t)){let n=!0;if(r){try{n=!await g(A,e=>r(e))}catch{n=!1}if(!o())return{status:"skipped",reason:"stale_auth_state"};n||b?.("session_refresh_invalidation_unconfirmed",{authType:e.type})}n&&await u?.(t)}return l?.(t),{status:"failure",error:t}}});_.inFlight=k;try{return await k}finally{_.inFlight=void 0}};var C=e.i(846574),S=e.i(820399),_=e.i(64260);let A="pm_perps_access",E=RegExp(`(?:^|; )${A}=([^;]+)`),I=()=>
1{if("u"<typeof document)return"";let e=document.cookie.match(E),t=e?.[1]?.toLowerCase();return t?.startsWith("0x")?t:""},k=e=>{if("u"<typeof document)return;let t=I();!t||e&&t!==e.toLowerCase()||(document.cookie=`${A}=; path=/; max-age=0; SameSite=Lax`)};e.s(["clearPerpsAccessHint",0,k,"getPerpsAccessHintAddress",0,I,"setPerpsAccessHintAddress",0,e=>{if("u"<typeof document)return;let t=e.toLowerCase();I()!==t&&(document.cookie=`${A}=${t}; path=/; max-age=604800; SameSite=Lax`)}],969821);var x=e.i(280042);let P=e=>e[0]===a.QueryKey.Account||e[0]===a.QueryKey.Approvals||e[0]===a.QueryKey.Deposit||e[0]===a.QueryKey.OpenOrders||e[0]===a.QueryKey.Positions||e[0]===a.QueryKey.Notifications,R=()=>{let e,t,r,i,o,s,c,l,u,d,h,f,p,g,m,y,w,v,b,_,A,E,I,P,R,M,L,U,N,j=(0,C.c)(8),K=(0,S.useQueryClient)(),{clearAuthenticatedCache:W}=(d=(0,C.c)(18),h=(0,S.useQueryClient)(),d[0]!==h?(r=()=>{h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Account].favoriteEvents().queryKey,exact:!0}),h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Account].preferences().queryKey,exact:!0}),h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Account].profile().queryKey,exact:!0})},d[0]=h,d[1]=r):r=d[1],f=r,d[2]!==h?(i=()=>{h.setQueryData(n.queryKeys[a.QueryKey.Notifications].cachedClob().queryKey,[]),h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Notifications].clob().queryKey,exact:!0}),h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Notifications].perps._def}),h.setQueryData(n.queryKeys[a.QueryKey.Notifications].watermark().queryKey,Date.now())},d[2]=h,d[3]=i):i=d[3],p=i,d[4]!==h?(o=()=>{h.removeQueries({queryKey:n.queryKeys[a.QueryKey.OpenOrders]._def,exact:!0}),h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Positions]._def,exact:!0})},d[4]=h,d[5]=o):o=d[5],g=o,d[6]!==h?(s=()=>{h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Approvals]._def})},d[6]=h,d[7]=s):s=d[7],m=s,d[8]!==h?(c=()=>{h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Deposit].transactions().queryKey,exact:!0}),h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Deposit].quotes().queryKey,exact:!0}),h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Deposit].copied().queryKey,exact:!0}),h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Deposit].chains().queryKey,exact:!0}),h.removeQueries({queryKey:n.queryKeys[a.QueryKey.Deposit].lastSeenT2bSourceBlock().queryKey,exact:!0})},d[8]=h,d[9]=c):c=d[9],y=c,d[10]!==f||d[11]!==m||d[12]!==y||d[13]!==p||d[14]!==g?(l=()=>{f(),m(),p(),g(),y()},d[10]=f,d[11]=m,d[12]=y,d[13]=p,d[14]=g,d[15]=l):l=d[15],w=l,d[16]!==w?(u={clearAuthenticatedCache:w},d[16]=w,d[17]=u):u=d[17],u),{removeAuthenticatedQueries:F}=(_=(0,C.c)(4),A=(0,S.useQueryClient)(),_[0]!==A?(v=()=>{A.removeQueries({predicate:T})},_[0]=A,_[1]=v):v=_[1],E=v,_[2]!==E?(b={removeAuthenticatedQueries:E},_[2]=E,_[3]=b):b=_[3],b),{cancelAuthenticatedQueries:q}=(R=(0,C.c)(4),M=(0,S.useQueryClient)(),R[0]!==M?(I=async()=>{await M.cancelQueries({predicate:D})},R[0]=M,R[1]=I):I=R[1],L=I,R[2]!==L?(P={cancelAuthenticatedQueries:L},R[2]=L,R[3]=P):P=R[3],P),{clearComplianceCredentials:$}=((N=(0,C.c)(1))[0]===Symbol.for("react.memo_cache_sentinel")?(U={clearComplianceCredentials:O},N[0]=U):U=N[0],U);j[0]!==q||j[1]!==W||j[2]!==$||j[3]!==K||j[4]!==F?(e=async e=>{let{isCurrent:t}=void 0===e?{}:e;if(!(void 0===t?function(){return!0}:t)())return;K.setQueryData(n.queryKeys[a.QueryKey.Auth].isLoggedIn().queryKey,{status:"logged-out"}),(0,x.clearSessionHint)(),k(),$();let r=q();W(),F(),await r},j[0]=q,j[1]=W,j[2]=$,j[3]=K,j[4]=F,j[5]=e):e=j[5];let G=e;return j[6]!==G?(t={clearLocalAuthenticatedSession:G},j[6]=G,j[7]=t):t=j[7],t};function T(e){return P(e.queryKey)}function D(e){return P(e.queryKey)}function O(){window.localStorage.removeItem(_.PROOF_OF_RESIDENCE_LS),window.localStorage.removeItem(_.NON_US_IP_LS),window.localStorage.removeItem(_.US_IP_VIEW_ONLY_LS)}e.s(["useSignOutHelpers",0,R],782168),e.s(["useSessionRefresh",0,({authenticatedUser:e,chainId:d,connector:h,isLoggedIn:p,isLoggedInPending:g})=>{let m,{clearLocalAuthenticatedSession:y}=R(),w=r.default.useRef({}),v="true"!==u.default.env.NEXT_PUBLIC_AUTH_SESSION_REFRESH_DISABLED,C="true"===u.default.env.NEXT_PUBLIC_AUTH_SESSION_REFRESH_DEBUG,S="true"!==u.default.env.NEXT_PUBLIC_AUTH_CONFIRM_BEFORE_LOGOUT_DISABLED,_="true"!==u.default.env.NEXT_PUBLIC_AUTH_SESSION_REFRESH_SINGLEFLIGHT_DISABLED,A=!Number.isFinite(m=Number(u.default.env.NEXT_PUBLIC_AUTH_SESSION_REFRESH_INTERVAL_SECONDS))||m<=0?f:1e3*m,E=e?.address?.toLowerCase(),I=e&&E?`${e.type}:${E}`:void 0,k=v&&p&&!g&&!!I,x=r.default.useRef({authenticatedUserKey:I,queryEnabled:k}),P=r.default.useRef(I);if(P.current!==I||!k){let e,t,r,n;w.current=_&&k&&I?(t=`polymarket.auth.session-refresh.${I}`,r=()=>{try{let e=window.localStorage.getItem(t);return e?JSON.parse(e):{}}catch{return{}}},n=e=>{try{window.localStorage.setItem(t,JSON.stringify({...r(),...e}))}catch{}},{get inFlight(){return e},set inFlight(value){e=value},get lastRefreshAt(){return r().lastRefreshAt},set lastRefreshAt(value){n({lastRefreshAt:value})},get lastFailureAt(){return r().lastFailureAt},set lastFailureAt(value){n({lastFailureAt:value})}}):{},P.current=I}x.current={authenticatedUserKey:I,queryEnabled:k},(0,t.useQuery)({queryKey:n.queryKeys[a.QueryKey.Auth].sessionRefresh(I).queryKey,enabled:k,queryFn:async({signal:t})=>{let r="auto";if(!e||!I)return{status:"skipped",reason:"stale_auth_state"};let n=h?.id??e.type,a=()=>!t.aborted&&x.current.queryEnabled&&x.current.authenticatedUserKey===I;C&&s.logger.info("[useSessionRefresh] Session refresh check started",(0,l.getSafeAuthDiagnosticContext)({authType:e.type,chainId:d,connectorId:n,hasWalletAddress:!!e.address,refreshIntervalMs:A,trigger:r}));let u=await b({authenticatedUser:e,chainId:d,confirmSessionActive:S?async()=>{let e=await (0,i.getGammaClient)().auth.session();if("success"===e.status)return!0;let t=e.error.code;if(401===t||403===t)return!1;throw e.error}:void 0,connector:h,intervalMs:A,timeoutMs:15e3,isCurrent:a,refreshSession:async a=>{let o=Date.now(),{signal:c,...u}=a??{},d=c&&c!==t?AbortSignal.any([c,t]):t;try{C&&s.logger.info("[useSessionRefresh] Gamma session refresh request started",(0,l.getSafeAuthDiagnosticContext)({authType:e.type,connectorId:n,hasMagicDidToken:!!a?.token,trigger:r}));let t=await (0,i.getGammaClient)().auth.refreshSession({...u,signal:d});return C&&s.logger.info("[useSessionRefresh] Gamma session refresh request completed",(0,l.getSafeAuthDiagnosticContext)({authType:e.type,connectorId:n,durationMs:Date.now()-o,errorCode:"failure"===t.status?t.error.code:void 0,hasRefreshedAddress:"success"===t.status?!!t.data.address:void 0,refreshedAuthType:"success"===t.status?t.data.type:void 0,status:t.status,trigger:r})),t}catch(t){throw C&&s.logger.info("[useSessionRefresh] Gamma session refresh request threw",(0,l.getSafeAuthDiagnosticContext)({authType:e.type,connectorId:n,durationMs:Date.now()-o,errorMessage:t instanceof Error?t.message:String(t),trigger:r})),t}},runExclusive:_?e=>(0,o.runWithLock)("polymarket.auth.session-refresh",e):void 0,state:w.current,onStep:(t,a)=>{(0,c.logAuthFlowStep)({connectorId:n,data:{...a,refreshIntervalMs:A,trigger:r},step:t,walletAddress:e.address})},onError:t=>{(0,c.logAuthFlowError)({authStatus:"error",connectorId:n,error:t,trigger:"session-refresh",walletAddress:e.address})},onSessionInvalidated:async t=>{try{if(!a()||(await y({isCurrent:a}),!a()))return;s.logger.info("[useSessionRefresh] Session refresh invalidated local auth state",(0,l.getSafeAuthDiagnosticContext)({authType:e.type,connectorId:n,errorMessage:t instanceof Error?t.message:String(t),refreshIntervalMs:A,trigger:r}))}catch(a){s.logger.warn("[useSessionRefresh] Session refresh invalidation teardown failed",(0,l.getSafeAuthDiagnosticContext)({authType:e.type,connectorId:n,errorMessage:a instanceof Error?a.message:String(a),refreshErrorMessage:t instanceof Error?t.message:String(t),refreshIntervalMs:A,trigger:r}))}}});return a()?("success"===u.status?C&&s.logger.info("[useSessionRefresh] Session refresh succeeded",(0,l.getSafeAuthDiagnosticContext)({authType:e.type,connectorId:n,hasRefreshedAddress:!!u.authenticatedUser.address,nextRefreshAttemptAt:new Date(Date.now()+A).toISOString(),refreshIntervalMs:A,refreshedAuthType:u.authenticatedUser.type,trigger:r})):"skipped"===u.status?C&&s.logger.info("[useSessionRefresh] Session refresh skipped",(0,l.getSafeAuthDiagnosticContext)({authType:e.type,connectorId:n,reason:u.reason,refreshIntervalMs:A,trigger:r})):s.logger.warn("[useSessionRefresh] Session refresh failed",(0,l.getSafeAuthDiagnosticContext)({authType:e.type,connectorId:n,errorMessage:u.error.message,refreshIntervalMs:A,trigger:r})),u):{status:"skipped",reason:"stale_auth_state"}},gcTime:A,refetchInterval:!!k&&A,refetchOnReconnect:!0,refetchOnWindowFocus:!0,retry:!1,staleTime:0})}],272580)},355664,e=>{"use strict";e.s(["useSiwx",()=>i]);var t=e.i(846574),r=e.i(334769),n=e.i(515796),a=e.i(720909);let i=()=>{let e,i=(0,t.c)(25),{authenticationStatus:o,connector:s,connectorRoute:c,connectorStatus:l,onboardingRoute:u,open:d,options:h,preventClose:f,route:p,setAuthenticationStatus:g,setConnector:m,setConnectorRoute:y,setConnectorStatus:w,setOnboardingRoute:v,setOpen:b,setPreventClose:C,setRoute:S}=(0,a.useSiwxContext)(),{authenticatedUser:_,gamma:A,isLoggedIn:E,signIn:I,wasSessionPersisted:k}=(0,r.useAuthenticationContext)(),{getUri:x,walletRecoveryRequired:P}=(0,n.useConnectorContext)();return i[0]!==_||i[1]!==o||i[2]!==s||i[3]!==c||i[4]!==l||i[5]!==A||i[
16]!==x||i[7]!==E||i[8]!==u||i[9]!==d||i[10]!==h||i[11]!==f||i[12]!==p||i[13]!==g||i[14]!==m||i[15]!==y||i[16]!==w||i[17]!==v||i[18]!==b||i[19]!==C||i[20]!==S||i[21]!==I||i[22]!==P||i[23]!==k?(e={authenticationStatus:o,connector:s,connectorRoute:c,connectorStatus:l,onboardingRoute:u,open:d,options:h,preventClose:f,route:p,setAuthenticationStatus:g,setConnector:m,setConnectorRoute:y,setConnectorStatus:w,setOnboardingRoute:v,setOpen:b,setPreventClose:C,setRoute:S,authenticatedUser:_,gamma:A,isLoggedIn:E,signIn:I,wasSessionPersisted:k,getUri:x,walletRecoveryRequired:P},i[0]=_,i[1]=o,i[2]=s,i[3]=c,i[4]=l,i[5]=A,i[6]=x,i[7]=E,i[8]=u,i[9]=d,i[10]=h,i[11]=f,i[12]=p,i[13]=g,i[14]=m,i[15]=y,i[16]=w,i[17]=v,i[18]=b,i[19]=C,i[20]=S,i[21]=I,i[22]=P,i[23]=k,i[24]=e):e=i[24],e}},304695,e=>{"use strict";e.s(["LAST_CONNECTOR_COOKIE_KEY",()=>a,"useLastConnector",()=>o,"useSingletonLastConnector",()=>i]);var t=e.i(846574),r=e.i(82756),n=e.i(720909);let a="polymarket.auth.lastConnectorId",i=()=>{let e,n,i=(0,t.c)(4);i[0]===Symbol.for("react.memo_cache_sentinel")?(e={defaultValue:void 0},i[0]=e):e=i[0];let[o,s]=(0,r.useCookieState)(a,e);return i[1]!==o||i[2]!==s?(n={lastConnectorId:o,updateLastConnectorId:s},i[1]=o,i[2]=s,i[3]=n):n=i[3],n},o=()=>{let e,r=(0,t.c)(3),{lastConnectorId:a,updateLastConnectorId:i}=(0,n.useSiwxContext)();return r[0]!==a||r[1]!==i?(e={lastConnectorId:a,updateLastConnectorId:i},r[0]=a,r[1]=i,r[2]=e):e=r[2],e}},708546,957078,350182,459028,406698,504377,281351,e=>{"use strict";let t,r;e.s(["useOptimisticMagicReconnect",()=>V],708546);var n,a=e.i(846574),i=e.i(669718),o=e.i(287865),s=e.i(45806),c=e.i(462017),l=e.i(938466),u=e.i(473462),d=e.i(650772),h=e.i(913259),f=e.i(266876),p=e.i(245085),g=e.i(925351),m=e.i(842768),y=e.i(813433);function w(t={}){let r,n,a,i;return o=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",type:w.type,async connect({chainId:e,withCapabilities:t,...r}={}){try{let o=await this.getProvider(),s=(await o.request({method:"eth_requestAccounts",params:"instantOnboarding"in r&&r.instantOnboarding?[{onboarding:"instant"}]:[]})).map(e=>(0,g.getAddress)(e));n||(n=this.onAccountsChanged.bind(this),o.on("accountsChanged",n)),a||(a=this.onChainChanged.bind(this),o.on("chainChanged",a)),i||(i=this.onDisconnect.bind(this),o.on("disconnect",i));let c=await this.getChainId();if(e&&c!==e){let t=await this.switchChain({chainId:e}).catch(e=>{if(e.code===y.UserRejectedRequestError.code)throw e;return{id:c}});c=t?.id??c}return{accounts:t?s.map(e=>({address:e,capabilities:{}})):s,chainId:c}}catch(e){if(/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(e.message))throw new y.UserRejectedRequestError(e);throw e}},async disconnect(){let e=await this.getProvider();n&&(e.removeListener("accountsChanged",n),n=void 0),a&&(e.removeListener("chainChanged",a),a=void 0),i&&(e.removeListener("disconnect",i),i=void 0),e.disconnect(),e.close?.()},async getAccounts(){let e=await this.getProvider();return(await e.request({method:"eth_accounts"})).map(e=>(0,g.getAddress)(e))},async getChainId(){let e=await this.getProvider();return Number(await e.request({method:"eth_chainId"}))}
1,async getProvider(){if(!r)try{let{createCoinbaseWalletSDK:n}=await e.A(55758);r=n({...t,appChainIds:o.chains.map(e=>e.id),preference:{options:"all",...t.preference??{}}}).getProvider()}catch(e){throw e}return r},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){let r=o.chains.find(e=>e.id===t);if(!r)throw new y.SwitchChainError(new p.ChainNotConfiguredError);let n=await this.getProvider();try{return await n.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,m.numberToHex)(r.id)}]}),r}catch(a){if(4902===a.code)try{let a,i;a=e?.blockExplorerUrls?e.blockExplorerUrls:r.blockExplorers?.default.url?[r.blockExplorers?.default.url]:[],i=e?.rpcUrls?.length?e.rpcUrls:[r.rpcUrls.default?.http[0]??""];let o={blockExplorerUrls:a,chainId:(0,m.numberToHex)(t),chainName:e?.chainName??r.name,iconUrls:e?.iconUrls,nativeCurrency:e?.nativeCurrency??r.nativeCurrency,rpcUrls:i};return await n.request({method:"wallet_addEthereumChain",params:[o]}),r}catch(e){throw new y.UserRejectedRequestError(e)}throw new y.SwitchChainError(a)}},onAccountsChanged(e){0===e.length?this.onDisconnect():o.emitter.emit("change",{accounts:e.map(e=>(0,g.getAddress)(e))})},onChainChanged(e){let t=Number(e);o.emitter.emit("change",{chainId:t})},async onDisconnect(e){o.emitter.emit("disconnect");let t=await this.getProvider();n&&(t.removeListener("accountsChanged",n),n=void 0),a&&(t.removeListener("chainChanged",a),a=void 0),i&&(t.removeListener("disconnect",i),i=void 0)}})}w.type="coinbaseWallet";var v=e.i(533539),b=e.i(277431),C=e.i(379476);class S extends C.BaseError{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}function _(e={}){let t,r,n,a,{shimDisconnect:i=!0,unstable_shimAsyncInject:o}=e;function s(){let t=e.target;if("function"==typeof t){let e=t();if(e)return e}return"object"==typeof t?t:"string"==typeof t?{...A[t]??{id:t,name:`${t[0].toUpperCase()}${t.slice(1)}`,provider:`is${t[0].toUpperCase()}${t.slice(1)}`}}:{id:"injected",name:"Injected",provider:e=>e?.ethereum}}return c=>({get icon(){return s().icon},get id(){return s().id},get name(){return s().name},type:_.type,async setup(){let r=await this.getProvider();r?.on&&e.target&&(n||(n=this.onConnect.bind(this),r.on("connect",n)),t||(t=this.onAccountsChanged.bind(this),r.on("accountsChanged",t)))},async connect({chainId:o,isReconnecting:s,withCapabilities:l}={}){let u=await this.getProvider();if(!u)throw new S;let d=[];if(s)d=await this.getAccounts().catch(()=>[]);else if(i)try{let e=await u.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});(d=e[0]?.caveats?.[0]?.value?.map(e=>(0,g.getAddress)(e))).length>0&&(d=await this.getAccounts())}catch(e){if(e.code===y.UserRejectedRequestError.code)throw new y.UserRejectedRequestError(e);if(e.code===y.ResourceUnavailableRpcError.code)throw e}try{d?.length||s||(d=(await u.request({method:"eth_requestAccounts"})).map(e=>(0,g.getAddress)(e))),n&&(u.removeListener("connect",n),n=void 0),t||(t=this.onAccountsChanged.bind(this),u.on("accountsChanged",t)),r||(r=this.onChainChanged.bind(this),u.on("chainChanged",r)),a||(a=this.onDisconnect.bind(this),u.on("disconnect",a));let h=await this.getChainId();if(o&&h!==o){let e=await this.switchChain({chainId:o}).catch(e=>{if(e.code===y.UserRejectedRequestError.code)throw e;return{id:h}});h=e?.id??h}return i&&await c.storage?.removeItem(`${this.id}.disconnected`),e.target||await c.storage?.setItem("injected.connected",!0),{accounts:l?d.map(e=>({address:e,capabilities:{}})):d,chainId:h}}catch(e){if(e.code===y.UserRejectedRequestError.code)throw new y.UserRejectedRequestError(e);if(e.code===y.ResourceUnavailableRpcError.code)throw new y.ResourceUnavailableRpcError(e);throw e}},async disconnect(){let t=await this.getProvider();if(!t)throw new S;r&&(t.removeListener("chainChanged",r),r=void 0),a&&(t.removeListener("disconnect",a),a=void 0),n||(n=this.onConnect.bind(this),t.on("connect",n));try{await (0,b.withTimeout)(()=>t.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}i&&await c.storage?.setItem(`${this.id}.disconnected`,!0),e.target||await c.storage?.removeItem("injected.connected")},async getAccounts(){let e=await this.getProvider();if(!e)throw new S;return(await e.request({method:"eth_accounts"})).map(e=>(0,g.getAddress)(e))},async getChainId(){let e=await this.getProvider();if(!e)throw new S;return Number(await e.request({method:"eth_chainId"}))},async getProvider(){let e;if("u"<typeof window)return;let t=s();return(e="function"==typeof t.provider?t.provider(window):"string"==typeof t.provider?E(window,t.provider):t.provider)&&!e.removeListener&&("off"in e&&"function"==typeof e.off?e.removeListener=e.off:e.removeListener=()=>{}),e}
1,async isAuthorized(){try{if(i&&await c.storage?.getItem(`${this.id}.disconnected`)||!e.target&&!await c.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(void 0!==o&&!1!==o){let e=async()=>("u">typeof window&&window.removeEventListener("ethereum#initialized",e),!!await this.getProvider()),t="number"==typeof o?o:1e3;if(await Promise.race([..."u">typeof window?[new Promise(t=>window.addEventListener("ethereum#initialized",()=>t(e()),{once:!0}))]:[],new Promise(r=>setTimeout(()=>r(e()),t))]))return!0}throw new S}return!!(await (0,v.withRetry)(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){let r=await this.getProvider();if(!r)throw new S;let n=c.chains.find(e=>e.id===t);if(!n)throw new y.SwitchChainError(new p.ChainNotConfiguredError);let a=new Promise(e=>{let r=n=>{"chainId"in n&&n.chainId===t&&(c.emitter.off("change",r),e())};c.emitter.on("change",r)});try{return await Promise.all([r.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,m.numberToHex)(t)}]}).then(async()=>{await this.getChainId()===t&&c.emitter.emit("change",{chainId:t})}),a]),n}catch(i){if(4902===i.code||i?.data?.originalError?.code===4902)try{let i,o,{default:s,...l}=n.blockExplorers??{};e?.blockExplorerUrls?i=e.blockExplorerUrls:s&&(i=[s.url,...Object.values(l).map(e=>e.url)]),o=e?.rpcUrls?.length?e.rpcUrls:[n.rpcUrls.default?.http[0]??""];let u={blockExplorerUrls:i,chainId:(0,m.numberToHex)(t),chainName:e?.chainName??n.name,iconUrls:e?.iconUrls,nativeCurrency:e?.nativeCurrency??n.nativeCurrency,rpcUrls:o};return await Promise.all([r.request({method:"wallet_addEthereumChain",params:[u]}).then(async()=>{if(await this.getChainId()===t)c.emitter.emit("change",{chainId:t});else throw new y.UserRejectedRequestError(Error("User rejected switch after adding network."))}),a]),n}catch(e){throw new y.UserRejectedRequestError(e)}if(i.code===y.UserRejectedRequestError.code)throw new y.UserRejectedRequestError(i);throw new y.SwitchChainError(i)}},async onAccountsChanged(e){if(0===e.length)this.onDisconnect();else if(c.emitter.listenerCount("connect")){let e=(await this.getChainId()).toString();this.onConnect({chainId:e}),i&&await c.storage?.removeItem(`${this.id}.disconnected`)}else c.emitter.emit("change",{accounts:e.map(e=>(0,g.getAddress)(e))})},onChainChanged(e){let t=Number(e);c.emitter.emit("change",{chainId:t})},async onConnect(e){let i=await this.getAccounts();if(0===i.length)return;let o=Number(e.chainId);c.emitter.emit("connect",{accounts:i,chainId:o});let s=await this.getProvider();s&&(n&&(s.removeListener("connect",n),n=void 0),t||(t=this.onAccountsChanged.bind(this),s.on("accountsChanged",t)),r||(r=this.onChainChanged.bind(this),s.on("chainChanged",r)),a||(a=this.onDisconnect.bind(this),s.on("disconnect",a)))},async onDisconnect(e){let t=await this.getProvider();e&&1013===e.code&&t&&(await this.getAccounts()).length||(c.emitter.emit("disconnect"),t&&(r&&(t.removeListener("chainChanged",r),r=void 0),a&&(t.removeListener("disconnect",a),a=void 0),n||(n=this.onConnect.bind(this),t.on("connect",n))))}})}C.BaseError,_.type="injected";let A={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider:e=>e?.coinbaseWalletExtension?e.coinbaseWalletExtension:E(e,"isCoinbaseWallet")},metaMask:{id:"metaMask",name:"MetaMask",provider:e=>E(e,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;for(let t of["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"])if(e[t])return!1;return!0})},phantom:{id:"phantom",name:"Phantom",provider:e=>e?.phantom?.ethereum?e.phantom?.ethereum:E(e,"isPhantom")}};function E(e,t){function r(e){return"function"==typeof t?t(e):"string"!=typeof t||e[t]}let n=e.ethereum;return n?.providers?n.providers.find(e=>r(e)):n&&r(n)?n:void 0}function I(t={}){let r,n;return a=>({id:"metaMaskSDK",name:"MetaMask",rdns:["io.metamask","io.metamask.mobile"],type:I.type,async connect({chainId:e,isReconnecting:r,withCapabilities:n}={}){let i=await this.getInstance(),o=i.getProvider(),s=[];r&&(s=await this.getAccounts().catch(()=>[]));try{let r,c;if(!s?.length){let e=a.chains.map(e=>(0,m.numberToHex)(e.id));t.connectAndSign||t.connectWith?(t.connectAndSign?r=(await i.connectAndSign({chainIds:e,message:t.connectAndSign})).signature:t.connectWith&&(c=(await i.connectWith({chainIds:e,method:t.connectWith.method,params:t.connectWith.params})).result),s=await this.getAccounts()):s=(await i.connect({chainIds:e})).accounts.map(e=>(0,g.getAddress)(e))}let l=await this.getChainId();if(e&&l!==e){let t=await this.switchChain({chainId:e}).catch(e=>{if(e.code===y.UserRejectedRequestError.code)throw e;return{id:l}});l=t?.id??l}return r?o.emit("connectAndSign",{accounts:s,chainId:(0,m.numberToHex)(l),signResponse:r}):c&&o.emit("connectWith",{accounts:s,chainId:(0,m.numberToHex)(l),connectWithResponse:c}),{accounts:n?s.map(e=>({address:e,capabilities:{}})):s,chainId:l}}catch(e){if(e.code===y.UserRejectedRequestError.code)throw new y.UserRejectedRequestError(e);
1if(e.code===y.ResourceUnavailableRpcError.code)throw new y.ResourceUnavailableRpcError(e);throw e}},async disconnect(){return(await this.getInstance()).disconnect()},async getAccounts(){if(!r&&!n){let e=a.providers[0]?.provider;if(e)return(await e.request({method:"eth_accounts"})).map(e=>(0,g.getAddress)(e))}let e=await this.getInstance();if(e.accounts.length)return e.accounts.map(e=>(0,g.getAddress)(e));let t=e.getProvider();return(await t.request({method:"eth_accounts"})).map(e=>(0,g.getAddress)(e))},async getChainId(){if(!r&&!n){let e=a.providers[0]?.provider;if(e)return Number(await e.request({method:"eth_chainId"}))}let e=await this.getInstance();if(e.getChainId())return Number(e.getChainId());let t=e.getProvider();return Number(await t.request({method:"eth_chainId"}))},async getProvider(){if(!r&&!n){let e=a.providers[0]?.provider;if(e)return e}return(await this.getInstance()).getProvider()},async isAuthorized(){try{if(!r&&!n){let e=a.providers[0]?.provider;if(e)return(await e.request({method:"eth_accounts"})).length>0}return!!(await (0,v.withRetry)(async()=>(0,b.withTimeout)(async()=>{let e=await this.getAccounts();if(!e.length)throw Error("try again");return e},{timeout:10}),{delay:11,retryCount:3})).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){let r=a.chains.find(({id:e})=>e===Number(t));if(!r)throw new y.SwitchChainError(new p.ChainNotConfiguredError);let n=(0,m.numberToHex)(t);try{let t=await this.getInstance();return await t.switchChain({chainId:n,chainConfiguration:{blockExplorerUrls:e?.blockExplorerUrls?[...e.blockExplorerUrls]:r.blockExplorers?.default.url?[r.blockExplorers.default.url]:void 0,chainId:n,chainName:e?.chainName??r.name,iconUrls:e?.iconUrls,nativeCurrency:e?.nativeCurrency??r.nativeCurrency,rpcUrls:e?.rpcUrls?[...e.rpcUrls]:r.rpcUrls.default?.http?[...r.rpcUrls.default.http]:void 0}}),r}catch(e){if(e.code===y.UserRejectedRequestError.code)throw new y.UserRejectedRequestError(e);throw new y.SwitchChainError(e)}},async onAccountsChanged(e){a.emitter.emit("change",{accounts:e.map(e=>(0,g.getAddress)(e))})},onChainChanged(e){let t=Number(e);a.emitter.emit("change",{chainId:t})},async onConnect(e){let t=await this.getAccounts();if(0===t.length)return;let r=Number(e.chainId);a.emitter.emit("connect",{accounts:t,chainId:r})},async onDisconnect(e){e&&1013===e.code&&await this.getProvider()&&(await this.getAccounts()).length||a.emitter.emit("disconnect")},onDisplayUri(e){a.emitter.emit("message",{type:"display_uri",data:e})},async getInstance(){if(!r){if(!n)try{let{createEVMClient:r}=await e.A(73024),i="u"<typeof window?{name:"wagmi"}:{name:window.location.hostname,url:window.location.href};n=r({...t,skipAutoAnnounce:!0,api:{supportedNetworks:Object.fromEntries(a.chains.map(e=>[(0,m.numberToHex)(e.id),e.rpcUrls.default?.http[0]??""]))},dapp:t.dapp??{...i,...t.dappMetadata},debug:t.debug??t.logging?.sdk,eventHandlers:{accountsChanged:this.onAccountsChanged.bind(this),chainChanged:this.onChainChanged.bind(this),connect:this.onConnect.bind(this),disconnect:this.onDisconnect.bind(this),displayUri:this.onDisplayUri.bind(this)},analytics:{integrationType:"wagmi"},ui:{...t.ui,...null!=t.headless&&{headless:t.headless}},...t.mobile&&{mobile:t.mobile}})}catch(e){throw e}r=await n}return r}})}function k(t){let r,n,a,i,o,s,c,l,u=t.isNewChainsStale??!0;return d=>({id:"walletConnect",name:"WalletConnect",type:k.type,async setup(){let e=await this.getProvider().catch(()=>null);e&&(o||(o=this.onConnect.bind(this),e.on("connect",o)),c||(c=this.onSessionDelete.bind(this),e.on("session_delete",c)))},async connect({chainId:e,withCapabilities:t,...r}={}){try{let n=await this.getProvider();if(!n)throw new S;s||(s=this.onDisplayUri,n.on("display_uri",s));let u=e;if(!u){let e=await d.storage?.getItem("state")??{};u=d.chains.some(t=>t.id===e.chainId)?e.chainId:d.chains[0]?.id}if(!u)throw Error("No chains found on connector.");let h=await this.isChainsStale();if(n.session&&h&&await n.disconnect(),!n.session||h){let e=d.chains.filter(e=>e.id!==u).map(e=>e.id);await n.connect({optionalChains:[u,...e],..."pairingTopic"in r?{pairingTopic:r.pairingTopic}:{}}),this.setRequestedChainsIds(d.chains.map(e=>e.id))}let f=(await n.enable()).map(e=>(0,g.getAddress)(e)),p=await this.getChainId();if(e&&p!==e){let t=await this.switchChain({chainId:e}).catch(e=>{if(e.code===y.UserRejectedRequestError.code&&e.cause?.message!=="Missing or invalid. request() method: wallet_addEthereumChain")throw e;return{id:p}});p=t?.id??p}return s&&(n.removeListener("display_uri",s),s=void 0),o&&(n.removeListener("connect",o),o=void 0),a||(a=this.onAccountsChanged.bind(this),n.on("accountsChanged",a)),i||(i=this.onChainChanged.bind(this),n.on("chainChanged",i)),l||(l=this.onDisconnect.bind(this),n.on("disconnect",l)),c||(c=this.onSessionDelete.bind(this),n.on("session_delete",c)),{accounts:t?f.map(e=>({address:e,capabilities:{}})):f,chainId:p}}catch(e){if(/(user rejected|connection request reset)/i.test(e?.message))throw new y.UserRejectedRequestError(e);throw e}},async disconnect(){let e=await this.getProvider();try{await e?.disconnect()}catch(e){if(!/No matching key/i.test(e.message))throw e}finally{i&&(e?.removeListener("chainChanged",i),i=void 0),l&&(e?.removeListener("disconnect",l),l=void 0),o||(o=this.onConnect.bind(this),e?.on("connect",o)),a&&(e?.removeListener("accountsChanged",a),a=void 0),c&&(e?.removeListener("session_delete",c),c=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(e=>(0,g.getAddress)(e))},async getProvider({chainId:a}={}){async function i(){let r=d.chains.map(e=>e.id);if(r.length)try{let{EthereumProvider:n}=await e.A(651702);return await n.init({...t,disableProviderPing:!0,optionalChains:r,projectId:t.projectId,rpcMap:Object.fromEntries(d.chains.map(e=>{let[t]=function(e){let{chain:t}=e,r=t.rpcUrls.default.http[0];if(!e.transports)return[r];let n=e.transports?.[t.id]?.({chain:t});return(n?.value?.transports||[n]).map(({value:e})=>e?.url||r)}({chain:e,transports:d.transports});return[e.id,t]})),showQrModal:t.showQrModal??!0})}catch(e){throw e}}return r||(n||(n=i()),r=await n,r?.events.setMaxListeners(1/0)),a&&await this.switchChain?.({chainId:a}),r},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{let[e,t]=await Promise.all([this.getAccounts(),this.getProvider()]);if(!e.length)return!1;if(await this.isChainsStale()&&t.session)return await t.disconnect().catch(()=>{}),!1;return!0}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){let r=await this.getProvider();if(!r)throw new S;let n=d.chains.find(e=>e.id===t);if(!n)throw new y.SwitchChainError(new p.ChainNotConfiguredError);let a=()=>{};try{await Promise.all([new Promise(e=>{a=r=>{r.chainId===t&&(d.emitter.off("change",a),e())},d.emitter.on("change",a)}),r.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,m.numberToHex)(t)}]})]);let e=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...e,t]),n}catch(i){if(d.emitter.off("change",a),/(user rejected)/i.test(i.message))throw new y.UserRejectedRequestError(i);try{let a,i;a=e?.blockExplorerUrls?e.blockExplorerUrls:n.blockExplorers?.default.url?[n.blockExplorers?.default.url]:[],i=e?.rpcUrls?.length?e.rpcUrls:[...n.rpcUrls.default.http];
1let o={blockExplorerUrls:a,chainId:(0,m.numberToHex)(t),chainName:e?.chainName??n.name,iconUrls:e?.iconUrls,nativeCurrency:e?.nativeCurrency??n.nativeCurrency,rpcUrls:i};await r.request({method:"wallet_addEthereumChain",params:[o]});let s=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...s,t]),n}catch(e){throw new y.UserRejectedRequestError(e)}}},onAccountsChanged(e){0===e.length?this.onDisconnect():d.emitter.emit("change",{accounts:e.map(e=>(0,g.getAddress)(e))})},onChainChanged(e){let t=Number(e);d.emitter.emit("change",{chainId:t})},async onConnect(e){let t=Number(e.chainId),r=await this.getAccounts();d.emitter.emit("connect",{accounts:r,chainId:t})},async onDisconnect(e){this.setRequestedChainsIds([]),d.emitter.emit("disconnect");let t=await this.getProvider();a&&(t.removeListener("accountsChanged",a),a=void 0),i&&(t.removeListener("chainChanged",i),i=void 0),l&&(t.removeListener("disconnect",l),l=void 0),c&&(t.removeListener("session_delete",c),c=void 0),o||(o=this.onConnect.bind(this),t.on("connect",o))},onDisplayUri(e){d.emitter.emit("message",{type:"display_uri",data:e})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds:()=>r?r.session?.namespaces.eip155?.accounts?.map(e=>Number.parseInt(e.split(":")[1]||"",10))??[]:[],async getRequestedChainsIds(){return await d.storage?.getItem(this.requestedChainsStorageKey)??[]},async isChainsStale(){if(!u)return!1;let e=d.chains.map(e=>e.id),t=this.getNamespaceChainsIds();if(t.length&&!t.some(t=>e.includes(t)))return!1;let r=await this.getRequestedChainsIds();return!e.every(e=>r.includes(e))},async setRequestedChainsIds(e){await d.storage?.setItem(this.requestedChainsStorageKey,e)},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}I.type="metaMask",k.type="walletConnect",e.s(["walletConnect",0,k],957078);var x=e.i(734804),P=e.i(313006);let R=e=>"string"==typeof e?Number.parseInt(e,"0x"===e.trim().substring(0,2)?16:10):"bigint"==typeof e?Number(e):e;var T=e.i(443911),D=e.i(127183);let O=137,M=null,L=async()=>(M||(M=(await e.A(632195)).createMagicSdk),M),U=e=>e instanceof Error?e.name||"Error":"UnknownError",N=e=>{if(e&&"object"==typeof e)return(e.wallets?.ethereum?.publicAddress??e.publicAddress??void 0)||void 0};var j=e.i(95184),K=e.i(732659),W=e.i(599314);class F extends Error{name="InjectedReadTimeoutError"}var q=e.i(386740),$=e.i(402400),G=e.i(371135),B=e.i(519216);let H=(t=(n={app:{injectedReadTimeoutMs:5e3,chainId:B.MATIC_CONFIG.chainId,meta:{name:"Polymarket",description:"Polymarket",url:"https://polymarket.com"},credentials:{magic:B.MAGIC_KEY,walletConnect:"65eb22fce2077beb8b6f4b9970650ae8",googleClientId:"269460707496-ajsl5rd7mvtre7tjm7gtppvi387j9a3k.apps.googleusercontent.com"},authEvents:{onEvent:({data:e,event:t})=>(0,G.sendAuthDiagnosticEvent)(t,e)},origin:B.CURRENT_ORIGIN}}).chains??(0,f.getChains)({chainId:n.app.chainId}),r=(0,u.createConfig)({chains:t,connectors:(({config:e,chains:t})=>{let r=(e=>{let{name:t="Polymarket",icon:r,description:n="Polymarket",url:a="https://polymarket.com"}=e.app.meta??{};return{name:t,description:n,url:a,icons:r?[r]:[]}})(e),n=(0,i.createWalletCache)();return[I({dapp:{name:r.name,url:r.url,...r.icons[0]?{iconUrl:r.icons[0]}:{}}}),w({appName:r.name}),k({showQrModal:!1,projectId:e.app.credentials.walletConnect,metadata:r}),_({target:"phantom",shimDisconnect:!0,unstable_shimAsyncInject:2e3}),function({chains:e,origin:t,cache:r,apiKey:n,googleClientId:a,onAuthEvent:i}){return(0,P.createConnector)(o=>{let{id:s,name:c,type:l,getProvider:u,onAccountsChanged:d,getMagicSDK:h,ensureMagicSDK:f,getAccount:p,getCache:m,getChainIdWithFallback:y,getChainId:w}=function({chains:e,apiKey:t,cache:r,onAuthEvent:n}){if(!t)throw Error("Magic API Key is required. Get one at https://dashboard.magic.link/");let a=()=>{let e=r.state.magic;if(!e)throw Error("[MagicConnectorV3 > getCache] No cache.");if("magic"!==e.type)throw Error("[MagicConnectorV3 > getCache] Mismatched cache type.");return e},i=async({chainId:e=O}={})=>{if(!t)throw Error("No Magic API key found.");return(await L())({chainId:e})},o=({chainId:t}={})=>t||e[0].id,s=async({chainId:e}={})=>{let t=await i({chainId:e});return t?t.rpcProvider:null},c=async e=>
1{let t=o({chainId:e?.chainId}),i=r.accounts.get(t);if(i)return n?.({event:"magic_account_resolved",data:{addressSource:"cache_accounts",providerAccountPresent:!0}}),i;let c=a();if(c.address)return r.accounts.update(t,c.address),n?.({event:"magic_account_resolved",data:{addressSource:"cache_state",providerAccountPresent:!0}}),c.address;let l=await s({chainId:t});n?.({event:"magic_provider_accounts_requested",data:{addressSource:"provider_eth_accounts"}});let u=await l?.request({method:"eth_accounts"}),d=Array.isArray(u)?u.length:0;Array.isArray(u)&&u[0]||n?.({event:"magic_provider_accounts_empty",data:{addressSource:"provider_eth_accounts",providerAccountPresent:!1,providerAccountsCount:d}});let h=(0,g.getAddress)(u[0]);return r.accounts.update(t,h),n?.({event:"magic_account_resolved",data:{addressSource:"provider_eth_accounts",providerAccountPresent:!0,providerAccountsCount:d}}),h},l=async e=>{let t=await s();0!==e.length&&e[0]?t?.emit("change",{account:(0,g.getAddress)(e[0])}):t?.emit("disconnect")},u=async()=>{let e=await s();return e?R(await e.request({method:"eth_chainId",params:[]})):R(137)};return{id:"magic",name:"Magic",type:"Magic",getMagicSDK:({chainId:e=O}={})=>{if(!t)throw Error("No Magic API key found.");if(!M)throw Error("Magic SDK is not loaded yet; call an async connector method first.");return M({chainId:e})},ensureMagicSDK:i,getProvider:s,getAccount:c,onAccountsChanged:l,getCache:a,getChainIdWithFallback:o,getChainId:u}}({chains:e,cache:r,apiKey:n,onAuthEvent:i}),v=(0,D.createLoginDidTokenSlot)(),b=(e,t={})=>{let n;i?.({data:{...!(n=r.state.value)?{cacheExists:!1}:"magic"!==n.type?{cacheExists:!0,cachedAuthType:n.type,cachedConnectorId:n.connectorId,hasCachedAddress:!!n.address}:{cacheExists:!0,cachedAuthType:n.type,cachedConnectorId:n.connectorId,cachedConnectionState:n.connectionState,cachedMagicAuthType:n.magicAuthType,cachedOauthProvider:n.oauthProvider,cachedUseOneTap:"oauth"===n.magicAuthType?n.useOneTap:void 0,hasCachedAddress:!!n.address,hasCachedEmail:!!n.email,magicAuthType:n.magicAuthType,magicProvider:"email"===n.magicAuthType?"email":n.oauthProvider??void 0,oauthProvider:"oauth"===n.magicAuthType?n.oauthProvider??void 0:void 0},...t},event:e})},C=async(e="disconnect")=>{v.clear();try{b("magic_disconnect_requested",{disconnectReason:e,logoutReason:e}),b("magic_logout_requested",{logoutReason:e});let t=await f();await t?.user.logout(),b("magic_logout_succeeded",{logoutReason:e}),r.accounts.clear(),o.emitter.emit("disconnect")}catch(t){b("magic_disconnect_failed",{disconnectReason:e,errorName:U(t)})}},S=async()=>{let e;try{e=await w()}catch{e=0}return e},_=e=>{let t=R(e);o.emitter.emit("change",{chainId:t})},A=()=>{b("magic_provider_disconnected"),o.emitter.emit("disconnect")},E=async()=>{let e=await u();return e?.on&&(e.on("accountsChanged",d),e.on("chainChanged",_),e.on("disconnect",A)),e},I=async()=>{try{m()}catch(e){throw b("magic_cache_validation_failed",{disconnectReason:"validate_connect_state_failed"}),await C("validate_connect_state_failed"),e}},k=async e=>{let t=m(),n=!1;if("oauth"===t.magicAuthType&&t.oauthProvider);else if("email"===t.magicAuthType&&t.address){let r=await p({chainId:e});if(r?.toLowerCase()!==t.address.toLowerCase()){b("magic_reconnect_address_mismatch",{addressSource:"cache_state",disconnectReason:"reconnect_address_mismatch",logoutReason:"reconnect_address_mismatch"});try{b("magic_logout_requested",{logoutReason:"reconnect_address_mismatch"}),await (await f()).user.logout()}catch{}finally{n=!0}}}if(!n){let n=await p({chainId:e});return r.state.update({..."email"===t.magicAuthType&&"pending"===t.connectionState&&{connectionState:"ready"}}),{chainId:e,accounts:[n]}}},P=async({chainId:e}={})=>{await I(),b("magic_connect_started");let n=m();await E();let i=y({chainId:e??await S()});if("requesting"===n.connectionState)try{await C("connect_requesting_cleanup")}catch{}if("ready"===(n=m()).connectionState){let e=await k(i);if(e)return e}if("oauth"===n.magicAuthType&&n.oauthProvider&&"requesting"===n.connectionState)if("google"===n.oauthProvider&&n.useOneTap&&a){let e=await f({chainId:i});try{let{jwt:t,signal:n}=await (0,T.promptGoogleOneTap)({clientId:a});if(n.aborted)throw(0,T.getGoogleOneTapAbortError)(n);let i=await e.oauth2.loginWithGoogleIdToken({jwt:t,googleClientId:a,lifespan:D.MAGIC_DID_TOKEN_LIFESPAN_SECONDS});if(n.aborted)throw(0,T.getGoogleOneTapAbortError)(n);let o=await e.user.getInfo();if(n.aborted)throw(0,T.getGoogleOneTapAbortError)(n);let s=N(o);v.hold(i,s),r.state.update({email:o.email??void 0,address:s,connectionState:"after-redirect-result"})}catch(e){try{await C("google_one_tap_failed")}catch{}finally{r.state.clear()}throw e}}else{r.state.update({connectionState:"redirect"}),b("magic_oauth_redirect_started",{oauthProvider:n.oauthProvider}),await o.storage?.setItem("recentConnectorId",s);try{{let e=`${window.location.pathname}${window.location.search}`;e.startsWith("/")&&x.default.set("pm_return_to",e,{path:"/",sameSite:"lax",secure:"https:"===window.location.protocol})}}catch{}if("telegram"===n.oauthProvider){let e=await f({chainId:i}),t=await e.oauth2.loginWithPopup({provider:"telegram"});if(t){b("magic_oauth_redirect_result_succeeded",{oauthProvider:n.oauthProvider});let e=N(t.magic.userMetadata);v.hold(t.magic.idToken,e),r.state.update({email:t.magic.userMetadata.email??t.oauth?.userInfo?.email??void 0,address:e,connectionState:"after-redirect-result"})}}else{let e=await f({chainId:i});await e.oauth2.loginWithRedirect({provider:n.oauthProvider,redirectURI:t??"https://polymarket.com"})}}let c=null;if("email"===n.magicAuthType&&n.email&&"requesting"===n.connectionState){let e=document.body.style.pointerEvents||"";document.body.style.pointerEvents="auto";let t=n.email;r.state.update({connectionState:"pending"});let a=await f({chainId:i});if(!a?.auth)throw Error("Magic authentication is unavailable");if("function"!=typeof a.auth.loginWithEmailOTP)throw Error("Email OTP authentication is unavailable");b("magic_login_with_email_otp_started",{magicAuthType:"email"}),c=await a.auth.loginWithEmailOTP({email:t,showUI:!0,lifespan:D.MAGIC_DID_TOKEN_LIFESPAN_SECONDS}),b("magic_login_with_email_otp_succeeded",{magicAuthType:"email"});let o=r.state.value,s=o?.type==="magic"&&"email"===o.magicAuthType&&o.email===t;if(o){if(!s)throw b("magic_email_stale_after_otp",{cachedAuthType:o.type,cachedConnectorId:o.connectorId,cachedConnectionState:"magic"===o.type?o.connectionState:void 0,cachedMagicAuthType:"magic"===o.type?o.magicAuthType:void 0}),document.body.style.pointerEvents=e,Error("Magic email auth state was replaced during OTP.")}else r.state.value={type:"magic",connectorId:"magic",magicAuthType:"email",oauthProvider:void 0,email:t,connectionState:"pending"},b("magic_email_cache_reseeded_after_otp",{magicAuthType:"email"});n=m(),document.body.style.pointerEvents=e}let l=await p();return c&&v.hold(c,l),r.state.update({address:l,..."email"===n.magicAuthType&&{connectionState:"ready"}}),{accounts:[l],chainId:i}},j=async({chainId:e}={})=>{try{let t=m();if(b("magic_oauth_redirect_result_started"),t?.type!=="magic")throw Error("Mismatched cache type.");let n=await f({chainId:e}),a=await n.oauth2.getRedirectResult({lifespan:D.MAGIC_DID_TOKEN_LIFESPAN_SECONDS});if(a){b("magic_oauth_redirect_result_succeeded",{oauthProvider:t.oauthProvider});let e=N(a.magic.userMetadata);return v.hold(a.magic.idToken,e),r.state.update({email:a.magic.userMetadata.email??a.oauth?.userInfo?.email??void 0,address:e,connectionState:"after-redirect-result"}),!0}return!1}catch(e){throw b("magic_oauth_redirect_result_failed",{oauthProvider:r.state.oauth?.oauthProvider}),e}},K=async({chainId:e}={})=>{let t=Date.now(),n="cache_read";try{let a=r.state.getMagicState({type:"oauth"});if(a){if("redirect"===a.connectionState)return n="oauth_redirect_result",await j({chainId:e});if("after-redirect-result"===a.connectionState)return n="sdk_initialization",await f({chainId:e}),!0}n="sdk_initialization";let i=await f({chainId:e});n="session_check";let o=await i.user.isLoggedIn();if(b("magic_is_logged_in_checked",{magicIsLoggedIn:o,cachedReadySessionMismatch:!o&&r.state.magic?.connectionState==="ready",durationMs:Date.now()-t}),o&&!r.state.magic)return b("magic_orphaned_session_skipped"),!1;if(o)return!0}catch(e){b("magic_authorization_failed",{phase:n,durationMs:Date.now()-t,errorName:U(e)})}return!1},W=async()=>{let e=await u();return(await e?.request({method:"eth_accounts"})).map(e=>(0,g.getAddress)(e))},F=async e=>{let t=R(e.chainId),r=await W();o.emitter.emit("connect",{accounts:r,chainId:t})};return{id:s,name:c,type:l,getProvider:u,onAccountsChanged:d,getMagicSDK:h,ensureMagicSDK:f,takeLoginDidToken:v.take,getChainId:w,disconnect:C,connect:P,isAuthorized:K,getAccounts:W,onChainChanged:_,onConnect:F,onDisconnect:A}})}({chains:t,cache:n,apiKey:e.app.credentials.magic,googleClientId:e.app.credentials.googleClientId,onAuthEvent:e.app.authEvents?.onEvent,origin:e.app.origin})]})({config:n,chains:t}),transports:(0,$.createTransports)({chains:t}),storage:(0,l.createStorage)({key:"polymarket.cache.wagmi.v2",storage:(0,q.createLocalStorage)(),serialize:h.serialize,deserialize:d.deserialize}),...(({app:e,ssr:t=!0,multiInjectedProviderDiscovery:r=!0,...n})=>({ssr:t,multiInjectedProviderDiscovery:r,...n}))(n)}),void 0!==n.app.injectedReadTimeoutMs&&Number.isFinite(n.app.injectedReadTimeoutMs)&&n.app.injectedReadTimeoutMs>0&&function(e,{timeoutMs:t,onAuthEvent:r}){let n,a,i=new WeakSet,o=[],s=0;function c(){a?.(),n=void 0,a=void 0}async function l(){for(let e=n;e;e=n)await e}let u=e.subscribe(e=>e,(e,t)=>{let r=e.current?e.connections.get(e.current):void 0,n=t.current?t.connections.get(t.current):void 0,a=r?.accounts,i=n?.accounts,o=void 0===a||void 0===i?a===i:a.length===i.length&&a.every((e,t)=>{let r=i[t];return void 0!==r&&(0,j.isAddress)(e)&&(0,j.isAddress)(r)&&(0,K.isAddressEqual)(e,r)});("disconnected"!==e.status||"disconnected"===t.status)&&e.current===t.current&&e.chainId===t.chainId&&r?.chainId===n?.chainId&&o||(s+=1),("connected"===e.status||"disconnected"===e.status)&&c()}),d=()=>"connecting"===e.state.status||"reconnecting"===e.state.status;function h(e){if(i.has(e))return;i.add(e);let c=({type:e})=>{"connecting"===e&&(s+=1,n??=new Promise(e=>{a=e}))};if(e.emitter.on("message",c),o.push(()=>e.emitter.off("message",c)),"injected"!==e.type)return;async function u(n,a){let i=Date.now(),o=new F(`Injected wallet ${n} timed out`);try{return await (0,b.withTimeout)(a,{timeout:t,errorInstance:o})}catch(t){throw t===o&&r?.({event:"injected_read_timed_out",data:{connectorId:e.id,method:n,durationMs:Date.now()-i}}),t}}let h=e.getAccounts.bind(e),f=e.getChainId.bind(e),p=e.isAuthorized.bind(e),g=e.connect,m=e.onDisconnect.bind(e);function y(e){return async(...t)=>{let r=s;try{await e(...t)}catch(e){if(!(e instanceof F))throw e;r===s&&await m()}}}e.onAccountsChanged=y(e.onAccountsChanged.bind(e)),e.onConnect&&(e.onConnect=y(e.onConnect.bind(e))),e.onDisconnect=y(m),e.getAccounts=()=>u("eth_accounts",h),e.getChainId=()=>u("eth_chainId",f),e.isAuthorized=async()=>{let e=s,t=await p();return await l(),e===s&&t},e.connect=async function(t){let r=s;if(t?.isReconnecting&&!d())throw Error("Injected wallet reconnect is no longer active");let n=await g.call(e,t).finally(async()=>{t?.isReconnecting&&await l()});if(t?.isReconnecting){if(r!==s||!d())throw Error("Injected wallet reconnect is no longer active");if(0===n.accounts.length)throw Error("Injected wallet reconnect returned no accounts")}return n}}
1e.connectors.forEach(h);(0,W.watchConnectors)(e,{onChange:e=>e.forEach(h)})}(r,{timeoutMs:n.app.injectedReadTimeoutMs,onAuthEvent:n.app.authEvents?.onEvent}),r);e.s(["config",0,H],350182);var Q=e.i(871554),J=e.i(334769),z=e.i(720909);let V=()=>{let e,t,r=(0,a.c)(11),{authenticationStatus:n,setAuthenticationStatus:l,setConnectorStatus:u}=(0,z.useSiwxContext)(),{isLoggedIn:d,isLoggedInPending:h,authenticatedUser:f}=(0,J.useAuthenticationContext)(),p=(0,o.useLatest)(n);r[0]!==f||r[1]!==d||r[2]!==h||r[3]!==p||r[4]!==l||r[5]!==u?(e=()=>{if(!h){let e=(0,i.createWalletCache)();if(p.current===Q.AuthenticationStatusStates.PERSISTING&&d&&f?.type==="magic"&&f.address&&e.state.getMagicState({connectionStates:["ready"]})){let e=(0,c.getConnection)(H);(0,G.sendAuthDiagnosticEvent)("magic_optimistic_reconnect",{walletStatus:e.status,connectorId:e.connector?.id}),l(Q.AuthenticationStatusStates.SUCCESS),u(Q.ConnectorStates.CONNECTED)}}},r[0]=f,r[1]=d,r[2]=h,r[3]=p,r[4]=l,r[5]=u,r[6]=e):e=r[6],r[7]!==f||r[8]!==d||r[9]!==h?(t=[d,h,f],r[7]=f,r[8]=d,r[9]=h,r[10]=t):t=r[10],s.default.useEffect(e,t)};var Z=e.i(14924);e.s(["usePreloadMagic",0,()=>{s.default.useEffect(()=>{(0,Z.createMagicSdk)({chainId:137,config:{environmentVariables:{apiKey:B.MAGIC_KEY}}}).preload()},[])}],459028);var Y=e.i(719082);e.s(["useEventListener",()=>Y.default],406698);var X=e.i(436002),ee=e.i(489129);e.s(["useTimeout",0,function(e,t){var r=(0,X.default)(e),n=(0,s.useRef)(null),a=(0,s.useCallback)(function(){n.current&&clearTimeout(n.current)},[]);return(0,s.useEffect)(function(){if((0,ee.isNumber)(t)&&!(t<0))return n.current=setTimeout(r,t),a},[t]),a}],504377),e.s(["useUnmountedRef",0,function(){var e=(0,s.useRef)(!1);return(0,s.useEffect)(function(){return e.current=!1,function(){e.current=!0}},[]),e}],281351)},387281,3168,e=>{"use strict";e.s(["useAccount",()=>U],387281);var t=e.i(846574),r=e.i(669718),n=e.i(668168),a=e.i(728056);e.i(45806);var i=e.i(28168),o=e.i(396866),s=e.i(871554),c=e.i(334769),l=e.i(720909),u=e.i(557140),d=e.i(303115),h=e.i(966516),f=e.i(863348),p=e.i(251701),g=e.i(641483),m=e.i(974917);let y=[{id:"io.rabby",config:(0,g.rabby)()},{id:"com.okex.wallet",config:(0,p.okx)()},{id:"com.bitget.web3",config:(0,f.bitget)()}],w=()=>{let e,r,a=(0,t.c)(4),i=(0,m.useConnectors)();if(a[0]!==i){let t=i.map(C),r=i.find(S),o=[...t,...r?y.map(e=>{let{id:t,config:n}=e;return{id:t,connector:r,...n,isInstalled:!1}}):[]],s=o.reduce(_,{});e=o.filter(e=>!s[e.id]&&!(0,n.isDenylistedConnector)(e.id)).filter(A).map(E).filter(k).filter(P).filter(T).filter(O).sort(M).sort(L),a[0]=i,a[1]=e}else e=a[1];return a[2]!==e?(r={wallets:e},a[2]=e,a[3]=r):r=a[3],r},v=e=>{let r,n=(0,t.c)(5),{wallets:a}=w();if(n[0]!==e||n[1]!==a){let t;n[3]!==e?(t=t=>t.id===e,n[3]=e,n[4]=t):t=n[4],r=a.find(t),n[0]=e,n[1]=a,n[2]=r}else r=n[2];let i=r;return i||null};function b(e){return e.trim()}function C(e){let t=Object.entries(h.walletConfigs).find(t=>{let[r]=t;return -1!==r.split(",").map(b).indexOf(e.id)}),r=t?.[1],a={id:e.id,name:e.name??e.id??e.type,icon:(0,d.jsx)("img",{src:e.icon,alt:e.name,width:"100%",height:"100%"}),connector:e,iconShape:"squircle",isInstalled:"mock"===e.type||"injected"===e.type&&"metaMask"!==e.id&&"phantom"!==e.id||(0,n.isCoinbaseWalletConnector)(e.id)||(0,n.isMetaMaskConnector)(e.id)||(0,n.isMagicConnector)(e.id)};if(r){let{isInstalled:e,...t}=r;return{...a,...t}}return a}function S(e){return"walletConnect"===e.id}function _(e,t){return!1===t.enabled&&(e[t.id]=!0),e}function A(e,t,r){return r.findIndex(t=>t.id===e.id)===t}function E(e){return"walletConnect"===e.id?{...e,name:e.name,shortName:e.shortName}:e}function I(e){return"com.coinbase.wallet"===e.id}function k(e,t,r){return!("coinbaseWalletSDK"===e.id&&r.find(I))}function x(e){return"rabby"===e.id&&"injected"===e.connector.type}function P(e,t,r){return!("io.rabby"===e.id&&"walletConnect"===e.connector.id&&r.find(x))}function R(e){return"metaMaskSDK"===e.id||"metaMask"===e.id}function T(e,t,r){return!(("io.metamask"===e.id||"io.metamask.mobile"===e.id)&&r.find(R))}function D(e){return"app.phantom"===e.id}function O(e,t,r){return!("phantom"===e.id&&r.find(D))}function M(e,t){let r=e.isInstalled&&((0,n.isInjectedConnector)(e.connector.type)||(0,n.isMetaMaskConnector)(e.connector.id)),a=t.isInstalled&&((0,n.isInjectedConnector)(t.connector.type)||(0,n.isMetaMaskConnector)(t.connector.id));if(r&&!a)return -1;if(!r&&a)return 1;if(e.order&&!t.order)return -1;if(!e.order&&t.order)return 1;if(e.order&&t.order){if(e.order<t.order)return -1;if(e.order>t.order)return 1}return 0}function L(e,t){return"walletConnect"===e.id?1:"walletConnect"===t.id?-1:0}function U(e){let d,h,f,p,g=(0,t.c)(48),{optimisticMagic:m}=void 0===e?{}:e,{authenticationStatus:y}=(0,l.useSiwxContext)(),{isLoggedIn:w,authenticatedUser:b}=(0,c.useAuthenticationContext)(),{address:C,connector:S,status:_,chain:A,chainId:E}=(0,i.useConnection)(),I=v("magic");g[0]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.createWalletCache)().wallets.value,g[0]=d):d=g[0];let k=d;g[1]===Symbol.for("react.memo_cache_sentinel")?(h={...o.accountProfileQueryOptions,enabled:!1},g[1]=h):h=g[1];let{data:x}=(0,a.useQuery)(h),P="connecting"===_,R="connected"===_,T="reconnecting"===_;x?.proxyWallet;e:{let e,t,a;
1if(m&&y===s.AuthenticationStatusStates.SUCCESS&&w&&!S&&b?.type==="magic"&&b.address&&(0,r.createWalletCache)().state.canReconnect){let e,t,r,n=b.address;g[2]!==n||g[3]!==x?.proxyWallet?(e=(0,u.matchDepositWalletAddress)(n,x?.proxyWallet)??(0,u.matchDepositWalletAddress)(n,k),g[2]=n,g[3]=x?.proxyWallet,g[4]=e):e=g[4];let a=e,i=a?"depositWallet":"proxy";g[5]!==n||g[6]!==a?.address?(t=a?.address??(0,u.getProxyAddress)(n,"magic"),g[5]=n,g[6]=a?.address,g[7]=t):t=g[7];let o=t,s=a?.mode,c=I?I.connector:void 0;g[8]!==n||g[9]!==i||g[10]!==o||g[11]!==s||g[12]!==c||g[13]!==R||g[14]!==P?(r={address:n,proxyAddress:o,depositWalletMode:s,authenticationType:"magic",walletMode:i,connector:c,isConnecting:P,isConnected:R},g[8]=n,g[9]=i,g[10]=o,g[11]=s,g[12]=c,g[13]=R,g[14]=P,g[15]=r):r=g[15],f=r;break e}if(!S||!C){let e;g[16]!==R||g[17]!==P?(e={address:void 0,proxyAddress:void 0,depositWalletMode:void 0,authenticationType:void 0,walletMode:void 0,connector:void 0,isConnecting:P,isConnected:R},g[16]=R,g[17]=P,g[18]=e):e=g[18],f=e;break e}let i=(0,n.isMagicConnector)(S.id);g[19]!==x?.proxyWallet||g[20]!==C?(e=(0,u.matchDepositWalletAddress)(C,x?.proxyWallet)??(0,u.matchDepositWalletAddress)(C,k),g[19]=x?.proxyWallet,g[20]=C,g[21]=e):e=g[21];let o=e,c=i?"magic":"eoa",l=o?"depositWallet":i?"proxy":"safe";g[22]!==o?.address||g[23]!==C||g[24]!==S.id?(t=o?.address??(0,u.getProxyAddress)(C,S.id),g[22]=o?.address,g[23]=C,g[24]=S.id,g[25]=t):t=g[25];let d=t,h=o?.mode;g[26]!==c||g[27]!==l||g[28]!==d||g[29]!==h||g[30]!==C||g[31]!==S||g[32]!==R||g[33]!==P?(a={address:C,proxyAddress:d,depositWalletMode:h,authenticationType:c,walletMode:l,connector:S,isConnecting:P,isConnected:R},g[26]=c,g[27]=l,g[28]=d,g[29]=h,g[30]=C,g[31]=S,g[32]=R,g[33]=P,g[34]=a):a=g[34],f=a}let{address:D,proxyAddress:O,depositWalletMode:M,authenticationType:L,walletMode:U,connector:N,isConnected:j,isConnecting:K}=f;return g[35]!==D||g[36]!==L||g[37]!==A||g[38]!==E||g[39]!==N||g[40]!==M||g[41]!==j||g[42]!==K||g[43]!==T||g[44]!==O||g[45]!==_||g[46]!==U?(p={address:D,proxyAddress:O,depositWalletMode:M,authenticationType:L,walletMode:U,connector:N,status:_,isConnecting:K,isConnected:j,isReconnecting:T,chain:A,chainId:E},g[35]=D,g[36]=L,g[37]=A,g[38]=E,g[39]=N,g[40]=M,g[41]=j,g[42]=K,g[43]=T,g[44]=O,g[45]=_,g[46]=U,g[47]=p):p=g[47],p}e.s(["useWallet",0,v,"useWallets",0,w],3168)},692827,e=>{"use strict";var t=e.i(846574);e.i(45806);var r=e.i(167058),n=e.i(945769);function a(e){if(e&&"success"===e[0].status)return{value:e[0].result}}function i({address:e,token:t,chainId:n}){return{contracts:[{address:t,abi:r.erc20Abi,functionName:"balanceOf",args:[e],chainId:n}]}}e.s(["getTokenBalanceParameters",0,i,"useTokenBalance",0,function(e){let r,o,s,c,l,u,d=(0,t.c)(18),{address:h,token:f,chainId:p,queryOptions:g}=e;d[0]!==h||d[1]!==p||d[2]!==f?(r=i({address:h,token:f,chainId:p}),d[0]=h,d[1]=p,d[2]=f,d[3]=r):r=d[3];let m=!!h&&(g?.enabled??!0);d[4]!==g||d[5]!==m?(o={...g,enabled:m},d[4]=g,d[5]=m,d[6]=o):o=d[6],d[7]!==r||d[8]!==o?(s={...r,query:o},d[7]=r,d[8]=o,d[9]=s):s=d[9];let{data:y,isLoading:w,refetch:v}=(0,n.useReadContracts)(s);d[10]!==y?(c=a(y),d[10]=y,d[11]=c):c=d[11];let b=c;d[12]!==v?(l=async()=>({data:a((await v()).data)}),d[12]=v,d[13]=l):l=d[13];let C=l;return d[14]!==w||d[15]!==b||d[16]!==C?(u={data:b,isLoading:w,refetch:C},d[14]=w,d[15]=b,d[16]=C,d[17]=u):u=d[17],u}])},584564,e=>{"use strict";e.s(["useDisconnect",()=>A],584564);var t=e.i(669718),r=e.i(608114),n=e.i(820399),a=e.i(45806),i=e.i(28168),o=e.i(741453),s=e.i(857165),c=e.i(566344),l=e.i(910233),u=e.i(681663),d=e.i(334769),h=e.i(256490),f=e.i(846574),p=e.i(393171),g=e.i(401512),m=e.i(871554),y=e.i(720909);function w(e){try{e.connector.disconnect()}catch{}}function v(e){return e.id}function b(e){return e.id}function C(e){return e.id}function S(e){return e.connector}let _=(e,t)=>[...e].sort((e,r)=>t?e.connector.id===t.id?-1:+(r.connector.id===t.id):0);function A({mutation:e={},...E}={}){let I=(0,n.useQueryClient)(),k=(0,o.useConnections)(),{connector:x}=(0,i.useConnection)(),{mutateAsync:P}=(0,s.useDisconnect)(),{onDisconnectAsync:R}=function(){let e,n,a=(0,f.c)(11),{options:i,setConnector:s,setAuthenticationStatus:c,setConnectorStatus:l}=(0,y.useSiwxContext)(),{signOut:_,authenticatedUser:A}=(0,d.useAuthenticationContext)(),E=(0,o.useConnections)();a[0]!==A?.address||a[1]!==A?.type||a[2]!==E||a[3]!==i||a[4]!==c||a[5]!==s||a[6]!==l||a[7]!==_?(e={mutationFn:async e=>{let{signOutOnDisconnect:r,connectors:n}=e??{},a=void 0===r||r,o=n?.length?n:E.map(S),d=(0,t.createWalletCache)().state.value?.connectorId,f=(0,h.getLogoutGuardDecision)({authenticatedUserType:A?.type,cacheConnectorId:d,connectorIds:o.map(C)}),y="magic_non_magic_connector"===f.reason?"magic_non_magic_disconnect":f.reason,I=f.shouldLogout;i.signOutOnDisconnect&&a&&!I&&u.logger.info("[useOnDisconnect] Skipping signOut for disconnect guard",{authType:A?.type,connectorIds:o.map(b),cacheConnectorId:f.cacheConnectorId,skipReason:y}),i.signOutOnDisconnect&&a&&I&&(u.logger.info("[useOnDisconnect] Signing out due to disconnect",{authType:A?.type,connectorIds:o.map(v),cacheConnectorId:f.cacheConnectorId,signOutOnDisconnect:a}),(0,p.setLogoutTrigger)({reason:"wallet_disconnect",initiator:"system",trigger:"wallet_disconnect"},{mode:"if_unset"}),(0,g.trackWalletDisconnected)({externalWalletId:A?.address,walletProvider:d??o[0]?.id}),_()),s({id:"",name:void 0}),l(m.ConnectorStates.DISCONNECTED),c(m.AuthenticationStatusStates.IDLE),E.forEac
1h(w)}},a[0]=A?.address,a[1]=A?.type,a[2]=E,a[3]=i,a[4]=c,a[5]=s,a[6]=l,a[7]=_,a[8]=e):e=a[8];let I=(0,r.useMutation)(e);if(a[9]!==I){let{mutate:e,mutateAsync:t,...r}=I;n={onDisconnect:t=>{let r=void 0===t?{}:t,{signOutOnDisconnect:n,mutation:a}=r;return e({signOutOnDisconnect:void 0===n||n,connectors:r.connectors},{...a})},onDisconnectAsync:async e=>{let r=void 0===e?{}:e,{signOutOnDisconnect:n,mutation:a}=r;return t({signOutOnDisconnect:void 0===n||n,connectors:r.connectors},{...a})},...r},a[9]=I,a[10]=n}else n=a[10];return n}(),{authenticatedUser:T}=(0,d.useAuthenticationContext)(),D=a.default.useCallback(()=>{I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Account].favoriteEvents().queryKey,exact:!0}),I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Account].preferences().queryKey,exact:!0}),I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Account].profile().queryKey,exact:!0})},[I]),O=a.default.useCallback(()=>{I.setQueryData(c.queryKeys[l.QueryKey.Notifications].cachedClob().queryKey,[]),I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Notifications].clob().queryKey,exact:!0}),I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Notifications].perps._def}),I.setQueryData(c.queryKeys[l.QueryKey.Notifications].watermark().queryKey,Date.now())},[I]),M=a.default.useCallback(()=>{I.removeQueries({queryKey:c.queryKeys[l.QueryKey.OpenOrders]._def,exact:!0}),I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Positions]._def,exact:!0})},[I]),L=a.default.useCallback(()=>{I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Approvals]._def})},[I]),U=a.default.useCallback(()=>{I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Deposit].transactions().queryKey,exact:!0}),I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Deposit].quotes().queryKey,exact:!0}),I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Deposit].copied().queryKey,exact:!0}),I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Deposit].chains().queryKey,exact:!0}),I.removeQueries({queryKey:c.queryKeys[l.QueryKey.Deposit].lastSeenT2bSourceBlock().queryKey,exact:!0})},[I]),{mutate:N,mutateAsync:j,...K}=(0,r.useMutation)({mutationFn:async({connector:e=x}={})=>{let t=_(k,e);for await(let e of(0===t.length&&await P(),t))await P({connector:e.connector});return t.map(e=>e.connector)},onMutate:async({signOutOnDisconnect:e=!0,connector:r=x}={})=>{let n=_(k,r),a=(0,t.createWalletCache)(),i=a.state.value?.connectorId,o=(0,h.getLogoutGuardDecision)({authenticatedUserType:T?.type,cacheConnectorId:i,connectorIds:n.map(e=>e.connector.id)}),s="magic_non_magic_connector"===o.reason?"magic_non_magic_disconnect":o.reason,c=e&&o.shouldLogout;u.logger.info("[useDisconnect > onMutate] Starting disconnect mutation",{signOutOnDisconnect:e,requestedConnectorId:r?.id,disconnectingConnectorIds:n.map(e=>e.connector.id),cacheConnectorId:o.cacheConnectorId,skipReason:s}),await R({signOutOnDisconnect:e,connectors:n.map(e=>e.connector)}),c?(a.state.clear(),a.wallets.clear(),u.logger.info("[useDisconnect > onMutate] Cleared wallet cache for signout disconnect",{requestedConnectorId:r?.id,cacheConnectorId:o.cacheConnectorId})):u.logger.info("[useDisconnect > onMutate] Preserving wallet cache for non-signout disconnect",{requestedConnectorId:r?.id,hasCachedState:a.state.exists,cacheConnectorId:o.cacheConnectorId,skipReason:s,signOutOnDisconnect:e}),await I.cancelQueries({predicate:e=>e.queryKey[0]===l.QueryKey.Account||e.queryKey[0]===l.QueryKey.Approvals||e.queryKey[0]===l.QueryKey.Notifications||e.queryKey[0]===l.QueryKey.Deposit}),D(),L(),O(),U(),M()},onError(e){u.logger.error("[useDisconnect > onError]",{error:e})},...e,...E});return{disconnect:(e={})=>{let{signOutOnDisconnect:t=!0,mutation:r}=e;return N({signOutOnDisconnect:t},r)},disconnectAsync:async(e={})=>{let{signOutOnDisconnect:t=!0,mutation:r}=e;return j({signOutOnDisconnect:t},r)},...K}}},95293,e=>{"use strict";var t=e.i(332124),r=e.i(669718),n=e.i(668168),a=e.i(202597),i=e.i(840733),o=e.i(681663),s=e.i(166533),c=e.i(371135);let l="__authFlowLoggedStatus",u=e=>{if(e)return e.slice(0,500)},d=e=>e?.toLowerCase()??"",h=e=>{if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e){let t=Number(e);if(Number.isFinite(t))return t}},f=(e,t=0,r=new WeakSet)=>{if(!(t>
1=5)&&e&&"object"==typeof e&&!r.has(e)){if(r.add(e),(0,i.hasField)(e,"response")){let{response:t}=e;if((0,i.hasField)(t,"data")&&void 0!==t.data)return t.data;if(t&&"object"==typeof t)return t}if((0,i.hasField)(e,"cause"))return f(e.cause,t+1,r)}},p=e=>e instanceof Error?{errorName:e.name||"Error",errorMessage:e.message||"Unknown error",errorCode:(0,i.hasField)(e,"code")?h(e.code):void 0,errorResponse:u((0,s.safeSerialize)(f(e)))}:"object"==typeof e&&null!==e?{errorName:(0,i.hasField)(e,"name")&&"string"==typeof e.name?e.name:"UnknownError",errorMessage:(0,i.hasField)(e,"message")&&"string"==typeof e.message?e.message:(0,s.safeSerialize)(e)||"Unknown error",errorCode:(0,i.hasField)(e,"code")?h(e.code):void 0,errorResponse:u((0,s.safeSerialize)(f(e)))}:{errorName:"UnknownError",errorMessage:"string"==typeof e?e:"Unknown error",errorCode:void 0,errorResponse:void 0},g=e=>{let t=(0,r.createWalletCache)().state.value;return"magic"===e?t?.type==="magic"&&"email"===t.magicAuthType?"magic-email":t?.type==="magic"&&"oauth"===t.magicAuthType&&"google"===t.oauthProvider?"magic-google":"magic-oauth":"unknown"===e?"unknown":(0,n.isWalletConnectConnector)(e)?"eoa-qr":"eoa-injector"},m=()=>{let e=(0,r.createWalletCache)().state.value;if(e?.type==="magic"){if("email"===e.magicAuthType)return"email";if("oauth"===e.magicAuthType)return e.oauthProvider}},y=()=>({pathname:window.location.pathname,hasSearch:window.location.search.length>0,visibilityState:document.visibilityState}),w=()=>{let e=(0,c.getSafeAuthCacheContext)(),t=(0,r.createWalletCache)().state.value;return t?"magic"===t.type?{...e,cachedAuthType:t.type,cachedConnectorId:t.connectorId,cachedConnectionState:t.connectionState,cachedMagicAuthType:t.magicAuthType,cachedOauthProvider:t.oauthProvider,hasCachedAddress:!!t.address,hasCachedEmail:!!t.email}:{...e,cachedAuthType:t.type,cachedConnectorId:t.connectorId,hasCachedAddress:!!t.address}:e},v="true"===t.default.env.NEXT_PUBLIC_E2E_AUTH_HARNESS,b=(e,t)=>{v&&window.__PM_E2E_AUTH_EVENTS__?.push({context:t,eventName:e})},C=({authStatus:e,authType:t,connectorId:r,errorCode:n,errorMessage:a,errorName:i,errorResponse:o,magicProvider:s,step:l,trigger:u,timestamp:d,pathname:h,hasSearch:f,visibilityState:p,authAttemptId:g,authFailureCategory:m,authTraceId:y,cachedAuthType:w,cachedConnectorId:v,cachedConnectionState:b,cachedMagicAuthType:C,cachedOauthProvider:S,cacheExists:_,cacheReadFailed:A,gammaUserId:E,hasCachedAddress:I,hasCachedEmail:k,hasProxyWallet:x,hasSignerAddress:P,hasWalletAddress:R,profileId:T})=>({authStatus:e,authAttemptId:g,authFailureCategory:m,authTraceId:y,authType:t,connectorId:r,errorCode:n,errorMessage:(0,c.scrubAuthSensitiveText)(a),errorName:i,errorResponse:(0,c.scrubAuthSensitiveText)(o),magicProvider:s,step:l,trigger:u,timestamp:d,pathname:h,hasSearch:f,visibilityState:p,cachedAuthType:w,cachedConnectorId:v,cachedConnectionState:b,cachedMagicAuthType:C,cachedOauthProvider:S,cacheExists:_,cacheReadFailed:A,gammaUserId:E,hasCachedAddress:I,hasCachedEmail:k,hasProxyWallet:x,hasSignerAddress:P,hasWalletAddress:R,profileId:T}),S=e=>{Promise.resolve().then(e).catch(()=>void 0)};e.s(["logAuthFlowError",0,({authStatus:e,authAttemptId:t,authType:n,connectorId:i,error:s,errorCode:h,errorMessage:f,errorName:v,errorResponse:_,gammaUserId:A,hasProxyWallet:E,hasSignerAddress:I,profileId:k,trigger:x,walletAddress:P})=>{let R=(0,r.createWalletCache)().state.value,T=i??R?.connectorId??"unknown",D=P??R?.address,O=p(s),M=(({authStatus:e,authAttemptId:t,authType:r,connectorId:n,errorCode:a,errorMessage:i,errorName:o,errorResponse:s,gammaUserId:l,hasProxyWallet:h,hasSignerAddress:f,magicProvider:p,profileId:g,trigger:m,walletAddress:v})=>({...y(),...w(),authStatus:e,authAttemptId:t,authFailureCategory:(({authStatus:e,errorCode:t,errorMessage:r,errorName:n,errorResponse:a})=>{let i=[d(r),d(n),d(a)].join(" ");return"account_deleted"===e||i.includes("account deleted")?"account_deleted":429===t||i.includes("ratelimit")||i.includes("rate limit")?"rate_limited":i.includes("magic_proxy_check_failed")?"magic_proxy_check_failed":i.includes("magic_proxy_already_deployed")?"magic_proxy_already_deployed":i.includes("safe_check_failed")?"safe_check_failed":i.includes("safe_already_deployed")?"safe_already_deployed":-32603===t&&(i.includes("user denied account access")||i.includes("magic session")||i.includes("cancellederror"))?"magic_session_invali
1d":404===t?"gamma_not_found":409===t?"gamma_conflict":"unknown"})({authStatus:e,errorCode:a,errorMessage:i,errorName:o,errorResponse:s}),authType:r,connectorId:n,errorName:o,errorMessage:(0,c.scrubAuthSensitiveText)(i),errorCode:a,errorResponse:(0,c.scrubAuthSensitiveText)(u(s)),gammaUserId:l,hasWalletAddress:!!v,hasProxyWallet:h,hasSignerAddress:f,magicProvider:p,profileId:g,trigger:m,timestamp:Date.now()}))({authStatus:e,authAttemptId:t??(0,c.getCurrentAuthAttemptId)(),authType:n??g(T),errorName:v??O.errorName,errorMessage:f??O.errorMessage,errorCode:h??O.errorCode,errorResponse:_??O.errorResponse,gammaUserId:A,hasProxyWallet:E,hasSignerAddress:I,magicProvider:m(),profileId:k,connectorId:T,trigger:x,walletAddress:D});if("object"==typeof s&&null!==s)try{s[l]=e}catch{}o.logger.error("auth.flow.error",M),b("auth.flow.error",M);let L=C(M);if(S(()=>(0,a.sendGroundcoverEvent)("auth.flow.error",L)),"rejected"!==e){let t=(s instanceof Error,(({authStatus:e,connectorId:t,errorCode:r,errorMessage:n,errorName:a,trigger:i})=>{let o=Error(n??"Unknown auth flow error");return o.name=a??"AuthFlowError",o.authStatus=e,o.code=r,o.connectorId=t,o.trigger=i,o})({authStatus:e,connectorId:T,errorCode:M.errorCode,errorMessage:L.errorMessage,errorName:M.errorName,trigger:x}));S(()=>(0,a.captureGroundcoverException)(t,L))}},"logAuthFlowStep",0,({authAttemptId:e,authType:t,connectorId:n,data:i,gammaUserId:s,hasProxyWallet:l,hasSignerAddress:u,profileId:d,step:h,walletAddress:f})=>{let p=(0,r.createWalletCache)().state.value,v=n??p?.connectorId??"unknown",_=f??p?.address,A={...y(),...w(),...(0,c.sanitizeAuthDiagnosticData)(i),authAttemptId:e??(0,c.getCurrentAuthAttemptId)(),authType:t??g(v),connectorId:v,gammaUserId:s,hasWalletAddress:!!_,hasProxyWallet:l,hasSignerAddress:u,magicProvider:m(),profileId:d,step:h,timestamp:Date.now()};o.logger.info("auth.flow.step",A),b("auth.flow.step",A),S(()=>(0,a.sendGroundcoverEvent)("auth.flow.step",C(A)))},"parseAuthFlowError",0,p,"wasAuthFlowErrorLogged",0,(e,t)=>"object"==typeof e&&null!==e&&e[l]===t])},401512,256490,990044,e=>{"use strict";var t=e.i(256750);let r=new WeakMap;e.s(["normalizeAuthFailureReason",0,function(e){if(e&&"object"==typeof e){if("code"in e&&("number"==typeof e.code||"string"==typeof e.code))return`code_${e.code}`;if("name"in e&&"string"==typeof e.name&&e.name)return e.name}return"unknown_error"},"readAuthFailureStep",0,function(e){return e&&"object"==typeof e?r.get(e):void 0},"tagAuthFailureStep",0,function(e,t){e&&"object"==typeof e&&r.set(e,t)},"trackWalletConnectFailed",0,function(e){(0,t.trackEvent)("wallet_connect_failed",{wallet_provider:e.walletProvider,auth_method:e.authMethod,failure_step:e.failureStep,failure_reason:e.failureReason})},"trackWalletConnectInitiated",0,function(e){(0,t.trackEvent)("wallet_connect_initiated",{wallet_provider:e.walletProvider,auth_method:e.authMethod,trigger_location:e.triggerLocation})},"trackWalletDisconnected",0,function(e){(0,t.trackEvent)("wallet_disconnected",{external_wallet_id:e.externalWalletId,wallet_provider:e.walletProvider})},"trackWalletSwitched",0,function(e){(0,t.trackEvent)("wallet_switched",{previous_external_wallet_id:e.previousExternalWalletId,external_wallet_id:e.externalWalletId,wallet_provider:e.walletProvider})}],401512);var n=e.i(668168);e.s(["getLogoutGuardDecision",0,({authenticatedUserType:e,cacheConnectorId:t,connectorIds:r})=>{let a=r.filter(e=>"string"==typeof e&&e.length>0),i=a.length>0,o=!!t&&a.some(e=>e===t),s=a.some(e=>(0,n.isMagicConnector)(e));return i&&t&&!o?{shouldLogout:!1,reason:"non_active_connector",cacheConnectorId:t}:i&&"magic"===e&&!s?{shouldLogout:!1,reason:"magic_non_magic_connector",cacheConnectorId:t}:{shouldLogout:!0,cacheConnectorId:t}}],256490);var a=e.i(846574),i=e.i(669718);e.i(45806);var o=e.i(40494),s=e.i(463659);e.s(["useWalletAnalytics",0,()=>{let e,t,r=(0,a.c)(4),n=(0,s.useAmplitudeAnalytics)();r[0]!==n?(e=e=>{let{address:t,connector:r}=e;if(r){if("magic"===r.id){let e=(0,i.createWalletCache)().state.magic;n.trackEvent(o.Events.WalletConnected,{address:t,id:r?.id,name:r?.name,magicAuthType:e?.magicAuthType});return}n.trackEvent(o.Events.WalletConnected,{address:t,id:r.id,name:r.name})}},r[0]=n,r[1]=e):e=r[1];let c=e;return r[2]!==c?(t={emitConnectAnalytics:c},r[2]=c,r[3]=t):t=r[3],t}],990044)},371135,871586,e=>{"use strict";let t,r;var n=e.i(669718),a=e.i(202597);let i=0,o=()=>
1{if(void 0!==globalThis.crypto&&"function"==typeof globalThis.crypto.randomUUID)return globalThis.crypto.randomUUID();if(void 0!==globalThis.crypto&&"function"==typeof globalThis.crypto.getRandomValues){let e=new Uint8Array(16);globalThis.crypto.getRandomValues(e);let t=Array.from(e,e=>e.toString(16).padStart(2,"0")).join("");return`auth-${Date.now()}-${t}`}return i+=1,`auth-${Date.now()}-${i}`};e.s(["createDiagnosticId",0,o],871586);var s=e.i(681663);let c="polymarket.auth.currentAttempt",l="polymarket.auth.traceId",u=/^auth-trace-(?:[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i,d=e=>{if(e)try{let t=JSON.parse(e);if(!t||"object"!=typeof t)return;let r="authAttemptId"in t&&"string"==typeof t.authAttemptId?t.authAttemptId:void 0,n="createdAt"in t&&"number"==typeof t.createdAt?t.createdAt:void 0;if(!r||!n)return;return{authAttemptId:r,createdAt:n}}catch{return}},h=(e,t=Date.now())=>t-e.createdAt>=0&&t-e.createdAt<=6e5,f=()=>{if(t&&h(t))return t.authAttemptId;try{let e=d(window.sessionStorage.getItem(c));if(!e||!h(e))return void p();return t=e,e.authAttemptId}catch{return}},p=e=>{if(e){if(t){if(t.authAttemptId!==e)return}else if(1){let t=d(window.sessionStorage.getItem(c));if(!t||t.authAttemptId!==e)return}}t=void 0;try{window.sessionStorage.removeItem(c)}catch{}},g=()=>{let e={authTraceId:(()=>{if(r)return r;try{let e=window.sessionStorage.getItem(l);if(e&&u.test(e))return r=e,e;e&&window.sessionStorage.removeItem(l)}catch{}let e=(()=>{if(void 0!==globalThis.crypto&&"function"==typeof globalThis.crypto.randomUUID)return`auth-trace-${globalThis.crypto.randomUUID()}`;if(void 0!==globalThis.crypto&&"function"==typeof globalThis.crypto.getRandomValues){let e=new Uint8Array(16);globalThis.crypto.getRandomValues(e);let t=Array.from(e,e=>e.toString(16).padStart(2,"0")).join("");return`auth-trace-${t}`}})();if(e){r=e;try{window.sessionStorage.setItem(l,e)}catch{}return e}})()};try{let t=(0,n.createWalletCache)().state.value;if(!t)return{...e,cacheExists:!1};if("magic"===t.type)return{...e,cacheExists:!0,cachedAuthType:t.type,cachedConnectorId:t.connectorId,cachedConnectionState:t.connectionState,cachedMagicAuthType:t.magicAuthType,cachedOauthProvider:t.oauthProvider,hasCachedAddress:!!t.address,hasCachedEmail:!!t.email,magicProvider:"email"===t.magicAuthType?"email":t.oauthProvider??void 0};return{...e,cacheExists:!0,cachedAuthType:t.type,cachedConnectorId:t.connectorId,hasCachedAddress:!!t.address}}catch{return{...e,cacheExists:!1,cacheReadFailed:!0}}},m=new Set(["address","apiKey","baseAddress","cookie","credential","didToken","email","eoa","funderAddress","issuer","jwt","mnemonic","passphrase","password","privateKey","proxyAddress","proxyWallet","proxyWalletAddress","receivingProxy","secret","seed","session","signature","signer","signerAddress","token","userAddress","walletAddress"]),y=e=>e.replace(/[^a-zA-Z0-9]/g,"").toLowerCase(),w=new Set(Array.from(m,y)),v=["address","apikey","cookie","credential","email","jwt","key","mnemonic","passphrase","password","secret","seed","signature","signer","token","wallet"],b=/\b0x[a-fA-F0-9]{40}\b/g,C=/\b0x[a-fA-F0-9]{41,}\b/g,S=/\b[a-fA-F0-9]{64,}\b/g,_=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,A=/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,E=e=>e?.replace(A,"[redacted-jwt]").replace(_,"[redacted-email]").replace(C,"[redacted-hex]").replace(b,"[redacted-address]").replace(S,"[redacted-hex]"),I=e=>{let t=y(e);return t.startsWith("has")&&v.some(e=>t.endsWith(e))},k=(e,t,r)=>{if(null==e)return e;if("string"==typeof e)return E(e);if("object"!=typeof e)return e;if(e instanceof Date)return e.toISOString();if(r.has(e)||t>=8)return;if(r.add(e),Array.isArray(e)){let n=e.map(e=>k(e,t+1,r)).filter(e=>void 0!==e);return r.delete(e),n}let n=Object.entries(e).filter(([e,t])=>{let r;return r=y(e),!(!("boolean"==typeof t&&I(e))&&(I(e)||w.has(r)||r.endsWith("address")||r.endsWith("wallet")||r.endsWith("signer")||r.endsWith("token")||r.endsWith("secret")||r.endsWith("signature")||r.includes("apikey")||r.includes("api_key")||r.includes("cookie")||r.includes("credential")||r.includes("jwt")||r.includes("mnemonic")||r.includes("passphrase")||r.includes("password")||r.includes("privatekey")||r.includes("private_key")||r.includes("proxywallet")||r.includes("depositwallet")||r.includes("seed")||"session"===r||r.endsWith("sessionid")||r.endsWith("sessiontoken")||r.endsWith("sessioncookie")))}).map(([e,n])=>[e,k(n,t+1,r)]).filter(([,e])=>void 0!==e);return r.delete(e),Object.fromEntries(n)},x=(e={})=>k(e,0,new WeakSet),P=(e={})=>{let t=x(e),r="string"==typeof t.authAttemptId?t.authAttemptId:f();return{...g(),online:"u">typeof navigator?navigator.onLine:void 0,visibilityState:"u">typeof document?document.visibilityState:void 0,...t,authAttemptId:r}};e.s(["clearCurrentAuthAttemptId",0,p,"getCurrentAuthAttemptId",0,f,"getSafeAuthCacheContext",0,g,"getSafeAuthDiagnosticContext",0,P,"sanitizeAuthDiagnosticData",0,x,"scrubAuthSensitiveText",0,E,"sendAuthDiagnosticEvent",0,(e,t={})=>{let r={...P(t),event:e,timestamp:Date.now()};s.logger.info("auth.lifecycle",r),Promise.resolve((0,a.sendGroundcoverEvent)("auth.lifecycle",r)).catch(()=>void 0)},"startAuthAttempt",0,()=>(e=>{var r={authAttemptId:e,createdAt:Date.now()};t=r;try{window.sessionStorage.setItem(c,JSON.stringify(r))}catch{}return e})(o())],371135)},557140,552564,736238,e=>{"use strict";var t=e.i(778842),r=e.i(106543),n=e.i(995451),a=e.i(767487),i=e.i(550124),o=e.i(234348),s=e.i(842768);let c="0xd21df8dc65880a8606f09fe0ce3df9b8869287ab0b058be05aa9e8af6330a00b",l="0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715ddb6fcecf";function u(e,t){let n=(0,o.pad)(e,{dir:"left",size:32});return(0,r.encodeAbiParameters)([{type:"address"},{type:"bytes32"}],[t,n])}e.s(["DEPOSIT_WALLET_DOMAIN_NAME",0,"DepositWallet","DEPOSIT_WALLET_DOMAIN_VERSION",0,"1","PROXY_INIT_CODE_HASH",0,c,"SAFE_FACTORY_NAME",0,"Polymarket Contract Proxy Factory","SAFE_INIT_CODE_HASH",0,l],552564);let d=(e,r,n)=>{let o,c=u(e,r),l=(0,i.keccak256)(c),d=(o=BigInt((c.length-2)/2),(0,i.keccak256)((0,t.concat)([(0,s.toHex)(0x61003d3d8160233d3973n+(o<<56n),{size:10}),n,"0x6009","0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076","0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3",c])));return(0,a.getCreate2Address)({from:r,salt:l,bytecodeHash:d})},h=(e,r,n)=>{let o,c=u(e,r),l=(0,i.keccak256)(c),d=(o=BigInt((c.length-2)/2),(0,i.keccak256)((0,t.concat)([(0,s.toHex)(0x6100523d8160233d3973n+(o<<56n),{size:10}),n,"0x60195155f3363d3d373d3d363d602036600436635c60da","0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c","0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3",c])));return(0,a.getCreate2Address)({from:r,salt:l,bytecodeHash:d})};e.s(["deriveBeaconDepositWallet",0,h,"deriveProxyWallet",0,(e,t)=>(0,a.getCreate2Address)({bytecodeHash:c,from:t,salt:(0,i.keccak256)((0,n.encodePacked)(["address"],[e]))}),"deriveSafe",0,(e,t)=>(0,a.getCreate2Address)({bytecodeHash:l,from:t,salt:(0,i.keccak256)((0,r.encodeAbiParameters)([{name:"address",type:"address"}],[e]))}),"deriveUupsDepositWallet",0,d],736238);var f=e.i(510335),p=e.i(676322),g=e.i(95184),m=e.i(732659),y=e.i(134320),w=e.i(957705),v=e.i(681663),b=e.i(519216),C=e.i(371135);let S=(e,t)=>"uups"===t?d(e,w.DEPOSIT_WALLET_FACTORY_ADDRESS,w.DEPOSIT_WALLET_IMPLEMENTATION_ADDRESS):h(e,w.DEPOSIT_WALLET_FACTORY_ADDRESS,"0x7A18EDfe055488A3128f01F563e5B479D92ffc3a"),_=async e=>{let t=(0,y.createChainAwarePublicClient)({chainId:b.MATIC_CONFIG.chainId});if(!t){let t=Error("No public client available for chain");throw v.logger.warn("[isSafeDeployedOnChain] no public client available",(0,C.getSafeAuthDiagnosticContext)({chainId:b.MATIC_CONFIG.chainId,hasSafeAddress:!!e})),t}try{let r=await t.getCode({address:e});return!!r&&"0x"!==r}catch(t){throw v.logger.warn("[isSafeDeployedOnChain] getCode failed",(0,C.getSafeAuthDiagnosticContext)({chainId:b.MATIC_CONFIG.chainId,hasSafeAddress:!!e,errorMessage:t instanceof Error?t.message:String(t)})),t}};e.s(["getProxyAddress",0,(e,t)=>"beacon"===t||"depositWallet"===t?S(e,"beacon"):"uups"===t?S(e,"uups"):(0,p.deriveProxyAddress)(e,"magic"===t?"magic":"eoa",{magic:{factoryAddress:w.PROXY_WALLET_FACTORY_ADDRESS},eoa:{factoryAddress:f.defaultNetworks[b.MATIC_CONFIG.chainId].proxyFactoryAddress,initCodeHash:w.SAFE_INIT_CODE_HASH}}),"isSafeDeployedOnChain",0,_,"matchDepositWalletAddress",0,(e,t)=>{if(!t)return;if(!(0,g.isAddress)(t))return void v.logger.warn("[matchDepositWalletAddress] proxyWallet candidate is not a valid address",(0,C.getSafeAuthDiagnosticContext)({event:"dw_match_invalid_candidate"}));let r=S(e,"beacon");if((0,m.isAddressEqual)(r,t))return{address:r,mode:"beacon"};let n=S(e,"uups");if((0,m.isAddressEqual)(n,t))return{address:n,mode:"uups"}}],557140)},435248,e=>{"use strict";var t=e.i(167058),r=e.i(163483),n=e.i(190794),a=e.i(134320),i=e.i(957705),o=e.i(681663),s=e.i(519216),c=e.i(371135),l=e.i(557140);let u=async e=>(await (0,r.getV2)("/value",{user:e},n.V2ValueResponseSchema)).data.value,d=async e=>{let r=(0,a.createChainAwarePublicClient)({chainId:s.MATIC_CONFIG.chainId});return r?r.readContract({address:i.USDC_ADDRESS,abi:t.erc20Abi,functionName:"balanceOf",args:[e]}):0n},h=async e=>{let r=(0,a.createChainAwarePublicClient)({chainId:s.MATIC_CONFIG.chainId});if(!r)return o.logger.warn("[isLegacyProxyEmpty] no public client available; treating proxy as not empty",(0,c.getSafeAuthDiagnosticContext)({hasLegacyProxyAddress:!!e})),!1;let n=n=>r.readContract({address:n,abi:t.erc20Abi,functionName:"balanceOf",args:[e]});try{let[t,r,a,s]=await Promise.all([n(i.USDC_ADDRESS),n(i.POLYGON_NATIVE_USDC_ADDRESS),n(i.USDCE_ADDRESS),u(e)]),l=0n===t&&0n===r&&0n===a&&0===s;return l||o.logger.info("[isLegacyProxyEmpty] legacy proxy still holds assets",(0,c.getSafeAuthDiagnosticContext)({hasLegacyProxyAddress:!!e,pusdBalance:t.toString(),nativeUsdcBalance:r.toString(),usdceBalance:a.toString(),positionsValue:s})),l}catch(t){return o.logger.warn("[isLegacyProxyEmpty] asset check failed; treating proxy as not empty",(0,c.getSafeAuthDiagnosticContext)({hasLegacyProxyAddress:!!e,errorMessage:t instanceof Error?t.message:String(t)})),!1}},f=async e=>{let[t,r]=await Promise.all([h((0,l.getProxyAddress)(e,"eoa")),h((0,l.getProxyAddress)(e,"magic"))]);return t&&r};
1e.s(["areLegacyProxiesEmpty",0,f,"getPusdBalance",0,d])},134320,402400,e=>{"use strict";var t=e.i(266876),r=e.i(337723),n=e.i(274282),a=e.i(530878);let i=({chainId:e,apiKey:r,authentication:i="default"})=>{if(!t.chainConfigs[e])return(0,n.http)();let o=r||t.chainConfigs[e].rpcUrls.alchemy.key;if(!o)return(0,n.http)();let s=(0,a.createRpc)({chainId:e,apiKey:o}),c="default"===i?s.http:s.baseHttp;return(0,n.http)(c,{batch:{batchSize:1e3,wait:50},..."bearer"===i&&{fetchOptions:{headers:{Authorization:`Bearer ${s.key}`}}}})};e.s(["createTransport",0,i,"createTransports",0,({chains:e})=>e.reduce((e,t)=>{var a;let o=void t.id,s=o?(0,n.http)(o):(a=[i({chainId:t.id,authentication:"bearer"}),(0,n.http)()],(0,r.fallback)(a,void 0));return e?(e[t.id]=s,e):{[t.id]:s}},{})],402400);var o=e.i(285799),s=e.i(600153),c=e.i(166031),l=e.i(560711),u=e.i(519216);let d=[s.mainnet,c.polygon,l.polygonMumbai];e.A(223388).catch(()=>void 0),e.s(["createChainAwarePublicClient",0,({chainId:e=u.MATIC_CONFIG.chainId}={})=>{let r=d.find(t=>t.id===e)??c.polygon;return u.POLYGON_RPC_URL&&r.id===u.MATIC_CONFIG.chainId?(0,o.createPublicClient)({chain:r,transport:(0,n.http)(u.POLYGON_RPC_URL),ccipRead:!1}):(0,o.createPublicClient)({chain:r,ccipRead:!1,transport:i({chainId:r.id,apiKey:t.chainConfigs[r.id].rpcUrls.alchemy.key,authentication:"bearer"})})}],134320)},828760,262153,e=>{"use strict";var t=e.i(251665),r=e.i(874783);let n=["BE","BY","BI","BR","CF","CD","CU","ET","FR","IR","IQ","KP","LB","LY","MM","NI","RU","SO","SS","SD","SY","GB","UM","US","VE","YE","ZW","SG","PL","TH","TW","AU","IT","DE","NL","JP","SK","IE","NZ","KR"],a=["IR","SY","CU","KP"],i=e=>"GB"===e.country,o=e=>"FR"===e.country,s=e=>"CA"===e.country&&("ON"===e.countryRegion||"Ontario"===e.countryRegion),c=e=>"CA"===e.country&&("QC"===e.countryRegion||"Quebec"===e.countryRegion),l=e=>"CA"===e.country&&("BC"===e.countryRegion||"British Columbia"===e.countryRegion),u=e=>"CA"===e.country&&("AB"===e.countryRegion||"Alberta"===e.countryRegion),d=e=>"UA"===e.country&&"43"===e.countryRegion,h=e=>"UA"===e.country&&"14"===e.countryRegion,f=e=>"UA"===e.country&&"09"===e.countryRegion,p=e=>a.includes(e.country?.toUpperCase()??"")||d(e)||h(e)||f(e),g=e=>n.includes(e.country?.toUpperCase()??"")&&!p(e),m=e=>"TR"===e.country,y=e=>"CA"===e.country,w=e=>"US"===e.country,v=e=>!!e&&(n.includes(e.country?.toUpperCase()??"")||s(e)||c(e)||l(e)||u(e)||d(e)||h(e)||f(e));e.s(["convertGeoApiResponseToGeo",0,e=>({country:e.location.country,countryRegion:e.location.region}),"getIsRestricted",0,v,"isAlberta",0,u,"isBlockCompletely",0,p,"isBritishColumbia",0,l,"isCanada",0,y,"isCloseOnlyCountry",0,g,"isFrance",0,o,"isOntario",0,s,"isQuebec",0,c,"isTurkey",0,m,"isUk",0,i,"isUsa",0,w],262153);let b=e=>({canBuy:!e,canSell:!e,canDeposit:!e,canWithdraw:!e,canSplit:!e,canMerge:!e,canRedeem:!e,canCreateApiKey:!e,canApprove:!e,canCancelOrders:!e}),C={block:[],closeOnly:[],allow:[]},S={hasFetchedLocation:!1,isRestrictedLocation:!1,permissions:b(!1),isTurkey:!1,isUk:!1,isCanada:!1,isUsa:!1,isFrance:!1,isOntario:!1,isQuebec:!1,isBritishColumbia:!1,isAlberta:!1,isCloseOnlyCountry:!1,rawCountry:void 0,rawRegion:void 0},_=(0,t.create)()((0,r.immer)(e=>({...S,walletLists:C,setGeolocation:({geolocation:t,disabled:r=!1})=>{e(e=>{if(!t||r)return void Object.assign(e,{...S,hasFetchedLocation:!0});let n=v(t),a=n&&!p(t);Object.assign(e,{hasFetchedLocation:!0,isRestrictedLocation:n,permissions:{...b(n),...a&&{canSell:!0,canWithdraw:!0,canMerge:!0,canRedeem:!0,canCreateApiKey:!0,canApprove:!0,canCancelOrders:!0}},isTurkey:m(t),isUk:i(t),isCanada:y(t),isUsa:w(t),isFrance:o(t),isOntario:s(t),isQuebec:c(t),isBritishColumbia:l(t),isAlberta:u(t),isCloseOnlyCountry:g(t),rawCountry:t.country,rawRegion:t.countryRegion})})},setFetchFailed:()=>{e(e=>{e.hasFetchedLocation=!0,e.isRestrictedLocation=!0,e.permissions=b(!0)})},setWalletLists:t=>{e(e=>{e.walletLists={block:t.block.map(e=>e.toLowerCase()),closeOnly:t.closeOnly.map(e=>e.toLowerCase()),allow:t.allow.map(e=>e.toLowerCase())},e.permissions={...e.permissions}})}})));e.s(["getDefaultPermissions",0,b,"useGeoStore",0,_],828760)},32221,e=>{"use strict";var t=e.i(251665),r=e.i(874783);let n=(0,t.create)()((0,r.immer)(e=>({misroutedEoas:{},setMisroutedEoa:(t,r)=>
1{e(e=>{e.misroutedEoas[t.toLowerCase()]=r})}})));e.s(["useMisroutedDepositWalletStore",0,n])},521280,523012,e=>{"use strict";e.s(["AccountContextProvider",()=>el,"useAccountContext",()=>eu],521280),e.s(["formatPauseUntil",()=>V,"getPauseOptionEndsAt",()=>z,"pauseCopyArgs",()=>Z,"useSelfPause",()=>X],523012);var t=e.i(303115),r=e.i(139393),n=e.i(734804),a=e.i(877762),i=e.i(45806),o=e.i(285952),s=e.i(534878),c=e.i(512402),l=e.i(237909),u=e.i(981239),d=e.i(40494),h=e.i(841105),f=e.i(466954),p=e.i(361381),g=e.i(748858),m=e.i(202597),y=e.i(90679),w=e.i(871554),v=e.i(745507),b=e.i(355664),C=e.i(371135),S=e.i(187511),_=e.i(598252),A=e.i(28168),E=e.i(635791),I=e.i(900579),k=e.i(855348),x=e.i(669718),P=e.i(728056),R=e.i(556784),T=e.i(319670),D=e.i(452284),O=e.i(84394),M=e.i(681663),L=e.i(222396);let U=async e=>{try{let t=await fetch(`/api/intercom/jwt?user_id=${encodeURIComponent(e)}`);if(!t.ok)return null;return(await t.json()).token??null}catch{return null}};function N(){return(0,k.useIntercomBubble)(),(()=>{let{proxyAddress:e,authenticationType:t,authenticated:r}=eu(["proxyAddress","authenticationType","authenticated"]),{accountProfile:n}=(0,l.default)(),{lastEmail:a,lastVerifiedEmail:s}=(0,L.default)(),c=(0,i.useRef)(null),{data:u}=(0,P.useQuery)({queryKey:["/api/intercom/jwt",e],queryFn:()=>U(e),enabled:o.INTERCOM_ENABLED&&!!e&&r,staleTime:3e6,gcTime:3e6,refetchInterval:3e6,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),{data:d,isFetched:h}=(0,T.useUserStats)(e,{enabled:o.INTERCOM_ENABLED&&r}),{marketPositionsValue:f,isMarketPositionsValueLoading:p,isMarketPositionsValuePending:g}=(0,D.useMarketPositionsValue)(e),{trackedProxyUsdcBalance:m,isProxyUsdcBalanceFetching:y}=(0,O.default)(e),w=h&&!(p||g||y);(0,i.useEffect)(()=>{if(!o.INTERCOM_ENABLED)return;let i=(0,x.createWalletCache)();if(r&&e&&u){let r=()=>{if(!window.Intercom)return;let r="";if(s?.email)r=s.email;else if(a?.email)r=a.email;else if("magic"===t){let e=i.state.oauth,t=i.state.email;e?.email?r=e.email:t?.email&&(r=t.email)}else n?.email&&(r=n.email.startsWith(R.OAUTH_EMAIL_PREFIX)?n.email.substring(R.OAUTH_EMAIL_PREFIX.length):n.email);let o=n?.username,c={user_id:e,proxy_wallet:e};u&&(c.intercom_user_jwt=u),r&&(c.email=r),o&&(c.name=o),t&&(c.auth_type=t),window.Intercom("update",c)};return r(),window.Intercom&&window.Intercom("onShow",r),()=>{window.Intercom&&window.Intercom("onHide",()=>{})}}return()=>{window.Intercom&&window.Intercom("onHide",()=>{})}},[r,e,t,n,a,s,u]),(0,i.useEffect)(()=>{o.INTERCOM_ENABLED&&(()=>{try{if(!window.Intercom||!r||!e||!u){c.current=null;return}if(c.current===e||!w)return;let t={lifetime_volume:Math.round(d?.volume??0),cash_balance:Math.round(m.current),portfolio_balance:Math.round((f??0)+m.current)};u&&(t.intercom_user_jwt=u),window.Intercom("update",t),c.current=e}catch(t){c.current=e??null,M.logger.error("[useIntercomUserData] Failed to update Intercom positions",{error:t})}})()},[r,e,w,d?.volume,f,m?.current,u])})(),null}var j=e.i(463659),K=e.i(846574),W=e.i(608114),F=e.i(820399),q=e.i(566344),$=e.i(910233),G=e.i(910044),B=e.i(384187),H=e.i(519216);let Q="self-exclusion",J=[{id:"1m",months:1},{id:"3m",months:3},{id:"6m",months:6},{id:"1y",months:12},{id:"lifetime",lifetime:!0}],z=(e,t)=>{if(e.lifetime)return 0x3afff4417f;let r=new Date(t),n=r.getUTCDate();r.setUTCDate(1),r.setUTCMonth(r.getUTCMonth()+(e.months??0));let a=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+1,0)).getUTCDate();return r.setUTCDate(Math.min(n,a)),Math.floor(r.getTime()/1e3)},V=(e,t,r={dateStyle:"medium"})=>t.dateTime(new Date(1e3*e),r),Z=(e,t,r)=>{let n=void 0===e||e>=0x3afff4417f;return{lifetime:n?"true":"false",date:n?"":V(e,t,r)}},Y=async({until:e})=>{let{data:t}=await G.axios.post(`${H.GAMMA_API_URL}/v1/account/self-exclusion`,{until:e},{withCredentials:!0});return t},X=()=>{let e,t,r=(0,K.c)(7),n=(0,F.useQueryClient)(),{accountProfile:a}=(0,l.default)(),i=(0,B.useServerMountTime)(),o=a?.closeOnlyUntil??void 0,s=a?.closeOnlyReason===Q&&!!o&&o>i/1e3;r[0]!==n?(e={mutationFn:Y,onSuccess:(e,t)=>{let{optionId:r,until:a}=t;(0,m.sendGroundcoverEvent)("self_exclusion_activated",{option:r,until:e.close_only_until??null,lifetime:"number"==typeof e.close_only_until&&e.close_only_until>=0x3afff4417f}),n.setQueryData(q.queryKeys[$.QueryKey.Account].profile().queryKey,t=>
1t?{...t,closeOnlyUntil:e.close_only_until??a,closeOnlyReason:e.close_only_reason??Q}:t)},onError:ee},r[0]=n,r[1]=e):e=r[1];let{mutateAsync:c,isPending:u}=(0,W.useMutation)(e),d=s?o:void 0;return r[2]!==c||r[3]!==u||r[4]!==s||r[5]!==d?(t={isSelfPaused:s,pausedUntil:d,options:J,activate:c,isActivating:u},r[2]=c,r[3]=u,r[4]=s,r[5]=d,r[6]=t):t=r[6],t};function ee(e,t){let{optionId:r}=t;(0,m.sendGroundcoverEvent)("self_exclusion_activation_failed",{option:r}),M.logger.error("[useSelfPause > onError]",{error:e})}let et=(0,a.default)(()=>e.A(419027).then(e=>e.CopyAddressWarningModal),{loadableGenerated:{modules:[659882]},ssr:!1}),er=(0,a.default)(()=>e.A(998295).then(e=>e.TradingRestricteDialog),{loadableGenerated:{modules:[959148]},ssr:!1}),en=(0,a.default)(()=>e.A(733100),{loadableGenerated:{modules:[668476]},ssr:!1}),ea=(0,a.default)(()=>e.A(57516).then(e=>e.DepositWalletMigrationModal),{loadableGenerated:{modules:[760337]},ssr:!1}),ei=(0,a.default)(()=>e.A(678320).then(e=>e.NonUsIpModal),{loadableGenerated:{modules:[747584]},ssr:!1}),eo=(0,a.default)(()=>e.A(812181).then(e=>e.ProofOfResidenceModal),{loadableGenerated:{modules:[99556]},ssr:!1}),es=(0,a.default)(()=>e.A(432370).then(e=>e.ViewOnlyModeModal),{loadableGenerated:{modules:[716484]},ssr:!1}),ec=(0,r.createSplitContext)("AccountContext",{isSessionLoading:!1,authenticated:!1,isUserOnboarding:!1,baseAddress:void 0,proxyAddress:void 0,authenticationType:void 0,walletMode:void 0,preventModalClose:!1,closedDynamic:!1,isComplianceCloseOnly:!1,isSelfPaused:!1,selfPausedUntil:void 0,setPreventModalClose:()=>{throw Error("AccountContext must export an `setPreventModalClose` function.")},toggleFavoriteEvent:e=>{throw Error("AccountContext must export a `toggleFavoriteEvent` function.")}});function el({children:e}){let{initializeUserSession:r,identifyMarketingUser:a,adapters:k}=(0,j.useAnalyticsContext)(),x=(0,j.useAmplitudeAnalytics)(),P=(0,y.useRouter)(),[R,T]=(0,i.useState)(!1),{setOpen:D,route:O,connectorRoute:M,open:L,gamma:U,isLoggedIn:K,authenticatedUser:W,authenticationStatus:F,connectorStatus:q,walletRecoveryRequired:$}=(0,b.useSiwx)(),{status:G,address:B}=(0,A.useConnection)(),{baseAddress:H,proxyAddress:Q,authenticated:J,isSessionLoading:z,authenticationType:V,walletMode:Z}=(0,v.useAccountState)();(0,S.useSessionHealthObservability)({accountKey:W?.address.toLowerCase(),emit:C.sendAuthDiagnosticEvent,gammaStatus:U.status,gammaAuthType:W?.type,isLoggedIn:K,authenticated:J,isSessionLoading:z,authenticationStatus:F,connectorStatus:q,walletStatus:G,hasWalletAddress:!!B,walletMatchesGamma:!!B&&B.toLowerCase()===W?.address.toLowerCase(),walletRecoveryRequired:$,isInteractiveAuth:L||O===w.AuthRoute.ONBOARDING||F===w.AuthenticationStatusStates.PENDING||q===w.ConnectorStates.CONNECTING});let Y=(0,i.useRef)(J);(0,i.useEffect)(()=>{if(!Y.current&&J){let e="u">typeof navigator?/Mobi|Android/i.test(navigator.userAgent)?"mobile":"desktop":void 0;x.trackEvent(d.Events.SuccessfulLogin),(0,g.trackEvent)("session_started",{device:e}),(0,f.trackClientEvent)("session_started",{device:e,auth_method:V}),(0,f.trackClientEvent)("logged_in",{device:e,auth_method:V}),k?.[h.BrowserAnalyticsAdapterEnum.GoogleAnalytics]&&k[h.BrowserAnalyticsAdapterEnum.GoogleAnalytics].trackGA4Event("login",{method:V||"unknown",platform:"web",device:e}),(0,m.sendGroundcoverEvent)("auth_login",{method:V||"unknown",platform:"web",device:e});try{let e=n.default.get("pm_return_to");e&&"string"==typeof e&&(n.default.remove("pm_return_to",{path:"/"}),e.startsWith("/")&&P.replace((0,y.stripLocalePrefix)(e)))}catch{}}Y.current=J},[J,x,k,V,P]);let ee=(0,i.useMemo)(()=>J&&O===w.AuthRoute.ONBOARDING,[J,O]),{accountProfile:eu}=(0,l.default)({isSessionLoading:z,authenticated:J,proxyAddress:Q??_.zeroAddress,isOnboarding:ee},{enableCallbacks:!0}),ed=(0,i.useMemo)(()=>!!Q&&!!eu?.proxyWallet&&eu.proxyWallet.toLowerCase()===Q.toLowerCase(),[Q,eu?.proxyWallet]),eh=ed?eu:void 0,ef=(0,p.getProfileEmail)(eh),{isSelfPaused:ep,pausedUntil:eg}=X(),em=ed&&ep,ey=em?eg:void 0;(0,c.default)(J,V,Q,z,ee);let{toggleFavoriteEvent:ew}=(0,u.default)(J,Q,z,ee),ev=(0,i.useCallback)(()=>{x.trackEvent(d.Events.LeaveFlow,{type:M,error_type:null}),D(!1)},[x,M,D]);(0,i.useEffect)(()=>{Q&&r(Q,V)},[V,r,Q]),(0,i.useEffect)(()=>{Q&&a(Q,{polymarket_wallet_id:Q,...H&&{external_wallet_id:H},...ef&&{email:ef},...eh?.username&&{username:eh.username},...eh?.bio&&{bio:eh.bio},...eh?.xUsername&&{x_handle:eh.xUsername}})},[H,a,eh?.bio,eh?.username,eh?.xUsername,Q,ef]);let eb=(0,i.useMemo)(()=>({isSessionLoading:z,authenticated:J,isUserOnboarding:ee,authenticationType:V,walletMode:Z,baseAddress:H,proxyAddress:Q,preventModalClose:R,setPreventModalClose:T,toggleFavoriteEvent:ew,closedDynamic:(eu?.isCloseOnly??!1)||em,isCompl
1ianceCloseOnly:eu?.isCloseOnly??!1,isSelfPaused:em,selfPausedUntil:ey}),[z,J,ee,V,Z,H,Q,R,ew,eu?.isCloseOnly,em,ey]);return(0,t.jsx)(ec.Provider,{values:eb,children:(0,t.jsxs)(I.FunkitContextProvider,{children:[(0,t.jsx)(E.ComplianceEffects,{}),(0,t.jsx)(s.AuthenticationFlow,{onClose:ev}),J&&(0,t.jsx)(eo,{}),J&&(0,t.jsx)(ei,{}),J&&(0,t.jsx)(es,{}),J&&(0,t.jsx)(ea,{}),J&&(0,t.jsx)(et,{}),(0,t.jsx)(en,{}),(0,t.jsx)(er,{}),o.INTERCOM_ENABLED&&(0,t.jsx)(N,{}),e]})})}let eu=e=>(0,r.useSplitContext)(ec,e)},463659,753816,e=>{"use strict";var t=e.i(303115),r=e.i(846574),n=e.i(871971),a=e.i(254094),i=e.i(333650),o=e.i(877762),s=e.i(45806),c=e.i(690507),l=e.i(841105),u=e.i(426200),d=e.i(307014),h=e.i(748858),f=e.i(27090),p=e.i(437303),g=e.i(256750),m=e.i(90679),y=e.i(202597),w=e.i(26011);let v=null,b=0,C=null,S=[];function _(){return w.isBrowser?performance.memory??null:null}function A(){let e,t,r,n,a=_();if(!a)return;let i=(e=Math.round(a.usedJSHeapSize/1024/1024),t=Math.round(a.totalJSHeapSize/1024/1024),r=Math.round(a.jsHeapSizeLimit/1024/1024),n=Number((a.usedJSHeapSize/a.jsHeapSizeLimit*100).toFixed(1)),{usedJSHeapSize:a.usedJSHeapSize,totalJSHeapSize:a.totalJSHeapSize,jsHeapSizeLimit:a.jsHeapSizeLimit,usedMB:e,totalMB:t,limitMB:r,usagePercent:n}),o=i.usedJSHeapSize>0x80000000,s=i.usagePercent/100>.8;if(!o&&!s){b=0,C=null;return}let c=Date.now();if(!(null===C||c>=C))return;b++,C=c+6e4;let l={usedMB:i.usedMB,totalMB:i.totalMB,limitMB:i.limitMB,usagePercent:i.usagePercent,deviceMemoryGB:navigator.deviceMemory??null,visibilityState:document.visibilityState,sessionDurationMs:Math.round(performance.now()),nthAlertInARow:b,visitedRoutes:[...S]};(0,y.sendGroundcoverEvent)("absolute_threshold"==(s&&o?"relative_threshold":o?"absolute_threshold":"relative_threshold")?"high_memory_exceeded_2gb":"high_memory_exceeded_80pct",l)}function E(){v&&(clearInterval(v),v=null),b=0,C=null}var I=e.i(842757),k=e.i(332124);let x="pm_tid",P=/^[A-Za-z0-9]{7,8}$/,R=/^[A-Za-z0-9]{7}$/,T=k.default.env.NEXT_PUBLIC_DUB_DOMAIN??"poly.market",D=()=>{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";return Array.from({length:8},()=>e[Math.floor(Math.random()*e.length)]).join("")},O=async(e,t)=>{for(let e=0;!window.dubAnalytics&&e<20;e++)await new Promise(e=>setTimeout(e,250));e({domain:T,key:t})};function M(){return(()=>{let e,t,a=(0,r.c)(6),{trackClick:i}=(0,n.useAnalytics)(),o=(0,m.usePathname)(),c=(0,I.useWindowSearchAndHash)();a[0]!==i?(e=()=>{let e,t;if(e=window.location.hash.slice(1),!P.test(e)||!e)return;let r=(t=window.location.hash.slice(1),R.test(t)?t:null);r&&O(i,r);let n=setTimeout(L,100);return()=>clearTimeout(n)},a[0]=i,a[1]=e):e=a[1],a[2]!==o||a[3]!==c||a[4]!==i?(t=[o,c,i],a[2]=o,a[3]=c,a[4]=i,a[5]=t):t=a[5],(0,s.useEffect)(e,t)})(),null}function L(){(0,I.replaceShallowUrl)(window.location.pathname+window.location.search)}e.s(["LinkTidTracker",0,M,"SHORT_LINK_SLUG_REGEX",0,R,"applyTidToUrl",0,e=>{let t=(()=>{try{let e=(()=>{try{let e=sessionStorage.getItem(x);return e&&P.test(e)?e:null}catch{return null}})();if(e)return e;let t=D();return sessionStorage.setItem(x,t),t}catch{return D()}})(),{hash:r}=new URL(e);return r?e:`${e}#${t}`},"getStoredShortLinkSlug",0,()=>{try{let e=sessionStorage.getItem(x);return e&&R.test(e)?e:null}catch{return null}},"setStoredTid",0,e=>{try{P.test(e)&&sessionStorage.setItem(x,e)}catch{}}],753816);var U=e.i(681663);let N=(0,o.default)(()=>e.A(607074),{loadableGenerated:{modules:[425704]},ssr:!1}),j=(0,s.createContext)({});function K(e){let a,o,c,u,p,y,w,v,b,C,A,E,k,x,P,R,T,D,O=(0,r.c)(26),{children:L}=e,U=(0,s.useRef)(!1),K=(P=(0,r.c)(3),R=(0,m.usePathname)(),T=(0,I.useWindowSearchAndHash)(),D=`${R}${T}`,P[0]!==R||P[1]!==D?(x={pathname:R,asPath:D},P[0]=R,P[1]=D,P[2]=x):x=P[2],x),{identify:q}=(0,i.useAnalytics)(d.analytics),[H]=(0,s.useState)($);O[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],O[0]=a):a=O[0],(0,s.useLayoutEffect)(F,a),O[1]!==K.asPath?(o=()=>{!function(e){let t=e.split(/[?#]/,1)[0];if(S.at(-1)?.route===t)return;let r=_(),n=r?Math.round(r.usedJSHeapSize/1024/1024):null;S.push({route:t,atMs:Math.round(performance.now()),usedMB:n}),S.length>200&&(S=S.slice(-200))}(K.asPath)},c=[K.asPath],O[1]=K.asPath,O[2]=o,O[3]=c):(o=O[2],c=O[3]),(0,s.useEffect)(o,c
1),O[4]!==H||O[5]!==K.pathname?(u=()=>{K.pathname&&(async()=>{let e=U.current;U.current=!0,e||await B(H),H[l.BrowserAnalyticsAdapterEnum.GoogleAnalytics].trackPageView(window.location.pathname),(0,g.trackPage)(),await (0,h.trackPage)()})()},O[4]=H,O[5]=K.pathname,O[6]=u):u=O[6],O[7]!==H||O[8]!==K.asPath||O[9]!==K.pathname?(p=[H,K.pathname,K.asPath],O[7]=H,O[8]=K.asPath,O[9]=K.pathname,O[10]=p):p=O[10],(0,s.useEffect)(u,p),O[11]!==H?(y=(...e)=>G(H,...e),O[11]=H,O[12]=y):y=O[12],O[13]!==q?(w=(e,t)=>{q(e,t,{to:"braze"})},O[13]=q,O[14]=w):w=O[14],O[15]!==H||O[16]!==y||O[17]!==w?(v={initializeUserSession:y,identifyMarketingUser:w,adapters:H},O[15]=H,O[16]=y,O[17]=w,O[18]=v):v=O[18];let Q=v;return(0,f.useDubIdCleaner)(),O[19]===Symbol.for("react.memo_cache_sentinel")?(b=[],O[19]=b):b=O[19],(0,s.useEffect)(W,b),O[20]===Symbol.for("react.memo_cache_sentinel")?(C=(0,t.jsx)(n.Analytics,{apiHost:"/_proxy/dub",domainsConfig:{refer:"poly.market"},scriptProps:{src:"/_proxy/dub/script.js"}}),A=(0,t.jsx)(M,{}),E=(0,t.jsx)(N,{}),O[20]=C,O[21]=A,O[22]=E):(C=O[20],A=O[21],E=O[22]),O[23]!==L||O[24]!==Q?(k=(0,t.jsxs)(j.Provider,{value:Q,children:[C,A,E,L]}),O[23]=L,O[24]=Q,O[25]=k):k=O[25],k}function W(){return w.isBrowser&&!v&&_()&&(A(),v=setInterval(A,5e3)),E}function F(){let e=new URL(window.location.href);if(e.searchParams.has("via"))return;let t=document.cookie.split("; ").find(q);if(!t)return;let r=t.substring(25);try{let t=new URLSearchParams(decodeURIComponent(r)).get("via");t&&(e.searchParams.set("via",t),(0,I.replaceShallowUrl)(e.toString()))}catch{}}function q(e){return e.startsWith("pm_trade_redirect_params=")}function $(){return{[l.BrowserAnalyticsAdapterEnum.GoogleAnalytics]:new u.GoogleAnalyticsAdapter,[l.BrowserAnalyticsAdapterEnum.AmplitudeAnalytics]:new c.BrowserAmplitudeAnalyticsAdapter}}let G=(e,t,r)=>{let n=t??"";e[l.BrowserAnalyticsAdapterEnum.GoogleAnalytics].linkUser(n),e[l.BrowserAnalyticsAdapterEnum.AmplitudeAnalytics].linkUser(n),t&&(0,g.identifyUser)(t,{auth_type:r}),U.logger.setUser({id:n,auth_type:r})},B=async e=>{await Promise.all([e[l.BrowserAnalyticsAdapterEnum.GoogleAnalytics].initializeAdapter(),e[l.BrowserAnalyticsAdapterEnum.AmplitudeAnalytics].initializeAdapter()]);let t=new URL(window.location.href).searchParams.get("via"),r={referrer:document.referrer||"direct",url:window.location.href};if(t&&(r.via=t),t){let e=0,r=setInterval(()=>{if(e++,(0,p.hasDubScriptConsumedVia)(t)||e>=p.DUB_TRACKING_MAX_ATTEMPTS){let e;clearInterval(r),(e=new URL(window.location.href)).searchParams.has("via")&&(e.searchParams.delete("via"),(0,I.replaceShallowUrl)(e.toString()))}},p.DUB_COOKIE_POLL_MS)}};e.s(["AnalyticsContextProvider",0,function(e){let n,i=(0,r.c)(2),{children:o}=e;return i[0]!==o?(n=(0,t.jsx)(a.AnalyticsProvider,{analytics:d.analytics,children:(0,t.jsx)(K,{children:o})}),i[0]=o,i[1]=n):n=i[1],n},"useAmplitudeAnalytics",0,()=>(0,s.useContext)(j).adapters[l.BrowserAnalyticsAdapterEnum.AmplitudeAnalytics],"useAnalyticsContext",0,()=>(0,s.useContext)(j),"useGoogleAnalytics",0,()=>(0,s.useContext)(j).adapters[l.BrowserAnalyticsAdapterEnum.GoogleAnalytics]],463659)},63922,830894,270903,508572,e=>{"use strict";var t=e.i(734804);let r="pm_dub_seen";function n(e,t){return`${t}.${e}`}function a(e){let t=e.indexOf(".");if(t<=0)return null;let r=Number(e.slice(0,t)),n=e.slice(t+1);return Number.isFinite(r)&&!(r<=0)&&n?{ts:r,value:n}:null}let i=[{param:"fbclid",cookie:"_fbc",key:"fbclid",build:function(e,t){return`fb.1.${t}.${e}`},parse:function(e){let t=e.split(".");if(t.length<4||"fb"!==t[0])return null;let r=Number(t[2]),n=t.slice(3).join(".");return Number.isFinite(r)&&!(r<=0)&&n?{ts:r,value:n}:null}},{param:"ttclid",cookie:"pm_ttclid",key:"ttclid",build:n,parse:a},{param:"twclid",cookie:"pm_twclid",key:"twclid",build:n,parse:a},{param:"ScCid",cookie:"pm_sccid",key:"sccid",build:n,parse:a},{param:"rdt_cid",cookie:"pm_rdt_cid",key:"rdt_cid",build:n,parse:a},{param:"gclid",cookie:"pm_gclid",key:"gclid",build:n,parse:a},{param:"gbraid",cookie:"pm_gbraid",key:"gbraid",build:n,parse:a},{param:"wbraid",cookie:"pm_wbraid",key:"wbraid",build:n,parse:a},{param:"msclkid",cookie:"pm_msclkid",key:"msclkid",build:n,parse:a},{param:"dub_id",cookie:"pm_dub_click",key:"dub_id",httpOnly:!0,presenceCookie:r,attribution:!1,validate:e=>c.test(e),build:n,parse:a},{param:"via",cookie:"pm_dub_via",key:"via",httpOnly:!0,attribution:!1,validate:function(e){return e.length>0&&e.length<=512&&l.test(e)&&!u.test(e)},requiresParam:"dub_id",refreshWith:"dub_id",encode:encodeURIComponent,build:n,parse:a}],o=/^[A-Za-z0-9_.-]+$/;function s(e){return e.length>0&&e.length<=512&&o.test(e)}let c=/^[A-Za-z0-9_-]{8,64}$/,l=/^[0-9A-Za-z_\u0080-\uFFFF/\-\p{Emoji}.]+$/u,u=/^0x[0-9a-fA-F]{40}$/,d="pm_attr_first",h="pm_attr_last";e.s(["ATTRIBUTION_FIRST_COOKIE_NAME",0,d,"ATTRIBUTION_LAST_COOKIE_NAME",0,h,"CLICK_ID_CONFIGS",0,i,"DUB_SEEN_COOKIE_NAME",0,r,"UTM_PARAM_KEYS",0,["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id"],"isValidClickIdValue",0,s],830894);let f="pm_referral_attribution",p=e=>e.trim().slice(0,64);e.s(["EXTERNAL_ID_COOKIE_NAME",0,"pm_eid","REFERRAL_ATTRIBUTION_COOKIE_NAME",0,f,"normalizeReferralCode",0,p],270903);let g="pm_referral_attribution",m=()=>{let e,r=t.default.get("_fbc");return{fbc:r&&void 0!==(e=function(e){let t=e.split(".");if(t.length<4||"fb"!==t[0])return;let r=Number(t[2]);return Number.isFinite(r)&&r>0?r:void 0}(r))&&Date.now()-e<7776e6?r:void 0,fbp:t.default.get("_fbp")||void 0}},y=()=>({uuid:t.default.get("_rdt_uuid")||void 0}),w=()=>({ttp:t.default.get("_ttp")||void 0}),v=()=>({sc_cookie1:t.default.get("_scid")||void 0});function b(e){let r=t.default.get(e);if(r)try{let e=JSON.parse(r);return"object"==typeof e&&null!==e?e:void 0}catch{return}}e.s(["getCookie",0,e=>t.default.get(e),"getMetaPixelCookies",0,m,"getRedditPixelCookies",0,y,"getReferralAttributionCookie",0,()=>{let e=t.default.get(f);if(e)return e;try{let e=window.localStorage?.getItem(g);if(!e)return;let t=JSON.parse(e);if("object"==typeof t&&t.code&&"number"==typeof t.ts){if(Date.now()-t.ts<2592e6)return t.code;window.localStorage?.removeItem(g);return}if("string"==typeof t)return t;return}catch{return}},"getSnapchatPixelCookies",0,v,"getTikTokPixelCookies",0,w,"setReferralAttributionCookie",0,(e,r)=>{let n=p(e);if(n){r?.skipCookieWrite||t.default.set(f,n,{expires:30,path:"/",sameSite:"lax"});try{window.localStorage?.setItem(g,JSON.stringify({code:n,ts:Date.now()}))}catch{}}}],508572),e.s(["getClickIds",0,function(){let e={},r=new URLSearchParams(window.location.search);for(let n of i){if(!1===n.attribution)continue;let a=r.get(n.param);if(a&&s(a)){e[n.key]=a;continue}let i=t.default.get(n.cookie),o=i?n.parse(i):null;o&&(e[n.key]=o.value)}let{fbc:n,fbp:a}=m();n&&(e.fbc=n),a&&(e.fbp=a);let{ttp:o}=w();o&&(e.ttp=o);let{sc_cookie1:c}=v();c&&(e.scid=c);let{uuid:l}=y();return l&&(e.rdt_uuid=l),e},"getFirstTouch",0,function(){return b(d)},"getLastTouch",0,function(){return b(h)}],63922)},37760,e=>{"use strict";let t=["user denied","user rejected the request","metamask message signature: user denied message signature"],r=new Set([4001,"ACTION_REJECTED"]);e.s(["EXECUTION_REVERTED",0,"execution reverted","REJECTED_SIGNATURE",0,"user denied","UNAUTHENTICATED",0,"user is not authenticated","isUserRejection",0,function(e){if(!e||"object"!=typeof e)return!1;if(void 0!==e.code&&r.has(e.code)||"UserRejectedRequestError"===e.name)return!0;let n=e.message?.toLowerCase()??"";return t.some(e=>n.includes(e))}])},584490,968610,e=>{"use strict";var t=e.i(332124),r=e.i(40494),n=e.i(910044),a=e.i(822150),i=e.i(681663);let o=(e,t)=>{if(t||"function"!=typeof e||(t=e,e=void 0),!t||"function"!=typeof t)throw Error("Invalid arguments");let{tries:r,startMs:n,pow:a,maxMs:i,jitter:o}={tries:6,startMs:250,pow:3,maxMs:3e5,jitter:.25,...e};return async(...e)=>{let s=0;for(;;)try{return await t(...e)}catch(e){if(++s===r)throw e;{let t=Math.min(i,n*s**a);t-=Math.random()*t*o,console.error(e),await new Promise(e=>setTimeout(e,t))}}}};
1e.s(["retryWithBackoff",0,o],968610);let s="polymarket_mobile_auth_mode",c=(t.default.env.NEXT_PUBLIC_MOBILE_AUTH_ENABLED,"polymarket://mobile-auth/"),l=o(async e=>{if(!e)throw Error("Bearer token is required for mobile authentication");try{return(await n.axios.get("https://gamma-api.polymarket.com/mobile/login",{headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},timeout:3e4})).data}catch(e){throw(0,a.handleError)(e,"mobile_auth_api_error","mobile_auth_user","high",{endpoint:"/mobile/login"}),e}}),u=(e,t)=>{try{let r;e?(r=`${c}success?token=${encodeURIComponent(e)}`,i.logger.debug("[redirectToiOS] Redirecting to success URL")):(r=`${c}error?error=${encodeURIComponent(t||"Unknown mobile auth error")}`,i.logger.debug("[redirectToiOS] Redirecting to error URL")),window.location.href=r}catch(e){(0,a.handleError)(e,"mobile_auth_callback_error","mobile_auth_user","medium",{})}},d=async(e,t,n)=>{i.logger.debug("[handleMobileAuthFlow] Mobile auth flow initiated");try{if(!e)throw Error("No token available for mobile authentication");let t=await l(e);n.trackEvent(r.Events.MobileAuthSuccess,{expiration:t.expiration}),localStorage.removeItem(s),i.logger.debug("[handleMobileAuthFlow] Mobile auth completed successfully"),u(t.exchangeToken)}catch(a){let e=a instanceof Error?a.message:String(a);n.trackEvent(r.Events.MobileAuthFailed,{error:e,connectorId:t}),localStorage.removeItem(s),u(void 0,e)}};e.s(["getMobileAuthMode",0,()=>"true"===localStorage.getItem(s),"handleMobileAuthFlow",0,d,"setMobileAuthMode",0,e=>{e?localStorage.setItem(s,"true"):localStorage.removeItem(s)}],584490)},566592,e=>{"use strict";async function t(e){return new Promise(t=>{setTimeout(()=>t(),e)})}e.s(["wait",0,t])},393171,e=>{"use strict";var t=e.i(669718);let r=null,n=null;e.s(["consumeLogoutTrigger",0,function(e=Date.now()){if(!r)return null;let t=e-r.at;if(t<0||t>15e3)return r=null,null;let n=r;return r=null,n},"getLastTradeContext",0,function(){return n},"setLastTradeContext",0,function(e){n={...e,at:"number"==typeof e.at?e.at:Date.now()}},"setLogoutTrigger",0,function(e,n={}){let a="number"==typeof e.at?e.at:Date.now();if("if_unset"===(n.mode??"overwrite")&&r&&a-r.at<=15e3){e.authAttemptId&&!r.authAttemptId&&(r={...r,authAttemptId:e.authAttemptId});return}let i=e.extra?.id??e.extra?.auth_type;if(void 0===i)try{{let e=(0,t.createWalletCache)();i=e.state.value?.connectorId}}catch{i=void 0}let o=void 0!==i?{...e.extra,id:i}:e.extra;r={...e,at:a,proxyAddress:e.proxyAddress??function(){try{let e=window.localStorage.getItem("polymarket.auth.proxyWallet");return"string"==typeof e&&e.length>0?e:void 0}catch{return}}(),extra:o}}])},748858,e=>{"use strict";let t;var r=e.i(63922),n=e.i(479189);let a=e.A(360639).then(e=>{t=e.AnalyticsBrowser.load({writeKey:"13c96cb84f404fdd65f8"})}),i=async(e,i={})=>{try{if(await a,!t)return;let o=(0,n.getLSUTMParameters)(),s=(0,r.getClickIds)(),c="u">typeof navigator?navigator.userAgent:void 0,l={...i},u={utm_source:o.utm_source,utm_medium:o.utm_medium,utm_campaign:o.utm_campaign,utm_content:o.utm_content,utm_term:o.utm_term,fbclid:s.fbclid??o.fbclid,fbc:s.fbc,fbp:s.fbp,user_agent:c};Object.entries(u).forEach(([e,t])=>{void 0!==t&&void 0===l[e]&&(l[e]=t)}),t.identify(e,{...l})}catch{}},o=async(e,r)=>{try{if(await a,!t)return;t.track(e,r)}catch{}},s=async()=>{try{if(await a,!t)return;t.page()}catch{}};e.s(["identifyUser",0,i,"trackEvent",0,o,"trackPage",0,s])},892499,e=>{"use strict";var t=e.i(141781),r=e.i(681663),n=e.i(163483),a=e.i(201913);let i=e=>({key:e,read:t=>{let r=t[e];return"number"==typeof r?r:null}}),o={trade_pnl:i("trade_pnl"),position_pnl:i("position_pnl"),economic_pnl:i("economic_pnl")}.trade_pnl,s=new Set(["max","all","1m","1w","1d","12h","6h"]),c=[{hours:1,value:"1h"},{hours:3,value:"3h"},{hours:12,value:"12h"},{hours:18,value:"18h"},{hours:24,value:"1d"}],l=t.z.object({timestamp:t.z.number(),trade_pnl:t.z.number().nullable().optional(),position_pnl:t.z.number().nullable().optional(),economic_pnl:t.z.number().nullable().optional()}),u=t.z.object({data:t.z.object({points:(0,a.looseArray)(l)}).nullable()}),d=async(e,t,a,i)=>{let l,d=await (0,n.getV2)("/user-pnl",{user:e,interval:"1y"===(l=t.toLowerCase())||"ytd"===l?"all":s.has(l)?l:(r.logger.warn("[user-pnl] unknown interval fell back to all",{interval:t}),"all"),fidelity:(e=>{let t=e.toLowerCase();if(c.some(e=>e.value===t))return t;let n=t.endsWith("h")?Number(t.slice(0,-1)):NaN;if(!Number.isFinite(n))return r.logger.warn("[user-pnl] unknown fidelity fell back to 1d",{fidelity:e}),"1d";let a=c[c.length-1],i=1/0;for(let e of c){let t=Math.abs(e.hours-n);t<i&&(a=e,i=t)}return a.value})(a)},u,i);return(d.data?.points??[]).flatMap(e=>
1{let t=o.read(e);return null===t?[]:[{t:e.timestamp,p:t}]})};e.s(["ACTIVE_HEADLINE_PNL_METRIC",0,o,"fetchUserPnlSeriesV2",0,d])},842187,e=>{"use strict";e.i(615298);var t=e.i(985553);class r extends t.QueryClient{defaultQueryOptions(e){return super.defaultQueryOptions(e)}}e.s(["createServerQueryClient",0,()=>new r({defaultOptions:{queries:{retry:!1},mutations:{retry:!1}}})],842187)},218424,e=>{"use strict";let t="polymarket.signupPrompt.v1",r="polymarket.signupPromptAttribution.v1",n={qualifiedViewsBySlug:{}};function a(){try{if(!window.localStorage)return;return window.localStorage}catch{return}}function i(e){if(e)try{return JSON.parse(e)}catch{return}}function o(e){try{return JSON.stringify(e)}catch{return}}function s(e){var r;let s,c=a();if(c)try{s=c.getItem(t)}catch{s=void 0}let l=(r=i(s)??n,{qualifiedViewsBySlug:Object.fromEntries(Object.entries(r.qualifiedViewsBySlug&&"object"==typeof r.qualifiedViewsBySlug?r.qualifiedViewsBySlug:{}).filter(([,t])=>Number.isFinite(t)&&e-t<6048e5)),lastShownAt:"number"==typeof r.lastShownAt&&Number.isFinite(r.lastShownAt)?r.lastShownAt:void 0});if(c){let e=o(l);if(e)try{c.setItem(t,e)}catch{}}return l}function c(e){let r=a(),n=o(e);if(r&&n)try{r.setItem(t,n)}catch{}}function l(){let e=a();if(e)try{e.removeItem(r)}catch{}}e.s(["SIGNUP_PROMPT_MIN_EVENT_VIEW_MS",0,1e4,"clearSignupPromptAttribution",0,l,"getNextLoggedOutVisibleEventCount",0,function({currentVisibleCount:e,pageSize:t}){return e+t},"getSignupPromptDecision",0,function({authenticated:e,modalOpen:t,now:r=Date.now()}){let n=s(r),a=Object.keys(n.qualifiedViewsBySlug).length,i=[];return e&&i.push("authenticated"),t&&i.push("modal_open"),n.lastShownAt&&r-n.lastShownAt<864e5&&i.push("cooldown"),a<3&&i.push("below_threshold"),{shouldOpen:0===i.length,reason:0===i.length?"qualified_event_views":null,qualifiedViewCount:a,blockers:i}},"getSignupPromptOpenedEventProperties",0,function({source:e,route:t}){return{signupPromptSource:e,signupPromptRoute:t}},"getSignupPromptTrackingProperties",0,function(e=Date.now()){let t=function(e=Date.now()){let t,n=a();if(n)try{t=n.getItem(r)}catch{t=void 0}let o=i(t),s=o?.source,c=o?.route,u=o?.openedAt;return"comments"!==s&&"deposit"!==s&&"event_page_visit"!==s&&"favorite"!==s&&"how_it_works"!==s&&"load_more"!==s&&"mobile_navbar"!==s&&"modal_query"!==s&&"navbar"!==s&&"portfolio_page"!==s&&"profile"!==s&&"rewards"!==s&&"settings_page"!==s&&"trade"!==s||void 0!==c&&"login"!==c&&"signup"!==c||"number"!=typeof u||!Number.isFinite(u)||e-u>18e5?void l():{source:s,route:c??"signup",openedAt:u}}(e);return t?{signupPromptSource:t.source,signupPromptRoute:t.route}:{}},"markSignupPromptOpened",0,function(e,t={}){let n=a(),i="number"==typeof t?t:t.now??Date.now(),s=o({source:e,route:"number"==typeof t?"signup":t.route??"signup",openedAt:i});if(n&&s)try{n.setItem(r,s)}catch{}},"markSignupPromptShown",0,function(e=Date.now()){let t={...s(e),lastShownAt:e};return c(t),t},"recordQualifiedEventView",0,function(e,t=Date.now()){let r=e.trim();if(!r)return s(t);let n=s(t),a={...n,qualifiedViewsBySlug:{...n.qualifiedViewsBySlug,[r]:t}};return c(a),a}])},871554,e=>{"use strict";e.s(["AuthRoute",0,{CONNECTORS:"connectors",CONNECT:"connect",ONBOARDING:"onboarding"},"AuthenticationStatusStates",0,{PERSISTING:"persisting",IDLE:"idle",PENDING:"pending",SUCCESS:"success",REJECTED:"rejected",ERROR:"error",ACCOUNT_DELETED:"account_deleted",BLOCKED:"blocked"},"ConnectorRoute",0,{LOGIN:"login",SIGNUP:"signup"},"ConnectorStates",0,{DISCONNECTED:"disconnected",RECONNECTING:"reconnecting",CONNECTING:"connecting",CONNECTED:"connected",FAILED:"failed",REJECTED:"rejected",UNAVAILABLE:"unavailable"},"OnboardingRoute",0,{CREATEACCOUNT:"createaccount",CAPTUREEOAEMAIL:"captureeoaemail",ENABLEEOATRADING:"enabletrading",APPROVETRADING:"approvetrading",AUTOREDEEM:"autoredeem",FUNDACCOUNT:"fundaccount"}])},478542,e=>{"use strict";let t=new Set([-1,500,502,503,504]);e.s(["IS_LOGGED_IN_RETRY_DELAYS_MS",0,[250,750],"isRetryableIsLoggedInFailureCode",0,e=>t.has(e)])},280042,e=>{"use strict";let t="pm_session_hint",r=RegExp(`(?:^|; )${t}=([^;]+)`);e.s(["SESSION_HINT_COOKIE",0,t,"clearSessionHint",0,()=>{"u">typeof document&&(document.cookie=`${t}=; path=/; max-age=0; SameSite=Lax`)},"getSessionHint",0,()=>{if("u"<typeof document)return;let e=document.cookie.match(r);if(!e?.[1])return;let[t,n]=e[1].split(":");if(t?.startsWith("0x")&&("magic"===n||"eoa"===n))return{address:t,type:n}},"setSessionHint",0,(e,r)=>{"u">typeof document&&(document.cookie=`${t}=${e}:${r}; path=/; max-age=604800; SameSite=Lax`)}])},320383,e=>{"use strict";var t=e.i(669718),r=e.i(45806);let n="polymarket:sunbreak-proof-cache-updated",a=e=>(window.addEventListener("storage",e),window.addEventListener(n,e),()=>{window.removeEventListener("storage",e),window.removeEventListener(n,e)}),i=()=>{window.dispatchEvent(new Event(n))};e.s(["removeSunbreakProofCredential",0,e=>{e&&((0,t.createWalletCache)().sunbreakProofs.remove(e),i())},"saveSunbreakProofCredential",0,(e,r)=>{(0,t.createWalletCache)().sunbreakProofs.set(e,r),i()},"useSunbreakProofCredential",0,e=>{let n=r.default.useCallback(()=>(e=>{if(!e)return"";let r=(0,t.createWalletCache)().sunbreakProofs.get(e);return r?JSON.stringify(r):""})(e),[e]),i=r.default.useSyncExternalStore(a,n,()=>"");return r.default.useMemo(()=>i&&e?JSON.parse(i):void 0,[i,e])}])},244876,e=>{"use strict";let t;e.s(["SunbreakAuthenticationProvider",()=>ta],244876);var r=e.i(303115),n=e.i(846574),a=e.i(45806),i=Object.defineProperty,o=e=>{throw TypeError(e)},s=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?i(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r},c=(e,t,r)=>t.has(e)||o("Cannot "+r),l=(e,t,r)=>(c(e,t,"read from private field"),r?r.call(e):t.get(e)),u=(e,t,r)=>t.has(e)?o("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),d=(e,t,r,n)=>(c(e,t,"write to private field"),t.set(e,r),r),h=e=>{let t=5381;for(let r=0;r<e.length;r++)t=33*t^e.charCodeAt(r);return(t>>>0).toString(16).padStart(8,"0")},f=e=>{try{return"provider_jwt"===e.method?`${e.issuer}:${h(e.token)}`:"siwe"===e.method||"eip191"===e.method?`${e.method}:${h(e.signature)}`:"ed25519"===e.method?`ed25519:${h(e.signatureBase64)}`:null}catch{return null}},p=async(e,t,r)=>
1{switch(e.name){case"custom":return{method:"provider_jwt",issuer:"custom",token:t,meta:r||{}};case"privy":return{method:"provider_jwt",issuer:"privy",token:t,meta:{app_id:e.appId}};case"dynamic":return e.expectedAud?{method:"provider_jwt",issuer:"dynamic",token:t,meta:{env_id:e.envId,expected_aud:e.expectedAud}}:{method:"provider_jwt",issuer:"dynamic",token:t,meta:{env_id:e.envId}};default:throw Error(`Unknown adapter: ${e}`)}},g="sunbreak_dpop_meta_v1",m="sunbreak_dpop_key_v1",y="ES256",w="P-256",v=e=>`${g}:${e}`,b=()=>new Promise((e,t)=>{let r=indexedDB.open("sunbreak-kv",1);r.onupgradeneeded=()=>r.result.createObjectStore("kv"),r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)}),C=async e=>{try{let t=await b();return await new Promise((r,n)=>{let a=t.transaction("kv","readonly").objectStore("kv").get(e);a.onsuccess=()=>r(a.result),a.onerror=()=>n(a.error)})}catch{return}},S=async(e,t)=>{let r=await b();await new Promise((n,a)=>{let i=r.transaction("kv","readwrite").objectStore("kv").put(t,e);i.onsuccess=()=>n(),i.onerror=()=>a(i.error)})},_=["Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India","Juliett","Kilo","Lima","Mike","November","Oscar","Papa","Quebec","Romeo","Sierra","Tango","Uniform","Victor","Whiskey","X-ray","Yankee","Zulu"],A=(e,t)=>{let r={clientId:e.clientId,wallet:e.wallet,ifPolicyHash:e.meta.lastPolicyHash||void 0,ifPolicyProof:e.meta.lastPolicyProof||void 0,...t};return Object.keys(r).forEach(e=>void 0===r[e]&&delete r[e]),btoa(JSON.stringify(r))},E=new Set(["connection","keep-alive","proxy-authenticate","proxy-authorization","te","trailer","transfer-encoding","upgrade","via"]),I=new Set(["user-agent","referer","origin","host","content-length","sec-fetch-site","sec-fetch-mode","sec-fetch-dest","sec-fetch-user","sec-ch-ua","sec-ch-ua-mobile","sec-ch-ua-platform","sec-ch-ua-platform-version","sec-ch-ua-full-version","sec-ch-ua-arch","sec-ch-ua-model","sec-ch-ua-bitness","cookie","set-cookie"]),k=new Set(["dpop","x-sunbreak-meta"]),x=new TextEncoder,P=new TextDecoder;function R(e){let t=e;return"string"==typeof t&&(t=x.encode(t)),Uint8Array.prototype.toBase64?t.toBase64({alphabet:"base64url",omitPadding:!0}):(function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();let t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode.apply(null,e.subarray(r,r+32768)));return btoa(t.join(""))})(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var T=class extends Error{constructor(e,t){super(e,t),s(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};s(T,"code","ERR_JOSE_GENERIC");var D=class extends T{constructor(){super(...arguments),s(this,"code","ERR_JOSE_NOT_SUPPORTED")}};s(D,"code","ERR_JOSE_NOT_SUPPORTED");var O=class extends T{constructor(){super(...arguments),s(this,"code","ERR_JWS_INVALID")}};s(O,"code","ERR_JWS_INVALID");var M=class extends T{constructor(){super(...arguments),s(this,"code","ERR_JWT_INVALID")}};s(M,"code","ERR_JWT_INVALID");var L,U,N=class extends(U=T,L=Symbol.asyncIterator,U){constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t),s(this,L),s(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}};function j(e,t="algorithm.name"){return TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function K(e,t){return e.name===t}function W(e){return parseInt(e.name.slice(4),10)}function F(e,t,...r){if((r=r.filter(Boolean)).length>2){let t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}function q(e,t,...r){return F(`Key for the ${e} algorithm must be `,t,...r)}function $(e){return e?.[Symbol.toStringTag]==="CryptoKey"}function G(e){return e?.[Symbol.toStringTag]==="KeyObject"}s(N,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");var B=e=>$(e)||G(e),H=e=>{if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},Q=async e=>{if(!e.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:t,keyUsages:r}=function(e){let t,r;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},r=e.priv?["sign"]:["verify"];break;default:throw new D('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},r=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new D('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},r=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},r=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new D('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;
1case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new D('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new D('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:r}}(e),n={...e};return"AKP"!==n.kty&&delete n.alg,delete n.use,crypto.subtle.importKey("jwk",n,t,e.ext??!(e.d||e.priv),e.key_ops??r)};function J(e){return H(e)&&"string"==typeof e.kty}var z,V=async(e,t,r,n=!1)=>{z||(z=new WeakMap);let a=z.get(e);if(a?.[r])return a[r];let i=await Q({...t,alg:r});return n&&Object.freeze(e),a?a[r]=i:z.set(e,{[r]:i}),i},Z=async(e,t)=>{if(e instanceof Uint8Array||$(e))return e;if(G(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{z||(z=new WeakMap);let r=z.get(e);if(r?.[t])return r[t];let n="public"===e.type,a=!!n,i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError("given KeyObject instance cannot be used for this algorithm")}i=e.toCryptoKey(e.asymmetricKeyType,a,n?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,a,[n?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,a,[n?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let r;switch(t){case"RSA-OAEP":r="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":r="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":r="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":r="SHA-512";break;default:throw TypeError("given KeyObject instance cannot be used for this algorithm")}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:r},a,n?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:r},a,[n?"verify":"sign"])}if("ec"===e.asymmetricKeyType){let r=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(e.asymmetricKeyDetails?.namedCurve);if(!r)throw TypeError("given KeyObject instance cannot be used for this algorithm");"ES256"===t&&"P-256"===r&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:r},a,[n?"verify":"sign"])),"ES384"===t&&"P-384"===r&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:r},a,[n?"verify":"sign"])),"ES512"===t&&"P-521"===r&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:r},a,[n?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:r},a,n?[]:["deriveBits"]))}if(!i)throw TypeError("given KeyObject instance cannot be used for this algorithm");return r?r[t]=i:z.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let r=e.export({format:"jwk"});return V(e,r,t)}if(J(e))return e.k?function(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof e?e:P.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=P.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{var r=t;if(Uint8Array.fromBase64)return Uint8Array.fromBase64(r);let e=atob(r),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}(e.k):V(e,e,t,!0);throw Error("unreachable")},Y=e=>e?.[Symbol.toStringTag],X=(e,t,r)=>{if(void 0!==t.use){let e;switch(r){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw TypeError(`Invalid key for this operation, its "use" must be "${e}" when present`)}if(void 0!==t.alg&&t.alg!==e)throw TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(t.key_ops)){let n;switch(!0){case"sign"===r:case"dir"===e:case e.includes("CBC-HS"):n=r;break;case e.startsWith("PBES2"):n="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):n=!e.includes("GCM")&&e.endsWith("KW")?"unwrapKey":r;break;case"encrypt"===r:n="wrapKey";break;case"decrypt"===r:n=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(n&&t.key_ops?.includes?.(n)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${n}" when present`)}return!0},ee=async(e,t,r)=>{if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw TypeError(((e,...t)=>F("Key must be ",e,...t))(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[r])}
1return function(e,t,r){switch(t){case"HS256":case"HS384":case"HS512":{if(!K(e.algorithm,"HMAC"))throw j("HMAC");let r=parseInt(t.slice(2),10);if(W(e.algorithm.hash)!==r)throw j(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!K(e.algorithm,"RSASSA-PKCS1-v1_5"))throw j("RSASSA-PKCS1-v1_5");let r=parseInt(t.slice(2),10);if(W(e.algorithm.hash)!==r)throw j(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!K(e.algorithm,"RSA-PSS"))throw j("RSA-PSS");let r=parseInt(t.slice(2),10);if(W(e.algorithm.hash)!==r)throw j(`SHA-${r}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":if(!K(e.algorithm,"Ed25519"))throw j("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":if(!K(e.algorithm,t))throw j(t);break;case"ES256":case"ES384":case"ES512":{if(!K(e.algorithm,"ECDSA"))throw j("ECDSA");let r=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(t);if(e.algorithm.namedCurve!==r)throw j(r,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}if(!e.usages.includes(r))throw TypeError(`CryptoKey does not support this operation, its usages must include ${r}.`)}(t,e,r),t},et=e=>Math.floor(e.getTime()/1e3),er=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,en=e=>{let t=er.exec(e);if(!t||t[4]&&t[1])throw TypeError("Invalid time period format");let r=parseFloat(t[2]),n;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":n=Math.round(r);break;case"minute":case"minutes":case"min":case"mins":case"m":n=Math.round(60*r);break;case"hour":case"hours":case"hr":case"hrs":case"h":n=Math.round(3600*r);break;case"day":case"days":case"d":n=Math.round(86400*r);break;case"week":case"weeks":case"w":n=Math.round(604800*r);break;default:n=Math.round(0x1e187e0*r)}return"-"===t[1]||"ago"===t[4]?-n:n};function ea(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}var ei,eo=class{constructor(e){if(u(this,ei),!H(e))throw TypeError("JWT Claims Set MUST be an object");d(this,ei,structuredClone(e))}data(){return x.encode(JSON.stringify(l(this,ei)))}get iss(){return l(this,ei).iss}set iss(e){l(this,ei).iss=e}get sub(){return l(this,ei).sub}set sub(e){l(this,ei).sub=e}get aud(){return l(this,ei).aud}set aud(e){l(this,ei).aud=e}set jti(e){l(this,ei).jti=e}set nbf(e){"number"==typeof e?l(this,ei).nbf=ea("setNotBefore",e):e instanceof Date?l(this,ei).nbf=ea("setNotBefore",et(e)):l(this,ei).nbf=et(new Date)+en(e)}set exp(e){"number"==typeof e?l(this,ei).exp=ea("setExpirationTime",e):e instanceof Date?l(this,ei).exp=ea("setExpirationTime",et(e)):l(this,ei).exp=et(new Date)+en(e)}set iat(e){typeof e>"u"?l(this,ei).iat=et(new Date):e instanceof Date?l(this,ei).iat=ea("setIssuedAt",et(e)):"string"==typeof e?l(this,ei).iat=ea("setIssuedAt",et(new Date)+en(e)):l(this,ei).iat=ea("setIssuedAt",e)}};ei=new WeakMap;var es,ec,el,eu=async(e,t,r)=>{let n=await ee(e,t,"sign");return((e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:r}=t.algorithm;if("number"!=typeof r||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}})(e,n),new Uint8Array(await crypto.subtle.sign(((e,t)=>{let r=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:t.namedCurve};
1case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new D(`alg ${e} is not supported either by JOSE or your javascript runtime`)}})(e,n.algorithm),n,r))},ed=class{constructor(e){if(u(this,es),u(this,ec),u(this,el),!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");d(this,es,e)}setProtectedHeader(e){if(l(this,ec))throw TypeError("setProtectedHeader can only be called once");return d(this,ec,e),this}setUnprotectedHeader(e){if(l(this,el))throw TypeError("setUnprotectedHeader can only be called once");return d(this,el,e),this}async sign(e,t){let r;if(!l(this,ec)&&!l(this,el))throw new O("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!((...e)=>{let t,r=e.filter(Boolean);if(0===r.length||1===r.length)return!0;for(let e of r){let r=Object.keys(e);if(!t||0===t.size){t=new Set(r);continue}for(let e of r){if(t.has(e))return!1;t.add(e)}}return!0})(l(this,ec),l(this,el)))throw new O("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let n={...l(this,ec),...l(this,el)},a=((e,t,r,n,a)=>{let i;if(void 0!==a.crit&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||void 0===n.crit)return new Set;if(!Array.isArray(n.crit)||0===n.crit.length||n.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let o of(i=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t,n.crit)){if(!i.has(o))throw new D(`Extension Header Parameter "${o}" is not recognized`);if(void 0===a[o])throw new e(`Extension Header Parameter "${o}" is missing`);if(i.get(o)&&void 0===n[o])throw new e(`Extension Header Parameter "${o}" MUST be integrity protected`)}return new Set(n.crit)})(O,new Map([["b64",!0]]),t?.crit,l(this,ec),n),i=!0;if(a.has("b64")&&"boolean"!=typeof(i=l(this,ec).b64))throw new O('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:o}=n;if("string"!=typeof o||!o)throw new O('JWS "alg" (Algorithm) Header Parameter missing or invalid');o.startsWith("HS")||"dir"===o||o.startsWith("PBES2")||/^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(o)||/^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(o)?((e,t,r)=>{if(!(t instanceof Uint8Array)){if(J(t)){if("oct"===t.kty&&"string"==typeof t.k&&X(e,t,r))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!B(t))throw TypeError(q(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw TypeError(`${Y(t)} instances for symmetric algorithms must be of type "secret"`)}})(o,e,"sign"):((e,t,r)=>{if(J(t))switch(r){case"decrypt":case"sign":if("oct"!==t.kty&&("AKP"===t.kty&&"string"==typeof t.priv||"string"==typeof t.d)&&X(e,t,r))return;throw TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if("oct"!==t.kty&&typeof t.d>"u"&&typeof t.priv>"u"&&X(e,t,r))return;throw TypeError("JSON Web Key for this operation be a public JWK")}if(!B(t))throw TypeError(q(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw TypeError(`${Y(t)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===t.type)switch(r){case"sign":throw TypeError(`${Y(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${Y(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===t.type)switch(r){case"verify":throw TypeError(`${Y(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${Y(t)} instances for asymmetric algorithm encryption must be of type "public"`)}})(o,e,"sign");let s=l(this,es);i&&(s=x.encode(R(s)));let c=function(...e){let t=new Uint8Array(e.reduce((e,{length:t})=>e+t,0)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}(r=l(this,ec)?x.encode(R(JSON.stringify(l(this,ec)))):x.encode(""),x.encode("."),s),u=await Z(e,o),d={signature:R(await eu(o,u,c)),payload:""};
1return i&&(d.payload=P.decode(s)),l(this,el)&&(d.header=l(this,el)),l(this,ec)&&(d.protected=P.decode(r)),d}};es=new WeakMap,ec=new WeakMap,el=new WeakMap;var eh,ef=class{constructor(e){u(this,eh),d(this,eh,new ed(e))}setProtectedHeader(e){return l(this,eh).setProtectedHeader(e),this}async sign(e,t){let r=await l(this,eh).sign(e,t);if(void 0===r.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}};eh=new WeakMap;var ep,eg,em=class{constructor(e={}){u(this,ep),u(this,eg),d(this,eg,new eo(e))}setIssuer(e){return l(this,eg).iss=e,this}setSubject(e){return l(this,eg).sub=e,this}setAudience(e){return l(this,eg).aud=e,this}setJti(e){return l(this,eg).jti=e,this}setNotBefore(e){return l(this,eg).nbf=e,this}setExpirationTime(e){return l(this,eg).exp=e,this}setIssuedAt(e){return l(this,eg).iat=e,this}setProtectedHeader(e){return d(this,ep,e),this}async sign(e,t){let r=new ef(l(this,eg).data());if(r.setProtectedHeader(l(this,ep)),Array.isArray(l(this,ep)?.crit)&&l(this,ep).crit.includes("b64")&&!1===l(this,ep).b64)throw new M("JWTs MUST NOT use unencoded payload");return r.sign(e,t)}};ep=new WeakMap,eg=new WeakMap;var ey=async e=>{let t=new TextEncoder().encode(e);return btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest("SHA-256",t)))).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")},ew=async e=>{let{method:t,url:r,nonce:n,ath:a,privateKey:i,publicJwk:o}=e,s={htm:t.toUpperCase(),htu:r,jti:crypto.randomUUID(),iat:Math.floor(Date.now()/1e3)};return n&&(s.nonce=n),a&&(s.ath=a),await new em(s).setProtectedHeader({alg:"ES256",typ:"dpop+jwt",jwk:o}).sign(i)},ev=async e=>{let t=JSON.stringify({crv:e.crv,kty:"EC",x:e.x,y:e.y}),r=new TextEncoder().encode(t);return btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest("SHA-256",r)))).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")};async function eb(e){let{rootPrivateKey:t,rootPublicJwk:r,childJkt:n,clientId:a,sid:i,ttlSec:o=300}=e,s=Math.floor(Date.now()/1e3),c=s+Math.max(60,Math.min(o,3600)),l={child_jkt:n,client_id:a,aud:"issuer",iat:s,exp:c,jti:crypto.randomUUID()};return i&&(l.sid=i),await new em(l).setProtectedHeader({alg:"ES256",typ:"pode+jwt",jwk:r}).sign(t)}function eC(e,t=300){return e.replace(/<[^>]*>/g,"").slice(0,t)}async function eS(e){let t=e.status,r=Array.from(e.headers.keys()).some(e=>{let t=e.toLowerCase();return t.startsWith("x-amzn-")&&t.includes("waf")}),n,a,i=e.headers.get("content-type")||"";if(i.includes("application/json"))try{let t=await e.clone().json();n="string"==typeof t?.error?t.error:void 0,a="string"==typeof t?.detail?t.detail:void 0}catch{}let o=403===t&&!r&&!i.includes("application/json");return{status:t,code:n,detail:a,edgeBlocked:r,originBlocked:o}}function e_(e,t){let r=Error(e);return r.status=t.status,r.code=t.code,r.detail=t.detail,r.edgeBlocked=t.edgeBlocked,r.originBlocked=t.originBlocked,r}var eA=e=>/^0x[a-fA-F0-9]{40}$/.test(e)?e.toLowerCase():e,eE=(e,t)=>!!e&&!!t&&(/^0x[a-fA-F0-9]{40}$/.test(e)&&/^0x[a-fA-F0-9]{40}$/.test(t)?e.toLowerCase()===t.toLowerCase():e===t),eI={boundWallet:null,clientId:null,jkt:null,refreshId:null,lastPolicyHash:null,lastPolicyProof:null,lastHost:null,rootJkt:null,registeredProofId:null},ek=(0,a.createContext)(void 0);function ex(e){try{return JSON.parse(localStorage.getItem(e)||"null")??eI}catch{return eI}}var eP=({children:e,clientId:t})=>{let[n,i]=(0,a.useState)(eI),o=(0,a.useRef)(!1),[s,c]=(0,a.useState)(!1),l=(0,a.useMemo)(()=>v(t),[t]);(0,a.useEffect)(()=>{let e=!0;return(async()=>{let t=await C(l)??await C(g)??ex(l);e&&(i({...eI,...t}),o.current=!0,c(!0))})(),()=>{e=!1}},[l]),(0,a.useEffect)(()=>{o.current&&(async()=>(await S(l,n),function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}(l,n)))()},[n,l]);let u=(0,a.useCallback)(e=>i(t=>({...t,refreshId:e})),[]),d=(0,a.useCallback)(e=>i(t=>({...t,lastPolicyHash:e})),[]),h=(0,a.useCallback)(e=>i(t=>({...t,lastPolicyProof:e})),[]),f=(0,a.useCallback)(e=>i(t=>({...t,lastHost:e})),[]),p=(0,a.useCallback)(e=>i(t=>({...t,rootJkt:e})),[]),m=(0,a.useCallback)(e=>i(t=>({...t,registeredProofId:e})),[]),y=async()=>{try{let e=localStorage.getItem(l);if(e){let t=JSON.parse(e);if("string"==typeof t?.refreshId&&t.refreshId)return t.refreshId}}catch{}try{let e=await C(l);if("string"==typeof e?.refreshId&&e.refreshId)return e.refreshId}catch{}return null},w=(0,a.useCallback)(e=>i(t=>({...t,boundWallet:e})),[]),b=(0,a.useCallback)(e=>i(t=>({...t,clientId:e})),[]),_=(0,a.useCallback)(e=>i(t=>({...t,jkt:e})),[]),A=(0,a.useCallback)(()=>i(eI),[]),E=(0,a.useCallback)(async()=>{let e=await C(l)??ex(l);i({...eI,...e})},[]),I=(0,a.useMemo)(()=>({meta:n,setBoundWallet:w,setClientId:b,setJkt:_,resetMeta:A,reload:E,setRefreshId:u,getRefreshId:y,ready:s,setLastPolicyHash:d,setLastPolicyProof:h,set
1LastHost:f,setRootJkt:p,setRegisteredProofId:m}),[n,w,b,_,A,E,s,u,y,d,h,f,p,m]);return(0,r.jsx)(ek.Provider,{value:I,children:e})},eR=`${m}:wrap`;async function eT(){try{let e=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:w},!1,["sign","verify"]),t=`${m}:probe_safe`;await S(t,{fmt:"cryptokey",privKey:e.privateKey});let r=await C(t);return await S(t,void 0),!!(r&&r.privKey)}catch{return!1}}async function eD(){try{let e=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:w},!0,["sign","verify"]),t=`${m}:probe`;await S(t,{fmt:"cryptokey",privKey:e.privateKey});let r=await C(t);return await S(t,void 0),!!(r&&r.privKey)}catch{return!1}}function eO(e){let{d:t,...r}=e;return{...r,kty:"EC",crv:w,alg:y,use:"sig"}}async function eM(){let e=await C(eR);if(!e){let t=new Uint8Array(32);crypto.getRandomValues(t),e=t.buffer,await S(eR,e)}return crypto.subtle.importKey("raw",e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function eL(e){let t=await eM(),r=new Uint8Array(12);crypto.getRandomValues(r);let n=new TextEncoder().encode(JSON.stringify(e));return{encPrivJwk:await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,n),iv:r.buffer}}async function eU(e,t){let r=await eM(),n=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},r,e);return JSON.parse(new TextDecoder().decode(new Uint8Array(n)))}var eN="sunbreak_root_key_v1",ej=`${eN}:wrap`;async function eK(){try{let e=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:w},!1,["sign","verify"]),t=`${eN}:probe_safe`;await S(t,{fmt:"cryptokey",privKey:e.privateKey,createdAt:Date.now(),pubJwk:{}});let r=await C(t);return await S(t,void 0),!!(r&&r.privKey)}catch{return!1}}function eW(e){let{d:t,...r}=e;return{...r,kty:"EC",crv:w,alg:y,use:"sig"}}async function eF(){let e=await C(ej);if(!e){let t=new Uint8Array(32);crypto.getRandomValues(t),e=t.buffer,await S(ej,e)}return crypto.subtle.importKey("raw",e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function eq(e){let t=await eF(),r=new Uint8Array(12);crypto.getRandomValues(r);let n=new TextEncoder().encode(JSON.stringify(e));return{encPrivJwk:await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,n),iv:r.buffer}}async function e$(e,t){let r=await eF(),n=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},r,e);return JSON.parse(new TextDecoder().decode(new Uint8Array(n)))}var eG="0.2.2",eB=class e{constructor(e,t=!1){this.colors={flow:"#00D9FF",state:"#00FF88",decision:"#FFB800",api:"#B388FF",guard:"#FFEA00",error:"#FF5252",warn:"#FF9100",info:"#90CAF9"},this.enabled=t,this.prefix=e?`[Sunbreak v${eG}:${e.slice(0,8)}]`:`[Sunbreak v${eG}]`}log(e,t,r){if(!this.enabled)return;let n=this.colors[e],a=new Date().toISOString().slice(11,23),i=this.getEmoji(e);console.log(`%c${i} ${this.prefix} [${a}] [${e.toUpperCase()}]%c ${t}`,`color: ${n}; font-weight: bold`,"color: inherit; font-weight: normal",void 0!==r?r:"")}getEmoji(e){switch(e){case"flow":return"ð";case"state":return"ð";case"decision":return"ð¤";case"api":return"ð¡";case"guard":return"ð¡ï¸";case"error":return"â";case"warn":return"â ï¸";case"info":return"â¹ï¸";default:return"â¢"}}flow(e,t,r){this.log("flow",`[${e.toUpperCase()}] ${t}`,r)}state(e,t,r,n){this.log("state",`${e} \u2192 ${t}: ${r}`,n)}decision(e,t,r,n){this.log("decision",`${e} = ${t?"â YES":"â NO"} (${r})`,n)}api(e,t,r){let n=r.status;this.log("api",`${n>=200&&n<300?"â":"â"} ${e} ${t} \u2192 ${n}${r.error?` (${r.error})`:""}`,r.data)}guard(e,t,r,n){this.log("guard",`${e}: ${t?"â PASS":"â BLOCK"} (${r})`,n)}error(e,t){this.log("error",e,t)}warn(e,t){this.log("warn",e,t)}info(e,t){this.log("info",e,t)}group(e){this.enabled&&console.group(`${this.prefix} ${e}`)}groupEnd(){this.enabled&&console.groupEnd()}child(t){let r=new e(void 0,this.enabled);return r.prefix=`${this.prefix}[${t}]`,r}},eH=null,eQ=class{constructor(e){this.currentState="unknown",this.previousState="unknown",this.logger=(eH||(eH=new eB(void 0,!1)),eH),this.hadSessionHistory=!1,this.inActiveSession=!1,e&&this.initialize(e)}initialize(e){if("unknown"!==this.currentState){this.logger.info(`Skipping initialization - state already set to ${this.currentState}`);let t=!!(e.boundWallet||e.refreshId);this.hadSessionHistory=t;return}this.logger.group("ð§ Initializing Session State Machine");let t=!!(e.boundWallet||e.refreshId);this.hadSessionHistory=t,this.logger.info("Initial context",{wallet:e.wallet,boundWallet:e.boundWallet,refreshId:e.refreshId?"present":"null",hasToken:e.hasToken,authenticated:e.authenticated,hasHistory:t}),e.authenticated&&e.hasToken?(this.transition("authenticated","Has valid token"),this.inActiveSession=!0):t?this.transition("refreshable","Has session history"):this.transition("unregistered","No session history"),this.logger.groupEnd()}transition(e,t){this.currentState===e?this.logger.info(`State unchanged: ${e} (${t})`):(this.previousState=this.currentState,this.currentState=e,this.logger.state(this.previousState,e,t))}getState(){return this.currentState}isInActiveSession(){return this.inActiveSession}markHadSession(){this.hadSessionHistory||(this.logger.info("Marked hadSessionHistory = true"),this.hadSessionHistory=!0)}clearSessionHistory(){this.logger.info("Cleared session history"),this.hadSessionHistory=!1,this.inActiveSession=!1}onNewCredentialsReceived(){this.inActiveSession&&(this.logger.info("New credentials received while in active session - allowing re-registration"),this.inActiveSession=!1,this.transition("unregistered","New credentials received"))}onProbeComplete(e){(this.logger.flow("probe","Probe completed, determining initial state"),"unknown"!==this.currentState)?this.logger.warn("Probe called but state is not UNKNOWN",{currentState:this.currentState}):e.boundWallet||e.refreshId||this.hadSessionHistory?this.transition("refreshable","Session history found"):this.transition("unregistered","No session history")}onRegisterSuccess(e){this.logger.flow("register","Register succeeded"),this.transition("authenticated","Register succeeded"),this.inActiveSession=!0,this.hadSessionHistory=!0}onRegisterFailure(e){this.logger.flow("register",`Register failed: ${e}`)}onRefreshSuccess(e){this.logger.flow("refresh","Refresh succeeded"),this.transition("authenticated","Refresh succeeded"),this.inActiveSession=!0}onRefreshExpired(){this.logger.flow("refresh","Refresh failed: session expired (missing refresh identifier)"),this.transition("expired","Session expired"),this.inActiveSession=!1}onRefreshFailure(e){this.logger.flow("refresh",`Refresh failed: ${e}`)}onTokenExpired(){this.logger.flow("token","Token expired"),"authenticated"===this.currentState&&this.transition("refreshable","Token expired")}onWalletChange(e,t,r){if(this.logger.flow("wallet",`Wallet changed: ${e||"null"} \u2192 ${t||"null"}`),!t){this.transition("unknown","Wallet disconnected"),this.inActiveSession=!1;return}eE(t,r.boundWallet)?(this.hadSessionHistory=!0,this.transition("refreshable","Wallet reconnected with session history")):(this.transition("unregistered","Wallet changed to different address"),this.inActiveSession=!1)}onWalletDisconnect(){this.logger.flow("wallet","Wallet disconnected"),this.transition("unknown","Wallet disconnected"),this.inActiveSession=!1}shouldAttemptProbe(){let e="unknown"===this.currentState;return this.logger.decision("Should attempt probe?",e,`State is ${this.currentState}`),e}shouldAttemptRefresh(e){if("refreshable"!==this.currentState&&"authenticated"!==this.currentState)return this.logger.decision("Should attempt refresh?",!1,`State is ${this.currentState}, not REFRESHABLE or AUTHENTICATED`),!1;if(!(e.boundWallet||e.wallet))return this.logger.decision("Should attempt refresh?",!1,"No wallet available (neither boundWallet nor current wallet)"),!1;
1if(e.wallet&&e.boundWallet&&!eE(e.wallet,e.boundWallet))return this.logger.decision("Should attempt refresh?",!1,"Wallet mismatch"),!1;if(e.hasToken&&e.tokenExpiry){let t=Math.floor(Date.now()/1e3);if(e.tokenExpiry-t>5&&"authenticated"===this.currentState)return this.logger.decision("Should attempt refresh?",!1,"Token still valid"),!1}return this.logger.decision("Should attempt refresh?",!0,`State is ${this.currentState}, token ${e.hasToken?"present":"missing"}`),!0}shouldAttemptRegister(e){return this.inActiveSession?(this.logger.decision("Should attempt register?",!1,"Already in active session - proof changes ignored"),!1):"unregistered"!==this.currentState&&"expired"!==this.currentState?(this.logger.decision("Should attempt register?",!1,`State is ${this.currentState}, not UNREGISTERED or EXPIRED`),!1):e.wallet?e.hasProof?e.authenticated&&e.hasToken?(this.logger.decision("Should attempt register?",!1,"Already authenticated"),!1):(this.logger.decision("Should attempt register?",!0,`State is ${this.currentState}, have wallet + proof`),!0):(this.logger.decision("Should attempt register?",!1,"No proof available"),!1):(this.logger.decision("Should attempt register?",!1,"No wallet connected"),!1)}shouldWaitForInitialRefresh(e,t){return"refreshable"===this.currentState&&!e&&!!(t.wallet&&t.boundWallet&&eE(t.wallet,t.boundWallet))&&(this.logger.decision("Should wait for initial refresh?",!0,"Returning user - let refresh attempt first"),!0)}getStateReport(e){return` 2\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 3\u2502 Session State Machine Report \u2502 4\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524 5\u2502 Current State: ${this.currentState.padEnd(20)} \u2502 6\u2502 Previous State: ${this.previousState.padEnd(20)} \u2502 7\u2502 Active Session: ${String(this.inActiveSession).padEnd(20)} \u2502 8\u2502 Had History: ${String(this.hadSessionHistory).padEnd(20)} \u2502 9\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524 10\u2502 Wallet: ${(e.wallet||"null").padEnd(20)} \u2502 11\u2502 Bound Wallet: ${(e.boundWallet||"null").padEnd(20)} \u2502 12\u2502 Refresh ID: ${(e.refreshId?"present":"null").padEnd(20)} \u2502 13\u2502 Has Token: ${String(e.hasToken).padEnd(20)} \u2502 14\u2502 Authenticated: ${String(e.authenticated).padEnd(20)} \u2502 15\u2502 Has Proof: ${String(e.hasProof).padEnd(20)} \u2502 16\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 17 `.trim()}},eJ=e=>{let t=e.privRef.current;if(!t)throw Error("Sunbreak: private key not initialized");return t},ez=e=>{let t=e.pubJwkRef.current;if(!t)throw Error("Sunbreak: public JWK not initialized");return t};async function eV(e,t,r,n){if(!t)return e.logger.guard("register",!1,"No wallet provided"),!1;if(!e.clientId)return e.logger.guard("register",!1,"No client ID configured"),e.setError("Missing client ID. Please configure a valid client ID."),!1;e.logger.flow("register","Starting register flow",{wallet:t});let a=eV._nonceCacheRef||(eV._nonceCacheRef={map:new Map});try{let n,i;await e.waitReady(),await e.awaitKeyStable(),await e.awaitProbe(),await e.ensureKeypair(),e.setError(null),e.beginFlow("register",2e4);try{if(await e.ensureRootKeypair(),e.rootPrivRef.current&&e.rootPubJwkRef.current){if(!e.meta.rootJkt)try{let t=await ev(e.rootPubJwkRef.current);
17e.setRootJkt?.(t)}catch{}let t=await ev(ez(e)),r=await e.getRefreshId();n=await eb({rootPrivateKey:e.rootPrivRef.current,rootPublicJwk:e.rootPubJwkRef.current,childJkt:t,clientId:e.clientId,sid:r||void 0,ttlSec:300})}}catch(t){e.logger.warn("Failed to create PODE for register",t)}let o=e.currentReqId(),s="/auth/register",c=`${e.baseUrl}${s}`,l=new URL(e.baseUrl).origin,u="POST",d=`${l}${s}`,h=`${u.toUpperCase()} ${d}`,p=a.map.get(h),g=await ew({method:u,url:d,nonce:p,privateKey:eJ(e),publicJwk:ez(e)}),m=async a=>e.fetchImpl(c,{method:u,headers:{"content-type":"application/json","x-sunbreak-meta":A(e,{reqId:o,pode:n||void 0,wallet:t}),...a},credentials:"include",body:JSON.stringify({wallet:t,proof:r})}),y=await m({DPoP:g});if(401===y.status){e.logger.info("Register got 401, retrying with nonce");let t=y.headers.get("www-authenticate"),r=(t&&t.match(/dpop-nonce="([^"]+)"/i))?.[1];if(r){a.map.set(h,r);let t=await ew({method:u,url:d,nonce:r,privateKey:eJ(e),publicJwk:ez(e)});y=await m({DPoP:t})}}if((i=y.headers.get("dpop-nonce"))&&a.map.set(h,i),e.logger.api(u,s,{status:y.status}),!y.ok){let e=await eS(y);if((y.headers.get("content-type")||"").includes("application/json")){let t;try{t=await y.clone().json()}catch{}let r=eC(t&&(t.error||t.message||t.detail)||`HTTP ${y.status}`);throw e_(r,e)}{let t=e.edgeBlocked?"Blocked (403)":e.originBlocked?"Request rejected (403)":`HTTP ${y.status}`;throw e_(t,e)}}let w=await y.json();e.logger.info("Register succeeded",{expiresIn:w.expiresIn,hasRefreshId:!!w.refreshId}),e.accessTokenRef.current=w.access,e.authWalletRef.current=eA(t),e.setAuthenticated(!0);try{let t=Math.floor(Date.now()/1e3);e.tokenExpRef.current=t+(w.expiresIn??0)}catch{}e.didInitialRefresh.current=!0,e.setBoundWallet(eA(t)),e.setLastPolicyHash(null),e.setLastPolicyProof(null);try{e.setJkt(await ev(ez(e)))}catch{}let b=f(r);e.setRegisteredProofId(b);try{let r={...e.meta,boundWallet:t,clientId:e.meta.clientId??e.clientId,jkt:e.meta.jkt??null,refreshId:w.refreshId??null,registeredProofId:b};e.setRefreshId(w.refreshId??null);let n=v(e.clientId);await S(n,r);try{localStorage.setItem(n,JSON.stringify(r))}catch(t){e.logger.warn("Failed to persist meta to localStorage",t)}}catch(t){e.logger.warn("Failed to persist session metadata",t)}let C={wallet:t,boundWallet:t,refreshId:w.refreshId??null,hasToken:!0,tokenExpiry:e.tokenExpRef.current,hasProof:!0,authenticated:!0};return e.stateMachine.onRegisterSuccess(C),!0}catch(l){let r=Number(l?.status||0),a=String(l?.code||"").toLowerCase(),i=String(l?.message||"").toLowerCase(),o=Math.floor(1e3*Math.random());e.logger.error("Register failed",{status:r,code:a,msg:i}),e.stateMachine.onRegisterFailure(`${a||i||"Unknown error"}`);let s="session_exists"===a||"already_authenticated"===a||i.includes("already")&&(i.includes("session")||i.includes("authenticated")),c=(401===r||403===r)&&"replay"===a;if((s||c)&&n?.refreshFallback&&(!e.meta.boundWallet||eE(e.meta.boundWallet,t))){e.logger.info("Register failed with recoverable error, attempting refresh fallback",{code:a,isSessionExists:s,isReplay:c});try{if(await n.refreshFallback())return e.logger.info("Refresh fallback succeeded after register failure"),e.meta.boundWallet||e.setBoundWallet(t),!0}catch(t){e.logger.warn("Refresh fallback failed",t)}}if(c){if(!e.providerAdapter)return e.proofRef.current=null,e.setError("Proof replayed; please sign a fresh proof."),e.registerCooldownUntilRef.current=Date.now()+1e4+o,!1;try{let t=await e.providerAdapter.getToken()??null;if(t)return await e.awaitKeyStable(),await e.ensureKeypair(),await e.rotate(),e.proofRef.current=await p(e.providerAdapter,t),e.registerCooldownUntilRef.current=Date.now()+5e3+o,!1}catch{}return e.registerCooldownUntilRef.current=Date.now()+8e3+o,!1}if(s)return e.setError("Session already exists. Try refreshing the page."),e.registerCooldownUntilRef.current=Date.now()+3e3+o,!1;if("siwe_invalid"===a||"eip191_invalid"===a||"ed25519_invalid"===a||"sig_wallet_mismatch"===a||i.includes("invalid")&&i.includes("signature")){if(e.logger.warn("Proof invalid for wallet, clearing proof",{code:a,msg:i}),e.proofRef.current=null,e.providerAdapter)try{let t=await e.providerAdapter.getToken()??null;if(t)return e.proofRef.current=await p(e.providerAdapter,t),e.registerCooldownUntilRef.current=Date.now()+3e3+o,!1}catch{}return e.setError("Proof doesn't match wallet. Please sign again."),e.registerCooldownUntilRef.current=Date.now()+5e3+o,!1}if(403===r&&(l?.edgeBlocked||l?.originBlocked))return e.setError(i||"Forbidden"),e.registerCooldownUntilRef.current=Date.now()+3e4+o,!1;if(403===r)return e.setError(a||i||"Forbidden"),e.registerCooldownUntilRef.current=Date.now()+15e3+o,!1;if(429===r||503===r){e.setError(a||i||"Rate limited / unavailable");let t=429===r?5e3:8e3;return e.registerCooldownUntilRef.current=Date.now()+t+o,!1}return e.setError(a||i||"Register failed"),e.registerCooldownUntilRef.current=Date.now()+5e3+o,!1}}function eZ(e){if(e.refreshLock.current)return e.logger.guard("refreshLock",!1,"Refresh already in progress"),e.refreshLock.current;if(e.registerLock.current){e.logger.guard("registerLock",!1,"Registration in progress, waiting");let t=e.registerLock.current.then(()=>
17{if(e.authenticated&&e.accessTokenRef.current)return!0;if(e.accessTokenRef.current){let t=e.tokenExpRef.current,r=Math.floor(Date.now()/1e3);if(t&&t-r>5)return!0}return!1});return e.refreshLock.current=t.finally(()=>{e.refreshLock.current=null}),e.refreshLock.current}return e.logger.flow("refresh","Starting refresh flow"),e.refreshLock.current=(async()=>{try{let t,r,n;await e.waitReady(),await e.awaitKeyStable(),await e.awaitProbe();let a=e.meta.boundWallet||e.wallet;if(!a)return e.logger.warn("No wallet available for refresh (neither boundWallet nor current wallet)"),!1;if(!e.clientId)return e.logger.warn("No client ID configured for refresh"),e.setError("Missing client ID. Please configure a valid client ID."),!1;if(e.wallet&&e.meta.boundWallet&&!eE(e.wallet,e.meta.boundWallet))return e.logger.warn("Wallet mismatch during refresh",{current:e.wallet,bound:e.meta.boundWallet}),e.accessTokenRef.current=null,e.setAuthenticated(!1),!1;let i=e.accessTokenRef.current??null;if(i){let t=e.tokenExpRef.current,r=Math.floor(Date.now()/1e3);if(i&&t&&t-r>5)return e.logger.info("Token still valid, skipping refresh"),!0}e.beginFlow("refresh",15e3);let o=e.currentReqId();await e.ensureKeypair();try{if(await e.ensureRootKeypair(),e.rootPrivRef.current&&e.rootPubJwkRef.current){if(!e.meta.rootJkt)try{let t=await ev(e.rootPubJwkRef.current);e.setRootJkt?.(t)}catch{}let r=await ev(ez(e)),n=await e.getRefreshId();t=await eb({rootPrivateKey:e.rootPrivRef.current,rootPublicJwk:e.rootPubJwkRef.current,childJkt:r,clientId:e.clientId,sid:n||void 0,ttlSec:300})}}catch(t){e.logger.warn("Failed to create PODE for refresh",t)}let s="/auth/refresh",c=`${e.baseUrl}${s}`,l=new URL(e.baseUrl).origin,u="POST",d=`${l}${s}`,h=`${u.toUpperCase()} ${d}`,f=eZ._nonceCacheRef||(eZ._nonceCacheRef={map:new Map}),p=async t=>await ew({method:u,url:d,nonce:t,privateKey:eJ(e),publicJwk:ez(e)}),g=await e.getRefreshId(),m={"x-sunbreak-meta":A(e,{reqId:o,refreshId:g||void 0,pode:t||void 0,wallet:a}),"content-type":"application/json"},y=async t=>e.fetchImpl(c,{method:u,headers:{DPoP:t,...m},credentials:"include",body:"{}"}),w=await y(await p(f.map.get(h)));if(401===w.status){e.logger.info("Refresh got 401, retrying with nonce");let t=w.headers.get("www-authenticate"),r=(t&&t.match(/dpop-nonce="([^"]+)"/i))?.[1];r&&(f.map.set(h,r),w=await y(await p(r)))}if((r=w.headers.get("dpop-nonce"))&&f.map.set(h,r),e.logger.api(u,s,{status:w.status}),!w.ok){try{if((w.headers.get("content-type")||"").includes("application/json")){let t=await w.clone().json().catch(()=>{}),r=t&&(t.error||t.code||t.message)||"",n=String(r).toLowerCase();if(n.includes("missing")&&n.includes("refresh")){e.logger.warn("Refresh session expired (missing refresh identifier)"),e.stateMachine.onRefreshExpired();try{e.setRefreshId?.(null)}catch{}e.accessTokenRef.current=null,e.setAuthenticated(!1)}else e.logger.warn("Refresh failed",{error:r}),e.stateMachine.onRefreshFailure(String(r))}}catch{}return!1}let v=await w.json();e.logger.info("Refresh succeeded",{expiresIn:v.expiresIn,hasRefreshId:!!v.refreshId}),e.accessTokenRef.current=v.access,e.setAuthenticated(!0);let b=(e.wallet&&(!e.meta.boundWallet||e.meta.boundWallet===e.wallet)?e.wallet:e.meta.boundWallet)||null;e.authWalletRef.current=b?eA(b):null;try{let t=Math.floor(Date.now()/1e3);e.tokenExpRef.current=t+(v.expiresIn??0)}catch{}try{e.setJkt(await ev(ez(e)))}catch{}v.refreshId&&e.setRefreshId(v.refreshId);let C={wallet:e.wallet||null,boundWallet:e.meta.boundWallet||null,refreshId:(n=v.refreshId??e.meta.refreshId??null)&&"null"!==n&&"undefined"!==n?n:null,hasToken:!0,tokenExpiry:e.tokenExpRef.current,hasProof:!!e.proofRef.current,authenticated:!0};return e.stateMachine.onRefreshSuccess(C),!0}finally{e.refreshLock.current=null}})(),e.refreshLock.current}var eY,eX=new Map;try{let e=globalThis;eY=e.__sunbreak_page_probe_guard??(e.__sunbreak_page_probe_guard=new Set)}catch{eY=new Set}async function e0(e){let t=(e=>{try{let t=new URL(e.baseUrl).origin;return`${e.clientId}::${t}`}catch{return`${e.clientId}::${e.baseUrl}`}})(e);if(e.probeLock.current){e.logger.guard("probeLock",!1,"Probe already in progress, waiting"),await e.probeLock.current,e.markProbed();return}if(e.hasProbedRef.current){e.logger.guard("hasProbedRef",!1,"Already probed in this session"),e.markProbed();return}if(eY.has(t)){e.logger.guard("pageProbeGuard",!1,"Already probed for this page load"),e.markProbed();return}if(eY.add(t),!e.clientId){e.logger.warn("No client ID configured, skipping probe"),e.markProbed();return}e.logger.flow("probe","Starting probe flow",{clientId:e.clientId,pageKey:t});let r=(async()=>{let r=new URL(e.baseUrl).origin;try{let t,n;if(await e.awaitKeyStable(),await e.ensureKeypair(),!e.rootPrivRef.current)try{await e.ensureRootKeypair()}catch{}if(e.rootPrivRef.current&&e.rootPubJwkRef.current)try{let r=await ev(ez(e));t=await eb({rootPrivateKey:e.rootPrivRef.current,rootPublicJwk:e.rootPubJwkRef.current,childJkt:r,clientId:e.clientId,ttlSec:300})}catch(t){e.logger.warn("Failed to create PODE for probe",t)}let a="POST",i="/auth/probe",o=`${e.baseUrl}${i}`,s=`${r}${i}`,c=`${a.toUpperCase()} ${s}`,l=async t=>ew({method:a,url:s,nonce:t,privateKey:eJ(e),publicJwk:ez(e)}),u=async r=>e.fetchImpl(o,{method:a,headers:{DPoP:r,"x-sunbreak-meta":A(e,{pode:t}),"content-type":"application/json"},credentials:"include",body:"{}"}),d=e=>{let t=e.headers.get("dpop-nonce");t&&eX.set(c,t)},h=await u(await l(eX.get(c)));if(d(h),401===h.status){e.logger.info("Probe got 401, retrying with nonce from www-authenticate");let t=h.headers.get("www-authenticate"),r=(t&&t.match(/dpop-nonce="([^"]+)"/i))?.[1];r&&(eX.set(c,r),h=await u(await l(r)),d(h))}e.logger.api(a,i,{status:h.status});let f={wallet:e.wallet||null,boundWallet:e.meta.boundWallet||null,refreshId:(n=e.meta.refreshId)&&"null"!==n&&"undefined"!==n?n:null,hasToken:!!e.accessTokenRef.current,tokenExpiry:e.tokenExpRef.current||null,hasProof:!!e.proofRef.current,authenticated:e.authenticated};e.stateMachine.onProbeComplete(f)}catch(r){e.logger.error("Probe failed",r);try{eY.delete(t)}catch{}}finally{e.markProbed(),e.logger.flow("probe","Probe flow completed")}})();e.probeLock.current=r;
17try{await r}finally{e.probeLock.current=null}}async function e1(e,t,r,n,a,i={}){e.setLoadingCount(e=>e+1),e.setError(null);let o=n.startsWith("/api/session"),s=new AbortController,c=setTimeout(()=>s.abort(),e.timeoutMs);try{let c,l,u;await e.waitReady(),await e.awaitKeyStable(),await e.awaitProbe(),await e.ensureKeypair();let d=`${o?(l=(c=new URL(e.baseUrl)).host,u=(e=>{for(let t=0;t<_.length;t++){let t=_[Math.floor(Math.random()*_.length)].toLowerCase();if(t!==e)return t}return"alpha"})(e.meta.lastHost??null),e.setLastHost(u),c.host=`${u}.${l}`,c.origin):e.baseUrl}${n.startsWith("/")?"":"/"}${n}`,h=`${new URL(e.baseUrl).origin}${n.startsWith("/")?"":"/"}${n}`,f=`${r.toUpperCase()} ${h}`,p=n.startsWith("/auth/"),g=!1,m=!1,y=e.currentReqId(),w=e1._nonceCacheRef||(e1._nonceCacheRef={map:new Map}),v=e=>{let t=e.headers.get("dpop-nonce");t&&w.map.set(f,t)},b=!!e.wallet&&!!e.authWalletRef.current&&!eE(e.wallet,e.authWalletRef.current),C=()=>!p&&!!e.wallet&&!!(e.authenticated||eE(e.wallet,e.meta.boundWallet)||"string"==typeof e.meta.refreshId&&e.meta.refreshId),S,x,P=async()=>{if(p||b)return;try{let r=e.accessTokenRef.current??null,n=e.tokenExpRef.current,a=Math.floor(Date.now()/1e3);if(r){if(n&&n-a<=60&&!await t().catch(()=>!1))return}else if(!C()||!await t().catch(()=>!1))return}catch{}let n=e.accessTokenRef.current??null;if(!n)return;let a=await ey(n),i=w.map.get(f),o=await ew({method:r,url:h,nonce:i,ath:a,privateKey:eJ(e),publicJwk:ez(e)});S=`Bearer ${e.accessTokenRef.current}`,x=o};await P();let R={"content-type":"application/json","x-sunbreak-auth":S||"","x-sunbreak-meta":A(e,{reqId:y,auth:S,ifPolicyHash:e.meta.lastPolicyHash||void 0,ifPolicyProof:e.meta.lastPolicyProof||void 0}),...function(e){let t={};if(!e)return t;let r=e instanceof Headers?Array.from(e.entries()):Object.entries(e),n=0;for(let[e,a]of r){if(n>=64)break;if(null==e||null==a)continue;let r=String(e).toLowerCase().trim();if(!r||r.length>64||E.has(r)||I.has(r)||k.has(r))continue;let i=String(a);i.length>2048&&(i=i.slice(0,2048)),t[r]=i,n++}return t}(i.headers)};x&&(R.DPoP=x);let T=async()=>e.fetchImpl(d,{...i,method:r,headers:R,body:void 0!==a?JSON.stringify(a):void 0,credentials:"include",signal:s.signal}),D=await T(),O=D.headers.get("x-sunbreak-policy-hash"),M=D.headers.get("x-sunbreak-policy-proof");if(O&&e.setLastPolicyHash(O),M&&e.setLastPolicyProof(M),v(D),401===D.status&&!p){let n=e.accessTokenRef.current??null,a=D.headers.get("www-authenticate"),i=(a&&a.match(/dpop-nonce="([^"]+)"/i))?.[1];if(!b&&i&&n&&!m){m=!0,w.map.set(f,i);let t=await ey(n),a=await ew({method:r,url:h,nonce:i,ath:t,privateKey:eJ(e),publicJwk:ez(e)});S=`Bearer ${e.accessTokenRef.current}`,x=a,R["x-sunbreak-meta"]=A(e,{reqId:y,auth:S}),R.DPoP=x,D=await T(),v(D)}if(401===D.status&&!g&&(g=!0,!b&&C())){let r=await t(),n=e.accessTokenRef.current??null;r&&n&&!b&&(await P(),R["x-sunbreak-meta"]=A(e,{reqId:y,auth:S}),x&&(R.DPoP=x),D=await T(),v(D))}if(401===D.status)throw Error("Unauthorized")}if(!D.ok){let e=await eS(D);if((D.headers.get("content-type")||"").includes("application/json")){let t=await D.json().catch(()=>{}),r=eC(t&&(t.error||t.message||t.detail)||`HTTP ${D.status}`);throw e_(r,e)}{let t=e.edgeBlocked?"Blocked (403)":e.originBlocked?"Request rejected (403)":`HTTP ${D.status}`;throw e_(t,e)}}return(D.headers.get("content-type")||"").includes("application/json")?await D.json():void 0}finally{clearTimeout(c),e.setLoadingCount(e=>Math.max(0,e-1))}}async function e2(e,t){let r=await t("GET","/api/session");if(r){e.setAllowed(!!r.allowed),e.setSessionData(r),e.setSessionExpiry(r.expiry??null);let t=r?.wallet;"string"==typeof t&&t&&e.setBoundWallet(eA(t))}return r}var e6=e=>(e.registerCooldownUntilRef.current??0)>Date.now(),e5=e=>{let t;return{wallet:e.wallet||null,boundWallet:e.meta.boundWallet||null,refreshId:(t=e.meta.refreshId)&&"null"!==t&&"undefined"!==t?t:null,hasToken:!!e.accessTokenRef.current,tokenExpiry:e.tokenExpRef.current||null,hasProof:!!e.proofRef.current,authenticated:e.authenticated}},e3=(0,a.createContext)(void 0),e8=e=>{let t,n,i,o,s,c,l,u,d=(e=>{let t,r,n,i,o,s,c,l,{clientId:u,wallet:d,base:h="https://api.sunbreak.com",fetchImpl:f,timeoutMs:p=15e3,proof:g=null,providerAdapter
17:y,refreshDeps:v=[],debug:b}=e,_=(e=>{let t=new URL(e.replace(/\/+$/,""));if("https:"!==t.protocol&&"localhost"!==t.hostname&&"127.0.0.1"!==t.hostname)throw Error("Sunbreak: insecure base URL");return t.hash="",t.origin})(h),A="u">typeof window?(f??fetch).bind(window):f??fetch,{meta:E,setBoundWallet:I,setJkt:k,setRefreshId:x,getRefreshId:P,setLastPolicyHash:R,setLastPolicyProof:T,setLastHost:D,setRootJkt:O,setRegisteredProofId:M,ready:L}=function(){let e=(0,a.useContext)(ek);if(!e)throw Error("useMeta must be used within <MetaProvider>");return e}(),{ensureRootKeypair:U,rootPrivRef:N,rootPubJwkRef:j}=(t=(0,a.useRef)(null),r=(0,a.useRef)(null),n=(0,a.useCallback)(async()=>{let e=await C(eN);if(!e)return!1;if("cryptokey"===e.fmt){if(!e.privKey)return await S(eN,void 0),!1;let n=e.privKey;try{if(n.extractable&&await eK()){let t=await crypto.subtle.exportKey("jwk",n),r=await crypto.subtle.importKey("jwk",t,{name:"ECDSA",namedCurve:w},!1,["sign"]),a={fmt:"cryptokey",privKey:r,pubJwk:eW(e.pubJwk),createdAt:e.createdAt};await S(eN,a),n=r}}catch{}return t.current=n,r.current=eW(e.pubJwk),!0}if("encjwk"===e.fmt)try{let n=await e$(e.encPrivJwk,e.iv);return t.current=await crypto.subtle.importKey("jwk",n,{name:"ECDSA",namedCurve:w},!1,["sign"]),r.current=eW(e.pubJwk),!0}catch{}return await S(eN,void 0),!1},[]),{ensureRootKeypair:(0,a.useCallback)(async()=>{if(t.current&&r.current||await n())return;let e=await eK(),a=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:w},!0,["sign","verify"]),i=eW(await crypto.subtle.exportKey("jwk",a.publicKey)),o=Date.now(),s=await crypto.subtle.exportKey("jwk",a.privateKey);if(e){let e=await crypto.subtle.importKey("jwk",s,{name:"ECDSA",namedCurve:w},!1,["sign"]);await S(eN,{fmt:"cryptokey",privKey:e,pubJwk:i,createdAt:o}),t.current=e,r.current=i}else{let{encPrivJwk:e,iv:n}=await eq(s);await S(eN,{fmt:"encjwk",encPrivJwk:e,iv:n,pubJwk:i,createdAt:o}),t.current=await crypto.subtle.importKey("jwk",s,{name:"ECDSA",namedCurve:w},!1,["sign"]),r.current=i}},[n]),clear:(0,a.useCallback)(async()=>{await S(eN,void 0),t.current=null,r.current=null},[]),rootPrivRef:t,rootPubJwkRef:r}),K=(0,a.useCallback)(async()=>{await U();try{if(!E.rootJkt&&j.current){let e=await ev(j.current);O(e)}}catch{}},[U,E.rootJkt,j]),{ensureKeypair:W,rotate:F,privRef:q,pubJwkRef:$}=(i=(0,a.useRef)(null),o=(0,a.useRef)(null),s=(0,a.useCallback)(async()=>{let e=await C(m);if(!e)return!1;if("cryptokey"===e.fmt){if(!e.privKey)return await S(m,void 0),!1;let t=e.privKey;try{if(t.extractable&&await eT()){let r=await crypto.subtle.exportKey("jwk",t),n=await crypto.subtle.importKey("jwk",r,{name:"ECDSA",namedCurve:w},!1,["sign"]),a={fmt:"cryptokey",privKey:n,pubJwk:eO(e.pubJwk)};await S(m,a),t=n}}catch{}return i.current=t,o.current=eO(e.pubJwk),!0}if("encjwk"===e.fmt)try{let t=await eU(e.encPrivJwk,e.iv);return i.current=await crypto.subtle.importKey("jwk",t,{name:"ECDSA",namedCurve:w},!1,["sign"]),o.current=eO(e.pubJwk),!0}catch{return await S(m,void 0),!1}if(e&&e.d){let{d:t,...r}=e,n=eO(r),a=await eT(),s=a||await eD();if(s&&a){let t=await crypto.subtle.importKey("jwk",e,{name:"ECDSA",namedCurve:w},!1,["sign"]);return await S(m,{fmt:"cryptokey",privKey:t,pubJwk:n}),i.current=t,o.current=n,!0}if(s){let t=await crypto.subtle.importKey("jwk",e,{name:"ECDSA",namedCurve:w},!0,["sign"]);return await S(m,{fmt:"cryptokey",privKey:t,pubJwk:n}),i.current=t,o.current=n,!0}let{encPrivJwk:c,iv:l}=await eL(e);return await S(m,{fmt:"encjwk",encPrivJwk:c,iv:l,pubJwk:n}),i.current=await crypto.subtle.importKey("jwk",e,{name:"ECDSA",namedCurve:w},!1,["sign"]),o.current=n,!0}return await S(m,void 0),!1},[]),c=(0,a.useCallback)(async(e,t)=>{await S(m,{fmt:"cryptokey",privKey:e,pubJwk:t})},[]),l=(0,a.useCallback)(async(e,t)=>{let{encPrivJwk:r,iv:n}=await eL(e);await S(m,{fmt:"encjwk",encPrivJwk:r,iv:n,pubJwk:t})},[]),{ensureKeypair:(0,a.useCallback)(async()=>{if(i.current&&o.current||await s())return;let e=await eT(),t=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:w},!0,["sign","verify"]),r=eO(await crypto.subtle.exportKey("jwk",t.publicKey)),n=await crypto.subtle.exportKey("jwk",t.privateKey);if(e){let e=await crypto.subtle.importKey("jwk",n,{name:"ECDSA",namedCurve:w},!1,["sign"]);await c(e,r),i.current=e,o.current=r}else await l(n,r),i.current=await crypto.subtle.importKey("jwk",n,{name:"ECDSA",namedCurve:w},!1,["sign"]),o.current=r},[s,c,l]),rotate:(0,a.useCallback)(async()=>{let e=await eT(),t=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:w},!0,["sign","verify"]),r=eO(await crypto.subtle.exportKey("jwk",t.publicKey)),n=await crypto.subtle.exportKey("jwk",t.privateKey);if(e){let e=await crypto.subtle.importKey("jwk",n,{name:"ECDSA",namedCurve:w},!1,["sign"]);await S(m,{fmt:"cryptokey",privKey:e,pubJwk:r}),i.current=e,o.current=r}else{let{encPrivJwk:e,iv:t}=await eL(n);await S(m,{fmt:"encjwk",encPrivJwk:e,iv:t,pubJwk:r}),i.current=await crypto.subtle.importKey("jwk",n,{name:"ECDSA",namedCurve:w},!1,["sign"]),o.current=r}},[]),clear:(0,a.useCallback)(async()=>{await S(m,void 0),i.current=null,o.current=null},[]),privRef:i,pubJwkRef:o}),[G,B]=(0,a.useState)(!1),[H,Q]=(0,a.useState)(0),[J,z]=(0,a.useState)(null),[V,Z]=(0,a.useState)(null),[Y,X]=(0,a.useState)(null),[ee,et]=(0,a.useState)(null),er=(0,a.useRef)(null),en=(0,a.useRef)(null),ea=(0,a.useRef)(null),ei=(0,a.useRef)(null),eo=(0,a.useRef)(null),es=(0,a.useRef)(null),ec=(0,a.useRef)(null),el=(0,a.useRef)(!1),eu=(0,a.useRef)(!1),ed=(0,a.useRef)(void 0),eh=(0,a.useRef)(!1),ef=(0,a.useRef)(!1),ep=(0,a.useRef)(null),eg=(0,a.useRef)(null);
17eg.current||(eg.current=new Promise(e=>{ep.current=e}));let em=(0,a.useRef)(null),ey=(0,a.useRef)(g),ew=(0,a.useRef)(null),eb=(0,a.useRef)(null);eb.current||(eb.current=new eB(u,b??!1));let eC=b??!1;eb.current&&eb.current.enabled!==eC&&(eb.current.enabled=eC);let eS=(0,a.useRef)(null);eS.current||(eS.current=new eQ);let e_=(0,a.useRef)(null),eA=(0,a.useRef)(null),eE=(0,a.useRef)(null),eI=(0,a.useCallback)((e,t=15e3)=>{let r=crypto.randomUUID();return e_.current=r,eA.current=e,eE.current=Date.now()+Math.max(1e3,t),r},[]),ex=(0,a.useCallback)(()=>((!e_.current||(eE.current??0)>0&&eE.current<Date.now())&&eI("adhoc",1e4),e_.current),[eI]),eP=(0,a.useRef)(null),eR=(0,a.useRef)(null);eR.current||(eR.current=new Promise(e=>{eP.current=e}));let eM=(0,a.useCallback)(async()=>{!eh.current&&eR.current&&await eR.current},[]),ej=(0,a.useCallback)(()=>{eh.current||(eh.current=!0,eP.current?.(),eP.current=null)},[]),eF=(0,a.useCallback)(async()=>{!ef.current&&eg.current&&await eg.current},[]),eG=(0,a.useCallback)(async()=>{!ef.current&&eg.current&&await eg.current,em.current&&await em.current},[]);return{clientId:u,wallet:d,baseUrl:_,fetchImpl:A,timeoutMs:p,providerAdapter:y,refreshDeps:v,ensureKeypair:W,rotate:F,ensureRootKeypair:K,rootPrivRef:N,rootPubJwkRef:j,privRef:q,pubJwkRef:$,meta:E,setBoundWallet:I,setJkt:k,setRefreshId:x,accessTokenRef:ea,tokenExpRef:ei,authenticated:G,setAuthenticated:B,loadingCount:H,setLoadingCount:Q,error:J,setError:z,allowed:V,setAllowed:Z,sessionExpiry:Y,setSessionExpiry:X,sessionData:ee,setSessionData:et,authWalletRef:en,refreshLock:eo,registerLock:es,sessionLock:ec,didInitialRefresh:el,didInitialSession:eu,prevWalletRef:ed,initResolvedRef:ef,initReady:eg,initResolveRef:ep,rotateLock:em,waitReady:eF,awaitKeyStable:eG,proofRef:ey,registerCooldownUntilRef:er,reqIdRef:e_,flowLabelRef:eA,flowExpireRef:eE,beginFlow:eI,currentReqId:ex,awaitProbe:eM,markProbed:ej,hasProbedRef:eh,getRefreshId:P,setLastPolicyHash:R,setLastPolicyProof:T,setLastHost:D,setRootJkt:O,setRegisteredProofId:M,metaReady:L,probeLock:ew,stateMachine:eS.current,logger:eb.current}})(e),{refresh:h,attemptRegister:g,setProofFromAdapterToken:y}=((t=(0,a.useRef)(d)).current=d,n=(0,a.useCallback)(()=>eZ(t.current),[]),i=(0,a.useCallback)(async()=>{let e,r=t.current;if(Date.now()<(r.registerCooldownUntilRef.current??0))return void r.logger.guard("registerCooldown",!1,"Cooldown active");if(!r.wallet)return void r.logger.guard("attemptRegister",!1,"No wallet");if(!r.initResolvedRef.current)return void r.logger.guard("attemptRegister",!1,"Not initialized");if(r.refreshLock.current)return void r.logger.guard("attemptRegister",!1,"Refresh in progress");if(r.registerLock.current)return void r.logger.guard("attemptRegister",!1,"Register already in progress");let n={wallet:r.wallet||null,boundWallet:r.meta.boundWallet||null,refreshId:(e=r.meta.refreshId)&&"null"!==e&&"undefined"!==e?e:null,hasToken:!!r.accessTokenRef.current,tokenExpiry:r.tokenExpRef.current||null,hasProof:!!r.proofRef.current,authenticated:r.authenticated};if(!r.stateMachine.shouldAttemptRegister(n))return void r.logger.guard("attemptRegister",!1,`State machine blocked (state: ${r.stateMachine.getState()}, inActiveSession: ${r.stateMachine.isInActiveSession()})`);let a=r.proofRef.current;if(!a)return void r.logger.guard("attemptRegister",!1,"No proof available");r.logger.guard("attemptRegister",!0,"All guards passed, proceeding");let i=(async()=>{try{await r.awaitKeyStable(),await eV(r,r.wallet,a,{refreshFallback:async()=>{r.logger.info("Attempting refresh as fallback after register failure");let e=!!r.meta.boundWallet;!e&&r.wallet&&r.setBoundWallet(r.wallet);try{return await eZ(r)}catch{return e||r.setBoundWallet(null),!1}}})}catch(e){r.setError(e?.message||String(e)||"Register failed")}finally{r.registerLock.current=null}})();r.registerLock.current=i},[]),o=(0,a.useCallback)(async e=>{let r=t.current;if(!r.providerAdapter||(r.registerCooldownUntilRef.current??0)>Date.now())return;let n=await p(r.providerAdapter,e);r.proofRef.current=n},[]),{refresh:n,register:(0,a.useCallback)((e,r,n)=>eV(t.current,e,r,n),[]),attemptRegister:i,setProofFromAdapterToken:o}),v=(s=(0,a.useRef)(d),c=(0,a.useRef)(h),s.current=d,c.current=h,(0,a.useCallback)(async(e,t,r,n={})=>e1(s.current,c.current,e,t,r,n),[])),{session:b}=(l=(0,a.useRef)(d),u=(0,a.useRef)(v),l.current=d,u.current=v,{session:(0,a.useCallback)(async()=>{let e=l.current,t=u.current;if(e.wallet&&!(e.meta.boundWallet&&!eE(e.wallet,e.meta.boundWallet)))return e.sessionLock.current||(e.sessionLock.current=(async()=>{try{return await e2(e,t)}catch(t){throw e.logger.error("Session request failed",t),t}
17finally{e.sessionLock.current=null}})()),e.sessionLock.current},[])});((e,t)=>{let{refresh:r,session:n,attemptRegister:i,setProofFromAdapterToken:o,proofProp:s}=t;(0,a.useEffect)(()=>{if(!e.metaReady)return;let t=!0;return(async()=>{try{if(await e.waitReady(),!t||(await e.awaitKeyStable(),!t)||(await e.ensureRootKeypair(),!t))return;let r=e5(e);e.stateMachine.initialize(r),await e0(e)}catch(r){if(!t)return;e.logger.error("Probe initialization failed",r)}})(),()=>{t=!1}},[e.metaReady]),(0,a.useEffect)(()=>{let t=e.prevWalletRef.current;if(e.prevWalletRef.current=e.wallet,e.wallet!==t&&e.hasProbedRef.current&&!e.refreshLock.current&&(e.didInitialRefresh.current=!1),!e.wallet){e.logger.flow("wallet","Wallet disconnected"),e.stateMachine.onWalletDisconnect(),e.setAllowed(null),e.setSessionExpiry(null),e.setSessionData(null),e.setAuthenticated(!1),e.accessTokenRef.current=null,e.proofRef.current=null,e.setError(null),e.didInitialSession.current=!1,e.authWalletRef.current=null,e.setLastPolicyHash(null),e.setLastPolicyProof(null),e.hasProbedRef.current&&!e.refreshLock.current&&(e.didInitialRefresh.current=!1);return}if(t&&e.wallet&&t!==e.wallet){e.logger.flow("wallet",`Wallet changed: ${t} \u2192 ${e.wallet}`);let r=e5(e);e.stateMachine.onWalletChange(t,e.wallet,r),e.proofRef.current=null,e.accessTokenRef.current=null,e.setAuthenticated(!1),e.didInitialSession.current=!1,e.authWalletRef.current=null,e.setLastPolicyHash(null),e.setLastPolicyProof(null),e.rotateLock.current=(async()=>{await e.rotate()})().catch(()=>{}).finally(()=>{e.rotateLock.current=null})}if(!t&&e.wallet){if(e.logger.flow("wallet",`Wallet connected: ${e.wallet}`),e.didInitialSession.current=!1,!e.metaReady)return void e.logger.info("Wallet connected but meta not ready, deferring state machine update");let t=e5(e);e.stateMachine.onWalletChange(null,e.wallet,t)}},[e.wallet,e.metaReady]),((e,t)=>{let{attemptRegister:r,setProofFromAdapterToken:n}=t;(0,a.useEffect)(()=>{if(!e.providerAdapter||e6(e)||!e.metaReady||!e.wallet)return;let t=e5(e);if(e.stateMachine.isInActiveSession())return void e.logger.decision("Provider adapter should trigger register?",!1,`Already in active session (state: ${e.stateMachine.getState()})`);if(e.stateMachine.shouldWaitForInitialRefresh(e.didInitialRefresh.current,t))return void e.logger.decision("Provider adapter should wait for initial refresh?",!0,"Returning user - refresh first");e.logger.decision("Provider adapter should trigger register?",!0,`Fetching token (state: ${e.stateMachine.getState()})`);let a=!1;return(async()=>{try{let t=e.providerAdapter.getToken(),i=new Promise((e,t)=>setTimeout(()=>t(Error("Provider adapter timeout (30s)")),3e4)),o=await Promise.race([t,i]).catch(t=>(e.logger.warn("Provider adapter getToken failed",t),null))??null;if(await e.awaitKeyStable(),a||!o)return;try{let t=o.split(".");if(t[1]){let r=JSON.parse(atob(t[1]));e.logger.info("Provider adapter: got token",{wallet:e.wallet,jwtSub:r.sub,jwtWallet:r.wallet||r.linked_accounts?.[0]?.address,jwtExp:r.exp,jwtIat:r.iat})}}catch{e.logger.info("Provider adapter: got token (could not decode)")}await n(o),await r()}catch(t){e.logger.error("Provider adapter flow failed",t)}})(),()=>{a=!0}},[e.providerAdapter,e.wallet,e.meta.boundWallet,e.metaReady,...e.refreshDeps])})(e,{attemptRegister:i,setProofFromAdapterToken:o}),((e,t)=>{let{proofProp:r,attemptRegister:n}=t;(0,a.useEffect)(()=>{if("u">typeof r&&(e.proofRef.current=r??null,r&&e.logger.info("Proof prop updated",{hasProof:!!r})),!e.metaReady)return;let t=e5(e),a=!!e.wallet,i=!!e.proofRef.current,o=!1,s=e.proofRef.current?.method;if(i&&e.stateMachine.isInActiveSession())if("siwe"!==s&&"eip191"!==s)return void e.logger.decision("Proof prop should trigger register?",!1,`Already in active session, no credential change detection for ${s}`);else{let t=f(e.proofRef.current),r=e.meta.registeredProofId;if(t&&r){let n=(e=>{if(!e)return null;let t=e.indexOf(":");return t>0?e.slice(0,t):null})(r),a="siwe"===n||"eip191"===n;if(a&&t!==r)e.logger.info("Proof prop: SIWE/EIP191 credentials changed, allowing re-registration",{old:r,new:t}),e.stateMachine.onNewCredentialsReceived(),e.accessTokenRef.current=null,e.setAuthenticated(!1),e.didInitialSession.current=!1,o=!0;else{if(a)return void e.logger.decision("Proof prop should trigger register?",!1,"Already authenticated with same SIWE/EIP191 credentials");e.logger.info("Proof prop: switching from provider JWT to SIWE/EIP191, allowing re-registration",{old:r,new:t}),e.stateMachine.onNewCredentialsReceived(),e.accessTokenRef.current=null,e.setAuthenticated(!1),e.didInitialSession.current=!1,o=!0}}}let c=o?e5(e):t;e.stateMachine.shouldAttemptRegister(c)?e.stateMachine.shouldWaitForInitialRefresh(e.didInitialRefresh.current,c)?e.logger.decision("Proof prop should wait for initial refresh?",!0,"Returning user - refresh first"):a&&i&&e.initResolvedRef.current&&!e6(e)&&(e.logger.info("Proof prop conditions met, attempting register"),n()):e.logger.decision("Proof prop should trigger register?",!1,`State machine says no (state: ${e.stateMachine.getState()}, inActiveSession: ${e.stateMachine.isInActiveSession()})`)},[r,e.wallet,e.authenticated,e.meta.boundWallet,e.meta.registeredProofId,e.metaReady,e.providerAdapter,n])})(e,{proofProp:s,attemptRegister:i}),((e,t)=>{let{refresh:r,session:n}=t;(0,a.useEffect)(()=>
17{if(!e.metaReady||e.didInitialRefresh.current)return;e.didInitialRefresh.current=!0;let t=!0;return(async()=>{try{await e.waitReady(),await e.awaitProbe();let a=e5(e);if(e.accessTokenRef.current||e.authenticated){e.logger.info("Already authenticated, skipping initial refresh"),e.wallet&&!e.didInitialSession.current&&await n()!==void 0&&(e.didInitialSession.current=!0);return}if(!e.stateMachine.shouldAttemptRefresh(a))return void e.logger.decision("Should attempt initial refresh?",!1,`State: ${e.stateMachine.getState()}`);e.logger.decision("Should attempt initial refresh?",!0,`State: ${e.stateMachine.getState()}`);let i=await r();if(!t)return;e.setAuthenticated(i),i&&e.wallet&&!e.didInitialSession.current&&await n()!==void 0&&(e.didInitialSession.current=!0)}catch(r){if(!t)return;e.setAuthenticated(!1),e.setError(r?.message||String(r)||"Unknown error")}})(),()=>{t=!1}},[e.wallet,e.meta.boundWallet,e.meta.refreshId,e.metaReady,r,n])})(e,{refresh:r,session:n}),(0,a.useEffect)(()=>{e.initResolvedRef.current||(async()=>{if(await e.ensureKeypair(),!e.wallet){e.initResolvedRef.current=!0,e.initResolveRef.current?.();return}e.meta.boundWallet&&!eE(e.meta.boundWallet,e.wallet)&&(e.rotateLock.current=(async()=>{e.accessTokenRef.current=null,e.setAuthenticated(!1)})().catch(()=>{}).finally(()=>{e.rotateLock.current=null}),e.rotateLock.current&&await e.rotateLock.current),e.initResolvedRef.current=!0,e.initResolveRef.current?.()})()},[e]),((e,t)=>{let{session:r}=t;(0,a.useEffect)(()=>{(async()=>{if(e.authenticated&&e.wallet&&e.accessTokenRef.current&&!(e.meta.boundWallet&&!eE(e.wallet,e.meta.boundWallet))&&!e.didInitialSession.current)try{e.logger.flow("session","Calling session after authentication"),await r()!==void 0&&(e.didInitialSession.current=!0)}catch(t){e.setError(t?.message||String(t))}})()},[e.authenticated,e.wallet,e.meta.boundWallet,r])})(e,{session:n}),(0,a.useEffect)(()=>{e.wallet&&e.authWalletRef.current&&!eE(e.wallet,e.authWalletRef.current)&&(e.logger.warn("Wallet mismatch detected, clearing auth and proof",{current:e.wallet,authWallet:e.authWalletRef.current}),e.accessTokenRef.current=null,e.setAuthenticated(!1),e.proofRef.current=null)},[e.wallet,e.authWalletRef.current]),((e,t)=>{let{refresh:r,session:n}=t;(0,a.useEffect)(()=>{let t=async()=>{try{let t,a,i;if(!e.authenticated||!e.wallet||e.meta.boundWallet&&!eE(e.wallet,e.meta.boundWallet))return;let{tokenSoon:o,sessionSoon:s}=(t=Math.floor(Date.now()/1e3),a=e.tokenExpRef.current,i=e.sessionExpiry,{tokenSoon:!!a&&a-t<=30&&a-t>0,sessionSoon:!!i&&i-t<=3600&&i-t>0});(o||s)&&(e.logger.info("Refreshing on focus",{tokenSoon:o,sessionSoon:s}),await r()&&s&&await n())}catch{}},a=async()=>{"visible"===document.visibilityState&&await t()};return window.addEventListener("focus",t),document.addEventListener("visibilitychange",a),()=>{window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",a)}},[e,e.sessionExpiry,r,n])})(e,{refresh:r,session:n})})(d,{refresh:h,session:b,attemptRegister:g,setProofFromAdapterToken:y,proofProp:e.proof});let _=(0,a.useMemo)(()=>({get:(e,t)=>v("GET",e,void 0,t),post:(e,t,r)=>v("POST",e,t,r),session:b,refresh:h,authenticated:d.authenticated,loading:d.loadingCount>0,error:d.error,allowed:d.allowed,sessionExpiry:d.sessionExpiry,sessionData:d.sessionData,wallet:d.wallet}),[v,b,h,d.authenticated,d.loadingCount,d.error,d.allowed,d.sessionExpiry,d.sessionData,d.wallet]);return(0,r.jsx)(e3.Provider,{value:_,children:e.children})},e4=e=>(0,r.jsx)(eP,{clientId:e.clientId,children:(0,r.jsx)(e8,{...e})}),e9=e.i(28168),e7=e.i(334769),te=e.i(320383),tt=e.i(668168);let tr=(t="14c82cba513847339263200b",{base:"https://api.sunbreak.com",clientId:t});function tn(e){let t,a,i,o=(0,n.c)(16),{children:s,config:c}=e,{authenticatedUser:l,isLoggedIn:u}=(0,e7.useAuthenticationContext)(),{address:d,connector:h}=(0,e9.useConnection)(),f=l?.address,p=l?.type,g=h?.id;o[0]!==d||o[1]!==u||o[2]!==f||o[3]!==p||o[4]!==g?(t=(({authenticatedAddress:e,authenticatedType:t,connectedAddress:r,connectorId:n,isLoggedIn:a})=>{let i="eoa"===t&&!!n&&!(0,tt.isMagicConnector)(n),o=e?.toLowerCase(),s=r?.toLowerCase();return a&&i&&s&&s===o?s:void 0})({authenticatedAddress:f,authenticatedType:p,connectedAddress:d,connectorId:g,isLoggedIn:u}),o[0]=d,o[1]=u,o[2]=f,o[3]=p,o[4]=g,o[5]=t):t=o[5];let m=t,y=(0,te.useSunbreakProofCredential)(m),w=y?m:void 0,v=y??null,b=y?.signature;return o[6]!==b||o[7]!==w?(a=[w,b],o[6]=b,o[7]=w,o[8]=a):a=o[8],o[9]!==s||o[10]!==c.base||o[11]!==c.clientId||o[12]!==v||o[13]!==a||o[14]!==w?(i=(0,r.jsx)(e4,{base:c.base,clientId:c.clientId,wallet:w,proof:v,refreshDeps:a,children:s}),o[9]=s,o[10]=c.base,o[11]=c.clientId,o[12]=v,o[13]=a,o[14]=w,o[15]=i):i=o[15],i}function ta(e){let t,a=(0,n.c)(2),{children:i}=e;return tr?(a[0]!==i?(t=(0,r.jsx)(tn,{config:tr,children:i}),a[0]=i,a[1]=t):t=a[1],t):i}},966516,863348,251701,641483,e=>{"use strict";var t=e.i(303115),r=e.i(960794),n=e.i(846574);let a=e=>{let r,a,i,o,s,c,l,u,d,h,f,p,g,m,y,w,v=(0,n.c)(18);return v[0]!==e?({...r}=e,v[0]=e,v[1]=r):r=v[1],v[2]===Symbol.for("react.memo_cache_sentinel")?(a={maskType:"alpha"},v[2]=a):a=v[2],v[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("mask",{id:"mask0_8_554",style:a,maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:(0,t.jsx)("circle",{cx:"60",cy:"60",r:"60",fill:"#D9D9D9"})}),v[3]=i):i=v[3],v[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsxs)("g",{clipPath:"url(#clip0_8_554)",children:[i,(0,t.jsx)("g",{mask:"url(#mask0_8_554)",children:(0,t.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_8_554)"})}),(0,t.jsx)("path",{d:"M26.6667 41.6667H31.6667C57.44 41.6667 78.3333 62.56 78.3333 88.3333V93.3333H88.3333C91.0948 93.3333 93.3333 91.0947 93.3333 88.3333C93.3333 54.2758 65.7242 26.6667 31.6667 26.6667C28.9052 26.6667 26.6667 28.9052 26.6667 31.6667V41.6667Z",fill:"url(#paint1_radial_8_554)"}),(0,t.jsx)("path",{d:"M80 88.3333H93.3333C93.3333 91.0948 91.0947 93.3333 88.3333 93.3333H80V88.3333Z",fill:"url(#paint2_linear_8_554)"}),(0,t.jsx)("path",{d:"M31.6667 26.6667L31.6667 40H26.6667L26.6667 31.6667C26.6667 28.9052 28.9052 26.6667 31.6667 26.6667Z",fill:"url(#paint3_linear_8_554)"}),(0,t.jsx)("path",{d:"M26.6666 40H31.6666C58.3604 40 80 61.6396 80 88.3333V93.3333H65V88.3333C65 69.9238 50.0761 55 31.6666 55H26.6666V40Z",fill:"url(#paint4_radial_8_554)"}),(0,t.jsx)("path",{d:"M66.6666 88.3333H80V93.3333H66.6666V88.3333Z",fill:"url(#paint5_linear_8_554)"}),(0,t.jsx)("path",{d:"M26.6666 53.3333L26.6666 40L31.6666 40L31.6666 53.3333H26.6666Z",fill:"url(#paint6_linear_8_554)"}),(0,t.jsx)("path",{d:"M26.6666 61.6667C26.6666 64.4281 28.9052 66.6667 31.6666 66.6667C43.6328 66.6667 53.3333 76.3672 53.3333 88.3333C53.3333 91.0947 55.5719 93.3333 58.3333 93.3333H66.6666V88.3333C66.6666 69.0034 50.9966 53.3333 31.6666 53.3333H26.6666V61.6667Z",fill:"url(#paint7_radial_8_554)"}),(0,t.jsx)("path",{d:"M53.3333 88.3333H66.6666V93.3333H58.3333C55.5719 93.3333 53.3333 91.0948 53.3333 88.3333Z",fill:"url(#paint8_radial_8_554)"}),(0,t.jsx)("path",{d:"M31.6666 66.6667C28.9052 66.6667 26.6666 64.4281 26.6666 61.6667L26.6666 53.3333L31.6666 53.3333L31.6666 66.6667Z",fill:"url(#paint9_radial_8_554)"})]}),v[4]=o):o=v[4],v[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsxs)("linearGradient",{id:"paint0_linear_8_554",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#174299"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),v[5]=s):s=v[5],v[6]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsxs)("radialGradient",{id:"paint1_radial_8_554",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(31.6667 88.3333) rotate(-90) scale(61.6667)",children:[(0,t.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),v[6]=c):c=v[6],v[7]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsxs)("linearGradient",{id:"paint2_linear_8_554",x1:"79.1666",y1:"90.8333",x2:"93.3333",y2:"90.8333",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#FF4000"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),v[7]=l):l=v[7],v[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsxs)("linearGradient",{id:"paint3_linear_8_554",x1:"29.1667",y1:"26.6667",x2:"29.1667",y2:"40.8333",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#8754C9"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),v[8]=u):u=v[8],v[9]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsxs)("radialGradient",{id:"paint4_radial_8_554",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(31.6666 88.3333) rotate(-90) scale(48.3333)",children:[(0,t.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),v[9]=d):d=v[9],v[10]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsxs)("linearGradient",{id:"paint5_linear_8_554",x1:"66.6666",y1:"90.8333",x2:"80",y2:"90.8333",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#FFF700"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),v[10]=h):h=v[10],v[11]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsxs)("linearGradient",{id:"paint6_linear_8_554",x1:"29.1666",y1:"53.3333",x2:"29.1666",y2:"40",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#FFF700"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),v[11]=f):f=v[11],v[12]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsxs)("radialGradient",{id:"paint7_radial_8_554",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(31.6666 88.3333) rotate(-90) scale(35)",children:[(0,t.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),v[12]=p):p=v[12],v[13]===Symbol.for("react.memo_cache_sentinel")?(g=(0,t.jsxs)("radialGradient",{id:"paint8_radial_8_554",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(52.5 90.8333) scale(14.1667 37.7778)",children:[(0,t.jsx)("stop",{stopColor:"#00AAFF"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),v[13]=g):g=v[13],v[14]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsxs)("radialGradient",{id:"paint9_radial_8_554",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(29.1666 67.5) rotate(-90) scale(14.1667 268.642)",children:[(0,t.jsx)("stop",{stopColor:"#00AAFF"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),v[14]=m):m=v[14],v[15]===Symbol.for("react.memo_cache_sentinel")?(y=(0,t.jsxs)("defs",{children:[s,c,l,u,d,h,f,p,g,m,(0,t.jsx)("clipPath",{id:"clip0_8_554",children:(0,t.jsx)("rect",{width:"120",height:"120",fill:"white"})})]}),v[15]=y):y=v[15],v[16]!==r?(w=(0,t.jsxs)("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:[o,y]}),v[16]=r,v[17]=w):w=v[17],w},i=e=>{let r,a,i,o,s,c,l,u,d,h,f,p,g,m,y,w,v,b,C,S,_,A,E=(0,n.c)(24);return E[0]!==e?({...r}=e,E[0]=e,E[1]=r):r=E[1],E[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_62_329)"}),o=(0,t.jsx)("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_62_329)"}),s=(0,t.jsx)("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_62_329)"}),c=(0,t.jsx)("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_62_329)"}),l=(0,t.jsx)("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_62_329)"}),u=(0,t.jsx)("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_62_329)"}),d=(0,t.jsx)("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_62_329)"}),h=(0,t.jsx)("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_62_329)"}),f=(0,t.jsx)("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_62_329)"}),i=(0,t.jsx)("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L2
176 52L26 68Z",fill:"url(#paint9_radial_62_329)"}),E[2]=a,E[3]=i,E[4]=o,E[5]=s,E[6]=c,E[7]=l,E[8]=u,E[9]=d,E[10]=h,E[11]=f):(a=E[2],i=E[3],o=E[4],s=E[5],c=E[6],l=E[7],u=E[8],d=E[9],h=E[10],f=E[11]),E[12]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsxs)("linearGradient",{id:"paint0_linear_62_329",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#174299"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),E[12]=p):p=E[12],E[13]===Symbol.for("react.memo_cache_sentinel")?(g=(0,t.jsxs)("radialGradient",{id:"paint1_radial_62_329",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[(0,t.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),E[13]=g):g=E[13],E[14]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsxs)("linearGradient",{id:"paint2_linear_62_329",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#FF4000"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),E[14]=m):m=E[14],E[15]===Symbol.for("react.memo_cache_sentinel")?(y=(0,t.jsxs)("linearGradient",{id:"paint3_linear_62_329",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#8754C9"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),E[15]=y):y=E[15],E[16]===Symbol.for("react.memo_cache_sentinel")?(w=(0,t.jsxs)("radialGradient",{id:"paint4_radial_62_329",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[(0,t.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),E[16]=w):w=E[16],E[17]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsxs)("linearGradient",{id:"paint5_linear_62_329",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#FFF700"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),E[17]=v):v=E[17],E[18]===Symbol.for("react.memo_cache_sentinel")?(b=(0,t.jsxs)("linearGradient",{id:"paint6_linear_62_329",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#FFF700"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),E[18]=b):b=E[18],E[19]===Symbol.for("react.memo_cache_sentinel")?(C=(0,t.jsxs)("radialGradient",{id:"paint7_radial_62_329",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[(0,t.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),E[19]=C):C=E[19],E[20]===Symbol.for("react.memo_cache_sentinel")?(S=(0,t.jsxs)("radialGradient",{id:"paint8_radial_62_329",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[(0,t.jsx)("stop",{stopColor:"#00AAFF"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),E[20]=S):S=E[20],E[21]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsxs)("defs",{children:[p,g,m,y,w,v,b,C,S,(0,t.jsxs)("radialGradient",{id:"paint9_radial_62_329",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[(0,t.jsx)("stop",{stopColor:"#00AAFF"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]})]}),E[21]=_):_=E[21],E[22]!==r?(A=(0,t.jsxs)("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:[a,o,s,c,l,u,d,h,f,i,_]}),E[22]=r,E[23]=A):A=E[23],A},o=e=>{let r,a,i,o,s,c=(0,n.c)(11);c[0]!==e?({background:a,...r}=e,c[0]=e,c[1]=r,c[2]=a):(r=c[1],a=c[2]);let l=void 0!==a&&a;c[3]!==l?(i=l?{background:"#3B99FC"}:void 0,c[3]=l,c[4]=i):i=c[4];let u=l?"white":"#3B99FC";return c[5]!==u?(o=(0,t.jsx)("path",{d:"M9.58818 11.8556C13.1293 8.31442 18.8706 8.31442 22.4117 11.8556L22.8379 12.2818C23.015 12.4588 23.015 12.7459 22.8379 12.9229L21.3801 14.3808C21.2915 14.4693 21.148 14.4693 21.0595 14.3808L20.473 13.7943C18.0026 11.3239 13.9973 11.3239 11.5269 13.7943L10.8989 14.4223C10.8104 14.5109 10.6668 14.5109 10.5783 14.4223L9.12041 12.9645C8.94336 12.7875 8.94336 12.5004 9.12041 12.3234L9.58818 11.8556ZM25.4268 14.8706L26.7243 16.1682C26.9013 16.3452 26.9013 16.6323 26.7243 16.8093L20.8737 22.6599C20.6966 22.8371 20.4096 22.8371 20.2325 22.6599L16.0802 18.5076C16.0359 18.4634 15.9641 18.4634 15.9199 18.5076L11.7675 22.6599C11.5905 22.8371 11.3034 22.8371 11.1264 22.66C11.1264 22.66 11.1264 22.6599 11.1264 22.6599L5.27561 16.8092C5.09856 16.6322 5.09856 16.3451 5.27561 16.168L6.57313 14.8706C6.75019 14.6934 7.03726 14.6934 7.21431 14.8706L11.3668 19.023C11.411 19.0672 11.4828 19.0672 11.5271 19.023L15.6793 14.8706C15.8563 14.6934 16.1434 14.6934 16.3205 14.8706L20.473 19.023C20.5172 19.0672 20.589 19.0672 20.6332 19.023L24.7856 14.8706C24.9627 14.6935 25.2498 14.6935 25.4268 14.8706Z",fill:u}),c[5]=u,c[6]=o):o=c[6],c[7]!==r||c[8]!==i||c[9]!==o?(s=(0,t.jsx)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:i,...r,children:o}),c[7]=r,c[8]=i,c[9]=o,c[10]=s):s=c[10],s},s=e=>{let r,a,i,o,s,c,l,u,d,h,f,p=(0,n.c)(15);p[0]!==e?({background:a,...r}=e,p[0]=e,p[1]=r,p[2]=a):(r=p[1],a=p[2]);let g=void 0!==a&&a;return p[3]!==g?(i=g?{background:"linear-gradient(0deg, #FF8D5D, #FF5C16)",borderRadius:"27.5%"}:void 0,p[3]=g,p[4]=i):i=p[4],p[5]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)("path",{d:"M132.682,132.192l-30.583-9.106l-23.063,13.787l-16.092-0.007l-23.077-13.78l-30.569,9.106L0,100.801\n l9.299-34.839L0,36.507L9.299,0l47.766,28.538h27.85L132.682,0l9.299,36.507l-9.299,29.455l9.299,34.839L132.682,132.192\n L132.682,132.192z",fill:"#FF5C16"}),s=(0,t.jsx)("path",{d:"M9.305,0l47.767,28.558l-1.899,19.599L9.305,0z M39.875,100.814l21.017,16.01l-21.017,6.261\n C39.875,123.085,39.875,100.814,39.875,100.814z M59.212,74.345l-4.039-26.174L29.317,65.97l-0.014-0.007v0.013l0.08,18.321\n l10.485-9.951L59.212,74.345L59.212,74.345z M132.682,0L84.915,28.558l1.893,19.599L132.682,0z M102.113,100.814l-21.018,16.01\n l21.018,6.261V100.814z M112.678,65.975h0.007H112.678v-0.013l-0.006,0.007L86.815,48.171l-4.039,26.174h19.336l10.492,9.95\n C112.604,84.295,112.678,65.975,112.678,65.975z",fill:"#FF5C16"}),c=(0,t.jsx)("path",{d:"M39.868,123.085l-30.569,9.106L0,100.814h39.868C39.868,100.814,39.868,123.085,39.868,123.085z\n M59.205,74.338l5.839,37.84l-8.093-21.04L29.37,84.295l10.491-9.956h19.344L59.205,74.338z M102.112,123.085l30.57,9.106\n l9.299-31.378h-39.869C102.112,100.814,102.112,123.085,102.112,123.085z M82.776,74.338l-5.839,37.84l8.092-21.04l27.583-6.843\n l-10.498-9.956H82.776V74.338z",fill:"#E34807"}),l=(0,t.jsx)("path",{d:"M0,100.801l9.299-34.839h19.997l0.073,18.327l27.584,6.843l8.092,21.039l-4.16,4.633l-21.017-16.01H0\n V100.801z M141.981,100.801l-9.299-34.839h-19.998l-0.073,18.327l-27.582,6.843l-8.093,21.039l4.159,4.633l21.018-16.01h39.868\n V100.801z M84.915,28.538h-27.85l-1.891,19.599l9.872,64.013h11.891l9.878-64.013L84.915,28.538z",fill:"#FF8D5D"}),u=(0,t.jsx)("path",{d:"M9.299,0L0,36.507l9.299,29.455h19.997l25.87-17.804L9.299,0z M53.426,81.938h-9.059l-4.932,4.835\n l17.524,4.344l-3.533-9.186V81.938z M132.682,0l9.299,36.507l-9.299,29.455h-19.998L86.815,48.158L132.682,0z M88.568,81.938h9.072\n l4.932,4.841l-17.544,4.353l3.54-9.201V81.938z M79.029,124.385l2.067-7.567l-4.16-4.633h-11.9l-4.159,4.633l2.066,7.567",fill:"#661800"}),d=(0,t.jsx)("path",{d:"M79.029,124.384v12.495H62.945v-12.495L79.029,124.384L79.029,124.384z",fill:"#C0C4CD"}),h=(0,t.jsx)("path",{d:"M39.875,123.072l23.083,13.8v-12.495l-2.067-7.566C60.891,116.811,39.875,123.072,39.875,123.072z\n M102.113,123.072l-23.084,13.8v-12.495l2.067-7.566C81.096,116.811,102.113,123.072,102.113,123.072z",fill:"#E7EBF6"}),p[5]=o,p[6]=s,p[7]=c,p[8]=l,p[9]=u,p[10]=d,p[11]=h):(o=p[5],s=p[6],c=p[7],l=p[8],u=p[9],d=p[10],h=p[11]),p[12]!==r||p[13]!==i?(f=(0,t.jsxs)("svg",{style:i,width:"32",height:"32",viewBox:"0 0 142 136.878",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:[o,s,c,l,u,d,h]}),p[12]=r,p[13]=i,p[14]=f):f=p[14],f},c=e=>{let r,a,i,o,s,c,l=(0,n.c)(10);l[0]!==e?({background:a,...r}=e,l[0]=e,l[1]=r,l[2]=a):(r=l[1],a=l[2]);let u=void 0!==a&&a;return l[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("circle",{cx:"10",cy:"10",r:"10",fill:"#0052FF"}),l[3]=i):i=l[3],l[4]!==u?(o=u&&(0,t.jsx)("rect",{rx:"27%",width:"20",height:"20",fill:"#0052FF"}),l[4]=u,l[5]=o):o=l[5],l[6]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 17C13.8661 17 17.0001 13.866 17.0001 10C17.0001 6.13401 13.8661 3 10.0001 3C6.13413 3 3.00012 6.13401 3.00012 10C3.00012 13.866 6.13413 17 10.0001 17ZM8.25012 7.71429C7.95427 7.71429 7.71441 7.95414 7.71441 8.25V11.75C7.71441 12.0459 7.95427 12.2857 8.25012 12.2857H11.7501C12.046 12.2857 12.2858 12.0459
1712.2858 11.75V8.25C12.2858 7.95414 12.046 7.71429 11.7501 7.71429H8.25012Z",fill:"white"}),l[6]=s):s=l[6],l[7]!==r||l[8]!==o?(c=(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:[i,o,s]}),l[7]=r,l[8]=o,l[9]=c):c=l[9],c},l=e=>{let r,a,i,o,s,c,l,u,d,h,f,p=(0,n.c)(13);return p[0]!==e?({...r}=e,p[0]=e,p[1]=r):r=p[1],p[2]===Symbol.for("react.memo_cache_sentinel")?(a={background:"#8697FF",borderRadius:"27%"},p[2]=a):a=p[2],p[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("path",{d:"M76.2062 48.0657C78.7621 42.356 66.1267 26.404 54.0555 19.7581C46.4467 14.6095 38.5183 15.3169 36.9125 17.5775C33.3886 22.5385 48.5814 26.7423 58.742 31.6478C56.5579 32.5964 54.4996 34.2987 53.2893 36.4758C49.5013 32.3404 41.1872 28.7791 31.4315 31.6478C24.8574 33.5809 19.3937 38.1382 17.2821 45.0216C16.7689 44.7936 16.2009 44.6669 15.6032 44.6669C13.3176 44.6669 11.4648 46.5197 11.4648 48.8052C11.4648 51.0908 13.3176 52.9435 15.6032 52.9435C16.0268 52.9435 17.3514 52.6594 17.3514 52.6594L38.5183 52.8128C30.0532 66.2418 23.3634 68.2049 23.3634 70.5314C23.3634 72.8579 29.7643 72.2274 32.1678 71.3602C43.6732 67.2088 56.0306 54.2706 58.1511 50.5462C67.056 51.6572 74.5397 51.7886 76.2062 48.0657Z",fill:"url(#paint0_linear_60607_36577)"}),o=(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M58.65 31.6053C58.682 31.6193 58.7139 31.6332 58.7458 31.6471C59.2168 31.4616 59.1406 30.766 59.0113 30.2198C58.714 28.9643 53.5856 23.9001 48.7696 21.6318C42.1984 18.5367 37.3618 18.7007 36.6582 20.1307C37.9975 22.8695 44.1927 25.441 50.663 28.1266C53.3909 29.2589 56.1676 30.4114 58.65 31.6053Z",fill:"url(#paint1_linear_60607_36577)"}),s=(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.4154 59.2247C49.0895 58.7182 47.592 58.2536 45.8898 57.8319C47.707 54.5801 48.0884 49.7663 46.3721 46.7226C43.9635 42.4512 40.9399 40.1777 33.9139 40.1777C30.0495 40.1777 19.6451 41.4794 19.4603 50.1648C19.441 51.0763 19.4599 51.9118 19.5259 52.68L38.5175 52.8176C35.9568 56.8798 33.5586 59.8928 31.4589 62.1841C33.9831 62.8309 36.0657 63.3738 37.9775 63.8722C39.7885 64.3443 41.4462 64.7764 43.1809 65.2191C45.8007 63.3102 48.2635 61.2288 50.4154 59.2247Z",fill:"url(#paint2_linear_60607_36577)"}),c=(0,t.jsx)("path",{d:"M17.0296 51.7821C17.8058 58.38 21.5555 60.9657 29.2177 61.7309C36.8799 62.4961 41.2751 61.9828 47.1265 62.5151C52.0136 62.9598 56.3772 65.4502 57.996 64.5895C59.4529 63.815 58.6378 61.0167 56.6884 59.2214C54.1614 56.8943 50.6641 55.2763 44.5104 54.7021C45.7368 51.3443 45.3931 46.6362 43.4885 44.0748C40.7345 40.3711 35.6513 38.6967 29.2177 39.4282C22.4962 40.1926 16.0556 43.5018 17.0296 51.7821Z",fill:"url(#paint3_linear_60607_36577)"}),p[3]=i,p[4]=o,p[5]=s,p[6]=c):(i=p[3],o=p[4],s=p[5],c=p[6]),p[7]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsxs)("linearGradient",{id:"paint0_linear_60607_36577",x1:"30.666",y1:"43.0094",x2:"75.6558",y2:"55.7677",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"white"}),(0,t.jsx)("stop",{offset:"1",stopColor:"white"})]}),p[7]=l):l=p[7],p[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsxs)("linearGradient",{id:"paint1_linear_60607_36577",x1:"68.0842",y1:"42.1521",x2:"35.6221",y2:"9.60636",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#7258DC"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#797DEA",stopOpacity:"0"})]}),p[8]=u):u=p[8],p[9]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsxs)("linearGradient",{id:"paint2_linear_60607_36577",x1:"51.3184",y1:"60.3591",x2:"20.1383",y2:"42.4347",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"#7461EA"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#BFC2FF",stopOpacity:"0"})]}),p[9]=d):d=p[9],p[10]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsxs)("defs",{children:[l,u,d,(0,t.jsxs)("linearGradient",{id:"paint3_linear_60607_36577",x1:"33.3531",y1:"42.6732",x2:"54.4308",y2:"69.4547",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{stopColor:"white"}),(0,t.jsx)("stop",{offset:"0.983895",stopColor:"#D5CEFF"})]})]}),p[10]=h):h=p[10],p[11]!==r?(f=(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 88 88",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:a,...r,children:[i,o,s,c,h]}),p[11]=r,p[12]=f):f=p[12],f},u=e=>{let r,a,i,o,s=(0,n.c)(6);return s[0]!==e?({...r}=e,s[0]=e,s[1]=r):r=s[1],s[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("title",{children:"mail"}),s[2]=a):a=s[2],s[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsxs)("g",{id:"Icons",stroke:"none",strokeWidth:"1",fill:"#6851FF",fillRule:"evenodd",children:[(0,t.jsx)("path",{d:"M200 0C218.262 21.2014 238.404 40.8906 260.185 58.8391C245.672 103.459 237.858 150.865 237.858 200C237.858 249.135 245.672 296.541 260.185 341.161C238.404 359.109 218.262 378.799 200 400C181.738 378.799 161.596 359.109 139.815 341.161C154.328 296.541 162.142 249.135 162.142 200C162.142 150.865 154.328 103.459 139.815 58.8392C161.596 40.8907 181.738 21.2015 200 0Z",fill:"#6851FF"}),(0,t.jsx)("path",{d:"M98.183 310.312C75.1276 294.994 50.6592 281.457 25 269.911C32.1177 247.797 35.9467 224.322 35.9467 200C35.9467 175.678 32.1177 152.204 25 130.089C50.6591 118.543 75.1275 105.006 98.183 89.6885C106.999 125.102 111.664 162.034 111.664 200C111.664 237.966 106.999 274.898 98.183 310.312Z",fill:"#6851FF"}),(0,t.jsx)("path",{d:"M288.336 200C288.336 237.966 293.001 274.898 301.817 310.312C324.872 294.994 349.341 281.457 375 269.911C367.882 247.797 364.053 224.322 364.053 200C364.053 175.678 367.882 152.204 375 130.089C349.341 118.543 324.872 105.006 301.817 89.6884C293.001 125.102 288.336 162.034 288.336 200Z",fill:"#6851FF"})]}),s[3]=i):i=s[3],s[4]!==r?(o=(0,t.jsxs)("svg",{width:"32px",height:"32px",viewBox:"0 0 400 400",version:"1.1",...r,children:[a,i]}),s[4]=r,s[5]=o):o=s[5],o},d=e=>{let r,a,i,o,s,c,l,u,d,h=(0,n.c)(11);return h[0]!==e?({...r}=e,h[0]=e,h[1]=r):r=h[1],h[2]===Symbol.for("react.memo_cache_sentinel")?(a={borderRadius:"27.5%"},h[2]=a):a=h[2],h[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("path",{fill:"#FFFFFF",opacity:"1.000000",stroke:"none",d:"\nM333.000000,514.000000 \n C222.026932,514.000000 111.553864,514.000000 1.040397,514.000000 \n C1.040397,343.068604 1.040397,172.137222 1.040397,1.102912 \n C171.556396,1.102912 342.112885,1.102912 512.834717,1.102912 \n C512.834717,171.999863 512.834717,342.999908 512.834717,514.000000 \n C453.137177,514.000000 393.318573,514.000000 333.000000,514.000000 \nM149.500153,106.296974 \n C137.679108,106.296974 125.858002,106.27
175078 114.037025,106.305374 \n C107.193314,106.322906 105.007622,108.477486 105.003799,115.206032 \n C104.987999,143.010406 104.988739,170.814774 105.003159,198.619141 \n C105.006721,205.496872 107.116180,207.685822 113.862015,207.692139 \n C141.666367,207.718124 169.470764,207.719223 197.275101,207.691544 \n C204.219543,207.684631 206.277847,205.671249 206.286438,198.803192 \n C206.321213,170.998871 206.318512,143.194443 206.288712,115.390106 \n C206.281113,108.297028 204.189957,106.308426 196.951782,106.301506 \n C181.467926,106.286697 165.984039,106.296967 149.500153,106.296974 \nM360.499817,207.703033 \n C373.486572,207.703018 386.473297,207.713654 399.460052,207.698898 \n C406.866913,207.690491 408.997681,205.585556 408.999725,198.283096 \n C409.007416,170.811203 409.006287,143.339310 409.000549,115.867424 \n C408.998962,108.322479 407.041901,106.305756 399.638947,106.302231 \n C372.000549,106.289101 344.362183,106.288246 316.723785,106.303131 \n C309.831238,106.306847 307.716339,108.339226 307.708130,115.158676 \n C307.674622,142.963516 307.676483,170.768433 307.706360,198.573288 \n C307.713928,205.633774 309.844757,207.682373 317.043213,207.695450 \n C331.195374,207.721176 345.347565,207.703033 360.499817,207.703033 \nM307.835571,272.500061 \n C307.835571,254.020844 307.852997,235.541595 307.826691,217.062424 \n C307.816620,209.980988 305.624878,207.714005 298.695282,207.706848 \n C270.893219,207.678146 243.091080,207.681274 215.289017,207.704651 \n C208.539688,207.710327 206.316681,209.920135 206.309784,216.679733 \n C206.281433,244.481796 206.279022,272.283936 206.311646,300.085968 \n C206.319443,306.731720 208.657730,308.989594 215.404510,308.994232 \n C243.206589,309.013367 271.008698,309.015533 298.810791,308.992523 \n C305.475708,308.987030 307.788635,306.663483 307.824036,299.970306 \n C307.870728,291.147125 307.835541,282.323547 307.835571,272.500061 \nM206.295914,361.500183 \n C206.295914,347.347748 206.303299,333.195282 206.293137,319.042847 \n C206.287186,310.746338 204.582611,309.003357 196.495056,309.002045 \n C169.189148,308.997620 141.883240,308.996155 114.577332,309.003113 \n C107.017197,309.005066 105.008812,310.947021 105.005447,318.319336 \n C104.992844,345.958252 104.993156,373.597137 105.005539,401.236053 \n C105.008606,408.084229 107.071625,410.273865 113.809303,410.283661 \n C141.614655,410.324066 169.420135,410.320862 197.225494,410.286896 \n C204.391434,410.278137 206.271317,408.301575 206.287842,400.961578 \n C206.316681,388.141205 206.295898,375.320709 206.295914,361.500183 \nM405.272217,309.830139 \n C403.497650,309.553558 401.723541,309.039185 399.948486,309.035950 \n C372.128693,308.985260 344.308807,308.990540 316.488922,309.007721 \n C309.933502,309.011780 307.731995,311.087433 307.720886,317.582550 \n C307.672699,345.735504 307.675659,373.888641 307.718475,402.041626 \n C307.727783,408.170410 309.704224,410.249603 315.823975,410.265076 \n C344.143433,410.336578 372.463196,410.331268 400.782715,410.270630 \n C406.739746,410.257874 408.978577,407.959930 408.985138,402.144501 \n C409.017090,373.824921 409.069275,345.504791 408.871033,317.186523 \n C408.854675,314.844818 407.022522,312.515839 405.272217,309.830139 \nz"}),o=(0,t.jsx)("path",{fill:"#020202",opacity:"1.000000",stroke:"none",d:"\nM150.000153,106.296974 \n C165.984039,106.296967 181.467926,106.286697 196.951782,106.301506 \n C204.189957,106.308426 206.281113,108.297028 206.288712,115.390106 \n C206.318512,143.194443 206.321213,170.998871 206.286438,198.803192 \n C206.277847,205.671249 204.219543,207.684631 197.275101,207.691544 \n C169.470764,207.719223 141.666367,207.718124 113.862015,207.692139 \n C107.116180,207.685822 105.006721,205.496872 105.003159,198.619141 \n C104.988739,170.814774 104.987999,143.010406 105.003799,115.206032 \n C105.007622,108.477486 107.193314,106.322906 114.037025,106.305374 \n C125.858002,106.275078 137.679108,106.296974 150.000153,106.296974 \nz"}),s=(0,t.jsx)("path",{fill:"#020202",opacity:"1.000000",stroke:"none",d:"\nM359.999786,207.703033 \n C345.347565,207.703033 331.195374,207.721176 317.043213,207.695450 \n C309.844757,207.682373 307.713928,205.633774 307.706360,198.573288 \n C307.676483,170.768433 307.674622,142.963516 307.708130,115.158676 \n C307.716339,108.339226 309.831238,106.306847 316.723785,106.303131 \n C344.362183,106.288246 372.000549,106.289101 399.638947,106.302231 \n C407.041901,106.305756 408.998962,108.322479 409.000549,115.867424 \n C409.006287,143.339310 409.007416,170.811203 408.999725,198.283096 \n C408.997681,205.585556 406.866913,207.690491 399.460052,207.698898 \n C386.473297,207.713654 373.486572,207.703018 359.999786,207.703033 \nz"}),c=(0,t.jsx)("path",{fill:"#010101",opacity:"1.000000",stroke:"none",d:"\nM307.835571,273.000092 \n C307.835541,282.323547 307.870728,291.147125 307.824036,299.970306 \n C307.788635,306.663483 305.475708,308.987030 298.810791,308.992523 \n C271.008698,309.015533 243.206589,309.013367 215.404510,308.994232 \n C208.657730,308.989594 206.319443,306.731720 206.311646,300.085968 \n C206.279022,272.283936 206.281433,244.481796 206.309784,216.679733 \n C206.316681,209.920135 208.539688,207.710327 215.289017,207.704651 \n C243.091080,207.681274 270.893219,207.678146 298.695282,207.706848 \n C305.624878,207.714005 307.816620,209.980988 307.826691,217.062424 \n C307.852997,235.541595 307.835571,254.020844 307.835571,273.000092 \nz"}),l=(0,t.jsx)("path",{fill:"#000000",opacity:"1.000000",stroke:"none",d:"\nM206.295914,362.000214 \n C206.295898,375.320709 206.316681,388.141205 206.287842,400.961578 \n C206.271317,408.301575 204.391434,410.278137 197.225494,410.28
176896 \n C169.420135,410.320862 141.614655,410.324066 113.809303,410.283661 \n C107.071625,410.273865 105.008606,408.084229 105.005539,401.236053 \n C104.993156,373.597137 104.992844,345.958252 105.005447,318.319336 \n C105.008812,310.947021 107.017197,309.005066 114.577332,309.003113 \n C141.883240,308.996155 169.189148,308.997620 196.495056,309.002045 \n C204.582611,309.003357 206.287186,310.746338 206.293137,319.042847 \n C206.303299,333.195282 206.295914,347.347748 206.295914,362.000214 \nz"}),u=(0,t.jsx)("path",{fill:"#000000",opacity:"1.000000",stroke:"none",d:"\nM405.653137,310.005554 \n C407.022522,312.515839 408.854675,314.844818 408.871033,317.186523 \n C409.069275,345.504791 409.017090,373.824921 408.985138,402.144501 \n C408.978577,407.959930 406.739746,410.257874 400.782715,410.270630 \n C372.463196,410.331268 344.143433,410.336578 315.823975,410.265076 \n C309.704224,410.249603 307.727783,408.170410 307.718475,402.041626 \n C307.675659,373.888641 307.672699,345.735504 307.720886,317.582550 \n C307.731995,311.087433 309.933502,309.011780 316.488922,309.007721 \n C344.308807,308.990540 372.128693,308.985260 399.948486,309.035950 \n C401.723541,309.039185 403.497650,309.553558 405.653137,310.005554 \nz"}),h[3]=i,h[4]=o,h[5]=s,h[6]=c,h[7]=l,h[8]=u):(i=h[3],o=h[4],s=h[5],c=h[6],l=h[7],u=h[8]),h[9]!==r?(d=(0,t.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"32px",height:"32px",viewBox:"0 0 512 513","enable-background":"new 0 0 512 513",style:a,...r,children:[i,o,s,c,l,u]}),h[9]=r,h[10]=d):d=h[10],d},h=e=>{let r,a,i,o,s,c=(0,n.c)(7);return c[0]!==e?({...r}=e,c[0]=e,c[1]=r):r=c[1],c[2]===Symbol.for("react.memo_cache_sentinel")?(a={borderRadius:"27.5%"},c[2]=a):a=c[2],c[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("rect",{width:"512",height:"512",fill:"#001F29"}),o=(0,t.jsx)("path",{d:"M219.948 95.7022C201.623 95.6929 183.33 95.6835 164.941 95.7116C153.822 95.7116 149.651 109.671 157.921 117.939L283.098 243.117C287.004 246.69 289.441 250.574 289.53 255.693C289.441 260.812 287.004 264.696 283.098 268.269L157.921 393.446C149.651 401.715 153.822 415.674 164.941 415.674C183.33 415.702 201.623 415.693 219.948 415.683C229.122 415.679 238.305 415.674 247.511 415.674C259.555 415.674 266.72 409.24 273.154 402.805L386.047 289.912C395.057 280.902 403.119 268.939 403.009 255.693C403.119 242.447 395.057 230.484 386.047 221.474L273.154 108.58C266.72 102.146 259.555 95.7116 247.511 95.7116C238.305 95.7116 229.122 95.7069 219.948 95.7022Z",fill:"#00F0FF"}),c[3]=i,c[4]=o):(i=c[3],o=c[4]),c[5]!==r?(s=(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:a,...r,children:[i,o]}),c[5]=r,c[6]=s):s=c[6],s},f=e=>{let r,a,i,o,s,c=(0,n.c)(11);c[0]!==e?({background:a,...r}=e,c[0]=e,c[1]=r,c[2]=a):(r=c[1],a=c[2]);let l=void 0!==a&&a;c[3]!==l?(i=l?{background:"#AB9FF2",borderRadius:"27.5%"}:void 0,c[3]=l,c[4]=i):i=c[4];let u=l?"#ffffff":"currentColor";return c[5]!==u?(o=(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.7425 57.0705C34.1942 62.3362 28.2483 69 20.3366 69C16.5965 69 13.0001 67.5093 13 61.0322C12.9997 44.5362 36.2555 19.0003 57.8334 19C70.1084 18.9998 75 27.2474 75 36.6136C75 48.6357 66.9442 62.3824 58.9368 62.3824C56.3955 62.3824 55.1487 61.031 55.1487 58.888C55.1487 58.3288 55.2442 57.7228 55.4365 57.0705C52.7029 61.5902 47.4285 65.7849 42.4896 65.7849C38.8933 65.7849 37.0713 63.5944 37.0713 60.5187C37.0713 59.4003 37.311 58.2357 37.7425 57.0705ZM53.7586 31.6834C51.8054 31.6868 50.4738 33.2938 50.478 35.5864C50.4822 37.879 51.8198 39.5273 53.7729 39.5241C55.6789 39.5208 57.0099 37.8679 57.0058 35.5752C57.0016 33.2827 55.6646 31.6802 53.7586 31.6834ZM64.1193 31.6725C62.1661 31.6759 60.8345 33.2829 60.8387 35.5755C60.8429 37.868 62.1798 39.5164 64.1336 39.5131C66.0396 39.5099 67.3706 37.8569 67.3664 35.5643C67.3622 33.2718 66.0253 31.6693 64.1193 31.6725Z",fill:u}),c[5]=u,c[6]=o):o=c[6],c[7]!==r||c[8]!==i||c[9]!==o?(s=(0,t.jsx)("svg",{width:"32",height:"32",viewBox:"0 0 88 88",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:i,...r,children:o}),c[7]=r,c[8]=i,c[9]=o,c[10]=s):s=c[10],s}
17,p=e=>{let r,a,i,o=(0,n.c)(5);return o[0]!==e?({...r}=e,o[0]=e,o[1]=r):r=o[1],o[2]===Symbol.for("react.memo_cache_sentinel")?(a={backgroundSize:"100% 100%",backgroundImage:'url("/images/logos/trust.svg")'},o[2]=a):a=o[2],o[3]!==r?(i=(0,t.jsx)("svg",{width:"32",height:"32",viewBox:"0 0 180 180",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:a,...r}),o[3]=r,o[4]=i):i=o[4],i},g=()=>({name:"Bitget Wallet",shortName:"Bitget",icon:(0,t.jsx)(h,{}),connectorIcon:(0,t.jsx)(h,{}),iconShouldShrink:!0,iconShape:"squircle",downloadUrls:{website:"https://web3.bitget.com",chrome:"https://chromewebstore.google.com/detail/bitget-wallet-formerly-bi/jiidiaalihmmhddjgbnbgdfflelocpak",ios:"https://apps.apple.com/us/app/bitget-wallet-bitcoin-crypto/id1395301115",android:"https://play.google.com/store/apps/details?id=com.bitkeep.wallet"},enabled:!0,order:6,getWalletConnectDeeplink:e=>(0,r.isAndroid)()?e:`bitkeep://wc?uri=${encodeURIComponent(e)}`});e.s(["bitget",0,g],863348);let m=()=>({name:"Coinbase Wallet",shortName:"Coinbase",icon:(0,t.jsx)(c,{background:!0}),connectorIcon:(0,t.jsx)(c,{background:!0}),iconShouldShrink:!0,iconShape:"squircle",downloadUrls:{download:"https://www.coinbase.com/en-ca/wallet/downloads",website:"https://www.coinbase.com/wallet/getting-started-extension",android:"https://play.google.com/store/apps/details?id=org.toshi",ios:"https://apps.apple.com/app/coinbase-wallet-store-crypto/id1278383455",chrome:"https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad"},enabled:!0,getWalletConnectDeeplink:e=>`https://go.cb-w.com/wc?uri=${encodeURIComponent(e)}`,shouldDeeplinkDesktop:!1,order:2}),y=()=>({name:"OKX Wallet",shortName:"OKX",icon:(0,t.jsx)(d,{}),connectorIcon:(0,t.jsx)(d,{}),iconShouldShrink:!0,iconShape:"squircle",downloadUrls:{website:"https://www.okx.com",chrome:"https://chromewebstore.google.com/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge?hl=en",ios:"https://apps.apple.com/us/app/okx-buy-bitcoin-eth-crypto/id1327268470",android:"https://play.google.com/store/apps/details?id=com.okinc.okex.gp"},enabled:!0,order:5,getWalletConnectDeeplink:e=>`okex://main/wc?uri=${encodeURIComponent(e)}`});e.s(["okx",0,y],251701);let w=()=>({name:"Rabby Wallet",shortName:"Rabby",icon:(0,t.jsx)(l,{}),connectorIcon:(0,t.jsx)(l,{}),iconShouldShrink:!0,iconShape:"squircle",downloadUrls:{download:"https://rabby.io",website:"https://rabby.io",chrome:"https://chrome.google.com/webstore/detail/rabby-wallet/acmacodkjbdgmoleebolmdjonilkdbch"},enabled:!0,preventDeeplinkIfNotInstalled:!0,order:3});e.s(["rabby",0,w],641483);let v={"coinbaseWallet, coinbaseWalletSDK":m(),"com.coinbase.wallet":m(),"com.bitget.web3":g(),"com.okex.wallet":y(),injected:{name:"Browser Wallet",shortName:"Browser",icon:(0,t.jsx)(e=>{let r,a,i,o=(0,n.c)(5);return o[0]!==e?({...r}=e,o[0]=e,o[1]=r):r=o[1],o[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6505 3.64041C15.6501 3.64062 15.6497 3.64083 15.6493 3.64103L6.05165 8.43985L16.2501 13.5391L26.4484 8.43987L16.8508 3.64103C16.8504 3.64083 16.85 3.64063 16.8496 3.64043C16.6632 3.54806 16.458 3.5 16.25 3.5C16.042 3.5 15.8369 3.54806 15.6505 3.64041ZM28 10.4592L17.5001 15.7091L17.5 28.5205L27.248 23.6465L27.2508 23.6452C27.4757 23.5334 27.665 23.3611 27.7973 23.1477C27.9297 22.9342 27.9999 22.6881 28 22.4369V10.4592ZM15 28.527L15.0001 15.7091L4.50006 10.4591V22.4333C4.49831 22.6849 4.56687 22.9319 4.69807 23.1466C4.82896 23.3608 5.01696 23.5342 5.24095 23.6475C5.24148 23.6477 5.242 23.648 5.24253 23.6483L15 28.527ZM14.5207 31.0824L4.12104 25.8826L4.11759 25.8809C3.47681 25.558 2.93902 25.0625 2.56486 24.4502C2.19154 23.8394 1.99597 23.1365 2.00006 22.4207V10.0486C2.00044 9.33234 2.20062 8.62972 2.5781 8.021C2.95529 7.41274 3.49457 6.92167 4.13537 6.60291C4.13585 6.60267 4.13633 6.60243 4.13681 6.60219L14.534 1.40359L14.5368 1.40221C15.0692 1.13767 15.6556 1 16.25 1C16.8445 1 17.4309 1.13767 17.9633 1.40221L17.966 1.40358L28.3633 6.60219C28.3638 6.60245 28.3643 6.6027 28.3648 6.60295C29.0055 6.92171 29.5448 7.41276 29.922 8.021C30.2994 8.62973 30.4996 9.33168 30.5 10.0479V22.4376C30.4996 23.1538 30.2994 23.8565 29.922 24.4652C29.5448 25.0734 29.0056 25.5644 28.365 25.8831C28.3644 25.8834 28.3638 25.8837 28.3633 25.884L17.9664 31.0824C17.9663 31.0825 17.9665 31.0824 17.9664 31.0824C17.4316 31.3499 16.8415 31.4894 16.2435 31.4894C15.6455 31.4894 15.0554 31.3499 14.5207 31.0824C14.5205 31.0824 14.5208 31.0825 14.5207 31.0824Z",fill:"#CCCCCC"}),o[2]=a):a=o[2],o[3]!==r?(i=(0,t.jsx)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:a}),o[3]=r,o[4]=i):i=o[4],i},{}),iconShouldShrink:!0,iconShape:"squircle"},magic:{name:"Magic",icon:(0,t.jsx)(u,{}),connectorIcon:(0,t.jsx)(u,{}),iconShouldShrink:!0,iconShape:"squircle",enabled:!0,isInstalled:!0},"metaMask, metaMask-io, io.metamask, io.metamask.mobile, metaMaskSDK":{name:"MetaMask",icon:(0,t.jsx)(s,{}),connectorIcon:(0,t.jsx)(s,{}),iconShouldShrink:!1,iconShape:"squircle",downloadUrls:{download:"https://metamask.io/download/",website:"https://metamask.io/",android:"https://play.google.com/store/apps/details?id=io.metamask",ios:"https://apps.apple.com/app/metamask/id1438144202",chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",firefox:"https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/",brave:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",edge:"https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm"},enabled:!0,getWalletConnectDeeplink:e=>`https://metamask.app.link/wc?uri=${encodeURIComponent(e)}`,order:1},"app.phantom, phantom":{name:"Phantom",icon:(0,t.jsx)(f,{background:!0}),connectorIcon:(0,t.jsx)(f,{background:!0}),iconShouldShrink:!0,iconShape:"squircle",enabled:!0,downloadUrls:{download:"https://phantom.app/download/",website:"https://phantom.app/",android:"https://play.google.com/store/apps/details?id=app.phantom",ios:"https://apps.apple.com/app/phantom-solana-wallet/1598432977",chrome:"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa",edge:"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa",brave:"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa"},order:4,getWalletConnectDeeplink:e=>{let t=encodeURIComponent("https://polymarket.com"),r=encodeURIComponent(window.location.href);return`https://phantom.app/ul/browse/${t}?ref=${r}`},shouldDeeplinkDesktop:!1},"me.rainbow":{name:"Rainbow Wallet",shortName:"Rainbow",icon:(0,t.jsx)(e=>{let r,o,s,c,l=(0,n.c)(7);l[0]!==e?({round:o,...r}=e,l[0]=e,l[1]=r,l[2]=o):(r=l[1],o=l[2]);let u=void 0!==o&&o?a:i;return l[3]===Symbol.for("react.memo_cache_sentinel")?(s={borderRadius:"8px"},l[3]=s):s=l[3],l[4]!==u||l[5]!==r?(c=(0,t.jsx)(u,{width:32,height:32,style:s,...r}),l[4]=u,l[5]=r,l[6]=c):c=l[6],c},{}),iconShouldShrink:!0,iconShape:"squircle",downloadUrls:{download:"https://rainbow.me/?utm_source=polymarket",website:"https://rainbow.me/?utm_source=connectkit",android:"https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Dconnectkit&utm_source=connectkit",ios:"https://apps.apple.com/app/rainbow-ethereum-wallet/id1457119021?pt=119997837&ct=connectkit&mt=8",chrome:"https://rainbow.me/extension?utm_source=connectkit",edge:"https://rainbow.me/extension?utm_source=connectkit",brave:"https://rainbow.me/extension?utm_source=connectkit"},enabled:!0,getWalletConnectDeeplink:e=>(0,r.isAndroid)()?e:`https://rnbwapp.com/wc?uri=${encodeURIComponent(e)}&connector=polymarket`},"io.rabby, rabby":w(),"com.trustwallet.app":{name:"Trust Wallet",shortName:"Trust",icon:(0,t.jsx)(p,{}),connectorIcon:(0,t.jsx)("span",{className:"block",style:{transform:"scale(1.25)"},children:(0,t.jsx)(p,{})}),iconShouldShrink:!0,iconShape:"squircle",downloadUrls:{download:"https://trustwallet.com/download",android:"https://play.google.com/store/apps/details?id=com.wallet.crypto.trustapp",ios:"https://apps.apple.com/app/trust-crypto-bitcoin-wallet/id1288339409",chrome:"https://chromewebstore.google.com/detail/trust-wallet/egjidjbpglich
17dcondbcbdnbeeppgdph"},enabled:!0,getWalletConnectDeeplink:e=>(0,r.isAndroid)()?e:`https://link.trustwallet.com/wc?uri=${encodeURIComponent(e)}`},walletConnect:{name:"WalletConnect",shortName:"WalletConnect",icon:(0,t.jsx)(o,{}),connectorIcon:(0,t.jsx)(o,{height:"42",width:"42",style:{position:"relative",top:"-5px",left:"-5px"}}),iconShouldShrink:!0,iconShape:"squircle",enabled:!0,getWalletConnectDeeplink:e=>e,order:4}};e.s(["walletConfigs",0,v],966516)},842757,e=>{"use strict";var t=e.i(846574),r=e.i(45806);let n=new Set,a=!1,i=new WeakSet;function o(e){let t=window.history[e];if(i.has(t))return;let r=function(...e){let r=t.apply(this,e);return a||0===n.size||(a=!0,queueMicrotask(()=>{for(let e of(a=!1,n))e()})),r};i.add(r),window.history[e]=r}function s(e){return n.add(e),o("pushState"),o("replaceState"),window.addEventListener("popstate",e),()=>{n.delete(e),window.removeEventListener("popstate",e)}}function c(){return window.location.search}function l(){return`${window.location.search}${window.location.hash}`}function u(){return""}e.s(["pushShallowUrl",0,function(e){window.history.pushState(null,"",e)},"replaceShallowUrl",0,function(e){window.history.replaceState(null,"",e)},"useHydrationSafeSearchParams",0,function(){let e,n=(0,t.c)(2),a=(0,r.useSyncExternalStore)(s,c,u);return n[0]!==a?(e=new URLSearchParams(a),n[0]=a,n[1]=e):e=n[1],e},"useWindowSearchAndHash",0,function(){return(0,r.useSyncExternalStore)(s,l,u)}])},318594,e=>{"use strict";var t=e.i(668168),r=e.i(681663);let n=async(e,n)=>{let a;if(!(0,t.isCoinbaseWalletConnector)(e?.id))return!1;try{a=await e?.getProvider?.()}catch(t){r.logger.warn("[isCoinbaseSmartWalletConnection] getProvider failed",{connectorId:e?.id,error:t instanceof Error?t.message:String(t)}),a=void 0}if(!a)return!1;if("scw_connection_type"===a.connectionType)return!0;if("extension_connection_type"===a.connectionType||!n||!a.request)return!1;try{let e=await a.request({method:"wallet_getCapabilities",params:[n]});return!!e&&"object"==typeof e&&Object.keys(e).length>0}catch(o){let t=o.code,n=o instanceof Error?o.message:String(o),a=4200===t||-32601===t||/unsupported|not support|not found/i.test(n),i={connectorId:e?.id,code:t,error:n};return a?r.logger.debug("[isCoinbaseSmartWalletConnection] wallet_getCapabilities unsupported",i):r.logger.warn("[isCoinbaseSmartWalletConnection] wallet_getCapabilities probe failed",i),!1}};e.s(["isCoinbaseSmartWalletConnection",0,n])},840733,166533,e=>{"use strict";e.s(["hasField",0,(e,t)=>null!=e&&"object"==typeof e&&Object.hasOwn(e,t)],840733),e.s(["safeSerialize",0,e=>{if(null!=e){if("string"==typeof e)return e;try{let t=new WeakSet;return JSON.stringify(e,(e,r)=>{if("bigint"==typeof r)return r.toString();if("object"==typeof r&&null!==r){if(t.has(r))return"[Circular Reference]";t.add(r)}return r})}catch{return String(e)}}}],166533)},871971,254094,333650,841105,286191,426200,83246,307014,e=>{"use strict";let t,r;var n,a,i,o=e.i(45806);function s(){return"u">typeof window&&window.dubAnalytics}e.s(["Analytics",0,function(e){return(0,o.useEffect)(()=>{!function(e){var t,r,n,a,i,o;if(!("u">typeof window))return;o="dubAnalytics",(i=window)[o]=i[o]||function(){(i[o].q=i[o].q||[]).push(arguments)},["trackClick","trackLead","trackSale"].forEach(function(e){i[o][e]=function(){(i[o].q=i[o].q||[]).push([e,...Array.from(arguments)])}});let s="https://www.dubcdn.com/analytics/script",c=[];(null==(t=e.domainsConfig)?void 0:t.site)&&c.push("site-visit"),(null==(r=e.domainsConfig)?void 0:r.outbound)&&c.push("outbound-domains"),e.publishableKey&&c.push("conversion-tracking");let l=(null==(n=e.scriptProps)?void 0:n.src)||(c.length>0?`${s}.${c.join(".")}.js`:`${s}.js`);if(document.head.querySelector(`script[src*="${l}"]`))return;let u=document.createElement("script");if(u.src=l,u.defer=(null==(a=e.scriptProps)?void 0:a.defer)??!0,u.setAttribute("data-sdkn","@dub/analytics"),u.setAttribute("data-sdkv","0.0.32"),e.apiHost&&u.setAttribute("data-api-host",e.apiHost),e.publishableKey&&u.setAttribute("data-publishable-key",e.publishableKey),e.domainsConfig&&u.setAttribute("data-domains",JSON.stringify(e.domainsConfig)),e.shortDomain&&u.setAttribute("data-short-domain",e.shortDomain),e.attributionModel&&u.setAttribute("data-attribution-model",e.attributionModel),e.cookieOptions&&Object.keys(e.cookieOptions).length>0&&u.setAttribute("data-cookie-options",JSON.stringify(e.cookieOptions)),e.queryParam&&u.setAttribute("data-query-param",e.queryParam),e.queryParams&&u.setAttribute("data-query-params",JSON.stringify(e.queryParams)),e.scriptProps){let{src:t,...r}=e.scriptProps;Object.assign(u,r)}u.onerror=()=>{console.log(`[Dub Web Analytics] failed to load script from ${l}.`)},document.head.appendChild(u)}(e)},[e]),null},"useAnalytics",0,function(){let[e,t]=(0,o.useState)({partner:null,discount:null}),r=(0,o.useCallback)(()=>{s()&&window.dubAnalytics("ready",()=>{let{partner:e=null,discount:r=null}=window.DubAnalytics||{};t({partner:e,discount:r})})},[]),n=(0,o.useCallback)(e=>{s()&&window.dubAnalytics.trackClick(e)},[]),a=(0,o.useCallback)(e=>{s()&&window.dubAnalytics.trackLead(e)},[]),i=(0,o.useCallback)(e=>{s()&&window.dubAnalytics.trackSale(e)},[]);return(0,o.useEffect)(()=>{r()},[r]),{...e,trackClick:n,trackLead:a,trackSale:i}}],871971);var c=e.i(303115),l=e.i(846574);let u=Symbol("analytics-bind"),d=(0,o.createContext)(void 0);d.displayName="AnalyticsContext",e.s(["AnalyticsProvider",0,function(e){let t,r,n=(0,l.c)(8),{analytics:a,context:i,children:o}=e;if(n[0]!==a||n[1]!==i){let e;n[3]!==i?(e=i??{},n[3]=i,n[4]=e):e=n[4],t=a[u](e),n[0]=a,n[1]=i,n[2]=t}else t=n[2];let s=t;return n[5]!==s||n[6]!==o?(r=(0,c.jsx)(d,{value:s,children:o}),n[5]=s,n[6]=o,n[7]=r):r=n[7],r}],254094),e.s(["useAnalytics",0,function(e){let t=(0,l.c)(4),r=(0,o.useContext)(d);if(r)return r;if(e){let r;return t[0]!==e.emit||t[1]!==e.identify||t[2]!==e.route?(r={emit:e.emit,route:e.route,identify:e.identify},t[0]=e.emit,t[1]=e.identify,t[2]=e.route,t[3]=r):r=t[3],r}throw Error("useAnalytics requires an AnalyticsProvider or configured fallback")}],333650),e.s(["BrowserAnalyticsAdapterEnum",0,{GoogleAnalytics:"GoogleAnalytics",AmplitudeAnalytics:"AmplitudeAnalytics"}],841105);var h=e.i(332124),f=e.i(95718),p=e.i(681663),g=((n=g||{}).CLICK="click",n.TRADE="trade",n.TRANSACTION="transaction",n);e.s(["GAEventAction",()=>g],286191);var m=e.i(50493);class y extends m.BaseAnalyticsAdapter{userProperties={};constructor(){super("true"===h.default.env.NEXT_PUBLIC_GA_DEBUG)}
17sendData(e){(0,f.sendGTMEvent)(e)}sendEvent(e,t){this.sendData({...t,event:e})}initializeAdapter(){this.debug&&p.logger.debug("[GoogleAnalyticsAdapter > initializeAdapter]",{config:{enabled:this.adapterEnabled,debug:this.debug,testMode:this.testMode}}),this.adapterEnabled&&(this.adapterInitialized=!0)}linkUser(e){this.debug&&p.logger.debug("[GoogleAnalyticsAdapter > linkUser]",{params:{proxyAddress:e},config:{enabled:this.adapterEnabled,debug:this.debug,testMode:this.testMode}}),this.adapterEnabled&&(this.sendData({user_id:e}),this.setUserProperty("user_id",e))}setUserProperties(e){this.debug&&p.logger.debug("[GoogleAnalyticsAdapter > setUserProperties]",{properties:e,config:{enabled:this.adapterEnabled,debug:this.debug,testMode:this.testMode}}),this.adapterEnabled&&(Object.assign(this.userProperties,e),this.sendData({user_properties:e}))}setUserProperty(e,t){this.setUserProperties({[e]:t})}trackGA4Event(e,t){if(this.debug&&p.logger.debug("[GoogleAnalyticsAdapter > trackGA4Event]",{params:{eventName:e,params:t},config:{enabled:this.adapterEnabled,debug:this.debug,testMode:this.testMode}}),this.adapterEnabled){let r={...t,...this.userProperties};this.sendEvent(e,r)}}trackEvent(e,t){this.debug&&p.logger.debug("[GoogleAnalyticsAdapter > trackEvent]",{params:{eventName:e,params:t},config:{enabled:this.adapterEnabled,debug:this.debug,testMode:this.testMode}}),this.adapterEnabled&&this.sendEvent(e,t)}trackClickEvent(e){this.debug&&p.logger.debug("[GoogleAnalyticsAdapter > trackClickEvent]",{params:{elementName:e},config:{enabled:this.adapterEnabled,debug:this.debug,testMode:this.testMode}}),this.adapterEnabled&&this.trackEvent(g.CLICK,{element_name:e})}trackPageView(e){this.debug&&p.logger.debug("[GoogleAnalyticsAdapter > trackPageView]",{params:{url:e},config:{enabled:this.adapterEnabled,debug:this.debug,testMode:this.testMode}}),this.adapterEnabled&&this.sendEvent("page_view",{page_path:e,page_location:window.location.href})}}e.s(["GoogleAnalyticsAdapter",0,y],426200);let w=()=>void 0,v=[["email",(e,t)=>e.setEmail(t)],["phone",(e,t)=>e.setPhoneNumber(t)],["first_name",(e,t)=>e.setFirstName(t)],["last_name",(e,t)=>e.setLastName(t)]],b=["user_id","polymarket_wallet_id","external_wallet_id","external_id","username","bio","x_handle","first_utm_source","first_utm_medium","first_utm_campaign","first_utm_content","first_utm_term","utm_source","utm_medium","utm_campaign","utm_content","utm_term","twclid","fbclid","gclid","gbraid","wbraid"];function C(e){return e?.trim()||void 0}let S={externalId:"pm_eid",identity:"polymarket.braze.identity.v1"},_={externalId:"pm_eid",firstTouch:"pm_attr_first",lastTouch:"pm_attr_last",clickIds:{fbclid:"_fbc",ttclid:"pm_ttclid",twclid:"pm_twclid",sccid:"pm_sccid",rdt_cid:"pm_rdt_cid",gclid:"pm_gclid",gbraid:"pm_gbraid",wbraid:"pm_wbraid",msclkid:"pm_msclkid",fbc:"_fbc",fbp:"_fbp",ttp:"_ttp",scid:"_scid",rdt_uuid:"_rdt_uuid"}};function A(e){return{...S,...e?.localStorageKeys}}function E(e){return{..._,...e?.cookieKeys,clickIds:{..._.clickIds,...e?.cookieKeys?.clickIds}}}function I(){try{return window.localStorage}catch{return}}function k(e){return"string"==typeof e&&e.trim().length>0?e:void 0}function x(e){let t=I();if(t)try{let r=t.getItem(A(e).identity);return r?function(e){try{let t=JSON.parse(e);if(!t||"object"!=typeof t||Array.isArray(t)||1!==t.version)return;let r=k(t.active_user_id),n=k(t.user_id),a=k(t.polymarket_wallet_id);if(!r||!n||!a)return;let i=k(t.external_wallet_id);return{version:1,active_user_id:r,user_id:n,polymarket_wallet_id:a,...i&&{external_wallet_id:i}}}catch{return}}(r):void 0}catch{return}}var P=e.i(734804);function R(e){let t=e.indexOf(".");if(t<=0)return null;let r=Number(e.slice(0,t)),n=e.slice(t+1);return Number.isFinite(r)&&!(r<=0)&&n?{ts:r,value:n}:null}function T(e){let t=e.split(".");if(t.length<4||"fb"!==t[0])return null;let r=Number(t[2]),n=t.slice(3).join(".");return Number.isFinite(r)&&!(r<=0)&&n?{ts:r,value:n}:null}let D=/^[A-Za-z0-9_.-]+$/;function O(e){var t;let r=E(e),n={},a=new URLSearchParams(window.location.search);for(let e of[{param:"fbclid",cookie:r.clickIds.fbclid,key:"fbclid",parse:T},{param:"ttclid",cookie:r.clickIds.ttclid,key:"ttclid",parse:R}
17,{param:"twclid",cookie:r.clickIds.twclid,key:"twclid",parse:R},{param:"ScCid",cookie:r.clickIds.sccid,key:"sccid",parse:R},{param:"rdt_cid",cookie:r.clickIds.rdt_cid,key:"rdt_cid",parse:R},{param:"gclid",cookie:r.clickIds.gclid,key:"gclid",parse:R},{param:"gbraid",cookie:r.clickIds.gbraid,key:"gbraid",parse:R},{param:"wbraid",cookie:r.clickIds.wbraid,key:"wbraid",parse:R},{param:"msclkid",cookie:r.clickIds.msclkid,key:"msclkid",parse:R}]){let r=a.get(e.param);if(r&&(t=r).length>0&&t.length<=512&&D.test(t)){n[e.key]=r;continue}let i=P.default.get(e.cookie),o=i?e.parse(i):null;o&&(n[e.key]=o.value)}let i=P.default.get(r.clickIds.fbc);i&&function(e){let t=e.split(".");if(t.length<4||"fb"!==t[0])return!1;let r=Number(t[2]);return Number.isFinite(r)&&r>0&&Date.now()-r<7776e6}(i)&&(n.fbc=i);let o=P.default.get(r.clickIds.fbp);o&&(n.fbp=o);let s=P.default.get(r.clickIds.ttp);s&&(n.ttp=s);let c=P.default.get(r.clickIds.scid);c&&(n.scid=c);let l=P.default.get(r.clickIds.rdt_uuid);return l&&(n.rdt_uuid=l),n}function M(e){let t=P.default.get(e);if(t)try{let e=JSON.parse(t);if(!e||"object"!=typeof e||Array.isArray(e))return;return e}catch{return}}function L(e){let t=E(e).externalId,r=A(e).externalId,n=P.default.get(t);if(n){try{window.localStorage?.setItem(r,n)}catch{}return n}try{let e=window.localStorage?.getItem(r);if(!e)return;return P.default.set(t,e,{expires:400,path:"/",sameSite:"lax"}),e}catch{return}}function U(e){return"string"==typeof e&&e.trim().length>0?e:void 0}function N(e){let t=M(E(e).lastTouch);if(!t)return{};let r=U(t.utm_source),n=U(t.utm_medium),a=U(t.utm_campaign),i=U(t.utm_content),o=U(t.utm_term);return{...r&&{utm_source:r},...n&&{utm_medium:n},...a&&{utm_campaign:a},...i&&{utm_content:i},...o&&{utm_term:o}}}function j(){return e=>({wireName:e})}let K={deposit_initiated:j()("client_deposit_initiated"),withdrawal_initiated:j()("client_withdrawal_initiated"),trade_started:j()("client_trade_started"),session_started:j()("client_session_started"),page_viewed:j()("page_viewed"),screen_viewed:j()("screen_viewed"),event_detail_viewed:j()("client_event_detail_viewed"),category_viewed:j()("client_category_viewed"),subcategory_viewed:j()("client_subcategory_viewed"),market_viewed:j()("client_market_viewed"),chat_viewed:j()("client_chat_viewed"),profile_viewed:j()("client_profile_viewed"),order_book_viewed:j()("client_order_book_viewed"),activity_viewed:j()("client_activity_viewed"),leaderboard_viewed:j()("client_leaderboard_viewed"),dashboard_viewed:j()("client_dashboard_viewed"),settings_viewed:j()("client_settings_viewed"),resolution_clicked:j()("client_resolution_clicked"),category_clicked:j()("client_category_clicked"),subcategory_clicked:j()("client_subcategory_clicked"),market_clicked:j()("client_market_clicked"),odds_clicked:j()("client_odds_clicked"),historical_timeframe_clicked:j()("client_historical_timeframe_clicked"),order_type_clicked:j()("client_order_type_clicked"),order_book_side_clicked:j()("client_order_book_side_clicked"),quick_amount_clicked:j()("client_quick_amount_clicked"),search_clicked:j()("client_search_clicked"),settings_clicked:j()("client_settings_clicked"),share_clicked:j()("client_share_clicked"),spread_clicked:j()("client_spread_clicked"),spread_scrubbed:j()("client_spread_scrubbed"),total_clicked:j()("client_total_clicked"),total_scrubbed:j()("client_total_scrubbed"),market_shared:j()("client_market_shared"),waitlist_landing_viewed:j()("US Waitlist Landing")};function W(e,t){return e.environments?.includes(t)??!0}function F(e,t){return void 0===t||(Array.isArray(t)?t:[t]).includes(e.id)}function q(e,t){let r=e.queue.then(async()=>{let r=await function(e){if(e.transport)return e.transport;let t=Promise.resolve().then(e.definition.create);return e.transport=t,t.catch(()=>{e.transport===t&&(e.transport=void 0)}),t}(e);r&&await t(r)});return e.queue=r.catch(()=>void 0),e.queue}async function $(e,t,r){let n={};for(let a of e)if(a.context&&W(a,r))try{Object.assign(n,await a.context(t))}catch{continue}return n}async function G(e,t,r,n){let a={};for(let i of e)if(i.identify&&W(i,n))try{Object.assign(a,await i.identify(t,r))}catch{continue}return{...a,...r,user_id:t}}function B(e,t){return"string"==typeof e?{name:e,parameters:t}:{name:e.name,parameters:"parameters"in e?e.parameters:void 0}}Object.freeze(Object.fromEntries(Object.entries(K).map(([e,t])=>[e,t.wireName])));var H=e.i(364331),Q=e.i(202597);let J=({scope:e,level:t="error"})=>(0,H.createLogger)({scope:e,level:t,config:{groundcover:{...(0,Q.getGroundcoverRumConfig)(),initialize:!1}}});e.s(["createLogger",0,J],83246);let z=function(e){let t=new Set(e.events);if(t.size!==e.events.length)throw Error("Analytics events must be configured once per application");var r=e.transports;let n=new Set;for(let e of r){if(!e.id||e.id!==e.id.trim())throw Error("Analytics transport IDs must be nonblank and trimmed");if(n.has(e.id))throw Error(`Analytics transport ID "${e.id}" is configured more than once`);n.add(e.id)}var a=e.transports;let i=new Set;for(let e of a)if("singleton"===e.instancePolicy){if(i.has(e.type))throw Error(`Analytics transport type "${e.type}" supports only one instance`);i.add(e.type)}for(let r of e.transports){let e=r.events;if(e){for(let n of e.only??e.except)if(!t.has(n))throw Error(`Analytics transport "${r.id}" configures unsupported event "${n}"`)}}return function(e){let t=new Set(e.events),r=e.plugins??[],n=e.transports.map(e=>({definition:e,queue:Promise.resolve()}));async function a(a,i,o){if(!t.has(a.name))return;let s="browser",c=n.filter(e=>{var t,r;let n;return W(e.definition,s)&&F(e.definition,i?.to)&&(t=e.definition,r=a.name,!1!==(n=t.events)&&(!n||(n.only?n.only.includes(r):!n.except.includes(r))))});if(0===c.length)return;let l=$(r,void 0===a.parameters?{name:a.name}:{name:a.name,parameters:a.parameters},s).then(t=>{let r={...t,...e.context,...o,...i?.context,...e.scope};return{name:a.name,wireName:K[a.name].wireName,parameters:a.parameters,context:r}}
17);await Promise.all(c.map(e=>q(e,async e=>{await e.emit(await l)})))}function i(e){return{emit:(t,r,n)=>"string"!=typeof t?a(B(t),r,e):a(B(t,r),n,e),identify:async function e(t,a={},i){if(!t.trim())return;let o="browser",s=n.filter(e=>W(e.definition,o)&&F(e.definition,i?.to));if(0===s.length)return;let c=G(r,t,a,o);await Promise.all(s.map(e=>q(e,async e=>e.identify(t,await c))))},route:function({title:t,url:r},n){return a(B("page_viewed",{page_title:t,page_url:r}),n,e)}}}return Object.assign(i({}),{[u]:i})}(e)}({events:[],scope:Object.freeze({exchange:"defi",client:"web",platform:"web"}),transports:[(t=C((a={id:"braze",apiKey:"8b371db6-4c91-4701-a1da-78a4f2e968d1",baseUrl:"sdk.iad-07.braze.com",logger:J({scope:"braze"})}).apiKey)??C("8b371db6-4c91-4701-a1da-78a4f2e968d1"),r=C(a.baseUrl)??C("sdk.iad-07.braze.com"),Object.freeze({...i={id:a.id,type:"braze",environments:["browser"],instancePolicy:"singleton",events:!1,create(){if(t&&r){var n;let i,o,s,c;return n={apiKey:t,baseUrl:r,logger:a.logger},c=new Map,{emit:w,async
17identify(t,r){try{let l=await function(){if(i)return i;let t=e.A(897897);return i=t,t.catch(()=>{i===t&&(i=void 0)}),t}();if(!l.isInitialized()&&!l.initialize(n.apiKey,{baseUrl:n.baseUrl,enableLogging:!1,allowUserSuppliedJavascript:!1,doNotLoadFontAwesome:!0}))return;o!==t&&(l.changeUser(t),c.clear(),o=t,s=void 0);var a=l.getUser();if(a){for(let[e,t]of v){let n=r[e];void 0!==n&&c.get(e)!==n&&(t(a,n),c.set(e,n))}for(let e of b){let t=r[e];void 0!==t&&c.get(e)!==t&&(a.setCustomUserAttribute(e,t),c.set(e,t))}}s!==t&&(l.openSession(),s=t)}catch(e){n.logger?.error({title:"Braze identify failed",message:"Braze identify failed",context:{error:e}})}}}}}},instancePolicy:i.instancePolicy??"multiple"}))],plugins:[function(e={}){return{environments:["browser"],context:()=>{var t;let r,n,a,i;return n=L(t=e),a=O(t),i="u"<typeof document?void 0:document.referrer,Object.fromEntries(Object.entries({...!(r=x(t))?{}:{user_id:r.user_id,polymarket_wallet_id:r.polymarket_wallet_id,...r.external_wallet_id&&{external_wallet_id:r.external_wallet_id}},...n&&{external_id:n},...N(t),...a.fbc&&{fbc:a.fbc},...a.fbp&&{fbp:a.fbp},...a.twclid&&{twclid:a.twclid},...a.fbclid&&{fbclid:a.fbclid},...a.gclid&&{gclid:a.gclid},...a.gbraid&&{gbraid:a.gbraid},...a.wbraid&&{wbraid:a.wbraid},...i&&{referring_url:i}}).filter(([,e])=>void 0!==U(e)))},identify(t,r){let n=function(e,t,r={}){let n,a=L(e);return{...a&&{external_id:a},...function(e){let t=M(E(e).firstTouch);if(!t)return{};let r=U(t.utm_source),n=U(t.utm_medium),a=U(t.utm_campaign),i=U(t.utm_content),o=U(t.utm_term);return{...r&&{first_utm_source:r},...n&&{first_utm_medium:n},...a&&{first_utm_campaign:a},...i&&{first_utm_content:i},...o&&{first_utm_term:o}}}(e),...N(e),...{...(n=O(e)).twclid&&{twclid:n.twclid},...n.fbclid&&{fbclid:n.fbclid},...n.gclid&&{gclid:n.gclid},...n.gbraid&&{gbraid:n.gbraid},...n.wbraid&&{wbraid:n.wbraid}},...Object.fromEntries(Object.entries(r).filter(([,e])=>void 0!==U(e))),user_id:t,polymarket_wallet_id:t}}(e,t,r);return!function(e,t,r){let n=k(t);if(!n)return;let a=x(e),i=a?.active_user_id===n,o=k(r.external_wallet_id)??(i?a.external_wallet_id:void 0);!function(e,t){let r=I();if(r)try{r.setItem(A(e).identity,JSON.stringify(t))}catch{return}}(e,{version:1,active_user_id:n,user_id:k(r.user_id)??(i?a.user_id:n),polymarket_wallet_id:k(r.polymarket_wallet_id)??(i?a.polymarket_wallet_id:n),...o&&{external_wallet_id:o}})}(e,t,n),n}}}()]});e.s(["analytics",0,z],307014)},615298,e=>{"use strict";e.i(332124);var t=e.i(792851),r=e.i(224098);function n(e){return e}
17function a(e){return e.state.isPaused}function i(e){return"success"===e.state.status}function o(e){return!0}e.s(["defaultShouldDehydrateQuery",0,i,"dehydrate",0,function(e,t={}){let s=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??a,c=e.getMutationCache().getAll().flatMap(e=>s(e)?[{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}]:[]),l=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??i,u=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors??o,d=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData??n;return{mutations:c,queries:e.getQueryCache().getAll().flatMap(e=>{let t;return l(e)?[{dehydratedAt:Date.now(),state:{...e.state,...void 0!==e.state.data&&{data:d(e.state.data)}},queryKey:e.queryKey,queryHash:e.queryHash,..."pending"===e.state.status&&{promise:(t=e.promise?.then(d).catch(e=>u(e)?Promise.reject(Error("redacted")):Promise.reject(e)),t?.catch(r.noop),t)},...e.meta&&{meta:e.meta},...e.queryType&&{queryType:e.queryType}}]:[]})}},"hydrate",0,function(e,a,i){if("object"!=typeof a||null===a)return;let o=e.getMutationCache(),s=e.getQueryCache(),c=i?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData??n,l=a.mutations||[],u=a.queries||[];l.forEach(({state:t,...r})=>{o.build(e,{...e.getDefaultOptions().hydrate?.mutations,...i?.defaultOptions?.mutations,...r},t)}),u.forEach(({queryKey:n,state:a,queryHash:o,meta:l,promise:u,dehydratedAt:d,queryType:h})=>{let f=u?(0,t.tryResolveSync)(u):void 0,p=void 0===a.data?f?.data:a.data,g=void 0===p?p:c(p),m=s.get(o),y=m?.state.status==="pending",w=m?.state.fetchStatus==="fetching";if(m){let e=f&&void 0!==d&&d>m.state.dataUpdatedAt;if(a.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=a;m.setState({...t,data:g,..."pending"===a.status&&void 0!==g&&{status:"success",dataUpdatedAt:d??Date.now(),...!w&&{fetchStatus:"idle"}}})}}else m=s.build(e,{...e.getDefaultOptions().hydrate?.queries,...i?.defaultOptions?.queries,queryKey:n,queryHash:o,meta:l,_type:h},{...a,data:g,fetchStatus:"idle",status:"pending"===a.status&&void 0!==g?"success":a.status,..."pending"===a.status&&void 0!==g&&{dataUpdatedAt:d??Date.now()}});!u||f||y||w||void 0!==d&&!(d>m.state.dataUpdatedAt)||m.fetch(void 0,{initialPromise:Promise.resolve(u).then(c)}).catch(r.noop)})}])},556356,e=>{"use strict";var t=e.i(224098),r=e.i(722346),n=e.i(351185),a=e.i(903215),i=class extends a.Subscribable{constructor(e={}){super(),this.config=e,this.#r=new Map}#r;build(e,n,a){let i=n.queryKey,o=n.queryHash??(0,t.hashQueryKeyByOptions)(i,n),s=this.get(o);return s||(s=new r.Query({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(n),state:a,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){this.#r.has(e.queryHash)||(this.#r.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#r.get(e.queryHash);t&&(e.destroy(),t===e&&this.#r.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){n.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#r.get(e)}getAll(){return[...this.#r.values()]}find(e){let r={exact:!0,...e};return this.getAll().find(e=>(0,t.matchQuery)(r,e))}findAll(e={}){let r=this.getAll();return Object.keys(e).length>0?r.filter(r=>(0,t.matchQuery)(e,r)):r}notify(e){n.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){n.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){n.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}};e.s(["QueryCache",0,i])},985553,e=>{"use strict";var t=e.i(224098),r=e.i(556356),n=e.i(351185),a=e.i(24189),i=e.i(903215),o=class extends i.Subscribable{constructor(e={}){super(),this.config=e,this.#n=new Set,this.#a=new Map,this.#i=0}#n;#a;#i;build(e,t,r){let n=new a.Mutation({client:e,mutationCache:this,mutationId:++this.#i,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#n.add(e);let t=s(e);if("string"==typeof t){let r=this.#a.get(t);r?r.push(e):this.#a.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#n.delete(e)){let t=s(e);if("string"==typeof t){let r=this.#a.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#a.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=s(e);if("string"!=typeof t)return!0;{let r=this.#a.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=s(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#a.get(t)?.find(t=>
17t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){n.notifyManager.batch(()=>{this.#n.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#n.clear(),this.#a.clear()})}getAll(){return Array.from(this.#n)}find(e){let r={exact:!0,...e};return this.getAll().find(e=>(0,t.matchMutation)(r,e))}findAll(e={}){return this.getAll().filter(r=>(0,t.matchMutation)(e,r))}notify(e){n.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return n.notifyManager.batch(()=>Promise.all(e.map(e=>e.continue().catch(t.noop))))}};function s(e){return e.options.scope?.id}var c=e.i(231884),l=e.i(898689),u=class{#o;#s;#c;#l;#u;#d;#h;#f;constructor(e={}){this.#o=e.queryCache||new r.QueryCache,this.#s=e.mutationCache||new o,this.#c=e.defaultOptions||{},this.#l=new Map,this.#u=new Map,this.#d=0}mount(){this.#d++,1===this.#d&&(this.#h=c.focusManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#o.onFocus())}),this.#f=l.onlineManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#o.onOnline())}))}unmount(){this.#d--,0===this.#d&&(this.#h?.(),this.#h=void 0,this.#f?.(),this.#f=void 0)}isFetching(e){return this.#o.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#s.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#o.get(t.queryHash)?.state.data}ensureQueryData(e){let r=this.defaultQueryOptions(e),n=this.#o.build(this,r),a=n.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime((0,t.resolveStaleTime)(r.staleTime,n))&&this.prefetchQuery(r),Promise.resolve(a))}getQueriesData(e){return this.#o.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,r,n){let a=this.defaultQueryOptions({queryKey:e}),i=this.#o.get(a.queryHash),o=i?.state.data,s=(0,t.functionalUpdate)(r,o);if(void 0!==s)return this.#o.build(this,a).setData(s,{...n,manual:!0})}setQueriesData(e,t,r){return n.notifyManager.batch(()=>this.#o.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#o.get(t.queryHash)?.state}removeQueries(e){let t=this.#o;n.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#o;return n.notifyManager.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,r={}){let a={revert:!0,...r};return Promise.all(n.notifyManager.batch(()=>this.#o.findAll(e).map(e=>e.cancel(a)))).then(t.noop).catch(t.noop)}invalidateQueries(e,t={}){return n.notifyManager.batch(()=>(this.#o.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,r={}){let a={...r,cancelRefetch:r.cancelRefetch??!0};return Promise.all(n.notifyManager.batch(()=>this.#o.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let r=e.fetch(void 0,a);return a.throwOnError||(r=r.catch(t.noop)),"paused"===e.state.fetchStatus?Promise.resolve():r}))).then(t.noop)}fetchQuery(e){let r=this.defaultQueryOptions(e);void 0===r.retry&&(r.retry=!1);let n=this.#o.build(this,r);return n.isStaleByTime((0,t.resolveStaleTime)(r.staleTime,n))?n.fetch(r):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(t.noop).catch(t.noop)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(t.noop).catch(t.noop)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return l.onlineManager.isOnline()?this.#s.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#o}getMutationCache(){return this.#s}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,r){this.#l.set((0,t.hashKey)(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){let r=[...this.#l.values()],n={};return r.forEach(r=>{(0,t.partialMatchKey)(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,r){this.#u.set((0,t.hashKey)(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){let r=[...this.#u.values()],n={};return r.forEach(r=>{(0,t.partialMatchKey)(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let r={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=(0,t.hashQueryKeyByOptions)(r.queryKey,r)),void 0===r.refetchOnReconnect&&(r.refetchOnReconnect="always"!==r.networkMode),void 0===r.throwOnError&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===t.skipToken&&(r.enabled=!1),r}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#o.clear(),this.#s.clear()}};e.s(["QueryClient",0,u],985553)},608114,24189,e=>{"use strict";var t=e.i(45806),r=e.i(351185),n=e.i(863807),a=e.i(952094),i=class extends n.Removable{#p;#g;#s;#m;constructor(e){super(),this.#p=e.client,this.mutationId=e.mutationId,this.#s=e.mutationCache,this.#g=[],this.state=e.state||o(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#g.includes(e)||(this.#g.push(e),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#g=this.#g.filter(t=>t!==e),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#g.length||("pending"===this.state.status?this.scheduleGc():this.#s.remove(this))}continue(){return this.#m?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#y({type:"continue"})},r={client:this.#p,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#m=(0,a.createRetryer)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#y({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#y({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>
17this.#s.canRun(this)});let n="pending"===this.state.status,i=!this.#m.canStart();try{if(n)t();else{this.#y({type:"pending",variables:e,isPaused:i}),this.#s.config.onMutate&&await this.#s.config.onMutate(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#y({type:"pending",context:t,variables:e,isPaused:i})}let a=await this.#m.start();return await this.#s.config.onSuccess?.(a,e,this.state.context,this,r),await this.options.onSuccess?.(a,e,this.state.context,r),await this.#s.config.onSettled?.(a,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(a,null,e,this.state.context,r),this.#y({type:"success",data:a}),a}catch(t){try{await this.#s.config.onError?.(t,e,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,r)}catch(e){Promise.reject(e)}try{await this.#s.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,r)}catch(e){Promise.reject(e)}throw this.#y({type:"error",error:t}),t}finally{this.#s.runNext(this)}}#y(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),r.notifyManager.batch(()=>{this.#g.forEach(t=>{t.onMutationUpdate(e)}),this.#s.notify({mutation:this,type:"updated",action:e})})}};function o(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}e.s(["Mutation",0,i,"getDefaultState",0,o],24189);var s=e.i(903215),c=e.i(224098),l=class extends s.Subscribable{#p;#w=void 0;#v;#b;constructor(e,t){super(),this.#p=e,this.setOptions(t),this.bindMethods(),this.#C()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#p.defaultMutationOptions(e),(0,c.shallowEqualObjects)(this.options,t)||this.#p.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#v,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,c.hashKey)(t.mutationKey)!==(0,c.hashKey)(this.options.mutationKey)?this.reset():this.#v?.state.status==="pending"&&this.#v.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#v?.removeObserver(this)}onMutationUpdate(e){this.#C(),this.#S(e)}getCurrentResult(){return this.#w}reset(){this.#v?.removeObserver(this),this.#v=void 0,this.#C(),this.#S()}mutate(e,t){return this.#b=t,this.#v?.removeObserver(this),this.#v=this.#p.getMutationCache().build(this.#p,this.options),this.#v.addObserver(this),this.#v.execute(e)}#C(){let e=this.#v?.state??o();this.#w={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#S(e){r.notifyManager.batch(()=>{if(this.#b&&this.hasListeners()){let t=this.#w.variables,r=this.#w.context,n={client:this.#p,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#b.onSuccess?.(e.data,t,r,n)}catch(e){Promise.reject(e)}try{this.#b.onSettled?.(e.data,null,t,r,n)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#b.onError?.(e.error,t,r,n)}catch(e){Promise.reject(e)}try{this.#b.onSettled?.(void 0,e.error,t,r,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#w)})})}},u=e.i(820399);e.s(["useMutation",0,function(e,n){let a=(0,u.useQueryClient)(n),[i]=t.useState(()=>new l(a,e));t.useEffect(()=>{i.setOptions(e)},[i,e]);let o=t.useSyncExternalStore(t.useCallback(e=>i.subscribe(r.notifyManager.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),s=t.useCallback((e,t)=>{i.mutate(e,t).catch(c.noop)},[i]);if(o.error&&(0,c.shouldThrowError)(i.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}],608114)},1941,379476,245085,e=>{"use strict";var t,r,n=e.i(654115),a=e.i(151924),i=e.i(109734),o=e.i(925351),s=e.i(776775),c=function(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};
17class l extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return"@wagmi/[email protected]"}constructor(e,r={}){super(),t.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const n=r.cause instanceof l?r.cause.details:r.cause?.message?r.cause.message:r.details,a=r.cause instanceof l&&r.cause.docsPath||r.docsPath;this.message=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...a?[`Docs: ${this.docsBaseUrl}${a}.html${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join("\n"),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=a,this.metaMessages=r.metaMessages,this.shortMessage=e}walk(e){return c(this,t,"m",r).call(this,this,e)}}t=new WeakSet,r=function e(r,n){return n?.(r)?r:r.cause?c(this,t,"m",e).call(this,r.cause,n):r},e.s(["BaseError",0,l],379476);class u extends l{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class d extends l{constructor({address:e,connector:t}){super(`Account "${e}" not found for connector "${t.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class h extends l{constructor({connectionChainId:e,connectorChainId:t}){super(`The current chain of the connector (id: ${t}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class f extends l{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:"During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`. All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored. This error commonly occurs for connectors that asynchronously inject after reconnection has already started."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function p(e,t={}){let r,{assertChainId:n=!0}=t;if(t.connector){let{connector:n}=t;if("reconnecting"===e.state.status&&!n.getAccounts&&!n.getChainId)throw new f({connector:n});let[a,i]=await Promise.all([n.getAccounts().catch(e=>{if(null===t.account)return[];throw e}),n.getChainId()]);r={accounts:a,chainId:i,connector:n}}else r=e.state.connections.get(e.state.current);if(!r)throw new u;let c=t.chainId??r.chainId,l=await r.connector.getChainId();if(n&&l!==c)throw new h({connectionChainId:c,connectorChainId:l});let g=r.connector;if(g.getClient)return g.getClient({chainId:c});let m=(0,s.parseAccount)(t.account??r.accounts[0]);if(m&&(m.address=(0,o.getAddress)(m.address)),t.account&&!r.accounts.some(e=>e.toLowerCase()===m.address.toLowerCase()))throw new d({address:m.address,connector:g});let y=e.chains.find(e=>e.id===c),w=await r.connector.getProvider({chainId:c});return(0,a.createClient)({account:m,chain:y,name:"Connector Client",transport:e=>(0,i.custom)(w)({...e,retryCount:0})})}async function g(e,t){let{account:r,connector:a,...i}=t;return(function(e,t,r){let n=e[t.name];if("function"==typeof n)return n;let a=e[r];return"function"==typeof a?a:r=>t(e,r)})("object"==typeof r&&"local"===r.type?e.getClient():await p(e,{account:r,connector:a}),n.signMessage,"signMessage")({...i,...r?{account:r}:{}})}e.s(["ChainNotConfiguredError",0,class extends l{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}},"ConnectorAccountNotFoundError",0,d,"ConnectorChainMismatchError",0,h,"ConnectorNotConnectedError",0,u,"ConnectorUnavailableReconnectingError",0,f],245085),e.s(["signMessage",0,g],
171941)},480534,763054,e=>{"use strict";e.s(["getChainId",0,function(e){return e.state.chainId}],480534),e.s(["watchChainId",0,function(e,t){let{onChange:r}=t;return e.subscribe(e=>e.chainId,r)}],763054)},462017,e=>{"use strict";e.s(["getConnection",0,function(e){let t=e.state.current,r=e.state.connections.get(t),n=r?.accounts,a=n?.[0],i=e.chains.find(e=>e.id===r?.chainId),o=e.state.status;switch(o){case"connected":return{address:a,addresses:n,chain:i,chainId:r?.chainId,connector:r?.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:o};case"reconnecting":return{address:a,addresses:n,chain:i,chainId:r?.chainId,connector:r?.connector,isConnected:!!a,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:o};case"connecting":return{address:a,addresses:n,chain:i,chainId:r?.chainId,connector:r?.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:o};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:o}}}])},157102,e=>{"use strict";var t=e.i(29504),r=e.i(334705);async function n(e,n){let{allowFailure:a=!0,chainId:i,contracts:o,...s}=n,c=e.getClient({chainId:i});return(0,r.getAction)(c,t.multicall,"multicall")({allowFailure:a,contracts:o,...s})}e.s(["multicall",0,n])},617944,e=>{"use strict";var t=e.i(869e3),r=e.i(334705);e.s(["readContract",0,function(e,n){let{chainId:a,...i}=n,o=e.getClient({chainId:a});return(0,r.getAction)(o,t.readContract,"readContract")(i)}])},380624,e=>{"use strict";var t=e.i(199544),r=e.i(157102),n=e.i(617944);async function a(e,a){let{allowFailure:i=!0,blockNumber:o,blockTag:s,...c}=a,l=a.contracts;try{let t={};for(let[r,n]of l.entries()){let a=n.chainId??e.state.chainId;t[a]||(t[a]=[]),t[a]?.push({contract:n,index:r})}let n=(await Promise.all(Object.entries(t).map(([t,n])=>(0,r.multicall)(e,{...c,allowFailure:i,blockNumber:o,blockTag:s,chainId:Number.parseInt(t,10),contracts:n.map(({contract:e})=>e)})))).flat(),a=Object.values(t).flatMap(e=>e.map(({index:e})=>e));return n.reduce((e,t,r)=>(e&&(e[a[r]]=t),e),[])}catch(a){if(a instanceof t.ContractFunctionExecutionError)throw a;let r=()=>l.map(t=>(0,n.readContract)(e,{...t,blockNumber:o,blockTag:s}));if(i)return(await Promise.allSettled(r())).map(e=>"fulfilled"===e.status?{result:e.value,status:"success"}:{error:e.reason,result:void 0,status:"failure"});return await Promise.all(r())}}e.s(["readContracts",0,a])},823958,e=>{"use strict";var t=e.i(535453),r=e.i(462017);e.s(["watchConnection",0,function(e,n){let{onChange:a}=n;return e.subscribe(()=>(0,r.getConnection)(e),a,{equalityFn(e,r){let{connector:n,...a}=e,{connector:i,...o}=r;return(0,t.deepEqual)(a,o)&&n?.id===i?.id&&n?.uid===i?.uid}})}])},247659,313006,531585,e=>{"use strict";var t=e.i(925351),r=e.i(842768),n=e.i(813433),a=e.i(533539),i=e.i(277431),o=e.i(270825),s=e.i(323380);function c(e){return e}function l(e={}){let h,f,p,g,{shimDisconnect:m=!0,unstable_shimAsyncInject:y}=e;function w(){let t=e.target;if("function"==typeof t){let e=t();if(e)return e}return"object"==typeof t?t:"string"==typeof t?{...u[t]??{id:t,name:`${t[0].toUpperCase()}${t.slice(1)}`,provider:`is${t[0].toUpperCase()}${t.slice(1)}`}}:{id:"injected",name:"Injected",provider:e=>e?.ethereum}}return c(c=>({get icon(){return w().icon},get id(){return w().id},get name(){return w().name},type:l.type,async setup(){let t=await this.getProvider();t?.on&&e.target&&(p||(p=this.onConnect.bind(this),t.on("connect",p)),h||(h=this.onAccountsChanged.bind(this),t.on("accountsChanged",h)))},async connect({chainId:r,isReconnecting:a,withCapabilities:i}={}){let o=await this.getProvider();if(!o)throw new s.ProviderNotFoundError;let l=[];if(a)l=await this.getAccounts().catch(()=>[]);else if(m)try{let e=await o.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});(l=e[0]?.caveats?.[0]?.value?.map(e=>(0,t.getAddress)(e))).length>0&&(l=await this.getAccounts())}catch(e){if(e.code===n.UserRejectedRequestError.code)throw new n.UserRejectedRequestError(e);
17if(e.code===n.ResourceUnavailableRpcError.code)throw e}try{l?.length||a||(l=(await o.request({method:"eth_requestAccounts"})).map(e=>(0,t.getAddress)(e))),p&&(o.removeListener("connect",p),p=void 0),h||(h=this.onAccountsChanged.bind(this),o.on("accountsChanged",h)),f||(f=this.onChainChanged.bind(this),o.on("chainChanged",f)),g||(g=this.onDisconnect.bind(this),o.on("disconnect",g));let s=await this.getChainId();if(r&&s!==r){let e=await this.switchChain({chainId:r}).catch(e=>{if(e.code===n.UserRejectedRequestError.code)throw e;return{id:s}});s=e?.id??s}return m&&await c.storage?.removeItem(`${this.id}.disconnected`),e.target||await c.storage?.setItem("injected.connected",!0),{accounts:i?l.map(e=>({address:e,capabilities:{}})):l,chainId:s}}catch(e){if(e.code===n.UserRejectedRequestError.code)throw new n.UserRejectedRequestError(e);if(e.code===n.ResourceUnavailableRpcError.code)throw new n.ResourceUnavailableRpcError(e);throw e}},async disconnect(){let t=await this.getProvider();if(!t)throw new s.ProviderNotFoundError;f&&(t.removeListener("chainChanged",f),f=void 0),g&&(t.removeListener("disconnect",g),g=void 0),p||(p=this.onConnect.bind(this),t.on("connect",p));try{await (0,i.withTimeout)(()=>t.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}m&&await c.storage?.setItem(`${this.id}.disconnected`,!0),e.target||await c.storage?.removeItem("injected.connected")},async getAccounts(){let e=await this.getProvider();if(!e)throw new s.ProviderNotFoundError;return(await e.request({method:"eth_accounts"})).map(e=>(0,t.getAddress)(e))},async getChainId(){let e=await this.getProvider();if(!e)throw new s.ProviderNotFoundError;return Number(await e.request({method:"eth_chainId"}))},async getProvider(){let e;if("u"<typeof window)return;let t=w();return(e="function"==typeof t.provider?t.provider(window):"string"==typeof t.provider?d(window,t.provider):t.provider)&&!e.removeListener&&("off"in e&&"function"==typeof e.off?e.removeListener=e.off:e.removeListener=()=>{}),e},async isAuthorized(){try{if(m&&await c.storage?.getItem(`${this.id}.disconnected`)||!e.target&&!await c.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(void 0!==y&&!1!==y){let e=async()=>("u">typeof window&&window.removeEventListener("ethereum#initialized",e),!!await this.getProvider()),t="number"==typeof y?y:1e3;if(await Promise.race([..."u">typeof window?[new Promise(t=>window.addEventListener("ethereum#initialized",()=>t(e()),{once:!0}))]:[],new Promise(r=>setTimeout(()=>r(e()),t))]))return!0}throw new s.ProviderNotFoundError}return!!(await (0,a.withRetry)(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){let a=await this.getProvider();if(!a)throw new s.ProviderNotFoundError;let i=c.chains.find(e=>e.id===t);if(!i)throw new n.SwitchChainError(new o.ChainNotConfiguredError);let l=new Promise(e=>{let r=n=>{"chainId"in n&&n.chainId===t&&(c.emitter.off("change",r),e())};c.emitter.on("change",r)});try{return await Promise.all([a.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,r.numberToHex)(t)}]}).then(async()=>{await this.getChainId()===t&&c.emitter.emit("change",{chainId:t})}),l]),i}catch(o){if(4902===o.code||o?.data?.originalError?.code===4902)try{let o,s,{default:u,...d}=i.blockExplorers??{};e?.blockExplorerUrls?o=e.blockExplorerUrls:u&&(o=[u.url,...Object.values(d).map(e=>e.url)]),s=e?.rpcUrls?.length?e.rpcUrls:[i.rpcUrls.default?.http[0]??""];let h={blockExplorerUrls:o,chainId:(0,r.numberToHex)(t),chainName:e?.chainName??i.name,iconUrls:e?.iconUrls,nativeCurrency:e?.nativeCurrency??i.nativeCurrency,rpcUrls:s};return await Promise.all([a.request({method:"wallet_addEthereumChain",params:[h]}).then(async()=>{if(await this.getChainId()===t)c.emitter.emit("change",{chainId:t});else throw new n.UserRejectedRequestError(Error("User rejected switch after adding network."))}),l]),i}catch(e){throw new n.UserRejectedRequestError(e)}if(o.code===n.UserRejectedRequestError.code)throw new n.UserRejectedRequestError(o);throw new n.SwitchChainError(o)}},async onAccountsChanged(e){if(0===e.length)this.onDisconnect();else if(c.emitter.listenerCount("connect")){let e=(await this.getChainId()).toString();this.onConnect({chainId:e}),m&&await c.storage?.removeItem(`${this.id}.disconnected`)}else c.emitter.emit("change",{accounts:e.map(e=>(0,t.getAddress)(e))})},onChainChanged(e){let t=Number(e);c.emitter.emit("change",{chainId:t})},async onConnect(e){let t=await this.getAccounts();if(0===t.length)return;let r=Number(e.chainId);c.emitter.emit("connect",{accounts:t,chainId:r});let n=await this.getProvider();n&&(p&&(n.removeListener("connect",p),p=void 0),h||(h=this.onAccountsChanged.bind(this),n.on("accountsChanged",h)),f||(f=this.onChainChanged.bind(this),n.on("chainChanged",f)),g||(g=this.onDisconnect.bind(this),n.on("disconnect",g)))},async onDisconnect(e){let t=await this.getProvider();e&&1013===e.code&&t&&(await this.getAccounts()).length||(c.emitter.emit("disconnect"),t&&(f&&(t.removeListener("chainChanged",f),f=void 0),g&&(t.removeListener("disconnect",g),g=void 0),p||(p=this.onConnect.bind(this),t.on("connect",p))))}}))}e.s(["createConnector",0,c],313006),l.type="injected";let u={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider:e=>e?.coinbaseWalletExtension?e.coinbaseWalletExtension:d(e,"isCoinbaseWallet")},metaMask:{id:"metaMask",name:"MetaMask",provider:e=>d(e,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;for(let t of["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"])if(e[t])return!1;return!0})}
17,phantom:{id:"phantom",name:"Phantom",provider:e=>e?.phantom?.ethereum?e.phantom?.ethereum:d(e,"isPhantom")}};function d(e,t){function r(e){return"function"==typeof t?t(e):"string"!=typeof t||e[t]}let n=e.ethereum;return n?.providers?n.providers.find(e=>r(e)):n&&r(n)?n:void 0}e.s(["injected",0,l],247659),e.i(785373);var h=e.i(153413),h=h;class f{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new h.default})}on(e,t){this._emitter.on(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}emit(e,...t){let r=t[0];this._emitter.emit(e,{uid:this.uid,...r})}listenerCount(e){return this._emitter.listenerCount(e)}}e.s(["createEmitter",0,function(e){return new f(e)}],531585)},473462,e=>{"use strict";let t;var r=e.i(154380),n=e.i(151924),a=e.i(228995),i=e.i(412614),o=e.i(247659),s=e.i(531585),c=e.i(938466),l=e.i(270825);let u=256;var d=e.i(556593);e.s(["createConfig",0,function(e){let h,{multiInjectedProviderDiscovery:f=!0,storage:p=(0,c.createStorage)({storage:(0,c.getDefaultStorage)()}),syncConnectedChain:g=!0,ssr:m=!1,...y}=e,w="u">typeof window&&f?(0,r.createStore)():void 0,v=(0,i.createStore)(()=>y.chains),b=(0,i.createStore)(()=>{let e=[],t=new Set;for(let r of y.connectors??[]){let n=C(r);if(e.push(n),!m&&n.rdns)for(let e of"string"==typeof n.rdns?[n.rdns]:n.rdns)t.add(e)}if(!m&&w)for(let r of w.getProviders())t.has(r.info.rdns)||e.push(C(S(r)));return e});function C(e){let r,n=(0,s.createEmitter)(function(e=11){if(!t||u+e>512){t="",u=0;for(let e=0;e<256;e++)t+=(256+256*Math.random()|0).toString(16).substring(1)}return t.substring(u,u+++e)}()),a={...e({emitter:n,chains:v.getState(),get providers(){if(!w||!r)return[];let e="string"==typeof r?[r]:r,t=w.getProviders();return e.flatMap(e=>t.filter(t=>t.info.rdns===e))},storage:p,transports:y.transports}),emitter:n,uid:n.uid};return r=a.rdns,n.on("connect",P),a.setup?.(),a}function S(e){let{info:t}=e,r=e.provider;return(0,o.injected)({target:{...t,id:t.rdns,provider:r}})}let _=new Map;function A(){return{chainId:v.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let E="0.0.0-canary-";h=d.version.startsWith(E)?Number.parseInt(d.version.replace(E,""),10):Number.parseInt(d.version.split(".")[0]??"0",10);let I=(0,i.createStore)((0,a.subscribeWithSelector)(p?(0,a.persist)(A,{migrate(e,t){if(t===h)return e;let r=A(),n=k(e,r.chainId);return{...r,chainId:n}},name:"store",partialize:e=>({connections:{__type:"Map",value:Array.from(e.connections.entries()).map(([e,t])=>{let{id:r,name:n,type:a,uid:i}=t.connector;return[e,{...t,connector:{id:r,name:n,type:a,uid:i}}]})},chainId:e.chainId,current:e.current}),merge(e,t){"object"==typeof e&&e&&"status"in e&&delete e.status;let r=k(e,t.chainId);return{...t,...e,chainId:r}},skipHydration:m,storage:p,version:h}):A));function k(e,t){return e&&"object"==typeof e&&"chainId"in e&&"number"==typeof e.chainId&&v.getState().some(t=>t.id===e.chainId)?e.chainId:t}function x(e){I.setState(t=>{let r=t.connections.get(e.uid);return r?{...t,connections:new Map(t.connections).set(e.uid,{accounts:e.accounts??r.accounts,chainId:e.chainId??r.chainId,connector:r.connector})}:t})}function P(e){"connecting"!==I.getState().status&&"reconnecting"!==I.getState().status&&I.setState(t=>{let r=b.getState().find(t=>t.uid===e.uid);return r?(r.emitter.listenerCount("connect")&&r.emitter.off("connect",x),r.emitter.listenerCount("change")||r.emitter.on("change",x),r.emitter.listenerCount("disconnect")||r.emitter.on("disconnect",R),{...t,connections:new Map(t.connections).set(e.uid,{accounts:e.accounts,chainId:e.chainId,connector:r}),current:e.uid,status:"connected"}):t})}function R(e){I.setState(t=>{let r=t.connections.get(e.uid);if(r){let e=r.connector;e.emitter.listenerCount("change")&&r.connector.emitter.off("change",x),e.emitter.listenerCount("disconnect")&&r.connector.emitter.off("disconnect",R),e.emitter.listenerCount("connect")||r.connector.emitter.on("connect",P)}if(t.connections.delete(e.uid),0===t.connections.size)return{...t,connections:new Map,current:null,status:"disconnected"};let n=t.connections.values().next().value;return{...t,connections:new Map(t.connections),current:n.connector.uid}})}return I.setState(A()),g&&I.subscribe(({connections:e,current:t})=>t?e.get(t)?.chainId:void 0,e=>{if(v.getState().some(t=>t.id===e))return I.setState(t=>({...t,chainId:e??t.chainId}))}),w?.subscribe(e=>{let t=new Set,r=new Set;for(let e of b.getState())if(t.add(e.id),e.rdns)for(let t of"string"==typeof e.rdns?[e.rdns]:e.rdns)r.add(t);let n=[];for(let a of e){if(r.has(a.info.rdns))continue;let e=C(S(a));t.has(e.id)||n.push(e)}(!p||I.persist.hasHydrated())&&b.setState(e=>[...e,...n],!0)}),{get chains(){return v.getState()},get connectors(){return b.getState()},storage:p,getClient:function(e={}){let t,r=e.chainId??I.getState().chainId,a=v.getState().find(e=>e.id===r);if(e.chainId&&!a)throw new l.ChainNotConfiguredError;{let e=_.get(I.getState().chainId);if(e&&!a)return e;if(!a)throw new l.ChainNotConfiguredError}{let e=_.get(r);if(e)return e}if(y.client)t=y.client({chain:a});else{let e=a.id,r=v.getState().map(e=>e.id),i={};for(let[t,n]of Object.entries(y))if("chains"!==t&&"client"!==t&&"connectors"!==t&&"transports"!==t)if("object"==typeof n)if(e in n)i[t]=n[e];else{if(r.some(e=>e in n))continue;i[t]=n}else i[t]=n;t=(0,n.createClient)({...i,chain:a,batch:i.batch??{multicall:!0},transport:t=>y.transports[e]({...t,connectors:b})})}return _.set(r,t),t}
17,get state(){return I.getState()},setState(e){let t;t="function"==typeof e?e(I.getState()):e;let r=A();"object"!=typeof t&&(t=r),Object.keys(r).some(e=>!(e in t))&&(t=r),I.setState(t,!0)},subscribe:(e,t,r)=>I.subscribe(e,t,r?{...r,fireImmediately:r.emitImmediately}:void 0),_internal:{mipd:w,async revalidate(){let e=I.getState(),t=e.connections,r=e.current;for(let[,e]of t){let n=e.connector;n.isAuthorized&&await n.isAuthorized()||(t.delete(n.uid),r===n.uid&&(r=null))}I.setState(e=>({...e,connections:t,current:r}))},store:I,ssr:!!m,syncConnectedChain:g,transports:y.transports,chains:{setState(e){let t="function"==typeof e?e(v.getState()):e;if(0!==t.length)return v.setState(t,!0)},subscribe:e=>v.subscribe(e)},connectors:{providerDetailToConnector:S,setup:C,setState:e=>b.setState("function"==typeof e?e(b.getState()):e,!0),subscribe:e=>b.subscribe(e)},events:{change:x,connect:P,disconnect:R}}}}],473462)},938466,e=>{"use strict";var t=e.i(650772),r=e.i(913259);let n={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};e.s(["createStorage",0,function(e){let{deserialize:a=t.deserialize,key:i="wagmi",serialize:o=r.serialize,storage:s=n}=e;function c(e){return e instanceof Promise?e.then(e=>e).catch(()=>null):e}return{...s,key:i,async getItem(e,t){let r=s.getItem(`${i}.${e}`),n=await c(r);return n?a(n)??null:t??null},async setItem(e,t){let r=`${i}.${e}`;null===t?await c(s.removeItem(r)):await c(s.setItem(r,o(t)))},async removeItem(e){await c(s.removeItem(`${i}.${e}`))}}},"getDefaultStorage",0,function(){let e="u">typeof window&&window.localStorage?window.localStorage:n;return{getItem:t=>e.getItem(t),removeItem(t){e.removeItem(t)},setItem(t,r){try{e.setItem(t,r)}catch{}}}},"noopStorage",0,n])},505075,556593,e=>{"use strict";let t="3.6.4";e.s(["version",0,t],556593);var r,n,a=function(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};r=new WeakSet,n=function e(t,n){return n?.(t)?t:t.cause?a(this,r,"m",e).call(this,t.cause,n):t},e.s(["BaseError",0,class e extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return`@wagmi/core@${t}`}constructor(t,n={}){super(),r.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const a=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof e&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${this.docsBaseUrl}${i}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...a?[`Details: ${a}`]:[],`Version: ${this.version}`].join("\n"),n.cause&&(this.cause=n.cause),this.details=a,this.docsPath=i,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(e){return a(this,r,"m",n).call(this,this,e)}}],505075)},270825,e=>{"use strict";var t=e.i(505075);class r extends t.BaseError{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class n extends t.BaseError{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class a extends t.BaseError{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}t.BaseError;class i extends t.BaseError{constructor({address:e,connector:t}){super(`Account "${e}" not found for connector "${t.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class o extends t.BaseError{constructor({connectionChainId:e,connectorChainId:t}){super(`The current chain of the connector (id: ${t}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class s extends t.BaseError{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:"During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`. All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored. This error commonly occurs for connectors that asynchronously inject after reconnection has already started."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}e.s(["ChainNotConfiguredError",0,r,"ConnectorAccountNotFoundError",0,i,"ConnectorAlreadyConnectedError",0,n,"ConnectorChainMismatchError",0,o,"ConnectorNotConnectedError",0,a,"ConnectorUnavailableReconnectingError",0,s])},323380,e=>{"use strict";var t=e.i(505075);class r extends t.BaseError{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class n extends t.BaseError{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}e.s(["ProviderNotFoundError",0,r,"SwitchChainNotSupportedError",0,n])},551023,e=>{"use strict";var t=e.i(270825);async function r(e,r){let n;if((n="function"==typeof r.connector?e._internal.connectors.setup(r.connector):r.connector).uid===e.state.current)throw new t.ConnectorAlreadyConnectedError;try{e.setState(e=>({...e,status:"connecting"})),n.emitter.emit("message",{type:"connecting"});
17let{connector:t,...a}=r,i=await n.connect(a);return n.emitter.off("connect",e._internal.events.connect),n.emitter.on("change",e._internal.events.change),n.emitter.on("disconnect",e._internal.events.disconnect),await e.storage?.setItem("recentConnectorId",n.id),e.setState(e=>({...e,connections:new Map(e.connections).set(n.uid,{accounts:a.withCapabilities?i.accounts.map(e=>"object"==typeof e?e.address:e):i.accounts,chainId:i.chainId,connector:n}),current:n.uid,status:"connected"})),{accounts:a.withCapabilities?i.accounts.map(e=>"object"==typeof e?e:{address:e,capabilities:{}}):i.accounts,chainId:i.chainId}}catch(t){throw e.setState(e=>({...e,status:e.current?"connected":"disconnected"})),t}}e.s(["connectMutationOptions",0,function(e,t={}){return{...t.mutation,mutationFn:async t=>r(e,t),mutationKey:["connect"]}}],551023)},192475,927951,e=>{"use strict";async function t(e,r={}){let n;if(r.connector)n=r.connector;else{let{connections:t,current:r}=e.state,a=t.get(r);n=a?.connector}let a=e.state.connections;n&&(await n.disconnect(),n.emitter.off("change",e._internal.events.change),n.emitter.off("disconnect",e._internal.events.disconnect),n.emitter.on("connect",e._internal.events.connect),a.delete(n.uid)),e.setState(e=>{if(0===a.size)return{...e,connections:new Map,current:null,status:"disconnected"};let t=a.values().next().value;return{...e,connections:new Map(a),current:t.connector.uid}});{let t=e.state.current;if(!t)return;let r=e.state.connections.get(t)?.connector;if(!r)return;await e.storage?.setItem("recentConnectorId",r.id)}}e.s(["disconnect",0,t],927951),e.s(["disconnectMutationOptions",0,function(e,r={}){return{...r.mutation,mutationFn:async r=>t(e,r),mutationKey:["disconnect"]}}],192475)},92606,e=>{"use strict";var t=e.i(380624),r=e.i(322507);e.s(["readContractsQueryOptions",0,function(e,n={}){return{...n.query,queryFn:async r=>{let a=[],i=r.queryKey[1].contracts.length;for(let e=0;e<i;e++){let t=r.queryKey[1].contracts[e],i=(n.contracts?.[e]).abi;a.push({...t,abi:i})}let{scopeKey:o,...s}=r.queryKey[1];return(0,t.readContracts)(e,{...s,contracts:a})},queryKey:function(e={}){let t=[],n=!1;for(let r of e.contracts??[]){let{abi:a,...i}=r;void 0===i.chainId&&(n=!0);let o=i.chainId??e.chainId;t.push({...i,...o?{chainId:o}:{}})}let{chainId:a,...i}=e;return["readContracts",(0,r.filterQueryOptions)({...i,...n&&e.chainId?{chainId:e.chainId}:{},contracts:t})]}(n)}}])},322507,e=>{"use strict";var t=e.i(224098);function r(e){return"[object Object]"===Object.prototype.toString.call(e)}e.s(["filterQueryOptions",0,function(e){let{_defaulted:t,behavior:r,gcTime:n,initialData:a,initialDataUpdatedAt:i,maxPages:o,meta:s,networkMode:c,queryFn:l,queryHash:u,queryKey:d,queryKeyHashFn:h,retry:f,retryDelay:p,structuralSharing:g,getPreviousPageParam:m,getNextPageParam:y,initialPageParam:w,_optimisticResults:v,enabled:b,notifyOnChangeProps:C,placeholderData:S,refetchInterval:_,refetchIntervalInBackground:A,refetchOnMount:E,refetchOnReconnect:I,refetchOnWindowFocus:k,retryOnMount:x,select:P,staleTime:R,suspense:T,throwOnError:D,abi:O,config:M,connector:L,query:U,watch:N,...j}=e;return L?{connectorUid:L?.uid,...j}:j},"hashFn",0,function(e){return JSON.stringify(e,(e,t)=>!function(e){if(!r(e))return!1;let t=e.constructor;if(void 0===t)return!0;let n=t.prototype;return!!r(n)&&!!n.hasOwnProperty("isPrototypeOf")}(t)?"bigint"==typeof t?t.toString():t:Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}))},"structuralSharing",0,function(e,r){return(0,t.replaceEqualDeep)(e,r)}])},535453,e=>{"use strict";e.s(["deepEqual",0,function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){let n,a;if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)&&Array.isArray(r)){if((n=t.length)!==r.length)return!1;for(a=n;0!=a--;)if(!e(t[a],r[a]))return!1;return!0}if("function"==typeof t.valueOf&&t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if("function"==typeof t.toString&&t.toString!==Object.prototype.toString)return t.toString()===r.toString();let i=Object.keys(t);if((n=i.length)!==Object.keys(r).length)return!1;for(a=n;0!=a--;)if(!Object.hasOwn(r,i[a]))return!1;for(a=n;0!=a--;){let n=i[a];if(n&&!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r}])},650772,913259,e=>{"use strict";function t(e,t){return e.slice(0,t).join(".")||"."}function r(e,t){let{length:r}=e;for(let n=0;n<r;++n)if(e[n]===t)return n+1;return 0}e.s(["deserialize",0,function(e,t){return JSON.parse(e,(e,r)=>{let n=r;return n?.__type==="bigint"&&(n=BigInt(n.value)),n?.__type==="Map"&&(n=new Map(n.value)),t?.(e,n)??n})}],650772),e.s(["serialize",0,function(e,n,a,i){var o;let s,c,l,u;return JSON.stringify(e,(o=(e,t)=>{let r=t;return"bigint"==typeof r&&(r={__type:"bigint",value:t.toString()}),r instanceof Map&&(r={__type:"Map",value:Array.from(t.entries())}),n?.(e,r)??r},s=true,c="function"==typeof i,l=[],u=[],function(e,n){if("object"==typeof n)if(l.length){let a=r(l,this);0===a?l[l.length]=this:(l.splice(a),u.splice(a)),u[u.length]=e;let o=r(l,n);if(0!==o)return c?i.call(this,e,n,t(u,o)):`[ref=${t(u,o)}]`}else l[0]=n,u[0]=e;return s?o.call(this,e,n):n}),a??void 0)}],913259)},334705,e=>{"use strict";e.s(["getAction",0,function(e,t,r){let n=e[t.name];if("function"==typeof n)return n;let a=e[r];return"function"==typeof a?a:r=>t(e,r)}])},82756,e=>{"use strict";var t=e.i(353531),r=e.i(734804),n=e.i(45806),a=e.i(436002),i=e.i(489129);e.s(["useCookieState",0,function(e,o){void 0===o&&(o={});
17var s=(0,t.__read)((0,n.useState)(function(){var t=r.default.get(e);return(0,i.isString)(t)?t:(0,i.isFunction)(o.defaultValue)?o.defaultValue():o.defaultValue}),2),c=s[0],l=s[1],u=(0,a.default)(function(n,a){void 0===a&&(a={});var s=(0,t.__assign)((0,t.__assign)({},o),a),u=(s.defaultValue,(0,t.__rest)(s,["defaultValue"])),d=(0,i.isFunction)(n)?n(c):n;l(d),void 0===d?r.default.remove(e):r.default.set(e,d,u)});return[c,u]}],82756)},382928,e=>{"use strict";var t=e.i(45806),r=function(e,t){return!Object.is(e,t)};e.s(["usePrevious",0,function(e,n){void 0===n&&(n=r);var a=(0,t.useRef)(void 0),i=(0,t.useRef)(void 0);return n(i.current,e)&&(a.current=i.current,i.current=e),a.current}],382928)},137432,e=>{"use strict";var t=e.i(353531),r=e.i(648250),n=e.i(45806),a=e.i(421678),i=e.i(381378),o=e.i(489129),s=e.i(203590);e.s(["useThrottleFn",0,function(e,c){s.default&&!(0,o.isFunction)(e)&&console.error("useThrottleFn expected parameter is a function, got ".concat(typeof e));var l,u=(0,a.default)(e),d=null!=(l=null==c?void 0:c.wait)?l:1e3,h=(0,n.useMemo)(function(){return(0,r.default)(function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return u.current.apply(u,(0,t.__spreadArray)([],(0,t.__read)(e),!1))},d,c)},[]);return(0,i.default)(function(){h.cancel()}),{run:h,cancel:h.cancel,flush:h.flush}}],137432)},154028,e=>{"use strict";var t=e.i(595053);e.s(["compareDesc",0,function(e,r){let n=(0,t.toDate)(e)-(0,t.toDate)(r);return n>0?-1:n<0?1:n}])},505918,(e,t,r)=>{t.exports=e.g&&e.g.Object===Object&&e.g},78974,(e,t,r)=>{var n=e.r(505918),a="object"==typeof self&&self&&self.Object===Object&&self;t.exports=n||a||Function("return this")()},864564,(e,t,r)=>{var n=e.r(78974);t.exports=function(){return n.Date.now()}},860205,(e,t,r)=>{var n=/\s/;t.exports=function(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}},798430,(e,t,r)=>{var n=e.r(860205),a=/^\s+/;t.exports=function(e){return e?e.slice(0,n(e)+1).replace(a,""):e}},328042,(e,t,r)=>{t.exports=e.r(78974).Symbol},684435,(e,t,r)=>{var n=e.r(328042),a=Object.prototype,i=a.hasOwnProperty,o=a.toString,s=n?n.toStringTag:void 0;t.exports=function(e){var t=i.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var a=o.call(e);return n&&(t?e[s]=r:delete e[s]),a}},933680,(e,t,r)=>{var n=Object.prototype.toString;t.exports=function(e){return n.call(e)}},416907,(e,t,r)=>{var n=e.r(328042),a=e.r(684435),i=e.r(933680),o=n?n.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?a(e):i(e)}},394022,(e,t,r)=>{t.exports=function(e){return null!=e&&"object"==typeof e}},692558,(e,t,r)=>{var n=e.r(416907),a=e.r(394022);t.exports=function(e){return"symbol"==typeof e||a(e)&&"[object Symbol]"==n(e)}},868922,(e,t,r)=>{var n=e.r(798430),a=e.r(878524),i=e.r(692558),o=0/0,s=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(i(e))return o;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=c.test(e);return r||l.test(e)?u(e.slice(2),r?2:8):s.test(e)?o:+e}},787331,(e,t,r)=>{var n=e.r(878524),a=e.r(864564),i=e.r(868922),o=Math.max,s=Math.min;t.exports=function(e,t,r){var c,l,u,d,h,f,p=0,g=!1,m=!1,y=!0;if("function"!=typeof e)throw TypeError("Expected a function");function w(t){var r=c,n=l;return c=l=void 0,p=t,d=e.apply(n,r)}function v(e){var r=e-f,n=e-p;return void 0===f||r>=t||r<0||m&&n>=u}function b(){var e,r,n,i=a();if(v(i))return C(i);h=setTimeout(b,(e=i-f,r=i-p,n=t-e,m?s(n,u-r):n))}function C(e){return(h=void 0,y&&c)?w(e):(c=l=void 0,d)}function S(){var e,r=a(),n=v(r);if(c=arguments,l=this,f=r,n){if(void 0===h)return p=e=f,h=setTimeout(b,t),g?w(e):d;if(m)return clearTimeout(h),h=setTimeout(b,t),w(f)}return void 0===h&&(h=setTimeout(b,t)),d}return t=i(t)||0,n(r)&&(g=!!r.leading,u=(m="maxWait"in r)?o(i(r.maxWait)||0,t):u,y="trailing"in r?!!r.trailing:y),S.cancel=function(){void 0!==h&&clearTimeout(h),p=0,c=f=l=h=void 0},S.flush=function(){return void 0===h?d:C(a())},S}},878524,(e,t,r)=>{t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},648250,(e,t,r)=>{var n=e.r(787331),a=e.r(878524);t.exports=function(e,t,r){var i=!0,o=!0;if("function"!=typeof e)throw TypeError("Expected a function");return a(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),n(e,t,{leading:i,maxWait:t,trailing:o})}},154380,228995,412614,e=>{"use strict";e.s(["createStore",0,function(){let e=new Set,t=[],r=()=>(function(e){if("u"<typeof window)return;let t=t=>e(t.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)})(r=>{t.some(({info:e})=>
17e.uuid===r.info.uuid)||(t=[...t,r],e.forEach(e=>e(t,{added:[r]})))}),n=r();return{_listeners:()=>e,clear(){e.forEach(e=>e([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),n?.()},findProvider:({rdns:e})=>t.find(t=>t.info.rdns===e),getProviders:()=>t,reset(){this.clear(),n?.(),n=r()},subscribe:(r,{emitImmediately:n}={})=>(e.add(r),n&&r(t,{added:t}),()=>e.delete(r))}}],154380);let t=e=>r=>{try{let n=e(r);if(n instanceof Promise)return n;return{then:e=>t(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:r=>t(r)(e)}}};e.s(["persist",0,(e,r)=>(n,a,i)=>{let o,s={storage:function(e){let t;try{t=e()}catch(e){return}return{getItem:e=>{var r;let n=e=>null===e?null:JSON.parse(e,void 0),a=null!=(r=t.getItem(e))?r:null;return a instanceof Promise?a.then(n):n(a)},setItem:(e,r)=>t.setItem(e,JSON.stringify(r,void 0)),removeItem:e=>t.removeItem(e)}}(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...r},c=!1,l=new Set,u=new Set,d=s.storage;if(!d)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...e)},a,i);let h=()=>{let e=s.partialize({...a()});return d.setItem(s.name,{state:e,version:s.version})},f=i.setState;i.setState=(e,t)=>{f(e,t),h()};let p=e((...e)=>{n(...e),h()},a,i);i.getInitialState=()=>p;let g=()=>{var e,r;if(!d)return;c=!1,l.forEach(e=>{var t;return e(null!=(t=a())?t:p)});let i=(null==(r=s.onRehydrateStorage)?void 0:r.call(s,null!=(e=a())?e:p))||void 0;return t(d.getItem.bind(d))(s.name).then(e=>{if(e)if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];else{if(s.migrate)return[!0,s.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;let[r,i]=e;if(n(o=s.merge(i,null!=(t=a())?t:p),!0),r)return h()}).then(()=>{null==i||i(o,void 0),o=a(),c=!0,u.forEach(e=>e(o))}).catch(e=>{null==i||i(void 0,e)})};return i.persist={setOptions:e=>{s={...s,...e},e.storage&&(d=e.storage)},clearStorage:()=>{null==d||d.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>g(),hasHydrated:()=>c,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},s.skipHydration||g(),o||p},"subscribeWithSelector",0,e=>(t,r,n)=>{let a=n.subscribe;return n.subscribe=(e,t,r)=>{let i=e;if(t){let a=(null==r?void 0:r.equalityFn)||Object.is,o=e(n.getState());i=r=>{let n=e(r);if(!a(o,n)){let e=o;t(o=n,e)}},(null==r?void 0:r.fireImmediately)&&t(o,o)}return a(i)},e(t,r,n)}],228995);let r=e=>{let t,r=new Set,n=(e,n)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=n?n:"object"!=typeof a||null===a)?a:Object.assign({},t,a),r.forEach(r=>r(t,e))}},a=()=>t,i={setState:n,getState:a,getInitialState:()=>o,subscribe:e=>(r.add(e),()=>r.delete(e))},o=t=e(n,a,i);return i};e.s(["createStore",0,e=>e?r(e):r],412614)},392708,517929,e=>{"use strict";var t=e.i(45806);let r=!1;async function n(e,t={}){let a;if(r)return[];r=!0,e.setState(e=>({...e,status:e.current?"reconnecting":"connecting"}));let i=[];if(t.connectors?.length)for(let r of t.connectors){let t;t="function"==typeof r?e._internal.connectors.setup(r):r,i.push(t)}else i.push(...e.connectors);try{a=await e.storage?.getItem("recentConnectorId")}catch{}let o={};for(let[,t]of e.state.connections)o[t.connector.id]=1;a&&(o[a]=0);let s=Object.keys(o).length>0?[...i].sort((e,t)=>(o[e.id]??10)-(o[t.id]??10)):i,c=!1,l=[],u=[];for(let t of s){let r=await t.getProvider().catch(()=>void 0);if(!r||u.some(e=>e===r)||!await t.isAuthorized())continue;let n=await t.connect({isReconnecting:!0}).catch(()=>null);n&&(t.emitter.off("connect",e._internal.events.connect),t.emitter.on("change",e._internal.events.change),t.emitter.on("disconnect",e._internal.events.disconnect),e.setState(e=>{let r=new Map(c?e.connections:new Map).set(t.uid,{accounts:n.accounts,chainId:n.chainId,connector:t});return{...e,current:c?e.current:t.uid,connections:r}}),l.push({accounts:n.accounts,chainId:n.chainId,connector:t}),u.push(r),c=!0)}return("reconnecting"===e.state.status||"connecting"===e.state.status)&&(c?e.setState(e=>({...e,status:"connected"})):e.setState(e=>({...e,connections:new Map,current:null,status:"disconnected"}))),r=!1,l}function a(e){let{children:r,config:a,initialState:i,reconnectOnMount:o=!0}=e,{onMount:s}
17=function(e,t){let{initialState:r,reconnectOnMount:a}=t;return r&&!e._internal.store.persist.hasHydrated()&&e.setState({...r,chainId:e.chains.some(e=>e.id===r.chainId)?r.chainId:e.chains[0].id,connections:a?r.connections:new Map,status:a?"reconnecting":"disconnected"}),{async onMount(){e._internal.ssr&&(await e._internal.store.persist.rehydrate(),e._internal.mipd&&e._internal.connectors.setState(t=>{let r=new Set;for(let e of t??[])if(e.rdns)for(let t of Array.isArray(e.rdns)?e.rdns:[e.rdns])r.add(t);let n=[];for(let t of e._internal.mipd?.getProviders()??[]){if(r.has(t.info.rdns))continue;let a=e._internal.connectors.providerDetailToConnector(t),i=e._internal.connectors.setup(a);n.push(i)}return[...t,...n]})),a?n(e):e.storage&&e.setState(e=>({...e,connections:new Map}))}}}(a,{initialState:i,reconnectOnMount:o});a._internal.ssr||s();let c=(0,t.useRef)(!0);return(0,t.useEffect)(()=>{if(c.current&&a._internal.ssr)return s(),()=>{c.current=!1}},[]),r}e.s(["reconnect",0,n],517929);let i=(0,t.createContext)(void 0);e.s(["WagmiContext",0,i,"WagmiProvider",0,function(e){let{children:r,config:n}=e;return(0,t.createElement)(a,e,(0,t.createElement)(i.Provider,{value:n},r))}],392708)},342287,e=>{"use strict";var t=e.i(480534),r=e.i(763054),n=e.i(45806),a=e.i(590873);e.s(["useChainId",0,function(e={}){let i=(0,a.useConfig)(e);return(0,n.useSyncExternalStore)(e=>(0,r.watchChainId)(i,{onChange:e}),()=>(0,t.getChainId)(i),()=>(0,t.getChainId)(i))}])},590873,e=>{"use strict";var t=e.i(45806),r=e.i(392708),n=e.i(505075);class a extends n.BaseError{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return"[email protected]"}}class i extends a{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}e.s(["useConfig",0,function(e={}){let n=e.config??(0,t.useContext)(r.WagmiContext);if(!n)throw new i;return n}],590873)},830598,e=>{"use strict";var t=e.i(608114),r=e.i(551023),n=e.i(45806),a=e.i(590873),i=e.i(974917);e.s(["useConnect",0,function(e={}){let o=(0,a.useConfig)(e),s=(0,r.connectMutationOptions)(o,e),c=(0,t.useMutation)(s);return(0,n.useEffect)(()=>o.subscribe(({status:e})=>e,(e,t)=>{"connected"===t&&"disconnected"===e&&c.reset()}),[o,c.reset]),{...c,connect:c.mutate,connectAsync:c.mutateAsync,connectors:(0,i.useConnectors)({config:o})}}])},28168,e=>{"use strict";var t=e.i(462017),r=e.i(823958),n=e.i(590873),a=e.i(535453),i=e.i(45806),o=e.i(716887);let s=e=>"object"==typeof e&&!Array.isArray(e);e.s(["useConnection",0,function(e={}){let c=(0,n.useConfig)(e);return function(e,t,r=t,n=a.deepEqual){let c=(0,i.useRef)([]),l=(0,o.useSyncExternalStoreWithSelector)(e,t,r,e=>e,(e,t)=>{if(s(e)&&s(t)&&c.current.length){for(let r of c.current)if(!n(e[r],t[r]))return!1;return!0}return n(e,t)});return(0,i.useMemo)(()=>{if(s(l)){let e={...l},t={};for(let[r,n]of Object.entries(e))t={...t,[r]:{configurable:!1,enumerable:!0,get:()=>(c.current.includes(r)||c.current.push(r),n)}};return Object.defineProperties(e,t),e}return l},[l])}(e=>(0,r.watchConnection)(c,{onChange:e}),()=>(0,t.getConnection)(c))}],28168)},843812,e=>{"use strict";var t=e.i(823958),r=e.i(45806),n=e.i(590873);e.s(["useConnectionEffect",0,function(e={}){let{onConnect:a,onDisconnect:i}=e,o=(0,n.useConfig)(e);(0,r.useEffect)(()=>(0,t.watchConnection)(o,{onChange(e,t){if(("reconnecting"===t.status||"connecting"===t.status&&void 0===t.address)&&"connected"===e.status){let{address:r,addresses:n,chain:i,chainId:o,connector:s}=e,c="reconnecting"===t.status||void 0===t.status;a?.({address:r,addresses:n,chain:i,chainId:o,connector:s,isReconnected:c})}else"connected"===t.status&&"disconnected"===e.status&&i?.()}}),[o,a,i])}])},741453,e=>{"use strict";var t=e.i(535453);let r=[];function n(e){let n=[...e.state.connections.values()];return"reconnecting"===e.state.status||(0,t.deepEqual)(r,n)?r:(r=n,n)}var a=e.i(45806),i=e.i(590873);e.s(["useConnections",0,function(e={}){let r=(0,i.useConfig)(e);return(0,a.useSyncExternalStore)(e=>(function(e,r){let{onChange:a}=r;return e.subscribe(()=>n(e),a,{equalityFn:t.deepEqual})})(r,{onChange:e}),()=>n(r),()=>n(r))}],741453)},974917,599314,e=>{"use strict";let t=[];function r(e){let r=e.connectors;return t.length===r.length&&t.every((e,t)=>e===r[t])?t:(t=r,r)}function n(e,t){let{onChange:r}=t;return e._internal.connectors.subscribe((e,t)=>{r(Object.values(e),t)})}e.s(["watchConnectors",0,n],599314);var a=e.i(45806),i=e.i(590873);e.s(["useConnectors",0,function(e={}){let t=(0,i.useConfig)(e);return(0,a.useSyncExternalStore)(e=>n(t,{onChange:e}),()=>r(t),()=>r(t))}],974917)}
17,857165,e=>{"use strict";var t=e.i(608114),r=e.i(192475),n=e.i(590873),a=e.i(741453);e.s(["useDisconnect",0,function(e={}){let i=(0,n.useConfig)(e),o=(0,r.disconnectMutationOptions)(i,e),s=(0,t.useMutation)(o);return{...s,connectors:(0,a.useConnections)({config:i}).map(e=>e.connector),disconnect:s.mutate,disconnectAsync:s.mutateAsync}}])},945769,e=>{"use strict";var t=e.i(92606),r=e.i(45806),n=e.i(286608),a=e.i(342287),i=e.i(590873);e.s(["useReadContracts",0,function(e={}){let o=(0,i.useConfig)(e),s=(0,a.useChainId)({config:o}),c=(0,r.useMemo)(()=>{let t=e.contracts?.[0]?.chainId;if((e.contracts??[]).every(e=>e.chainId===t))return t},[e.contracts]),l=(0,t.readContractsQueryOptions)(o,{...e,chainId:e.chainId??c??s});return(0,n.useQuery)(l)}])},238874,e=>{"use strict";var t=e.i(608114),r=e.i(517929),n=e.i(590873);e.s(["useReconnect",0,function(e={}){let a=(0,n.useConfig)(e),i=function(e,t={}){return{...t.mutation,mutationFn:t=>(0,r.reconnect)(e,t),mutationKey:["reconnect"]}}(a,e),o=(0,t.useMutation)(i);return{...o,connectors:a.connectors,reconnect:o.mutate,reconnectAsync:o.mutateAsync}}],238874)},286608,e=>{"use strict";var t=e.i(728056);e.i(608114);var r=e.i(322507);e.s(["useQuery",0,function(e){let n=(0,t.useQuery)({...e,queryKeyHashFn:r.hashFn});return n.queryKey=e.queryKey,n}])},121964,e=>{"use strict";function t(e,t){let r;try{r=e()}catch(e){return}return{getItem:e=>{var n;let a=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),i=null!=(n=r.getItem(e))?n:null;return i instanceof Promise?i.then(a):a(i)},setItem:(e,n)=>r.setItem(e,JSON.stringify(n,null==t?void 0:t.replacer)),removeItem:e=>r.removeItem(e)}}let r=e=>t=>{try{let n=e(t);if(n instanceof Promise)return n;return{then:e=>r(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>r(t)(e)}}};e.s(["createJSONStorage",0,t,"persist",0,(e,n)=>(a,i,o)=>{let s,c={storage:t(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...n},l=!1,u=0,d=new Set,h=new Set,f=c.storage;if(!f)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),a(...e)},i,o);let p=()=>{let e=c.partialize({...i()});return f.setItem(c.name,{state:e,version:c.version})},g=o.setState;o.setState=(e,t)=>(g(e,t),p());let m=e((...e)=>(a(...e),p()),i,o);o.getInitialState=()=>m;let y=()=>{var e,t;if(!f)return;let n=++u;l=!1,d.forEach(e=>{var t;return e(null!=(t=i())?t:m)});let o=(null==(t=c.onRehydrateStorage)?void 0:t.call(c,null!=(e=i())?e:m))||void 0;return r(f.getItem.bind(f))(c.name).then(e=>{if(e)if("number"!=typeof e.version||e.version===c.version)return[!1,e.state];else{if(c.migrate){let t=c.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(n!==u)return;let[r,o]=e;if(a(s=c.merge(o,null!=(t=i())?t:m),!0),r)return p()}).then(()=>{n===u&&(null==o||o(i(),void 0),s=i(),l=!0,h.forEach(e=>e(s)))}).catch(e=>{n===u&&(null==o||o(void 0,e))})};return o.persist={setOptions:e=>{c={...c,...e},e.storage&&(f=e.storage)},clearStorage:()=>{null==f||f.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>y(),hasHydrated:()=>l,onHydrate:e=>(d.add(e),()=>{d.delete(e)}),onFinishHydration:e=>(h.add(e),()=>{h.delete(e)})},c.skipHydration||y(),s||m}])},723325,e=>{"use strict";e.s(["swallow",0,e=>{try{return e()}catch{return}}])},766130,127183,e=>{"use strict";var t=e.i(918071),r=e.i(1941),n=e.i(668168);e.s(["MAGIC_DID_TOKEN_LIFESPAN_SECONDS",0,601200,"createLoginDidTokenSlot",0,()=>{let e;return{hold:(t,r)=>{e=t&&r?{token:t,address:r.toLowerCase()}:void 0},take:t=>{let r=e;return e=void 0,r?.address===t.toLowerCase()?r.token:void 0},clear:()=>{e=void 0}}}],127183);let a=async({chainId:e,connector:t,lifespanSeconds:r})=>{try{let n=t.getMagicSDK({chainId:e}),a=void 0===r?await n.user.getIdToken():await n.user.getIdToken({lifespan:r});return{status:"success",data:a}}catch(e){return{status:"failure",error:e}}},i=async({chainId:e,connector:t})=>a({chainId:e,connector:t,lifespanSeconds:601200}),o=async({chainId:e,connector:t,address:r})=>{let n=t.takeLoginDidToken?.(r);if(n)return{status:"success",data:n,magicTokenSource:"login"};let i=await a({chainId:e,connector:t});return"success"===i.status?{...i,magicTokenSource:"minted"}:i},s=async({connector:e,config:a,message:i,fields:o})=>
17{try{(0,n.isRabbyConnector)(e?.id)&&(await e?.isAuthorized(),await new Promise(e=>setTimeout(e,500)));let s=await (0,r.signMessage)(a,{message:i,account:o.address,connector:e}),{token:c,proof:l}=(({fields:e,message:r,signature:n})=>({token:t.Buffer.from(`${JSON.stringify(e)}:::${n}`).toString("base64"),proof:{method:"siwe",message:r,signature:n}}))({fields:o,message:i,signature:s});return{status:"success",data:c,proof:l}}catch(e){return{status:"failure",error:e}}};e.s(["getEoaTokenFromChallenge",0,s,"getFreshMagicDidToken",0,i,"getMagicLoginToken",0,o],766130)},669718,386740,e=>{"use strict";var t=e.i(723325),r=e.i(938466);let n=()=>{if(!window.localStorage)return r.noopStorage;let e=window.localStorage.setItem.bind(window.localStorage);return{removeItem:window.localStorage.removeItem.bind(window.localStorage),getItem:window.localStorage.getItem.bind(window.localStorage),setItem:(r,n)=>{(0,t.swallow)(()=>e(r,n))}}};function a(e){if(e)try{return JSON.parse(e)}catch{return}}function i(e){try{return JSON.stringify(e)}catch{return}}e.s(["createLocalStorage",0,n],386740);let o={account:"polymarket.auth.cache.account"};class s{#_;keys;constructor({storage:e=n(),config:t}={}){this.#_=e,t?this.keys={...o,...t}:this.keys=o}get all(){let e=a(this.#_?.getItem(this.keys.account));if(e&&"object"==typeof e)return e}set all(e){let r=i(e);r&&(0,t.swallow)(()=>this.#_?.setItem(this.keys.account,r))}clear(){(0,t.swallow)(()=>this.#_?.removeItem(this.keys.account))}get(e){let t=this.all;if(t)return t[e]}update(e,t){let r=this.all??{};this.all={...r,[e]:t}}}let c={email:"polymarket.auth.lastUsedEmail"};class l{#_;keys;constructor({storage:e=n(),config:t}={}){this.#_=e,t?this.keys={...c,...t}:this.keys=c}get value(){return(0,t.swallow)(()=>this.#_?.getItem(this.keys.email)??void 0)}set value(e){(0,t.swallow)(()=>this.#_?.setItem(this.keys.email,e))}clear(){(0,t.swallow)(()=>this.#_?.removeItem(this.keys.email))}}let u={wallet:"polymarket.auth.proxyWallet"};class d{#_;keys;constructor({storage:e=n(),config:t}={}){this.#_=e,t?this.keys={...u,...t}:this.keys=u}get value(){return(0,t.swallow)(()=>this.#_?.getItem(this.keys.wallet)??void 0)}set value(e){(0,t.swallow)(()=>this.#_?.setItem(this.keys.wallet,e))}clear(){(0,t.swallow)(()=>this.#_?.removeItem(this.keys.wallet))}}let h={state:"polymarket.auth.params"};class f{#_;keys;constructor({storage:e=n(),config:t}={}){this.#_=e,t?this.keys={...h,...t}:this.keys=h}get value(){return a(this.#_?.getItem(this.keys.state))}set value(e){let r=i(e);r&&(0,t.swallow)(()=>this.#_?.setItem(this.keys.state,r))}update(e){let t=this.value;if(!t)return;let r={...t,...e};return this.value=r,r}get exists(){return!!this.value}clear(){(0,t.swallow)(()=>this.#_?.removeItem(this.keys.state))}get magic(){let e=this.value;if(e&&"magic"===e.type)return e}get oauth(){let e=this.magic;if(e&&"oauth"===e.magicAuthType)return e}get email(){let e=this.magic;if(e&&"email"===e.magicAuthType)return e}getMagicState({type:e,connectionStates:t}={}){let r=this.magic;if(r&&(!e||e===r.magicAuthType)&&(!t||t.includes(r.connectionState)))return r}get canReconnect(){let e=this.magic;return!!e&&"ready"===e.connectionState}get oauthReconnecting(){let e=this.oauth;return!!e&&("requesting"===e.connectionState||"redirect"===e.connectionState||"after-redirect-result"===e.connectionState||"pending"===e.connectionState)}get oauthRedirected(){let e=this.oauth;return!!e&&"after-redirect-result"===e.connectionState}}let p={proofs:"polymarket.auth.sunbreakProofs"},g=/^Expiration Time: (.+)$/m,m=e=>!!e&&"object"==typeof e&&"method"in e&&"siwe"===e.method&&"message"in e&&"string"==typeof e.message&&"signature"in e&&"string"==typeof e.signature,y=e=>e&&"object"==typeof e&&"savedAt"in e&&"number"==typeof e.savedAt&&"proof"in e&&m(e.proof)?e.savedAt+6048e5>Date.now()?e:void 0:m(e)&&!(e=>{let t=g.exec(e.message)?.[1]?.trim();if(!t)return!1;let r=Date.parse(t);return Number.isFinite(r)&&r<=Date.now()})(e)?{proof:e,savedAt:Date.now()}:void 0;class w{#_;keys;constructor({storage:e=n(),config:t}={}){this.#_=e,this.keys={...p,...t}}#A(){let e=a(this.#_.getItem(this.keys.proofs));if(!e||"object"!=typeof e||Array.isArray(e))return{};let t={};for(let[r,n]of Object.entries(e)){let e=y(n);e&&(t[r.toLowerCase()]=e)}return t}#E(e){let r=i(e);r&&(0,t.swallow)(()=>this.#_.setItem(this.keys.proofs,r))}get all(){let e=this.#A();if(!Object.keys(e).length)return;let t={};for(let[r,n]of Object.entries(e))t[r]=n.proof;return t}get(e){return this.all?.[e.toLowerCase()]}set(e,t){this.#E({...this.#A(),[e.toLowerCase()]:{proof:t,savedAt:Date.now()}})}remove(e){let t=this.#A();if(Object.keys(t).length){if(delete t[e.toLowerCase()],Object.keys(t).length)return void this.#E(t);this.clear()}}clear(){(0,t.swallow)(()=>this.#_.removeItem(this.keys.proofs))}}class v{state;accounts;email;wallets;sunbreakProofs;constructor({storage:e=n(),config:t}={}){this.accounts=new s({storage:e,config:t?.accounts}
17),this.email=new l({storage:e,config:t?.email}),this.wallets=new d({storage:e,config:t?.wallets}),this.state=new f({storage:e,config:t?.state}),this.sunbreakProofs=new w({storage:e,config:t?.sunbreakProofs})}}e.s(["createWalletCache",0,e=>new v(e)],669718)},668168,e=>{"use strict";var t=e.i(669718);e.s(["isCoinbaseWalletConnector",0,e=>"coinbaseWalletSDK"===e,"isDenylistedConnector",0,e=>e&&["app.keplr","app.backpack"].includes(e),"isInjectedConnector",0,e=>"injected"===e,"isMagicConnector",0,e=>"magic"===e,"isMagicOauthConnector",0,e=>"magic"===e&&!!(0,t.createWalletCache)().state.oauth,"isMetaMaskConnector",0,e=>"metaMaskSDK"===e||"metaMask"===e,"isRabbyConnector",0,e=>"rabby"===e||"io.rabby"===e,"isWalletConnectConnector",0,e=>"walletConnect"===e])},443911,e=>{"use strict";let t,r,n,a="https://accounts.google.com/gsi/client";class i extends Error{constructor(e="Google One Tap dismissed by user."){super(e),this.name="GoogleOneTapDismissedError"}}class o extends Error{constructor(e="Google Identity Services unavailable."){super(e),this.name="GoogleOneTapUnavailableError"}}let s=()=>window.google?.accounts?.id;function c(e){try{e.cancel()}catch{return}}function l(){let e=r;r=void 0,e&&(clearTimeout(e.timeoutId),c(e.accountsId),e.reject(new i("Google One Tap cancelled."))),n&&!n.signal.aborted&&n.abort(new i("Google One Tap cancelled."))}async function u({clientId:e}){let h;l();let f=new AbortController;n=f;try{h=await (t||(t=new Promise((e,r)=>{let n=s();if(n)return void e(n);let i=document.querySelector(`script[src="${a}"]`)??document.createElement("script"),c=!1;function l(){clearTimeout(f),i.removeEventListener("load",d),i.removeEventListener("error",h)}function u(e){c||(c=!0,l(),t=void 0,i.remove(),r(e))}function d(){let t=s();if(t)c||(c=!0,l(),e(t));else u(new o("Google Identity Services loaded without accounts.id."))}function h(){u(new o(`Failed to load Google Identity Services: ${a}`))}let f=setTimeout(()=>{u(new o(`Timed out loading Google Identity Services: ${a}`))},15e3);i.addEventListener("load",d,{once:!0}),i.addEventListener("error",h,{once:!0}),i.parentNode||(i.src=a,i.async=!0,i.defer=!0,document.head.appendChild(i))})))}catch(e){if(f.signal.aborted)throw d(f.signal);throw e}if(f.signal.aborted)throw d(f.signal);return{jwt:await new Promise((t,n)=>{let a=!1,o=e=>{if(a)return;a=!0;let t=r;r=void 0,t&&clearTimeout(t.timeoutId),e()},s=setTimeout(()=>{c(h),o(()=>n(new i("Google One Tap timed out.")))},6e4);r={accountsId:h,reject:e=>o(()=>n(e)),timeoutId:s},h.initialize({client_id:e,callback:e=>{let r=e.credential;r?o(()=>t(r)):o(()=>n(Error("Google One Tap returned no credential.")))}}),h.prompt(e=>{if(e.isNotDisplayed?.())return void o(()=>n(new i(`Google One Tap not displayed: ${e.getNotDisplayedReason?.()??"unknown"}`)));if(e.isSkippedMoment?.())return void o(()=>n(new i(`Google One Tap skipped: ${e.getSkippedReason?.()??"unknown"}`)));if(e.isDismissedMoment?.()){let t=e.getDismissedReason?.();if("credential_returned"===t)return;o(()=>n(new i(`Google One Tap dismissed: ${t??"unknown"}`)))}})}),signal:f.signal}}function d(e){return e.reason instanceof i?e.reason:new i("Google One Tap cancelled.")}e.s(["GoogleOneTapDismissedError",0,i,"GoogleOneTapUnavailableError",0,o,"cancelGoogleOneTap",0,l,"getGoogleOneTapAbortError",0,d,"promptGoogleOneTap",0,u])}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.