While using pdfjs in frameworks with SSR like Next.js or Gatsby there is an error while build phase
```ReferenceError: window is not defined```

The error occurs at line 563 in `ui_utils.js`

Looks like all changes needs is:
```diff
const animationStarted = new Promise(function (resolve) {
  if (
    typeof PDFJSDev !== "undefined" &&
-   PDFJSDev.test("LIB && TESTING") &&
+   PDFJSDev.test("LIB && TESTING") ||
    typeof window === "undefined"
  ) {
    // Prevent "ReferenceError: window is not defined" errors when running the
    // unit-tests in Node.js/Travis.
    setTimeout(resolve, 20);
    return;
  }
  window.requestAnimationFrame(resolve);
});
```

There is an issue in react-pdf: https://github.com/wojtekmaj/react-pdf/issues/657
}
  const first = visible[0],
    last = visible[visible.length - 1];
  if (sortByVisibility) {
    visible.sort(function (a, b) {
      const pc = a.percent - b.percent;
      if (Math.abs(pc) > 0.001) {
        return -pc;
      }
      return a.id - b.id; 
    });
  }
  return { first, last, views: visible };
}
/**
 * Event handler to suppress context menu.
 */
function noContextMenuHandler(evt) {
  evt.preventDefault();
}
function normalizeWheelEventDirection(evt) {
  let delta = Math.hypot(evt.deltaX, evt.deltaY);
  const angle = Math.atan2(evt.deltaY, evt.deltaX);
  if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {
    
    delta = -delta;
  }
  return delta;
}
function normalizeWheelEventDelta(evt) {