Shell-model calculations of stellar weak interaction rates. I. Gamow-Teller distributions and spectra of nuclei in the mass range A = 45–65