Theory of condensation of indirect excitons in a trap