Thermodynamics of the dissipative two-state system: A Bethe-ansatz study