// Settings live at `#settings`, and a single section can be linked directly:
// `#settings/app`. Every reader of the hash goes through here, so the three
// places in App.vue that route on it cannot drift apart — an unparsed
// `#settings/app` would be taken for a session id and loaded as one.
const SETTINGS_HASH = /^#settings(?:\/([A-Za-z0-9_-]+))?$/
export function isSettingsHash(hash) {
return SETTINGS_HASH.test(hash || '')
}
/** The tab id in the hash, or null when the hash names no section. */
export function settingsTabFromHash(hash) {
return SETTINGS_HASH.exec(hash || '')?.[1] ?? null
}
export function settingsHash(tab) {
return tab ? `#settings/${tab}` : '#settings'
}