import{K as h,m as j,j as e,L as v,$ as g}from"./app-D_lWdAF1.js";import{S as N,H as y}from"./layout-Cc5k98TZ.js";import{I as o}from"./input-error-Dz46bbCi.js";import{B as b}from"./app-logo-icon-B18IWF-o.js";import{L as t,I as r}from"./label-4h6KnNp-.js";import{A as S}from"./app-layout-DBWaGSby.js";import{z as k}from"./transition-DwSW-Bq9.js";import"./app-gFGt7Tbg.js";import"./index-DKsctv8k.js";import"./index--DsFJTFe.js";const L=[{title:"Profile settings",href:"/settings/profile"}];function B({mustVerifyEmail:m,status:d}){const{auth:a}=h().props,{data:i,setData:l,patch:c,errors:n,processing:u,recentlySuccessful:p}=j({name:a.user.name,email:a.user.email}),f=s=>{s.preventDefault(),c(route("profile.update"),{preserveScroll:!0})};function x(s){return s=s.replace(/[\s\-()]/g,""),/^\+91\d{10}$/.test(s)?s.slice(0,3)+" "+s.slice(3):/^91\d{10}$/.test(s)?"+91 "+s.slice(2):/^\d{10}$/.test(s)?"+91 "+s:null}return e.jsxs(S,{breadcrumbs:L,children:[e.jsx(v,{title:"Profile settings"}),e.jsx(N,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(y,{title:"Profile information",description:"Update your name and email address"}),e.jsxs("form",{onSubmit:f,className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(t,{htmlFor:"name",children:"Name"}),e.jsx(r,{id:"name",className:"mt-1 block w-full",value:i.name,onChange:s=>l("name",s.target.value),required:!0,autoComplete:"name",placeholder:"Full name"}),e.jsx(o,{className:"mt-2",message:n.name})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(t,{htmlFor:"email",children:"Email address"}),e.jsx(r,{id:"email",type:"email",className:"mt-1 block w-full",value:i.email,onChange:s=>l("email",s.target.value),required:!0,autoComplete:"username",placeholder:"Email address"}),e.jsx(o,{className:"mt-2",message:n.email})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(t,{htmlFor:"mobile",children:"Mobile"}),e.jsx(r,{id:"mobile",readOnly:!0,disabled:!0,className:"mt-1 block w-full",value:x(a.user.mobile)})]}),m&&a.user.email_verified_at===null&&e.jsxs("div",{children:[e.jsxs("p",{className:"-mt-4 text-sm text-muted-foreground",children:["Your email address is unverified."," ",e.jsx(g,{href:route("verification.send"),method:"post",as:"button",className:"text-foreground underline decoration-neutral-300 underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-neutral-500",children:"Click here to resend the verification email."})]}),d==="verification-link-sent"&&e.jsx("div",{className:"mt-2 text-sm font-medium text-green-600",children:"A new verification link has been sent to your email address."})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(b,{disabled:u,children:"Save"}),e.jsx(k,{show:p,enter:"transition ease-in-out",enterFrom:"opacity-0",leave:"transition ease-in-out",leaveTo:"opacity-0",children:e.jsx("p",{className:"text-sm text-neutral-600",children:"Saved"})})]})]})]})})]})}export{B as default};
