/**
 * Runtime shim for compiled MDX previews.
 *
 * Every compiled document imports exactly this module and nothing else. It is
 * served unhashed from the public directory on purpose: compiled documents are
 * cached on disk across app builds, so a hashed specifier baked into a cached
 * module would 404 after the next release.
 *
 * The host page publishes its own React on `globalThis` before importing a
 * document, so the document and the page share one React instance rather than
 * loading a second copy.
 */
const runtime = globalThis.__P4_MDX_RUNTIME__;

if (!runtime) {
  throw new Error("The MDX preview runtime was not initialised by the host page.");
}

export const Fragment = runtime.Fragment;
export const jsx = runtime.jsx;
export const jsxs = runtime.jsxs;
export const jsxDEV = runtime.jsxDEV ?? runtime.jsx;
export const useMDXComponents = runtime.useMDXComponents;
