export function resolveServiceImageUrl(value: string | null | undefined): string | null {
  if (!value) return null;
  const trimmed = value.trim();
  if (!trimmed) return null;
  if (trimmed.startsWith("/objects/")) return `/api/storage${trimmed}`;
  if (/^https?:\/\//i.test(trimmed)) return trimmed;
  // Treat as a path relative to the frontend's base (e.g. files in /public).
  const base = import.meta.env.BASE_URL ?? "/";
  const cleaned = trimmed.replace(/^\/+/, "");
  return `${base}${cleaned}`;
}
