import{g as e,s as l,p as u}from"./authShared.js";import"./index.js";import"./config.js";async function g(){const s=e("signup"),i=e("email"),n=e("password"),r=e("status");if(!s||!i||!n){console.error("Signup form not found");return}s.addEventListener("submit",async a=>{a.preventDefault(),r&&(r.textContent="Creating account...",r.style.cssText=`
        margin-top: 10px;
        font-size: 12px;
        padding: 8px 10px;
        border-radius: 6px;
        background: rgba(55,149,189,.1);
        color: #3795BD;
        border: 1px solid rgba(55,149,189,.3);
        display: block;
      `);const p=i.value.trim(),c=n.value;try{const{data:o,error:t}=await l.auth.signUp({email:p,password:c});if(t){console.error("Sign-up error:",t),r&&(r.textContent=`Error: ${t.message}`,r.style.cssText=`
            margin-top: 10px;
            font-size: 12px;
            padding: 8px 10px;
            border-radius: 6px;
            background: rgba(239,68,68,.1);
            color: #ef4444;
            border: 1px solid rgba(239,68,68,.3);
            display: block;
          `);return}await u(o.session??null),o.session?(r&&(r.textContent="Account created successfully! Redirecting...",r.style.cssText=`
            margin-top: 10px;
            font-size: 12px;
            padding: 8px 10px;
            border-radius: 6px;
            background: rgba(55,149,189,.1);
            color: #3795BD;
            border: 1px solid rgba(55,149,189,.3);
            display: block;
          `),setTimeout(()=>{const d=chrome?.runtime?.getURL?chrome.runtime.getURL("quickGuide.html"):"quickGuide.html";window.location.replace(d)},1500)):r&&(r.textContent="Account created! Check your email to confirm your account.",r.style.cssText=`
            margin-top: 10px;
            font-size: 12px;
            padding: 8px 10px;
            border-radius: 6px;
            background: rgba(55,149,189,.1);
            color: #3795BD;
            border: 1px solid rgba(55,149,189,.3);
            display: block;
          `)}catch(o){console.error("Signup failed:",o),r&&(r.textContent="Signup failed. Please try again.",r.style.cssText=`
          margin-top: 10px;
          font-size: 12px;
          padding: 8px 10px;
          border-radius: 6px;
          background: rgba(239,68,68,.1);
          color: #ef4444;
          border: 1px solid rgba(239,68,68,.3);
          display: block;
        `)}})}g();
//# sourceMappingURL=signup.js.map
