module.exports=[56863,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(35766),e=a.i(67379),f=a.i(23292);a.s(["default",0,function(){let{clienttoken:a}=(0,d.useAuthContext)(),[g,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)({currentPassword:"",newPassword:"",confirmPassword:""}),k=async b=>{var c;if(b.preventDefault(),!i.currentPassword.trim())return void f.toast.error("Current password is required");if(!i.newPassword.trim())return void f.toast.error("New password is required");if(i.newPassword.length<8)return void f.toast.error("Password must be at least 8 characters");if(c=i.newPassword,!/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/.test(c))return void f.toast.error("Password must contain uppercase, lowercase, number and special character");if(i.newPassword!==i.confirmPassword)return void f.toast.error("Passwords not matching");if(i.currentPassword===i.newPassword)return void f.toast.error("New password must be different from current password");try{h(!0);let b=await (0,e.apiCall)("/clientapi/users/details",{method:"PUT",headers:{Authorization:`Bearer ${a}`},body:{currentPassword:i.currentPassword,newPassword:i.newPassword,confirmPassword:i.confirmPassword}});b?.data?.success===!0?(f.toast.success(b?.data?.message||"Password updated successfully"),j({currentPassword:"",newPassword:"",confirmPassword:""})):f.toast.error(b?.data?.message||"Failed to update password")}catch(b){console.error("Password change error:",b);let a=b?.response?.data?.message||b?.message||"Failed to update password. Please try again.";f.toast.error(a)}finally{h(!1)}};return(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-xl sm:text-2xl 2xl:text-3xl font-semibold mb-3",children:"Change Password"}),(0,b.jsx)("div",{className:"p-0",children:(0,b.jsxs)("form",{onSubmit:k,className:"m-0",children:[(0,b.jsxs)("div",{className:"flex flex-wrap -mx-2 xl:-mx-3",children:[(0,b.jsx)("div",{className:"2xl:w-full xl:w-full lg:w-full md:w-full w-full px-2 xl:px-3 mb-3 md:mb-4",children:(0,b.jsxs)("div",{className:"form-group",children:[(0,b.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Current Password ",(0,b.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,b.jsx)("input",{type:"password",value:i.currentPassword,onChange:a=>j({...i,currentPassword:a.target.value}),className:"form-control h-[40px] md:h-[44px] lg:h-[48px] 2xl:h-[60px] text-xs lg::text-sm 2xl:text-lg",required:!0,disabled:g})]})}),(0,b.jsx)("div",{className:"2xl:w-6/12 xl:w-6/12 lg:w-6/12 md:w-6/12 w-full px-2 xl:px-3 mb-3 md:mb-4",children:(0,b.jsxs)("div",{className:"form-group",children:[(0,b.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["New Password ",(0,b.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,b.jsx)("input",{type:"password",value:i.newPassword,onChange:a=>j({...i,newPassword:a.target.value}),className:"form-control h-[40px] md:h-[44px] lg:h-[48px] 2xl:h-[60px] text-xs lg::text-sm 2xl:text-lg",required:!0,disabled:g}),(0,b.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Minimum 8 characters with uppercase, lowercase, number and special character (@$!%*?&)"})]})}),(0,b.jsx)("div",{className:"2xl:w-6/12 xl:w-6/12 lg:w-6/12 md:w-6/12 w-full px-2 xl:px-3 mb-3 md:mb-4",children:(0,b.jsxs)("div",{className:"form-group",children:[(0,b.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Confirm New Password ",(0,b.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,b.jsx)("input",{type:"password",value:i.confirmPassword,onChange:a=>j({...i,confirmPassword:a.target.value}),className:"form-control h-[40px] md:h-[44px] lg:h-[48px] 2xl:h-[60px] text-xs lg::text-sm 2xl:text-lg",required:!0,disabled:g})]})})]}),(0,b.jsx)("button",{type:"submit",disabled:g,className:"theme-btn",children:g?(0,b.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,b.jsxs)("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,b.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,b.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Updating..."]}):"Update Password"})]})})]})}])}];

//# sourceMappingURL=src_app_%28root-layout%29_dashboard_change-password_page_tsx_1lkmc87._.js.map