/**
 * Parses the `labels` value out of a hash query string (the part after `?` in
 * `window.location.hash`).
 *
 * Returns `true` for any non-`'false'` value (e.g. `labels=true`, `labels=1`),
 * and `false` when `labels=false`, or when the param is absent.
 *
 * Modeled on `parseEmbedParam` — coexists with `embed` and other params.
 */
export function parseLabelsParam(hashQuery: string): boolean {
  if (!hashQuery) return false

  const labelsParam = new URLSearchParams(hashQuery).get('labels')

  if (labelsParam === null) return false

  return labelsParam !== 'false'
}
