9 weeks and heavy bleeding

So last night I had very heavy bleeding with a lot of clotting I’m currently 9 weeks and baby’s heart was still beating last night. The bleeding has almost stopped now I’m so confused though am I going to miscarry or am o just bleeding so scary not knowing!

Update I was at the hospital last night when it started.