What is a good approach for warning user on leaving a modal or side flyout panel with unsaved changes?

The user is editing a form element on the RHS flyout panel and the editing is not completed. In the middle of the process, the user decides to undertake the following actions:

  1. Click outside the flyout panel.
  2. Click in the search bar.
  3. Click on one of the tabs inside the flyout
  4. Clicks on the flyout close button.

Right Hand Side Flyout Panel

What is the best way to notify the user that their changes will not be saved? Here are some of my iterations:

iterations of notifying users about unsaved changes