import { characterEntitiesLegacy as e } from "../../../character-entities-legacy/index.js";
import { characterEntitiesHtml4 as t } from "../../../character-entities-html4/index.js";
import { dangerous as n } from "../constant/dangerous.js";
//#region ../../node_modules/stringify-entities/lib/util/to-named.js
var r = {}.hasOwnProperty, i = {}, a;
for (a in t) r.call(t, a) && (i[t[a]] = a);
var o = /[^\dA-Za-z]/;
function s(t, a, s, c) {
	let l = String.fromCharCode(t);
	if (r.call(i, l)) {
		let t = i[l], r = "&" + t;
		return s && e.includes(t) && !n.includes(t) && (!c || a && a !== 61 && o.test(String.fromCharCode(a))) ? r : r + ";";
	}
	return "";
}
//#endregion
export { s as toNamed };
