export type DesktopOS = 'mac' | 'win' | 'other';

export function detectDesktopOS(): DesktopOS {
  if (typeof navigator === 'undefined') {
    return 'other';
  }

  const platform = navigator.platform ?? '';
  const ua = navigator.userAgent;

  if (/Mac|iPhone|iPad|iPod/.test(platform) || /Macintosh/.test(ua)) {
    return 'mac';
  }

  if (/Win/.test(platform) || /Windows/.test(ua)) {
    return 'win';
  }

  return 'other';
}
