Gusting winds have “wreaked havoc” on the state’s power grid, uprooting trees, toppling electric poles, and leaving more than 300,000 Bay State residents in the dark — and officials are estimating that restoring power to the hardest hit areas could be measured in the days, not hours.Most of Eversource Energy’s 141,000 reported outages — 12 percent of its customers — were on the Cape and the South Shore, where persisting wind gusts pulled down scores of trees and countless power wires.