diff --git a/assets/index-f798eedc.js b/assets/index-a397a75f.js similarity index 98% rename from assets/index-f798eedc.js rename to assets/index-a397a75f.js index 42c1196..49fe033 100644 --- a/assets/index-f798eedc.js +++ b/assets/index-a397a75f.js @@ -190,7 +190,7 @@ ${ka(s)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const r=[];for(const `);for(let x=0;x({method:"POST",headers:k0({},e,{"Content-Type":"application/json"}),body:JSON.stringify(t||{}),signal:r}),Gt=t=>t.text().then(e=>{let r;try{r=JSON.parse(e)}catch(n){let i="";throw n instanceof Error&&(i=n.message),vc.new({status:t.status,cause:`JSON.parse(): ${i}: response text: ${e}`})}if(!t.ok){const n=typeof r.code=="number"?r.code:0;throw(UT[n]||yt).new(r)}return r});class yt extends Error{constructor(e,r,n,i,s){super(n),this.name=void 0,this.code=void 0,this.message=void 0,this.status=void 0,this.cause=void 0,this.msg=void 0,this.name=e||"WebrpcError",this.code=typeof r=="number"?r:0,this.message=n||`endpoint error ${this.code}`,this.msg=this.message,this.status=typeof i=="number"?i:0,this.cause=s,Object.setPrototypeOf(this,yt.prototype)}static new(e){return new this(e.error,e.code,e.message||e.msg,e.status,e.cause)}}class Kb extends yt{constructor(e="WebrpcEndpoint",r=0,n="endpoint error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Kb.prototype)}}class $t extends yt{constructor(e="WebrpcRequestFailed",r=-1,n="request failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,$t.prototype)}}class Yb extends yt{constructor(e="WebrpcBadRoute",r=-2,n="bad route",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Yb.prototype)}}class Qb extends yt{constructor(e="WebrpcBadMethod",r=-3,n="bad method",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Qb.prototype)}}class Jb extends yt{constructor(e="WebrpcBadRequest",r=-4,n="bad request",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Jb.prototype)}}class vc extends yt{constructor(e="WebrpcBadResponse",r=-5,n="bad response",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,vc.prototype)}}class Xb extends yt{constructor(e="WebrpcServerPanic",r=-6,n="server panic",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Xb.prototype)}}class Zb extends yt{constructor(e="WebrpcInternalError",r=-7,n="internal error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Zb.prototype)}}class ew extends yt{constructor(e="WebrpcClientDisconnected",r=-8,n="client disconnected",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,ew.prototype)}}class Kl extends yt{constructor(e="WebrpcStreamLost",r=-9,n="stream lost",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Kl.prototype)}}class tw extends yt{constructor(e="WebrpcStreamFinished",r=-10,n="stream finished",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,tw.prototype)}}class rw extends yt{constructor(e="Unauthorized",r=1e3,n="Unauthorized access",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,rw.prototype)}}class nw extends yt{constructor(e="PermissionDenied",r=1001,n="Permission denied",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,nw.prototype)}}class iw extends yt{constructor(e="SessionExpired",r=1002,n="Session expired",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,iw.prototype)}}class sw extends yt{constructor(e="MethodNotFound",r=1003,n="Method not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,sw.prototype)}}class ow extends yt{constructor(e="RequestConflict",r=1004,n="Conflict with target resource",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,ow.prototype)}}class aw extends yt{constructor(e="Aborted",r=1005,n="Request aborted",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,aw.prototype)}}class lw extends yt{constructor(e="Timeout",r=2e3,n="Request timed out",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,lw.prototype)}}class cw extends yt{constructor(e="InvalidArgument",r=2001,n="Invalid argument",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,cw.prototype)}}class fw extends yt{constructor(e="Unavailable",r=2002,n="Unavailable resource",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,fw.prototype)}}class uw extends yt{constructor(e="QueryFailed",r=2003,n="Query failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,uw.prototype)}}class dw extends yt{constructor(e="ResourceExhausted",r=2004,n="Resource exhausted",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,dw.prototype)}}class hw extends yt{constructor(e="NotFound",r=3e3,n="Resource not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,hw.prototype)}}class vw extends yt{constructor(e="ProjectNotFound",r=3002,n="Project not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,vw.prototype)}}class pw extends yt{constructor(e="MetadataCallFailed",r=3003,n="Metadata service call failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,pw.prototype)}}const UT={0:Kb,[-1]:$t,[-2]:Yb,[-3]:Qb,[-4]:Jb,[-5]:vc,[-6]:Xb,[-7]:Zb,[-8]:ew,[-9]:Kl,[-10]:tw,1e3:rw,1001:nw,1002:iw,1003:sw,1004:ow,1005:aw,2e3:lw,2001:cw,2002:fw,2003:uw,2004:dw,3e3:hw,3002:vw,3003:pw},qA=typeof global=="object"?global.fetch:window.fetch;class zT extends Cre{constructor(e,r,n){super(e.endsWith("/")?e.slice(0,-1):e,qA),this.projectAccessKey=r,this.jwtAuth=n,this._fetch=(i,s)=>{const o={},a=this.jwtAuth,l=this.projectAccessKey;return a&&a.length>0&&(o.Authorization=`BEARER ${a}`),l&&l.length>0&&(o["X-Access-Key"]=l),s.headers=k0({},s.headers,o),qA(i,s)},this.fetch=this._fetch}}const HA=[..."ðŸķðŸąðŸ­ðŸđ🐰ðŸĶŠðŸŧ🐞ðŸĻðŸŊðŸĶðŸŪðŸ·ðŸ―ðŸļðŸĩ🙈🙉🙊🐒🐔🐧ðŸĶðŸĪðŸĢðŸĨðŸĶ†ðŸĶ…ðŸĶ‰ðŸĶ‡ðŸšðŸ—ðŸīðŸĶ„🐝🐛ðŸĶ‹ðŸŒðŸžðŸœðŸĶŸðŸĶ—🕷ðŸ•ļðŸĶ‚ðŸĒ🐍ðŸĶŽðŸĶ–ðŸĶ•ðŸ™ðŸĶ‘ðŸĶðŸĶžðŸĶ€ðŸĄðŸ ðŸŸðŸŽðŸģ🐋ðŸĶˆðŸŠðŸ…🐆ðŸĶ“ðŸĶðŸĶ§ðŸ˜ðŸĶ›ðŸĶðŸŠðŸŦðŸĶ’ðŸĶ˜ðŸƒðŸ‚🐄🐎🐖🐏🐑ðŸĶ™ðŸðŸĶŒðŸ•ðŸĐðŸĶŪ🐈🐓ðŸĶƒðŸĶšðŸĶœðŸĶĒðŸĶĐ🕊🐇ðŸĶðŸĶĻðŸĶĄðŸĶĶðŸĶĨ🐁🐀ðŸŋðŸĶ”ðŸū🐉ðŸēðŸŒĩ🎄ðŸŒēðŸŒģðŸŒīðŸŒąðŸŒŋ🍀🎍🎋🍃ðŸ‘Ģ🍂🍁🍄🐚ðŸŒū💐🌷ðŸŒđðŸĨ€ðŸŒšðŸŒļ🌞ðŸŒŧ🌞🌝🍏🍎🍐🍊🍋🍌🍉🍇🍓🍈ðŸĨ­ðŸðŸĨĨðŸĨðŸ…ðŸĨ‘ðŸĨĶðŸĨŽðŸĨ’ðŸŒķðŸŒ―ðŸĨ•ðŸ§„🧅ðŸĨ”🍠ðŸĨðŸĨŊ🍞ðŸĨ–ðŸĨĻ🧀ðŸĨšðŸģ🧈ðŸĨžðŸ§‡ðŸĨ“ðŸĨĐ🍗🍖ðŸĶī🌭🍔🍟🍕ðŸĨŠðŸĨ™ðŸ§†ðŸŒŪðŸŒŊðŸĨ—ðŸĨ˜ðŸĨŦ🍝🍜ðŸē🍛ðŸĢðŸąðŸĨŸðŸĶŠðŸĪ🍙🍚🍘ðŸĨðŸĨ ðŸĨŪðŸĒðŸĄðŸ§ðŸĻðŸĶðŸĨ§ðŸ§ðŸ°ðŸŽ‚ðŸŪ🍭🍎ðŸŦðŸŋðŸĐ🍊🌰ðŸĨœðŸ‘€ðŸ‘‚👃👄👅👆👇👈👉👊👋👌👍👎👏👐👑👒👓ðŸŽŊðŸŽ°ðŸŽąðŸŽēðŸŽģðŸ‘ūðŸ‘Ŋ👚ðŸ‘ŧðŸ‘―ðŸ‚ðŸƒðŸ„"];function wo(){const e=em.en,r=HA[Math.floor(Math.random()*HA.length)],n=e.getWord(Math.floor(Math.random()*2048)),i=e.getWord(Math.floor(Math.random()*2048));return`${r} ${n} ${i}`}function _re({onSuccess:t}){const[e,r]=y.useState(""),[n,i]=y.useState(),[s,o]=y.useState(!1),[a,l]=y.useState("");return{inProgress:s||!!a,loading:s,error:n,initiateAuth:async u=>{o(!0);try{const{instance:d}=await Re.email.initiateAuth({email:u});l(d),r(u)}catch(d){console.error(d),i(d.message||"Unknown error")}finally{o(!1)}},sendChallengeAnswer:a?async u=>{o(!0);try{const d=await Re.getSessionHash(),h=await Re.email.finalizeAuth({instance:a,answer:u,email:e,sessionHash:d});if(!("idToken"in h))throw new Error("invalid identity returned by finalizeAuth");t(h.idToken)}catch(d){i(d.message||"Unknown error")}finally{o(!1)}}:void 0}}const yh=t=>t.name==="AccountAlreadyLinked";function VT({onSuccess:t,sessionName:e,linkAccount:r=!1}){const n=P8(),[i,s]=y.useState(),[o,a]=y.useState(!1),[l,c]=y.useState(!1),[f,u]=y.useState(),[d,h]=y.useState();return y.useEffect(()=>Re.onEmailAuthCodeRequired(async b=>{a(!1),u(()=>b)}),[Re,a,u]),{inProgress:l,initiateAuth:async b=>{a(!0),c(!0);try{if(r){const w=await Re.initAuth({email:b});h(w),a(!1)}else{const w=await Re.signIn({email:b},e);t(w)}}catch(w){s(w.message||"Unknown error")}finally{r||(a(!1),c(!1))}},loading:o,error:i,sendChallengeAnswer:l?async b=>{if(r&&d){try{await Re.linkAccount(d.withAnswer(b))}catch(w){yh(w)&&n({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}a(!1),c(!1);return}f&&await f(b)}:void 0,cancel:()=>{c(!1),a(!1),h(void 0),u(null)}}}const Tre=({KEYS_TO_EXCLUDE:t=[]}={})=>{const e=(r,n)=>typeof r!=typeof n?!1:r===null||n===null?r===n:typeof r=="object"?Object.keys(r).length!==Object.keys(n).length||Object.keys(r).some(i=>!(i in n))?!1:Object.entries(r).filter(([i])=>!t.includes(i)).every(([i,s])=>e(s,n[i])):r===n;return e},Pre=Tre(),Rre=(t,e)=>t===e?e:Object.keys(t).reduce((r,n)=>(n in e&&Pre(t[n],e[n])&&(r[n]=t[n]),r),Object.assign({},e)),Ire=t=>{const e=y.useRef(!0),[r,n]=y.useState(t);y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]);const i=y.useCallback(s=>{e.current&&n(s)},[]);return[r,i]},qT=(t,e="StytchProvider")=>`${t} can only be used inside <${e}>.`,Ore="You cannot render a inside another .",Mre=`The @stytch/react library is not meant for use with serverside environments like NextJS. Use the @stytch/nextjs library instead - npm remove @stytch/react && npm install @stytch/nextjs -`;function A0(t,e){if(!t)throw new Error(e)}const Nre={user:null,fromCache:!1},$re={session:null,fromCache:!1},yw=y.createContext({isMounted:!1}),Dre=y.createContext(Nre),HT=y.createContext($re),WT=()=>y.useContext(yw).isMounted,Lre=()=>(A0(WT(),qT("useStytchSession")),y.useContext(HT)),jre=()=>{const t=y.useContext(yw);return A0(t.isMounted,qT("useStytch")),t.client},Fre=({stytch:t,children:e})=>{A0(!WT(),Ore),A0(typeof window<"u",Mre);const r=y.useMemo(()=>({client:t,isMounted:!0}),[t]),[{user:n,session:i},s]=Ire({session:t.session.getInfo(),user:t.user.getInfo()});return y.useEffect(()=>t.onStateChange(()=>{s(o=>{const a={session:t.session.getInfo(),user:t.user.getInfo()};return Rre(o,a)})}),[s,t]),pr.createElement(yw.Provider,{value:r},pr.createElement(Dre.Provider,{value:n},pr.createElement(HT.Provider,{value:i},e)))};function Bre(){const t=jre(),{session:e}=Lre(),[r,n]=y.useState(0),[i,s]=y.useState(""),o=y.useRef(null);y.useEffect(()=>{if(localStorage.getItem("stytch_auth")!=="legacy")return;const l=new URLSearchParams(window.location.search);l.get("stytch_token_type")==="magic_links"&&r===0&&(n(2),(async()=>await t.magicLinks.authenticate(l.get("token")||"",{session_duration_minutes:5}))())},[t,e,r]),y.useEffect(()=>{localStorage.getItem("stytch_auth")==="legacy"&&e&&r==2&&(n(3),(async()=>{console.log("LEGACY STYTCH FLOW");const l=t.session.getTokens(),u=await(await fetch(`https://oidc-wrapper.sequence.info/authenticate?jwt=${l.session_jwt}`,{method:"POST"})).json(),d=await Re.signIn({idToken:u.idToken},wo());console.log(`Wallet address: ${d}`),await t.session.revoke(),n(0),window.location.search="",Ri.navigate("/")})())},[e,t,r]);const a=async l=>{localStorage.setItem("stytch_auth","legacy"),n(1),await t.magicLinks.email.loginOrCreate(l,{})};return $.jsxs(G,{children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Stytch login (LEGACY)"})}),$.jsxs(G,{marginTop:"5",marginBottom:"4",children:[$.jsx(G,{marginTop:"6",children:$.jsx(Ir,{name:"stytchEmail",type:"email",onChange:l=>{s(l.target.value)},ref:o,onKeyDown:l=>{i&&l.key==="Enter"&&a(i)},value:i,placeholder:"hello@example.com",disabled:r!==0,required:!0})}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(Ct,{variant:"primary",label:"Continue",onClick:()=>a(i),"data-id":"continueButton",disabled:r!==0})}),r===1&&$.jsx(G,{children:$.jsx(me,{variant:"normal",color:"text80",children:"Magic link sent to your email. Please click the link. You can close this page."})})]})]})}function Ure(){var S;const[t,e]=y.useState(""),r=y.useRef(null),n=(S=r.current)==null?void 0:S.validity.valid,[i,s]=y.useState(!1),[o,a]=y.useState([]),[l,c]=y.useState(!0),[f,u]=y.useState(),[d,h]=y.useState(!1),p=y.useRef(null);Re.onEmailConflict(async(g,R)=>{p.current=R,u(g),h(!0)});const m=K8({flow:"implicit",onSuccess:g=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:g.access_token,CreateAccount:!0,TitleId:"8F854"},async(R,F)=>{if(R)try{const C=await Re.signIn({playFabTitleId:"8F854",playFabSessionTicket:R.data.SessionTicket},wo());console.log("Sequence response:",C),Ri.navigate("/")}catch{console.error("Error: "+JSON.stringify(F))}else F&&console.error("Error: "+JSON.stringify(F))})}}),{inProgress:x,loading:b,initiateAuth:w,sendChallengeAnswer:E,cancel:P}=VT({sessionName:wo(),onSuccess:async({wallet:g})=>{console.log(`Wallet address: ${g}`),Ri.navigate("/")}}),{inProgress:N,loading:I,initiateAuth:j,sendChallengeAnswer:L}=_re({onSuccess:async g=>{const R=await Re.signIn({idToken:g},wo());console.log(`Wallet address: ${R}`),Ri.navigate("/")}}),U=l?x:N,K=l?b:I,X=l?w:j,ee=l?E:L;y.useEffect(()=>{(async()=>await Re.isSignedIn()&&Ri.navigate("/"))()},[]);const M=async g=>{const R=await Re.signIn({idToken:g.credential},wo());console.log(`Wallet address: ${R.wallet}`),console.log(`Email address: ${R.email}`),Ri.navigate("/")},v="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":""),_=async g=>{const R=await Re.signIn({idToken:g.authorization.id_token},wo());console.log(`Wallet address: ${R.wallet}`),console.log(`Email address: ${R.email}`),Ri.navigate("/")},k=async()=>{const g=await Re.signIn({guest:!0},wo());console.log(`Wallet address: ${g.wallet}`),Ri.navigate("/")},A=new URLSearchParams(window.location.search),T=A.get("env")==="dev",[O,D]=y.useState(T);return $.jsxs($.Fragment,{children:[$.jsxs(G,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[$.jsxs(G,{marginBottom:"16",flexDirection:"row",children:[$.jsx(X8,{}),$.jsx(G,{marginLeft:"auto",children:$.jsx(pU,{label:"Use dev env",checked:O,onCheckedChange:()=>{O?(A.delete("env"),window.location.search=A.toString()):(A.set("env","dev"),window.location.search=A.toString()),D(!O)}})})]}),$.jsx(G,{gap:"4",children:$.jsx(Ct,{label:"Guest login",onClick:k})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{marginTop:"6",children:[$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Email Login"}),$.jsx(G,{marginTop:"4",children:$.jsx(i5,{label:"Use v2 email login",checked:l,onCheckedChange:()=>{c(!l)}})})]}),ee?$.jsxs(G,{flexDirection:"column",children:[$.jsx(G,{marginTop:"6",children:$.jsx(me,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),$.jsx(G,{marginTop:"4",children:$.jsx(J8,{value:o,digits:6,onChange:a})}),$.jsx(G,{gap:"2",marginY:"4",children:K?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:o.includes(""),label:"Verify",onClick:()=>ee(o.join("")),"data-id":"verifyButton"})})]}):$.jsxs(G,{marginTop:"5",marginBottom:"4",children:[$.jsxs(me,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",$.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),$.jsxs(G,{marginTop:"6",children:[$.jsx(Ir,{name:"email",type:"email",onChange:g=>{e(g.target.value)},ref:r,onKeyDown:g=>{t&&g.key==="Enter"&&X(t)},onBlur:()=>s(!!t&&!n),value:t,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),i&&$.jsx(me,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:K?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:!n,label:"Continue",onClick:()=>X(t),"data-id":"continueButton"})})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{paddingY:"4",gap:"4",flexDirection:"column",width:"full",children:!U&&$.jsxs($.Fragment,{children:[$.jsx(G,{marginBottom:"2",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Social Login"})}),$.jsxs(G,{gap:"4",flexDirection:"column",width:"fit",children:[$.jsx(G,{children:$.jsx(G8,{onSuccess:M,shape:"circle",width:230},"google")}),$.jsx(Q8,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:v,usePopup:!0},onError:g=>console.error(g),onSuccess:_,uiType:"dark"},"apple")]}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsxs(G,{children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Playfab login"})}),$.jsx(G,{children:$.jsx(Ct,{label:"Login with Google (through Playfab)",onClick:m})})]}),!1,$.jsx(Bre,{})]})})]}),d&&f&&$.jsx(i8,{size:"small",onClose:()=>h(!1),children:$.jsx(Are,{info:f,onCancel:()=>{h(!1),u(void 0),U&&(a([]),P(),e(""))},onConfirm:async()=>{var g;h(!1),u(void 0),await((g=p.current)==null?void 0:g.call(p))}})})]})}async function M1({transactions:t,network:e}){const r=await Re.feeOptions({transactions:t,network:e==null?void 0:e.id});return r.data.feeQuote&&r.data.feeOptions?{feeQuote:r.data.feeQuote,feeOptions:r.data.feeOptions,isSponsored:!1}:{feeQuote:r.data.feeQuote,feeOptions:r.data.feeOptions,isSponsored:!0}}function N1(t){var s;const{feeOptions:e,onSelected:r}=t,[n,i]=y.useState();return y.useEffect(()=>{e&&e.length>0&&(i(e[0]),r(e[0]))},[e]),y.useEffect(()=>{n&&r(n)},[n]),e?$.jsxs(G,{marginTop:"5",children:[$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options:"}),$.jsx(G,{marginTop:"3"}),$.jsx(u1,{name:"chainId",labelLocation:"top",onValueChange:o=>{const a=e.find(l=>l.token.name===o);a&&i(a)},value:(s=n==null?void 0:n.token)==null?void 0:s.name,options:[...e.map(o=>{var a,l,c;return{label:$.jsx(G,{alignItems:"center",gap:"2",children:$.jsxs(me,{children:[(a=o==null?void 0:o.token)==null?void 0:a.name," ",Dx(o==null?void 0:o.value,(l=o==null?void 0:o.token)==null?void 0:l.decimals)]})}),value:String((c=o==null?void 0:o.token)==null?void 0:c.name)}})]})]}):$.jsx(G,{})}const zre="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function Vre(t){const[e,r]=y.useState(),[n,i]=y.useState("ETH"),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(""),[u,d]=y.useState(),[h,p]=y.useState(!1),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(),[j,L]=y.useState(!1);y.useEffect(()=>{U()},[]),y.useEffect(()=>{var ee,M;if(t.network){const v=Kk(t.network.name);if(v){const _=v.name in{polygon:1,mumbai:1}?"MATIC":"ETH";i(_),U(),(ee=v.blockExplorer)!=null&&ee.rootUrl&&o((M=v.blockExplorer)==null?void 0:M.rootUrl)}}},[t.network]);const U=async()=>{if(!t.network)return;const ee=Kk(t.network.name);if(!ee)return;const M=await Re.getAddress(),_=await new zT(P_(ee.name),zre).getEtherBalance({accountAddress:M});r(ce.from(_.balance.balanceWei))},K=async(ee,M)=>{const v=await M1({transactions:[{to:ee,value:Gk(M)}],network:t.network});if(v.feeQuote&&v.feeOptions){w(v.feeOptions),I(v.feeQuote),console.log("feeOptions",v);return}L(!0),console.log("tx sponsored")},X=async(ee,M)=>{var v;try{x(void 0),p(!0);const _=await Re.sendTransaction({transactions:[{to:ee,value:Gk(M)}],network:(v=t.network)==null?void 0:v.id,transactionsFeeOption:E,transactionsFeeQuote:N});Wu(_)?d(_.data.txHash):x(_.data.error),p(!1)}catch(_){console.error(_),p(!1)}finally{I(void 0),w(void 0),P(void 0),L(!1)}};return $.jsxs(G,{children:[$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Native token balance: ",eY(e||0)," ",n]}),$.jsx(Ct,{marginLeft:"2",size:"xs",label:"Fetch",onClick:U}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"sendNativeTokenTo",type:"text",onChange:ee=>{l(ee.target.value)},value:a,placeholder:"To address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"sendNativeTokenAmount",type:"text",onChange:ee=>{f(ee.target.value)},value:c,placeholder:"Amount",required:!0,"data-id":"nativeTokenSendAmount"})}),m&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",m]}),$.jsx(N1,{feeOptions:b,onSelected:P}),j&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:a===""&&c==="",onClick:()=>K(a,c)}),$.jsx(Ct,{marginTop:"5",label:"Send native token",disabled:a===""&&c==="",onClick:()=>X(a,c)})]}),u&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),$.jsx("br",{}),$.jsx("a",{href:`${s}tx/${u}`,target:"_blank",rel:"noopener noreferrer",children:u})]})]})}function qre(){const[t,e]=y.useState(),[r,n]=y.useState(),[i,s]=y.useState(!0),[o,a]=y.useState(),l=async c=>{s(!0),e(void 0);try{await Re.dropSession({sessionId:c}),e(await Re.listSessions())}catch(f){a(f.message),e(await Re.listSessions())}s(!1)};return y.useEffect(()=>{Promise.all([Re.listSessions(),Re.getSessionId()]).then(([c,f])=>{e(c),n(f),s(!1)}).catch(c=>{a(c.message),s(!1)})},[]),$.jsxs(G,{children:[$.jsxs(G,{marginBottom:"5",children:[$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your open sessions:"})}),t&&$.jsx($.Fragment,{children:t.map(c=>$.jsx(G,{children:$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"normal",children:[c.friendlyName,!c.isThis&&$.jsx("a",{style:{marginLeft:"7px",textDecoration:"underline",cursor:"pointer"},onClick:()=>l(c.id),children:"x"}),c.isThis&&$.jsx($.Fragment,{children:" (current)"})]})},c.id))}),i&&$.jsx(_n,{})]}),o&&$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading sessions: ",o]})]})}function Hre(t){const[e,r]=y.useState(""),[n,i]=y.useState(),s=async()=>{var a;const o=await Re.signMessage({message:e,network:(a=t.network)==null?void 0:a.id});i(o.data.signature)};return $.jsxs(G,{children:[$.jsx(Ir,{name:"signMessageText",type:"text",onChange:o=>{r(o.target.value),n!=""&&i("")},value:e,placeholder:"Enter a message to sign",required:!0,"data-id":"signMessageInput"}),$.jsx(Ct,{marginTop:"5",label:"Sign message",disabled:e==="",onClick:()=>s()}),n&&n!==""&&$.jsxs(G,{flexDirection:"column",marginTop:"5",children:[$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Signature for ",e,":"]}),$.jsx(G,{children:$.jsx(me,{as:"p",wordBreak:"break-word",children:n})})]})]})}function Wre(t){const[e,r]=y.useState(""),[n,i]=y.useState(""),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(),[u,d]=y.useState(!1),[h,p]=y.useState(),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(!1),j=async()=>{const U=await M1({transactions:[pT({to:e,abi:n,func:s,args:JSON.parse(a),value:"0"})],network:t.network});if(U.feeQuote&&U.feeOptions){x(U.feeOptions),P(U.feeQuote),console.log("feeOptions",U);return}I(!0),console.log("tx sponsored")},L=async()=>{var U;try{p(void 0),d(!0);const K=await Re.callContract({network:(U=t.network)==null?void 0:U.id,to:e,abi:n,func:s,args:JSON.parse(a),value:0,transactionsFeeOption:b,transactionsFeeQuote:E});Wu(K)?f(K.data.txHash):p(K.data.error),d(!1)}catch(K){console.error(K),d(!1)}};return $.jsxs(G,{children:[$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractAddress",type:"text",onChange:U=>{r(U.target.value)},value:e,placeholder:"Contract address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractAbi",type:"text",onChange:U=>{i(U.target.value)},value:n,placeholder:"Contract ABI or function ABI, e.g. [{...}] or [{...}, {...}] or transfer(address,uint256)",required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractMethod",type:"text",onChange:U=>{o(U.target.value)},value:s,placeholder:"Method name, e.g. transfer",required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractArgs",type:"text",onChange:U=>{l(U.target.value)},value:a,placeholder:'Method args, e.g. [0x..., 1000] or named { "to": "0x...", "amount": "1000" }',required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(N1,{feeOptions:m,onSelected:w}),N&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",h]}),u?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&n===""&&s===""&&a==="",onClick:()=>j()}),$.jsx(Ct,{marginTop:"5",label:"Call contract",disabled:e===""&&n===""&&s===""&&a==="",onClick:()=>L()})]}),c&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),$.jsx("br",{}),$.jsx("a",{href:`https://polygonscan.com/tx/${c}`,target:"_blank",rel:"noopener noreferrer",children:c})]})]})}const WA=[{label:"Custom Token",value:"Custom"},{label:"USDC Old",value:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"},{label:"USDC New",value:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"},{label:"DAI",value:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"}];function Gre(t){const[e,r]=y.useState(WA[0].value),[n,i]=y.useState(""),[s,o]=y.useState(!0),[a,l]=y.useState("---"),[c,f]=y.useState(""),[u,d]=y.useState(""),[h,p]=y.useState(""),[m,x]=y.useState(""),[b,w]=y.useState(!1),[E,P]=y.useState(0),[N,I]=y.useState(),[j,L]=y.useState(),[U,K]=y.useState(),[X,ee]=y.useState(!1);y.useEffect(()=>{M(n)},[n]);const M=async A=>{var D;if(!Iq(A)){l("---");return}l("...");const T=new __(`https://nodes.sequence.app/${(D=t.network)==null?void 0:D.name}`),O=new HG(A,["function balanceOf(address) view returns (uint256)","function decimals() view returns (uint8)","function symbol() view returns (string)"],T);try{const[S,g,R]=await Promise.all([O.balanceOf(Re.getAddress()),O.decimals(),O.symbol()]);P(g),l(`${Dx(S,g)} ${R}`)}catch{l("---")}},v=async()=>{const A=await M1({transactions:[Bb({token:n,to:c,value:pu(u,E).toString()})],network:t.network});if(A.feeQuote&&A.feeOptions){I(A.feeOptions),K(A.feeQuote),console.log("feeOptions",A);return}ee(!0),console.log("tx sponsored")},_=async()=>{var A;try{x(""),w(!0);const T=await Re.sendERC20({token:n,to:c,value:pu(u,E),network:(A=t.network)==null?void 0:A.id,transactionsFeeOption:j,transactionsFeeQuote:U});Wu(T)?p(T.data.txHash):x(T.data.error)}catch(T){console.error(T)}finally{w(!1)}},k=A=>{r(A),A==="Custom"?(i(""),o(!0)):(i(A),o(!1))};return $.jsxs(G,{children:[$.jsxs(G,{marginTop:"5",children:[$.jsx(u1,{name:"token",options:WA,value:e??"",onValueChange:A=>k(A)}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:n,disabled:!s,onChange:A=>i(A.target.value),placeholder:"Custom ERC20 Contract Address"})})]}),$.jsxs(G,{marginTop:"3",children:[$.jsxs(me,{variant:"normal",color:"text100",children:["Token Balance: ",a]}),$.jsx(Ct,{marginLeft:"2",size:"xs",label:"Fetch",onClick:()=>M(n)})]}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:c,onChange:A=>f(A.target.value),placeholder:"Destination Address"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:u,onChange:A=>d(A.target.value),placeholder:"Amount"})}),m&&$.jsx(G,{marginTop:"3",children:$.jsxs(me,{color:"error",children:["Error: ",m]})}),$.jsx(N1,{feeOptions:N,onSelected:L}),X&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),b?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:n===""&&c==="",onClick:()=>v()}),$.jsx(Ct,{marginTop:"5",label:"Send Token",onClick:_})]}),h&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),$.jsx("a",{href:`https://polygonscan.com/tx/${h}`,target:"_blank",rel:"noopener noreferrer",children:h})]})]})}const Kre="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function Yre(t){var a;const[e,r]=y.useState(""),[n,i]=y.useState("");y.useEffect(()=>{t.onChange(t.index,e,n)},[e,n]);const s={display:"flex",gap:"10px",marginBottom:"10px"},o={flex:1};return $.jsxs(G,{style:s,children:[$.jsx(G,{style:o,children:$.jsx(u1,{name:`sendERC1155TokenId${t.index}`,value:e,disabled:!t.options,onValueChange:l=>{r(l)},options:((a=t.options)==null?void 0:a.balances.map(l=>{var c;return{label:`${((c=l.tokenMetadata)==null?void 0:c.name)||"Unknown"} - ${l.balance}`,value:l.tokenID}}))||[],placeholder:"Select a token"})}),$.jsx(G,{style:o,children:$.jsx(Ir,{type:"text",value:e,onChange:l=>r(l.target.value),placeholder:"Token ID"})}),$.jsx(G,{style:o,children:$.jsx(Ir,{type:"text",value:n,onChange:l=>i(l.target.value),placeholder:"Amount"})}),$.jsx(G,{style:o,children:$.jsx(Ct,{label:"Remove",onClick:()=>t.removeTokenEntry(t.index)})})]})}function Qre(t){const[e,r]=y.useState(""),[n,i]=y.useState([]),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(""),[u,d]=y.useState(!1),[h,p]=y.useState(void 0),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(!1),j=()=>{i([...n,{tokenId:"",amount:""}])},L=async()=>{if(!e||!t.network)return;const M=t.network.name,v=new zT("https://"+M+"-indexer.sequence.app",Kre),_=e,k=await Re.getAddress(),A=!0;p(await v.getTokenBalances({contractAddress:_,accountAddress:k,includeMetadata:A}))};y.useEffect(()=>{L()},[e]);const U=(M,v)=>{const _=[...n];_[M]=v,i(_)},K=M=>{const v=[...n];v.splice(M,1),i(v)},X=async()=>{const M=await M1({transactions:[Ub({to:s,token:e,values:n.map(v=>({id:v.tokenId,amount:pu(v.amount,0)}))})],network:t.network});if(M.feeQuote&&M.feeOptions){x(M.feeOptions),P(M.feeQuote),console.log("feeOptions",M);return}I(!0),console.log("tx sponsored")},ee=async()=>{var M;try{f(""),d(!0);const v=await Re.sendERC1155({to:s,token:e,values:n.map(_=>({id:_.tokenId,amount:pu(_.amount,0)})),network:(M=t.network)==null?void 0:M.id,transactionsFeeOption:b,transactionsFeeQuote:E});Wu(v)?l(v.data.txHash):f(v.data.error)}catch(v){console.error(v)}finally{d(!1)}};return $.jsxs(G,{children:[$.jsx(G,{marginBottom:"5",children:$.jsx(Ir,{type:"text",value:e,onChange:M=>r(M.target.value),placeholder:"Token Contract Address"})}),$.jsx(G,{marginBottom:"5",children:$.jsx(Ct,{label:"Fetch metadata",onClick:()=>L()})}),n.map((M,v)=>$.jsx(G,{marginBottom:"3",children:$.jsx(Yre,{index:v,options:h,onChange:(_,k,A)=>U(_,{tokenId:k,amount:A}),removeTokenEntry:K})},v)),$.jsx(Ct,{label:"Add Token",onClick:j}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:s,onChange:M=>o(M.target.value),placeholder:"Destination Address"})}),c&&$.jsx(G,{marginTop:"3",children:$.jsxs(me,{color:"error",children:["Error: ",c]})}),$.jsx(N1,{feeOptions:m,onSelected:w}),N&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),u?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&s===""&&n.length!==0,onClick:()=>X()}),$.jsx(Ct,{marginTop:"5",label:"Send Tokens",onClick:ee})]}),a&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),$.jsx("a",{href:`https://polygonscan.com/tx/${a}`,target:"_blank",rel:"noopener noreferrer",children:a})]})]})}function Jre(t){const[e,r]=y.useState(),[n,i]=y.useState(),[s,o]=y.useState(!1),[a,l]=y.useState(),c=async()=>{var f,u;try{l(void 0),o(!0),console.log(t.walletAddress);const h=await(await fetch("https://dev-api.sequence.app/rpc/API/GenerateWaaSVerificationURL",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({walletAddress:t.walletAddress})})).json(),p=await Re.sessionAuthProof({nonce:h.nonce,network:(f=t.network)==null?void 0:f.name}),m=`https://demo-waas-wallet-link.pages.dev/?nonce=${h.nonce}&signature=${p.data.signature}&sessionId=${p.data.sessionId}&chainId=${(u=t.network)==null?void 0:u.name}`;r(m),i(h.nonce),o(!1)}catch(d){console.error(d),o(!1)}};return $.jsxs(G,{children:[a&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",a]}),s?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsx(G,{children:$.jsx(Ct,{marginTop:"5",label:"Generate EOA Link",disabled:n!==void 0,onClick:()=>c()})}),n&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Verification Link:"}),$.jsx("br",{}),$.jsx("a",{href:`${e}`,target:"_blank",rel:"noopener noreferrer",children:e})]})]})}const Fe={AMOY:80002,APE_CHAIN_TESTNET:33111,ARBITRUM:42161,ARBITRUM_GOERLI:421613,ARBITRUM_NOVA:42170,ARBITRUM_SEPOLIA:421614,AVALANCHE:43114,AVALANCHE_TESTNET:43113,BASE:8453,BASE_GOERLI:84531,BASE_SEPOLIA:84532,B3_SEPOLIA:1993,BLAST:81457,BLAST_SEPOLIA:168587773,BORNE_TESTNET:94984,BSC:56,BSC_TESTNET:97,FANTOM:250,FANTOM_TESTNET:4002,GNOSIS:100,GOERLI:5,HOMEVERSE:19011,HOMEVERSE_TESTNET:40875,IMMUTABLE_ZKEVM:13371,IMMUTABLE_ZKEVM_TESTNET:13473,KOVAN:42,MAINNET:1,OPTIMISM:10,OPTIMISM_SEPOLIA:11155420,OPTIMISM_TESTNET:69,POLYGON:137,POLYGON_MUMBAI:80001,POLYGON_ZKEVM:1101,RINKEBY:4,ROPSTEN:3,SEPOLIA:11155111,ASTAR_ZKEVM:3776,ASTAR_ZKYOTO:6038361,XAI:660279,XAI_SEPOLIA:37714555429,XR_SEPOLIA:2730},Xre={[Fe.MAINNET]:"https://assets.sequence.info/images/networks/small/1.webp",[Fe.ROPSTEN]:"https://assets.sequence.info/images/networks/small/3.webp",[Fe.GOERLI]:"https://assets.sequence.info/images/networks/small/5.webp",[Fe.KOVAN]:"https://assets.sequence.info/images/networks/small/42.webp",[Fe.OPTIMISM]:"https://assets.sequence.info/images/networks/small/10.webp",[Fe.OPTIMISM_TESTNET]:"https://assets.sequence.info/images/networks/small/69.webp",[Fe.OPTIMISM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155420.webp",[Fe.POLYGON]:"https://assets.sequence.info/images/networks/small/137.webp",[Fe.POLYGON_MUMBAI]:"https://assets.sequence.info/images/networks/small/80001.webp",[Fe.POLYGON_ZKEVM]:"https://assets.sequence.info/images/networks/small/1101.webp",[Fe.APE_CHAIN_TESTNET]:"https://assets.sequence.info/images/networks/small/33111.webp",[Fe.ARBITRUM]:"https://assets.sequence.info/images/networks/small/42161.webp",[Fe.ARBITRUM_NOVA]:"https://assets.sequence.info/images/networks/small/42170.webp",[Fe.ARBITRUM_GOERLI]:"https://assets.sequence.info/images/networks/small/421613.webp",[Fe.ARBITRUM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/421614.webp",[Fe.GNOSIS]:"https://assets.sequence.info/images/networks/small/100.webp",[Fe.BSC]:"https://assets.sequence.info/images/networks/small/56.webp",[Fe.BSC_TESTNET]:"https://assets.sequence.info/images/networks/small/97.webp",[Fe.FANTOM]:"https://assets.sequence.info/images/networks/small/250.webp",[Fe.FANTOM_TESTNET]:"https://assets.sequence.info/images/networks/small/4002.webp",[Fe.AVALANCHE]:"https://assets.sequence.info/images/networks/small/43114.webp",[Fe.AVALANCHE_TESTNET]:"https://assets.sequence.info/images/networks/small/43113.webp",[Fe.BASE]:"https://assets.sequence.info/images/networks/small/8453.webp",[Fe.BASE_SEPOLIA]:"https://assets.sequence.info/images/networks/small/84532.webp",[Fe.BORNE_TESTNET]:"https://assets.sequence.info/images/networks/small/94984.webp",[Fe.BLAST]:"https://assets.sequence.info/images/networks/small/81457.webp",[Fe.BLAST_SEPOLIA]:"https://assets.sequence.info/images/networks/small/168587773.webp",[Fe.SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155111.webp",[Fe.AMOY]:"https://assets.sequence.info/images/networks/small/80002.webp",[Fe.HOMEVERSE]:"https://assets.sequence.info/images/networks/small/19011.webp",[Fe.HOMEVERSE_TESTNET]:"https://assets.sequence.info/images/networks/small/40875.webp",[Fe.IMMUTABLE_ZKEVM]:"https://assets.sequence.info/images/networks/small/13371.webp",[Fe.IMMUTABLE_ZKEVM_TESTNET]:"https://assets.sequence.info/images/networks/small/13473.webp",[Fe.XAI]:"https://assets.sequence.info/images/networks/small/660279.webp",[Fe.XAI_SEPOLIA]:"https://assets.sequence.info/images/networks/small/37714555429.webp",[Fe.ASTAR_ZKEVM]:"https://assets.sequence.info/images/networks/small/3776.webp",[Fe.ASTAR_ZKYOTO]:"https://assets.sequence.info/images/networks/small/6038361.webp",[Fe.B3_SEPOLIA]:"https://assets.sequence.info/images/networks/small/1993.webp",[Fe.XR_SEPOLIA]:"https://assets.sequence.info/images/networks/small/2730.webp"};function Zre({onNetworkChange:t}){const[e,r]=y.useState(),[n,i]=y.useState([]);return y.useEffect(()=>{Re.networkList().then(s=>{i(s),r(s[0]),t(s[0])})},[]),n.length===0?$.jsx(G,{marginY:"5",children:$.jsx(_n,{})}):$.jsxs(G,{marginBottom:"4",children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Network to use with requests:"})}),$.jsx(G,{children:$.jsx(u1,{name:"chainId",labelLocation:"top",onValueChange:s=>{const o=n==null?void 0:n.find(a=>a.name===s);o&&(r(o),t(o))},value:e==null?void 0:e.name,options:[...n.map(s=>({label:$.jsxs(G,{alignItems:"center",gap:"2",children:[$.jsx(nz,{src:Xre[s.id],size:"sm"}),$.jsx(me,{children:s.name})]}),value:String(s.name)}))]})})]})}function GT(t){var e;if(t.type===cr.Email)return $.jsxs(me,{variant:"normal",color:"text100",children:["(",t.email,")"]});if(t.type===cr.Guest)return $.jsx(me,{variant:"normal",color:"text100",children:"Guest account"});if(t.type===cr.PlayFab)return $.jsxs(me,{variant:"normal",color:"text100",children:["(",t.email,")"]});if(t.type===cr.OIDC&&(e=t.issuer)!=null&&e.includes("cognito-idp"))return $.jsxs(me,{variant:"normal",color:"text100",children:["Email v1 (",t.email,")"]});if(t.type===cr.Stytch)return $.jsxs($.Fragment,{children:["Stytch account (",t.email,")"]});if({}.STYTCH_LEGACY_ISSUER&&t.issuer==={}.STYTCH_LEGACY_ISSUER)return $.jsxs($.Fragment,{children:["WRAPPED Stytch account (",t.email]});switch(t.issuer){case"https://accounts.google.com":return $.jsxs(G,{gap:"2",marginTop:"2",children:[$.jsx("img",{width:24,src:"data:image/png;base64,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"}),$.jsxs(me,{variant:"normal",color:"text100",children:["Google (",t.email,")"]})]});case"https://appleid.apple.com":return $.jsxs(G,{gap:"2",children:[$.jsx("img",{width:24,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABMlJREFUaEPVmV1oXEUUx89/Ete6SUykWiv4QcRYymISc2fWdCPUVUQUpIqKPggaEa1Wqj7UPokg+hJfagM+iMX2QS0RjQSFIkLpQ2Oyd+7GtaTiB4rgB8ZqNKlJupvco6MbCHH33tnNzSaZ1zn3f/6/O3PnzMwFbfCGDe6f1gxgfHw8Njs7exMRXd/c3Hygra3tXDUvs+YAx48f39TU1LSPiJ4koq1F0y1Syj/XPYDWuouIjhJR2xKzc47jxAHwugZwXbcHwEdE1LzUKIBhx3F6qjFvnqnJFMpkMluFEGNLpsxSv3ullP3rGkBrbd78HctNMvNkoVC4JpVK/b5uATKZjBJCZEoZBPC44zivV2u+JlPI87x+Zn6qhMnDUsrelZivCYDW+nMium6pUWZ+U0r5KAB/IwCcIaLNxigz/yGEeNZxnMMrNb74/IpXoZGRkUvr6+vnyhUirfXbRDTDzCfi8fhgIpE4a5KPjo5uFkJcKf5rv3V2dn5fTS2oGEBrfRkRPUREdzFzJ4Dzi2/3VwAnieiDWCw21N7ePrls2sB13R11dXW7mPn2EtPqLAAN4Eh9ff27HR0df9mMkjWA2QI0NjY+T0RPA2gIEmfmcwCOEdHHzPyjECLFzPcS0dU2pojoDDPvVkq9FxZvBWAKERENCiG6wwQj7u+XUu4N0gwFGBsba1lYWBglomsjNmcr94KU8sVywYEAzCyy2eyHxTlrmzCyOGbOA9gnpTxYFYDrug8AeCcyRxUIMfNPRHS3UqpkFQ9dRgcGBupaW1tPAdheQd6oQqd939+RTCbHwwTLTqFsNnuL7/ufhAmsUv8eKeVrNtplAVzX7TPzz0YkyhhmNgWtTUpZsNEtC6C1Nvv3ThuRKGOY+RWl1HO2mkEjMAmgxVYoqjgA9ziO876tXkkAc2MwMzMzByC0Ttgmso1j5hvCVp6lWiUNFvc7ZhmreWPmLqWUmb5WrSRALpfbUigUfrFSiDiImW9VSlmvfiUBhoeHL4jFYjMRe7OSY+b9Sqk+q+CgWwnXdScAXGIrFFUcM3+qlErZ6pX9SD3PO8nM1kK2CW3ifN/vSSaTwzaxQXXggNn724isQsyp6enpZDqdngvTDgK4j4gGwgRWsf+Q4ziPhR38ywIUzwETRHTeKpoMlAZwdGpqqjdoJAILVSaTOSaEuG2tAExeZv4GwDNSSnO7978WCOB53p3/FJahtQQwuX3fn2hoaLgikUjkl3sJO5HB87wviGjbGkO8JKU0FwqVjYCJ1lqbQ/WrawgwPz8/39rd3f1DVQDFqvwVEV2+RhBvSSkfLJfbarfped7D5j6z1gDmUE9E25VS364IwNxOeJ53gohurCUEgD7HcfYH5bQaASPguu42AJ8R0aYaQXydz+c7UqnUbCQARYhHAByqAcAcM++0OdhYj8Ci6YAfFpFwMTMD6JVSHrERrBjAfA9a64MA9lgkWCCin33fjwkhtljG75ZSvmER+29IxQCLwlrrJ5j5ZQAXLUt2GoDZBA5OTU2dTqfT86Y/l8s15PP5nQDuN1fzRHThsue+NL+iKjmNrQigWOQuJiJzbX4VgO8AjHZ1deXC3l6xttxslkjz35iZc/F4fKjUViFMq+oRCBOuVf+GB/gb9M3GQJMHYpQAAAAASUVORK5CYII="}),$.jsxs(me,{variant:"normal",color:"text100",children:["Apple (",t.email,")"]})]});default:return"Unknown"}}function ene(){var ee;const t=P8(),[e,r]=y.useState(),[n,i]=y.useState(),[s,o]=y.useState(!0),[a,l]=y.useState(),[c,f]=y.useState(""),u=y.useRef(null),d=(ee=u.current)==null?void 0:ee.validity.valid,[h,p]=y.useState(!1),[m,x]=y.useState([]),[b,w]=y.useState(!0),{inProgress:E,loading:P,initiateAuth:N,sendChallengeAnswer:I}=VT({sessionName:wo(),onSuccess:async({wallet:M})=>{console.log(`Wallet address: ${M}`)},linkAccount:!0}),j=async M=>{o(!0),i(void 0);try{await Re.removeAccount(M);const v=await Re.listAccounts();i(v.accounts)}catch(v){l(v.message);const _=await Re.listAccounts();i(_.accounts)}o(!1)},L=async M=>{const v=await Re.initAuth({idToken:M.credential});try{const _=await Re.linkAccount(v);i(k=>[...k||[],_.account])}catch(_){yh(_)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},U="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":"/"),K=async M=>{const v=await Re.initAuth({idToken:M.authorization.id_token});try{const _=await Re.linkAccount(v);i(k=>[...k||[],_.account])}catch(_){yh(_)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},X=K8({flow:"implicit",onSuccess:M=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:M.access_token,CreateAccount:!0,TitleId:"8F854"},async(v,_)=>{if(v)try{const k=await Re.initAuth({playFabTitleId:"8F854",playFabSessionTicket:v.data.SessionTicket}),A=await Re.linkAccount(k);console.log("playfab account",JSON.stringify(A.account,null,2)),i(T=>[...T||[],A.account])}catch(k){console.error(k),yh(k)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}else _&&console.log("Error: "+JSON.stringify(_))})}});return y.useEffect(()=>{Re.listAccounts().then(M=>{i(M.accounts),M.currentAccountId&&r(M.accounts.find(v=>v.id===M.currentAccountId)),o(!1)}).catch(M=>{l(M.message),o(!1)})},[E]),$.jsxs(G,{children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{marginBottom:"5",gap:"4",flexDirection:"column",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your connected (linked) accounts"}),n&&$.jsx($.Fragment,{children:n.map(M=>$.jsxs(G,{flexDirection:"row",alignItems:"center",gap:"2",children:[$.jsx(me,{variant:"normal",color:"text100",children:GT(M)}),M.id!==(e==null?void 0:e.id)&&$.jsx(Ct,{size:"xs",label:"Remove",onClick:()=>j(M.id)}),M.id===(e==null?void 0:e.id)&&$.jsx(G,{children:$.jsx(me,{variant:"small",color:"text100",children:"(Account you logged in with)"})})]},M.id))}),s&&$.jsx(_n,{})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{flexDirection:"column",gap:"2",width:"fit",children:[$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",marginBottom:"5",children:"Connect (link) another login method"}),$.jsx(G8,{onSuccess:L,shape:"circle",width:230}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsx(Q8,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:U,usePopup:!0},onError:M=>console.error(M),onSuccess:K,uiType:"dark"}),$.jsxs($.Fragment,{children:[$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsx(G,{marginTop:"2",children:$.jsx(G,{children:$.jsx(Ct,{label:"Login with Google (through Playfab)",onClick:X})})})]}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsxs(G,{marginTop:"2",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Email"}),$.jsx(G,{marginTop:"4",children:$.jsx(i5,{label:"Use v2 email login",disabled:!0,checked:b,onChange:()=>w(!b)})})]}),I?$.jsxs(G,{flexDirection:"column",children:[$.jsx(G,{marginTop:"3",children:$.jsx(me,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),$.jsx(G,{marginTop:"4",children:$.jsx(zF,{value:m,digits:6,onChange:x})}),$.jsx(G,{gap:"2",marginY:"4",children:P?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:m.includes(""),label:"Verify",onClick:()=>I(m.join("")),"data-id":"verifyButton"})})]}):$.jsxs(G,{marginBottom:"4",children:[$.jsxs(me,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",$.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),$.jsxs(G,{marginTop:"6",children:[$.jsx(Ir,{name:"email",type:"email",onChange:M=>{f(M.target.value)},ref:u,onKeyDown:M=>{c&&M.key==="Enter"&&N(c)},onBlur:()=>p(!!c&&!d),value:c,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),h&&$.jsx(me,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:P?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:!d,label:"Continue",onClick:()=>N(c),"data-id":"continueButton"})})]})]}),a&&$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading accounts: ",a]})]})}function tne(){const[t,e]=y.useState(),[r,n]=y.useState(),[i,s]=y.useState([]),[o,a]=y.useState(!1),[l,c]=y.useState(!1),[f,u]=y.useState(),[d,h]=y.useState();return y.useEffect(()=>{Re.getAddress().then(p=>{e(p)}).catch(p=>{n(p.message)}),Re.listAccounts().then(p=>{p.currentAccountId&&h(p.accounts.find(m=>m.id===p.currentAccountId))})},[]),y.useEffect(()=>{Re.isSignedIn().then(p=>{p||Ri.navigate("/login")})},[]),y.useEffect(()=>{const p=i.join("");p.length===6&&(c(!0),Re.finishValidateSession(p))},[i]),y.useEffect(()=>{const p=Re.onValidationRequired(()=>{a(!0),Re.waitForSessionValid(6e5,4e3).then(m=>{console.log("isValid",m),s([]),a(!1),c(!1)})});return()=>{p.then(m=>m())}},[]),$.jsxs($.Fragment,{children:[$.jsx(Hg,{children:o&&$.jsx(i8,{children:$.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"1.2em",height:"50vh"},children:$.jsxs(G,{flexDirection:"column",alignItems:"center",children:[$.jsx(me,{marginBottom:"7",children:"Please enter the session verification code that was sent to your email"}),$.jsx(J8,{value:i,digits:6,onChange:s}),$.jsx(G,{marginTop:"5",children:l&&$.jsx(_n,{})})]})})})}),$.jsxs(G,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[$.jsx(G,{marginBottom:"10",children:$.jsx(X8,{})}),$.jsxs(G,{marginBottom:"5",flexDirection:"row",children:[d&&$.jsxs(G,{flexDirection:"column",gap:"2",children:[$.jsxs(me,{marginTop:"1",variant:"normal",color:"text100",children:[d.type===cr.Guest?"Guest account":`Logged in with account type ${d.type}`," "]}),d.type!==cr.Guest&>(d)]}),$.jsx(Ct,{marginLeft:"auto",label:"Log out",size:"xs",onClick:async()=>{try{await Re.dropSession({strict:!1})}catch(p){console.warn(`Could not drop session: ${p.message}`)}$V(),Ri.navigate("/login")}})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your wallet address:"})}),$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"normal",children:t?$.jsx(G,{children:$.jsx(me,{children:t})}):$.jsx(_n,{})})}),$.jsx(G,{children:r&&$.jsxs(me,{children:["Error fetching wallet address: ",r]})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(qre,{}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{marginBottom:"5",children:$.jsx(Zre,{onNetworkChange:u})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(il,{marginY:"3",label:"Send native token transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Vre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Send ERC20 transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Gre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Send ERC1155 transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Qre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Sign a message",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Hre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Call contracts",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Wre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"EOA Link",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Jre,{network:f,walletAddress:t})]}),$.jsx(ene,{})]})]})}function rne(t,e,r){return e=JT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bm(t,e){return sne(t)||ine(t,e)||KT(t,e)||nne()}function nne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +`;function A0(t,e){if(!t)throw new Error(e)}const Nre={user:null,fromCache:!1},$re={session:null,fromCache:!1},yw=y.createContext({isMounted:!1}),Dre=y.createContext(Nre),HT=y.createContext($re),WT=()=>y.useContext(yw).isMounted,Lre=()=>(A0(WT(),qT("useStytchSession")),y.useContext(HT)),jre=()=>{const t=y.useContext(yw);return A0(t.isMounted,qT("useStytch")),t.client},Fre=({stytch:t,children:e})=>{A0(!WT(),Ore),A0(typeof window<"u",Mre);const r=y.useMemo(()=>({client:t,isMounted:!0}),[t]),[{user:n,session:i},s]=Ire({session:t.session.getInfo(),user:t.user.getInfo()});return y.useEffect(()=>t.onStateChange(()=>{s(o=>{const a={session:t.session.getInfo(),user:t.user.getInfo()};return Rre(o,a)})}),[s,t]),pr.createElement(yw.Provider,{value:r},pr.createElement(Dre.Provider,{value:n},pr.createElement(HT.Provider,{value:i},e)))};function Bre(){const t=jre(),{session:e}=Lre(),[r,n]=y.useState(0),[i,s]=y.useState(""),o=y.useRef(null);y.useEffect(()=>{if(localStorage.getItem("stytch_auth")!=="legacy")return;const l=new URLSearchParams(window.location.search);l.get("stytch_token_type")==="magic_links"&&r===0&&(n(2),(async()=>await t.magicLinks.authenticate(l.get("token")||"",{session_duration_minutes:5}))())},[t,e,r]),y.useEffect(()=>{localStorage.getItem("stytch_auth")==="legacy"&&e&&r==2&&(n(3),(async()=>{console.log("LEGACY STYTCH FLOW");const l=t.session.getTokens(),u=await(await fetch(`https://oidc-wrapper.sequence.info/authenticate?jwt=${l.session_jwt}`,{method:"POST"})).json(),d=await Re.signIn({idToken:u.idToken},wo());console.log(`Wallet address: ${d}`),await t.session.revoke(),n(0),window.location.search="",Ri.navigate("/")})())},[e,t,r]);const a=async l=>{localStorage.setItem("stytch_auth","legacy"),n(1),await t.magicLinks.email.loginOrCreate(l,{})};return $.jsxs(G,{children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Stytch login (LEGACY)"})}),$.jsxs(G,{marginTop:"5",marginBottom:"4",children:[$.jsx(G,{marginTop:"6",children:$.jsx(Ir,{name:"stytchEmail",type:"email",onChange:l=>{s(l.target.value)},ref:o,onKeyDown:l=>{i&&l.key==="Enter"&&a(i)},value:i,placeholder:"hello@example.com",disabled:r!==0,required:!0})}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(Ct,{variant:"primary",label:"Continue",onClick:()=>a(i),"data-id":"continueButton",disabled:r!==0})}),r===1&&$.jsx(G,{children:$.jsx(me,{variant:"normal",color:"text80",children:"Magic link sent to your email. Please click the link. You can close this page."})})]})]})}function Ure(){var S;const[t,e]=y.useState(""),r=y.useRef(null),n=(S=r.current)==null?void 0:S.validity.valid,[i,s]=y.useState(!1),[o,a]=y.useState([]),[l,c]=y.useState(!0),[f,u]=y.useState(),[d,h]=y.useState(!1),p=y.useRef(null);Re.onEmailConflict(async(g,R)=>{p.current=R,u(g),h(!0)});const m=K8({flow:"implicit",onSuccess:g=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:g.access_token,CreateAccount:!0,TitleId:"8F854"},async(R,F)=>{if(R)try{const C=await Re.signIn({playFabTitleId:"8F854",playFabSessionTicket:R.data.SessionTicket},wo());console.log("Sequence response:",C),Ri.navigate("/")}catch{console.error("Error: "+JSON.stringify(F))}else F&&console.error("Error: "+JSON.stringify(F))})}}),{inProgress:x,loading:b,initiateAuth:w,sendChallengeAnswer:E,cancel:P}=VT({sessionName:wo(),onSuccess:async({wallet:g})=>{console.log(`Wallet address: ${g}`),Ri.navigate("/")}}),{inProgress:N,loading:I,initiateAuth:j,sendChallengeAnswer:L}=_re({onSuccess:async g=>{const R=await Re.signIn({idToken:g},wo());console.log(`Wallet address: ${R}`),Ri.navigate("/")}}),U=l?x:N,K=l?b:I,X=l?w:j,ee=l?E:L;y.useEffect(()=>{(async()=>await Re.isSignedIn()&&Ri.navigate("/"))()},[]);const M=async g=>{const R=await Re.signIn({idToken:g.credential},wo());console.log(`Wallet address: ${R.wallet}`),console.log(`Email address: ${R.email}`),Ri.navigate("/")},v="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":""),_=async g=>{const R=await Re.signIn({idToken:g.authorization.id_token},wo());console.log(`Wallet address: ${R.wallet}`),console.log(`Email address: ${R.email}`),Ri.navigate("/")},k=async()=>{const g=await Re.signIn({guest:!0},wo());console.log(`Wallet address: ${g.wallet}`),Ri.navigate("/")},A=new URLSearchParams(window.location.search),T=A.get("env")==="dev",[O,D]=y.useState(T);return $.jsxs($.Fragment,{children:[$.jsxs(G,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[$.jsxs(G,{marginBottom:"16",flexDirection:"row",children:[$.jsx(X8,{}),$.jsx(G,{marginLeft:"auto",children:$.jsx(pU,{label:"Use dev env",checked:O,onCheckedChange:()=>{O?(A.delete("env"),window.location.search=A.toString()):(A.set("env","dev"),window.location.search=A.toString()),D(!O)}})})]}),$.jsx(G,{gap:"4",children:$.jsx(Ct,{label:"Guest login",onClick:k})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{marginTop:"6",children:[$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Email Login"}),$.jsx(G,{marginTop:"4",children:$.jsx(i5,{label:"Use v2 email login",checked:l,onCheckedChange:()=>{c(!l)}})})]}),ee?$.jsxs(G,{flexDirection:"column",children:[$.jsx(G,{marginTop:"6",children:$.jsx(me,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),$.jsx(G,{marginTop:"4",children:$.jsx(J8,{value:o,digits:6,onChange:a})}),$.jsx(G,{gap:"2",marginY:"4",children:K?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:o.includes(""),label:"Verify",onClick:()=>ee(o.join("")),"data-id":"verifyButton"})})]}):$.jsxs(G,{marginTop:"5",marginBottom:"4",children:[$.jsxs(me,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",$.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),$.jsxs(G,{marginTop:"6",children:[$.jsx(Ir,{name:"email",type:"email",onChange:g=>{e(g.target.value)},ref:r,onKeyDown:g=>{t&&g.key==="Enter"&&X(t)},onBlur:()=>s(!!t&&!n),value:t,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),i&&$.jsx(me,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:K?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:!n,label:"Continue",onClick:()=>X(t),"data-id":"continueButton"})})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{paddingY:"4",gap:"4",flexDirection:"column",width:"full",children:!U&&$.jsxs($.Fragment,{children:[$.jsx(G,{marginBottom:"2",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Social Login"})}),$.jsxs(G,{gap:"4",flexDirection:"column",width:"fit",children:[$.jsx(G,{children:$.jsx(G8,{onSuccess:M,shape:"circle",width:230},"google")}),$.jsx(Q8,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:v,usePopup:!0},onError:g=>console.error(g),onSuccess:_,uiType:"dark"},"apple")]}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsxs(G,{children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Playfab login"})}),$.jsx(G,{children:$.jsx(Ct,{label:"Login with Google (through Playfab)",onClick:m})})]}),!1,$.jsx(Bre,{})]})})]}),d&&f&&$.jsx(i8,{size:"small",onClose:()=>h(!1),children:$.jsx(Are,{info:f,onCancel:()=>{h(!1),u(void 0),U&&(a([]),P(),e(""))},onConfirm:async()=>{var g;h(!1),u(void 0),await((g=p.current)==null?void 0:g.call(p))}})})]})}async function M1({transactions:t,network:e}){const r=await Re.feeOptions({transactions:t,network:e==null?void 0:e.id});return r.data.feeQuote&&r.data.feeOptions?{feeQuote:r.data.feeQuote,feeOptions:r.data.feeOptions,isSponsored:!1}:{feeQuote:r.data.feeQuote,feeOptions:r.data.feeOptions,isSponsored:!0}}function N1(t){var s;const{feeOptions:e,onSelected:r}=t,[n,i]=y.useState();return y.useEffect(()=>{e&&e.length>0&&(i(e[0]),r(e[0]))},[e]),y.useEffect(()=>{n&&r(n)},[n]),e?$.jsxs(G,{marginTop:"5",children:[$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options:"}),$.jsx(G,{marginTop:"3"}),$.jsx(u1,{name:"chainId",labelLocation:"top",onValueChange:o=>{const a=e.find(l=>l.token.name===o);a&&i(a)},value:(s=n==null?void 0:n.token)==null?void 0:s.name,options:[...e.map(o=>{var a,l,c;return{label:$.jsx(G,{alignItems:"center",gap:"2",children:$.jsxs(me,{children:[(a=o==null?void 0:o.token)==null?void 0:a.name," ",Dx(o==null?void 0:o.value,(l=o==null?void 0:o.token)==null?void 0:l.decimals)]})}),value:String((c=o==null?void 0:o.token)==null?void 0:c.name)}})]})]}):$.jsx(G,{})}const zre="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function Vre(t){const[e,r]=y.useState(),[n,i]=y.useState("ETH"),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(""),[u,d]=y.useState(),[h,p]=y.useState(!1),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(),[j,L]=y.useState(!1);y.useEffect(()=>{U()},[]),y.useEffect(()=>{var ee,M;if(t.network){const v=Kk(t.network.name);if(v){const _=v.name in{polygon:1,mumbai:1}?"MATIC":"ETH";i(_),U(),(ee=v.blockExplorer)!=null&&ee.rootUrl&&o((M=v.blockExplorer)==null?void 0:M.rootUrl)}}},[t.network]);const U=async()=>{if(!t.network)return;const ee=Kk(t.network.name);if(!ee)return;const M=await Re.getAddress(),_=await new zT(P_(ee.name),zre).getEtherBalance({accountAddress:M});r(ce.from(_.balance.balanceWei))},K=async(ee,M)=>{const v=await M1({transactions:[{to:ee,value:Gk(M)}],network:t.network});if(v.feeQuote&&v.feeOptions){w(v.feeOptions),I(v.feeQuote),console.log("feeOptions",v);return}L(!0),console.log("tx sponsored")},X=async(ee,M)=>{var v;try{x(void 0),p(!0);const _=await Re.sendTransaction({transactions:[{to:ee,value:Gk(M)}],network:(v=t.network)==null?void 0:v.id,transactionsFeeOption:E,transactionsFeeQuote:N});Wu(_)?d(_.data.txHash):x(_.data.error),p(!1)}catch(_){console.error(_),p(!1)}finally{I(void 0),w(void 0),P(void 0),L(!1)}};return $.jsxs(G,{children:[$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Native token balance: ",eY(e||0)," ",n]}),$.jsx(Ct,{marginLeft:"2",size:"xs",label:"Fetch",onClick:U}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"sendNativeTokenTo",type:"text",onChange:ee=>{l(ee.target.value)},value:a,placeholder:"To address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"sendNativeTokenAmount",type:"text",onChange:ee=>{f(ee.target.value)},value:c,placeholder:"Amount",required:!0,"data-id":"nativeTokenSendAmount"})}),m&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",m]}),$.jsx(N1,{feeOptions:b,onSelected:P}),j&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:a===""&&c==="",onClick:()=>K(a,c)}),$.jsx(Ct,{marginTop:"5",label:"Send native token",disabled:a===""&&c==="",onClick:()=>X(a,c)})]}),u&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),$.jsx("br",{}),$.jsx("a",{href:`${s}tx/${u}`,target:"_blank",rel:"noopener noreferrer",children:u})]})]})}function qre(){const[t,e]=y.useState(),[r,n]=y.useState(),[i,s]=y.useState(!0),[o,a]=y.useState(),l=async c=>{s(!0),e(void 0);try{await Re.dropSession({sessionId:c}),e(await Re.listSessions())}catch(f){a(f.message),e(await Re.listSessions())}s(!1)};return y.useEffect(()=>{Promise.all([Re.listSessions(),Re.getSessionId()]).then(([c,f])=>{e(c),n(f),s(!1)}).catch(c=>{a(c.message),s(!1)})},[]),$.jsxs(G,{children:[$.jsxs(G,{marginBottom:"5",children:[$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your open sessions:"})}),t&&$.jsx($.Fragment,{children:t.map(c=>$.jsx(G,{children:$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"normal",children:[c.friendlyName,!c.isThis&&$.jsx("a",{style:{marginLeft:"7px",textDecoration:"underline",cursor:"pointer"},onClick:()=>l(c.id),children:"x"}),c.isThis&&$.jsx($.Fragment,{children:" (current)"})]})},c.id))}),i&&$.jsx(_n,{})]}),o&&$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading sessions: ",o]})]})}function Hre(t){const[e,r]=y.useState(""),[n,i]=y.useState(),s=async()=>{var a;const o=await Re.signMessage({message:e,network:(a=t.network)==null?void 0:a.id});i(o.data.signature)};return $.jsxs(G,{children:[$.jsx(Ir,{name:"signMessageText",type:"text",onChange:o=>{r(o.target.value),n!=""&&i("")},value:e,placeholder:"Enter a message to sign",required:!0,"data-id":"signMessageInput"}),$.jsx(Ct,{marginTop:"5",label:"Sign message",disabled:e==="",onClick:()=>s()}),n&&n!==""&&$.jsxs(G,{flexDirection:"column",marginTop:"5",children:[$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Signature for ",e,":"]}),$.jsx(G,{children:$.jsx(me,{as:"p",wordBreak:"break-word",children:n})})]})]})}function Wre(t){const[e,r]=y.useState(""),[n,i]=y.useState(""),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(),[u,d]=y.useState(!1),[h,p]=y.useState(),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(!1),j=async()=>{const U=await M1({transactions:[pT({to:e,abi:n,func:s,args:JSON.parse(a),value:"0"})],network:t.network});if(U.feeQuote&&U.feeOptions){x(U.feeOptions),P(U.feeQuote),console.log("feeOptions",U);return}I(!0),console.log("tx sponsored")},L=async()=>{var U;try{p(void 0),d(!0);const K=await Re.callContract({network:(U=t.network)==null?void 0:U.id,to:e,abi:n,func:s,args:JSON.parse(a),value:0,transactionsFeeOption:b,transactionsFeeQuote:E});Wu(K)?f(K.data.txHash):p(K.data.error),d(!1)}catch(K){console.error(K),d(!1)}};return $.jsxs(G,{children:[$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractAddress",type:"text",onChange:U=>{r(U.target.value)},value:e,placeholder:"Contract address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractAbi",type:"text",onChange:U=>{i(U.target.value)},value:n,placeholder:"Contract ABI or function ABI, e.g. [{...}] or [{...}, {...}] or transfer(address,uint256)",required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractMethod",type:"text",onChange:U=>{o(U.target.value)},value:s,placeholder:"Method name, e.g. transfer",required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractArgs",type:"text",onChange:U=>{l(U.target.value)},value:a,placeholder:'Method args, e.g. [0x..., 1000] or named { "to": "0x...", "amount": "1000" }',required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(N1,{feeOptions:m,onSelected:w}),N&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",h]}),u?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&n===""&&s===""&&a==="",onClick:()=>j()}),$.jsx(Ct,{marginTop:"5",label:"Call contract",disabled:e===""&&n===""&&s===""&&a==="",onClick:()=>L()})]}),c&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),$.jsx("br",{}),$.jsx("a",{href:`https://polygonscan.com/tx/${c}`,target:"_blank",rel:"noopener noreferrer",children:c})]})]})}const WA=[{label:"Custom Token",value:"Custom"},{label:"USDC Old",value:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"},{label:"USDC New",value:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"},{label:"DAI",value:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"}];function Gre(t){const[e,r]=y.useState(WA[0].value),[n,i]=y.useState(""),[s,o]=y.useState(!0),[a,l]=y.useState("---"),[c,f]=y.useState(""),[u,d]=y.useState(""),[h,p]=y.useState(""),[m,x]=y.useState(""),[b,w]=y.useState(!1),[E,P]=y.useState(0),[N,I]=y.useState(),[j,L]=y.useState(),[U,K]=y.useState(),[X,ee]=y.useState(!1);y.useEffect(()=>{M(n)},[n]);const M=async A=>{var D;if(!Iq(A)){l("---");return}l("...");const T=new __(`https://nodes.sequence.app/${(D=t.network)==null?void 0:D.name}`),O=new HG(A,["function balanceOf(address) view returns (uint256)","function decimals() view returns (uint8)","function symbol() view returns (string)"],T);try{const[S,g,R]=await Promise.all([O.balanceOf(Re.getAddress()),O.decimals(),O.symbol()]);P(g),l(`${Dx(S,g)} ${R}`)}catch{l("---")}},v=async()=>{const A=await M1({transactions:[Bb({token:n,to:c,value:pu(u,E).toString()})],network:t.network});if(A.feeQuote&&A.feeOptions){I(A.feeOptions),K(A.feeQuote),console.log("feeOptions",A);return}ee(!0),console.log("tx sponsored")},_=async()=>{var A;try{x(""),w(!0);const T=await Re.sendERC20({token:n,to:c,value:pu(u,E),network:(A=t.network)==null?void 0:A.id,transactionsFeeOption:j,transactionsFeeQuote:U});Wu(T)?p(T.data.txHash):x(T.data.error)}catch(T){console.error(T)}finally{w(!1)}},k=A=>{r(A),A==="Custom"?(i(""),o(!0)):(i(A),o(!1))};return $.jsxs(G,{children:[$.jsxs(G,{marginTop:"5",children:[$.jsx(u1,{name:"token",options:WA,value:e??"",onValueChange:A=>k(A)}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:n,disabled:!s,onChange:A=>i(A.target.value),placeholder:"Custom ERC20 Contract Address"})})]}),$.jsxs(G,{marginTop:"3",children:[$.jsxs(me,{variant:"normal",color:"text100",children:["Token Balance: ",a]}),$.jsx(Ct,{marginLeft:"2",size:"xs",label:"Fetch",onClick:()=>M(n)})]}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:c,onChange:A=>f(A.target.value),placeholder:"Destination Address"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:u,onChange:A=>d(A.target.value),placeholder:"Amount"})}),m&&$.jsx(G,{marginTop:"3",children:$.jsxs(me,{color:"error",children:["Error: ",m]})}),$.jsx(N1,{feeOptions:N,onSelected:L}),X&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),b?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:n===""&&c==="",onClick:()=>v()}),$.jsx(Ct,{marginTop:"5",label:"Send Token",onClick:_})]}),h&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),$.jsx("a",{href:`https://polygonscan.com/tx/${h}`,target:"_blank",rel:"noopener noreferrer",children:h})]})]})}const Kre="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function Yre(t){var a;const[e,r]=y.useState(""),[n,i]=y.useState("");y.useEffect(()=>{t.onChange(t.index,e,n)},[e,n]);const s={display:"flex",gap:"10px",marginBottom:"10px"},o={flex:1};return $.jsxs(G,{style:s,children:[$.jsx(G,{style:o,children:$.jsx(u1,{name:`sendERC1155TokenId${t.index}`,value:e,disabled:!t.options,onValueChange:l=>{r(l)},options:((a=t.options)==null?void 0:a.balances.map(l=>{var c;return{label:`${((c=l.tokenMetadata)==null?void 0:c.name)||"Unknown"} - ${l.balance}`,value:l.tokenID}}))||[],placeholder:"Select a token"})}),$.jsx(G,{style:o,children:$.jsx(Ir,{type:"text",value:e,onChange:l=>r(l.target.value),placeholder:"Token ID"})}),$.jsx(G,{style:o,children:$.jsx(Ir,{type:"text",value:n,onChange:l=>i(l.target.value),placeholder:"Amount"})}),$.jsx(G,{style:o,children:$.jsx(Ct,{label:"Remove",onClick:()=>t.removeTokenEntry(t.index)})})]})}function Qre(t){const[e,r]=y.useState(""),[n,i]=y.useState([]),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(""),[u,d]=y.useState(!1),[h,p]=y.useState(void 0),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(!1),j=()=>{i([...n,{tokenId:"",amount:""}])},L=async()=>{if(!e||!t.network)return;const M=t.network.name,v=new zT("https://"+M+"-indexer.sequence.app",Kre),_=e,k=await Re.getAddress(),A=!0;p(await v.getTokenBalances({contractAddress:_,accountAddress:k,includeMetadata:A}))};y.useEffect(()=>{L()},[e]);const U=(M,v)=>{const _=[...n];_[M]=v,i(_)},K=M=>{const v=[...n];v.splice(M,1),i(v)},X=async()=>{const M=await M1({transactions:[Ub({to:s,token:e,values:n.map(v=>({id:v.tokenId,amount:pu(v.amount,0)}))})],network:t.network});if(M.feeQuote&&M.feeOptions){x(M.feeOptions),P(M.feeQuote),console.log("feeOptions",M);return}I(!0),console.log("tx sponsored")},ee=async()=>{var M;try{f(""),d(!0);const v=await Re.sendERC1155({to:s,token:e,values:n.map(_=>({id:_.tokenId,amount:pu(_.amount,0)})),network:(M=t.network)==null?void 0:M.id,transactionsFeeOption:b,transactionsFeeQuote:E});Wu(v)?l(v.data.txHash):f(v.data.error)}catch(v){console.error(v)}finally{d(!1)}};return $.jsxs(G,{children:[$.jsx(G,{marginBottom:"5",children:$.jsx(Ir,{type:"text",value:e,onChange:M=>r(M.target.value),placeholder:"Token Contract Address"})}),$.jsx(G,{marginBottom:"5",children:$.jsx(Ct,{label:"Fetch metadata",onClick:()=>L()})}),n.map((M,v)=>$.jsx(G,{marginBottom:"3",children:$.jsx(Yre,{index:v,options:h,onChange:(_,k,A)=>U(_,{tokenId:k,amount:A}),removeTokenEntry:K})},v)),$.jsx(Ct,{label:"Add Token",onClick:j}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:s,onChange:M=>o(M.target.value),placeholder:"Destination Address"})}),c&&$.jsx(G,{marginTop:"3",children:$.jsxs(me,{color:"error",children:["Error: ",c]})}),$.jsx(N1,{feeOptions:m,onSelected:w}),N&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),u?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&s===""&&n.length!==0,onClick:()=>X()}),$.jsx(Ct,{marginTop:"5",label:"Send Tokens",onClick:ee})]}),a&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),$.jsx("a",{href:`https://polygonscan.com/tx/${a}`,target:"_blank",rel:"noopener noreferrer",children:a})]})]})}function Jre(t){const[e,r]=y.useState(),[n,i]=y.useState(),[s,o]=y.useState(!1),[a,l]=y.useState(),c=async()=>{var f,u;try{l(void 0),o(!0),console.log(t.walletAddress);const h=await(await fetch("https://dev-api.sequence.app/rpc/API/GenerateWaaSVerificationURL",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({walletAddress:t.walletAddress})})).json(),p=await Re.sessionAuthProof({nonce:h.nonce,network:(f=t.network)==null?void 0:f.name}),m=`https://demo-waas-wallet-link.pages.dev/?nonce=${h.nonce}&signature=${p.data.signature}&sessionId=${p.data.sessionId}&chainId=${(u=t.network)==null?void 0:u.name}`;r(m),i(h.nonce),o(!1)}catch(d){console.error(d),o(!1)}};return $.jsxs(G,{children:[a&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",a]}),s?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsx(G,{children:$.jsx(Ct,{marginTop:"5",label:"Generate EOA Link",disabled:n!==void 0,onClick:()=>c()})}),n&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Verification Link:"}),$.jsx("br",{}),$.jsx("a",{href:`${e}`,target:"_blank",rel:"noopener noreferrer",children:e})]})]})}const Fe={AMOY:80002,APE_CHAIN_TESTNET:33111,ARBITRUM:42161,ARBITRUM_GOERLI:421613,ARBITRUM_NOVA:42170,ARBITRUM_SEPOLIA:421614,AVALANCHE:43114,AVALANCHE_TESTNET:43113,BASE:8453,BASE_GOERLI:84531,BASE_SEPOLIA:84532,B3_SEPOLIA:1993,BLAST:81457,BLAST_SEPOLIA:168587773,BORNE_TESTNET:94984,BSC:56,BSC_TESTNET:97,FANTOM:250,FANTOM_TESTNET:4002,GNOSIS:100,GOERLI:5,HOMEVERSE:19011,HOMEVERSE_TESTNET:40875,IMMUTABLE_ZKEVM:13371,IMMUTABLE_ZKEVM_TESTNET:13473,KOVAN:42,MAINNET:1,OPTIMISM:10,OPTIMISM_SEPOLIA:11155420,OPTIMISM_TESTNET:69,POLYGON:137,POLYGON_MUMBAI:80001,POLYGON_ZKEVM:1101,RINKEBY:4,ROPSTEN:3,SEPOLIA:11155111,ASTAR_ZKEVM:3776,ASTAR_ZKYOTO:6038361,XAI:660279,XAI_SEPOLIA:37714555429,XR_SEPOLIA:2730},Xre={[Fe.MAINNET]:"https://assets.sequence.info/images/networks/small/1.webp",[Fe.ROPSTEN]:"https://assets.sequence.info/images/networks/small/3.webp",[Fe.GOERLI]:"https://assets.sequence.info/images/networks/small/5.webp",[Fe.KOVAN]:"https://assets.sequence.info/images/networks/small/42.webp",[Fe.OPTIMISM]:"https://assets.sequence.info/images/networks/small/10.webp",[Fe.OPTIMISM_TESTNET]:"https://assets.sequence.info/images/networks/small/69.webp",[Fe.OPTIMISM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155420.webp",[Fe.POLYGON]:"https://assets.sequence.info/images/networks/small/137.webp",[Fe.POLYGON_MUMBAI]:"https://assets.sequence.info/images/networks/small/80001.webp",[Fe.POLYGON_ZKEVM]:"https://assets.sequence.info/images/networks/small/1101.webp",[Fe.APE_CHAIN_TESTNET]:"https://assets.sequence.info/images/networks/small/33111.webp",[Fe.ARBITRUM]:"https://assets.sequence.info/images/networks/small/42161.webp",[Fe.ARBITRUM_NOVA]:"https://assets.sequence.info/images/networks/small/42170.webp",[Fe.ARBITRUM_GOERLI]:"https://assets.sequence.info/images/networks/small/421613.webp",[Fe.ARBITRUM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/421614.webp",[Fe.GNOSIS]:"https://assets.sequence.info/images/networks/small/100.webp",[Fe.BSC]:"https://assets.sequence.info/images/networks/small/56.webp",[Fe.BSC_TESTNET]:"https://assets.sequence.info/images/networks/small/97.webp",[Fe.FANTOM]:"https://assets.sequence.info/images/networks/small/250.webp",[Fe.FANTOM_TESTNET]:"https://assets.sequence.info/images/networks/small/4002.webp",[Fe.AVALANCHE]:"https://assets.sequence.info/images/networks/small/43114.webp",[Fe.AVALANCHE_TESTNET]:"https://assets.sequence.info/images/networks/small/43113.webp",[Fe.BASE]:"https://assets.sequence.info/images/networks/small/8453.webp",[Fe.BASE_SEPOLIA]:"https://assets.sequence.info/images/networks/small/84532.webp",[Fe.BORNE_TESTNET]:"https://assets.sequence.info/images/networks/small/94984.webp",[Fe.BLAST]:"https://assets.sequence.info/images/networks/small/81457.webp",[Fe.BLAST_SEPOLIA]:"https://assets.sequence.info/images/networks/small/168587773.webp",[Fe.SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155111.webp",[Fe.AMOY]:"https://assets.sequence.info/images/networks/small/80002.webp",[Fe.HOMEVERSE]:"https://assets.sequence.info/images/networks/small/19011.webp",[Fe.HOMEVERSE_TESTNET]:"https://assets.sequence.info/images/networks/small/40875.webp",[Fe.IMMUTABLE_ZKEVM]:"https://assets.sequence.info/images/networks/small/13371.webp",[Fe.IMMUTABLE_ZKEVM_TESTNET]:"https://assets.sequence.info/images/networks/small/13473.webp",[Fe.XAI]:"https://assets.sequence.info/images/networks/small/660279.webp",[Fe.XAI_SEPOLIA]:"https://assets.sequence.info/images/networks/small/37714555429.webp",[Fe.ASTAR_ZKEVM]:"https://assets.sequence.info/images/networks/small/3776.webp",[Fe.ASTAR_ZKYOTO]:"https://assets.sequence.info/images/networks/small/6038361.webp",[Fe.B3_SEPOLIA]:"https://assets.sequence.info/images/networks/small/1993.webp",[Fe.XR_SEPOLIA]:"https://assets.sequence.info/images/networks/small/2730.webp"};function Zre({onNetworkChange:t}){const[e,r]=y.useState(),[n,i]=y.useState([]);return y.useEffect(()=>{Re.networkList().then(s=>{i(s),r(s[0]),t(s[0])})},[]),n.length===0?$.jsx(G,{marginY:"5",children:$.jsx(_n,{})}):$.jsxs(G,{marginBottom:"4",children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Network to use with requests:"})}),$.jsx(G,{children:$.jsx(u1,{name:"chainId",labelLocation:"top",onValueChange:s=>{const o=n==null?void 0:n.find(a=>a.name===s);o&&(r(o),t(o))},value:e==null?void 0:e.name,options:[...n.map(s=>({label:$.jsxs(G,{alignItems:"center",gap:"2",children:[$.jsx(nz,{src:Xre[s.id],size:"sm"}),$.jsx(me,{children:s.name})]}),value:String(s.name)}))]})})]})}function GT(t){var e;if(t.type===cr.Email)return $.jsxs(me,{variant:"normal",color:"text100",children:["(",t.email,")"]});if(t.type===cr.Guest)return $.jsx(me,{variant:"normal",color:"text100",children:"Guest account"});if(t.type===cr.PlayFab)return $.jsxs(me,{variant:"normal",color:"text100",children:["(",t.email,")"]});if(t.type===cr.OIDC&&(e=t.issuer)!=null&&e.includes("cognito-idp"))return $.jsxs(me,{variant:"normal",color:"text100",children:["Email v1 (",t.email,")"]});if(t.type===cr.Stytch)return $.jsxs($.Fragment,{children:["Stytch account (",t.email,")"]});if(t.issuer==="https://oidc-wrapper.sequence.info")return $.jsxs($.Fragment,{children:["WRAPPED Stytch account (",t.email]});switch(t.issuer){case"https://accounts.google.com":return $.jsxs(G,{gap:"2",marginTop:"2",children:[$.jsx("img",{width:24,src:"data:image/png;base64,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"}),$.jsxs(me,{variant:"normal",color:"text100",children:["Google (",t.email,")"]})]});case"https://appleid.apple.com":return $.jsxs(G,{gap:"2",children:[$.jsx("img",{width:24,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABMlJREFUaEPVmV1oXEUUx89/Ete6SUykWiv4QcRYymISc2fWdCPUVUQUpIqKPggaEa1Wqj7UPokg+hJfagM+iMX2QS0RjQSFIkLpQ2Oyd+7GtaTiB4rgB8ZqNKlJupvco6MbCHH33tnNzSaZ1zn3f/6/O3PnzMwFbfCGDe6f1gxgfHw8Njs7exMRXd/c3Hygra3tXDUvs+YAx48f39TU1LSPiJ4koq1F0y1Syj/XPYDWuouIjhJR2xKzc47jxAHwugZwXbcHwEdE1LzUKIBhx3F6qjFvnqnJFMpkMluFEGNLpsxSv3ullP3rGkBrbd78HctNMvNkoVC4JpVK/b5uATKZjBJCZEoZBPC44zivV2u+JlPI87x+Zn6qhMnDUsrelZivCYDW+nMium6pUWZ+U0r5KAB/IwCcIaLNxigz/yGEeNZxnMMrNb74/IpXoZGRkUvr6+vnyhUirfXbRDTDzCfi8fhgIpE4a5KPjo5uFkJcKf5rv3V2dn5fTS2oGEBrfRkRPUREdzFzJ4Dzi2/3VwAnieiDWCw21N7ePrls2sB13R11dXW7mPn2EtPqLAAN4Eh9ff27HR0df9mMkjWA2QI0NjY+T0RPA2gIEmfmcwCOEdHHzPyjECLFzPcS0dU2pojoDDPvVkq9FxZvBWAKERENCiG6wwQj7u+XUu4N0gwFGBsba1lYWBglomsjNmcr94KU8sVywYEAzCyy2eyHxTlrmzCyOGbOA9gnpTxYFYDrug8AeCcyRxUIMfNPRHS3UqpkFQ9dRgcGBupaW1tPAdheQd6oQqd939+RTCbHwwTLTqFsNnuL7/ufhAmsUv8eKeVrNtplAVzX7TPzz0YkyhhmNgWtTUpZsNEtC6C1Nvv3ThuRKGOY+RWl1HO2mkEjMAmgxVYoqjgA9ziO876tXkkAc2MwMzMzByC0Ttgmso1j5hvCVp6lWiUNFvc7ZhmreWPmLqWUmb5WrSRALpfbUigUfrFSiDiImW9VSlmvfiUBhoeHL4jFYjMRe7OSY+b9Sqk+q+CgWwnXdScAXGIrFFUcM3+qlErZ6pX9SD3PO8nM1kK2CW3ifN/vSSaTwzaxQXXggNn724isQsyp6enpZDqdngvTDgK4j4gGwgRWsf+Q4ziPhR38ywIUzwETRHTeKpoMlAZwdGpqqjdoJAILVSaTOSaEuG2tAExeZv4GwDNSSnO7978WCOB53p3/FJahtQQwuX3fn2hoaLgikUjkl3sJO5HB87wviGjbGkO8JKU0FwqVjYCJ1lqbQ/WrawgwPz8/39rd3f1DVQDFqvwVEV2+RhBvSSkfLJfbarfped7D5j6z1gDmUE9E25VS364IwNxOeJ53gohurCUEgD7HcfYH5bQaASPguu42AJ8R0aYaQXydz+c7UqnUbCQARYhHAByqAcAcM++0OdhYj8Ci6YAfFpFwMTMD6JVSHrERrBjAfA9a64MA9lgkWCCin33fjwkhtljG75ZSvmER+29IxQCLwlrrJ5j5ZQAXLUt2GoDZBA5OTU2dTqfT86Y/l8s15PP5nQDuN1fzRHThsue+NL+iKjmNrQigWOQuJiJzbX4VgO8AjHZ1deXC3l6xttxslkjz35iZc/F4fKjUViFMq+oRCBOuVf+GB/gb9M3GQJMHYpQAAAAASUVORK5CYII="}),$.jsxs(me,{variant:"normal",color:"text100",children:["Apple (",t.email,")"]})]});default:return"Unknown"}}function ene(){var ee;const t=P8(),[e,r]=y.useState(),[n,i]=y.useState(),[s,o]=y.useState(!0),[a,l]=y.useState(),[c,f]=y.useState(""),u=y.useRef(null),d=(ee=u.current)==null?void 0:ee.validity.valid,[h,p]=y.useState(!1),[m,x]=y.useState([]),[b,w]=y.useState(!0),{inProgress:E,loading:P,initiateAuth:N,sendChallengeAnswer:I}=VT({sessionName:wo(),onSuccess:async({wallet:M})=>{console.log(`Wallet address: ${M}`)},linkAccount:!0}),j=async M=>{o(!0),i(void 0);try{await Re.removeAccount(M);const v=await Re.listAccounts();i(v.accounts)}catch(v){l(v.message);const _=await Re.listAccounts();i(_.accounts)}o(!1)},L=async M=>{const v=await Re.initAuth({idToken:M.credential});try{const _=await Re.linkAccount(v);i(k=>[...k||[],_.account])}catch(_){yh(_)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},U="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":"/"),K=async M=>{const v=await Re.initAuth({idToken:M.authorization.id_token});try{const _=await Re.linkAccount(v);i(k=>[...k||[],_.account])}catch(_){yh(_)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},X=K8({flow:"implicit",onSuccess:M=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:M.access_token,CreateAccount:!0,TitleId:"8F854"},async(v,_)=>{if(v)try{const k=await Re.initAuth({playFabTitleId:"8F854",playFabSessionTicket:v.data.SessionTicket}),A=await Re.linkAccount(k);console.log("playfab account",JSON.stringify(A.account,null,2)),i(T=>[...T||[],A.account])}catch(k){console.error(k),yh(k)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}else _&&console.log("Error: "+JSON.stringify(_))})}});return y.useEffect(()=>{Re.listAccounts().then(M=>{i(M.accounts),M.currentAccountId&&r(M.accounts.find(v=>v.id===M.currentAccountId)),o(!1)}).catch(M=>{l(M.message),o(!1)})},[E]),$.jsxs(G,{children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{marginBottom:"5",gap:"4",flexDirection:"column",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your connected (linked) accounts"}),n&&$.jsx($.Fragment,{children:n.map(M=>$.jsxs(G,{flexDirection:"row",alignItems:"center",gap:"2",children:[$.jsx(me,{variant:"normal",color:"text100",children:GT(M)}),M.id!==(e==null?void 0:e.id)&&$.jsx(Ct,{size:"xs",label:"Remove",onClick:()=>j(M.id)}),M.id===(e==null?void 0:e.id)&&$.jsx(G,{children:$.jsx(me,{variant:"small",color:"text100",children:"(Account you logged in with)"})})]},M.id))}),s&&$.jsx(_n,{})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{flexDirection:"column",gap:"2",width:"fit",children:[$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",marginBottom:"5",children:"Connect (link) another login method"}),$.jsx(G8,{onSuccess:L,shape:"circle",width:230}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsx(Q8,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:U,usePopup:!0},onError:M=>console.error(M),onSuccess:K,uiType:"dark"}),$.jsxs($.Fragment,{children:[$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsx(G,{marginTop:"2",children:$.jsx(G,{children:$.jsx(Ct,{label:"Login with Google (through Playfab)",onClick:X})})})]}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsxs(G,{marginTop:"2",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Email"}),$.jsx(G,{marginTop:"4",children:$.jsx(i5,{label:"Use v2 email login",disabled:!0,checked:b,onChange:()=>w(!b)})})]}),I?$.jsxs(G,{flexDirection:"column",children:[$.jsx(G,{marginTop:"3",children:$.jsx(me,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),$.jsx(G,{marginTop:"4",children:$.jsx(zF,{value:m,digits:6,onChange:x})}),$.jsx(G,{gap:"2",marginY:"4",children:P?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:m.includes(""),label:"Verify",onClick:()=>I(m.join("")),"data-id":"verifyButton"})})]}):$.jsxs(G,{marginBottom:"4",children:[$.jsxs(me,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",$.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),$.jsxs(G,{marginTop:"6",children:[$.jsx(Ir,{name:"email",type:"email",onChange:M=>{f(M.target.value)},ref:u,onKeyDown:M=>{c&&M.key==="Enter"&&N(c)},onBlur:()=>p(!!c&&!d),value:c,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),h&&$.jsx(me,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:P?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:!d,label:"Continue",onClick:()=>N(c),"data-id":"continueButton"})})]})]}),a&&$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading accounts: ",a]})]})}function tne(){const[t,e]=y.useState(),[r,n]=y.useState(),[i,s]=y.useState([]),[o,a]=y.useState(!1),[l,c]=y.useState(!1),[f,u]=y.useState(),[d,h]=y.useState();return y.useEffect(()=>{Re.getAddress().then(p=>{e(p)}).catch(p=>{n(p.message)}),Re.listAccounts().then(p=>{p.currentAccountId&&h(p.accounts.find(m=>m.id===p.currentAccountId))})},[]),y.useEffect(()=>{Re.isSignedIn().then(p=>{p||Ri.navigate("/login")})},[]),y.useEffect(()=>{const p=i.join("");p.length===6&&(c(!0),Re.finishValidateSession(p))},[i]),y.useEffect(()=>{const p=Re.onValidationRequired(()=>{a(!0),Re.waitForSessionValid(6e5,4e3).then(m=>{console.log("isValid",m),s([]),a(!1),c(!1)})});return()=>{p.then(m=>m())}},[]),$.jsxs($.Fragment,{children:[$.jsx(Hg,{children:o&&$.jsx(i8,{children:$.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"1.2em",height:"50vh"},children:$.jsxs(G,{flexDirection:"column",alignItems:"center",children:[$.jsx(me,{marginBottom:"7",children:"Please enter the session verification code that was sent to your email"}),$.jsx(J8,{value:i,digits:6,onChange:s}),$.jsx(G,{marginTop:"5",children:l&&$.jsx(_n,{})})]})})})}),$.jsxs(G,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[$.jsx(G,{marginBottom:"10",children:$.jsx(X8,{})}),$.jsxs(G,{marginBottom:"5",flexDirection:"row",children:[d&&$.jsxs(G,{flexDirection:"column",gap:"2",children:[$.jsxs(me,{marginTop:"1",variant:"normal",color:"text100",children:[d.type===cr.Guest?"Guest account":`Logged in with account type ${d.type}`," "]}),d.type!==cr.Guest&>(d)]}),$.jsx(Ct,{marginLeft:"auto",label:"Log out",size:"xs",onClick:async()=>{try{await Re.dropSession({strict:!1})}catch(p){console.warn(`Could not drop session: ${p.message}`)}$V(),Ri.navigate("/login")}})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your wallet address:"})}),$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"normal",children:t?$.jsx(G,{children:$.jsx(me,{children:t})}):$.jsx(_n,{})})}),$.jsx(G,{children:r&&$.jsxs(me,{children:["Error fetching wallet address: ",r]})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(qre,{}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{marginBottom:"5",children:$.jsx(Zre,{onNetworkChange:u})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(il,{marginY:"3",label:"Send native token transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Vre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Send ERC20 transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Gre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Send ERC1155 transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Qre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Sign a message",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Hre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Call contracts",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Wre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"EOA Link",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Jre,{network:f,walletAddress:t})]}),$.jsx(ene,{})]})]})}function rne(t,e,r){return e=JT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bm(t,e){return sne(t)||ine(t,e)||KT(t,e)||nne()}function nne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ine(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,o,a=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function sne(t){if(Array.isArray(t))return t}function one(t){return cne(t)||lne(t)||KT(t)||ane()}function ane(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KT(t,e){if(t){if(typeof t=="string")return wm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wm(t,e)}}function lne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function cne(t){if(Array.isArray(t))return wm(t)}function wm(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--D){var S=this.tryEntries[D],g=S.completion;if(S.tryLoc==="root")return O("end");if(S.tryLoc<=this.prev){var R=n.call(S,"catchLoc"),F=n.call(S,"finallyLoc");if(R&&F){if(this.prev=0;--O){var D=this.tryEntries[O];if(D.tryLoc<=this.prev&&n.call(D,"finallyLoc")&&this.prev=0;--T){var O=this.tryEntries[T];if(O.finallyLoc===A)return this.complete(O.completion,O.afterLoc),M(O),x}},catch:function(A){for(var T=this.tryEntries.length-1;T>=0;--T){var O=this.tryEntries[T];if(O.tryLoc===A){var D=O.completion;if(D.type==="throw"){var S=D.arg;M(O)}return S}}throw new Error("illegal catch attempt")},delegateYield:function(A,T,O){return this.delegate={iterator:_(A),resultName:T,nextLoc:O},this.method==="next"&&(this.arg=t),x}},e}function $i(t){"@babel/helpers - typeof";return $i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$i(t)}function On(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function GA(t,e){for(var r=0;r Demo Waas App - +