They have been preparing for 50 years yet lost all their leadership, nuclear facilities, ballistic missile manufacturing ecosystem and air defenses in minutes to days.
The US is not doing amazing in this war but no need to give the Iranians too much credit. The Iranians are expanding a lot of resources of their own as much as this war drags on.
It is still very early to say how a country will fare considering that it ran out of water and was on a verge of economic breakdown and revolt before fighting a prolonged war with economic blockade of its main export.
According to the US administration Iran military was supposed to be obliterated, and still. Either way, they have figure out they have a much cheaper way to hold Trump by the balls, and let him dance to their tune. I believe Ukraine and Iran are showing that there is a new level of inflicting damage to your aggressor.
They are mainly using the known fact that there's no chance in hell that the US will invade Iran with ground forces. They also previously negotiated as if this war would never start, so they might make a mistake as this is Trump after all.
In any case, Iran is not in a prime position either, it has many economic assets that can be completely destroyed as it has no air defense and then leave them in a much worse situation, while the only real damage they can do to the US is by attacking their own neighbors
the US can make Iran look like Afghanistan and still loose the war.
Iran is a paper tiger.