import{j as e,r as l,u as h}from"./app-CAqQVdqj.js";import{T as w,I as j}from"./TextInput-CB3jN3Hw.js";import{I as b}from"./InputLabel-DLUBTFsF.js";import{M as N}from"./Modal-p-UzP8zH.js";import"./transition-DPTzZICW.js";function d({className:o="",disabled:t,children:s,...r}){return e.jsx("button",{...r,className:`inline-flex items-center rounded-md border border-transparent bg-red-600 px-4 py-2 text-xs font-semibold uppercase tracking-widest text-white transition duration-150 ease-in-out hover:bg-red-500 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 active:bg-red-700 ${t&&"opacity-25"} `+o,disabled:t,children:s})}function v({type:o="button",className:t="",disabled:s,children:r,...n}){return e.jsx("button",{...n,type:o,className:`inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-xs font-semibold uppercase tracking-widest text-gray-700 shadow-sm transition duration-150 ease-in-out hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-25 ${s&&"opacity-25"} `+t,disabled:s,children:r})}function F({className:o=""}){const[t,s]=l.useState(!1),r=l.useRef(),{data:n,setData:u,delete:m,processing:p,reset:i,errors:f,clearErrors:x}=h({password:""}),y=()=>{s(!0)},g=c=>{c.preventDefault(),m(route("profile.destroy"),{preserveScroll:!0,onSuccess:()=>a(),onError:()=>r.current.focus(),onFinish:()=>i()})},a=()=>{s(!1),x(),i()};return e.jsxs("section",{className:`space-y-6 ${o}`,children:[e.jsxs("header",{children:[e.jsx("h2",{className:"text-lg font-medium text-gray-900",children:"Delete Account"}),e.jsx("p",{className:"mt-1 text-sm text-gray-600",children:"Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain."})]}),e.jsx(d,{onClick:y,children:"Delete Account"}),e.jsx(N,{show:t,onClose:a,children:e.jsxs("form",{onSubmit:g,className:"p-6",children:[e.jsx("h2",{className:"text-lg font-medium text-gray-900",children:"Are you sure you want to delete your account?"}),e.jsx("p",{className:"mt-1 text-sm text-gray-600",children:"Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account."}),e.jsxs("div",{className:"mt-6",children:[e.jsx(b,{htmlFor:"password",value:"Password",className:"sr-only"}),e.jsx(w,{id:"password",type:"password",name:"password",ref:r,value:n.password,onChange:c=>u("password",c.target.value),className:"mt-1 block w-3/4",isFocused:!0,placeholder:"Password"}),e.jsx(j,{message:f.password,className:"mt-2"})]}),e.jsxs("div",{className:"mt-6 flex justify-end",children:[e.jsx(v,{onClick:a,children:"Cancel"}),e.jsx(d,{className:"ms-3",disabled:p,children:"Delete Account"})]})]})})]})}export{F as default};
