import{$n as e,Mu as t,Nu as n,Qn as r,Xd as i,Xn as a,Zn as o,ar as s,cr as c,er as l,ir as u,nr as d,or as f,rr as p,sr as m,tr as h}from"./messages-Dl4DZ3oF.js";import{a as g}from"./auth-store-CjAlzl54.js";import{t as _}from"./button-C1yViT6u.js";import{n as v}from"./dist-i7zhhmGc.js";import{c as y,s as b}from"./zod-o7fWFSsj.js";import{a as x,c as S,i as C,l as w,n as T,o as E,s as D,t as O}from"./form-B11xe3D_.js";import{t as k}from"./password-input-BzvPgVCK.js";import{t as A}from"./page-header-BQBo8kJV.js";var j=i(),M=b({old_password:y().min(1,c()),new_password:y().min(8,m()),confirm_password:y().min(1,f())}).refine(e=>e.new_password===e.confirm_password,{message:s(),path:[`confirm_password`]});function N(){let t=w({resolver:S(M),defaultValues:{old_password:``,new_password:``,confirm_password:``}}),n=g.useMutation(`post`,`/admin/api/v1/auth/password`);async function i(e){await n.mutateAsync({body:{old_password:e.old_password,new_password:e.new_password}}),v.success(u()),t.reset()}return(0,j.jsx)(O,{...t,children:(0,j.jsxs)(`form`,{className:`max-w-md space-y-4`,onSubmit:t.handleSubmit(i),children:[(0,j.jsx)(C,{control:t.control,name:`old_password`,render:({field:e})=>(0,j.jsxs)(x,{children:[(0,j.jsx)(E,{children:p()}),(0,j.jsx)(T,{children:(0,j.jsx)(k,{placeholder:d(),...e})}),(0,j.jsx)(D,{})]})}),(0,j.jsx)(C,{control:t.control,name:`new_password`,render:({field:e})=>(0,j.jsxs)(x,{children:[(0,j.jsx)(E,{children:h()}),(0,j.jsx)(T,{children:(0,j.jsx)(k,{placeholder:l(),...e})}),(0,j.jsx)(D,{})]})}),(0,j.jsx)(C,{control:t.control,name:`confirm_password`,render:({field:t})=>(0,j.jsxs)(x,{children:[(0,j.jsx)(E,{children:e()}),(0,j.jsx)(T,{children:(0,j.jsx)(k,{placeholder:r(),...t})}),(0,j.jsx)(D,{})]})}),(0,j.jsx)(_,{disabled:n.isPending,type:`submit`,children:n.isPending?o():a()})]})})}function P(){return(0,j.jsx)(A,{description:t(),title:n(),variant:`section`,children:(0,j.jsx)(N,{})})}var F=P;export{F as component};