/**
* Popover API & HTMLDialogElement polyfills for jsdom.
*
* jsdom does not implement the Popover API or the HTMLDialogElement methods
* (showModal, show, close). This polyfill provides faithful implementations,
* including timing semantics validated against Chromium via Playwright.
*
* Behaviour:
* - beforetoggle: sync, cancelable on popover show only. toggle: async task, never cancelable.
* - Rapid show/hide coalesces into one toggle event (originalOldState to finalNewState).
* - Dialog: showModal/show fire beforetoggle+toggle. close fires toggle then close event.
* - Popover open state tracked via `data-popover-open` (no `:popover-open` in jsdom).
* - Auto popovers: maintain an open stack, perform light-dismiss on document mousedown
* outside the open chain, and dismiss the topmost on Escape.
* - On open, removes any inline `opacity: 0` from the popover element so callers that
* rely on a `ResizeObserver` reveal callback (e.g. `use-anchor-position`) become
* visible in jsdom, where layout-driven RO callbacks never fire.
*
* Companion `toBeVisible` patch lives at `./to-be-visible`.
*
* Importing this module has the side-effect of patching the relevant
* prototypes. It is safe to import multiple times; each branch is guarded
* to avoid overwriting native implementations or re-patching.
*/
export {};