Extremely unfortunate, but any used camper should be gone over very intensely before buying. Water leaks and this result are very common. Probably every used camper over 5 or 6 years old has had a leak somewhere, unless it was stored inside all of its life.
The worst thing with the Flagstaff is that the floor is likely only very thin "plywood", so a whole new layer of real plywood may have to be laid down.
Hopefully the styrofoam in the floor is ok.
Disheartening for sure, and everyone here knows how both of you must feel.