import { useEffect } from 'react';
import { Viewer, DocumentGate } 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 { SearchLayer, searchPlugin, useSearch, useSearchState } from '@embedpdf/react/search';
import { Anchored } from '@embedpdf/react/anchored';
import { cloudEngine } from '@cloudpdf/engine';
import './overlay.css';
const engine = cloudEngine();
const plugins = [stagePlugin(), renderPlugin(), searchPlugin()];
const welcome: OpenInput = { kind: 'grant', grant: 'shr_gvpJcG1ULUMon19C0D1wODSY' };
// A button below the active match: it follows the match while you scroll and zoom.
function NextMatch() {
const search = useSearch();
const { activeHit, activeHitIndex, hitCount } = useSearchState();
return (