iTunes suddenly reset
I opened up iTunes today to find it completely empty. All the songs, podcasts, etc. were gone from the library and all the playlists I had created were gone. I have iTunes version 12.7.3.46.
The songs and podcasts are still on my computer where they had been, but no longer appear in iTunes. I realize I can put them back into the library (though have to wait a very long time for that to process because I have a large collection). Luckily the files still have the metadata I'd entered for them in iTunes. So I'm mostly concerned about losing my playlists. I had some awesome mixes that I've made over the years.
Is there a way to restore my iTunes to how it was before this happened? I'm also wondering why it happened but that may be impossible to tell without investigating more details. I see I have a file called "iTunes Library.itl" but if I open that in iTunes, nothing happens. I also see I have similar files under "Previous iTunes Libraries," the most recent one of which is dated almost a year ago, but anyway nothing happens when I open those either.
Any help would be appreciated. I'd also like to know how to prevent this from happening because as far as I can tell it seems to have happened for no reason. I wasn't doing anything unusual with my computer and my iTunes collection had been stable for years.