import { useEffect, useRef } from 'react';
import { Viewer, DocumentGate, DocumentScope, useDocumentsState } from '@embedpdf/react/runtime';
import type { OpenInput } from '@embedpdf/react/runtime';
import { Stage, stagePlugin } from '@embedpdf/react/stage';
import { RenderLayer, renderPlugin } from '@embedpdf/react/render';
import {
useViewManager,
useViewManagerState,
viewManagerPlugin,
type PaneInfo,
} from '@embedpdf/react/view-manager';
import { localEngine } from '@embedpdf/engine';
import './panes.css';
const engine = localEngine();
const plugins = [stagePlugin(), renderPlugin(), viewManagerPlugin()];
// [!doc-source welcome]
const welcome = async (): Promise
No document in this pane.
)} ); } function Panes() { const views = useViewManager(); const { panes } = useViewManagerState(); // On load, both documents land in the first pane: put the second one beside it, once. const splitOnLoad = useRef(true); useEffect(() => { if (splitOnLoad.current && panes.length === 1 && panes[0].documentIds.length === 2) { splitOnLoad.current = false; views.splitPane(panes[0].documentIds[1]); } }, [panes, views]); return (