Bear spray is great line of defense (if your that close

) but truth be known, I don't care to be that close to start with

. Spraying Bear spray from a 100 feet away, doesn't work

.
Best line of defense is to avoid a get together to start with! Make noise, talk, sing, whistle, clap, etc when hiking/running/walking/biking in bear country.
Of course not knowing why the bear decided this egg was worth getting into, it's hard to say how they could have protected it to avoid such a issue.
But would wonder if there was anything left out, such as a piece of fruit, candy bar, cracker, even a box of cereal, left on the counter will entice them. The slightest odor will bring them investigating. I have lived in Bear country on and off for years. And have had only one issue. Of course it was at our back door

.
While Dh was walking some trash out to the bear proof container the phone rang, instead of letting it go to voice mail, he sat the trash down just outside the back door and answered the phone, when he finished the phone conversation he decided to finish reading the paper so he could add it to the trash before unlocking the bear proof trash container (God forbid you make 2 trips

) . We had 2 bears within 20 minutes of him sitting it out the door. Boy that was fun! Thankfully we got them on their way, before animal control got there. Though I almost got shot by a neighbor in the process! (dumb a$$!)........
Best line of defense is to avoid them. As beautiful and majestic as they are, I respect the fact that they know I am scared of them.