[epiphany/mcatanzaro/pdfjs-2.12.313] Update to PDF.js 2.12.313




commit 84fa68572ec79e446266970e1fffe0ed5899623e
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Thu Jan 6 19:06:05 2022 -0600

    Update to PDF.js 2.12.313

 third-party/pdfjs/README.epiphany.md               |    7 +-
 third-party/pdfjs/build/pdf.js                     | 1991 ++++++++++-------
 third-party/pdfjs/build/pdf.sandbox.js             |    6 +-
 third-party/pdfjs/build/pdf.worker.js              | 1608 ++++++++++----
 third-party/pdfjs/epiphany-pdfjs-changes.patch     |   27 +-
 third-party/pdfjs/pdfjs.gresource.xml              |    3 +
 third-party/pdfjs/web/debugger.js                  |   16 +-
 .../images/secondaryToolbarButton-scrollPage.svg   |    1 +
 third-party/pdfjs/web/locale/be/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/cs/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/cy/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/da/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/de/viewer.properties  |    4 +-
 third-party/pdfjs/web/locale/dsb/viewer.properties |    2 +
 third-party/pdfjs/web/locale/el/viewer.properties  |    2 +
 .../pdfjs/web/locale/en-CA/viewer.properties       |    2 +
 .../pdfjs/web/locale/en-GB/viewer.properties       |    2 +
 .../pdfjs/web/locale/en-US/viewer.properties       |    2 +
 third-party/pdfjs/web/locale/eo/viewer.properties  |    2 +
 .../pdfjs/web/locale/es-AR/viewer.properties       |    2 +
 .../pdfjs/web/locale/es-CL/viewer.properties       |   12 +-
 .../pdfjs/web/locale/es-ES/viewer.properties       |    2 +
 .../pdfjs/web/locale/es-MX/viewer.properties       |    2 +
 third-party/pdfjs/web/locale/et/viewer.properties  |   12 +
 third-party/pdfjs/web/locale/eu/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/fi/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/fr/viewer.properties  |    2 +
 .../pdfjs/web/locale/fy-NL/viewer.properties       |    2 +
 third-party/pdfjs/web/locale/gn/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/he/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/hsb/viewer.properties |    2 +
 third-party/pdfjs/web/locale/hu/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/ia/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/it/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/ja/viewer.properties  |   33 +-
 third-party/pdfjs/web/locale/ka/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/kk/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/ko/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/locale.properties     |    6 +
 third-party/pdfjs/web/locale/lt/viewer.properties  |    2 +
 .../pdfjs/web/locale/nb-NO/viewer.properties       |    2 +
 .../pdfjs/web/locale/ne-NP/viewer.properties       |   41 +
 third-party/pdfjs/web/locale/nl/viewer.properties  |    2 +
 .../pdfjs/web/locale/nn-NO/viewer.properties       |    2 +
 third-party/pdfjs/web/locale/oc/viewer.properties  |    2 +
 .../pdfjs/web/locale/pa-IN/viewer.properties       |    2 +
 third-party/pdfjs/web/locale/pl/viewer.properties  |    2 +
 .../pdfjs/web/locale/pt-BR/viewer.properties       |    2 +
 .../pdfjs/web/locale/pt-PT/viewer.properties       |    2 +
 third-party/pdfjs/web/locale/rm/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/ru/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/sat/viewer.properties |  154 ++
 third-party/pdfjs/web/locale/sc/viewer.properties  |  119 +
 third-party/pdfjs/web/locale/sk/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/sl/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/sq/viewer.properties  |    9 +
 .../pdfjs/web/locale/sv-SE/viewer.properties       |    2 +
 third-party/pdfjs/web/locale/th/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/tr/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/uk/viewer.properties  |    2 +
 third-party/pdfjs/web/locale/vi/viewer.properties  |    4 +-
 .../pdfjs/web/locale/zh-CN/viewer.properties       |    2 +
 .../pdfjs/web/locale/zh-TW/viewer.properties       |    2 +
 third-party/pdfjs/web/viewer.css                   |  100 +-
 third-party/pdfjs/web/viewer.html                  |   21 +-
 third-party/pdfjs/web/viewer.js                    | 2343 ++++++++++----------
 66 files changed, 4098 insertions(+), 2509 deletions(-)
---
diff --git a/third-party/pdfjs/README.epiphany.md b/third-party/pdfjs/README.epiphany.md
index 70be46998..4da667dad 100644
--- a/third-party/pdfjs/README.epiphany.md
+++ b/third-party/pdfjs/README.epiphany.md
@@ -6,9 +6,10 @@ This directory contains an official pdf.js release version, distributed at: http
 1. Delete existing files except epiphany-pdfjs-changes.patch, pdfjs_generate_resource.py, and 
README.epiphany.md.
 2. Grab a new official release (*-dist.zip) distributed at github and extract everything into this directory.
 3. Delete precompiled .map files (viewer.js.map, pdf.js.map, pdf.worker.js.map, pdf.sandbox.js.map).
-4. Manually merge changes from epiphany-pdfjs-changes.patch into web/viewer.[html/js/css].
-5. Recreate epiphany-pdfjs-changes.patch.
-6. Recreate the resource xml file with `./pdfjs_generate_resource.py`
+4. Create WIP git commit to help with updating our patch in step 6.
+5. Manually merge changes from epiphany-pdfjs-changes.patch into web/viewer.[html/js/css].
+6. Recreate epiphany-pdfjs-changes.patch: `git diff > tmp && mv tmp epiphany-pdfjs-changes.patch`
+7. Recreate the resource xml file with `./pdfjs_generate_resource.py`
 
 ## Modifications to viewer.html
 1. In order to circumvent CORS the pdf is downloaded and then embedded into the viewer.html file. Therefore 
the head has an
diff --git a/third-party/pdfjs/build/pdf.js b/third-party/pdfjs/build/pdf.js
index cdf8a707f..43168287f 100644
--- a/third-party/pdfjs/build/pdf.js
+++ b/third-party/pdfjs/build/pdf.js
@@ -42,6 +42,7 @@ return /******/ (() => { // webpackBootstrap
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.StatTimer = exports.RenderingCancelledException = exports.PixelsPerInch = exports.PageViewport = 
exports.PDFDateString = exports.LinkTarget = exports.DOMStandardFontDataFactory = exports.DOMSVGFactory = 
exports.DOMCanvasFactory = exports.DOMCMapReaderFactory = void 0;
 exports.addLinkAttributes = addLinkAttributes;
 exports.deprecated = deprecated;
 exports.getFilenameFromUrl = getFilenameFromUrl;
@@ -51,7 +52,6 @@ exports.isDataScheme = isDataScheme;
 exports.isPdfFile = isPdfFile;
 exports.isValidFetchUrl = isValidFetchUrl;
 exports.loadScript = loadScript;
-exports.StatTimer = exports.RenderingCancelledException = exports.PixelsPerInch = exports.PDFDateString = 
exports.PageViewport = exports.LinkTarget = exports.DOMSVGFactory = exports.DOMStandardFontDataFactory = 
exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
@@ -563,6 +563,7 @@ function getXfaPageViewport(xfaPage, {
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException 
= exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag 
= exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = 
exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.IsLittleEndianCached = 
exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = 
exports.FormatError = exports.FontType = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = 
exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = 
exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = 
exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag 
= exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortExce
 ption = void 0;
 exports.arrayByteLength = arrayByteLength;
 exports.arraysToBytes = arraysToBytes;
 exports.assert = assert;
@@ -594,7 +595,6 @@ exports.stringToUTF8String = stringToUTF8String;
 exports.unreachable = unreachable;
 exports.utf8StringToString = utf8StringToString;
 exports.warn = warn;
-exports.VerbosityLevel = exports.Util = exports.UNSUPPORTED_FEATURES = exports.UnknownErrorException = 
exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = 
exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException 
= exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.IsLittleEndianCached = 
exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = 
exports.FormatError = exports.FontType = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = 
exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = 
exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = 
exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag 
= exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortExce
 ption = void 0;
 
 __w_pdfjs_require__(3);
 
@@ -1131,14 +1131,19 @@ class AbortException extends BaseException {
 }
 
 exports.AbortException = AbortException;
-const NullCharactersRegExp = /\x00/g;
+const NullCharactersRegExp = /\x00+/g;
+const InvisibleCharactersRegExp = /[\x01-\x1F]/g;
 
-function removeNullCharacters(str) {
+function removeNullCharacters(str, replaceInvisible = false) {
   if (typeof str !== "string") {
     warn("The argument for removeNullCharacters must be a string.");
     return str;
   }
 
+  if (replaceInvisible) {
+    str = str.replace(InvisibleCharactersRegExp, " ");
+  }
+
   return str.replace(NullCharactersRegExp, "");
 }
 
@@ -1365,6 +1370,75 @@ class Util {
     return result;
   }
 
+  static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
+    const tvalues = [],
+          bounds = [[], []];
+    let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
+
+    for (let i = 0; i < 2; ++i) {
+      if (i === 0) {
+        b = 6 * x0 - 12 * x1 + 6 * x2;
+        a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
+        c = 3 * x1 - 3 * x0;
+      } else {
+        b = 6 * y0 - 12 * y1 + 6 * y2;
+        a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
+        c = 3 * y1 - 3 * y0;
+      }
+
+      if (Math.abs(a) < 1e-12) {
+        if (Math.abs(b) < 1e-12) {
+          continue;
+        }
+
+        t = -c / b;
+
+        if (0 < t && t < 1) {
+          tvalues.push(t);
+        }
+
+        continue;
+      }
+
+      b2ac = b * b - 4 * c * a;
+      sqrtb2ac = Math.sqrt(b2ac);
+
+      if (b2ac < 0) {
+        continue;
+      }
+
+      t1 = (-b + sqrtb2ac) / (2 * a);
+
+      if (0 < t1 && t1 < 1) {
+        tvalues.push(t1);
+      }
+
+      t2 = (-b - sqrtb2ac) / (2 * a);
+
+      if (0 < t2 && t2 < 1) {
+        tvalues.push(t2);
+      }
+    }
+
+    let j = tvalues.length,
+        mt;
+    const jlen = j;
+
+    while (j--) {
+      t = tvalues[j];
+      mt = 1 - t;
+      bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
+      bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
+    }
+
+    bounds[0][jlen] = x0;
+    bounds[1][jlen] = y0;
+    bounds[0][jlen + 1] = x3;
+    bounds[1][jlen + 1] = y3;
+    bounds[0].length = bounds[1].length = jlen + 2;
+    return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
+  }
+
 }
 
 exports.Util = Util;
@@ -1486,7 +1560,7 @@ function createPromiseCapability() {
 }
 
 function createObjectURL(data, contentType = "", forceDataSchema = false) {
-  if (URL.createObjectURL && !forceDataSchema) {
+  if (URL.createObjectURL && typeof Blob !== "undefined" && !forceDataSchema) {
     return URL.createObjectURL(new Blob([data], {
       type: contentType
     }));
@@ -1541,7 +1615,7 @@ exports.isNodeJS = isNodeJS;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.BaseSVGFactory = exports.BaseStandardFontDataFactory = exports.BaseCMapReaderFactory = 
exports.BaseCanvasFactory = void 0;
+exports.BaseStandardFontDataFactory = exports.BaseSVGFactory = exports.BaseCanvasFactory = 
exports.BaseCMapReaderFactory = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
@@ -1719,9 +1793,10 @@ exports.BaseSVGFactory = BaseSVGFactory;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.build = exports.RenderTask = exports.PDFWorker = exports.PDFPageProxy = exports.PDFDocumentProxy = 
exports.PDFDocumentLoadingTask = exports.PDFDataRangeTransport = exports.LoopbackPort = 
exports.DefaultStandardFontDataFactory = exports.DefaultCanvasFactory = exports.DefaultCMapReaderFactory = 
void 0;
 exports.getDocument = getDocument;
 exports.setPDFNetworkStreamFactory = setPDFNetworkStreamFactory;
-exports.version = exports.RenderTask = exports.PDFWorker = exports.PDFPageProxy = exports.PDFDocumentProxy = 
exports.PDFDocumentLoadingTask = exports.PDFDataRangeTransport = exports.LoopbackPort = 
exports.DefaultStandardFontDataFactory = exports.DefaultCMapReaderFactory = exports.DefaultCanvasFactory = 
exports.build = void 0;
+exports.version = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
@@ -1942,7 +2017,6 @@ function getDocument(src) {
       }
 
       const messageHandler = new _message_handler.MessageHandler(docId, workerId, worker.port);
-      messageHandler.postMessageTransfers = worker.postMessageTransfers;
       const transport = new WorkerTransport(messageHandler, task, networkStream, params);
       task._transport = transport;
       messageHandler.send("Ready", null);
@@ -1965,7 +2039,7 @@ async function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
 
   const workerId = await worker.messageHandler.sendWithPromise("GetDocRequest", {
     docId,
-    apiVersion: '2.11.338',
+    apiVersion: '2.12.313',
     source: {
       data: source.data,
       url: source.url,
@@ -1976,7 +2050,6 @@ async function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
     },
     maxImageSize: source.maxImageSize,
     disableFontFace: source.disableFontFace,
-    postMessageTransfers: worker.postMessageTransfers,
     docBaseUrl: source.docBaseUrl,
     ignoreErrors: source.ignoreErrors,
     isEvalSupported: source.isEvalSupported,
@@ -2116,6 +2189,15 @@ class PDFDocumentProxy {
       }
 
     });
+    Object.defineProperty(this, "getStats", {
+      value: async () => {
+        (0, _display_utils.deprecated)("`PDFDocumentProxy.getStats`, " + "please use the 
`PDFDocumentProxy.stats`-getter instead.");
+        return this.stats || {
+          streamTypes: {},
+          fontTypes: {}
+        };
+      }
+    });
   }
 
   get annotationStorage() {
@@ -2130,6 +2212,10 @@ class PDFDocumentProxy {
     return this._pdfInfo.fingerprints;
   }
 
+  get stats() {
+    return this._transport.stats;
+  }
+
   get isPureXfa() {
     return !!this._transport._htmlForXfa;
   }
@@ -2214,10 +2300,6 @@ class PDFDocumentProxy {
     return this._transport.downloadInfoCapability.promise;
   }
 
-  getStats() {
-    return this._transport.getStats();
-  }
-
   cleanup(keepLoadedFonts = false) {
     return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa);
   }
@@ -2371,7 +2453,8 @@ class PDFPageProxy {
     imageLayer = null,
     canvasFactory = null,
     background = null,
-    optionalContentConfigPromise = null
+    optionalContentConfigPromise = null,
+    annotationCanvasMap = null
   }) {
     if (arguments[0]?.renderInteractiveForms !== undefined) {
       (0, _display_utils.deprecated)("render no longer accepts the `renderInteractiveForms`-option, " + 
"please use the `annotationMode`-option instead.");
@@ -2472,6 +2555,7 @@ class PDFPageProxy {
       },
       objs: this.objs,
       commonObjs: this.commonObjs,
+      annotationCanvasMap,
       operatorList: intentState.operatorList,
       pageIndex: this._pageIndex,
       canvasFactory: canvasFactoryInstance,
@@ -2604,7 +2688,6 @@ class PDFPageProxy {
 
   _destroy() {
     this.destroyed = true;
-    this._transport.pageCache[this._pageIndex] = null;
     const waitOn = [];
 
     for (const intentState of this._intentStates.values()) {
@@ -2824,84 +2907,92 @@ exports.PDFPageProxy = PDFPageProxy;
 class LoopbackPort {
   constructor() {
     this._listeners = [];
-    this._deferred = Promise.resolve(undefined);
+    this._deferred = Promise.resolve();
   }
 
   postMessage(obj, transfers) {
-    function cloneValue(value) {
-      if (typeof value === "function" || typeof value === "symbol" || value instanceof URL) {
-        throw new Error(`LoopbackPort.postMessage - cannot clone: ${value?.toString()}`);
+    function cloneValue(object) {
+      if (globalThis.structuredClone) {
+        return globalThis.structuredClone(object, transfers);
       }
 
-      if (typeof value !== "object" || value === null) {
-        return value;
-      }
+      function fallbackCloneValue(value) {
+        if (typeof value === "function" || typeof value === "symbol" || value instanceof URL) {
+          throw new Error(`LoopbackPort.postMessage - cannot clone: ${value?.toString()}`);
+        }
 
-      if (cloned.has(value)) {
-        return cloned.get(value);
-      }
+        if (typeof value !== "object" || value === null) {
+          return value;
+        }
 
-      let buffer, result;
+        if (cloned.has(value)) {
+          return cloned.get(value);
+        }
 
-      if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
-        if (transfers?.includes(buffer)) {
-          result = new value.constructor(buffer, value.byteOffset, value.byteLength);
-        } else {
-          result = new value.constructor(value);
+        let buffer, result;
+
+        if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
+          if (transfers?.includes(buffer)) {
+            result = new value.constructor(buffer, value.byteOffset, value.byteLength);
+          } else {
+            result = new value.constructor(value);
+          }
+
+          cloned.set(value, result);
+          return result;
         }
 
-        cloned.set(value, result);
-        return result;
-      }
+        if (value instanceof Map) {
+          result = new Map();
+          cloned.set(value, result);
 
-      if (value instanceof Map) {
-        result = new Map();
-        cloned.set(value, result);
+          for (const [key, val] of value) {
+            result.set(key, fallbackCloneValue(val));
+          }
 
-        for (const [key, val] of value) {
-          result.set(key, cloneValue(val));
+          return result;
         }
 
-        return result;
-      }
+        if (value instanceof Set) {
+          result = new Set();
+          cloned.set(value, result);
 
-      if (value instanceof Set) {
-        result = new Set();
-        cloned.set(value, result);
+          for (const val of value) {
+            result.add(fallbackCloneValue(val));
+          }
 
-        for (const val of value) {
-          result.add(cloneValue(val));
+          return result;
         }
 
-        return result;
-      }
+        result = Array.isArray(value) ? [] : Object.create(null);
+        cloned.set(value, result);
 
-      result = Array.isArray(value) ? [] : Object.create(null);
-      cloned.set(value, result);
+        for (const i in value) {
+          let desc,
+              p = value;
 
-      for (const i in value) {
-        let desc,
-            p = value;
+          while (!(desc = Object.getOwnPropertyDescriptor(p, i))) {
+            p = Object.getPrototypeOf(p);
+          }
 
-        while (!(desc = Object.getOwnPropertyDescriptor(p, i))) {
-          p = Object.getPrototypeOf(p);
-        }
+          if (typeof desc.value === "undefined") {
+            continue;
+          }
 
-        if (typeof desc.value === "undefined") {
-          continue;
-        }
+          if (typeof desc.value === "function" && !value.hasOwnProperty?.(i)) {
+            continue;
+          }
 
-        if (typeof desc.value === "function" && !value.hasOwnProperty?.(i)) {
-          continue;
+          result[i] = fallbackCloneValue(desc.value);
         }
 
-        result[i] = cloneValue(desc.value);
+        return result;
       }
 
-      return result;
+      const cloned = new WeakMap();
+      return fallbackCloneValue(object);
     }
 
-    const cloned = new WeakMap();
     const event = {
       data: cloneValue(obj)
     };
@@ -2969,7 +3060,6 @@ class PDFWorker {
 
     this.name = name;
     this.destroyed = false;
-    this.postMessageTransfers = true;
     this.verbosity = verbosity;
     this._readyCapability = (0, _util.createPromiseCapability)();
     this._port = null;
@@ -3052,10 +3142,6 @@ class PDFWorker {
             this._port = worker;
             this._webWorker = worker;
 
-            if (!data.supportTransfers) {
-              this.postMessageTransfers = false;
-            }
-
             this._readyCapability.resolve();
 
             messageHandler.send("configure", {
@@ -3084,7 +3170,7 @@ class PDFWorker {
         });
 
         const sendTest = () => {
-          const testObj = new Uint8Array([this.postMessageTransfers ? 255 : 0]);
+          const testObj = new Uint8Array([255]);
 
           try {
             messageHandler.send("test", testObj, [testObj.buffer]);
@@ -3223,6 +3309,11 @@ exports.PDFWorker = PDFWorker;
 }
 
 class WorkerTransport {
+  #docStats = null;
+  #pageCache = new Map();
+  #pagePromises = new Map();
+  #metadataPromise = null;
+
   constructor(messageHandler, loadingTask, networkStream, params) {
     this.messageHandler = messageHandler;
     this.loadingTask = loadingTask;
@@ -3251,8 +3342,6 @@ class WorkerTransport {
     this._networkStream = networkStream;
     this._fullReader = null;
     this._lastProgress = null;
-    this.pageCache = [];
-    this.pagePromises = [];
     this.downloadInfoCapability = (0, _util.createPromiseCapability)();
     this.setupMessageHandler();
   }
@@ -3261,6 +3350,10 @@ class WorkerTransport {
     return (0, _util.shadow)(this, "annotationStorage", new _annotation_storage.AnnotationStorage());
   }
 
+  get stats() {
+    return this.#docStats;
+  }
+
   getRenderingIntent(intent, annotationMode = _util.AnnotationMode.ENABLE, isOpList = false) {
     let renderingIntent = _util.RenderingIntentFlag.DISPLAY;
     let lastModified = "";
@@ -3326,14 +3419,12 @@ class WorkerTransport {
 
     const waitOn = [];
 
-    for (const page of this.pageCache) {
-      if (page) {
-        waitOn.push(page._destroy());
-      }
+    for (const page of this.#pageCache.values()) {
+      waitOn.push(page._destroy());
     }
 
-    this.pageCache.length = 0;
-    this.pagePromises.length = 0;
+    this.#pageCache.clear();
+    this.#pagePromises.clear();
 
     if (this.hasOwnProperty("annotationStorage")) {
       this.annotationStorage.resetModified();
@@ -3344,6 +3435,7 @@ class WorkerTransport {
     Promise.all(waitOn).then(() => {
       this.commonObjs.clear();
       this.fontLoader.clear();
+      this.#metadataPromise = null;
       this._getFieldObjectsPromise = null;
       this._hasJSActionsPromise = null;
 
@@ -3411,17 +3503,15 @@ class WorkerTransport {
       const fullReader = this._fullReader;
       fullReader.headersReady.then(() => {
         if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) {
-          if (this._lastProgress && loadingTask.onProgress) {
-            loadingTask.onProgress(this._lastProgress);
+          if (this._lastProgress) {
+            loadingTask.onProgress?.(this._lastProgress);
           }
 
           fullReader.onProgress = evt => {
-            if (loadingTask.onProgress) {
-              loadingTask.onProgress({
-                loaded: evt.loaded,
-                total: evt.total
-              });
-            }
+            loadingTask.onProgress?.({
+              loaded: evt.loaded,
+              total: evt.total
+            });
           };
         }
 
@@ -3532,13 +3622,10 @@ class WorkerTransport {
       return this._passwordCapability.promise;
     });
     messageHandler.on("DataLoaded", data => {
-      if (loadingTask.onProgress) {
-        loadingTask.onProgress({
-          loaded: data.length,
-          total: data.length
-        });
-      }
-
+      loadingTask.onProgress?.({
+        loaded: data.length,
+        total: data.length
+      });
       this.downloadInfoCapability.resolve(data);
     });
     messageHandler.on("StartRenderPage", data => {
@@ -3546,17 +3633,15 @@ class WorkerTransport {
         return;
       }
 
-      const page = this.pageCache[data.pageIndex];
+      const page = this.#pageCache.get(data.pageIndex);
 
       page._startRenderPage(data.transparency, data.cacheKey);
     });
-    messageHandler.on("commonobj", data => {
+    messageHandler.on("commonobj", ([id, type, exportedData]) => {
       if (this.destroyed) {
         return;
       }
 
-      const [id, type, exportedData] = data;
-
       if (this.commonObjs.has(id)) {
         return;
       }
@@ -3612,16 +3697,15 @@ class WorkerTransport {
           throw new Error(`Got unknown common object type ${type}`);
       }
     });
-    messageHandler.on("obj", data => {
+    messageHandler.on("obj", ([id, pageIndex, type, imageData]) => {
       if (this.destroyed) {
-        return undefined;
+        return;
       }
 
-      const [id, pageIndex, type, imageData] = data;
-      const pageProxy = this.pageCache[pageIndex];
+      const pageProxy = this.#pageCache.get(pageIndex);
 
       if (pageProxy.objs.has(id)) {
-        return undefined;
+        return;
       }
 
       switch (type) {
@@ -3642,20 +3726,26 @@ class WorkerTransport {
         default:
           throw new Error(`Got unknown object type ${type}`);
       }
-
-      return undefined;
     });
     messageHandler.on("DocProgress", data => {
       if (this.destroyed) {
         return;
       }
 
-      if (loadingTask.onProgress) {
-        loadingTask.onProgress({
-          loaded: data.loaded,
-          total: data.total
-        });
+      loadingTask.onProgress?.({
+        loaded: data.loaded,
+        total: data.total
+      });
+    });
+    messageHandler.on("DocStats", data => {
+      if (this.destroyed) {
+        return;
       }
+
+      this.#docStats = Object.freeze({
+        streamTypes: Object.freeze(data.streamTypes),
+        fontTypes: Object.freeze(data.fontTypes)
+      });
     });
     messageHandler.on("UnsupportedFeature", this._onUnsupportedFeature.bind(this));
     messageHandler.on("FetchBuiltInCMap", data => {
@@ -3689,9 +3779,7 @@ class WorkerTransport {
       return;
     }
 
-    if (this.loadingTask.onUnsupportedFeature) {
-      this.loadingTask.onUnsupportedFeature(featureId);
-    }
+    this.loadingTask.onUnsupportedFeature?.(featureId);
   }
 
   getData() {
@@ -3703,10 +3791,11 @@ class WorkerTransport {
       return Promise.reject(new Error("Invalid page request"));
     }
 
-    const pageIndex = pageNumber - 1;
+    const pageIndex = pageNumber - 1,
+          cachedPromise = this.#pagePromises.get(pageIndex);
 
-    if (pageIndex in this.pagePromises) {
-      return this.pagePromises[pageIndex];
+    if (cachedPromise) {
+      return cachedPromise;
     }
 
     const promise = this.messageHandler.sendWithPromise("GetPage", {
@@ -3717,10 +3806,10 @@ class WorkerTransport {
       }
 
       const page = new PDFPageProxy(pageIndex, pageInfo, this, this._params.ownerDocument, 
this._params.pdfBug);
-      this.pageCache[pageIndex] = page;
+      this.#pageCache.set(pageIndex, page);
       return page;
     });
-    this.pagePromises[pageIndex] = promise;
+    this.#pagePromises.set(pageIndex, promise);
     return promise;
   }
 
@@ -3833,7 +3922,7 @@ class WorkerTransport {
   }
 
   getMetadata() {
-    return this.messageHandler.sendWithPromise("GetMetadata", null).then(results => {
+    return this.#metadataPromise ||= this.messageHandler.sendWithPromise("GetMetadata", null).then(results 
=> {
       return {
         info: results[0],
         metadata: results[1] ? new _metadata.Metadata(results[1]) : null,
@@ -3847,10 +3936,6 @@ class WorkerTransport {
     return this.messageHandler.sendWithPromise("GetMarkInfo", null);
   }
 
-  getStats() {
-    return this.messageHandler.sendWithPromise("GetStats", null);
-  }
-
   async startCleanup(keepLoadedFonts = false) {
     await this.messageHandler.sendWithPromise("Cleanup", null);
 
@@ -3858,17 +3943,11 @@ class WorkerTransport {
       return;
     }
 
-    for (let i = 0, ii = this.pageCache.length; i < ii; i++) {
-      const page = this.pageCache[i];
-
-      if (!page) {
-        continue;
-      }
-
+    for (const page of this.#pageCache.values()) {
       const cleanupSuccessful = page.cleanup();
 
       if (!cleanupSuccessful) {
-        throw new Error(`startCleanup: Page ${i + 1} is currently rendering.`);
+        throw new Error(`startCleanup: Page ${page.pageNumber} is currently rendering.`);
       }
     }
 
@@ -3878,6 +3957,7 @@ class WorkerTransport {
       this.fontLoader.clear();
     }
 
+    this.#metadataPromise = null;
     this._getFieldObjectsPromise = null;
     this._hasJSActionsPromise = null;
   }
@@ -3972,6 +4052,7 @@ class InternalRenderTask {
     params,
     objs,
     commonObjs,
+    annotationCanvasMap,
     operatorList,
     pageIndex,
     canvasFactory,
@@ -3982,6 +4063,7 @@ class InternalRenderTask {
     this.params = params;
     this.objs = objs;
     this.commonObjs = commonObjs;
+    this.annotationCanvasMap = annotationCanvasMap;
     this.operatorListIdx = null;
     this.operatorList = operatorList;
     this._pageIndex = pageIndex;
@@ -4034,7 +4116,7 @@ class InternalRenderTask {
       imageLayer,
       background
     } = this.params;
-    this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, 
imageLayer, optionalContentConfig);
+    this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, 
imageLayer, optionalContentConfig, this.annotationCanvasMap);
     this.gfx.beginDrawing({
       transform,
       viewport,
@@ -4132,9 +4214,9 @@ class InternalRenderTask {
 
 }
 
-const version = '2.11.338';
+const version = '2.12.313';
 exports.version = version;
-const build = 'dedff3c98';
+const build = 'a2ae56f39';
 exports.build = build;
 
 /***/ }),
@@ -4416,8 +4498,7 @@ exports.FontLoader = FontLoader;
       this._document.body.appendChild(div);
 
       isFontReady(loadTestFontId, () => {
-        this._document.body.removeChild(div);
-
+        div.remove();
         request.complete();
       });
     }
@@ -4559,7 +4640,7 @@ exports.FontFaceObject = FontFaceObject;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.NodeStandardFontDataFactory = exports.NodeCMapReaderFactory = exports.NodeCanvasFactory = void 0;
+exports.NodeStandardFontDataFactory = exports.NodeCanvasFactory = exports.NodeCMapReaderFactory = void 0;
 
 var _base_factory = __w_pdfjs_require__(5);
 
@@ -4749,7 +4830,6 @@ var _display_utils = __w_pdfjs_require__(1);
 const MIN_FONT_SIZE = 16;
 const MAX_FONT_SIZE = 100;
 const MAX_GROUP_SIZE = 4096;
-const MAX_CACHED_CANVAS_PATTERNS = 2;
 const EXECUTION_TIME = 15;
 const EXECUTION_STEPS = 10;
 const COMPILE_TYPE3_GLYPHS = true;
@@ -4757,6 +4837,137 @@ const MAX_SIZE_TO_COMPILE = 1000;
 const FULL_CHUNK_HEIGHT = 16;
 const LINEWIDTH_SCALE_FACTOR = 1.000001;
 
+function mirrorContextOperations(ctx, destCtx) {
+  if (ctx._removeMirroring) {
+    throw new Error("Context is already forwarding operations.");
+  }
+
+  ctx.__originalSave = ctx.save;
+  ctx.__originalRestore = ctx.restore;
+  ctx.__originalRotate = ctx.rotate;
+  ctx.__originalScale = ctx.scale;
+  ctx.__originalTranslate = ctx.translate;
+  ctx.__originalTransform = ctx.transform;
+  ctx.__originalSetTransform = ctx.setTransform;
+  ctx.__originalResetTransform = ctx.resetTransform;
+  ctx.__originalClip = ctx.clip;
+  ctx.__originalMoveTo = ctx.moveTo;
+  ctx.__originalLineTo = ctx.lineTo;
+  ctx.__originalBezierCurveTo = ctx.bezierCurveTo;
+  ctx.__originalRect = ctx.rect;
+  ctx.__originalClosePath = ctx.closePath;
+  ctx.__originalBeginPath = ctx.beginPath;
+
+  ctx._removeMirroring = () => {
+    ctx.save = ctx.__originalSave;
+    ctx.restore = ctx.__originalRestore;
+    ctx.rotate = ctx.__originalRotate;
+    ctx.scale = ctx.__originalScale;
+    ctx.translate = ctx.__originalTranslate;
+    ctx.transform = ctx.__originalTransform;
+    ctx.setTransform = ctx.__originalSetTransform;
+    ctx.resetTransform = ctx.__originalResetTransform;
+    ctx.clip = ctx.__originalClip;
+    ctx.moveTo = ctx.__originalMoveTo;
+    ctx.lineTo = ctx.__originalLineTo;
+    ctx.bezierCurveTo = ctx.__originalBezierCurveTo;
+    ctx.rect = ctx.__originalRect;
+    ctx.closePath = ctx.__originalClosePath;
+    ctx.beginPath = ctx.__originalBeginPath;
+    delete ctx._removeMirroring;
+  };
+
+  ctx.save = function ctxSave() {
+    destCtx.save();
+
+    this.__originalSave();
+  };
+
+  ctx.restore = function ctxRestore() {
+    destCtx.restore();
+
+    this.__originalRestore();
+  };
+
+  ctx.translate = function ctxTranslate(x, y) {
+    destCtx.translate(x, y);
+
+    this.__originalTranslate(x, y);
+  };
+
+  ctx.scale = function ctxScale(x, y) {
+    destCtx.scale(x, y);
+
+    this.__originalScale(x, y);
+  };
+
+  ctx.transform = function ctxTransform(a, b, c, d, e, f) {
+    destCtx.transform(a, b, c, d, e, f);
+
+    this.__originalTransform(a, b, c, d, e, f);
+  };
+
+  ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {
+    destCtx.setTransform(a, b, c, d, e, f);
+
+    this.__originalSetTransform(a, b, c, d, e, f);
+  };
+
+  ctx.resetTransform = function ctxResetTransform() {
+    destCtx.resetTransform();
+
+    this.__originalResetTransform();
+  };
+
+  ctx.rotate = function ctxRotate(angle) {
+    destCtx.rotate(angle);
+
+    this.__originalRotate(angle);
+  };
+
+  ctx.clip = function ctxRotate(rule) {
+    destCtx.clip(rule);
+
+    this.__originalClip(rule);
+  };
+
+  ctx.moveTo = function (x, y) {
+    destCtx.moveTo(x, y);
+
+    this.__originalMoveTo(x, y);
+  };
+
+  ctx.lineTo = function (x, y) {
+    destCtx.lineTo(x, y);
+
+    this.__originalLineTo(x, y);
+  };
+
+  ctx.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {
+    destCtx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
+
+    this.__originalBezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
+  };
+
+  ctx.rect = function (x, y, width, height) {
+    destCtx.rect(x, y, width, height);
+
+    this.__originalRect(x, y, width, height);
+  };
+
+  ctx.closePath = function () {
+    destCtx.closePath();
+
+    this.__originalClosePath();
+  };
+
+  ctx.beginPath = function () {
+    destCtx.beginPath();
+
+    this.__originalBeginPath();
+  };
+}
+
 function addContextCurrentTransform(ctx) {
   if (ctx.mozCurrentTransform) {
     return;
@@ -4903,46 +5114,6 @@ class CachedCanvases {
 
 }
 
-class LRUCache {
-  constructor(maxSize = 0) {
-    this._cache = new Map();
-    this._maxSize = maxSize;
-  }
-
-  has(key) {
-    return this._cache.has(key);
-  }
-
-  get(key) {
-    if (this._cache.has(key)) {
-      const value = this._cache.get(key);
-
-      this._cache.delete(key);
-
-      this._cache.set(key, value);
-    }
-
-    return this._cache.get(key);
-  }
-
-  set(key, value) {
-    if (this._maxSize <= 0) {
-      return;
-    }
-
-    if (this._cache.size + 1 > this._maxSize) {
-      this._cache.delete(this._cache.keys().next().value);
-    }
-
-    this._cache.set(key, value);
-  }
-
-  clear() {
-    this._cache.clear();
-  }
-
-}
-
 function compileType3Glyph(imgData) {
   const POINT_TO_PROCESS_LIMIT = 1000;
   const POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);
@@ -5117,7 +5288,7 @@ function compileType3Glyph(imgData) {
 }
 
 class CanvasExtraState {
-  constructor() {
+  constructor(width, height) {
     this.alphaIsShape = false;
     this.fontSize = 0;
     this.fontSizeScale = 1;
@@ -5141,12 +5312,14 @@ class CanvasExtraState {
     this.strokeAlpha = 1;
     this.lineWidth = 1;
     this.activeSMask = null;
-    this.resumeSMaskCtx = null;
     this.transferMaps = null;
+    this.startNewPathAndClipBox([0, 0, width, height]);
   }
 
   clone() {
-    return Object.create(this);
+    const clone = Object.create(this);
+    clone.clipBox = this.clipBox.slice();
+    return clone;
   }
 
   setCurrentPoint(x, y) {
@@ -5154,6 +5327,60 @@ class CanvasExtraState {
     this.y = y;
   }
 
+  updatePathMinMax(transform, x, y) {
+    [x, y] = _util.Util.applyTransform([x, y], transform);
+    this.minX = Math.min(this.minX, x);
+    this.minY = Math.min(this.minY, y);
+    this.maxX = Math.max(this.maxX, x);
+    this.maxY = Math.max(this.maxY, y);
+  }
+
+  updateCurvePathMinMax(transform, x0, y0, x1, y1, x2, y2, x3, y3) {
+    const box = _util.Util.bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3);
+
+    this.updatePathMinMax(transform, box[0], box[1]);
+    this.updatePathMinMax(transform, box[2], box[3]);
+  }
+
+  getPathBoundingBox(pathType = _pattern_helper.PathType.FILL, transform = null) {
+    const box = [this.minX, this.minY, this.maxX, this.maxY];
+
+    if (pathType === _pattern_helper.PathType.STROKE) {
+      if (!transform) {
+        (0, _util.unreachable)("Stroke bounding box must include transform.");
+      }
+
+      const scale = _util.Util.singularValueDecompose2dScale(transform);
+
+      const xStrokePad = scale[0] * this.lineWidth / 2;
+      const yStrokePad = scale[1] * this.lineWidth / 2;
+      box[0] -= xStrokePad;
+      box[1] -= yStrokePad;
+      box[2] += xStrokePad;
+      box[3] += yStrokePad;
+    }
+
+    return box;
+  }
+
+  updateClipFromPath() {
+    const intersect = _util.Util.intersect(this.clipBox, this.getPathBoundingBox());
+
+    this.startNewPathAndClipBox(intersect || [0, 0, 0, 0]);
+  }
+
+  startNewPathAndClipBox(box) {
+    this.clipBox = box;
+    this.minX = Infinity;
+    this.minY = Infinity;
+    this.maxX = 0;
+    this.maxY = 0;
+  }
+
+  getClippedPathBoundingBox(pathType = _pattern_helper.PathType.FILL, transform = null) {
+    return _util.Util.intersect(this.clipBox, this.getPathBoundingBox(pathType, transform));
+  }
+
 }
 
 function putBinaryImageData(ctx, imgData, transferMaps = null) {
@@ -5450,7 +5677,7 @@ function composeSMaskLuminosity(maskData, layerData, transferMap) {
   }
 }
 
-function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap) {
+function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap, layerOffsetX, 
layerOffsetY, maskOffsetX, maskOffsetY) {
   const hasBackdrop = !!backdrop;
   const r0 = hasBackdrop ? backdrop[0] : 0;
   const g0 = hasBackdrop ? backdrop[1] : 0;
@@ -5468,24 +5695,35 @@ function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop
 
   for (let row = 0; row < height; row += chunkSize) {
     const chunkHeight = Math.min(chunkSize, height - row);
-    const maskData = maskCtx.getImageData(0, row, width, chunkHeight);
-    const layerData = layerCtx.getImageData(0, row, width, chunkHeight);
+    const maskData = maskCtx.getImageData(layerOffsetX - maskOffsetX, row + (layerOffsetY - maskOffsetY), 
width, chunkHeight);
+    const layerData = layerCtx.getImageData(layerOffsetX, row + layerOffsetY, width, chunkHeight);
 
     if (hasBackdrop) {
       composeSMaskBackdrop(maskData.data, r0, g0, b0);
     }
 
     composeFn(maskData.data, layerData.data, transferMap);
-    maskCtx.putImageData(layerData, 0, row);
+    layerCtx.putImageData(layerData, layerOffsetX, row + layerOffsetY);
   }
 }
 
-function composeSMask(ctx, smask, layerCtx) {
-  const mask = smask.canvas;
-  const maskCtx = smask.context;
-  ctx.setTransform(smask.scaleX, 0, 0, smask.scaleY, smask.offsetX, smask.offsetY);
-  genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height, smask.subtype, smask.backdrop, 
smask.transferMap);
-  ctx.drawImage(mask, 0, 0);
+function composeSMask(ctx, smask, layerCtx, layerBox) {
+  const layerOffsetX = layerBox[0];
+  const layerOffsetY = layerBox[1];
+  const layerWidth = layerBox[2] - layerOffsetX;
+  const layerHeight = layerBox[3] - layerOffsetY;
+
+  if (layerWidth === 0 || layerHeight === 0) {
+    return;
+  }
+
+  genericComposeSMask(smask.context, layerCtx, layerWidth, layerHeight, smask.subtype, smask.backdrop, 
smask.transferMap, layerOffsetX, layerOffsetY, smask.offsetX, smask.offsetY);
+  ctx.save();
+  ctx.globalAlpha = 1;
+  ctx.globalCompositeOperation = "source-over";
+  ctx.setTransform(1, 0, 0, 1, 0, 0);
+  ctx.drawImage(layerCtx.canvas, 0, 0);
+  ctx.restore();
 }
 
 function getImageSmoothingEnabled(transform, interpolate) {
@@ -5510,9 +5748,9 @@ const NORMAL_CLIP = {};
 const EO_CLIP = {};
 
 class CanvasGraphics {
-  constructor(canvasCtx, commonObjs, objs, canvasFactory, imageLayer, optionalContentConfig) {
+  constructor(canvasCtx, commonObjs, objs, canvasFactory, imageLayer, optionalContentConfig, 
annotationCanvasMap) {
     this.ctx = canvasCtx;
-    this.current = new CanvasExtraState();
+    this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
     this.stateStack = [];
     this.pendingClip = null;
     this.pendingEOFill = false;
@@ -5530,12 +5768,16 @@ class CanvasGraphics {
     this.smaskStack = [];
     this.smaskCounter = 0;
     this.tempSMask = null;
+    this.suspendedCtx = null;
     this.contentVisible = true;
     this.markedContentStack = [];
     this.optionalContentConfig = optionalContentConfig;
     this.cachedCanvases = new CachedCanvases(this.canvasFactory);
-    this.cachedCanvasPatterns = new LRUCache(MAX_CACHED_CANVAS_PATTERNS);
     this.cachedPatterns = new Map();
+    this.annotationCanvasMap = annotationCanvasMap;
+    this.viewportScale = 1;
+    this.outputScaleX = 1;
+    this.outputScaleY = 1;
 
     if (canvasCtx) {
       addContextCurrentTransform(canvasCtx);
@@ -5571,9 +5813,12 @@ class CanvasGraphics {
 
     if (transform) {
       this.ctx.transform.apply(this.ctx, transform);
+      this.outputScaleX = transform[0];
+      this.outputScaleY = transform[0];
     }
 
     this.ctx.transform.apply(this.ctx, viewport.transform);
+    this.viewportScale = viewport.scale;
     this.baseTransform = this.ctx.mozCurrentTransform.slice();
     this._combinedScaleFactor = Math.hypot(this.baseTransform[0], this.baseTransform[2]);
 
@@ -5654,7 +5899,6 @@ class CanvasGraphics {
     }
 
     this.cachedCanvases.clear();
-    this.cachedCanvasPatterns.clear();
     this.cachedPatterns.clear();
 
     if (this.imageLayer) {
@@ -5741,7 +5985,7 @@ class CanvasGraphics {
 
     const inverse = _util.Util.transform(fillCtx.mozCurrentTransformInverse, [1, 0, 0, 1, -offsetX, 
-offsetY]);
 
-    fillCtx.fillStyle = isPatternFill ? fillColor.getPattern(ctx, this, inverse, false) : fillColor;
+    fillCtx.fillStyle = isPatternFill ? fillColor.getPattern(ctx, this, inverse, 
_pattern_helper.PathType.FILL) : fillColor;
     fillCtx.fillRect(0, 0, width, height);
     return {
       canvas: fillCanvas.canvas,
@@ -5833,21 +6077,9 @@ class CanvasGraphics {
           break;
 
         case "SMask":
-          if (this.current.activeSMask) {
-            if (this.stateStack.length > 0 && this.stateStack[this.stateStack.length - 1].activeSMask === 
this.current.activeSMask) {
-              this.suspendSMaskGroup();
-            } else {
-              this.endSMaskGroup();
-            }
-          }
-
           this.current.activeSMask = value ? this.tempSMask : null;
-
-          if (this.current.activeSMask) {
-            this.beginSMaskGroup();
-          }
-
           this.tempSMask = null;
+          this.checkSMaskState();
           break;
 
         case "TR":
@@ -5856,65 +6088,68 @@ class CanvasGraphics {
     }
   }
 
-  beginSMaskGroup() {
-    const activeSMask = this.current.activeSMask;
-    const drawnWidth = activeSMask.canvas.width;
-    const drawnHeight = activeSMask.canvas.height;
+  checkSMaskState() {
+    const inSMaskMode = !!this.suspendedCtx;
+
+    if (this.current.activeSMask && !inSMaskMode) {
+      this.beginSMaskMode();
+    } else if (!this.current.activeSMask && inSMaskMode) {
+      this.endSMaskMode();
+    }
+  }
+
+  beginSMaskMode() {
+    if (this.suspendedCtx) {
+      throw new Error("beginSMaskMode called while already in smask mode");
+    }
+
+    const drawnWidth = this.ctx.canvas.width;
+    const drawnHeight = this.ctx.canvas.height;
     const cacheId = "smaskGroupAt" + this.groupLevel;
     const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true);
-    const currentCtx = this.ctx;
-    const currentTransform = currentCtx.mozCurrentTransform;
-    this.ctx.save();
-    const groupCtx = scratchCanvas.context;
-    groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY);
-    groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY);
-    groupCtx.transform.apply(groupCtx, currentTransform);
-    activeSMask.startTransformInverse = groupCtx.mozCurrentTransformInverse;
-    copyCtxState(currentCtx, groupCtx);
-    this.ctx = groupCtx;
+    this.suspendedCtx = this.ctx;
+    this.ctx = scratchCanvas.context;
+    const ctx = this.ctx;
+    ctx.setTransform.apply(ctx, this.suspendedCtx.mozCurrentTransform);
+    copyCtxState(this.suspendedCtx, ctx);
+    mirrorContextOperations(ctx, this.suspendedCtx);
     this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
-    this.groupStack.push(currentCtx);
-    this.groupLevel++;
   }
 
-  suspendSMaskGroup() {
-    const groupCtx = this.ctx;
-    this.groupLevel--;
-    this.ctx = this.groupStack.pop();
-    composeSMask(this.ctx, this.current.activeSMask, groupCtx);
-    this.ctx.restore();
-    this.ctx.save();
-    copyCtxState(groupCtx, this.ctx);
-    this.current.resumeSMaskCtx = groupCtx;
-
-    const deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, 
groupCtx.mozCurrentTransform);
+  endSMaskMode() {
+    if (!this.suspendedCtx) {
+      throw new Error("endSMaskMode called while not in smask mode");
+    }
 
-    this.ctx.transform.apply(this.ctx, deltaTransform);
-    groupCtx.save();
-    groupCtx.setTransform(1, 0, 0, 1, 0, 0);
-    groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height);
-    groupCtx.restore();
-  }
+    this.ctx._removeMirroring();
 
-  resumeSMaskGroup() {
-    const groupCtx = this.current.resumeSMaskCtx;
-    const currentCtx = this.ctx;
-    this.ctx = groupCtx;
-    this.groupStack.push(currentCtx);
-    this.groupLevel++;
+    copyCtxState(this.ctx, this.suspendedCtx);
+    this.ctx = this.suspendedCtx;
+    this.current.activeSMask = null;
+    this.suspendedCtx = null;
   }
 
-  endSMaskGroup() {
-    const groupCtx = this.ctx;
-    this.groupLevel--;
-    this.ctx = this.groupStack.pop();
-    composeSMask(this.ctx, this.current.activeSMask, groupCtx);
-    this.ctx.restore();
-    copyCtxState(groupCtx, this.ctx);
+  compose(dirtyBox) {
+    if (!this.current.activeSMask) {
+      return;
+    }
 
-    const deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, 
groupCtx.mozCurrentTransform);
+    if (!dirtyBox) {
+      dirtyBox = [0, 0, this.ctx.canvas.width, this.ctx.canvas.height];
+    } else {
+      dirtyBox[0] = Math.floor(dirtyBox[0]);
+      dirtyBox[1] = Math.floor(dirtyBox[1]);
+      dirtyBox[2] = Math.ceil(dirtyBox[2]);
+      dirtyBox[3] = Math.ceil(dirtyBox[3]);
+    }
 
-    this.ctx.transform.apply(this.ctx, deltaTransform);
+    const smask = this.current.activeSMask;
+    const suspendedCtx = this.suspendedCtx;
+    composeSMask(suspendedCtx, smask, this.ctx, dirtyBox);
+    this.ctx.save();
+    this.ctx.setTransform(1, 0, 0, 1, 0, 0);
+    this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
+    this.ctx.restore();
   }
 
   save() {
@@ -5922,25 +6157,19 @@ class CanvasGraphics {
     const old = this.current;
     this.stateStack.push(old);
     this.current = old.clone();
-    this.current.resumeSMaskCtx = null;
   }
 
   restore() {
-    if (this.current.resumeSMaskCtx) {
-      this.resumeSMaskGroup();
-    }
-
-    if (this.current.activeSMask !== null && (this.stateStack.length === 0 || 
this.stateStack[this.stateStack.length - 1].activeSMask !== this.current.activeSMask)) {
-      this.endSMaskGroup();
+    if (this.stateStack.length === 0 && this.current.activeSMask) {
+      this.endSMaskMode();
     }
 
     if (this.stateStack.length !== 0) {
       this.current = this.stateStack.pop();
       this.ctx.restore();
+      this.checkSMaskState();
       this.pendingClip = null;
       this._cachedGetSinglePixelWidth = null;
-    } else {
-      this.current.activeSMask = null;
     }
   }
 
@@ -5954,6 +6183,7 @@ class CanvasGraphics {
     const current = this.current;
     let x = current.x,
         y = current.y;
+    let startX, startY;
 
     for (let i = 0, j = 0, ii = ops.length; i < ii; i++) {
       switch (ops[i] | 0) {
@@ -5974,6 +6204,8 @@ class CanvasGraphics {
             ctx.lineTo(x, yh);
           }
 
+          current.updatePathMinMax(ctx.mozCurrentTransform, x, y);
+          current.updatePathMinMax(ctx.mozCurrentTransform, xw, yh);
           ctx.closePath();
           break;
 
@@ -5981,32 +6213,43 @@ class CanvasGraphics {
           x = args[j++];
           y = args[j++];
           ctx.moveTo(x, y);
+          current.updatePathMinMax(ctx.mozCurrentTransform, x, y);
           break;
 
         case _util.OPS.lineTo:
           x = args[j++];
           y = args[j++];
           ctx.lineTo(x, y);
+          current.updatePathMinMax(ctx.mozCurrentTransform, x, y);
           break;
 
         case _util.OPS.curveTo:
+          startX = x;
+          startY = y;
           x = args[j + 4];
           y = args[j + 5];
           ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y);
+          current.updateCurvePathMinMax(ctx.mozCurrentTransform, startX, startY, args[j], args[j + 1], 
args[j + 2], args[j + 3], x, y);
           j += 6;
           break;
 
         case _util.OPS.curveTo2:
+          startX = x;
+          startY = y;
           ctx.bezierCurveTo(x, y, args[j], args[j + 1], args[j + 2], args[j + 3]);
+          current.updateCurvePathMinMax(ctx.mozCurrentTransform, startX, startY, x, y, args[j], args[j + 1], 
args[j + 2], args[j + 3]);
           x = args[j + 2];
           y = args[j + 3];
           j += 4;
           break;
 
         case _util.OPS.curveTo3:
+          startX = x;
+          startY = y;
           x = args[j + 2];
           y = args[j + 3];
           ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y);
+          current.updateCurvePathMinMax(ctx.mozCurrentTransform, startX, startY, args[j], args[j + 1], x, y, 
x, y);
           j += 4;
           break;
 
@@ -6033,7 +6276,7 @@ class CanvasGraphics {
       if (typeof strokeColor === "object" && strokeColor?.getPattern) {
         const lineWidth = this.getSinglePixelWidth();
         ctx.save();
-        ctx.strokeStyle = strokeColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse);
+        ctx.strokeStyle = strokeColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse, 
_pattern_helper.PathType.STROKE);
         ctx.lineWidth = Math.max(lineWidth, this.current.lineWidth);
         ctx.stroke();
         ctx.restore();
@@ -6054,7 +6297,7 @@ class CanvasGraphics {
     }
 
     if (consumePath) {
-      this.consumePath();
+      this.consumePath(this.current.getClippedPathBoundingBox());
     }
 
     ctx.globalAlpha = this.current.fillAlpha;
@@ -6074,11 +6317,13 @@ class CanvasGraphics {
 
     if (isPatternFill) {
       ctx.save();
-      ctx.fillStyle = fillColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse);
+      ctx.fillStyle = fillColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse, 
_pattern_helper.PathType.FILL);
       needRestore = true;
     }
 
-    if (this.contentVisible) {
+    const intersect = this.current.getClippedPathBoundingBox();
+
+    if (this.contentVisible && intersect !== null) {
       if (this.pendingEOFill) {
         ctx.fill("evenodd");
         this.pendingEOFill = false;
@@ -6092,7 +6337,7 @@ class CanvasGraphics {
     }
 
     if (consumePath) {
-      this.consumePath();
+      this.consumePath(intersect);
     }
   }
 
@@ -6379,16 +6624,6 @@ class CanvasGraphics {
     const widthAdvanceScale = fontSize * current.fontMatrix[0];
     const simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && 
!font.disableFontFace && !current.patternFill;
     ctx.save();
-    let patternTransform;
-
-    if (current.patternFill) {
-      ctx.save();
-      const pattern = current.fillColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse);
-      patternTransform = ctx.mozCurrentTransform;
-      ctx.restore();
-      ctx.fillStyle = pattern;
-    }
-
     ctx.transform.apply(ctx, current.textMatrix);
     ctx.translate(current.x, current.y + current.textRise);
 
@@ -6398,6 +6633,16 @@ class CanvasGraphics {
       ctx.scale(textHScale, 1);
     }
 
+    let patternTransform;
+
+    if (current.patternFill) {
+      ctx.save();
+      const pattern = current.fillColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse, 
_pattern_helper.PathType.FILL);
+      patternTransform = ctx.mozCurrentTransform;
+      ctx.restore();
+      ctx.fillStyle = pattern;
+    }
+
     let lineWidth = current.lineWidth;
     let resetLineWidthToOne = false;
     const scale = current.textMatrixScale;
@@ -6500,6 +6745,7 @@ class CanvasGraphics {
     }
 
     ctx.restore();
+    this.compose();
     return undefined;
   }
 
@@ -6623,7 +6869,7 @@ class CanvasGraphics {
     if (this.cachedPatterns.has(objId)) {
       pattern = this.cachedPatterns.get(objId);
     } else {
-      pattern = (0, _pattern_helper.getShadingPattern)(this.objs.get(objId), this.cachedCanvasPatterns);
+      pattern = (0, _pattern_helper.getShadingPattern)(this.objs.get(objId));
       this.cachedPatterns.set(objId, pattern);
     }
 
@@ -6644,7 +6890,7 @@ class CanvasGraphics {
 
     const pattern = this._getPattern(objId);
 
-    ctx.fillStyle = pattern.getPattern(ctx, this, ctx.mozCurrentTransformInverse, true);
+    ctx.fillStyle = pattern.getPattern(ctx, this, ctx.mozCurrentTransformInverse, 
_pattern_helper.PathType.SHADING);
     const inv = ctx.mozCurrentTransformInverse;
 
     if (inv) {
@@ -6669,6 +6915,7 @@ class CanvasGraphics {
       this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
     }
 
+    this.compose(this.current.getClippedPathBoundingBox());
     this.restore();
   }
 
@@ -6698,6 +6945,8 @@ class CanvasGraphics {
       const width = bbox[2] - bbox[0];
       const height = bbox[3] - bbox[1];
       this.ctx.rect(bbox[0], bbox[1], width, height);
+      this.current.updatePathMinMax(this.ctx.mozCurrentTransform, bbox[0], bbox[1]);
+      this.current.updatePathMinMax(this.ctx.mozCurrentTransform, bbox[2], bbox[3]);
       this.clip();
       this.endPath();
     }
@@ -6718,6 +6967,13 @@ class CanvasGraphics {
     }
 
     this.save();
+    const suspendedCtx = this.suspendedCtx;
+
+    if (this.current.activeSMask) {
+      this.suspendedCtx = null;
+      this.current.activeSMask = null;
+    }
+
     const currentCtx = this.ctx;
 
     if (!group.isolated) {
@@ -6759,6 +7015,7 @@ class CanvasGraphics {
       drawnHeight = MAX_GROUP_SIZE;
     }
 
+    this.current.startNewPathAndClipBox([0, 0, drawnWidth, drawnHeight]);
     let cacheId = "groupAt" + this.groupLevel;
 
     if (group.smask) {
@@ -6788,14 +7045,17 @@ class CanvasGraphics {
       currentCtx.setTransform(1, 0, 0, 1, 0, 0);
       currentCtx.translate(offsetX, offsetY);
       currentCtx.scale(scaleX, scaleY);
+      currentCtx.save();
     }
 
     copyCtxState(currentCtx, groupCtx);
     this.ctx = groupCtx;
     this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
-    this.groupStack.push(currentCtx);
+    this.groupStack.push({
+      ctx: currentCtx,
+      suspendedCtx
+    });
     this.groupLevel++;
-    this.current.activeSMask = null;
   }
 
   endGroup(group) {
@@ -6805,16 +7065,33 @@ class CanvasGraphics {
 
     this.groupLevel--;
     const groupCtx = this.ctx;
-    this.ctx = this.groupStack.pop();
+    const {
+      ctx,
+      suspendedCtx
+    } = this.groupStack.pop();
+    this.ctx = ctx;
     this.ctx.imageSmoothingEnabled = false;
 
+    if (suspendedCtx) {
+      this.suspendedCtx = suspendedCtx;
+    }
+
     if (group.smask) {
       this.tempSMask = this.smaskStack.pop();
+      this.restore();
     } else {
+      this.ctx.restore();
+      const currentMtx = this.ctx.mozCurrentTransform;
+      this.restore();
+      this.ctx.save();
+      this.ctx.setTransform.apply(this.ctx, currentMtx);
+
+      const dirtyBox = _util.Util.getAxialAlignedBoundingBox([0, 0, groupCtx.canvas.width, 
groupCtx.canvas.height], currentMtx);
+
       this.ctx.drawImage(groupCtx.canvas, 0, 0);
+      this.ctx.restore();
+      this.compose(dirtyBox);
     }
-
-    this.restore();
   }
 
   beginAnnotations() {
@@ -6829,24 +7106,62 @@ class CanvasGraphics {
     this.restore();
   }
 
-  beginAnnotation(id, rect, transform, matrix) {
+  beginAnnotation(id, rect, transform, matrix, hasOwnCanvas) {
     this.save();
-    resetCtxToDefault(this.ctx);
-    this.current = new CanvasExtraState();
 
     if (Array.isArray(rect) && rect.length === 4) {
       const width = rect[2] - rect[0];
       const height = rect[3] - rect[1];
-      this.ctx.rect(rect[0], rect[1], width, height);
-      this.clip();
-      this.endPath();
+
+      if (hasOwnCanvas && this.annotationCanvasMap) {
+        transform = transform.slice();
+        transform[4] -= rect[0];
+        transform[5] -= rect[1];
+        rect = rect.slice();
+        rect[0] = rect[1] = 0;
+        rect[2] = width;
+        rect[3] = height;
+
+        const [scaleX, scaleY] = _util.Util.singularValueDecompose2dScale(this.ctx.mozCurrentTransform);
+
+        const {
+          viewportScale
+        } = this;
+        const canvasWidth = Math.ceil(width * this.outputScaleX * viewportScale);
+        const canvasHeight = Math.ceil(height * this.outputScaleY * viewportScale);
+        this.annotationCanvas = this.canvasFactory.create(canvasWidth, canvasHeight);
+        const {
+          canvas,
+          context
+        } = this.annotationCanvas;
+        canvas.style.width = `calc(${width}px * var(--viewport-scale-factor))`;
+        canvas.style.height = `calc(${height}px * var(--viewport-scale-factor))`;
+        this.annotationCanvasMap.set(id, canvas);
+        this.annotationCanvas.savedCtx = this.ctx;
+        this.ctx = context;
+        this.ctx.setTransform(scaleX, 0, 0, -scaleY, 0, height * scaleY);
+        addContextCurrentTransform(this.ctx);
+        resetCtxToDefault(this.ctx);
+      } else {
+        resetCtxToDefault(this.ctx);
+        this.ctx.rect(rect[0], rect[1], width, height);
+        this.clip();
+        this.endPath();
+      }
     }
 
+    this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
     this.transform.apply(this, transform);
     this.transform.apply(this, matrix);
   }
 
   endAnnotation() {
+    if (this.annotationCanvas) {
+      this.ctx = this.annotationCanvas.savedCtx;
+      delete this.annotationCanvas.savedCtx;
+      delete this.annotationCanvas;
+    }
+
     this.restore();
   }
 
@@ -6884,6 +7199,7 @@ class CanvasGraphics {
     ctx.setTransform(1, 0, 0, 1, 0, 0);
     ctx.drawImage(maskCanvas, mask.offsetX, mask.offsetY);
     ctx.restore();
+    this.compose();
   }
 
   paintImageMaskXObjectRepeat(imgData, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
@@ -6909,6 +7225,7 @@ class CanvasGraphics {
     }
 
     ctx.restore();
+    this.compose();
   }
 
   paintImageMaskXObjectGroup(images) {
@@ -6929,7 +7246,7 @@ class CanvasGraphics {
       maskCtx.save();
       putBinaryImageMask(maskCtx, image);
       maskCtx.globalCompositeOperation = "source-in";
-      maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, 
ctx.mozCurrentTransformInverse, false) : fillColor;
+      maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, 
ctx.mozCurrentTransformInverse, _pattern_helper.PathType.FILL) : fillColor;
       maskCtx.fillRect(0, 0, width, height);
       maskCtx.restore();
       ctx.save();
@@ -6938,6 +7255,8 @@ class CanvasGraphics {
       ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
       ctx.restore();
     }
+
+    this.compose();
   }
 
   paintImageXObject(objId) {
@@ -7021,6 +7340,7 @@ class CanvasGraphics {
       });
     }
 
+    this.compose();
     this.restore();
   }
 
@@ -7056,6 +7376,8 @@ class CanvasGraphics {
 
       ctx.restore();
     }
+
+    this.compose();
   }
 
   paintSolidColorImageMask() {
@@ -7064,6 +7386,7 @@ class CanvasGraphics {
     }
 
     this.ctx.fillRect(0, 0, 1, 1);
+    this.compose();
   }
 
   markPoint(tag) {}
@@ -7099,7 +7422,15 @@ class CanvasGraphics {
 
   endCompat() {}
 
-  consumePath() {
+  consumePath(clipBox) {
+    if (this.pendingClip) {
+      this.current.updateClipFromPath();
+    }
+
+    if (!this.pendingClip) {
+      this.compose(clipBox);
+    }
+
     const ctx = this.ctx;
 
     if (this.pendingClip) {
@@ -7112,6 +7443,7 @@ class CanvasGraphics {
       this.pendingClip = null;
     }
 
+    this.current.startNewPathAndClipBox(this.current.clipBox);
     ctx.beginPath();
   }
 
@@ -7169,11 +7501,18 @@ for (const op in _util.OPS) {
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.TilingPattern = exports.PathType = void 0;
 exports.getShadingPattern = getShadingPattern;
-exports.TilingPattern = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
+const PathType = {
+  FILL: "Fill",
+  STROKE: "Stroke",
+  SHADING: "Shading"
+};
+exports.PathType = PathType;
+
 function applyBoundingBox(ctx, bbox) {
   if (!bbox || typeof Path2D === "undefined") {
     return;
@@ -7200,7 +7539,7 @@ class BaseShadingPattern {
 }
 
 class RadialAxialShadingPattern extends BaseShadingPattern {
-  constructor(IR, cachedCanvasPatterns) {
+  constructor(IR) {
     super();
     this._type = IR[1];
     this._bbox = IR[2];
@@ -7210,7 +7549,6 @@ class RadialAxialShadingPattern extends BaseShadingPattern {
     this._r0 = IR[6];
     this._r1 = IR[7];
     this.matrix = null;
-    this.cachedCanvasPatterns = cachedCanvasPatterns;
   }
 
   _createGradient(ctx) {
@@ -7229,36 +7567,30 @@ class RadialAxialShadingPattern extends BaseShadingPattern {
     return grad;
   }
 
-  getPattern(ctx, owner, inverse, shadingFill = false) {
+  getPattern(ctx, owner, inverse, pathType) {
     let pattern;
 
-    if (!shadingFill) {
-      if (this.cachedCanvasPatterns.has(this)) {
-        pattern = this.cachedCanvasPatterns.get(this);
-      } else {
-        const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", owner.ctx.canvas.width, 
owner.ctx.canvas.height, true);
-        const tmpCtx = tmpCanvas.context;
-        tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
-        tmpCtx.beginPath();
-        tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
-        tmpCtx.setTransform.apply(tmpCtx, owner.baseTransform);
-
-        if (this.matrix) {
-          tmpCtx.transform.apply(tmpCtx, this.matrix);
-        }
+    if (pathType === PathType.STROKE || pathType === PathType.FILL) {
+      const ownerBBox = owner.current.getClippedPathBoundingBox(pathType, ctx.mozCurrentTransform) || [0, 0, 
0, 0];
+      const width = Math.ceil(ownerBBox[2] - ownerBBox[0]) || 1;
+      const height = Math.ceil(ownerBBox[3] - ownerBBox[1]) || 1;
+      const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", width, height, true);
+      const tmpCtx = tmpCanvas.context;
+      tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
+      tmpCtx.beginPath();
+      tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
+      tmpCtx.translate(-ownerBBox[0], -ownerBBox[1]);
+      inverse = _util.Util.transform(inverse, [1, 0, 0, 1, ownerBBox[0], ownerBBox[1]]);
+      tmpCtx.transform.apply(tmpCtx, owner.baseTransform);
 
-        applyBoundingBox(tmpCtx, this._bbox);
-        tmpCtx.fillStyle = this._createGradient(tmpCtx);
-        tmpCtx.fill();
-        pattern = ctx.createPattern(tmpCanvas.canvas, "repeat");
-        this.cachedCanvasPatterns.set(this, pattern);
+      if (this.matrix) {
+        tmpCtx.transform.apply(tmpCtx, this.matrix);
       }
-    } else {
-      applyBoundingBox(ctx, this._bbox);
-      pattern = this._createGradient(ctx);
-    }
 
-    if (!shadingFill) {
+      applyBoundingBox(tmpCtx, this._bbox);
+      tmpCtx.fillStyle = this._createGradient(tmpCtx);
+      tmpCtx.fill();
+      pattern = ctx.createPattern(tmpCanvas.canvas, "no-repeat");
       const domMatrix = new DOMMatrix(inverse);
 
       try {
@@ -7266,6 +7598,9 @@ class RadialAxialShadingPattern extends BaseShadingPattern {
       } catch (ex) {
         (0, _util.warn)(`RadialAxialShadingPattern.getPattern: "${ex?.message}".`);
       }
+    } else {
+      applyBoundingBox(ctx, this._bbox);
+      pattern = this._createGradient(ctx);
     }
 
     return pattern;
@@ -7496,11 +7831,11 @@ class MeshShadingPattern extends BaseShadingPattern {
     };
   }
 
-  getPattern(ctx, owner, inverse, shadingFill = false) {
+  getPattern(ctx, owner, inverse, pathType) {
     applyBoundingBox(ctx, this._bbox);
     let scale;
 
-    if (shadingFill) {
+    if (pathType === PathType.SHADING) {
       scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform);
     } else {
       scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform);
@@ -7512,9 +7847,9 @@ class MeshShadingPattern extends BaseShadingPattern {
       }
     }
 
-    const temporaryPatternCanvas = this._createMeshCanvas(scale, shadingFill ? null : this._background, 
owner.cachedCanvases);
+    const temporaryPatternCanvas = this._createMeshCanvas(scale, pathType === PathType.SHADING ? null : 
this._background, owner.cachedCanvases);
 
-    if (!shadingFill) {
+    if (pathType !== PathType.SHADING) {
       ctx.setTransform.apply(ctx, owner.baseTransform);
 
       if (this.matrix) {
@@ -7536,10 +7871,10 @@ class DummyShadingPattern extends BaseShadingPattern {
 
 }
 
-function getShadingPattern(IR, cachedCanvasPatterns) {
+function getShadingPattern(IR) {
   switch (IR[0]) {
     case "RadialAxial":
-      return new RadialAxialShadingPattern(IR, cachedCanvasPatterns);
+      return new RadialAxialShadingPattern(IR);
 
     case "Mesh":
       return new MeshShadingPattern(IR);
@@ -7684,10 +8019,10 @@ class TilingPattern {
     }
   }
 
-  getPattern(ctx, owner, inverse, shadingFill = false) {
+  getPattern(ctx, owner, inverse, pathType) {
     let matrix = inverse;
 
-    if (!shadingFill) {
+    if (pathType !== PathType.SHADING) {
       matrix = _util.Util.transform(matrix, owner.baseTransform);
 
       if (this.matrix) {
@@ -7793,7 +8128,6 @@ class MessageHandler {
     this.comObj = comObj;
     this.callbackId = 1;
     this.streamId = 1;
-    this.postMessageTransfers = true;
     this.streamSinks = Object.create(null);
     this.streamControllers = Object.create(null);
     this.callbackCapabilities = Object.create(null);
@@ -7887,7 +8221,7 @@ class MessageHandler {
   }
 
   send(actionName, data, transfers) {
-    this._postMessage({
+    this.comObj.postMessage({
       sourceName: this.sourceName,
       targetName: this.targetName,
       action: actionName,
@@ -7901,7 +8235,7 @@ class MessageHandler {
     this.callbackCapabilities[callbackId] = capability;
 
     try {
-      this._postMessage({
+      this.comObj.postMessage({
         sourceName: this.sourceName,
         targetName: this.targetName,
         action: actionName,
@@ -7930,8 +8264,7 @@ class MessageHandler {
           cancelCall: null,
           isClosed: false
         };
-
-        this._postMessage({
+        comObj.postMessage({
           sourceName,
           targetName,
           action: actionName,
@@ -7939,7 +8272,6 @@ class MessageHandler {
           data,
           desiredSize: controller.desiredSize
         }, transfers);
-
         return startCapability.promise;
       },
       pull: controller => {
@@ -7992,7 +8324,7 @@ class MessageHandler {
           this.ready = this.sinkCapability.promise;
         }
 
-        self._postMessage({
+        comObj.postMessage({
           sourceName,
           targetName,
           stream: StreamKind.ENQUEUE,
@@ -8211,14 +8543,6 @@ class MessageHandler {
     delete this.streamControllers[streamId];
   }
 
-  _postMessage(message, transfers) {
-    if (transfers && this.postMessageTransfers) {
-      this.comObj.postMessage(message, transfers);
-    } else {
-      this.comObj.postMessage(message);
-    }
-  }
-
   destroy() {
     this.comObj.removeEventListener("message", this._onComObjOnMessage);
   }
@@ -8241,28 +8565,31 @@ exports.Metadata = void 0;
 var _util = __w_pdfjs_require__(2);
 
 class Metadata {
+  #metadataMap;
+  #data;
+
   constructor({
     parsedData,
     rawData
   }) {
-    this._metadataMap = parsedData;
-    this._data = rawData;
+    this.#metadataMap = parsedData;
+    this.#data = rawData;
   }
 
   getRaw() {
-    return this._data;
+    return this.#data;
   }
 
   get(name) {
-    return this._metadataMap.get(name) ?? null;
+    return this.#metadataMap.get(name) ?? null;
   }
 
   getAll() {
-    return (0, _util.objectFromMap)(this._metadataMap);
+    return (0, _util.objectFromMap)(this.#metadataMap);
   }
 
   has(name) {
-    return this._metadataMap.has(name);
+    return this.#metadataMap.has(name);
   }
 
 }
@@ -8928,6 +9255,8 @@ var _annotation_storage = __w_pdfjs_require__(9);
 
 var _scripting_utils = __w_pdfjs_require__(19);
 
+var _xfa_layer = __w_pdfjs_require__(20);
+
 const DEFAULT_TAB_INDEX = 1000;
 const GetElementsByNameSet = new WeakSet();
 
@@ -9058,7 +9387,25 @@ class AnnotationElement {
 
     const rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], 
data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
 
-    container.style.transform = `matrix(${viewport.transform.join(",")})`;
+    if (data.hasOwnCanvas) {
+      const transform = viewport.transform.slice();
+
+      const [scaleX, scaleY] = _util.Util.singularValueDecompose2dScale(transform);
+
+      width = Math.ceil(width * scaleX);
+      height = Math.ceil(height * scaleY);
+      rect[0] *= scaleX;
+      rect[1] *= scaleY;
+
+      for (let i = 0; i < 4; i++) {
+        transform[i] = Math.sign(transform[i]);
+      }
+
+      container.style.transform = `matrix(${transform.join(",")})`;
+    } else {
+      container.style.transform = `matrix(${viewport.transform.join(",")})`;
+    }
+
     container.style.transformOrigin = `${-rect[0]}px ${-rect[1]}px`;
 
     if (!ignoreBorder && data.borderStyle.width > 0) {
@@ -9113,8 +9460,14 @@ class AnnotationElement {
 
     container.style.left = `${rect[0]}px`;
     container.style.top = `${rect[1]}px`;
-    container.style.width = `${width}px`;
-    container.style.height = `${height}px`;
+
+    if (data.hasOwnCanvas) {
+      container.style.width = container.style.height = "auto";
+    } else {
+      container.style.width = `${width}px`;
+      container.style.height = `${height}px`;
+    }
+
     return container;
   }
 
@@ -9157,6 +9510,7 @@ class AnnotationElement {
       titleObj: data.titleObj,
       modificationDate: data.modificationDate,
       contentsObj: data.contentsObj,
+      richText: data.richText,
       hideWrapper: true
     });
     const popup = popupElement.render();
@@ -9250,10 +9604,11 @@ class AnnotationElement {
 }
 
 class LinkAnnotationElement extends AnnotationElement {
-  constructor(parameters) {
+  constructor(parameters, options = null) {
     const isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action || 
parameters.data.isTooltipOnly || parameters.data.resetForm || parameters.data.actions && 
(parameters.data.actions.Action || parameters.data.actions["Mouse Up"] || parameters.data.actions["Mouse 
Down"]));
     super(parameters, {
       isRenderable,
+      ignoreBorder: !!options?.ignoreBorder,
       createQuadrilaterals: true
     });
   }
@@ -9490,7 +9845,7 @@ class LinkAnnotationElement extends AnnotationElement {
 
 class TextAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable
     });
@@ -10097,6 +10452,12 @@ class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {
 }
 
 class PushButtonWidgetAnnotationElement extends LinkAnnotationElement {
+  constructor(parameters) {
+    super(parameters, {
+      ignoreBorder: parameters.data.hasAppearance
+    });
+  }
+
   render() {
     const container = super.render();
     container.className = "buttonWidgetAnnotation pushButton";
@@ -10350,7 +10711,7 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
 
 class PopupAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.titleObj?.str || parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.titleObj?.str || parameters.data.contentsObj?.str || 
parameters.data.richText?.str);
     super(parameters, {
       isRenderable
     });
@@ -10377,7 +10738,8 @@ class PopupAnnotationElement extends AnnotationElement {
       color: this.data.color,
       titleObj: this.data.titleObj,
       modificationDate: this.data.modificationDate,
-      contentsObj: this.data.contentsObj
+      contentsObj: this.data.contentsObj,
+      richText: this.data.richText
     });
     const page = this.page;
 
@@ -10402,6 +10764,7 @@ class PopupElement {
     this.titleObj = parameters.titleObj;
     this.modificationDate = parameters.modificationDate;
     this.contentsObj = parameters.contentsObj;
+    this.richText = parameters.richText;
     this.hideWrapper = parameters.hideWrapper || false;
     this.pinned = false;
   }
@@ -10432,6 +10795,7 @@ class PopupElement {
 
     if (dateObject) {
       const modificationDate = document.createElement("span");
+      modificationDate.className = "popupDate";
       modificationDate.textContent = "{{date}}, {{time}}";
       modificationDate.dataset.l10nId = "annotation_date_string";
       modificationDate.dataset.l10nArgs = JSON.stringify({
@@ -10441,9 +10805,19 @@ class PopupElement {
       popup.appendChild(modificationDate);
     }
 
-    const contents = this._formatContents(this.contentsObj);
+    if (this.richText?.str && (!this.contentsObj?.str || this.contentsObj.str === this.richText.str)) {
+      _xfa_layer.XfaLayer.render({
+        xfaHtml: this.richText.html,
+        intent: "richText",
+        div: popup
+      });
+
+      popup.lastChild.className = "richText popupContent";
+    } else {
+      const contents = this._formatContents(this.contentsObj);
 
-    popup.appendChild(contents);
+      popup.appendChild(contents);
+    }
 
     if (!Array.isArray(this.trigger)) {
       this.trigger = [this.trigger];
@@ -10465,6 +10839,7 @@ class PopupElement {
     dir
   }) {
     const p = document.createElement("p");
+    p.className = "popupContent";
     p.dir = dir;
     const lines = str.split(/(?:\r\n?|\n)/);
 
@@ -10514,7 +10889,7 @@ class PopupElement {
 
 class FreeTextAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true
@@ -10535,7 +10910,7 @@ class FreeTextAnnotationElement extends AnnotationElement {
 
 class LineAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true
@@ -10555,6 +10930,7 @@ class LineAnnotationElement extends AnnotationElement {
     line.setAttribute("y2", data.rect[3] - data.lineCoordinates[3]);
     line.setAttribute("stroke-width", data.borderStyle.width || 1);
     line.setAttribute("stroke", "transparent");
+    line.setAttribute("fill", "transparent");
     svg.appendChild(line);
     this.container.append(svg);
 
@@ -10567,7 +10943,7 @@ class LineAnnotationElement extends AnnotationElement {
 
 class SquareAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true
@@ -10588,7 +10964,7 @@ class SquareAnnotationElement extends AnnotationElement {
     square.setAttribute("height", height - borderWidth);
     square.setAttribute("stroke-width", borderWidth || 1);
     square.setAttribute("stroke", "transparent");
-    square.setAttribute("fill", "none");
+    square.setAttribute("fill", "transparent");
     svg.appendChild(square);
     this.container.append(svg);
 
@@ -10601,7 +10977,7 @@ class SquareAnnotationElement extends AnnotationElement {
 
 class CircleAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true
@@ -10622,7 +10998,7 @@ class CircleAnnotationElement extends AnnotationElement {
     circle.setAttribute("ry", height / 2 - borderWidth / 2);
     circle.setAttribute("stroke-width", borderWidth || 1);
     circle.setAttribute("stroke", "transparent");
-    circle.setAttribute("fill", "none");
+    circle.setAttribute("fill", "transparent");
     svg.appendChild(circle);
     this.container.append(svg);
 
@@ -10635,7 +11011,7 @@ class CircleAnnotationElement extends AnnotationElement {
 
 class PolylineAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true
@@ -10663,7 +11039,7 @@ class PolylineAnnotationElement extends AnnotationElement {
     polyline.setAttribute("points", points);
     polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
     polyline.setAttribute("stroke", "transparent");
-    polyline.setAttribute("fill", "none");
+    polyline.setAttribute("fill", "transparent");
     svg.appendChild(polyline);
     this.container.append(svg);
 
@@ -10685,7 +11061,7 @@ class PolygonAnnotationElement extends PolylineAnnotationElement {
 
 class CaretAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true
@@ -10706,7 +11082,7 @@ class CaretAnnotationElement extends AnnotationElement {
 
 class InkAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true
@@ -10736,7 +11112,7 @@ class InkAnnotationElement extends AnnotationElement {
       polyline.setAttribute("points", points);
       polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
       polyline.setAttribute("stroke", "transparent");
-      polyline.setAttribute("fill", "none");
+      polyline.setAttribute("fill", "transparent");
 
       this._createPopup(polyline, data);
 
@@ -10751,7 +11127,7 @@ class InkAnnotationElement extends AnnotationElement {
 
 class HighlightAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true,
@@ -10776,7 +11152,7 @@ class HighlightAnnotationElement extends AnnotationElement {
 
 class UnderlineAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true,
@@ -10801,7 +11177,7 @@ class UnderlineAnnotationElement extends AnnotationElement {
 
 class SquigglyAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true,
@@ -10826,7 +11202,7 @@ class SquigglyAnnotationElement extends AnnotationElement {
 
 class StrikeOutAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true,
@@ -10851,7 +11227,7 @@ class StrikeOutAnnotationElement extends AnnotationElement {
 
 class StampAnnotationElement extends AnnotationElement {
   constructor(parameters) {
-    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str);
+    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || 
parameters.data.contentsObj?.str || parameters.data.richText?.str);
     super(parameters, {
       isRenderable,
       ignoreBorder: true
@@ -10896,7 +11272,7 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
     trigger.style.width = this.container.style.width;
     trigger.addEventListener("dblclick", this._download.bind(this));
 
-    if (!this.data.hasPopup && (this.data.titleObj?.str || this.data.contentsObj?.str)) {
+    if (!this.data.hasPopup && (this.data.titleObj?.str || this.data.contentsObj?.str || 
this.data.richText)) {
       this._createPopup(trigger, this.data);
     }
 
@@ -10932,10 +11308,12 @@ class AnnotationLayer {
       sortedAnnotations.push(...popupAnnotations);
     }
 
+    const div = parameters.div;
+
     for (const data of sortedAnnotations) {
       const element = AnnotationElementFactory.create({
         data,
-        layer: parameters.div,
+        layer: div,
         page: parameters.page,
         viewport: parameters.viewport,
         linkService: parameters.linkService,
@@ -10961,33 +11339,93 @@ class AnnotationLayer {
 
         if (Array.isArray(rendered)) {
           for (const renderedElement of rendered) {
-            parameters.div.appendChild(renderedElement);
+            div.appendChild(renderedElement);
           }
         } else {
           if (element instanceof PopupAnnotationElement) {
-            parameters.div.prepend(rendered);
+            div.prepend(rendered);
           } else {
-            parameters.div.appendChild(rendered);
+            div.appendChild(rendered);
           }
         }
       }
     }
+
+    this.#setAnnotationCanvasMap(div, parameters.annotationCanvasMap);
   }
 
   static update(parameters) {
-    const transform = `matrix(${parameters.viewport.transform.join(",")})`;
+    const {
+      page,
+      viewport,
+      annotations,
+      annotationCanvasMap,
+      div
+    } = parameters;
+    const transform = viewport.transform;
+    const matrix = `matrix(${transform.join(",")})`;
+    let scale, ownMatrix;
 
-    for (const data of parameters.annotations) {
-      const elements = parameters.div.querySelectorAll(`[data-annotation-id="${data.id}"]`);
+    for (const data of annotations) {
+      const elements = div.querySelectorAll(`[data-annotation-id="${data.id}"]`);
 
       if (elements) {
         for (const element of elements) {
-          element.style.transform = transform;
+          if (data.hasOwnCanvas) {
+            const rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], 
data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
+
+            if (!ownMatrix) {
+              scale = Math.abs(transform[0] || transform[1]);
+              const ownTransform = transform.slice();
+
+              for (let i = 0; i < 4; i++) {
+                ownTransform[i] = Math.sign(ownTransform[i]);
+              }
+
+              ownMatrix = `matrix(${ownTransform.join(",")})`;
+            }
+
+            const left = rect[0] * scale;
+            const top = rect[1] * scale;
+            element.style.left = `${left}px`;
+            element.style.top = `${top}px`;
+            element.style.transformOrigin = `${-left}px ${-top}px`;
+            element.style.transform = ownMatrix;
+          } else {
+            element.style.transform = matrix;
+          }
         }
       }
     }
 
-    parameters.div.hidden = false;
+    this.#setAnnotationCanvasMap(div, annotationCanvasMap);
+    div.hidden = false;
+  }
+
+  static #setAnnotationCanvasMap(div, annotationCanvasMap) {
+    if (!annotationCanvasMap) {
+      return;
+    }
+
+    for (const [id, canvas] of annotationCanvasMap) {
+      const element = div.querySelector(`[data-annotation-id="${id}"]`);
+
+      if (!element) {
+        continue;
+      }
+
+      const {
+        firstChild
+      } = element;
+
+      if (firstChild.nodeName === "CANVAS") {
+        element.replaceChild(canvas, firstChild);
+      } else {
+        element.insertBefore(canvas, firstChild);
+      }
+    }
+
+    annotationCanvasMap.clear();
   }
 
 }
@@ -11071,82 +11509,336 @@ exports.ColorConverters = ColorConverters;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.renderTextLayer = renderTextLayer;
+exports.XfaLayer = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
-const MAX_TEXT_DIVS_TO_RENDER = 100000;
-const DEFAULT_FONT_SIZE = 30;
-const DEFAULT_FONT_ASCENT = 0.8;
-const ascentCache = new Map();
-const AllWhitespaceRegexp = /^\s+$/g;
+var _xfa_text = __w_pdfjs_require__(17);
 
-function getAscent(fontFamily, ctx) {
-  const cachedAscent = ascentCache.get(fontFamily);
+class XfaLayer {
+  static setupStorage(html, id, element, storage, intent) {
+    const storedData = storage.getValue(id, {
+      value: null
+    });
 
-  if (cachedAscent) {
-    return cachedAscent;
-  }
+    switch (element.name) {
+      case "textarea":
+        if (storedData.value !== null) {
+          html.textContent = storedData.value;
+        }
 
-  ctx.save();
-  ctx.font = `${DEFAULT_FONT_SIZE}px ${fontFamily}`;
-  const metrics = ctx.measureText("");
-  let ascent = metrics.fontBoundingBoxAscent;
-  let descent = Math.abs(metrics.fontBoundingBoxDescent);
+        if (intent === "print") {
+          break;
+        }
 
-  if (ascent) {
-    ctx.restore();
-    const ratio = ascent / (ascent + descent);
-    ascentCache.set(fontFamily, ratio);
-    return ratio;
-  }
+        html.addEventListener("input", event => {
+          storage.setValue(id, {
+            value: event.target.value
+          });
+        });
+        break;
 
-  ctx.strokeStyle = "red";
-  ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
-  ctx.strokeText("g", 0, 0);
-  let pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
-  descent = 0;
+      case "input":
+        if (element.attributes.type === "radio" || element.attributes.type === "checkbox") {
+          if (storedData.value === element.attributes.xfaOn) {
+            html.setAttribute("checked", true);
+          } else if (storedData.value === element.attributes.xfaOff) {
+            html.removeAttribute("checked");
+          }
 
-  for (let i = pixels.length - 1 - 3; i >= 0; i -= 4) {
-    if (pixels[i] > 0) {
-      descent = Math.ceil(i / 4 / DEFAULT_FONT_SIZE);
-      break;
-    }
-  }
+          if (intent === "print") {
+            break;
+          }
 
-  ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
-  ctx.strokeText("A", 0, DEFAULT_FONT_SIZE);
-  pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
-  ascent = 0;
+          html.addEventListener("change", event => {
+            storage.setValue(id, {
+              value: event.target.checked ? event.target.getAttribute("xfaOn") : 
event.target.getAttribute("xfaOff")
+            });
+          });
+        } else {
+          if (storedData.value !== null) {
+            html.setAttribute("value", storedData.value);
+          }
 
-  for (let i = 0, ii = pixels.length; i < ii; i += 4) {
-    if (pixels[i] > 0) {
-      ascent = DEFAULT_FONT_SIZE - Math.floor(i / 4 / DEFAULT_FONT_SIZE);
-      break;
-    }
-  }
+          if (intent === "print") {
+            break;
+          }
 
-  ctx.restore();
+          html.addEventListener("input", event => {
+            storage.setValue(id, {
+              value: event.target.value
+            });
+          });
+        }
 
-  if (ascent) {
-    const ratio = ascent / (ascent + descent);
-    ascentCache.set(fontFamily, ratio);
-    return ratio;
-  }
+        break;
 
-  ascentCache.set(fontFamily, DEFAULT_FONT_ASCENT);
-  return DEFAULT_FONT_ASCENT;
-}
+      case "select":
+        if (storedData.value !== null) {
+          for (const option of element.children) {
+            if (option.attributes.value === storedData.value) {
+              option.attributes.selected = true;
+            }
+          }
+        }
 
-function appendText(task, geom, styles, ctx) {
-  const textDiv = document.createElement("span");
-  const textDivProperties = task._enhanceTextSelection ? {
-    angle: 0,
-    canvasWidth: 0,
-    hasText: geom.str !== "",
-    hasEOL: geom.hasEOL,
-    originalTransform: null,
-    paddingBottom: 0,
+        html.addEventListener("input", event => {
+          const options = event.target.options;
+          const value = options.selectedIndex === -1 ? "" : options[options.selectedIndex].value;
+          storage.setValue(id, {
+            value
+          });
+        });
+        break;
+    }
+  }
+
+  static setAttributes({
+    html,
+    element,
+    storage = null,
+    intent,
+    linkService
+  }) {
+    const {
+      attributes
+    } = element;
+    const isHTMLAnchorElement = html instanceof HTMLAnchorElement;
+
+    if (attributes.type === "radio") {
+      attributes.name = `${attributes.name}-${intent}`;
+    }
+
+    for (const [key, value] of Object.entries(attributes)) {
+      if (value === null || value === undefined || key === "dataId") {
+        continue;
+      }
+
+      if (key !== "style") {
+        if (key === "textContent") {
+          html.textContent = value;
+        } else if (key === "class") {
+          if (value.length) {
+            html.setAttribute(key, value.join(" "));
+          }
+        } else {
+          if (isHTMLAnchorElement && (key === "href" || key === "newWindow")) {
+            continue;
+          }
+
+          html.setAttribute(key, value);
+        }
+      } else {
+        Object.assign(html.style, value);
+      }
+    }
+
+    if (isHTMLAnchorElement) {
+      if (!linkService.addLinkAttributes) {
+        (0, _util.warn)("XfaLayer.setAttribute - missing `addLinkAttributes`-method on the 
`linkService`-instance.");
+      }
+
+      linkService.addLinkAttributes?.(html, attributes.href, attributes.newWindow);
+    }
+
+    if (storage && attributes.dataId) {
+      this.setupStorage(html, attributes.dataId, element, storage);
+    }
+  }
+
+  static render(parameters) {
+    const storage = parameters.annotationStorage;
+    const linkService = parameters.linkService;
+    const root = parameters.xfaHtml;
+    const intent = parameters.intent || "display";
+    const rootHtml = document.createElement(root.name);
+
+    if (root.attributes) {
+      this.setAttributes({
+        html: rootHtml,
+        element: root,
+        intent,
+        linkService
+      });
+    }
+
+    const stack = [[root, -1, rootHtml]];
+    const rootDiv = parameters.div;
+    rootDiv.appendChild(rootHtml);
+
+    if (parameters.viewport) {
+      const transform = `matrix(${parameters.viewport.transform.join(",")})`;
+      rootDiv.style.transform = transform;
+    }
+
+    if (intent !== "richText") {
+      rootDiv.setAttribute("class", "xfaLayer xfaFont");
+    }
+
+    const textDivs = [];
+
+    while (stack.length > 0) {
+      const [parent, i, html] = stack[stack.length - 1];
+
+      if (i + 1 === parent.children.length) {
+        stack.pop();
+        continue;
+      }
+
+      const child = parent.children[++stack[stack.length - 1][1]];
+
+      if (child === null) {
+        continue;
+      }
+
+      const {
+        name
+      } = child;
+
+      if (name === "#text") {
+        const node = document.createTextNode(child.value);
+        textDivs.push(node);
+        html.appendChild(node);
+        continue;
+      }
+
+      let childHtml;
+
+      if (child?.attributes?.xmlns) {
+        childHtml = document.createElementNS(child.attributes.xmlns, name);
+      } else {
+        childHtml = document.createElement(name);
+      }
+
+      html.appendChild(childHtml);
+
+      if (child.attributes) {
+        this.setAttributes({
+          html: childHtml,
+          element: child,
+          storage,
+          intent,
+          linkService
+        });
+      }
+
+      if (child.children && child.children.length > 0) {
+        stack.push([child, -1, childHtml]);
+      } else if (child.value) {
+        const node = document.createTextNode(child.value);
+
+        if (_xfa_text.XfaText.shouldBuildText(name)) {
+          textDivs.push(node);
+        }
+
+        childHtml.appendChild(node);
+      }
+    }
+
+    for (const el of rootDiv.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea")) {
+      el.setAttribute("readOnly", true);
+    }
+
+    return {
+      textDivs
+    };
+  }
+
+  static update(parameters) {
+    const transform = `matrix(${parameters.viewport.transform.join(",")})`;
+    parameters.div.style.transform = transform;
+    parameters.div.hidden = false;
+  }
+
+}
+
+exports.XfaLayer = XfaLayer;
+
+/***/ }),
+/* 21 */
+/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+  value: true
+}));
+exports.renderTextLayer = renderTextLayer;
+
+var _util = __w_pdfjs_require__(2);
+
+const MAX_TEXT_DIVS_TO_RENDER = 100000;
+const DEFAULT_FONT_SIZE = 30;
+const DEFAULT_FONT_ASCENT = 0.8;
+const ascentCache = new Map();
+const AllWhitespaceRegexp = /^\s+$/g;
+
+function getAscent(fontFamily, ctx) {
+  const cachedAscent = ascentCache.get(fontFamily);
+
+  if (cachedAscent) {
+    return cachedAscent;
+  }
+
+  ctx.save();
+  ctx.font = `${DEFAULT_FONT_SIZE}px ${fontFamily}`;
+  const metrics = ctx.measureText("");
+  let ascent = metrics.fontBoundingBoxAscent;
+  let descent = Math.abs(metrics.fontBoundingBoxDescent);
+
+  if (ascent) {
+    ctx.restore();
+    const ratio = ascent / (ascent + descent);
+    ascentCache.set(fontFamily, ratio);
+    return ratio;
+  }
+
+  ctx.strokeStyle = "red";
+  ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
+  ctx.strokeText("g", 0, 0);
+  let pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
+  descent = 0;
+
+  for (let i = pixels.length - 1 - 3; i >= 0; i -= 4) {
+    if (pixels[i] > 0) {
+      descent = Math.ceil(i / 4 / DEFAULT_FONT_SIZE);
+      break;
+    }
+  }
+
+  ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
+  ctx.strokeText("A", 0, DEFAULT_FONT_SIZE);
+  pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
+  ascent = 0;
+
+  for (let i = 0, ii = pixels.length; i < ii; i += 4) {
+    if (pixels[i] > 0) {
+      ascent = DEFAULT_FONT_SIZE - Math.floor(i / 4 / DEFAULT_FONT_SIZE);
+      break;
+    }
+  }
+
+  ctx.restore();
+
+  if (ascent) {
+    const ratio = ascent / (ascent + descent);
+    ascentCache.set(fontFamily, ratio);
+    return ratio;
+  }
+
+  ascentCache.set(fontFamily, DEFAULT_FONT_ASCENT);
+  return DEFAULT_FONT_ASCENT;
+}
+
+function appendText(task, geom, styles, ctx) {
+  const textDiv = document.createElement("span");
+  const textDivProperties = task._enhanceTextSelection ? {
+    angle: 0,
+    canvasWidth: 0,
+    hasText: geom.str !== "",
+    hasEOL: geom.hasEOL,
+    originalTransform: null,
+    paddingBottom: 0,
     paddingLeft: 0,
     paddingRight: 0,
     paddingTop: 0,
@@ -11201,7 +11893,7 @@ function appendText(task, geom, styles, ctx) {
 
   if (geom.str.length > 1 || task._enhanceTextSelection && AllWhitespaceRegexp.test(geom.str)) {
     shouldScaleText = true;
-  } else if (geom.transform[0] !== geom.transform[3]) {
+  } else if (geom.str !== " " && geom.transform[0] !== geom.transform[3]) {
     const absScaleX = Math.abs(geom.transform[0]),
           absScaleY = Math.abs(geom.transform[3]);
 
@@ -11845,7 +12537,7 @@ function renderTextLayer(renderParameters) {
 }
 
 /***/ }),
-/* 21 */
+/* 22 */
 /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
 
 
@@ -12896,6 +13588,10 @@ exports.SVGGraphics = SVGGraphics;
     }
 
     _makeShadingPattern(args) {
+      if (typeof args === "string") {
+        args = this.objs.get(args);
+      }
+
       switch (args[0]) {
         case "RadialAxial":
           const shadingId = `shading${shadingCount++}`;
@@ -13372,252 +14068,7 @@ exports.SVGGraphics = SVGGraphics;
 }
 
 /***/ }),
-/* 22 */
-/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
-
-
-
-Object.defineProperty(exports, "__esModule", ({
-  value: true
-}));
-exports.XfaLayer = void 0;
-
-var _util = __w_pdfjs_require__(2);
-
-var _xfa_text = __w_pdfjs_require__(17);
-
-class XfaLayer {
-  static setupStorage(html, id, element, storage, intent) {
-    const storedData = storage.getValue(id, {
-      value: null
-    });
-
-    switch (element.name) {
-      case "textarea":
-        if (storedData.value !== null) {
-          html.textContent = storedData.value;
-        }
-
-        if (intent === "print") {
-          break;
-        }
-
-        html.addEventListener("input", event => {
-          storage.setValue(id, {
-            value: event.target.value
-          });
-        });
-        break;
-
-      case "input":
-        if (element.attributes.type === "radio" || element.attributes.type === "checkbox") {
-          if (storedData.value === element.attributes.xfaOn) {
-            html.setAttribute("checked", true);
-          } else if (storedData.value === element.attributes.xfaOff) {
-            html.removeAttribute("checked");
-          }
-
-          if (intent === "print") {
-            break;
-          }
-
-          html.addEventListener("change", event => {
-            storage.setValue(id, {
-              value: event.target.checked ? event.target.getAttribute("xfaOn") : 
event.target.getAttribute("xfaOff")
-            });
-          });
-        } else {
-          if (storedData.value !== null) {
-            html.setAttribute("value", storedData.value);
-          }
-
-          if (intent === "print") {
-            break;
-          }
-
-          html.addEventListener("input", event => {
-            storage.setValue(id, {
-              value: event.target.value
-            });
-          });
-        }
-
-        break;
-
-      case "select":
-        if (storedData.value !== null) {
-          for (const option of element.children) {
-            if (option.attributes.value === storedData.value) {
-              option.attributes.selected = true;
-            }
-          }
-        }
-
-        html.addEventListener("input", event => {
-          const options = event.target.options;
-          const value = options.selectedIndex === -1 ? "" : options[options.selectedIndex].value;
-          storage.setValue(id, {
-            value
-          });
-        });
-        break;
-    }
-  }
-
-  static setAttributes({
-    html,
-    element,
-    storage = null,
-    intent,
-    linkService
-  }) {
-    const {
-      attributes
-    } = element;
-    const isHTMLAnchorElement = html instanceof HTMLAnchorElement;
-
-    if (attributes.type === "radio") {
-      attributes.name = `${attributes.name}-${intent}`;
-    }
-
-    for (const [key, value] of Object.entries(attributes)) {
-      if (value === null || value === undefined || key === "dataId") {
-        continue;
-      }
-
-      if (key !== "style") {
-        if (key === "textContent") {
-          html.textContent = value;
-        } else if (key === "class") {
-          html.setAttribute(key, value.join(" "));
-        } else {
-          if (isHTMLAnchorElement && (key === "href" || key === "newWindow")) {
-            continue;
-          }
-
-          html.setAttribute(key, value);
-        }
-      } else {
-        Object.assign(html.style, value);
-      }
-    }
-
-    if (isHTMLAnchorElement) {
-      if (!linkService.addLinkAttributes) {
-        (0, _util.warn)("XfaLayer.setAttribute - missing `addLinkAttributes`-method on the 
`linkService`-instance.");
-      }
-
-      linkService.addLinkAttributes?.(html, attributes.href, attributes.newWindow);
-    }
-
-    if (storage && attributes.dataId) {
-      this.setupStorage(html, attributes.dataId, element, storage);
-    }
-  }
-
-  static render(parameters) {
-    const storage = parameters.annotationStorage;
-    const linkService = parameters.linkService;
-    const root = parameters.xfa;
-    const intent = parameters.intent || "display";
-    const rootHtml = document.createElement(root.name);
-
-    if (root.attributes) {
-      this.setAttributes({
-        html: rootHtml,
-        element: root,
-        intent,
-        linkService
-      });
-    }
-
-    const stack = [[root, -1, rootHtml]];
-    const rootDiv = parameters.div;
-    rootDiv.appendChild(rootHtml);
-    const transform = `matrix(${parameters.viewport.transform.join(",")})`;
-    rootDiv.style.transform = transform;
-    rootDiv.setAttribute("class", "xfaLayer xfaFont");
-    const textDivs = [];
-
-    while (stack.length > 0) {
-      const [parent, i, html] = stack[stack.length - 1];
-
-      if (i + 1 === parent.children.length) {
-        stack.pop();
-        continue;
-      }
-
-      const child = parent.children[++stack[stack.length - 1][1]];
-
-      if (child === null) {
-        continue;
-      }
-
-      const {
-        name
-      } = child;
-
-      if (name === "#text") {
-        const node = document.createTextNode(child.value);
-        textDivs.push(node);
-        html.appendChild(node);
-        continue;
-      }
-
-      let childHtml;
-
-      if (child?.attributes?.xmlns) {
-        childHtml = document.createElementNS(child.attributes.xmlns, name);
-      } else {
-        childHtml = document.createElement(name);
-      }
-
-      html.appendChild(childHtml);
-
-      if (child.attributes) {
-        this.setAttributes({
-          html: childHtml,
-          element: child,
-          storage,
-          intent,
-          linkService
-        });
-      }
-
-      if (child.children && child.children.length > 0) {
-        stack.push([child, -1, childHtml]);
-      } else if (child.value) {
-        const node = document.createTextNode(child.value);
-
-        if (_xfa_text.XfaText.shouldBuildText(name)) {
-          textDivs.push(node);
-        }
-
-        childHtml.appendChild(node);
-      }
-    }
-
-    for (const el of rootDiv.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea")) {
-      el.setAttribute("readOnly", true);
-    }
-
-    return {
-      textDivs
-    };
-  }
-
-  static update(parameters) {
-    const transform = `matrix(${parameters.viewport.transform.join(",")})`;
-    parameters.div.style.transform = transform;
-    parameters.div.hidden = false;
-  }
-
-}
-
-exports.XfaLayer = XfaLayer;
-
-/***/ }),
-/* 23 */
+/* 23 */
 /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
 
 
@@ -15225,34 +15676,34 @@ var exports = __webpack_exports__;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-Object.defineProperty(exports, "addLinkAttributes", ({
+Object.defineProperty(exports, "AnnotationLayer", ({
   enumerable: true,
   get: function () {
-    return _display_utils.addLinkAttributes;
+    return _annotation_layer.AnnotationLayer;
   }
 }));
-Object.defineProperty(exports, "getFilenameFromUrl", ({
+Object.defineProperty(exports, "AnnotationMode", ({
   enumerable: true,
   get: function () {
-    return _display_utils.getFilenameFromUrl;
+    return _util.AnnotationMode;
   }
 }));
-Object.defineProperty(exports, "getPdfFilenameFromUrl", ({
+Object.defineProperty(exports, "CMapCompressionType", ({
   enumerable: true,
   get: function () {
-    return _display_utils.getPdfFilenameFromUrl;
+    return _util.CMapCompressionType;
   }
 }));
-Object.defineProperty(exports, "getXfaPageViewport", ({
+Object.defineProperty(exports, "GlobalWorkerOptions", ({
   enumerable: true,
   get: function () {
-    return _display_utils.getXfaPageViewport;
+    return _worker_options.GlobalWorkerOptions;
   }
 }));
-Object.defineProperty(exports, "isPdfFile", ({
+Object.defineProperty(exports, "InvalidPDFException", ({
   enumerable: true,
   get: function () {
-    return _display_utils.isPdfFile;
+    return _util.InvalidPDFException;
   }
 }));
 Object.defineProperty(exports, "LinkTarget", ({
@@ -15261,130 +15712,130 @@ Object.defineProperty(exports, "LinkTarget", ({
     return _display_utils.LinkTarget;
   }
 }));
-Object.defineProperty(exports, "loadScript", ({
+Object.defineProperty(exports, "LoopbackPort", ({
   enumerable: true,
   get: function () {
-    return _display_utils.loadScript;
+    return _api.LoopbackPort;
   }
 }));
-Object.defineProperty(exports, "PDFDateString", ({
+Object.defineProperty(exports, "MissingPDFException", ({
   enumerable: true,
   get: function () {
-    return _display_utils.PDFDateString;
+    return _util.MissingPDFException;
   }
 }));
-Object.defineProperty(exports, "PixelsPerInch", ({
+Object.defineProperty(exports, "OPS", ({
   enumerable: true,
   get: function () {
-    return _display_utils.PixelsPerInch;
+    return _util.OPS;
   }
 }));
-Object.defineProperty(exports, "RenderingCancelledException", ({
+Object.defineProperty(exports, "PDFDataRangeTransport", ({
   enumerable: true,
   get: function () {
-    return _display_utils.RenderingCancelledException;
+    return _api.PDFDataRangeTransport;
   }
 }));
-Object.defineProperty(exports, "AnnotationMode", ({
+Object.defineProperty(exports, "PDFDateString", ({
   enumerable: true,
   get: function () {
-    return _util.AnnotationMode;
+    return _display_utils.PDFDateString;
   }
 }));
-Object.defineProperty(exports, "CMapCompressionType", ({
+Object.defineProperty(exports, "PDFWorker", ({
   enumerable: true,
   get: function () {
-    return _util.CMapCompressionType;
+    return _api.PDFWorker;
   }
 }));
-Object.defineProperty(exports, "createObjectURL", ({
+Object.defineProperty(exports, "PasswordResponses", ({
   enumerable: true,
   get: function () {
-    return _util.createObjectURL;
+    return _util.PasswordResponses;
   }
 }));
-Object.defineProperty(exports, "createPromiseCapability", ({
+Object.defineProperty(exports, "PermissionFlag", ({
   enumerable: true,
   get: function () {
-    return _util.createPromiseCapability;
+    return _util.PermissionFlag;
   }
 }));
-Object.defineProperty(exports, "createValidAbsoluteUrl", ({
+Object.defineProperty(exports, "PixelsPerInch", ({
   enumerable: true,
   get: function () {
-    return _util.createValidAbsoluteUrl;
+    return _display_utils.PixelsPerInch;
   }
 }));
-Object.defineProperty(exports, "InvalidPDFException", ({
+Object.defineProperty(exports, "RenderingCancelledException", ({
   enumerable: true,
   get: function () {
-    return _util.InvalidPDFException;
+    return _display_utils.RenderingCancelledException;
   }
 }));
-Object.defineProperty(exports, "MissingPDFException", ({
+Object.defineProperty(exports, "SVGGraphics", ({
   enumerable: true,
   get: function () {
-    return _util.MissingPDFException;
+    return _svg.SVGGraphics;
   }
 }));
-Object.defineProperty(exports, "OPS", ({
+Object.defineProperty(exports, "UNSUPPORTED_FEATURES", ({
   enumerable: true,
   get: function () {
-    return _util.OPS;
+    return _util.UNSUPPORTED_FEATURES;
   }
 }));
-Object.defineProperty(exports, "PasswordResponses", ({
+Object.defineProperty(exports, "UnexpectedResponseException", ({
   enumerable: true,
   get: function () {
-    return _util.PasswordResponses;
+    return _util.UnexpectedResponseException;
   }
 }));
-Object.defineProperty(exports, "PermissionFlag", ({
+Object.defineProperty(exports, "Util", ({
   enumerable: true,
   get: function () {
-    return _util.PermissionFlag;
+    return _util.Util;
   }
 }));
-Object.defineProperty(exports, "removeNullCharacters", ({
+Object.defineProperty(exports, "VerbosityLevel", ({
   enumerable: true,
   get: function () {
-    return _util.removeNullCharacters;
+    return _util.VerbosityLevel;
   }
 }));
-Object.defineProperty(exports, "shadow", ({
+Object.defineProperty(exports, "XfaLayer", ({
   enumerable: true,
   get: function () {
-    return _util.shadow;
+    return _xfa_layer.XfaLayer;
   }
 }));
-Object.defineProperty(exports, "UnexpectedResponseException", ({
+Object.defineProperty(exports, "addLinkAttributes", ({
   enumerable: true,
   get: function () {
-    return _util.UnexpectedResponseException;
+    return _display_utils.addLinkAttributes;
   }
 }));
-Object.defineProperty(exports, "UNSUPPORTED_FEATURES", ({
+Object.defineProperty(exports, "build", ({
   enumerable: true,
   get: function () {
-    return _util.UNSUPPORTED_FEATURES;
+    return _api.build;
   }
 }));
-Object.defineProperty(exports, "Util", ({
+Object.defineProperty(exports, "createObjectURL", ({
   enumerable: true,
   get: function () {
-    return _util.Util;
+    return _util.createObjectURL;
   }
 }));
-Object.defineProperty(exports, "VerbosityLevel", ({
+Object.defineProperty(exports, "createPromiseCapability", ({
   enumerable: true,
   get: function () {
-    return _util.VerbosityLevel;
+    return _util.createPromiseCapability;
   }
 }));
-Object.defineProperty(exports, "build", ({
+Object.defineProperty(exports, "createValidAbsoluteUrl", ({
   enumerable: true,
   get: function () {
-    return _api.build;
+    return _util.createValidAbsoluteUrl;
   }
 }));
 Object.defineProperty(exports, "getDocument", ({
@@ -15393,40 +15844,40 @@ Object.defineProperty(exports, "getDocument", ({
     return _api.getDocument;
   }
 }));
-Object.defineProperty(exports, "LoopbackPort", ({
+Object.defineProperty(exports, "getFilenameFromUrl", ({
   enumerable: true,
   get: function () {
-    return _api.LoopbackPort;
+    return _display_utils.getFilenameFromUrl;
   }
 }));
-Object.defineProperty(exports, "PDFDataRangeTransport", ({
+Object.defineProperty(exports, "getPdfFilenameFromUrl", ({
   enumerable: true,
   get: function () {
-    return _api.PDFDataRangeTransport;
+    return _display_utils.getPdfFilenameFromUrl;
   }
 }));
-Object.defineProperty(exports, "PDFWorker", ({
+Object.defineProperty(exports, "getXfaPageViewport", ({
   enumerable: true,
   get: function () {
-    return _api.PDFWorker;
+    return _display_utils.getXfaPageViewport;
   }
 }));
-Object.defineProperty(exports, "version", ({
+Object.defineProperty(exports, "isPdfFile", ({
   enumerable: true,
   get: function () {
-    return _api.version;
+    return _display_utils.isPdfFile;
   }
 }));
-Object.defineProperty(exports, "AnnotationLayer", ({
+Object.defineProperty(exports, "loadScript", ({
   enumerable: true,
   get: function () {
-    return _annotation_layer.AnnotationLayer;
+    return _display_utils.loadScript;
   }
 }));
-Object.defineProperty(exports, "GlobalWorkerOptions", ({
+Object.defineProperty(exports, "removeNullCharacters", ({
   enumerable: true,
   get: function () {
-    return _worker_options.GlobalWorkerOptions;
+    return _util.removeNullCharacters;
   }
 }));
 Object.defineProperty(exports, "renderTextLayer", ({
@@ -15435,16 +15886,16 @@ Object.defineProperty(exports, "renderTextLayer", ({
     return _text_layer.renderTextLayer;
   }
 }));
-Object.defineProperty(exports, "SVGGraphics", ({
+Object.defineProperty(exports, "shadow", ({
   enumerable: true,
   get: function () {
-    return _svg.SVGGraphics;
+    return _util.shadow;
   }
 }));
-Object.defineProperty(exports, "XfaLayer", ({
+Object.defineProperty(exports, "version", ({
   enumerable: true,
   get: function () {
-    return _xfa_layer.XfaLayer;
+    return _api.version;
   }
 }));
 
@@ -15460,14 +15911,14 @@ var _worker_options = __w_pdfjs_require__(12);
 
 var _is_node = __w_pdfjs_require__(4);
 
-var _text_layer = __w_pdfjs_require__(20);
+var _text_layer = __w_pdfjs_require__(21);
 
-var _svg = __w_pdfjs_require__(21);
+var _svg = __w_pdfjs_require__(22);
 
-var _xfa_layer = __w_pdfjs_require__(22);
+var _xfa_layer = __w_pdfjs_require__(20);
 
-const pdfjsVersion = '2.11.338';
-const pdfjsBuild = 'dedff3c98';
+const pdfjsVersion = '2.12.313';
+const pdfjsBuild = 'a2ae56f39';
 {
   if (_is_node.isNodeJS) {
     const {
diff --git a/third-party/pdfjs/build/pdf.sandbox.js b/third-party/pdfjs/build/pdf.sandbox.js
index 3583ce2a4..283e3e537 100644
--- a/third-party/pdfjs/build/pdf.sandbox.js
+++ b/third-party/pdfjs/build/pdf.sandbox.js
@@ -215,8 +215,8 @@ var _pdfSandboxExternal = __w_pdfjs_require__(2);
 
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
-const pdfjsVersion = '2.11.338';
-const pdfjsBuild = 'dedff3c98';
+const pdfjsVersion = '2.12.313';
+const pdfjsBuild = 'a2ae56f39';
 
 class SandboxSupport extends _pdfSandboxExternal.SandboxSupportBase {
   exportValueToSandbox(val) {
@@ -242,7 +242,7 @@ class Sandbox {
   }
 
   create(data) {
-    const code = ['(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 
\'object\' && typeof module === \'object\')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 
\'function\' && define.amd)\n\t\tdefine("pdfjs-dist/build/pdf.scripting", [], factory);\n\telse if(typeof 
exports === \'object\')\n\t\texports["pdfjs-dist/build/pdf.scripting"] = 
factory();\n\telse\n\t\troot.pdfjsScripting = factory();\n})(this, function() {\nreturn /******/ (() => { // 
webpackBootstrap\n/******/ \t"use strict";\n/******/ \tvar __webpack_modules__ = ([\n/* 0 */,\n/* 1 */\n/***/ 
((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, 
"__esModule", ({\n  value: true\n}));\nexports.initSandbox = initSandbox;\n\nvar _constants = 
__w_pdfjs_require__(2);\n\nvar _field = __w_pdfjs_require__(3);\n\nvar _aform = 
__w_pdfjs_require__(8);\n\nvar _app = __w_pdfjs_require__(9);\n\nvar _color = __w_pdfjs_require__(5);\n\nvar 
_conso
 le = __w_pdfjs_require__(13);\n\nvar _doc = __w_pdfjs_require__(14);\n\nvar _proxy = 
__w_pdfjs_require__(16);\n\nvar _util = __w_pdfjs_require__(17);\n\nfunction initSandbox(params) {\n  delete 
globalThis.pdfjsScripting;\n  const externalCall = globalThis.callExternalFunction;\n  delete 
globalThis.callExternalFunction;\n\n  const globalEval = code => globalThis.eval(code);\n\n  const send = 
data => externalCall("send", [data]);\n\n  const proxyHandler = new _proxy.ProxyHandler();\n  const {\n    
data\n  } = params;\n  const doc = new _doc.Doc({\n    send,\n    globalEval,\n    ...data.docInfo\n  });\n  
const _document = {\n    obj: doc,\n    wrapped: new Proxy(doc, proxyHandler)\n  };\n  const app = new 
_app.App({\n    send,\n    globalEval,\n    externalCall,\n    _document,\n    calculationOrder: 
data.calculationOrder,\n    proxyHandler,\n    ...data.appInfo\n  });\n  const util = new _util.Util({\n    
externalCall\n  });\n  const appObjects = app._objects;\n\n  if (data.objects) 
 {\n    const annotations = [];\n\n    for (const [name, objs] of Object.entries(data.objects)) {\n      
annotations.length = 0;\n      let container = null;\n\n      for (const obj of objs) {\n        if (obj.type 
!== "") {\n          annotations.push(obj);\n        } else {\n          container = obj;\n        }\n      
}\n\n      let obj = container;\n\n      if (annotations.length > 0) {\n        obj = annotations[0];\n       
 obj.send = send;\n      }\n\n      obj.globalEval = globalEval;\n      obj.doc = _document;\n      
obj.fieldPath = name;\n      obj.appObjects = appObjects;\n      let field;\n\n      switch (obj.type) {\n    
    case "radiobutton":\n          {\n            const otherButtons = annotations.slice(1);\n            
field = new _field.RadioButtonField(otherButtons, obj);\n            break;\n          }\n\n        case 
"checkbox":\n          {\n            const otherButtons = annotations.slice(1);\n            field = new 
_field.CheckboxField(otherButtons, obj
 );\n            break;\n          }\n\n        case "text":\n          if (annotations.length <= 1) {\n      
      field = new _field.Field(obj);\n            break;\n          }\n\n          obj.siblings = 
annotations.map(x => x.id).slice(1);\n          field = new _field.Field(obj);\n          break;\n\n        
default:\n          field = new _field.Field(obj);\n      }\n\n      const wrapped = new Proxy(field, 
proxyHandler);\n\n      doc._addField(name, wrapped);\n\n      const _object = {\n        obj: field,\n       
 wrapped\n      };\n\n      for (const object of objs) {\n        appObjects[object.id] = _object;\n      
}\n\n      if (container) {\n        appObjects[container.id] = _object;\n      }\n    }\n  }\n\n  const 
color = new _color.Color();\n  globalThis.event = null;\n  globalThis.global = Object.create(null);\n  
globalThis.app = new Proxy(app, proxyHandler);\n  globalThis.color = new Proxy(color, proxyHandler);\n  
globalThis.console = new Proxy(new _console.Console(
 {\n    send\n  }), proxyHandler);\n  globalThis.util = new Proxy(util, proxyHandler);\n  globalThis.border = 
_constants.Border;\n  globalThis.cursor = _constants.Cursor;\n  globalThis.display = _constants.Display;\n  
globalThis.font = _constants.Font;\n  globalThis.highlight = _constants.Highlight;\n  globalThis.position = 
_constants.Position;\n  globalThis.scaleHow = _constants.ScaleHow;\n  globalThis.scaleWhen = 
_constants.ScaleWhen;\n  globalThis.style = _constants.Style;\n  globalThis.trans = _constants.Trans;\n  
globalThis.zoomtype = _constants.ZoomType;\n  globalThis.ADBE = {\n    Reader_Value_Asked: true,\n    
Viewer_Value_Asked: true\n  };\n  const aform = new _aform.AForm(doc, app, util, color);\n\n  for (const name 
of Object.getOwnPropertyNames(_aform.AForm.prototype)) {\n    if (name !== "constructor" && 
!name.startsWith("_")) {\n      globalThis[name] = aform[name].bind(aform);\n    }\n  }\n\n  for (const 
[name, value] of Object.entries(_constants.GlobalConstants)) {\n  
   Object.defineProperty(globalThis, name, {\n      value,\n      writable: false\n    });\n  }\n\n  
Object.defineProperties(globalThis, {\n    ColorConvert: {\n      value: color.convert.bind(color),\n      
writable: true\n    },\n    ColorEqual: {\n      value: color.equal.bind(color),\n      writable: true\n    
}\n  });\n  const properties = Object.create(null);\n\n  for (const name of 
Object.getOwnPropertyNames(_doc.Doc.prototype)) {\n    if (name === "constructor" || name.startsWith("_")) 
{\n      continue;\n    }\n\n    const descriptor = Object.getOwnPropertyDescriptor(_doc.Doc.prototype, 
name);\n\n    if (descriptor.get) {\n      properties[name] = {\n        get: descriptor.get.bind(doc),\n     
   set: descriptor.set.bind(doc)\n      };\n    } else {\n      properties[name] = {\n        value: 
_doc.Doc.prototype[name].bind(doc)\n      };\n    }\n  }\n\n  Object.defineProperties(globalThis, 
properties);\n  const functions = {\n    dispatchEvent: app._dispatchEvent.bind(app),\
 n    timeoutCb: app._evalCallback.bind(app)\n  };\n  return (name, args) => {\n    try {\n      
functions[name](args);\n    } catch (error) {\n      const value = `${error.toString()}\\n${error.stack}`;\n  
    send({\n        command: "error",\n        value\n      });\n    }\n  };\n}\n\n/***/ }),\n/* 2 */\n/***/ 
((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: 
true\n}));\nexports.ZoomType = exports.Trans = exports.Style = exports.ScaleWhen = exports.ScaleHow = 
exports.Position = exports.Highlight = exports.GlobalConstants = exports.Font = exports.Display = 
exports.Cursor = exports.Border = void 0;\nconst Border = Object.freeze({\n  s: "solid",\n  d: "dashed",\n  
b: "beveled",\n  i: "inset",\n  u: "underline"\n});\nexports.Border = Border;\nconst Cursor = 
Object.freeze({\n  visible: 0,\n  hidden: 1,\n  delay: 2\n});\nexports.Cursor = Cursor;\nconst Display = 
Object.freeze({\n  visible: 0,\n  hidden: 1,\n  noPrint: 2,\n  noView
 : 3\n});\nexports.Display = Display;\nconst Font = Object.freeze({\n  Times: "Times-Roman",\n  TimesB: 
"Times-Bold",\n  TimesI: "Times-Italic",\n  TimesBI: "Times-BoldItalic",\n  Helv: "Helvetica",\n  HelvB: 
"Helvetica-Bold",\n  HelvI: "Helvetica-Oblique",\n  HelvBI: "Helvetica-BoldOblique",\n  Cour: "Courier",\n  
CourB: "Courier-Bold",\n  CourI: "Courier-Oblique",\n  CourBI: "Courier-BoldOblique",\n  Symbol: "Symbol",\n  
ZapfD: "ZapfDingbats",\n  KaGo: "HeiseiKakuGo-W5-UniJIS-UCS2-H",\n  KaMi: 
"HeiseiMin-W3-UniJIS-UCS2-H"\n});\nexports.Font = Font;\nconst Highlight = Object.freeze({\n  n: "none",\n  
i: "invert",\n  p: "push",\n  o: "outline"\n});\nexports.Highlight = Highlight;\nconst Position = 
Object.freeze({\n  textOnly: 0,\n  iconOnly: 1,\n  iconTextV: 2,\n  textIconV: 3,\n  iconTextH: 4,\n  
textIconH: 5,\n  overlay: 6\n});\nexports.Position = Position;\nconst ScaleHow = Object.freeze({\n  
proportional: 0,\n  anamorphic: 1\n});\nexports.ScaleHow = ScaleHow;\nconst ScaleWhen = O
 bject.freeze({\n  always: 0,\n  never: 1,\n  tooBig: 2,\n  tooSmall: 3\n});\nexports.ScaleWhen = 
ScaleWhen;\nconst Style = Object.freeze({\n  ch: "check",\n  cr: "cross",\n  di: "diamond",\n  ci: 
"circle",\n  st: "star",\n  sq: "square"\n});\nexports.Style = Style;\nconst Trans = Object.freeze({\n  
blindsH: "BlindsHorizontal",\n  blindsV: "BlindsVertical",\n  boxI: "BoxIn",\n  boxO: "BoxOut",\n  dissolve: 
"Dissolve",\n  glitterD: "GlitterDown",\n  glitterR: "GlitterRight",\n  glitterRD: "GlitterRightDown",\n  
random: "Random",\n  replace: "Replace",\n  splitHI: "SplitHorizontalIn",\n  splitHO: "SplitHorizontalOut",\n 
 splitVI: "SplitVerticalIn",\n  splitVO: "SplitVerticalOut",\n  wipeD: "WipeDown",\n  wipeL: "WipeLeft",\n  
wipeR: "WipeRight",\n  wipeU: "WipeUp"\n});\nexports.Trans = Trans;\nconst ZoomType = Object.freeze({\n  
none: "NoVary",\n  fitP: "FitPage",\n  fitW: "FitWidth",\n  fitH: "FitHeight",\n  fitV: "FitVisibleWidth",\n  
pref: "Preferred",\n  refW: "ReflowWidth"\n});\ne
 xports.ZoomType = ZoomType;\nconst GlobalConstants = Object.freeze({\n  IDS_GREATER_THAN: "Invalid value: 
must be greater than or equal to % s.",\n  IDS_GT_AND_LT: "Invalid value: must be greater than or equal to % 
s " + "and less than or equal to % s.",\n  IDS_LESS_THAN: "Invalid value: must be less than or equal to % 
s.",\n  IDS_INVALID_MONTH: "** Invalid **",\n  IDS_INVALID_DATE: "Invalid date / time: please ensure that the 
date / time exists.Field",\n  IDS_INVALID_DATE2: " should match format ",\n  IDS_INVALID_VALUE: "The value 
entered does not match the format of the field",\n  IDS_AM: "am",\n  IDS_PM: "pm",\n  IDS_MONTH_INFO: 
"January[1] February[2] March[3] April[4] May[5] " + "June[6] July[7] August[8] September[9] October[10] " + 
"November[11] December[12] Sept[9] Jan[1] Feb[2] Mar[3] " + "Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] 
Nov[11] Dec[12]",\n  IDS_STARTUP_CONSOLE_MSG: "** ^ _ ^ **",\n  RE_NUMBER_ENTRY_DOT_SEP: 
["[+-]?\\\\d*\\\\.?\\\\d*"],\n  RE_NUMBER_COMMIT_DOT_SE
 P: ["[+-]?\\\\d+(\\\\.\\\\d+)?", "[+-]?\\\\.\\\\d+", "[+-]?\\\\d+\\\\."],\n  RE_NUMBER_ENTRY_COMMA_SEP: 
["[+-]?\\\\d*,?\\\\d*"],\n  RE_NUMBER_COMMIT_COMMA_SEP: ["[+-]?\\\\d+([.,]\\\\d+)?", "[+-]?[.,]\\\\d+", 
"[+-]?\\\\d+[.,]"],\n  RE_ZIP_ENTRY: ["\\\\d{0,5}"],\n  RE_ZIP_COMMIT: ["\\\\d{5}"],\n  RE_ZIP4_ENTRY: 
["\\\\d{0,5}(\\\\.|[- ])?\\\\d{0,4}"],\n  RE_ZIP4_COMMIT: ["\\\\d{5}(\\\\.|[- ])?\\\\d{4}"],\n  
RE_PHONE_ENTRY: ["\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", "\\\\(\\\\d{0,3}", 
"\\\\(\\\\d{0,3}\\\\)(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", "\\\\(\\\\d{0,3}(\\\\.|[- 
])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", "\\\\d{0,3}\\\\)(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", 
"011(\\\\.|[- \\\\d])*"],\n  RE_PHONE_COMMIT: ["\\\\d{3}(\\\\.|[- ])?\\\\d{4}", "\\\\d{3}(\\\\.|[- 
])?\\\\d{3}(\\\\.|[- ])?\\\\d{4}", "\\\\(\\\\d{3}\\\\)(\\\\.|[- ])?\\\\d{3}(\\\\.|[- ])?\\\\d{4}", 
"011(\\\\.|[- \\\\d])*"],\n  RE_SSN_ENTRY: ["\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,2}(\\\\.|[- ])?\\\\d
 {0,4}"],\n  RE_SSN_COMMIT: ["\\\\d{3}(\\\\.|[- ])?\\\\d{2}(\\\\.|[- 
])?\\\\d{4}"]\n});\nexports.GlobalConstants = GlobalConstants;\n\n/***/ }),\n/* 3 */\n/***/ 
((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, 
"__esModule", ({\n  value: true\n}));\nexports.RadioButtonField = exports.Field = exports.CheckboxField = 
void 0;\n\nvar _common = __w_pdfjs_require__(4);\n\nvar _color = __w_pdfjs_require__(5);\n\nvar _pdf_object = 
__w_pdfjs_require__(7);\n\nclass Field extends _pdf_object.PDFObject {\n  constructor(data) {\n    
super(data);\n    this.alignment = data.alignment || "left";\n    this.borderStyle = data.borderStyle || 
"";\n    this.buttonAlignX = data.buttonAlignX || 50;\n    this.buttonAlignY = data.buttonAlignY || 50;\n    
this.buttonFitBounds = data.buttonFitBounds;\n    this.buttonPosition = data.buttonPosition;\n    
this.buttonScaleHow = data.buttonScaleHow;\n    this.ButtonScaleWhen = data.buttonScaleWhen;\n    this.calcOrd
 erIndex = data.calcOrderIndex;\n    this.charLimit = data.charLimit;\n    this.comb = data.comb;\n    
this.commitOnSelChange = data.commitOnSelChange;\n    this.currentValueIndices = data.currentValueIndices;\n  
  this.defaultStyle = data.defaultStyle;\n    this.defaultValue = data.defaultValue;\n    this.doNotScroll = 
data.doNotScroll;\n    this.doNotSpellCheck = data.doNotSpellCheck;\n    this.delay = data.delay;\n    
this.display = data.display;\n    this.doc = data.doc.wrapped;\n    this.editable = data.editable;\n    
this.exportValues = data.exportValues;\n    this.fileSelect = data.fileSelect;\n    this.hidden = 
data.hidden;\n    this.highlight = data.highlight;\n    this.lineWidth = data.lineWidth;\n    this.multiline 
= data.multiline;\n    this.multipleSelection = !!data.multipleSelection;\n    this.name = data.name;\n    
this.password = data.password;\n    this.print = data.print;\n    this.radiosInUnison = 
data.radiosInUnison;\n    this.readonly = data.readonly;\n    this.
 rect = data.rect;\n    this.required = data.required;\n    this.richText = data.richText;\n    
this.richValue = data.richValue;\n    this.rotation = data.rotation;\n    this.style = data.style;\n    
this.submitName = data.submitName;\n    this.textFont = data.textFont;\n    this.textSize = data.textSize;\n  
  this.type = data.type;\n    this.userName = data.userName;\n    this._actions = (0, 
_common.createActionsMap)(data.actions);\n    this._browseForFileToSubmit = data.browseForFileToSubmit || 
null;\n    this._buttonCaption = null;\n    this._buttonIcon = null;\n    this._children = null;\n    
this._currentValueIndices = data.currentValueIndices || 0;\n    this._document = data.doc;\n    
this._fieldPath = data.fieldPath;\n    this._fillColor = data.fillColor || ["T"];\n    this._isChoice = 
Array.isArray(data.items);\n    this._items = data.items || [];\n    this._page = data.page || 0;\n    
this._strokeColor = data.strokeColor || ["G", 0];\n    this._textColor = data.textColor || 
 ["G", 0];\n    this._value = data.value || "";\n    this._kidIds = data.kidIds || null;\n    this._fieldType 
= (0, _common.getFieldType)(this._actions);\n    this._siblings = data.siblings || null;\n    
this._globalEval = data.globalEval;\n    this._appObjects = data.appObjects;\n    this.valueAsString = 
data.valueAsString || this._value;\n  }\n\n  get currentValueIndices() {\n    if (!this._isChoice) {\n      
return 0;\n    }\n\n    return this._currentValueIndices;\n  }\n\n  set currentValueIndices(indices) {\n    
if (!this._isChoice) {\n      return;\n    }\n\n    if (!Array.isArray(indices)) {\n      indices = 
[indices];\n    }\n\n    if (!indices.every(i => typeof i === "number" && Number.isInteger(i) && i >= 0 && i 
< this.numItems)) {\n      return;\n    }\n\n    indices.sort();\n\n    if (this.multipleSelection) {\n      
this._currentValueIndices = indices;\n      this._value = [];\n      indices.forEach(i => {\n        
this._value.push(this._items[i].displayValue);\n      })
 ;\n    } else {\n      if (indices.length > 0) {\n        indices = indices.splice(1, indices.length - 1);\n 
       this._currentValueIndices = indices[0];\n        this._value = 
this._items[this._currentValueIndices];\n      }\n    }\n\n    this._send({\n      id: this._id,\n      
indices\n    });\n  }\n\n  get fillColor() {\n    return this._fillColor;\n  }\n\n  set fillColor(color) {\n  
  if (_color.Color._isValidColor(color)) {\n      this._fillColor = color;\n    }\n  }\n\n  get bgColor() {\n 
   return this.fillColor;\n  }\n\n  set bgColor(color) {\n    this.fillColor = color;\n  }\n\n  get 
numItems() {\n    if (!this._isChoice) {\n      throw new Error("Not a choice widget");\n    }\n\n    return 
this._items.length;\n  }\n\n  set numItems(_) {\n    throw new Error("field.numItems is read-only");\n  }\n\n 
 get strokeColor() {\n    return this._strokeColor;\n  }\n\n  set strokeColor(color) {\n    if 
(_color.Color._isValidColor(color)) {\n      this._strokeColor = color;\n    }\n
   }\n\n  get borderColor() {\n    return this.strokeColor;\n  }\n\n  set borderColor(color) {\n    
this.strokeColor = color;\n  }\n\n  get page() {\n    return this._page;\n  }\n\n  set page(_) {\n    throw 
new Error("field.page is read-only");\n  }\n\n  get textColor() {\n    return this._textColor;\n  }\n\n  set 
textColor(color) {\n    if (_color.Color._isValidColor(color)) {\n      this._textColor = color;\n    }\n  
}\n\n  get fgColor() {\n    return this.textColor;\n  }\n\n  set fgColor(color) {\n    this.textColor = 
color;\n  }\n\n  get value() {\n    return this._value;\n  }\n\n  set value(value) {\n    if (value === "") 
{\n      this._value = "";\n    } else if (typeof value === "string") {\n      switch (this._fieldType) {\n   
     case _common.FieldType.number:\n        case _common.FieldType.percent:\n          value = 
parseFloat(value);\n\n          if (!isNaN(value)) {\n            this._value = value;\n          }\n\n       
   break;\n\n        default:\n          this.
 _value = value;\n      }\n    } else {\n      this._value = value;\n    }\n\n    if (this._isChoice) {\n     
 if (this.multipleSelection) {\n        const values = new Set(value);\n        
this._currentValueIndices.length = 0;\n\n        this._items.forEach(({\n          displayValue\n        }, 
i) => {\n          if (values.has(displayValue)) {\n            this._currentValueIndices.push(i);\n          
}\n        });\n      } else {\n        this._currentValueIndices = this._items.findIndex(({\n          
displayValue\n        }) => value === displayValue);\n      }\n    }\n  }\n\n  get valueAsString() {\n    if 
(this._valueAsString === undefined) {\n      this._valueAsString = this._value ? this._value.toString() : 
"";\n    }\n\n    return this._valueAsString;\n  }\n\n  set valueAsString(val) {\n    this._valueAsString = 
val ? val.toString() : "";\n  }\n\n  browseForFileToSubmit() {\n    if (this._browseForFileToSubmit) {\n      
this._browseForFileToSubmit();\n    }\n  }\n\n  butto
 nGetCaption(nFace = 0) {\n    if (this._buttonCaption) {\n      return this._buttonCaption[nFace];\n    
}\n\n    return "";\n  }\n\n  buttonGetIcon(nFace = 0) {\n    if (this._buttonIcon) {\n      return 
this._buttonIcon[nFace];\n    }\n\n    return null;\n  }\n\n  buttonImportIcon(cPath = null, nPave = 0) 
{}\n\n  buttonSetCaption(cCaption, nFace = 0) {\n    if (!this._buttonCaption) {\n      this._buttonCaption = 
["", "", ""];\n    }\n\n    this._buttonCaption[nFace] = cCaption;\n  }\n\n  buttonSetIcon(oIcon, nFace = 0) 
{\n    if (!this._buttonIcon) {\n      this._buttonIcon = [null, null, null];\n    }\n\n    
this._buttonIcon[nFace] = oIcon;\n  }\n\n  checkThisBox(nWidget, bCheckIt = true) {}\n\n  clearItems() {\n    
if (!this._isChoice) {\n      throw new Error("Not a choice widget");\n    }\n\n    this._items = [];\n\n    
this._send({\n      id: this._id,\n      clear: null\n    });\n  }\n\n  deleteItemAt(nIdx = null) {\n    if 
(!this._isChoice) {\n      throw new Error("Not a c
 hoice widget");\n    }\n\n    if (!this.numItems) {\n      return;\n    }\n\n    if (nIdx === null) {\n      
nIdx = Array.isArray(this._currentValueIndices) ? this._currentValueIndices[0] : this._currentValueIndices;\n 
     nIdx = nIdx || 0;\n    }\n\n    if (nIdx < 0 || nIdx >= this.numItems) {\n      nIdx = this.numItems - 
1;\n    }\n\n    this._items.splice(nIdx, 1);\n\n    if (Array.isArray(this._currentValueIndices)) {\n      
let index = this._currentValueIndices.findIndex(i => i >= nIdx);\n\n      if (index !== -1) {\n        if 
(this._currentValueIndices[index] === nIdx) {\n          this._currentValueIndices.splice(index, 1);\n        
}\n\n        for (const ii = this._currentValueIndices.length; index < ii; index++) {\n          
--this._currentValueIndices[index];\n        }\n      }\n    } else {\n      if (this._currentValueIndices 
=== nIdx) {\n        this._currentValueIndices = this.numItems > 0 ? 0 : -1;\n      } else if 
(this._currentValueIndices > nIdx) {\n        --
 this._currentValueIndices;\n      }\n    }\n\n    this._send({\n      id: this._id,\n      remove: nIdx\n    
});\n  }\n\n  getItemAt(nIdx = -1, bExportValue = false) {\n    if (!this._isChoice) {\n      throw new 
Error("Not a choice widget");\n    }\n\n    if (nIdx < 0 || nIdx >= this.numItems) {\n      nIdx = 
this.numItems - 1;\n    }\n\n    const item = this._items[nIdx];\n    return bExportValue ? item.exportValue 
: item.displayValue;\n  }\n\n  getArray() {\n    if (this._kidIds) {\n      return this._kidIds.map(id => 
this._appObjects[id].wrapped);\n    }\n\n    if (this._children === null) {\n      this._children = 
this._document.obj._getChildren(this._fieldPath);\n    }\n\n    return this._children;\n  }\n\n  getLock() 
{\n    return undefined;\n  }\n\n  isBoxChecked(nWidget) {\n    return false;\n  }\n\n  
isDefaultChecked(nWidget) {\n    return false;\n  }\n\n  insertItemAt(cName, cExport = undefined, nIdx = 0) 
{\n    if (!this._isChoice) {\n      throw new Error("Not a choice 
 widget");\n    }\n\n    if (!cName) {\n      return;\n    }\n\n    if (nIdx < 0 || nIdx > this.numItems) {\n 
     nIdx = this.numItems;\n    }\n\n    if (this._items.some(({\n      displayValue\n    }) => displayValue 
=== cName)) {\n      return;\n    }\n\n    if (cExport === undefined) {\n      cExport = cName;\n    }\n\n    
const data = {\n      displayValue: cName,\n      exportValue: cExport\n    };\n\n    
this._items.splice(nIdx, 0, data);\n\n    if (Array.isArray(this._currentValueIndices)) {\n      let index = 
this._currentValueIndices.findIndex(i => i >= nIdx);\n\n      if (index !== -1) {\n        for (const ii = 
this._currentValueIndices.length; index < ii; index++) {\n          ++this._currentValueIndices[index];\n     
   }\n      }\n    } else if (this._currentValueIndices >= nIdx) {\n      ++this._currentValueIndices;\n    
}\n\n    this._send({\n      id: this._id,\n      insert: {\n        index: nIdx,\n        ...data\n      }\n 
   });\n  }\n\n  setAction(cTrigger, cS
 cript) {\n    if (typeof cTrigger !== "string" || typeof cScript !== "string") {\n      return;\n    }\n\n   
 if (!(cTrigger in this._actions)) {\n      this._actions[cTrigger] = [];\n    }\n\n    
this._actions[cTrigger].push(cScript);\n  }\n\n  setFocus() {\n    this._send({\n      id: this._id,\n      
focus: true\n    });\n  }\n\n  setItems(oArray) {\n    if (!this._isChoice) {\n      throw new Error("Not a 
choice widget");\n    }\n\n    this._items.length = 0;\n\n    for (const element of oArray) {\n      let 
displayValue, exportValue;\n\n      if (Array.isArray(element)) {\n        displayValue = 
element[0]?.toString() || "";\n        exportValue = element[1]?.toString() || "";\n      } else {\n        
displayValue = exportValue = element?.toString() || "";\n      }\n\n      this._items.push({\n        
displayValue,\n        exportValue\n      });\n    }\n\n    this._currentValueIndices = 0;\n\n    
this._send({\n      id: this._id,\n      items: this._items\n    });\n  }\n\n  se
 tLock() {}\n\n  signatureGetModifications() {}\n\n  signatureGetSeedValue() {}\n\n  signatureInfo() {}\n\n  
signatureSetSeedValue() {}\n\n  signatureSign() {}\n\n  signatureValidate() {}\n\n  _isButton() {\n    return 
false;\n  }\n\n  _reset() {\n    this.value = this.valueAsString = this.defaultValue;\n  }\n\n  
_runActions(event) {\n    const eventName = event.name;\n\n    if (!this._actions.has(eventName)) {\n      
return false;\n    }\n\n    const actions = this._actions.get(eventName);\n\n    try {\n      for (const 
action of actions) {\n        this._globalEval(action);\n      }\n    } catch (error) {\n      event.rc = 
false;\n      throw error;\n    }\n\n    return true;\n  }\n\n}\n\nexports.Field = Field;\n\nclass 
RadioButtonField extends Field {\n  constructor(otherButtons, data) {\n    super(data);\n    
this.exportValues = [this.exportValues];\n    this._radioIds = [this._id];\n    this._radioActions = 
[this._actions];\n\n    for (const radioData of otherButtons) {\n      t
 his.exportValues.push(radioData.exportValues);\n\n      this._radioIds.push(radioData.id);\n\n      
this._radioActions.push((0, _common.createActionsMap)(radioData.actions));\n\n      if (this._value === 
radioData.exportValues) {\n        this._id = radioData.id;\n      }\n    }\n  }\n\n  get value() {\n    
return this._value;\n  }\n\n  set value(value) {\n    if (value === null || value === undefined) {\n      
this._value = "";\n    }\n\n    const i = this.exportValues.indexOf(value);\n\n    if (0 <= i && i < 
this._radioIds.length) {\n      this._id = this._radioIds[i];\n      this._value = value;\n    } else if 
(value === "Off" && this._radioIds.length === 2) {\n      const nextI = (1 + 
this._radioIds.indexOf(this._id)) % 2;\n      this._id = this._radioIds[nextI];\n      this._value = 
this.exportValues[nextI];\n    }\n  }\n\n  checkThisBox(nWidget, bCheckIt = true) {\n    if (nWidget < 0 || 
nWidget >= this._radioIds.length || !bCheckIt) {\n      return;\n    }\n\n    this._id = t
 his._radioIds[nWidget];\n    this._value = this.exportValues[nWidget];\n\n    this._send({\n      id: 
this._id,\n      value: this._value\n    });\n  }\n\n  isBoxChecked(nWidget) {\n    return nWidget >= 0 && 
nWidget < this._radioIds.length && this._id === this._radioIds[nWidget];\n  }\n\n  isDefaultChecked(nWidget) 
{\n    return nWidget >= 0 && nWidget < this.exportValues.length && this.defaultValue === 
this.exportValues[nWidget];\n  }\n\n  _getExportValue(state) {\n    const i = 
this._radioIds.indexOf(this._id);\n\n    return this.exportValues[i];\n  }\n\n  _runActions(event) {\n    
const i = this._radioIds.indexOf(this._id);\n\n    this._actions = this._radioActions[i];\n    return 
super._runActions(event);\n  }\n\n  _isButton() {\n    return true;\n  }\n\n}\n\nexports.RadioButtonField = 
RadioButtonField;\n\nclass CheckboxField extends RadioButtonField {\n  get value() {\n    return 
this._value;\n  }\n\n  set value(value) {\n    if (!value || value === "Off") {\n      this._value
  = "Off";\n    } else {\n      super.value = value;\n    }\n  }\n\n  _getExportValue(state) {\n    return 
state ? super._getExportValue(state) : "Off";\n  }\n\n  isBoxChecked(nWidget) {\n    if (this._value === 
"Off") {\n      return false;\n    }\n\n    return super.isBoxChecked(nWidget);\n  }\n\n  
isDefaultChecked(nWidget) {\n    if (this.defaultValue === "Off") {\n      return this._value === "Off";\n    
}\n\n    return super.isDefaultChecked(nWidget);\n  }\n\n  checkThisBox(nWidget, bCheckIt = true) {\n    if 
(nWidget < 0 || nWidget >= this._radioIds.length) {\n      return;\n    }\n\n    this._id = 
this._radioIds[nWidget];\n    this._value = bCheckIt ? this.exportValues[nWidget] : "Off";\n\n    
this._send({\n      id: this._id,\n      value: this._value\n    });\n  }\n\n}\n\nexports.CheckboxField = 
CheckboxField;\n\n/***/ }),\n/* 4 */\n/***/ ((__unused_webpack_module, exports) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}));\nexports.createAction
 sMap = createActionsMap;\nexports.getFieldType = getFieldType;\nexports.FieldType = void 0;\nconst FieldType 
= {\n  none: 0,\n  number: 1,\n  percent: 2,\n  date: 3,\n  time: 4\n};\nexports.FieldType = 
FieldType;\n\nfunction createActionsMap(actions) {\n  const actionsMap = new Map();\n\n  if (actions) {\n    
for (const [eventType, actionsForEvent] of Object.entries(actions)) {\n      actionsMap.set(eventType, 
actionsForEvent);\n    }\n  }\n\n  return actionsMap;\n}\n\nfunction getFieldType(actions) {\n  let format = 
actions.get("Format");\n\n  if (!format) {\n    return FieldType.none;\n  }\n\n  format = format[0];\n  
format = format.trim();\n\n  if (format.startsWith("AFNumber_")) {\n    return FieldType.number;\n  }\n\n  if 
(format.startsWith("AFPercent_")) {\n    return FieldType.percent;\n  }\n\n  if 
(format.startsWith("AFDate_")) {\n    return FieldType.date;\n  }\n\n  if (format.startsWith("AFTime__")) {\n 
   return FieldType.time;\n  }\n\n  return FieldType.none;\n}\n\n/***/
  }),\n/* 5 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}));\nexports.Color = void 0;\n\nvar 
_scripting_utils = __w_pdfjs_require__(6);\n\nvar _pdf_object = __w_pdfjs_require__(7);\n\nclass Color 
extends _pdf_object.PDFObject {\n  constructor() {\n    super({});\n    this.transparent = ["T"];\n    
this.black = ["G", 0];\n    this.white = ["G", 1];\n    this.red = ["RGB", 1, 0, 0];\n    this.green = 
["RGB", 0, 1, 0];\n    this.blue = ["RGB", 0, 0, 1];\n    this.cyan = ["CMYK", 1, 0, 0, 0];\n    this.magenta 
= ["CMYK", 0, 1, 0, 0];\n    this.yellow = ["CMYK", 0, 0, 1, 0];\n    this.dkGray = ["G", 0.25];\n    
this.gray = ["G", 0.5];\n    this.ltGray = ["G", 0.75];\n  }\n\n  static _isValidSpace(cColorSpace) {\n    
return typeof cColorSpace === "string" && (cColorSpace === "T" || cColorSpace === "G" || cColorSpace === 
"RGB" || cColorSpace === "CMYK");\n  }\n\n  static _isValidColor(colorArr
 ay) {\n    if (!Array.isArray(colorArray) || colorArray.length === 0) {\n      return false;\n    }\n\n    
const space = colorArray[0];\n\n    if (!Color._isValidSpace(space)) {\n      return false;\n    }\n\n    
switch (space) {\n      case "T":\n        if (colorArray.length !== 1) {\n          return false;\n        
}\n\n        break;\n\n      case "G":\n        if (colorArray.length !== 2) {\n          return false;\n     
   }\n\n        break;\n\n      case "RGB":\n        if (colorArray.length !== 4) {\n          return 
false;\n        }\n\n        break;\n\n      case "CMYK":\n        if (colorArray.length !== 5) {\n          
return false;\n        }\n\n        break;\n\n      default:\n        return false;\n    }\n\n    return 
colorArray.slice(1).every(c => typeof c === "number" && c >= 0 && c <= 1);\n  }\n\n  static 
_getCorrectColor(colorArray) {\n    return Color._isValidColor(colorArray) ? colorArray : ["G", 0];\n  }\n\n  
convert(colorArray, cColorSpace) {\n    if (!Col
 or._isValidSpace(cColorSpace)) {\n      return this.black;\n    }\n\n    if (cColorSpace === "T") {\n      
return ["T"];\n    }\n\n    colorArray = Color._getCorrectColor(colorArray);\n\n    if (colorArray[0] === 
cColorSpace) {\n      return colorArray;\n    }\n\n    if (colorArray[0] === "T") {\n      return 
this.convert(this.black, cColorSpace);\n    }\n\n    return 
_scripting_utils.ColorConverters[`${colorArray[0]}_${cColorSpace}`](colorArray.slice(1));\n  }\n\n  
equal(colorArray1, colorArray2) {\n    colorArray1 = Color._getCorrectColor(colorArray1);\n    colorArray2 = 
Color._getCorrectColor(colorArray2);\n\n    if (colorArray1[0] === "T" || colorArray2[0] === "T") {\n      
return colorArray1[0] === "T" && colorArray2[0] === "T";\n    }\n\n    if (colorArray1[0] !== colorArray2[0]) 
{\n      colorArray2 = this.convert(colorArray2, colorArray1[0]);\n    }\n\n    return 
colorArray1.slice(1).every((c, i) => c === colorArray2[i + 1]);\n  }\n\n}\n\nexports.Color = Color;\n\n/***/ 
}),\
 n/* 6 */\n/***/ ((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, "__esModule", 
({\n  value: true\n}));\nexports.ColorConverters = void 0;\n\nfunction makeColorComp(n) {\n  return 
Math.floor(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, "0");\n}\n\nclass ColorConverters {\n  
static CMYK_G([c, y, m, k]) {\n    return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];\n  }\n\n 
 static G_CMYK([g]) {\n    return ["CMYK", 0, 0, 0, 1 - g];\n  }\n\n  static G_RGB([g]) {\n    return ["RGB", 
g, g, g];\n  }\n\n  static G_HTML([g]) {\n    const G = makeColorComp(g);\n    return `#${G}${G}${G}`;\n  
}\n\n  static RGB_G([r, g, b]) {\n    return ["G", 0.3 * r + 0.59 * g + 0.11 * b];\n  }\n\n  static 
RGB_HTML([r, g, b]) {\n    const R = makeColorComp(r);\n    const G = makeColorComp(g);\n    const B = 
makeColorComp(b);\n    return `#${R}${G}${B}`;\n  }\n\n  static T_HTML() {\n    return "#00000000";\n  }\n\n  
static CMYK_RGB([c, y, m, k]) {\n    re
 turn ["RGB", 1 - Math.min(1, c + k), 1 - Math.min(1, m + k), 1 - Math.min(1, y + k)];\n  }\n\n  static 
CMYK_HTML(components) {\n    return this.RGB_HTML(this.CMYK_RGB(components));\n  }\n\n  static RGB_CMYK([r, 
g, b]) {\n    const c = 1 - r;\n    const m = 1 - g;\n    const y = 1 - b;\n    const k = Math.min(c, m, 
y);\n    return ["CMYK", c, m, y, k];\n  }\n\n}\n\nexports.ColorConverters = ColorConverters;\n\n/***/ 
}),\n/* 7 */\n/***/ ((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, 
"__esModule", ({\n  value: true\n}));\nexports.PDFObject = void 0;\n\nclass PDFObject {\n  constructor(data) 
{\n    this._expandos = Object.create(null);\n    this._send = data.send || null;\n    this._id = data.id || 
null;\n  }\n\n}\n\nexports.PDFObject = PDFObject;\n\n/***/ }),\n/* 8 */\n/***/ ((__unused_webpack_module, 
exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: 
true\n}));\nexports.AForm = void 0;\n\nvar _constants =
  __w_pdfjs_require__(2);\n\nclass AForm {\n  constructor(document, app, util, color) {\n    this._document = 
document;\n    this._app = app;\n    this._util = util;\n    this._color = color;\n    this._dateFormats = 
["m/d", "m/d/yy", "mm/dd/yy", "mm/yy", "d-mmm", "d-mmm-yy", "dd-mmm-yy", "yy-mm-dd", "mmm-yy", "mmmm-yy", 
"mmm d, yyyy", "mmmm d, yyyy", "m/d/yy h:MM tt", "m/d/yy HH:MM"];\n    this._timeFormats = ["HH:MM", "h:MM 
tt", "HH:MM:ss", "h:MM:ss tt"];\n    this._emailRegex = new RegExp("^[a-zA-Z0-9.!#$%&\'*+\\\\/=?^_`{|}~-]+" + 
"@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?" + 
"(?:\\\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$");\n  }\n\n  _mkTargetName(event) {\n    return 
event.target ? `[ ${event.target.name} ]` : "";\n  }\n\n  _parseDate(cFormat, cDate) {\n    const ddate = 
Date.parse(cDate);\n\n    if (isNaN(ddate)) {\n      try {\n        return this._util.scand(cFormat, 
cDate);\n      } catch (error) {\n        return null;\n      }\n    } else {\n      return ne
 w Date(ddate);\n    }\n  }\n\n  AFMergeChange(event = globalThis.event) {\n    if (event.willCommit) {\n     
 return event.value.toString();\n    }\n\n    return this._app._eventDispatcher.mergeChange(event);\n  }\n\n  
AFParseDateEx(cString, cOrder) {\n    return this._parseDate(cOrder, cString);\n  }\n\n  AFExtractNums(str) 
{\n    if (typeof str === "number") {\n      return [str];\n    }\n\n    if (!str || typeof str !== "string") 
{\n      return null;\n    }\n\n    const first = str.charAt(0);\n\n    if (first === "." || first === ",") 
{\n      str = `0${str}`;\n    }\n\n    const numbers = str.match(/(\\d+)/g);\n\n    if (numbers.length === 
0) {\n      return null;\n    }\n\n    return numbers;\n  }\n\n  AFMakeNumber(str) {\n    if (typeof str === 
"number") {\n      return str;\n    }\n\n    if (typeof str !== "string") {\n      return null;\n    }\n\n    
str = str.trim().replace(",", ".");\n    const number = parseFloat(str);\n\n    if (isNaN(number) || 
!isFinite(number)) {\n  
     return null;\n    }\n\n    return number;\n  }\n\n  AFMakeArrayFromList(string) {\n    if (typeof string 
=== "string") {\n      return string.split(/, ?/g);\n    }\n\n    return string;\n  }\n\n  
AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend) {\n    const event = 
globalThis.event;\n\n    if (!event.value) {\n      return;\n    }\n\n    let value = 
this.AFMakeNumber(event.value);\n\n    if (value === null) {\n      event.value = "";\n      return;\n    
}\n\n    const sign = Math.sign(value);\n    const buf = [];\n    let hasParen = false;\n\n    if (sign === 
-1 && bCurrencyPrepend && negStyle === 0) {\n      buf.push("-");\n    }\n\n    if ((negStyle === 2 || 
negStyle === 3) && sign === -1) {\n      buf.push("(");\n      hasParen = true;\n    }\n\n    if 
(bCurrencyPrepend) {\n      buf.push(strCurrency);\n    }\n\n    sepStyle = Math.min(Math.max(0, 
Math.floor(sepStyle)), 4);\n    buf.push("%,", sepStyle, ".", nDec.toString(), "f");\n\n    if 
 (!bCurrencyPrepend) {\n      buf.push(strCurrency);\n    }\n\n    if (hasParen) {\n      buf.push(")");\n    
}\n\n    if (negStyle === 1 || negStyle === 3) {\n      event.target.textColor = sign === 1 ? 
this._color.black : this._color.red;\n    }\n\n    if ((negStyle !== 0 || bCurrencyPrepend) && sign === -1) 
{\n      value = -value;\n    }\n\n    const formatStr = buf.join("");\n    event.value = 
this._util.printf(formatStr, value);\n  }\n\n  AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, 
strCurrency, bCurrencyPrepend) {\n    const event = globalThis.event;\n    let value = 
this.AFMergeChange(event);\n\n    if (!value) {\n      return;\n    }\n\n    value = value.trim();\n    let 
pattern;\n\n    if (sepStyle > 1) {\n      pattern = event.willCommit ? /^[+-]?(\\d+(,\\d*)?|,\\d+)$/ : 
/^[+-]?\\d*,?\\d*$/;\n    } else {\n      pattern = event.willCommit ? /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)$/ : 
/^[+-]?\\d*\\.?\\d*$/;\n    }\n\n    if (!pattern.test(value)) {\n      if (event.willC
 ommit) {\n        const err = `${_constants.GlobalConstants.IDS_INVALID_VALUE} 
${this._mkTargetName(event)}`;\n\n        this._app.alert(err);\n      }\n\n      event.rc = false;\n    
}\n\n    if (event.willCommit && sepStyle > 1) {\n      event.value = parseFloat(value.replace(",", "."));\n  
  }\n  }\n\n  AFPercent_Format(nDec, sepStyle, percentPrepend = false) {\n    if (typeof nDec !== "number") 
{\n      return;\n    }\n\n    if (typeof sepStyle !== "number") {\n      return;\n    }\n\n    if (nDec < 0) 
{\n      throw new Error("Invalid nDec value in AFPercent_Format");\n    }\n\n    const event = 
globalThis.event;\n\n    if (nDec > 512) {\n      event.value = "%";\n      return;\n    }\n\n    nDec = 
Math.floor(nDec);\n    sepStyle = Math.min(Math.max(0, Math.floor(sepStyle)), 4);\n    let value = 
this.AFMakeNumber(event.value);\n\n    if (value === null) {\n      event.value = "%";\n      return;\n    
}\n\n    const formatStr = `%,${sepStyle}.${nDec}f`;\n    value = this._util.p
 rintf(formatStr, value * 100);\n\n    if (percentPrepend) {\n      event.value = `%${value}`;\n    } else 
{\n      event.value = `${value}%`;\n    }\n  }\n\n  AFPercent_Keystroke(nDec, sepStyle) {\n    
this.AFNumber_Keystroke(nDec, sepStyle, 0, 0, "", true);\n  }\n\n  AFDate_FormatEx(cFormat) {\n    const 
event = globalThis.event;\n    const value = event.value;\n\n    if (!value) {\n      return;\n    }\n\n    
const date = this._parseDate(cFormat, value);\n\n    if (date !== null) {\n      event.value = 
this._util.printd(cFormat, date);\n    }\n  }\n\n  AFDate_Format(pdf) {\n    if (pdf >= 0 && pdf < 
this._dateFormats.length) {\n      this.AFDate_FormatEx(this._dateFormats[pdf]);\n    }\n  }\n\n  
AFDate_KeystrokeEx(cFormat) {\n    const event = globalThis.event;\n\n    if (!event.willCommit) {\n      
return;\n    }\n\n    const value = this.AFMergeChange(event);\n\n    if (!value) {\n      return;\n    }\n\n 
   if (this._parseDate(cFormat, value) === null) {\n      const invalid = 
 _constants.GlobalConstants.IDS_INVALID_DATE;\n      const invalid2 = 
_constants.GlobalConstants.IDS_INVALID_DATE2;\n      const err = `${invalid} 
${this._mkTargetName(event)}${invalid2}${cFormat}`;\n\n      this._app.alert(err);\n\n      event.rc = 
false;\n    }\n  }\n\n  AFDate_Keystroke(pdf) {\n    if (pdf >= 0 && pdf < this._dateFormats.length) {\n      
this.AFDate_KeystrokeEx(this._dateFormats[pdf]);\n    }\n  }\n\n  AFRange_Validate(bGreaterThan, 
nGreaterThan, bLessThan, nLessThan) {\n    const event = globalThis.event;\n\n    if (!event.value) {\n      
return;\n    }\n\n    const value = this.AFMakeNumber(event.value);\n\n    if (value === null) {\n      
return;\n    }\n\n    bGreaterThan = !!bGreaterThan;\n    bLessThan = !!bLessThan;\n\n    if (bGreaterThan) 
{\n      nGreaterThan = this.AFMakeNumber(nGreaterThan);\n\n      if (nGreaterThan === null) {\n        
return;\n      }\n    }\n\n    if (bLessThan) {\n      nLessThan = this.AFMakeNumber(nLessThan);\n\n      if 
(nLessT
 han === null) {\n        return;\n      }\n    }\n\n    let err = "";\n\n    if (bGreaterThan && bLessThan) 
{\n      if (value < nGreaterThan || value > nLessThan) {\n        err = 
this._util.printf(_constants.GlobalConstants.IDS_GT_AND_LT, nGreaterThan, nLessThan);\n      }\n    } else if 
(bGreaterThan) {\n      if (value < nGreaterThan) {\n        err = 
this._util.printf(_constants.GlobalConstants.IDS_GREATER_THAN, nGreaterThan);\n      }\n    } else if (value 
nLessThan) {\n      err = this._util.printf(_constants.GlobalConstants.IDS_LESS_THAN, nLessThan);\n    
}\n\n    if (err) {\n      this._app.alert(err);\n\n      event.rc = false;\n    }\n  }\n\n  
AFSimple(cFunction, nValue1, nValue2) {\n    const value1 = this.AFMakeNumber(nValue1);\n\n    if (value1 === 
null) {\n      throw new Error("Invalid nValue1 in AFSimple");\n    }\n\n    const value2 = 
this.AFMakeNumber(nValue2);\n\n    if (value2 === null) {\n      throw new Error("Invalid nValue2 in 
AFSimple");\n    }\n\n    swi
 tch (cFunction) {\n      case "AVG":\n        return (value1 + value2) / 2;\n\n      case "SUM":\n        
return value1 + value2;\n\n      case "PRD":\n        return value1 * value2;\n\n      case "MIN":\n        
return Math.min(value1, value2);\n\n      case "MAX":\n        return Math.max(value1, value2);\n    }\n\n    
throw new Error("Invalid cFunction in AFSimple");\n  }\n\n  AFSimple_Calculate(cFunction, cFields) {\n    
const actions = {\n      AVG: args => args.reduce((acc, value) => acc + value, 0) / args.length,\n      SUM: 
args => args.reduce((acc, value) => acc + value, 0),\n      PRD: args => args.reduce((acc, value) => acc * 
value, 1),\n      MIN: args => args.reduce((acc, value) => Math.min(acc, value), Number.MAX_VALUE),\n      
MAX: args => args.reduce((acc, value) => Math.max(acc, value), Number.MIN_VALUE)\n    };\n\n    if 
(!(cFunction in actions)) {\n      throw new TypeError("Invalid function in AFSimple_Calculate");\n    }\n\n  
  const event = globalThis.event;\n
     const values = [];\n\n    for (const cField of cFields) {\n      const field = 
this._document.getField(cField);\n\n      const number = this.AFMakeNumber(field.value);\n\n      if (number 
!== null) {\n        values.push(number);\n      }\n    }\n\n    if (values.length === 0) {\n      
event.value = cFunction === "PRD" ? 1 : 0;\n      return;\n    }\n\n    const res = 
actions[cFunction](values);\n    event.value = Math.round(1e6 * res) / 1e6;\n  }\n\n  AFSpecial_Format(psf) 
{\n    const event = globalThis.event;\n\n    if (!event.value) {\n      return;\n    }\n\n    psf = 
this.AFMakeNumber(psf);\n\n    if (psf === null) {\n      throw new Error("Invalid psf in 
AFSpecial_Format");\n    }\n\n    let formatStr = "";\n\n    switch (psf) {\n      case 0:\n        formatStr 
= "99999";\n        break;\n\n      case 1:\n        formatStr = "99999-9999";\n        break;\n\n      case 
2:\n        if (this._util.printx("9999999999", event.value).length >= 10) {\n          formatStr = "(99
 9) 999-9999";\n        } else {\n          formatStr = "999-9999";\n        }\n\n        break;\n\n      
case 3:\n        formatStr = "999-99-9999";\n        break;\n\n      default:\n        throw new 
Error("Invalid psf in AFSpecial_Format");\n    }\n\n    event.value = this._util.printx(formatStr, 
event.value);\n  }\n\n  AFSpecial_KeystrokeEx(cMask) {\n    if (!cMask) {\n      return;\n    }\n\n    const 
event = globalThis.event;\n    const value = this.AFMergeChange(event);\n    const checkers = new Map([["9", 
char => char >= "0" && char <= "9"], ["A", char => "a" <= char && char <= "z" || "A" <= char && char <= "Z"], 
["O", char => "a" <= char && char <= "z" || "A" <= char && char <= "Z" || "0" <= char && char <= "9"], ["X", 
char => true]]);\n\n    function _checkValidity(_value, _cMask) {\n      for (let i = 0, ii = value.length; i 
< ii; i++) {\n        const mask = _cMask.charAt(i);\n\n        const char = _value.charAt(i);\n\n        
const checker = checkers.get(mask);\n\n    
     if (checker) {\n          if (!checker(char)) {\n            return false;\n          }\n        } else 
if (mask !== char) {\n          return false;\n        }\n      }\n\n      return true;\n    }\n\n    if 
(!value) {\n      return;\n    }\n\n    const err = `${_constants.GlobalConstants.IDS_INVALID_VALUE} = 
"${cMask}"`;\n\n    if (value.length > cMask.length) {\n      this._app.alert(err);\n\n      event.rc = 
false;\n      return;\n    }\n\n    if (event.willCommit) {\n      if (value.length < cMask.length) {\n       
 this._app.alert(err);\n\n        event.rc = false;\n        return;\n      }\n\n      if 
(!_checkValidity(value, cMask)) {\n        this._app.alert(err);\n\n        event.rc = false;\n        
return;\n      }\n\n      event.value += cMask.substring(value.length);\n      return;\n    }\n\n    if 
(value.length < cMask.length) {\n      cMask = cMask.substring(0, value.length);\n    }\n\n    if 
(!_checkValidity(value, cMask)) {\n      this._app.alert(err);\n\n      
 event.rc = false;\n    }\n  }\n\n  AFSpecial_Keystroke(psf) {\n    const event = globalThis.event;\n\n    if 
(!event.value) {\n      return;\n    }\n\n    psf = this.AFMakeNumber(psf);\n\n    if (psf === null) {\n      
throw new Error("Invalid psf in AFSpecial_Keystroke");\n    }\n\n    let formatStr;\n\n    switch (psf) {\n   
   case 0:\n        formatStr = "99999";\n        break;\n\n      case 1:\n        formatStr = 
"99999-9999";\n        break;\n\n      case 2:\n        const finalLen = event.value.length + 
event.change.length + event.selStart - event.selEnd;\n\n        if (finalLen >= 8) {\n          formatStr = 
"(999) 999-9999";\n        } else {\n          formatStr = "999-9999";\n        }\n\n        break;\n\n      
case 3:\n        formatStr = "999-99-9999";\n        break;\n\n      default:\n        throw new 
Error("Invalid psf in AFSpecial_Keystroke");\n    }\n\n    this.AFSpecial_KeystrokeEx(formatStr);\n  }\n\n  
AFTime_FormatEx(cFormat) {\n    this.AFDate_FormatEx(cFor
 mat);\n  }\n\n  AFTime_Format(pdf) {\n    if (pdf >= 0 && pdf < this._timeFormats.length) {\n      
this.AFDate_FormatEx(this._timeFormats[pdf]);\n    }\n  }\n\n  AFTime_KeystrokeEx(cFormat) {\n    
this.AFDate_KeystrokeEx(cFormat);\n  }\n\n  AFTime_Keystroke(pdf) {\n    if (pdf >= 0 && pdf < 
this._timeFormats.length) {\n      this.AFDate_KeystrokeEx(this._timeFormats[pdf]);\n    }\n  }\n\n  
eMailValidate(str) {\n    return this._emailRegex.test(str);\n  }\n\n}\n\nexports.AForm = AForm;\n\n/***/ 
}),\n/* 9 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}));\nexports.App = void 0;\n\nvar 
_color = __w_pdfjs_require__(5);\n\nvar _event = __w_pdfjs_require__(10);\n\nvar _fullscreen = 
__w_pdfjs_require__(11);\n\nvar _pdf_object = __w_pdfjs_require__(7);\n\nvar _thermometer = 
__w_pdfjs_require__(12);\n\nconst VIEWER_TYPE = "PDF.js";\nconst VIEWER_VARIATION = "Full";\nconst 
VIEWER_VERSION = "10.0";
 \nconst FORMS_VERSION = undefined;\n\nclass App extends _pdf_object.PDFObject {\n  constructor(data) {\n    
super(data);\n    this._constants = null;\n    this._focusRect = true;\n    this._fs = null;\n    
this._language = App._getLanguage(data.language);\n    this._openInPlace = false;\n    this._platform = 
App._getPlatform(data.platform);\n    this._runtimeHighlight = false;\n    this._runtimeHighlightColor = 
["T"];\n    this._thermometer = null;\n    this._toolbar = false;\n    this._document = data._document;\n    
this._proxyHandler = data.proxyHandler;\n    this._objects = Object.create(null);\n    this._eventDispatcher 
= new _event.EventDispatcher(this._document, data.calculationOrder, this._objects);\n    this._timeoutIds = 
new WeakMap();\n\n    if (typeof FinalizationRegistry !== "undefined") {\n      this._timeoutIdsRegistry = 
new FinalizationRegistry(this._cleanTimeout.bind(this));\n    } else {\n      this._timeoutIdsRegistry = 
null;\n    }\n\n    this._timeoutCallbackIds
  = new Map();\n    this._timeoutCallbackId = 0;\n    this._globalEval = data.globalEval;\n    
this._externalCall = data.externalCall;\n    this._document = data._document;\n  }\n\n  
_dispatchEvent(pdfEvent) {\n    this._eventDispatcher.dispatch(pdfEvent);\n  }\n\n  
_registerTimeoutCallback(cExpr) {\n    const id = this._timeoutCallbackId++;\n\n    
this._timeoutCallbackIds.set(id, cExpr);\n\n    return id;\n  }\n\n  _unregisterTimeoutCallback(id) {\n    
this._timeoutCallbackIds.delete(id);\n  }\n\n  _evalCallback({\n    callbackId,\n    interval\n  }) {\n    
const expr = this._timeoutCallbackIds.get(callbackId);\n\n    if (!interval) {\n      
this._unregisterTimeoutCallback(callbackId);\n    }\n\n    if (expr) {\n      this._globalEval(expr);\n    
}\n  }\n\n  _registerTimeout(callbackId, interval) {\n    const timeout = Object.create(null);\n    const id 
= {\n      callbackId,\n      interval\n    };\n\n    this._timeoutIds.set(timeout, id);\n\n    if 
(this._timeoutIdsRegistry) {\n  
     this._timeoutIdsRegistry.register(timeout, id);\n    }\n\n    return timeout;\n  }\n\n  
_unregisterTimeout(timeout) {\n    if (this._timeoutIdsRegistry) {\n      
this._timeoutIdsRegistry.unregister(timeout);\n    }\n\n    const data = this._timeoutIds.get(timeout);\n\n   
 if (!data) {\n      return;\n    }\n\n    this._timeoutIds.delete(timeout);\n\n    
this._cleanTimeout(data);\n  }\n\n  _cleanTimeout({\n    callbackId,\n    interval\n  }) {\n    
this._unregisterTimeoutCallback(callbackId);\n\n    if (interval) {\n      
this._externalCall("clearInterval", [callbackId]);\n    } else {\n      this._externalCall("clearTimeout", 
[callbackId]);\n    }\n  }\n\n  static _getPlatform(platform) {\n    if (typeof platform === "string") {\n    
  platform = platform.toLowerCase();\n\n      if (platform.includes("win")) {\n        return "WIN";\n      } 
else if (platform.includes("mac")) {\n        return "MAC";\n      }\n    }\n\n    return "UNIX";\n  }\n\n  
static _getLanguage(language) {
 \n    const [main, sub] = language.toLowerCase().split(/[-_]/);\n\n    switch (main) {\n      case "zh":\n   
     if (sub === "cn" || sub === "sg") {\n          return "CHS";\n        }\n\n        return "CHT";\n\n     
 case "da":\n        return "DAN";\n\n      case "de":\n        return "DEU";\n\n      case "es":\n        
return "ESP";\n\n      case "fr":\n        return "FRA";\n\n      case "it":\n        return "ITA";\n\n      
case "ko":\n        return "KOR";\n\n      case "ja":\n        return "JPN";\n\n      case "nl":\n        
return "NLD";\n\n      case "no":\n        return "NOR";\n\n      case "pt":\n        if (sub === "br") {\n   
       return "PTB";\n        }\n\n        return "ENU";\n\n      case "fi":\n        return "SUO";\n\n      
case "SV":\n        return "SVE";\n\n      default:\n        return "ENU";\n    }\n  }\n\n  get activeDocs() 
{\n    return [this._document.wrapped];\n  }\n\n  set activeDocs(_) {\n    throw new Error("app.activeDocs is 
read-only");\n  }\
 n\n  get calculate() {\n    return this._document.obj.calculate;\n  }\n\n  set calculate(calculate) {\n    
this._document.obj.calculate = calculate;\n  }\n\n  get constants() {\n    if (!this._constants) {\n      
this._constants = Object.freeze({\n        align: Object.freeze({\n          left: 0,\n          center: 1,\n 
         right: 2,\n          top: 3,\n          bottom: 4\n        })\n      });\n    }\n\n    return 
this._constants;\n  }\n\n  set constants(_) {\n    throw new Error("app.constants is read-only");\n  }\n\n  
get focusRect() {\n    return this._focusRect;\n  }\n\n  set focusRect(val) {\n    this._focusRect = val;\n  
}\n\n  get formsVersion() {\n    return FORMS_VERSION;\n  }\n\n  set formsVersion(_) {\n    throw new 
Error("app.formsVersion is read-only");\n  }\n\n  get fromPDFConverters() {\n    return [];\n  }\n\n  set 
fromPDFConverters(_) {\n    throw new Error("app.fromPDFConverters is read-only");\n  }\n\n  get fs() {\n    
if (this._fs === null) {\n      this.
 _fs = new Proxy(new _fullscreen.FullScreen({\n        send: this._send\n      }), this._proxyHandler);\n    
}\n\n    return this._fs;\n  }\n\n  set fs(_) {\n    throw new Error("app.fs is read-only");\n  }\n\n  get 
language() {\n    return this._language;\n  }\n\n  set language(_) {\n    throw new Error("app.language is 
read-only");\n  }\n\n  get media() {\n    return undefined;\n  }\n\n  set media(_) {\n    throw new 
Error("app.media is read-only");\n  }\n\n  get monitors() {\n    return [];\n  }\n\n  set monitors(_) {\n    
throw new Error("app.monitors is read-only");\n  }\n\n  get numPlugins() {\n    return 0;\n  }\n\n  set 
numPlugins(_) {\n    throw new Error("app.numPlugins is read-only");\n  }\n\n  get openInPlace() {\n    
return this._openInPlace;\n  }\n\n  set openInPlace(val) {\n    this._openInPlace = val;\n  }\n\n  get 
platform() {\n    return this._platform;\n  }\n\n  set platform(_) {\n    throw new Error("app.platform is 
read-only");\n  }\n\n  get plugins() {\n    retu
 rn [];\n  }\n\n  set plugins(_) {\n    throw new Error("app.plugins is read-only");\n  }\n\n  get 
printColorProfiles() {\n    return [];\n  }\n\n  set printColorProfiles(_) {\n    throw new 
Error("app.printColorProfiles is read-only");\n  }\n\n  get printerNames() {\n    return [];\n  }\n\n  set 
printerNames(_) {\n    throw new Error("app.printerNames is read-only");\n  }\n\n  get runtimeHighlight() {\n 
   return this._runtimeHighlight;\n  }\n\n  set runtimeHighlight(val) {\n    this._runtimeHighlight = val;\n  
}\n\n  get runtimeHighlightColor() {\n    return this._runtimeHighlightColor;\n  }\n\n  set 
runtimeHighlightColor(val) {\n    if (_color.Color._isValidColor(val)) {\n      this._runtimeHighlightColor = 
val;\n    }\n  }\n\n  get thermometer() {\n    if (this._thermometer === null) {\n      this._thermometer = 
new Proxy(new _thermometer.Thermometer({\n        send: this._send\n      }), this._proxyHandler);\n    }\n\n 
   return this._thermometer;\n  }\n\n  set thermometer(_) {\
 n    throw new Error("app.thermometer is read-only");\n  }\n\n  get toolbar() {\n    return this._toolbar;\n 
 }\n\n  set toolbar(val) {\n    this._toolbar = val;\n  }\n\n  get toolbarHorizontal() {\n    return 
this.toolbar;\n  }\n\n  set toolbarHorizontal(value) {\n    this.toolbar = value;\n  }\n\n  get 
toolbarVertical() {\n    return this.toolbar;\n  }\n\n  set toolbarVertical(value) {\n    this.toolbar = 
value;\n  }\n\n  get viewerType() {\n    return VIEWER_TYPE;\n  }\n\n  set viewerType(_) {\n    throw new 
Error("app.viewerType is read-only");\n  }\n\n  get viewerVariation() {\n    return VIEWER_VARIATION;\n  
}\n\n  set viewerVariation(_) {\n    throw new Error("app.viewerVariation is read-only");\n  }\n\n  get 
viewerVersion() {\n    return VIEWER_VERSION;\n  }\n\n  set viewerVersion(_) {\n    throw new 
Error("app.viewerVersion is read-only");\n  }\n\n  addMenuItem() {}\n\n  addSubMenu() {}\n\n  addToolButton() 
{}\n\n  alert(cMsg, nIcon = 0, nType = 0, cTitle = "PDF.js", oDoc =
  null, oCheckbox = null) {\n    if (typeof cMsg === "object") {\n      nType = cMsg.nType;\n      cMsg = 
cMsg.cMsg;\n    }\n\n    cMsg = (cMsg || "").toString();\n    nType = typeof nType !== "number" || 
isNaN(nType) || nType < 0 || nType > 3 ? 0 : nType;\n\n    if (nType >= 2) {\n      return 
this._externalCall("confirm", [cMsg]) ? 4 : 3;\n    }\n\n    this._externalCall("alert", [cMsg]);\n\n    
return 1;\n  }\n\n  beep() {}\n\n  beginPriv() {}\n\n  browseForDoc() {}\n\n  clearInterval(oInterval) {\n    
this._unregisterTimeout(oInterval);\n  }\n\n  clearTimeOut(oTime) {\n    this._unregisterTimeout(oTime);\n  
}\n\n  endPriv() {}\n\n  execDialog() {}\n\n  execMenuItem(item) {\n    switch (item) {\n      case 
"SaveAs":\n      case "FirstPage":\n      case "LastPage":\n      case "NextPage":\n      case "PrevPage":\n  
    case "ZoomViewIn":\n      case "ZoomViewOut":\n        this._send({\n          command: item\n        
});\n\n        break;\n\n      case "FitPage":\n        this._s
 end({\n          command: "zoom",\n          value: "page-fit"\n        });\n\n        break;\n\n      case 
"Print":\n        this._send({\n          command: "print"\n        });\n\n        break;\n    }\n  }\n\n  
getNthPlugInName() {}\n\n  getPath() {}\n\n  goBack() {}\n\n  goForward() {}\n\n  hideMenuItem() {}\n\n  
hideToolbarButton() {}\n\n  launchURL() {}\n\n  listMenuItems() {}\n\n  listToolbarButtons() {}\n\n  
loadPolicyFile() {}\n\n  mailGetAddrs() {}\n\n  mailMsg() {}\n\n  newDoc() {}\n\n  newCollection() {}\n\n  
newFDF() {}\n\n  openDoc() {}\n\n  openFDF() {}\n\n  popUpMenu() {}\n\n  popUpMenuEx() {}\n\n  
removeToolButton() {}\n\n  response(cQuestion, cTitle = "", cDefault = "", bPassword = "", cLabel = "") {\n   
 if (typeof cQuestion === "object") {\n      cDefault = cQuestion.cDefault;\n      cQuestion = 
cQuestion.cQuestion;\n    }\n\n    cQuestion = (cQuestion || "").toString();\n    cDefault = (cDefault || 
"").toString();\n    return this._externalCall("prompt", [cQues
 tion, cDefault || ""]);\n  }\n\n  setInterval(cExpr, nMilliseconds = 0) {\n    if (typeof cExpr === 
"object") {\n      nMilliseconds = cExpr.nMilliseconds || 0;\n      cExpr = cExpr.cExpr;\n    }\n\n    if 
(typeof cExpr !== "string") {\n      throw new TypeError("First argument of app.setInterval must be a 
string");\n    }\n\n    if (typeof nMilliseconds !== "number") {\n      throw new TypeError("Second argument 
of app.setInterval must be a number");\n    }\n\n    const callbackId = 
this._registerTimeoutCallback(cExpr);\n\n    this._externalCall("setInterval", [callbackId, 
nMilliseconds]);\n\n    return this._registerTimeout(callbackId, true);\n  }\n\n  setTimeOut(cExpr, 
nMilliseconds = 0) {\n    if (typeof cExpr === "object") {\n      nMilliseconds = cExpr.nMilliseconds || 0;\n 
     cExpr = cExpr.cExpr;\n    }\n\n    if (typeof cExpr !== "string") {\n      throw new TypeError("First 
argument of app.setTimeOut must be a string");\n    }\n\n    if (typeof nMilliseconds !== "number")
  {\n      throw new TypeError("Second argument of app.setTimeOut must be a number");\n    }\n\n    const 
callbackId = this._registerTimeoutCallback(cExpr);\n\n    this._externalCall("setTimeout", [callbackId, 
nMilliseconds]);\n\n    return this._registerTimeout(callbackId, false);\n  }\n\n  trustedFunction() {}\n\n  
trustPropagatorFunction() {}\n\n}\n\nexports.App = App;\n\n/***/ }),\n/* 10 */\n/***/ 
((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: 
true\n}));\nexports.EventDispatcher = exports.Event = void 0;\n\nclass Event {\n  constructor(data) {\n    
this.change = data.change || "";\n    this.changeEx = data.changeEx || null;\n    this.commitKey = 
data.commitKey || 0;\n    this.fieldFull = data.fieldFull || false;\n    this.keyDown = data.keyDown || 
false;\n    this.modifier = data.modifier || false;\n    this.name = data.name;\n    this.rc = true;\n    
this.richChange = data.richChange || [];\n    this.richChangeEx = data.
 richChangeEx || [];\n    this.richValue = data.richValue || [];\n    this.selEnd = data.selEnd || -1;\n    
this.selStart = data.selStart || -1;\n    this.shift = data.shift || false;\n    this.source = data.source || 
null;\n    this.target = data.target || null;\n    this.targetName = "";\n    this.type = "Field";\n    
this.value = data.value || "";\n    this.willCommit = data.willCommit || false;\n  }\n\n}\n\nexports.Event = 
Event;\n\nclass EventDispatcher {\n  constructor(document, calculationOrder, objects) {\n    this._document = 
document;\n    this._calculationOrder = calculationOrder;\n    this._objects = objects;\n    
this._document.obj._eventDispatcher = this;\n  }\n\n  mergeChange(event) {\n    let value = event.value;\n\n  
  if (typeof value !== "string") {\n      value = value.toString();\n    }\n\n    const prefix = 
event.selStart >= 0 ? value.substring(0, event.selStart) : "";\n    const postfix = event.selEnd >= 0 && 
event.selEnd <= value.length ? value.substring(event
 .selEnd) : "";\n    return `${prefix}${event.change}${postfix}`;\n  }\n\n  dispatch(baseEvent) {\n    const 
id = baseEvent.id;\n\n    if (!(id in this._objects)) {\n      let event;\n\n      if (id === "doc" || id === 
"page") {\n        event = globalThis.event = new Event(baseEvent);\n        event.source = event.target = 
this._document.wrapped;\n        event.name = baseEvent.name;\n      }\n\n      if (id === "doc") {\n        
this._document.obj._dispatchDocEvent(event.name);\n      } else if (id === "page") {\n        
this._document.obj._dispatchPageEvent(event.name, baseEvent.actions, baseEvent.pageNumber);\n      } else if 
(id === "app" && baseEvent.name === "ResetForm") {\n        for (const fieldId of baseEvent.ids) {\n          
const obj = this._objects[fieldId];\n\n          if (obj) {\n            obj.obj._reset();\n          }\n     
   }\n      }\n\n      return;\n    }\n\n    const name = baseEvent.name;\n    const source = 
this._objects[id];\n    const event = globalTh
 is.event = new Event(baseEvent);\n    let savedChange;\n\n    if (source.obj._isButton()) {\n      
source.obj._id = id;\n      event.value = source.obj._getExportValue(event.value);\n\n      if (name === 
"Action") {\n        source.obj._value = event.value;\n      }\n    }\n\n    switch (name) {\n      case 
"Keystroke":\n        savedChange = {\n          value: event.value,\n          change: event.change,\n       
   selStart: event.selStart,\n          selEnd: event.selEnd\n        };\n        break;\n\n      case 
"Blur":\n      case "Focus":\n        Object.defineProperty(event, "value", {\n          configurable: 
false,\n          writable: false,\n          enumerable: true,\n          value: event.value\n        });\n  
      break;\n\n      case "Validate":\n        this.runValidation(source, event);\n        return;\n\n      
case "Action":\n        this.runActions(source, source, event, name);\n\n        if 
(this._document.obj.calculate) {\n          this.runCalculate(source,
  event);\n        }\n\n        return;\n    }\n\n    this.runActions(source, source, event, name);\n\n    if 
(name === "Keystroke") {\n      if (event.rc) {\n        if (event.willCommit) {\n          
this.runValidation(source, event);\n        } else if (event.change !== savedChange.change || event.selStart 
!== savedChange.selStart || event.selEnd !== savedChange.selEnd) {\n          source.wrapped.value = 
this.mergeChange(event);\n        }\n      } else if (!event.willCommit) {\n        source.obj._send({\n      
    id: source.obj._id,\n          value: savedChange.value,\n          selRange: [savedChange.selStart, 
savedChange.selEnd]\n        });\n      }\n    }\n  }\n\n  runValidation(source, event) {\n    const hasRan = 
this.runActions(source, source, event, "Validate");\n\n    if (event.rc) {\n      if (hasRan) {\n        
source.wrapped.value = event.value;\n        source.wrapped.valueAsString = event.value;\n      } else {\n    
    source.obj.value = event.value;\n        s
 ource.obj.valueAsString = event.value;\n      }\n\n      if (this._document.obj.calculate) {\n        
this.runCalculate(source, event);\n      }\n\n      event.value = source.obj.value;\n      
this.runActions(source, source, event, "Format");\n      source.wrapped.valueAsString = event.value;\n    }\n 
 }\n\n  runActions(source, target, event, eventName) {\n    event.source = source.wrapped;\n    event.target 
= target.wrapped;\n    event.name = eventName;\n    event.targetName = target.obj.name;\n    event.rc = 
true;\n    return target.obj._runActions(event);\n  }\n\n  calculateNow() {\n    if (!this._calculationOrder) 
{\n      return;\n    }\n\n    const first = this._calculationOrder[0];\n    const source = 
this._objects[first];\n    globalThis.event = new Event({});\n    this.runCalculate(source, 
globalThis.event);\n  }\n\n  runCalculate(source, event) {\n    if (!this._calculationOrder) {\n      
return;\n    }\n\n    for (const targetId of this._calculationOrder) {\n      if (!(t
 argetId in this._objects)) {\n        continue;\n      }\n\n      if (!this._document.obj.calculate) {\n     
   continue;\n      }\n\n      event.value = null;\n      const target = this._objects[targetId];\n      
this.runActions(source, target, event, "Calculate");\n\n      if (!event.rc) {\n        continue;\n      
}\n\n      if (event.value !== null) {\n        target.wrapped.value = event.value;\n      }\n\n      
event.value = target.obj.value;\n      this.runActions(target, target, event, "Validate");\n\n      if 
(!event.rc) {\n        continue;\n      }\n\n      event.value = target.obj.value;\n      
this.runActions(target, target, event, "Format");\n\n      if (event.value !== null) {\n        
target.wrapped.valueAsString = event.value;\n      }\n    }\n  }\n\n}\n\nexports.EventDispatcher = 
EventDispatcher;\n\n/***/ }),\n/* 11 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}));\nex
 ports.FullScreen = void 0;\n\nvar _constants = __w_pdfjs_require__(2);\n\nvar _pdf_object = 
__w_pdfjs_require__(7);\n\nclass FullScreen extends _pdf_object.PDFObject {\n  constructor(data) {\n    
super(data);\n    this._backgroundColor = [];\n    this._clickAdvances = true;\n    this._cursor = 
_constants.Cursor.hidden;\n    this._defaultTransition = "";\n    this._escapeExits = true;\n    
this._isFullScreen = true;\n    this._loop = false;\n    this._timeDelay = 3600;\n    this._usePageTiming = 
false;\n    this._useTimer = false;\n  }\n\n  get backgroundColor() {\n    return this._backgroundColor;\n  
}\n\n  set backgroundColor(_) {}\n\n  get clickAdvances() {\n    return this._clickAdvances;\n  }\n\n  set 
clickAdvances(_) {}\n\n  get cursor() {\n    return this._cursor;\n  }\n\n  set cursor(_) {}\n\n  get 
defaultTransition() {\n    return this._defaultTransition;\n  }\n\n  set defaultTransition(_) {}\n\n  get 
escapeExits() {\n    return this._escapeExits;\n  }\n\n  set escapeExits(_
 ) {}\n\n  get isFullScreen() {\n    return this._isFullScreen;\n  }\n\n  set isFullScreen(_) {}\n\n  get 
loop() {\n    return this._loop;\n  }\n\n  set loop(_) {}\n\n  get timeDelay() {\n    return 
this._timeDelay;\n  }\n\n  set timeDelay(_) {}\n\n  get transitions() {\n    return ["Replace", "WipeRight", 
"WipeLeft", "WipeDown", "WipeUp", "SplitHorizontalIn", "SplitHorizontalOut", "SplitVerticalIn", 
"SplitVerticalOut", "BlindsHorizontal", "BlindsVertical", "BoxIn", "BoxOut", "GlitterRight", "GlitterDown", 
"GlitterRightDown", "Dissolve", "Random"];\n  }\n\n  set transitions(_) {\n    throw new 
Error("fullscreen.transitions is read-only");\n  }\n\n  get usePageTiming() {\n    return 
this._usePageTiming;\n  }\n\n  set usePageTiming(_) {}\n\n  get useTimer() {\n    return this._useTimer;\n  
}\n\n  set useTimer(_) {}\n\n}\n\nexports.FullScreen = FullScreen;\n\n/***/ }),\n/* 12 */\n/***/ 
((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, "_
 _esModule", ({\n  value: true\n}));\nexports.Thermometer = void 0;\n\nvar _pdf_object = 
__w_pdfjs_require__(7);\n\nclass Thermometer extends _pdf_object.PDFObject {\n  constructor(data) {\n    
super(data);\n    this._cancelled = false;\n    this._duration = 100;\n    this._text = "";\n    this._value 
= 0;\n  }\n\n  get cancelled() {\n    return this._cancelled;\n  }\n\n  set cancelled(_) {\n    throw new 
Error("thermometer.cancelled is read-only");\n  }\n\n  get duration() {\n    return this._duration;\n  }\n\n  
set duration(val) {\n    this._duration = val;\n  }\n\n  get text() {\n    return this._text;\n  }\n\n  set 
text(val) {\n    this._text = val;\n  }\n\n  get value() {\n    return this._value;\n  }\n\n  set value(val) 
{\n    this._value = val;\n  }\n\n  begin() {}\n\n  end() {}\n\n}\n\nexports.Thermometer = 
Thermometer;\n\n/***/ }),\n/* 13 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: t
 rue\n}));\nexports.Console = void 0;\n\nvar _pdf_object = __w_pdfjs_require__(7);\n\nclass Console extends 
_pdf_object.PDFObject {\n  clear() {\n    this._send({\n      id: "clear"\n    });\n  }\n\n  hide() {}\n\n  
println(msg) {\n    if (typeof msg === "string") {\n      this._send({\n        command: "println",\n        
value: "PDF.js Console:: " + msg\n      });\n    }\n  }\n\n  show() {}\n\n}\n\nexports.Console = 
Console;\n\n/***/ }),\n/* 14 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}));\nexports.Doc = void 0;\n\nvar 
_common = __w_pdfjs_require__(4);\n\nvar _pdf_object = __w_pdfjs_require__(7);\n\nvar _print_params = 
__w_pdfjs_require__(15);\n\nvar _constants = __w_pdfjs_require__(2);\n\nclass InfoProxyHandler {\n  static 
get(obj, prop) {\n    return obj[prop.toLowerCase()];\n  }\n\n  static set(obj, prop, value) {\n    throw new 
Error(`doc.info.${prop} is read-only`);\n  }\n\n}\
 n\nclass Doc extends _pdf_object.PDFObject {\n  constructor(data) {\n    super(data);\n    this._expandos = 
globalThis;\n    this._baseURL = data.baseURL || "";\n    this._calculate = true;\n    this._delay = false;\n 
   this._dirty = false;\n    this._disclosed = false;\n    this._media = undefined;\n    this._metadata = 
data.metadata || "";\n    this._noautocomplete = undefined;\n    this._nocache = undefined;\n    
this._spellDictionaryOrder = [];\n    this._spellLanguageOrder = [];\n    this._printParams = null;\n    
this._fields = new Map();\n    this._fieldNames = [];\n    this._event = null;\n    this._author = 
data.Author || "";\n    this._creator = data.Creator || "";\n    this._creationDate = 
this._getDate(data.CreationDate) || null;\n    this._docID = data.docID || ["", ""];\n    
this._documentFileName = data.filename || "";\n    this._filesize = data.filesize || 0;\n    this._keywords = 
data.Keywords || "";\n    this._layout = data.layout || "";\n    this._modDate = this.
 _getDate(data.ModDate) || null;\n    this._numFields = 0;\n    this._numPages = data.numPages || 1;\n    
this._pageNum = data.pageNum || 0;\n    this._producer = data.Producer || "";\n    this._subject = 
data.Subject || "";\n    this._title = data.Title || "";\n    this._URL = data.URL || "";\n    this._info = 
new Proxy({\n      title: this._title,\n      author: this._author,\n      authors: data.authors || 
[this._author],\n      subject: this._subject,\n      keywords: this._keywords,\n      creator: 
this._creator,\n      producer: this._producer,\n      creationdate: this._creationDate,\n      moddate: 
this._modDate,\n      trapped: data.Trapped || "Unknown"\n    }, InfoProxyHandler);\n    this._zoomType = 
_constants.ZoomType.none;\n    this._zoom = data.zoom || 100;\n    this._actions = (0, 
_common.createActionsMap)(data.actions);\n    this._globalEval = data.globalEval;\n    this._pageActions = 
new Map();\n  }\n\n  _dispatchDocEvent(name) {\n    if (name === "Open") {\n      co
 nst dontRun = new Set(["WillClose", "WillSave", "DidSave", "WillPrint", "DidPrint", "OpenAction"]);\n\n      
for (const actionName of this._actions.keys()) {\n        if (!dontRun.has(actionName)) {\n          
this._runActions(actionName);\n        }\n      }\n\n      this._runActions("OpenAction");\n    } else {\n    
  this._runActions(name);\n    }\n  }\n\n  _dispatchPageEvent(name, actions, pageNumber) {\n    if (name === 
"PageOpen") {\n      if (!this._pageActions.has(pageNumber)) {\n        this._pageActions.set(pageNumber, (0, 
_common.createActionsMap)(actions));\n      }\n\n      this._pageNum = pageNumber - 1;\n    }\n\n    actions 
= this._pageActions.get(pageNumber)?.get(name);\n\n    if (actions) {\n      for (const action of actions) 
{\n        this._globalEval(action);\n      }\n    }\n  }\n\n  _runActions(name) {\n    const actions = 
this._actions.get(name);\n\n    if (actions) {\n      for (const action of actions) {\n        
this._globalEval(action);\n      }\n    }\n
   }\n\n  _addField(name, field) {\n    this._fields.set(name, field);\n\n    
this._fieldNames.push(name);\n\n    this._numFields++;\n  }\n\n  _getDate(date) {\n    if (!date || 
date.length < 15 || !date.startsWith("D:")) {\n      return date;\n    }\n\n    date = date.substring(2);\n   
 const year = date.substring(0, 4);\n    const month = date.substring(4, 6);\n    const day = 
date.substring(6, 8);\n    const hour = date.substring(8, 10);\n    const minute = date.substring(10, 12);\n  
  const o = date.charAt(12);\n    let second, offsetPos;\n\n    if (o === "Z" || o === "+" || o === "-") {\n  
    second = "00";\n      offsetPos = 12;\n    } else {\n      second = date.substring(12, 14);\n      
offsetPos = 14;\n    }\n\n    const offset = date.substring(offsetPos).replaceAll("\'", "");\n    return new 
Date(`${year}-${month}-${day}T${hour}:${minute}:${second}${offset}`);\n  }\n\n  get author() {\n    return 
this._author;\n  }\n\n  set author(_) {\n    throw new Error("doc.author is r
 ead-only");\n  }\n\n  get baseURL() {\n    return this._baseURL;\n  }\n\n  set baseURL(baseURL) {\n    
this._baseURL = baseURL;\n  }\n\n  get bookmarkRoot() {\n    return undefined;\n  }\n\n  set bookmarkRoot(_) 
{\n    throw new Error("doc.bookmarkRoot is read-only");\n  }\n\n  get calculate() {\n    return 
this._calculate;\n  }\n\n  set calculate(calculate) {\n    this._calculate = calculate;\n  }\n\n  get 
creator() {\n    return this._creator;\n  }\n\n  set creator(_) {\n    throw new Error("doc.creator is 
read-only");\n  }\n\n  get dataObjects() {\n    return [];\n  }\n\n  set dataObjects(_) {\n    throw new 
Error("doc.dataObjects is read-only");\n  }\n\n  get delay() {\n    return this._delay;\n  }\n\n  set 
delay(delay) {\n    this._delay = delay;\n  }\n\n  get dirty() {\n    return this._dirty;\n  }\n\n  set 
dirty(dirty) {\n    this._dirty = dirty;\n  }\n\n  get disclosed() {\n    return this._disclosed;\n  }\n\n  
set disclosed(disclosed) {\n    this._disclosed = disclosed;\n  
 }\n\n  get docID() {\n    return this._docID;\n  }\n\n  set docID(_) {\n    throw new Error("doc.docID is 
read-only");\n  }\n\n  get documentFileName() {\n    return this._documentFileName;\n  }\n\n  set 
documentFileName(_) {\n    throw new Error("doc.documentFileName is read-only");\n  }\n\n  get 
dynamicXFAForm() {\n    return false;\n  }\n\n  set dynamicXFAForm(_) {\n    throw new 
Error("doc.dynamicXFAForm is read-only");\n  }\n\n  get external() {\n    return true;\n  }\n\n  set 
external(_) {\n    throw new Error("doc.external is read-only");\n  }\n\n  get filesize() {\n    return 
this._filesize;\n  }\n\n  set filesize(_) {\n    throw new Error("doc.filesize is read-only");\n  }\n\n  get 
hidden() {\n    return false;\n  }\n\n  set hidden(_) {\n    throw new Error("doc.hidden is read-only");\n  
}\n\n  get hostContainer() {\n    return undefined;\n  }\n\n  set hostContainer(_) {\n    throw new 
Error("doc.hostContainer is read-only");\n  }\n\n  get icons() {\n    return undefined;\n
   }\n\n  set icons(_) {\n    throw new Error("doc.icons is read-only");\n  }\n\n  get info() {\n    return 
this._info;\n  }\n\n  set info(_) {\n    throw new Error("doc.info is read-only");\n  }\n\n  get 
innerAppWindowRect() {\n    return [0, 0, 0, 0];\n  }\n\n  set innerAppWindowRect(_) {\n    throw new 
Error("doc.innerAppWindowRect is read-only");\n  }\n\n  get innerDocWindowRect() {\n    return [0, 0, 0, 
0];\n  }\n\n  set innerDocWindowRect(_) {\n    throw new Error("doc.innerDocWindowRect is read-only");\n  
}\n\n  get isModal() {\n    return false;\n  }\n\n  set isModal(_) {\n    throw new Error("doc.isModal is 
read-only");\n  }\n\n  get keywords() {\n    return this._keywords;\n  }\n\n  set keywords(_) {\n    throw 
new Error("doc.keywords is read-only");\n  }\n\n  get layout() {\n    return this._layout;\n  }\n\n  set 
layout(value) {\n    if (typeof value !== "string") {\n      return;\n    }\n\n    if (value !== "SinglePage" 
&& value !== "OneColumn" && value !== "TwoColumnLeft
 " && value !== "TwoPageLeft" && value !== "TwoColumnRight" && value !== "TwoPageRight") {\n      value = 
"SinglePage";\n    }\n\n    this._send({\n      command: "layout",\n      value\n    });\n\n    this._layout 
= value;\n  }\n\n  get media() {\n    return this._media;\n  }\n\n  set media(media) {\n    this._media = 
media;\n  }\n\n  get metadata() {\n    return this._metadata;\n  }\n\n  set metadata(metadata) {\n    
this._metadata = metadata;\n  }\n\n  get modDate() {\n    return this._modDate;\n  }\n\n  set modDate(_) {\n  
  throw new Error("doc.modDate is read-only");\n  }\n\n  get mouseX() {\n    return 0;\n  }\n\n  set 
mouseX(_) {\n    throw new Error("doc.mouseX is read-only");\n  }\n\n  get mouseY() {\n    return 0;\n  }\n\n 
 set mouseY(_) {\n    throw new Error("doc.mouseY is read-only");\n  }\n\n  get noautocomplete() {\n    
return this._noautocomplete;\n  }\n\n  set noautocomplete(noautocomplete) {\n    this._noautocomplete = 
noautocomplete;\n  }\n\n  get nocache() {\n   
  return this._nocache;\n  }\n\n  set nocache(nocache) {\n    this._nocache = nocache;\n  }\n\n  get 
numFields() {\n    return this._numFields;\n  }\n\n  set numFields(_) {\n    throw new Error("doc.numFields 
is read-only");\n  }\n\n  get numPages() {\n    return this._numPages;\n  }\n\n  set numPages(_) {\n    throw 
new Error("doc.numPages is read-only");\n  }\n\n  get numTemplates() {\n    return 0;\n  }\n\n  set 
numTemplates(_) {\n    throw new Error("doc.numTemplates is read-only");\n  }\n\n  get outerAppWindowRect() 
{\n    return [0, 0, 0, 0];\n  }\n\n  set outerAppWindowRect(_) {\n    throw new 
Error("doc.outerAppWindowRect is read-only");\n  }\n\n  get outerDocWindowRect() {\n    return [0, 0, 0, 
0];\n  }\n\n  set outerDocWindowRect(_) {\n    throw new Error("doc.outerDocWindowRect is read-only");\n  
}\n\n  get pageNum() {\n    return this._pageNum;\n  }\n\n  set pageNum(value) {\n    if (typeof value !== 
"number" || value < 0 || value >= this._numPages) {\n      return;\n    
 }\n\n    this._send({\n      command: "page-num",\n      value\n    });\n\n    this._pageNum = value;\n  
}\n\n  get pageWindowRect() {\n    return [0, 0, 0, 0];\n  }\n\n  set pageWindowRect(_) {\n    throw new 
Error("doc.pageWindowRect is read-only");\n  }\n\n  get path() {\n    return "";\n  }\n\n  set path(_) {\n    
throw new Error("doc.path is read-only");\n  }\n\n  get permStatusReady() {\n    return true;\n  }\n\n  set 
permStatusReady(_) {\n    throw new Error("doc.permStatusReady is read-only");\n  }\n\n  get producer() {\n   
 return this._producer;\n  }\n\n  set producer(_) {\n    throw new Error("doc.producer is read-only");\n  
}\n\n  get requiresFullSave() {\n    return false;\n  }\n\n  set requiresFullSave(_) {\n    throw new 
Error("doc.requiresFullSave is read-only");\n  }\n\n  get securityHandler() {\n    return null;\n  }\n\n  set 
securityHandler(_) {\n    throw new Error("doc.securityHandler is read-only");\n  }\n\n  get selectedAnnots() 
{\n    return [];\n  }\n\n  set
  selectedAnnots(_) {\n    throw new Error("doc.selectedAnnots is read-only");\n  }\n\n  get sounds() {\n    
return [];\n  }\n\n  set sounds(_) {\n    throw new Error("doc.sounds is read-only");\n  }\n\n  get 
spellDictionaryOrder() {\n    return this._spellDictionaryOrder;\n  }\n\n  set 
spellDictionaryOrder(spellDictionaryOrder) {\n    this._spellDictionaryOrder = spellDictionaryOrder;\n  }\n\n 
 get spellLanguageOrder() {\n    return this._spellLanguageOrder;\n  }\n\n  set 
spellLanguageOrder(spellLanguageOrder) {\n    this._spellLanguageOrder = spellLanguageOrder;\n  }\n\n  get 
subject() {\n    return this._subject;\n  }\n\n  set subject(_) {\n    throw new Error("doc.subject is 
read-only");\n  }\n\n  get templates() {\n    return [];\n  }\n\n  set templates(_) {\n    throw new 
Error("doc.templates is read-only");\n  }\n\n  get title() {\n    return this._title;\n  }\n\n  set title(_) 
{\n    throw new Error("doc.title is read-only");\n  }\n\n  get URL() {\n    return this._URL;\n  }\
 n\n  set URL(_) {\n    throw new Error("doc.URL is read-only");\n  }\n\n  get viewState() {\n    return 
undefined;\n  }\n\n  set viewState(_) {\n    throw new Error("doc.viewState is read-only");\n  }\n\n  get 
xfa() {\n    return this._xfa;\n  }\n\n  set xfa(_) {\n    throw new Error("doc.xfa is read-only");\n  }\n\n  
get XFAForeground() {\n    return false;\n  }\n\n  set XFAForeground(_) {\n    throw new 
Error("doc.XFAForeground is read-only");\n  }\n\n  get zoomType() {\n    return this._zoomType;\n  }\n\n  set 
zoomType(type) {\n    if (typeof type !== "string") {\n      return;\n    }\n\n    switch (type) {\n      
case _constants.ZoomType.none:\n        this._send({\n          command: "zoom",\n          value: 1\n        
});\n\n        break;\n\n      case _constants.ZoomType.fitP:\n        this._send({\n          command: 
"zoom",\n          value: "page-fit"\n        });\n\n        break;\n\n      case _constants.ZoomType.fitW:\n 
       this._send({\n          command: "zoom",\
 n          value: "page-width"\n        });\n\n        break;\n\n      case _constants.ZoomType.fitH:\n      
  this._send({\n          command: "zoom",\n          value: "page-height"\n        });\n\n        break;\n\n 
     case _constants.ZoomType.fitV:\n        this._send({\n          command: "zoom",\n          value: 
"auto"\n        });\n\n        break;\n\n      case _constants.ZoomType.pref:\n      case 
_constants.ZoomType.refW:\n        break;\n\n      default:\n        return;\n    }\n\n    this._zoomType = 
type;\n  }\n\n  get zoom() {\n    return this._zoom;\n  }\n\n  set zoom(value) {\n    if (typeof value !== 
"number" || value < 8.33 || value > 6400) {\n      return;\n    }\n\n    this._send({\n      command: 
"zoom",\n      value: value / 100\n    });\n  }\n\n  addAnnot() {}\n\n  addField() {}\n\n  addIcon() {}\n\n  
addLink() {}\n\n  addRecipientListCryptFilter() {}\n\n  addRequirement() {}\n\n  addScript() {}\n\n  
addThumbnails() {}\n\n  addWatermarkFromFile() {}\n\n  ad
 dWatermarkFromText() {}\n\n  addWeblinks() {}\n\n  bringToFront() {}\n\n  calculateNow() {\n    
this._eventDispatcher.calculateNow();\n  }\n\n  closeDoc() {}\n\n  colorConvertPage() {}\n\n  
createDataObject() {}\n\n  createTemplate() {}\n\n  deletePages() {}\n\n  deleteSound() {}\n\n  
embedDocAsDataObject() {}\n\n  embedOutputIntent() {}\n\n  encryptForRecipients() {}\n\n  
encryptUsingPolicy() {}\n\n  exportAsFDF() {}\n\n  exportAsFDFStr() {}\n\n  exportAsText() {}\n\n  
exportAsXFDF() {}\n\n  exportAsXFDFStr() {}\n\n  exportDataObject() {}\n\n  exportXFAData() {}\n\n  
extractPages() {}\n\n  flattenPages() {}\n\n  getAnnot() {}\n\n  getAnnots() {}\n\n  getAnnot3D() {}\n\n  
getAnnots3D() {}\n\n  getColorConvertAction() {}\n\n  getDataObject() {}\n\n  getDataObjectContents() {}\n\n  
getField(cName) {\n    if (typeof cName === "object") {\n      cName = cName.cName;\n    }\n\n    if (typeof 
cName !== "string") {\n      throw new TypeError("Invalid field name: must be a string");\n    }\
 n\n    const searchedField = this._fields.get(cName);\n\n    if (searchedField) {\n      return 
searchedField;\n    }\n\n    const parts = cName.split("#");\n    let childIndex = NaN;\n\n    if 
(parts.length === 2) {\n      childIndex = Math.floor(parseFloat(parts[1]));\n      cName = parts[0];\n    
}\n\n    for (const [name, field] of this._fields.entries()) {\n      if (name.endsWith(cName)) {\n        if 
(!isNaN(childIndex)) {\n          const children = this._getChildren(name);\n\n          if (childIndex < 0 
|| childIndex >= children.length) {\n            childIndex = 0;\n          }\n\n          if (childIndex < 
children.length) {\n            this._fields.set(cName, children[childIndex]);\n\n            return 
children[childIndex];\n          }\n        }\n\n        this._fields.set(cName, field);\n\n        return 
field;\n      }\n    }\n\n    return null;\n  }\n\n  _getChildren(fieldName) {\n    const len = 
fieldName.length;\n    const children = [];\n    const pattern = /
 ^\\.[^.]+$/;\n\n    for (const [name, field] of this._fields.entries()) {\n      if 
(name.startsWith(fieldName)) {\n        const finalPart = name.slice(len);\n\n        if 
(finalPart.match(pattern)) {\n          children.push(field);\n        }\n      }\n    }\n\n    return 
children;\n  }\n\n  getIcon() {}\n\n  getLegalWarnings() {}\n\n  getLinks() {}\n\n  getNthFieldName(nIndex) 
{\n    if (typeof nIndex === "object") {\n      nIndex = nIndex.nIndex;\n    }\n\n    if (typeof nIndex !== 
"number") {\n      throw new TypeError("Invalid field index: must be a number");\n    }\n\n    if (0 <= 
nIndex && nIndex < this.numFields) {\n      return this._fieldNames[Math.trunc(nIndex)];\n    }\n\n    return 
null;\n  }\n\n  getNthTemplate() {\n    return null;\n  }\n\n  getOCGs() {}\n\n  getOCGOrder() {}\n\n  
getPageBox() {}\n\n  getPageLabel() {}\n\n  getPageNthWord() {}\n\n  getPageNthWordQuads() {}\n\n  
getPageNumWords() {}\n\n  getPageRotation() {}\n\n  getPageTransition() {}\n\n  getPrintP
 arams() {\n    if (!this._printParams) {\n      this._printParams = new _print_params.PrintParams({\n        
lastPage: this._numPages - 1\n      });\n    }\n\n    return this._printParams;\n  }\n\n  getSound() {}\n\n  
getTemplate() {}\n\n  getURL() {}\n\n  gotoNamedDest() {}\n\n  importAnFDF() {}\n\n  importAnXFDF() {}\n\n  
importDataObject() {}\n\n  importIcon() {}\n\n  importSound() {}\n\n  importTextData() {}\n\n  
importXFAData() {}\n\n  insertPages() {}\n\n  mailDoc() {}\n\n  mailForm() {}\n\n  movePage() {}\n\n  
newPage() {}\n\n  openDataObject() {}\n\n  print(bUI = true, nStart = 0, nEnd = -1, bSilent = false, 
bShrinkToFit = false, bPrintAsImage = false, bReverse = false, bAnnotations = true, printParams = null) {\n   
 if (typeof bUI === "object") {\n      nStart = bUI.nStart;\n      nEnd = bUI.nEnd;\n      bSilent = 
bUI.bSilent;\n      bShrinkToFit = bUI.bShrinkToFit;\n      bPrintAsImage = bUI.bPrintAsImage;\n      
bReverse = bUI.bReverse;\n      bAnnotations = bUI.bAnnotati
 ons;\n      printParams = bUI.printParams;\n      bUI = bUI.bUI;\n    }\n\n    if (printParams) {\n      
nStart = printParams.firstPage;\n      nEnd = printParams.lastPage;\n    }\n\n    if (typeof nStart === 
"number") {\n      nStart = Math.max(0, Math.trunc(nStart));\n    } else {\n      nStart = 0;\n    }\n\n    
if (typeof nEnd === "number") {\n      nEnd = Math.max(0, Math.trunc(nEnd));\n    } else {\n      nEnd = 
-1;\n    }\n\n    this._send({\n      command: "print",\n      start: nStart,\n      end: nEnd\n    });\n  
}\n\n  removeDataObject() {}\n\n  removeField() {}\n\n  removeIcon() {}\n\n  removeLinks() {}\n\n  
removeRequirement() {}\n\n  removeScript() {}\n\n  removeTemplate() {}\n\n  removeThumbnails() {}\n\n  
removeWeblinks() {}\n\n  replacePages() {}\n\n  resetForm(aFields = null) {\n    if (aFields && 
!Array.isArray(aFields) && typeof aFields === "object") {\n      aFields = aFields.aFields;\n    }\n\n    let 
mustCalculate = false;\n\n    if (aFields) {\n      for (con
 st fieldName of aFields) {\n        if (!fieldName) {\n          continue;\n        }\n\n        const field 
= this.getField(fieldName);\n\n        if (!field) {\n          continue;\n        }\n\n        field.value = 
field.defaultValue;\n        field.valueAsString = field.value;\n        mustCalculate = true;\n      }\n    
} else {\n      mustCalculate = this._fields.size !== 0;\n\n      for (const field of this._fields.values()) 
{\n        field.value = field.defaultValue;\n        field.valueAsString = field.value;\n      }\n    }\n\n  
  if (mustCalculate) {\n      this.calculateNow();\n    }\n  }\n\n  saveAs() {}\n\n  scroll() {}\n\n  
selectPageNthWord() {}\n\n  setAction() {}\n\n  setDataObjectContents() {}\n\n  setOCGOrder() {}\n\n  
setPageAction() {}\n\n  setPageBoxes() {}\n\n  setPageLabels() {}\n\n  setPageRotations() {}\n\n  
setPageTabOrder() {}\n\n  setPageTransitions() {}\n\n  spawnPageFromTemplate() {}\n\n  submitForm() {}\n\n  
syncAnnotScan() {}\n\n}\n\nexports.Doc =
  Doc;\n\n/***/ }),\n/* 15 */\n/***/ ((__unused_webpack_module, exports) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}));\nexports.PrintParams = void 
0;\n\nclass PrintParams {\n  constructor(data) {\n    this.binaryOk = true;\n    this.bitmapDPI = 150;\n    
this.booklet = {\n      binding: 0,\n      duplexMode: 0,\n      subsetFrom: 0,\n      subsetTo: -1\n    };\n 
   this.colorOverride = 0;\n    this.colorProfile = "";\n    this.constants = Object.freeze({\n      
bookletBindings: Object.freeze({\n        Left: 0,\n        Right: 1,\n        LeftTall: 2,\n        
RightTall: 3\n      }),\n      bookletDuplexMode: Object.freeze({\n        BothSides: 0,\n        
FrontSideOnly: 1,\n        BasicSideOnly: 2\n      }),\n      colorOverrides: Object.freeze({\n        auto: 
0,\n        gray: 1,\n        mono: 2\n      }),\n      fontPolicies: Object.freeze({\n        everyPage: 
0,\n        jobStart: 1,\n        pageRange: 2\n      }),\n      handling: Object.f
 reeze({\n        none: 0,\n        fit: 1,\n        shrink: 2,\n        tileAll: 3,\n        tileLarge: 4,\n 
       nUp: 5,\n        booklet: 6\n      }),\n      interactionLevel: Object.freeze({\n        automatic: 
0,\n        full: 1,\n        silent: 2\n      }),\n      nUpPageOrders: Object.freeze({\n        Horizontal: 
0,\n        HorizontalReversed: 1,\n        Vertical: 2\n      }),\n      printContents: Object.freeze({\n    
    doc: 0,\n        docAndComments: 1,\n        formFieldsOnly: 2\n      }),\n      flagValues: 
Object.freeze({\n        applyOverPrint: 1,\n        applySoftProofSettings: 1 << 1,\n        
applyWorkingColorSpaces: 1 << 2,\n        emitHalftones: 1 << 3,\n        emitPostScriptXObjects: 1 << 4,\n   
     emitFormsAsPSForms: 1 << 5,\n        maxJP2KRes: 1 << 6,\n        setPageSize: 1 << 7,\n        
suppressBG: 1 << 8,\n        suppressCenter: 1 << 9,\n        suppressCJKFontSubst: 1 << 10,\n        
suppressCropClip: 1 << 1,\n        suppressRotate: 1 << 1
 2,\n        suppressTransfer: 1 << 13,\n        suppressUCR: 1 << 14,\n        useTrapAnnots: 1 << 15,\n     
   usePrintersMarks: 1 << 16\n      }),\n      rasterFlagValues: Object.freeze({\n        textToOutline: 1,\n 
       strokesToOutline: 1 << 1,\n        allowComplexClip: 1 << 2,\n        preserveOverprint: 1 << 3\n      
}),\n      subsets: Object.freeze({\n        all: 0,\n        even: 1,\n        odd: 2\n      }),\n      
tileMarks: Object.freeze({\n        none: 0,\n        west: 1,\n        east: 2\n      }),\n      usages: 
Object.freeze({\n        auto: 0,\n        use: 1,\n        noUse: 2\n      })\n    });\n    
this.downloadFarEastFonts = false;\n    this.fileName = "";\n    this.firstPage = 0;\n    this.flags = 0;\n   
 this.fontPolicy = 0;\n    this.gradientDPI = 150;\n    this.interactive = 1;\n    this.lastPage = 
data.lastPage;\n    this.npUpAutoRotate = false;\n    this.npUpNumPagesH = 2;\n    this.npUpNumPagesV = 2;\n  
  this.npUpPageBorder = false;\n    this.npUp
 PageOrder = 0;\n    this.pageHandling = 0;\n    this.pageSubset = 0;\n    this.printAsImage = false;\n    
this.printContent = 0;\n    this.printerName = "";\n    this.psLevel = 0;\n    this.rasterFlags = 0;\n    
this.reversePages = false;\n    this.tileLabel = false;\n    this.tileMark = 0;\n    this.tileOverlap = 0;\n  
  this.tileScale = 1.0;\n    this.transparencyLevel = 75;\n    this.usePrinterCRD = 0;\n    
this.useT1Conversion = 0;\n  }\n\n}\n\nexports.PrintParams = PrintParams;\n\n/***/ }),\n/* 16 */\n/***/ 
((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: 
true\n}));\nexports.ProxyHandler = void 0;\n\nclass ProxyHandler {\n  constructor() {\n    this.nosend = new 
Set(["delay"]);\n  }\n\n  get(obj, prop) {\n    if (prop in obj._expandos) {\n      const val = 
obj._expandos[prop];\n\n      if (typeof val === "function") {\n        return val.bind(obj);\n      }\n\n    
  return val;\n    }\n\n    if (typeof prop === "string" &
 & !prop.startsWith("_") && prop in obj) {\n      const val = obj[prop];\n\n      if (typeof val === 
"function") {\n        return val.bind(obj);\n      }\n\n      return val;\n    }\n\n    return undefined;\n  
}\n\n  set(obj, prop, value) {\n    if (obj._kidIds) {\n      obj._kidIds.forEach(id => {\n        
obj._appObjects[id].wrapped[prop] = value;\n      });\n    }\n\n    if (typeof prop === "string" && 
!prop.startsWith("_") && prop in obj) {\n      const old = obj[prop];\n      obj[prop] = value;\n\n      if 
(!this.nosend.has(prop) && obj._send && obj._id !== null && typeof old !== "function") {\n        const data 
= {\n          id: obj._id\n        };\n        data[prop] = obj[prop];\n\n        if (!obj._siblings) {\n    
      obj._send(data);\n        } else {\n          data.siblings = obj._siblings;\n\n          
obj._send(data);\n        }\n      }\n    } else {\n      obj._expandos[prop] = value;\n    }\n\n    return 
true;\n  }\n\n  has(obj, prop) {\n    return prop in obj.
 _expandos || typeof prop === "string" && !prop.startsWith("_") && prop in obj;\n  }\n\n  getPrototypeOf(obj) 
{\n    return null;\n  }\n\n  setPrototypeOf(obj, proto) {\n    return false;\n  }\n\n  isExtensible(obj) {\n 
   return true;\n  }\n\n  preventExtensions(obj) {\n    return false;\n  }\n\n  getOwnPropertyDescriptor(obj, 
prop) {\n    if (prop in obj._expandos) {\n      return {\n        configurable: true,\n        enumerable: 
true,\n        value: obj._expandos[prop]\n      };\n    }\n\n    if (typeof prop === "string" && 
!prop.startsWith("_") && prop in obj) {\n      return {\n        configurable: true,\n        enumerable: 
true,\n        value: obj[prop]\n      };\n    }\n\n    return undefined;\n  }\n\n  defineProperty(obj, key, 
descriptor) {\n    Object.defineProperty(obj._expandos, key, descriptor);\n    return true;\n  }\n\n  
deleteProperty(obj, prop) {\n    if (prop in obj._expandos) {\n      delete obj._expandos[prop];\n    }\n  
}\n\n  ownKeys(obj) {\n    const fromE
 xpandos = Reflect.ownKeys(obj._expandos);\n    const fromObj = Reflect.ownKeys(obj).filter(k => 
!k.startsWith("_"));\n    return fromExpandos.concat(fromObj);\n  }\n\n}\n\nexports.ProxyHandler = 
ProxyHandler;\n\n/***/ }),\n/* 17 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}));\nexports.Util = void 0;\n\nvar 
_pdf_object = __w_pdfjs_require__(7);\n\nclass Util extends _pdf_object.PDFObject {\n  constructor(data) {\n  
  super(data);\n    this._scandCache = new Map();\n    this._months = ["January", "February", "March", 
"April", "May", "June", "July", "August", "September", "October", "November", "December"];\n    this._days = 
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];\n    this.MILLISECONDS_IN_DAY 
= 86400000;\n    this.MILLISECONDS_IN_WEEK = 604800000;\n    this._externalCall = data.externalCall;\n  }\n\n 
 printf(...args) {\n    if (args.length === 0) 
 {\n      throw new Error("Invalid number of params in printf");\n    }\n\n    if (typeof args[0] !== 
"string") {\n      throw new TypeError("First argument of printf must be a string");\n    }\n\n    const 
pattern = /%(,[0-4])?([+ 0#]+)?(\\d+)?(\\.\\d+)?(.)/g;\n    const PLUS = 1;\n    const SPACE = 2;\n    const 
ZERO = 4;\n    const HASH = 8;\n    let i = 0;\n    return args[0].replace(pattern, function (match, nDecSep, 
cFlags, nWidth, nPrecision, cConvChar) {\n      if (cConvChar !== "d" && cConvChar !== "f" && cConvChar !== 
"s" && cConvChar !== "x") {\n        const buf = ["%"];\n\n        for (const str of [nDecSep, cFlags, 
nWidth, nPrecision, cConvChar]) {\n          if (str) {\n            buf.push(str);\n          }\n        
}\n\n        return buf.join("");\n      }\n\n      i++;\n\n      if (i === args.length) {\n        throw new 
Error("Not enough arguments in printf");\n      }\n\n      const arg = args[i];\n\n      if (cConvChar === 
"s") {\n        return arg.toString();
 \n      }\n\n      let flags = 0;\n\n      if (cFlags) {\n        for (const flag of cFlags) {\n          
switch (flag) {\n            case "+":\n              flags |= PLUS;\n              break;\n\n            
case " ":\n              flags |= SPACE;\n              break;\n\n            case "0":\n              flags 
|= ZERO;\n              break;\n\n            case "#":\n              flags |= HASH;\n              break;\n 
         }\n        }\n      }\n\n      cFlags = flags;\n\n      if (nWidth) {\n        nWidth = 
parseInt(nWidth);\n      }\n\n      let intPart = Math.trunc(arg);\n\n      if (cConvChar === "x") {\n        
let hex = Math.abs(intPart).toString(16).toUpperCase();\n\n        if (nWidth !== undefined) {\n          hex 
= hex.padStart(nWidth, cFlags & ZERO ? "0" : " ");\n        }\n\n        if (cFlags & HASH) {\n          hex 
= `0x${hex}`;\n        }\n\n        return hex;\n      }\n\n      if (nPrecision) {\n        nPrecision = 
parseInt(nPrecision.substring(1));
 \n      }\n\n      nDecSep = nDecSep ? nDecSep.substring(1) : "0";\n      const separators = {\n        0: 
[",", "."],\n        1: ["", "."],\n        2: [".", ","],\n        3: ["", ","],\n        4: ["\'", "."]\n   
   };\n      const [thousandSep, decimalSep] = separators[nDecSep];\n      let decPart = "";\n\n      if 
(cConvChar === "f") {\n        if (nPrecision !== undefined) {\n          decPart = Math.abs(arg - 
intPart).toFixed(nPrecision);\n        } else {\n          decPart = Math.abs(arg - intPart).toString();\n    
    }\n\n        if (decPart.length > 2) {\n          decPart = `${decimalSep}${decPart.substring(2)}`;\n     
   } else if (cFlags & HASH) {\n          decPart = ".";\n        } else {\n          decPart = "";\n        
}\n      }\n\n      let sign = "";\n\n      if (intPart < 0) {\n        sign = "-";\n        intPart = 
-intPart;\n      } else if (cFlags & PLUS) {\n        sign = "+";\n      } else if (cFlags & SPACE) {\n       
 sign = " ";\n      }\n\n      if 
 (thousandSep && intPart >= 1000) {\n        const buf = [];\n\n        while (true) {\n          
buf.push((intPart % 1000).toString().padStart(3, "0"));\n          intPart = Math.trunc(intPart / 1000);\n\n  
        if (intPart < 1000) {\n            buf.push(intPart.toString());\n            break;\n          }\n   
     }\n\n        intPart = buf.reverse().join(thousandSep);\n      } else {\n        intPart = 
intPart.toString();\n      }\n\n      let n = `${intPart}${decPart}`;\n\n      if (nWidth !== undefined) {\n  
      n = n.padStart(nWidth - sign.length, cFlags & ZERO ? "0" : " ");\n      }\n\n      return 
`${sign}${n}`;\n    });\n  }\n\n  iconStreamFromIcon() {}\n\n  printd(cFormat, oDate) {\n    switch (cFormat) 
{\n      case 0:\n        return this.printd("D:yyyymmddHHMMss", oDate);\n\n      case 1:\n        return 
this.printd("yyyy.mm.dd HH:MM:ss", oDate);\n\n      case 2:\n        return this.printd("m/d/yy h:MM:ss tt", 
oDate);\n    }\n\n    const handlers = {\n      mmmm:
  data => {\n        return this._months[data.month];\n      },\n      mmm: data => {\n        return 
this._months[data.month].substring(0, 3);\n      },\n      mm: data => {\n        return (data.month + 
1).toString().padStart(2, "0");\n      },\n      m: data => {\n        return (data.month + 1).toString();\n  
    },\n      dddd: data => {\n        return this._days[data.dayOfWeek];\n      },\n      ddd: data => {\n   
     return this._days[data.dayOfWeek].substring(0, 3);\n      },\n      dd: data => {\n        return 
data.day.toString().padStart(2, "0");\n      },\n      d: data => {\n        return data.day.toString();\n    
  },\n      yyyy: data => {\n        return data.year.toString();\n      },\n      yy: data => {\n        
return (data.year % 100).toString().padStart(2, "0");\n      },\n      HH: data => {\n        return 
data.hours.toString().padStart(2, "0");\n      },\n      H: data => {\n        return 
data.hours.toString();\n      },\n      hh: data => {\n        retu
 rn (1 + (data.hours + 11) % 12).toString().padStart(2, "0");\n      },\n      h: data => {\n        return 
(1 + (data.hours + 11) % 12).toString();\n      },\n      MM: data => {\n        return 
data.minutes.toString().padStart(2, "0");\n      },\n      M: data => {\n        return 
data.minutes.toString();\n      },\n      ss: data => {\n        return data.seconds.toString().padStart(2, 
"0");\n      },\n      s: data => {\n        return data.seconds.toString();\n      },\n      tt: data => {\n 
       return data.hours < 12 ? "am" : "pm";\n      },\n      t: data => {\n        return data.hours < 12 ? 
"a" : "p";\n      }\n    };\n    const data = {\n      year: oDate.getFullYear(),\n      month: 
oDate.getMonth(),\n      day: oDate.getDate(),\n      dayOfWeek: oDate.getDay(),\n      hours: 
oDate.getHours(),\n      minutes: oDate.getMinutes(),\n      seconds: oDate.getSeconds()\n    };\n    const 
patterns = /(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t|\\\\.)/g;\n   
  return cFormat.replace(patterns, function (match, pattern) {\n      if (pattern in handlers) {\n        
return handlers[pattern](data);\n      }\n\n      return pattern.charCodeAt(1);\n    });\n  }\n\n  
printx(cFormat, cSource) {\n    const handlers = [x => x, x => x.toUpperCase(), x => x.toLowerCase()];\n    
const buf = [];\n    let i = 0;\n    const ii = cSource.length;\n    let currCase = handlers[0];\n    let 
escaped = false;\n\n    for (const command of cFormat) {\n      if (escaped) {\n        buf.push(command);\n  
      escaped = false;\n        continue;\n      }\n\n      if (i >= ii) {\n        break;\n      }\n\n      
switch (command) {\n        case "?":\n          buf.push(currCase(cSource.charAt(i++)));\n          
break;\n\n        case "X":\n          while (i < ii) {\n            const char = cSource.charAt(i++);\n\n    
        if ("a" <= char && char <= "z" || "A" <= char && char <= "Z" || "0" <= char && char <= "9") {\n       
       buf.push(currCase(char));\n     
          break;\n            }\n          }\n\n          break;\n\n        case "A":\n          while (i < 
ii) {\n            const char = cSource.charAt(i++);\n\n            if ("a" <= char && char <= "z" || "A" <= 
char && char <= "Z") {\n              buf.push(currCase(char));\n              break;\n            }\n        
  }\n\n          break;\n\n        case "9":\n          while (i < ii) {\n            const char = 
cSource.charAt(i++);\n\n            if ("0" <= char && char <= "9") {\n              buf.push(char);\n        
      break;\n            }\n          }\n\n          break;\n\n        case "*":\n          while (i < ii) 
{\n            buf.push(currCase(cSource.charAt(i++)));\n          }\n\n          break;\n\n        case 
"\\\\":\n          escaped = true;\n          break;\n\n        case ">":\n          currCase = 
handlers[1];\n          break;\n\n        case "<":\n          currCase = handlers[2];\n          break;\n\n  
      case "=":\n          currCase = handl
 ers[0];\n          break;\n\n        default:\n          buf.push(command);\n      }\n    }\n\n    return 
buf.join("");\n  }\n\n  scand(cFormat, cDate) {\n    if (cDate === "") {\n      return new Date();\n    }\n\n 
   switch (cFormat) {\n      case 0:\n        return this.scand("D:yyyymmddHHMMss", cDate);\n\n      case 
1:\n        return this.scand("yyyy.mm.dd HH:MM:ss", cDate);\n\n      case 2:\n        return 
this.scand("m/d/yy h:MM:ss tt", cDate);\n    }\n\n    if (!this._scandCache.has(cFormat)) {\n      const 
months = this._months;\n      const days = this._days;\n      const handlers = {\n        mmmm: {\n          
pattern: `(${months.join("|")})`,\n          action: (value, data) => {\n            data.month = 
months.indexOf(value);\n          }\n        },\n        mmm: {\n          pattern: `(${months.map(month => 
month.substring(0, 3)).join("|")})`,\n          action: (value, data) => {\n            data.month = 
months.findIndex(month => month.substring(0, 3) === value);\
 n          }\n        },\n        mm: {\n          pattern: `(\\\\d{2})`,\n          action: (value, data) 
=> {\n            data.month = parseInt(value) - 1;\n          }\n        },\n        m: {\n          
pattern: `(\\\\d{1,2})`,\n          action: (value, data) => {\n            data.month = parseInt(value) - 
1;\n          }\n        },\n        dddd: {\n          pattern: `(${days.join("|")})`,\n          action: 
(value, data) => {\n            data.day = days.indexOf(value);\n          }\n        },\n        ddd: {\n    
      pattern: `(${days.map(day => day.substring(0, 3)).join("|")})`,\n          action: (value, data) => {\n 
           data.day = days.findIndex(day => day.substring(0, 3) === value);\n          }\n        },\n        
dd: {\n          pattern: "(\\\\d{2})",\n          action: (value, data) => {\n            data.day = 
parseInt(value);\n          }\n        },\n        d: {\n          pattern: "(\\\\d{1,2})",\n          
action: (value, data) => {\n           
  data.day = parseInt(value);\n          }\n        },\n        yyyy: {\n          pattern: "(\\\\d{4})",\n   
       action: (value, data) => {\n            data.year = parseInt(value);\n          }\n        },\n        
yy: {\n          pattern: "(\\\\d{2})",\n          action: (value, data) => {\n            data.year = 2000 + 
parseInt(value);\n          }\n        },\n        HH: {\n          pattern: "(\\\\d{2})",\n          action: 
(value, data) => {\n            data.hours = parseInt(value);\n          }\n        },\n        H: {\n        
  pattern: "(\\\\d{1,2})",\n          action: (value, data) => {\n            data.hours = parseInt(value);\n 
         }\n        },\n        hh: {\n          pattern: "(\\\\d{2})",\n          action: (value, data) => 
{\n            data.hours = parseInt(value);\n          }\n        },\n        h: {\n          pattern: 
"(\\\\d{1,2})",\n          action: (value, data) => {\n            data.hours = parseInt(value);\n          
}\n        },\n   
      MM: {\n          pattern: "(\\\\d{2})",\n          action: (value, data) => {\n            data.minutes 
= parseInt(value);\n          }\n        },\n        M: {\n          pattern: "(\\\\d{1,2})",\n          
action: (value, data) => {\n            data.minutes = parseInt(value);\n          }\n        },\n        ss: 
{\n          pattern: "(\\\\d{2})",\n          action: (value, data) => {\n            data.seconds = 
parseInt(value);\n          }\n        },\n        s: {\n          pattern: "(\\\\d{1,2})",\n          
action: (value, data) => {\n            data.seconds = parseInt(value);\n          }\n        },\n        tt: 
{\n          pattern: "([aApP][mM])",\n          action: (value, data) => {\n            const char = 
value.charAt(0);\n            data.am = char === "a" || char === "A";\n          }\n        },\n        t: 
{\n          pattern: "([aApP])",\n          action: (value, data) => {\n            data.am = value === "a" 
|| value === "A";\n          }\n        
 }\n      };\n      const escapedFormat = cFormat.replace(/[.*+\\-?^${}()|[\\]\\\\]/g, "\\\\$&");\n      
const patterns = /(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t)/g;\n      const actions = 
[];\n      const re = escapedFormat.replace(patterns, function (match, patternElement) {\n        const {\n   
       pattern,\n          action\n        } = handlers[patternElement];\n        actions.push(action);\n     
   return pattern;\n      });\n\n      this._scandCache.set(cFormat, [re, actions]);\n    }\n\n    const [re, 
actions] = this._scandCache.get(cFormat);\n\n    const matches = new RegExp(re, "g").exec(cDate);\n\n    if 
(!matches || matches.length !== actions.length + 1) {\n      return null;\n    }\n\n    const data = {\n      
year: 0,\n      month: 0,\n      day: 0,\n      hours: 0,\n      minutes: 0,\n      seconds: 0,\n      am: 
null\n    };\n    actions.forEach((action, i) => action(matches[i + 1], data));\n\n    if (data.am !== null) 
{\n      data.hours = 
 data.hours % 12 + (data.am ? 0 : 12);\n    }\n\n    return new Date(data.year, data.month, data.day, 
data.hours, data.minutes, data.seconds);\n  }\n\n  spansToXML() {}\n\n  stringFromStream() {}\n\n  
xmlToSpans() {}\n\n}\n\nexports.Util = Util;\n\n/***/ })\n/******/ 
\t]);\n/************************************************************************/\n/******/ \t// The module 
cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require 
function\n/******/ \tfunction __w_pdfjs_require__(moduleId) {\n/******/ \t\t// Check if module is in 
cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== 
undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new 
module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = 
{\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: 
{}\n/*
 *****/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ 
\t\t__webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);\n/******/ \t\n/******/ \t\t// 
Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ 
\t\n/************************************************************************/\nvar __webpack_exports__ = 
{};\n// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the 
chunk.\n(() => {\nvar exports = __webpack_exports__;\n\n\nObject.defineProperty(exports, "__esModule", ({\n  
value: true\n}));\nObject.defineProperty(exports, "initSandbox", ({\n  enumerable: true,\n  get: function () 
{\n    return _initialization.initSandbox;\n  }\n}));\n\nvar _initialization = 
__w_pdfjs_require__(1);\n\nconst pdfjsVersion = \'2.11.338\';\nconst pdfjsBuild = 
\'dedff3c98\';\n})();\n\n/******/ \treturn __webpack_exports__;\n/******/ })()\n;\n});'];
+    const code = ['(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 
\'object\' && typeof module === \'object\')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 
\'function\' && define.amd)\n\t\tdefine("pdfjs-dist/build/pdf.scripting", [], factory);\n\telse if(typeof 
exports === \'object\')\n\t\texports["pdfjs-dist/build/pdf.scripting"] = 
factory();\n\telse\n\t\troot.pdfjsScripting = factory();\n})(this, function() {\nreturn /******/ (() => { // 
webpackBootstrap\n/******/ \t"use strict";\n/******/ \tvar __webpack_modules__ = ([\n/* 0 */,\n/* 1 */\n/***/ 
((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, 
"__esModule", ({\n  value: true\n}));\nexports.initSandbox = initSandbox;\n\nvar _constants = 
__w_pdfjs_require__(2);\n\nvar _field = __w_pdfjs_require__(3);\n\nvar _aform = 
__w_pdfjs_require__(8);\n\nvar _app = __w_pdfjs_require__(9);\n\nvar _color = __w_pdfjs_require__(5);\n\nvar 
_conso
 le = __w_pdfjs_require__(13);\n\nvar _doc = __w_pdfjs_require__(14);\n\nvar _proxy = 
__w_pdfjs_require__(16);\n\nvar _util = __w_pdfjs_require__(17);\n\nfunction initSandbox(params) {\n  delete 
globalThis.pdfjsScripting;\n  const externalCall = globalThis.callExternalFunction;\n  delete 
globalThis.callExternalFunction;\n\n  const globalEval = code => globalThis.eval(code);\n\n  const send = 
data => externalCall("send", [data]);\n\n  const proxyHandler = new _proxy.ProxyHandler();\n  const {\n    
data\n  } = params;\n  const doc = new _doc.Doc({\n    send,\n    globalEval,\n    ...data.docInfo\n  });\n  
const _document = {\n    obj: doc,\n    wrapped: new Proxy(doc, proxyHandler)\n  };\n  const app = new 
_app.App({\n    send,\n    globalEval,\n    externalCall,\n    _document,\n    calculationOrder: 
data.calculationOrder,\n    proxyHandler,\n    ...data.appInfo\n  });\n  const util = new _util.Util({\n    
externalCall\n  });\n  const appObjects = app._objects;\n\n  if (data.objects) 
 {\n    const annotations = [];\n\n    for (const [name, objs] of Object.entries(data.objects)) {\n      
annotations.length = 0;\n      let container = null;\n\n      for (const obj of objs) {\n        if (obj.type 
!== "") {\n          annotations.push(obj);\n        } else {\n          container = obj;\n        }\n      
}\n\n      let obj = container;\n\n      if (annotations.length > 0) {\n        obj = annotations[0];\n       
 obj.send = send;\n      }\n\n      obj.globalEval = globalEval;\n      obj.doc = _document;\n      
obj.fieldPath = name;\n      obj.appObjects = appObjects;\n      let field;\n\n      switch (obj.type) {\n    
    case "radiobutton":\n          {\n            const otherButtons = annotations.slice(1);\n            
field = new _field.RadioButtonField(otherButtons, obj);\n            break;\n          }\n\n        case 
"checkbox":\n          {\n            const otherButtons = annotations.slice(1);\n            field = new 
_field.CheckboxField(otherButtons, obj
 );\n            break;\n          }\n\n        case "text":\n          if (annotations.length <= 1) {\n      
      field = new _field.Field(obj);\n            break;\n          }\n\n          obj.siblings = 
annotations.map(x => x.id).slice(1);\n          field = new _field.Field(obj);\n          break;\n\n        
default:\n          field = new _field.Field(obj);\n      }\n\n      const wrapped = new Proxy(field, 
proxyHandler);\n\n      doc._addField(name, wrapped);\n\n      const _object = {\n        obj: field,\n       
 wrapped\n      };\n\n      for (const object of objs) {\n        appObjects[object.id] = _object;\n      
}\n\n      if (container) {\n        appObjects[container.id] = _object;\n      }\n    }\n  }\n\n  const 
color = new _color.Color();\n  globalThis.event = null;\n  globalThis.global = Object.create(null);\n  
globalThis.app = new Proxy(app, proxyHandler);\n  globalThis.color = new Proxy(color, proxyHandler);\n  
globalThis.console = new Proxy(new _console.Console(
 {\n    send\n  }), proxyHandler);\n  globalThis.util = new Proxy(util, proxyHandler);\n  globalThis.border = 
_constants.Border;\n  globalThis.cursor = _constants.Cursor;\n  globalThis.display = _constants.Display;\n  
globalThis.font = _constants.Font;\n  globalThis.highlight = _constants.Highlight;\n  globalThis.position = 
_constants.Position;\n  globalThis.scaleHow = _constants.ScaleHow;\n  globalThis.scaleWhen = 
_constants.ScaleWhen;\n  globalThis.style = _constants.Style;\n  globalThis.trans = _constants.Trans;\n  
globalThis.zoomtype = _constants.ZoomType;\n  globalThis.ADBE = {\n    Reader_Value_Asked: true,\n    
Viewer_Value_Asked: true\n  };\n  const aform = new _aform.AForm(doc, app, util, color);\n\n  for (const name 
of Object.getOwnPropertyNames(_aform.AForm.prototype)) {\n    if (name !== "constructor" && 
!name.startsWith("_")) {\n      globalThis[name] = aform[name].bind(aform);\n    }\n  }\n\n  for (const 
[name, value] of Object.entries(_constants.GlobalConstants)) {\n  
   Object.defineProperty(globalThis, name, {\n      value,\n      writable: false\n    });\n  }\n\n  
Object.defineProperties(globalThis, {\n    ColorConvert: {\n      value: color.convert.bind(color),\n      
writable: true\n    },\n    ColorEqual: {\n      value: color.equal.bind(color),\n      writable: true\n    
}\n  });\n  const properties = Object.create(null);\n\n  for (const name of 
Object.getOwnPropertyNames(_doc.Doc.prototype)) {\n    if (name === "constructor" || name.startsWith("_")) 
{\n      continue;\n    }\n\n    const descriptor = Object.getOwnPropertyDescriptor(_doc.Doc.prototype, 
name);\n\n    if (descriptor.get) {\n      properties[name] = {\n        get: descriptor.get.bind(doc),\n     
   set: descriptor.set.bind(doc)\n      };\n    } else {\n      properties[name] = {\n        value: 
_doc.Doc.prototype[name].bind(doc)\n      };\n    }\n  }\n\n  Object.defineProperties(globalThis, 
properties);\n  const functions = {\n    dispatchEvent: app._dispatchEvent.bind(app),\
 n    timeoutCb: app._evalCallback.bind(app)\n  };\n  return (name, args) => {\n    try {\n      
functions[name](args);\n    } catch (error) {\n      const value = `${error.toString()}\\n${error.stack}`;\n  
    send({\n        command: "error",\n        value\n      });\n    }\n  };\n}\n\n/***/ }),\n/* 2 */\n/***/ 
((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: 
true\n}));\nexports.ZoomType = exports.Trans = exports.Style = exports.ScaleWhen = exports.ScaleHow = 
exports.Position = exports.Highlight = exports.GlobalConstants = exports.Font = exports.Display = 
exports.Cursor = exports.Border = void 0;\nconst Border = Object.freeze({\n  s: "solid",\n  d: "dashed",\n  
b: "beveled",\n  i: "inset",\n  u: "underline"\n});\nexports.Border = Border;\nconst Cursor = 
Object.freeze({\n  visible: 0,\n  hidden: 1,\n  delay: 2\n});\nexports.Cursor = Cursor;\nconst Display = 
Object.freeze({\n  visible: 0,\n  hidden: 1,\n  noPrint: 2,\n  noView
 : 3\n});\nexports.Display = Display;\nconst Font = Object.freeze({\n  Times: "Times-Roman",\n  TimesB: 
"Times-Bold",\n  TimesI: "Times-Italic",\n  TimesBI: "Times-BoldItalic",\n  Helv: "Helvetica",\n  HelvB: 
"Helvetica-Bold",\n  HelvI: "Helvetica-Oblique",\n  HelvBI: "Helvetica-BoldOblique",\n  Cour: "Courier",\n  
CourB: "Courier-Bold",\n  CourI: "Courier-Oblique",\n  CourBI: "Courier-BoldOblique",\n  Symbol: "Symbol",\n  
ZapfD: "ZapfDingbats",\n  KaGo: "HeiseiKakuGo-W5-UniJIS-UCS2-H",\n  KaMi: 
"HeiseiMin-W3-UniJIS-UCS2-H"\n});\nexports.Font = Font;\nconst Highlight = Object.freeze({\n  n: "none",\n  
i: "invert",\n  p: "push",\n  o: "outline"\n});\nexports.Highlight = Highlight;\nconst Position = 
Object.freeze({\n  textOnly: 0,\n  iconOnly: 1,\n  iconTextV: 2,\n  textIconV: 3,\n  iconTextH: 4,\n  
textIconH: 5,\n  overlay: 6\n});\nexports.Position = Position;\nconst ScaleHow = Object.freeze({\n  
proportional: 0,\n  anamorphic: 1\n});\nexports.ScaleHow = ScaleHow;\nconst ScaleWhen = O
 bject.freeze({\n  always: 0,\n  never: 1,\n  tooBig: 2,\n  tooSmall: 3\n});\nexports.ScaleWhen = 
ScaleWhen;\nconst Style = Object.freeze({\n  ch: "check",\n  cr: "cross",\n  di: "diamond",\n  ci: 
"circle",\n  st: "star",\n  sq: "square"\n});\nexports.Style = Style;\nconst Trans = Object.freeze({\n  
blindsH: "BlindsHorizontal",\n  blindsV: "BlindsVertical",\n  boxI: "BoxIn",\n  boxO: "BoxOut",\n  dissolve: 
"Dissolve",\n  glitterD: "GlitterDown",\n  glitterR: "GlitterRight",\n  glitterRD: "GlitterRightDown",\n  
random: "Random",\n  replace: "Replace",\n  splitHI: "SplitHorizontalIn",\n  splitHO: "SplitHorizontalOut",\n 
 splitVI: "SplitVerticalIn",\n  splitVO: "SplitVerticalOut",\n  wipeD: "WipeDown",\n  wipeL: "WipeLeft",\n  
wipeR: "WipeRight",\n  wipeU: "WipeUp"\n});\nexports.Trans = Trans;\nconst ZoomType = Object.freeze({\n  
none: "NoVary",\n  fitP: "FitPage",\n  fitW: "FitWidth",\n  fitH: "FitHeight",\n  fitV: "FitVisibleWidth",\n  
pref: "Preferred",\n  refW: "ReflowWidth"\n});\ne
 xports.ZoomType = ZoomType;\nconst GlobalConstants = Object.freeze({\n  IDS_GREATER_THAN: "Invalid value: 
must be greater than or equal to % s.",\n  IDS_GT_AND_LT: "Invalid value: must be greater than or equal to % 
s " + "and less than or equal to % s.",\n  IDS_LESS_THAN: "Invalid value: must be less than or equal to % 
s.",\n  IDS_INVALID_MONTH: "** Invalid **",\n  IDS_INVALID_DATE: "Invalid date / time: please ensure that the 
date / time exists.Field",\n  IDS_INVALID_DATE2: " should match format ",\n  IDS_INVALID_VALUE: "The value 
entered does not match the format of the field",\n  IDS_AM: "am",\n  IDS_PM: "pm",\n  IDS_MONTH_INFO: 
"January[1] February[2] March[3] April[4] May[5] " + "June[6] July[7] August[8] September[9] October[10] " + 
"November[11] December[12] Sept[9] Jan[1] Feb[2] Mar[3] " + "Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] 
Nov[11] Dec[12]",\n  IDS_STARTUP_CONSOLE_MSG: "** ^ _ ^ **",\n  RE_NUMBER_ENTRY_DOT_SEP: 
["[+-]?\\\\d*\\\\.?\\\\d*"],\n  RE_NUMBER_COMMIT_DOT_SE
 P: ["[+-]?\\\\d+(\\\\.\\\\d+)?", "[+-]?\\\\.\\\\d+", "[+-]?\\\\d+\\\\."],\n  RE_NUMBER_ENTRY_COMMA_SEP: 
["[+-]?\\\\d*,?\\\\d*"],\n  RE_NUMBER_COMMIT_COMMA_SEP: ["[+-]?\\\\d+([.,]\\\\d+)?", "[+-]?[.,]\\\\d+", 
"[+-]?\\\\d+[.,]"],\n  RE_ZIP_ENTRY: ["\\\\d{0,5}"],\n  RE_ZIP_COMMIT: ["\\\\d{5}"],\n  RE_ZIP4_ENTRY: 
["\\\\d{0,5}(\\\\.|[- ])?\\\\d{0,4}"],\n  RE_ZIP4_COMMIT: ["\\\\d{5}(\\\\.|[- ])?\\\\d{4}"],\n  
RE_PHONE_ENTRY: ["\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", "\\\\(\\\\d{0,3}", 
"\\\\(\\\\d{0,3}\\\\)(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", "\\\\(\\\\d{0,3}(\\\\.|[- 
])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", "\\\\d{0,3}\\\\)(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", 
"011(\\\\.|[- \\\\d])*"],\n  RE_PHONE_COMMIT: ["\\\\d{3}(\\\\.|[- ])?\\\\d{4}", "\\\\d{3}(\\\\.|[- 
])?\\\\d{3}(\\\\.|[- ])?\\\\d{4}", "\\\\(\\\\d{3}\\\\)(\\\\.|[- ])?\\\\d{3}(\\\\.|[- ])?\\\\d{4}", 
"011(\\\\.|[- \\\\d])*"],\n  RE_SSN_ENTRY: ["\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,2}(\\\\.|[- ])?\\\\d
 {0,4}"],\n  RE_SSN_COMMIT: ["\\\\d{3}(\\\\.|[- ])?\\\\d{2}(\\\\.|[- 
])?\\\\d{4}"]\n});\nexports.GlobalConstants = GlobalConstants;\n\n/***/ }),\n/* 3 */\n/***/ 
((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, 
"__esModule", ({\n  value: true\n}));\nexports.RadioButtonField = exports.Field = exports.CheckboxField = 
void 0;\n\nvar _common = __w_pdfjs_require__(4);\n\nvar _color = __w_pdfjs_require__(5);\n\nvar _pdf_object = 
__w_pdfjs_require__(7);\n\nclass Field extends _pdf_object.PDFObject {\n  constructor(data) {\n    
super(data);\n    this.alignment = data.alignment || "left";\n    this.borderStyle = data.borderStyle || 
"";\n    this.buttonAlignX = data.buttonAlignX || 50;\n    this.buttonAlignY = data.buttonAlignY || 50;\n    
this.buttonFitBounds = data.buttonFitBounds;\n    this.buttonPosition = data.buttonPosition;\n    
this.buttonScaleHow = data.buttonScaleHow;\n    this.ButtonScaleWhen = data.buttonScaleWhen;\n    this.calcOrd
 erIndex = data.calcOrderIndex;\n    this.charLimit = data.charLimit;\n    this.comb = data.comb;\n    
this.commitOnSelChange = data.commitOnSelChange;\n    this.currentValueIndices = data.currentValueIndices;\n  
  this.defaultStyle = data.defaultStyle;\n    this.defaultValue = data.defaultValue;\n    this.doNotScroll = 
data.doNotScroll;\n    this.doNotSpellCheck = data.doNotSpellCheck;\n    this.delay = data.delay;\n    
this.display = data.display;\n    this.doc = data.doc.wrapped;\n    this.editable = data.editable;\n    
this.exportValues = data.exportValues;\n    this.fileSelect = data.fileSelect;\n    this.hidden = 
data.hidden;\n    this.highlight = data.highlight;\n    this.lineWidth = data.lineWidth;\n    this.multiline 
= data.multiline;\n    this.multipleSelection = !!data.multipleSelection;\n    this.name = data.name;\n    
this.password = data.password;\n    this.print = data.print;\n    this.radiosInUnison = 
data.radiosInUnison;\n    this.readonly = data.readonly;\n    this.
 rect = data.rect;\n    this.required = data.required;\n    this.richText = data.richText;\n    
this.richValue = data.richValue;\n    this.rotation = data.rotation;\n    this.style = data.style;\n    
this.submitName = data.submitName;\n    this.textFont = data.textFont;\n    this.textSize = data.textSize;\n  
  this.type = data.type;\n    this.userName = data.userName;\n    this._actions = (0, 
_common.createActionsMap)(data.actions);\n    this._browseForFileToSubmit = data.browseForFileToSubmit || 
null;\n    this._buttonCaption = null;\n    this._buttonIcon = null;\n    this._children = null;\n    
this._currentValueIndices = data.currentValueIndices || 0;\n    this._document = data.doc;\n    
this._fieldPath = data.fieldPath;\n    this._fillColor = data.fillColor || ["T"];\n    this._isChoice = 
Array.isArray(data.items);\n    this._items = data.items || [];\n    this._page = data.page || 0;\n    
this._strokeColor = data.strokeColor || ["G", 0];\n    this._textColor = data.textColor || 
 ["G", 0];\n    this._value = data.value || "";\n    this._kidIds = data.kidIds || null;\n    this._fieldType 
= (0, _common.getFieldType)(this._actions);\n    this._siblings = data.siblings || null;\n    
this._globalEval = data.globalEval;\n    this._appObjects = data.appObjects;\n    this.valueAsString = 
data.valueAsString || this._value;\n  }\n\n  get currentValueIndices() {\n    if (!this._isChoice) {\n      
return 0;\n    }\n\n    return this._currentValueIndices;\n  }\n\n  set currentValueIndices(indices) {\n    
if (!this._isChoice) {\n      return;\n    }\n\n    if (!Array.isArray(indices)) {\n      indices = 
[indices];\n    }\n\n    if (!indices.every(i => typeof i === "number" && Number.isInteger(i) && i >= 0 && i 
< this.numItems)) {\n      return;\n    }\n\n    indices.sort();\n\n    if (this.multipleSelection) {\n      
this._currentValueIndices = indices;\n      this._value = [];\n      indices.forEach(i => {\n        
this._value.push(this._items[i].displayValue);\n      })
 ;\n    } else {\n      if (indices.length > 0) {\n        indices = indices.splice(1, indices.length - 1);\n 
       this._currentValueIndices = indices[0];\n        this._value = 
this._items[this._currentValueIndices];\n      }\n    }\n\n    this._send({\n      id: this._id,\n      
indices\n    });\n  }\n\n  get fillColor() {\n    return this._fillColor;\n  }\n\n  set fillColor(color) {\n  
  if (_color.Color._isValidColor(color)) {\n      this._fillColor = color;\n    }\n  }\n\n  get bgColor() {\n 
   return this.fillColor;\n  }\n\n  set bgColor(color) {\n    this.fillColor = color;\n  }\n\n  get 
numItems() {\n    if (!this._isChoice) {\n      throw new Error("Not a choice widget");\n    }\n\n    return 
this._items.length;\n  }\n\n  set numItems(_) {\n    throw new Error("field.numItems is read-only");\n  }\n\n 
 get strokeColor() {\n    return this._strokeColor;\n  }\n\n  set strokeColor(color) {\n    if 
(_color.Color._isValidColor(color)) {\n      this._strokeColor = color;\n    }\n
   }\n\n  get borderColor() {\n    return this.strokeColor;\n  }\n\n  set borderColor(color) {\n    
this.strokeColor = color;\n  }\n\n  get page() {\n    return this._page;\n  }\n\n  set page(_) {\n    throw 
new Error("field.page is read-only");\n  }\n\n  get textColor() {\n    return this._textColor;\n  }\n\n  set 
textColor(color) {\n    if (_color.Color._isValidColor(color)) {\n      this._textColor = color;\n    }\n  
}\n\n  get fgColor() {\n    return this.textColor;\n  }\n\n  set fgColor(color) {\n    this.textColor = 
color;\n  }\n\n  get value() {\n    return this._value;\n  }\n\n  set value(value) {\n    if (value === "") 
{\n      this._value = "";\n    } else if (typeof value === "string") {\n      switch (this._fieldType) {\n   
     case _common.FieldType.number:\n        case _common.FieldType.percent:\n          value = 
parseFloat(value);\n\n          if (!isNaN(value)) {\n            this._value = value;\n          }\n\n       
   break;\n\n        default:\n          this.
 _value = value;\n      }\n    } else {\n      this._value = value;\n    }\n\n    if (this._isChoice) {\n     
 if (this.multipleSelection) {\n        const values = new Set(value);\n        
this._currentValueIndices.length = 0;\n\n        this._items.forEach(({\n          displayValue\n        }, 
i) => {\n          if (values.has(displayValue)) {\n            this._currentValueIndices.push(i);\n          
}\n        });\n      } else {\n        this._currentValueIndices = this._items.findIndex(({\n          
displayValue\n        }) => value === displayValue);\n      }\n    }\n  }\n\n  get valueAsString() {\n    if 
(this._valueAsString === undefined) {\n      this._valueAsString = this._value ? this._value.toString() : 
"";\n    }\n\n    return this._valueAsString;\n  }\n\n  set valueAsString(val) {\n    this._valueAsString = 
val ? val.toString() : "";\n  }\n\n  browseForFileToSubmit() {\n    if (this._browseForFileToSubmit) {\n      
this._browseForFileToSubmit();\n    }\n  }\n\n  butto
 nGetCaption(nFace = 0) {\n    if (this._buttonCaption) {\n      return this._buttonCaption[nFace];\n    
}\n\n    return "";\n  }\n\n  buttonGetIcon(nFace = 0) {\n    if (this._buttonIcon) {\n      return 
this._buttonIcon[nFace];\n    }\n\n    return null;\n  }\n\n  buttonImportIcon(cPath = null, nPave = 0) 
{}\n\n  buttonSetCaption(cCaption, nFace = 0) {\n    if (!this._buttonCaption) {\n      this._buttonCaption = 
["", "", ""];\n    }\n\n    this._buttonCaption[nFace] = cCaption;\n  }\n\n  buttonSetIcon(oIcon, nFace = 0) 
{\n    if (!this._buttonIcon) {\n      this._buttonIcon = [null, null, null];\n    }\n\n    
this._buttonIcon[nFace] = oIcon;\n  }\n\n  checkThisBox(nWidget, bCheckIt = true) {}\n\n  clearItems() {\n    
if (!this._isChoice) {\n      throw new Error("Not a choice widget");\n    }\n\n    this._items = [];\n\n    
this._send({\n      id: this._id,\n      clear: null\n    });\n  }\n\n  deleteItemAt(nIdx = null) {\n    if 
(!this._isChoice) {\n      throw new Error("Not a c
 hoice widget");\n    }\n\n    if (!this.numItems) {\n      return;\n    }\n\n    if (nIdx === null) {\n      
nIdx = Array.isArray(this._currentValueIndices) ? this._currentValueIndices[0] : this._currentValueIndices;\n 
     nIdx = nIdx || 0;\n    }\n\n    if (nIdx < 0 || nIdx >= this.numItems) {\n      nIdx = this.numItems - 
1;\n    }\n\n    this._items.splice(nIdx, 1);\n\n    if (Array.isArray(this._currentValueIndices)) {\n      
let index = this._currentValueIndices.findIndex(i => i >= nIdx);\n\n      if (index !== -1) {\n        if 
(this._currentValueIndices[index] === nIdx) {\n          this._currentValueIndices.splice(index, 1);\n        
}\n\n        for (const ii = this._currentValueIndices.length; index < ii; index++) {\n          
--this._currentValueIndices[index];\n        }\n      }\n    } else {\n      if (this._currentValueIndices 
=== nIdx) {\n        this._currentValueIndices = this.numItems > 0 ? 0 : -1;\n      } else if 
(this._currentValueIndices > nIdx) {\n        --
 this._currentValueIndices;\n      }\n    }\n\n    this._send({\n      id: this._id,\n      remove: nIdx\n    
});\n  }\n\n  getItemAt(nIdx = -1, bExportValue = false) {\n    if (!this._isChoice) {\n      throw new 
Error("Not a choice widget");\n    }\n\n    if (nIdx < 0 || nIdx >= this.numItems) {\n      nIdx = 
this.numItems - 1;\n    }\n\n    const item = this._items[nIdx];\n    return bExportValue ? item.exportValue 
: item.displayValue;\n  }\n\n  getArray() {\n    if (this._kidIds) {\n      return this._kidIds.map(id => 
this._appObjects[id].wrapped);\n    }\n\n    if (this._children === null) {\n      this._children = 
this._document.obj._getChildren(this._fieldPath);\n    }\n\n    return this._children;\n  }\n\n  getLock() 
{\n    return undefined;\n  }\n\n  isBoxChecked(nWidget) {\n    return false;\n  }\n\n  
isDefaultChecked(nWidget) {\n    return false;\n  }\n\n  insertItemAt(cName, cExport = undefined, nIdx = 0) 
{\n    if (!this._isChoice) {\n      throw new Error("Not a choice 
 widget");\n    }\n\n    if (!cName) {\n      return;\n    }\n\n    if (nIdx < 0 || nIdx > this.numItems) {\n 
     nIdx = this.numItems;\n    }\n\n    if (this._items.some(({\n      displayValue\n    }) => displayValue 
=== cName)) {\n      return;\n    }\n\n    if (cExport === undefined) {\n      cExport = cName;\n    }\n\n    
const data = {\n      displayValue: cName,\n      exportValue: cExport\n    };\n\n    
this._items.splice(nIdx, 0, data);\n\n    if (Array.isArray(this._currentValueIndices)) {\n      let index = 
this._currentValueIndices.findIndex(i => i >= nIdx);\n\n      if (index !== -1) {\n        for (const ii = 
this._currentValueIndices.length; index < ii; index++) {\n          ++this._currentValueIndices[index];\n     
   }\n      }\n    } else if (this._currentValueIndices >= nIdx) {\n      ++this._currentValueIndices;\n    
}\n\n    this._send({\n      id: this._id,\n      insert: {\n        index: nIdx,\n        ...data\n      }\n 
   });\n  }\n\n  setAction(cTrigger, cS
 cript) {\n    if (typeof cTrigger !== "string" || typeof cScript !== "string") {\n      return;\n    }\n\n   
 if (!(cTrigger in this._actions)) {\n      this._actions[cTrigger] = [];\n    }\n\n    
this._actions[cTrigger].push(cScript);\n  }\n\n  setFocus() {\n    this._send({\n      id: this._id,\n      
focus: true\n    });\n  }\n\n  setItems(oArray) {\n    if (!this._isChoice) {\n      throw new Error("Not a 
choice widget");\n    }\n\n    this._items.length = 0;\n\n    for (const element of oArray) {\n      let 
displayValue, exportValue;\n\n      if (Array.isArray(element)) {\n        displayValue = 
element[0]?.toString() || "";\n        exportValue = element[1]?.toString() || "";\n      } else {\n        
displayValue = exportValue = element?.toString() || "";\n      }\n\n      this._items.push({\n        
displayValue,\n        exportValue\n      });\n    }\n\n    this._currentValueIndices = 0;\n\n    
this._send({\n      id: this._id,\n      items: this._items\n    });\n  }\n\n  se
 tLock() {}\n\n  signatureGetModifications() {}\n\n  signatureGetSeedValue() {}\n\n  signatureInfo() {}\n\n  
signatureSetSeedValue() {}\n\n  signatureSign() {}\n\n  signatureValidate() {}\n\n  _isButton() {\n    return 
false;\n  }\n\n  _reset() {\n    this.value = this.valueAsString = this.defaultValue;\n  }\n\n  
_runActions(event) {\n    const eventName = event.name;\n\n    if (!this._actions.has(eventName)) {\n      
return false;\n    }\n\n    const actions = this._actions.get(eventName);\n\n    try {\n      for (const 
action of actions) {\n        this._globalEval(action);\n      }\n    } catch (error) {\n      event.rc = 
false;\n      throw error;\n    }\n\n    return true;\n  }\n\n}\n\nexports.Field = Field;\n\nclass 
RadioButtonField extends Field {\n  constructor(otherButtons, data) {\n    super(data);\n    
this.exportValues = [this.exportValues];\n    this._radioIds = [this._id];\n    this._radioActions = 
[this._actions];\n\n    for (const radioData of otherButtons) {\n      t
 his.exportValues.push(radioData.exportValues);\n\n      this._radioIds.push(radioData.id);\n\n      
this._radioActions.push((0, _common.createActionsMap)(radioData.actions));\n\n      if (this._value === 
radioData.exportValues) {\n        this._id = radioData.id;\n      }\n    }\n  }\n\n  get value() {\n    
return this._value;\n  }\n\n  set value(value) {\n    if (value === null || value === undefined) {\n      
this._value = "";\n    }\n\n    const i = this.exportValues.indexOf(value);\n\n    if (0 <= i && i < 
this._radioIds.length) {\n      this._id = this._radioIds[i];\n      this._value = value;\n    } else if 
(value === "Off" && this._radioIds.length === 2) {\n      const nextI = (1 + 
this._radioIds.indexOf(this._id)) % 2;\n      this._id = this._radioIds[nextI];\n      this._value = 
this.exportValues[nextI];\n    }\n  }\n\n  checkThisBox(nWidget, bCheckIt = true) {\n    if (nWidget < 0 || 
nWidget >= this._radioIds.length || !bCheckIt) {\n      return;\n    }\n\n    this._id = t
 his._radioIds[nWidget];\n    this._value = this.exportValues[nWidget];\n\n    this._send({\n      id: 
this._id,\n      value: this._value\n    });\n  }\n\n  isBoxChecked(nWidget) {\n    return nWidget >= 0 && 
nWidget < this._radioIds.length && this._id === this._radioIds[nWidget];\n  }\n\n  isDefaultChecked(nWidget) 
{\n    return nWidget >= 0 && nWidget < this.exportValues.length && this.defaultValue === 
this.exportValues[nWidget];\n  }\n\n  _getExportValue(state) {\n    const i = 
this._radioIds.indexOf(this._id);\n\n    return this.exportValues[i];\n  }\n\n  _runActions(event) {\n    
const i = this._radioIds.indexOf(this._id);\n\n    this._actions = this._radioActions[i];\n    return 
super._runActions(event);\n  }\n\n  _isButton() {\n    return true;\n  }\n\n}\n\nexports.RadioButtonField = 
RadioButtonField;\n\nclass CheckboxField extends RadioButtonField {\n  get value() {\n    return 
this._value;\n  }\n\n  set value(value) {\n    if (!value || value === "Off") {\n      this._value
  = "Off";\n    } else {\n      super.value = value;\n    }\n  }\n\n  _getExportValue(state) {\n    return 
state ? super._getExportValue(state) : "Off";\n  }\n\n  isBoxChecked(nWidget) {\n    if (this._value === 
"Off") {\n      return false;\n    }\n\n    return super.isBoxChecked(nWidget);\n  }\n\n  
isDefaultChecked(nWidget) {\n    if (this.defaultValue === "Off") {\n      return this._value === "Off";\n    
}\n\n    return super.isDefaultChecked(nWidget);\n  }\n\n  checkThisBox(nWidget, bCheckIt = true) {\n    if 
(nWidget < 0 || nWidget >= this._radioIds.length) {\n      return;\n    }\n\n    this._id = 
this._radioIds[nWidget];\n    this._value = bCheckIt ? this.exportValues[nWidget] : "Off";\n\n    
this._send({\n      id: this._id,\n      value: this._value\n    });\n  }\n\n}\n\nexports.CheckboxField = 
CheckboxField;\n\n/***/ }),\n/* 4 */\n/***/ ((__unused_webpack_module, exports) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}));\nexports.FieldType = 
 void 0;\nexports.createActionsMap = createActionsMap;\nexports.getFieldType = getFieldType;\nconst FieldType 
= {\n  none: 0,\n  number: 1,\n  percent: 2,\n  date: 3,\n  time: 4\n};\nexports.FieldType = 
FieldType;\n\nfunction createActionsMap(actions) {\n  const actionsMap = new Map();\n\n  if (actions) {\n    
for (const [eventType, actionsForEvent] of Object.entries(actions)) {\n      actionsMap.set(eventType, 
actionsForEvent);\n    }\n  }\n\n  return actionsMap;\n}\n\nfunction getFieldType(actions) {\n  let format = 
actions.get("Format");\n\n  if (!format) {\n    return FieldType.none;\n  }\n\n  format = format[0];\n  
format = format.trim();\n\n  if (format.startsWith("AFNumber_")) {\n    return FieldType.number;\n  }\n\n  if 
(format.startsWith("AFPercent_")) {\n    return FieldType.percent;\n  }\n\n  if 
(format.startsWith("AFDate_")) {\n    return FieldType.date;\n  }\n\n  if (format.startsWith("AFTime__")) {\n 
   return FieldType.time;\n  }\n\n  return FieldType.none;\n}\n\n/***/
  }),\n/* 5 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}));\nexports.Color = void 0;\n\nvar 
_scripting_utils = __w_pdfjs_require__(6);\n\nvar _pdf_object = __w_pdfjs_require__(7);\n\nclass Color 
extends _pdf_object.PDFObject {\n  constructor() {\n    super({});\n    this.transparent = ["T"];\n    
this.black = ["G", 0];\n    this.white = ["G", 1];\n    this.red = ["RGB", 1, 0, 0];\n    this.green = 
["RGB", 0, 1, 0];\n    this.blue = ["RGB", 0, 0, 1];\n    this.cyan = ["CMYK", 1, 0, 0, 0];\n    this.magenta 
= ["CMYK", 0, 1, 0, 0];\n    this.yellow = ["CMYK", 0, 0, 1, 0];\n    this.dkGray = ["G", 0.25];\n    
this.gray = ["G", 0.5];\n    this.ltGray = ["G", 0.75];\n  }\n\n  static _isValidSpace(cColorSpace) {\n    
return typeof cColorSpace === "string" && (cColorSpace === "T" || cColorSpace === "G" || cColorSpace === 
"RGB" || cColorSpace === "CMYK");\n  }\n\n  static _isValidColor(colorArr
 ay) {\n    if (!Array.isArray(colorArray) || colorArray.length === 0) {\n      return false;\n    }\n\n    
const space = colorArray[0];\n\n    if (!Color._isValidSpace(space)) {\n      return false;\n    }\n\n    
switch (space) {\n      case "T":\n        if (colorArray.length !== 1) {\n          return false;\n        
}\n\n        break;\n\n      case "G":\n        if (colorArray.length !== 2) {\n          return false;\n     
   }\n\n        break;\n\n      case "RGB":\n        if (colorArray.length !== 4) {\n          return 
false;\n        }\n\n        break;\n\n      case "CMYK":\n        if (colorArray.length !== 5) {\n          
return false;\n        }\n\n        break;\n\n      default:\n        return false;\n    }\n\n    return 
colorArray.slice(1).every(c => typeof c === "number" && c >= 0 && c <= 1);\n  }\n\n  static 
_getCorrectColor(colorArray) {\n    return Color._isValidColor(colorArray) ? colorArray : ["G", 0];\n  }\n\n  
convert(colorArray, cColorSpace) {\n    if (!Col
 or._isValidSpace(cColorSpace)) {\n      return this.black;\n    }\n\n    if (cColorSpace === "T") {\n      
return ["T"];\n    }\n\n    colorArray = Color._getCorrectColor(colorArray);\n\n    if (colorArray[0] === 
cColorSpace) {\n      return colorArray;\n    }\n\n    if (colorArray[0] === "T") {\n      return 
this.convert(this.black, cColorSpace);\n    }\n\n    return 
_scripting_utils.ColorConverters[`${colorArray[0]}_${cColorSpace}`](colorArray.slice(1));\n  }\n\n  
equal(colorArray1, colorArray2) {\n    colorArray1 = Color._getCorrectColor(colorArray1);\n    colorArray2 = 
Color._getCorrectColor(colorArray2);\n\n    if (colorArray1[0] === "T" || colorArray2[0] === "T") {\n      
return colorArray1[0] === "T" && colorArray2[0] === "T";\n    }\n\n    if (colorArray1[0] !== colorArray2[0]) 
{\n      colorArray2 = this.convert(colorArray2, colorArray1[0]);\n    }\n\n    return 
colorArray1.slice(1).every((c, i) => c === colorArray2[i + 1]);\n  }\n\n}\n\nexports.Color = Color;\n\n/***/ 
}),\
 n/* 6 */\n/***/ ((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, "__esModule", 
({\n  value: true\n}));\nexports.ColorConverters = void 0;\n\nfunction makeColorComp(n) {\n  return 
Math.floor(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, "0");\n}\n\nclass ColorConverters {\n  
static CMYK_G([c, y, m, k]) {\n    return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];\n  }\n\n 
 static G_CMYK([g]) {\n    return ["CMYK", 0, 0, 0, 1 - g];\n  }\n\n  static G_RGB([g]) {\n    return ["RGB", 
g, g, g];\n  }\n\n  static G_HTML([g]) {\n    const G = makeColorComp(g);\n    return `#${G}${G}${G}`;\n  
}\n\n  static RGB_G([r, g, b]) {\n    return ["G", 0.3 * r + 0.59 * g + 0.11 * b];\n  }\n\n  static 
RGB_HTML([r, g, b]) {\n    const R = makeColorComp(r);\n    const G = makeColorComp(g);\n    const B = 
makeColorComp(b);\n    return `#${R}${G}${B}`;\n  }\n\n  static T_HTML() {\n    return "#00000000";\n  }\n\n  
static CMYK_RGB([c, y, m, k]) {\n    re
 turn ["RGB", 1 - Math.min(1, c + k), 1 - Math.min(1, m + k), 1 - Math.min(1, y + k)];\n  }\n\n  static 
CMYK_HTML(components) {\n    return this.RGB_HTML(this.CMYK_RGB(components));\n  }\n\n  static RGB_CMYK([r, 
g, b]) {\n    const c = 1 - r;\n    const m = 1 - g;\n    const y = 1 - b;\n    const k = Math.min(c, m, 
y);\n    return ["CMYK", c, m, y, k];\n  }\n\n}\n\nexports.ColorConverters = ColorConverters;\n\n/***/ 
}),\n/* 7 */\n/***/ ((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, 
"__esModule", ({\n  value: true\n}));\nexports.PDFObject = void 0;\n\nclass PDFObject {\n  constructor(data) 
{\n    this._expandos = Object.create(null);\n    this._send = data.send || null;\n    this._id = data.id || 
null;\n  }\n\n}\n\nexports.PDFObject = PDFObject;\n\n/***/ }),\n/* 8 */\n/***/ ((__unused_webpack_module, 
exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: 
true\n}));\nexports.AForm = void 0;\n\nvar _constants =
  __w_pdfjs_require__(2);\n\nclass AForm {\n  constructor(document, app, util, color) {\n    this._document = 
document;\n    this._app = app;\n    this._util = util;\n    this._color = color;\n    this._dateFormats = 
["m/d", "m/d/yy", "mm/dd/yy", "mm/yy", "d-mmm", "d-mmm-yy", "dd-mmm-yy", "yy-mm-dd", "mmm-yy", "mmmm-yy", 
"mmm d, yyyy", "mmmm d, yyyy", "m/d/yy h:MM tt", "m/d/yy HH:MM"];\n    this._timeFormats = ["HH:MM", "h:MM 
tt", "HH:MM:ss", "h:MM:ss tt"];\n    this._emailRegex = new RegExp("^[a-zA-Z0-9.!#$%&\'*+\\\\/=?^_`{|}~-]+" + 
"@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?" + 
"(?:\\\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$");\n  }\n\n  _mkTargetName(event) {\n    return 
event.target ? `[ ${event.target.name} ]` : "";\n  }\n\n  _parseDate(cFormat, cDate) {\n    const ddate = 
Date.parse(cDate);\n\n    if (isNaN(ddate)) {\n      try {\n        return this._util.scand(cFormat, 
cDate);\n      } catch (error) {\n        return null;\n      }\n    } else {\n      return ne
 w Date(ddate);\n    }\n  }\n\n  AFMergeChange(event = globalThis.event) {\n    if (event.willCommit) {\n     
 return event.value.toString();\n    }\n\n    return this._app._eventDispatcher.mergeChange(event);\n  }\n\n  
AFParseDateEx(cString, cOrder) {\n    return this._parseDate(cOrder, cString);\n  }\n\n  AFExtractNums(str) 
{\n    if (typeof str === "number") {\n      return [str];\n    }\n\n    if (!str || typeof str !== "string") 
{\n      return null;\n    }\n\n    const first = str.charAt(0);\n\n    if (first === "." || first === ",") 
{\n      str = `0${str}`;\n    }\n\n    const numbers = str.match(/(\\d+)/g);\n\n    if (numbers.length === 
0) {\n      return null;\n    }\n\n    return numbers;\n  }\n\n  AFMakeNumber(str) {\n    if (typeof str === 
"number") {\n      return str;\n    }\n\n    if (typeof str !== "string") {\n      return null;\n    }\n\n    
str = str.trim().replace(",", ".");\n    const number = parseFloat(str);\n\n    if (isNaN(number) || 
!isFinite(number)) {\n  
     return null;\n    }\n\n    return number;\n  }\n\n  AFMakeArrayFromList(string) {\n    if (typeof string 
=== "string") {\n      return string.split(/, ?/g);\n    }\n\n    return string;\n  }\n\n  
AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend) {\n    const event = 
globalThis.event;\n\n    if (!event.value) {\n      return;\n    }\n\n    let value = 
this.AFMakeNumber(event.value);\n\n    if (value === null) {\n      event.value = "";\n      return;\n    
}\n\n    const sign = Math.sign(value);\n    const buf = [];\n    let hasParen = false;\n\n    if (sign === 
-1 && bCurrencyPrepend && negStyle === 0) {\n      buf.push("-");\n    }\n\n    if ((negStyle === 2 || 
negStyle === 3) && sign === -1) {\n      buf.push("(");\n      hasParen = true;\n    }\n\n    if 
(bCurrencyPrepend) {\n      buf.push(strCurrency);\n    }\n\n    sepStyle = Math.min(Math.max(0, 
Math.floor(sepStyle)), 4);\n    buf.push("%,", sepStyle, ".", nDec.toString(), "f");\n\n    if 
 (!bCurrencyPrepend) {\n      buf.push(strCurrency);\n    }\n\n    if (hasParen) {\n      buf.push(")");\n    
}\n\n    if (negStyle === 1 || negStyle === 3) {\n      event.target.textColor = sign === 1 ? 
this._color.black : this._color.red;\n    }\n\n    if ((negStyle !== 0 || bCurrencyPrepend) && sign === -1) 
{\n      value = -value;\n    }\n\n    const formatStr = buf.join("");\n    event.value = 
this._util.printf(formatStr, value);\n  }\n\n  AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, 
strCurrency, bCurrencyPrepend) {\n    const event = globalThis.event;\n    let value = 
this.AFMergeChange(event);\n\n    if (!value) {\n      return;\n    }\n\n    value = value.trim();\n    let 
pattern;\n\n    if (sepStyle > 1) {\n      pattern = event.willCommit ? /^[+-]?(\\d+(,\\d*)?|,\\d+)$/ : 
/^[+-]?\\d*,?\\d*$/;\n    } else {\n      pattern = event.willCommit ? /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)$/ : 
/^[+-]?\\d*\\.?\\d*$/;\n    }\n\n    if (!pattern.test(value)) {\n      if (event.willC
 ommit) {\n        const err = `${_constants.GlobalConstants.IDS_INVALID_VALUE} 
${this._mkTargetName(event)}`;\n\n        this._app.alert(err);\n      }\n\n      event.rc = false;\n    
}\n\n    if (event.willCommit && sepStyle > 1) {\n      event.value = parseFloat(value.replace(",", "."));\n  
  }\n  }\n\n  AFPercent_Format(nDec, sepStyle, percentPrepend = false) {\n    if (typeof nDec !== "number") 
{\n      return;\n    }\n\n    if (typeof sepStyle !== "number") {\n      return;\n    }\n\n    if (nDec < 0) 
{\n      throw new Error("Invalid nDec value in AFPercent_Format");\n    }\n\n    const event = 
globalThis.event;\n\n    if (nDec > 512) {\n      event.value = "%";\n      return;\n    }\n\n    nDec = 
Math.floor(nDec);\n    sepStyle = Math.min(Math.max(0, Math.floor(sepStyle)), 4);\n    let value = 
this.AFMakeNumber(event.value);\n\n    if (value === null) {\n      event.value = "%";\n      return;\n    
}\n\n    const formatStr = `%,${sepStyle}.${nDec}f`;\n    value = this._util.p
 rintf(formatStr, value * 100);\n\n    if (percentPrepend) {\n      event.value = `%${value}`;\n    } else 
{\n      event.value = `${value}%`;\n    }\n  }\n\n  AFPercent_Keystroke(nDec, sepStyle) {\n    
this.AFNumber_Keystroke(nDec, sepStyle, 0, 0, "", true);\n  }\n\n  AFDate_FormatEx(cFormat) {\n    const 
event = globalThis.event;\n    const value = event.value;\n\n    if (!value) {\n      return;\n    }\n\n    
const date = this._parseDate(cFormat, value);\n\n    if (date !== null) {\n      event.value = 
this._util.printd(cFormat, date);\n    }\n  }\n\n  AFDate_Format(pdf) {\n    if (pdf >= 0 && pdf < 
this._dateFormats.length) {\n      this.AFDate_FormatEx(this._dateFormats[pdf]);\n    }\n  }\n\n  
AFDate_KeystrokeEx(cFormat) {\n    const event = globalThis.event;\n\n    if (!event.willCommit) {\n      
return;\n    }\n\n    const value = this.AFMergeChange(event);\n\n    if (!value) {\n      return;\n    }\n\n 
   if (this._parseDate(cFormat, value) === null) {\n      const invalid = 
 _constants.GlobalConstants.IDS_INVALID_DATE;\n      const invalid2 = 
_constants.GlobalConstants.IDS_INVALID_DATE2;\n      const err = `${invalid} 
${this._mkTargetName(event)}${invalid2}${cFormat}`;\n\n      this._app.alert(err);\n\n      event.rc = 
false;\n    }\n  }\n\n  AFDate_Keystroke(pdf) {\n    if (pdf >= 0 && pdf < this._dateFormats.length) {\n      
this.AFDate_KeystrokeEx(this._dateFormats[pdf]);\n    }\n  }\n\n  AFRange_Validate(bGreaterThan, 
nGreaterThan, bLessThan, nLessThan) {\n    const event = globalThis.event;\n\n    if (!event.value) {\n      
return;\n    }\n\n    const value = this.AFMakeNumber(event.value);\n\n    if (value === null) {\n      
return;\n    }\n\n    bGreaterThan = !!bGreaterThan;\n    bLessThan = !!bLessThan;\n\n    if (bGreaterThan) 
{\n      nGreaterThan = this.AFMakeNumber(nGreaterThan);\n\n      if (nGreaterThan === null) {\n        
return;\n      }\n    }\n\n    if (bLessThan) {\n      nLessThan = this.AFMakeNumber(nLessThan);\n\n      if 
(nLessT
 han === null) {\n        return;\n      }\n    }\n\n    let err = "";\n\n    if (bGreaterThan && bLessThan) 
{\n      if (value < nGreaterThan || value > nLessThan) {\n        err = 
this._util.printf(_constants.GlobalConstants.IDS_GT_AND_LT, nGreaterThan, nLessThan);\n      }\n    } else if 
(bGreaterThan) {\n      if (value < nGreaterThan) {\n        err = 
this._util.printf(_constants.GlobalConstants.IDS_GREATER_THAN, nGreaterThan);\n      }\n    } else if (value 
nLessThan) {\n      err = this._util.printf(_constants.GlobalConstants.IDS_LESS_THAN, nLessThan);\n    
}\n\n    if (err) {\n      this._app.alert(err);\n\n      event.rc = false;\n    }\n  }\n\n  
AFSimple(cFunction, nValue1, nValue2) {\n    const value1 = this.AFMakeNumber(nValue1);\n\n    if (value1 === 
null) {\n      throw new Error("Invalid nValue1 in AFSimple");\n    }\n\n    const value2 = 
this.AFMakeNumber(nValue2);\n\n    if (value2 === null) {\n      throw new Error("Invalid nValue2 in 
AFSimple");\n    }\n\n    swi
 tch (cFunction) {\n      case "AVG":\n        return (value1 + value2) / 2;\n\n      case "SUM":\n        
return value1 + value2;\n\n      case "PRD":\n        return value1 * value2;\n\n      case "MIN":\n        
return Math.min(value1, value2);\n\n      case "MAX":\n        return Math.max(value1, value2);\n    }\n\n    
throw new Error("Invalid cFunction in AFSimple");\n  }\n\n  AFSimple_Calculate(cFunction, cFields) {\n    
const actions = {\n      AVG: args => args.reduce((acc, value) => acc + value, 0) / args.length,\n      SUM: 
args => args.reduce((acc, value) => acc + value, 0),\n      PRD: args => args.reduce((acc, value) => acc * 
value, 1),\n      MIN: args => args.reduce((acc, value) => Math.min(acc, value), Number.MAX_VALUE),\n      
MAX: args => args.reduce((acc, value) => Math.max(acc, value), Number.MIN_VALUE)\n    };\n\n    if 
(!(cFunction in actions)) {\n      throw new TypeError("Invalid function in AFSimple_Calculate");\n    }\n\n  
  const event = globalThis.event;\n
     const values = [];\n\n    for (const cField of cFields) {\n      const field = 
this._document.getField(cField);\n\n      const number = this.AFMakeNumber(field.value);\n\n      if (number 
!== null) {\n        values.push(number);\n      }\n    }\n\n    if (values.length === 0) {\n      
event.value = cFunction === "PRD" ? 1 : 0;\n      return;\n    }\n\n    const res = 
actions[cFunction](values);\n    event.value = Math.round(1e6 * res) / 1e6;\n  }\n\n  AFSpecial_Format(psf) 
{\n    const event = globalThis.event;\n\n    if (!event.value) {\n      return;\n    }\n\n    psf = 
this.AFMakeNumber(psf);\n\n    if (psf === null) {\n      throw new Error("Invalid psf in 
AFSpecial_Format");\n    }\n\n    let formatStr = "";\n\n    switch (psf) {\n      case 0:\n        formatStr 
= "99999";\n        break;\n\n      case 1:\n        formatStr = "99999-9999";\n        break;\n\n      case 
2:\n        if (this._util.printx("9999999999", event.value).length >= 10) {\n          formatStr = "(99
 9) 999-9999";\n        } else {\n          formatStr = "999-9999";\n        }\n\n        break;\n\n      
case 3:\n        formatStr = "999-99-9999";\n        break;\n\n      default:\n        throw new 
Error("Invalid psf in AFSpecial_Format");\n    }\n\n    event.value = this._util.printx(formatStr, 
event.value);\n  }\n\n  AFSpecial_KeystrokeEx(cMask) {\n    if (!cMask) {\n      return;\n    }\n\n    const 
event = globalThis.event;\n    const value = this.AFMergeChange(event);\n    const checkers = new Map([["9", 
char => char >= "0" && char <= "9"], ["A", char => "a" <= char && char <= "z" || "A" <= char && char <= "Z"], 
["O", char => "a" <= char && char <= "z" || "A" <= char && char <= "Z" || "0" <= char && char <= "9"], ["X", 
char => true]]);\n\n    function _checkValidity(_value, _cMask) {\n      for (let i = 0, ii = value.length; i 
< ii; i++) {\n        const mask = _cMask.charAt(i);\n\n        const char = _value.charAt(i);\n\n        
const checker = checkers.get(mask);\n\n    
     if (checker) {\n          if (!checker(char)) {\n            return false;\n          }\n        } else 
if (mask !== char) {\n          return false;\n        }\n      }\n\n      return true;\n    }\n\n    if 
(!value) {\n      return;\n    }\n\n    const err = `${_constants.GlobalConstants.IDS_INVALID_VALUE} = 
"${cMask}"`;\n\n    if (value.length > cMask.length) {\n      this._app.alert(err);\n\n      event.rc = 
false;\n      return;\n    }\n\n    if (event.willCommit) {\n      if (value.length < cMask.length) {\n       
 this._app.alert(err);\n\n        event.rc = false;\n        return;\n      }\n\n      if 
(!_checkValidity(value, cMask)) {\n        this._app.alert(err);\n\n        event.rc = false;\n        
return;\n      }\n\n      event.value += cMask.substring(value.length);\n      return;\n    }\n\n    if 
(value.length < cMask.length) {\n      cMask = cMask.substring(0, value.length);\n    }\n\n    if 
(!_checkValidity(value, cMask)) {\n      this._app.alert(err);\n\n      
 event.rc = false;\n    }\n  }\n\n  AFSpecial_Keystroke(psf) {\n    const event = globalThis.event;\n\n    if 
(!event.value) {\n      return;\n    }\n\n    psf = this.AFMakeNumber(psf);\n\n    if (psf === null) {\n      
throw new Error("Invalid psf in AFSpecial_Keystroke");\n    }\n\n    let formatStr;\n\n    switch (psf) {\n   
   case 0:\n        formatStr = "99999";\n        break;\n\n      case 1:\n        formatStr = 
"99999-9999";\n        break;\n\n      case 2:\n        const finalLen = event.value.length + 
event.change.length + event.selStart - event.selEnd;\n\n        if (finalLen >= 8) {\n          formatStr = 
"(999) 999-9999";\n        } else {\n          formatStr = "999-9999";\n        }\n\n        break;\n\n      
case 3:\n        formatStr = "999-99-9999";\n        break;\n\n      default:\n        throw new 
Error("Invalid psf in AFSpecial_Keystroke");\n    }\n\n    this.AFSpecial_KeystrokeEx(formatStr);\n  }\n\n  
AFTime_FormatEx(cFormat) {\n    this.AFDate_FormatEx(cFor
 mat);\n  }\n\n  AFTime_Format(pdf) {\n    if (pdf >= 0 && pdf < this._timeFormats.length) {\n      
this.AFDate_FormatEx(this._timeFormats[pdf]);\n    }\n  }\n\n  AFTime_KeystrokeEx(cFormat) {\n    
this.AFDate_KeystrokeEx(cFormat);\n  }\n\n  AFTime_Keystroke(pdf) {\n    if (pdf >= 0 && pdf < 
this._timeFormats.length) {\n      this.AFDate_KeystrokeEx(this._timeFormats[pdf]);\n    }\n  }\n\n  
eMailValidate(str) {\n    return this._emailRegex.test(str);\n  }\n\n}\n\nexports.AForm = AForm;\n\n/***/ 
}),\n/* 9 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}));\nexports.App = void 0;\n\nvar 
_color = __w_pdfjs_require__(5);\n\nvar _event = __w_pdfjs_require__(10);\n\nvar _fullscreen = 
__w_pdfjs_require__(11);\n\nvar _pdf_object = __w_pdfjs_require__(7);\n\nvar _thermometer = 
__w_pdfjs_require__(12);\n\nconst VIEWER_TYPE = "PDF.js";\nconst VIEWER_VARIATION = "Full";\nconst 
VIEWER_VERSION = 21.0072
 0099;\nconst FORMS_VERSION = 21.00720099;\n\nclass App extends _pdf_object.PDFObject {\n  constructor(data) 
{\n    super(data);\n    this._constants = null;\n    this._focusRect = true;\n    this._fs = null;\n    
this._language = App._getLanguage(data.language);\n    this._openInPlace = false;\n    this._platform = 
App._getPlatform(data.platform);\n    this._runtimeHighlight = false;\n    this._runtimeHighlightColor = 
["T"];\n    this._thermometer = null;\n    this._toolbar = false;\n    this._document = data._document;\n    
this._proxyHandler = data.proxyHandler;\n    this._objects = Object.create(null);\n    this._eventDispatcher 
= new _event.EventDispatcher(this._document, data.calculationOrder, this._objects);\n    this._timeoutIds = 
new WeakMap();\n\n    if (typeof FinalizationRegistry !== "undefined") {\n      this._timeoutIdsRegistry = 
new FinalizationRegistry(this._cleanTimeout.bind(this));\n    } else {\n      this._timeoutIdsRegistry = 
null;\n    }\n\n    this._timeoutCall
 backIds = new Map();\n    this._timeoutCallbackId = 0;\n    this._globalEval = data.globalEval;\n    
this._externalCall = data.externalCall;\n    this._document = data._document;\n  }\n\n  
_dispatchEvent(pdfEvent) {\n    this._eventDispatcher.dispatch(pdfEvent);\n  }\n\n  
_registerTimeoutCallback(cExpr) {\n    const id = this._timeoutCallbackId++;\n\n    
this._timeoutCallbackIds.set(id, cExpr);\n\n    return id;\n  }\n\n  _unregisterTimeoutCallback(id) {\n    
this._timeoutCallbackIds.delete(id);\n  }\n\n  _evalCallback({\n    callbackId,\n    interval\n  }) {\n    
const expr = this._timeoutCallbackIds.get(callbackId);\n\n    if (!interval) {\n      
this._unregisterTimeoutCallback(callbackId);\n    }\n\n    if (expr) {\n      this._globalEval(expr);\n    
}\n  }\n\n  _registerTimeout(callbackId, interval) {\n    const timeout = Object.create(null);\n    const id 
= {\n      callbackId,\n      interval\n    };\n\n    this._timeoutIds.set(timeout, id);\n\n    if 
(this._timeoutIdsRegistry
 ) {\n      this._timeoutIdsRegistry.register(timeout, id);\n    }\n\n    return timeout;\n  }\n\n  
_unregisterTimeout(timeout) {\n    if (this._timeoutIdsRegistry) {\n      
this._timeoutIdsRegistry.unregister(timeout);\n    }\n\n    const data = this._timeoutIds.get(timeout);\n\n   
 if (!data) {\n      return;\n    }\n\n    this._timeoutIds.delete(timeout);\n\n    
this._cleanTimeout(data);\n  }\n\n  _cleanTimeout({\n    callbackId,\n    interval\n  }) {\n    
this._unregisterTimeoutCallback(callbackId);\n\n    if (interval) {\n      
this._externalCall("clearInterval", [callbackId]);\n    } else {\n      this._externalCall("clearTimeout", 
[callbackId]);\n    }\n  }\n\n  static _getPlatform(platform) {\n    if (typeof platform === "string") {\n    
  platform = platform.toLowerCase();\n\n      if (platform.includes("win")) {\n        return "WIN";\n      } 
else if (platform.includes("mac")) {\n        return "MAC";\n      }\n    }\n\n    return "UNIX";\n  }\n\n  
static _getLanguage(lang
 uage) {\n    const [main, sub] = language.toLowerCase().split(/[-_]/);\n\n    switch (main) {\n      case 
"zh":\n        if (sub === "cn" || sub === "sg") {\n          return "CHS";\n        }\n\n        return 
"CHT";\n\n      case "da":\n        return "DAN";\n\n      case "de":\n        return "DEU";\n\n      case 
"es":\n        return "ESP";\n\n      case "fr":\n        return "FRA";\n\n      case "it":\n        return 
"ITA";\n\n      case "ko":\n        return "KOR";\n\n      case "ja":\n        return "JPN";\n\n      case 
"nl":\n        return "NLD";\n\n      case "no":\n        return "NOR";\n\n      case "pt":\n        if (sub 
=== "br") {\n          return "PTB";\n        }\n\n        return "ENU";\n\n      case "fi":\n        return 
"SUO";\n\n      case "SV":\n        return "SVE";\n\n      default:\n        return "ENU";\n    }\n  }\n\n  
get activeDocs() {\n    return [this._document.wrapped];\n  }\n\n  set activeDocs(_) {\n    throw new 
Error("app.activeDocs is read-only")
 ;\n  }\n\n  get calculate() {\n    return this._document.obj.calculate;\n  }\n\n  set calculate(calculate) 
{\n    this._document.obj.calculate = calculate;\n  }\n\n  get constants() {\n    if (!this._constants) {\n   
   this._constants = Object.freeze({\n        align: Object.freeze({\n          left: 0,\n          center: 
1,\n          right: 2,\n          top: 3,\n          bottom: 4\n        })\n      });\n    }\n\n    return 
this._constants;\n  }\n\n  set constants(_) {\n    throw new Error("app.constants is read-only");\n  }\n\n  
get focusRect() {\n    return this._focusRect;\n  }\n\n  set focusRect(val) {\n    this._focusRect = val;\n  
}\n\n  get formsVersion() {\n    return FORMS_VERSION;\n  }\n\n  set formsVersion(_) {\n    throw new 
Error("app.formsVersion is read-only");\n  }\n\n  get fromPDFConverters() {\n    return [];\n  }\n\n  set 
fromPDFConverters(_) {\n    throw new Error("app.fromPDFConverters is read-only");\n  }\n\n  get fs() {\n    
if (this._fs === null) {\n    
   this._fs = new Proxy(new _fullscreen.FullScreen({\n        send: this._send\n      }), 
this._proxyHandler);\n    }\n\n    return this._fs;\n  }\n\n  set fs(_) {\n    throw new Error("app.fs is 
read-only");\n  }\n\n  get language() {\n    return this._language;\n  }\n\n  set language(_) {\n    throw 
new Error("app.language is read-only");\n  }\n\n  get media() {\n    return undefined;\n  }\n\n  set media(_) 
{\n    throw new Error("app.media is read-only");\n  }\n\n  get monitors() {\n    return [];\n  }\n\n  set 
monitors(_) {\n    throw new Error("app.monitors is read-only");\n  }\n\n  get numPlugins() {\n    return 
0;\n  }\n\n  set numPlugins(_) {\n    throw new Error("app.numPlugins is read-only");\n  }\n\n  get 
openInPlace() {\n    return this._openInPlace;\n  }\n\n  set openInPlace(val) {\n    this._openInPlace = 
val;\n  }\n\n  get platform() {\n    return this._platform;\n  }\n\n  set platform(_) {\n    throw new 
Error("app.platform is read-only");\n  }\n\n  get plugins() {\n 
    return [];\n  }\n\n  set plugins(_) {\n    throw new Error("app.plugins is read-only");\n  }\n\n  get 
printColorProfiles() {\n    return [];\n  }\n\n  set printColorProfiles(_) {\n    throw new 
Error("app.printColorProfiles is read-only");\n  }\n\n  get printerNames() {\n    return [];\n  }\n\n  set 
printerNames(_) {\n    throw new Error("app.printerNames is read-only");\n  }\n\n  get runtimeHighlight() {\n 
   return this._runtimeHighlight;\n  }\n\n  set runtimeHighlight(val) {\n    this._runtimeHighlight = val;\n  
}\n\n  get runtimeHighlightColor() {\n    return this._runtimeHighlightColor;\n  }\n\n  set 
runtimeHighlightColor(val) {\n    if (_color.Color._isValidColor(val)) {\n      this._runtimeHighlightColor = 
val;\n    }\n  }\n\n  get thermometer() {\n    if (this._thermometer === null) {\n      this._thermometer = 
new Proxy(new _thermometer.Thermometer({\n        send: this._send\n      }), this._proxyHandler);\n    }\n\n 
   return this._thermometer;\n  }\n\n  set thermomete
 r(_) {\n    throw new Error("app.thermometer is read-only");\n  }\n\n  get toolbar() {\n    return 
this._toolbar;\n  }\n\n  set toolbar(val) {\n    this._toolbar = val;\n  }\n\n  get toolbarHorizontal() {\n   
 return this.toolbar;\n  }\n\n  set toolbarHorizontal(value) {\n    this.toolbar = value;\n  }\n\n  get 
toolbarVertical() {\n    return this.toolbar;\n  }\n\n  set toolbarVertical(value) {\n    this.toolbar = 
value;\n  }\n\n  get viewerType() {\n    return VIEWER_TYPE;\n  }\n\n  set viewerType(_) {\n    throw new 
Error("app.viewerType is read-only");\n  }\n\n  get viewerVariation() {\n    return VIEWER_VARIATION;\n  
}\n\n  set viewerVariation(_) {\n    throw new Error("app.viewerVariation is read-only");\n  }\n\n  get 
viewerVersion() {\n    return VIEWER_VERSION;\n  }\n\n  set viewerVersion(_) {\n    throw new 
Error("app.viewerVersion is read-only");\n  }\n\n  addMenuItem() {}\n\n  addSubMenu() {}\n\n  addToolButton() 
{}\n\n  alert(cMsg, nIcon = 0, nType = 0, cTitle = "PDF.js",
  oDoc = null, oCheckbox = null) {\n    if (typeof cMsg === "object") {\n      nType = cMsg.nType;\n      
cMsg = cMsg.cMsg;\n    }\n\n    cMsg = (cMsg || "").toString();\n    nType = typeof nType !== "number" || 
isNaN(nType) || nType < 0 || nType > 3 ? 0 : nType;\n\n    if (nType >= 2) {\n      return 
this._externalCall("confirm", [cMsg]) ? 4 : 3;\n    }\n\n    this._externalCall("alert", [cMsg]);\n\n    
return 1;\n  }\n\n  beep() {}\n\n  beginPriv() {}\n\n  browseForDoc() {}\n\n  clearInterval(oInterval) {\n    
this._unregisterTimeout(oInterval);\n  }\n\n  clearTimeOut(oTime) {\n    this._unregisterTimeout(oTime);\n  
}\n\n  endPriv() {}\n\n  execDialog() {}\n\n  execMenuItem(item) {\n    switch (item) {\n      case 
"SaveAs":\n      case "FirstPage":\n      case "LastPage":\n      case "NextPage":\n      case "PrevPage":\n  
    case "ZoomViewIn":\n      case "ZoomViewOut":\n        this._send({\n          command: item\n        
});\n\n        break;\n\n      case "FitPage":\n        
 this._send({\n          command: "zoom",\n          value: "page-fit"\n        });\n\n        break;\n\n     
 case "Print":\n        this._send({\n          command: "print"\n        });\n\n        break;\n    }\n  
}\n\n  getNthPlugInName() {}\n\n  getPath() {}\n\n  goBack() {}\n\n  goForward() {}\n\n  hideMenuItem() 
{}\n\n  hideToolbarButton() {}\n\n  launchURL() {}\n\n  listMenuItems() {}\n\n  listToolbarButtons() {}\n\n  
loadPolicyFile() {}\n\n  mailGetAddrs() {}\n\n  mailMsg() {}\n\n  newDoc() {}\n\n  newCollection() {}\n\n  
newFDF() {}\n\n  openDoc() {}\n\n  openFDF() {}\n\n  popUpMenu() {}\n\n  popUpMenuEx() {}\n\n  
removeToolButton() {}\n\n  response(cQuestion, cTitle = "", cDefault = "", bPassword = "", cLabel = "") {\n   
 if (typeof cQuestion === "object") {\n      cDefault = cQuestion.cDefault;\n      cQuestion = 
cQuestion.cQuestion;\n    }\n\n    cQuestion = (cQuestion || "").toString();\n    cDefault = (cDefault || 
"").toString();\n    return this._externalCall("prompt",
  [cQuestion, cDefault || ""]);\n  }\n\n  setInterval(cExpr, nMilliseconds = 0) {\n    if (typeof cExpr === 
"object") {\n      nMilliseconds = cExpr.nMilliseconds || 0;\n      cExpr = cExpr.cExpr;\n    }\n\n    if 
(typeof cExpr !== "string") {\n      throw new TypeError("First argument of app.setInterval must be a 
string");\n    }\n\n    if (typeof nMilliseconds !== "number") {\n      throw new TypeError("Second argument 
of app.setInterval must be a number");\n    }\n\n    const callbackId = 
this._registerTimeoutCallback(cExpr);\n\n    this._externalCall("setInterval", [callbackId, 
nMilliseconds]);\n\n    return this._registerTimeout(callbackId, true);\n  }\n\n  setTimeOut(cExpr, 
nMilliseconds = 0) {\n    if (typeof cExpr === "object") {\n      nMilliseconds = cExpr.nMilliseconds || 0;\n 
     cExpr = cExpr.cExpr;\n    }\n\n    if (typeof cExpr !== "string") {\n      throw new TypeError("First 
argument of app.setTimeOut must be a string");\n    }\n\n    if (typeof nMilliseconds !== "n
 umber") {\n      throw new TypeError("Second argument of app.setTimeOut must be a number");\n    }\n\n    
const callbackId = this._registerTimeoutCallback(cExpr);\n\n    this._externalCall("setTimeout", [callbackId, 
nMilliseconds]);\n\n    return this._registerTimeout(callbackId, false);\n  }\n\n  trustedFunction() {}\n\n  
trustPropagatorFunction() {}\n\n}\n\nexports.App = App;\n\n/***/ }),\n/* 10 */\n/***/ 
((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: 
true\n}));\nexports.EventDispatcher = exports.Event = void 0;\n\nclass Event {\n  constructor(data) {\n    
this.change = data.change || "";\n    this.changeEx = data.changeEx || null;\n    this.commitKey = 
data.commitKey || 0;\n    this.fieldFull = data.fieldFull || false;\n    this.keyDown = data.keyDown || 
false;\n    this.modifier = data.modifier || false;\n    this.name = data.name;\n    this.rc = true;\n    
this.richChange = data.richChange || [];\n    this.richChangeEx 
 = data.richChangeEx || [];\n    this.richValue = data.richValue || [];\n    this.selEnd = data.selEnd || 
-1;\n    this.selStart = data.selStart || -1;\n    this.shift = data.shift || false;\n    this.source = 
data.source || null;\n    this.target = data.target || null;\n    this.targetName = "";\n    this.type = 
"Field";\n    this.value = data.value || "";\n    this.willCommit = data.willCommit || false;\n  
}\n\n}\n\nexports.Event = Event;\n\nclass EventDispatcher {\n  constructor(document, calculationOrder, 
objects) {\n    this._document = document;\n    this._calculationOrder = calculationOrder;\n    this._objects 
= objects;\n    this._document.obj._eventDispatcher = this;\n  }\n\n  mergeChange(event) {\n    let value = 
event.value;\n\n    if (typeof value !== "string") {\n      value = value.toString();\n    }\n\n    const 
prefix = event.selStart >= 0 ? value.substring(0, event.selStart) : "";\n    const postfix = event.selEnd >= 
0 && event.selEnd <= value.length ? value.substrin
 g(event.selEnd) : "";\n    return `${prefix}${event.change}${postfix}`;\n  }\n\n  dispatch(baseEvent) {\n    
const id = baseEvent.id;\n\n    if (!(id in this._objects)) {\n      let event;\n\n      if (id === "doc" || 
id === "page") {\n        event = globalThis.event = new Event(baseEvent);\n        event.source = 
event.target = this._document.wrapped;\n        event.name = baseEvent.name;\n      }\n\n      if (id === 
"doc") {\n        this._document.obj._dispatchDocEvent(event.name);\n      } else if (id === "page") {\n      
  this._document.obj._dispatchPageEvent(event.name, baseEvent.actions, baseEvent.pageNumber);\n      } else 
if (id === "app" && baseEvent.name === "ResetForm") {\n        for (const fieldId of baseEvent.ids) {\n       
   const obj = this._objects[fieldId];\n\n          if (obj) {\n            obj.obj._reset();\n          }\n  
      }\n      }\n\n      return;\n    }\n\n    const name = baseEvent.name;\n    const source = 
this._objects[id];\n    const event = g
 lobalThis.event = new Event(baseEvent);\n    let savedChange;\n\n    if (source.obj._isButton()) {\n      
source.obj._id = id;\n      event.value = source.obj._getExportValue(event.value);\n\n      if (name === 
"Action") {\n        source.obj._value = event.value;\n      }\n    }\n\n    switch (name) {\n      case 
"Keystroke":\n        savedChange = {\n          value: event.value,\n          change: event.change,\n       
   selStart: event.selStart,\n          selEnd: event.selEnd\n        };\n        break;\n\n      case 
"Blur":\n      case "Focus":\n        Object.defineProperty(event, "value", {\n          configurable: 
false,\n          writable: false,\n          enumerable: true,\n          value: event.value\n        });\n  
      break;\n\n      case "Validate":\n        this.runValidation(source, event);\n        return;\n\n      
case "Action":\n        this.runActions(source, source, event, name);\n\n        if 
(this._document.obj.calculate) {\n          this.runCalculate(
 source, event);\n        }\n\n        return;\n    }\n\n    this.runActions(source, source, event, 
name);\n\n    if (name === "Keystroke") {\n      if (event.rc) {\n        if (event.willCommit) {\n          
this.runValidation(source, event);\n        } else if (event.change !== savedChange.change || event.selStart 
!== savedChange.selStart || event.selEnd !== savedChange.selEnd) {\n          source.wrapped.value = 
this.mergeChange(event);\n        }\n      } else if (!event.willCommit) {\n        source.obj._send({\n      
    id: source.obj._id,\n          value: savedChange.value,\n          selRange: [savedChange.selStart, 
savedChange.selEnd]\n        });\n      }\n    }\n  }\n\n  runValidation(source, event) {\n    const hasRan = 
this.runActions(source, source, event, "Validate");\n\n    if (event.rc) {\n      if (hasRan) {\n        
source.wrapped.value = event.value;\n        source.wrapped.valueAsString = event.value;\n      } else {\n    
    source.obj.value = event.value;\n  
       source.obj.valueAsString = event.value;\n      }\n\n      if (this._document.obj.calculate) {\n        
this.runCalculate(source, event);\n      }\n\n      event.value = source.obj.value;\n      
this.runActions(source, source, event, "Format");\n      source.wrapped.valueAsString = event.value;\n    }\n 
 }\n\n  runActions(source, target, event, eventName) {\n    event.source = source.wrapped;\n    event.target 
= target.wrapped;\n    event.name = eventName;\n    event.targetName = target.obj.name;\n    event.rc = 
true;\n    return target.obj._runActions(event);\n  }\n\n  calculateNow() {\n    if (!this._calculationOrder) 
{\n      return;\n    }\n\n    const first = this._calculationOrder[0];\n    const source = 
this._objects[first];\n    globalThis.event = new Event({});\n    this.runCalculate(source, 
globalThis.event);\n  }\n\n  runCalculate(source, event) {\n    if (!this._calculationOrder) {\n      
return;\n    }\n\n    for (const targetId of this._calculationOrder) {\n      
 if (!(targetId in this._objects)) {\n        continue;\n      }\n\n      if (!this._document.obj.calculate) 
{\n        continue;\n      }\n\n      event.value = null;\n      const target = this._objects[targetId];\n   
   this.runActions(source, target, event, "Calculate");\n\n      if (!event.rc) {\n        continue;\n      
}\n\n      if (event.value !== null) {\n        target.wrapped.value = event.value;\n      }\n\n      
event.value = target.obj.value;\n      this.runActions(target, target, event, "Validate");\n\n      if 
(!event.rc) {\n        continue;\n      }\n\n      event.value = target.obj.value;\n      
this.runActions(target, target, event, "Format");\n\n      if (event.value !== null) {\n        
target.wrapped.valueAsString = event.value;\n      }\n    }\n  }\n\n}\n\nexports.EventDispatcher = 
EventDispatcher;\n\n/***/ }),\n/* 11 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}
 ));\nexports.FullScreen = void 0;\n\nvar _constants = __w_pdfjs_require__(2);\n\nvar _pdf_object = 
__w_pdfjs_require__(7);\n\nclass FullScreen extends _pdf_object.PDFObject {\n  constructor(data) {\n    
super(data);\n    this._backgroundColor = [];\n    this._clickAdvances = true;\n    this._cursor = 
_constants.Cursor.hidden;\n    this._defaultTransition = "";\n    this._escapeExits = true;\n    
this._isFullScreen = true;\n    this._loop = false;\n    this._timeDelay = 3600;\n    this._usePageTiming = 
false;\n    this._useTimer = false;\n  }\n\n  get backgroundColor() {\n    return this._backgroundColor;\n  
}\n\n  set backgroundColor(_) {}\n\n  get clickAdvances() {\n    return this._clickAdvances;\n  }\n\n  set 
clickAdvances(_) {}\n\n  get cursor() {\n    return this._cursor;\n  }\n\n  set cursor(_) {}\n\n  get 
defaultTransition() {\n    return this._defaultTransition;\n  }\n\n  set defaultTransition(_) {}\n\n  get 
escapeExits() {\n    return this._escapeExits;\n  }\n\n  set escape
 Exits(_) {}\n\n  get isFullScreen() {\n    return this._isFullScreen;\n  }\n\n  set isFullScreen(_) {}\n\n  
get loop() {\n    return this._loop;\n  }\n\n  set loop(_) {}\n\n  get timeDelay() {\n    return 
this._timeDelay;\n  }\n\n  set timeDelay(_) {}\n\n  get transitions() {\n    return ["Replace", "WipeRight", 
"WipeLeft", "WipeDown", "WipeUp", "SplitHorizontalIn", "SplitHorizontalOut", "SplitVerticalIn", 
"SplitVerticalOut", "BlindsHorizontal", "BlindsVertical", "BoxIn", "BoxOut", "GlitterRight", "GlitterDown", 
"GlitterRightDown", "Dissolve", "Random"];\n  }\n\n  set transitions(_) {\n    throw new 
Error("fullscreen.transitions is read-only");\n  }\n\n  get usePageTiming() {\n    return 
this._usePageTiming;\n  }\n\n  set usePageTiming(_) {}\n\n  get useTimer() {\n    return this._useTimer;\n  
}\n\n  set useTimer(_) {}\n\n}\n\nexports.FullScreen = FullScreen;\n\n/***/ }),\n/* 12 */\n/***/ 
((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(expo
 rts, "__esModule", ({\n  value: true\n}));\nexports.Thermometer = void 0;\n\nvar _pdf_object = 
__w_pdfjs_require__(7);\n\nclass Thermometer extends _pdf_object.PDFObject {\n  constructor(data) {\n    
super(data);\n    this._cancelled = false;\n    this._duration = 100;\n    this._text = "";\n    this._value 
= 0;\n  }\n\n  get cancelled() {\n    return this._cancelled;\n  }\n\n  set cancelled(_) {\n    throw new 
Error("thermometer.cancelled is read-only");\n  }\n\n  get duration() {\n    return this._duration;\n  }\n\n  
set duration(val) {\n    this._duration = val;\n  }\n\n  get text() {\n    return this._text;\n  }\n\n  set 
text(val) {\n    this._text = val;\n  }\n\n  get value() {\n    return this._value;\n  }\n\n  set value(val) 
{\n    this._value = val;\n  }\n\n  begin() {}\n\n  end() {}\n\n}\n\nexports.Thermometer = 
Thermometer;\n\n/***/ }),\n/* 13 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  v
 alue: true\n}));\nexports.Console = void 0;\n\nvar _pdf_object = __w_pdfjs_require__(7);\n\nclass Console 
extends _pdf_object.PDFObject {\n  clear() {\n    this._send({\n      id: "clear"\n    });\n  }\n\n  hide() 
{}\n\n  println(msg) {\n    if (typeof msg === "string") {\n      this._send({\n        command: "println",\n 
       value: "PDF.js Console:: " + msg\n      });\n    }\n  }\n\n  show() {}\n\n}\n\nexports.Console = 
Console;\n\n/***/ }),\n/* 14 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => 
{\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: true\n}));\nexports.Doc = void 0;\n\nvar 
_common = __w_pdfjs_require__(4);\n\nvar _pdf_object = __w_pdfjs_require__(7);\n\nvar _print_params = 
__w_pdfjs_require__(15);\n\nvar _constants = __w_pdfjs_require__(2);\n\nclass InfoProxyHandler {\n  static 
get(obj, prop) {\n    return obj[prop.toLowerCase()];\n  }\n\n  static set(obj, prop, value) {\n    throw new 
Error(`doc.info.${prop} is read-only`);\n  
 }\n\n}\n\nclass Doc extends _pdf_object.PDFObject {\n  constructor(data) {\n    super(data);\n    
this._expandos = globalThis;\n    this._baseURL = data.baseURL || "";\n    this._calculate = true;\n    
this._delay = false;\n    this._dirty = false;\n    this._disclosed = false;\n    this._media = undefined;\n  
  this._metadata = data.metadata || "";\n    this._noautocomplete = undefined;\n    this._nocache = 
undefined;\n    this._spellDictionaryOrder = [];\n    this._spellLanguageOrder = [];\n    this._printParams = 
null;\n    this._fields = new Map();\n    this._fieldNames = [];\n    this._event = null;\n    this._author = 
data.Author || "";\n    this._creator = data.Creator || "";\n    this._creationDate = 
this._getDate(data.CreationDate) || null;\n    this._docID = data.docID || ["", ""];\n    
this._documentFileName = data.filename || "";\n    this._filesize = data.filesize || 0;\n    this._keywords = 
data.Keywords || "";\n    this._layout = data.layout || "";\n    this._modDate 
 = this._getDate(data.ModDate) || null;\n    this._numFields = 0;\n    this._numPages = data.numPages || 1;\n 
   this._pageNum = data.pageNum || 0;\n    this._producer = data.Producer || "";\n    this._securityHandler = 
data.EncryptFilterName || null;\n    this._subject = data.Subject || "";\n    this._title = data.Title || 
"";\n    this._URL = data.URL || "";\n    this._info = new Proxy({\n      title: this._title,\n      author: 
this._author,\n      authors: data.authors || [this._author],\n      subject: this._subject,\n      keywords: 
this._keywords,\n      creator: this._creator,\n      producer: this._producer,\n      creationdate: 
this._creationDate,\n      moddate: this._modDate,\n      trapped: data.Trapped || "Unknown"\n    }, 
InfoProxyHandler);\n    this._zoomType = _constants.ZoomType.none;\n    this._zoom = data.zoom || 100;\n    
this._actions = (0, _common.createActionsMap)(data.actions);\n    this._globalEval = data.globalEval;\n    
this._pageActions = new Map();\n  }\
 n\n  _dispatchDocEvent(name) {\n    if (name === "Open") {\n      const dontRun = new Set(["WillClose", 
"WillSave", "DidSave", "WillPrint", "DidPrint", "OpenAction"]);\n\n      for (const actionName of 
this._actions.keys()) {\n        if (!dontRun.has(actionName)) {\n          this._runActions(actionName);\n   
     }\n      }\n\n      this._runActions("OpenAction");\n    } else {\n      this._runActions(name);\n    
}\n  }\n\n  _dispatchPageEvent(name, actions, pageNumber) {\n    if (name === "PageOpen") {\n      if 
(!this._pageActions.has(pageNumber)) {\n        this._pageActions.set(pageNumber, (0, 
_common.createActionsMap)(actions));\n      }\n\n      this._pageNum = pageNumber - 1;\n    }\n\n    actions 
= this._pageActions.get(pageNumber)?.get(name);\n\n    if (actions) {\n      for (const action of actions) 
{\n        this._globalEval(action);\n      }\n    }\n  }\n\n  _runActions(name) {\n    const actions = 
this._actions.get(name);\n\n    if (actions) {\n      for (const actio
 n of actions) {\n        this._globalEval(action);\n      }\n    }\n  }\n\n  _addField(name, field) {\n    
this._fields.set(name, field);\n\n    this._fieldNames.push(name);\n\n    this._numFields++;\n  }\n\n  
_getDate(date) {\n    if (!date || date.length < 15 || !date.startsWith("D:")) {\n      return date;\n    
}\n\n    date = date.substring(2);\n    const year = date.substring(0, 4);\n    const month = 
date.substring(4, 6);\n    const day = date.substring(6, 8);\n    const hour = date.substring(8, 10);\n    
const minute = date.substring(10, 12);\n    const o = date.charAt(12);\n    let second, offsetPos;\n\n    if 
(o === "Z" || o === "+" || o === "-") {\n      second = "00";\n      offsetPos = 12;\n    } else {\n      
second = date.substring(12, 14);\n      offsetPos = 14;\n    }\n\n    const offset = 
date.substring(offsetPos).replaceAll("\'", "");\n    return new 
Date(`${year}-${month}-${day}T${hour}:${minute}:${second}${offset}`);\n  }\n\n  get author() {\n    return 
this._aut
 hor;\n  }\n\n  set author(_) {\n    throw new Error("doc.author is read-only");\n  }\n\n  get baseURL() {\n  
  return this._baseURL;\n  }\n\n  set baseURL(baseURL) {\n    this._baseURL = baseURL;\n  }\n\n  get 
bookmarkRoot() {\n    return undefined;\n  }\n\n  set bookmarkRoot(_) {\n    throw new 
Error("doc.bookmarkRoot is read-only");\n  }\n\n  get calculate() {\n    return this._calculate;\n  }\n\n  
set calculate(calculate) {\n    this._calculate = calculate;\n  }\n\n  get creator() {\n    return 
this._creator;\n  }\n\n  set creator(_) {\n    throw new Error("doc.creator is read-only");\n  }\n\n  get 
dataObjects() {\n    return [];\n  }\n\n  set dataObjects(_) {\n    throw new Error("doc.dataObjects is 
read-only");\n  }\n\n  get delay() {\n    return this._delay;\n  }\n\n  set delay(delay) {\n    this._delay = 
delay;\n  }\n\n  get dirty() {\n    return this._dirty;\n  }\n\n  set dirty(dirty) {\n    this._dirty = 
dirty;\n  }\n\n  get disclosed() {\n    return this._disclosed;\n  }\n
 \n  set disclosed(disclosed) {\n    this._disclosed = disclosed;\n  }\n\n  get docID() {\n    return 
this._docID;\n  }\n\n  set docID(_) {\n    throw new Error("doc.docID is read-only");\n  }\n\n  get 
documentFileName() {\n    return this._documentFileName;\n  }\n\n  set documentFileName(_) {\n    throw new 
Error("doc.documentFileName is read-only");\n  }\n\n  get dynamicXFAForm() {\n    return false;\n  }\n\n  set 
dynamicXFAForm(_) {\n    throw new Error("doc.dynamicXFAForm is read-only");\n  }\n\n  get external() {\n    
return true;\n  }\n\n  set external(_) {\n    throw new Error("doc.external is read-only");\n  }\n\n  get 
filesize() {\n    return this._filesize;\n  }\n\n  set filesize(_) {\n    throw new Error("doc.filesize is 
read-only");\n  }\n\n  get hidden() {\n    return false;\n  }\n\n  set hidden(_) {\n    throw new 
Error("doc.hidden is read-only");\n  }\n\n  get hostContainer() {\n    return undefined;\n  }\n\n  set 
hostContainer(_) {\n    throw new Error("doc.hostContai
 ner is read-only");\n  }\n\n  get icons() {\n    return undefined;\n  }\n\n  set icons(_) {\n    throw new 
Error("doc.icons is read-only");\n  }\n\n  get info() {\n    return this._info;\n  }\n\n  set info(_) {\n    
throw new Error("doc.info is read-only");\n  }\n\n  get innerAppWindowRect() {\n    return [0, 0, 0, 0];\n  
}\n\n  set innerAppWindowRect(_) {\n    throw new Error("doc.innerAppWindowRect is read-only");\n  }\n\n  get 
innerDocWindowRect() {\n    return [0, 0, 0, 0];\n  }\n\n  set innerDocWindowRect(_) {\n    throw new 
Error("doc.innerDocWindowRect is read-only");\n  }\n\n  get isModal() {\n    return false;\n  }\n\n  set 
isModal(_) {\n    throw new Error("doc.isModal is read-only");\n  }\n\n  get keywords() {\n    return 
this._keywords;\n  }\n\n  set keywords(_) {\n    throw new Error("doc.keywords is read-only");\n  }\n\n  get 
layout() {\n    return this._layout;\n  }\n\n  set layout(value) {\n    if (typeof value !== "string") {\n    
  return;\n    }\n\n    if (value !
 == "SinglePage" && value !== "OneColumn" && value !== "TwoColumnLeft" && value !== "TwoPageLeft" && value 
!== "TwoColumnRight" && value !== "TwoPageRight") {\n      value = "SinglePage";\n    }\n\n    this._send({\n 
     command: "layout",\n      value\n    });\n\n    this._layout = value;\n  }\n\n  get media() {\n    
return this._media;\n  }\n\n  set media(media) {\n    this._media = media;\n  }\n\n  get metadata() {\n    
return this._metadata;\n  }\n\n  set metadata(metadata) {\n    this._metadata = metadata;\n  }\n\n  get 
modDate() {\n    return this._modDate;\n  }\n\n  set modDate(_) {\n    throw new Error("doc.modDate is 
read-only");\n  }\n\n  get mouseX() {\n    return 0;\n  }\n\n  set mouseX(_) {\n    throw new 
Error("doc.mouseX is read-only");\n  }\n\n  get mouseY() {\n    return 0;\n  }\n\n  set mouseY(_) {\n    
throw new Error("doc.mouseY is read-only");\n  }\n\n  get noautocomplete() {\n    return 
this._noautocomplete;\n  }\n\n  set noautocomplete(noautocomplete) {\n    t
 his._noautocomplete = noautocomplete;\n  }\n\n  get nocache() {\n    return this._nocache;\n  }\n\n  set 
nocache(nocache) {\n    this._nocache = nocache;\n  }\n\n  get numFields() {\n    return this._numFields;\n  
}\n\n  set numFields(_) {\n    throw new Error("doc.numFields is read-only");\n  }\n\n  get numPages() {\n    
return this._numPages;\n  }\n\n  set numPages(_) {\n    throw new Error("doc.numPages is read-only");\n  
}\n\n  get numTemplates() {\n    return 0;\n  }\n\n  set numTemplates(_) {\n    throw new 
Error("doc.numTemplates is read-only");\n  }\n\n  get outerAppWindowRect() {\n    return [0, 0, 0, 0];\n  
}\n\n  set outerAppWindowRect(_) {\n    throw new Error("doc.outerAppWindowRect is read-only");\n  }\n\n  get 
outerDocWindowRect() {\n    return [0, 0, 0, 0];\n  }\n\n  set outerDocWindowRect(_) {\n    throw new 
Error("doc.outerDocWindowRect is read-only");\n  }\n\n  get pageNum() {\n    return this._pageNum;\n  }\n\n  
set pageNum(value) {\n    if (typeof value !== "num
 ber" || value < 0 || value >= this._numPages) {\n      return;\n    }\n\n    this._send({\n      command: 
"page-num",\n      value\n    });\n\n    this._pageNum = value;\n  }\n\n  get pageWindowRect() {\n    return 
[0, 0, 0, 0];\n  }\n\n  set pageWindowRect(_) {\n    throw new Error("doc.pageWindowRect is read-only");\n  
}\n\n  get path() {\n    return "";\n  }\n\n  set path(_) {\n    throw new Error("doc.path is read-only");\n  
}\n\n  get permStatusReady() {\n    return true;\n  }\n\n  set permStatusReady(_) {\n    throw new 
Error("doc.permStatusReady is read-only");\n  }\n\n  get producer() {\n    return this._producer;\n  }\n\n  
set producer(_) {\n    throw new Error("doc.producer is read-only");\n  }\n\n  get requiresFullSave() {\n    
return false;\n  }\n\n  set requiresFullSave(_) {\n    throw new Error("doc.requiresFullSave is 
read-only");\n  }\n\n  get securityHandler() {\n    return this._securityHandler;\n  }\n\n  set 
securityHandler(_) {\n    throw new Error("doc.securityH
 andler is read-only");\n  }\n\n  get selectedAnnots() {\n    return [];\n  }\n\n  set selectedAnnots(_) {\n  
  throw new Error("doc.selectedAnnots is read-only");\n  }\n\n  get sounds() {\n    return [];\n  }\n\n  set 
sounds(_) {\n    throw new Error("doc.sounds is read-only");\n  }\n\n  get spellDictionaryOrder() {\n    
return this._spellDictionaryOrder;\n  }\n\n  set spellDictionaryOrder(spellDictionaryOrder) {\n    
this._spellDictionaryOrder = spellDictionaryOrder;\n  }\n\n  get spellLanguageOrder() {\n    return 
this._spellLanguageOrder;\n  }\n\n  set spellLanguageOrder(spellLanguageOrder) {\n    
this._spellLanguageOrder = spellLanguageOrder;\n  }\n\n  get subject() {\n    return this._subject;\n  }\n\n  
set subject(_) {\n    throw new Error("doc.subject is read-only");\n  }\n\n  get templates() {\n    return 
[];\n  }\n\n  set templates(_) {\n    throw new Error("doc.templates is read-only");\n  }\n\n  get title() 
{\n    return this._title;\n  }\n\n  set title(_) {\n    throw ne
 w Error("doc.title is read-only");\n  }\n\n  get URL() {\n    return this._URL;\n  }\n\n  set URL(_) {\n    
throw new Error("doc.URL is read-only");\n  }\n\n  get viewState() {\n    return undefined;\n  }\n\n  set 
viewState(_) {\n    throw new Error("doc.viewState is read-only");\n  }\n\n  get xfa() {\n    return 
this._xfa;\n  }\n\n  set xfa(_) {\n    throw new Error("doc.xfa is read-only");\n  }\n\n  get XFAForeground() 
{\n    return false;\n  }\n\n  set XFAForeground(_) {\n    throw new Error("doc.XFAForeground is 
read-only");\n  }\n\n  get zoomType() {\n    return this._zoomType;\n  }\n\n  set zoomType(type) {\n    if 
(typeof type !== "string") {\n      return;\n    }\n\n    switch (type) {\n      case 
_constants.ZoomType.none:\n        this._send({\n          command: "zoom",\n          value: 1\n        
});\n\n        break;\n\n      case _constants.ZoomType.fitP:\n        this._send({\n          command: 
"zoom",\n          value: "page-fit"\n        });\n\n        break;\n\n  
     case _constants.ZoomType.fitW:\n        this._send({\n          command: "zoom",\n          value: 
"page-width"\n        });\n\n        break;\n\n      case _constants.ZoomType.fitH:\n        this._send({\n   
       command: "zoom",\n          value: "page-height"\n        });\n\n        break;\n\n      case 
_constants.ZoomType.fitV:\n        this._send({\n          command: "zoom",\n          value: "auto"\n        
});\n\n        break;\n\n      case _constants.ZoomType.pref:\n      case _constants.ZoomType.refW:\n        
break;\n\n      default:\n        return;\n    }\n\n    this._zoomType = type;\n  }\n\n  get zoom() {\n    
return this._zoom;\n  }\n\n  set zoom(value) {\n    if (typeof value !== "number" || value < 8.33 || value > 
6400) {\n      return;\n    }\n\n    this._send({\n      command: "zoom",\n      value: value / 100\n    
});\n  }\n\n  addAnnot() {}\n\n  addField() {}\n\n  addIcon() {}\n\n  addLink() {}\n\n  
addRecipientListCryptFilter() {}\n\n  addRequirement() 
 {}\n\n  addScript() {}\n\n  addThumbnails() {}\n\n  addWatermarkFromFile() {}\n\n  addWatermarkFromText() 
{}\n\n  addWeblinks() {}\n\n  bringToFront() {}\n\n  calculateNow() {\n    
this._eventDispatcher.calculateNow();\n  }\n\n  closeDoc() {}\n\n  colorConvertPage() {}\n\n  
createDataObject() {}\n\n  createTemplate() {}\n\n  deletePages() {}\n\n  deleteSound() {}\n\n  
embedDocAsDataObject() {}\n\n  embedOutputIntent() {}\n\n  encryptForRecipients() {}\n\n  
encryptUsingPolicy() {}\n\n  exportAsFDF() {}\n\n  exportAsFDFStr() {}\n\n  exportAsText() {}\n\n  
exportAsXFDF() {}\n\n  exportAsXFDFStr() {}\n\n  exportDataObject() {}\n\n  exportXFAData() {}\n\n  
extractPages() {}\n\n  flattenPages() {}\n\n  getAnnot() {}\n\n  getAnnots() {}\n\n  getAnnot3D() {}\n\n  
getAnnots3D() {}\n\n  getColorConvertAction() {}\n\n  getDataObject() {}\n\n  getDataObjectContents() {}\n\n  
getField(cName) {\n    if (typeof cName === "object") {\n      cName = cName.cName;\n    }\n\n    if (typeof 
cName !== "s
 tring") {\n      throw new TypeError("Invalid field name: must be a string");\n    }\n\n    const 
searchedField = this._fields.get(cName);\n\n    if (searchedField) {\n      return searchedField;\n    }\n\n  
  const parts = cName.split("#");\n    let childIndex = NaN;\n\n    if (parts.length === 2) {\n      
childIndex = Math.floor(parseFloat(parts[1]));\n      cName = parts[0];\n    }\n\n    for (const [name, 
field] of this._fields.entries()) {\n      if (name.endsWith(cName)) {\n        if (!isNaN(childIndex)) {\n   
       const children = this._getChildren(name);\n\n          if (childIndex < 0 || childIndex >= 
children.length) {\n            childIndex = 0;\n          }\n\n          if (childIndex < children.length) 
{\n            this._fields.set(cName, children[childIndex]);\n\n            return children[childIndex];\n   
       }\n        }\n\n        this._fields.set(cName, field);\n\n        return field;\n      }\n    }\n\n   
 return null;\n  }\n\n  _getChildren(fieldName) 
 {\n    const len = fieldName.length;\n    const children = [];\n    const pattern = /^\\.[^.]+$/;\n\n    for 
(const [name, field] of this._fields.entries()) {\n      if (name.startsWith(fieldName)) {\n        const 
finalPart = name.slice(len);\n\n        if (finalPart.match(pattern)) {\n          children.push(field);\n    
    }\n      }\n    }\n\n    return children;\n  }\n\n  getIcon() {}\n\n  getLegalWarnings() {}\n\n  
getLinks() {}\n\n  getNthFieldName(nIndex) {\n    if (typeof nIndex === "object") {\n      nIndex = 
nIndex.nIndex;\n    }\n\n    if (typeof nIndex !== "number") {\n      throw new TypeError("Invalid field 
index: must be a number");\n    }\n\n    if (0 <= nIndex && nIndex < this.numFields) {\n      return 
this._fieldNames[Math.trunc(nIndex)];\n    }\n\n    return null;\n  }\n\n  getNthTemplate() {\n    return 
null;\n  }\n\n  getOCGs() {}\n\n  getOCGOrder() {}\n\n  getPageBox() {}\n\n  getPageLabel() {}\n\n  
getPageNthWord() {}\n\n  getPageNthWordQuads() {}\n\n  getP
 ageNumWords() {}\n\n  getPageRotation() {}\n\n  getPageTransition() {}\n\n  getPrintParams() {\n    if 
(!this._printParams) {\n      this._printParams = new _print_params.PrintParams({\n        lastPage: 
this._numPages - 1\n      });\n    }\n\n    return this._printParams;\n  }\n\n  getSound() {}\n\n  
getTemplate() {}\n\n  getURL() {}\n\n  gotoNamedDest() {}\n\n  importAnFDF() {}\n\n  importAnXFDF() {}\n\n  
importDataObject() {}\n\n  importIcon() {}\n\n  importSound() {}\n\n  importTextData() {}\n\n  
importXFAData() {}\n\n  insertPages() {}\n\n  mailDoc() {}\n\n  mailForm() {}\n\n  movePage() {}\n\n  
newPage() {}\n\n  openDataObject() {}\n\n  print(bUI = true, nStart = 0, nEnd = -1, bSilent = false, 
bShrinkToFit = false, bPrintAsImage = false, bReverse = false, bAnnotations = true, printParams = null) {\n   
 if (typeof bUI === "object") {\n      nStart = bUI.nStart;\n      nEnd = bUI.nEnd;\n      bSilent = 
bUI.bSilent;\n      bShrinkToFit = bUI.bShrinkToFit;\n      bPrintAsImage = b
 UI.bPrintAsImage;\n      bReverse = bUI.bReverse;\n      bAnnotations = bUI.bAnnotations;\n      printParams 
= bUI.printParams;\n      bUI = bUI.bUI;\n    }\n\n    if (printParams) {\n      nStart = 
printParams.firstPage;\n      nEnd = printParams.lastPage;\n    }\n\n    if (typeof nStart === "number") {\n  
    nStart = Math.max(0, Math.trunc(nStart));\n    } else {\n      nStart = 0;\n    }\n\n    if (typeof nEnd 
=== "number") {\n      nEnd = Math.max(0, Math.trunc(nEnd));\n    } else {\n      nEnd = -1;\n    }\n\n    
this._send({\n      command: "print",\n      start: nStart,\n      end: nEnd\n    });\n  }\n\n  
removeDataObject() {}\n\n  removeField() {}\n\n  removeIcon() {}\n\n  removeLinks() {}\n\n  
removeRequirement() {}\n\n  removeScript() {}\n\n  removeTemplate() {}\n\n  removeThumbnails() {}\n\n  
removeWeblinks() {}\n\n  replacePages() {}\n\n  resetForm(aFields = null) {\n    if (aFields && 
!Array.isArray(aFields) && typeof aFields === "object") {\n      aFields = aFields.aF
 ields;\n    }\n\n    let mustCalculate = false;\n\n    if (aFields) {\n      for (const fieldName of 
aFields) {\n        if (!fieldName) {\n          continue;\n        }\n\n        const field = 
this.getField(fieldName);\n\n        if (!field) {\n          continue;\n        }\n\n        field.value = 
field.defaultValue;\n        field.valueAsString = field.value;\n        mustCalculate = true;\n      }\n    
} else {\n      mustCalculate = this._fields.size !== 0;\n\n      for (const field of this._fields.values()) 
{\n        field.value = field.defaultValue;\n        field.valueAsString = field.value;\n      }\n    }\n\n  
  if (mustCalculate) {\n      this.calculateNow();\n    }\n  }\n\n  saveAs() {}\n\n  scroll() {}\n\n  
selectPageNthWord() {}\n\n  setAction() {}\n\n  setDataObjectContents() {}\n\n  setOCGOrder() {}\n\n  
setPageAction() {}\n\n  setPageBoxes() {}\n\n  setPageLabels() {}\n\n  setPageRotations() {}\n\n  
setPageTabOrder() {}\n\n  setPageTransitions() {}\n\n  spawnPag
 eFromTemplate() {}\n\n  submitForm() {}\n\n  syncAnnotScan() {}\n\n}\n\nexports.Doc = Doc;\n\n/***/ }),\n/* 
15 */\n/***/ ((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, "__esModule", 
({\n  value: true\n}));\nexports.PrintParams = void 0;\n\nclass PrintParams {\n  constructor(data) {\n    
this.binaryOk = true;\n    this.bitmapDPI = 150;\n    this.booklet = {\n      binding: 0,\n      duplexMode: 
0,\n      subsetFrom: 0,\n      subsetTo: -1\n    };\n    this.colorOverride = 0;\n    this.colorProfile = 
"";\n    this.constants = Object.freeze({\n      bookletBindings: Object.freeze({\n        Left: 0,\n        
Right: 1,\n        LeftTall: 2,\n        RightTall: 3\n      }),\n      bookletDuplexMode: Object.freeze({\n  
      BothSides: 0,\n        FrontSideOnly: 1,\n        BasicSideOnly: 2\n      }),\n      colorOverrides: 
Object.freeze({\n        auto: 0,\n        gray: 1,\n        mono: 2\n      }),\n      fontPolicies: 
Object.freeze({\n        everyPage
 : 0,\n        jobStart: 1,\n        pageRange: 2\n      }),\n      handling: Object.freeze({\n        none: 
0,\n        fit: 1,\n        shrink: 2,\n        tileAll: 3,\n        tileLarge: 4,\n        nUp: 5,\n        
booklet: 6\n      }),\n      interactionLevel: Object.freeze({\n        automatic: 0,\n        full: 1,\n     
   silent: 2\n      }),\n      nUpPageOrders: Object.freeze({\n        Horizontal: 0,\n        
HorizontalReversed: 1,\n        Vertical: 2\n      }),\n      printContents: Object.freeze({\n        doc: 
0,\n        docAndComments: 1,\n        formFieldsOnly: 2\n      }),\n      flagValues: Object.freeze({\n     
   applyOverPrint: 1,\n        applySoftProofSettings: 1 << 1,\n        applyWorkingColorSpaces: 1 << 2,\n    
    emitHalftones: 1 << 3,\n        emitPostScriptXObjects: 1 << 4,\n        emitFormsAsPSForms: 1 << 5,\n    
    maxJP2KRes: 1 << 6,\n        setPageSize: 1 << 7,\n        suppressBG: 1 << 8,\n        suppressCenter: 1 
<< 9,\n        suppressCJKF
 ontSubst: 1 << 10,\n        suppressCropClip: 1 << 1,\n        suppressRotate: 1 << 12,\n        
suppressTransfer: 1 << 13,\n        suppressUCR: 1 << 14,\n        useTrapAnnots: 1 << 15,\n        
usePrintersMarks: 1 << 16\n      }),\n      rasterFlagValues: Object.freeze({\n        textToOutline: 1,\n    
    strokesToOutline: 1 << 1,\n        allowComplexClip: 1 << 2,\n        preserveOverprint: 1 << 3\n      
}),\n      subsets: Object.freeze({\n        all: 0,\n        even: 1,\n        odd: 2\n      }),\n      
tileMarks: Object.freeze({\n        none: 0,\n        west: 1,\n        east: 2\n      }),\n      usages: 
Object.freeze({\n        auto: 0,\n        use: 1,\n        noUse: 2\n      })\n    });\n    
this.downloadFarEastFonts = false;\n    this.fileName = "";\n    this.firstPage = 0;\n    this.flags = 0;\n   
 this.fontPolicy = 0;\n    this.gradientDPI = 150;\n    this.interactive = 1;\n    this.lastPage = 
data.lastPage;\n    this.npUpAutoRotate = false;\n    this.npUpNumPage
 sH = 2;\n    this.npUpNumPagesV = 2;\n    this.npUpPageBorder = false;\n    this.npUpPageOrder = 0;\n    
this.pageHandling = 0;\n    this.pageSubset = 0;\n    this.printAsImage = false;\n    this.printContent = 
0;\n    this.printerName = "";\n    this.psLevel = 0;\n    this.rasterFlags = 0;\n    this.reversePages = 
false;\n    this.tileLabel = false;\n    this.tileMark = 0;\n    this.tileOverlap = 0;\n    this.tileScale = 
1.0;\n    this.transparencyLevel = 75;\n    this.usePrinterCRD = 0;\n    this.useT1Conversion = 0;\n  
}\n\n}\n\nexports.PrintParams = PrintParams;\n\n/***/ }),\n/* 16 */\n/***/ ((__unused_webpack_module, 
exports) => {\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n  value: 
true\n}));\nexports.ProxyHandler = void 0;\n\nclass ProxyHandler {\n  constructor() {\n    this.nosend = new 
Set(["delay"]);\n  }\n\n  get(obj, prop) {\n    if (prop in obj._expandos) {\n      const val = 
obj._expandos[prop];\n\n      if (typeof val === "function") {\n        return val.
 bind(obj);\n      }\n\n      return val;\n    }\n\n    if (typeof prop === "string" && !prop.startsWith("_") 
&& prop in obj) {\n      const val = obj[prop];\n\n      if (typeof val === "function") {\n        return 
val.bind(obj);\n      }\n\n      return val;\n    }\n\n    return undefined;\n  }\n\n  set(obj, prop, value) 
{\n    if (obj._kidIds) {\n      obj._kidIds.forEach(id => {\n        obj._appObjects[id].wrapped[prop] = 
value;\n      });\n    }\n\n    if (typeof prop === "string" && !prop.startsWith("_") && prop in obj) {\n     
 const old = obj[prop];\n      obj[prop] = value;\n\n      if (!this.nosend.has(prop) && obj._send && obj._id 
!== null && typeof old !== "function") {\n        const data = {\n          id: obj._id\n        };\n        
data[prop] = obj[prop];\n\n        if (!obj._siblings) {\n          obj._send(data);\n        } else {\n      
    data.siblings = obj._siblings;\n\n          obj._send(data);\n        }\n      }\n    } else {\n      
obj._expandos[prop] = 
 value;\n    }\n\n    return true;\n  }\n\n  has(obj, prop) {\n    return prop in obj._expandos || typeof 
prop === "string" && !prop.startsWith("_") && prop in obj;\n  }\n\n  getPrototypeOf(obj) {\n    return 
null;\n  }\n\n  setPrototypeOf(obj, proto) {\n    return false;\n  }\n\n  isExtensible(obj) {\n    return 
true;\n  }\n\n  preventExtensions(obj) {\n    return false;\n  }\n\n  getOwnPropertyDescriptor(obj, prop) {\n 
   if (prop in obj._expandos) {\n      return {\n        configurable: true,\n        enumerable: true,\n     
   value: obj._expandos[prop]\n      };\n    }\n\n    if (typeof prop === "string" && !prop.startsWith("_") 
&& prop in obj) {\n      return {\n        configurable: true,\n        enumerable: true,\n        value: 
obj[prop]\n      };\n    }\n\n    return undefined;\n  }\n\n  defineProperty(obj, key, descriptor) {\n    
Object.defineProperty(obj._expandos, key, descriptor);\n    return true;\n  }\n\n  deleteProperty(obj, prop) 
{\n    if (prop in obj._expandos) 
 {\n      delete obj._expandos[prop];\n    }\n  }\n\n  ownKeys(obj) {\n    const fromExpandos = 
Reflect.ownKeys(obj._expandos);\n    const fromObj = Reflect.ownKeys(obj).filter(k => !k.startsWith("_"));\n  
  return fromExpandos.concat(fromObj);\n  }\n\n}\n\nexports.ProxyHandler = ProxyHandler;\n\n/***/ }),\n/* 17 
*/\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, 
"__esModule", ({\n  value: true\n}));\nexports.Util = void 0;\n\nvar _pdf_object = 
__w_pdfjs_require__(7);\n\nclass Util extends _pdf_object.PDFObject {\n  constructor(data) {\n    
super(data);\n    this._scandCache = new Map();\n    this._months = ["January", "February", "March", "April", 
"May", "June", "July", "August", "September", "October", "November", "December"];\n    this._days = 
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];\n    this.MILLISECONDS_IN_DAY 
= 86400000;\n    this.MILLISECONDS_IN_WEEK = 604800000;\n    this._exter
 nalCall = data.externalCall;\n  }\n\n  printf(...args) {\n    if (args.length === 0) {\n      throw new 
Error("Invalid number of params in printf");\n    }\n\n    if (typeof args[0] !== "string") {\n      throw 
new TypeError("First argument of printf must be a string");\n    }\n\n    const pattern = /%(,[0-4])?([+ 
0#]+)?(\\d+)?(\\.\\d+)?(.)/g;\n    const PLUS = 1;\n    const SPACE = 2;\n    const ZERO = 4;\n    const HASH 
= 8;\n    let i = 0;\n    return args[0].replace(pattern, function (match, nDecSep, cFlags, nWidth, 
nPrecision, cConvChar) {\n      if (cConvChar !== "d" && cConvChar !== "f" && cConvChar !== "s" && cConvChar 
!== "x") {\n        const buf = ["%"];\n\n        for (const str of [nDecSep, cFlags, nWidth, nPrecision, 
cConvChar]) {\n          if (str) {\n            buf.push(str);\n          }\n        }\n\n        return 
buf.join("");\n      }\n\n      i++;\n\n      if (i === args.length) {\n        throw new Error("Not enough 
arguments in printf");\n      }\n\n      c
 onst arg = args[i];\n\n      if (cConvChar === "s") {\n        return arg.toString();\n      }\n\n      let 
flags = 0;\n\n      if (cFlags) {\n        for (const flag of cFlags) {\n          switch (flag) {\n          
  case "+":\n              flags |= PLUS;\n              break;\n\n            case " ":\n              flags 
|= SPACE;\n              break;\n\n            case "0":\n              flags |= ZERO;\n              
break;\n\n            case "#":\n              flags |= HASH;\n              break;\n          }\n        }\n 
     }\n\n      cFlags = flags;\n\n      if (nWidth) {\n        nWidth = parseInt(nWidth);\n      }\n\n      
let intPart = Math.trunc(arg);\n\n      if (cConvChar === "x") {\n        let hex = 
Math.abs(intPart).toString(16).toUpperCase();\n\n        if (nWidth !== undefined) {\n          hex = 
hex.padStart(nWidth, cFlags & ZERO ? "0" : " ");\n        }\n\n        if (cFlags & HASH) {\n          hex = 
`0x${hex}`;\n        }\n\n        return hex;\n      
 }\n\n      if (nPrecision) {\n        nPrecision = parseInt(nPrecision.substring(1));\n      }\n\n      
nDecSep = nDecSep ? nDecSep.substring(1) : "0";\n      const separators = {\n        0: [",", "."],\n        
1: ["", "."],\n        2: [".", ","],\n        3: ["", ","],\n        4: ["\'", "."]\n      };\n      const 
[thousandSep, decimalSep] = separators[nDecSep];\n      let decPart = "";\n\n      if (cConvChar === "f") {\n 
       if (nPrecision !== undefined) {\n          decPart = Math.abs(arg - intPart).toFixed(nPrecision);\n    
    } else {\n          decPart = Math.abs(arg - intPart).toString();\n        }\n\n        if 
(decPart.length > 2) {\n          decPart = `${decimalSep}${decPart.substring(2)}`;\n        } else if 
(cFlags & HASH) {\n          decPart = ".";\n        } else {\n          decPart = "";\n        }\n      
}\n\n      let sign = "";\n\n      if (intPart < 0) {\n        sign = "-";\n        intPart = -intPart;\n     
 } else if (cFlags & PLUS) {\n        sign 
 = "+";\n      } else if (cFlags & SPACE) {\n        sign = " ";\n      }\n\n      if (thousandSep && intPart 
= 1000) {\n        const buf = [];\n\n        while (true) {\n          buf.push((intPart % 
1000).toString().padStart(3, "0"));\n          intPart = Math.trunc(intPart / 1000);\n\n          if (intPart 
< 1000) {\n            buf.push(intPart.toString());\n            break;\n          }\n        }\n\n        
intPart = buf.reverse().join(thousandSep);\n      } else {\n        intPart = intPart.toString();\n      
}\n\n      let n = `${intPart}${decPart}`;\n\n      if (nWidth !== undefined) {\n        n = 
n.padStart(nWidth - sign.length, cFlags & ZERO ? "0" : " ");\n      }\n\n      return `${sign}${n}`;\n    
});\n  }\n\n  iconStreamFromIcon() {}\n\n  printd(cFormat, oDate) {\n    switch (cFormat) {\n      case 0:\n  
      return this.printd("D:yyyymmddHHMMss", oDate);\n\n      case 1:\n        return this.printd("yyyy.mm.dd 
HH:MM:ss", oDate);\n\n      case 2:\n        return t
 his.printd("m/d/yy h:MM:ss tt", oDate);\n    }\n\n    const handlers = {\n      mmmm: data => {\n        
return this._months[data.month];\n      },\n      mmm: data => {\n        return 
this._months[data.month].substring(0, 3);\n      },\n      mm: data => {\n        return (data.month + 
1).toString().padStart(2, "0");\n      },\n      m: data => {\n        return (data.month + 1).toString();\n  
    },\n      dddd: data => {\n        return this._days[data.dayOfWeek];\n      },\n      ddd: data => {\n   
     return this._days[data.dayOfWeek].substring(0, 3);\n      },\n      dd: data => {\n        return 
data.day.toString().padStart(2, "0");\n      },\n      d: data => {\n        return data.day.toString();\n    
  },\n      yyyy: data => {\n        return data.year.toString();\n      },\n      yy: data => {\n        
return (data.year % 100).toString().padStart(2, "0");\n      },\n      HH: data => {\n        return 
data.hours.toString().padStart(2, "0");\n      },\n      H: data => 
 {\n        return data.hours.toString();\n      },\n      hh: data => {\n        return (1 + (data.hours + 
11) % 12).toString().padStart(2, "0");\n      },\n      h: data => {\n        return (1 + (data.hours + 11) % 
12).toString();\n      },\n      MM: data => {\n        return data.minutes.toString().padStart(2, "0");\n    
  },\n      M: data => {\n        return data.minutes.toString();\n      },\n      ss: data => {\n        
return data.seconds.toString().padStart(2, "0");\n      },\n      s: data => {\n        return 
data.seconds.toString();\n      },\n      tt: data => {\n        return data.hours < 12 ? "am" : "pm";\n      
},\n      t: data => {\n        return data.hours < 12 ? "a" : "p";\n      }\n    };\n    const data = {\n    
  year: oDate.getFullYear(),\n      month: oDate.getMonth(),\n      day: oDate.getDate(),\n      dayOfWeek: 
oDate.getDay(),\n      hours: oDate.getHours(),\n      minutes: oDate.getMinutes(),\n      seconds: 
oDate.getSeconds()\n    };\n    const pat
 terns = /(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t|\\\\.)/g;\n    return 
cFormat.replace(patterns, function (match, pattern) {\n      if (pattern in handlers) {\n        return 
handlers[pattern](data);\n      }\n\n      return pattern.charCodeAt(1);\n    });\n  }\n\n  printx(cFormat, 
cSource) {\n    const handlers = [x => x, x => x.toUpperCase(), x => x.toLowerCase()];\n    const buf = [];\n 
   let i = 0;\n    const ii = cSource.length;\n    let currCase = handlers[0];\n    let escaped = false;\n\n  
  for (const command of cFormat) {\n      if (escaped) {\n        buf.push(command);\n        escaped = 
false;\n        continue;\n      }\n\n      if (i >= ii) {\n        break;\n      }\n\n      switch (command) 
{\n        case "?":\n          buf.push(currCase(cSource.charAt(i++)));\n          break;\n\n        case 
"X":\n          while (i < ii) {\n            const char = cSource.charAt(i++);\n\n            if ("a" <= 
char && char <= "z" || "A" <= char && char <=
  "Z" || "0" <= char && char <= "9") {\n              buf.push(currCase(char));\n              break;\n       
     }\n          }\n\n          break;\n\n        case "A":\n          while (i < ii) {\n            const 
char = cSource.charAt(i++);\n\n            if ("a" <= char && char <= "z" || "A" <= char && char <= "Z") {\n  
            buf.push(currCase(char));\n              break;\n            }\n          }\n\n          
break;\n\n        case "9":\n          while (i < ii) {\n            const char = cSource.charAt(i++);\n\n    
        if ("0" <= char && char <= "9") {\n              buf.push(char);\n              break;\n            
}\n          }\n\n          break;\n\n        case "*":\n          while (i < ii) {\n            
buf.push(currCase(cSource.charAt(i++)));\n          }\n\n          break;\n\n        case "\\\\":\n          
escaped = true;\n          break;\n\n        case ">":\n          currCase = handlers[1];\n          
break;\n\n        case "<":\n          currC
 ase = handlers[2];\n          break;\n\n        case "=":\n          currCase = handlers[0];\n          
break;\n\n        default:\n          buf.push(command);\n      }\n    }\n\n    return buf.join("");\n  }\n\n 
 scand(cFormat, cDate) {\n    if (cDate === "") {\n      return new Date();\n    }\n\n    switch (cFormat) 
{\n      case 0:\n        return this.scand("D:yyyymmddHHMMss", cDate);\n\n      case 1:\n        return 
this.scand("yyyy.mm.dd HH:MM:ss", cDate);\n\n      case 2:\n        return this.scand("m/d/yy h:MM:ss tt", 
cDate);\n    }\n\n    if (!this._scandCache.has(cFormat)) {\n      const months = this._months;\n      const 
days = this._days;\n      const handlers = {\n        mmmm: {\n          pattern: `(${months.join("|")})`,\n  
        action: (value, data) => {\n            data.month = months.indexOf(value);\n          }\n        
},\n        mmm: {\n          pattern: `(${months.map(month => month.substring(0, 3)).join("|")})`,\n         
 action: (value, data) => {\n
             data.month = months.findIndex(month => month.substring(0, 3) === value);\n          }\n        
},\n        mm: {\n          pattern: `(\\\\d{2})`,\n          action: (value, data) => {\n            
data.month = parseInt(value) - 1;\n          }\n        },\n        m: {\n          pattern: 
`(\\\\d{1,2})`,\n          action: (value, data) => {\n            data.month = parseInt(value) - 1;\n        
  }\n        },\n        dddd: {\n          pattern: `(${days.join("|")})`,\n          action: (value, data) 
=> {\n            data.day = days.indexOf(value);\n          }\n        },\n        ddd: {\n          
pattern: `(${days.map(day => day.substring(0, 3)).join("|")})`,\n          action: (value, data) => {\n       
     data.day = days.findIndex(day => day.substring(0, 3) === value);\n          }\n        },\n        dd: 
{\n          pattern: "(\\\\d{2})",\n          action: (value, data) => {\n            data.day = 
parseInt(value);\n          }\n        },\n        d: {\n
           pattern: "(\\\\d{1,2})",\n          action: (value, data) => {\n            data.day = 
parseInt(value);\n          }\n        },\n        yyyy: {\n          pattern: "(\\\\d{4})",\n          
action: (value, data) => {\n            data.year = parseInt(value);\n          }\n        },\n        yy: 
{\n          pattern: "(\\\\d{2})",\n          action: (value, data) => {\n            data.year = 2000 + 
parseInt(value);\n          }\n        },\n        HH: {\n          pattern: "(\\\\d{2})",\n          action: 
(value, data) => {\n            data.hours = parseInt(value);\n          }\n        },\n        H: {\n        
  pattern: "(\\\\d{1,2})",\n          action: (value, data) => {\n            data.hours = parseInt(value);\n 
         }\n        },\n        hh: {\n          pattern: "(\\\\d{2})",\n          action: (value, data) => 
{\n            data.hours = parseInt(value);\n          }\n        },\n        h: {\n          pattern: 
"(\\\\d{1,2})",\n          action: (value
 , data) => {\n            data.hours = parseInt(value);\n          }\n        },\n        MM: {\n          
pattern: "(\\\\d{2})",\n          action: (value, data) => {\n            data.minutes = parseInt(value);\n   
       }\n        },\n        M: {\n          pattern: "(\\\\d{1,2})",\n          action: (value, data) => 
{\n            data.minutes = parseInt(value);\n          }\n        },\n        ss: {\n          pattern: 
"(\\\\d{2})",\n          action: (value, data) => {\n            data.seconds = parseInt(value);\n          
}\n        },\n        s: {\n          pattern: "(\\\\d{1,2})",\n          action: (value, data) => {\n       
     data.seconds = parseInt(value);\n          }\n        },\n        tt: {\n          pattern: 
"([aApP][mM])",\n          action: (value, data) => {\n            const char = value.charAt(0);\n            
data.am = char === "a" || char === "A";\n          }\n        },\n        t: {\n          pattern: 
"([aApP])",\n          action: (value, dat
 a) => {\n            data.am = value === "a" || value === "A";\n          }\n        }\n      };\n      
const escapedFormat = cFormat.replace(/[.*+\\-?^${}()|[\\]\\\\]/g, "\\\\$&");\n      const patterns = 
/(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t)/g;\n      const actions = [];\n      const re 
= escapedFormat.replace(patterns, function (match, patternElement) {\n        const {\n          pattern,\n   
       action\n        } = handlers[patternElement];\n        actions.push(action);\n        return 
pattern;\n      });\n\n      this._scandCache.set(cFormat, [re, actions]);\n    }\n\n    const [re, actions] 
= this._scandCache.get(cFormat);\n\n    const matches = new RegExp(re, "g").exec(cDate);\n\n    if (!matches 
|| matches.length !== actions.length + 1) {\n      return null;\n    }\n\n    const data = {\n      year: 
0,\n      month: 0,\n      day: 0,\n      hours: 0,\n      minutes: 0,\n      seconds: 0,\n      am: null\n   
 };\n    actions.forEach((action, i) 
 => action(matches[i + 1], data));\n\n    if (data.am !== null) {\n      data.hours = data.hours % 12 + 
(data.am ? 0 : 12);\n    }\n\n    return new Date(data.year, data.month, data.day, data.hours, data.minutes, 
data.seconds);\n  }\n\n  spansToXML() {}\n\n  stringFromStream() {}\n\n  xmlToSpans() {}\n\n}\n\nexports.Util 
= Util;\n\n/***/ })\n/******/ 
\t]);\n/************************************************************************/\n/******/ \t// The module 
cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require 
function\n/******/ \tfunction __w_pdfjs_require__(moduleId) {\n/******/ \t\t// Check if module is in 
cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== 
undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new 
module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = 
{\n/******/ \t\t\t// no module
 .id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ 
\t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, 
module.exports, __w_pdfjs_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the 
module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ 
\t\n/************************************************************************/\nvar __webpack_exports__ = 
{};\n// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the 
chunk.\n(() => {\nvar exports = __webpack_exports__;\n\n\nObject.defineProperty(exports, "__esModule", ({\n  
value: true\n}));\nObject.defineProperty(exports, "initSandbox", ({\n  enumerable: true,\n  get: function () 
{\n    return _initialization.initSandbox;\n  }\n}));\n\nvar _initialization = 
__w_pdfjs_require__(1);\n\nconst pdfjsVersion = \'2.12.313\';\nconst pdfjsBuild = 
\'a2ae56f39\';\n})();\n\n/******
 / \treturn __webpack_exports__;\n/******/ })()\n;\n});'];
     code.push("delete dump;");
     let success = false;
     let buf = 0;
diff --git a/third-party/pdfjs/build/pdf.worker.js b/third-party/pdfjs/build/pdf.worker.js
index f0f620cc9..b58495735 100644
--- a/third-party/pdfjs/build/pdf.worker.js
+++ b/third-party/pdfjs/build/pdf.worker.js
@@ -98,17 +98,7 @@ class WorkerMessageHandler {
       }
 
       testMessageProcessed = true;
-
-      if (!(data instanceof Uint8Array)) {
-        handler.send("test", null);
-        return;
-      }
-
-      const supportTransfers = data[0] === 255;
-      handler.postMessageTransfers = supportTransfers;
-      handler.send("test", {
-        supportTransfers
-      });
+      handler.send("test", data instanceof Uint8Array && data[0] === 255);
     });
     handler.on("configure", function wphConfigure(data) {
       (0, _util.setVerbosityLevel)(data.verbosity);
@@ -125,7 +115,7 @@ class WorkerMessageHandler {
     const WorkerTasks = [];
     const verbosity = (0, _util.getVerbosityLevel)();
     const apiVersion = docParams.apiVersion;
-    const workerVersion = '2.11.338';
+    const workerVersion = '2.12.313';
 
     if (apiVersion !== workerVersion) {
       throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version 
"${workerVersion}".`);
@@ -149,7 +139,6 @@ class WorkerMessageHandler {
     const docBaseUrl = docParams.docBaseUrl;
     const workerHandlerName = docParams.docId + "_worker";
     let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
-    handler.postMessageTransfers = docParams.postMessageTransfers;
 
     function ensureNotTerminated() {
       if (terminated) {
@@ -171,11 +160,8 @@ class WorkerMessageHandler {
       await pdfManager.ensureDoc("checkHeader");
       await pdfManager.ensureDoc("parseStartXRef");
       await pdfManager.ensureDoc("parse", [recoveryMode]);
-
-      if (!recoveryMode) {
-        await pdfManager.ensureDoc("checkFirstPage");
-      }
-
+      await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
+      await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
       const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
 
       if (isPureXfa) {
@@ -200,7 +186,7 @@ class WorkerMessageHandler {
 
       if (source.data) {
         try {
-          newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, 
evaluatorOptions, enableXfa, docBaseUrl);
+          newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, handler, 
evaluatorOptions, enableXfa, docBaseUrl);
           pdfManagerCapability.resolve(newPdfManager);
         } catch (ex) {
           pdfManagerCapability.reject(ex);
@@ -255,7 +241,7 @@ class WorkerMessageHandler {
         }
 
         try {
-          newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, 
evaluatorOptions, enableXfa, docBaseUrl);
+          newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, handler, 
evaluatorOptions, enableXfa, docBaseUrl);
           pdfManagerCapability.resolve(newPdfManager);
         } catch (ex) {
           pdfManagerCapability.reject(ex);
@@ -468,9 +454,6 @@ class WorkerMessageHandler {
         return stream.bytes;
       });
     });
-    handler.on("GetStats", function wphSetupGetStats(data) {
-      return pdfManager.ensureXRef("stats");
-    });
     handler.on("GetAnnotations", function ({
       pageIndex,
       intent
@@ -731,6 +714,7 @@ if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "unde
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException 
= exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag 
= exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = 
exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.IsLittleEndianCached = 
exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = 
exports.FormatError = exports.FontType = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = 
exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = 
exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = 
exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag 
= exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortExce
 ption = void 0;
 exports.arrayByteLength = arrayByteLength;
 exports.arraysToBytes = arraysToBytes;
 exports.assert = assert;
@@ -762,7 +746,6 @@ exports.stringToUTF8String = stringToUTF8String;
 exports.unreachable = unreachable;
 exports.utf8StringToString = utf8StringToString;
 exports.warn = warn;
-exports.VerbosityLevel = exports.Util = exports.UNSUPPORTED_FEATURES = exports.UnknownErrorException = 
exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = 
exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException 
= exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.IsLittleEndianCached = 
exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = 
exports.FormatError = exports.FontType = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = 
exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = 
exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = 
exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag 
= exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortExce
 ption = void 0;
 
 __w_pdfjs_require__(3);
 
@@ -1299,14 +1282,19 @@ class AbortException extends BaseException {
 }
 
 exports.AbortException = AbortException;
-const NullCharactersRegExp = /\x00/g;
+const NullCharactersRegExp = /\x00+/g;
+const InvisibleCharactersRegExp = /[\x01-\x1F]/g;
 
-function removeNullCharacters(str) {
+function removeNullCharacters(str, replaceInvisible = false) {
   if (typeof str !== "string") {
     warn("The argument for removeNullCharacters must be a string.");
     return str;
   }
 
+  if (replaceInvisible) {
+    str = str.replace(InvisibleCharactersRegExp, " ");
+  }
+
   return str.replace(NullCharactersRegExp, "");
 }
 
@@ -1533,6 +1521,75 @@ class Util {
     return result;
   }
 
+  static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
+    const tvalues = [],
+          bounds = [[], []];
+    let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
+
+    for (let i = 0; i < 2; ++i) {
+      if (i === 0) {
+        b = 6 * x0 - 12 * x1 + 6 * x2;
+        a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
+        c = 3 * x1 - 3 * x0;
+      } else {
+        b = 6 * y0 - 12 * y1 + 6 * y2;
+        a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
+        c = 3 * y1 - 3 * y0;
+      }
+
+      if (Math.abs(a) < 1e-12) {
+        if (Math.abs(b) < 1e-12) {
+          continue;
+        }
+
+        t = -c / b;
+
+        if (0 < t && t < 1) {
+          tvalues.push(t);
+        }
+
+        continue;
+      }
+
+      b2ac = b * b - 4 * c * a;
+      sqrtb2ac = Math.sqrt(b2ac);
+
+      if (b2ac < 0) {
+        continue;
+      }
+
+      t1 = (-b + sqrtb2ac) / (2 * a);
+
+      if (0 < t1 && t1 < 1) {
+        tvalues.push(t1);
+      }
+
+      t2 = (-b - sqrtb2ac) / (2 * a);
+
+      if (0 < t2 && t2 < 1) {
+        tvalues.push(t2);
+      }
+    }
+
+    let j = tvalues.length,
+        mt;
+    const jlen = j;
+
+    while (j--) {
+      t = tvalues[j];
+      mt = 1 - t;
+      bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
+      bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
+    }
+
+    bounds[0][jlen] = x0;
+    bounds[1][jlen] = y0;
+    bounds[0][jlen + 1] = x3;
+    bounds[1][jlen + 1] = y3;
+    bounds[0].length = bounds[1].length = jlen + 2;
+    return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
+  }
+
 }
 
 exports.Util = Util;
@@ -1654,7 +1711,7 @@ function createPromiseCapability() {
 }
 
 function createObjectURL(data, contentType = "", forceDataSchema = false) {
-  if (URL.createObjectURL && !forceDataSchema) {
+  if (URL.createObjectURL && typeof Blob !== "undefined" && !forceDataSchema) {
     return URL.createObjectURL(new Blob([data], {
       type: contentType
     }));
@@ -1709,6 +1766,7 @@ exports.isNodeJS = isNodeJS;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd 
= exports.CIRCULAR_REF = void 0;
 exports.clearPrimitiveCaches = clearPrimitiveCaches;
 exports.isCmd = isCmd;
 exports.isDict = isDict;
@@ -1716,12 +1774,13 @@ exports.isName = isName;
 exports.isRef = isRef;
 exports.isRefsEqual = isRefsEqual;
 exports.isStream = isStream;
-exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd 
= void 0;
 
 var _util = __w_pdfjs_require__(2);
 
 var _base_stream = __w_pdfjs_require__(6);
 
+const CIRCULAR_REF = Symbol("CIRCULAR_REF");
+exports.CIRCULAR_REF = CIRCULAR_REF;
 const EOF = Symbol("EOF");
 exports.EOF = EOF;
 
@@ -2314,11 +2373,12 @@ class BasePdfManager {
 }
 
 class LocalPdfManager extends BasePdfManager {
-  constructor(docId, data, password, evaluatorOptions, enableXfa, docBaseUrl) {
+  constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
     super();
     this._docId = docId;
     this._password = password;
     this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
+    this.msgHandler = msgHandler;
     this.evaluatorOptions = evaluatorOptions;
     this.enableXfa = enableXfa;
     const stream = new _stream.Stream(data);
@@ -2505,6 +2565,10 @@ class ChunkedStream extends _stream.Stream {
 
     const chunk = Math.floor(pos / this.chunkSize);
 
+    if (chunk > this.numChunks) {
+      return;
+    }
+
     if (chunk === this.lastSuccessfulEnsureByteChunk) {
       return;
     }
@@ -2525,9 +2589,13 @@ class ChunkedStream extends _stream.Stream {
       return;
     }
 
-    const chunkSize = this.chunkSize;
-    const beginChunk = Math.floor(begin / chunkSize);
-    const endChunk = Math.floor((end - 1) / chunkSize) + 1;
+    const beginChunk = Math.floor(begin / this.chunkSize);
+
+    if (beginChunk > this.numChunks) {
+      return;
+    }
+
+    const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
 
     for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
       if (!this._loadedChunks.has(chunk)) {
@@ -2992,6 +3060,7 @@ exports.ChunkedStreamManager = ChunkedStreamManager;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = 
exports.MissingDataException = exports.DocStats = void 0;
 exports.collectActions = collectActions;
 exports.encodeToXmlString = encodeToXmlString;
 exports.escapePDFName = escapePDFName;
@@ -3007,7 +3076,6 @@ exports.readUint32 = readUint32;
 exports.recoverJsURL = recoverJsURL;
 exports.toRomanNumerals = toRomanNumerals;
 exports.validateCSSFont = validateCSSFont;
-exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = 
exports.MissingDataException = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
@@ -3083,6 +3151,55 @@ class XRefParseException extends _util.BaseException {
 
 exports.XRefParseException = XRefParseException;
 
+class DocStats {
+  constructor(handler) {
+    this._handler = handler;
+    this._streamTypes = new Set();
+    this._fontTypes = new Set();
+  }
+
+  _send() {
+    const streamTypes = Object.create(null),
+          fontTypes = Object.create(null);
+
+    for (const type of this._streamTypes) {
+      streamTypes[type] = true;
+    }
+
+    for (const type of this._fontTypes) {
+      fontTypes[type] = true;
+    }
+
+    this._handler.send("DocStats", {
+      streamTypes,
+      fontTypes
+    });
+  }
+
+  addStreamType(type) {
+    if (this._streamTypes.has(type)) {
+      return;
+    }
+
+    this._streamTypes.add(type);
+
+    this._send();
+  }
+
+  addFontType(type) {
+    if (this._fontTypes.has(type)) {
+      return;
+    }
+
+    this._fontTypes.add(type);
+
+    this._send();
+  }
+
+}
+
+exports.DocStats = DocStats;
+
 function getInheritableProperty({
   dict,
   key,
@@ -3536,7 +3653,7 @@ exports.NullStream = NullStream;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.PDFDocument = exports.Page = void 0;
+exports.Page = exports.PDFDocument = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
@@ -3747,13 +3864,9 @@ class Page {
   }
 
   get xfaData() {
-    if (this.xfaFactory) {
-      return (0, _util.shadow)(this, "xfaData", {
-        bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
-      });
-    }
-
-    return (0, _util.shadow)(this, "xfaData", null);
+    return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
+      bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
+    } : null);
   }
 
   save(handler, task, annotationStorage) {
@@ -3851,7 +3964,7 @@ class Page {
 
       for (const annotation of annotations) {
         if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && 
annotation.mustBePrinted(annotationStorage)) {
-          opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderForms, 
annotationStorage).catch(function (reason) {
+          opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, 
annotationStorage).catch(function (reason) {
             (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: 
"${reason}".`);
             return null;
           }));
@@ -4055,7 +4168,7 @@ class PDFDocument {
     this.pdfManager = pdfManager;
     this.stream = stream;
     this.xref = new _xref.XRef(stream, pdfManager);
-    this._pagePromises = [];
+    this._pagePromises = new Map();
     this._version = null;
     const idCounters = {
       font: 0
@@ -4189,12 +4302,18 @@ class PDFDocument {
   }
 
   get numPages() {
-    if (this.xfaFactory) {
-      return (0, _util.shadow)(this, "numPages", this.xfaFactory.numberPages);
+    let num = 0;
+
+    if (this.catalog.hasActualNumPages) {
+      num = this.catalog.numPages;
+    } else if (this.xfaFactory) {
+      num = this.xfaFactory.getNumPages();
+    } else if (this.linearization) {
+      num = this.linearization.numPages;
+    } else {
+      num = this.catalog.numPages;
     }
 
-    const linearization = this.linearization;
-    const num = linearization ? linearization.numPages : this.catalog.numPages;
     return (0, _util.shadow)(this, "numPages", num);
   }
 
@@ -4294,24 +4413,21 @@ class PDFDocument {
   }
 
   get xfaFactory() {
+    let data;
+
     if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && 
!this.formInfo.hasAcroForm) {
-      const data = this.xfaData;
-      return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
+      data = this.xfaData;
     }
 
-    return (0, _util.shadow)(this, "xfaFaxtory", null);
+    return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
   }
 
   get isPureXfa() {
-    return this.xfaFactory && this.xfaFactory.isValid();
+    return this.xfaFactory ? this.xfaFactory.isValid() : false;
   }
 
   get htmlForXfa() {
-    if (this.xfaFactory) {
-      return this.xfaFactory.getPages();
-    }
-
-    return null;
+    return this.xfaFactory ? this.xfaFactory.getPages() : null;
   }
 
   async loadXfaImages() {
@@ -4483,11 +4599,7 @@ class PDFDocument {
   }
 
   async serializeXfaData(annotationStorage) {
-    if (this.xfaFactory) {
-      return this.xfaFactory.serializeData(annotationStorage);
-    }
-
-    return null;
+    return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
   }
 
   get formInfo() {
@@ -4548,6 +4660,8 @@ class PDFDocument {
 
     const docInfo = {
       PDFFormatVersion: version,
+      Language: this.catalog.lang,
+      EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
       IsLinearized: !!this.linearization,
       IsAcroFormPresent: this.formInfo.hasAcroForm,
       IsXFAPresent: this.formInfo.hasXfa,
@@ -4632,7 +4746,7 @@ class PDFDocument {
     return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? 
hexString(hashModified) : null]);
   }
 
-  _getLinearizationPage(pageIndex) {
+  async _getLinearizationPage(pageIndex) {
     const {
       catalog,
       linearization
@@ -4640,7 +4754,9 @@ class PDFDocument {
 
     const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
 
-    return this.xref.fetchAsync(ref).then(obj => {
+    try {
+      const obj = await this.xref.fetchAsync(ref);
+
       if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && 
obj.has("Contents")) {
         if (ref && !catalog.pageKidsCountCache.has(ref)) {
           catalog.pageKidsCountCache.put(ref, 1);
@@ -4649,42 +4765,36 @@ class PDFDocument {
         return [obj, ref];
       }
 
-      throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page 
dictionary.");
-    }).catch(reason => {
+      throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
+    } catch (reason) {
       (0, _util.info)(reason);
       return catalog.getPageDict(pageIndex);
-    });
+    }
   }
 
   getPage(pageIndex) {
-    if (this._pagePromises[pageIndex] !== undefined) {
-      return this._pagePromises[pageIndex];
+    const cachedPromise = this._pagePromises.get(pageIndex);
+
+    if (cachedPromise) {
+      return cachedPromise;
     }
 
     const {
       catalog,
-      linearization
+      linearization,
+      xfaFactory
     } = this;
+    let promise;
 
-    if (this.xfaFactory) {
-      return Promise.resolve(new Page({
-        pdfManager: this.pdfManager,
-        xref: this.xref,
-        pageIndex,
-        pageDict: _primitives.Dict.empty,
-        ref: null,
-        globalIdFactory: this._globalIdFactory,
-        fontCache: catalog.fontCache,
-        builtInCMapCache: catalog.builtInCMapCache,
-        standardFontDataCache: catalog.standardFontDataCache,
-        globalImageCache: catalog.globalImageCache,
-        nonBlendModesSet: catalog.nonBlendModesSet,
-        xfaFactory: this.xfaFactory
-      }));
+    if (xfaFactory) {
+      promise = Promise.resolve([_primitives.Dict.empty, null]);
+    } else if (linearization && linearization.pageFirst === pageIndex) {
+      promise = this._getLinearizationPage(pageIndex);
+    } else {
+      promise = catalog.getPageDict(pageIndex);
     }
 
-    const promise = linearization && linearization.pageFirst === pageIndex ? 
this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
-    return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => {
+    promise = promise.then(([pageDict, ref]) => {
       return new Page({
         pdfManager: this.pdfManager,
         xref: this.xref,
@@ -4697,19 +4807,109 @@ class PDFDocument {
         standardFontDataCache: catalog.standardFontDataCache,
         globalImageCache: catalog.globalImageCache,
         nonBlendModesSet: catalog.nonBlendModesSet,
-        xfaFactory: null
+        xfaFactory
       });
     });
+
+    this._pagePromises.set(pageIndex, promise);
+
+    return promise;
   }
 
-  checkFirstPage() {
-    return this.getPage(0).catch(async reason => {
+  async checkFirstPage(recoveryMode = false) {
+    if (recoveryMode) {
+      return;
+    }
+
+    try {
+      await this.getPage(0);
+    } catch (reason) {
       if (reason instanceof _core_utils.XRefEntryException) {
-        this._pagePromises.length = 0;
+        this._pagePromises.delete(0);
+
         await this.cleanup();
         throw new _core_utils.XRefParseException();
       }
-    });
+    }
+  }
+
+  async checkLastPage(recoveryMode = false) {
+    const {
+      catalog,
+      pdfManager
+    } = this;
+    catalog.setActualNumPages();
+    let numPages;
+
+    try {
+      await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), 
pdfManager.ensureCatalog("numPages")]);
+
+      if (this.xfaFactory) {
+        return;
+      } else if (this.linearization) {
+        numPages = this.linearization.numPages;
+      } else {
+        numPages = catalog.numPages;
+      }
+
+      if (!Number.isInteger(numPages)) {
+        throw new _util.FormatError("Page count is not an integer.");
+      } else if (numPages <= 1) {
+        return;
+      }
+
+      await this.getPage(numPages - 1);
+    } catch (reason) {
+      this._pagePromises.delete(numPages - 1);
+
+      await this.cleanup();
+
+      if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
+        throw new _core_utils.XRefParseException();
+      }
+
+      (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
+      let pagesTree;
+
+      try {
+        pagesTree = await pdfManager.ensureCatalog("getAllPageDicts", [recoveryMode]);
+      } catch (reasonAll) {
+        if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
+          throw new _core_utils.XRefParseException();
+        }
+
+        catalog.setActualNumPages(1);
+        return;
+      }
+
+      for (const [pageIndex, [pageDict, ref]] of pagesTree) {
+        let promise;
+
+        if (pageDict instanceof Error) {
+          promise = Promise.reject(pageDict);
+          promise.catch(() => {});
+        } else {
+          promise = Promise.resolve(new Page({
+            pdfManager,
+            xref: this.xref,
+            pageIndex,
+            pageDict,
+            ref,
+            globalIdFactory: this._globalIdFactory,
+            fontCache: catalog.fontCache,
+            builtInCMapCache: catalog.builtInCMapCache,
+            standardFontDataCache: catalog.standardFontDataCache,
+            globalImageCache: catalog.globalImageCache,
+            nonBlendModesSet: catalog.nonBlendModesSet,
+            xfaFactory: null
+          }));
+        }
+
+        this._pagePromises.set(pageIndex, promise);
+      }
+
+      catalog.setActualNumPages(pagesTree.size);
+    }
   }
 
   fontFallback(id, handler) {
@@ -5247,11 +5447,11 @@ exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
 exports.getFontType = getFontType;
 exports.normalizeFontName = normalizeFontName;
 exports.recoverGlyphName = recoverGlyphName;
 exports.type1FontGlyphMapping = type1FontGlyphMapping;
-exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
@@ -5420,8 +5620,8 @@ function normalizeFontName(name) {
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.getEncoding = getEncoding;
 exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = 
exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
+exports.getEncoding = getEncoding;
 const ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", 
"dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", 
"parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", 
"zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", 
"sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", 
"threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", 
"dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", 
"osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", 
"parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", 
"Bs
 mall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", 
"Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", 
"Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", 
"Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", 
"hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", 
"threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", 
"twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", 
"fivesuperior", "sixsuperior", "sevensuperi
 or", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", 
"fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", 
"centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", 
"Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", 
"Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", 
"Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", 
"Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", 
"Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
 exports.ExpertEncoding = ExpertEncoding;
 const MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", 
"dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", 
"parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", 
"zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", 
"sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", 
"questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", 
"threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", 
"fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", 
"Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmal
 l", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", 
"Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", 
"colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", 
"Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", 
"Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", 
"Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", 
"Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", 
"Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", 
"seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", 
"osuperior", "fiveinferior", "", "commainferior", "periodinferior", 
 "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", 
"Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", 
"", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", 
"exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", 
"fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", 
"tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", 
"Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", 
"Dotaccentsmall", "Ringsmall", "", "", "", ""];
@@ -17906,8 +18106,8 @@ function reverseIfRtl(chars) {
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.getQuadPoints = getQuadPoints;
 exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = 
void 0;
+exports.getQuadPoints = getQuadPoints;
 
 var _util = __w_pdfjs_require__(2);
 
@@ -17933,6 +18133,8 @@ var _stream = __w_pdfjs_require__(10);
 
 var _writer = __w_pdfjs_require__(71);
 
+var _factory = __w_pdfjs_require__(74);
+
 class AnnotationFactory {
   static create(xref, ref, pdfManager, idFactory, collectFields) {
     return Promise.all([pdfManager.ensureCatalog("acroForm"), collectFields ? this._getPageIndex(xref, ref, 
pdfManager) : -1]).then(([acroForm, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, 
idFactory, acroForm, collectFields, pageIndex]));
@@ -18196,7 +18398,8 @@ class Annotation {
       id: params.id,
       modificationDate: this.modificationDate,
       rect: this.rectangle,
-      subtype: params.subtype
+      subtype: params.subtype,
+      hasOwnCanvas: false
     };
 
     if (params.collectFields) {
@@ -18355,7 +18558,7 @@ class Annotation {
         this.borderStyle.setWidth(array[2], this.rectangle);
 
         if (array.length === 4) {
-          this.borderStyle.setDashArray(array[3]);
+          this.borderStyle.setDashArray(array[3], true);
         }
       }
     } else {
@@ -18391,8 +18594,8 @@ class Annotation {
     this.appearance = normalAppearanceState.get(as.name);
   }
 
-  loadResources(keys) {
-    return this.appearance.dict.getAsync("Resources").then(resources => {
+  loadResources(keys, appearance) {
+    return appearance.dict.getAsync("Resources").then(resources => {
       if (!resources) {
         return undefined;
       }
@@ -18404,21 +18607,28 @@ class Annotation {
     });
   }
 
-  getOperatorList(evaluator, task, renderForms, annotationStorage) {
-    if (!this.appearance) {
-      return Promise.resolve(new _operator_list.OperatorList());
+  getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
+    const data = this.data;
+    let appearance = this.appearance;
+    const isUsingOwnCanvas = data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY;
+
+    if (!appearance) {
+      if (!isUsingOwnCanvas) {
+        return Promise.resolve(new _operator_list.OperatorList());
+      }
+
+      appearance = new _stream.StringStream("");
+      appearance.dict = new _primitives.Dict();
     }
 
-    const appearance = this.appearance;
-    const data = this.data;
     const appearanceDict = appearance.dict;
-    const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", 
"Font"]);
+    const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", 
"Font"], appearance);
     const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
     const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
     const transform = getTransformMatrix(data.rect, bbox, matrix);
     return resourcesPromise.then(resources => {
       const opList = new _operator_list.OperatorList();
-      opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix]);
+      opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
       return evaluator.getOperatorList({
         stream: appearance,
         task,
@@ -18567,7 +18777,7 @@ class AnnotationBorderStyle {
     }
   }
 
-  setDashArray(dashArray) {
+  setDashArray(dashArray, forceStyle = false) {
     if (Array.isArray(dashArray) && dashArray.length > 0) {
       let isValid = true;
       let allZeros = true;
@@ -18585,6 +18795,10 @@ class AnnotationBorderStyle {
 
       if (isValid && !allZeros) {
         this.dashArray = dashArray;
+
+        if (forceStyle) {
+          this.setStyle(_primitives.Name.get("D"));
+        }
       } else {
         this.width = 0;
       }
@@ -18660,6 +18874,10 @@ class MarkupAnnotation extends Annotation {
         this.data.color = null;
       }
     }
+
+    if (dict.has("RC")) {
+      this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
+    }
   }
 
   setCreationDate(creationDate) {
@@ -18850,18 +19068,18 @@ class WidgetAnnotation extends Annotation {
     return !!(this.data.fieldFlags & flag);
   }
 
-  getOperatorList(evaluator, task, renderForms, annotationStorage) {
+  getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
     if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
       return Promise.resolve(new _operator_list.OperatorList());
     }
 
     if (!this._hasText) {
-      return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
+      return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
     }
 
     return this._getAppearance(evaluator, task, annotationStorage).then(content => {
       if (this.appearance && content === null) {
-        return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
+        return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
       }
 
       const operatorList = new _operator_list.OperatorList();
@@ -19311,15 +19529,17 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
     } else if (this.data.radioButton) {
       this._processRadioButton(params);
     } else if (this.data.pushButton) {
+      this.data.hasOwnCanvas = true;
+
       this._processPushButton(params);
     } else {
       (0, _util.warn)("Invalid field flags for button widget annotation");
     }
   }
 
-  async getOperatorList(evaluator, task, renderForms, annotationStorage) {
+  async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
     if (this.data.pushButton) {
-      return super.getOperatorList(evaluator, task, false, annotationStorage);
+      return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
     }
 
     let value = null;
@@ -19331,7 +19551,7 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
 
     if (value === null) {
       if (this.appearance) {
-        return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
+        return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
       }
 
       if (this.data.checkBox) {
@@ -19346,7 +19566,7 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
     if (appearance) {
       const savedAppearance = this.appearance;
       this.appearance = appearance;
-      const operatorList = super.getOperatorList(evaluator, task, renderForms, annotationStorage);
+      const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
       this.appearance = savedAppearance;
       return operatorList;
     }
@@ -19879,6 +20099,10 @@ class PopupAnnotation extends Annotation {
     this.data.titleObj = this._title;
     this.setContents(parentItem.get("Contents"));
     this.data.contentsObj = this._contents;
+
+    if (parentItem.has("RC")) {
+      this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
+    }
   }
 
 }
@@ -19953,6 +20177,10 @@ class SquareAnnotation extends MarkupAnnotation {
 
       const fillAlpha = fillColor ? strokeAlpha : null;
 
+      if (this.borderStyle.width === 0 && !fillColor) {
+        return;
+      }
+
       this._setDefaultAppearance({
         xref: parameters.xref,
         extra: `${this.borderStyle.width} w`,
@@ -19998,6 +20226,11 @@ class CircleAnnotation extends MarkupAnnotation {
       }
 
       const fillAlpha = fillColor ? strokeAlpha : null;
+
+      if (this.borderStyle.width === 0 && !fillColor) {
+        return;
+      }
+
       const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
 
       this._setDefaultAppearance({
@@ -20685,16 +20918,16 @@ class ColorSpace {
 
     if ((0, _primitives.isName)(cs)) {
       switch (cs.name) {
-        case "DeviceGray":
         case "G":
+        case "DeviceGray":
           return this.singletons.gray;
 
-        case "DeviceRGB":
         case "RGB":
+        case "DeviceRGB":
           return this.singletons.rgb;
 
-        case "DeviceCMYK":
         case "CMYK":
+        case "DeviceCMYK":
           return this.singletons.cmyk;
 
         case "Pattern":
@@ -20727,16 +20960,16 @@ class ColorSpace {
       let params, numComps, baseCS, whitePoint, blackPoint, gamma;
 
       switch (mode) {
-        case "DeviceGray":
         case "G":
+        case "DeviceGray":
           return this.singletons.gray;
 
-        case "DeviceRGB":
         case "RGB":
+        case "DeviceRGB":
           return this.singletons.rgb;
 
-        case "DeviceCMYK":
         case "CMYK":
+        case "DeviceCMYK":
           return this.singletons.cmyk;
 
         case "CalGray":
@@ -20789,8 +21022,8 @@ class ColorSpace {
 
           return new PatternCS(baseCS);
 
-        case "Indexed":
         case "I":
+        case "Indexed":
           baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
           const hiVal = xref.fetchIfRef(cs[2]) + 1;
           const lookup = xref.fetchIfRef(cs[3]);
@@ -21103,7 +21336,7 @@ const CalGrayCS = function CalGrayCSClosure() {
     const A = src[srcOffset] * scale;
     const AG = A ** cs.G;
     const L = cs.YW * AG;
-    const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);
+    const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
     dest[destOffset] = val;
     dest[destOffset + 1] = val;
     dest[destOffset + 2] = val;
@@ -21548,6 +21781,8 @@ var _image_utils = __w_pdfjs_require__(58);
 
 var _stream = __w_pdfjs_require__(10);
 
+var _base_stream = __w_pdfjs_require__(6);
+
 var _bidi = __w_pdfjs_require__(59);
 
 var _colorspace = __w_pdfjs_require__(24);
@@ -21990,7 +22225,8 @@ class PartialEvaluator {
       operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
     }
 
-    operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
+    const args = group ? [matrix, null] : [matrix, bbox];
+    operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
     return this.getOperatorList({
       stream: xobj,
       task,
@@ -22031,8 +22267,8 @@ class PartialEvaluator {
   }) {
     const dict = image.dict;
     const imageRef = dict.objId;
-    const w = dict.get("Width", "W");
-    const h = dict.get("Height", "H");
+    const w = dict.get("W", "Width");
+    const h = dict.get("H", "Height");
 
     if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
       (0, _util.warn)("Image dimensions are missing, or not numbers.");
@@ -22056,20 +22292,18 @@ class PartialEvaluator {
       operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
     }
 
-    const imageMask = dict.get("ImageMask", "IM") || false;
-    const interpolate = dict.get("Interpolate", "I");
+    const imageMask = dict.get("IM", "ImageMask") || false;
+    const interpolate = dict.get("I", "Interpolate");
     let imgData, args;
 
     if (imageMask) {
-      const width = dict.get("Width", "W");
-      const height = dict.get("Height", "H");
-      const bitStrideLength = width + 7 >> 3;
-      const imgArray = image.getBytes(bitStrideLength * height, true);
-      const decode = dict.getArray("Decode", "D");
+      const bitStrideLength = w + 7 >> 3;
+      const imgArray = image.getBytes(bitStrideLength * h, true);
+      const decode = dict.getArray("D", "Decode");
       imgData = _image.PDFImage.createMask({
         imgArray,
-        width,
-        height,
+        width: w,
+        height: h,
         imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
         inverseDecode: !!decode && decode[0] > 0,
         interpolate
@@ -22092,7 +22326,7 @@ class PartialEvaluator {
       return;
     }
 
-    const softMask = dict.get("SMask", "SM") || false;
+    const softMask = dict.get("SM", "SMask") || false;
     const mask = dict.get("Mask") || false;
     const SMALL_IMAGE_DIMENSIONS = 200;
 
@@ -22591,8 +22825,7 @@ class PartialEvaluator {
     font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
     this.translateFont(preEvaluatedFont).then(translatedFont => {
       if (translatedFont.fontType !== undefined) {
-        const xrefFontStats = xref.stats.fontTypes;
-        xrefFontStats[translatedFont.fontType] = true;
+        xref.stats.addFontType(translatedFont.fontType);
       }
 
       fontCapability.resolve(new TranslatedFont({
@@ -22611,8 +22844,10 @@ class PartialEvaluator {
         const fontFile3 = descriptor && descriptor.get("FontFile3");
         const subtype = fontFile3 && fontFile3.get("Subtype");
         const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
-        const xrefFontStats = xref.stats.fontTypes;
-        xrefFontStats[fontType] = true;
+
+        if (fontType !== undefined) {
+          xref.stats.addFontType(fontType);
+        }
       } catch (ex) {}
 
       fontCapability.resolve(new TranslatedFont({
@@ -23413,6 +23648,8 @@ class PartialEvaluator {
     resources = resources || _primitives.Dict.empty;
     stateManager = stateManager || new StateManager(new TextState());
     const WhitespaceRegexp = /\s/g;
+    const DiacriticRegExp = new RegExp("^\\p{Mn}$", "u");
+    const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
     const textContent = {
       items: [],
       styles: Object.create(null)
@@ -23425,21 +23662,20 @@ class PartialEvaluator {
       width: 0,
       height: 0,
       vertical: false,
-      lastCharSize: 0,
       prevTransform: null,
       textAdvanceScale: 0,
-      spaceWidth: 0,
       spaceInFlowMin: 0,
       spaceInFlowMax: 0,
       trackingSpaceMin: Infinity,
+      negativeSpaceMax: -Infinity,
       transform: null,
       fontName: null,
-      hasEOL: false,
-      isLastCharWhiteSpace: false
+      hasEOL: false
     };
-    const TRACKING_SPACE_FACTOR = 0.3;
-    const SPACE_IN_FLOW_MIN_FACTOR = 0.3;
-    const SPACE_IN_FLOW_MAX_FACTOR = 1.3;
+    const TRACKING_SPACE_FACTOR = 0.1;
+    const NEGATIVE_SPACE_FACTOR = -0.2;
+    const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
+    const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
     const self = this;
     const xref = this.xref;
     const showSpacedTextBuffer = [];
@@ -23498,19 +23734,10 @@ class PartialEvaluator {
       const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
       const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
       textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
-      textContentItem.lastCharSize = textContentItem.lastCharSize || 0;
-      const spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
-
-      if (spaceWidth) {
-        textContentItem.spaceWidth = spaceWidth;
-        textContentItem.trackingSpaceMin = spaceWidth * TRACKING_SPACE_FACTOR;
-        textContentItem.spaceInFlowMin = spaceWidth * SPACE_IN_FLOW_MIN_FACTOR;
-        textContentItem.spaceInFlowMax = spaceWidth * SPACE_IN_FLOW_MAX_FACTOR;
-      } else {
-        textContentItem.spaceWidth = 0;
-        textContentItem.trackingSpaceMin = Infinity;
-      }
-
+      textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
+      textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
+      textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
+      textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
       textContentItem.hasEOL = false;
       textContentItem.initialized = true;
       return textContentItem;
@@ -23582,38 +23809,69 @@ class PartialEvaluator {
       });
     }
 
-    function compareWithLastPosition(fontSize) {
+    function compareWithLastPosition() {
       if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
         return;
       }
 
       const currentTransform = getCurrentTextTransform();
-      const posX = currentTransform[4];
-      const posY = currentTransform[5];
-      const lastPosX = textContentItem.prevTransform[4];
-      const lastPosY = textContentItem.prevTransform[5];
+      let posX = currentTransform[4];
+      let posY = currentTransform[5];
+      let lastPosX = textContentItem.prevTransform[4];
+      let lastPosY = textContentItem.prevTransform[5];
 
       if (lastPosX === posX && lastPosY === posY) {
         return;
       }
 
-      const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
-      const advanceY = (posY - lastPosY) / textContentItem.textAdvanceScale;
-      const HALF_LAST_CHAR = -0.5 * textContentItem.lastCharSize;
+      let rotate = 0;
+
+      if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
+        rotate = currentTransform[0] > 0 ? 0 : 180;
+      } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
+        rotate += currentTransform[1] > 0 ? 90 : 270;
+      }
+
+      if (rotate !== 0) {
+        switch (rotate) {
+          case 90:
+            [posX, posY] = [posY, posX];
+            [lastPosX, lastPosY] = [lastPosY, lastPosX];
+            break;
+
+          case 180:
+            [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
+            break;
+
+          case 270:
+            [posX, posY] = [-posY, -posX];
+            [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
+            break;
+        }
+      }
 
       if (textState.font.vertical) {
-        if (Math.abs(advanceX) > textContentItem.width / textContentItem.textAdvanceScale) {
-          appendEOL();
+        const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
+        const advanceX = posX - lastPosX;
+
+        if (advanceY < textContentItem.negativeSpaceMax) {
+          if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
+            appendEOL();
+            return;
+          }
+
+          flushTextContentItem();
           return;
         }
 
-        if (HALF_LAST_CHAR > advanceY) {
+        if (Math.abs(advanceX) > textContentItem.height) {
+          appendEOL();
           return;
         }
 
-        if (advanceY > textContentItem.trackingSpaceMin) {
+        if (advanceY <= textContentItem.trackingSpaceMin) {
           textContentItem.height += advanceY;
-        } else if (!addFakeSpaces(advanceY, 0, textContentItem.prevTransform)) {
+        } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform)) {
           if (textContentItem.str.length === 0) {
             textContent.items.push({
               str: " ",
@@ -23624,7 +23882,6 @@ class PartialEvaluator {
               fontName: textContentItem.fontName,
               hasEOL: false
             });
-            textContentItem.isLastCharWhiteSpace = true;
           } else {
             textContentItem.height += advanceY;
           }
@@ -23633,18 +23890,27 @@ class PartialEvaluator {
         return;
       }
 
-      if (Math.abs(advanceY) > textContentItem.height / textContentItem.textAdvanceScale) {
-        appendEOL();
+      const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
+      const advanceY = posY - lastPosY;
+
+      if (advanceX < textContentItem.negativeSpaceMax) {
+        if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
+          appendEOL();
+          return;
+        }
+
+        flushTextContentItem();
         return;
       }
 
-      if (HALF_LAST_CHAR > advanceX) {
+      if (Math.abs(advanceY) > textContentItem.height) {
+        appendEOL();
         return;
       }
 
       if (advanceX <= textContentItem.trackingSpaceMin) {
         textContentItem.width += advanceX;
-      } else if (!addFakeSpaces(advanceX, 0, textContentItem.prevTransform)) {
+      } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform)) {
         if (textContentItem.str.length === 0) {
           textContent.items.push({
             str: " ",
@@ -23655,7 +23921,6 @@ class PartialEvaluator {
             fontName: textContentItem.fontName,
             hasEOL: false
           });
-          textContentItem.isLastCharWhiteSpace = true;
         } else {
           textContentItem.width += advanceX;
         }
@@ -23664,8 +23929,7 @@ class PartialEvaluator {
 
     function buildTextContentItem({
       chars,
-      extraSpacing,
-      isFirstChunk
+      extraSpacing
     }) {
       const font = textState.font;
 
@@ -23676,87 +23940,73 @@ class PartialEvaluator {
           if (!font.vertical) {
             textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
           } else {
-            textState.translateTextMatrix(0, charSpacing);
+            textState.translateTextMatrix(0, -charSpacing);
           }
         }
 
         return;
       }
 
-      const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
       const glyphs = font.charsToGlyphs(chars);
       const scale = textState.fontMatrix[0] * textState.fontSize;
 
-      if (isFirstChunk) {
-        compareWithLastPosition(scale);
-      }
-
-      let textChunk = ensureTextContentItem();
-      let size = 0;
-      let lastCharSize = 0;
-
       for (let i = 0, ii = glyphs.length; i < ii; i++) {
         const glyph = glyphs[i];
-        let charSpacing = textState.charSpacing + (i === ii - 1 ? extraSpacing : 0);
-        let glyphUnicode = glyph.unicode;
+        let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
+        let glyphWidth = glyph.width;
 
-        if (glyph.isSpace) {
-          charSpacing += textState.wordSpacing;
-          textChunk.isLastCharWhiteSpace = true;
-        } else {
-          glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
-          glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
-          textChunk.isLastCharWhiteSpace = false;
+        if (font.vertical) {
+          glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
         }
 
-        textChunk.str.push(glyphUnicode);
-        const glyphWidth = font.vertical && glyph.vmetric ? glyph.vmetric[0] : glyph.width;
         let scaledDim = glyphWidth * scale;
+        let glyphUnicode = glyph.unicode;
+
+        if (glyphUnicode === " " && (i === 0 || i + 1 === ii || glyphs[i - 1].unicode === " " || glyphs[i + 
1].unicode === " " || extraSpacing)) {
+          if (!font.vertical) {
+            charSpacing += scaledDim + textState.wordSpacing;
+            textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
+          } else {
+            charSpacing += -scaledDim + textState.wordSpacing;
+            textState.translateTextMatrix(0, -charSpacing);
+          }
+
+          continue;
+        }
+
+        compareWithLastPosition();
+        const textChunk = ensureTextContentItem();
+
+        if (DiacriticRegExp.test(glyph.unicode)) {
+          scaledDim = 0;
+        }
 
         if (!font.vertical) {
           scaledDim *= textState.textHScale;
           textState.translateTextMatrix(scaledDim, 0);
+          textChunk.width += scaledDim;
         } else {
           textState.translateTextMatrix(0, scaledDim);
           scaledDim = Math.abs(scaledDim);
+          textChunk.height += scaledDim;
         }
 
-        size += scaledDim;
-
-        if (charSpacing) {
-          if (!font.vertical) {
-            charSpacing *= textState.textHScale;
-          }
+        if (scaledDim) {
+          textChunk.prevTransform = getCurrentTextTransform();
+        }
 
-          scaledDim += charSpacing;
-          const wasSplit = charSpacing > textContentItem.trackingSpaceMin && addFakeSpaces(charSpacing, 
size);
+        glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
+        glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
+        textChunk.str.push(glyphUnicode);
 
+        if (charSpacing) {
           if (!font.vertical) {
-            textState.translateTextMatrix(charSpacing, 0);
-          } else {
-            textState.translateTextMatrix(0, charSpacing);
-          }
-
-          if (wasSplit) {
-            textChunk = ensureTextContentItem();
-            size = 0;
+            textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
           } else {
-            size += charSpacing;
+            textState.translateTextMatrix(0, -charSpacing);
           }
         }
-
-        lastCharSize = scaledDim;
-      }
-
-      textChunk.lastCharSize = lastCharSize;
-
-      if (!font.vertical) {
-        textChunk.width += size;
-      } else {
-        textChunk.height += size;
       }
-
-      textChunk.prevTransform = getCurrentTextTransform();
     }
 
     function appendEOL() {
@@ -23774,16 +24024,12 @@ class PartialEvaluator {
           hasEOL: true
         });
       }
-
-      textContentItem.isLastCharWhiteSpace = false;
-      textContentItem.lastCharSize = 0;
     }
 
-    function addFakeSpaces(width, size, transf = null) {
+    function addFakeSpaces(width, transf) {
       if (textContentItem.spaceInFlowMin <= width && width <= textContentItem.spaceInFlowMax) {
         if (textContentItem.initialized) {
           textContentItem.str.push(" ");
-          textContentItem.isLastCharWhiteSpace = true;
         }
 
         return false;
@@ -23791,29 +24037,19 @@ class PartialEvaluator {
 
       const fontName = textContentItem.fontName;
       let height = 0;
-      width *= textContentItem.textAdvanceScale;
 
-      if (!textContentItem.vertical) {
-        textContentItem.width += size;
-      } else {
-        textContentItem.height += size;
+      if (textContentItem.vertical) {
         height = width;
         width = 0;
       }
 
       flushTextContentItem();
-
-      if (textContentItem.isLastCharWhiteSpace) {
-        return true;
-      }
-
-      textContentItem.isLastCharWhiteSpace = true;
       textContent.items.push({
         str: " ",
         dir: "ltr",
         width,
         height,
-        transform: transf ? transf : getCurrentTextTransform(),
+        transform: transf || getCurrentTextTransform(),
         fontName,
         hasEOL: false
       });
@@ -23899,17 +24135,14 @@ class PartialEvaluator {
             return;
 
           case _util.OPS.setTextRise:
-            flushTextContentItem();
             textState.textRise = args[0];
             break;
 
           case _util.OPS.setHScale:
-            flushTextContentItem();
             textState.textHScale = args[0] / 100;
             break;
 
           case _util.OPS.setLeading:
-            flushTextContentItem();
             textState.leading = args[0];
             break;
 
@@ -23919,14 +24152,12 @@ class PartialEvaluator {
             break;
 
           case _util.OPS.setLeadingMoveText:
-            flushTextContentItem();
             textState.leading = -args[1];
             textState.translateTextLineMatrix(args[0], args[1]);
             textState.textMatrix = textState.textLineMatrix.slice();
             break;
 
           case _util.OPS.nextLine:
-            appendEOL();
             textState.carriageReturn();
             break;
 
@@ -23945,7 +24176,6 @@ class PartialEvaluator {
             break;
 
           case _util.OPS.beginText:
-            flushTextContentItem();
             textState.textMatrix = _util.IDENTITY_MATRIX.slice();
             textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
             break;
@@ -23958,7 +24188,6 @@ class PartialEvaluator {
 
             const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
             const elements = args[0];
-            let isFirstChunk = true;
 
             for (let i = 0, ii = elements.length; i < ii - 1; i++) {
               const item = elements[i];
@@ -23970,13 +24199,8 @@ class PartialEvaluator {
                 showSpacedTextBuffer.length = 0;
                 buildTextContentItem({
                   chars: str,
-                  extraSpacing: item * spaceFactor,
-                  isFirstChunk
+                  extraSpacing: item * spaceFactor
                 });
-
-                if (str && isFirstChunk) {
-                  isFirstChunk = false;
-                }
               }
             }
 
@@ -23991,8 +24215,7 @@ class PartialEvaluator {
               showSpacedTextBuffer.length = 0;
               buildTextContentItem({
                 chars: str,
-                extraSpacing: 0,
-                isFirstChunk
+                extraSpacing: 0
               });
             }
 
@@ -24006,8 +24229,7 @@ class PartialEvaluator {
 
             buildTextContentItem({
               chars: args[0],
-              extraSpacing: 0,
-              isFirstChunk: true
+              extraSpacing: 0
             });
             break;
 
@@ -24017,13 +24239,10 @@ class PartialEvaluator {
               continue;
             }
 
-            textContentItem.hasEOL = true;
-            flushTextContentItem();
             textState.carriageReturn();
             buildTextContentItem({
               chars: args[0],
-              extraSpacing: 0,
-              isFirstChunk: true
+              extraSpacing: 0
             });
             break;
 
@@ -24033,15 +24252,12 @@ class PartialEvaluator {
               continue;
             }
 
-            textContentItem.hasEOL = true;
-            flushTextContentItem();
             textState.wordSpacing = args[0];
             textState.charSpacing = args[1];
             textState.carriageReturn();
             buildTextContentItem({
               chars: args[2],
-              extraSpacing: 0,
-              isFirstChunk: true
+              extraSpacing: 0
             });
             break;
 
@@ -24293,7 +24509,7 @@ class PartialEvaluator {
 
       const cidToGidMap = dict.get("CIDToGIDMap");
 
-      if ((0, _primitives.isStream)(cidToGidMap)) {
+      if (cidToGidMap instanceof _base_stream.BaseStream) {
         cidToGidBytes = cidToGidMap.getBytes();
       }
     }
@@ -24893,6 +25109,16 @@ class PartialEvaluator {
 
           hash.update(widthsBuf.join());
         }
+
+        const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
+
+        if (cidToGidMap instanceof _primitives.Name) {
+          hash.update(cidToGidMap.name);
+        } else if (cidToGidMap instanceof _primitives.Ref) {
+          hash.update(cidToGidMap.toString());
+        } else if (cidToGidMap instanceof _base_stream.BaseStream) {
+          hash.update(cidToGidMap.peekBytes());
+        }
       }
     }
 
@@ -25990,7 +26216,14 @@ class CMap {
 
     while (low <= high) {
       this._map[low++] = dstLow;
-      dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
+      const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
+
+      if (nextCharCode > 0xff) {
+        dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 
1) + "\x00";
+        continue;
+      }
+
+      dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
     }
   }
 
@@ -27315,7 +27548,7 @@ class Parser {
       dictLength = stream.pos - lexer.beginInlineImagePos;
     }
 
-    const filter = dict.get("Filter", "F");
+    const filter = dict.get("F", "Filter");
     let filterName;
 
     if ((0, _primitives.isName)(filter)) {
@@ -27331,14 +27564,24 @@ class Parser {
     const startPos = stream.pos;
     let length;
 
-    if (filterName === "DCTDecode" || filterName === "DCT") {
-      length = this.findDCTDecodeInlineStreamEnd(stream);
-    } else if (filterName === "ASCII85Decode" || filterName === "A85") {
-      length = this.findASCII85DecodeInlineStreamEnd(stream);
-    } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") {
-      length = this.findASCIIHexDecodeInlineStreamEnd(stream);
-    } else {
-      length = this.findDefaultInlineStreamEnd(stream);
+    switch (filterName) {
+      case "DCT":
+      case "DCTDecode":
+        length = this.findDCTDecodeInlineStreamEnd(stream);
+        break;
+
+      case "A85":
+      case "ASCII85Decode":
+        length = this.findASCII85DecodeInlineStreamEnd(stream);
+        break;
+
+      case "AHx":
+      case "ASCIIHexDecode":
+        length = this.findASCIIHexDecodeInlineStreamEnd(stream);
+        break;
+
+      default:
+        length = this.findDefaultInlineStreamEnd(stream);
     }
 
     let imageStream = stream.makeSubStream(startPos, length, dict);
@@ -27426,7 +27669,7 @@ class Parser {
     let length = dict.get("Length");
 
     if (!Number.isInteger(length)) {
-      (0, _util.info)(`Bad length "${length}" in stream`);
+      (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
       length = 0;
     }
 
@@ -27486,12 +27729,12 @@ class Parser {
   }
 
   filter(stream, dict, length) {
-    let filter = dict.get("Filter", "F");
-    let params = dict.get("DecodeParms", "DP");
+    let filter = dict.get("F", "Filter");
+    let params = dict.get("DP", "DecodeParms");
 
     if ((0, _primitives.isName)(filter)) {
       if (Array.isArray(params)) {
-        (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name.");
+        (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
       }
 
       return this.makeFilter(stream, filter.name, length, params);
@@ -27530,67 +27773,68 @@ class Parser {
       return new _stream.NullStream();
     }
 
+    const xrefStats = this.xref.stats;
+
     try {
-      const xrefStreamStats = this.xref.stats.streamTypes;
+      switch (name) {
+        case "Fl":
+        case "FlateDecode":
+          xrefStats.addStreamType(_util.StreamType.FLATE);
 
-      if (name === "FlateDecode" || name === "Fl") {
-        xrefStreamStats[_util.StreamType.FLATE] = true;
+          if (params) {
+            return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), 
maybeLength, params);
+          }
 
-        if (params) {
-          return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), 
maybeLength, params);
-        }
+          return new _flate_stream.FlateStream(stream, maybeLength);
 
-        return new _flate_stream.FlateStream(stream, maybeLength);
-      }
+        case "LZW":
+        case "LZWDecode":
+          xrefStats.addStreamType(_util.StreamType.LZW);
+          let earlyChange = 1;
 
-      if (name === "LZWDecode" || name === "LZW") {
-        xrefStreamStats[_util.StreamType.LZW] = true;
-        let earlyChange = 1;
+          if (params) {
+            if (params.has("EarlyChange")) {
+              earlyChange = params.get("EarlyChange");
+            }
 
-        if (params) {
-          if (params.has("EarlyChange")) {
-            earlyChange = params.get("EarlyChange");
+            return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, 
earlyChange), maybeLength, params);
           }
 
-          return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, 
earlyChange), maybeLength, params);
-        }
+          return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
 
-        return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
-      }
+        case "DCT":
+        case "DCTDecode":
+          xrefStats.addStreamType(_util.StreamType.DCT);
+          return new _jpeg_stream.JpegStream(stream, maybeLength, params);
 
-      if (name === "DCTDecode" || name === "DCT") {
-        xrefStreamStats[_util.StreamType.DCT] = true;
-        return new _jpeg_stream.JpegStream(stream, maybeLength, params);
-      }
+        case "JPX":
+        case "JPXDecode":
+          xrefStats.addStreamType(_util.StreamType.JPX);
+          return new _jpx_stream.JpxStream(stream, maybeLength, params);
 
-      if (name === "JPXDecode" || name === "JPX") {
-        xrefStreamStats[_util.StreamType.JPX] = true;
-        return new _jpx_stream.JpxStream(stream, maybeLength, params);
-      }
+        case "A85":
+        case "ASCII85Decode":
+          xrefStats.addStreamType(_util.StreamType.A85);
+          return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
 
-      if (name === "ASCII85Decode" || name === "A85") {
-        xrefStreamStats[_util.StreamType.A85] = true;
-        return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
-      }
-
-      if (name === "ASCIIHexDecode" || name === "AHx") {
-        xrefStreamStats[_util.StreamType.AHX] = true;
-        return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
-      }
+        case "AHx":
+        case "ASCIIHexDecode":
+          xrefStats.addStreamType(_util.StreamType.AHX);
+          return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
 
-      if (name === "CCITTFaxDecode" || name === "CCF") {
-        xrefStreamStats[_util.StreamType.CCF] = true;
-        return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
-      }
+        case "CCF":
+        case "CCITTFaxDecode":
+          xrefStats.addStreamType(_util.StreamType.CCF);
+          return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
 
-      if (name === "RunLengthDecode" || name === "RL") {
-        xrefStreamStats[_util.StreamType.RLX] = true;
-        return new _run_length_stream.RunLengthStream(stream, maybeLength);
-      }
+        case "RL":
+        case "RunLengthDecode":
+          xrefStats.addStreamType(_util.StreamType.RLX);
+          return new _run_length_stream.RunLengthStream(stream, maybeLength);
 
-      if (name === "JBIG2Decode") {
-        xrefStreamStats[_util.StreamType.JBIG] = true;
-        return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
+        case "JBIG2Decode":
+          xrefStats.addStreamType(_util.StreamType.JBIG);
+          return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
       }
 
       (0, _util.warn)(`Filter "${name}" is not supported.`);
@@ -27901,8 +28145,6 @@ class Lexer {
 
     if (strBuf.length > 127) {
       (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
-    } else if (strBuf.length === 0) {
-      (0, _util.warn)("Name token is empty.");
     }
 
     return _primitives.Name.get(strBuf.join(""));
@@ -29078,6 +29320,10 @@ class CCITTFaxDecoder {
       c = 0;
 
       do {
+        if (typeof this.outputBits !== "number") {
+          throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
+        }
+
         if (this.outputBits > bits) {
           c <<= bits;
 
@@ -32339,10 +32585,10 @@ class JpegStream extends _decode_stream.DecodeStream {
       decodeTransform: undefined,
       colorTransform: undefined
     };
-    const decodeArr = this.dict.getArray("Decode", "D");
+    const decodeArr = this.dict.getArray("D", "Decode");
 
     if (this.forceRGB && Array.isArray(decodeArr)) {
-      const bitsPerComponent = this.dict.get("BitsPerComponent") || 8;
+      const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
       const decodeArrLength = decodeArr.length;
       const transform = new Int32Array(decodeArrLength);
       let transformNeeded = false;
@@ -33581,7 +33827,7 @@ class JpegImage {
       y = data[i + 2];
       k = data[i + 3];
       data[offset++] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 
0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m 
- 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * 
(-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * 
k + 0.7430659151342254);
-      data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 
0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * 
m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 
* y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.00031891311758832814 * k + 
0.7364883807733168);
+      data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 
0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * 
m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 
* y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.0003189131175883281 * k + 
0.7364883807733168);
       data[offset++] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 
0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 
* m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * 
(5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k 
+ 0.7063770186160144);
     }
 
@@ -36249,7 +36495,7 @@ class PredictorStream extends _decode_stream.DecodeStream {
     this.str = str;
     this.dict = str.dict;
     const colors = this.colors = params.get("Colors") || 1;
-    const bits = this.bits = params.get("BitsPerComponent") || 8;
+    const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
     const columns = this.columns = params.get("Columns") || 1;
     this.pixBytes = colors * bits + 7 >> 3;
     this.rowBytes = columns * colors * bits + 7 >> 3;
@@ -37695,6 +37941,54 @@ class Font {
         }
 
         hasShortCmap = true;
+      } else if (format === 2) {
+        const subHeaderKeys = [];
+        let maxSubHeaderKey = 0;
+
+        for (let i = 0; i < 256; i++) {
+          const subHeaderKey = file.getUint16() >> 3;
+          subHeaderKeys.push(subHeaderKey);
+          maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
+        }
+
+        const subHeaders = [];
+
+        for (let i = 0; i <= maxSubHeaderKey; i++) {
+          subHeaders.push({
+            firstCode: file.getUint16(),
+            entryCount: file.getUint16(),
+            idDelta: signedInt16(file.getByte(), file.getByte()),
+            idRangePos: file.pos + file.getUint16()
+          });
+        }
+
+        for (let i = 0; i < 256; i++) {
+          if (subHeaderKeys[i] === 0) {
+            file.pos = subHeaders[0].idRangePos + 2 * i;
+            glyphId = file.getUint16();
+            mappings.push({
+              charCode: i,
+              glyphId
+            });
+          } else {
+            const s = subHeaders[subHeaderKeys[i]];
+
+            for (j = 0; j < s.entryCount; j++) {
+              const charCode = (i << 8) + j + s.firstCode;
+              file.pos = s.idRangePos + 2 * j;
+              glyphId = file.getUint16();
+
+              if (glyphId !== 0) {
+                glyphId = (glyphId + s.idDelta) % 65536;
+              }
+
+              mappings.push({
+                charCode,
+                glyphId
+              });
+            }
+          }
+        }
       } else if (format === 4) {
         const segCount = file.getUint16() >> 1;
         file.skip(6);
@@ -41182,8 +41476,9 @@ exports.ExpertSubsetCharset = ExpertSubsetCharset;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = 
exports.getFontNameToFileMap = void 0;
 exports.getStandardFontName = getStandardFontName;
-exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = 
exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = exports.getSerifFonts = 
exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
+exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = 
exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
 
 var _core_utils = __w_pdfjs_require__(9);
 
@@ -45077,8 +45372,8 @@ exports.Type1Parser = Type1Parser;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.getTilingPatternIR = getTilingPatternIR;
 exports.Pattern = void 0;
+exports.getTilingPatternIR = getTilingPatternIR;
 
 var _util = __w_pdfjs_require__(2);
 
@@ -45163,7 +45458,7 @@ class RadialAxialShading extends BaseShading {
     this.shadingType = dict.get("ShadingType");
 
     const cs = _colorspace.ColorSpace.parse({
-      cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
+      cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
       xref,
       resources,
       pdfFunctionFactory,
@@ -45435,7 +45730,7 @@ class MeshShading extends BaseShading {
     }
 
     const cs = _colorspace.ColorSpace.parse({
-      cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
+      cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
       xref,
       resources,
       pdfFunctionFactory,
@@ -46020,8 +46315,8 @@ function getTilingPatternIR(operatorList, dict, color) {
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.isPDFFunction = isPDFFunction;
 exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
+exports.isPDFFunction = isPDFFunction;
 
 var _primitives = __w_pdfjs_require__(5);
 
@@ -48032,7 +48327,7 @@ function bidi(str, startLevel = -1, vertical = false) {
   }
 
   if (startLevel === -1) {
-    if (numBidi / strLength < 0.3) {
+    if (numBidi / strLength < 0.3 && strLength > 4) {
       isLTR = true;
       startLevel = 0;
     } else {
@@ -52050,7 +52345,7 @@ class PDFImage {
   }) {
     this.image = image;
     const dict = image.dict;
-    const filter = dict.get("Filter");
+    const filter = dict.get("F", "Filter");
 
     if ((0, _primitives.isName)(filter)) {
       switch (filter.name) {
@@ -52071,8 +52366,8 @@ class PDFImage {
       }
     }
 
-    let width = dict.get("Width", "W");
-    let height = dict.get("Height", "H");
+    let width = dict.get("W", "Width");
+    let height = dict.get("H", "Height");
 
     if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 
0 && (image.width !== width || image.height !== height)) {
       (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image 
dictionary.");
@@ -52086,13 +52381,13 @@ class PDFImage {
 
     this.width = width;
     this.height = height;
-    this.interpolate = dict.get("Interpolate", "I");
-    this.imageMask = dict.get("ImageMask", "IM") || false;
+    this.interpolate = dict.get("I", "Interpolate");
+    this.imageMask = dict.get("IM", "ImageMask") || false;
     this.matte = dict.get("Matte") || false;
     let bitsPerComponent = image.bitsPerComponent;
 
     if (!bitsPerComponent) {
-      bitsPerComponent = dict.get("BitsPerComponent", "BPC");
+      bitsPerComponent = dict.get("BPC", "BitsPerComponent");
 
       if (!bitsPerComponent) {
         if (this.imageMask) {
@@ -52106,7 +52401,7 @@ class PDFImage {
     this.bpc = bitsPerComponent;
 
     if (!this.imageMask) {
-      let colorSpace = dict.getRaw("ColorSpace") || dict.getRaw("CS");
+      let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
 
       if (!colorSpace) {
         (0, _util.info)("JPX images (which do not require color spaces)");
@@ -52125,7 +52420,7 @@ class PDFImage {
             break;
 
           default:
-            throw new Error(`JPX images with ${image.numComps} ` + "color components not supported.");
+            throw new Error(`JPX images with ${image.numComps} color components not supported.`);
         }
       }
 
@@ -52139,7 +52434,7 @@ class PDFImage {
       this.numComps = this.colorSpace.numComps;
     }
 
-    this.decode = dict.getArray("Decode", "D");
+    this.decode = dict.getArray("D", "Decode");
     this.needsDecode = false;
 
     if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) 
|| isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
@@ -52169,7 +52464,7 @@ class PDFImage {
     } else if (mask) {
       if ((0, _primitives.isStream)(mask)) {
         const maskDict = mask.dict,
-              imageMask = maskDict.get("ImageMask", "IM");
+              imageMask = maskDict.get("IM", "ImageMask");
 
         if (!imageMask) {
           (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
@@ -52658,6 +52953,8 @@ var _util = __w_pdfjs_require__(2);
 
 var _name_number_tree = __w_pdfjs_require__(65);
 
+var _base_stream = __w_pdfjs_require__(6);
+
 var _colorspace = __w_pdfjs_require__(24);
 
 var _file_spec = __w_pdfjs_require__(66);
@@ -52682,10 +52979,12 @@ class Catalog {
     this.xref = xref;
     this._catDict = xref.getCatalogObj();
 
-    if (!(0, _primitives.isDict)(this._catDict)) {
+    if (!(this._catDict instanceof _primitives.Dict)) {
       throw new _util.FormatError("Catalog object is not a dictionary.");
     }
 
+    this.toplevelPagesDict;
+    this._actualNumPages = null;
     this.fontCache = new _primitives.RefSetCache();
     this.builtInCMapCache = new Map();
     this.standardFontDataCache = new Map();
@@ -52698,21 +52997,19 @@ class Catalog {
   get version() {
     const version = this._catDict.get("Version");
 
-    if (!(0, _primitives.isName)(version)) {
-      return (0, _util.shadow)(this, "version", null);
-    }
+    return (0, _util.shadow)(this, "version", version instanceof _primitives.Name ? version.name : null);
+  }
+
+  get lang() {
+    const lang = this._catDict.get("Lang");
 
-    return (0, _util.shadow)(this, "version", version.name);
+    return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : 
null);
   }
 
   get needsRendering() {
     const needsRendering = this._catDict.get("NeedsRendering");
 
-    if (!(0, _util.isBool)(needsRendering)) {
-      return (0, _util.shadow)(this, "needsRendering", false);
-    }
-
-    return (0, _util.shadow)(this, "needsRendering", needsRendering);
+    return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : 
false);
   }
 
   get collection() {
@@ -52764,33 +53061,34 @@ class Catalog {
   get metadata() {
     const streamRef = this._catDict.getRaw("Metadata");
 
-    if (!(0, _primitives.isRef)(streamRef)) {
+    if (!(streamRef instanceof _primitives.Ref)) {
       return (0, _util.shadow)(this, "metadata", null);
     }
 
-    const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
-    const stream = this.xref.fetch(streamRef, suppressEncryption);
     let metadata = null;
 
-    if ((0, _primitives.isStream)(stream) && (0, _primitives.isDict)(stream.dict)) {
-      const type = stream.dict.get("Type");
-      const subtype = stream.dict.get("Subtype");
+    try {
+      const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
+      const stream = this.xref.fetch(streamRef, suppressEncryption);
 
-      if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
-        try {
+      if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
+        const type = stream.dict.get("Type");
+        const subtype = stream.dict.get("Subtype");
+
+        if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
           const data = (0, _util.stringToUTF8String)(stream.getString());
 
           if (data) {
             metadata = new _metadata_parser.MetadataParser(data).serializable;
           }
-        } catch (e) {
-          if (e instanceof _core_utils.MissingDataException) {
-            throw e;
-          }
-
-          (0, _util.info)("Skipping invalid metadata.");
         }
       }
+    } catch (ex) {
+      if (ex instanceof _core_utils.MissingDataException) {
+        throw ex;
+      }
+
+      (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
     }
 
     return (0, _util.shadow)(this, "metadata", metadata);
@@ -53192,14 +53490,26 @@ class Catalog {
     };
   }
 
-  get numPages() {
+  setActualNumPages(num = null) {
+    this._actualNumPages = num;
+  }
+
+  get hasActualNumPages() {
+    return this._actualNumPages !== null;
+  }
+
+  get _pagesCount() {
     const obj = this.toplevelPagesDict.get("Count");
 
     if (!Number.isInteger(obj)) {
       throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
     }
 
-    return (0, _util.shadow)(this, "numPages", obj);
+    return (0, _util.shadow)(this, "_pagesCount", obj);
+  }
+
+  get numPages() {
+    return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
   }
 
   get destinations() {
@@ -53776,21 +54086,27 @@ class Catalog {
 
   getPageDict(pageIndex) {
     const capability = (0, _util.createPromiseCapability)();
-    const nodesToVisit = [this._catDict.getRaw("Pages")];
+    const nodesToVisit = [this.toplevelPagesDict];
     const visitedNodes = new _primitives.RefSet();
+
+    const pagesRef = this._catDict.getRaw("Pages");
+
+    if (pagesRef instanceof _primitives.Ref) {
+      visitedNodes.put(pagesRef);
+    }
+
     const xref = this.xref,
           pageKidsCountCache = this.pageKidsCountCache;
-    let count,
-        currentPageIndex = 0;
+    let currentPageIndex = 0;
 
     function next() {
       while (nodesToVisit.length) {
         const currentNode = nodesToVisit.pop();
 
-        if ((0, _primitives.isRef)(currentNode)) {
-          count = pageKidsCountCache.get(currentNode);
+        if (currentNode instanceof _primitives.Ref) {
+          const count = pageKidsCountCache.get(currentNode);
 
-          if (count > 0 && currentPageIndex + count < pageIndex) {
+          if (count >= 0 && currentPageIndex + count <= pageIndex) {
             currentPageIndex += count;
             continue;
           }
@@ -53803,11 +54119,11 @@ class Catalog {
           visitedNodes.put(currentNode);
           xref.fetchAsync(currentNode).then(function (obj) {
             if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
-              if (pageIndex === currentPageIndex) {
-                if (currentNode && !pageKidsCountCache.has(currentNode)) {
-                  pageKidsCountCache.put(currentNode, 1);
-                }
+              if (currentNode && !pageKidsCountCache.has(currentNode)) {
+                pageKidsCountCache.put(currentNode, 1);
+              }
 
+              if (pageIndex === currentPageIndex) {
                 capability.resolve([obj, currentNode]);
               } else {
                 currentPageIndex++;
@@ -53823,12 +54139,20 @@ class Catalog {
           return;
         }
 
-        if (!(0, _primitives.isDict)(currentNode)) {
+        if (!(currentNode instanceof _primitives.Dict)) {
           capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of 
object."));
           return;
         }
 
-        count = currentNode.get("Count");
+        let count;
+
+        try {
+          count = currentNode.get("Count");
+        } catch (ex) {
+          if (ex instanceof _core_utils.MissingDataException) {
+            throw ex;
+          }
+        }
 
         if (Number.isInteger(count) && count >= 0) {
           const objId = currentNode.objId;
@@ -53843,10 +54167,28 @@ class Catalog {
           }
         }
 
-        const kids = currentNode.get("Kids");
+        let kids;
+
+        try {
+          kids = currentNode.get("Kids");
+        } catch (ex) {
+          if (ex instanceof _core_utils.MissingDataException) {
+            throw ex;
+          }
+        }
 
         if (!Array.isArray(kids)) {
-          if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && 
currentNode.has("Contents")) {
+          let type;
+
+          try {
+            type = currentNode.get("Type");
+          } catch (ex) {
+            if (ex instanceof _core_utils.MissingDataException) {
+              throw ex;
+            }
+          }
+
+          if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Type") && 
currentNode.has("Contents")) {
             if (currentPageIndex === pageIndex) {
               capability.resolve([currentNode, null]);
               return;
@@ -53872,6 +54214,112 @@ class Catalog {
     return capability.promise;
   }
 
+  getAllPageDicts(recoveryMode = false) {
+    const queue = [{
+      currentNode: this.toplevelPagesDict,
+      posInKids: 0
+    }];
+    const visitedNodes = new _primitives.RefSet();
+
+    const pagesRef = this._catDict.getRaw("Pages");
+
+    if (pagesRef instanceof _primitives.Ref) {
+      visitedNodes.put(pagesRef);
+    }
+
+    const map = new Map();
+    let pageIndex = 0;
+
+    function addPageDict(pageDict, pageRef) {
+      map.set(pageIndex++, [pageDict, pageRef]);
+    }
+
+    function addPageError(error) {
+      map.set(pageIndex++, [error, null]);
+    }
+
+    while (queue.length > 0) {
+      const queueItem = queue[queue.length - 1];
+      const {
+        currentNode,
+        posInKids
+      } = queueItem;
+      let kids;
+
+      try {
+        kids = currentNode.get("Kids");
+      } catch (ex) {
+        if (ex instanceof _core_utils.MissingDataException) {
+          throw ex;
+        }
+
+        if (ex instanceof _core_utils.XRefEntryException && !recoveryMode) {
+          throw ex;
+        }
+
+        addPageError(ex);
+        break;
+      }
+
+      if (!Array.isArray(kids)) {
+        addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
+        break;
+      }
+
+      if (posInKids >= kids.length) {
+        queue.pop();
+        continue;
+      }
+
+      const kidObj = kids[posInKids];
+      let obj;
+
+      if (kidObj instanceof _primitives.Ref) {
+        try {
+          obj = this.xref.fetch(kidObj);
+        } catch (ex) {
+          if (ex instanceof _core_utils.MissingDataException) {
+            throw ex;
+          }
+
+          if (ex instanceof _core_utils.XRefEntryException && !recoveryMode) {
+            throw ex;
+          }
+
+          addPageError(ex);
+          break;
+        }
+
+        if (visitedNodes.has(kidObj)) {
+          addPageError(new _util.FormatError("Pages tree contains circular reference."));
+          break;
+        }
+
+        visitedNodes.put(kidObj);
+      } else {
+        obj = kidObj;
+      }
+
+      if (!(obj instanceof _primitives.Dict)) {
+        addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
+        break;
+      }
+
+      if ((0, _primitives.isDict)(obj, "Page") || !obj.has("Kids")) {
+        addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
+      } else {
+        queue.push({
+          currentNode: obj,
+          posInKids: 0
+        });
+      }
+
+      queueItem.posInKids++;
+    }
+
+    return map;
+  }
+
   getPageIndex(pageRef) {
     const cachedPageIndex = this.pageIndexCache.get(pageRef);
 
@@ -55431,6 +55879,12 @@ class StructTreePage {
         obj.alt = (0, _util.stringToPDFString)(alt);
       }
 
+      const lang = node.dict.get("Lang");
+
+      if ((0, _util.isString)(lang)) {
+        obj.lang = (0, _util.stringToPDFString)(lang);
+      }
+
       for (const kid of node.kids) {
         const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
 
@@ -55981,8 +56435,9 @@ function incrementalUpdate({
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = 
exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
 exports.calculateSHA384 = calculateSHA384;
-exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.calculateSHA512 = 
exports.calculateSHA256 = exports.calculateMD5 = exports.ARCFourCipher = exports.AES256Cipher = 
exports.AES128Cipher = void 0;
+exports.calculateSHA512 = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
@@ -57443,6 +57898,7 @@ const CipherTransformFactory = function CipherTransformFactoryClosure() {
         throw new _util.FormatError("unknown encryption method");
       }
 
+      this.filterName = filter.name;
       this.dict = dict;
       const algorithm = dict.get("V");
 
@@ -57645,6 +58101,8 @@ var _util = __w_pdfjs_require__(2);
 
 var _parser = __w_pdfjs_require__(86);
 
+var _xhtml = __w_pdfjs_require__(96);
+
 class XFAFactory {
   constructor(data) {
     try {
@@ -57662,9 +58120,31 @@ class XFAFactory {
     return this.root && this.form;
   }
 
-  _createPages() {
+  _createPagesHelper() {
+    const iterator = this.form[_xfa_object.$toPages]();
+
+    return new Promise((resolve, reject) => {
+      const nextIteration = () => {
+        try {
+          const value = iterator.next();
+
+          if (value.done) {
+            resolve(value.value);
+          } else {
+            setTimeout(nextIteration, 0);
+          }
+        } catch (e) {
+          reject(e);
+        }
+      };
+
+      setTimeout(nextIteration, 0);
+    });
+  }
+
+  async _createPages() {
     try {
-      this.pages = this.form[_xfa_object.$toHTML]();
+      this.pages = await this._createPagesHelper();
       this.dims = this.pages.children.map(c => {
         const {
           width,
@@ -57681,9 +58161,9 @@ class XFAFactory {
     return this.dims[pageIndex];
   }
 
-  get numberPages() {
+  async getNumPages() {
     if (!this.pages) {
-      this._createPages();
+      await this._createPages();
     }
 
     return this.dims.length;
@@ -57718,9 +58198,9 @@ class XFAFactory {
     this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
   }
 
-  getPages() {
+  async getPages() {
     if (!this.pages) {
-      this._createPages();
+      await this._createPages();
     }
 
     const pages = this.pages;
@@ -57740,6 +58220,54 @@ class XFAFactory {
     return Object.values(data).join("");
   }
 
+  static getRichTextAsHtml(rc) {
+    if (!rc || typeof rc !== "string") {
+      return null;
+    }
+
+    try {
+      let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
+
+      if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
+        const newRoot = _xhtml.XhtmlNamespace.body({});
+
+        newRoot[_xfa_object.$appendChild](root);
+
+        root = newRoot;
+      }
+
+      const result = root[_xfa_object.$toHTML]();
+
+      if (!result.success) {
+        return null;
+      }
+
+      const {
+        html
+      } = result;
+      const {
+        attributes
+      } = html;
+
+      if (attributes) {
+        if (attributes.class) {
+          attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
+        }
+
+        attributes.dir = "auto";
+      }
+
+      return {
+        html,
+        str: root[_xfa_object.$text]()
+      };
+    } catch (e) {
+      (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
+    }
+
+    return null;
+  }
+
 }
 
 exports.XFAFactory = XFAFactory;
@@ -57753,7 +58281,7 @@ exports.XFAFactory = XFAFactory;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.XmlObject = exports.XFAObjectArray = exports.XFAObject = exports.XFAAttribute = exports.StringObject 
= exports.OptionObject = exports.Option10 = exports.Option01 = exports.IntegerObject = exports.ContentObject 
= exports.$uid = exports.$toStyle = exports.$toString = exports.$toHTML = exports.$text = exports.$tabIndex = 
exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$searchNode = exports.$root = 
exports.$resolvePrototypes = exports.$removeChild = exports.$pushPara = exports.$pushGlyphs = 
exports.$popPara = exports.$onText = exports.$onChildCheck = exports.$onChild = exports.$nsAttributes = 
exports.$nodeName = exports.$namespaceId = exports.$isUsable = exports.$isTransparent = 
exports.$isThereMoreWidth = exports.$isSplittable = exports.$isNsAgnostic = exports.$isDescendent = 
exports.$isDataValue = exports.$isCDATAXml = exports.$isBindable = exports.$insertAt = exports.$indexOf = 
exports.$ids = exports.$hasSettableValue = exports.$globalData = exports.$
 getTemplateRoot = exports.$getSubformParent = exports.$getRealChildrenByNameIt = exports.$getParent = 
exports.$getNextPage = exports.$getExtra = exports.$getDataValue = exports.$getContainedChildren = 
exports.$getChildrenByNameIt = exports.$getChildrenByName = exports.$getChildrenByClass = 
exports.$getChildren = exports.$getAvailableSpace = exports.$getAttributes = exports.$getAttributeIt = 
exports.$flushHTML = exports.$finalize = exports.$extra = exports.$dump = exports.$data = exports.$content = 
exports.$consumed = exports.$clone = exports.$cleanup = exports.$cleanPage = exports.$clean = 
exports.$childrenToHTML = exports.$appendChild = exports.$addHTML = exports.$acceptWhitespace = void 0;
+exports.XmlObject = exports.XFAObjectArray = exports.XFAObject = exports.XFAAttribute = exports.StringObject 
= exports.OptionObject = exports.Option10 = exports.Option01 = exports.IntegerObject = exports.ContentObject 
= exports.$uid = exports.$toStyle = exports.$toString = exports.$toPages = exports.$toHTML = exports.$text = 
exports.$tabIndex = exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$searchNode = 
exports.$root = exports.$resolvePrototypes = exports.$removeChild = exports.$pushPara = exports.$pushGlyphs = 
exports.$popPara = exports.$onText = exports.$onChildCheck = exports.$onChild = exports.$nsAttributes = 
exports.$nodeName = exports.$namespaceId = exports.$isUsable = exports.$isTransparent = 
exports.$isThereMoreWidth = exports.$isSplittable = exports.$isNsAgnostic = exports.$isDescendent = 
exports.$isDataValue = exports.$isCDATAXml = exports.$isBindable = exports.$insertAt = exports.$indexOf = 
exports.$ids = exports.$hasSettableValue = exports.$glo
 balData = exports.$getTemplateRoot = exports.$getSubformParent = exports.$getRealChildrenByNameIt = 
exports.$getParent = exports.$getNextPage = exports.$getExtra = exports.$getDataValue = 
exports.$getContainedChildren = exports.$getChildrenByNameIt = exports.$getChildrenByName = 
exports.$getChildrenByClass = exports.$getChildren = exports.$getAvailableSpace = exports.$getAttributes = 
exports.$getAttributeIt = exports.$flushHTML = exports.$finalize = exports.$extra = exports.$dump = 
exports.$data = exports.$content = exports.$consumed = exports.$clone = exports.$cleanup = exports.$cleanPage 
= exports.$clean = exports.$childrenToHTML = exports.$appendChild = exports.$addHTML = 
exports.$acceptWhitespace = void 0;
 
 var _utils = __w_pdfjs_require__(76);
 
@@ -57890,6 +58418,8 @@ const $tabIndex = Symbol();
 exports.$tabIndex = $tabIndex;
 const $text = Symbol();
 exports.$text = $text;
+const $toPages = Symbol();
+exports.$toPages = $toPages;
 const $toHTML = Symbol();
 exports.$toHTML = $toHTML;
 const $toString = Symbol();
@@ -58650,11 +59180,13 @@ class XmlObject extends XFAObject {
       return;
     }
 
+    const utf8TagName = (0, _util.utf8StringToString)(tagName);
     const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
-    buf.push(`<${prefix}${tagName}`);
+    buf.push(`<${prefix}${utf8TagName}`);
 
     for (const [name, value] of this[_attributes].entries()) {
-      buf.push(` ${name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
+      const utf8Name = (0, _util.utf8StringToString)(name);
+      buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
     }
 
     if (this[_dataValue] !== null) {
@@ -58684,7 +59216,7 @@ class XmlObject extends XFAObject {
       }
     }
 
-    buf.push(`</${prefix}${tagName}>`);
+    buf.push(`</${prefix}${utf8TagName}>`);
   }
 
   [$onChild](child) {
@@ -58947,6 +59479,7 @@ exports.Option10 = Option10;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.HTMLResult = void 0;
 exports.getBBox = getBBox;
 exports.getColor = getColor;
 exports.getFloat = getFloat;
@@ -58957,7 +59490,6 @@ exports.getRatio = getRatio;
 exports.getRelevant = getRelevant;
 exports.getStringOption = getStringOption;
 exports.stripQuotes = stripQuotes;
-exports.HTMLResult = void 0;
 
 var _util = __w_pdfjs_require__(2);
 
@@ -60189,6 +60721,11 @@ class Binder {
           match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, 
this.emptyMerge).next().value;
 
           if (!match) {
+            if (min === 0) {
+              uselessNodes.push(child);
+              continue;
+            }
+
             const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : 
dataNode[_xfa_object.$namespaceId];
             match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
 
@@ -60262,7 +60799,7 @@ const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
 const MAX_EMPTY_PAGES = 3;
 const DEFAULT_TAB_INDEX = 5000;
 const HEADING_PATTERN = /^H(\d+)$/;
-const MIMES = new Set(["image/gif", "image/jpeg", "image/jpg", "image/pjpeg", "image/png", "image/apng", 
"image/x-png", "image/bmp", "image/x-ms-bmp", "image/tiff", "image/tif"]);
+const MIMES = new Set(["image/gif", "image/jpeg", "image/jpg", "image/pjpeg", "image/png", "image/apng", 
"image/x-png", "image/bmp", "image/x-ms-bmp", "image/tiff", "image/tif", "application/octet-stream"]);
 const IMAGES_HEADERS = [[[0x42, 0x4d], "image/bmp"], [[0xff, 0xd8, 0xff], "image/jpeg"], [[0x49, 0x49, 0x2a, 
0x00], "image/tiff"], [[0x4d, 0x4d, 0x00, 0x2a], "image/tiff"], [[0x47, 0x49, 0x46, 0x38, 0x39, 0x61], 
"image/gif"], [[0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], "image/png"]];
 
 function getBorderDims(node) {
@@ -60497,22 +61034,31 @@ function handleBreak(node) {
   const pageArea = target && target[_xfa_object.$getParent]();
 
   let index;
+  let nextPageArea = pageArea;
 
   if (node.startNew) {
     if (target) {
       const contentAreas = pageArea.contentArea.children;
-      index = contentAreas.findIndex(e => e === target) - 1;
+      const indexForCurrent = contentAreas.indexOf(currentContentArea);
+      const indexForTarget = contentAreas.indexOf(target);
+
+      if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
+        nextPageArea = null;
+      }
+
+      index = indexForTarget - 1;
     } else {
-      index = currentPageArea.contentArea.children.findIndex(e => e === currentContentArea);
+      index = currentPageArea.contentArea.children.indexOf(currentContentArea);
     }
   } else if (target && target !== currentContentArea) {
     const contentAreas = pageArea.contentArea.children;
-    index = contentAreas.findIndex(e => e === target) - 1;
+    index = contentAreas.indexOf(target) - 1;
+    nextPageArea = pageArea === currentPageArea ? null : pageArea;
   } else {
     return false;
   }
 
-  node[_xfa_object.$extra].target = pageArea === currentPageArea ? null : pageArea;
+  node[_xfa_object.$extra].target = nextPageArea;
   node[_xfa_object.$extra].index = index;
   return true;
 }
@@ -60597,7 +61143,7 @@ class Arc extends _xfa_object.XFAObject {
       }
     };
 
-    if (this.startAngle === 0 && this.sweepAngle === 360) {
+    if (this.sweepAngle === 360) {
       arc = {
         name: "ellipse",
         attributes: {
@@ -60612,8 +61158,8 @@ class Arc extends _xfa_object.XFAObject {
     } else {
       const startAngle = this.startAngle * Math.PI / 180;
       const sweepAngle = this.sweepAngle * Math.PI / 180;
-      const largeArc = this.sweepAngle - this.startAngle > 180 ? 1 : 0;
-      const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + 
Math.cos(sweepAngle)), 50 * (1 - Math.sin(sweepAngle))];
+      const largeArc = this.sweepAngle > 180 ? 1 : 0;
+      const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + 
Math.cos(startAngle + sweepAngle)), 50 * (1 - Math.sin(startAngle + sweepAngle))];
       arc = {
         name: "path",
         attributes: {
@@ -64813,6 +65359,10 @@ class Subform extends _xfa_object.XFAObject {
       style.height = (0, _html_utils.measureToString)(height);
     }
 
+    if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
+      return _utils.HTMLResult.EMPTY;
+    }
+
     const html = {
       name: "div",
       attributes,
@@ -64968,7 +65518,7 @@ class Template extends _xfa_object.XFAObject {
     return (0, _som.searchNode)(this, container, expr, true, true);
   }
 
-  [_xfa_object.$toHTML]() {
+  *[_xfa_object.$toPages]() {
     if (!this.subform.children.length) {
       return _utils.HTMLResult.success({
         name: "div",
@@ -65116,7 +65666,7 @@ class Template extends _xfa_object.XFAObject {
           if (html.html) {
             hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
             htmlContentAreas[i].children.push(html.html);
-          } else if (!hasSomething) {
+          } else if (!hasSomething && mainHtml.children.length > 1) {
             mainHtml.children.pop();
           }
 
@@ -65202,6 +65752,7 @@ class Template extends _xfa_object.XFAObject {
       }
 
       pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
+      yield null;
     }
   }
 
@@ -66257,7 +66808,7 @@ function addHTML(node, html, bbox) {
 
     case "tb":
       {
-        extra.width = availableSpace.width;
+        extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
         extra.height += h;
         extra.children.push(html);
         break;
@@ -66755,7 +67306,7 @@ function layoutNode(node, availableSpace) {
 
       let parent = node[_xfa_object.$getParent]();
 
-      while (parent !== root) {
+      while (parent && parent !== root) {
         if (parent.font) {
           font = parent.font;
           break;
@@ -67127,9 +67678,14 @@ function setPara(node, nodeStyle, value) {
 }
 
 function setFontFamily(xfaFont, node, fontFinder, style) {
+  if (!fontFinder) {
+    delete style.fontFamily;
+    return;
+  }
+
   const name = (0, _utils.stripQuotes)(xfaFont.typeface);
-  const typeface = fontFinder.find(name);
   style.fontFamily = `"${name}"`;
+  const typeface = fontFinder.find(name);
 
   if (typeface) {
     const {
@@ -67175,9 +67731,9 @@ function fixURL(str) {
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.FontFinder = void 0;
 exports.getMetrics = getMetrics;
 exports.selectFont = selectFont;
-exports.FontFinder = void 0;
 
 var _xfa_object = __w_pdfjs_require__(75);
 
@@ -67740,9 +68296,9 @@ var _builder = __w_pdfjs_require__(87);
 var _util = __w_pdfjs_require__(2);
 
 class XFAParser extends _xml_parser.XMLParserBase {
-  constructor() {
+  constructor(rootNameSpace = null, richText = false) {
     super();
-    this._builder = new _builder.Builder();
+    this._builder = new _builder.Builder(rootNameSpace);
     this._stack = [];
     this._globalData = {
       usedTypefaces: new Set()
@@ -67752,6 +68308,7 @@ class XFAParser extends _xml_parser.XMLParserBase {
     this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
     this._whiteRegex = /^\s+$/;
     this._nbsps = /\xa0+/g;
+    this._richText = richText;
   }
 
   parse(data) {
@@ -67769,8 +68326,8 @@ class XFAParser extends _xml_parser.XMLParserBase {
   onText(text) {
     text = text.replace(this._nbsps, match => match.slice(1) + " ");
 
-    if (this._current[_xfa_object.$acceptWhitespace]()) {
-      this._current[_xfa_object.$onText](text);
+    if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
+      this._current[_xfa_object.$onText](text, this._richText);
 
       return;
     }
@@ -67973,7 +68530,7 @@ class Empty extends _xfa_object.XFAObject {
 }
 
 class Builder {
-  constructor() {
+  constructor(rootNameSpace = null) {
     this._namespaceStack = [];
     this._nsAgnosticLevel = 0;
     this._namespacePrefixes = new Map();
@@ -67981,7 +68538,7 @@ class Builder {
     this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
       id
     }) => id));
-    this._currentNamespace = new _unknown.UnknownNamespace(++this._nextNsId);
+    this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
   }
 
   buildRoot(ids) {
@@ -70852,15 +71409,17 @@ var _html_utils = __w_pdfjs_require__(82);
 var _utils = __w_pdfjs_require__(76);
 
 const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
+const $richText = Symbol();
 const VALID_STYLES = new Set(["color", "font", "font-family", "font-size", "font-stretch", "font-style", 
"font-weight", "margin", "margin-bottom", "margin-left", "margin-right", "margin-top", "letter-spacing", 
"line-height", "orphans", "page-break-after", "page-break-before", "page-break-inside", "tab-interval", 
"tab-stop", "text-align", "text-decoration", "text-indent", "vertical-align", "widows", "kerning-mode", 
"xfa-font-horizontal-scale", "xfa-font-vertical-scale", "xfa-spacerun", "xfa-tab-stops"]);
 const StyleMapping = new Map([["page-break-after", "breakAfter"], ["page-break-before", "breakBefore"], 
["page-break-inside", "breakInside"], ["kerning-mode", value => value === "none" ? "none" : "normal"], 
["xfa-font-horizontal-scale", value => `scaleX(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], 
["xfa-font-vertical-scale", value => `scaleY(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], 
["xfa-spacerun", ""], ["xfa-tab-stops", ""], ["font-size", (value, original) => {
   value = original.fontSize = (0, _utils.getMeasurement)(value);
   return (0, _html_utils.measureToString)(0.99 * value);
-}], ["letter-spacing", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], 
["line-height", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin", 
value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-bottom", value => (0, 
_html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-left", value => (0, 
_html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-right", value => (0, 
_html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-top", value => (0, 
_html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["text-indent", value => (0, 
_html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["font-family", value => value]]);
+}], ["letter-spacing", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], 
["line-height", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin", 
value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-bottom", value => (0, 
_html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-left", value => (0, 
_html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-right", value => (0, 
_html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-top", value => (0, 
_html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["text-indent", value => (0, 
_html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["font-family", value => value], 
["vertical-align", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))]]);
 const spacesRegExp = /\s+/g;
 const crlfRegExp = /[\r\n]+/g;
+const crlfForRichTextRegExp = /\r\n?/g;
 
-function mapStyle(styleStr, node) {
+function mapStyle(styleStr, node, richText) {
   const style = Object.create(null);
 
   if (!styleStr) {
@@ -70906,6 +71465,14 @@ function mapStyle(styleStr, node) {
     }, node, node[_xfa_object.$globalData].fontFinder, style);
   }
 
+  if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
+    const SUB_SUPER_SCRIPT_FACTOR = 0.583;
+    const VERTICAL_FACTOR = 0.333;
+    const fontSize = (0, _utils.getMeasurement)(style.fontSize);
+    style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
+    style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, 
_utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
+  }
+
   (0, _html_utils.fixTextIndent)(style);
   return style;
 }
@@ -70929,6 +71496,7 @@ const NoWhites = new Set(["body", "html"]);
 class XhtmlObject extends _xfa_object.XmlObject {
   constructor(attributes, name) {
     super(XHTML_NS_ID, name);
+    this[$richText] = false;
     this.style = attributes.style || "";
   }
 
@@ -70942,11 +71510,15 @@ class XhtmlObject extends _xfa_object.XmlObject {
     return !NoWhites.has(this[_xfa_object.$nodeName]);
   }
 
-  [_xfa_object.$onText](str) {
-    str = str.replace(crlfRegExp, "");
+  [_xfa_object.$onText](str, richText = false) {
+    if (!richText) {
+      str = str.replace(crlfRegExp, "");
 
-    if (!this.style.includes("xfa-spacerun:yes")) {
-      str = str.replace(spacesRegExp, " ");
+      if (!this.style.includes("xfa-spacerun:yes")) {
+        str = str.replace(spacesRegExp, " ");
+      }
+    } else {
+      this[$richText] = true;
     }
 
     if (str) {
@@ -71069,14 +71641,22 @@ class XhtmlObject extends _xfa_object.XmlObject {
       return _utils.HTMLResult.EMPTY;
     }
 
+    let value;
+
+    if (this[$richText]) {
+      value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : 
undefined;
+    } else {
+      value = this[_xfa_object.$content] || undefined;
+    }
+
     return _utils.HTMLResult.success({
       name: this[_xfa_object.$nodeName],
       attributes: {
         href: this.href,
-        style: mapStyle(this.style, this)
+        style: mapStyle(this.style, this, this[$richText])
       },
       children,
-      value: this[_xfa_object.$content] || ""
+      value
     });
   }
 
@@ -71240,6 +71820,12 @@ class P extends XhtmlObject {
   }
 
   [_xfa_object.$text]() {
+    const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
+
+    if (siblings[siblings.length - 1] === this) {
+      return super[_xfa_object.$text]();
+    }
+
     return super[_xfa_object.$text]() + "\n";
   }
 
@@ -71381,9 +71967,11 @@ var _util = __w_pdfjs_require__(2);
 
 var _primitives = __w_pdfjs_require__(5);
 
+var _core_utils = __w_pdfjs_require__(9);
+
 var _parser = __w_pdfjs_require__(27);
 
-var _core_utils = __w_pdfjs_require__(9);
+var _base_stream = __w_pdfjs_require__(6);
 
 var _crypto = __w_pdfjs_require__(72);
 
@@ -71394,10 +71982,8 @@ class XRef {
     this.entries = [];
     this.xrefstms = Object.create(null);
     this._cacheMap = new Map();
-    this.stats = {
-      streamTypes: Object.create(null),
-      fontTypes: Object.create(null)
-    };
+    this._pendingRefs = new _primitives.RefSet();
+    this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
     this._newRefNum = null;
   }
 
@@ -71441,7 +72027,7 @@ class XRef {
       (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
     }
 
-    if ((0, _primitives.isDict)(encrypt)) {
+    if (encrypt instanceof _primitives.Dict) {
       const ids = trailerDict.get("ID");
       const fileId = ids && ids.length ? ids[0] : "";
       encrypt.suppressEncryption = true;
@@ -71460,15 +72046,28 @@ class XRef {
       (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
     }
 
-    if ((0, _primitives.isDict)(root) && root.has("Pages")) {
-      this.root = root;
-    } else {
-      if (!recoveryMode) {
-        throw new _core_utils.XRefParseException();
+    if (root instanceof _primitives.Dict) {
+      try {
+        const pages = root.get("Pages");
+
+        if (pages instanceof _primitives.Dict) {
+          this.root = root;
+          return;
+        }
+      } catch (ex) {
+        if (ex instanceof _core_utils.MissingDataException) {
+          throw ex;
+        }
+
+        (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
       }
+    }
 
-      throw new _util.FormatError("Invalid root reference");
+    if (!recoveryMode) {
+      throw new _core_utils.XRefParseException();
     }
+
+    throw new _util.InvalidPDFException("Invalid Root reference.");
   }
 
   processXRefTable(parser) {
@@ -71489,11 +72088,11 @@ class XRef {
 
     let dict = parser.getObj();
 
-    if (!(0, _primitives.isDict)(dict) && dict.dict) {
+    if (!(dict instanceof _primitives.Dict) && dict.dict) {
       dict = dict.dict;
     }
 
-    if (!(0, _primitives.isDict)(dict)) {
+    if (!(dict instanceof _primitives.Dict)) {
       throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
     }
 
@@ -71600,18 +72199,13 @@ class XRef {
   }
 
   readXRefStream(stream) {
-    let i, j;
     const streamState = this.streamState;
     stream.pos = streamState.streamPos;
-    const byteWidths = streamState.byteWidths;
-    const typeFieldWidth = byteWidths[0];
-    const offsetFieldWidth = byteWidths[1];
-    const generationFieldWidth = byteWidths[2];
+    const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
     const entryRanges = streamState.entryRanges;
 
     while (entryRanges.length > 0) {
-      const first = entryRanges[0];
-      const n = entryRanges[1];
+      const [first, n] = entryRanges;
 
       if (!Number.isInteger(first) || !Number.isInteger(n)) {
         throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
@@ -71621,27 +72215,45 @@ class XRef {
         throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
       }
 
-      for (i = streamState.entryNum; i < n; ++i) {
+      for (let i = streamState.entryNum; i < n; ++i) {
         streamState.entryNum = i;
         streamState.streamPos = stream.pos;
         let type = 0,
             offset = 0,
             generation = 0;
 
-        for (j = 0; j < typeFieldWidth; ++j) {
-          type = type << 8 | stream.getByte();
+        for (let j = 0; j < typeFieldWidth; ++j) {
+          const typeByte = stream.getByte();
+
+          if (typeByte === -1) {
+            throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
+          }
+
+          type = type << 8 | typeByte;
         }
 
         if (typeFieldWidth === 0) {
           type = 1;
         }
 
-        for (j = 0; j < offsetFieldWidth; ++j) {
-          offset = offset << 8 | stream.getByte();
+        for (let j = 0; j < offsetFieldWidth; ++j) {
+          const offsetByte = stream.getByte();
+
+          if (offsetByte === -1) {
+            throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
+          }
+
+          offset = offset << 8 | offsetByte;
         }
 
-        for (j = 0; j < generationFieldWidth; ++j) {
-          generation = generation << 8 | stream.getByte();
+        for (let j = 0; j < generationFieldWidth; ++j) {
+          const generationByte = stream.getByte();
+
+          if (generationByte === -1) {
+            throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
+          }
+
+          generation = generation << 8 | generationByte;
         }
 
         const entry = {};
@@ -71731,6 +72343,9 @@ class XRef {
     const objBytes = new Uint8Array([111, 98, 106]);
     const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
     this.entries.length = 0;
+
+    this._cacheMap.clear();
+
     const stream = this.stream;
     stream.pos = 0;
     const buffer = stream.getBytes(),
@@ -71862,7 +72477,7 @@ class XRef {
 
       const dict = parser.getObj();
 
-      if (!(0, _primitives.isDict)(dict)) {
+      if (!(dict instanceof _primitives.Dict)) {
         continue;
       }
 
@@ -71899,6 +72514,10 @@ class XRef {
       return trailerDict;
     }
 
+    if (this.topDict) {
+      return this.topDict;
+    }
+
     throw new _util.InvalidPDFException("Invalid PDF structure.");
   }
 
@@ -71944,7 +72563,7 @@ class XRef {
             }
           }
         } else if (Number.isInteger(obj)) {
-          if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !(0, 
_primitives.isStream)(obj = parser.getObj())) {
+          if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || 
!((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
             throw new _util.FormatError("Invalid XRef stream");
           }
 
@@ -71965,7 +72584,7 @@ class XRef {
 
         if (Number.isInteger(obj)) {
           this.startXRefQueue.push(obj);
-        } else if ((0, _primitives.isRef)(obj)) {
+        } else if (obj instanceof _primitives.Ref) {
           this.startXRefQueue.push(obj.num);
         }
 
@@ -71979,6 +72598,7 @@ class XRef {
       }
 
       (0, _util.info)("(while reading XRef): " + e);
+      this.startXRefQueue.shift();
     }
 
     if (recoveryMode) {
@@ -72031,15 +72651,32 @@ class XRef {
       return xrefEntry;
     }
 
-    if (xrefEntry.uncompressed) {
-      xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
-    } else {
-      xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
+    if (this._pendingRefs.has(ref)) {
+      this._pendingRefs.remove(ref);
+
+      (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
+      return _primitives.CIRCULAR_REF;
+    }
+
+    this._pendingRefs.put(ref);
+
+    try {
+      if (xrefEntry.uncompressed) {
+        xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
+      } else {
+        xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
+      }
+
+      this._pendingRefs.remove(ref);
+    } catch (ex) {
+      this._pendingRefs.remove(ref);
+
+      throw ex;
     }
 
-    if ((0, _primitives.isDict)(xrefEntry)) {
+    if (xrefEntry instanceof _primitives.Dict) {
       xrefEntry.objId = ref.toString();
-    } else if ((0, _primitives.isStream)(xrefEntry)) {
+    } else if (xrefEntry instanceof _base_stream.BaseStream) {
       xrefEntry.dict.objId = ref.toString();
     }
 
@@ -72086,7 +72723,7 @@ class XRef {
       xrefEntry = parser.getObj();
     }
 
-    if (!(0, _primitives.isStream)(xrefEntry)) {
+    if (!(xrefEntry instanceof _base_stream.BaseStream)) {
       this._cacheMap.set(num, xrefEntry);
     }
 
@@ -72097,7 +72734,7 @@ class XRef {
     const tableOffset = xrefEntry.offset;
     const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
 
-    if (!(0, _primitives.isStream)(stream)) {
+    if (!(stream instanceof _base_stream.BaseStream)) {
       throw new _util.FormatError("bad ObjStm stream");
     }
 
@@ -72151,7 +72788,7 @@ class XRef {
       const obj = parser.getObj();
       entries[i] = obj;
 
-      if ((0, _primitives.isStream)(obj)) {
+      if (obj instanceof _base_stream.BaseStream) {
         continue;
       }
 
@@ -72265,7 +72902,6 @@ class MessageHandler {
     this.comObj = comObj;
     this.callbackId = 1;
     this.streamId = 1;
-    this.postMessageTransfers = true;
     this.streamSinks = Object.create(null);
     this.streamControllers = Object.create(null);
     this.callbackCapabilities = Object.create(null);
@@ -72359,7 +72995,7 @@ class MessageHandler {
   }
 
   send(actionName, data, transfers) {
-    this._postMessage({
+    this.comObj.postMessage({
       sourceName: this.sourceName,
       targetName: this.targetName,
       action: actionName,
@@ -72373,7 +73009,7 @@ class MessageHandler {
     this.callbackCapabilities[callbackId] = capability;
 
     try {
-      this._postMessage({
+      this.comObj.postMessage({
         sourceName: this.sourceName,
         targetName: this.targetName,
         action: actionName,
@@ -72402,8 +73038,7 @@ class MessageHandler {
           cancelCall: null,
           isClosed: false
         };
-
-        this._postMessage({
+        comObj.postMessage({
           sourceName,
           targetName,
           action: actionName,
@@ -72411,7 +73046,6 @@ class MessageHandler {
           data,
           desiredSize: controller.desiredSize
         }, transfers);
-
         return startCapability.promise;
       },
       pull: controller => {
@@ -72464,7 +73098,7 @@ class MessageHandler {
           this.ready = this.sinkCapability.promise;
         }
 
-        self._postMessage({
+        comObj.postMessage({
           sourceName,
           targetName,
           stream: StreamKind.ENQUEUE,
@@ -72683,14 +73317,6 @@ class MessageHandler {
     delete this.streamControllers[streamId];
   }
 
-  _postMessage(message, transfers) {
-    if (transfers && this.postMessageTransfers) {
-      this.comObj.postMessage(message, transfers);
-    } else {
-      this.comObj.postMessage(message);
-    }
-  }
-
   destroy() {
     this.comObj.removeEventListener("message", this._onComObjOnMessage);
   }
@@ -72924,8 +73550,8 @@ Object.defineProperty(exports, "WorkerMessageHandler", ({
 
 var _worker = __w_pdfjs_require__(1);
 
-const pdfjsVersion = '2.11.338';
-const pdfjsBuild = 'dedff3c98';
+const pdfjsVersion = '2.12.313';
+const pdfjsBuild = 'a2ae56f39';
 })();
 
 /******/       return __webpack_exports__;
diff --git a/third-party/pdfjs/epiphany-pdfjs-changes.patch b/third-party/pdfjs/epiphany-pdfjs-changes.patch
index 7aaa00971..e6ad67746 100644
--- a/third-party/pdfjs/epiphany-pdfjs-changes.patch
+++ b/third-party/pdfjs/epiphany-pdfjs-changes.patch
@@ -1,5 +1,5 @@
 diff --git a/third-party/pdfjs/web/viewer.css b/third-party/pdfjs/web/viewer.css
-index 0d87d30df..81a09f7f5 100644
+index c5f0bcb1e..f8fc94ad1 100644
 --- a/third-party/pdfjs/web/viewer.css
 +++ b/third-party/pdfjs/web/viewer.css
 @@ -1,4 +1,5 @@
@@ -8,7 +8,7 @@ index 0d87d30df..81a09f7f5 100644
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
-@@ -1694,6 +1695,7 @@ html[dir="rtl"] .dropdownToolbarButton::after {
+@@ -1720,6 +1721,7 @@ html[dir="rtl"] .dropdownToolbarButton::after {
  }
  
  .dropdownToolbarButton > select {
@@ -16,7 +16,7 @@ index 0d87d30df..81a09f7f5 100644
    width: calc(var(--scale-select-container-width) + var(--scale-select-overflow));
    height: 28px;
    font-size: 12px;
-@@ -2067,6 +2069,7 @@ html[dir="rtl"] .toolbarField[type="checkbox"] {
+@@ -2098,6 +2100,7 @@ html[dir="rtl"] .toolbarField[type="checkbox"] {
  }
  
  .toolbarField.pageNumber {
@@ -25,7 +25,7 @@ index 0d87d30df..81a09f7f5 100644
    min-width: 16px;
    text-align: right;
 diff --git a/third-party/pdfjs/web/viewer.html b/third-party/pdfjs/web/viewer.html
-index 503b810ba..db9b7427a 100644
+index efbd58391..bb2068cd1 100644
 --- a/third-party/pdfjs/web/viewer.html
 +++ b/third-party/pdfjs/web/viewer.html
 @@ -1,6 +1,7 @@
@@ -61,7 +61,7 @@ index 503b810ba..db9b7427a 100644
                <span data-l10n-id="bookmark_label">Current View</span>
              </a>
  
-@@ -237,7 +238,7 @@ See https://github.com/adobe-type-tools/cmap-resources
+@@ -240,7 +241,7 @@ See https://github.com/adobe-type-tools/cmap-resources
                  <button id="download" class="toolbarButton download hiddenMediumView" title="Download" 
tabindex="34" data-l10n-id="download">
                    <span data-l10n-id="download_label">Download</span>
                  </button>
@@ -71,7 +71,7 @@ index 503b810ba..db9b7427a 100644
                  </a>
  
 diff --git a/third-party/pdfjs/web/viewer.js b/third-party/pdfjs/web/viewer.js
-index c7fd413a0..cad44eeb1 100644
+index 74f538450..c11421eaf 100644
 --- a/third-party/pdfjs/web/viewer.js
 +++ b/third-party/pdfjs/web/viewer.js
 @@ -3,6 +3,7 @@
@@ -82,7 +82,7 @@ index c7fd413a0..cad44eeb1 100644
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
-@@ -2236,8 +2237,7 @@ function webViewerInitialized() {
+@@ -2242,8 +2243,7 @@ function webViewerInitialized() {
    let file;
    const queryString = document.location.search.substring(1);
    const params = (0, _ui_utils.parseQueryString)(queryString);
@@ -92,7 +92,7 @@ index c7fd413a0..cad44eeb1 100644
    const fileInput = document.createElement("input");
    fileInput.id = appConfig.openFileInputName;
    fileInput.className = "fileInput";
-@@ -2245,12 +2245,8 @@ function webViewerInitialized() {
+@@ -2251,12 +2251,8 @@ function webViewerInitialized() {
    fileInput.oncontextmenu = _ui_utils.noContextMenuHandler;
    document.body.appendChild(fileInput);
  
@@ -107,11 +107,10 @@ index c7fd413a0..cad44eeb1 100644
  
    fileInput.addEventListener("change", function (evt) {
      const files = evt.target.files;
-@@ -2311,9 +2307,19 @@ function webViewerInitialized() {
-       });
+@@ -2318,8 +2314,18 @@ function webViewerInitialized() {
      }
    }, true);
-+  
+ 
 +  var file_name = document.head.getAttribute('pdf_name')
 +  var raw = atob(document.head.getAttribute('pdf_data'));
 +  var raw_length = raw.length;
@@ -120,7 +119,7 @@ index c7fd413a0..cad44eeb1 100644
 +  for(var i = 0; i < raw_length; i++) {
 +    array[i] = raw.charCodeAt(i);
 +  }
- 
++
    try {
 -    webViewerOpenFileViaURL(file);
 +    PDFViewerApplication.open(array);
@@ -128,7 +127,7 @@ index c7fd413a0..cad44eeb1 100644
    } catch (reason) {
      PDFViewerApplication.l10n.get("loading_error").then(msg => {
        PDFViewerApplication._documentError(msg, reason);
-@@ -6376,6 +6382,8 @@ class PDFHistory {
+@@ -6209,6 +6215,8 @@ class PDFHistory {
        }
      }
  
@@ -137,7 +136,7 @@ index c7fd413a0..cad44eeb1 100644
      if (shouldReplace) {
        window.history.replaceState(newState, "", newUrl);
      } else {
-@@ -15620,4 +15628,4 @@ if (document.readyState === "interactive" || document.readyState === "complete")
+@@ -15661,4 +15669,4 @@ if (document.readyState === "interactive" || document.readyState === "complete")
  
  /******/ })()
  ;
diff --git a/third-party/pdfjs/pdfjs.gresource.xml b/third-party/pdfjs/pdfjs.gresource.xml
index 1769fb55c..5289308c0 100644
--- a/third-party/pdfjs/pdfjs.gresource.xml
+++ b/third-party/pdfjs/pdfjs.gresource.xml
@@ -201,6 +201,7 @@
                <file compressed="true">web/images/secondaryToolbarButton-rotateCcw.svg</file>
                <file compressed="true">web/images/secondaryToolbarButton-rotateCw.svg</file>
                <file compressed="true">web/images/secondaryToolbarButton-scrollHorizontal.svg</file>
+               <file compressed="true">web/images/secondaryToolbarButton-scrollPage.svg</file>
                <file compressed="true">web/images/secondaryToolbarButton-scrollVertical.svg</file>
                <file compressed="true">web/images/secondaryToolbarButton-scrollWrapped.svg</file>
                <file compressed="true">web/images/secondaryToolbarButton-selectTool.svg</file>
@@ -311,6 +312,8 @@
                <file compressed="true">web/locale/rm/viewer.properties</file>
                <file compressed="true">web/locale/ro/viewer.properties</file>
                <file compressed="true">web/locale/ru/viewer.properties</file>
+               <file compressed="true">web/locale/sat/viewer.properties</file>
+               <file compressed="true">web/locale/sc/viewer.properties</file>
                <file compressed="true">web/locale/scn/viewer.properties</file>
                <file compressed="true">web/locale/sco/viewer.properties</file>
                <file compressed="true">web/locale/si/viewer.properties</file>
diff --git a/third-party/pdfjs/web/debugger.js b/third-party/pdfjs/web/debugger.js
index 7849cc4fb..9686807e4 100644
--- a/third-party/pdfjs/web/debugger.js
+++ b/third-party/pdfjs/web/debugger.js
@@ -292,6 +292,7 @@ const Stepper = (function StepperClosure() {
       this.breakPoints = initialBreakPoints;
       this.currentIdx = -1;
       this.operatorListIdx = 0;
+      this.indentLevel = 0;
     }
 
     init(operatorList) {
@@ -382,8 +383,14 @@ const Stepper = (function StepperClosure() {
           table.appendChild(charCodeRow);
           table.appendChild(fontCharRow);
           table.appendChild(unicodeRow);
+        } else if (fn === "restore") {
+          this.indentLevel--;
         }
-        line.appendChild(c("td", fn));
+        line.appendChild(c("td", " ".repeat(this.indentLevel * 2) + fn));
+        if (fn === "save") {
+          this.indentLevel++;
+        }
+
         if (decArgs instanceof HTMLElement) {
           line.appendChild(decArgs);
         } else {
@@ -455,9 +462,7 @@ const Stepper = (function StepperClosure() {
 var Stats = (function Stats() {
   let stats = [];
   function clear(node) {
-    while (node.hasChildNodes()) {
-      node.removeChild(node.lastChild);
-    }
+    node.textContent = ""; // Remove any `node` contents from the DOM.
   }
   function getStatIndex(pageNumber) {
     for (let i = 0, ii = stats.length; i < ii; ++i) {
@@ -483,8 +488,7 @@ var Stats = (function Stats() {
       }
       const statsIndex = getStatIndex(pageNumber);
       if (statsIndex !== false) {
-        const b = stats[statsIndex];
-        this.panel.removeChild(b.div);
+        stats[statsIndex].div.remove();
         stats.splice(statsIndex, 1);
       }
       const wrapper = document.createElement("div");
diff --git a/third-party/pdfjs/web/images/secondaryToolbarButton-scrollPage.svg 
b/third-party/pdfjs/web/images/secondaryToolbarButton-scrollPage.svg
new file mode 100644
index 000000000..bea2f0d67
--- /dev/null
+++ b/third-party/pdfjs/web/images/secondaryToolbarButton-scrollPage.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg"; height="16" width="16"><path d="M9.5 4c1 0 1.5.5 1.5 1.5v5c0 1-.5 
1.5-1.5 1.5h-3c-1 0-1.5-.5-1.5-1.5v-5C5 4.5 5.5 4 6.5 4z"/></svg>
\ No newline at end of file
diff --git a/third-party/pdfjs/web/locale/be/viewer.properties 
b/third-party/pdfjs/web/locale/be/viewer.properties
index fc82c27a4..ec3002ce6 100644
--- a/third-party/pdfjs/web/locale/be/viewer.properties
+++ b/third-party/pdfjs/web/locale/be/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Прылада выбару тэксту
 cursor_hand_tool.title=Уключыць ручную прыладу
 cursor_hand_tool_label=Ручная прылада
 
+scroll_page.title=Выкарыстоўваць пракрутку старонкi
+scroll_page_label=Пракрутка старонкi
 scroll_vertical.title=Ужываць вертыкальную пракрутку
 scroll_vertical_label=Вертыкальная пракрутка
 scroll_horizontal.title=Ужываць гарызантальную пракрутку
diff --git a/third-party/pdfjs/web/locale/cs/viewer.properties 
b/third-party/pdfjs/web/locale/cs/viewer.properties
index 894cc5eb4..341172cac 100644
--- a/third-party/pdfjs/web/locale/cs/viewer.properties
+++ b/third-party/pdfjs/web/locale/cs/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Výběr textu
 cursor_hand_tool.title=Povolí nástroj ručička
 cursor_hand_tool_label=Nástroj ručička
 
+scroll_page.title=Posouvat po stránkách
+scroll_page_label=Posouvání po stránkách
 scroll_vertical.title=Použít svislé posouvání
 scroll_vertical_label=Svislé posouvání
 scroll_horizontal.title=Použít vodorovné posouvání
diff --git a/third-party/pdfjs/web/locale/cy/viewer.properties 
b/third-party/pdfjs/web/locale/cy/viewer.properties
index 3a8757185..d9c705963 100644
--- a/third-party/pdfjs/web/locale/cy/viewer.properties
+++ b/third-party/pdfjs/web/locale/cy/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Offeryn Dewis Testun
 cursor_hand_tool.title=Galluogi Offeryn Llaw
 cursor_hand_tool_label=Offeryn Llaw
 
+scroll_page.title=Defnyddio Sgrolio Tudalen
+scroll_page_label=Sgrolio Tudalen
 scroll_vertical.title=Defnyddio Sgrolio Fertigol
 scroll_vertical_label=Sgrolio Fertigol
 scroll_horizontal.title=Defnyddio Sgrolio Llorweddol
diff --git a/third-party/pdfjs/web/locale/da/viewer.properties 
b/third-party/pdfjs/web/locale/da/viewer.properties
index 7e0c40fe4..a67fedc70 100644
--- a/third-party/pdfjs/web/locale/da/viewer.properties
+++ b/third-party/pdfjs/web/locale/da/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Markeringsværktøj
 cursor_hand_tool.title=Aktiver håndværktøj
 cursor_hand_tool_label=Håndværktøj
 
+scroll_page.title=Brug sidescrolling
+scroll_page_label=Sidescrolling
 scroll_vertical.title=Brug vertikal scrolling
 scroll_vertical_label=Vertikal scrolling
 scroll_horizontal.title=Brug horisontal scrolling
diff --git a/third-party/pdfjs/web/locale/de/viewer.properties 
b/third-party/pdfjs/web/locale/de/viewer.properties
index b380d5672..1cda13f3d 100644
--- a/third-party/pdfjs/web/locale/de/viewer.properties
+++ b/third-party/pdfjs/web/locale/de/viewer.properties
@@ -61,11 +61,13 @@ cursor_text_select_tool_label=Textauswahl-Werkzeug
 cursor_hand_tool.title=Hand-Werkzeug aktivieren
 cursor_hand_tool_label=Hand-Werkzeug
 
+scroll_page.title=Seiten einzeln anordnen
+scroll_page_label=Einzelseitenanordnung
 scroll_vertical.title=Seiten übereinander anordnen
 scroll_vertical_label=Vertikale Seitenanordnung
 scroll_horizontal.title=Seiten nebeneinander anordnen
 scroll_horizontal_label=Horizontale Seitenanordnung
-scroll_wrapped.title=Seiten neben- und übereinander anordnen, anhängig vom Platz
+scroll_wrapped.title=Seiten neben- und übereinander anordnen, abhängig vom Platz
 scroll_wrapped_label=Kombinierte Seitenanordnung
 
 spread_none.title=Seiten nicht nebeneinander anzeigen
diff --git a/third-party/pdfjs/web/locale/dsb/viewer.properties 
b/third-party/pdfjs/web/locale/dsb/viewer.properties
index fd8e2798d..00fe87333 100644
--- a/third-party/pdfjs/web/locale/dsb/viewer.properties
+++ b/third-party/pdfjs/web/locale/dsb/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Rěd za wuběranje teksta
 cursor_hand_tool.title=Rucny rěd zmóžniś
 cursor_hand_tool_label=Rucny rěd
 
+scroll_page.title=Kulanje boka wužywaś
+scroll_page_label=Kulanje boka
 scroll_vertical.title=Wertikalne suwanje wužywaś
 scroll_vertical_label=Wertikalnje suwanje
 scroll_horizontal.title=Horicontalne suwanje wužywaś
diff --git a/third-party/pdfjs/web/locale/el/viewer.properties 
b/third-party/pdfjs/web/locale/el/viewer.properties
index 13538be8a..2525b3bce 100644
--- a/third-party/pdfjs/web/locale/el/viewer.properties
+++ b/third-party/pdfjs/web/locale/el/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Εργαλείο επιλογής κειμένου
 cursor_hand_tool.title=Ενεργοποίηση εργαλείου χεριού
 cursor_hand_tool_label=Εργαλείο χεριού
 
+scroll_page.title=Χρήση κύλισης σελίδας
+scroll_page_label=Κύλιση σελίδας
 scroll_vertical.title=Χρήση κάθετης κύλισης
 scroll_vertical_label=Κάθετη κύλιση
 scroll_horizontal.title=Χρήση οριζόντιας κύλισης
diff --git a/third-party/pdfjs/web/locale/en-CA/viewer.properties 
b/third-party/pdfjs/web/locale/en-CA/viewer.properties
index a3c6823a8..d14ab52af 100644
--- a/third-party/pdfjs/web/locale/en-CA/viewer.properties
+++ b/third-party/pdfjs/web/locale/en-CA/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Text Selection Tool
 cursor_hand_tool.title=Enable Hand Tool
 cursor_hand_tool_label=Hand Tool
 
+scroll_page.title=Use Page Scrolling
+scroll_page_label=Page Scrolling
 scroll_vertical.title=Use Vertical Scrolling
 scroll_vertical_label=Vertical Scrolling
 scroll_horizontal.title=Use Horizontal Scrolling
diff --git a/third-party/pdfjs/web/locale/en-GB/viewer.properties 
b/third-party/pdfjs/web/locale/en-GB/viewer.properties
index 0052e7f1a..48f6e6702 100644
--- a/third-party/pdfjs/web/locale/en-GB/viewer.properties
+++ b/third-party/pdfjs/web/locale/en-GB/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Text Selection Tool
 cursor_hand_tool.title=Enable Hand Tool
 cursor_hand_tool_label=Hand Tool
 
+scroll_page.title=Use Page Scrolling
+scroll_page_label=Page Scrolling
 scroll_vertical.title=Use Vertical Scrolling
 scroll_vertical_label=Vertical Scrolling
 scroll_horizontal.title=Use Horizontal Scrolling
diff --git a/third-party/pdfjs/web/locale/en-US/viewer.properties 
b/third-party/pdfjs/web/locale/en-US/viewer.properties
index 5fe094b76..dc54ed39d 100644
--- a/third-party/pdfjs/web/locale/en-US/viewer.properties
+++ b/third-party/pdfjs/web/locale/en-US/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Text Selection Tool
 cursor_hand_tool.title=Enable Hand Tool
 cursor_hand_tool_label=Hand Tool
 
+scroll_page.title=Use Page Scrolling
+scroll_page_label=Page Scrolling
 scroll_vertical.title=Use Vertical Scrolling
 scroll_vertical_label=Vertical Scrolling
 scroll_horizontal.title=Use Horizontal Scrolling
diff --git a/third-party/pdfjs/web/locale/eo/viewer.properties 
b/third-party/pdfjs/web/locale/eo/viewer.properties
index c883da1da..004307ed4 100644
--- a/third-party/pdfjs/web/locale/eo/viewer.properties
+++ b/third-party/pdfjs/web/locale/eo/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Teksta elektilo
 cursor_hand_tool.title=Aktivigi ilon de mano
 cursor_hand_tool_label=Ilo de mano
 
+scroll_page.title=Uzi ŝovadon de paĝo
+scroll_page_label=Ŝovado de paĝo
 scroll_vertical.title=Uzi vertikalan ŝovadon
 scroll_vertical_label=Vertikala ŝovado
 scroll_horizontal.title=Uzi horizontalan ŝovadon
diff --git a/third-party/pdfjs/web/locale/es-AR/viewer.properties 
b/third-party/pdfjs/web/locale/es-AR/viewer.properties
index befc3903f..7d6ba407b 100644
--- a/third-party/pdfjs/web/locale/es-AR/viewer.properties
+++ b/third-party/pdfjs/web/locale/es-AR/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Herramienta de selección de texto
 cursor_hand_tool.title=Habilitar herramienta mano
 cursor_hand_tool_label=Herramienta mano
 
+scroll_page.title=Usar desplazamiento de página
+scroll_page_label=Desplazamiento de página
 scroll_vertical.title=Usar desplazamiento vertical
 scroll_vertical_label=Desplazamiento vertical
 scroll_horizontal.title=Usar desplazamiento vertical
diff --git a/third-party/pdfjs/web/locale/es-CL/viewer.properties 
b/third-party/pdfjs/web/locale/es-CL/viewer.properties
index 140c5d419..90fdf9f66 100644
--- a/third-party/pdfjs/web/locale/es-CL/viewer.properties
+++ b/third-party/pdfjs/web/locale/es-CL/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Herramienta de selección de texto
 cursor_hand_tool.title=Activar la herramienta de mano
 cursor_hand_tool_label=Herramienta de mano
 
+scroll_page.title=Usar desplazamiento de página
+scroll_page_label=Desplazamiento de página
 scroll_vertical.title=Usar desplazamiento vertical
 scroll_vertical_label=Desplazamiento vertical
 scroll_horizontal.title=Usar desplazamiento horizontal
@@ -177,11 +179,11 @@ find_reached_bottom=Se alcanzó el final del documento, continuando desde el ini
 # index of the currently active find result, respectively a number representing
 # the total number of matches in the document.
 find_match_count={[ plural(total) ]}
-find_match_count[one]={{current}} de {{total}} coincidencia
-find_match_count[two]={{current}} de {{total}} coincidencias
-find_match_count[few]={{current}} de {{total}} coincidencias
-find_match_count[many]={{current}} de {{total}} coincidencias
-find_match_count[other]={{current}} de {{total}} coincidencias
+find_match_count[one]=Coincidencia {{current}} de {{total}}
+find_match_count[two]=Coincidencia {{current}} de {{total}}
+find_match_count[few]=Coincidencia {{current}} de {{total}}
+find_match_count[many]=Coincidencia {{current}} de {{total}}
+find_match_count[other]=Coincidencia {{current}} de {{total}}
 # LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are
 # [zero|one|two|few|many|other], with [other] as the default value.
 # "{{limit}}" will be replaced by a numerical value.
diff --git a/third-party/pdfjs/web/locale/es-ES/viewer.properties 
b/third-party/pdfjs/web/locale/es-ES/viewer.properties
index f5bdf9796..de4bbdf62 100644
--- a/third-party/pdfjs/web/locale/es-ES/viewer.properties
+++ b/third-party/pdfjs/web/locale/es-ES/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Herramienta de selección de texto
 cursor_hand_tool.title=Activar herramienta de mano
 cursor_hand_tool_label=Herramienta de mano
 
+scroll_page.title=Usar desplazamiento de página
+scroll_page_label=Desplazamiento de página
 scroll_vertical.title=Usar desplazamiento vertical
 scroll_vertical_label=Desplazamiento vertical
 scroll_horizontal.title=Usar desplazamiento horizontal
diff --git a/third-party/pdfjs/web/locale/es-MX/viewer.properties 
b/third-party/pdfjs/web/locale/es-MX/viewer.properties
index 4ac214213..a44768d85 100644
--- a/third-party/pdfjs/web/locale/es-MX/viewer.properties
+++ b/third-party/pdfjs/web/locale/es-MX/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Herramienta de selección de texto
 cursor_hand_tool.title=Activar la herramienta de mano
 cursor_hand_tool_label=Herramienta de mano
 
+scroll_page.title=Usar desplazamiento de página
+scroll_page_label=Desplazamiento de página
 scroll_vertical.title=Usar desplazamiento vertical
 scroll_vertical_label=Desplazamiento vertical
 scroll_horizontal.title=Usar desplazamiento horizontal
diff --git a/third-party/pdfjs/web/locale/et/viewer.properties 
b/third-party/pdfjs/web/locale/et/viewer.properties
index 5f9065bf1..17bf0e4f4 100644
--- a/third-party/pdfjs/web/locale/et/viewer.properties
+++ b/third-party/pdfjs/web/locale/et/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Teksti valimise tööriist
 cursor_hand_tool.title=Luba sirvimistööriist
 cursor_hand_tool_label=Sirvimistööriist
 
+scroll_page.title=Kasutatakse lehe kaupa kerimist
+scroll_page_label=Lehe kaupa kerimine
 scroll_vertical.title=Kasuta vertikaalset kerimist
 scroll_vertical_label=Vertikaalne kerimine
 scroll_horizontal.title=Kasuta horisontaalset kerimist
@@ -133,16 +135,24 @@ print_progress_close=Loobu
 # (the _label strings are alt text for the buttons, the .title strings are
 # tooltips)
 toggle_sidebar.title=Näita külgriba
+toggle_sidebar_notification2.title=Näita külgriba (dokument sisaldab sisukorda/manuseid/kihte)
 toggle_sidebar_label=Näita külgriba
 document_outline.title=Näita sisukorda (kõigi punktide laiendamiseks/ahendamiseks topeltklõpsa)
 document_outline_label=Näita sisukorda
 attachments.title=Näita manuseid
 attachments_label=Manused
+layers.title=Näita kihte (kõikide kihtide vaikeolekusse lähtestamiseks topeltklõpsa)
+layers_label=Kihid
 thumbs.title=Näita pisipilte
 thumbs_label=Pisipildid
+current_outline_item.title=Otsi üles praegune kontuuriüksus
+current_outline_item_label=Praegune kontuuriüksus
 findbar.title=Otsi dokumendist
 findbar_label=Otsi
 
+additional_layers=Täiendavad kihid
+# LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
+page_landmark=Lehekülg {{page}}
 # Thumbnails panel item (tooltip and alt text for images)
 # LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
 # number.
@@ -214,6 +224,8 @@ page_scale_actual=Tegelik suurus
 # numerical scale value.
 page_scale_percent={{scale}}%
 
+# Loading indicator messages
+loading=Laadimine…
 loading_error=PDFi laadimisel esines viga.
 invalid_file_error=Vigane või rikutud PDF-fail.
 missing_file_error=PDF-fail puudub.
diff --git a/third-party/pdfjs/web/locale/eu/viewer.properties 
b/third-party/pdfjs/web/locale/eu/viewer.properties
index 5a379dc5d..aa2bef792 100644
--- a/third-party/pdfjs/web/locale/eu/viewer.properties
+++ b/third-party/pdfjs/web/locale/eu/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Testuaren hautapen tresna
 cursor_hand_tool.title=Gaitu eskuaren tresna
 cursor_hand_tool_label=Eskuaren tresna
 
+scroll_page.title=Erabili orriaren korritzea
+scroll_page_label=Orriaren korritzea
 scroll_vertical.title=Erabili korritze bertikala
 scroll_vertical_label=Korritze bertikala
 scroll_horizontal.title=Erabili korritze horizontala
diff --git a/third-party/pdfjs/web/locale/fi/viewer.properties 
b/third-party/pdfjs/web/locale/fi/viewer.properties
index a5482800e..23496e93b 100644
--- a/third-party/pdfjs/web/locale/fi/viewer.properties
+++ b/third-party/pdfjs/web/locale/fi/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Tekstinvalintatyökalu
 cursor_hand_tool.title=Käytä käsityökalua
 cursor_hand_tool_label=Käsityökalu
 
+scroll_page.title=Käytä sivun vieritystä
+scroll_page_label=Sivun vieritys
 scroll_vertical.title=Käytä pystysuuntaista vieritystä
 scroll_vertical_label=Pystysuuntainen vieritys
 scroll_horizontal.title=Käytä vaakasuuntaista vieritystä
diff --git a/third-party/pdfjs/web/locale/fr/viewer.properties 
b/third-party/pdfjs/web/locale/fr/viewer.properties
index 38bc6df22..54d8033c0 100644
--- a/third-party/pdfjs/web/locale/fr/viewer.properties
+++ b/third-party/pdfjs/web/locale/fr/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Outil de sélection de texte
 cursor_hand_tool.title=Activer l’outil main
 cursor_hand_tool_label=Outil main
 
+scroll_page.title=Utiliser le défilement par page
+scroll_page_label=Défilement par page
 scroll_vertical.title=Utiliser le défilement vertical
 scroll_vertical_label=Défilement vertical
 scroll_horizontal.title=Utiliser le défilement horizontal
diff --git a/third-party/pdfjs/web/locale/fy-NL/viewer.properties 
b/third-party/pdfjs/web/locale/fy-NL/viewer.properties
index 497844887..996d7c4f4 100644
--- a/third-party/pdfjs/web/locale/fy-NL/viewer.properties
+++ b/third-party/pdfjs/web/locale/fy-NL/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Tekstseleksjehelpmiddel
 cursor_hand_tool.title=Hânhelpmiddel ynskeakelje
 cursor_hand_tool_label=Hânhelpmiddel
 
+scroll_page.title=Sideskowen brûke
+scroll_page_label=Sideskowen
 scroll_vertical.title=Fertikaal skowe brûke
 scroll_vertical_label=Fertikaal skowe
 scroll_horizontal.title=Horizontaal skowe brûke
diff --git a/third-party/pdfjs/web/locale/gn/viewer.properties 
b/third-party/pdfjs/web/locale/gn/viewer.properties
index ba7861127..e443df98f 100644
--- a/third-party/pdfjs/web/locale/gn/viewer.properties
+++ b/third-party/pdfjs/web/locale/gn/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Moñe’ẽrã jeporavo rembipuru
 cursor_hand_tool.title=Tembipuru po pegua myandy
 cursor_hand_tool_label=Tembipuru po pegua
 
+scroll_page.title=Eipuru kuatiarogue jeku’e
+scroll_page_label=Kuatiarogue jeku’e
 scroll_vertical.title=Eipuru jeku’e ykeguáva
 scroll_vertical_label=Jeku’e ykeguáva
 scroll_horizontal.title=Eipuru jeku’e yvate gotyo
diff --git a/third-party/pdfjs/web/locale/he/viewer.properties 
b/third-party/pdfjs/web/locale/he/viewer.properties
index 58be62203..e8ed3f0b3 100644
--- a/third-party/pdfjs/web/locale/he/viewer.properties
+++ b/third-party/pdfjs/web/locale/he/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=כלי בחירת טקסט
 cursor_hand_tool.title=הפעלת כלי היד
 cursor_hand_tool_label=כלי יד
 
+scroll_page.title=שימוש בגלילת עמוד
+scroll_page_label=גלילת עמוד
 scroll_vertical.title=שימוש בגלילה אנכית
 scroll_vertical_label=גלילה אנכית
 scroll_horizontal.title=שימוש בגלילה אופקית
diff --git a/third-party/pdfjs/web/locale/hsb/viewer.properties 
b/third-party/pdfjs/web/locale/hsb/viewer.properties
index f710d981a..d797ac702 100644
--- a/third-party/pdfjs/web/locale/hsb/viewer.properties
+++ b/third-party/pdfjs/web/locale/hsb/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Nastroj za wuběranje teksta
 cursor_hand_tool.title=Ručny nastroj zmóžnić
 cursor_hand_tool_label=Ručny nastroj
 
+scroll_page.title=Kulenje strony wužiwać
+scroll_page_label=Kulenje strony
 scroll_vertical.title=Wertikalne suwanje wužiwać
 scroll_vertical_label=Wertikalnje suwanje
 scroll_horizontal.title=Horicontalne suwanje wužiwać
diff --git a/third-party/pdfjs/web/locale/hu/viewer.properties 
b/third-party/pdfjs/web/locale/hu/viewer.properties
index b72a6b5e6..f26b9297b 100644
--- a/third-party/pdfjs/web/locale/hu/viewer.properties
+++ b/third-party/pdfjs/web/locale/hu/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Szövegkijelölő eszköz
 cursor_hand_tool.title=Kéz eszköz bekapcsolása
 cursor_hand_tool_label=Kéz eszköz
 
+scroll_page.title=Oldalgörgetés használata
+scroll_page_label=Oldalgörgetés
 scroll_vertical.title=Függőleges görgetés használata
 scroll_vertical_label=Függőleges görgetés
 scroll_horizontal.title=Vízszintes görgetés használata
diff --git a/third-party/pdfjs/web/locale/ia/viewer.properties 
b/third-party/pdfjs/web/locale/ia/viewer.properties
index e93b7a297..bbb68b776 100644
--- a/third-party/pdfjs/web/locale/ia/viewer.properties
+++ b/third-party/pdfjs/web/locale/ia/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Instrumento de selection de texto
 cursor_hand_tool.title=Activar le instrumento mano
 cursor_hand_tool_label=Instrumento mano
 
+scroll_page.title=Usar rolamento de pagina
+scroll_page_label=Rolamento de pagina
 scroll_vertical.title=Usar rolamento vertical
 scroll_vertical_label=Rolamento vertical
 scroll_horizontal.title=Usar rolamento horizontal
diff --git a/third-party/pdfjs/web/locale/it/viewer.properties 
b/third-party/pdfjs/web/locale/it/viewer.properties
index 0a98f01da..fa8bc0d2e 100644
--- a/third-party/pdfjs/web/locale/it/viewer.properties
+++ b/third-party/pdfjs/web/locale/it/viewer.properties
@@ -57,6 +57,8 @@ cursor_text_select_tool_label = Strumento di selezione testo
 cursor_hand_tool.title = Attiva strumento mano
 cursor_hand_tool_label = Strumento mano
 
+scroll_page.title = Utilizza scorrimento pagine
+scroll_page_label = Scorrimento pagine
 scroll_vertical.title = Scorri le pagine in verticale
 scroll_vertical_label = Scorrimento verticale
 scroll_horizontal.title = Scorri le pagine in orizzontale
diff --git a/third-party/pdfjs/web/locale/ja/viewer.properties 
b/third-party/pdfjs/web/locale/ja/viewer.properties
index 6869fc761..6fbabcae2 100644
--- a/third-party/pdfjs/web/locale/ja/viewer.properties
+++ b/third-party/pdfjs/web/locale/ja/viewer.properties
@@ -48,35 +48,33 @@ bookmark_label=現在のビュー
 tools.title=ツール
 tools_label=ツール
 first_page.title=最初のページへ移動します
-first_page.label=最初のページへ移動
 first_page_label=最初のページへ移動
 last_page.title=最後のページへ移動します
-last_page.label=最後のページへ移動
 last_page_label=最後のページへ移動
 page_rotate_cw.title=ページを右へ回転します
-page_rotate_cw.label=右回転
 page_rotate_cw_label=右回転
 page_rotate_ccw.title=ページを左へ回転します
-page_rotate_ccw.label=左回転
 page_rotate_ccw_label=左回転
 
-cursor_text_select_tool.title=テキスト選択ツールを有効にする
+cursor_text_select_tool.title=テキスト選択ツールを有効にします
 cursor_text_select_tool_label=テキスト選択ツール
-cursor_hand_tool.title=手のひらツールを有効にする
+cursor_hand_tool.title=手のひらツールを有効にします
 cursor_hand_tool_label=手のひらツール
 
-scroll_vertical.title=縦スクロールにする
+scroll_page.title=ページ単位でスクロールします
+scroll_page_label=ページ単位でスクロール
+scroll_vertical.title=縦スクロールにします
 scroll_vertical_label=縦スクロール
-scroll_horizontal.title=横スクロールにする
+scroll_horizontal.title=横スクロールにします
 scroll_horizontal_label=横スクロール
-scroll_wrapped.title=折り返しスクロールにする
+scroll_wrapped.title=折り返しスクロールにします
 scroll_wrapped_label=折り返しスクロール
 
-spread_none.title=見開きにしない
+spread_none.title=見開きにしません
 spread_none_label=見開きにしない
-spread_odd.title=奇数ページ開始で見開きにする
+spread_odd.title=奇数ページ開始で見開きにします
 spread_odd_label=奇数ページ見開き
-spread_even.title=偶数ページ開始で見開きにする
+spread_even.title=偶数ページ開始で見開きにします
 spread_even_label=偶数ページ見開き
 
 # Document properties dialog box
@@ -86,10 +84,10 @@ document_properties_file_name=ファイル名:
 document_properties_file_size=ファイルサイズ:
 # LOCALIZATION NOTE (document_properties_kb): "{{size_kb}}" and "{{size_b}}"
 # will be replaced by the PDF file size in kilobytes, respectively in bytes.
-document_properties_kb={{size_kb}} KB ({{size_b}} bytes)
+document_properties_kb={{size_kb}} KB ({{size_b}} バイト)
 # LOCALIZATION NOTE (document_properties_mb): "{{size_mb}}" and "{{size_b}}"
 # will be replaced by the PDF file size in megabytes, respectively in bytes.
-document_properties_mb={{size_mb}} MB ({{size_b}} bytes)
+document_properties_mb={{size_mb}} MB ({{size_b}} バイト)
 document_properties_title=タイトル:
 document_properties_author=作成者:
 document_properties_subject=件名:
@@ -137,7 +135,6 @@ print_progress_close=キャンセル
 # (the _label strings are alt text for the buttons, the .title strings are
 # tooltips)
 toggle_sidebar.title=サイドバー表示を切り替えます
-toggle_sidebar_notification.title=サイドバー表示を切り替えます (文書に含まれるアウトライン / 添付)
 toggle_sidebar_notification2.title=サイドバー表示を切り替えます (文書に含まれるアウトライン / 添付 / レイヤー)
 toggle_sidebar_label=サイドバーの切り替え
 document_outline.title=文書の目次を表示します (ダブルクリックで項目を開閉します)
@@ -153,9 +150,6 @@ current_outline_item_label=現在のアウトライン項目
 findbar.title=文書内を検索します
 findbar_label=検索
 
-# LOCALIZATION NOTE (page_canvas): "{{page}}" will be replaced by the page number.
-page_canvas={{page}} ページ
-
 additional_layers=追加レイヤー
 # LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
 page_landmark={{page}} ページ
@@ -230,9 +224,6 @@ page_scale_actual=実際のサイズ
 # numerical scale value.
 page_scale_percent={{scale}}%
 
-# Loading indicator messages
-loading_error_indicator=エラー
-
 # Loading indicator messages
 loading=読み込み中...
 loading_error=PDF の読み込み中にエラーが発生しました。
diff --git a/third-party/pdfjs/web/locale/ka/viewer.properties 
b/third-party/pdfjs/web/locale/ka/viewer.properties
index 4d5b92924..2144a11c3 100644
--- a/third-party/pdfjs/web/locale/ka/viewer.properties
+++ b/third-party/pdfjs/web/locale/ka/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=მოსანიშნი მაჩვენე
 cursor_hand_tool.title=გადასაადგილებელი მაჩვენებლის გამოყენება
 cursor_hand_tool_label=გადასაადგილებელი
 
+scroll_page.title=გვერდზე გადაადგილების გამოყენება
+scroll_page_label=გვერდზე გადაადგილება
 scroll_vertical.title=გვერდების შვეულად ჩვენება
 scroll_vertical_label=შვეული გადაადგილება
 scroll_horizontal.title=გვერდების თარაზულად ჩვენება
diff --git a/third-party/pdfjs/web/locale/kk/viewer.properties 
b/third-party/pdfjs/web/locale/kk/viewer.properties
index a29c5d85b..456504456 100644
--- a/third-party/pdfjs/web/locale/kk/viewer.properties
+++ b/third-party/pdfjs/web/locale/kk/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Мәтінді таңдау құралы
 cursor_hand_tool.title=Қол құралын іске қосу
 cursor_hand_tool_label=Қол құралы
 
+scroll_page.title=Беттерді айналдыруды пайдалану
+scroll_page_label=Беттерді айналдыру
 scroll_vertical.title=Вертикалды айналдыруды қолдану
 scroll_vertical_label=Вертикалды айналдыру
 scroll_horizontal.title=Горизонталды айналдыруды қолдану
diff --git a/third-party/pdfjs/web/locale/ko/viewer.properties 
b/third-party/pdfjs/web/locale/ko/viewer.properties
index 71e6bcd4c..19720e59b 100644
--- a/third-party/pdfjs/web/locale/ko/viewer.properties
+++ b/third-party/pdfjs/web/locale/ko/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=텍스트 선택 도구
 cursor_hand_tool.title=손 도구 활성화
 cursor_hand_tool_label=손 도구
 
+scroll_page.title=페이지 스크롤 사용
+scroll_page_label=페이지 스크롤
 scroll_vertical.title=세로 스크롤 사용
 scroll_vertical_label=세로 스크롤
 scroll_horizontal.title=가로 스크롤 사용
diff --git a/third-party/pdfjs/web/locale/locale.properties b/third-party/pdfjs/web/locale/locale.properties
index 6be6adfb2..ae79f4739 100644
--- a/third-party/pdfjs/web/locale/locale.properties
+++ b/third-party/pdfjs/web/locale/locale.properties
@@ -244,6 +244,12 @@
 [ru]
 @import url(ru/viewer.properties)
 
+[sat]
+@import url(sat/viewer.properties)
+
+[sc]
+@import url(sc/viewer.properties)
+
 [scn]
 @import url(scn/viewer.properties)
 
diff --git a/third-party/pdfjs/web/locale/lt/viewer.properties 
b/third-party/pdfjs/web/locale/lt/viewer.properties
index 5577f6d59..6188a92d1 100644
--- a/third-party/pdfjs/web/locale/lt/viewer.properties
+++ b/third-party/pdfjs/web/locale/lt/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Teksto žymėjimo įrankis
 cursor_hand_tool.title=Įjungti vilkimo įrankį
 cursor_hand_tool_label=Vilkimo įrankis
 
+scroll_page.title=Naudoti puslapio slinkimą
+scroll_page_label=Puslapio slinkimas
 scroll_vertical.title=Naudoti vertikalų slinkimą
 scroll_vertical_label=Vertikalus slinkimas
 scroll_horizontal.title=Naudoti horizontalų slinkimą
diff --git a/third-party/pdfjs/web/locale/nb-NO/viewer.properties 
b/third-party/pdfjs/web/locale/nb-NO/viewer.properties
index 85c37f5c8..0bb995821 100644
--- a/third-party/pdfjs/web/locale/nb-NO/viewer.properties
+++ b/third-party/pdfjs/web/locale/nb-NO/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Tekstmarkeringsverktøy
 cursor_hand_tool.title=Aktiver handverktøy
 cursor_hand_tool_label=Handverktøy
 
+scroll_page.title=Bruk siderulling
+scroll_page_label=Siderulling
 scroll_vertical.title=Bruk vertikal rulling
 scroll_vertical_label=Vertikal rulling
 scroll_horizontal.title=Bruk horisontal rulling
diff --git a/third-party/pdfjs/web/locale/ne-NP/viewer.properties 
b/third-party/pdfjs/web/locale/ne-NP/viewer.properties
index 1e30fece8..004416745 100644
--- a/third-party/pdfjs/web/locale/ne-NP/viewer.properties
+++ b/third-party/pdfjs/web/locale/ne-NP/viewer.properties
@@ -61,6 +61,16 @@ cursor_text_select_tool_label=पाठ चयन उपकरण
 cursor_hand_tool.title=हाते उपकरण सक्षम गर्नुहोस्
 cursor_hand_tool_label=हाते उपकरण
 
+scroll_vertical.title=ठाडो स्क्रोलिङ्ग प्रयोग गर्नुहोस्
+scroll_vertical_label=ठाडो स्क्र्रोलिङ्ग
+scroll_horizontal.title=तेर्सो स्क्रोलिङ्ग प्रयोग गर्नुहोस्
+scroll_horizontal_label=तेर्सो स्क्रोलिङ्ग
+scroll_wrapped.title=लिपि स्क्रोलिङ्ग प्रयोग गर्नुहोस्
+scroll_wrapped_label=लिपि स्क्रोलिङ्ग
+
+spread_none.title=पृष्ठ स्प्रेडमा सामेल हुनुहुन्न
+spread_none_label=स्प्रेड छैन
+
 # Document properties dialog box
 document_properties.title=कागजात विशेषताहरू...
 document_properties_label=कागजात विशेषताहरू...
@@ -85,6 +95,23 @@ document_properties_creator=सर्जक:
 document_properties_producer=PDF निर्माता:
 document_properties_version=PDF संस्करण
 document_properties_page_count=पृष्ठ गणना:
+document_properties_page_size=पृष्ठ आकार:
+document_properties_page_size_unit_inches=इन्च
+document_properties_page_size_unit_millimeters=मि.मि.
+document_properties_page_size_orientation_portrait=पोट्रेट
+document_properties_page_size_orientation_landscape=परिदृश्य
+document_properties_page_size_name_letter=अक्षर
+document_properties_page_size_name_legal=कानूनी
+# LOCALIZATION NOTE (document_properties_page_size_dimension_string):
+# "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by
+# the size, respectively their unit of measurement and orientation, of the (current) page.
+# LOCALIZATION NOTE (document_properties_page_size_dimension_name_string):
+# "{{width}}", "{{height}}", {{unit}}, {{name}}, and {{orientation}} will be replaced by
+# the size, respectively their unit of measurement, name, and orientation, of the (current) page.
+# LOCALIZATION NOTE (document_properties_linearized): The linearization status of
+# the document; usually called "Fast Web View" in English locales of Adobe software.
+document_properties_linearized_yes=हो
+document_properties_linearized_no=होइन
 document_properties_close=बन्द गर्नुहोस्
 
 print_progress_message=मुद्रणका लागि कागजात तयारी गरिदै…
@@ -107,6 +134,7 @@ thumbs_label=थम्बनेलहरू
 findbar.title=कागजातमा फेला पार्नुहोस्
 findbar_label=फेला पार्नुहोस्
 
+# LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
 # Thumbnails panel item (tooltip and alt text for images)
 # LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
 # number.
@@ -124,8 +152,17 @@ find_next.title=यस वाक्यांशको पछिल्लो घ
 find_next_label=अर्को
 find_highlight=सबै हाइलाइट गर्ने
 find_match_case_label=केस जोडा मिलाउनुहोस्
+find_entire_word_label=पुरा शब्दहरु
 find_reached_top=पृष्ठको शिर्षमा पुगीयो, तलबाट जारी गरिएको थियो
 find_reached_bottom=पृष्ठको अन्त्यमा पुगीयो, शिर्षबाट जारी गरिएको थियो
+# LOCALIZATION NOTE (find_match_count): The supported plural forms are
+# [one|two|few|many|other], with [other] as the default value.
+# "{{current}}" and "{{total}}" will be replaced by a number representing the
+# index of the currently active find result, respectively a number representing
+# the total number of matches in the document.
+# LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are
+# [zero|one|two|few|many|other], with [other] as the default value.
+# "{{limit}}" will be replaced by a numerical value.
 find_not_found=वाक्यांश फेला परेन
 
 # Error panel labels
@@ -156,11 +193,15 @@ page_scale_actual=वास्तविक आकार
 # numerical scale value.
 page_scale_percent={{scale}}%
 
+# Loading indicator messages
 loading_error=यो PDF लोड गर्दा एउटा त्रुटि देखापर्‍यो।
 invalid_file_error=अवैध वा दुषित PDF फाइल।
 missing_file_error=हराईरहेको PDF फाइल।
 unexpected_response_error=अप्रत्याशित सर्भर प्रतिक्रिया।
 
+# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be
+# replaced by the modification date, and time, of the annotation.
+
 # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.
 # "{{type}}" will be replaced with an annotation type from a list defined in
 # the PDF spec (32000-1:2008 Table 169 – Annotation types).
diff --git a/third-party/pdfjs/web/locale/nl/viewer.properties 
b/third-party/pdfjs/web/locale/nl/viewer.properties
index 98bf888a4..ea47d68ab 100644
--- a/third-party/pdfjs/web/locale/nl/viewer.properties
+++ b/third-party/pdfjs/web/locale/nl/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Tekstselectiehulpmiddel
 cursor_hand_tool.title=Handhulpmiddel inschakelen
 cursor_hand_tool_label=Handhulpmiddel
 
+scroll_page.title=Paginascrollen gebruiken
+scroll_page_label=Paginascrollen
 scroll_vertical.title=Verticaal scrollen gebruiken
 scroll_vertical_label=Verticaal scrollen
 scroll_horizontal.title=Horizontaal scrollen gebruiken
diff --git a/third-party/pdfjs/web/locale/nn-NO/viewer.properties 
b/third-party/pdfjs/web/locale/nn-NO/viewer.properties
index 0827dc5ec..2feff7852 100644
--- a/third-party/pdfjs/web/locale/nn-NO/viewer.properties
+++ b/third-party/pdfjs/web/locale/nn-NO/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Tekstmarkeringsverktøy
 cursor_hand_tool.title=Aktiver handverktøy
 cursor_hand_tool_label=Handverktøy
 
+scroll_page.title=Bruk siderulling
+scroll_page_label=Siderulling
 scroll_vertical.title=Bruk vertikal rulling
 scroll_vertical_label=Vertikal rulling
 scroll_horizontal.title=Bruk horisontal rulling
diff --git a/third-party/pdfjs/web/locale/oc/viewer.properties 
b/third-party/pdfjs/web/locale/oc/viewer.properties
index b3ee54f9a..219de4de2 100644
--- a/third-party/pdfjs/web/locale/oc/viewer.properties
+++ b/third-party/pdfjs/web/locale/oc/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Aisina de seleccion de tèxte
 cursor_hand_tool.title=Activar l’aisina man
 cursor_hand_tool_label=Aisina man
 
+scroll_page.title=Activar lo desfilament per pagina
+scroll_page_label=Desfilament per pagina
 scroll_vertical.title=Utilizar lo desfilament vertical
 scroll_vertical_label=Desfilament vertical
 scroll_horizontal.title=Utilizar lo desfilament orizontal
diff --git a/third-party/pdfjs/web/locale/pa-IN/viewer.properties 
b/third-party/pdfjs/web/locale/pa-IN/viewer.properties
index f63909f98..61215db50 100644
--- a/third-party/pdfjs/web/locale/pa-IN/viewer.properties
+++ b/third-party/pdfjs/web/locale/pa-IN/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=ਲਿਖਤ ਚੋਣ ਟੂਲ
 cursor_hand_tool.title=ਹੱਥ ਟੂਲ ਸਮਰੱਥ ਕਰੋ
 cursor_hand_tool_label=ਹੱਥ ਟੂਲ
 
+scroll_page.title=ਸਫ਼ਾ ਖਿਸਕਾਉਣ ਨੂੰ ਵਰਤੋਂ
+scroll_page_label=ਸਫ਼ਾ ਖਿਸਕਾਉਣਾ
 scroll_vertical.title=ਖੜ੍ਹਵੇਂ ਸਕਰਾਉਣ ਨੂੰ ਵਰਤੋਂ
 scroll_vertical_label=ਖੜ੍ਹਵਾਂ ਸਰਕਾਉਣਾ
 scroll_horizontal.title=ਲੇਟਵੇਂ ਸਰਕਾਉਣ ਨੂੰ ਵਰਤੋਂ
diff --git a/third-party/pdfjs/web/locale/pl/viewer.properties 
b/third-party/pdfjs/web/locale/pl/viewer.properties
index 0fb8d9d87..e841f1382 100644
--- a/third-party/pdfjs/web/locale/pl/viewer.properties
+++ b/third-party/pdfjs/web/locale/pl/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Narzędzie zaznaczania tekstu
 cursor_hand_tool.title=Włącz narzędzie rączka
 cursor_hand_tool_label=Narzędzie rączka
 
+scroll_page.title=Przewijaj strony
+scroll_page_label=Przewijanie stron
 scroll_vertical.title=Przewijaj dokument w pionie
 scroll_vertical_label=Przewijanie pionowe
 scroll_horizontal.title=Przewijaj dokument w poziomie
diff --git a/third-party/pdfjs/web/locale/pt-BR/viewer.properties 
b/third-party/pdfjs/web/locale/pt-BR/viewer.properties
index fc67ea7ec..f91b2aa4a 100644
--- a/third-party/pdfjs/web/locale/pt-BR/viewer.properties
+++ b/third-party/pdfjs/web/locale/pt-BR/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Ferramenta de seleção de texto
 cursor_hand_tool.title=Ativar ferramenta de deslocamento
 cursor_hand_tool_label=Ferramenta de deslocamento
 
+scroll_page.title=Usar rolagem de página
+scroll_page_label=Rolagem de página
 scroll_vertical.title=Usar deslocamento vertical
 scroll_vertical_label=Deslocamento vertical
 scroll_horizontal.title=Usar deslocamento horizontal
diff --git a/third-party/pdfjs/web/locale/pt-PT/viewer.properties 
b/third-party/pdfjs/web/locale/pt-PT/viewer.properties
index fa9493360..8a44e1e8f 100644
--- a/third-party/pdfjs/web/locale/pt-PT/viewer.properties
+++ b/third-party/pdfjs/web/locale/pt-PT/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Ferramenta de seleção de texto
 cursor_hand_tool.title=Ativar ferramenta de mão
 cursor_hand_tool_label=Ferramenta de mão
 
+scroll_page.title=Utilizar deslocamento da página
+scroll_page_label=Deslocamento da página
 scroll_vertical.title=Utilizar deslocação vertical
 scroll_vertical_label=Deslocação vertical
 scroll_horizontal.title=Utilizar deslocação horizontal
diff --git a/third-party/pdfjs/web/locale/rm/viewer.properties 
b/third-party/pdfjs/web/locale/rm/viewer.properties
index cd79a35b4..85d4e865c 100644
--- a/third-party/pdfjs/web/locale/rm/viewer.properties
+++ b/third-party/pdfjs/web/locale/rm/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Utensil per selecziunar text
 cursor_hand_tool.title=Activar l'utensil da maun
 cursor_hand_tool_label=Utensil da maun
 
+scroll_page.title=Utilisar la defilada per pagina
+scroll_page_label=Defilada per pagina
 scroll_vertical.title=Utilisar il defilar vertical
 scroll_vertical_label=Defilar vertical
 scroll_horizontal.title=Utilisar il defilar orizontal
diff --git a/third-party/pdfjs/web/locale/ru/viewer.properties 
b/third-party/pdfjs/web/locale/ru/viewer.properties
index e015623c1..8f817bd10 100644
--- a/third-party/pdfjs/web/locale/ru/viewer.properties
+++ b/third-party/pdfjs/web/locale/ru/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Инструмент «Выделение текс
 cursor_hand_tool.title=Включить Инструмент «Рука»
 cursor_hand_tool_label=Инструмент «Рука»
 
+scroll_page.title=Использовать прокрутку страниц
+scroll_page_label=Прокрутка страниц
 scroll_vertical.title=Использовать вертикальную прокрутку
 scroll_vertical_label=Вертикальная прокрутка
 scroll_horizontal.title=Использовать горизонтальную прокрутку
diff --git a/third-party/pdfjs/web/locale/sat/viewer.properties 
b/third-party/pdfjs/web/locale/sat/viewer.properties
new file mode 100644
index 000000000..3f38d5ab1
--- /dev/null
+++ b/third-party/pdfjs/web/locale/sat/viewer.properties
@@ -0,0 +1,154 @@
+# Copyright 2012 Mozilla Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Main toolbar buttons (tooltips and alt text for images)
+previous.title=पा़हिलाक् साहटा
+next.title=इना़ तायोम साहटा
+
+# LOCALIZATION NOTE (page.title): The tooltip for the pageNumber input.
+# LOCALIZATION NOTE (of_pages): "{{pagesCount}}" will be replaced by a number
+# representing the total number of pages in the document.
+# LOCALIZATION NOTE (page_of_pages): "{{pageNumber}}" and "{{pagesCount}}"
+# will be replaced by a number representing the currently visible page,
+# respectively a number representing the total number of pages in the document.
+
+zoom.title=हुडिञ ला़टु तेयार
+presentation_mode.title=उदुक् सोदोर ओबोसता रे ओताय मे
+presentation_mode_label=उदुक् सोदोर ओबोसता
+open_file.title=रेत् झिज मे
+open_file_label=झिज मे झिच्
+bookmark.title=नितोगाक् ञेल (नावा विंडो रे नोकोल आर बाङ झिज मे )
+bookmark_label=नितोगाक् ञेंल
+
+# Secondary toolbar and context menu
+
+
+
+
+# Document properties dialog box
+document_properties_file_name=रेत् ञुतुम:
+document_properties_file_size=रेत् माराङ तेत्:
+# LOCALIZATION NOTE (document_properties_kb): "{{size_kb}}" and "{{size_b}}"
+# will be replaced by the PDF file size in kilobytes, respectively in bytes.
+document_properties_kb={{size_kb}} KB ({{size_b}} बाइट्स)
+# LOCALIZATION NOTE (document_properties_mb): "{{size_mb}}" and "{{size_b}}"
+# will be replaced by the PDF file size in megabytes, respectively in bytes.
+document_properties_mb={{size_mb}} MB ({{size_b}} बाइट्स)
+document_properties_title=एम ञुतुम:
+document_properties_author=ओनोलिया़:
+document_properties_subject=बिसोय:
+document_properties_keywords=का़ठी बोर्ड:
+document_properties_creation_date=तेयार मा़हित्:
+document_properties_modification_date=बोदोल होचो मा़हित्:
+# LOCALIZATION NOTE (document_properties_date_string): "{{date}}" and "{{time}}"
+# will be replaced by the creation/modification date, and time, of the PDF file.
+document_properties_date_string={{date}}, {{time}}
+document_properties_creator=बेनाविच्:
+document_properties_producer=PDF तेयार ओडोकिच्:
+document_properties_version=PDF बार्सान:
+document_properties_page_count=साहटा लेखा:
+# LOCALIZATION NOTE (document_properties_page_size_dimension_string):
+# "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by
+# the size, respectively their unit of measurement and orientation, of the (current) page.
+# LOCALIZATION NOTE (document_properties_page_size_dimension_name_string):
+# "{{width}}", "{{height}}", {{unit}}, {{name}}, and {{orientation}} will be replaced by
+# the size, respectively their unit of measurement, name, and orientation, of the (current) page.
+# LOCALIZATION NOTE (document_properties_linearized): The linearization status of
+# the document; usually called "Fast Web View" in English locales of Adobe software.
+
+# LOCALIZATION NOTE (print_progress_percent): "{{progress}}" will be replaced by
+# a numerical per cent value.
+
+# Tooltips and alt text for side panel toolbar buttons
+# (the _label strings are alt text for the buttons, the .title strings are
+# tooltips)
+document_outline_label=दोलिल तेयार तेत्
+attachments.title=ᱞᱟᱴᱷᱟ ᱥᱮᱞᱮᱫ ᱠᱚ ᱩᱫᱩᱜᱽ ᱢᱮ
+attachments_label=ᱞᱟᱴᱷᱟ ᱥᱮᱞᱮᱫ ᱠᱚ
+thumbs.title=चिता़र आहला को उदुगा मे
+thumbs_label=चिता़र आहला को
+findbar.title=दोलिल रे ञाम
+
+# LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
+# Thumbnails panel item (tooltip and alt text for images)
+# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
+# number.
+thumb_page_title=साहटा {{page}}
+# LOCALIZATION NOTE (thumb_page_canvas): "{{page}}" will be replaced by the page
+# number.
+thumb_page_canvas=साहटा रेयाक् चिता़र आहला {{page}}
+
+# Find panel button title and messages
+find_previous.title=आयात् हिंस रेयाक् पा़हिल सेदाक् ओडोक् ञाम मे
+find_next.title=आयात् हिंस रेयाक् इना़ तायोम ओडोक् ञाम मे
+find_highlight=जोतो उदुक् राकाब
+find_match_case_label=जोड़ मामला
+find_reached_top=दोलिल रेयाक् चोट रे सेटेर, लातार खोन लेताड़
+find_reached_bottom=दोलिल रेयाक् मुचा़त् रे सेटेर, चोट खोन लेताड़
+# LOCALIZATION NOTE (find_match_count): The supported plural forms are
+# [one|two|few|many|other], with [other] as the default value.
+# "{{current}}" and "{{total}}" will be replaced by a number representing the
+# index of the currently active find result, respectively a number representing
+# the total number of matches in the document.
+# LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are
+# [zero|one|two|few|many|other], with [other] as the default value.
+# "{{limit}}" will be replaced by a numerical value.
+find_not_found=आयात् हिंस बाय ञाम लेना
+
+# Error panel labels
+error_more_info=बाड़ती ला़य सोदोरढेर ला़य सोदोर
+error_less_info=कोम ला़य सोदोर
+# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be
+# replaced by the PDF.JS version and build ID.
+error_version_info=PDF.js v{{version}} (तेयार: {{build}})
+# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an
+# english string describing the error.
+error_message=खोबोर: {{message}}
+# LOCALIZATION NOTE (error_stack): "{{stack}}" will be replaced with a stack
+# trace.
+error_stack=डांग: {{stack}}
+# LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename
+error_file=रेत्: {{file}}
+# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number
+error_line=गार: {{line}}
+rendering_error=साहटा एम जोहोक मित् भुल हुय एना .
+
+# Predefined zoom values
+page_scale_width=साहटा ओसार
+page_scale_fit=साहटा खाप
+page_scale_auto=आच् आच् ते हुडिञ ला़टु तेयार
+page_scale_actual=ठिक माराङ तेत्
+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a
+# numerical scale value.
+
+# Loading indicator messages
+loading_error=\u0020PDFलादे जोहोक् मित् भुल हुय एना.
+invalid_file_error=बाङ बाताव आर बाङ  PDF रेत्.
+missing_file_error=आदाक् PDF रेत्.
+
+# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be
+# replaced by the modification date, and time, of the annotation.
+
+# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.
+# "{{type}}" will be replaced with an annotation type from a list defined in
+# the PDF spec (32000-1:2008 Table 169 – Annotation types).
+# Some common types are e.g.: "Check", "Text", "Comment", "Note"
+text_annotation_type.alt=[{{type}} बेयान एम]
+password_label=नोवा PDF रेत् झिज ला़गित् दानाङ साबाद आदेर मे.
+password_invalid=बाङ बातावाक् दानाङ साबाद. दोहड़ा कुरुमुटुय मे.
+password_ok=OK
+
+printing_not_supported=होसियार: छापा नोवा पानतेयाक् दाराय ते पुरा़व बाय गोड़ोवाकाना .
+printing_not_ready=होंसिया़र: छापा ला़गित्  PDF पुरा़ बाय लादे आकाना.
+web_fonts_disabled=वेब फॉन्ट बाङ हुय होचो आकाना: भितिर थापोन PDF फॉन्ट्स बेभार बाङ हुय केया.
diff --git a/third-party/pdfjs/web/locale/sc/viewer.properties 
b/third-party/pdfjs/web/locale/sc/viewer.properties
new file mode 100644
index 000000000..00702225b
--- /dev/null
+++ b/third-party/pdfjs/web/locale/sc/viewer.properties
@@ -0,0 +1,119 @@
+# Copyright 2012 Mozilla Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Main toolbar buttons (tooltips and alt text for images)
+previous_label=S'ischeda chi b'est primu
+next_label=Imbeniente
+
+# LOCALIZATION NOTE (page.title): The tooltip for the pageNumber input.
+page.title=Pàgina
+# LOCALIZATION NOTE (of_pages): "{{pagesCount}}" will be replaced by a number
+# representing the total number of pages in the document.
+# LOCALIZATION NOTE (page_of_pages): "{{pageNumber}}" and "{{pagesCount}}"
+# will be replaced by a number representing the currently visible page,
+# respectively a number representing the total number of pages in the document.
+
+zoom_out.title=Impitica
+zoom_out_label=Impitica
+zoom_in.title=Ismànnia
+zoom_in_label=Ismànnia
+zoom.title=Ismànnia
+open_file.title=Aberi s'archìviu
+open_file_label=Abertu
+print.title=Imprenta
+print_label=Imprenta
+download.title=Iscàrriga
+download_label=Iscàrriga
+
+# Secondary toolbar and context menu
+tools.title=Istrumentos
+tools_label=Istrumentos
+
+
+
+
+# Document properties dialog box
+# LOCALIZATION NOTE (document_properties_kb): "{{size_kb}}" and "{{size_b}}"
+# will be replaced by the PDF file size in kilobytes, respectively in bytes.
+# LOCALIZATION NOTE (document_properties_mb): "{{size_mb}}" and "{{size_b}}"
+# will be replaced by the PDF file size in megabytes, respectively in bytes.
+document_properties_subject=Ogetu:
+# LOCALIZATION NOTE (document_properties_date_string): "{{date}}" and "{{time}}"
+# will be replaced by the creation/modification date, and time, of the PDF file.
+# LOCALIZATION NOTE (document_properties_page_size_dimension_string):
+# "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by
+# the size, respectively their unit of measurement and orientation, of the (current) page.
+# LOCALIZATION NOTE (document_properties_page_size_dimension_name_string):
+# "{{width}}", "{{height}}", {{unit}}, {{name}}, and {{orientation}} will be replaced by
+# the size, respectively their unit of measurement, name, and orientation, of the (current) page.
+# LOCALIZATION NOTE (document_properties_linearized): The linearization status of
+# the document; usually called "Fast Web View" in English locales of Adobe software.
+document_properties_close=Serra
+
+# LOCALIZATION NOTE (print_progress_percent): "{{progress}}" will be replaced by
+# a numerical per cent value.
+print_progress_close=Cantzella
+
+# Tooltips and alt text for side panel toolbar buttons
+# (the _label strings are alt text for the buttons, the .title strings are
+# tooltips)
+attachments_label=Alliongiados
+
+# LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
+# Thumbnails panel item (tooltip and alt text for images)
+# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
+# number.
+# LOCALIZATION NOTE (thumb_page_canvas): "{{page}}" will be replaced by the page
+# number.
+
+# Find panel button title and messages
+find_previous_label=S'ischeda chi b'est primu
+find_next_label=Imbeniente
+# LOCALIZATION NOTE (find_match_count): The supported plural forms are
+# [one|two|few|many|other], with [other] as the default value.
+# "{{current}}" and "{{total}}" will be replaced by a number representing the
+# index of the currently active find result, respectively a number representing
+# the total number of matches in the document.
+# LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are
+# [zero|one|two|few|many|other], with [other] as the default value.
+# "{{limit}}" will be replaced by a numerical value.
+
+# Error panel labels
+error_close=Serra
+# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be
+# replaced by the PDF.JS version and build ID.
+# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an
+# english string describing the error.
+# LOCALIZATION NOTE (error_stack): "{{stack}}" will be replaced with a stack
+# trace.
+# LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename
+# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number
+
+# Predefined zoom values
+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a
+# numerical scale value.
+
+# Loading indicator messages
+
+# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be
+# replaced by the modification date, and time, of the annotation.
+
+# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.
+# "{{type}}" will be replaced with an annotation type from a list defined in
+# the PDF spec (32000-1:2008 Table 169 – Annotation types).
+# Some common types are e.g.: "Check", "Text", "Comment", "Note"
+password_invalid=Sa crae no est curreta. Torra·bi a proare.
+password_ok=Andat bene
+password_cancel=Cantzella
+
diff --git a/third-party/pdfjs/web/locale/sk/viewer.properties 
b/third-party/pdfjs/web/locale/sk/viewer.properties
index 0e2963a99..f13bf6ede 100644
--- a/third-party/pdfjs/web/locale/sk/viewer.properties
+++ b/third-party/pdfjs/web/locale/sk/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Výber textu
 cursor_hand_tool.title=Povoliť nástroj ruka
 cursor_hand_tool_label=Nástroj ruka
 
+scroll_page.title=Použiť rolovanie po stránkach
+scroll_page_label=Rolovanie po stránkach
 scroll_vertical.title=Používať zvislé posúvanie
 scroll_vertical_label=Zvislé posúvanie
 scroll_horizontal.title=Používať vodorovné posúvanie
diff --git a/third-party/pdfjs/web/locale/sl/viewer.properties 
b/third-party/pdfjs/web/locale/sl/viewer.properties
index a6e725efa..723f75dab 100644
--- a/third-party/pdfjs/web/locale/sl/viewer.properties
+++ b/third-party/pdfjs/web/locale/sl/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Orodje za izbor besedila
 cursor_hand_tool.title=Omogoči roko
 cursor_hand_tool_label=Roka
 
+scroll_page.title=Uporabi drsenje po strani
+scroll_page_label=Drsenje po strani
 scroll_vertical.title=Uporabi navpično drsenje
 scroll_vertical_label=Navpično drsenje
 scroll_horizontal.title=Uporabi vodoravno drsenje
diff --git a/third-party/pdfjs/web/locale/sq/viewer.properties 
b/third-party/pdfjs/web/locale/sq/viewer.properties
index 281c25e0f..3ff4e4d24 100644
--- a/third-party/pdfjs/web/locale/sq/viewer.properties
+++ b/third-party/pdfjs/web/locale/sq/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Mjet Përzgjedhjeje Teksti
 cursor_hand_tool.title=Aktivizo Mjetin Dorë
 cursor_hand_tool_label=Mjeti Dorë
 
+scroll_page.title=Përdor Rrëshqitje Në Faqe
+scroll_page_label=Rrëshqitje Në Faqe
 scroll_vertical.title=Përdor Rrëshqitje Vertikale
 scroll_vertical_label=Rrëshqitje Vertikale
 scroll_horizontal.title=Përdor Rrëshqitje Horizontale
@@ -112,6 +114,7 @@ document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}}
 document_properties_page_size_dimension_name_string={{width}} × {{height}} {{unit}} ({{name}}, 
{{orientation}})
 # LOCALIZATION NOTE (document_properties_linearized): The linearization status of
 # the document; usually called "Fast Web View" in English locales of Adobe software.
+document_properties_linearized=Parje e Shpjetë në Web:
 document_properties_linearized_yes=Po
 document_properties_linearized_no=Jo
 document_properties_close=Mbylleni
@@ -136,10 +139,14 @@ layers.title=Shfaq Shtresa (dyklikoni që të rikthehen krejt shtresat në gjend
 layers_label=Shtresa
 thumbs.title=Shfaqni Miniatura
 thumbs_label=Miniatura
+current_outline_item.title=Gjej Objektin e Tanishëm të Përvijuar
+current_outline_item_label=Objekt i Tanishëm i Përvijuar
 findbar.title=Gjeni në Dokument
 findbar_label=Gjej
 
 additional_layers=Shtresa Shtesë
+# LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
+page_landmark=Faqja {{page}}
 # Thumbnails panel item (tooltip and alt text for images)
 # LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
 # number.
@@ -211,6 +218,8 @@ page_scale_actual=Madhësia Faktike
 # numerical scale value.
 page_scale_percent={{scale}}%
 
+# Loading indicator messages
+loading=Po ngarkohet…
 loading_error=Ndodhi një gabim gjatë ngarkimit të PDF-së.
 invalid_file_error=Kartelë PDF e pavlefshme ose e dëmtuar.
 missing_file_error=Kartelë PDF që mungon.
diff --git a/third-party/pdfjs/web/locale/sv-SE/viewer.properties 
b/third-party/pdfjs/web/locale/sv-SE/viewer.properties
index 75f675eab..a1d6fe1bc 100644
--- a/third-party/pdfjs/web/locale/sv-SE/viewer.properties
+++ b/third-party/pdfjs/web/locale/sv-SE/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Textmarkeringsverktyg
 cursor_hand_tool.title=Aktivera handverktyg
 cursor_hand_tool_label=Handverktyg
 
+scroll_page.title=Använd sidrullning
+scroll_page_label=Sidrullning
 scroll_vertical.title=Använd vertikal rullning
 scroll_vertical_label=Vertikal rullning
 scroll_horizontal.title=Använd horisontell rullning
diff --git a/third-party/pdfjs/web/locale/th/viewer.properties 
b/third-party/pdfjs/web/locale/th/viewer.properties
index 78e859654..c48a7115e 100644
--- a/third-party/pdfjs/web/locale/th/viewer.properties
+++ b/third-party/pdfjs/web/locale/th/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=เครื่องมือการเลื
 cursor_hand_tool.title=เปิดใช้งานเครื่องมือมือ
 cursor_hand_tool_label=เครื่องมือมือ
 
+scroll_page.title=ใช้การเลื่อนหน้า
+scroll_page_label=การเลื่อนหน้า
 scroll_vertical.title=ใช้การเลื่อนแนวตั้ง
 scroll_vertical_label=การเลื่อนแนวตั้ง
 scroll_horizontal.title=ใช้การเลื่อนแนวนอน
diff --git a/third-party/pdfjs/web/locale/tr/viewer.properties 
b/third-party/pdfjs/web/locale/tr/viewer.properties
index 7bfba6401..5d725d5c9 100644
--- a/third-party/pdfjs/web/locale/tr/viewer.properties
+++ b/third-party/pdfjs/web/locale/tr/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Metin seçme aracı
 cursor_hand_tool.title=El aracını etkinleştir
 cursor_hand_tool_label=El aracı
 
+scroll_page.title=Sayfa kaydırmayı kullan
+scroll_page_label=Sayfa kaydırma
 scroll_vertical.title=Dikey kaydırma kullan
 scroll_vertical_label=Dikey kaydırma
 scroll_horizontal.title=Yatay kaydırma kullan
diff --git a/third-party/pdfjs/web/locale/uk/viewer.properties 
b/third-party/pdfjs/web/locale/uk/viewer.properties
index 30c609185..546dc589e 100644
--- a/third-party/pdfjs/web/locale/uk/viewer.properties
+++ b/third-party/pdfjs/web/locale/uk/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Інструмент вибору тексту
 cursor_hand_tool.title=Увімкнути інструмент "Рука"
 cursor_hand_tool_label=Інструмент "Рука"
 
+scroll_page.title=Використовувати прокручування сторінки
+scroll_page_label=Прокручування сторінки
 scroll_vertical.title=Використовувати вертикальне прокручування
 scroll_vertical_label=Вертикальне прокручування
 scroll_horizontal.title=Використовувати горизонтальне прокручування
diff --git a/third-party/pdfjs/web/locale/vi/viewer.properties 
b/third-party/pdfjs/web/locale/vi/viewer.properties
index 98aa8d14a..1f100093e 100644
--- a/third-party/pdfjs/web/locale/vi/viewer.properties
+++ b/third-party/pdfjs/web/locale/vi/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=Công cụ chọn vùng văn bản
 cursor_hand_tool.title=Kích hoạt công cụ con trỏ
 cursor_hand_tool_label=Công cụ con trỏ
 
+scroll_page.title=Sử dụng cuộn trang hiện tại
+scroll_page_label=Cuộn trang hiện tại
 scroll_vertical.title=Sử dụng cuộn dọc
 scroll_vertical_label=Cuộn dọc
 scroll_horizontal.title=Sử dụng cuộn ngang
@@ -135,7 +137,7 @@ print_progress_close=Hủy bỏ
 toggle_sidebar.title=Bật/Tắt thanh lề
 toggle_sidebar_notification2.title=Bật tắt thanh lề (tài liệu bao gồm bản phác thảo/tập tin đính kèm/lớp)
 toggle_sidebar_label=Bật/Tắt thanh lề
-document_outline.title=Hiện tài liệu phác thảo (nhấp đúp vào để mở rộng/thu gọn tất cả các mục)
+document_outline.title=Hiển thị tài liệu phác thảo (nhấp đúp vào để mở rộng/thu gọn tất cả các mục)
 document_outline_label=Bản phác tài liệu
 attachments.title=Hiện nội dung đính kèm
 attachments_label=Nội dung đính kèm
diff --git a/third-party/pdfjs/web/locale/zh-CN/viewer.properties 
b/third-party/pdfjs/web/locale/zh-CN/viewer.properties
index b08377130..55aee59b1 100644
--- a/third-party/pdfjs/web/locale/zh-CN/viewer.properties
+++ b/third-party/pdfjs/web/locale/zh-CN/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=文本选择工具
 cursor_hand_tool.title=启用手形工具
 cursor_hand_tool_label=手形工具
 
+scroll_page.title=使用页面滚动
+scroll_page_label=页面滚动
 scroll_vertical.title=使用垂直滚动
 scroll_vertical_label=垂直滚动
 scroll_horizontal.title=使用水平滚动
diff --git a/third-party/pdfjs/web/locale/zh-TW/viewer.properties 
b/third-party/pdfjs/web/locale/zh-TW/viewer.properties
index 322ffd20a..32da91c3e 100644
--- a/third-party/pdfjs/web/locale/zh-TW/viewer.properties
+++ b/third-party/pdfjs/web/locale/zh-TW/viewer.properties
@@ -61,6 +61,8 @@ cursor_text_select_tool_label=文字選擇工具
 cursor_hand_tool.title=開啟頁面移動工具
 cursor_hand_tool_label=頁面移動工具
 
+scroll_page.title=使用頁面捲動功能
+scroll_page_label=頁面捲動功能
 scroll_vertical.title=使用垂直捲動版面
 scroll_vertical_label=垂直捲動
 scroll_horizontal.title=使用水平捲動版面
diff --git a/third-party/pdfjs/web/viewer.css b/third-party/pdfjs/web/viewer.css
index 81a09f7f5..f8fc94ad1 100644
--- a/third-party/pdfjs/web/viewer.css
+++ b/third-party/pdfjs/web/viewer.css
@@ -24,6 +24,9 @@
   overflow: hidden;
   opacity: 0.2;
   line-height: 1;
+  -webkit-text-size-adjust: none;
+     -moz-text-size-adjust: none;
+          text-size-adjust: none;
 }
 
 .textLayer span,
@@ -35,6 +38,13 @@
   transform-origin: 0% 0%;
 }
 
+/* Only necessary in Google Chrome, see issue 14205, and most unfortunately
+ * the problem doesn't show up in "text" reference tests. */
+.textLayer span.markedContent {
+  top: 0;
+  height: 0;
+}
+
 .textLayer .highlight {
   margin: -1px;
   padding: 1px;
@@ -116,6 +126,13 @@
   height: 100%;
 }
 
+.annotationLayer .buttonWidgetAnnotation.pushButton > canvas {
+  position: relative;
+  top: 0;
+  left: 0;
+  z-index: -1;
+}
+
 .annotationLayer .linkAnnotation > a:hover,
 .annotationLayer .buttonWidgetAnnotation.pushButton > a:hover {
   opacity: 0.2;
@@ -231,6 +248,16 @@
   padding-right: 0;
 }
 
+.annotationLayer .textWidgetAnnotation input.comb:focus {
+  /*
+   * Letter spacing is placed on the right side of each character. Hence, the
+   * letter spacing of the last character may be placed outside the visible
+   * area, causing horizontal scrolling. We avoid this by extending the width
+   * when the element has focus and revert this when it loses focus.
+   */
+  width: 103%;
+}
+
 .annotationLayer .buttonWidgetAnnotation.checkBox input,
 .annotationLayer .buttonWidgetAnnotation.radioButton input {
   -webkit-appearance: none;
@@ -268,17 +295,21 @@
   display: inline-block;
 }
 
-.annotationLayer .popup span {
+.annotationLayer .popupDate {
   display: inline-block;
   margin-left: 5px;
 }
 
-.annotationLayer .popup p {
+.annotationLayer .popupContent {
   border-top: 1px solid rgba(51, 51, 51, 1);
   margin-top: 2px;
   padding-top: 2px;
 }
 
+.annotationLayer .richText > * {
+  white-space: pre-wrap;
+}
+
 .annotationLayer .highlightAnnotation,
 .annotationLayer .underlineAnnotation,
 .annotationLayer .squigglyAnnotation,
@@ -511,6 +542,9 @@
 .xfaLink {
   width: 100%;
   height: 100%;
+  position: absolute;
+  top: 0;
+  left: 0;
 }
 
 .xfaCheckbox,
@@ -621,11 +655,12 @@
 }
 
 :root {
-  --pdfViewer-padding-bottom: none;
+  --pdfViewer-padding-bottom: 0;
   --page-margin: 1px auto -8px;
   --page-border: 9px solid transparent;
   --spreadHorizontalWrapped-margin-LR: -3.5px;
   --zoom-factor: 1;
+  --viewport-scale-factor: 1;
 }
 
 @media screen and (forced-colors: active) {
@@ -659,6 +694,12 @@
   background-color: rgba(255, 255, 255, 1);
 }
 
+.pdfViewer .dummyPage {
+  position: relative;
+  width: 0;
+  /* The height is set via JS, see `BaseViewer.#ensurePageViewVisible`. */
+}
+
 .pdfViewer.removePageBorders .page {
   margin: 0 auto 10px;
   border: none;
@@ -694,6 +735,7 @@
 }
 
 .spread .page,
+.spread .dummyPage,
 .pdfViewer.scrollHorizontal .page,
 .pdfViewer.scrollWrapped .page,
 .pdfViewer.scrollHorizontal .spread,
@@ -734,31 +776,28 @@
   bottom: 0;
   background: url("images/loading-icon.gif") center no-repeat;
 }
-
-.pdfPresentationMode .pdfViewer {
-  margin-left: 0;
-  margin-right: 0;
+.pdfViewer .page .loadingIcon.notVisible {
+  background: none;
 }
 
-.pdfPresentationMode .pdfViewer .page,
-.pdfPresentationMode .pdfViewer .spread {
-  display: block;
+.pdfViewer.enablePermissions .textLayer span {
+  -webkit-user-select: none !important;
+     -moz-user-select: none !important;
+          user-select: none !important;
+  cursor: not-allowed;
 }
 
-.pdfPresentationMode .pdfViewer .page,
-.pdfPresentationMode .pdfViewer.removePageBorders .page {
-  margin-left: auto;
-  margin-right: auto;
+.pdfPresentationMode .pdfViewer {
+  padding-bottom: 0;
 }
 
-.pdfPresentationMode:-webkit-full-screen .pdfViewer .page {
-  margin-bottom: 100%;
-  border: 0;
+.pdfPresentationMode .spread {
+  margin: 0;
 }
 
-.pdfPresentationMode:fullscreen .pdfViewer .page {
-  margin-bottom: 100%;
-  border: 0;
+.pdfPresentationMode .pdfViewer .page {
+  margin: 0 auto;
+  border: 2px solid transparent;
 }
 
 :root {
@@ -840,6 +879,7 @@
   --secondaryToolbarButton-rotateCw-icon: url(images/secondaryToolbarButton-rotateCw.svg);
   --secondaryToolbarButton-selectTool-icon: url(images/secondaryToolbarButton-selectTool.svg);
   --secondaryToolbarButton-handTool-icon: url(images/secondaryToolbarButton-handTool.svg);
+  --secondaryToolbarButton-scrollPage-icon: url(images/secondaryToolbarButton-scrollPage.svg);
   --secondaryToolbarButton-scrollVertical-icon: url(images/secondaryToolbarButton-scrollVertical.svg);
   --secondaryToolbarButton-scrollHorizontal-icon: url(images/secondaryToolbarButton-scrollHorizontal.svg);
   --secondaryToolbarButton-scrollWrapped-icon: url(images/secondaryToolbarButton-scrollWrapped.svg);
@@ -949,16 +989,8 @@ select {
   display: none !important;
 }
 
-.pdfViewer.enablePermissions .textLayer span {
-  -webkit-user-select: none !important;
-     -moz-user-select: none !important;
-          user-select: none !important;
-  cursor: not-allowed;
-}
-
 #viewerContainer.pdfPresentationMode:-webkit-full-screen {
   top: 0;
-  border-top: 2px solid rgba(0, 0, 0, 0);
   background-color: rgba(0, 0, 0, 1);
   width: 100%;
   height: 100%;
@@ -970,7 +1002,6 @@ select {
 
 #viewerContainer.pdfPresentationMode:fullscreen {
   top: 0;
-  border-top: 2px solid rgba(0, 0, 0, 0);
   background-color: rgba(0, 0, 0, 1);
   width: 100%;
   height: 100%;
@@ -1409,11 +1440,6 @@ html[dir="rtl"] .secondaryToolbar {
   margin-bottom: -4px;
 }
 
-#secondaryToolbarButtonContainer.hiddenScrollModeButtons > .scrollModeButtons,
-#secondaryToolbarButtonContainer.hiddenSpreadModeButtons > .spreadModeButtons {
-  display: none !important;
-}
-
 .doorHanger,
 .doorHangerRight {
   border-radius: 2px;
@@ -1981,6 +2007,11 @@ html[dir="rtl"] .secondaryToolbarButton > span {
   mask-image: var(--secondaryToolbarButton-handTool-icon);
 }
 
+.secondaryToolbarButton.scrollPage::before {
+  -webkit-mask-image: var(--secondaryToolbarButton-scrollPage-icon);
+  mask-image: var(--secondaryToolbarButton-scrollPage-icon);
+}
+
 .secondaryToolbarButton.scrollVertical::before {
   -webkit-mask-image: var(--secondaryToolbarButton-scrollVertical-icon);
   mask-image: var(--secondaryToolbarButton-scrollVertical-icon);
@@ -2496,6 +2527,7 @@ html[dir="rtl"] #documentPropertiesOverlay .row > * {
 }
 #PDFBug table {
   font-size: 10px;
+  white-space: pre;
 }
 #PDFBug table.showText {
   border-collapse: collapse;
diff --git a/third-party/pdfjs/web/viewer.html b/third-party/pdfjs/web/viewer.html
index db9b7427a..bb2068cd1 100644
--- a/third-party/pdfjs/web/viewer.html
+++ b/third-party/pdfjs/web/viewer.html
@@ -169,31 +169,34 @@ See https://github.com/adobe-type-tools/cmap-resources
 
             <div class="horizontalToolbarSeparator"></div>
 
-            <button id="scrollVertical" class="secondaryToolbarButton scrollModeButtons scrollVertical 
toggled" title="Use Vertical Scrolling" tabindex="62" data-l10n-id="scroll_vertical">
+            <button id="scrollPage" class="secondaryToolbarButton scrollPage" title="Use Page Scrolling" 
tabindex="62" data-l10n-id="scroll_page">
+              <span data-l10n-id="scroll_page_label">Page Scrolling</span>
+            </button>
+            <button id="scrollVertical" class="secondaryToolbarButton scrollVertical toggled" title="Use 
Vertical Scrolling" tabindex="63" data-l10n-id="scroll_vertical">
               <span data-l10n-id="scroll_vertical_label">Vertical Scrolling</span>
             </button>
-            <button id="scrollHorizontal" class="secondaryToolbarButton scrollModeButtons scrollHorizontal" 
title="Use Horizontal Scrolling" tabindex="63" data-l10n-id="scroll_horizontal">
+            <button id="scrollHorizontal" class="secondaryToolbarButton scrollHorizontal" title="Use 
Horizontal Scrolling" tabindex="64" data-l10n-id="scroll_horizontal">
               <span data-l10n-id="scroll_horizontal_label">Horizontal Scrolling</span>
             </button>
-            <button id="scrollWrapped" class="secondaryToolbarButton scrollModeButtons scrollWrapped" 
title="Use Wrapped Scrolling" tabindex="64" data-l10n-id="scroll_wrapped">
+            <button id="scrollWrapped" class="secondaryToolbarButton scrollWrapped" title="Use Wrapped 
Scrolling" tabindex="65" data-l10n-id="scroll_wrapped">
               <span data-l10n-id="scroll_wrapped_label">Wrapped Scrolling</span>
             </button>
 
-            <div class="horizontalToolbarSeparator scrollModeButtons"></div>
+            <div class="horizontalToolbarSeparator"></div>
 
-            <button id="spreadNone" class="secondaryToolbarButton spreadModeButtons spreadNone toggled" 
title="Do not join page spreads" tabindex="65" data-l10n-id="spread_none">
+            <button id="spreadNone" class="secondaryToolbarButton spreadNone toggled" title="Do not join 
page spreads" tabindex="66" data-l10n-id="spread_none">
               <span data-l10n-id="spread_none_label">No Spreads</span>
             </button>
-            <button id="spreadOdd" class="secondaryToolbarButton spreadModeButtons spreadOdd" title="Join 
page spreads starting with odd-numbered pages" tabindex="66" data-l10n-id="spread_odd">
+            <button id="spreadOdd" class="secondaryToolbarButton spreadOdd" title="Join page spreads 
starting with odd-numbered pages" tabindex="67" data-l10n-id="spread_odd">
               <span data-l10n-id="spread_odd_label">Odd Spreads</span>
             </button>
-            <button id="spreadEven" class="secondaryToolbarButton spreadModeButtons spreadEven" title="Join 
page spreads starting with even-numbered pages" tabindex="67" data-l10n-id="spread_even">
+            <button id="spreadEven" class="secondaryToolbarButton spreadEven" title="Join page spreads 
starting with even-numbered pages" tabindex="68" data-l10n-id="spread_even">
               <span data-l10n-id="spread_even_label">Even Spreads</span>
             </button>
 
-            <div class="horizontalToolbarSeparator spreadModeButtons"></div>
+            <div class="horizontalToolbarSeparator"></div>
 
-            <button id="documentProperties" class="secondaryToolbarButton documentProperties" 
title="Document Properties…" tabindex="68" data-l10n-id="document_properties">
+            <button id="documentProperties" class="secondaryToolbarButton documentProperties" 
title="Document Properties…" tabindex="69" data-l10n-id="document_properties">
               <span data-l10n-id="document_properties_label">Document Properties…</span>
             </button>
           </div>
diff --git a/third-party/pdfjs/web/viewer.js b/third-party/pdfjs/web/viewer.js
index cad44eeb1..c11421eaf 100644
--- a/third-party/pdfjs/web/viewer.js
+++ b/third-party/pdfjs/web/viewer.js
@@ -33,7 +33,7 @@
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.OptionKind = exports.compatibilityParams = exports.AppOptions = void 0;
+exports.compatibilityParams = exports.OptionKind = exports.AppOptions = void 0;
 const compatibilityParams = Object.create(null);
 exports.compatibilityParams = compatibilityParams;
 {
@@ -336,11 +336,11 @@ var _ui_utils = __webpack_require__(3);
 
 var _app_options = __webpack_require__(1);
 
-var _pdfjsLib = __webpack_require__(4);
+var _event_utils = __webpack_require__(4);
 
-var _pdf_cursor_tools = __webpack_require__(5);
+var _pdfjsLib = __webpack_require__(5);
 
-var _pdf_rendering_queue = __webpack_require__(7);
+var _pdf_cursor_tools = __webpack_require__(6);
 
 var _overlay_manager = __webpack_require__(8);
 
@@ -364,17 +364,19 @@ var _pdf_outline_viewer = __webpack_require__(19);
 
 var _pdf_presentation_mode = __webpack_require__(20);
 
-var _pdf_scripting_manager = __webpack_require__(21);
+var _pdf_rendering_queue = __webpack_require__(21);
 
-var _pdf_sidebar = __webpack_require__(22);
+var _pdf_scripting_manager = __webpack_require__(22);
 
-var _pdf_sidebar_resizer = __webpack_require__(23);
+var _pdf_sidebar = __webpack_require__(23);
 
-var _pdf_thumbnail_viewer = __webpack_require__(24);
+var _pdf_sidebar_resizer = __webpack_require__(24);
 
-var _pdf_viewer = __webpack_require__(26);
+var _pdf_thumbnail_viewer = __webpack_require__(25);
 
-var _secondary_toolbar = __webpack_require__(35);
+var _pdf_viewer = __webpack_require__(27);
+
+var _secondary_toolbar = __webpack_require__(36);
 
 var _toolbar = __webpack_require__(37);
 
@@ -383,7 +385,6 @@ var _view_history = __webpack_require__(38);
 const DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
 const FORCE_PAGES_LOADED_TIMEOUT = 10000;
 const WHEEL_ZOOM_DISABLED_TIMEOUT = 1000;
-const ENABLE_PERMISSIONS_CLASS = "enablePermissions";
 const ViewOnLoad = {
   UNKNOWN: -1,
   PREVIOUS: 0,
@@ -493,6 +494,7 @@ const PDFViewerApplication = {
   _contentDispositionFilename: null,
   _contentLength: null,
   _saveInProgress: false,
+  _docStats: null,
   _wheelUnusedTicks: 0,
   _idleCallbacks: new Set(),
 
@@ -639,20 +641,17 @@ const PDFViewerApplication = {
     try {
       const styleSheet = document.styleSheets[0];
       const cssRules = styleSheet?.cssRules || [];
-      const mediaMatcher = "prefers-color-scheme";
-      const mediaRule = `(${mediaMatcher}: dark)`;
-      const mediaRegex = new RegExp(`^@media \\(${mediaMatcher}: dark\\) 
{\\n\\s*([\\w\\s-.,:;/\\\\{}()]+)\\n}$`);
 
       for (let i = 0, ii = cssRules.length; i < ii; i++) {
         const rule = cssRules[i];
 
-        if (rule instanceof CSSMediaRule && rule.media?.[0] === mediaRule) {
+        if (rule instanceof CSSMediaRule && rule.media?.[0] === "(prefers-color-scheme: dark)") {
           if (cssTheme === ViewerCssTheme.LIGHT) {
             styleSheet.deleteRule(i);
             return;
           }
 
-          const darkRules = mediaRegex.exec(rule.cssText);
+          const darkRules = /^@media \(prefers-color-scheme: dark\) 
{\n\s*([\w\s-.,:;/\\{}()]+)\n}$/.exec(rule.cssText);
 
           if (darkRules?.[1]) {
             styleSheet.deleteRule(i);
@@ -677,9 +676,9 @@ const PDFViewerApplication = {
     if (appConfig.eventBus) {
       eventBus = appConfig.eventBus;
     } else if (externalServices.isInAutomation) {
-      eventBus = new _ui_utils.AutomationEventBus();
+      eventBus = new _event_utils.AutomationEventBus();
     } else {
-      eventBus = new _ui_utils.EventBus();
+      eventBus = new _event_utils.EventBus();
     }
 
     this.eventBus = eventBus;
@@ -726,7 +725,8 @@ const PDFViewerApplication = {
       imageResourcesPath: _app_options.AppOptions.get("imageResourcesPath"),
       enablePrintAutoRotate: _app_options.AppOptions.get("enablePrintAutoRotate"),
       useOnlyCssZoom: _app_options.AppOptions.get("useOnlyCssZoom"),
-      maxCanvasPixels: _app_options.AppOptions.get("maxCanvasPixels")
+      maxCanvasPixels: _app_options.AppOptions.get("maxCanvasPixels"),
+      enablePermissions: _app_options.AppOptions.get("enablePermissions")
     });
     pdfRenderingQueue.setViewer(this.pdfViewer);
     pdfLinkService.setViewer(this.pdfViewer);
@@ -961,7 +961,6 @@ const PDFViewerApplication = {
       this.pdfDocumentProperties.setDocument(null);
     }
 
-    webViewerResetPermissions();
     this.pdfLinkService.externalLinkEnabled = true;
     this._fellback = false;
     this.store = null;
@@ -975,6 +974,7 @@ const PDFViewerApplication = {
     this._contentDispositionFilename = null;
     this._contentLength = null;
     this._saveInProgress = false;
+    this._docStats = null;
 
     this._cancelIdleCallbacks();
 
@@ -1053,27 +1053,27 @@ const PDFViewerApplication = {
     loadingTask.onUnsupportedFeature = this.fallback.bind(this);
     return loadingTask.promise.then(pdfDocument => {
       this.load(pdfDocument);
-    }, exception => {
+    }, reason => {
       if (loadingTask !== this.pdfLoadingTask) {
         return undefined;
       }
 
       let key = "loading_error";
 
-      if (exception instanceof _pdfjsLib.InvalidPDFException) {
+      if (reason instanceof _pdfjsLib.InvalidPDFException) {
         key = "invalid_file_error";
-      } else if (exception instanceof _pdfjsLib.MissingPDFException) {
+      } else if (reason instanceof _pdfjsLib.MissingPDFException) {
         key = "missing_file_error";
-      } else if (exception instanceof _pdfjsLib.UnexpectedResponseException) {
+      } else if (reason instanceof _pdfjsLib.UnexpectedResponseException) {
         key = "unexpected_response_error";
       }
 
       return this.l10n.get(key).then(msg => {
         this._documentError(msg, {
-          message: exception?.message
+          message: reason?.message
         });
 
-        throw exception;
+        throw reason;
       });
     });
   },
@@ -1361,8 +1361,9 @@ const PDFViewerApplication = {
           sidebarView = (0, _ui_utils.apiPageModeToSidebarView)(pageMode);
         }
 
-        if (pageLayout && spreadMode === _ui_utils.SpreadMode.UNKNOWN) {
-          spreadMode = (0, _ui_utils.apiPageLayoutToSpreadMode)(pageLayout);
+        if (pageLayout && scrollMode === _ui_utils.ScrollMode.UNKNOWN && spreadMode === 
_ui_utils.SpreadMode.UNKNOWN) {
+          const modes = (0, _ui_utils.apiPageLayoutToViewerModes)(pageLayout);
+          spreadMode = modes.spreadMode;
         }
 
         this.setInitialView(hash, {
@@ -1379,8 +1380,6 @@ const PDFViewerApplication = {
           pdfViewer.focus();
         }
 
-        this._initializePermissions(pdfDocument);
-
         await Promise.race([pagesPromise, new Promise(resolve => {
           setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT);
         })]);
@@ -1406,8 +1405,18 @@ const PDFViewerApplication = {
       this._unblockDocumentLoadEvent();
 
       this._initializeAutoPrint(pdfDocument, openActionPromise);
+    }, reason => {
+      this.l10n.get("loading_error").then(msg => {
+        this._documentError(msg, {
+          message: reason?.message
+        });
+      });
     });
-    onePageRendered.then(() => {
+    onePageRendered.then(data => {
+      this.externalServices.reportTelemetry({
+        type: "pageInfo",
+        timestamp: data.timestamp
+      });
       pdfDocument.getOutline().then(outline => {
         if (pdfDocument !== this.pdfDocument) {
           return;
@@ -1646,19 +1655,22 @@ const PDFViewerApplication = {
     }
 
     const numLabels = labels.length;
+    let standardLabels = 0,
+        emptyLabels = 0;
 
-    if (numLabels !== this.pagesCount) {
-      console.error("The number of Page Labels does not match the number of pages in the document.");
-      return;
-    }
-
-    let i = 0;
+    for (let i = 0; i < numLabels; i++) {
+      const label = labels[i];
 
-    while (i < numLabels && labels[i] === (i + 1).toString()) {
-      i++;
+      if (label === (i + 1).toString()) {
+        standardLabels++;
+      } else if (label === "") {
+        emptyLabels++;
+      } else {
+        break;
+      }
     }
 
-    if (i === numLabels) {
+    if (standardLabels >= numLabels || emptyLabels >= numLabels) {
       return;
     }
 
@@ -1702,22 +1714,6 @@ const PDFViewerApplication = {
     }
   },
 
-  async _initializePermissions(pdfDocument) {
-    const permissions = await pdfDocument.getPermissions();
-
-    if (pdfDocument !== this.pdfDocument) {
-      return;
-    }
-
-    if (!permissions || !_app_options.AppOptions.get("enablePermissions")) {
-      return;
-    }
-
-    if (!permissions.includes(_pdfjsLib.PermissionFlag.COPY)) {
-      this.appConfig.viewerContainer.classList.add(ENABLE_PERMISSIONS_CLASS);
-    }
-  },
-
   _initializeAnnotationStorageCallbacks(pdfDocument) {
     if (pdfDocument !== this.pdfDocument) {
       return;
@@ -1938,8 +1934,6 @@ const PDFViewerApplication = {
 
     eventBus._on("documentproperties", webViewerDocumentProperties);
 
-    eventBus._on("find", webViewerFind);
-
     eventBus._on("findfromurlhash", webViewerFindFromUrlHash);
 
     eventBus._on("updatefindmatchescount", webViewerUpdateFindMatchesCount);
@@ -2087,8 +2081,6 @@ const PDFViewerApplication = {
 
     eventBus._off("documentproperties", webViewerDocumentProperties);
 
-    eventBus._off("find", webViewerFind);
-
     eventBus._off("findfromurlhash", webViewerFindFromUrlHash);
 
     eventBus._off("updatefindmatchescount", webViewerUpdateFindMatchesCount);
@@ -2155,6 +2147,20 @@ const PDFViewerApplication = {
     this._unblockDocumentLoadEvent = () => {};
   },
 
+  _reportDocumentStatsTelemetry() {
+    const {
+      stats
+    } = this.pdfDocument;
+
+    if (stats !== this._docStats) {
+      this._docStats = stats;
+      this.externalServices.reportTelemetry({
+        type: "documentStats",
+        stats
+      });
+    }
+  },
+
   get scriptingReady() {
     return this.pdfScriptingManager.ready;
   }
@@ -2307,7 +2313,7 @@ function webViewerInitialized() {
       });
     }
   }, true);
-  
+
   var file_name = document.head.getAttribute('pdf_name')
   var raw = atob(document.head.getAttribute('pdf_data'));
   var raw_length = raw.length;
@@ -2335,21 +2341,8 @@ function webViewerOpenFileViaURL(file) {
   }
 }
 
-function webViewerResetPermissions() {
-  const {
-    appConfig
-  } = PDFViewerApplication;
-
-  if (!appConfig) {
-    return;
-  }
-
-  appConfig.viewerContainer.classList.remove(ENABLE_PERMISSIONS_CLASS);
-}
-
 function webViewerPageRendered({
   pageNumber,
-  timestamp,
   error
 }) {
   if (pageNumber === PDFViewerApplication.page) {
@@ -2371,16 +2364,7 @@ function webViewerPageRendered({
     });
   }
 
-  PDFViewerApplication.externalServices.reportTelemetry({
-    type: "pageInfo",
-    timestamp
-  });
-  PDFViewerApplication.pdfDocument.getStats().then(function (stats) {
-    PDFViewerApplication.externalServices.reportTelemetry({
-      type: "documentStats",
-      stats
-    });
-  });
+  PDFViewerApplication._reportDocumentStatsTelemetry();
 }
 
 function webViewerPageMode({
@@ -2447,48 +2431,42 @@ function webViewerPresentationModeChanged(evt) {
 
 function webViewerSidebarViewChanged(evt) {
   PDFViewerApplication.pdfRenderingQueue.isThumbnailViewEnabled = 
PDFViewerApplication.pdfSidebar.isThumbnailViewVisible;
-  const store = PDFViewerApplication.store;
 
-  if (store && PDFViewerApplication.isInitialViewSet) {
-    store.set("sidebarView", evt.view).catch(function () {});
+  if (PDFViewerApplication.isInitialViewSet) {
+    PDFViewerApplication.store?.set("sidebarView", evt.view).catch(() => {});
   }
 }
 
 function webViewerUpdateViewarea(evt) {
-  const location = evt.location,
-        store = PDFViewerApplication.store;
+  const location = evt.location;
 
-  if (store && PDFViewerApplication.isInitialViewSet) {
-    store.setMultiple({
+  if (PDFViewerApplication.isInitialViewSet) {
+    PDFViewerApplication.store?.setMultiple({
       page: location.pageNumber,
       zoom: location.scale,
       scrollLeft: location.left,
       scrollTop: location.top,
       rotation: location.rotation
-    }).catch(function () {});
+    }).catch(() => {});
   }
 
   const href = PDFViewerApplication.pdfLinkService.getAnchorUrl(location.pdfOpenParams);
   PDFViewerApplication.appConfig.toolbar.viewBookmark.href = href;
   PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href = href;
   const currentPage = PDFViewerApplication.pdfViewer.getPageView(PDFViewerApplication.page - 1);
-  const loading = currentPage?.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED;
+  const loading = currentPage?.renderingState !== _ui_utils.RenderingStates.FINISHED;
   PDFViewerApplication.toolbar.updateLoadingIndicatorState(loading);
 }
 
 function webViewerScrollModeChanged(evt) {
-  const store = PDFViewerApplication.store;
-
-  if (store && PDFViewerApplication.isInitialViewSet) {
-    store.set("scrollMode", evt.mode).catch(function () {});
+  if (PDFViewerApplication.isInitialViewSet) {
+    PDFViewerApplication.store?.set("scrollMode", evt.mode).catch(() => {});
   }
 }
 
 function webViewerSpreadModeChanged(evt) {
-  const store = PDFViewerApplication.store;
-
-  if (store && PDFViewerApplication.isInitialViewSet) {
-    store.set("spreadMode", evt.mode).catch(function () {});
+  if (PDFViewerApplication.isInitialViewSet) {
+    PDFViewerApplication.store?.set("spreadMode", evt.mode).catch(() => {});
   }
 }
 
@@ -2656,19 +2634,10 @@ function webViewerDocumentProperties() {
   PDFViewerApplication.pdfDocumentProperties.open();
 }
 
-function webViewerFind(evt) {
-  PDFViewerApplication.findController.executeCommand("find" + evt.type, {
-    query: evt.query,
-    phraseSearch: evt.phraseSearch,
-    caseSensitive: evt.caseSensitive,
-    entireWord: evt.entireWord,
-    highlightAll: evt.highlightAll,
-    findPrevious: evt.findPrevious
-  });
-}
-
 function webViewerFindFromUrlHash(evt) {
-  PDFViewerApplication.findController.executeCommand("find", {
+  PDFViewerApplication.eventBus.dispatch("find", {
+    source: evt.source,
+    type: "",
     query: evt.query,
     phraseSearch: evt.phraseSearch,
     caseSensitive: false,
@@ -2823,11 +2792,14 @@ function webViewerKeyDown(evt) {
     return;
   }
 
+  const {
+    eventBus,
+    pdfViewer
+  } = PDFViewerApplication;
+  const isViewerInPresentationMode = pdfViewer.isInPresentationMode;
   let handled = false,
       ensureViewerFocused = false;
   const cmd = (evt.ctrlKey ? 1 : 0) | (evt.altKey ? 2 : 0) | (evt.shiftKey ? 4 : 0) | (evt.metaKey ? 8 : 0);
-  const pdfViewer = PDFViewerApplication.pdfViewer;
-  const isViewerInPresentationMode = pdfViewer?.isInPresentationMode;
 
   if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {
     switch (evt.keyCode) {
@@ -2841,17 +2813,17 @@ function webViewerKeyDown(evt) {
 
       case 71:
         if (!PDFViewerApplication.supportsIntegratedFind) {
-          const findState = PDFViewerApplication.findController.state;
-
-          if (findState) {
-            PDFViewerApplication.findController.executeCommand("findagain", {
-              query: findState.query,
-              phraseSearch: findState.phraseSearch,
-              caseSensitive: findState.caseSensitive,
-              entireWord: findState.entireWord,
-              highlightAll: findState.highlightAll,
+          const {
+            state
+          } = PDFViewerApplication.findController;
+
+          if (state) {
+            const eventState = Object.assign(Object.create(null), state, {
+              source: window,
+              type: "again",
               findPrevious: cmd === 5 || cmd === 12
             });
+            eventBus.dispatch("find", eventState);
           }
 
           handled = true;
@@ -2911,10 +2883,6 @@ function webViewerKeyDown(evt) {
     }
   }
 
-  const {
-    eventBus
-  } = PDFViewerApplication;
-
   if (cmd === 1 || cmd === 8) {
     switch (evt.keyCode) {
       case 83:
@@ -3094,10 +3062,7 @@ function webViewerKeyDown(evt) {
           break;
         }
 
-        if (PDFViewerApplication.page > 1) {
-          PDFViewerApplication.page--;
-        }
-
+        pdfViewer.previousPage();
         handled = true;
         break;
 
@@ -3149,7 +3114,8 @@ exports.PDFPrintServiceFactory = PDFPrintServiceFactory;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.apiPageLayoutToSpreadMode = apiPageLayoutToSpreadMode;
+exports.animationStarted = exports.VERTICAL_PADDING = exports.UNKNOWN_SCALE = exports.TextLayerMode = 
exports.SpreadMode = exports.SidebarView = exports.ScrollMode = exports.SCROLLBAR_PADDING = 
exports.RenderingStates = exports.RendererType = exports.ProgressBar = exports.PresentationModeState = 
exports.MIN_SCALE = exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.DEFAULT_SCALE_VALUE = 
exports.DEFAULT_SCALE_DELTA = exports.DEFAULT_SCALE = exports.AutoPrintRegExp = void 0;
+exports.apiPageLayoutToViewerModes = apiPageLayoutToViewerModes;
 exports.apiPageModeToSidebarView = apiPageModeToSidebarView;
 exports.approximateFraction = approximateFraction;
 exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements;
@@ -3162,16 +3128,13 @@ exports.isPortraitOrientation = isPortraitOrientation;
 exports.isValidRotation = isValidRotation;
 exports.isValidScrollMode = isValidScrollMode;
 exports.isValidSpreadMode = isValidSpreadMode;
-exports.moveToEndOfArray = moveToEndOfArray;
 exports.noContextMenuHandler = noContextMenuHandler;
 exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
 exports.normalizeWheelEventDirection = normalizeWheelEventDirection;
 exports.parseQueryString = parseQueryString;
 exports.roundToDivide = roundToDivide;
 exports.scrollIntoView = scrollIntoView;
-exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
 exports.watchScroll = watchScroll;
-exports.WaitOnType = exports.VERTICAL_PADDING = exports.UNKNOWN_SCALE = exports.TextLayerMode = 
exports.SpreadMode = exports.SidebarView = exports.ScrollMode = exports.SCROLLBAR_PADDING = 
exports.RendererType = exports.ProgressBar = exports.PresentationModeState = exports.MIN_SCALE = 
exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.EventBus = exports.DEFAULT_SCALE_VALUE = 
exports.DEFAULT_SCALE_DELTA = exports.DEFAULT_SCALE = exports.AutoPrintRegExp = exports.AutomationEventBus = 
exports.animationStarted = void 0;
 const DEFAULT_SCALE_VALUE = "auto";
 exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
 const DEFAULT_SCALE = 1.0;
@@ -3191,6 +3154,13 @@ exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
 const VERTICAL_PADDING = 5;
 exports.VERTICAL_PADDING = VERTICAL_PADDING;
 const LOADINGBAR_END_OFFSET_VAR = "--loadingBar-end-offset";
+const RenderingStates = {
+  INITIAL: 0,
+  RUNNING: 1,
+  PAUSED: 2,
+  FINISHED: 3
+};
+exports.RenderingStates = RenderingStates;
 const PresentationModeState = {
   UNKNOWN: 0,
   NORMAL: 1,
@@ -3222,7 +3192,8 @@ const ScrollMode = {
   UNKNOWN: -1,
   VERTICAL: 0,
   HORIZONTAL: 1,
-  WRAPPED: 2
+  WRAPPED: 2,
+  PAGE: 3
 };
 exports.ScrollMode = ScrollMode;
 const SpreadMode = {
@@ -3324,11 +3295,8 @@ function watchScroll(viewAreaElement, callback) {
 function parseQueryString(query) {
   const params = new Map();
 
-  for (const part of query.split("&")) {
-    const param = part.split("="),
-          key = param[0].toLowerCase(),
-          value = param.length > 1 ? param[1] : "";
-    params.set(decodeURIComponent(key), decodeURIComponent(value));
+  for (const [key, value] of new URLSearchParams(query)) {
+    params.set(key.toLowerCase(), value);
   }
 
   return params;
@@ -3480,6 +3448,7 @@ function getVisibleElements({
   }
 
   const visible = [],
+        ids = new Set(),
         numViews = views.length;
   let firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally 
: isElementBottomAfterViewTop);
 
@@ -3524,6 +3493,7 @@ function getVisibleElements({
       percent,
       widthPercent: fractionWidth * 100 | 0
     });
+    ids.add(view.id);
   }
 
   const first = visible[0],
@@ -3544,7 +3514,8 @@ function getVisibleElements({
   return {
     first,
     last,
-    views: visible
+    views: visible,
+    ids
   };
 }
 
@@ -3595,145 +3566,11 @@ function isPortraitOrientation(size) {
   return size.width <= size.height;
 }
 
-const WaitOnType = {
-  EVENT: "event",
-  TIMEOUT: "timeout"
-};
-exports.WaitOnType = WaitOnType;
-
-function waitOnEventOrTimeout({
-  target,
-  name,
-  delay = 0
-}) {
-  return new Promise(function (resolve, reject) {
-    if (typeof target !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && 
delay >= 0)) {
-      throw new Error("waitOnEventOrTimeout - invalid parameters.");
-    }
-
-    function handler(type) {
-      if (target instanceof EventBus) {
-        target._off(name, eventHandler);
-      } else {
-        target.removeEventListener(name, eventHandler);
-      }
-
-      if (timeout) {
-        clearTimeout(timeout);
-      }
-
-      resolve(type);
-    }
-
-    const eventHandler = handler.bind(null, WaitOnType.EVENT);
-
-    if (target instanceof EventBus) {
-      target._on(name, eventHandler);
-    } else {
-      target.addEventListener(name, eventHandler);
-    }
-
-    const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
-    const timeout = setTimeout(timeoutHandler, delay);
-  });
-}
-
 const animationStarted = new Promise(function (resolve) {
   window.requestAnimationFrame(resolve);
 });
 exports.animationStarted = animationStarted;
 
-class EventBus {
-  constructor() {
-    this._listeners = Object.create(null);
-  }
-
-  on(eventName, listener, options = null) {
-    this._on(eventName, listener, {
-      external: true,
-      once: options?.once
-    });
-  }
-
-  off(eventName, listener, options = null) {
-    this._off(eventName, listener, {
-      external: true,
-      once: options?.once
-    });
-  }
-
-  dispatch(eventName, data) {
-    const eventListeners = this._listeners[eventName];
-
-    if (!eventListeners || eventListeners.length === 0) {
-      return;
-    }
-
-    let externalListeners;
-
-    for (const {
-      listener,
-      external,
-      once
-    } of eventListeners.slice(0)) {
-      if (once) {
-        this._off(eventName, listener);
-      }
-
-      if (external) {
-        (externalListeners ||= []).push(listener);
-        continue;
-      }
-
-      listener(data);
-    }
-
-    if (externalListeners) {
-      for (const listener of externalListeners) {
-        listener(data);
-      }
-
-      externalListeners = null;
-    }
-  }
-
-  _on(eventName, listener, options = null) {
-    const eventListeners = this._listeners[eventName] ||= [];
-    eventListeners.push({
-      listener,
-      external: options?.external === true,
-      once: options?.once === true
-    });
-  }
-
-  _off(eventName, listener, options = null) {
-    const eventListeners = this._listeners[eventName];
-
-    if (!eventListeners) {
-      return;
-    }
-
-    for (let i = 0, ii = eventListeners.length; i < ii; i++) {
-      if (eventListeners[i].listener === listener) {
-        eventListeners.splice(i, 1);
-        return;
-      }
-    }
-  }
-
-}
-
-exports.EventBus = EventBus;
-
-class AutomationEventBus extends EventBus {
-  dispatch(eventName, data) {
-    throw new Error("Not implemented: AutomationEventBus.dispatch");
-  }
-
-}
-
-exports.AutomationEventBus = AutomationEventBus;
-
 function clamp(v, min, max) {
   return Math.min(Math.max(v, min), max);
 }
@@ -3813,25 +3650,6 @@ class ProgressBar {
 
 exports.ProgressBar = ProgressBar;
 
-function moveToEndOfArray(arr, condition) {
-  const moved = [],
-        len = arr.length;
-  let write = 0;
-
-  for (let read = 0; read < len; ++read) {
-    if (condition(arr[read])) {
-      moved.push(arr[read]);
-    } else {
-      arr[write] = arr[read];
-      ++write;
-    }
-  }
-
-  for (let read = 0; write < len; ++read, ++write) {
-    arr[write] = moved[read];
-  }
-}
-
 function getActiveOrFocusedElement() {
   let curRoot = document;
   let curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
@@ -3844,22 +3662,37 @@ function getActiveOrFocusedElement() {
   return curActiveOrFocused;
 }
 
-function apiPageLayoutToSpreadMode(layout) {
+function apiPageLayoutToViewerModes(layout) {
+  let scrollMode = ScrollMode.VERTICAL,
+      spreadMode = SpreadMode.NONE;
+
   switch (layout) {
     case "SinglePage":
+      scrollMode = ScrollMode.PAGE;
+      break;
+
     case "OneColumn":
-      return SpreadMode.NONE;
+      break;
 
-    case "TwoColumnLeft":
     case "TwoPageLeft":
-      return SpreadMode.ODD;
+      scrollMode = ScrollMode.PAGE;
+
+    case "TwoColumnLeft":
+      spreadMode = SpreadMode.ODD;
+      break;
 
-    case "TwoColumnRight":
     case "TwoPageRight":
-      return SpreadMode.EVEN;
+      scrollMode = ScrollMode.PAGE;
+
+    case "TwoColumnRight":
+      spreadMode = SpreadMode.EVEN;
+      break;
   }
 
-  return SpreadMode.NONE;
+  return {
+    scrollMode,
+    spreadMode
+  };
 }
 
 function apiPageModeToSidebarView(mode) {
@@ -3885,33 +3718,178 @@ function apiPageModeToSidebarView(mode) {
 
 /***/ }),
 /* 4 */
-/***/ ((module) => {
-
-
-
-let pdfjsLib;
-
-if (typeof window !== "undefined" && window["pdfjs-dist/build/pdf"]) {
-  pdfjsLib = window["pdfjs-dist/build/pdf"];
-} else {
-  pdfjsLib = require("../build/pdf.js");
-}
-
-module.exports = pdfjsLib;
-
-/***/ }),
-/* 5 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+/***/ ((__unused_webpack_module, exports) => {
 
 
 
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.PDFCursorTools = exports.CursorTool = void 0;
-
-var _grab_to_pan = __webpack_require__(6);
-
+exports.WaitOnType = exports.EventBus = exports.AutomationEventBus = void 0;
+exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
+const WaitOnType = {
+  EVENT: "event",
+  TIMEOUT: "timeout"
+};
+exports.WaitOnType = WaitOnType;
+
+function waitOnEventOrTimeout({
+  target,
+  name,
+  delay = 0
+}) {
+  return new Promise(function (resolve, reject) {
+    if (typeof target !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && 
delay >= 0)) {
+      throw new Error("waitOnEventOrTimeout - invalid parameters.");
+    }
+
+    function handler(type) {
+      if (target instanceof EventBus) {
+        target._off(name, eventHandler);
+      } else {
+        target.removeEventListener(name, eventHandler);
+      }
+
+      if (timeout) {
+        clearTimeout(timeout);
+      }
+
+      resolve(type);
+    }
+
+    const eventHandler = handler.bind(null, WaitOnType.EVENT);
+
+    if (target instanceof EventBus) {
+      target._on(name, eventHandler);
+    } else {
+      target.addEventListener(name, eventHandler);
+    }
+
+    const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
+    const timeout = setTimeout(timeoutHandler, delay);
+  });
+}
+
+class EventBus {
+  constructor() {
+    this._listeners = Object.create(null);
+  }
+
+  on(eventName, listener, options = null) {
+    this._on(eventName, listener, {
+      external: true,
+      once: options?.once
+    });
+  }
+
+  off(eventName, listener, options = null) {
+    this._off(eventName, listener, {
+      external: true,
+      once: options?.once
+    });
+  }
+
+  dispatch(eventName, data) {
+    const eventListeners = this._listeners[eventName];
+
+    if (!eventListeners || eventListeners.length === 0) {
+      return;
+    }
+
+    let externalListeners;
+
+    for (const {
+      listener,
+      external,
+      once
+    } of eventListeners.slice(0)) {
+      if (once) {
+        this._off(eventName, listener);
+      }
+
+      if (external) {
+        (externalListeners ||= []).push(listener);
+        continue;
+      }
+
+      listener(data);
+    }
+
+    if (externalListeners) {
+      for (const listener of externalListeners) {
+        listener(data);
+      }
+
+      externalListeners = null;
+    }
+  }
+
+  _on(eventName, listener, options = null) {
+    const eventListeners = this._listeners[eventName] ||= [];
+    eventListeners.push({
+      listener,
+      external: options?.external === true,
+      once: options?.once === true
+    });
+  }
+
+  _off(eventName, listener, options = null) {
+    const eventListeners = this._listeners[eventName];
+
+    if (!eventListeners) {
+      return;
+    }
+
+    for (let i = 0, ii = eventListeners.length; i < ii; i++) {
+      if (eventListeners[i].listener === listener) {
+        eventListeners.splice(i, 1);
+        return;
+      }
+    }
+  }
+
+}
+
+exports.EventBus = EventBus;
+
+class AutomationEventBus extends EventBus {
+  dispatch(eventName, data) {
+    throw new Error("Not implemented: AutomationEventBus.dispatch");
+  }
+
+}
+
+exports.AutomationEventBus = AutomationEventBus;
+
+/***/ }),
+/* 5 */
+/***/ ((module) => {
+
+
+
+let pdfjsLib;
+
+if (typeof window !== "undefined" && window["pdfjs-dist/build/pdf"]) {
+  pdfjsLib = window["pdfjs-dist/build/pdf"];
+} else {
+  pdfjsLib = require("../build/pdf.js");
+}
+
+module.exports = pdfjsLib;
+
+/***/ }),
+/* 6 */
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+  value: true
+}));
+exports.PDFCursorTools = exports.CursorTool = void 0;
+
+var _grab_to_pan = __webpack_require__(7);
+
 var _ui_utils = __webpack_require__(3);
 
 const CursorTool = {
@@ -4027,7 +4005,7 @@ class PDFCursorTools {
 exports.PDFCursorTools = PDFCursorTools;
 
 /***/ }),
-/* 6 */
+/* 7 */
 /***/ ((__unused_webpack_module, exports) => {
 
 
@@ -4035,65 +4013,63 @@ exports.PDFCursorTools = PDFCursorTools;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.GrabToPan = GrabToPan;
+exports.GrabToPan = void 0;
+const CSS_CLASS_GRAB = "grab-to-pan-grab";
 
-function GrabToPan(options) {
-  this.element = options.element;
-  this.document = options.element.ownerDocument;
+class GrabToPan {
+  constructor(options) {
+    this.element = options.element;
+    this.document = options.element.ownerDocument;
 
-  if (typeof options.ignoreTarget === "function") {
-    this.ignoreTarget = options.ignoreTarget;
-  }
+    if (typeof options.ignoreTarget === "function") {
+      this.ignoreTarget = options.ignoreTarget;
+    }
 
-  this.onActiveChanged = options.onActiveChanged;
-  this.activate = this.activate.bind(this);
-  this.deactivate = this.deactivate.bind(this);
-  this.toggle = this.toggle.bind(this);
-  this._onmousedown = this._onmousedown.bind(this);
-  this._onmousemove = this._onmousemove.bind(this);
-  this._endPan = this._endPan.bind(this);
-  const overlay = this.overlay = document.createElement("div");
-  overlay.className = "grab-to-pan-grabbing";
-}
+    this.onActiveChanged = options.onActiveChanged;
+    this.activate = this.activate.bind(this);
+    this.deactivate = this.deactivate.bind(this);
+    this.toggle = this.toggle.bind(this);
+    this._onMouseDown = this.#onMouseDown.bind(this);
+    this._onMouseMove = this.#onMouseMove.bind(this);
+    this._endPan = this.#endPan.bind(this);
+    const overlay = this.overlay = document.createElement("div");
+    overlay.className = "grab-to-pan-grabbing";
+  }
 
-GrabToPan.prototype = {
-  CSS_CLASS_GRAB: "grab-to-pan-grab",
-  activate: function GrabToPan_activate() {
+  activate() {
     if (!this.active) {
       this.active = true;
-      this.element.addEventListener("mousedown", this._onmousedown, true);
-      this.element.classList.add(this.CSS_CLASS_GRAB);
-
-      if (this.onActiveChanged) {
-        this.onActiveChanged(true);
-      }
+      this.element.addEventListener("mousedown", this._onMouseDown, true);
+      this.element.classList.add(CSS_CLASS_GRAB);
+      this.onActiveChanged?.(true);
     }
-  },
-  deactivate: function GrabToPan_deactivate() {
+  }
+
+  deactivate() {
     if (this.active) {
       this.active = false;
-      this.element.removeEventListener("mousedown", this._onmousedown, true);
+      this.element.removeEventListener("mousedown", this._onMouseDown, true);
 
       this._endPan();
 
-      this.element.classList.remove(this.CSS_CLASS_GRAB);
-
-      if (this.onActiveChanged) {
-        this.onActiveChanged(false);
-      }
+      this.element.classList.remove(CSS_CLASS_GRAB);
+      this.onActiveChanged?.(false);
     }
-  },
-  toggle: function GrabToPan_toggle() {
+  }
+
+  toggle() {
     if (this.active) {
       this.deactivate();
     } else {
       this.activate();
     }
-  },
-  ignoreTarget: function GrabToPan_ignoreTarget(node) {
+  }
+
+  ignoreTarget(node) {
     return node.matches("a[href], a[href] *, input, textarea, button, button *, select, option");
-  },
-  _onmousedown: function GrabToPan__onmousedown(event) {
+  }
+
+  #onMouseDown(event) {
     if (event.button !== 0 || this.ignoreTarget(event.target)) {
       return;
     }
@@ -4110,7 +4086,7 @@ GrabToPan.prototype = {
     this.scrollTopStart = this.element.scrollTop;
     this.clientXStart = event.clientX;
     this.clientYStart = event.clientY;
-    this.document.addEventListener("mousemove", this._onmousemove, true);
+    this.document.addEventListener("mousemove", this._onMouseMove, true);
     this.document.addEventListener("mouseup", this._endPan, true);
     this.element.addEventListener("scroll", this._endPan, true);
     event.preventDefault();
@@ -4120,11 +4096,12 @@ GrabToPan.prototype = {
     if (focusedElement && !focusedElement.contains(event.target)) {
       focusedElement.blur();
     }
-  },
-  _onmousemove: function GrabToPan__onmousemove(event) {
+  }
+
+  #onMouseMove(event) {
     this.element.removeEventListener("scroll", this._endPan, true);
 
-    if (isLeftMouseReleased(event)) {
+    if (!(event.buttons & 1)) {
       this._endPan();
 
       return;
@@ -4149,178 +4126,18 @@ GrabToPan.prototype = {
     if (!this.overlay.parentNode) {
       document.body.appendChild(this.overlay);
     }
-  },
-  _endPan: function GrabToPan__endPan() {
+  }
+
+  #endPan() {
     this.element.removeEventListener("scroll", this._endPan, true);
-    this.document.removeEventListener("mousemove", this._onmousemove, true);
+    this.document.removeEventListener("mousemove", this._onMouseMove, true);
     this.document.removeEventListener("mouseup", this._endPan, true);
     this.overlay.remove();
   }
-};
-
-function isLeftMouseReleased(event) {
-  if ("buttons" in event) {
-    return !(event.buttons & 1);
-  }
-
-  const chrome = window.chrome;
-  const isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app);
-  const isSafari6plus = /Apple/.test(navigator.vendor) && 
/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);
-
-  if (isChrome15OrOpera15plus || isSafari6plus) {
-    return event.which === 0;
-  }
-
-  return false;
-}
-
-/***/ }),
-/* 7 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-
-
-Object.defineProperty(exports, "__esModule", ({
-  value: true
-}));
-exports.RenderingStates = exports.PDFRenderingQueue = void 0;
-
-var _pdfjsLib = __webpack_require__(4);
-
-const CLEANUP_TIMEOUT = 30000;
-const RenderingStates = {
-  INITIAL: 0,
-  RUNNING: 1,
-  PAUSED: 2,
-  FINISHED: 3
-};
-exports.RenderingStates = RenderingStates;
-
-class PDFRenderingQueue {
-  constructor() {
-    this.pdfViewer = null;
-    this.pdfThumbnailViewer = null;
-    this.onIdle = null;
-    this.highestPriorityPage = null;
-    this.idleTimeout = null;
-    this.printing = false;
-    this.isThumbnailViewEnabled = false;
-  }
-
-  setViewer(pdfViewer) {
-    this.pdfViewer = pdfViewer;
-  }
-
-  setThumbnailViewer(pdfThumbnailViewer) {
-    this.pdfThumbnailViewer = pdfThumbnailViewer;
-  }
-
-  isHighestPriority(view) {
-    return this.highestPriorityPage === view.renderingId;
-  }
-
-  hasViewer() {
-    return !!this.pdfViewer;
-  }
-
-  renderHighestPriority(currentlyVisiblePages) {
-    if (this.idleTimeout) {
-      clearTimeout(this.idleTimeout);
-      this.idleTimeout = null;
-    }
-
-    if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {
-      return;
-    }
-
-    if (this.pdfThumbnailViewer && this.isThumbnailViewEnabled) {
-      if (this.pdfThumbnailViewer.forceRendering()) {
-        return;
-      }
-    }
-
-    if (this.printing) {
-      return;
-    }
-
-    if (this.onIdle) {
-      this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);
-    }
-  }
-
-  getHighestPriority(visible, views, scrolledDown, preRenderExtra = false) {
-    const visibleViews = visible.views;
-    const numVisible = visibleViews.length;
-
-    if (numVisible === 0) {
-      return null;
-    }
-
-    for (let i = 0; i < numVisible; ++i) {
-      const view = visibleViews[i].view;
-
-      if (!this.isViewFinished(view)) {
-        return view;
-      }
-    }
-
-    let preRenderIndex = scrolledDown ? visible.last.id : visible.first.id - 2;
-    let preRenderView = views[preRenderIndex];
-
-    if (preRenderView && !this.isViewFinished(preRenderView)) {
-      return preRenderView;
-    }
-
-    if (preRenderExtra) {
-      preRenderIndex += scrolledDown ? 1 : -1;
-      preRenderView = views[preRenderIndex];
-
-      if (preRenderView && !this.isViewFinished(preRenderView)) {
-        return preRenderView;
-      }
-    }
-
-    return null;
-  }
-
-  isViewFinished(view) {
-    return view.renderingState === RenderingStates.FINISHED;
-  }
-
-  renderView(view) {
-    switch (view.renderingState) {
-      case RenderingStates.FINISHED:
-        return false;
-
-      case RenderingStates.PAUSED:
-        this.highestPriorityPage = view.renderingId;
-        view.resume();
-        break;
-
-      case RenderingStates.RUNNING:
-        this.highestPriorityPage = view.renderingId;
-        break;
-
-      case RenderingStates.INITIAL:
-        this.highestPriorityPage = view.renderingId;
-        view.draw().finally(() => {
-          this.renderHighestPriority();
-        }).catch(reason => {
-          if (reason instanceof _pdfjsLib.RenderingCancelledException) {
-            return;
-          }
-
-          console.error(`renderView: "${reason}"`);
-        });
-        break;
-    }
-
-    return true;
-  }
 
 }
 
-exports.PDFRenderingQueue = PDFRenderingQueue;
+exports.GrabToPan = GrabToPan;
 
 /***/ }),
 /* 8 */
@@ -4443,7 +4260,7 @@ Object.defineProperty(exports, "__esModule", ({
 }));
 exports.PasswordPrompt = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 class PasswordPrompt {
   constructor(options, overlayManager, l10n, isViewerEmbedded = false) {
@@ -4514,7 +4331,7 @@ Object.defineProperty(exports, "__esModule", ({
 }));
 exports.PDFAttachmentViewer = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 var _base_tree_viewer = __webpack_require__(11);
 
@@ -4669,7 +4486,7 @@ Object.defineProperty(exports, "__esModule", ({
 }));
 exports.BaseTreeViewer = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 const TREEITEM_OFFSET_TOP = -100;
 const TREEITEM_SELECTED_CLASS = "selected";
@@ -4702,7 +4519,7 @@ class BaseTreeViewer {
   }
 
   _normalizeTextContent(str) {
-    return (0, _pdfjsLib.removeNullCharacters)(str) || "\u2013";
+    return (0, _pdfjsLib.removeNullCharacters)(str, true) || "\u2013";
   }
 
   _addToggleButton(div, hidden = false) {
@@ -4803,7 +4620,7 @@ Object.defineProperty(exports, "__esModule", ({
 }));
 exports.PDFDocumentProperties = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 var _ui_utils = __webpack_require__(3);
 
@@ -5137,7 +4954,7 @@ class PDFFindBar {
     this.updateUIState();
   }
 
-  dispatchEvent(type, findPrev) {
+  dispatchEvent(type, findPrev = false) {
     this.eventBus.dispatch("find", {
       source: this,
       type,
@@ -5276,7 +5093,7 @@ Object.defineProperty(exports, "__esModule", ({
 }));
 exports.PDFFindController = exports.FindState = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 var _pdf_find_utils = __webpack_require__(15);
 
@@ -5363,7 +5180,18 @@ class PDFFindController {
 
     this._reset();
 
+    eventBus._on("find", this._onFind.bind(this));
+
     eventBus._on("findbarclose", this._onFindBarClose.bind(this));
+
+    this.executeCommand = (cmd, state) => {
+      console.error("Deprecated method `PDFFindController.executeCommand` called, " + 'please dispatch a 
"find"-event using the EventBus instead.');
+      const eventState = Object.assign(Object.create(null), state, {
+        type: cmd.substring("find".length)
+      });
+
+      this._onFind(eventState);
+    };
   }
 
   get highlightMatches() {
@@ -5400,20 +5228,23 @@ class PDFFindController {
     this._firstPageCapability.resolve();
   }
 
-  executeCommand(cmd, state) {
+  _onFind(state) {
     if (!state) {
       return;
     }
 
     const pdfDocument = this._pdfDocument;
+    const {
+      type
+    } = state;
 
-    if (this._state === null || this._shouldDirtyMatch(cmd, state)) {
+    if (this._state === null || this._shouldDirtyMatch(state)) {
       this._dirtyMatch = true;
     }
 
     this._state = state;
 
-    if (cmd !== "findhighlightallchange") {
+    if (type !== "highlightallchange") {
       this._updateUIState(FindState.PENDING);
     }
 
@@ -5432,7 +5263,7 @@ class PDFFindController {
         this._findTimeout = null;
       }
 
-      if (cmd === "find") {
+      if (!type) {
         this._findTimeout = setTimeout(() => {
           this._nextMatch();
 
@@ -5440,13 +5271,13 @@ class PDFFindController {
         }, FIND_TIMEOUT);
       } else if (this._dirtyMatch) {
         this._nextMatch();
-      } else if (cmd === "findagain") {
+      } else if (type === "again") {
         this._nextMatch();
 
         if (findbarClosed && this._state.highlightAll) {
           this._updateAllPages();
         }
-      } else if (cmd === "findhighlightallchange") {
+      } else if (type === "highlightallchange") {
         if (pendingTimeout) {
           this._nextMatch();
         } else {
@@ -5520,13 +5351,13 @@ class PDFFindController {
     return this._normalizedQuery;
   }
 
-  _shouldDirtyMatch(cmd, state) {
+  _shouldDirtyMatch(state) {
     if (state.query !== this._state.query) {
       return true;
     }
 
-    switch (cmd) {
-      case "findagain":
+    switch (state.type) {
+      case "again":
         const pageNumber = this._selected.pageIdx + 1;
         const linkService = this._linkService;
 
@@ -5536,7 +5367,7 @@ class PDFFindController {
 
         return false;
 
-      case "findhighlightallchange":
+      case "highlightallchange":
         return false;
     }
 
@@ -5980,7 +5811,7 @@ class PDFFindController {
     });
   }
 
-  _updateUIState(state, previous) {
+  _updateUIState(state, previous = false) {
     this._eventBus.dispatch("updatefindcontrolstate", {
       source: this,
       state,
@@ -6003,8 +5834,8 @@ exports.PDFFindController = PDFFindController;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.getCharacterType = getCharacterType;
 exports.CharacterType = void 0;
+exports.getCharacterType = getCharacterType;
 const CharacterType = {
   SPACE: 0,
   ALPHA_LETTER: 1,
@@ -6098,12 +5929,14 @@ function getCharacterType(charCode) {
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.PDFHistory = void 0;
 exports.isDestArraysEqual = isDestArraysEqual;
 exports.isDestHashesEqual = isDestHashesEqual;
-exports.PDFHistory = void 0;
 
 var _ui_utils = __webpack_require__(3);
 
+var _event_utils = __webpack_require__(4);
+
 const HASH_CHANGE_TIMEOUT = 1000;
 const POSITION_UPDATED_THRESHOLD = 50;
 const UPDATE_VIEWAREA_TIMEOUT = 1000;
@@ -6572,7 +6405,7 @@ class PDFHistory {
 
     if (hashChanged) {
       this._blockHashChange++;
-      (0, _ui_utils.waitOnEventOrTimeout)({
+      (0, _event_utils.waitOnEventOrTimeout)({
         target: window,
         name: "hashchange",
         delay: HASH_CHANGE_TIMEOUT
@@ -6898,7 +6731,7 @@ Object.defineProperty(exports, "__esModule", ({
 }));
 exports.SimpleLinkService = exports.PDFLinkService = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 var _ui_utils = __webpack_require__(3);
 
@@ -6962,7 +6795,7 @@ class PDFLinkService {
     if (typeof destRef === "object" && destRef !== null) {
       pageNumber = this._cachedPageNumber(destRef);
 
-      if (pageNumber === null) {
+      if (!pageNumber) {
         this.pdfDocument.getPageIndex(destRef).then(pageIndex => {
           this.cachePageRef(pageIndex + 1, destRef);
 
@@ -7214,6 +7047,10 @@ class PDFLinkService {
   }
 
   _cachedPageNumber(pageRef) {
+    if (!pageRef) {
+      return null;
+    }
+
     const refStr = pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;
     return this._pagesRefCache?.[refStr] || null;
   }
@@ -7371,7 +7208,7 @@ exports.PDFOutlineViewer = void 0;
 
 var _base_tree_viewer = __webpack_require__(11);
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 var _ui_utils = __webpack_require__(3);
 
@@ -7406,7 +7243,7 @@ class PDFOutlineViewer extends _base_tree_viewer.BaseTreeViewer {
     this._outline = null;
     this._pageNumberToDestHashCapability = null;
     this._currentPageNumber = 1;
-    this._isPagesLoaded = false;
+    this._isPagesLoaded = null;
 
     if (this._currentOutlineItemCapability && !this._currentOutlineItemCapability.settled) {
       this._currentOutlineItemCapability.resolve(false);
@@ -7420,8 +7257,8 @@ class PDFOutlineViewer extends _base_tree_viewer.BaseTreeViewer {
 
     if (outlineCount === 0 || this._pdfDocument?.loadingParams.disableAutoFetch) {
       this._currentOutlineItemCapability.resolve(false);
-    } else if (this._isPagesLoaded) {
-      this._currentOutlineItemCapability.resolve(true);
+    } else if (this._isPagesLoaded !== null) {
+      this._currentOutlineItemCapability.resolve(this._isPagesLoaded);
     }
 
     this.eventBus.dispatch("outlineloaded", {
@@ -7754,8 +7591,10 @@ class PDFPresentationMode {
     }
 
     this.args = {
-      page: this.pdfViewer.currentPageNumber,
-      previousScale: this.pdfViewer.currentScaleValue
+      pageNumber: this.pdfViewer.currentPageNumber,
+      scaleValue: this.pdfViewer.currentScaleValue,
+      scrollMode: this.pdfViewer.scrollMode,
+      spreadMode: this.pdfViewer.spreadMode
     };
     return true;
   }
@@ -7842,7 +7681,9 @@ class PDFPresentationMode {
 
     this.container.classList.add(ACTIVE_SELECTOR);
     setTimeout(() => {
-      this.pdfViewer.currentPageNumber = this.args.page;
+      this.pdfViewer.scrollMode = _ui_utils.ScrollMode.PAGE;
+      this.pdfViewer.spreadMode = _ui_utils.SpreadMode.NONE;
+      this.pdfViewer.currentPageNumber = this.args.pageNumber;
       this.pdfViewer.currentScaleValue = "page-fit";
     }, 0);
 
@@ -7855,7 +7696,7 @@ class PDFPresentationMode {
   }
 
   _exit() {
-    const page = this.pdfViewer.currentPageNumber;
+    const pageNumber = this.pdfViewer.currentPageNumber;
     this.container.classList.remove(ACTIVE_SELECTOR);
     setTimeout(() => {
       this.active = false;
@@ -7864,8 +7705,10 @@ class PDFPresentationMode {
 
       this._notifyStateChange();
 
-      this.pdfViewer.currentScaleValue = this.args.previousScale;
-      this.pdfViewer.currentPageNumber = page;
+      this.pdfViewer.scrollMode = this.args.scrollMode;
+      this.pdfViewer.spreadMode = this.args.spreadMode;
+      this.pdfViewer.currentScaleValue = this.args.scaleValue;
+      this.pdfViewer.currentPageNumber = pageNumber;
       this.args = null;
     }, 0);
 
@@ -8050,10 +7893,172 @@ class PDFPresentationMode {
 
 }
 
-exports.PDFPresentationMode = PDFPresentationMode;
+exports.PDFPresentationMode = PDFPresentationMode;
+
+/***/ }),
+/* 21 */
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+
+Object.defineProperty(exports, "__esModule", ({
+  value: true
+}));
+exports.PDFRenderingQueue = void 0;
+
+var _pdfjsLib = __webpack_require__(5);
+
+var _ui_utils = __webpack_require__(3);
+
+const CLEANUP_TIMEOUT = 30000;
+
+class PDFRenderingQueue {
+  constructor() {
+    this.pdfViewer = null;
+    this.pdfThumbnailViewer = null;
+    this.onIdle = null;
+    this.highestPriorityPage = null;
+    this.idleTimeout = null;
+    this.printing = false;
+    this.isThumbnailViewEnabled = false;
+  }
+
+  setViewer(pdfViewer) {
+    this.pdfViewer = pdfViewer;
+  }
+
+  setThumbnailViewer(pdfThumbnailViewer) {
+    this.pdfThumbnailViewer = pdfThumbnailViewer;
+  }
+
+  isHighestPriority(view) {
+    return this.highestPriorityPage === view.renderingId;
+  }
+
+  hasViewer() {
+    return !!this.pdfViewer;
+  }
+
+  renderHighestPriority(currentlyVisiblePages) {
+    if (this.idleTimeout) {
+      clearTimeout(this.idleTimeout);
+      this.idleTimeout = null;
+    }
+
+    if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {
+      return;
+    }
+
+    if (this.isThumbnailViewEnabled && this.pdfThumbnailViewer?.forceRendering()) {
+      return;
+    }
+
+    if (this.printing) {
+      return;
+    }
+
+    if (this.onIdle) {
+      this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);
+    }
+  }
+
+  getHighestPriority(visible, views, scrolledDown, preRenderExtra = false) {
+    const visibleViews = visible.views,
+          numVisible = visibleViews.length;
+
+    if (numVisible === 0) {
+      return null;
+    }
+
+    for (let i = 0; i < numVisible; i++) {
+      const view = visibleViews[i].view;
+
+      if (!this.isViewFinished(view)) {
+        return view;
+      }
+    }
+
+    const firstId = visible.first.id,
+          lastId = visible.last.id;
+
+    if (lastId - firstId + 1 > numVisible) {
+      const visibleIds = visible.ids;
+
+      for (let i = 1, ii = lastId - firstId; i < ii; i++) {
+        const holeId = scrolledDown ? firstId + i : lastId - i;
+
+        if (visibleIds.has(holeId)) {
+          continue;
+        }
+
+        const holeView = views[holeId - 1];
+
+        if (!this.isViewFinished(holeView)) {
+          return holeView;
+        }
+      }
+    }
+
+    let preRenderIndex = scrolledDown ? lastId : firstId - 2;
+    let preRenderView = views[preRenderIndex];
+
+    if (preRenderView && !this.isViewFinished(preRenderView)) {
+      return preRenderView;
+    }
+
+    if (preRenderExtra) {
+      preRenderIndex += scrolledDown ? 1 : -1;
+      preRenderView = views[preRenderIndex];
+
+      if (preRenderView && !this.isViewFinished(preRenderView)) {
+        return preRenderView;
+      }
+    }
+
+    return null;
+  }
+
+  isViewFinished(view) {
+    return view.renderingState === _ui_utils.RenderingStates.FINISHED;
+  }
+
+  renderView(view) {
+    switch (view.renderingState) {
+      case _ui_utils.RenderingStates.FINISHED:
+        return false;
+
+      case _ui_utils.RenderingStates.PAUSED:
+        this.highestPriorityPage = view.renderingId;
+        view.resume();
+        break;
+
+      case _ui_utils.RenderingStates.RUNNING:
+        this.highestPriorityPage = view.renderingId;
+        break;
+
+      case _ui_utils.RenderingStates.INITIAL:
+        this.highestPriorityPage = view.renderingId;
+        view.draw().finally(() => {
+          this.renderHighestPriority();
+        }).catch(reason => {
+          if (reason instanceof _pdfjsLib.RenderingCancelledException) {
+            return;
+          }
+
+          console.error(`renderView: "${reason}"`);
+        });
+        break;
+    }
+
+    return true;
+  }
+
+}
+
+exports.PDFRenderingQueue = PDFRenderingQueue;
 
 /***/ }),
-/* 21 */
+/* 22 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 
 
@@ -8063,11 +8068,9 @@ Object.defineProperty(exports, "__esModule", ({
 }));
 exports.PDFScriptingManager = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
-
 var _ui_utils = __webpack_require__(3);
 
-var _pdf_rendering_queue = __webpack_require__(7);
+var _pdfjsLib = __webpack_require__(5);
 
 class PDFScriptingManager {
   constructor({
@@ -8303,7 +8306,12 @@ class PDFScriptingManager {
           break;
 
         case "layout":
-          this._pdfViewer.spreadMode = (0, _ui_utils.apiPageLayoutToSpreadMode)(value);
+          if (isInPresentationMode) {
+            return;
+          }
+
+          const modes = (0, _ui_utils.apiPageLayoutToViewerModes)(value);
+          this._pdfViewer.spreadMode = modes.spreadMode;
           break;
 
         case "page-num":
@@ -8415,7 +8423,7 @@ class PDFScriptingManager {
 
     const pageView = this._pdfViewer.getPageView(pageNumber - 1);
 
-    if (pageView?.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) {
+    if (pageView?.renderingState !== _ui_utils.RenderingStates.FINISHED) {
       this._pageOpenPending.add(pageNumber);
 
       return;
@@ -8544,7 +8552,7 @@ class PDFScriptingManager {
 exports.PDFScriptingManager = PDFScriptingManager;
 
 /***/ }),
-/* 22 */
+/* 23 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 
 
@@ -8556,8 +8564,6 @@ exports.PDFSidebar = void 0;
 
 var _ui_utils = __webpack_require__(3);
 
-var _pdf_rendering_queue = __webpack_require__(7);
-
 const UI_NOTIFICATION_CLASS = "pdfSidebarNotification";
 
 class PDFSidebar {
@@ -8794,7 +8800,7 @@ class PDFSidebar {
     for (let pageIndex = 0; pageIndex < pagesCount; pageIndex++) {
       const pageView = pdfViewer.getPageView(pageIndex);
 
-      if (pageView?.renderingState === _pdf_rendering_queue.RenderingStates.FINISHED) {
+      if (pageView?.renderingState === _ui_utils.RenderingStates.FINISHED) {
         const thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex);
         thumbnailView.setImage(pageView);
       }
@@ -8904,7 +8910,7 @@ class PDFSidebar {
 exports.PDFSidebar = PDFSidebar;
 
 /***/ }),
-/* 23 */
+/* 24 */
 /***/ ((__unused_webpack_module, exports) => {
 
 
@@ -9035,7 +9041,7 @@ class PDFSidebarResizer {
 exports.PDFSidebarResizer = PDFSidebarResizer;
 
 /***/ }),
-/* 24 */
+/* 25 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 
 
@@ -9047,9 +9053,7 @@ exports.PDFThumbnailViewer = void 0;
 
 var _ui_utils = __webpack_require__(3);
 
-var _pdf_thumbnail_view = __webpack_require__(25);
-
-var _pdf_rendering_queue = __webpack_require__(7);
+var _pdf_thumbnail_view = __webpack_require__(26);
 
 const THUMBNAIL_SCROLL_MARGIN = -19;
 const THUMBNAIL_SELECTED_CLASS = "selected";
@@ -9108,26 +9112,29 @@ class PDFThumbnailViewer {
       thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);
     }
 
-    const visibleThumbs = this._getVisibleThumbs();
-
-    const numVisibleThumbs = visibleThumbs.views.length;
+    const {
+      first,
+      last,
+      views
+    } = this._getVisibleThumbs();
 
-    if (numVisibleThumbs > 0) {
-      const first = visibleThumbs.first.id;
-      const last = numVisibleThumbs > 1 ? visibleThumbs.last.id : first;
+    if (views.length > 0) {
       let shouldScroll = false;
 
-      if (pageNumber <= first || pageNumber >= last) {
+      if (pageNumber <= first.id || pageNumber >= last.id) {
         shouldScroll = true;
       } else {
-        visibleThumbs.views.some(function (view) {
-          if (view.id !== pageNumber) {
-            return false;
+        for (const {
+          id,
+          percent
+        } of views) {
+          if (id !== pageNumber) {
+            continue;
           }
 
-          shouldScroll = view.percent < 100;
-          return true;
-        });
+          shouldScroll = percent < 100;
+          break;
+        }
       }
 
       if (shouldScroll) {
@@ -9169,7 +9176,7 @@ class PDFThumbnailViewer {
 
   cleanup() {
     for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
-      if (this._thumbnails[i] && this._thumbnails[i].renderingState !== 
_pdf_rendering_queue.RenderingStates.FINISHED) {
+      if (this._thumbnails[i] && this._thumbnails[i].renderingState !== _ui_utils.RenderingStates.FINISHED) {
         this._thumbnails[i].reset();
       }
     }
@@ -9183,7 +9190,6 @@ class PDFThumbnailViewer {
     this._pageLabels = null;
     this._pagesRotation = 0;
     this._optionalContentConfigPromise = null;
-    this._pagesRequests = new WeakMap();
     this._setImageDisabled = false;
     this.container.textContent = "";
   }
@@ -9269,44 +9275,45 @@ class PDFThumbnailViewer {
     }
   }
 
-  _ensurePdfPageLoaded(thumbView) {
+  async #ensurePdfPageLoaded(thumbView) {
     if (thumbView.pdfPage) {
-      return Promise.resolve(thumbView.pdfPage);
+      return thumbView.pdfPage;
     }
 
-    if (this._pagesRequests.has(thumbView)) {
-      return this._pagesRequests.get(thumbView);
-    }
+    try {
+      const pdfPage = await this.pdfDocument.getPage(thumbView.id);
 
-    const promise = this.pdfDocument.getPage(thumbView.id).then(pdfPage => {
       if (!thumbView.pdfPage) {
         thumbView.setPdfPage(pdfPage);
       }
 
-      this._pagesRequests.delete(thumbView);
-
       return pdfPage;
-    }).catch(reason => {
+    } catch (reason) {
       console.error("Unable to get page for thumb view", reason);
+      return null;
+    }
+  }
 
-      this._pagesRequests.delete(thumbView);
-    });
-
-    this._pagesRequests.set(thumbView, promise);
+  #getScrollAhead(visible) {
+    if (visible.first?.id === 1) {
+      return true;
+    } else if (visible.last?.id === this._thumbnails.length) {
+      return false;
+    }
 
-    return promise;
+    return this.scroll.down;
   }
 
   forceRendering() {
     const visibleThumbs = this._getVisibleThumbs();
 
-    const thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this._thumbnails, 
this.scroll.down);
+    const scrollAhead = this.#getScrollAhead(visibleThumbs);
+    const thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this._thumbnails, scrollAhead);
 
     if (thumbView) {
-      this._ensurePdfPageLoaded(thumbView).then(() => {
+      this.#ensurePdfPageLoaded(thumbView).then(() => {
         this.renderingQueue.renderView(thumbView);
       });
-
       return true;
     }
 
@@ -9318,7 +9325,7 @@ class PDFThumbnailViewer {
 exports.PDFThumbnailViewer = PDFThumbnailViewer;
 
 /***/ }),
-/* 25 */
+/* 26 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 
 
@@ -9330,52 +9337,43 @@ exports.TempImageFactory = exports.PDFThumbnailView = void 0;
 
 var _ui_utils = __webpack_require__(3);
 
-var _pdfjsLib = __webpack_require__(4);
-
-var _pdf_rendering_queue = __webpack_require__(7);
+var _pdfjsLib = __webpack_require__(5);
 
 const DRAW_UPSCALE_FACTOR = 2;
 const MAX_NUM_SCALING_STEPS = 3;
 const THUMBNAIL_CANVAS_BORDER_WIDTH = 1;
 const THUMBNAIL_WIDTH = 98;
 
-const TempImageFactory = function TempImageFactoryClosure() {
-  let tempCanvasCache = null;
-  return {
-    getCanvas(width, height) {
-      let tempCanvas = tempCanvasCache;
-
-      if (!tempCanvas) {
-        tempCanvas = document.createElement("canvas");
-        tempCanvasCache = tempCanvas;
-      }
-
-      tempCanvas.width = width;
-      tempCanvas.height = height;
-      tempCanvas.mozOpaque = true;
-      const ctx = tempCanvas.getContext("2d", {
-        alpha: false
-      });
-      ctx.save();
-      ctx.fillStyle = "rgb(255, 255, 255)";
-      ctx.fillRect(0, 0, width, height);
-      ctx.restore();
-      return [tempCanvas, tempCanvas.getContext("2d")];
-    },
+class TempImageFactory {
+  static #tempCanvas = null;
 
-    destroyCanvas() {
-      const tempCanvas = tempCanvasCache;
+  static getCanvas(width, height) {
+    const tempCanvas = this.#tempCanvas ||= document.createElement("canvas");
+    tempCanvas.width = width;
+    tempCanvas.height = height;
+    tempCanvas.mozOpaque = true;
+    const ctx = tempCanvas.getContext("2d", {
+      alpha: false
+    });
+    ctx.save();
+    ctx.fillStyle = "rgb(255, 255, 255)";
+    ctx.fillRect(0, 0, width, height);
+    ctx.restore();
+    return [tempCanvas, tempCanvas.getContext("2d")];
+  }
 
-      if (tempCanvas) {
-        tempCanvas.width = 0;
-        tempCanvas.height = 0;
-      }
+  static destroyCanvas() {
+    const tempCanvas = this.#tempCanvas;
 
-      tempCanvasCache = null;
+    if (tempCanvas) {
+      tempCanvas.width = 0;
+      tempCanvas.height = 0;
     }
 
-  };
-}();
+    this.#tempCanvas = null;
+  }
+
+}
 
 exports.TempImageFactory = TempImageFactory;
 
@@ -9401,7 +9399,7 @@ class PDFThumbnailView {
     this.linkService = linkService;
     this.renderingQueue = renderingQueue;
     this.renderTask = null;
-    this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
+    this.renderingState = _ui_utils.RenderingStates.INITIAL;
     this.resume = null;
 
     this._checkSetImageDisabled = checkSetImageDisabled || function () {
@@ -9456,7 +9454,7 @@ class PDFThumbnailView {
 
   reset() {
     this.cancelRendering();
-    this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
+    this.renderingState = _ui_utils.RenderingStates.INITIAL;
     const pageWidth = this.viewport.width,
           pageHeight = this.viewport.height,
           pageRatio = pageWidth / pageHeight;
@@ -9523,7 +9521,7 @@ class PDFThumbnailView {
   }
 
   _convertCanvasToImage(canvas) {
-    if (this.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) {
+    if (this.renderingState !== _ui_utils.RenderingStates.FINISHED) {
       throw new Error("_convertCanvasToImage: Rendering has not finished.");
     }
 
@@ -9547,9 +9545,9 @@ class PDFThumbnailView {
   }
 
   draw() {
-    if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) {
+    if (this.renderingState !== _ui_utils.RenderingStates.INITIAL) {
       console.error("Must be in new state before drawing");
-      return Promise.resolve(undefined);
+      return Promise.resolve();
     }
 
     const {
@@ -9557,11 +9555,11 @@ class PDFThumbnailView {
     } = this;
 
     if (!pdfPage) {
-      this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
+      this.renderingState = _ui_utils.RenderingStates.FINISHED;
       return Promise.reject(new Error("pdfPage is not loaded"));
     }
 
-    this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING;
+    this.renderingState = _ui_utils.RenderingStates.RUNNING;
 
     const finishRenderTask = async (error = null) => {
       if (renderTask === this.renderTask) {
@@ -9572,7 +9570,7 @@ class PDFThumbnailView {
         return;
       }
 
-      this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
+      this.renderingState = _ui_utils.RenderingStates.FINISHED;
 
       this._convertCanvasToImage(canvas);
 
@@ -9593,10 +9591,10 @@ class PDFThumbnailView {
 
     const renderContinueCallback = cont => {
       if (!this.renderingQueue.isHighestPriority(this)) {
-        this.renderingState = _pdf_rendering_queue.RenderingStates.PAUSED;
+        this.renderingState = _ui_utils.RenderingStates.PAUSED;
 
         this.resume = () => {
-          this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING;
+          this.renderingState = _ui_utils.RenderingStates.RUNNING;
           cont();
         };
 
@@ -9636,7 +9634,7 @@ class PDFThumbnailView {
       return;
     }
 
-    if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) {
+    if (this.renderingState !== _ui_utils.RenderingStates.INITIAL) {
       return;
     }
 
@@ -9653,7 +9651,7 @@ class PDFThumbnailView {
       this.setPdfPage(pdfPage);
     }
 
-    this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
+    this.renderingState = _ui_utils.RenderingStates.FINISHED;
 
     this._convertCanvasToImage(canvas);
   }
@@ -9709,7 +9707,7 @@ class PDFThumbnailView {
       this.anchor.title = msg;
     });
 
-    if (this.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) {
+    if (this.renderingState !== _ui_utils.RenderingStates.FINISHED) {
       return;
     }
 
@@ -9723,7 +9721,7 @@ class PDFThumbnailView {
 exports.PDFThumbnailView = PDFThumbnailView;
 
 /***/ }),
-/* 26 */
+/* 27 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 
 
@@ -9731,87 +9729,38 @@ exports.PDFThumbnailView = PDFThumbnailView;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.PDFViewer = void 0;
+exports.PDFViewer = exports.PDFSinglePageViewer = void 0;
 
 var _ui_utils = __webpack_require__(3);
 
-var _base_viewer = __webpack_require__(27);
+var _base_viewer = __webpack_require__(28);
 
-var _pdfjsLib = __webpack_require__(4);
+class PDFViewer extends _base_viewer.BaseViewer {}
 
-class PDFViewer extends _base_viewer.BaseViewer {
-  get _viewerElement() {
-    return (0, _pdfjsLib.shadow)(this, "_viewerElement", this.viewer);
-  }
-
-  _scrollIntoView({
-    pageDiv,
-    pageSpot = null,
-    pageNumber = null
-  }) {
-    if (!pageSpot && !this.isInPresentationMode) {
-      const left = pageDiv.offsetLeft + pageDiv.clientLeft;
-      const right = left + pageDiv.clientWidth;
-      const {
-        scrollLeft,
-        clientWidth
-      } = this.container;
-
-      if (this._isScrollModeHorizontal || left < scrollLeft || right > scrollLeft + clientWidth) {
-        pageSpot = {
-          left: 0,
-          top: 0
-        };
-      }
-    }
-
-    super._scrollIntoView({
-      pageDiv,
-      pageSpot,
-      pageNumber
-    });
-  }
+exports.PDFViewer = PDFViewer;
 
-  _getVisiblePages() {
-    if (this.isInPresentationMode) {
-      return this._getCurrentVisiblePage();
-    }
+class PDFSinglePageViewer extends _base_viewer.BaseViewer {
+  _resetView() {
+    super._resetView();
 
-    return super._getVisiblePages();
+    this._scrollMode = _ui_utils.ScrollMode.PAGE;
+    this._spreadMode = _ui_utils.SpreadMode.NONE;
   }
 
-  _updateHelper(visiblePages) {
-    if (this.isInPresentationMode) {
-      return;
-    }
-
-    let currentId = this._currentPageNumber;
-    let stillFullyVisible = false;
-
-    for (const page of visiblePages) {
-      if (page.percent < 100) {
-        break;
-      }
+  set scrollMode(mode) {}
 
-      if (page.id === currentId && this._scrollMode === _ui_utils.ScrollMode.VERTICAL && this._spreadMode 
=== _ui_utils.SpreadMode.NONE) {
-        stillFullyVisible = true;
-        break;
-      }
-    }
+  _updateScrollMode() {}
 
-    if (!stillFullyVisible) {
-      currentId = visiblePages[0].id;
-    }
+  set spreadMode(mode) {}
 
-    this._setCurrentPageNumber(currentId);
-  }
+  _updateSpreadMode() {}
 
 }
 
-exports.PDFViewer = PDFViewer;
+exports.PDFSinglePageViewer = PDFSinglePageViewer;
 
 /***/ }),
-/* 27 */
+/* 28 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 
 
@@ -9819,93 +9768,118 @@ exports.PDFViewer = PDFViewer;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.BaseViewer = void 0;
+exports.PagesCountLimit = exports.PDFPageViewBuffer = exports.BaseViewer = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 var _ui_utils = __webpack_require__(3);
 
-var _pdf_rendering_queue = __webpack_require__(7);
+var _annotation_layer_builder = __webpack_require__(29);
 
-var _annotation_layer_builder = __webpack_require__(28);
+var _l10n_utils = __webpack_require__(30);
 
-var _l10n_utils = __webpack_require__(29);
+var _pdf_page_view = __webpack_require__(31);
 
-var _pdf_page_view = __webpack_require__(30);
+var _pdf_rendering_queue = __webpack_require__(21);
 
 var _pdf_link_service = __webpack_require__(18);
 
-var _struct_tree_layer_builder = __webpack_require__(31);
+var _struct_tree_layer_builder = __webpack_require__(32);
 
-var _text_highlighter = __webpack_require__(32);
+var _text_highlighter = __webpack_require__(33);
 
-var _text_layer_builder = __webpack_require__(33);
+var _text_layer_builder = __webpack_require__(34);
 
-var _xfa_layer_builder = __webpack_require__(34);
+var _xfa_layer_builder = __webpack_require__(35);
 
 const DEFAULT_CACHE_SIZE = 10;
+const ENABLE_PERMISSIONS_CLASS = "enablePermissions";
+const PagesCountLimit = {
+  FORCE_SCROLL_MODE_PAGE: 15000,
+  FORCE_LAZY_PAGE_INIT: 7500,
+  PAUSE_EAGER_PAGE_INIT: 500
+};
+exports.PagesCountLimit = PagesCountLimit;
+
+class PDFPageViewBuffer {
+  #buf = new Set();
+  #size = 0;
 
-function PDFPageViewBuffer(size) {
-  const data = [];
+  constructor(size) {
+    this.#size = size;
+  }
 
-  this.push = function (view) {
-    const i = data.indexOf(view);
+  push(view) {
+    const buf = this.#buf;
 
-    if (i >= 0) {
-      data.splice(i, 1);
+    if (buf.has(view)) {
+      buf.delete(view);
     }
 
-    data.push(view);
+    buf.add(view);
 
-    if (data.length > size) {
-      data.shift().destroy();
+    if (buf.size > this.#size) {
+      this.#destroyFirstView();
     }
-  };
+  }
 
-  this.resize = function (newSize, pagesToKeep) {
-    size = newSize;
+  resize(newSize, idsToKeep = null) {
+    this.#size = newSize;
+    const buf = this.#buf;
 
-    if (pagesToKeep) {
-      const pageIdsToKeep = new Set();
+    if (idsToKeep) {
+      const ii = buf.size;
+      let i = 1;
 
-      for (let i = 0, iMax = pagesToKeep.length; i < iMax; ++i) {
-        pageIdsToKeep.add(pagesToKeep[i].id);
-      }
+      for (const view of buf) {
+        if (idsToKeep.has(view.id)) {
+          buf.delete(view);
+          buf.add(view);
+        }
 
-      (0, _ui_utils.moveToEndOfArray)(data, function (page) {
-        return pageIdsToKeep.has(page.id);
-      });
+        if (++i > ii) {
+          break;
+        }
+      }
     }
 
-    while (data.length > size) {
-      data.shift().destroy();
+    while (buf.size > this.#size) {
+      this.#destroyFirstView();
     }
-  };
+  }
 
-  this.has = function (view) {
-    return data.includes(view);
-  };
-}
+  has(view) {
+    return this.#buf.has(view);
+  }
 
-function isSameScale(oldScale, newScale) {
-  if (newScale === oldScale) {
-    return true;
+  [Symbol.iterator]() {
+    return this.#buf.keys();
   }
 
-  if (Math.abs(newScale - oldScale) < 1e-15) {
-    return true;
+  #destroyFirstView() {
+    const firstView = this.#buf.keys().next().value;
+    firstView?.destroy();
+    this.#buf.delete(firstView);
   }
 
-  return false;
 }
 
+exports.PDFPageViewBuffer = PDFPageViewBuffer;
+
 class BaseViewer {
+  #buffer = null;
+  #annotationMode = _pdfjsLib.AnnotationMode.ENABLE_FORMS;
+  #previousAnnotationMode = null;
+  #enablePermissions = false;
+  #previousContainerHeight = 0;
+  #scrollModePageState = null;
+
   constructor(options) {
     if (this.constructor === BaseViewer) {
       throw new Error("Cannot initialize BaseViewer.");
     }
 
-    const viewerVersion = '2.11.338';
+    const viewerVersion = '2.12.313';
 
     if (_pdfjsLib.version !== viewerVersion) {
       throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version 
"${viewerVersion}".`);
@@ -9929,13 +9903,14 @@ class BaseViewer {
     this._scriptingManager = options.scriptingManager || null;
     this.removePageBorders = options.removePageBorders || false;
     this.textLayerMode = options.textLayerMode ?? _ui_utils.TextLayerMode.ENABLE;
-    this._annotationMode = options.annotationMode ?? _pdfjsLib.AnnotationMode.ENABLE_FORMS;
+    this.#annotationMode = options.annotationMode ?? _pdfjsLib.AnnotationMode.ENABLE_FORMS;
     this.imageResourcesPath = options.imageResourcesPath || "";
     this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
     this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
     this.useOnlyCssZoom = options.useOnlyCssZoom || false;
     this.maxCanvasPixels = options.maxCanvasPixels;
     this.l10n = options.l10n || _l10n_utils.NullL10n;
+    this.#enablePermissions = options.enablePermissions || false;
     this.defaultRenderingQueue = !options.renderingQueue;
 
     if (this.defaultRenderingQueue) {
@@ -9982,7 +9957,7 @@ class BaseViewer {
   }
 
   get renderForms() {
-    return this._annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS;
+    return this.#annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS;
   }
 
   get enableScripting() {
@@ -10148,11 +10123,24 @@ class BaseViewer {
     return this.pdfDocument ? this._pagesCapability.promise : null;
   }
 
-  get _viewerElement() {
-    throw new Error("Not implemented: _viewerElement");
+  #initializePermissions(permissions) {
+    if (!permissions) {
+      return;
+    }
+
+    if (!permissions.includes(_pdfjsLib.PermissionFlag.COPY)) {
+      this.viewer.classList.add(ENABLE_PERMISSIONS_CLASS);
+    }
+
+    if (!permissions.includes(_pdfjsLib.PermissionFlag.MODIFY_ANNOTATIONS) && 
!permissions.includes(_pdfjsLib.PermissionFlag.FILL_INTERACTIVE_FORMS)) {
+      if (this.#annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS) {
+        this.#previousAnnotationMode = this.#annotationMode;
+        this.#annotationMode = _pdfjsLib.AnnotationMode.ENABLE;
+      }
+    }
   }
 
-  _onePageRenderedOrForceFetch() {
+  #onePageRenderedOrForceFetch() {
     if (!this.container.offsetParent || this._getVisiblePages().views.length === 0) {
       return Promise.resolve();
     }
@@ -10189,13 +10177,23 @@ class BaseViewer {
     const pagesCount = pdfDocument.numPages;
     const firstPagePromise = pdfDocument.getPage(1);
     const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
+    const permissionsPromise = this.#enablePermissions ? pdfDocument.getPermissions() : Promise.resolve();
+
+    if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
+      console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");
+      const mode = this._scrollMode = _ui_utils.ScrollMode.PAGE;
+      this.eventBus.dispatch("scrollmodechanged", {
+        source: this,
+        mode
+      });
+    }
 
     this._pagesCapability.promise.then(() => {
       this.eventBus.dispatch("pagesloaded", {
         source: this,
         pagesCount
       });
-    });
+    }, () => {});
 
     this._onBeforeDraw = evt => {
       const pageView = this._pages[evt.pageNumber - 1];
@@ -10204,7 +10202,7 @@ class BaseViewer {
         return;
       }
 
-      this._buffer.push(pageView);
+      this.#buffer.push(pageView);
     };
 
     this.eventBus._on("pagerender", this._onBeforeDraw);
@@ -10214,7 +10212,9 @@ class BaseViewer {
         return;
       }
 
-      this._onePageRenderedCapability.resolve();
+      this._onePageRenderedCapability.resolve({
+        timestamp: evt.timestamp
+      });
 
       this.eventBus._off("pagerendered", this._onAfterDraw);
 
@@ -10223,21 +10223,27 @@ class BaseViewer {
 
     this.eventBus._on("pagerendered", this._onAfterDraw);
 
-    firstPagePromise.then(firstPdfPage => {
+    Promise.all([firstPagePromise, permissionsPromise]).then(([firstPdfPage, permissions]) => {
+      if (pdfDocument !== this.pdfDocument) {
+        return;
+      }
+
       this._firstPageCapability.resolve(firstPdfPage);
 
       this._optionalContentConfigPromise = optionalContentConfigPromise;
+      this.#initializePermissions(permissions);
+      const viewerElement = this._scrollMode === _ui_utils.ScrollMode.PAGE ? null : this.viewer;
       const scale = this.currentScale;
       const viewport = firstPdfPage.getViewport({
         scale: scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
       });
       const textLayerFactory = this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && !isPureXfa ? this : 
null;
-      const annotationLayerFactory = this._annotationMode !== _pdfjsLib.AnnotationMode.DISABLE ? this : null;
+      const annotationLayerFactory = this.#annotationMode !== _pdfjsLib.AnnotationMode.DISABLE ? this : null;
       const xfaLayerFactory = isPureXfa ? this : null;
 
       for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
         const pageView = new _pdf_page_view.PDFPageView({
-          container: this._viewerElement,
+          container: viewerElement,
           eventBus: this.eventBus,
           id: pageNum,
           scale,
@@ -10247,7 +10253,7 @@ class BaseViewer {
           textLayerFactory,
           textLayerMode: this.textLayerMode,
           annotationLayerFactory,
-          annotationMode: this._annotationMode,
+          annotationMode: this.#annotationMode,
           xfaLayerFactory,
           textHighlighterFactory: this,
           structTreeLayerFactory: this,
@@ -10268,11 +10274,13 @@ class BaseViewer {
         this.linkService.cachePageRef(1, firstPdfPage.ref);
       }
 
-      if (this._spreadMode !== _ui_utils.SpreadMode.NONE) {
+      if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
+        this.#ensurePageViewVisible();
+      } else if (this._spreadMode !== _ui_utils.SpreadMode.NONE) {
         this._updateSpreadMode();
       }
 
-      this._onePageRenderedOrForceFetch().then(() => {
+      this.#onePageRenderedOrForceFetch().then(async () => {
         if (this.findController) {
           this.findController.setDocument(pdfDocument);
         }
@@ -10281,7 +10289,7 @@ class BaseViewer {
           this._scriptingManager.setDocument(pdfDocument);
         }
 
-        if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > 7500) {
+        if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT) 
{
           this._pagesCapability.resolve();
 
           return;
@@ -10296,7 +10304,7 @@ class BaseViewer {
         }
 
         for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) {
-          pdfDocument.getPage(pageNum).then(pdfPage => {
+          const promise = pdfDocument.getPage(pageNum).then(pdfPage => {
             const pageView = this._pages[pageNum - 1];
 
             if (!pageView.pdfPage) {
@@ -10315,18 +10323,34 @@ class BaseViewer {
               this._pagesCapability.resolve();
             }
           });
+
+          if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) {
+            await promise;
+          }
         }
       });
-
       this.eventBus.dispatch("pagesinit", {
         source: this
       });
+      pdfDocument.getMetadata().then(({
+        info
+      }) => {
+        if (pdfDocument !== this.pdfDocument) {
+          return;
+        }
+
+        if (info.Language) {
+          this.viewer.lang = info.Language;
+        }
+      });
 
       if (this.defaultRenderingQueue) {
         this.update();
       }
     }).catch(reason => {
       console.error("Unable to initialize viewer", reason);
+
+      this._pagesCapability.reject(reason);
     });
   }
 
@@ -10355,16 +10379,21 @@ class BaseViewer {
     this._currentScale = _ui_utils.UNKNOWN_SCALE;
     this._currentScaleValue = null;
     this._pageLabels = null;
-    this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);
+    this.#buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);
     this._location = null;
     this._pagesRotation = 0;
     this._optionalContentConfigPromise = null;
-    this._pagesRequests = new WeakMap();
     this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)();
     this._onePageRenderedCapability = (0, _pdfjsLib.createPromiseCapability)();
     this._pagesCapability = (0, _pdfjsLib.createPromiseCapability)();
     this._scrollMode = _ui_utils.ScrollMode.VERTICAL;
+    this._previousScrollMode = _ui_utils.ScrollMode.UNKNOWN;
     this._spreadMode = _ui_utils.SpreadMode.NONE;
+    this.#scrollModePageState = {
+      previousPageNumber: 1,
+      scrollDown: true,
+      pages: []
+    };
 
     if (this._onBeforeDraw) {
       this.eventBus._off("pagerender", this._onBeforeDraw);
@@ -10381,6 +10410,81 @@ class BaseViewer {
     this.viewer.textContent = "";
 
     this._updateScrollMode();
+
+    this.viewer.removeAttribute("lang");
+    this.viewer.classList.remove(ENABLE_PERMISSIONS_CLASS);
+
+    if (this.#previousAnnotationMode !== null) {
+      this.#annotationMode = this.#previousAnnotationMode;
+      this.#previousAnnotationMode = null;
+    }
+  }
+
+  #ensurePageViewVisible() {
+    if (this._scrollMode !== _ui_utils.ScrollMode.PAGE) {
+      throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");
+    }
+
+    const pageNumber = this._currentPageNumber,
+          state = this.#scrollModePageState,
+          viewer = this.viewer;
+    viewer.textContent = "";
+    state.pages.length = 0;
+
+    if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
+      const pageView = this._pages[pageNumber - 1];
+
+      if (this.isInPresentationMode) {
+        const spread = document.createElement("div");
+        spread.className = "spread";
+        const dummyPage = document.createElement("div");
+        dummyPage.className = "dummyPage";
+        dummyPage.style.height = `${this.container.clientHeight}px`;
+        spread.appendChild(dummyPage);
+        spread.appendChild(pageView.div);
+        viewer.appendChild(spread);
+      } else {
+        viewer.appendChild(pageView.div);
+      }
+
+      state.pages.push(pageView);
+    } else {
+      const pageIndexSet = new Set(),
+            parity = this._spreadMode - 1;
+
+      if (pageNumber % 2 !== parity) {
+        pageIndexSet.add(pageNumber - 1);
+        pageIndexSet.add(pageNumber);
+      } else {
+        pageIndexSet.add(pageNumber - 2);
+        pageIndexSet.add(pageNumber - 1);
+      }
+
+      let spread = null;
+
+      for (const i of pageIndexSet) {
+        const pageView = this._pages[i];
+
+        if (!pageView) {
+          continue;
+        }
+
+        if (spread === null) {
+          spread = document.createElement("div");
+          spread.className = "spread";
+          viewer.appendChild(spread);
+        } else if (i % 2 === parity) {
+          spread = spread.cloneNode(false);
+          viewer.appendChild(spread);
+        }
+
+        spread.appendChild(pageView.div);
+        state.pages.push(pageView);
+      }
+    }
+
+    state.scrollDown = pageNumber >= state.previousPageNumber;
+    state.previousPageNumber = pageNumber;
   }
 
   _scrollUpdate() {
@@ -10396,13 +10500,46 @@ class BaseViewer {
     pageSpot = null,
     pageNumber = null
   }) {
+    if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
+      if (pageNumber) {
+        this._setCurrentPageNumber(pageNumber);
+      }
+
+      this.#ensurePageViewVisible();
+      this.update();
+    }
+
+    if (!pageSpot && !this.isInPresentationMode) {
+      const left = pageDiv.offsetLeft + pageDiv.clientLeft;
+      const right = left + pageDiv.clientWidth;
+      const {
+        scrollLeft,
+        clientWidth
+      } = this.container;
+
+      if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL || left < scrollLeft || right > scrollLeft + 
clientWidth) {
+        pageSpot = {
+          left: 0,
+          top: 0
+        };
+      }
+    }
+
     (0, _ui_utils.scrollIntoView)(pageDiv, pageSpot);
   }
 
+  #isSameScale(newScale) {
+    if (this.isInPresentationMode && this.container.clientHeight !== this.#previousContainerHeight) {
+      return false;
+    }
+
+    return newScale === this._currentScale || Math.abs(newScale - this._currentScale) < 1e-15;
+  }
+
   _setScaleUpdatePages(newScale, newValue, noScroll = false, preset = false) {
     this._currentScaleValue = newValue.toString();
 
-    if (isSameScale(this._currentScale, newScale)) {
+    if (this.#isSameScale(newScale)) {
       if (preset) {
         this.eventBus.dispatch("scalechanging", {
           source: this,
@@ -10416,6 +10553,8 @@ class BaseViewer {
 
     this._doc.style.setProperty("--zoom-factor", newScale);
 
+    this._doc.style.setProperty("--viewport-scale-factor", newScale * 
_pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS);
+
     const updateArgs = {
       scale: newScale
     };
@@ -10453,10 +10592,12 @@ class BaseViewer {
     if (this.defaultRenderingQueue) {
       this.update();
     }
+
+    this.#previousContainerHeight = this.container.clientHeight;
   }
 
   get _pageWidthScaleFactor() {
-    if (this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== 
_ui_utils.ScrollMode.HORIZONTAL && !this.isInPresentationMode) {
+    if (this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== 
_ui_utils.ScrollMode.HORIZONTAL) {
       return 2;
     }
 
@@ -10475,11 +10616,16 @@ class BaseViewer {
         return;
       }
 
-      const noPadding = this.isInPresentationMode || this.removePageBorders;
-      let hPadding = noPadding ? 0 : _ui_utils.SCROLLBAR_PADDING;
-      let vPadding = noPadding ? 0 : _ui_utils.VERTICAL_PADDING;
+      let hPadding = _ui_utils.SCROLLBAR_PADDING,
+          vPadding = _ui_utils.VERTICAL_PADDING;
+
+      if (this.isInPresentationMode) {
+        hPadding = vPadding = 4;
+      } else if (this.removePageBorders) {
+        hPadding = vPadding = 0;
+      }
 
-      if (!noPadding && this._isScrollModeHorizontal) {
+      if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL) {
         [hPadding, vPadding] = [vPadding, hPadding];
       }
 
@@ -10599,7 +10745,7 @@ class BaseViewer {
         if (y === null && this._location) {
           x = this._location.left;
           y = this._location.top;
-        } else if (typeof y !== "number") {
+        } else if (typeof y !== "number" || y < 0) {
           y = pageHeight;
         }
 
@@ -10689,10 +10835,6 @@ class BaseViewer {
     };
   }
 
-  _updateHelper(visiblePages) {
-    throw new Error("Not implemented: _updateHelper");
-  }
-
   update() {
     const visible = this._getVisiblePages();
 
@@ -10704,12 +10846,31 @@ class BaseViewer {
     }
 
     const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);
+    this.#buffer.resize(newCacheSize, visible.ids);
+    this.renderingQueue.renderHighestPriority(visible);
 
-    this._buffer.resize(newCacheSize, visiblePages);
+    if (!this.isInPresentationMode) {
+      const isSimpleLayout = this._spreadMode === _ui_utils.SpreadMode.NONE && (this._scrollMode === 
_ui_utils.ScrollMode.PAGE || this._scrollMode === _ui_utils.ScrollMode.VERTICAL);
+      let currentId = this._currentPageNumber;
+      let stillFullyVisible = false;
 
-    this.renderingQueue.renderHighestPriority(visible);
+      for (const page of visiblePages) {
+        if (page.percent < 100) {
+          break;
+        }
+
+        if (page.id === currentId && isSimpleLayout) {
+          stillFullyVisible = true;
+          break;
+        }
+      }
+
+      if (!stillFullyVisible) {
+        currentId = visiblePages[0].id;
+      }
 
-    this._updateHelper(visiblePages);
+      this._setCurrentPageNumber(currentId);
+    }
 
     this._updateLocation(visible.first);
 
@@ -10727,10 +10888,6 @@ class BaseViewer {
     this.container.focus();
   }
 
-  get _isScrollModeHorizontal() {
-    return this.isInPresentationMode ? false : this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL;
-  }
-
   get _isContainerRtl() {
     return getComputedStyle(this.container).direction === "rtl";
   }
@@ -10766,20 +10923,29 @@ class BaseViewer {
       y: element.offsetTop + element.clientTop,
       view: pageView
     };
+    const ids = new Set([pageView.id]);
     return {
       first: view,
       last: view,
-      views: [view]
+      views: [view],
+      ids
     };
   }
 
   _getVisiblePages() {
+    if (this.isInPresentationMode) {
+      return this._getCurrentVisiblePage();
+    }
+
+    const views = this._scrollMode === _ui_utils.ScrollMode.PAGE ? this.#scrollModePageState.pages : 
this._pages,
+          horizontal = this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL,
+          rtl = horizontal && this._isContainerRtl;
     return (0, _ui_utils.getVisibleElements)({
       scrollEl: this.container,
-      views: this._pages,
+      views,
       sortByVisibility: true,
-      horizontal: this._isScrollModeHorizontal,
-      rtl: this._isScrollModeHorizontal && this._isContainerRtl
+      horizontal,
+      rtl
     });
   }
 
@@ -10793,13 +10959,11 @@ class BaseViewer {
       return false;
     }
 
-    return this._getVisiblePages().views.some(function (view) {
-      return view.id === pageNumber;
-    });
+    return this._getVisiblePages().ids.has(pageNumber);
   }
 
   isPageCached(pageNumber) {
-    if (!this.pdfDocument || !this._buffer) {
+    if (!this.pdfDocument) {
       return false;
     }
 
@@ -10809,17 +10973,12 @@ class BaseViewer {
     }
 
     const pageView = this._pages[pageNumber - 1];
-
-    if (!pageView) {
-      return false;
-    }
-
-    return this._buffer.has(pageView);
+    return this.#buffer.has(pageView);
   }
 
   cleanup() {
     for (let i = 0, ii = this._pages.length; i < ii; i++) {
-      if (this._pages[i] && this._pages[i].renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) 
{
+      if (this._pages[i] && this._pages[i].renderingState !== _ui_utils.RenderingStates.FINISHED) {
         this._pages[i].reset();
       }
     }
@@ -10833,46 +10992,74 @@ class BaseViewer {
     }
   }
 
-  _ensurePdfPageLoaded(pageView) {
+  async #ensurePdfPageLoaded(pageView) {
     if (pageView.pdfPage) {
-      return Promise.resolve(pageView.pdfPage);
+      return pageView.pdfPage;
     }
 
-    if (this._pagesRequests.has(pageView)) {
-      return this._pagesRequests.get(pageView);
-    }
+    try {
+      const pdfPage = await this.pdfDocument.getPage(pageView.id);
 
-    const promise = this.pdfDocument.getPage(pageView.id).then(pdfPage => {
       if (!pageView.pdfPage) {
         pageView.setPdfPage(pdfPage);
       }
 
-      this._pagesRequests.delete(pageView);
+      if (!this.linkService._cachedPageNumber(pdfPage.ref)) {
+        this.linkService.cachePageRef(pageView.id, pdfPage.ref);
+      }
 
       return pdfPage;
-    }).catch(reason => {
+    } catch (reason) {
       console.error("Unable to get page for page view", reason);
+      return null;
+    }
+  }
 
-      this._pagesRequests.delete(pageView);
-    });
+  #getScrollAhead(visible) {
+    if (visible.first?.id === 1) {
+      return true;
+    } else if (visible.last?.id === this.pagesCount) {
+      return false;
+    }
+
+    switch (this._scrollMode) {
+      case _ui_utils.ScrollMode.PAGE:
+        return this.#scrollModePageState.scrollDown;
+
+      case _ui_utils.ScrollMode.HORIZONTAL:
+        return this.scroll.right;
+    }
+
+    return this.scroll.down;
+  }
 
-    this._pagesRequests.set(pageView, promise);
+  #toggleLoadingIconSpinner(visibleIds) {
+    for (const id of visibleIds) {
+      const pageView = this._pages[id - 1];
+      pageView?.toggleLoadingIconSpinner(true);
+    }
+
+    for (const pageView of this.#buffer) {
+      if (visibleIds.has(pageView.id)) {
+        continue;
+      }
 
-    return promise;
+      pageView.toggleLoadingIconSpinner(false);
+    }
   }
 
   forceRendering(currentlyVisiblePages) {
     const visiblePages = currentlyVisiblePages || this._getVisiblePages();
 
-    const scrollAhead = this._isScrollModeHorizontal ? this.scroll.right : this.scroll.down;
-    const preRenderExtra = this._scrollMode === _ui_utils.ScrollMode.VERTICAL && this._spreadMode !== 
_ui_utils.SpreadMode.NONE && !this.isInPresentationMode;
+    const scrollAhead = this.#getScrollAhead(visiblePages);
+    const preRenderExtra = this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== 
_ui_utils.ScrollMode.HORIZONTAL;
     const pageView = this.renderingQueue.getHighestPriority(visiblePages, this._pages, scrollAhead, 
preRenderExtra);
+    this.#toggleLoadingIconSpinner(visiblePages.ids);
 
     if (pageView) {
-      this._ensurePdfPageLoaded(pageView).then(() => {
+      this.#ensurePdfPageLoaded(pageView).then(() => {
         this.renderingQueue.renderView(pageView);
       });
-
       return true;
     }
 
@@ -10898,7 +11085,7 @@ class BaseViewer {
     });
   }
 
-  createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", 
renderForms = true, l10n = _l10n_utils.NullL10n, enableScripting = null, hasJSActionsPromise = null, 
mouseState = null, fieldObjectsPromise = null) {
+  createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", 
renderForms = true, l10n = _l10n_utils.NullL10n, enableScripting = null, hasJSActionsPromise = null, 
mouseState = null, fieldObjectsPromise = null, annotationCanvasMap = null) {
     return new _annotation_layer_builder.AnnotationLayerBuilder({
       pageDiv,
       pdfPage,
@@ -10911,7 +11098,8 @@ class BaseViewer {
       enableScripting: enableScripting ?? this.enableScripting,
       hasJSActionsPromise: hasJSActionsPromise || this.pdfDocument?.hasJSActions(),
       fieldObjectsPromise: fieldObjectsPromise || this.pdfDocument?.getFieldObjects(),
-      mouseState: mouseState || this._scriptingManager?.mouseState
+      mouseState: mouseState || this._scriptingManager?.mouseState,
+      annotationCanvasMap
     });
   }
 
@@ -11020,6 +11208,11 @@ class BaseViewer {
       throw new Error(`Invalid scroll mode: ${mode}`);
     }
 
+    if (this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
+      return;
+    }
+
+    this._previousScrollMode = this._scrollMode;
     this._scrollMode = mode;
     this.eventBus.dispatch("scrollmodechanged", {
       source: this,
@@ -11039,6 +11232,12 @@ class BaseViewer {
       return;
     }
 
+    if (scrollMode === _ui_utils.ScrollMode.PAGE) {
+      this.#ensurePageViewVisible();
+    } else if (this._previousScrollMode === _ui_utils.ScrollMode.PAGE) {
+      this._updateSpreadMode();
+    }
+
     if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
       this._setScale(this._currentScaleValue, true);
     }
@@ -11077,27 +11276,32 @@ class BaseViewer {
 
     const viewer = this.viewer,
           pages = this._pages;
-    viewer.textContent = "";
 
-    if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
-      for (let i = 0, iMax = pages.length; i < iMax; ++i) {
-        viewer.appendChild(pages[i].div);
-      }
+    if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
+      this.#ensurePageViewVisible();
     } else {
-      const parity = this._spreadMode - 1;
-      let spread = null;
+      viewer.textContent = "";
 
-      for (let i = 0, iMax = pages.length; i < iMax; ++i) {
-        if (spread === null) {
-          spread = document.createElement("div");
-          spread.className = "spread";
-          viewer.appendChild(spread);
-        } else if (i % 2 === parity) {
-          spread = spread.cloneNode(false);
-          viewer.appendChild(spread);
+      if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
+        for (let i = 0, ii = pages.length; i < ii; ++i) {
+          viewer.appendChild(pages[i].div);
         }
+      } else {
+        const parity = this._spreadMode - 1;
+        let spread = null;
+
+        for (let i = 0, ii = pages.length; i < ii; ++i) {
+          if (spread === null) {
+            spread = document.createElement("div");
+            spread.className = "spread";
+            viewer.appendChild(spread);
+          } else if (i % 2 === parity) {
+            spread = spread.cloneNode(false);
+            viewer.appendChild(spread);
+          }
 
-        spread.appendChild(pages[i].div);
+          spread.appendChild(pages[i].div);
+        }
       }
     }
 
@@ -11115,10 +11319,6 @@ class BaseViewer {
   }
 
   _getPageAdvance(currentPageNumber, previous = false) {
-    if (this.isInPresentationMode) {
-      return 1;
-    }
-
     switch (this._scrollMode) {
       case _ui_utils.ScrollMode.WRAPPED:
         {
@@ -11204,6 +11404,7 @@ class BaseViewer {
           break;
         }
 
+      case _ui_utils.ScrollMode.PAGE:
       case _ui_utils.ScrollMode.VERTICAL:
         {
           if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
@@ -11300,7 +11501,7 @@ class BaseViewer {
 exports.BaseViewer = BaseViewer;
 
 /***/ }),
-/* 28 */
+/* 29 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 
 
@@ -11308,13 +11509,11 @@ exports.BaseViewer = BaseViewer;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = void 0;
+exports.AnnotationLayerBuilder = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
-var _l10n_utils = __webpack_require__(29);
-
-var _pdf_link_service = __webpack_require__(18);
+var _l10n_utils = __webpack_require__(30);
 
 class AnnotationLayerBuilder {
   constructor({
@@ -11329,7 +11528,8 @@ class AnnotationLayerBuilder {
     enableScripting = false,
     hasJSActionsPromise = null,
     fieldObjectsPromise = null,
-    mouseState = null
+    mouseState = null,
+    annotationCanvasMap = null
   }) {
     this.pageDiv = pageDiv;
     this.pdfPage = pdfPage;
@@ -11343,6 +11543,7 @@ class AnnotationLayerBuilder {
     this._hasJSActionsPromise = hasJSActionsPromise;
     this._fieldObjectsPromise = fieldObjectsPromise;
     this._mouseState = mouseState;
+    this._annotationCanvasMap = annotationCanvasMap;
     this.div = null;
     this._cancelled = false;
   }
@@ -11371,7 +11572,8 @@ class AnnotationLayerBuilder {
       enableScripting: this.enableScripting,
       hasJSActions,
       fieldObjects,
-      mouseState: this._mouseState
+      mouseState: this._mouseState,
+      annotationCanvasMap: this._annotationCanvasMap
     };
 
     if (this.div) {
@@ -11404,29 +11606,8 @@ class AnnotationLayerBuilder {
 
 exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
 
-class DefaultAnnotationLayerFactory {
-  createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", 
renderForms = true, l10n = _l10n_utils.NullL10n, enableScripting = false, hasJSActionsPromise = null, 
mouseState = null, fieldObjectsPromise = null) {
-    return new AnnotationLayerBuilder({
-      pageDiv,
-      pdfPage,
-      imageResourcesPath,
-      renderForms,
-      linkService: new _pdf_link_service.SimpleLinkService(),
-      l10n,
-      annotationStorage,
-      enableScripting,
-      hasJSActionsPromise,
-      fieldObjectsPromise,
-      mouseState
-    });
-  }
-
-}
-
-exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory;
-
 /***/ }),
-/* 29 */
+/* 30 */
 /***/ ((__unused_webpack_module, exports) => {
 
 
@@ -11434,9 +11615,9 @@ exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
+exports.NullL10n = void 0;
 exports.fixupLangCode = fixupLangCode;
 exports.getL10nFallback = getL10nFallback;
-exports.NullL10n = void 0;
 const DEFAULT_L10N_STRINGS = {
   of_pages: "of {{pagesCount}}",
   page_of_pages: "({{pageNumber}} of {{pagesCount}})",
@@ -11554,7 +11735,7 @@ const NullL10n = {
 exports.NullL10n = NullL10n;
 
 /***/ }),
-/* 30 */
+/* 31 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 
 
@@ -11564,19 +11745,19 @@ Object.defineProperty(exports, "__esModule", ({
 }));
 exports.PDFPageView = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 var _ui_utils = __webpack_require__(3);
 
 var _app_options = __webpack_require__(1);
 
-var _l10n_utils = __webpack_require__(29);
-
-var _pdf_rendering_queue = __webpack_require__(7);
+var _l10n_utils = __webpack_require__(30);
 
 const MAX_CANVAS_PIXELS = _app_options.compatibilityParams.maxCanvasPixels || 16777216;
 
 class PDFPageView {
+  #annotationMode = _pdfjsLib.AnnotationMode.ENABLE_FORMS;
+
   constructor(options) {
     const container = options.container;
     const defaultViewport = options.defaultViewport;
@@ -11591,7 +11772,7 @@ class PDFPageView {
     this._optionalContentConfigPromise = options.optionalContentConfigPromise || null;
     this.hasRestrictedScaling = false;
     this.textLayerMode = options.textLayerMode ?? _ui_utils.TextLayerMode.ENABLE;
-    this._annotationMode = options.annotationMode ?? _pdfjsLib.AnnotationMode.ENABLE_FORMS;
+    this.#annotationMode = options.annotationMode ?? _pdfjsLib.AnnotationMode.ENABLE_FORMS;
     this.imageResourcesPath = options.imageResourcesPath || "";
     this.useOnlyCssZoom = options.useOnlyCssZoom || false;
     this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;
@@ -11606,10 +11787,11 @@ class PDFPageView {
     this.l10n = options.l10n || _l10n_utils.NullL10n;
     this.paintTask = null;
     this.paintedViewportMap = new WeakMap();
-    this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
+    this.renderingState = _ui_utils.RenderingStates.INITIAL;
     this.resume = null;
     this._renderError = null;
     this._isStandalone = !this.renderingQueue?.hasViewer();
+    this._annotationCanvasMap = null;
     this.annotationLayer = null;
     this.textLayer = null;
     this.zoomLayer = null;
@@ -11627,7 +11809,7 @@ class PDFPageView {
       div.setAttribute("aria-label", msg);
     });
     this.div = div;
-    container.appendChild(div);
+    container?.appendChild(div);
   }
 
   setPdfPage(pdfPage) {
@@ -11723,7 +11905,7 @@ class PDFPageView {
       keepAnnotationLayer,
       keepXfaLayer
     });
-    this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
+    this.renderingState = _ui_utils.RenderingStates.INITIAL;
     const div = this.div;
     div.style.width = Math.floor(this.viewport.width) + "px";
     div.style.height = Math.floor(this.viewport.height) + "px";
@@ -11742,7 +11924,7 @@ class PDFPageView {
           continue;
       }
 
-      div.removeChild(node);
+      node.remove();
     }
 
     div.removeAttribute("data-loaded");
@@ -11772,7 +11954,12 @@ class PDFPageView {
     }
 
     this.loadingIconDiv = document.createElement("div");
-    this.loadingIconDiv.className = "loadingIcon";
+    this.loadingIconDiv.className = "loadingIcon notVisible";
+
+    if (this._isStandalone) {
+      this.toggleLoadingIconSpinner(true);
+    }
+
     this.loadingIconDiv.setAttribute("role", "img");
     this.l10n.get("loading").then(msg => {
       this.loadingIconDiv?.setAttribute("aria-label", msg);
@@ -11805,17 +11992,21 @@ class PDFPageView {
       this._optionalContentConfigPromise = optionalContentConfigPromise;
     }
 
-    if (this._isStandalone) {
-      const doc = document.documentElement;
-      doc.style.setProperty("--zoom-factor", this.scale);
-    }
-
     const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
+    const viewportScale = this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
     this.viewport = this.viewport.clone({
-      scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
+      scale: viewportScale,
       rotation: totalRotation
     });
 
+    if (this._isStandalone) {
+      const {
+        style
+      } = document.documentElement;
+      style.setProperty("--zoom-factor", this.scale);
+      style.setProperty("--viewport-scale-factor", viewportScale);
+    }
+
     if (this.svg) {
       this.cssTransform({
         target: this.svg,
@@ -11897,6 +12088,7 @@ class PDFPageView {
     if (this.annotationLayer && (!keepAnnotationLayer || !this.annotationLayer.div)) {
       this.annotationLayer.cancel();
       this.annotationLayer = null;
+      this._annotationCanvasMap = null;
     }
 
     if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {
@@ -11997,8 +12189,12 @@ class PDFPageView {
     return this.viewport.convertToPdfPoint(x, y);
   }
 
+  toggleLoadingIconSpinner(viewVisible = false) {
+    this.loadingIconDiv?.classList.toggle("notVisible", !viewVisible);
+  }
+
   draw() {
-    if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) {
+    if (this.renderingState !== _ui_utils.RenderingStates.INITIAL) {
       console.error("Must be in new state before drawing");
       this.reset();
     }
@@ -12009,17 +12205,17 @@ class PDFPageView {
     } = this;
 
     if (!pdfPage) {
-      this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
+      this.renderingState = _ui_utils.RenderingStates.FINISHED;
 
       if (this.loadingIconDiv) {
-        div.removeChild(this.loadingIconDiv);
+        this.loadingIconDiv.remove();
         delete this.loadingIconDiv;
       }
 
       return Promise.reject(new Error("pdfPage is not loaded"));
     }
 
-    this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING;
+    this.renderingState = _ui_utils.RenderingStates.RUNNING;
     const canvasWrapper = document.createElement("div");
     canvasWrapper.style.width = div.style.width;
     canvasWrapper.style.height = div.style.height;
@@ -12050,6 +12246,11 @@ class PDFPageView {
 
     this.textLayer = textLayer;
 
+    if (this.#annotationMode !== _pdfjsLib.AnnotationMode.DISABLE && this.annotationLayerFactory) {
+      this._annotationCanvasMap ||= new Map();
+      this.annotationLayer ||= this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, null, 
this.imageResourcesPath, this.#annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS, this.l10n, null, 
null, null, null, this._annotationCanvasMap);
+    }
+
     if (this.xfaLayer?.div) {
       div.appendChild(this.xfaLayer.div);
     }
@@ -12059,10 +12260,10 @@ class PDFPageView {
     if (this.renderingQueue) {
       renderContinueCallback = cont => {
         if (!this.renderingQueue.isHighestPriority(this)) {
-          this.renderingState = _pdf_rendering_queue.RenderingStates.PAUSED;
+          this.renderingState = _ui_utils.RenderingStates.PAUSED;
 
           this.resume = () => {
-            this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING;
+            this.renderingState = _ui_utils.RenderingStates.RUNNING;
             cont();
           };
 
@@ -12084,10 +12285,10 @@ class PDFPageView {
       }
 
       this._renderError = error;
-      this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
+      this.renderingState = _ui_utils.RenderingStates.FINISHED;
 
       if (this.loadingIconDiv) {
-        div.removeChild(this.loadingIconDiv);
+        this.loadingIconDiv.remove();
         delete this.loadingIconDiv;
       }
 
@@ -12119,19 +12320,15 @@ class PDFPageView {
           textLayer.setTextContentStream(readableStream);
           textLayer.render();
         }
+
+        if (this.annotationLayer) {
+          this._renderAnnotationLayer();
+        }
       });
     }, function (reason) {
       return finishPaintTask(reason);
     });
 
-    if (this._annotationMode !== _pdfjsLib.AnnotationMode.DISABLE && this.annotationLayerFactory) {
-      if (!this.annotationLayer) {
-        this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, null, 
this.imageResourcesPath, this._annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS, this.l10n, null, 
null, null, null);
-      }
-
-      this._renderAnnotationLayer();
-    }
-
     if (this.xfaLayerFactory) {
       if (!this.xfaLayer) {
         this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder(div, pdfPage, null);
@@ -12252,8 +12449,9 @@ class PDFPageView {
       canvasContext: ctx,
       transform,
       viewport: this.viewport,
-      annotationMode: this._annotationMode,
-      optionalContentConfigPromise: this._optionalContentConfigPromise
+      annotationMode: this.#annotationMode,
+      optionalContentConfigPromise: this._optionalContentConfigPromise,
+      annotationCanvasMap: this._annotationCanvasMap
     };
     const renderTask = this.pdfPage.render(renderContext);
 
@@ -12269,7 +12467,7 @@ class PDFPageView {
 
     renderTask.promise.then(function () {
       showCanvas();
-      renderCapability.resolve(undefined);
+      renderCapability.resolve();
     }, function (error) {
       showCanvas();
       renderCapability.reject(error);
@@ -12291,7 +12489,7 @@ class PDFPageView {
       scale: _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
     });
     const promise = pdfPage.getOperatorList({
-      annotationMode: this._annotationMode
+      annotationMode: this.#annotationMode
     }).then(opList => {
       ensureNotCancelled();
       const svgGfx = new _pdfjsLib.SVGGraphics(pdfPage.commonObjs, pdfPage.objs, 
_app_options.compatibilityParams.disableCreateObjectURL);
@@ -12301,7 +12499,7 @@ class PDFPageView {
         this.paintedViewportMap.set(svg, actualSizeViewport);
         svg.style.width = wrapper.style.width;
         svg.style.height = wrapper.style.height;
-        this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
+        this.renderingState = _ui_utils.RenderingStates.FINISHED;
         wrapper.appendChild(svg);
       });
     });
@@ -12334,7 +12532,7 @@ class PDFPageView {
 exports.PDFPageView = PDFPageView;
 
 /***/ }),
-/* 31 */
+/* 32 */
 /***/ ((__unused_webpack_module, exports) => {
 
 
@@ -12342,7 +12540,7 @@ exports.PDFPageView = PDFPageView;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.StructTreeLayerBuilder = exports.DefaultStructTreeLayerFactory = void 0;
+exports.StructTreeLayerBuilder = void 0;
 const PDF_ROLE_TO_HTML_ROLE = {
   Document: null,
   DocumentFragment: null,
@@ -12406,6 +12604,10 @@ class StructTreeLayerBuilder {
     if (structElement.id !== undefined) {
       htmlElement.setAttribute("aria-owns", structElement.id);
     }
+
+    if (structElement.lang !== undefined) {
+      htmlElement.setAttribute("lang", structElement.lang);
+    }
   }
 
   _walk(node) {
@@ -12448,19 +12650,8 @@ class StructTreeLayerBuilder {
 
 exports.StructTreeLayerBuilder = StructTreeLayerBuilder;
 
-class DefaultStructTreeLayerFactory {
-  createStructTreeLayerBuilder(pdfPage) {
-    return new StructTreeLayerBuilder({
-      pdfPage
-    });
-  }
-
-}
-
-exports.DefaultStructTreeLayerFactory = DefaultStructTreeLayerFactory;
-
 /***/ }),
-/* 32 */
+/* 33 */
 /***/ ((__unused_webpack_module, exports) => {
 
 
@@ -12733,7 +12924,7 @@ class TextHighlighter {
 exports.TextHighlighter = TextHighlighter;
 
 /***/ }),
-/* 33 */
+/* 34 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 
 
@@ -12741,9 +12932,9 @@ exports.TextHighlighter = TextHighlighter;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.TextLayerBuilder = exports.DefaultTextLayerFactory = void 0;
+exports.TextLayerBuilder = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 const EXPAND_DIVS_TIMEOUT = 300;
 
@@ -12894,24 +13085,8 @@ class TextLayerBuilder {
 
 exports.TextLayerBuilder = TextLayerBuilder;
 
-class DefaultTextLayerFactory {
-  createTextLayerBuilder(textLayerDiv, pageIndex, viewport, enhanceTextSelection = false, eventBus, 
highlighter) {
-    return new TextLayerBuilder({
-      textLayerDiv,
-      pageIndex,
-      viewport,
-      enhanceTextSelection,
-      eventBus,
-      highlighter
-    });
-  }
-
-}
-
-exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
-
 /***/ }),
-/* 34 */
+/* 35 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 
 
@@ -12919,19 +13094,17 @@ exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.XfaLayerBuilder = exports.DefaultXfaLayerFactory = void 0;
-
-var _pdf_link_service = __webpack_require__(18);
+exports.XfaLayerBuilder = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 class XfaLayerBuilder {
   constructor({
     pageDiv,
     pdfPage,
-    annotationStorage,
+    annotationStorage = null,
     linkService,
-    xfaHtml
+    xfaHtml = null
   }) {
     this.pageDiv = pageDiv;
     this.pdfPage = pdfPage;
@@ -12949,8 +13122,7 @@ class XfaLayerBuilder {
           dontFlip: true
         }),
         div: this.div,
-        xfa: this.xfaHtml,
-        page: null,
+        xfaHtml: this.xfaHtml,
         annotationStorage: this.annotationStorage,
         linkService: this.linkService,
         intent
@@ -12964,8 +13136,8 @@ class XfaLayerBuilder {
       return Promise.resolve(result);
     }
 
-    return this.pdfPage.getXfa().then(xfa => {
-      if (this._cancelled || !xfa) {
+    return this.pdfPage.getXfa().then(xfaHtml => {
+      if (this._cancelled || !xfaHtml) {
         return {
           textDivs: []
         };
@@ -12976,8 +13148,7 @@ class XfaLayerBuilder {
           dontFlip: true
         }),
         div: this.div,
-        xfa,
-        page: this.pdfPage,
+        xfaHtml,
         annotationStorage: this.annotationStorage,
         linkService: this.linkService,
         intent
@@ -13012,23 +13183,8 @@ class XfaLayerBuilder {
 
 exports.XfaLayerBuilder = XfaLayerBuilder;
 
-class DefaultXfaLayerFactory {
-  createXfaLayerBuilder(pageDiv, pdfPage, annotationStorage = null, xfaHtml = null) {
-    return new XfaLayerBuilder({
-      pageDiv,
-      pdfPage,
-      annotationStorage,
-      linkService: new _pdf_link_service.SimpleLinkService(),
-      xfaHtml
-    });
-  }
-
-}
-
-exports.DefaultXfaLayerFactory = DefaultXfaLayerFactory;
-
 /***/ }),
-/* 35 */
+/* 36 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 
 
@@ -13040,9 +13196,9 @@ exports.SecondaryToolbar = void 0;
 
 var _ui_utils = __webpack_require__(3);
 
-var _pdf_cursor_tools = __webpack_require__(5);
+var _pdf_cursor_tools = __webpack_require__(6);
 
-var _pdf_single_page_viewer = __webpack_require__(36);
+var _base_viewer = __webpack_require__(28);
 
 class SecondaryToolbar {
   constructor(options, mainContainer, eventBus) {
@@ -13099,6 +13255,13 @@ class SecondaryToolbar {
         tool: _pdf_cursor_tools.CursorTool.HAND
       },
       close: true
+    }, {
+      element: options.scrollPageButton,
+      eventName: "switchscrollmode",
+      eventDetails: {
+        mode: _ui_utils.ScrollMode.PAGE
+      },
+      close: true
     }, {
       element: options.scrollVerticalButton,
       eventName: "switchscrollmode",
@@ -13168,14 +13331,6 @@ class SecondaryToolbar {
     this._bindSpreadModeListener(options);
 
     this.eventBus._on("resize", this._setMaxHeight.bind(this));
-
-    this.eventBus._on("baseviewerinit", evt => {
-      if (evt.source instanceof _pdf_single_page_viewer.PDFSinglePageViewer) {
-        this.toolbarButtonContainer.classList.add("hiddenScrollModeButtons", "hiddenSpreadModeButtons");
-      } else {
-        this.toolbarButtonContainer.classList.remove("hiddenScrollModeButtons", "hiddenSpreadModeButtons");
-      }
-    });
   }
 
   get isOpen() {
@@ -13251,17 +13406,23 @@ class SecondaryToolbar {
   }
 
   _bindScrollModeListener(buttons) {
-    function scrollModeChanged({
+    const scrollModeChanged = ({
       mode
-    }) {
+    }) => {
+      buttons.scrollPageButton.classList.toggle("toggled", mode === _ui_utils.ScrollMode.PAGE);
       buttons.scrollVerticalButton.classList.toggle("toggled", mode === _ui_utils.ScrollMode.VERTICAL);
       buttons.scrollHorizontalButton.classList.toggle("toggled", mode === _ui_utils.ScrollMode.HORIZONTAL);
       buttons.scrollWrappedButton.classList.toggle("toggled", mode === _ui_utils.ScrollMode.WRAPPED);
+      const forceScrollModePage = this.pagesCount > _base_viewer.PagesCountLimit.FORCE_SCROLL_MODE_PAGE;
+      buttons.scrollPageButton.disabled = forceScrollModePage;
+      buttons.scrollVerticalButton.disabled = forceScrollModePage;
+      buttons.scrollHorizontalButton.disabled = forceScrollModePage;
+      buttons.scrollWrappedButton.disabled = forceScrollModePage;
       const isScrollModeHorizontal = mode === _ui_utils.ScrollMode.HORIZONTAL;
       buttons.spreadNoneButton.disabled = isScrollModeHorizontal;
       buttons.spreadOddButton.disabled = isScrollModeHorizontal;
       buttons.spreadEvenButton.disabled = isScrollModeHorizontal;
-    }
+    };
 
     this.eventBus._on("scrollmodechanged", scrollModeChanged);
 
@@ -13346,135 +13507,6 @@ class SecondaryToolbar {
 
 exports.SecondaryToolbar = SecondaryToolbar;
 
-/***/ }),
-/* 36 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-
-
-Object.defineProperty(exports, "__esModule", ({
-  value: true
-}));
-exports.PDFSinglePageViewer = void 0;
-
-var _base_viewer = __webpack_require__(27);
-
-var _pdfjsLib = __webpack_require__(4);
-
-class PDFSinglePageViewer extends _base_viewer.BaseViewer {
-  constructor(options) {
-    super(options);
-
-    this.eventBus._on("pagesinit", evt => {
-      this._ensurePageViewVisible();
-    });
-  }
-
-  get _viewerElement() {
-    return (0, _pdfjsLib.shadow)(this, "_viewerElement", this._shadowViewer);
-  }
-
-  get _pageWidthScaleFactor() {
-    return 1;
-  }
-
-  _resetView() {
-    super._resetView();
-
-    this._previousPageNumber = 1;
-    this._shadowViewer = document.createDocumentFragment();
-    this._updateScrollDown = null;
-  }
-
-  _ensurePageViewVisible() {
-    const pageView = this._pages[this._currentPageNumber - 1];
-    const previousPageView = this._pages[this._previousPageNumber - 1];
-    const viewerNodes = this.viewer.childNodes;
-
-    switch (viewerNodes.length) {
-      case 0:
-        this.viewer.appendChild(pageView.div);
-        break;
-
-      case 1:
-        if (viewerNodes[0] !== previousPageView.div) {
-          throw new Error("_ensurePageViewVisible: Unexpected previously visible page.");
-        }
-
-        if (pageView === previousPageView) {
-          break;
-        }
-
-        this._shadowViewer.appendChild(previousPageView.div);
-
-        this.viewer.appendChild(pageView.div);
-        this.container.scrollTop = 0;
-        break;
-
-      default:
-        throw new Error("_ensurePageViewVisible: Only one page should be visible at a time.");
-    }
-
-    this._previousPageNumber = this._currentPageNumber;
-  }
-
-  _scrollUpdate() {
-    if (this._updateScrollDown) {
-      this._updateScrollDown();
-    }
-
-    super._scrollUpdate();
-  }
-
-  _scrollIntoView({
-    pageDiv,
-    pageSpot = null,
-    pageNumber = null
-  }) {
-    if (pageNumber) {
-      this._setCurrentPageNumber(pageNumber);
-    }
-
-    const scrolledDown = this._currentPageNumber >= this._previousPageNumber;
-
-    this._ensurePageViewVisible();
-
-    this.update();
-
-    super._scrollIntoView({
-      pageDiv,
-      pageSpot,
-      pageNumber
-    });
-
-    this._updateScrollDown = () => {
-      this.scroll.down = scrolledDown;
-      this._updateScrollDown = null;
-    };
-  }
-
-  _getVisiblePages() {
-    return this._getCurrentVisiblePage();
-  }
-
-  _updateHelper(visiblePages) {}
-
-  get _isScrollModeHorizontal() {
-    return (0, _pdfjsLib.shadow)(this, "_isScrollModeHorizontal", false);
-  }
-
-  _updateScrollMode() {}
-
-  _updateSpreadMode() {}
-
-  _getPageAdvance() {
-    return 1;
-  }
-
-}
-
-exports.PDFSinglePageViewer = PDFSinglePageViewer;
-
 /***/ }),
 /* 37 */
 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -14045,7 +14077,7 @@ Object.defineProperty(exports, "__esModule", ({
 }));
 exports.DownloadManager = void 0;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 var _app_options = __webpack_require__(1);
 
@@ -14149,7 +14181,7 @@ exports.GenericL10n = void 0;
 
 __webpack_require__(43);
 
-var _l10n_utils = __webpack_require__(29);
+var _l10n_utils = __webpack_require__(30);
 
 const webL10n = document.webL10n;
 
@@ -15018,10 +15050,10 @@ document.webL10n = function (window, document, undefined) {
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-exports.docPropertiesLookup = docPropertiesLookup;
 exports.GenericScripting = void 0;
+exports.docPropertiesLookup = docPropertiesLookup;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 async function docPropertiesLookup(pdfDocument) {
   const url = "",
@@ -15088,7 +15120,7 @@ Object.defineProperty(exports, "__esModule", ({
 }));
 exports.PDFPrintService = PDFPrintService;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
 
 var _app = __webpack_require__(2);
 
@@ -15387,20 +15419,28 @@ Object.defineProperty(exports, "__esModule", ({
 }));
 exports.getXfaHtmlForPrinting = getXfaHtmlForPrinting;
 
-var _pdfjsLib = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(5);
+
+var _pdf_link_service = __webpack_require__(18);
 
-var _xfa_layer_builder = __webpack_require__(34);
+var _xfa_layer_builder = __webpack_require__(35);
 
 function getXfaHtmlForPrinting(printContainer, pdfDocument) {
   const xfaHtml = pdfDocument.allXfaHtml;
-  const factory = new _xfa_layer_builder.DefaultXfaLayerFactory();
+  const linkService = new _pdf_link_service.SimpleLinkService();
   const scale = Math.round(_pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS * 100) / 100;
 
   for (const xfaPage of xfaHtml.children) {
     const page = document.createElement("div");
     page.className = "xfaPrintedPage";
     printContainer.appendChild(page);
-    const builder = factory.createXfaLayerBuilder(page, null, pdfDocument.annotationStorage, xfaPage);
+    const builder = new _xfa_layer_builder.XfaLayerBuilder({
+      pageDiv: page,
+      pdfPage: null,
+      annotationStorage: pdfDocument.annotationStorage,
+      linkService,
+      xfaHtml: xfaPage
+    });
     const viewport = (0, _pdfjsLib.getXfaPageViewport)(xfaPage, {
       scale
     });
@@ -15445,16 +15485,16 @@ var exports = __webpack_exports__;
 Object.defineProperty(exports, "__esModule", ({
   value: true
 }));
-Object.defineProperty(exports, "PDFViewerApplicationOptions", ({
+Object.defineProperty(exports, "PDFViewerApplication", ({
   enumerable: true,
   get: function () {
-    return _app_options.AppOptions;
+    return _app.PDFViewerApplication;
   }
 }));
-Object.defineProperty(exports, "PDFViewerApplication", ({
+Object.defineProperty(exports, "PDFViewerApplicationOptions", ({
   enumerable: true,
   get: function () {
-    return _app.PDFViewerApplication;
+    return _app_options.AppOptions;
   }
 }));
 
@@ -15462,8 +15502,8 @@ var _app_options = __webpack_require__(1);
 
 var _app = __webpack_require__(2);
 
-const pdfjsVersion = '2.11.338';
-const pdfjsBuild = 'dedff3c98';
+const pdfjsVersion = '2.12.313';
+const pdfjsBuild = 'a2ae56f39';
 window.PDFViewerApplication = _app.PDFViewerApplication;
 window.PDFViewerApplicationOptions = _app_options.AppOptions;
 ;
@@ -15523,6 +15563,7 @@ function getViewerConfiguration() {
       pageRotateCcwButton: document.getElementById("pageRotateCcw"),
       cursorSelectToolButton: document.getElementById("cursorSelectTool"),
       cursorHandToolButton: document.getElementById("cursorHandTool"),
+      scrollPageButton: document.getElementById("scrollPage"),
       scrollVerticalButton: document.getElementById("scrollVertical"),
       scrollHorizontalButton: document.getElementById("scrollHorizontal"),
       scrollWrappedButton: document.getElementById("scrollWrapped"),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]