import { mapLoader } from "./data_loaders.js";
import { random } from "./random_utils.js";
import { resolve } from "./string_utils.js";
const BOOK_TITLES = await mapLoader("books.data", ";");
/*
Marked for Ruin
{Sea|Grace} and the {Heart|Tomb|Serpent}
Throne and the Lily
Stars and the Princess
{The Shadow|The Lurker|The Phantom} in the {Forest|Castle|Mist}
The Shadows in the Forest
The Shadow in the Picture
The Groom in the Dark City
The Gold in the Marsh
{Tried} for {The State}
{Zenith|Equinox|Master|Mistress|Dawn} of {Mercury|Venus|Jupiter|Hyperion|Andromeda}
The Lightning Veil
Twenty and Eligible
How to Win a Prince
Mists
Lure the Devil
Steel Abyss
Abyss/Nebula
Atomic Chaos
*/
const KEYS = [];
for (const key of BOOK_TITLES.keys()) {
KEYS.push(key);
}
export function getBookGenres() {
return KEYS;
}
/**
* Generates a random fictional book title, optionally filtered by genre.
*
* @param {Object} [options={}] - Book title creation options
* @param {string} [options.genre] - Genre of book to generate, selected from the values returned by
* `getBookGenres()`. If not provided, a genre is randomly selected.
* @returns {string} A generated book title
*/
export function createBookTitle({ genre = random(getBookGenres()) } = {}) {
return resolve(BOOK_TITLES.get(genre));
}