The companies that feed America and provide basic staples are bracing for labor shortages as the coronavirus pandemic intensifies, which could leave them without enough workers to manufacture, deliver and unpack groceries in stores in the coming months.

As the virus spreads, supermarkets and distribution facilities face a difficult choice: how to keep shelves stocked with essentials while keeping their workers safe.

Already, some chains are rationing products as shelves empty out of pasta, rice and frozen vegetables and anxious customers wait in long lines for toilet paper and bottled water - in scenes similar to those seen before a hurricane, yet this time unfolding on a national scale.

In Washington, D.C., hundreds of people waited in lines that snaked to the back of stores and sometimes onto sidewalks at Walmart, Whole Foods and Trader Joe's this week, as consumers stocked up on toilet paper, canned tuna and cartons of premade soups. Cases of chicken, beef and frozen vegetables were largely wiped out at a Whole Foods near American University. At the Trader Joe's in Tampa, Florida, the pasta and tomato sauce aisle was empty Friday afternoon, and the salty snacks were depleted (there was still plenty of $3 chardonnay on offer, however).

Food producers and supply chain managers say there is generally enough nonperishable food on shelves, in warehouses and on the production line to last several months, but the challenge could soon be getting that food to the right places once local distribution centers are wiped out.

In addition, millions of Americans, who previously got food at restaurants or in school or at work cafeterias, will have to serve themselves at home, with food bought from grocery big-box enterprises.

"The replenishment cycle is going to be the real test here," said Sean Maharaj, a supply chain expert and managing director at AArete, a consulting firm in Chicago. "Manufacturers don't sit on a lot of extra inventory, so what do you do when everything you have is depleted?"

Beyond that, industry officials acknowledge some uncertainty about how exactly they will be able to replenish their stocks if factories and ports worldwide are short-staffed. Over the past decade, retailers have moved aggressively to become more efficient by slimming down on inventory instead of stockpiling backrooms.

"We've whittled down the inefficiencies to the point where logical and orderly demand creates logical and orderly resupply," said Mark Cohen, director of retail studies at Columbia Business School and the former chief executive of Sears Canada. "But this is a different situation: This is serial hoarding - and no part of the machine that supplies consumers is geared for this."

There are already signs of far-reaching shortages: Shelves of hand sanitizer and disinfecting sprays have remained empty for weeks across the country. Amazon is largely sold out of toilet paper, with shipments that were due to be delivered earlier this week delayed indefinitely. Costco's website, meanwhile, is out of peanut butter and canned tomatoes, and has removed its online listing for Kirkland brand baby wipes. Amazon and Costco did not respond to requests for comment.

Wegmans, the regional supermarket chain based in Rochester, New York, said this week that shoppers are buying shelf-stable foods, paper products and cleaning supplies faster than it can keep up with. Like its competitors, it has begun rationing sales of a high-demand items such as bottled water, hand sanitizer and toilet paper.

"As demand for these items continues to grow and supply remains limited, we're working with our current suppliers and pursuing additional sources to replenish our supply," the grocer said on its website.

Analysts say the buying spree could end up lifting prices, after years when chains cut prices amid growing competition from Walmart and newcomers such as Aldi.

"Either prices will start to go up as we see shortages, or companies will have to figure out new ways to move things around," said Per Hong, a senior partner in the strategic operations at Kearney, a consulting firm. "Companies can start to pivot, but there is no question we'll see disruptions because of coronavirus."

Supermarkets are doubling down on essentials, such as food, water and cleaning supplies, while letting everything else go by the wayside, according to Brittain Ladd, a consultant to Kroger and other retailers.

"Fresh food, milk, dairy, meat, eggs - the consumables are the only focus now," he said. "Everything else, like dish towels and candle holders, is of zero concern."

Among food items, products like seafood, apple juice and garlic, which are heavily sourced from China, are likely to be hit first, according to Phil Lempert, a California- based food industry analyst who bills himself as the "supermarket guru."

"The fact that we get a lot of food from China, where factories have been closed, does indicate that we are going to have a supply chain problem," he said. "We're going to have two-, three-, four-month lag time until those factories get back up to speed."

In the United States, grocery chains and distributors are taking their own measures to keep the coronavirus outbreak from spreading to their workers. Warehouses have begun limiting visits from vendors and suppliers, while some supermarkets are toying with reducing their hours, according to Maharaj.

Instacart and other delivery services are offering "contact-free" drop-offs to customers' doorsteps. Big-box stores like Walmart and Target, which have invested heavily in store-pickup and same-day delivery programs, have been doubling down on them in recent days, industry experts say.

Many companies have also revised their sick leave policies in recent days to encourage employees to stay home if they feel ill.

"The issue is: Grocery stores are essentially giant petri dishes," Maharaj said. "You have a lot of people, touching a lot of food."

Although grocery stores may struggle in the short term to keep shelves stocked, some experts say current shortages are temporary supply-chain glitches. American stockpiles of basic foods are strong, they say. Lowell Randel, vice president of government and legal affairs for Global Cold Chain Alliance, which provides temperature-controlled storage and distribution to 1,300 companies in 85 countries, says he sees no supply problems.

"It's not a shortage of availability of food," he said. "It's nothing like the situation with hand sanitizer. Our member facilities are full, not empty. That should provide comfort for consumers."

If anything, he said, the United States currently has excesses of certain food items, such as pork and soy, because of a slowdown in exports to China. The pork industry continues to run near full capacity, slaughtering 490,000 heads per day, according to Steve Meyer, an economist for Kerns and Associates who covers the pork industry.

But, he added, the big fear is that the coronavirus outbreak could affect workers.

"If we had a major plant that had two or three workers test positive, they would have no choice but to suspend operations," he said. "Same would be true for the beef business."

Fears of a "serious market disruption with catastrophic implications for hog farmers" prompted the National Pork Producers Council to send a letter to the White House and lawmakers this week asking for federal action such as expedited worker visas and support for farmers suffering from supply-chain bottlenecks. Pointing to a Tyson meat plant fire this summer, Meyer says a processing bottleneck results in both meat price hikes for consumers and lower cattle prices for producers.

John Newton, chief economist for the Farm Bureau, echoed concerns about the impact of labor shortages on protein supplies. "The bigger concern is the 'flow commodities' - raising chickens and milking cows - where you need access to skilled labor. If you have labor hiccups, it could disrupt the ability to get milk off the farm and process it. You see that in natural disasters: The plants close because people can't get to work."

Industry groups estimate that about one-third of fresh fruits and vegetables in American grocery stores at this time of year are imported from Mexico, coming through checkpoints in San Diego, McAllen and Laredo, Texas, and Nogales, Arizona. Growers and packers there are following CDC and WHO protocol to eliminate outside visitors to facilities, limit travel and have doctors on-site to assess the health of workers, said Lance Jungmeyer, president of the Fresh Produce Association of the Americas. Still, he said he worries about what could happen down the line.

"I'm less worried about the food supply than in disruptions in the agencies that regulate it," he said. "If we had an outbreak in the USDA or FDA, that would certainly disrupt things until we figured it out. For a short time, produce could be stuck at the border."

He says fresh fruits and vegetables from South America are normally unloaded at ports in Philadelphia, Miami, Seattle and Long Beach, California, where USDA and FDA inspectors are responsible for checking it. According to Jungmeyer, in the event of sailors or dock workers being infected with the virus, there have been discussions of ways to unload product away from docks.