[agent] refactor Search

Refactor the Search functionality. This is just some cleanup that should have happened long ago.

+ Create a Search constructor
+ set instance properties like `currentEl`, `clickMask`
+ move event handlers to instance methods `onMouseOver`...

previously this was just in a closure, but it's nice to call it directly