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 { interactionPlugin, useInteraction } from '@embedpdf/react/interaction';
import {
AnnotationLayer,
annotationPlugin,
useAnnotation,
useAnnotationDefaults,
useAnnotationEvent,
} from '@embedpdf/react/annotation';
import { localEngine } from '@embedpdf/engine';
import './tool-defaults.css';
const engine = localEngine();
// The pen starts with what the reader picked last time: see RememberDefaults below.
const plugins = [
stagePlugin(),
renderPlugin(),
interactionPlugin(),
annotationPlugin({
tools: [{ id: 'ink', defaults: JSON.parse(localStorage.getItem('tool:ink') ?? '{}') }],
}),
];
const sketch = async (): Promise