i think she got stuck in some way in a darkworld (assuming she's the knight), and that slowly over the years "blinded her with darkness", it'd be a cool parallel to (mostly susie's) desire to stay in the dark world and escapism as a whole
i think she got trapped in the bunker where gaster does negative photon readings and shit and he made her become the knight for reasons that are probably lore-relevant
i think the "where am i?" stuff in the code happened before the events of deltarune