WASHINGTON — First came the blue wave, then came the red ink.

The new leader of the Democratic Congressional Campaign Committee, who is slated to be chosen Wednesday in the party's internal elections, will inherit $18 million in debt from this year's midterms, a source familiar with the group's finances told NBC News.

It’s common for campaigns and party committees to finish election cycles in the hole as they throw everything they have — and then some — at an election, but the $18 million will have to be made up through fundraising before the new chairman can start building a warchest for the next election cycle.

The National Republican Congressional Committee also spent heavily this year as it fought to defend the GOP majority, taking out a $12 million line of credit that still has to be paid off, according to the committee's communications director, Matt Gorman.

Democrats racked up the debt while flipping at least 39 seats, taking control of the House and enjoying unusually strong fundraising year, with the DCCC taking in $272 million, including $106.3 million online.

But they spent heavily in an unusually large number of races and faced deep-pocketed opponents in GOP outside groups like the Congressional Leadership Fund, which spent roughly twice as much as their Democratic super PAC counterpart.

Overall, it was the most expensive midterm in history, with the DCCC spending at least $100,000 in each of more than 80 congressional districts as they expanded the map to places Democrats haven't competed before.

The Democratic National Committee, which has had its own fundraising woes this year, gave the DCCC slightly less money this year — $4.85 million — than the $5 million they gave in 2014 and 2016, or the more than $7 million they contributed in 2010, according to the source.

The DCCC has been taking a victory lap after its successes this year, including breaking the record popular vote margin for a midterm election.

Its outgoing leader, Rep. Ben Ray Lujan, D-N.M., is running unopposed for a job higher up the party's congressional hierarchy, which will be voted on Wednesday along with the vote on Rep. Nancy Pelosi's, D-Calif., bid for the speakership.

Also up for grabs will be the chairmanship of the DCCC, for which four Democrats are competing: Reps. Cheri Bustos, D-Ill.; Sean Patrick Maloney, D-N.Y.; Denny Heck, D-Wash.; and Suzan DelBene, D-Wash. The position was only recently made an elected one, instead of one appointed by the party's leader.