"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),de=require("@solana/wallet-adapter-base"),tt=require("@solana/wallet-adapter-react"),le=require("@solana/wallet-adapter-wallets"),Oe=require("@wagmi/connectors"),W=require("@wagmi/core"),m=require("./index-CfQ9MLb-.js"),_=require("@tanstack/react-query"),G=require("lucide-react"),Dt=require("@radix-ui/react-dialog"),K=require("vaul"),qt=require("@radix-ui/react-scroll-area"),I=require("ethers"),nt=require("viem"),oe=require("sonner"),$=require("./index.browser.esm-Axi7-9eG.js"),ot=require("./constants-DHrYhKoh.js"),Se=require("next-auth/react"),Ne=require("./index-RLsrNeoQ.js"),F=require("framer-motion"),Ft=require("qrcode.react"),$t=require("@radix-ui/react-slot"),Ie=require("./chains.cjs");function qe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const D=qe(N),B=qe(Dt),ne=qe(qt);var Te={exports:{}},ye={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Le;function Bt(){if(Le)return ye;Le=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(o,s,r){var a=null;if(r!==void 0&&(a=""+r),s.key!==void 0&&(a=""+s.key),"key"in s){r={};for(var c in s)c!=="key"&&(r[c]=s[c])}else r=s;return s=r.ref,{$$typeof:e,type:o,key:a,ref:s!==void 0?s:null,props:r}}return ye.Fragment=t,ye.jsx=n,ye.jsxs=n,ye}var ve={};/**
 * @license React
 * react-jsx-runtime.development.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Ge;function Kt(){return Ge||(Ge=1,process.env.NODE_ENV!=="production"&&function(){function e(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===ge?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case v:return"Fragment";case y:return"Profiler";case g:return"StrictMode";case se:return"Suspense";case Ae:return"SuspenseList";case pe:return"Activity"}if(typeof u=="object")switch(typeof u.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),u.$$typeof){case R:return"Portal";case M:return(u.displayName||"Context")+".Provider";case E:return(u._context.displayName||"Context")+".Consumer";case q:var k=u.render;return u=u.displayName,u||(u=k.displayName||k.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case Re:return k=u.displayName||null,k!==null?k:e(u.type)||"Memo";case ke:k=u._payload,u=u._init;try{return e(u(k))}catch{}}return null}function t(u){return""+u}function n(u){try{t(u);var k=!1}catch{k=!0}if(k){k=console;var T=k.error,z=typeof Symbol=="function"&&Symbol.toStringTag&&u[Symbol.toStringTag]||u.constructor.name||"Object";return T.call(k,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",z),t(u)}}function o(u){if(u===v)return"<>";if(typeof u=="object"&&u!==null&&u.$$typeof===ke)return"<...>";try{var k=e(u);return k?"<"+k+">":"<...>"}catch{return"<...>"}}function s(){var u=ee.A;return u===null?null:u.getOwner()}function r(){return Error("react-stack-top-frame")}function a(u){if(S.call(u,"key")){var k=Object.getOwnPropertyDescriptor(u,"key").get;if(k&&k.isReactWarning)return!1}return u.key!==void 0}function c(u,k){function T(){he||(he=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",k))}T.isReactWarning=!0,Object.defineProperty(u,"key",{get:T,configurable:!0})}function l(){var u=e(this.type);return te[u]||(te[u]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),u=this.props.ref,u!==void 0?u:null}function d(u,k,T,z,J,L,We,Me){return T=L.ref,u={$$typeof:x,type:u,key:k,props:L,_owner:J},(T!==void 0?T:null)!==null?Object.defineProperty(u,"ref",{enumerable:!1,get:l}):Object.defineProperty(u,"ref",{enumerable:!1,value:null}),u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(u,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(u,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:We}),Object.defineProperty(u,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Me}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u}function b(u,k,T,z,J,L,We,Me){var O=k.children;if(O!==void 0)if(z)if(Pe(O)){for(z=0;z<O.length;z++)w(O[z]);Object.freeze&&Object.freeze(O)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(O);if(S.call(k,"key")){O=e(u);var ce=Object.keys(k).filter(function(_t){return _t!=="key"});z=0<ce.length?"{key: someKey, "+ce.join(": ..., ")+": ...}":"{key: someKey}",H[O+z]||(ce=0<ce.length?"{"+ce.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
  let props = %s;
  <%s {...props} />
React keys must be passed directly to JSX without using spread:
  let props = %s;
  <%s key={someKey} {...props} />`,z,O,ce,O),H[O+z]=!0)}if(O=null,T!==void 0&&(n(T),O=""+T),a(k)&&(n(k.key),O=""+k.key),"key"in k){T={};for(var ze in k)ze!=="key"&&(T[ze]=k[ze])}else T=k;return O&&c(T,typeof u=="function"?u.displayName||u.name||"Unknown":u),d(u,O,L,J,s(),T,We,Me)}function w(u){typeof u=="object"&&u!==null&&u.$$typeof===x&&u._store&&(u._store.validated=1)}var f=N,x=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),M=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),Ae=Symbol.for("react.suspense_list"),Re=Symbol.for("react.memo"),ke=Symbol.for("react.lazy"),pe=Symbol.for("react.activity"),ge=Symbol.for("react.client.reference"),ee=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,S=Object.prototype.hasOwnProperty,Pe=Array.isArray,Y=console.createTask?console.createTask:function(){return null};f={"react-stack-bottom-frame":function(u){return u()}};var he,te={},xe=f["react-stack-bottom-frame"].bind(f,r)(),ae=Y(o(r)),H={};ve.Fragment=v,ve.jsx=function(u,k,T,z,J){var L=1e4>ee.recentlyCreatedOwnerStacks++;return b(u,k,T,!1,z,J,L?Error("react-stack-top-frame"):xe,L?Y(o(u)):ae)},ve.jsxs=function(u,k,T,z,J){var L=1e4>ee.recentlyCreatedOwnerStacks++;return b(u,k,T,!0,z,J,L?Error("react-stack-top-frame"):xe,L?Y(o(u)):ae)}}()),ve}var Ue;function Lt(){return Ue||(Ue=1,process.env.NODE_ENV==="production"?Te.exports=Bt():Te.exports=Kt()),Te.exports}var i=Lt();const rt=new _.QueryClient,Ve={home:"Login",account:"Account",walletConnecting:"Wallet Connecting",selectETHWallet:"Select ETH Wallet",selectSolanaWallet:"Select Solana Wallet",walletqr:"Wallet QR",switchAccount:"Switch Account",switchingAccount:"Switching Account",switchChain:"Switch Chain",switchingChain:"Switching Chain",withdrawFunds:"Withdraw Funds",withdrawingFunds:"Withdrawing Funds",accountSigning:"Account Signing"},p={home:"home",account:"account",accountSigning:"accountSigning",socialConnecting:"socialConnecting",walletConnecting:"walletConnecting",selectETHWallet:"selectETHWallet",selectSolanaWallet:"selectSolanaWallet",walletqr:"walletqr",switchAccount:"switchAccount",switchingAccount:"switchingAccount",switchChain:"switchChain",switchingChain:"switchingChain",withdrawFunds:"withdrawFunds"},Fe=N.createContext({chains:[],wagmiConfig:null,pendingItem:null,setPendingItem:()=>{},open:!1,setOpen:()=>{},router:p.home,setRouter:()=>{}}),C=()=>N.useContext(Fe),Gt=()=>{const{open:e,setOpen:t,...n}=N.useContext(Fe);return{isOpen:e,openModal:()=>{t(!0)},closeModal:()=>{t(!1)},...n}},Ut=({children:e,chains:t,host:n,name:o,description:s,icon:r,projectId:a})=>{const[c,l]=N.useState(!1),[d,b]=N.useState(null),[w,f]=N.useState(null),x=N.useRef(Oe.walletConnect({projectId:a,metadata:{name:o,description:s,url:n,icons:[r]},showQrModal:!1,qrModalOptions:{themeMode:"dark"}})),R=N.useMemo(()=>{const g=t.filter(E=>E.network.symbol===m.NetworkSymbols.eth),y=!(typeof window>"u")&&(window==null?void 0:window.parent)!==window;return W.createConfig({chains:g,connectors:[W.injected({target:"metaMask"}),x.current,Oe.coinbaseWallet({appName:o,appLogoUrl:r,overrideIsMetaMask:!1,preference:"all"}),...y?[Oe.safe({allowedDomains:[/gnosis-safe.io$/,/app.safe.global$/]})]:[]],storage:W.createStorage({storage:W.cookieStorage}),transports:Object.fromEntries(g.map(E=>[E.id,W.http()]))})},[t]),v=N.useMemo(()=>[new le.CoinbaseWalletAdapter,new le.PhantomWalletAdapter,new le.SafePalWalletAdapter,new le.SolflareWalletAdapter,new le.TrustWalletAdapter,new le.WalletConnectWalletAdapter({network:de.WalletAdapterNetwork.Mainnet,options:{relayUrl:"wss://relay.walletconnect.com",projectId:a,metadata:{name:o,description:s,url:n,icons:[r]}}})],[]);return i.jsx(Fe.Provider,{value:{chains:t,wagmiConfig:R,open:c,setOpen:l,router:d,setRouter:b,pendingItem:w,setPendingItem:f},children:i.jsx(tt.WalletProvider,{wallets:v,autoConnect:!0,children:i.jsx(_.QueryClientProvider,{client:rt,children:e})})})};function it(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=it(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function st(){for(var e,t,n=0,o="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=it(e))&&(o&&(o+=" "),o+=t);return o}const $e="-",Vt=e=>{const t=Ht(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:a=>{const c=a.split($e);return c[0]===""&&c.length!==1&&c.shift(),at(c,t)||Yt(a)},getConflictingClassGroupIds:(a,c)=>{const l=n[a]||[];return c&&o[a]?[...l,...o[a]]:l}}},at=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],o=t.nextPart.get(n),s=o?at(e.slice(1),o):void 0;if(s)return s;if(t.validators.length===0)return;const r=e.join($e);return(a=t.validators.find(({validator:c})=>c(r)))==null?void 0:a.classGroupId},Ye=/^\[(.+)\]$/,Yt=e=>{if(Ye.test(e)){const t=Ye.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Ht=e=>{const{theme:t,prefix:n}=e,o={nextPart:new Map,validators:[]};return Qt(Object.entries(e.classGroups),n).forEach(([r,a])=>{De(a,o,r,t)}),o},De=(e,t,n,o)=>{e.forEach(s=>{if(typeof s=="string"){const r=s===""?t:He(t,s);r.classGroupId=n;return}if(typeof s=="function"){if(Jt(s)){De(s(o),t,n,o);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([r,a])=>{De(a,He(t,r),n,o)})})},He=(e,t)=>{let n=e;return t.split($e).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},Jt=e=>e.isThemeGetter,Qt=(e,t)=>t?e.map(([n,o])=>{const s=o.map(r=>typeof r=="string"?t+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([a,c])=>[t+a,c])):r);return[n,s]}):e,Xt=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,o=new Map;const s=(r,a)=>{n.set(r,a),t++,t>e&&(t=0,o=n,n=new Map)};return{get(r){let a=n.get(r);if(a!==void 0)return a;if((a=o.get(r))!==void 0)return s(r,a),a},set(r,a){n.has(r)?n.set(r,a):s(r,a)}}},ct="!",Zt=e=>{const{separator:t,experimentalParseClassName:n}=e,o=t.length===1,s=t[0],r=t.length,a=c=>{const l=[];let d=0,b=0,w;for(let g=0;g<c.length;g++){let y=c[g];if(d===0){if(y===s&&(o||c.slice(g,g+r)===t)){l.push(c.slice(b,g)),b=g+r;continue}if(y==="/"){w=g;continue}}y==="["?d++:y==="]"&&d--}const f=l.length===0?c:c.substring(b),x=f.startsWith(ct),R=x?f.substring(1):f,v=w&&w>b?w-b:void 0;return{modifiers:l,hasImportantModifier:x,baseClassName:R,maybePostfixModifierPosition:v}};return n?c=>n({className:c,parseClassName:a}):a},en=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(o=>{o[0]==="["?(t.push(...n.sort(),o),n=[]):n.push(o)}),t.push(...n.sort()),t},tn=e=>({cache:Xt(e.cacheSize),parseClassName:Zt(e),...Vt(e)}),nn=/\s+/,on=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:s}=t,r=[],a=e.trim().split(nn);let c="";for(let l=a.length-1;l>=0;l-=1){const d=a[l],{modifiers:b,hasImportantModifier:w,baseClassName:f,maybePostfixModifierPosition:x}=n(d);let R=!!x,v=o(R?f.substring(0,x):f);if(!v){if(!R){c=d+(c.length>0?" "+c:c);continue}if(v=o(f),!v){c=d+(c.length>0?" "+c:c);continue}R=!1}const g=en(b).join(":"),y=w?g+ct:g,E=y+v;if(r.includes(E))continue;r.push(E);const M=s(v,R);for(let q=0;q<M.length;++q){const se=M[q];r.push(y+se)}c=d+(c.length>0?" "+c:c)}return c};function rn(){let e=0,t,n,o="";for(;e<arguments.length;)(t=arguments[e++])&&(n=lt(t))&&(o&&(o+=" "),o+=n);return o}const lt=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=lt(e[o]))&&(n&&(n+=" "),n+=t);return n};function sn(e,...t){let n,o,s,r=a;function a(l){const d=t.reduce((b,w)=>w(b),e());return n=tn(d),o=n.cache.get,s=n.cache.set,r=c,c(l)}function c(l){const d=o(l);if(d)return d;const b=on(l,n);return s(l,b),b}return function(){return r(rn.apply(null,arguments))}}const A=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},dt=/^\[(?:([a-z-]+):)?(.+)\]$/i,an=/^\d+\/\d+$/,cn=new Set(["px","full","screen"]),ln=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,un=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,wn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,U=e=>ue(e)||cn.has(e)||an.test(e),Q=e=>we(e,"length",yn),ue=e=>!!e&&!Number.isNaN(Number(e)),_e=e=>we(e,"number",ue),Ce=e=>!!e&&Number.isInteger(Number(e)),fn=e=>e.endsWith("%")&&ue(e.slice(0,-1)),h=e=>dt.test(e),X=e=>ln.test(e),mn=new Set(["length","size","percentage"]),kn=e=>we(e,mn,ut),pn=e=>we(e,"position",ut),gn=new Set(["image","url"]),hn=e=>we(e,gn,Cn),xn=e=>we(e,"",vn),je=()=>!0,we=(e,t,n)=>{const o=dt.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):n(o[2]):!1},yn=e=>dn.test(e)&&!un.test(e),ut=()=>!1,vn=e=>wn.test(e),Cn=e=>bn.test(e),jn=()=>{const e=A("colors"),t=A("spacing"),n=A("blur"),o=A("brightness"),s=A("borderColor"),r=A("borderRadius"),a=A("borderSpacing"),c=A("borderWidth"),l=A("contrast"),d=A("grayscale"),b=A("hueRotate"),w=A("invert"),f=A("gap"),x=A("gradientColorStops"),R=A("gradientColorStopPositions"),v=A("inset"),g=A("margin"),y=A("opacity"),E=A("padding"),M=A("saturate"),q=A("scale"),se=A("sepia"),Ae=A("skew"),Re=A("space"),ke=A("translate"),pe=()=>["auto","contain","none"],ge=()=>["auto","hidden","clip","visible","scroll"],ee=()=>["auto",h,t],S=()=>[h,t],Pe=()=>["",U,Q],Y=()=>["auto",ue,h],he=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],te=()=>["solid","dashed","dotted","double","none"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>["start","end","center","between","around","evenly","stretch"],H=()=>["","0",h],u=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>[ue,h];return{cacheSize:500,separator:":",theme:{colors:[je],spacing:[U,Q],blur:["none","",X,h],brightness:k(),borderColor:[e],borderRadius:["none","","full",X,h],borderSpacing:S(),borderWidth:Pe(),contrast:k(),grayscale:H(),hueRotate:k(),invert:H(),gap:S(),gradientColorStops:[e],gradientColorStopPositions:[fn,Q],inset:ee(),margin:ee(),opacity:k(),padding:S(),saturate:k(),scale:k(),sepia:H(),skew:k(),space:S(),translate:S()},classGroups:{aspect:[{aspect:["auto","square","video",h]}],container:["container"],columns:[{columns:[X]}],"break-after":[{"break-after":u()}],"break-before":[{"break-before":u()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...he(),h]}],overflow:[{overflow:ge()}],"overflow-x":[{"overflow-x":ge()}],"overflow-y":[{"overflow-y":ge()}],overscroll:[{overscroll:pe()}],"overscroll-x":[{"overscroll-x":pe()}],"overscroll-y":[{"overscroll-y":pe()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ce,h]}],basis:[{basis:ee()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",h]}],grow:[{grow:H()}],shrink:[{shrink:H()}],order:[{order:["first","last","none",Ce,h]}],"grid-cols":[{"grid-cols":[je]}],"col-start-end":[{col:["auto",{span:["full",Ce,h]},h]}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":[je]}],"row-start-end":[{row:["auto",{span:[Ce,h]},h]}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",h]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",h]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...ae()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ae(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ae(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[Re]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[Re]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",h,t]}],"min-w":[{"min-w":[h,t,"min","max","fit"]}],"max-w":[{"max-w":[h,t,"none","full","min","max","fit","prose",{screen:[X]},X]}],h:[{h:[h,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[h,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[h,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[h,t,"auto","min","max","fit"]}],"font-size":[{text:["base",X,Q]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",_e]}],"font-family":[{font:[je]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",h]}],"line-clamp":[{"line-clamp":["none",ue,_e]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",U,h]}],"list-image":[{"list-image":["none",h]}],"list-style-type":[{list:["none","disc","decimal",h]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",U,Q]}],"underline-offset":[{"underline-offset":["auto",U,h]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",h]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",h]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...he(),pn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",kn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},hn]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[R]}],"gradient-via-pos":[{via:[R]}],"gradient-to-pos":[{to:[R]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[r]}],"rounded-s":[{"rounded-s":[r]}],"rounded-e":[{"rounded-e":[r]}],"rounded-t":[{"rounded-t":[r]}],"rounded-r":[{"rounded-r":[r]}],"rounded-b":[{"rounded-b":[r]}],"rounded-l":[{"rounded-l":[r]}],"rounded-ss":[{"rounded-ss":[r]}],"rounded-se":[{"rounded-se":[r]}],"rounded-ee":[{"rounded-ee":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-br":[{"rounded-br":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...te(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:te()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...te()]}],"outline-offset":[{"outline-offset":[U,h]}],"outline-w":[{outline:[U,Q]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[U,Q]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",X,xn]}],"shadow-color":[{shadow:[je]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...xe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":xe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[o]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",X,h]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[b]}],invert:[{invert:[w]}],saturate:[{saturate:[M]}],sepia:[{sepia:[se]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[M]}],"backdrop-sepia":[{"backdrop-sepia":[se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",h]}],duration:[{duration:k()}],ease:[{ease:["linear","in","out","in-out",h]}],delay:[{delay:k()}],animate:[{animate:["none","spin","ping","pulse","bounce",h]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[q]}],"scale-x":[{"scale-x":[q]}],"scale-y":[{"scale-y":[q]}],rotate:[{rotate:[Ce,h]}],"translate-x":[{"translate-x":[ke]}],"translate-y":[{"translate-y":[ke]}],"skew-x":[{"skew-x":[Ae]}],"skew-y":[{"skew-y":[Ae]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",h]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",h]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",h]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[U,Q,_e]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Nn=sn(jn);function j(...e){return Nn(st(e))}const Sn=B.Root,En=B.Portal,wt=D.forwardRef(({className:e,...t},n)=>i.jsx(B.Overlay,{ref:n,className:j("web3kit-fixed web3kit-inset-0 web3kit-z-20 web3kit-bg-white/20 data-[state=open]:web3kit-animate-in data-[state=closed]:web3kit-animate-out data-[state=closed]:web3kit-fade-out-0 data-[state=open]:web3kit-fade-in-0",e),...t}));wt.displayName=B.Overlay.displayName;const bt=D.forwardRef(({className:e,children:t,...n},o)=>i.jsxs(En,{children:[i.jsx(wt,{className:"DialogContent"}),i.jsxs(B.Content,{ref:o,className:j("web3kit-fixed web3kit-left-[50%] web3kit-top-[50%] web3kit-z-20 web3kit-grid web3kit-w-full web3kit-max-w-lg web3kit-translate-x-[-50%] web3kit-translate-y-[-50%] web3kit-gap-4 web3kit-border web3kit-bg-background web3kit-p-6 web3kit-shadow-lg web3kit-duration-200 data-[state=open]:web3kit-animate-in data-[state=closed]:web3kit-animate-out data-[state=closed]:web3kit-fade-out-0 data-[state=open]:web3kit-fade-in-0 data-[state=closed]:web3kit-zoom-out-95 data-[state=open]:web3kit-zoom-in-95 data-[state=closed]:web3kit-slide-out-to-left-1/2 data-[state=closed]:web3kit-slide-out-to-top-[48%] data-[state=open]:web3kit-slide-in-from-left-1/2 data-[state=open]:web3kit-slide-in-from-top-[48%] sm:web3kit-rounded-lg",e),...n,children:[t,i.jsxs(B.Close,{className:"web3kit-absolute web3kit-right-4 web3kit-top-4 web3kit-rounded-sm web3kit-opacity-70 web3kit-ring-offset-background web3kit-transition-opacity hover:web3kit-opacity-100 focus:web3kit-outline-none focus:web3kit-ring-2 focus:web3kit-ring-ring focus:web3kit-ring-offset-2 disabled:web3kit-pointer-events-none data-[state=open]:web3kit-bg-accent data-[state=open]:web3kit-text-muted-foreground",children:[i.jsx(G.X,{className:"web3kit-h-4 web3kit-w-4"}),i.jsx("span",{className:"web3kit-sr-only",children:"Close"})]})]})]}));bt.displayName=B.Content.displayName;const ft=D.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:j("web3kit-flex web3kit-flex-col web3kit-space-y-1.5 web3kit-text-center sm:web3kit-text-left",e),...t}));ft.displayName="DialogHeader";const mt=D.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:j("web3kit-flex web3kit-flex-col-reverse sm:web3kit-flex-row sm:web3kit-justify-end sm:web3kit-space-x-2",e),...t}));mt.displayName="DialogFooter";const kt=D.forwardRef(({className:e,...t},n)=>i.jsx(B.Title,{ref:n,className:j("web3kit-text-lg web3kit-font-semibold web3kit-leading-none web3kit-tracking-tight",e),...t}));kt.displayName=B.Title.displayName;const pt=D.forwardRef(({className:e,...t},n)=>i.jsx(B.Description,{ref:n,className:j("web3kit-text-sm web3kit-text-muted-foreground",e),...t}));pt.displayName=B.Description.displayName;const gt=({shouldScaleBackground:e=!0,...t})=>i.jsx(K.Drawer.Root,{shouldScaleBackground:e,...t});gt.displayName="Drawer";K.Drawer.Trigger;const An=K.Drawer.Portal;K.Drawer.Close;const ht=D.forwardRef(({className:e,...t},n)=>i.jsx(K.Drawer.Overlay,{ref:n,className:j("web3kit-fixed web3kit-inset-0 web3kit-z-20 web3kit-bg-black/80",e),...t}));var Xe;ht.displayName=((Xe=K.Drawer.Overlay)==null?void 0:Xe.displayName)||"DrawerOverlay";const xt=D.forwardRef(({className:e,children:t,...n},o)=>i.jsxs(An,{children:[i.jsx(ht,{}),i.jsxs(K.Drawer.Content,{ref:o,className:j("web3kit-fixed web3kit-inset-x-0 web3kit-bottom-0 web3kit-z-20 web3kit-mt-24 web3kit-flex web3kit-h-auto web3kit-flex-col web3kit-rounded-t-[10px] web3kit-border web3kit-bg-background",e),...n,children:[i.jsx("div",{className:"web3kit-mx-auto web3kit-mt-4 web3kit-h-2 web3kit-w-[100px] web3kit-rounded-full web3kit-bg-muted"}),t]})]}));xt.displayName="DrawerContent";const yt=({className:e,...t})=>i.jsx("div",{className:j("web3kit-grid web3kit-gap-1.5 web3kit-p-4 web3kit-text-center sm:web3kit-text-left",e),...t});yt.displayName="DrawerHeader";const vt=({className:e,...t})=>i.jsx("div",{className:j("web3kit-mt-auto web3kit-flex web3kit-flex-col web3kit-gap-2 web3kit-p-4",e),...t});vt.displayName="DrawerFooter";const Ct=D.forwardRef(({className:e,...t},n)=>i.jsx(K.Drawer.Title,{ref:n,className:j("web3kit-text-lg web3kit-font-semibold web3kit-leading-none web3kit-tracking-tight",e),...t}));var Ze;Ct.displayName=((Ze=K.Drawer.Title)==null?void 0:Ze.displayName)||"DrawerTitle";const jt=D.forwardRef(({className:e,...t},n)=>i.jsx(K.Drawer.Description,{ref:n,className:j("web3kit-text-sm web3kit-text-muted-foreground",e),...t}));var et;jt.displayName=((et=K.Drawer.Description)==null?void 0:et.displayName)||"DrawerDescription";const Nt=D.forwardRef(({className:e,children:t,...n},o)=>i.jsxs(ne.Root,{ref:o,className:j("web3kit-relative web3kit-overflow-hidden",e),...n,children:[i.jsx(ne.Viewport,{className:"web3kit-h-full web3kit-w-full web3kit-rounded-[inherit]",children:t}),i.jsx(St,{}),i.jsx(ne.Corner,{})]}));Nt.displayName=ne.Root.displayName;const St=D.forwardRef(({className:e,orientation:t="vertical",...n},o)=>i.jsx(ne.ScrollAreaScrollbar,{ref:o,orientation:t,className:j("web3kit-flex web3kit-touch-none web3kit-select-none web3kit-transition-colors",t==="vertical"&&"web3kit-h-full web3kit-w-2.5 web3kit-border-l web3kit-border-l-transparent web3kit-p-[1px]",t==="horizontal"&&"web3kit-h-2.5 web3kit-flex-col web3kit-border-t web3kit-border-t-transparent web3kit-p-[1px]",e),...n,children:i.jsx(ne.ScrollAreaThumb,{className:"web3kit-relative web3kit-flex-1 web3kit-rounded-full web3kit-bg-border"})}));St.displayName=ne.ScrollAreaScrollbar.displayName;const be="(min-width: 768px)",Rn=({className:e,children:t,...n})=>{const s=fe(be)?Sn:gt;return i.jsx(s,{...n,className:j("web3kit-transition-transform web3kit-duration-300",e),children:t})},Pn=({className:e,children:t,...n})=>{const s=fe(be)?bt:xt;return i.jsx(s,{className:j("web3kit-bg-card web3kit-text-card-foreground !web3kit-border-0 !web3kit-rounded-3xl md:web3kit-max-w-[380px] [&>button]:web3kit-right-[26px] [&>button]:web3kit-top-[26px] web3kit-transition-transform web3kit-duration-300",e),onOpenAutoFocus:r=>r.preventDefault(),...n,children:t})},Tn=({className:e,children:t,...n})=>{const s=fe(be)?pt:jt;return i.jsx(s,{className:e,...n,children:t})},In=({className:e,children:t,...n})=>{const s=fe(be)?ft:yt;return i.jsx(s,{className:j("web3kit-space-y-0 web3kit-pb-6 md:web3kit-pb-3",e),...n,children:t})},Wn=({className:e,children:t,...n})=>{const s=fe(be)?kt:Ct;return i.jsx(s,{className:j("web3kit-text-center web3kit-py-2",e),...n,children:t})},Mn=({className:e,children:t,...n})=>i.jsx(Nt,{className:j("web3kit-h-[260px] web3kit-max-h-[350px] web3kit-px-6 md:web3kit-h-full md:web3kit-min-h-[260px] md:web3kit-px-0",e),...n,children:i.jsx("div",{className:"web3kit-space-y-2",children:t})}),zn=({className:e,children:t,...n})=>{const s=fe(be)?mt:vt;return i.jsx(s,{className:j("web3kit-py-3.5 md:web3kit-py-0",e),...n,children:i.jsx("div",{className:"web3kit-flex web3kit-flex-col web3kit-gap-y-4 web3kit-w-full",children:t})})};function fe(e){const[t,n]=D.useState(!1);return D.useEffect(()=>{const o=matchMedia(e);n(o.matches);const s=r=>n(r.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),t}function On(e){var s,r;const{chain:t,transport:n}=e,o={chainId:t.id,name:t.name,ensAddress:(r=(s=t.contracts)==null?void 0:s.ensRegistry)==null?void 0:r.address};if(n.type==="fallback"){const a=n.transports.map(({value:c})=>new I.JsonRpcProvider(c==null?void 0:c.url,o));return a.length===1?a[0]:new I.FallbackProvider(a)}return new I.JsonRpcProvider(n.url,o)}function Et(e,{chainId:t}={}){const n=W.getClient(e,{chainId:t});if(n)return On(n)}function P(){const{chains:e}=C(),{data:t,update:n}=Se.useSession(),{chainId:o=0,network:s="",address:r="",social:a="",name:c="",image:l="",role:d="",provider:b="",users:w=[]}=(t==null?void 0:t.user)||{},f=e.find(x=>x.id===o);return{address:r,chainId:o,social:a,image:l,name:c,role:d,network:s,provider:b,users:w,chain:f,switchChain:async x=>{await n({id:"switchChain",chainId:x})},switchAccount:async(x,R)=>{await n({id:"switchAccount",network:x,address:R})}}}function Be(){var o,s,r,a,c;const{chainId:e}=P(),{chains:t}=C(),n=t.find(l=>l.id===e);return{chainLogo:(n==null?void 0:n.logo)||m.M,networkLogo:((o=n==null?void 0:n.network)==null?void 0:o.logo)||m.M,nativeSymbol:((s=n==null?void 0:n.nativeCurrency)==null?void 0:s.symbol)||"",nativeDecimals:((r=n==null?void 0:n.nativeCurrency)==null?void 0:r.decimals)||18,txExplorer:((a=n==null?void 0:n.blockExplorers)==null?void 0:a.default.hash)||"",addressExplorer:((c=n==null?void 0:n.blockExplorers)==null?void 0:c.default.address)||""}}function Ke(){return _.useQuery({queryKey:["use-social-providers"],queryFn:async()=>{const e=await Se.getProviders();return Object.values(e||{}).filter(t=>t.id!=="credentials")}})}function Z(){const{wagmiConfig:e}=C(),{data:t,...n}=_.useQuery({queryKey:["use-eth-wallets"],queryFn:async()=>{const o={metaMask:m.b,walletConnect:m.m,coinbaseWalletSDK:m.j};return(await W.getConnectors(e)).map(r=>(r.isInstalled=r.type==="mock"||r.type==="injected"&&r.id!=="metaMask"||r.id==="coinbaseWalletSDK",r.icon=o[r.id]||r.icon,r)).filter((r,a,c)=>c.findIndex(l=>l.id===r.id)===a).map(r=>r.id==="walletConnect"?{...r,name:"WalletConnect"}:r).filter((r,a,c)=>!(r.id==="coinbaseWalletSDK"&&c.find(l=>l.id==="com.coinbase.wallet"))).filter((r,a,c)=>!((r.id==="metaMaskSDK"||r.id==="metaMask")&&c.find(l=>l.id==="io.metamask"||l.id==="io.metamask.mobile"))).sort((r,a)=>{const c=r.isInstalled&&r.type==="injected",l=a.isInstalled&&a.type==="injected";return c&&!l?-1:!c&&l?1:0}).sort((r,a)=>r.id==="walletConnect"?1:a.id==="walletConnect"?-1:0)}});return{...n,data:t||[]}}function re(){const{wallets:e,connect:t,disconnect:n,select:o,signMessage:s}=tt.useWallet();return{solConnect:t,solDisconnect:n,solSelect:o,solSignMessage:s,solWallets:e.filter(r=>r.readyState===de.WalletReadyState.Installed||r.readyState===de.WalletReadyState.Loadable).sort((r,a)=>a.readyState===de.WalletReadyState.Installed?1:-1).map(r=>r.adapter)}}function Ee({chainId:e}={}){const{chains:t,wagmiConfig:n}=C(),{chainId:o}=P(),s=e||o,r=t.find(l=>l.id===s);if(!r)throw new Error("Chain not found");const a=r.network.symbol;let c;switch(a){case m.NetworkSymbols.eth:c=o?Et(n,{chainId:s}):new I.JsonRpcProvider(r.rpcUrls.default.http[0]);break;case m.NetworkSymbols.sol:c=new $.Connection($.clusterApiUrl(ot.isMainnet?de.WalletAdapterNetwork.Mainnet:de.WalletAdapterNetwork.Devnet),"confirmed");break}return c}function At({address:e,chainId:t}={}){const{chainId:n,address:o}=P(),{chains:s}=C(),r=t||n,a=s.find(f=>f.id===r);if(!a)throw new Error("Chain not found");const c=a.network.symbol,l=e||o,d=Ee({chainId:r}),{data:b,...w}=_.useQuery({queryKey:["use-account-balance",{chainId:r,network:c,address:l}],queryFn:async function(){if(!l)return 0n;switch(c){case m.NetworkSymbols.eth:return d instanceof I.JsonRpcProvider||d instanceof I.FallbackProvider?await d.getBalance(l):0n;case m.NetworkSymbols.sol:if(d instanceof $.Connection){const f=await d.getBalance(new $.PublicKey(l));return BigInt(f)}return 0n;default:return 0n}}});return{...w,data:b}}function _n({address:e,tokenAddress:t,chainId:n}){const{chainId:o,address:s}=P(),{chains:r}=C(),a=n||o,c=r.find(x=>x.id===a);if(!c)throw new Error("Chain not found");const l=c.network.symbol,d=Ee({chainId:a}),b=e||s,{data:w,...f}=_.useQuery({queryKey:["use-token-balance",{chainId:a,address:b,tokenAddress:t}],queryFn:async function(){if(!b)return 0n;switch(l){case m.NetworkSymbols.eth:return d instanceof I.JsonRpcProvider||d instanceof I.FallbackProvider?await new I.Contract(t,nt.erc20Abi,d).balanceOf(b):0n;case m.NetworkSymbols.sol:if(d instanceof $.Connection){const x=await d.getTokenAccountsByOwner(new $.PublicKey(b),{mint:new $.PublicKey(t)});if(x.value.length===0)return 0n;const R=await d.getTokenAccountBalance(x.value[0].pubkey);return BigInt(R.value.amount)}return 0n;default:return 0n}}});return{...f,data:w||0n}}function Rt(){const{chains:e,pendingItem:t,wagmiConfig:n,setRouter:o,setPendingItem:s}=C(),{solWallets:r}=re(),{data:a}=Z(),{data:c}=Ke();return _.useMutation({mutationKey:["use-connect",{id:t==null?void 0:t.id,network:t==null?void 0:t.network}],mutationFn:async()=>{if(t)if(t.network===m.NetworkSymbols.eth){const l=a.find(w=>w.id===t.id);if(!l)throw new Error(`Wallet ${t.id} not found`);try{await W.disconnect(n,{connector:l})}catch{}let d=null;try{const w=await W.connect(n,{connector:l});d={chainId:w.chainId,accounts:Array.from(w.accounts)}}catch(w){if(!(w instanceof W.ConnectorAlreadyConnectedError))throw console.log("error",w),w}if(!d){const w=W.getChainId(n),f=W.getAccount(n);d={chainId:w,accounts:f!=null&&f.address?[f.address]:[]}}if(!(d!=null&&d.chainId))throw new Error("Failed to connect to wallet");console.log({chainId:d.chainId});const b=e.find(w=>w.id===d.chainId);if(!b){const w=e.find(f=>f.network.symbol===m.NetworkSymbols.eth);if(!w)throw new Error("Chain not found");await W.switchChain(n,{connector:l,chainId:w.id})}o(()=>{var w;return s({id:l==null?void 0:l.id,name:l==null?void 0:l.name,logo:l==null?void 0:l.icon,network:m.NetworkSymbols.eth,chainId:b.id,address:(w=d==null?void 0:d.accounts)==null?void 0:w[0]}),p.accountSigning})}else if(t.network===m.NetworkSymbols.sol){const l=r.find(d=>d.name===t.id);if(!l)throw new Error(`Wallet ${t.id} not found`);l.connected&&await l.disconnect(),await l.connect()}else{const l=c.find(d=>d.id===t.id);if(!l)throw new Error(`Provider ${t.id} not found`);await Se.signIn(l.id),oe.toast.success("Redirecting to oauth provider")}},onSuccess:()=>{oe.toast.success("Connected to wallet")},onError:l=>{throw console.log("connect error",l),l}})}function Dn(){var l;const{address:e,social:t,chain:n,network:o,provider:s,switchChain:r}=P(),{wagmiConfig:a}=C(),{data:c}=Z();return _.useMutation({mutationKey:["use-switch-chain",{social:t,network:(l=n==null?void 0:n.network)==null?void 0:l.symbol}],mutationFn:async d=>{if(e)if(t)await r(d);else if(o===m.NetworkSymbols.eth){const b=c.find(w=>w.id===s);if(!b)throw new Error(`Wallet ${s} not found`);await W.switchChain(a,{connector:b,chainId:d})}else throw o===m.NetworkSymbols.sol?new Error("Solana wallet does not support chain switching"):new Error("Unknown network")},onSuccess:()=>{oe.toast.success("Switched to chain")},onError:d=>{throw console.log("switch chain error",d),d}})}function qn(){const{pendingItem:e,wagmiConfig:t}=C(),{solWallets:n}=re(),{data:o}=Z(),s=process.env.SIGN_MESSAGE_CONTENT||ot.signMessageContent;return _.useMutation({mutationKey:["use-sign-account",{id:e==null?void 0:e.id,network:e==null?void 0:e.network}],mutationFn:async()=>{if(!e)return;let r;if(e.network===m.NetworkSymbols.eth){const a=o.find(c=>c.id===e.id);if(!a)throw new Error(`Wallet ${e.id} not found`);r=await W.signMessage(t,{connector:a,message:s})}else if(e.network===m.NetworkSymbols.sol){const a=n.find(l=>l.name===e.id);if(!a)throw new Error(`Wallet ${e.id} not found`);const c=await a.signMessage(Buffer.from(s));r=Buffer.from(c).toString("base64")}else throw new Error("Unknown network");await Se.signIn("credentials",{redirect:!1,signature:r,provider:e.id,chainId:e.chainId,address:e.address,message:s})},onSuccess:()=>{oe.toast.success("Signed in")},onError:r=>{throw console.log("sign account error",r),r}})}function Fn(){const{pendingItem:e,setRouter:t,setPendingItem:n}=C(),{users:o}=P(),{solWallets:s}=re(),{data:r}=Z();return _.useMutation({mutationKey:["use-sign-account",{id:e==null?void 0:e.id,network:e==null?void 0:e.network}],mutationFn:async({network:a,address:c})=>{if(!e)return;const l=o.find(d=>d.network===a&&d.address===c);if(!l)throw new Error("User not found");if(l.social)t(()=>(n({id:l.provider,logo:l.image,network:"",description:`We connect your "${l.name}" account to our platform.`}),p.socialConnecting));else if(l.network===m.NetworkSymbols.eth){const d=r.find(b=>b.id===l.provider);if(!d)throw new Error(`Wallet ${l.provider} not found`);t(()=>(n({id:d.id,logo:d.icon,network:m.NetworkSymbols.eth,description:`Open the ${d.name} browser extension to connect your wallet.`}),p.walletConnecting))}else{const d=s.find(b=>b.name===l.provider);if(!d)throw new Error(`Wallet ${l.provider} not found`);t(()=>(n({id:d.name,logo:d.icon,network:m.NetworkSymbols.sol,description:`Open the ${d.name} browser extension to connect your wallet.`}),p.walletConnecting))}},onSuccess:()=>{},onError:a=>{throw console.log("switch account error",a),a}})}function Pt(){const{wagmiConfig:e}=C(),{data:t}=Z(),{solWallets:n,solDisconnect:o}=re(),{provider:s,social:r,address:a,network:c}=P();return _.useMutation({mutationKey:["use-disconnect-account",{social:r,address:a,network:c}],mutationFn:async()=>{if(!r)if(c===m.NetworkSymbols.eth){const l=t.find(d=>d.id===s);if(!l)throw new Error(`Wallet ${s} not found`);await W.disconnect(e,{connector:l})}else if(c===m.NetworkSymbols.sol){if(!n.find(d=>d.name===s))throw new Error(`Wallet ${s} not found`);await o()}else throw new Error("Unknown network");await Se.signOut({redirect:!1})},onSuccess:()=>{oe.toast.success("Signed out")},onError:l=>{throw console.log("disconnect account error",l),l}})}function Tt({address:e,chainId:t}={}){const{chainId:n,address:o}=P(),{chains:s}=C(),r=t||n,a=s.find(b=>b.id===r);if(!a)throw new Error("Chain not found");const c=a.network.symbol,l=Ee({chainId:r}),d=e||o;return _.useMutation({mutationKey:["use-balance-async",{chainId:r,address:d}],mutationFn:async function(){let b=0n;switch(c){case m.NetworkSymbols.eth:(l instanceof I.JsonRpcProvider||l instanceof I.FallbackProvider)&&(b=await l.getBalance(d));break;case m.NetworkSymbols.sol:if(l instanceof $.Connection){const w=await l.getBalance(new $.PublicKey(d));b=BigInt(w)}break}return b},onError:b=>{console.log(b)}})}function It({address:e,chainId:t}={}){const{chainId:n,address:o}=P(),{chains:s}=C(),r=t||n,a=s.find(b=>b.id===r);if(!a)throw new Error("Chain not found");const c=a.network.symbol,l=Ee({chainId:r}),d=e||o;return _.useMutation({mutationKey:["use-token-balance-async",{chainId:r,address:d}],mutationFn:async function(b){if(!d)return 0n;switch(c){case m.NetworkSymbols.eth:return l instanceof I.JsonRpcProvider||l instanceof I.FallbackProvider?await new I.Contract(b,nt.erc20Abi,l).balanceOf(d):0n;case m.NetworkSymbols.sol:if(l instanceof $.Connection){const w=await l.getTokenAccountsByOwner(new $.PublicKey(d),{mint:new $.PublicKey(b)});if(w.value.length===0)return 0n;const f=await l.getTokenAccountBalance(w.value[0].pubkey);return BigInt(f.value.amount)}return 0n;default:return 0n}},onError:b=>{console.log(b)}})}function $n(){const{chainId:e,social:t}=P();return _.useMutation({mutationKey:["use-send-transaction-async",{chainId:e,social:t}],mutationFn:async({address:n,value:o})=>{if(t){const s=await fetch("/api/based-auth/transfer",{method:"POST",body:JSON.stringify({address:n,value:o})});if(!s.ok){const r=await s.json();throw new Error(r.message)}return s.json()}else throw new Error("This feature is not available for only social wallets")},onError:n=>{throw oe.toast.error(n.message),n},onSuccess:()=>{oe.toast.success("Balance transferred")}})}function Bn(){const{chainId:e,social:t,switchChain:n}=P(),{data:o}=Z(),{chains:s,wagmiConfig:r}=C();return _.useMutation({mutationKey:["use-read-contract-async",{chainId:e,social:t,wallets:o.map(a=>a.id)}],mutationFn:async a=>{const c=s.find(d=>d.id===a.chainId);if(!c)throw new Error("Chain not found");const l=c.network.symbol;if(t){e!==a.chainId&&await n(a.chainId);const d=await fetch("/api/based-auth/read-contract",{method:"POST",body:Ne.serialize(a)});if(!d.ok){const w=await d.json();throw new Error(w.message)}const b=await d.json();return Ne.deserialize(b)}if(l===m.NetworkSymbols.eth){const d=Et(r,{chainId:a.chainId}),w=await new I.Contract(a.address,a.abi,d)[a.functionName](...a.args);return Ne.deserialize(Ne.serialize(w))}throw new Error("Unknown network")},onError:a=>{throw console.log(a),a}})}function Kn(){const{chainId:e,social:t,provider:n,switchChain:o}=P(),{chains:s,wagmiConfig:r}=C(),{data:a}=Z(),{solWallets:c}=re();return _.useMutation({mutationKey:["use-write-contract-async",{chainId:e,social:t,wallets:a.map(l=>l.id)}],mutationFn:async l=>{const d=s.find(w=>w.id===l.chainId);if(!d)throw new Error("Chain not found");const b=d.network.symbol;if(t){e!==l.chainId&&await o(l.chainId);const w=await fetch("/api/based-auth/write-contract",{method:"POST",body:Ne.serialize(l)});if(!w.ok){const f=await w.json();throw console.log(f),new Error(f.message)}return w.json()}else if(b===m.NetworkSymbols.eth){const w=a.find(x=>x.id===n);if(!w)throw new Error(`Wallet ${n} not found`);return await W.writeContract(r,{...l,connector:w})}else if(b===m.NetworkSymbols.sol&&!c.find(f=>f.name===n))throw new Error(`Wallet ${n} not found`)},onError:l=>{throw console.log(l),l}})}const ie=({className:e})=>i.jsxs("svg",{"aria-hidden":"true",width:"102",height:"102",viewBox:"0 0 102 102",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[i.jsx("path",{d:"M52 100C24.3858 100 2 77.6142 2 50",stroke:"url(#paint0_linear_1943_4139)",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("defs",{children:i.jsxs("linearGradient",{id:"paint0_linear_1943_4139",x1:"2",y1:"48.5",x2:"53",y2:"100",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"currentColor"}),i.jsx("stop",{offset:"1",stopColor:"currentColor",stopOpacity:"0"})]})})]});function V({className:e,index:t=0,onClick:n,logo:o,children:s,disabled:r=!1,...a}){return i.jsxs(F.motion.button,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1*(t+1)},onClick:n,className:j("web3kit-flex web3kit-justify-between web3kit-h-12 web3kit-items-center web3kit-rounded-xl web3kit-px-4 web3kit-py-2 web3kit-text-lg web3kit-font-semibold web3kit-shadow-md web3kit-bg-muted hover:web3kit-bg-accent hover:web3kit-shadow-xl web3kit-gap-x-2 web3kit-w-full",e),disabled:r,...a,children:[i.jsx("div",{className:"web3kit-leading-none",children:s}),r?i.jsx(ie,{className:"web3kit-size-8 web3kit-animate-spin"}):typeof o=="string"?i.jsx(F.motion.img,{src:o,alt:`${t} logo`,className:"web3kit-size-8 web3kit-overflow-hidden web3kit-rounded-lg"}):o]})}function Ln(){const{setPendingItem:e,setRouter:t}=C(),{users:n}=P(),{data:o}=Z();return N.useEffect(()=>{e(null)},[]),i.jsx("div",{className:"web3kit-space-y-2",children:o.filter(s=>!n.find(r=>r.provider===s.id&&r.network===m.NetworkSymbols.eth)).map((s,r)=>i.jsx(V,{index:r,logo:s.icon,onClick:()=>{t(()=>(e({id:s.id,logo:s.icon,network:m.NetworkSymbols.eth,description:`Open the ${s.name} browser extension to connect your wallet.`}),p.walletConnecting))},children:s.name},s.id))})}function Gn(){const{solWallets:e}=re(),{users:t}=P(),{setPendingItem:n,setRouter:o}=C();return N.useEffect(()=>{n(null)},[]),i.jsx("div",{className:"web3kit-space-y-2",children:e.filter(s=>!t.find(r=>r.provider===s.name&&r.network===m.NetworkSymbols.sol)).map((s,r)=>i.jsx(V,{index:r,logo:s.icon,onClick:()=>{o(()=>(n({id:s.name,logo:s.icon,network:m.NetworkSymbols.sol,description:`Open the ${s.name} browser extension to connect your wallet.`}),p.walletConnecting))},children:s.name},r))})}function Un(){const{address:e}=P();return i.jsxs("div",{className:"web3kit-flex web3kit-flex-col web3kit-items-center web3kit-gap-4",children:[i.jsx("div",{className:"web3kit-text-center",children:i.jsx("p",{className:"web3kit-text-sm web3kit-text-muted-foreground",children:"Scan this QR code to send funds to your wallet"})}),i.jsx(F.motion.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.3},className:"web3kit-flex web3kit-items-center web3kit-justify-center web3kit-p-4 web3kit-bg-white web3kit-rounded-lg",children:i.jsx(Ft.QRCodeSVG,{value:e,size:200,level:"H",marginSize:1,className:"web3kit-border web3kit-rounded-lg"})})]})}const Je=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Qe=st,Vn=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return Qe(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:r}=t,a=Object.keys(s).map(d=>{const b=n==null?void 0:n[d],w=r==null?void 0:r[d];if(b===null)return null;const f=Je(b)||Je(w);return s[d][f]}),c=n&&Object.entries(n).reduce((d,b)=>{let[w,f]=b;return f===void 0||(d[w]=f),d},{}),l=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((d,b)=>{let{class:w,className:f,...x}=b;return Object.entries(x).every(R=>{let[v,g]=R;return Array.isArray(g)?g.includes({...r,...c}[v]):{...r,...c}[v]===g})?[...d,w,f]:d},[]);return Qe(e,a,l,n==null?void 0:n.class,n==null?void 0:n.className)},Yn=Vn("web3kit-inline-flex web3kit-items-center web3kit-justify-center web3kit-gap-2 web3kit-whitespace-nowrap web3kit-rounded-md web3kit-text-sm web3kit-font-medium web3kit-transition-colors focus-visible:web3kit-outline-none focus-visible:web3kit-ring-1 focus-visible:web3kit-ring-ring disabled:web3kit-pointer-events-none disabled:web3kit-opacity-50 [&_svg]:web3kit-pointer-events-none [&_svg]:web3kit-size-4 [&_svg]:web3kit-shrink-0",{variants:{variant:{default:"web3kit-bg-primary web3kit-text-primary-foreground web3kit-shadow hover:web3kit-bg-primary/90",destructive:"web3kit-bg-destructive web3kit-text-destructive-foreground web3kit-shadow-sm hover:web3kit-bg-destructive/90",outline:"web3kit-border web3kit-border-input web3kit-bg-background web3kit-shadow-sm hover:web3kit-bg-accent hover:web3kit-text-accent-foreground",secondary:"web3kit-bg-secondary web3kit-text-secondary-foreground web3kit-shadow-sm hover:web3kit-bg-secondary/80",ghost:"hover:web3kit-bg-accent hover:web3kit-text-accent-foreground",link:"web3kit-text-primary web3kit-underline-offset-4 hover:web3kit-underline"},size:{default:"web3kit-h-9 web3kit-px-4 web3kit-py-2",sm:"web3kit-h-8 web3kit-rounded-md web3kit-px-3 web3kit-text-xs",lg:"web3kit-h-10 web3kit-rounded-md web3kit-px-8",icon:"web3kit-h-9 web3kit-w-9"}},defaultVariants:{variant:"default",size:"default"}}),me=D.forwardRef(({className:e,variant:t,size:n,asChild:o=!1,...s},r)=>{const a=o?$t.Slot:"button";return i.jsx(a,{className:j(Yn({variant:t,size:n}),e),ref:r,...s})});me.displayName="Button";function Hn(){const{pendingItem:e}=C(),{mutateAsync:t,isError:n,error:o,isPending:s}=Rt();return N.useEffect(()=>{t()},[e]),e?i.jsxs("div",{className:"web3kit-flex web3kit-w-full web3kit-flex-col web3kit-items-center web3kit-justify-center web3kit-gap-9 md:web3kit-pt-5",children:[i.jsxs("div",{className:j("web3kit-relative web3kit-size-28 web3kit-flex web3kit-items-center web3kit-justify-center web3kit-rounded-2xl web3kit-p-3"),children:[i.jsx("img",{src:e.logo,alt:e.name,className:"web3kit-size-16 web3kit-overflow-hidden web3kit-rounded-2xl"}),!s&&n?i.jsx(me,{size:"icon",variant:"ghost",className:"web3kit-group web3kit-absolute -web3kit-bottom-2 -web3kit-right-2 web3kit-rounded-full web3kit-bg-muted web3kit-p-1.5 web3kit-shadow",onClick:()=>{t()},children:i.jsx(G.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):i.jsx(ie,{className:"web3kit-absolute web3kit-w-full web3kit-h-full web3kit-text-primary web3kit-animate-spin"})]}),i.jsxs("div",{className:"web3kit-space-y-3.5 web3kit-px-3.5 web3kit-text-center sm:web3kit-px-0",children:[i.jsx("h1",{className:"web3kit-text-xl web3kit-font-semibold",children:n||o?"Request Error":"Requesting Connection"}),i.jsx("p",{className:"web3kit-text-balance web3kit-text-sm web3kit-text-muted-foreground",children:n||o?"There was an error with the request. Click above to try again.":e.description})]})]}):null}function Jn(){const{pendingItem:e,setRouter:t}=C(),{mutateAsync:n,isError:o,isPending:s}=Dn();return N.useEffect(()=>{e?n(...e.args):t(p.account)},[]),e?i.jsxs("div",{className:"web3kit-flex web3kit-w-full web3kit-flex-col web3kit-items-center web3kit-justify-center web3kit-gap-9 md:web3kit-pt-5",children:[i.jsxs("div",{className:j("web3kit-relative web3kit-size-28 web3kit-flex web3kit-items-center web3kit-justify-center web3kit-rounded-2xl web3kit-p-3"),children:[i.jsx("img",{src:e.logo,alt:e.name,className:"web3kit-size-16 web3kit-overflow-hidden web3kit-rounded-2xl"}),!s&&o?i.jsx(me,{size:"icon",variant:"ghost",className:"web3kit-group web3kit-absolute -web3kit-bottom-2 -web3kit-right-2 web3kit-rounded-full web3kit-bg-muted web3kit-p-1.5 web3kit-shadow",onClick:()=>{n(...e.args)},children:i.jsx(G.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):i.jsx(ie,{className:"web3kit-absolute web3kit-w-full web3kit-h-full web3kit-text-primary web3kit-animate-spin"})]}),i.jsxs("div",{className:"web3kit-space-y-3.5 web3kit-px-3.5 web3kit-text-center sm:web3kit-px-0",children:[i.jsx("h1",{className:"web3kit-text-xl web3kit-font-semibold",children:o?"Request Error":"Requesting Connection"}),i.jsx("p",{className:"web3kit-text-balance web3kit-text-sm web3kit-text-muted-foreground",children:o?"There was an error with the request. Click above to try again.":`We change your chain to "${e.name}".`})]})]}):null}function Wt(e,t=4){const n=e==null?void 0:e.startsWith("0x");return`${e==null?void 0:e.slice(0,(n?2:0)+t)}...${e==null?void 0:e.slice(-t)}`}function Mt({index:e,className:t}){return i.jsx(F.motion.div,{className:j("web3kit-animate-pulse web3kit-rounded-md web3kit-bg-foreground/10 web3kit-w-full",t),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3*(e+1)}})}function Qn(){const{address:e,network:t,users:n}=P(),{isPending:o}=Ke(),{setPendingItem:s,setRouter:r}=C();return o?i.jsx("div",{className:"web3kit-space-y-2",children:Array.from({length:3}).map((a,c)=>i.jsx(Mt,{index:c,className:"web3kit-h-12"},c))}):i.jsx("div",{className:"web3kit-space-y-2",children:n.filter(a=>!(a.address===e&&a.network===t)).map((a,c)=>i.jsx(V,{index:c,logo:a.image,onClick:()=>{s(()=>(r(p.switchingAccount),{name:a.name,logo:a.image,args:[{network:a.network,address:a.address}],description:`We change your account to "${a.name}".`}))},children:Wt(a.address)},c))})}function Xn({className:e,...t}){return i.jsx("div",{className:j("web3kit-animate-pulse web3kit-rounded-md web3kit-bg-foreground/10",e),...t})}function Zn({address:e}){const[t,n]=N.useState(!1);N.useEffect(()=>{const s=setTimeout(()=>{t&&n(!1)},1e3);return()=>clearTimeout(s)},[t,n]);async function o(){n(!0),await navigator.clipboard.writeText(e)}return i.jsx("button",{className:"web3kit-cursor-pointer hover:web3kit-text-foreground web3kit-text-muted-foreground",onClick:o,children:t?i.jsx(G.CheckIcon,{className:"web3kit-size-4"}):i.jsx(G.CopyIcon,{className:"web3kit-size-4"})})}function eo(e){let t="";for(;e>=10;)t=String.fromCharCode(8320+e%10)+t,e=Math.floor(e/10);return String.fromCharCode(8320+e)+t}function to(e,t=3){if(e=+e,e!==0&&e<+`1e-${t}`){const n=e.toExponential(t-1),o=n.replace(/(\.|e-\d+$)/gi,"").replace(/0+$/,""),s=Number(n.split("e-")[1]);return"0.0"+eo(s-1)+o}return e=+(+e).toFixed(t),e.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")}function zt({className:e=""}){const{chains:t,setRouter:n}=C(),{chainId:o,address:s,network:r,social:a,image:c,users:l}=P(),{chainLogo:d,nativeSymbol:b,addressExplorer:w}=Be(),{data:f,isPending:x}=At({address:s,chainId:o}),R=t.filter(g=>g.id!==o).filter(g=>a||g.network.symbol===r).length>0,v=[l.length>1&&{label:"Switch Account",logo:m.T,onClick:()=>{n("switchAccount")}},R&&{label:"Switch Chain",logo:d||m.M,onClick:()=>{n(p.switchChain)}},{label:"Add Account",logo:m.T,onClick:()=>{n(p.home)}},a&&{label:"Withdraw",logo:m.H,onClick:()=>{n(p.withdrawFunds)}}].filter(Boolean);return i.jsxs("div",{className:j("web3kit-space-y-4 web3kit-text-center",e),children:[i.jsx(F.motion.img,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.5,ease:[.4,0,.2,1],delay:.1},src:typeof c=="string"?c:void 0,alt:`avatar for ${s}`,className:"web3kit-size-24 web3kit-rounded-full web3kit-mx-auto"}),i.jsxs("div",{className:"web3kit-flex web3kit-items-end web3kit-gap-2 web3kit-justify-center",children:[i.jsx("div",{className:"web3kit-text-sm web3kit-leading-none",children:x?i.jsx(Xn,{className:"web3kit-h-4 web3kit-w-[50px]"}):`${to(I.formatUnits(f||0n,18))} ${b}`}),i.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:w.replace("{{addr}}",s),className:"web3kit-leading-none web3kit-text-primary",children:Wt(s)}),i.jsx(Zn,{address:s}),i.jsx(G.QrCodeIcon,{className:"web3kit-size-4 web3kit-cursor-pointer hover:web3kit-text-foreground",onClick:()=>{n(p.walletqr)}})]}),i.jsx("div",{className:"web3kit-space-y-2",children:v.map((g,y)=>i.jsx(V,{index:y,className:"web3kit-w-full",logo:g.logo,onClick:g.onClick,children:i.jsx("div",{className:"web3kit-text-lg",children:g.label})},y))})]})}const no={google:m.e,github:m.c,twitter:m.u,discord:m.n};function Ot(){const{data:e,isPending:t}=Ke(),{chains:n,setPendingItem:o,setRouter:s}=C(),{users:r}=P(),a=Object.values(n.reduce((c,l)=>(c[l.network.symbol]=l.network,c),{}));return N.useEffect(()=>{o(null)},[]),t?i.jsx("div",{className:"web3kit-space-y-2",children:Array.from({length:3}).map((c,l)=>i.jsx(Mt,{index:l,className:"web3kit-h-12"},l))}):i.jsxs("div",{className:"web3kit-space-y-2",children:[e.filter(c=>!r.some(l=>l.provider===c.id)).map((c,l)=>{const d=no[c.id]||m.M;return i.jsx(V,{index:l,logo:d,onClick:()=>{s(()=>(o({id:c.id,chainId:n[0].id,logo:d,network:"",description:`We connect your "${c.name}" account to our platform.`}),p.socialConnecting))},children:c.name},c.id)}),i.jsx("div",{className:"web3kit-flex web3kit-items-center web3kit-gap-2",children:a.map((c,l)=>i.jsx(V,{index:l,logo:c.logo,onClick:()=>{switch(c.symbol){case m.NetworkSymbols.eth:s(p.selectETHWallet);break;case m.NetworkSymbols.sol:s(p.selectSolanaWallet);break}},children:c.name},l))})]})}function oo(){const{chainId:e,network:t,social:n}=P(),{chains:o,setPendingItem:s,setRouter:r}=C();return i.jsx("div",{className:"web3kit-space-y-2",children:o.filter(a=>a.id!==e).filter(a=>n||a.network.symbol===t).map((a,c)=>i.jsx(V,{index:c,logo:a.logo,onClick:()=>{s(()=>(r(p.switchingChain),{name:a.name,logo:a.logo,args:[a.id]}))},className:"web3kit-w-full",children:a.name},c))})}function ro(){const{pendingItem:e,setRouter:t}=C(),{mutateAsync:n,isError:o,isPending:s}=Fn();return N.useEffect(()=>{e?n(...e.args):t(p.account)},[]),e?i.jsxs("div",{className:"web3kit-flex web3kit-w-full web3kit-flex-col web3kit-items-center web3kit-justify-center web3kit-gap-9 md:web3kit-pt-5",children:[i.jsxs("div",{className:j("web3kit-relative web3kit-size-28 web3kit-flex web3kit-items-center web3kit-justify-center web3kit-rounded-2xl web3kit-p-3"),children:[i.jsx("img",{src:e.logo,alt:e.name,className:"web3kit-size-16 web3kit-overflow-hidden web3kit-rounded-2xl"}),!s&&o?i.jsx(me,{size:"icon",variant:"ghost",className:"web3kit-group web3kit-absolute -web3kit-bottom-2 -web3kit-right-2 web3kit-rounded-full web3kit-bg-muted web3kit-p-1.5 web3kit-shadow",onClick:()=>{n(...e.args)},children:i.jsx(G.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):i.jsx(ie,{className:"web3kit-absolute web3kit-w-full web3kit-h-full web3kit-text-primary web3kit-animate-spin"})]}),i.jsxs("div",{className:"web3kit-space-y-3.5 web3kit-px-3.5 web3kit-text-center sm:web3kit-px-0",children:[i.jsx("h1",{className:"web3kit-text-xl web3kit-font-semibold",children:o?"Request Error":"Requesting Connection"}),i.jsx("p",{className:"web3kit-text-balance web3kit-text-sm web3kit-text-muted-foreground",children:o?"There was an error with the request. Click above to try again.":`We change your account to "${e.name}".`})]})]}):null}function io(){const e=N.useRef(null),t=N.useRef(null),[n,o]=N.useState("native"),{nativeSymbol:s,nativeDecimals:r}=Be(),{network:a}=P(),c=Ee(),{mutateAsync:l,isPending:d}=It(),{mutateAsync:b,isPending:w}=Tt(),{mutateAsync:f,isPending:x}=$n();async function R(g){g.preventDefault();const y=new FormData(g.target),E=y.get("type");y.get("token");const M=y.get("amount"),q=y.get("recepient");if(E==="native")await f({address:q,value:I.parseUnits(M,r)});else throw new Error("Not implemented yet")}const v=async g=>{var y;if(g.preventDefault(),e.current){let E=0n;if(a===m.networkEth.symbol){const M=21000n;if(!c||!(c instanceof I.JsonRpcProvider||c instanceof I.FallbackProvider))throw new Error("Provider not found");const q=(await c.getFeeData()).gasPrice;if(!q)throw new Error("Failed to get gas price");E=q*M}else if(a===m.networkSol.symbol)E=5000n;else throw new Error("Invalid network");if(n==="token"){const M=await l((y=t.current)==null?void 0:y.value);e.current.value=I.formatUnits(M,r)}else{const M=await b();e.current.value=Number(I.formatUnits(M<=E?0n:M-E,r)).toString()}}};return i.jsxs("form",{className:"web3kit-flex web3kit-flex-col web3kit-justify-between web3kit-items-center web3kit-gap-y-4",onSubmit:R,children:[i.jsxs(F.motion.select,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"web3kit-bg-background web3kit-rounded-md web3kit-border web3kit-border-input web3kit-text-sm web3kit-ring-offset-background web3kit-focus:web3kit-ring-ring web3kit-focus:web3kit-ring-offset-2 web3kit-disabled:web3kit-cursor-not-allowed web3kit-disabled:web3kit-opacity-50 web3kit-px-4 web3kit-py-2 web3kit-w-full",name:"type",onChange:g=>o(g.target.value),children:[i.jsx(F.motion.option,{value:"native",className:"web3kit-text-sm",children:s}),i.jsx(F.motion.option,{value:"token",className:"web3kit-text-sm",children:"Token"})]}),n==="token"&&i.jsx(F.motion.input,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"web3kit-bg-background web3kit-rounded-md web3kit-border web3kit-border-input web3kit-text-sm web3kit-ring-offset-background web3kit-focus:web3kit-ring-ring web3kit-focus:web3kit-ring-offset-2 web3kit-disabled:web3kit-cursor-not-allowed web3kit-disabled:web3kit-opacity-50 web3kit-px-4 web3kit-py-2 web3kit-w-full",name:"token",placeholder:"Token Address",ref:t}),i.jsxs("div",{className:"web3kit-relative web3kit-w-full",children:[i.jsx(F.motion.input,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"web3kit-bg-background web3kit-rounded-md web3kit-border web3kit-border-input web3kit-text-sm web3kit-ring-offset-background web3kit-focus:web3kit-ring-ring web3kit-focus:web3kit-ring-offset-2 web3kit-disabled:web3kit-cursor-not-allowed web3kit-disabled:web3kit-opacity-50 web3kit-px-4 web3kit-py-2 web3kit-w-full",name:"amount",placeholder:"Amount",ref:e}),i.jsx(F.motion.button,{className:"web3kit-absolute web3kit-right-2 web3kit-top-1/2 web3kit-text-xs web3kit-text-muted-foreground web3kit-font-medium web3kit-bg-background web3kit-rounded-md web3kit-px-2 web3kit-py-1 web3kit-translate-y-[-50%]",onClick:v,disabled:d||w,children:d||w?i.jsx(ie,{className:"web3kit-size-6 web3kit-animate-spin"}):"MAX"})]}),i.jsx(F.motion.input,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"web3kit-bg-background web3kit-rounded-md web3kit-border web3kit-border-input web3kit-text-sm web3kit-ring-offset-background web3kit-focus:web3kit-ring-ring web3kit-focus:web3kit-ring-offset-2 web3kit-disabled:web3kit-cursor-not-allowed web3kit-disabled:web3kit-opacity-50 web3kit-px-4 web3kit-py-2 web3kit-w-full",name:"recepient",placeholder:"Recepient Address"}),i.jsx(V,{disabled:x,logo:m.H,children:x?"Withdrawing":"Withdraw"})]})}function so(){const{pendingItem:e}=C(),{mutateAsync:t,isError:n,error:o,isPending:s}=Rt();return N.useEffect(()=>{t()},[e]),e?i.jsxs("div",{className:"web3kit-flex web3kit-w-full web3kit-flex-col web3kit-items-center web3kit-justify-center web3kit-gap-9 md:web3kit-pt-5",children:[i.jsxs("div",{className:j("web3kit-relative web3kit-size-28 web3kit-flex web3kit-items-center web3kit-justify-center web3kit-rounded-2xl web3kit-p-3"),children:[i.jsx("img",{src:e.logo,alt:e.name,className:"web3kit-size-16 web3kit-overflow-hidden web3kit-rounded-2xl"}),!s&&n?i.jsx(me,{size:"icon",variant:"ghost",className:"web3kit-group web3kit-absolute -web3kit-bottom-2 -web3kit-right-2 web3kit-rounded-full web3kit-bg-muted web3kit-p-1.5 web3kit-shadow",onClick:()=>{t()},children:i.jsx(G.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):i.jsx(ie,{className:"web3kit-absolute web3kit-w-full web3kit-h-full web3kit-text-primary web3kit-animate-spin"})]}),i.jsxs("div",{className:"web3kit-space-y-3.5 web3kit-px-3.5 web3kit-text-center sm:web3kit-px-0",children:[i.jsx("h1",{className:"web3kit-text-xl web3kit-font-semibold",children:n||o?"Request Error":"Requesting Connection"}),i.jsx("p",{className:"web3kit-text-balance web3kit-text-sm web3kit-text-muted-foreground",children:n||o?"There was an error with the request. Click above to try again.":e.description})]})]}):null}function ao(){const{pendingItem:e}=C(),{mutateAsync:t,isError:n,error:o,isPending:s}=qn();return N.useEffect(()=>{t()},[e]),e?i.jsxs("div",{className:"web3kit-flex web3kit-w-full web3kit-flex-col web3kit-items-center web3kit-justify-center web3kit-gap-9 md:web3kit-pt-5",children:[i.jsxs("div",{className:j("web3kit-relative web3kit-size-28 web3kit-flex web3kit-items-center web3kit-justify-center web3kit-rounded-2xl web3kit-p-3"),children:[i.jsx("img",{src:e.logo,alt:e.name,className:"web3kit-size-16 web3kit-overflow-hidden web3kit-rounded-2xl"}),!s&&n?i.jsx(me,{size:"icon",variant:"ghost",className:"web3kit-group web3kit-absolute -web3kit-bottom-2 -web3kit-right-2 web3kit-rounded-full web3kit-bg-muted web3kit-p-1.5 web3kit-shadow",onClick:()=>{t()},children:i.jsx(G.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):i.jsx(ie,{className:"web3kit-absolute web3kit-w-full web3kit-h-full web3kit-text-primary web3kit-animate-spin"})]}),i.jsxs("div",{className:"web3kit-space-y-3.5 web3kit-px-3.5 web3kit-text-center sm:web3kit-px-0",children:[i.jsx("h1",{className:"web3kit-text-xl web3kit-font-semibold",children:n||o?"Request Error":"Requesting Connection"}),i.jsx("p",{className:"web3kit-text-balance web3kit-text-sm web3kit-text-muted-foreground",children:n||o?"There was an error with the request. Click above to try again.":`We're verifying your ${e.name} account.`})]})]}):null}function co(){const{setRouter:e,setPendingItem:t}=C(),{solWallets:n}=re();return N.useEffect(()=>(n.forEach(o=>{o.on("connect",async s=>{e(()=>(t({id:o.name,logo:o.icon,network:m.NetworkSymbols.sol,chainId:Ie.isMainnet?Ie.chainSol.id:Ie.chainSolDevnet.id,address:s.toBase58()}),p.accountSigning))}),o.on("error",s=>{console.log("error",s,o.name)}),o.on("disconnect",async()=>{console.log("disconnect",o.name)})}),()=>{n.forEach(o=>{o.off("connect"),o.off("error"),o.off("disconnect")})}),[n]),N.useEffect(()=>{rt.fetchQuery({queryKey:["use-social-providers"]})},[]),i.jsx(i.Fragment,{})}const lo={[p.home]:i.jsx(Ot,{}),[p.account]:i.jsx(zt,{}),[p.accountSigning]:i.jsx(ao,{}),[p.switchChain]:i.jsx(oo,{}),[p.switchingChain]:i.jsx(Jn,{}),[p.switchAccount]:i.jsx(Qn,{}),[p.switchingAccount]:i.jsx(ro,{}),[p.selectETHWallet]:i.jsx(Ln,{}),[p.selectSolanaWallet]:i.jsx(Gn,{}),[p.walletConnecting]:i.jsx(Hn,{}),[p.socialConnecting]:i.jsx(so,{}),[p.walletqr]:i.jsx(Un,{}),[p.withdrawFunds]:i.jsx(io,{})};function uo(e){const{address:t,chainId:n}=P(),{router:o,setRouter:s,open:r,setOpen:a,pendingItem:c,setPendingItem:l}=C();return N.useEffect(()=>{a(!1),l(null),s(t?p.account:p.home)},[t,n]),N.useEffect(()=>{r||s(t?p.account:p.home)},[r]),N.useEffect(()=>{const d=new MutationObserver(b=>{b.forEach(w=>{w.type==="attributes"&&w.attributeName==="style"&&document.body.style.pointerEvents==="none"&&!r&&(console.log("pointerEvents removed"),document.body.style.pointerEvents="")})});return d.observe(document.body,{attributes:!0,attributeFilter:["style"]}),()=>{d.disconnect()}},[]),i.jsxs(i.Fragment,{children:[e.children,i.jsx(co,{}),i.jsx(Rn,{open:r,onOpenChange:a,children:i.jsxs(Pn,{children:[i.jsxs(In,{children:[i.jsx(fo,{}),i.jsx(Wn,{children:o&&o in Ve?Ve[o]:"Login"}),i.jsx(Tn,{className:"web3kit-sr-only",children:"Connect your Web3 wallet or create a new one."})]}),i.jsx(Mn,{children:lo[o]||i.jsx(i.Fragment,{children:t?i.jsx(zt,{}):i.jsx(Ot,{})})}),i.jsx(zn,{children:i.jsx(wo,{})})]})})]})}function wo(){const{address:e}=P(),{pendingItem:t}=C();return i.jsx(i.Fragment,{children:e&&!t&&i.jsx(bo,{})})}function bo(){const{mutateAsync:e,isPending:t}=Pt();return i.jsx(V,{logo:m.r,disabled:t,onClick:()=>e(),children:t?"Signing out":"Logout"})}function fo(){const{address:e}=P(),{router:t,setRouter:n,pendingItem:o,setPendingItem:s}=C();if(!t||t===p.home&&!e||t===p.account&&e)return null;function r(){if(o){s(()=>(n(e?p.account:p.home),null));return}switch(t){case p.home:case p.switchChain:case p.switchAccount:case p.walletqr:case p.withdrawFunds:n(p.account);break;default:n(p.home)}}return i.jsxs("button",{className:"web3kit-absolute web3kit-left-[26px] web3kit-top-[42px] web3kit-z-20 web3kit-rounded-sm web3kit-opacity-70 web3kit-ring-offset-background web3kit-transition-opacity hover:web3kit-opacity-100 focus:web3kit-outline-none focus:web3kit-ring-2 focus:web3kit-ring-ring focus:web3kit-ring-offset-2 disabled:web3kit-pointer-events-none data-[state=open]:web3kit-bg-accent data-[state=open]:web3kit-text-muted-foreground md:web3kit-top-[26px]",onClick:r,children:[i.jsx(G.ChevronLeft,{className:"web3kit-h-4 web3kit-w-4"}),i.jsx("span",{className:"web3kit-sr-only",children:"Cancel connection"})]})}function mo({chains:e,host:t,name:n,description:o,icon:s,projectId:r,children:a}){return i.jsx(Ut,{chains:e||Ie.supportedChains,host:t,name:n,description:o,icon:s,projectId:r,children:i.jsx(uo,{children:a})})}exports.SimpleKitProvider=mo;exports.useAccount=P;exports.useBalance=At;exports.useBalanceAsync=Tt;exports.useChainInfo=Be;exports.useDisconnectAccount=Pt;exports.useReadContractAsync=Bn;exports.useSimpleKit=Gt;exports.useTokenBalance=_n;exports.useTokenBalanceAsync=It;exports.useWriteContractAsync=Kn;
//# sourceMappingURL=react.cjs.map
