globalThis.process ??= {};
globalThis.process.env ??= {};
import { _ as count, y as list } from "./db_BQ9NAt8x.mjs";
import { o as safeAuthorUrl } from "./comments_Drdrk1x-.mjs";
/** F1/F2 — safe author label + optional http(s) href; email never exposed. */
function guestAuthorParts(author) {
	if (author.kind === "user") return {
		label: "Member",
		href: null
	};
	return {
		label: author.name,
		href: author.url ? safeAuthorUrl(author.url) : null
	};
}
function commentIndentStyle(depth) {
	const capped = Math.min(depth, 5);
	return capped > 0 ? `margin-inline-start: ${capped * 1.5}rem` : "";
}
async function loadPublicComments(db, target) {
	const [total, page] = await Promise.all([count(db, target), list(db, target, {
		order: "oldest",
		limit: 100
	}, void 0)]);
	return {
		total,
		comments: page.items
	};
}
//#endregion
export { guestAuthorParts as n, loadPublicComments as r, commentIndentStyle as t };
