/**
* Seed → QR code element (SVG via qrcode-generator, ~5 KB dep). The QR
* payload is the bare 43-char base64url seed — exactly what the import
* textarea and the camera scanner expect on the other device.
*/
import qrcode from "qrcode-generator";
import { h } from "./ui-kit";
/** White-padded scannable QR block for the given text. */
export function qrElement(text: string, testid?: string): HTMLElement {
const qr = qrcode(0, "M");
qr.addData(text);
qr.make();
const wrap = h("div", { class: "qr-box", "aria-hidden": "true", "data-testid": testid });
// createSvgTag output is fully generated from our own data (no user HTML)
wrap.innerHTML = qr.createSvgTag({ cellSize: 4, margin: 2, scalable: true });
return wrap;
}