Bonus Repayment - How to claim your taxes?

I received a bonus of $19K ($13K in account after tax deduction) in 2021 but I left job early in 2022 and I repaid the pro-rated bonus amount of $12K. For this $12K, they took around 3K from my last paycheck and rest 9K I paid by doing an ACH transfer. Few questions:

1. How can I find the tax that I overpaid in this situation? What is the formula for finding that? I think 12K should be used as the base?

2. As they deducted 3K from my last paycheck, how can I handle that? Because it means, 3K is used to reduce my overall income of the entire year but I still paid taxes on it.