import { page } from "$app/state"; import { getAuth } from "$lib/auth.svelte"; export interface Reporting { readonly labelerDid: string; canReport(authorDid: string): boolean; } export const createReporting = (labelerDid?: () => string | undefined): Reporting => { const auth = getAuth(); const labeler = $derived( labelerDid?.() ?? (page.data.publicConfig?.moderationServiceDid as string | undefined) ?? "" ); return { get labelerDid() { return labeler; }, canReport: (authorDid: string) => Boolean(labeler) && Boolean(auth?.currentDid) && !auth.hasAccount(authorDid) }; };