// Auto-extracted from apps-manager.js (verbatim) — augments AppsManager.prototype. Loaded after the base.
Object.assign(AppsManager.prototype, {
  // Update service buttons sidebar with service data from apps-services.json
  async updateServiceButtonsSidebar(app, appName) {
    if (!window.serviceButtons) return;

    try {
      // Update sidebar using the new ServiceButtons API
      await window.serviceButtons.updateSidebar(appName);
    } catch (error) {
      console.error('Error updating service buttons sidebar:', error);
    }
  },
  // Show service popup on hover
  async showServicePopup(event, appName) {
    if (!window.serviceButtons) return;

    const popup = document.getElementById(`service-popup-${appName}`);
    if (!popup) return;

    try {
      // Load services if not already loaded
      if (window.serviceButtons.services.length === 0) {
        await window.serviceButtons.loadServices();
      }

      // Generate buttons HTML
      const buttonsHTML = await window.serviceButtons.generateButtonsHTML(appName);
      const content = popup.querySelector('.service-popup-content');
      if (content) {
        content.innerHTML = buttonsHTML;
      }

      // Show popup
      popup.style.display = 'block';
    } catch (error) {
      console.error('Error showing service popup:', error);
    }
  },
  // Hide service popup
  hideServicePopup() {
    const popups = document.querySelectorAll('.service-popup');
    popups.forEach(popup => {
      popup.style.display = 'none';
    });
  },
});
