Moping would have been a waste of time. So when Maggie Nichols dislocated her left kneecap last summer — pausing her ascent into the highest ranks of American gymnastics — she chose to view her six-month recovery period as an opportunity, not as a hardship.

Nichols, of Little Canada, was injured only a week after a breakthrough performance that earned her the all-around bronze medal at the national championships. With the 2016 Olympics two years away, she knew she needed to improve her strength and fitness to have a chance to make the U.S. team for the Rio Games. “During that six months, she was in the gym every day, working on her strength and her conditioning and whatever she needed to do,’’ said Sarah Jantzi, Nichols’ coach. “And when she came back, she was on a mission.’’

That mission continues at this week’s U.S. championships in Indianapolis, as Nichols seeks to solidify her standing among the nation’s top gymnasts. She debuted new skills and routines — including an Amanar vault, one of the most difficult in the sport — at last month’s U.S. Classic, where she earned the all-around bronze in a competition thick with Olympic and world medalists.

Making the team for October’s world championships and moving on toward the Olympics will require unyielding focus and determination. Tapping into those traits during her layoff helped Nichols come back better than ever, leaving her feeling well-prepared to chase the biggest prizes in her sport.

“I had so much motivation,’’ said Nichols, 17. “I’ve gotten so much stronger, mentally as well as physically.

“I feel so much better. I’m really excited to compete at nationals and show everyone what I’ve been working so hard for.’’

Much of that work is done at the Twin City Twisters gym in Champlin, Nichols’ home club since she was 6 years old. The Twisters — who did not have an elite program when she joined — also will send junior stars Abby Paulson, Olivia Trautman and Tori Tatum to the national meet, the second-largest contingent of any club in the women’s field.

Her gym’s evolution into a powerhouse has mirrored her own. At 12, Nichols made her first trip to the U.S. national training center at the Karolyi Ranch in Huntsville, Texas, where U.S. women’s national team coordinator Martha Karolyi grooms the best of the best. She was given a list of things she needed to work on to earn an invitation to return; energized by the challenge, she trained relentlessly and won a place on the senior national team in 2013.

Under the guidance of Jantzi, Rich Stenger and Twisters director Mike Hunger, Nichols has developed into an elegant yet powerful gymnast. She now spends one week each month at the Karolyi ranch, honing her high-difficulty, high-style routines alongside superstars such as world all-around champ Simone Biles and Olympic gold medalist Gabrielle Douglas. Her growing international résumé includes five team gold medals — including the one she won at the Pan American Championships last August, where she injured her knee.

During her recovery, Nichols built the upper-body strength necessary to add the Amanar vault to her arsenal. She also improved her fitness, and her body got a much-needed break from the strain of constant training. “She toughed it out, like she’s done with other injuries,’’ said her mom, Gina Nichols. “She never complains. She just works.’’

While many people were impressed by Nichols’ physical transformation, Jantzi saw another change: an unwavering commitment to pushing herself as far as she could go.

“When people saw her for the first time after she came back, it was like, ‘Whoa. She’s a completely different person,’ ’’ Jantzi said. “Her body looks different, and her gymnastics looks different. And she was a different kid for me to coach. Her attitude now is, ‘I’m here for a purpose, and I know what I want.’ ’’

At the U.S. championships, Nichols will be trying to earn another term on the national team and put herself in contention for a place on the world championships team. She will graduate this December from Roseville Area High School, enabling her to train full-time toward the 2016 nationals and Olympic trials.

“I’ve wanted to go to the Olympics my whole life,’’ Nichols said. “It would mean the world to me, but I have to take one step at a time.

“I just want to keep improving and show people what I can do. I want to prove that all your hard work can pay off.’’