/**
 * Browser-tab favicon helpers for the admin SPA.
 *
 * The admin runs as a client app, so the favicon shown in the browser tab is
 * whatever `<link rel="icon">` the document currently has. The Settings →
 * Appearance favicon (stored in the CMS) is the source of truth, so the admin
 * applies it at runtime instead of relying on the host app's `<head>` wiring.
 */
/**
 * Window event the admin dispatches after the brand (logo/favicon) is saved so
 * live surfaces — the browser tab favicon — refresh without a full reload.
 */
export const BRAND_UPDATED_EVENT = 'actuate:brand-updated';
/**
 * Point the browser tab favicon at `href`, creating the `<link rel="icon">` when
 * the document doesn't already have one. Returns enough state for the caller to
 * restore/remove it on cleanup. Client-only — call inside an effect.
 */
export function setDocumentFavicon(href, type) {
    const existing = document.querySelector('link[rel="icon"]');
    if (existing) {
        const previousHref = existing.href || null;
        existing.href = href;
        existing.sizes = '32x32';
        if (type)
            existing.type = type;
        return { link: existing, created: false, previousHref };
    }
    const link = document.createElement('link');
    link.rel = 'icon';
    link.href = href;
    link.sizes = '32x32';
    if (type)
        link.type = type;
    document.head.appendChild(link);
    return { link, created: true, previousHref: null };
}
//# sourceMappingURL=favicon.js.map