  Interactions of ultra-high energy cosmic rays (UHECRs) accelerated in
specific astrophysical environments have been shown to shape the energy
production rate of nuclei differently from that of the secondary neutrons
escaping from the confinement zone. Here, we aim at testing a generic scenario
of in-source interactions through a phenomenological modeling of the flux and
composition of UHECRs. We fit a model in which nucleons and nuclei follow
different particle energy distributions to the all-particle energy spectrum,
proton spectrum below the ankle energy and distributions of maximum shower
depths above this energy, as inferred at the Pierre Auger Observatory. We
obtain that the data can be reproduced using a spatial distribution of sources
that follows the density of extragalactic matter on both local and large
scales, providing hence a realistic set of constraints for the emission
mechanisms in cosmic accelerators, for their energetics and for the abundances
of elements at escape from their environments. While the quasi mono-elemental
increase of the cosmic-ray mass number observed on Earth from ${\simeq}\:
2\:$EeV up to the highest energies calls for nuclei accelerated with a hard
spectral index, the inferred flux of protons down to ${\simeq}\: 0.6\:$ EeV is
shown to require for this population a spectral index significantly softer than
that generally obtained up to now. We demonstrate that modeling UHECR data
across the ankle substantiate the conjecture of in-source interactions in a
robust statistical framework, although pushing the mechanism to the extreme.
