import { useState } 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 } from '@embedpdf/react/interaction';
import { actionsPlugin } from '@embedpdf/react/actions';
import {
FormLayer,
formPlugin,
toFieldRef,
useFormEvent,
useFormValue,
} from '@embedpdf/react/form';
import { localEngine } from '@embedpdf/engine';
import './scripts.css';
const engine = localEngine();
// The form's scripts run with JavaScript on in the actions plugin.
const plugins = [
stagePlugin(),
renderPlugin(),
interactionPlugin(),
formPlugin(),
actionsPlugin({ javascript: { enabled: true } }),
];
const invoice = async (): Promise