(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[11],{5414:function(e,r,t){Promise.resolve().then(t.bind(t,5262))},5262:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return m}});var n=t(3827),a=t(4090),s=t(8792),o=t(7907),l=t(5754),i=t(7815),c=t(438),d=t(8998),u=t(8994);function m(){let e=(0,o.useRouter)(),[r,t]=(0,a.useState)(!1),[m,f]=(0,a.useState)(""),[p,h]=(0,a.useState)({firstName:"",lastName:"",email:"",companyName:"",password:"",confirmPassword:""}),x=e=>{h({...p,[e.target.id]:e.target.value}),f("")},g=async r=>{if(r.preventDefault(),f(""),p.password!==p.confirmPassword){f("As senhas n\xe3o coincidem");return}if(p.password.length<8){f("A senha deve ter pelo menos 8 caracteres");return}t(!0);try{var n,a;let r=await fetch("".concat("https://api.maxwhats.maxsystec.com.br","/v1/auth/register"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({firstName:p.firstName,lastName:p.lastName,email:p.email,password:p.password,companyName:p.companyName||void 0})}),t=await r.json();if(!r.ok)throw Error((null===(a=t.error)||void 0===a?void 0:a.message)||"Erro ao criar conta");(null===(n=t.data)||void 0===n?void 0:n.accessToken)&&(localStorage.setItem("accessToken",t.data.accessToken),localStorage.setItem("refreshToken",t.data.refreshToken),localStorage.setItem("user",JSON.stringify(t.data.user))),e.push("/dashboard")}catch(e){f(e.message||"Erro ao conectar com o servidor")}finally{t(!1)}};return(0,n.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 px-4",children:(0,n.jsxs)(i.Zb,{className:"w-full max-w-md",children:[(0,n.jsxs)(i.Ol,{className:"text-center",children:[(0,n.jsx)("div",{className:"flex justify-center mb-4",children:(0,n.jsx)(c.Z,{className:"h-12 w-12 text-green-600"})}),(0,n.jsx)(i.ll,{className:"text-2xl",children:"Criar Conta Gr\xe1tis"}),(0,n.jsx)(i.SZ,{children:"Comece a integrar WhatsApp em minutos"})]}),(0,n.jsxs)(i.aY,{children:[m&&(0,n.jsxs)("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md flex items-center gap-2 text-red-700 text-sm",children:[(0,n.jsx)(d.Z,{className:"h-4 w-4 flex-shrink-0"}),m]}),(0,n.jsxs)("form",{onSubmit:g,className:"space-y-4",children:[(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",htmlFor:"firstName",children:"Nome *"}),(0,n.jsx)("input",{id:"firstName",type:"text",placeholder:"Jo\xe3o",required:!0,value:p.firstName,onChange:x,className:"w-full mt-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-green-600"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",htmlFor:"lastName",children:"Sobrenome *"}),(0,n.jsx)("input",{id:"lastName",type:"text",placeholder:"Silva",required:!0,value:p.lastName,onChange:x,className:"w-full mt-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-green-600"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",htmlFor:"email",children:"E-mail *"}),(0,n.jsx)("input",{id:"email",type:"email",placeholder:"seu@email.com",required:!0,value:p.email,onChange:x,className:"w-full mt-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-green-600"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",htmlFor:"companyName",children:"Empresa (opcional)"}),(0,n.jsx)("input",{id:"companyName",type:"text",placeholder:"Minha Empresa LTDA",value:p.companyName,onChange:x,className:"w-full mt-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-green-600"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",htmlFor:"password",children:"Senha *"}),(0,n.jsx)("input",{id:"password",type:"password",placeholder:"M\xednimo 8 caracteres",required:!0,minLength:8,value:p.password,onChange:x,className:"w-full mt-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-green-600"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",htmlFor:"confirmPassword",children:"Confirmar Senha *"}),(0,n.jsx)("input",{id:"confirmPassword",type:"password",placeholder:"••••••••",required:!0,minLength:8,value:p.confirmPassword,onChange:x,className:"w-full mt-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-green-600"})]}),(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[(0,n.jsx)("input",{type:"checkbox",className:"mt-1 rounded",required:!0}),(0,n.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Eu aceito os"," ",(0,n.jsx)(s.default,{href:"/terms",className:"text-green-600 hover:underline",children:"Termos de Uso"})," ","e a"," ",(0,n.jsx)(s.default,{href:"/privacy",className:"text-green-600 hover:underline",children:"Pol\xedtica de Privacidade"})]})]}),(0,n.jsx)(l.z,{type:"submit",className:"w-full",disabled:r,children:r?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Criando conta..."]}):"Criar Conta"})]}),(0,n.jsxs)("div",{className:"mt-6 text-center text-sm",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"J\xe1 tem uma conta? "}),(0,n.jsx)(s.default,{href:"/login",className:"text-green-600 hover:underline",children:"Entrar"})]})]})]})})}},5754:function(e,r,t){"use strict";t.d(r,{z:function(){return c}});var n=t(3827),a=t(4090),s=t(6371),o=t(9769),l=t(1657);let i=(0,o.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=a.forwardRef((e,r)=>{let{className:t,variant:a,size:o,asChild:c=!1,...d}=e,u=c?s.g7:"button";return(0,n.jsx)(u,{className:(0,l.cn)(i({variant:a,size:o,className:t})),ref:r,...d})});c.displayName="Button"},7815:function(e,r,t){"use strict";t.d(r,{Ol:function(){return l},SZ:function(){return c},Zb:function(){return o},aY:function(){return d},ll:function(){return i}});var n=t(3827),a=t(4090),s=t(1657);let o=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,n.jsx)("div",{ref:r,className:(0,s.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...a})});o.displayName="Card";let l=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,n.jsx)("div",{ref:r,className:(0,s.cn)("flex flex-col space-y-1.5 p-6",t),...a})});l.displayName="CardHeader";let i=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,n.jsx)("h3",{ref:r,className:(0,s.cn)("text-2xl font-semibold leading-none tracking-tight",t),...a})});i.displayName="CardTitle";let c=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,n.jsx)("p",{ref:r,className:(0,s.cn)("text-sm text-muted-foreground",t),...a})});c.displayName="CardDescription";let d=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,n.jsx)("div",{ref:r,className:(0,s.cn)("p-6 pt-0",t),...a})});d.displayName="CardContent",a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,n.jsx)("div",{ref:r,className:(0,s.cn)("flex items-center p-6 pt-0",t),...a})}).displayName="CardFooter"},1657:function(e,r,t){"use strict";t.d(r,{cn:function(){return s}});var n=t(3167),a=t(1367);function s(){for(var e=arguments.length,r=Array(e),t=0;ts(e,"name",{value:r,configurable:!0});function l(e,r){if("function"==typeof e)return e(r);null!=e&&(e.current=r)}function i(){for(var e=arguments.length,r=Array(e),t=0;t{let t=!1,n=r.map(r=>{let n=l(r,e);return t||"function"!=typeof n||(t=!0),n});if(t)return()=>{for(let e=0;ed(e,"name",{value:r,configurable:!0});function m(e){let r=n.forwardRef((r,t)=>{var a;let{children:s,...o}=r,l=null,i=!1,d=[];b(s)&&"function"==typeof S&&(s=S(s._payload)),n.Children.forEach(s,e=>{if(v(e)){var r;i=!0;let t="child"in e.props?e.props.child:e.props.children;b(t)&&"function"==typeof S&&(t=S(t._payload)),l=h(e,t),d.push(null==l?void 0:null===(r=l.props)||void 0===r?void 0:r.children)}else d.push(e)}),l?l=n.cloneElement(l,void 0,d):!i&&1===n.Children.count(s)&&n.isValidElement(s)&&(l=s);let u=l?g(l):void 0,m=c(t,u);if(!l){if(s||0===s)throw Error(i?w(e):j(e));return s}let f=x(o,null!==(a=l.props)&&void 0!==a?a:{});return l.type!==n.Fragment&&(f.ref=t?m:u),n.cloneElement(l,f)});return r.displayName="".concat(e,".Slot"),r}u(m,"createSlot");var f=m("Slot"),p=Symbol.for("radix.slottable");u(function(e){let r=u(e=>"child"in e?e.children(e.child):e.children,"Slottable");return r.displayName="".concat(e,".Slottable"),r.__radixId=p,r},"createSlottable");var h=u((e,r)=>{if("child"in e.props){let r=e.props.child;return n.isValidElement(r)?n.cloneElement(r,void 0,e.props.children(r.props.children)):null}return n.isValidElement(r)?r:null},"getSlottableElementFromSlottable");function x(e,r){let t={...r};for(let n in r){let a=e[n],s=r[n];/^on[A-Z]/.test(n)?a&&s?t[n]=function(){for(var e=arguments.length,r=Array(e),t=0;t"".concat(e," failed to slot onto its children. Expected a single React element child or `Slottable`."),"createSlotError"),w=u(e=>"".concat(e," failed to slot onto its `Slottable`. Expected `Slottable` to receive a single React element child."),"createSlottableError"),S=a[" use ".trim().toString()]},9769:function(e,r,t){"use strict";t.d(r,{j:function(){return o}});var n=t(3167);let a=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,s=n.W,o=(e,r)=>t=>{var n;if((null==r?void 0:r.variants)==null)return s(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:o,defaultVariants:l}=r,i=Object.keys(o).map(e=>{let r=null==t?void 0:t[e],n=null==l?void 0:l[e];if(null===r)return null;let s=a(r)||a(n);return o[e][s]}),c=t&&Object.entries(t).reduce((e,r)=>{let[t,n]=r;return void 0===n||(e[t]=n),e},{});return s(e,i,null==r?void 0:null===(n=r.compoundVariants)||void 0===n?void 0:n.reduce((e,r)=>{let{class:t,className:n,...a}=r;return Object.entries(a).every(e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...l,...c}[r]):({...l,...c})[r]===t})?[...e,t,n]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}},function(e){e.O(0,[700,250,971,69,744],function(){return e(e.s=5414)}),_N_E=e.O()}]);