"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.applyFontFaces = applyFontFaces;
var _fontDataWeb = require("./font-data.web.js");
var _tokens = require("./tokens.js");
const STYLE_ID = 'bloom-fonts';

/**
 * Inject @font-face rules and font CSS variables onto :root.
 *
 * Web-only. The native counterpart in `apply-font-faces.ts` is a no-op
 * stub — Metro cannot parse `.woff2` imports, so the file split keeps
 * the font payload out of the native bundle entirely. Idempotent: safe to
 * call multiple times; subsequent calls early-return after the
 * `<style id="bloom-fonts">` tag has been mounted. SSR-safe via the
 * `typeof document === 'undefined'` guard.
 *
 * The font URLs come from `./font-data.web`, a generated module that
 * embeds the woff2 bytes as base64 data URLs. Inlining (rather than
 * relying on bundler asset loaders for `.woff2`) means consumers do not
 * have to extend Metro's `assetExts` or add a webpack/Vite asset rule —
 * the published JS is self-contained. See `scripts/generate-font-data.mjs`
 * for the rationale and trade-offs.
 */
function applyFontFaces() {
  if (typeof document === 'undefined') return;
  if (document.getElementById(STYLE_ID)) return;
  const style = document.createElement('style');
  style.id = STYLE_ID;
  style.textContent = `
    @font-face { font-family: 'BlomusModernus'; src: url(${_fontDataWeb.blomusModernusRegular}) format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
    @font-face { font-family: 'BlomusModernus'; src: url(${_fontDataWeb.blomusModernusBold}) format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
    @font-face { font-family: 'Inter'; src: url(${_fontDataWeb.interVariable}) format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
    @font-face { font-family: 'Geist Mono'; src: url(${_fontDataWeb.geistMonoVariable}) format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
    :root {
      --bloom-font-display: ${_tokens.fontFamilies.display};
      --bloom-font-sans: ${_tokens.fontFamilies.sans};
      --bloom-font-mono: ${_tokens.fontFamilies.mono};
    }
  `;
  document.head.appendChild(style);
}
//# sourceMappingURL=apply-font-faces.web.js.map