As legislative leaders and the governor huddled inside Gov. Mark Dayton’s 16,000-square-foot official residence Wednesday, the rest of the Legislature and those who waited for a deal “prayed for numbers.”

The state’s budget plans for the next two years are at a standstill, as they have been for days, while the governor and Republican House and Democratic-Farmer-Labor Senate leaders met privately in hopes of reaching an agreement.

Leaders on both sides said they’re “making progress in every area,” as House Speaker Kurt Daudt put it. However, time is running out.

The Legislature is scheduled to adjourn for the year at the end of Monday, May 18. But Dayton, Daudt and Senate Majority Leader Tom Bakk have to reach a budget deal long before then.

Once the leadership reaches a deal, joint committees from each chamber have to take that deal and flesh it out, resolving hundreds of minor differences between the House and Senate in each budget bill. Then the attorneys, budget experts and proofreaders need to comb through the massive bills to make sure everything adds up and checks out before the bills can be voted into law.

All this can take days, even working round-the-clock. So Monday’s midnight deadline is closer than it seems.

“There does come a time when … even if you have agreement, you can’t mechanically process the bills fast enough,” said Rep. Matt Dean, R-Dellwood and the chairman of the House health and human services committee.

How long does it take?

“The answer is the revisor’s office will try our very best to do whatever the Legislature asks us to do. It is a significant amount of work that is left to be done,” said Michele Timmons, the state’s longtime revisor. The revisor’s office is charged with the actual drafting of legislation before lawmakers can vote to approve it.

In 2011, after an agreement was struck on budget measures to end a state government shutdown, it took from three to four days to draft all the legislation. Timmons said those 2011 measures were slightly shorter than the ones in play this year.

“It seems like every year, we get tested a little bit more,” Timmons said.

She said staffers have to draft the legislative language and check it. Then legislative staffers, outside the office, tend to reread it.

“All those steps take time, all of those quality-control steps,” she said.

How much time differs depending on the part of the budget.

Some of the Legislature’s 10 budget bills are comparatively short and straightforward. Others — such as taxes and health and human services — are longer and more complicated.

Sen. Scott Dibble, DFL-Minneapolis and chairman of the Senate’s transportation committee, is optimistic about how fast lawmakers could produce a final transportation bill once a deal is struck.

“We’d probably need about a day to work through the committee process and give staff time to get everything shipshape,” Dibble said.

The health and human services budget bill, which tends to stretch over hundreds of pages, can take two to three days for the revisor’s office to produce, Timmons said. That’s on top of the hours or days it would take the conference committee to settle the smaller disputes between the chambers.

Revisors will work 24 hours a day over the weekend to finish this work as the end of the session nears.

Even as the whole Legislature waits for Dayton, Daudt and Bakk to strike a deal, work is continuing to resolve some of the smaller differences between the chambers.

“The skeletons of the bill are already completed,” Dean said.

But there’s only so much lawmakers can do until a deal is reached.

The combined House- Senate committee charged with crafting the spending plans on state departments and the Legislature canceled a meeting planned for Wednesday. That has been the case nearly every work day since May 1. On that day, the committee met for three hours. Now, it just schedules meetings in hopes of getting a spending target, and then cancels its plans while leaders work out their differences.

Opening another meeting of that committee on Wednesday, Rep. Greg Davids, R-Preston, told lawmakers and onlookers that his hope was to “wrap it up and pray for numbers.”

As the day wore to evening, the leaders indicated few signs of a conclusion. But they still proclaimed the work on track.

“We’re all still at the table and we’re all still talking friendly with each other, so that’s good,” Daudt, R-Crown, said.

Lawmakers broke off the meeting about 10:30 p.m. and planned to meet again at 10 a.m. Thursday.