Hamas' Gaza strategy for the last 10 years has gone nowhere.  Egypt has kept the border blocked (except for the brief time the Muslim Brotherhood was in charge), Gazans receive critical healthcare in Israel (other Arab countries won't let them in) because they couldn't get it in Gaza, and Hamas couldn't pay their utility bills to Israel.

Hamas spent most of their resources on missiles and tunnels against Israeli villages instead of on local infrastructure and services.  Meanwhile, Israel's Iron Dome has effectively neutered those missiles, and is now implementing new technologies to detect and destroy deep tunnels that cross the border.

And don't even mention elections or a political opposition.

So Hamas' decline was inevitable.