Pregnancy depression?

I am 27 years old and am pregnant with my first child at 15 weeks 3 days. I used to be a heavy black and mild smoker and also marijuana. Smoking at least 2-3 blacks a day and 4 blunts a day prior to my pregnancy. As soon as I found out i was pregnant I quit cold turkey with the nicotine. As for the marijuana I have been struggling to quit. I had initially tried to quit at my first prenatal appt at 12 weeks. I quit that day because my doctor threatened me with CPS because I live in the state of Indiana marijuana is not legal. I made it to about 2 1/2 weeks before I started having horrible nightmares about me and my baby dying not actually in ways but like just seeing my casket and then a little baby casket next to mine. Its was slowly freaking me out. I then end up having a horrible panic attack on the bypass on my way to work and it was so bad my boyfriend had to leave work and come get me off the side of the road. At this point I'm starting to feel like either i may have bipolar disorder or i maybe battling some type of depression. My point in making this post is that I'm really scared because I have my 16 week appt coming up and i know they are gonna test my urine. I'm scared I'm gonna lose my baby before it even gets here but I'm also scared that if I quit marijuana and dont get on some type of medication I may not be well enough to even continue the pregnancy. I need help!!! What should I do?