(() => {
  const switchers = document.querySelectorAll('[data-workspace-switch], [data-workspace-access-switch]');
  switchers.forEach((select) => {
    select.addEventListener('change', () => {
      const form = select.form;
      if (form && typeof form.requestSubmit === 'function') form.requestSubmit();
      else if (form) form.submit();
    });
  });
})();
