(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,72953,s=>{"use strict";var e=s.i(43476),r=s.i(71645),a=s.i(171),t=s.i(859),l=s.i(46696);s.s(["default",0,function(){let{clienttoken:s}=(0,a.useAuthContext)(),[o,d]=(0,r.useState)(!1),[n,c]=(0,r.useState)({currentPassword:"",newPassword:"",confirmPassword:""}),i=async e=>{var r;if(e.preventDefault(),!n.currentPassword.trim())return void l.toast.error("Current password is required");if(!n.newPassword.trim())return void l.toast.error("New password is required");if(n.newPassword.length<8)return void l.toast.error("Password must be at least 8 characters");if(r=n.newPassword,!/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/.test(r))return void l.toast.error("Password must contain uppercase, lowercase, number and special character");if(n.newPassword!==n.confirmPassword)return void l.toast.error("Passwords not matching");if(n.currentPassword===n.newPassword)return void l.toast.error("New password must be different from current password");try{d(!0);let e=await (0,t.apiCall)("/clientapi/users/details",{method:"PUT",headers:{Authorization:`Bearer ${s}`},body:{currentPassword:n.currentPassword,newPassword:n.newPassword,confirmPassword:n.confirmPassword}});e?.data?.success===!0?(l.toast.success(e?.data?.message||"Password updated successfully"),c({currentPassword:"",newPassword:"",confirmPassword:""})):l.toast.error(e?.data?.message||"Failed to update password")}catch(e){console.error("Password change error:",e);let s=e?.response?.data?.message||e?.message||"Failed to update password. Please try again.";l.toast.error(s)}finally{d(!1)}};return(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-xl sm:text-2xl 2xl:text-3xl font-semibold mb-3",children:"Change Password"}),(0,e.jsx)("div",{className:"p-0",children:(0,e.jsxs)("form",{onSubmit:i,className:"m-0",children:[(0,e.jsxs)("div",{className:"flex flex-wrap -mx-2 xl:-mx-3",children:[(0,e.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,e.jsxs)("div",{className:"form-group",children:[(0,e.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Current Password ",(0,e.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,e.jsx)("input",{type:"password",value:n.currentPassword,onChange:s=>c({...n,currentPassword:s.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:o})]})}),(0,e.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,e.jsxs)("div",{className:"form-group",children:[(0,e.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["New Password ",(0,e.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,e.jsx)("input",{type:"password",value:n.newPassword,onChange:s=>c({...n,newPassword:s.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:o}),(0,e.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Minimum 8 characters with uppercase, lowercase, number and special character (@$!%*?&)"})]})}),(0,e.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,e.jsxs)("div",{className:"form-group",children:[(0,e.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Confirm New Password ",(0,e.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,e.jsx)("input",{type:"password",value:n.confirmPassword,onChange:s=>c({...n,confirmPassword:s.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:o})]})})]}),(0,e.jsx)("button",{type:"submit",disabled:o,className:"theme-btn",children:o?(0,e.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,e.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,e.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,e.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"})]})})]})}])}]);