1import{i as W,u as B,l as M,d as r,c5 as O,j as e,L as H,b5 as U}from"./index-qXefKMUT.js";import{S as k}from"./sparkles-BgG8stgS.js";import{A as S}from"./arrow-right-DqeAUMsQ.js";import{L as v}from"./loader-2-Cyww9U2p.js";import{M as D}from"./mail-DnaImg_F.js";const G="demoverse_my_handle";function le(){var y;const[L]=W(),n=((y=L.get("h"))==null?void 0:y.trim().toLowerCase())||"",p=B(),{user:s,signUp:A,signIn:F,signInWithGoogle:C}=M(),[m,h]=r.useState("pick"),[c,R]=r.useState(""),[u,I]=r.useState(""),[a,d]=r.useState(!1),[t,o]=r.useState(null),[f,g]=r.useState(!1),z=r.useMemo(()=>{if(typeof navigator>"u")return!1;const i=navigator.userAgent||"";return/Instagram|FBAN|FBAV|Twitter|Line\/|Snapchat|LinkedIn|WhatsApp|Pinterest|MicroMessenger|musical_ly|Bytedance|KAKAOTALK/i.test(i)},[]),x=r.useMemo(()=>t?t==="auth/email-already-in-use"?"That email is already signed up. Try signing in instead.":t==="auth/weak-password"?"Password is too short. Use at least 6 characters.":t==="auth/invalid-email"?"That email doesn't look right.":t==="auth/wrong-password"||t==="auth/user-not-found"?"Email or password is wrong.":t==="auth/popup-closed-by-user"?null:t==="auth/popup-blocked"?"Your browser blocked the Google popup. Allow popups for demoverse.ai, or use email + password below.":t==="auth/account-exists-with-different-credential"?"This email already has a password sign-in. Use email + password below â same email.":t==="auth/cancelled-popup-request"?null:t==="auth/network-request-failed"?"Network glitch. Check your connection and try again.":t==="email_mismatch"?"This email isn't the one that claimed @"+n+". Sign in with the email you used on the challenge.":t==="already_locked"?"@"+n+" is already locked to another account.":t==="handle_not_found"?"@"+n+" doesn't exist yet.":"Something went wrong. Try again.":null,[t,n]);r.useEffect(()=>{n&&(!s||!s.uid||!s.email||f||(g(!0),(async()=>{const i=await O(n,s.email,s.uid);if(!i.ok){o(i.error??"lock_failed"),g(!1);return}try{window.localStorage.setItem(G,n)}catch{}p(`/u/${encodeURIComponent(n)}`,{replace:!0})})()))},[s,n,f,p]);async function Y(){o(null),d(!0);try{await C()}catch(i){if(U(i)){d(!1);return}const l=i==null?void 0:i.code;o(l??"auth_failed"),d(!1)}}async function N(i){if(i.preventDefault(),!a){if(!c.trim()||!u.trim()){o("missing_fields");return}o(null),d(!0);try{try{await A(c.trim(),u)}catch(l){if(l.code==="auth/email-already-in-use")await F(c.trim(),u);else throw l}}catch(l){const b=l.code??"auth_failed";o(b),d(!1)}}}return n?e.jsx("div",{style:w,children:e.jsxs("div",{style:{maxWidth:380,width:"100%"},children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5",style:j,children:[e.jsx(k,{size:11,"aria-hidden":!0}),"Claim your taste"]}),e.jsxs("h1",{style:T,children:["Lock ",e.jsxs("em",{style:{fontStyle:"italic",color:"var(--ember)"},children:["@",n]})," for good."]}),e.jsx("p",{style:P,children:"Sign in to keep this profile across devices. Use the same email you submitted on the challenge."}),m==="pick"&&e.jsxs(e.Fragment,{children:[z&&e.jsxs("div",{style:Z,role:"alert",children:["Google sign-in doesn't work inside this app's browser. Tap the",e.jsx("strong",{children:" ⯠"})," menu and choose",e.jsx("strong",{children:' "Open in Chrome" '}),"(or Safari) â or use email + password below."]}),e.jsxs("button",{type:"button",onClick:Y,disabled:a,style:K,children:[a?e.jsx(v,{size:16,className:"animate-spin"}):e.jsx("span",{style:q,"aria-hidden":!0}),"Continue with Google"]}),e.jsxs("div",{style:V,children:[e.jsx("div",{style:E}),e.jsx("span",{children:"or"}),e.jsx("div",{style:E})]}),e.jsxs("button",{type:"button",onClick:()=>h("email"),disabled:a,style:$,children:[e.jsx(D,{size:15,"aria-hidden":!0}),"Use email + password"]})]}),m==="email"&&e.jsxs("form",{onSubmit:N,children:[e.jsx("input",{type:"email",required:!0,autoFocus:!0,autoComplete:"email",placeholder:"The email you used on the challenge",value:c,onChange:i=>R(i.target.value),style:_}),e.jsx("input",{type:"password",required:!0,autoComplete:"new-password",minLength:6,placeholder:"Pick a password (6+ characters)",value:u,onChange:i=>I(i.target.value),style:{..._,marginTop:8}}),e.jsxs("button",{type:"submit",disabled:a,style:J,children:[a?e.jsx(v,{size:16,className:"animate-spin"}):e.jsx(S,{size:14}
1),"Lock @",n]}),e.jsx("button",{type:"button",onClick:()=>{h("pick"),o(null)},disabled:a,style:Q,children:"â Use Google instead"})]}),x&&e.jsx("div",{style:X,role:"alert",children:x}),e.jsx("p",{style:ee,children:"Same email as the challenge. Different email won't lock this handle."}),e.jsx("div",{style:te,children:"demoverse"})]})}):e.jsx("div",{style:w,children:e.jsxs("div",{style:{maxWidth:380,textAlign:"center"},children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5",style:j,children:[e.jsx(k,{size:11,"aria-hidden":!0}),"No handle to claim"]}),e.jsx("h1",{style:T,children:"This link is incomplete."}),e.jsxs(H,{to:"/game",style:ie,children:["Make your own taste profile",e.jsx(S,{size:14})]})]})})}const w={flex:1,minHeight:0,background:"var(--cream)",fontFamily:"var(--font-body)",color:"var(--ink)",padding:24,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"},j={fontSize:11,fontWeight:500,color:"var(--ember)",background:"var(--ember-soft)",padding:"4px 11px",borderRadius:100,letterSpacing:"0.08em",textTransform:"uppercase",marginBottom:14},T={fontFamily:"var(--font-display)",fontSize:28,fontWeight:400,margin:0,lineHeight:1.15,letterSpacing:"-0.02em"},P={color:"var(--ink60)",fontSize:14,fontWeight:300,lineHeight:1.55,margin:"14px 0 22px"},K={width:"100%",background:"var(--white)",color:"var(--ink)",border:"1px solid var(--ink12)",borderRadius:12,padding:"13px 18px",fontSize:14,fontWeight:500,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:10,fontFamily:"var(--font-body)"},q={display:"inline-block",width:16,height:16,borderRadius:"50%",background:"conic-gradient(from -45deg, #EA4335 25%, #FBBC05 25% 50%, #34A853 50% 75%, #4285F4 75%)",WebkitMask:"radial-gradient(circle at center, transparent 4px, #000 5px)",mask:"radial-gradient(circle at center, transparent 4px, #000 5px)"},V={display:"flex",alignItems:"center",gap:10,fontSize:10,color:"var(--ink40)",fontWeight:500,letterSpacing:"0.1em",textTransform:"uppercase",margin:"14px 0"},E={flex:1,height:1,background:"var(--ink12)"},$={width:"100%",background:"transparent",color:"var(--ink)",border:"1px solid var(--ink12)",borderRadius:12,padding:"11px 18px",fontSize:13,fontWeight:500,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8,fontFamily:"var(--font-body)"},_={width:"100%",background:"var(--white)",border:"1px solid var(--ink12)",borderRadius:12,padding:"12px 14px",fontSize:14,color:"var(--ink)",fontFamily:"var(--font-body)",outline:"none"},J={width:"100%",background:"var(--ink)",color:"#fff",border:0,borderRadius:12,padding:"13px 18px",fontSize:14,fontWeight:500,marginTop:12,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8,fontFamily:"var(--font-body)"},Q={width:"100%",background:"transparent",color:"var(--ink60)",border:0,fontSize:12,fontWeight:400,marginTop:8,cursor:"pointer",fontFamily:"var(--font-body)"},X={background:"#FEF2F2",border:"1px solid #FCA5A5",borderRadius:10,padding:"10px 12px",fontSize:12,color:"#7F1D1D",marginTop:14,textAlign:"left"},Z={background:"#FFF7ED",border:"1px solid #FDBA74",borderRadius:10,padding:"10px 12px",fontSize:12,color:"#9A3412",marginBottom:12,textAlign:"left",lineHeight:1.5},ee={fontSize:11,color:"var(--ink40)",marginTop:16,lineHeight:1.4},te={marginTop:28,textAlign:"center",fontFamily:"var(--font-display)",fontStyle:"italic",color:"var(--ink40)",fontSize:14},ie={background:"var(--ink)",color:"#fff",padding:"12px 22px",borderRadius:12,fontSize:14,fontWeight:500,textDecoration:"none",fontFamily:"var(--font-body)",display:"inline-flex",alignItems:"center",gap:8,marginTop:20};export{G as MY_HANDLE_KEY,le as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.