/** * Mermaid diagram enhancement for markdown surfaces: lazily loads the * mermaid runtime from the host vendor route (same origin, no CDN), renders * every fenced ```mermaid code block in place, and re-renders on theme * flips. Framework-free so both the preview panel (React effect) and the * chat transcript observer can drive it over disjoint DOM scopes. * * Failure policy: any load/render failure leaves the original code block * untouched (or restores it verbatim); nothing here throws to the caller. * @module dsh-aionui-panel/client/preview/mermaid */ /** Minimal structural type of the mermaid runtime this module consumes. */ interface MermaidRuntime { initialize: (config: Record) => void; render: (id: string, text: string, container?: HTMLElement) => Promise<{ svg: string; }>; } /** Host-served mermaid IIFE bundle (lib/assets/mermaid.min.js behind the route). */ export declare const MERMAID_VENDOR_URL = "/aionui-panel/vendor/mermaid.js"; /** Marker the preview viewer stamps on its own subtree (chat enhancement skips it). */ export declare const DATA_MD_SCOPE = "data-aionui-md-scope"; /** * Load the mermaid runtime once per page: injects a