import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const root = join(dirname(fileURLToPath(import.meta.url)), "..", "node_modules", "@phosphor-icons", "core", "assets");
const cache = new Map();
export function icon(name, weight = "regular") {
const key = `${weight}/${name}`;
if (!cache.has(key)) {
const file = weight === "regular" ? `${name}.svg` : `${name}-${weight}.svg`;
const svg = readFileSync(join(root, weight, file), "utf8")
.replace("<svg ", '<svg aria-hidden="true" focusable="false" ');
cache.set(key, svg);
}
return cache.get(key);
}