1import{q as T,W as _,r as k,j as e,d as S}from"./app-BZl21zSa.js";import{I as c}from"./InputError-JUehfOXp.js";import{I as d}from"./InputLabel-BsVacIoc.js";import{P as q}from"./PrimaryButton-BoPiYvtU.js";import{T as h}from"./TextInput-BXWAikdN.js";import{P as V}from"./style-a1Dh8hS9.js";import{i as B,s as U}from"./phoneUtils-DLLKw7hN.js";import{q as z}from"./transition-xllRY7Is.js";import"./index-Be81nlU3.js";function J({mustVerifyEmail:b,status:g,className:v=""}){const i=T().props.auth.user,{data:o,setData:p,patch:y,transform:N,errors:r,processing:C,recentlySuccessful:E}=_({name:i.name,lastname:i.lastname,nickname:i.nickname,username:i.username,phone_country:i.phone_country,phone:i.phone}),[m,w]=k.useState({}),[l,f]=k.useState({}),u=(n,a)=>{const s={...m};switch(n){case"nickname":!a||a.trim()===""?s.nickname="El nombre a mostrar es obligatorio.":a.length>255?s.nickname="El nombre a mostrar no puede exceder 255 caracteres.":delete s.nickname;break;case"phone":B(a)?s.phone="El número de teléfono es obligatorio.":delete s.phone;break}return w(s),Object.keys(s).length===0},x=n=>{f({...l,[n]:!0}),u(n,o[n])},F=()=>{const n=["nickname","phone"];let a=!0;n.forEach(t=>{u(t,o[t])||(a=!1)});const s={};return n.forEach(t=>{s[t]=!0}),f(s),a},P=n=>{n.preventDefault(),F()&&(N(a=>{var t;const s=U(a.phone);return{...a,phone:s,phone_country:s?(t=a.phone_country)==null?void 0:t.toUpperCase():""}}),y(route("profile.update")))};return e.jsxs("section",{className:v,children:[e.jsxs("header",{children:[e.jsx("h2",{className:"text-lg font-medium text-gray-900",children:"Información del Perfil"}),e.jsx("p",{className:"mt-1 text-sm text-gray-600",children:"Actualiza la información de tu perfil."})]}),e.jsxs("form",{onSubmit:P,className:"mt-6 space-y-6",children:[e.jsxs("div",{className:"columns-2",children:[e.jsxs("div",{children:[e.jsx(d,{htmlFor:"name",value:"Nombre"}),e.jsx(h,{id:"name",className:"mt-1 block w-full",value:o.name,disabled:!0}),e.jsx(c,{className:"mt-2",message:r.name})]}),e.jsxs("div",{children:[e.jsx(d,{htmlFor:"lastname",value:"Apellido"}),e.jsx(h,{id:"lastname",className:"mt-1 block w-full",value:o.lastname,disabled:!0}),e.jsx(c,{className:"mt-2",message:r.lastname})]})]}),e.jsxs("div",{children:[e.jsx(d,{htmlFor:"username",value:"Usuario"}),e.jsx(h,{id:"username",className:"mt-1 block w-full",value:o.username,disabled:!0,autoComplete:"username"}),e.jsx(c,{className:"mt-2",message:r.name})]}),e.jsxs("div",{children:[e.jsx(d,{htmlFor:"nickname",value:"Nombre a mostrar *"}),e.jsx(h,{id:"nickname",className:`mt-1 block w-full ${l.nickname&&(m.nickname||r.nickname)?"border-red-500 focus:border-red-500":""}`,value:o.nickname,onChange:n=>{p("nickname",n.target.value),l.nickname&&u("nickname",n.target.value)},onBlur:()=>x("nickname"),required:!0,isFocused:!0,autoComplete:"nickname"}),e.jsx(c,{className:"mt-2",message:l.nickname&&m.nickname||r.nickname})]}),e.jsxs("div",{children:[e.jsx(d,{htmlFor:"phone",value:"Teléfono móvil *"}),e.jsx(V,{id:"phone",countryCodeEditable:!1,country:o.phone_country||"ar",placeholder:"+54 11 1234 5678",masks:{ar:"(...) ...-...."},regions:["north-america","south-america","central-america","carribean","eu-union"],containerClass:"mt-1 block w-full h-10.5",inputClass:`border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm p-5 ${l.phone&&(m.phone||r.ph
1one)?"border-red-500 focus:border-red-500":""}`,inputStyle:{fontFamily:"Gotham",fontSize:"1rem",width:"100%"},inputProps:{autoComplete:"mobile",onBlur:()=>x("phone")},value:o.phone,specialLabel:"",onChange:(n,a,s,t)=>{const j=(a==null?void 0:a.countryCode)||"ar";p(I=>({...I,phone_country:j,phone:n})),l.phone&&u("phone",n)}}),e.jsx(c,{className:"mt-2",message:l.phone&&m.phone||r.phone})]}),b&&i.email_verified_at===null&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm mt-2 text-gray-800",children:["Tu correo electrónico no está verificada.",e.jsx(S,{href:route("verification.send"),method:"post",as:"button",className:"underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:"Click aquà para reenviar el correo electrónico de verificación."})]}),g==="verification-link-sent"&&e.jsx("div",{className:"mt-2 font-medium text-sm text-green-600",children:"Un nuevo link de verificación ha sido enviado a tu correo electrónico."})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(q,{disabled:C||Object.keys(m).length>0,children:"Guardar"}),e.jsx(z,{show:E,enter:"transition ease-in-out",enterFrom:"opacity-0",leave:"transition ease-in-out",leaveTo:"opacity-0",children:e.jsx("p",{className:"text-sm text-gray-600",children:"Guardado."})})]})]})]})}export{J 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.