(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3781],{4766:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>A});var a=s(95155),r=s(12115),l=s(20063),i=s(52619),h=s.n(i),n=s(3998),d=s(65142),o=s(55010),c=s(76444),m=s(18332),x=s(71871),p=s(23664),u=s(69141),w=s(99708),N=s(70532),j=s(57828),y=s(36489),b=s(58261),g=s(76343),f=s(37861),v=s(66091),k=s(67734);function A(){let e=(0,l.useRouter)(),t=(0,k.Ps)(),s=(0,k.jA)(),[i,A]=(0,r.useState)(!0),[C,E]=(0,r.useState)({businessName:"",ownerName:"",email:"",phone:"",password:"",confirmPassword:""}),[S,F]=(0,r.useState)(!1),[M,P]=(0,r.useState)(!1),[_,J]=(0,r.useState)(!1),[O,q]=(0,r.useState)(!1),[T,R]=(0,r.useState)(""),[z,W]=(0,r.useState)("");(0,r.useEffect)(()=>{A(!1)},[t,s]),(0,r.useEffect)(()=>{i||!t||s||e.push("/auth/business/signup/phone")},[t,s,i,e]);let D=e=>{let{name:t,value:s}=e.target;E(e=>({...e,[t]:s}))},I=async t=>{if(t.preventDefault(),R(""),W(""),(()=>{if(!C.businessName.trim())return R("نام کسب‌وکار الزامی است"),!1;if(!C.ownerName.trim())return R("نام مالک الزامی است"),!1;if(!C.email.trim())return R("ایمیل الزامی است"),!1;if(!C.email.includes("@"))return R("ایمیل معتبر نیست"),!1;if(!C.phone.trim())return R("شماره تماس الزامی است"),!1;let e=(0,g.Oj)(C.password);return e.isValid?C.password===C.confirmPassword||(R("رمز عبور و تأیید آن مطابقت ندارند"),!1):(R(e.errors[0]),!1)})()){q(!0);try{let t=await fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:C.ownerName,businessName:C.businessName,email:C.email,phone:C.phone,password:C.password,role:"CAFE_OWNER"})}),s=await t.json();if(!t.ok)if(400===t.status)throw Error(s.message||"اطلاعات وارد شده نامعتبر است");else if(409===t.status)throw Error("کاربری با این ایمیل قبلاً ثبت نام کرده است");else throw Error("خطای سرور. لطفاً دوباره تلاش کنید");W("ثبت نام با موفقیت انجام شد! در حال ورود..."),await (0,b.SP)(C.email,C.password,"CAFE_OWNER",y.signIn,e)}catch(e){e instanceof Error?R(e.message):R("خطای غیرمنتظره‌ای رخ داد. لطفاً دوباره تلاش کنید")}finally{q(!1)}}};return(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-emerald-900 via-teal-900 to-cyan-900 p-4",children:(0,a.jsxs)("div",{className:"max-w-md w-full space-y-8 bg-white/10 backdrop-blur-lg rounded-xl border border-white/20 p-8",children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"flex justify-center mb-4",children:(0,a.jsx)("div",{className:"p-3 bg-gradient-to-r from-emerald-600 to-teal-600 rounded-full",children:(0,a.jsx)(x.A,{className:"h-8 w-8 text-white"})})}),(0,a.jsx)("h2",{className:"text-3xl font-bold text-white mb-2",children:"ثبت نام کسب‌وکار"}),(0,a.jsx)("p",{className:"text-gray-300",children:"کافه گیمینگ خود را در پلیمو ثبت کنید"})]}),T&&(0,a.jsx)(m.Fc,{className:"border-red-500/50 bg-red-500/10 text-red-200",children:(0,a.jsx)(m.TN,{children:T})}),z&&(0,a.jsx)(m.Fc,{className:"border-green-500/50 bg-green-500/10 text-green-200",children:(0,a.jsx)(m.TN,{children:z})}),(0,a.jsxs)("form",{onSubmit:I,className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.J,{htmlFor:"businessName",className:"text-white",children:"نام کسب‌وکار"}),(0,a.jsxs)("div",{className:"relative mt-1",children:[(0,a.jsx)(d.p,{id:"businessName",name:"businessName",type:"text",required:!0,value:C.businessName,onChange:D,className:"bg-white/10 border-white/30 text-white placeholder:text-gray-400 pr-10",placeholder:"نام کافه گیمینگ خود را وارد کنید"}),(0,a.jsx)(x.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.J,{htmlFor:"ownerName",className:"text-white",children:"نام مالک"}),(0,a.jsxs)("div",{className:"relative mt-1",children:[(0,a.jsx)(d.p,{id:"ownerName",name:"ownerName",type:"text",required:!0,value:C.ownerName,onChange:D,className:"bg-white/10 border-white/30 text-white placeholder:text-gray-400 pr-10",placeholder:"نام و نام خانوادگی مالک"}),(0,a.jsx)(x.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.J,{htmlFor:"email",className:"text-white",children:"ایمیل کسب‌وکار"}),(0,a.jsxs)("div",{className:"relative mt-1",children:[(0,a.jsx)(d.p,{id:"email",name:"email",type:"email",required:!0,value:C.email,onChange:D,className:"bg-white/10 border-white/30 text-white placeholder:text-gray-400 pr-10",placeholder:"ایمیل کسب‌وکار خود را وارد کنید"}),(0,a.jsx)(p.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.J,{htmlFor:"phone",className:"text-white",children:"شماره تماس"}),(0,a.jsxs)("div",{className:"relative mt-1",children:[(0,a.jsx)(d.p,{id:"phone",name:"phone",type:"tel",required:!0,value:C.phone,onChange:D,className:"bg-white/10 border-white/30 text-white placeholder:text-gray-400 pr-10",placeholder:"شماره تماس کسب‌وکار"}),(0,a.jsx)(u.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.J,{htmlFor:"password",className:"text-white",children:"رمز عبور"}),(0,a.jsxs)("div",{className:"relative mt-1",children:[(0,a.jsx)(o.y,{id:"password",name:"password",type:S?"text":"password",required:!0,value:C.password,onChange:D,onFocus:()=>J(!0),className:"bg-white/10 border-white/30 text-white placeholder:text-gray-400 pr-10 pl-10",placeholder:"رمز عبور امن وارد کنید"}),(0,a.jsx)(w.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,a.jsx)("button",{type:"button",onClick:()=>F(!S),className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-white",children:S?(0,a.jsx)(N.A,{className:"h-4 w-4"}):(0,a.jsx)(j.A,{className:"h-4 w-4"})})]}),_&&(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)(f.u,{password:C.password})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.J,{htmlFor:"confirmPassword",className:"text-white",children:"تأیید رمز عبور"}),(0,a.jsxs)("div",{className:"relative mt-1",children:[(0,a.jsx)(o.y,{id:"confirmPassword",name:"confirmPassword",type:M?"text":"password",required:!0,value:C.confirmPassword,onChange:D,className:"bg-white/10 border-white/30 text-white placeholder:text-gray-400 pr-10 pl-10",placeholder:"رمز عبور را مجدداً وارد کنید"}),(0,a.jsx)(w.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,a.jsx)("button",{type:"button",onClick:()=>P(!M),className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-white",children:M?(0,a.jsx)(N.A,{className:"h-4 w-4"}):(0,a.jsx)(j.A,{className:"h-4 w-4"})})]})]}),(0,a.jsx)(n.$,{type:"submit",disabled:O,className:"w-full bg-gradient-to-r from-emerald-600 to-teal-600 hover:from-emerald-700 hover:to-teal-700 text-white font-medium py-3",children:O?"در حال ثبت نام...":"ثبت نام کسب‌وکار"}),(0,a.jsxs)("div",{className:"text-center text-sm space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{className:"text-gray-300",children:["قبلاً ثبت نام کرده‌اید؟"," "]}),(0,a.jsx)(h(),{href:(0,v.aC)(),className:"text-emerald-400 font-medium hover:text-emerald-300 hover:underline",children:"ورود کسب‌وکار"})]}),!t&&(0,a.jsx)("div",{children:(0,a.jsx)(h(),{href:"/auth/business/signup/phone",className:"text-gray-400 hover:text-gray-300 hover:underline",children:"ثبت نام با شماره موبایل"})})]})]}),(0,a.jsx)("div",{className:"text-center mt-6",children:(0,a.jsx)(h(),{href:"/",className:"text-sm text-gray-400 hover:text-gray-300 hover:underline",children:"بازگشت به صفحه اصلی"})})]})})}},69141:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(71847).A)("phone",[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]])},69479:(e,t,s)=>{Promise.resolve().then(s.bind(s,4766))},71871:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(71847).A)("building",[["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3",key:"cabbwy"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]])}},e=>{e.O(0,[4909,7055,6489,8720,8924,4623,7358],()=>e(e.s=69479)),_N_E=e.O()}]);