Have you gotten any help while you were not attending work? Are you taking medication or seeing a therapist? I think you can try to be honest with your manager and explain what you are going through ask them for an extension and that you will work to meet deadlines and also seek help. Worrying and being scared won't solve your problems so you need to take action and try so salvage your role. I suffer from depression and there are times where i would've love nothing more than to stay home and not deal with work, but at the end of the day I know i have to be responsible for my condition and seek help. I got medication and therapy and i am functional nothing is perfect but i still have a job and have to manage. You can do it , just talk to your boss or HR.