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 [x1, y1, x2, y2] = view;
  
  const changeOrientation = rotate % 180 !== 0;
  const width = ((x2 - x1) / 72) * userUnit;
  const height = ((y2 - y1) / 72) * userUnit;
  return {
    width: changeOrientation ? height : width,
    height: changeOrientation ? width : height,
  };
}
/**
 * Helper function for getVisibleElements.
 *
 * @param {number} index - initial guess at the first visible element
 * @param {Array} views - array of pages, into which `index` is an index
 * @param {number} top - the top of the scroll pane
 * @returns {number} less than or equal to `index` that is definitely at or
 *   before the first visible element in `views`, but not by too much. (Usually,
 *   this will be the first element in the first partially visible row in
 *   `views`, although sometimes it goes back one row further.)
 */
function backtrackBeforeAllVisibleElements(index, views, top) {