/**
 * Shared bridge for scheduling fsLightbox refresh calls without global window APIs.
 */
let refreshPending = false;

export const requestFsLightboxRefresh = () => {
  if (typeof window.refreshFsLightbox === 'function') {
    window.refreshFsLightbox();
    refreshPending = false;
    return true;
  }
  refreshPending = true;
  return false;
};

export const flushPendingFsLightboxRefresh = () => {
  if (!refreshPending) {
    return false;
  }
  return requestFsLightboxRefresh();
};
