import { jsx } from "react/jsx-runtime";
import { useMemo, memo } from "react";
import { useCacheData } from "../../hooks/use-cache-data";
import { pageToRootDocument } from "../../../../client";
import { Page as PageComponent } from "./Page";
import { useRegisterDocument } from "../../hooks/use-register-document";
import { ActivityOrFallback } from "../activity-with-fallback";
const Page = memo(
  ({
    snapshot,
    metadata = true
  }) => {
    useCacheData(snapshot.cacheData);
    const rootDocument = useMemo(() => pageToRootDocument(snapshot.document), [snapshot.document]);
    useRegisterDocument(rootDocument);
    return /* @__PURE__ */ jsx(ActivityOrFallback, { children: /* @__PURE__ */ jsx(
      PageComponent,
      {
        page: snapshot.document,
        rootDocument,
        metadata
      },
      snapshot.document.data.key
    ) });
  }
);
export {
  Page
};
//# sourceMappingURL=index.js.map