Since #12241 we have notifications for this when the user navigates away from the viewer, but we do not yet warn when switching documents, which means that if you call e.g. `PDFViewerApplication.open` with a new document (or directly call `BaseViewer.setDocument` when using the viewer components standalone) there won't be any warning about losing form data. This should be addressed.
const appConfig = PDFViewerApplication.appConfig;
  return loadScript(appConfig.debuggerScriptPath).then(function () {
    PDFBug.enable(enabledTabs);
    PDFBug.init({ OPS }, appConfig.mainContainer);
  });
}
function reportPageStatsPDFBug({ pageNumber }) {
  if (typeof Stats === "undefined" || !Stats.enabled) {
    return;
  }
  const pageView = PDFViewerApplication.pdfViewer.getPageView(
     pageNumber - 1
  );
  const pageStats = pageView?.pdfPage?.stats;
  if (!pageStats) {
    return;
  }
  Stats.add(pageNumber, pageStats);
}
function webViewerInitialized() {
  const appConfig = PDFViewerApplication.appConfig;
  let file;
  if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
    const queryString = document.location.search.substring(1);
    const params = parseQueryString(queryString);