  The properties of the $X(3872)$ and its spin partner, the $X(4014)$, are
studied both in vacuum and at finite temperature. Using an effective hadron
theory based on the hidden-gauge Lagrangian, the $X(3872)$ is dynamically
generated from the $s$-wave rescattering of a pair of pseudoscalar and vector
charm mesons. By incorporating the thermal spectral functions of open charm
mesons, the calculation is extended to finite temperature. Similarly, the
properties of the $X(4014)$ are obtained out of the scattering of charm vector
mesons. By applying heavy-quark flavor symmetry, the properties of their bottom
counterparts in the axial-vector and tensor channels are also predicted. All
the dynamically generated states show a decreasing mass and acquire an
increasing decay width with temperature, following the trend observed in their
meson constituents. These results are relevant in relativistic heavy-ion
collisions at high energies, in analyses of the collective medium formed after
hadronization or in femtoscopic studies, and can be tested in lattice-QCD
calculations exploring the melting of heavy mesons at finite temperature.
