(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[966],{9072:function(e,t,a){Promise.resolve().then(a.bind(a,4665))},4665:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return l}});var n=a(7437),s=a(2265),i=a(605);function l(){let[e,t]=(0,s.useState)(""),[a,l]=(0,s.useState)(""),[r,c]=(0,s.useState)(""),[u,o]=(0,s.useState)("storeshifted"),[d,h]=(0,s.useState)(""),[p,g]=(0,s.useState)(!1);async function f(t){t.preventDefault(),g(!0),h("");try{let t=await fetch("/api/auth/signup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,email:a,password:r,slug:u})}),n=await t.json();if(!t.ok)throw Error(n.error||"Sign up failed");await (0,i.signIn)("credentials",{email:a,password:r,redirect:!0,callbackUrl:"/connect"})}catch(e){h(e.message||"Sign up failed.")}finally{g(!1)}}return(0,n.jsx)("main",{className:"auth-page",children:(0,n.jsx)("section",{className:"section",children:(0,n.jsxs)("div",{className:"container auth-page__inner",children:[(0,n.jsx)("h1",{className:"page-title",children:"Create Account"}),(0,n.jsxs)("form",{className:"auth-card",onSubmit:f,children:[(0,n.jsx)("input",{type:"text",placeholder:"Name",value:e,onChange:e=>t(e.target.value)}),(0,n.jsx)("input",{type:"email",placeholder:"Email",value:a,onChange:e=>l(e.target.value)}),(0,n.jsx)("input",{type:"password",placeholder:"Password",value:r,onChange:e=>c(e.target.value)}),(0,n.jsx)("input",{type:"text",placeholder:"Store slug (e.g. storeshifted)",value:u,onChange:e=>o(e.target.value)}),(0,n.jsx)("button",{className:"btn",type:"submit",disabled:p,children:p?"Creating...":"Create account"}),d?(0,n.jsx)("div",{className:"connect-message",children:d}):null]}),(0,n.jsxs)("div",{className:"connect-muted",children:["Already have an account? ",(0,n.jsx)("a",{href:"/login",children:"Sign in"})]})]})})})}}},function(e){e.O(0,[605,971,117,744],function(){return e(e.s=9072)}),_N_E=e.O()}]);