All may not be lost for Pandora Media Inc. (P) .

Shares of the world's largest internet radio service have surged this week, jumping 18%, including 6% on Friday, June 23, alone, and cutting its 2017 decline to 36.7%.

After being dogged by negative sentiment for much of 2017, Pandora fell even further after Sirius XM Holdings Inc. (SIRI) - Get Report , the satellite radio provider controlled by John Malone's Liberty Media Corp. (FWONA), agreed on June 9 to spend $480 million for a minority stake in the Oakland, Calif., company.

Though the Sirius XM investment came at an opportune time for money-losing Pandora, it was widely viewed as removing the company's most likely acquirer from buying the company outright. If Sirius was content with a minority stake, the thinking went, a takeout at a premium seemingly had evaporated.

Yet over the past few days, investors have come to see Pandora as oversold, said Michael Pachter, a media analyst for Wedbush Securities Inc. Additionally, they may have realized that Liberty Media acquired Sirius XM after initially taking a minority stake, he added.

"People started to reflect on how Liberty ended up buying Sirius after a similar kind of thing that began with a minority investment," Pachter said. "People have gotten more optimistic that maybe these two companies together will be better than Pandora was alone."

Shares of Pandora, though, remain below levels where the stock was trading -- $8.42 per share -- immediately before Sirius XM made its investment announcement on June 9 as well as below where the stock closed just before giant private equity firm Kohlberg Kravis Roberts & Co. LLP (KKR) on May 8 committed to $150 million in financing -- $10.40 per share.

Pandora called off the KKR investment after securing the Sirius XM deal. 

Looking down the road, a Sirius XM takeover of Pandora may not be so far-fetched. Sirius XM will control three of nine board seats by year's end, meaning it would need support from two other directors to execute a friendly buyout. The deal specifically precludes a hostile takeover, i.e., a buyout that couldn't win board approval.

Still to be determined is the future of Pandora's on-demand service, Pandora Premium, which launched in March. In the weeks leading up to Sirius XM's investment, Liberty Media CEO Greg Maffei had panned the service, charging that Pandora would have been better off not entering a market already controlled by Spotify Ltd., Apple (AAPL) - Get Report Music, Inc. (AMZN) - Get Report and YouTube, a unit of Alphabet Inc. (GOOGL) - Get Report

Nonetheless, Pachter said Pandora has indicated it plans to use the Sirius XM money and the $150 million in cash from the sale of concert ticket service TicketFly LLC to integrate its platforms into Siriux XM's satellite radio business.

"I think the company has been pretty clear that it's not going to do anything crazy," Pachter said. "Shares had come to a point where they were overdone, and takeout speculation seems to have come back."

Jim Cramer and the Action Alerts PLUS team on a recent call with members of the investment club said they aren't buying Apple here and think Facebook Inc. (FB) - Get Report and Alphabet look better on a dip.