Change Default Category Based On Conditions

For reference - the code i’ve gotten so far:

HTML Body

<!-- Used to flag Calendar page by adding calendar-page class to body -->

  <script>
    // Check if the URL ends with "/calendar"
    if (window.location.href.endsWith("/calendar")) {
      // Add a class to the body to trigger the CSS rule
      document.body.classList.add('calendar-page');
    }
  </script>

<!-- Changes 'Add Topic' to 'Add Event' in calendar screen -->

  <script>
    // Check if the body has the class "hide-on-calendar"
    if (document.body.classList.contains('calendar-page')) {
      // Update the text of the button
      const button = document.querySelector('.main-content.calendar .d-button-label');
      if (button) {
        button.textContent = 'Add Event';
      }
    }
  </script>

CSS

//Hide none Event Categories 
    
     body.calendar-page li.select-kit-row.category-row[title]:not([title="Private Events"]):not([title="Public Events"]):not([title="Induction Sessions"]):not([title="Space Bookings"]) {
      display: none;
    }

If anyone has got any suggestions on how to pick up a value set against the category settings by a plugin (in this case the Event’s plugin’s “Allow events to be added to topics in this category.” setting) so i don’t need to hard code the categories, that would be awesome too … but i know i’m pushing my luck.