Detecting if browser extension is running as popup or side panel

I’m building a browser extension that can be opened as both a popup and a side panel (chrome-based browsers) / sidebar (firefox). Is there a way in JavaScript to detect which option the user is currently using (where the application is loaded)?

This is a part of my manifest.json file:

{
  "manifest_version": 3,
  "permissions": [
    "storage",
    "unlimitedStorage",
    "activeTab",
    "tabs",
    "sidePanel",
    "declarativeNetRequestWithHostAccess"
  ],
  "action": {
    "default_popup": "index.html"
  },
  "background": {
    "service_worker": "js/background.js"
  },
  "side_panel": {
    "default_path": "index.html"
  },
  "sidebar_action": {
    "default_panel": "index.html",
    "default_icon": "icons/icon_128.png"
  }
}

For both extension and side panel the sidePanel is present in the browser object and I didn’t notice any differences there.