import { useEffect, useRef } from "react";
// Global hardware-scanner capture (HID "keyboard wedge"). A barcode/QR scanner types
// the code as a fast keystroke burst followed by Enter — like a keyboard, but far
// faster than a human. This hook listens at the DOCUMENT level so a scan fires the
// callback no matter what's focused (or if nothing is), unlike a single that
// only catches scans while it holds focus. See wiki/concepts/booth-console.md.
//
// It does NOT hijack manual typing: keystrokes into an /