To my dismay, I realized I had lost my money.

Literal

Dismayed thing [to-には], I [topic-は] money [object-を] had-lost thing [to-に] noticed.

狼狽した事には ('to my dismay') is a set phrase using 狼狽 (ろうばい, 'panic'). なくしていた uses ~ていた to mark the loss as a state existing before the realization. The discovery came after the fact.