"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useAuthor = useAuthor;
const livestream_store_1 = require("../livestream-store");
const player_store_1 = require("../player-store");
const video_store_1 = require("../video-store");
// Surfaces the profile of whoever created what the player is currently
// showing — the streamer in live mode, the uploader in vod mode — switching
// on the player's mode. Like useTitle, this keeps player UI generic:
// `const author = useAuthor()` works the same in live and vod contexts.
//
// Reads from the *optional* store hooks so it's safe to call even when only
// one of the providers (LivestreamProvider / VideoProvider) is mounted.
// Returns null until the relevant metadata has loaded.
function useAuthor() {
    const mode = (0, player_store_1.usePlayerStore)((x) => x.mode);
    const liveProfile = (0, livestream_store_1.useLivestreamStoreOptional)((x) => x.profile);
    const vodAuthor = (0, video_store_1.useVideoStoreOptional)((x) => x.video?.author ?? null);
    return mode === "vod" ? vodAuthor : liveProfile;
}
//# sourceMappingURL=useAuthor.js.map