//#region src/fts/safe-headline.ts
/** Sentinels for `ts_headline` — swapped to `<mark>` only after HTML escape. */
const HEADLINE_START_SEL = "⟦";
const HEADLINE_STOP_SEL = "⟧";
/** Options object for Postgres `ts_headline` matching the sentinel pair. */
const HEADLINE_OPTS = {
	StartSel: "⟦",
	StopSel: "⟧"
};
function escapeHtml(fragment) {
	return fragment.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
}
/**
* XSS-safe `ts_headline` HTML: escape first, then swap sentinels to `<mark>`.
*/
function buildSafeHeadlineHtml(fragment) {
	return escapeHtml(fragment).replaceAll("⟦", "<mark>").replaceAll("⟧", "</mark>");
}
//#endregion
export { HEADLINE_OPTS, HEADLINE_START_SEL, HEADLINE_STOP_SEL, buildSafeHeadlineHtml };
