/**
 * Parses the `embed` value out of a hash query string (the part after `?` in
 * `window.location.hash`).
 *
 * Returns:
 *  - `'va'`  when `embed=va` (SAS Visual Analytics data-driven content mode)
 *  - `false` when `embed=false`, or when the param is absent
 *  - `true`  for any other non-empty value (legacy boolean embed)
 *
 * `'va'` is intentionally truthy so existing `!embed` chrome checks keep hiding
 * the header/back/subnav exactly as they do for `embed=true`.
 */
export function parseEmbedParam(hashQuery: string): boolean | 'va' {
  if (!hashQuery) return false

  const embedParam = new URLSearchParams(hashQuery).get('embed')
  if (embedParam === null) return false

  if (embedParam === 'va') return 'va'

  return embedParam !== 'false'
}
