import { useEffect, useState, type CSSProperties } 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,
useInteractionState,
} from '@embedpdf/react/interaction';
import { AnnotationLayer, annotationPlugin } from '@embedpdf/react/annotation';
import { localEngine } from '@embedpdf/engine';
import './ghost.css';
const engine = localEngine();
// A preview for the rectangle (off by default for tools you drag), and a fainter one for notes.
const plugins = [
stagePlugin(),
renderPlugin(),
interactionPlugin(),
annotationPlugin({
tools: [
{ id: 'square', ghost: true },
{ id: 'note', ghost: { opacity: 0.3 } },
],
}),
];
const sketch = async (): Promise