  We investigate competition between two phase transitions of the second kind
induced by the self-attractive nonlinearity, viz., self-trapping of the leaky
modes, and spontaneous symmetry breaking (SSB) of both fully trapped and leaky
states. We use a one-dimensional mean-field model, which combines the cubic
nonlinearity and a double-well-potential (DWP) structure with an elevated
floor, which supports leaky modes (quasi-bound states) in the linear limit. The
setting can be implemented in nonlinear optics and BEC. The order in which the
SSB and self-trapping transitions take place with the growth of the
nonlinearity strength depends on the height of the central barrier of the DWP:
the SSB happens first if the barrier is relatively high, while self-trapping
comes first if the barrier is lower. The SSB of the leaky modes is
characterized by specific asymmetry of their radiation tails, which, in
addition, feature a resonant dependence on the relation between the total size
of the system and radiation wavelength. As a result of the SSB, the instability
of symmetric modes initiates spontaneous Josephson oscillations. Collisions of
freely moving solitons with the DWP structure admit trapping of an incident
soliton into a state of persistent shuttle motion, due to emission of
radiation. The study is carried out numerically, and basic results are
explained by means of analytical considerations.
