From a6c49c3ab0201e25c57963b158b712808bc78496 Mon Sep 17 00:00:00 2001 From: Florian Franzen Date: Tue, 19 Jan 2021 14:43:14 +0100 Subject: [PATCH 1/2] pdf.js: v2.0.943 -> v2.5.207 --- docs/_static/build/pdf.js | 36417 ++++++---- docs/_static/build/pdf.js.map | 2 +- docs/_static/build/pdf.worker.js | 56728 +++++++++------- docs/_static/build/pdf.worker.js.map | 2 +- docs/_static/pdfview/debugger.js | 321 +- .../pdfview/images/findbarButton-next-rtl.png | Bin 199 -> 0 bytes .../images/findbarButton-next-rtl@2x.png | Bin 304 -> 0 bytes .../images/findbarButton-previous-rtl.png | Bin 193 -> 0 bytes .../images/findbarButton-previous-rtl@2x.png | Bin 296 -> 0 bytes .../images/toolbarButton-pageDown-rtl.png | Bin 242 -> 0 bytes .../images/toolbarButton-pageDown-rtl@2x.png | Bin 398 -> 0 bytes .../images/toolbarButton-pageUp-rtl.png | Bin 245 -> 0 bytes .../images/toolbarButton-pageUp-rtl@2x.png | Bin 405 -> 0 bytes ...olbarButton-secondaryToolbarToggle-rtl.png | Bin 246 -> 0 bytes ...arButton-secondaryToolbarToggle-rtl@2x.png | Bin 456 -> 0 bytes .../toolbarButton-sidebarToggle-rtl.png | Bin 225 -> 0 bytes .../toolbarButton-sidebarToggle-rtl@2x.png | Bin 344 -> 0 bytes .../images/toolbarButton-viewOutline-rtl.png | Bin 177 -> 0 bytes .../toolbarButton-viewOutline-rtl@2x.png | Bin 394 -> 0 bytes .../pdfview/images/treeitem-collapsed-rtl.png | Bin 143 -> 0 bytes .../images/treeitem-collapsed-rtl@2x.png | Bin 167 -> 0 bytes .../pdfview/locale/ak/viewer.properties | 130 - .../pdfview/locale/ar/viewer.properties | 4 + .../pdfview/locale/as/viewer.properties | 167 - .../pdfview/locale/ast/viewer.properties | 18 +- .../pdfview/locale/az/viewer.properties | 6 + .../pdfview/locale/be/viewer.properties | 6 + .../pdfview/locale/bn-IN/viewer.properties | 177 - .../locale/{bn-BD => bn}/viewer.properties | 33 +- .../locale/{en-ZA => bo}/viewer.properties | 85 +- .../pdfview/locale/br/viewer.properties | 6 + .../pdfview/locale/brx/viewer.properties | 44 + .../pdfview/locale/ca/viewer.properties | 49 +- .../pdfview/locale/cak/viewer.properties | 8 +- .../pdfview/locale/crh/viewer.properties | 217 - .../pdfview/locale/cs/viewer.properties | 10 +- .../pdfview/locale/csb/viewer.properties | 134 - .../pdfview/locale/cy/viewer.properties | 6 + .../pdfview/locale/da/viewer.properties | 6 + .../pdfview/locale/de/viewer.properties | 23 +- .../pdfview/locale/dsb/viewer.properties | 248 + .../pdfview/locale/el/viewer.properties | 4 + .../pdfview/locale/en-CA/viewer.properties | 6 + .../pdfview/locale/en-GB/viewer.properties | 64 + .../pdfview/locale/en-US/viewer.properties | 7 +- .../pdfview/locale/eo/viewer.properties | 6 + .../pdfview/locale/es-AR/viewer.properties | 6 + .../pdfview/locale/es-CL/viewer.properties | 6 + .../pdfview/locale/es-ES/viewer.properties | 6 + .../pdfview/locale/es-MX/viewer.properties | 6 + .../pdfview/locale/et/viewer.properties | 4 + .../pdfview/locale/eu/viewer.properties | 6 + .../pdfview/locale/fa/viewer.properties | 22 + .../pdfview/locale/ff/viewer.properties | 41 + .../pdfview/locale/fi/viewer.properties | 6 + .../pdfview/locale/fr/viewer.properties | 12 +- .../pdfview/locale/fy-NL/viewer.properties | 6 + .../pdfview/locale/gd/viewer.properties | 27 + .../pdfview/locale/gl/viewer.properties | 78 +- .../pdfview/locale/gn/viewer.properties | 6 + .../pdfview/locale/gu-IN/viewer.properties | 2 +- .../pdfview/locale/he/viewer.properties | 16 +- .../pdfview/locale/hi-IN/viewer.properties | 38 +- .../pdfview/locale/hr/viewer.properties | 122 +- .../pdfview/locale/hsb/viewer.properties | 6 + .../pdfview/locale/hto/viewer.properties | 127 - .../pdfview/locale/hu/viewer.properties | 8 +- .../pdfview/locale/hy-AM/viewer.properties | 67 +- .../pdfview/locale/hye/viewer.properties | 247 + .../pdfview/locale/ia/viewer.properties | 22 +- .../pdfview/locale/id/viewer.properties | 6 + .../pdfview/locale/is/viewer.properties | 27 +- .../pdfview/locale/it/viewer.properties | 6 +- .../pdfview/locale/ja/viewer.properties | 30 +- .../pdfview/locale/ka/viewer.properties | 34 +- .../pdfview/locale/kab/viewer.properties | 6 + .../pdfview/locale/kk/viewer.properties | 6 + .../pdfview/locale/ko/viewer.properties | 76 +- .../pdfview/locale/kok/viewer.properties | 167 - .../pdfview/locale/ks/viewer.properties | 168 - .../pdfview/locale/ku/viewer.properties | 146 - .../pdfview/locale/lij/viewer.properties | 16 +- docs/_static/pdfview/locale/locale.properties | 88 +- .../pdfview/locale/lt/viewer.properties | 6 + .../pdfview/locale/mai/viewer.properties | 168 - .../pdfview/locale/meh/viewer.properties | 39 + .../pdfview/locale/ml/viewer.properties | 184 - .../pdfview/locale/mn/viewer.properties | 82 - .../pdfview/locale/mr/viewer.properties | 32 + .../pdfview/locale/my/viewer.properties | 20 +- .../pdfview/locale/nb-NO/viewer.properties | 6 + .../pdfview/locale/nl/viewer.properties | 6 + .../pdfview/locale/nn-NO/viewer.properties | 6 + .../pdfview/locale/nso/viewer.properties | 130 - .../pdfview/locale/oc/viewer.properties | 44 +- .../pdfview/locale/or/viewer.properties | 167 - .../pdfview/locale/pa-IN/viewer.properties | 37 + .../pdfview/locale/pl/viewer.properties | 141 +- .../pdfview/locale/pt-BR/viewer.properties | 39 +- .../pdfview/locale/pt-PT/viewer.properties | 16 +- .../pdfview/locale/rm/viewer.properties | 6 + .../pdfview/locale/ro/viewer.properties | 32 +- .../pdfview/locale/ru/viewer.properties | 6 + .../pdfview/locale/rw/viewer.properties | 81 - .../pdfview/locale/sah/viewer.properties | 166 - .../pdfview/locale/sat/viewer.properties | 134 - .../locale/{lg => scn}/viewer.properties | 71 +- .../pdfview/locale/si/viewer.properties | 36 + .../pdfview/locale/sk/viewer.properties | 6 + .../pdfview/locale/sl/viewer.properties | 18 +- .../pdfview/locale/sq/viewer.properties | 18 +- .../pdfview/locale/sr/viewer.properties | 28 + .../pdfview/locale/sv-SE/viewer.properties | 6 + .../pdfview/locale/sw/viewer.properties | 128 - .../pdfview/locale/ta-LK/viewer.properties | 77 - .../pdfview/locale/te/viewer.properties | 19 +- .../pdfview/locale/th/viewer.properties | 26 +- .../pdfview/locale/tl/viewer.properties | 89 +- .../pdfview/locale/tn/viewer.properties | 83 - .../pdfview/locale/tr/viewer.properties | 12 +- .../pdfview/locale/trs/viewer.properties | 213 + .../pdfview/locale/tsz/viewer.properties | 75 - .../pdfview/locale/uk/viewer.properties | 6 + .../pdfview/locale/ur/viewer.properties | 37 +- .../pdfview/locale/vi/viewer.properties | 53 +- .../pdfview/locale/zam/viewer.properties | 90 - .../pdfview/locale/zh-CN/viewer.properties | 8 +- .../pdfview/locale/zh-TW/viewer.properties | 12 +- .../pdfview/locale/zu/viewer.properties | 131 - docs/_static/pdfview/viewer.css | 619 +- docs/_static/pdfview/viewer.html | 4 +- docs/_static/pdfview/viewer.js | 11170 +-- docs/_static/pdfview/viewer.js.map | 2 +- 133 files changed, 65267 insertions(+), 45915 deletions(-) delete mode 100644 docs/_static/pdfview/images/findbarButton-next-rtl.png delete mode 100644 docs/_static/pdfview/images/findbarButton-next-rtl@2x.png delete mode 100644 docs/_static/pdfview/images/findbarButton-previous-rtl.png delete mode 100644 docs/_static/pdfview/images/findbarButton-previous-rtl@2x.png delete mode 100644 docs/_static/pdfview/images/toolbarButton-pageDown-rtl.png delete mode 100644 docs/_static/pdfview/images/toolbarButton-pageDown-rtl@2x.png delete mode 100644 docs/_static/pdfview/images/toolbarButton-pageUp-rtl.png delete mode 100644 docs/_static/pdfview/images/toolbarButton-pageUp-rtl@2x.png delete mode 100644 docs/_static/pdfview/images/toolbarButton-secondaryToolbarToggle-rtl.png delete mode 100644 docs/_static/pdfview/images/toolbarButton-secondaryToolbarToggle-rtl@2x.png delete mode 100644 docs/_static/pdfview/images/toolbarButton-sidebarToggle-rtl.png delete mode 100644 docs/_static/pdfview/images/toolbarButton-sidebarToggle-rtl@2x.png delete mode 100644 docs/_static/pdfview/images/toolbarButton-viewOutline-rtl.png delete mode 100644 docs/_static/pdfview/images/toolbarButton-viewOutline-rtl@2x.png delete mode 100644 docs/_static/pdfview/images/treeitem-collapsed-rtl.png delete mode 100644 docs/_static/pdfview/images/treeitem-collapsed-rtl@2x.png delete mode 100644 docs/_static/pdfview/locale/ak/viewer.properties delete mode 100644 docs/_static/pdfview/locale/as/viewer.properties delete mode 100644 docs/_static/pdfview/locale/bn-IN/viewer.properties rename docs/_static/pdfview/locale/{bn-BD => bn}/viewer.properties (87%) rename docs/_static/pdfview/locale/{en-ZA => bo}/viewer.properties (61%) delete mode 100644 docs/_static/pdfview/locale/crh/viewer.properties delete mode 100644 docs/_static/pdfview/locale/csb/viewer.properties create mode 100644 docs/_static/pdfview/locale/dsb/viewer.properties delete mode 100644 docs/_static/pdfview/locale/hto/viewer.properties create mode 100644 docs/_static/pdfview/locale/hye/viewer.properties delete mode 100644 docs/_static/pdfview/locale/kok/viewer.properties delete mode 100644 docs/_static/pdfview/locale/ks/viewer.properties delete mode 100644 docs/_static/pdfview/locale/ku/viewer.properties delete mode 100644 docs/_static/pdfview/locale/mai/viewer.properties delete mode 100644 docs/_static/pdfview/locale/ml/viewer.properties delete mode 100644 docs/_static/pdfview/locale/mn/viewer.properties delete mode 100644 docs/_static/pdfview/locale/nso/viewer.properties delete mode 100644 docs/_static/pdfview/locale/or/viewer.properties delete mode 100644 docs/_static/pdfview/locale/rw/viewer.properties delete mode 100644 docs/_static/pdfview/locale/sah/viewer.properties delete mode 100644 docs/_static/pdfview/locale/sat/viewer.properties rename docs/_static/pdfview/locale/{lg => scn}/viewer.properties (65%) delete mode 100644 docs/_static/pdfview/locale/sw/viewer.properties delete mode 100644 docs/_static/pdfview/locale/ta-LK/viewer.properties delete mode 100644 docs/_static/pdfview/locale/tn/viewer.properties create mode 100644 docs/_static/pdfview/locale/trs/viewer.properties delete mode 100644 docs/_static/pdfview/locale/tsz/viewer.properties delete mode 100644 docs/_static/pdfview/locale/zam/viewer.properties delete mode 100644 docs/_static/pdfview/locale/zu/viewer.properties diff --git a/docs/_static/build/pdf.js b/docs/_static/build/pdf.js index 4d8adb0f..24f31917 100644 --- a/docs/_static/build/pdf.js +++ b/docs/_static/build/pdf.js @@ -2,7 +2,7 @@ * @licstart The following is the entire license notice for the * Javascript code in this page * - * Copyright 2018 Mozilla Foundation + * Copyright 2020 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -123,69 +123,248 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; -var pdfjsVersion = '2.0.943'; -var pdfjsBuild = 'dc98bf76'; -var pdfjsSharedUtil = __w_pdfjs_require__(1); -var pdfjsDisplayAPI = __w_pdfjs_require__(129); -var pdfjsDisplayTextLayer = __w_pdfjs_require__(145); -var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(146); -var pdfjsDisplayDOMUtils = __w_pdfjs_require__(130); -var pdfjsDisplaySVG = __w_pdfjs_require__(147); -var pdfjsDisplayWorkerOptions = __w_pdfjs_require__(135); -var pdfjsDisplayAPICompatibility = __w_pdfjs_require__(132); +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "addLinkAttributes", { + enumerable: true, + get: function get() { + return _display_utils.addLinkAttributes; + } +}); +Object.defineProperty(exports, "getFilenameFromUrl", { + enumerable: true, + get: function get() { + return _display_utils.getFilenameFromUrl; + } +}); +Object.defineProperty(exports, "LinkTarget", { + enumerable: true, + get: function get() { + return _display_utils.LinkTarget; + } +}); +Object.defineProperty(exports, "loadScript", { + enumerable: true, + get: function get() { + return _display_utils.loadScript; + } +}); +Object.defineProperty(exports, "PDFDateString", { + enumerable: true, + get: function get() { + return _display_utils.PDFDateString; + } +}); +Object.defineProperty(exports, "RenderingCancelledException", { + enumerable: true, + get: function get() { + return _display_utils.RenderingCancelledException; + } +}); +Object.defineProperty(exports, "build", { + enumerable: true, + get: function get() { + return _api.build; + } +}); +Object.defineProperty(exports, "getDocument", { + enumerable: true, + get: function get() { + return _api.getDocument; + } +}); +Object.defineProperty(exports, "LoopbackPort", { + enumerable: true, + get: function get() { + return _api.LoopbackPort; + } +}); +Object.defineProperty(exports, "PDFDataRangeTransport", { + enumerable: true, + get: function get() { + return _api.PDFDataRangeTransport; + } +}); +Object.defineProperty(exports, "PDFWorker", { + enumerable: true, + get: function get() { + return _api.PDFWorker; + } +}); +Object.defineProperty(exports, "version", { + enumerable: true, + get: function get() { + return _api.version; + } +}); +Object.defineProperty(exports, "CMapCompressionType", { + enumerable: true, + get: function get() { + return _util.CMapCompressionType; + } +}); +Object.defineProperty(exports, "createObjectURL", { + enumerable: true, + get: function get() { + return _util.createObjectURL; + } +}); +Object.defineProperty(exports, "createPromiseCapability", { + enumerable: true, + get: function get() { + return _util.createPromiseCapability; + } +}); +Object.defineProperty(exports, "createValidAbsoluteUrl", { + enumerable: true, + get: function get() { + return _util.createValidAbsoluteUrl; + } +}); +Object.defineProperty(exports, "InvalidPDFException", { + enumerable: true, + get: function get() { + return _util.InvalidPDFException; + } +}); +Object.defineProperty(exports, "MissingPDFException", { + enumerable: true, + get: function get() { + return _util.MissingPDFException; + } +}); +Object.defineProperty(exports, "OPS", { + enumerable: true, + get: function get() { + return _util.OPS; + } +}); +Object.defineProperty(exports, "PasswordResponses", { + enumerable: true, + get: function get() { + return _util.PasswordResponses; + } +}); +Object.defineProperty(exports, "PermissionFlag", { + enumerable: true, + get: function get() { + return _util.PermissionFlag; + } +}); +Object.defineProperty(exports, "removeNullCharacters", { + enumerable: true, + get: function get() { + return _util.removeNullCharacters; + } +}); +Object.defineProperty(exports, "shadow", { + enumerable: true, + get: function get() { + return _util.shadow; + } +}); +Object.defineProperty(exports, "UnexpectedResponseException", { + enumerable: true, + get: function get() { + return _util.UnexpectedResponseException; + } +}); +Object.defineProperty(exports, "UNSUPPORTED_FEATURES", { + enumerable: true, + get: function get() { + return _util.UNSUPPORTED_FEATURES; + } +}); +Object.defineProperty(exports, "Util", { + enumerable: true, + get: function get() { + return _util.Util; + } +}); +Object.defineProperty(exports, "VerbosityLevel", { + enumerable: true, + get: function get() { + return _util.VerbosityLevel; + } +}); +Object.defineProperty(exports, "AnnotationLayer", { + enumerable: true, + get: function get() { + return _annotation_layer.AnnotationLayer; + } +}); +Object.defineProperty(exports, "apiCompatibilityParams", { + enumerable: true, + get: function get() { + return _api_compatibility.apiCompatibilityParams; + } +}); +Object.defineProperty(exports, "GlobalWorkerOptions", { + enumerable: true, + get: function get() { + return _worker_options.GlobalWorkerOptions; + } +}); +Object.defineProperty(exports, "renderTextLayer", { + enumerable: true, + get: function get() { + return _text_layer.renderTextLayer; + } +}); +Object.defineProperty(exports, "SVGGraphics", { + enumerable: true, + get: function get() { + return _svg.SVGGraphics; + } +}); + +var _display_utils = __w_pdfjs_require__(1); + +var _api = __w_pdfjs_require__(198); + +var _util = __w_pdfjs_require__(5); + +var _annotation_layer = __w_pdfjs_require__(209); + +var _api_compatibility = __w_pdfjs_require__(200); + +var _worker_options = __w_pdfjs_require__(203); + +var _text_layer = __w_pdfjs_require__(210); + +var _svg = __w_pdfjs_require__(211); + +var pdfjsVersion = '2.5.207'; +var pdfjsBuild = '0974d6052'; { - var isNodeJS = __w_pdfjs_require__(4); - if (isNodeJS()) { - var PDFNodeStream = __w_pdfjs_require__(148).PDFNodeStream; - pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) { + var _require = __w_pdfjs_require__(7), + isNodeJS = _require.isNodeJS; + + if (isNodeJS) { + var PDFNodeStream = __w_pdfjs_require__(212).PDFNodeStream; + + (0, _api.setPDFNetworkStreamFactory)(function (params) { return new PDFNodeStream(params); }); - } else if (typeof Response !== 'undefined' && 'body' in Response.prototype && typeof ReadableStream !== 'undefined') { - var PDFFetchStream = __w_pdfjs_require__(151).PDFFetchStream; - pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) { - return new PDFFetchStream(params); - }); } else { - var PDFNetworkStream = __w_pdfjs_require__(152).PDFNetworkStream; - pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) { + var PDFNetworkStream = __w_pdfjs_require__(215).PDFNetworkStream; + + var PDFFetchStream; + + if ((0, _display_utils.isFetchSupported)()) { + PDFFetchStream = __w_pdfjs_require__(216).PDFFetchStream; + } + + (0, _api.setPDFNetworkStreamFactory)(function (params) { + if (PDFFetchStream && (0, _display_utils.isValidFetchUrl)(params.url)) { + return new PDFFetchStream(params); + } + return new PDFNetworkStream(params); }); } } -exports.build = pdfjsDisplayAPI.build; -exports.version = pdfjsDisplayAPI.version; -exports.getDocument = pdfjsDisplayAPI.getDocument; -exports.LoopbackPort = pdfjsDisplayAPI.LoopbackPort; -exports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport; -exports.PDFWorker = pdfjsDisplayAPI.PDFWorker; -exports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer; -exports.AnnotationLayer = pdfjsDisplayAnnotationLayer.AnnotationLayer; -exports.createPromiseCapability = pdfjsSharedUtil.createPromiseCapability; -exports.PasswordResponses = pdfjsSharedUtil.PasswordResponses; -exports.InvalidPDFException = pdfjsSharedUtil.InvalidPDFException; -exports.MissingPDFException = pdfjsSharedUtil.MissingPDFException; -exports.SVGGraphics = pdfjsDisplaySVG.SVGGraphics; -exports.NativeImageDecoding = pdfjsSharedUtil.NativeImageDecoding; -exports.CMapCompressionType = pdfjsSharedUtil.CMapCompressionType; -exports.PermissionFlag = pdfjsSharedUtil.PermissionFlag; -exports.UnexpectedResponseException = pdfjsSharedUtil.UnexpectedResponseException; -exports.OPS = pdfjsSharedUtil.OPS; -exports.VerbosityLevel = pdfjsSharedUtil.VerbosityLevel; -exports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES; -exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl; -exports.createObjectURL = pdfjsSharedUtil.createObjectURL; -exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters; -exports.shadow = pdfjsSharedUtil.shadow; -exports.Util = pdfjsSharedUtil.Util; -exports.ReadableStream = pdfjsSharedUtil.ReadableStream; -exports.URL = pdfjsSharedUtil.URL; -exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException; -exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl; -exports.LinkTarget = pdfjsDisplayDOMUtils.LinkTarget; -exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes; -exports.loadScript = pdfjsDisplayDOMUtils.loadScript; -exports.GlobalWorkerOptions = pdfjsDisplayWorkerOptions.GlobalWorkerOptions; -exports.apiCompatibilityParams = pdfjsDisplayAPICompatibility.apiCompatibilityParams; /***/ }), /* 1 */ @@ -197,7815 +376,11889 @@ exports.apiCompatibilityParams = pdfjsDisplayAPICompatibility.apiCompatibilityPa Object.defineProperty(exports, "__esModule", { value: true }); -exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.URL = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.getInheritableProperty = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.toRomanNumerals = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined; +exports.addLinkAttributes = addLinkAttributes; +exports.getFilenameFromUrl = getFilenameFromUrl; +exports.isFetchSupported = isFetchSupported; +exports.isValidFetchUrl = isValidFetchUrl; +exports.loadScript = loadScript; +exports.deprecated = deprecated; +exports.PDFDateString = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0; -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); -__w_pdfjs_require__(2); +var _util = __w_pdfjs_require__(5); -var _streams_polyfill = __w_pdfjs_require__(125); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _url_polyfill = __w_pdfjs_require__(127); +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } -var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; -var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; -var NativeImageDecoding = { - NONE: 'none', - DECODE: 'decode', - DISPLAY: 'display' -}; -var PermissionFlag = { - PRINT: 0x04, - MODIFY_CONTENTS: 0x08, - COPY: 0x10, - MODIFY_ANNOTATIONS: 0x20, - FILL_INTERACTIVE_FORMS: 0x100, - COPY_FOR_ACCESSIBILITY: 0x200, - ASSEMBLE: 0x400, - PRINT_HIGH_QUALITY: 0x800 -}; -var TextRenderingMode = { - FILL: 0, - STROKE: 1, - FILL_STROKE: 2, - INVISIBLE: 3, - FILL_ADD_TO_PATH: 4, - STROKE_ADD_TO_PATH: 5, - FILL_STROKE_ADD_TO_PATH: 6, - ADD_TO_PATH: 7, - FILL_STROKE_MASK: 3, - ADD_TO_PATH_FLAG: 4 -}; -var ImageKind = { - GRAYSCALE_1BPP: 1, - RGB_24BPP: 2, - RGBA_32BPP: 3 -}; -var AnnotationType = { - TEXT: 1, - LINK: 2, - FREETEXT: 3, - LINE: 4, - SQUARE: 5, - CIRCLE: 6, - POLYGON: 7, - POLYLINE: 8, - HIGHLIGHT: 9, - UNDERLINE: 10, - SQUIGGLY: 11, - STRIKEOUT: 12, - STAMP: 13, - CARET: 14, - INK: 15, - POPUP: 16, - FILEATTACHMENT: 17, - SOUND: 18, - MOVIE: 19, - WIDGET: 20, - SCREEN: 21, - PRINTERMARK: 22, - TRAPNET: 23, - WATERMARK: 24, - THREED: 25, - REDACT: 26 -}; -var AnnotationFlag = { - INVISIBLE: 0x01, - HIDDEN: 0x02, - PRINT: 0x04, - NOZOOM: 0x08, - NOROTATE: 0x10, - NOVIEW: 0x20, - READONLY: 0x40, - LOCKED: 0x80, - TOGGLENOVIEW: 0x100, - LOCKEDCONTENTS: 0x200 -}; -var AnnotationFieldFlag = { - READONLY: 0x0000001, - REQUIRED: 0x0000002, - NOEXPORT: 0x0000004, - MULTILINE: 0x0001000, - PASSWORD: 0x0002000, - NOTOGGLETOOFF: 0x0004000, - RADIO: 0x0008000, - PUSHBUTTON: 0x0010000, - COMBO: 0x0020000, - EDIT: 0x0040000, - SORT: 0x0080000, - FILESELECT: 0x0100000, - MULTISELECT: 0x0200000, - DONOTSPELLCHECK: 0x0400000, - DONOTSCROLL: 0x0800000, - COMB: 0x1000000, - RICHTEXT: 0x2000000, - RADIOSINUNISON: 0x2000000, - COMMITONSELCHANGE: 0x4000000 -}; -var AnnotationBorderStyleType = { - SOLID: 1, - DASHED: 2, - BEVELED: 3, - INSET: 4, - UNDERLINE: 5 -}; -var StreamType = { - UNKNOWN: 0, - FLATE: 1, - LZW: 2, - DCT: 3, - JPX: 4, - JBIG: 5, - A85: 6, - AHX: 7, - CCF: 8, - RL: 9 -}; -var FontType = { - UNKNOWN: 0, - TYPE1: 1, - TYPE1C: 2, - CIDFONTTYPE0: 3, - CIDFONTTYPE0C: 4, - TRUETYPE: 5, - CIDFONTTYPE2: 6, - TYPE3: 7, - OPENTYPE: 8, - TYPE0: 9, - MMTYPE1: 10 -}; -var VerbosityLevel = { - ERRORS: 0, - WARNINGS: 1, - INFOS: 5 -}; -var CMapCompressionType = { - NONE: 0, - BINARY: 1, - STREAM: 2 -}; -var OPS = { - dependency: 1, - setLineWidth: 2, - setLineCap: 3, - setLineJoin: 4, - setMiterLimit: 5, - setDash: 6, - setRenderingIntent: 7, - setFlatness: 8, - setGState: 9, - save: 10, - restore: 11, - transform: 12, - moveTo: 13, - lineTo: 14, - curveTo: 15, - curveTo2: 16, - curveTo3: 17, - closePath: 18, - rectangle: 19, - stroke: 20, - closeStroke: 21, - fill: 22, - eoFill: 23, - fillStroke: 24, - eoFillStroke: 25, - closeFillStroke: 26, - closeEOFillStroke: 27, - endPath: 28, - clip: 29, - eoClip: 30, - beginText: 31, - endText: 32, - setCharSpacing: 33, - setWordSpacing: 34, - setHScale: 35, - setLeading: 36, - setFont: 37, - setTextRenderingMode: 38, - setTextRise: 39, - moveText: 40, - setLeadingMoveText: 41, - setTextMatrix: 42, - nextLine: 43, - showText: 44, - showSpacedText: 45, - nextLineShowText: 46, - nextLineSetSpacingShowText: 47, - setCharWidth: 48, - setCharWidthAndBounds: 49, - setStrokeColorSpace: 50, - setFillColorSpace: 51, - setStrokeColor: 52, - setStrokeColorN: 53, - setFillColor: 54, - setFillColorN: 55, - setStrokeGray: 56, - setFillGray: 57, - setStrokeRGBColor: 58, - setFillRGBColor: 59, - setStrokeCMYKColor: 60, - setFillCMYKColor: 61, - shadingFill: 62, - beginInlineImage: 63, - beginImageData: 64, - endInlineImage: 65, - paintXObject: 66, - markPoint: 67, - markPointProps: 68, - beginMarkedContent: 69, - beginMarkedContentProps: 70, - endMarkedContent: 71, - beginCompat: 72, - endCompat: 73, - paintFormXObjectBegin: 74, - paintFormXObjectEnd: 75, - beginGroup: 76, - endGroup: 77, - beginAnnotations: 78, - endAnnotations: 79, - beginAnnotation: 80, - endAnnotation: 81, - paintJpegXObject: 82, - paintImageMaskXObject: 83, - paintImageMaskXObjectGroup: 84, - paintImageXObject: 85, - paintInlineImageXObject: 86, - paintInlineImageXObjectGroup: 87, - paintImageXObjectRepeat: 88, - paintImageMaskXObjectRepeat: 89, - paintSolidColorImageMask: 90, - constructPath: 91 -}; -var UNSUPPORTED_FEATURES = { - unknown: 'unknown', - forms: 'forms', - javaScript: 'javaScript', - smask: 'smask', - shadingPattern: 'shadingPattern', - font: 'font' -}; -var PasswordResponses = { - NEED_PASSWORD: 1, - INCORRECT_PASSWORD: 2 -}; -var verbosity = VerbosityLevel.WARNINGS; -function setVerbosityLevel(level) { - if (Number.isInteger(level)) { - verbosity = level; - } -} -function getVerbosityLevel() { - return verbosity; -} -function info(msg) { - if (verbosity >= VerbosityLevel.INFOS) { - console.log('Info: ' + msg); - } -} -function warn(msg) { - if (verbosity >= VerbosityLevel.WARNINGS) { - console.log('Warning: ' + msg); - } -} -function deprecated(details) { - console.log('Deprecated API usage: ' + details); -} -function unreachable(msg) { - throw new Error(msg); -} -function assert(cond, msg) { - if (!cond) { - unreachable(msg); +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var DEFAULT_LINK_REL = "noopener noreferrer nofollow"; +exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL; +var SVG_NS = "http://www.w3.org/2000/svg"; + +var DOMCanvasFactory = /*#__PURE__*/function () { + function DOMCanvasFactory() { + _classCallCheck(this, DOMCanvasFactory); } -} -function isSameOrigin(baseUrl, otherUrl) { - try { - var base = new _url_polyfill.URL(baseUrl); - if (!base.origin || base.origin === 'null') { - return false; + + _createClass(DOMCanvasFactory, [{ + key: "create", + value: function create(width, height) { + if (width <= 0 || height <= 0) { + throw new Error("Invalid canvas size"); + } + + var canvas = document.createElement("canvas"); + var context = canvas.getContext("2d"); + canvas.width = width; + canvas.height = height; + return { + canvas: canvas, + context: context + }; } - } catch (e) { - return false; - } - var other = new _url_polyfill.URL(otherUrl, base); - return base.origin === other.origin; -} -function _isValidProtocol(url) { - if (!url) { - return false; - } - switch (url.protocol) { - case 'http:': - case 'https:': - case 'ftp:': - case 'mailto:': - case 'tel:': - return true; - default: - return false; - } -} -function createValidAbsoluteUrl(url, baseUrl) { - if (!url) { - return null; - } - try { - var absoluteUrl = baseUrl ? new _url_polyfill.URL(url, baseUrl) : new _url_polyfill.URL(url); - if (_isValidProtocol(absoluteUrl)) { - return absoluteUrl; + }, { + key: "reset", + value: function reset(canvasAndContext, width, height) { + if (!canvasAndContext.canvas) { + throw new Error("Canvas is not specified"); + } + + if (width <= 0 || height <= 0) { + throw new Error("Invalid canvas size"); + } + + canvasAndContext.canvas.width = width; + canvasAndContext.canvas.height = height; } - } catch (ex) {} - return null; -} -function shadow(obj, prop, value) { - Object.defineProperty(obj, prop, { - value: value, - enumerable: true, - configurable: true, - writable: false - }); - return value; -} -function getLookupTableFactory(initializer) { - var lookup; - return function () { - if (initializer) { - lookup = Object.create(null); - initializer(lookup); - initializer = null; + }, { + key: "destroy", + value: function destroy(canvasAndContext) { + if (!canvasAndContext.canvas) { + throw new Error("Canvas is not specified"); + } + + canvasAndContext.canvas.width = 0; + canvasAndContext.canvas.height = 0; + canvasAndContext.canvas = null; + canvasAndContext.context = null; } - return lookup; - }; -} -var PasswordException = function PasswordExceptionClosure() { - function PasswordException(msg, code) { - this.name = 'PasswordException'; - this.message = msg; - this.code = code; - } - PasswordException.prototype = new Error(); - PasswordException.constructor = PasswordException; - return PasswordException; -}(); -var UnknownErrorException = function UnknownErrorExceptionClosure() { - function UnknownErrorException(msg, details) { - this.name = 'UnknownErrorException'; - this.message = msg; - this.details = details; - } - UnknownErrorException.prototype = new Error(); - UnknownErrorException.constructor = UnknownErrorException; - return UnknownErrorException; -}(); -var InvalidPDFException = function InvalidPDFExceptionClosure() { - function InvalidPDFException(msg) { - this.name = 'InvalidPDFException'; - this.message = msg; - } - InvalidPDFException.prototype = new Error(); - InvalidPDFException.constructor = InvalidPDFException; - return InvalidPDFException; + }]); + + return DOMCanvasFactory; }(); -var MissingPDFException = function MissingPDFExceptionClosure() { - function MissingPDFException(msg) { - this.name = 'MissingPDFException'; - this.message = msg; + +exports.DOMCanvasFactory = DOMCanvasFactory; + +var DOMCMapReaderFactory = /*#__PURE__*/function () { + function DOMCMapReaderFactory(_ref) { + var _ref$baseUrl = _ref.baseUrl, + baseUrl = _ref$baseUrl === void 0 ? null : _ref$baseUrl, + _ref$isCompressed = _ref.isCompressed, + isCompressed = _ref$isCompressed === void 0 ? false : _ref$isCompressed; + + _classCallCheck(this, DOMCMapReaderFactory); + + this.baseUrl = baseUrl; + this.isCompressed = isCompressed; } - MissingPDFException.prototype = new Error(); - MissingPDFException.constructor = MissingPDFException; - return MissingPDFException; + + _createClass(DOMCMapReaderFactory, [{ + key: "fetch", + value: function (_fetch) { + function fetch(_x) { + return _fetch.apply(this, arguments); + } + + fetch.toString = function () { + return _fetch.toString(); + }; + + return fetch; + }( /*#__PURE__*/function () { + var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_ref2) { + var _this = this; + + var name, url, compressionType; + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + name = _ref2.name; + + if (this.baseUrl) { + _context2.next = 3; + break; + } + + throw new Error('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.'); + + case 3: + if (name) { + _context2.next = 5; + break; + } + + throw new Error("CMap name must be specified."); + + case 5: + url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : ""); + compressionType = this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE; + + if (!(isFetchSupported() && isValidFetchUrl(url, document.baseURI))) { + _context2.next = 9; + break; + } + + return _context2.abrupt("return", fetch(url).then( /*#__PURE__*/function () { + var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(response) { + var cMapData; + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (response.ok) { + _context.next = 2; + break; + } + + throw new Error(response.statusText); + + case 2: + if (!_this.isCompressed) { + _context.next = 10; + break; + } + + _context.t0 = Uint8Array; + _context.next = 6; + return response.arrayBuffer(); + + case 6: + _context.t1 = _context.sent; + cMapData = new _context.t0(_context.t1); + _context.next = 15; + break; + + case 10: + _context.t2 = _util.stringToBytes; + _context.next = 13; + return response.text(); + + case 13: + _context.t3 = _context.sent; + cMapData = (0, _context.t2)(_context.t3); + + case 15: + return _context.abrupt("return", { + cMapData: cMapData, + compressionType: compressionType + }); + + case 16: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + + return function (_x3) { + return _ref4.apply(this, arguments); + }; + }())["catch"](function (reason) { + throw new Error("Unable to load ".concat(_this.isCompressed ? "binary " : "") + "CMap at: ".concat(url)); + })); + + case 9: + return _context2.abrupt("return", new Promise(function (resolve, reject) { + var request = new XMLHttpRequest(); + request.open("GET", url, true); + + if (_this.isCompressed) { + request.responseType = "arraybuffer"; + } + + request.onreadystatechange = function () { + if (request.readyState !== XMLHttpRequest.DONE) { + return; + } + + if (request.status === 200 || request.status === 0) { + var cMapData; + + if (_this.isCompressed && request.response) { + cMapData = new Uint8Array(request.response); + } else if (!_this.isCompressed && request.responseText) { + cMapData = (0, _util.stringToBytes)(request.responseText); + } + + if (cMapData) { + resolve({ + cMapData: cMapData, + compressionType: compressionType + }); + return; + } + } + + reject(new Error(request.statusText)); + }; + + request.send(null); + })["catch"](function (reason) { + throw new Error("Unable to load ".concat(_this.isCompressed ? "binary " : "") + "CMap at: ".concat(url)); + })); + + case 10: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + return function (_x2) { + return _ref3.apply(this, arguments); + }; + }()) + }]); + + return DOMCMapReaderFactory; }(); -var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() { - function UnexpectedResponseException(msg, status) { - this.name = 'UnexpectedResponseException'; - this.message = msg; - this.status = status; + +exports.DOMCMapReaderFactory = DOMCMapReaderFactory; + +var DOMSVGFactory = /*#__PURE__*/function () { + function DOMSVGFactory() { + _classCallCheck(this, DOMSVGFactory); } - UnexpectedResponseException.prototype = new Error(); - UnexpectedResponseException.constructor = UnexpectedResponseException; - return UnexpectedResponseException; -}(); -var MissingDataException = function MissingDataExceptionClosure() { - function MissingDataException(begin, end) { - this.begin = begin; - this.end = end; - this.message = 'Missing data [' + begin + ', ' + end + ')'; - } - MissingDataException.prototype = new Error(); - MissingDataException.prototype.name = 'MissingDataException'; - MissingDataException.constructor = MissingDataException; - return MissingDataException; -}(); -var XRefParseException = function XRefParseExceptionClosure() { - function XRefParseException(msg) { - this.message = msg; - } - XRefParseException.prototype = new Error(); - XRefParseException.prototype.name = 'XRefParseException'; - XRefParseException.constructor = XRefParseException; - return XRefParseException; + + _createClass(DOMSVGFactory, [{ + key: "create", + value: function create(width, height) { + (0, _util.assert)(width > 0 && height > 0, "Invalid SVG dimensions"); + var svg = document.createElementNS(SVG_NS, "svg:svg"); + svg.setAttribute("version", "1.1"); + svg.setAttribute("width", width + "px"); + svg.setAttribute("height", height + "px"); + svg.setAttribute("preserveAspectRatio", "none"); + svg.setAttribute("viewBox", "0 0 " + width + " " + height); + return svg; + } + }, { + key: "createElement", + value: function createElement(type) { + (0, _util.assert)(typeof type === "string", "Invalid SVG element type"); + return document.createElementNS(SVG_NS, type); + } + }]); + + return DOMSVGFactory; }(); -var FormatError = function FormatErrorClosure() { - function FormatError(msg) { - this.message = msg; - } - FormatError.prototype = new Error(); - FormatError.prototype.name = 'FormatError'; - FormatError.constructor = FormatError; - return FormatError; -}(); -var AbortException = function AbortExceptionClosure() { - function AbortException(msg) { - this.name = 'AbortException'; - this.message = msg; + +exports.DOMSVGFactory = DOMSVGFactory; + +var PageViewport = /*#__PURE__*/function () { + function PageViewport(_ref5) { + var viewBox = _ref5.viewBox, + scale = _ref5.scale, + rotation = _ref5.rotation, + _ref5$offsetX = _ref5.offsetX, + offsetX = _ref5$offsetX === void 0 ? 0 : _ref5$offsetX, + _ref5$offsetY = _ref5.offsetY, + offsetY = _ref5$offsetY === void 0 ? 0 : _ref5$offsetY, + _ref5$dontFlip = _ref5.dontFlip, + dontFlip = _ref5$dontFlip === void 0 ? false : _ref5$dontFlip; + + _classCallCheck(this, PageViewport); + + this.viewBox = viewBox; + this.scale = scale; + this.rotation = rotation; + this.offsetX = offsetX; + this.offsetY = offsetY; + var centerX = (viewBox[2] + viewBox[0]) / 2; + var centerY = (viewBox[3] + viewBox[1]) / 2; + var rotateA, rotateB, rotateC, rotateD; + rotation = rotation % 360; + rotation = rotation < 0 ? rotation + 360 : rotation; + + switch (rotation) { + case 180: + rotateA = -1; + rotateB = 0; + rotateC = 0; + rotateD = 1; + break; + + case 90: + rotateA = 0; + rotateB = 1; + rotateC = 1; + rotateD = 0; + break; + + case 270: + rotateA = 0; + rotateB = -1; + rotateC = -1; + rotateD = 0; + break; + + case 0: + rotateA = 1; + rotateB = 0; + rotateC = 0; + rotateD = -1; + break; + + default: + throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees."); + } + + if (dontFlip) { + rotateC = -rotateC; + rotateD = -rotateD; + } + + var offsetCanvasX, offsetCanvasY; + var width, height; + + if (rotateA === 0) { + offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; + offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; + width = Math.abs(viewBox[3] - viewBox[1]) * scale; + height = Math.abs(viewBox[2] - viewBox[0]) * scale; + } else { + offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; + offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; + width = Math.abs(viewBox[2] - viewBox[0]) * scale; + height = Math.abs(viewBox[3] - viewBox[1]) * scale; + } + + this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY]; + this.width = width; + this.height = height; } - AbortException.prototype = new Error(); - AbortException.constructor = AbortException; - return AbortException; + + _createClass(PageViewport, [{ + key: "clone", + value: function clone() { + var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref6$scale = _ref6.scale, + scale = _ref6$scale === void 0 ? this.scale : _ref6$scale, + _ref6$rotation = _ref6.rotation, + rotation = _ref6$rotation === void 0 ? this.rotation : _ref6$rotation, + _ref6$offsetX = _ref6.offsetX, + offsetX = _ref6$offsetX === void 0 ? this.offsetX : _ref6$offsetX, + _ref6$offsetY = _ref6.offsetY, + offsetY = _ref6$offsetY === void 0 ? this.offsetY : _ref6$offsetY, + _ref6$dontFlip = _ref6.dontFlip, + dontFlip = _ref6$dontFlip === void 0 ? false : _ref6$dontFlip; + + return new PageViewport({ + viewBox: this.viewBox.slice(), + scale: scale, + rotation: rotation, + offsetX: offsetX, + offsetY: offsetY, + dontFlip: dontFlip + }); + } + }, { + key: "convertToViewportPoint", + value: function convertToViewportPoint(x, y) { + return _util.Util.applyTransform([x, y], this.transform); + } + }, { + key: "convertToViewportRectangle", + value: function convertToViewportRectangle(rect) { + var topLeft = _util.Util.applyTransform([rect[0], rect[1]], this.transform); + + var bottomRight = _util.Util.applyTransform([rect[2], rect[3]], this.transform); + + return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]]; + } + }, { + key: "convertToPdfPoint", + value: function convertToPdfPoint(x, y) { + return _util.Util.applyInverseTransform([x, y], this.transform); + } + }]); + + return PageViewport; }(); -var NullCharactersRegExp = /\x00/g; -function removeNullCharacters(str) { - if (typeof str !== 'string') { - warn('The argument for removeNullCharacters must be a string.'); - return str; - } - return str.replace(NullCharactersRegExp, ''); -} -function bytesToString(bytes) { - assert(bytes !== null && (typeof bytes === 'undefined' ? 'undefined' : _typeof(bytes)) === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString'); - var length = bytes.length; - var MAX_ARGUMENT_COUNT = 8192; - if (length < MAX_ARGUMENT_COUNT) { - return String.fromCharCode.apply(null, bytes); + +exports.PageViewport = PageViewport; + +var RenderingCancelledException = /*#__PURE__*/function (_BaseException) { + _inherits(RenderingCancelledException, _BaseException); + + var _super = _createSuper(RenderingCancelledException); + + function RenderingCancelledException(msg, type) { + var _this2; + + _classCallCheck(this, RenderingCancelledException); + + _this2 = _super.call(this, msg); + _this2.type = type; + return _this2; } - var strBuf = []; - for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) { - var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); - var chunk = bytes.subarray(i, chunkEnd); - strBuf.push(String.fromCharCode.apply(null, chunk)); + + return RenderingCancelledException; +}(_util.BaseException); + +exports.RenderingCancelledException = RenderingCancelledException; +var LinkTarget = { + NONE: 0, + SELF: 1, + BLANK: 2, + PARENT: 3, + TOP: 4 +}; +exports.LinkTarget = LinkTarget; + +function addLinkAttributes(link) { + var _ref7 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + url = _ref7.url, + target = _ref7.target, + rel = _ref7.rel, + _ref7$enabled = _ref7.enabled, + enabled = _ref7$enabled === void 0 ? true : _ref7$enabled; + + (0, _util.assert)(url && typeof url === "string", 'addLinkAttributes: A valid "url" parameter must provided.'); + var urlNullRemoved = (0, _util.removeNullCharacters)(url); + + if (enabled) { + link.href = link.title = urlNullRemoved; + } else { + link.href = ""; + link.title = "Disabled: ".concat(urlNullRemoved); + + link.onclick = function () { + return false; + }; } - return strBuf.join(''); -} -function stringToBytes(str) { - assert(typeof str === 'string', 'Invalid argument for stringToBytes'); - var length = str.length; - var bytes = new Uint8Array(length); - for (var i = 0; i < length; ++i) { - bytes[i] = str.charCodeAt(i) & 0xFF; + + var targetStr = ""; + + switch (target) { + case LinkTarget.NONE: + break; + + case LinkTarget.SELF: + targetStr = "_self"; + break; + + case LinkTarget.BLANK: + targetStr = "_blank"; + break; + + case LinkTarget.PARENT: + targetStr = "_parent"; + break; + + case LinkTarget.TOP: + targetStr = "_top"; + break; } - return bytes; + + link.target = targetStr; + link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL; } -function arrayByteLength(arr) { - if (arr.length !== undefined) { - return arr.length; - } - assert(arr.byteLength !== undefined); - return arr.byteLength; + +function getFilenameFromUrl(url) { + var anchor = url.indexOf("#"); + var query = url.indexOf("?"); + var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length); + return url.substring(url.lastIndexOf("/", end) + 1, end); } -function arraysToBytes(arr) { - if (arr.length === 1 && arr[0] instanceof Uint8Array) { - return arr[0]; - } - var resultLength = 0; - var i, - ii = arr.length; - var item, itemLength; - for (i = 0; i < ii; i++) { - item = arr[i]; - itemLength = arrayByteLength(item); - resultLength += itemLength; + +var StatTimer = /*#__PURE__*/function () { + function StatTimer() { + _classCallCheck(this, StatTimer); + + this.started = Object.create(null); + this.times = []; } - var pos = 0; - var data = new Uint8Array(resultLength); - for (i = 0; i < ii; i++) { - item = arr[i]; - if (!(item instanceof Uint8Array)) { - if (typeof item === 'string') { - item = stringToBytes(item); - } else { - item = new Uint8Array(item); + + _createClass(StatTimer, [{ + key: "time", + value: function time(name) { + if (name in this.started) { + (0, _util.warn)("Timer is already running for ".concat(name)); } + + this.started[name] = Date.now(); } - itemLength = item.byteLength; - data.set(item, pos); - pos += itemLength; - } - return data; -} -function string32(value) { - return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); -} -function log2(x) { - if (x <= 0) { - return 0; - } - return Math.ceil(Math.log2(x)); -} -function readInt8(data, start) { - return data[start] << 24 >> 24; -} -function readUint16(data, offset) { - return data[offset] << 8 | data[offset + 1]; -} -function readUint32(data, offset) { - return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; -} -function isLittleEndian() { - var buffer8 = new Uint8Array(4); - buffer8[0] = 1; - var view32 = new Uint32Array(buffer8.buffer, 0, 1); - return view32[0] === 1; -} -function isEvalSupported() { - try { - new Function(''); - return true; - } catch (e) { - return false; - } -} -function getInheritableProperty(_ref) { - var dict = _ref.dict, - key = _ref.key, - _ref$getArray = _ref.getArray, - getArray = _ref$getArray === undefined ? false : _ref$getArray, - _ref$stopWhenFound = _ref.stopWhenFound, - stopWhenFound = _ref$stopWhenFound === undefined ? true : _ref$stopWhenFound; - - var LOOP_LIMIT = 100; - var loopCount = 0; - var values = void 0; - while (dict) { - var value = getArray ? dict.getArray(key) : dict.get(key); - if (value !== undefined) { - if (stopWhenFound) { - return value; - } - if (!values) { - values = []; + }, { + key: "timeEnd", + value: function timeEnd(name) { + if (!(name in this.started)) { + (0, _util.warn)("Timer has not been started for ".concat(name)); } - values.push(value); + + this.times.push({ + name: name, + start: this.started[name], + end: Date.now() + }); + delete this.started[name]; } - if (++loopCount > LOOP_LIMIT) { - warn('getInheritableProperty: maximum loop count exceeded for "' + key + '"'); - break; + }, { + key: "toString", + value: function toString() { + var outBuf = []; + var longest = 0; + + var _iterator = _createForOfIteratorHelper(this.times), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var time = _step.value; + var name = time.name; + + if (name.length > longest) { + longest = name.length; + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + var _iterator2 = _createForOfIteratorHelper(this.times), + _step2; + + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var _time = _step2.value; + var duration = _time.end - _time.start; + outBuf.push("".concat(_time.name.padEnd(longest), " ").concat(duration, "ms\n")); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + + return outBuf.join(""); } - dict = dict.get('Parent'); + }]); + + return StatTimer; +}(); + +exports.StatTimer = StatTimer; + +function isFetchSupported() { + return typeof fetch !== "undefined" && typeof Response !== "undefined" && "body" in Response.prototype && typeof ReadableStream !== "undefined"; +} + +function isValidFetchUrl(url, baseUrl) { + try { + var _ref8 = baseUrl ? new URL(url, baseUrl) : new URL(url), + protocol = _ref8.protocol; + + return protocol === "http:" || protocol === "https:"; + } catch (ex) { + return false; } - return values; } -var Util = function UtilClosure() { - function Util() {} - var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')']; - Util.makeCssRgb = function Util_makeCssRgb(r, g, b) { - rgbBuf[1] = r; - rgbBuf[3] = g; - rgbBuf[5] = b; - return rgbBuf.join(''); - }; - Util.transform = function Util_transform(m1, m2) { - return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]]; - }; - Util.applyTransform = function Util_applyTransform(p, m) { - var xt = p[0] * m[0] + p[1] * m[2] + m[4]; - var yt = p[0] * m[1] + p[1] * m[3] + m[5]; - return [xt, yt]; - }; - Util.applyInverseTransform = function Util_applyInverseTransform(p, m) { - var d = m[0] * m[3] - m[1] * m[2]; - var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; - var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; - return [xt, yt]; - }; - Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) { - var p1 = Util.applyTransform(r, m); - var p2 = Util.applyTransform(r.slice(2, 4), m); - var p3 = Util.applyTransform([r[0], r[3]], m); - var p4 = Util.applyTransform([r[2], r[1]], m); - return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])]; - }; - Util.inverseTransform = function Util_inverseTransform(m) { - var d = m[0] * m[3] - m[1] * m[2]; - return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d]; - }; - Util.apply3dTransform = function Util_apply3dTransform(m, v) { - return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]]; - }; - Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) { - var transpose = [m[0], m[2], m[1], m[3]]; - var a = m[0] * transpose[0] + m[1] * transpose[2]; - var b = m[0] * transpose[1] + m[1] * transpose[3]; - var c = m[2] * transpose[0] + m[3] * transpose[2]; - var d = m[2] * transpose[1] + m[3] * transpose[3]; - var first = (a + d) / 2; - var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; - var sx = first + second || 1; - var sy = first - second || 1; - return [Math.sqrt(sx), Math.sqrt(sy)]; - }; - Util.normalizeRect = function Util_normalizeRect(rect) { - var r = rect.slice(0); - if (rect[0] > rect[2]) { - r[0] = rect[2]; - r[2] = rect[0]; - } - if (rect[1] > rect[3]) { - r[1] = rect[3]; - r[3] = rect[1]; - } - return r; - }; - Util.intersect = function Util_intersect(rect1, rect2) { - function compare(a, b) { - return a - b; - } - var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare), - orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare), - result = []; - rect1 = Util.normalizeRect(rect1); - rect2 = Util.normalizeRect(rect2); - if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) { - result[0] = orderedX[1]; - result[2] = orderedX[2]; - } else { - return false; - } - if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) { - result[1] = orderedY[1]; - result[3] = orderedY[2]; - } else { - return false; - } - return result; - }; - return Util; -}(); -var ROMAN_NUMBER_MAP = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX']; -function toRomanNumerals(number) { - var lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - assert(Number.isInteger(number) && number > 0, 'The number should be a positive integer.'); - var pos = void 0, - romanBuf = []; - while (number >= 1000) { - number -= 1000; - romanBuf.push('M'); - } - pos = number / 100 | 0; - number %= 100; - romanBuf.push(ROMAN_NUMBER_MAP[pos]); - pos = number / 10 | 0; - number %= 10; - romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); - romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); - var romanStr = romanBuf.join(''); - return lowerCase ? romanStr.toLowerCase() : romanStr; -} -var PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC]; -function stringToPDFString(str) { - var i, - n = str.length, - strBuf = []; - if (str[0] === '\xFE' && str[1] === '\xFF') { - for (i = 2; i < n; i += 2) { - strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1))); - } - } else { - for (i = 0; i < n; ++i) { - var code = PDFStringTranslateTable[str.charCodeAt(i)]; - strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); - } - } - return strBuf.join(''); -} -function stringToUTF8String(str) { - return decodeURIComponent(escape(str)); -} -function utf8StringToString(str) { - return unescape(encodeURIComponent(str)); -} -function isEmptyObj(obj) { - for (var key in obj) { - return false; - } - return true; -} -function isBool(v) { - return typeof v === 'boolean'; -} -function isNum(v) { - return typeof v === 'number'; -} -function isString(v) { - return typeof v === 'string'; -} -function isArrayBuffer(v) { - return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v !== null && v.byteLength !== undefined; -} -function isSpace(ch) { - return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A; -} -function createPromiseCapability() { - var capability = {}; - capability.promise = new Promise(function (resolve, reject) { - capability.resolve = resolve; - capability.reject = reject; - }); - return capability; -} -var createObjectURL = function createObjectURLClosure() { - var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; - return function createObjectURL(data, contentType) { - var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - if (!forceDataSchema && _url_polyfill.URL.createObjectURL) { - var blob = new Blob([data], { type: contentType }); - return _url_polyfill.URL.createObjectURL(blob); - } - var buffer = 'data:' + contentType + ';base64,'; - for (var i = 0, ii = data.length; i < ii; i += 3) { - var b1 = data[i] & 0xFF; - var b2 = data[i + 1] & 0xFF; - var b3 = data[i + 2] & 0xFF; - var d1 = b1 >> 2, - d2 = (b1 & 3) << 4 | b2 >> 4; - var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64; - var d4 = i + 2 < ii ? b3 & 0x3F : 64; - buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; - } - return buffer; - }; -}(); -exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; -exports.IDENTITY_MATRIX = IDENTITY_MATRIX; -exports.OPS = OPS; -exports.VerbosityLevel = VerbosityLevel; -exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; -exports.AnnotationBorderStyleType = AnnotationBorderStyleType; -exports.AnnotationFieldFlag = AnnotationFieldFlag; -exports.AnnotationFlag = AnnotationFlag; -exports.AnnotationType = AnnotationType; -exports.FontType = FontType; -exports.ImageKind = ImageKind; -exports.CMapCompressionType = CMapCompressionType; -exports.AbortException = AbortException; -exports.InvalidPDFException = InvalidPDFException; -exports.MissingDataException = MissingDataException; -exports.MissingPDFException = MissingPDFException; -exports.NativeImageDecoding = NativeImageDecoding; -exports.PasswordException = PasswordException; -exports.PasswordResponses = PasswordResponses; -exports.PermissionFlag = PermissionFlag; -exports.StreamType = StreamType; -exports.TextRenderingMode = TextRenderingMode; -exports.UnexpectedResponseException = UnexpectedResponseException; -exports.UnknownErrorException = UnknownErrorException; -exports.Util = Util; -exports.toRomanNumerals = toRomanNumerals; -exports.XRefParseException = XRefParseException; -exports.FormatError = FormatError; -exports.arrayByteLength = arrayByteLength; -exports.arraysToBytes = arraysToBytes; -exports.assert = assert; -exports.bytesToString = bytesToString; -exports.createPromiseCapability = createPromiseCapability; -exports.createObjectURL = createObjectURL; -exports.deprecated = deprecated; -exports.getInheritableProperty = getInheritableProperty; -exports.getLookupTableFactory = getLookupTableFactory; -exports.getVerbosityLevel = getVerbosityLevel; -exports.info = info; -exports.isArrayBuffer = isArrayBuffer; -exports.isBool = isBool; -exports.isEmptyObj = isEmptyObj; -exports.isNum = isNum; -exports.isString = isString; -exports.isSpace = isSpace; -exports.isSameOrigin = isSameOrigin; -exports.createValidAbsoluteUrl = createValidAbsoluteUrl; -exports.isLittleEndian = isLittleEndian; -exports.isEvalSupported = isEvalSupported; -exports.log2 = log2; -exports.readInt8 = readInt8; -exports.readUint16 = readUint16; -exports.readUint32 = readUint32; -exports.removeNullCharacters = removeNullCharacters; -exports.ReadableStream = _streams_polyfill.ReadableStream; -exports.URL = _url_polyfill.URL; -exports.setVerbosityLevel = setVerbosityLevel; -exports.shadow = shadow; -exports.string32 = string32; -exports.stringToBytes = stringToBytes; -exports.stringToPDFString = stringToPDFString; -exports.stringToUTF8String = stringToUTF8String; -exports.utf8StringToString = utf8StringToString; -exports.warn = warn; -exports.unreachable = unreachable; -/***/ }), -/* 2 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +function loadScript(src) { + return new Promise(function (resolve, reject) { + var script = document.createElement("script"); + script.src = src; + script.onload = resolve; -var globalScope = __w_pdfjs_require__(3); -if (!globalScope._pdfjsCompatibilityChecked) { - globalScope._pdfjsCompatibilityChecked = true; - var isNodeJS = __w_pdfjs_require__(4); - var hasDOM = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' && (typeof document === 'undefined' ? 'undefined' : _typeof(document)) === 'object'; - (function checkNodeBtoa() { - if (globalScope.btoa || !isNodeJS()) { - return; - } - globalScope.btoa = function (chars) { - return Buffer.from(chars, 'binary').toString('base64'); - }; - })(); - (function checkNodeAtob() { - if (globalScope.atob || !isNodeJS()) { - return; - } - globalScope.atob = function (input) { - return Buffer.from(input, 'base64').toString('binary'); + script.onerror = function () { + reject(new Error("Cannot load script at: ".concat(script.src))); }; - })(); - (function checkCurrentScript() { - if (!hasDOM) { - return; - } - if ('currentScript' in document) { - return; - } - Object.defineProperty(document, 'currentScript', { - get: function get() { - var scripts = document.getElementsByTagName('script'); - return scripts[scripts.length - 1]; - }, - enumerable: true, - configurable: true - }); - })(); - (function checkChildNodeRemove() { - if (!hasDOM) { - return; - } - if (typeof Element.prototype.remove !== 'undefined') { - return; - } - Element.prototype.remove = function () { - if (this.parentNode) { - this.parentNode.removeChild(this); - } - }; - })(); - (function checkDOMTokenListToggle() { - if (!hasDOM || isNodeJS()) { - return; - } - var div = document.createElement('div'); - if (div.classList.toggle('test', 0) === false) { - return; - } - var originalDOMTokenListToggle = DOMTokenList.prototype.toggle; - DOMTokenList.prototype.toggle = function (token) { - if (arguments.length > 1) { - var force = !!arguments[1]; - return this[force ? 'add' : 'remove'](token), force; - } - return originalDOMTokenListToggle(token); - }; - })(); - (function checkStringIncludes() { - if (String.prototype.includes) { - return; - } - __w_pdfjs_require__(5); - })(); - (function checkArrayIncludes() { - if (Array.prototype.includes) { - return; - } - __w_pdfjs_require__(33); - })(); - (function checkObjectAssign() { - if (Object.assign) { - return; - } - __w_pdfjs_require__(42); - })(); - (function checkMathLog2() { - if (Math.log2) { - return; - } - Math.log2 = __w_pdfjs_require__(52); - })(); - (function checkNumberIsNaN() { - if (Number.isNaN) { - return; - } - Number.isNaN = __w_pdfjs_require__(54); - })(); - (function checkNumberIsInteger() { - if (Number.isInteger) { - return; - } - Number.isInteger = __w_pdfjs_require__(56); - })(); - (function checkPromise() { - if (globalScope.Promise) { - return; - } - globalScope.Promise = __w_pdfjs_require__(59); - })(); - (function checkWeakMap() { - if (globalScope.WeakMap) { - return; - } - globalScope.WeakMap = __w_pdfjs_require__(94); - })(); - (function checkStringCodePointAt() { - if (String.codePointAt) { - return; - } - String.codePointAt = __w_pdfjs_require__(111); - })(); - (function checkStringFromCodePoint() { - if (String.fromCodePoint) { - return; - } - String.fromCodePoint = __w_pdfjs_require__(113); - })(); - (function checkSymbol() { - if (globalScope.Symbol) { - return; - } - __w_pdfjs_require__(115); - })(); - (function checkObjectValues() { - if (Object.values) { - return; - } - Object.values = __w_pdfjs_require__(122); - })(); + (document.head || document.documentElement).appendChild(script); + }); } -/***/ }), -/* 3 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +function deprecated(details) { + console.log("Deprecated API usage: " + details); +} -"use strict"; +var pdfDateStringRegex; +var PDFDateString = /*#__PURE__*/function () { + function PDFDateString() { + _classCallCheck(this, PDFDateString); + } -module.exports = typeof window !== 'undefined' && window.Math === Math ? window : typeof global !== 'undefined' && global.Math === Math ? global : typeof self !== 'undefined' && self.Math === Math ? self : {}; + _createClass(PDFDateString, null, [{ + key: "toDateObject", + value: function toDateObject(input) { + if (!input || !(0, _util.isString)(input)) { + return null; + } -/***/ }), -/* 4 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + if (!pdfDateStringRegex) { + pdfDateStringRegex = new RegExp("^D:" + "(\\d{4})" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "([Z|+|-])?" + "(\\d{2})?" + "'?" + "(\\d{2})?" + "'?"); + } -"use strict"; + var matches = pdfDateStringRegex.exec(input); + if (!matches) { + return null; + } -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + var year = parseInt(matches[1], 10); + var month = parseInt(matches[2], 10); + month = month >= 1 && month <= 12 ? month - 1 : 0; + var day = parseInt(matches[3], 10); + day = day >= 1 && day <= 31 ? day : 1; + var hour = parseInt(matches[4], 10); + hour = hour >= 0 && hour <= 23 ? hour : 0; + var minute = parseInt(matches[5], 10); + minute = minute >= 0 && minute <= 59 ? minute : 0; + var second = parseInt(matches[6], 10); + second = second >= 0 && second <= 59 ? second : 0; + var universalTimeRelation = matches[7] || "Z"; + var offsetHour = parseInt(matches[8], 10); + offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0; + var offsetMinute = parseInt(matches[9], 10) || 0; + offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0; + + if (universalTimeRelation === "-") { + hour += offsetHour; + minute += offsetMinute; + } else if (universalTimeRelation === "+") { + hour -= offsetHour; + minute -= offsetMinute; + } + + return new Date(Date.UTC(year, month, day, hour, minute, second)); + } + }]); -module.exports = function isNodeJS() { - return (typeof process === 'undefined' ? 'undefined' : _typeof(process)) === 'object' && process + '' === '[object process]'; -}; + return PDFDateString; +}(); + +exports.PDFDateString = PDFDateString; /***/ }), -/* 5 */ +/* 2 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(6); -module.exports = __w_pdfjs_require__(9).String.includes; +module.exports = __w_pdfjs_require__(3); /***/ }), -/* 6 */ +/* 3 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; +/* WEBPACK VAR INJECTION */(function(module) { +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var $export = __w_pdfjs_require__(7); -var context = __w_pdfjs_require__(25); -var INCLUDES = 'includes'; -$export($export.P + $export.F * __w_pdfjs_require__(32)(INCLUDES), 'String', { - includes: function includes(searchString) { - return !!~context(this, searchString, INCLUDES).indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); - } -}); +var runtime = function (exports) { + "use strict"; -/***/ }), -/* 7 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; -"use strict"; + function wrap(innerFn, outerFn, self, tryLocsList) { + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + generator._invoke = makeInvokeMethod(innerFn, self, context); + return generator; + } + exports.wrap = wrap; -var global = __w_pdfjs_require__(8); -var core = __w_pdfjs_require__(9); -var hide = __w_pdfjs_require__(10); -var redefine = __w_pdfjs_require__(20); -var ctx = __w_pdfjs_require__(23); -var PROTOTYPE = 'prototype'; -var $export = function $export(type, name, source) { - var IS_FORCED = type & $export.F; - var IS_GLOBAL = type & $export.G; - var IS_STATIC = type & $export.S; - var IS_PROTO = type & $export.P; - var IS_BIND = type & $export.B; - var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; - var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); - var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); - var key, own, out, exp; - if (IS_GLOBAL) source = name; - for (key in source) { - own = !IS_FORCED && target && target[key] !== undefined; - out = (own ? target : source)[key]; - exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - if (target) redefine(target, key, out, type & $export.U); - if (exports[key] != out) hide(exports, key, exp); - if (IS_PROTO && expProto[key] != out) expProto[key] = out; + function tryCatch(fn, obj, arg) { + try { + return { + type: "normal", + arg: fn.call(obj, arg) + }; + } catch (err) { + return { + type: "throw", + arg: err + }; + } } -}; -global.core = core; -$export.F = 1; -$export.G = 2; -$export.S = 4; -$export.P = 8; -$export.B = 16; -$export.W = 32; -$export.U = 64; -$export.R = 128; -module.exports = $export; - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + var ContinueSentinel = {}; + function Generator() {} -var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); -if (typeof __g == 'number') __g = global; + function GeneratorFunction() {} -/***/ }), -/* 9 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + function GeneratorFunctionPrototype() {} -"use strict"; + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; -var core = module.exports = { version: '2.5.7' }; -if (typeof __e == 'number') __e = core; + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); -/***/ }), -/* 10 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + IteratorPrototype = NativeIteratorPrototype; + } -"use strict"; + var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function (method) { + prototype[method] = function (arg) { + return this._invoke(method, arg); + }; + }); + } -var dP = __w_pdfjs_require__(11); -var createDesc = __w_pdfjs_require__(19); -module.exports = __w_pdfjs_require__(15) ? function (object, key, value) { - return dP.f(object, key, createDesc(1, value)); -} : function (object, key, value) { - object[key] = value; - return object; -}; + exports.isGeneratorFunction = function (genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false; + }; -/***/ }), -/* 11 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + exports.mark = function (genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; -"use strict"; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; -var anObject = __w_pdfjs_require__(12); -var IE8_DOM_DEFINE = __w_pdfjs_require__(14); -var toPrimitive = __w_pdfjs_require__(18); -var dP = Object.defineProperty; -exports.f = __w_pdfjs_require__(15) ? Object.defineProperty : function defineProperty(O, P, Attributes) { - anObject(O); - P = toPrimitive(P, true); - anObject(Attributes); - if (IE8_DOM_DEFINE) try { - return dP(O, P, Attributes); - } catch (e) {} - if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); - if ('value' in Attributes) O[P] = Attributes.value; - return O; -}; + exports.awrap = function (arg) { + return { + __await: arg + }; + }; -/***/ }), -/* 12 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + function AsyncIterator(generator, PromiseImpl) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); -"use strict"; + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) { + return PromiseImpl.resolve(value.__await).then(function (value) { + invoke("next", value, resolve, reject); + }, function (err) { + invoke("throw", err, resolve, reject); + }); + } -var isObject = __w_pdfjs_require__(13); -module.exports = function (it) { - if (!isObject(it)) throw TypeError(it + ' is not an object!'); - return it; -}; + return PromiseImpl.resolve(value).then(function (unwrapped) { + result.value = unwrapped; + resolve(result); + }, function (error) { + return invoke("throw", error, resolve, reject); + }); + } + } -/***/ }), -/* 13 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + var previousPromise; -"use strict"; + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new PromiseImpl(function (resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + this._invoke = enqueue; + } -module.exports = function (it) { - return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) === 'object' ? it !== null : typeof it === 'function'; -}; + defineIteratorMethods(AsyncIterator.prototype); -/***/ }), -/* 14 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; -"use strict"; + exports.AsyncIterator = AsyncIterator; + exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { + if (PromiseImpl === void 0) PromiseImpl = Promise; + var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); + return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { + return result.done ? result.value : iter.next(); + }); + }; -module.exports = !__w_pdfjs_require__(15) && !__w_pdfjs_require__(16)(function () { - return Object.defineProperty(__w_pdfjs_require__(17)('div'), 'a', { - get: function get() { - return 7; - } - }).a != 7; -}); + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } -/***/ }), -/* 15 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } -"use strict"; + return doneResult(); + } + context.method = method; + context.arg = arg; -module.exports = !__w_pdfjs_require__(16)(function () { - return Object.defineProperty({}, 'a', { - get: function get() { - return 7; - } - }).a != 7; -}); + while (true) { + var delegate = context.delegate; -/***/ }), -/* 16 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); -"use strict"; + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + if (context.method === "next") { + context.sent = context._sent = context.arg; + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } -module.exports = function (exec) { - try { - return !!exec(); - } catch (e) { - return true; - } -}; + context.dispatchException(context.arg); + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } -/***/ }), -/* 17 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + state = GenStateExecuting; + var record = tryCatch(innerFn, self, context); -"use strict"; + if (record.type === "normal") { + state = context.done ? GenStateCompleted : GenStateSuspendedYield; + if (record.arg === ContinueSentinel) { + continue; + } -var isObject = __w_pdfjs_require__(13); -var document = __w_pdfjs_require__(8).document; -var is = isObject(document) && isObject(document.createElement); -module.exports = function (it) { - return is ? document.createElement(it) : {}; -}; + return { + value: record.arg, + done: context.done + }; + } else if (record.type === "throw") { + state = GenStateCompleted; + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } -/***/ }), -/* 18 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; -"use strict"; + if (method === undefined) { + context.delegate = null; + if (context.method === "throw") { + if (delegate.iterator["return"]) { + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); -var isObject = __w_pdfjs_require__(13); -module.exports = function (it, S) { - if (!isObject(it)) return it; - var fn, val; - if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; - if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; - if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; - throw TypeError("Can't convert object to primitive value"); -}; + if (context.method === "throw") { + return ContinueSentinel; + } + } -/***/ }), -/* 19 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + context.method = "throw"; + context.arg = new TypeError("The iterator does not provide a 'throw' method"); + } -"use strict"; - - -module.exports = function (bitmap, value) { - return { - enumerable: !(bitmap & 1), - configurable: !(bitmap & 2), - writable: !(bitmap & 4), - value: value - }; -}; - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var global = __w_pdfjs_require__(8); -var hide = __w_pdfjs_require__(10); -var has = __w_pdfjs_require__(21); -var SRC = __w_pdfjs_require__(22)('src'); -var TO_STRING = 'toString'; -var $toString = Function[TO_STRING]; -var TPL = ('' + $toString).split(TO_STRING); -__w_pdfjs_require__(9).inspectSource = function (it) { - return $toString.call(it); -}; -(module.exports = function (O, key, val, safe) { - var isFunction = typeof val == 'function'; - if (isFunction) has(val, 'name') || hide(val, 'name', key); - if (O[key] === val) return; - if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); - if (O === global) { - O[key] = val; - } else if (!safe) { - delete O[key]; - hide(O, key, val); - } else if (O[key]) { - O[key] = val; - } else { - hide(O, key, val); - } -})(Function.prototype, TO_STRING, function toString() { - return typeof this == 'function' && this[SRC] || $toString.call(this); -}); - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; + return ContinueSentinel; + } + var record = tryCatch(method, delegate.iterator, context.arg); -var hasOwnProperty = {}.hasOwnProperty; -module.exports = function (it, key) { - return hasOwnProperty.call(it, key); -}; + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } -/***/ }), -/* 22 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + var info = record.arg; -"use strict"; + if (!info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + if (info.done) { + context[delegate.resultName] = info.value; + context.next = delegate.nextLoc; -var id = 0; -var px = Math.random(); -module.exports = function (key) { - return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); -}; + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + } else { + return info; + } -/***/ }), -/* 23 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + context.delegate = null; + return ContinueSentinel; + } -"use strict"; + defineIteratorMethods(Gp); + Gp[toStringTagSymbol] = "Generator"; + Gp[iteratorSymbol] = function () { + return this; + }; -var aFunction = __w_pdfjs_require__(24); -module.exports = function (fn, that, length) { - aFunction(fn); - if (that === undefined) return fn; - switch (length) { - case 1: - return function (a) { - return fn.call(that, a); - }; - case 2: - return function (a, b) { - return fn.call(that, a, b); - }; - case 3: - return function (a, b, c) { - return fn.call(that, a, b, c); - }; - } - return function () { - return fn.apply(that, arguments); + Gp.toString = function () { + return "[object Generator]"; }; -}; -/***/ }), -/* 24 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + function pushTryEntry(locs) { + var entry = { + tryLoc: locs[0] + }; -"use strict"; + if (1 in locs) { + entry.catchLoc = locs[1]; + } + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } -module.exports = function (it) { - if (typeof it != 'function') throw TypeError(it + ' is not a function!'); - return it; -}; + this.tryEntries.push(entry); + } -/***/ }), -/* 25 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } -"use strict"; + function Context(tryLocsList) { + this.tryEntries = [{ + tryLoc: "root" + }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + exports.keys = function (object) { + var keys = []; -var isRegExp = __w_pdfjs_require__(26); -var defined = __w_pdfjs_require__(31); -module.exports = function (that, searchString, NAME) { - if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); - return String(defined(that)); -}; + for (var key in object) { + keys.push(key); + } -/***/ }), -/* 26 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + keys.reverse(); + return function next() { + while (keys.length) { + var key = keys.pop(); -"use strict"; + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + next.done = true; + return next; + }; + }; -var isObject = __w_pdfjs_require__(13); -var cof = __w_pdfjs_require__(27); -var MATCH = __w_pdfjs_require__(28)('match'); -module.exports = function (it) { - var isRegExp; - return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); -}; + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; -/***/ }), -/* 27 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } -"use strict"; + if (typeof iterable.next === "function") { + return iterable; + } + if (!isNaN(iterable.length)) { + var i = -1, + next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } -var toString = {}.toString; -module.exports = function (it) { - return toString.call(it).slice(8, -1); -}; + next.value = undefined; + next.done = true; + return next; + }; -/***/ }), -/* 28 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return next.next = next; + } + } -"use strict"; + return { + next: doneResult + }; + } + exports.values = values; -var store = __w_pdfjs_require__(29)('wks'); -var uid = __w_pdfjs_require__(22); -var _Symbol = __w_pdfjs_require__(8).Symbol; -var USE_SYMBOL = typeof _Symbol == 'function'; -var $exports = module.exports = function (name) { - return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name)); -}; -$exports.store = store; + function doneResult() { + return { + value: undefined, + done: true + }; + } -/***/ }), -/* 29 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + Context.prototype = { + constructor: Context, + reset: function reset(skipTempReset) { + this.prev = 0; + this.next = 0; + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + this.method = "next"; + this.arg = undefined; + this.tryEntries.forEach(resetTryEntry); -"use strict"; + if (!skipTempReset) { + for (var name in this) { + if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + stop: function stop() { + this.done = true; + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } -var core = __w_pdfjs_require__(9); -var global = __w_pdfjs_require__(8); -var SHARED = '__core-js_shared__'; -var store = global[SHARED] || (global[SHARED] = {}); -(module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); -})('versions', []).push({ - version: core.version, - mode: __w_pdfjs_require__(30) ? 'pure' : 'global', - copyright: '© 2018 Denis Pushkarev (zloirock.ru)' -}); + return this.rval; + }, + dispatchException: function dispatchException(exception) { + if (this.done) { + throw exception; + } -/***/ }), -/* 30 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + var context = this; -"use strict"; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + if (caught) { + context.method = "next"; + context.arg = undefined; + } -module.exports = false; + return !!caught; + } -/***/ }), -/* 31 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; -"use strict"; + if (entry.tryLoc === "root") { + return handle("end"); + } + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); -module.exports = function (it) { - if (it == undefined) throw TypeError("Can't call method on " + it); - return it; -}; - -/***/ }), -/* 32 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + abrupt: function abrupt(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } -var MATCH = __w_pdfjs_require__(28)('match'); -module.exports = function (KEY) { - var re = /./; - try { - '/./'[KEY](re); - } catch (e) { - try { - re[MATCH] = false; - return !'/./'[KEY](re); - } catch (f) {} - } - return true; -}; + if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { + finallyEntry = null; + } -/***/ }), -/* 33 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; -"use strict"; + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + return this.complete(record); + }, + complete: function complete(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } -__w_pdfjs_require__(34); -module.exports = __w_pdfjs_require__(9).Array.includes; + if (record.type === "break" || record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } -/***/ }), -/* 34 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return ContinueSentinel; + }, + finish: function finish(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; -"use strict"; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + "catch": function _catch(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; -var $export = __w_pdfjs_require__(7); -var $includes = __w_pdfjs_require__(35)(true); -$export($export.P, 'Array', { - includes: function includes(el) { - return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); - } -}); -__w_pdfjs_require__(41)('includes'); + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } -/***/ }), -/* 35 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return thrown; + } + } -"use strict"; + throw new Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + if (this.method === "next") { + this.arg = undefined; + } -var toIObject = __w_pdfjs_require__(36); -var toLength = __w_pdfjs_require__(38); -var toAbsoluteIndex = __w_pdfjs_require__(40); -module.exports = function (IS_INCLUDES) { - return function ($this, el, fromIndex) { - var O = toIObject($this); - var length = toLength(O.length); - var index = toAbsoluteIndex(fromIndex, length); - var value; - if (IS_INCLUDES && el != el) while (length > index) { - value = O[index++]; - if (value != value) return true; - } else for (; length > index; index++) { - if (IS_INCLUDES || index in O) { - if (O[index] === el) return IS_INCLUDES || index || 0; - } - }return !IS_INCLUDES && -1; + return ContinueSentinel; + } }; -}; - -/***/ }), -/* 36 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - + return exports; +}(( false ? undefined : _typeof(module)) === "object" ? module.exports : {}); -var IObject = __w_pdfjs_require__(37); -var defined = __w_pdfjs_require__(31); -module.exports = function (it) { - return IObject(defined(it)); -}; - -/***/ }), -/* 37 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var cof = __w_pdfjs_require__(27); -module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { - return cof(it) == 'String' ? it.split('') : Object(it); -}; - -/***/ }), -/* 38 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var toInteger = __w_pdfjs_require__(39); -var min = Math.min; -module.exports = function (it) { - return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; -}; +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + Function("r", "regeneratorRuntime = r")(runtime); +} +/* WEBPACK VAR INJECTION */}.call(this, __w_pdfjs_require__(4)(module))) /***/ }), -/* 39 */ +/* 4 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var ceil = Math.ceil; -var floor = Math.floor; -module.exports = function (it) { - return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); -}; - -/***/ }), -/* 40 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +module.exports = function (module) { + if (!module.webpackPolyfill) { + module.deprecate = function () {}; + module.paths = []; + if (!module.children) module.children = []; + Object.defineProperty(module, "loaded", { + enumerable: true, + get: function get() { + return module.l; + } + }); + Object.defineProperty(module, "id", { + enumerable: true, + get: function get() { + return module.i; + } + }); + module.webpackPolyfill = 1; + } -var toInteger = __w_pdfjs_require__(39); -var max = Math.max; -var min = Math.min; -module.exports = function (index, length) { - index = toInteger(index); - return index < 0 ? max(index + length, 0) : min(index, length); + return module; }; /***/ }), -/* 41 */ +/* 5 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var UNSCOPABLES = __w_pdfjs_require__(28)('unscopables'); -var ArrayProto = Array.prototype; -if (ArrayProto[UNSCOPABLES] == undefined) __w_pdfjs_require__(10)(ArrayProto, UNSCOPABLES, {}); -module.exports = function (key) { - ArrayProto[UNSCOPABLES][key] = true; -}; - -/***/ }), -/* 42 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.arrayByteLength = arrayByteLength; +exports.arraysToBytes = arraysToBytes; +exports.assert = assert; +exports.bytesToString = bytesToString; +exports.createPromiseCapability = createPromiseCapability; +exports.getVerbosityLevel = getVerbosityLevel; +exports.info = info; +exports.isArrayBuffer = isArrayBuffer; +exports.isArrayEqual = isArrayEqual; +exports.isBool = isBool; +exports.isEmptyObj = isEmptyObj; +exports.isNum = isNum; +exports.isString = isString; +exports.isSameOrigin = isSameOrigin; +exports.createValidAbsoluteUrl = createValidAbsoluteUrl; +exports.removeNullCharacters = removeNullCharacters; +exports.setVerbosityLevel = setVerbosityLevel; +exports.shadow = shadow; +exports.string32 = string32; +exports.stringToBytes = stringToBytes; +exports.stringToPDFString = stringToPDFString; +exports.stringToUTF8String = stringToUTF8String; +exports.utf8StringToString = utf8StringToString; +exports.warn = warn; +exports.unreachable = unreachable; +exports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0; -__w_pdfjs_require__(43); -module.exports = __w_pdfjs_require__(9).Object.assign; +__w_pdfjs_require__(6); -/***/ }), -/* 43 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -"use strict"; +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var $export = __w_pdfjs_require__(7); -$export($export.S + $export.F, 'Object', { assign: __w_pdfjs_require__(44) }); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -/***/ }), -/* 44 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } -"use strict"; +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -var getKeys = __w_pdfjs_require__(45); -var gOPS = __w_pdfjs_require__(49); -var pIE = __w_pdfjs_require__(50); -var toObject = __w_pdfjs_require__(51); -var IObject = __w_pdfjs_require__(37); -var $assign = Object.assign; -module.exports = !$assign || __w_pdfjs_require__(16)(function () { - var A = {}; - var B = {}; - var S = Symbol(); - var K = 'abcdefghijklmnopqrst'; - A[S] = 7; - K.split('').forEach(function (k) { - B[k] = k; - }); - return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; -}) ? function assign(target, source) { - var T = toObject(target); - var aLen = arguments.length; - var index = 1; - var getSymbols = gOPS.f; - var isEnum = pIE.f; - while (aLen > index) { - var S = IObject(arguments[index++]); - var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); - var length = keys.length; - var j = 0; - var key; - while (length > j) { - if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; - } - } - return T; -} : $assign; +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } -/***/ }), -/* 45 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -"use strict"; +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -var $keys = __w_pdfjs_require__(46); -var enumBugKeys = __w_pdfjs_require__(48); -module.exports = Object.keys || function keys(O) { - return $keys(O, enumBugKeys); +var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; +exports.IDENTITY_MATRIX = IDENTITY_MATRIX; +var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; +exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; +var PermissionFlag = { + PRINT: 0x04, + MODIFY_CONTENTS: 0x08, + COPY: 0x10, + MODIFY_ANNOTATIONS: 0x20, + FILL_INTERACTIVE_FORMS: 0x100, + COPY_FOR_ACCESSIBILITY: 0x200, + ASSEMBLE: 0x400, + PRINT_HIGH_QUALITY: 0x800 }; - -/***/ }), -/* 46 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var has = __w_pdfjs_require__(21); -var toIObject = __w_pdfjs_require__(36); -var arrayIndexOf = __w_pdfjs_require__(35)(false); -var IE_PROTO = __w_pdfjs_require__(47)('IE_PROTO'); -module.exports = function (object, names) { - var O = toIObject(object); - var i = 0; - var result = []; - var key; - for (key in O) { - if (key != IE_PROTO) has(O, key) && result.push(key); - }while (names.length > i) { - if (has(O, key = names[i++])) { - ~arrayIndexOf(result, key) || result.push(key); - } - }return result; -}; - -/***/ }), -/* 47 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var shared = __w_pdfjs_require__(29)('keys'); -var uid = __w_pdfjs_require__(22); -module.exports = function (key) { - return shared[key] || (shared[key] = uid(key)); +exports.PermissionFlag = PermissionFlag; +var TextRenderingMode = { + FILL: 0, + STROKE: 1, + FILL_STROKE: 2, + INVISIBLE: 3, + FILL_ADD_TO_PATH: 4, + STROKE_ADD_TO_PATH: 5, + FILL_STROKE_ADD_TO_PATH: 6, + ADD_TO_PATH: 7, + FILL_STROKE_MASK: 3, + ADD_TO_PATH_FLAG: 4 }; - -/***/ }), -/* 48 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(','); - -/***/ }), -/* 49 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -exports.f = Object.getOwnPropertySymbols; - -/***/ }), -/* 50 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -exports.f = {}.propertyIsEnumerable; - -/***/ }), -/* 51 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var defined = __w_pdfjs_require__(31); -module.exports = function (it) { - return Object(defined(it)); +exports.TextRenderingMode = TextRenderingMode; +var ImageKind = { + GRAYSCALE_1BPP: 1, + RGB_24BPP: 2, + RGBA_32BPP: 3 }; - -/***/ }), -/* 52 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -__w_pdfjs_require__(53); -module.exports = __w_pdfjs_require__(9).Math.log2; - -/***/ }), -/* 53 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var $export = __w_pdfjs_require__(7); -$export($export.S, 'Math', { - log2: function log2(x) { - return Math.log(x) / Math.LN2; - } -}); - -/***/ }), -/* 54 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -__w_pdfjs_require__(55); -module.exports = __w_pdfjs_require__(9).Number.isNaN; - -/***/ }), -/* 55 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var $export = __w_pdfjs_require__(7); -$export($export.S, 'Number', { - isNaN: function isNaN(number) { - return number != number; - } -}); - -/***/ }), -/* 56 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -__w_pdfjs_require__(57); -module.exports = __w_pdfjs_require__(9).Number.isInteger; - -/***/ }), -/* 57 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var $export = __w_pdfjs_require__(7); -$export($export.S, 'Number', { isInteger: __w_pdfjs_require__(58) }); - -/***/ }), -/* 58 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var isObject = __w_pdfjs_require__(13); -var floor = Math.floor; -module.exports = function isInteger(it) { - return !isObject(it) && isFinite(it) && floor(it) === it; +exports.ImageKind = ImageKind; +var AnnotationType = { + TEXT: 1, + LINK: 2, + FREETEXT: 3, + LINE: 4, + SQUARE: 5, + CIRCLE: 6, + POLYGON: 7, + POLYLINE: 8, + HIGHLIGHT: 9, + UNDERLINE: 10, + SQUIGGLY: 11, + STRIKEOUT: 12, + STAMP: 13, + CARET: 14, + INK: 15, + POPUP: 16, + FILEATTACHMENT: 17, + SOUND: 18, + MOVIE: 19, + WIDGET: 20, + SCREEN: 21, + PRINTERMARK: 22, + TRAPNET: 23, + WATERMARK: 24, + THREED: 25, + REDACT: 26 }; - -/***/ }), -/* 59 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -__w_pdfjs_require__(60); -__w_pdfjs_require__(62); -__w_pdfjs_require__(72); -__w_pdfjs_require__(75); -__w_pdfjs_require__(92); -__w_pdfjs_require__(93); -module.exports = __w_pdfjs_require__(9).Promise; - -/***/ }), -/* 60 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var classof = __w_pdfjs_require__(61); -var test = {}; -test[__w_pdfjs_require__(28)('toStringTag')] = 'z'; -if (test + '' != '[object z]') { - __w_pdfjs_require__(20)(Object.prototype, 'toString', function toString() { - return '[object ' + classof(this) + ']'; - }, true); -} - -/***/ }), -/* 61 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var cof = __w_pdfjs_require__(27); -var TAG = __w_pdfjs_require__(28)('toStringTag'); -var ARG = cof(function () { - return arguments; -}()) == 'Arguments'; -var tryGet = function tryGet(it, key) { - try { - return it[key]; - } catch (e) {} +exports.AnnotationType = AnnotationType; +var AnnotationStateModelType = { + MARKED: "Marked", + REVIEW: "Review" }; -module.exports = function (it) { - var O, T, B; - return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T : ARG ? cof(O) : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +exports.AnnotationStateModelType = AnnotationStateModelType; +var AnnotationMarkedState = { + MARKED: "Marked", + UNMARKED: "Unmarked" }; - -/***/ }), -/* 62 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var $at = __w_pdfjs_require__(63)(true); -__w_pdfjs_require__(64)(String, 'String', function (iterated) { - this._t = String(iterated); - this._i = 0; -}, function () { - var O = this._t; - var index = this._i; - var point; - if (index >= O.length) return { - value: undefined, - done: true - }; - point = $at(O, index); - this._i += point.length; - return { - value: point, - done: false - }; -}); - -/***/ }), -/* 63 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var toInteger = __w_pdfjs_require__(39); -var defined = __w_pdfjs_require__(31); -module.exports = function (TO_STRING) { - return function (that, pos) { - var s = String(defined(that)); - var i = toInteger(pos); - var l = s.length; - var a, b; - if (i < 0 || i >= l) return TO_STRING ? '' : undefined; - a = s.charCodeAt(i); - return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; - }; +exports.AnnotationMarkedState = AnnotationMarkedState; +var AnnotationReviewState = { + ACCEPTED: "Accepted", + REJECTED: "Rejected", + CANCELLED: "Cancelled", + COMPLETED: "Completed", + NONE: "None" }; - -/***/ }), -/* 64 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var LIBRARY = __w_pdfjs_require__(30); -var $export = __w_pdfjs_require__(7); -var redefine = __w_pdfjs_require__(20); -var hide = __w_pdfjs_require__(10); -var Iterators = __w_pdfjs_require__(65); -var $iterCreate = __w_pdfjs_require__(66); -var setToStringTag = __w_pdfjs_require__(70); -var getPrototypeOf = __w_pdfjs_require__(71); -var ITERATOR = __w_pdfjs_require__(28)('iterator'); -var BUGGY = !([].keys && 'next' in [].keys()); -var FF_ITERATOR = '@@iterator'; -var KEYS = 'keys'; -var VALUES = 'values'; -var returnThis = function returnThis() { - return this; +exports.AnnotationReviewState = AnnotationReviewState; +var AnnotationReplyType = { + GROUP: "Group", + REPLY: "R" }; -module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { - $iterCreate(Constructor, NAME, next); - var getMethod = function getMethod(kind) { - if (!BUGGY && kind in proto) return proto[kind]; - switch (kind) { - case KEYS: - return function keys() { - return new Constructor(this, kind); - }; - case VALUES: - return function values() { - return new Constructor(this, kind); - }; - } - return function entries() { - return new Constructor(this, kind); - }; - }; - var TAG = NAME + ' Iterator'; - var DEF_VALUES = DEFAULT == VALUES; - var VALUES_BUG = false; - var proto = Base.prototype; - var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; - var $default = $native || getMethod(DEFAULT); - var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; - var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; - var methods, key, IteratorPrototype; - if ($anyNative) { - IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); - if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { - setToStringTag(IteratorPrototype, TAG, true); - if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); - } - } - if (DEF_VALUES && $native && $native.name !== VALUES) { - VALUES_BUG = true; - $default = function values() { - return $native.call(this); - }; - } - if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { - hide(proto, ITERATOR, $default); - } - Iterators[NAME] = $default; - Iterators[TAG] = returnThis; - if (DEFAULT) { - methods = { - values: DEF_VALUES ? $default : getMethod(VALUES), - keys: IS_SET ? $default : getMethod(KEYS), - entries: $entries - }; - if (FORCED) for (key in methods) { - if (!(key in proto)) redefine(proto, key, methods[key]); - } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); - } - return methods; +exports.AnnotationReplyType = AnnotationReplyType; +var AnnotationFlag = { + INVISIBLE: 0x01, + HIDDEN: 0x02, + PRINT: 0x04, + NOZOOM: 0x08, + NOROTATE: 0x10, + NOVIEW: 0x20, + READONLY: 0x40, + LOCKED: 0x80, + TOGGLENOVIEW: 0x100, + LOCKEDCONTENTS: 0x200 }; +exports.AnnotationFlag = AnnotationFlag; +var AnnotationFieldFlag = { + READONLY: 0x0000001, + REQUIRED: 0x0000002, + NOEXPORT: 0x0000004, + MULTILINE: 0x0001000, + PASSWORD: 0x0002000, + NOTOGGLETOOFF: 0x0004000, + RADIO: 0x0008000, + PUSHBUTTON: 0x0010000, + COMBO: 0x0020000, + EDIT: 0x0040000, + SORT: 0x0080000, + FILESELECT: 0x0100000, + MULTISELECT: 0x0200000, + DONOTSPELLCHECK: 0x0400000, + DONOTSCROLL: 0x0800000, + COMB: 0x1000000, + RICHTEXT: 0x2000000, + RADIOSINUNISON: 0x2000000, + COMMITONSELCHANGE: 0x4000000 +}; +exports.AnnotationFieldFlag = AnnotationFieldFlag; +var AnnotationBorderStyleType = { + SOLID: 1, + DASHED: 2, + BEVELED: 3, + INSET: 4, + UNDERLINE: 5 +}; +exports.AnnotationBorderStyleType = AnnotationBorderStyleType; +var StreamType = { + UNKNOWN: "UNKNOWN", + FLATE: "FLATE", + LZW: "LZW", + DCT: "DCT", + JPX: "JPX", + JBIG: "JBIG", + A85: "A85", + AHX: "AHX", + CCF: "CCF", + RLX: "RLX" +}; +exports.StreamType = StreamType; +var FontType = { + UNKNOWN: "UNKNOWN", + TYPE1: "TYPE1", + TYPE1C: "TYPE1C", + CIDFONTTYPE0: "CIDFONTTYPE0", + CIDFONTTYPE0C: "CIDFONTTYPE0C", + TRUETYPE: "TRUETYPE", + CIDFONTTYPE2: "CIDFONTTYPE2", + TYPE3: "TYPE3", + OPENTYPE: "OPENTYPE", + TYPE0: "TYPE0", + MMTYPE1: "MMTYPE1" +}; +exports.FontType = FontType; +var VerbosityLevel = { + ERRORS: 0, + WARNINGS: 1, + INFOS: 5 +}; +exports.VerbosityLevel = VerbosityLevel; +var CMapCompressionType = { + NONE: 0, + BINARY: 1, + STREAM: 2 +}; +exports.CMapCompressionType = CMapCompressionType; +var OPS = { + dependency: 1, + setLineWidth: 2, + setLineCap: 3, + setLineJoin: 4, + setMiterLimit: 5, + setDash: 6, + setRenderingIntent: 7, + setFlatness: 8, + setGState: 9, + save: 10, + restore: 11, + transform: 12, + moveTo: 13, + lineTo: 14, + curveTo: 15, + curveTo2: 16, + curveTo3: 17, + closePath: 18, + rectangle: 19, + stroke: 20, + closeStroke: 21, + fill: 22, + eoFill: 23, + fillStroke: 24, + eoFillStroke: 25, + closeFillStroke: 26, + closeEOFillStroke: 27, + endPath: 28, + clip: 29, + eoClip: 30, + beginText: 31, + endText: 32, + setCharSpacing: 33, + setWordSpacing: 34, + setHScale: 35, + setLeading: 36, + setFont: 37, + setTextRenderingMode: 38, + setTextRise: 39, + moveText: 40, + setLeadingMoveText: 41, + setTextMatrix: 42, + nextLine: 43, + showText: 44, + showSpacedText: 45, + nextLineShowText: 46, + nextLineSetSpacingShowText: 47, + setCharWidth: 48, + setCharWidthAndBounds: 49, + setStrokeColorSpace: 50, + setFillColorSpace: 51, + setStrokeColor: 52, + setStrokeColorN: 53, + setFillColor: 54, + setFillColorN: 55, + setStrokeGray: 56, + setFillGray: 57, + setStrokeRGBColor: 58, + setFillRGBColor: 59, + setStrokeCMYKColor: 60, + setFillCMYKColor: 61, + shadingFill: 62, + beginInlineImage: 63, + beginImageData: 64, + endInlineImage: 65, + paintXObject: 66, + markPoint: 67, + markPointProps: 68, + beginMarkedContent: 69, + beginMarkedContentProps: 70, + endMarkedContent: 71, + beginCompat: 72, + endCompat: 73, + paintFormXObjectBegin: 74, + paintFormXObjectEnd: 75, + beginGroup: 76, + endGroup: 77, + beginAnnotations: 78, + endAnnotations: 79, + beginAnnotation: 80, + endAnnotation: 81, + paintJpegXObject: 82, + paintImageMaskXObject: 83, + paintImageMaskXObjectGroup: 84, + paintImageXObject: 85, + paintInlineImageXObject: 86, + paintInlineImageXObjectGroup: 87, + paintImageXObjectRepeat: 88, + paintImageMaskXObjectRepeat: 89, + paintSolidColorImageMask: 90, + constructPath: 91 +}; +exports.OPS = OPS; +var UNSUPPORTED_FEATURES = { + unknown: "unknown", + forms: "forms", + javaScript: "javaScript", + smask: "smask", + shadingPattern: "shadingPattern", + font: "font", + errorTilingPattern: "errorTilingPattern", + errorExtGState: "errorExtGState", + errorXObject: "errorXObject", + errorFontLoadType3: "errorFontLoadType3", + errorFontState: "errorFontState", + errorFontMissing: "errorFontMissing", + errorFontTranslate: "errorFontTranslate", + errorColorSpace: "errorColorSpace", + errorOperatorList: "errorOperatorList", + errorFontToUnicode: "errorFontToUnicode", + errorFontLoadNative: "errorFontLoadNative", + errorFontGetPath: "errorFontGetPath" +}; +exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; +var PasswordResponses = { + NEED_PASSWORD: 1, + INCORRECT_PASSWORD: 2 +}; +exports.PasswordResponses = PasswordResponses; +var verbosity = VerbosityLevel.WARNINGS; -/***/ }), -/* 65 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -module.exports = {}; - -/***/ }), -/* 66 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - +function setVerbosityLevel(level) { + if (Number.isInteger(level)) { + verbosity = level; + } +} -var create = __w_pdfjs_require__(67); -var descriptor = __w_pdfjs_require__(19); -var setToStringTag = __w_pdfjs_require__(70); -var IteratorPrototype = {}; -__w_pdfjs_require__(10)(IteratorPrototype, __w_pdfjs_require__(28)('iterator'), function () { - return this; -}); -module.exports = function (Constructor, NAME, next) { - Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); - setToStringTag(Constructor, NAME + ' Iterator'); -}; +function getVerbosityLevel() { + return verbosity; +} -/***/ }), -/* 67 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +function info(msg) { + if (verbosity >= VerbosityLevel.INFOS) { + console.log("Info: ".concat(msg)); + } +} -"use strict"; +function warn(msg) { + if (verbosity >= VerbosityLevel.WARNINGS) { + console.log("Warning: ".concat(msg)); + } +} +function unreachable(msg) { + throw new Error(msg); +} -var anObject = __w_pdfjs_require__(12); -var dPs = __w_pdfjs_require__(68); -var enumBugKeys = __w_pdfjs_require__(48); -var IE_PROTO = __w_pdfjs_require__(47)('IE_PROTO'); -var Empty = function Empty() {}; -var PROTOTYPE = 'prototype'; -var _createDict = function createDict() { - var iframe = __w_pdfjs_require__(17)('iframe'); - var i = enumBugKeys.length; - var lt = '<'; - var gt = '>'; - var iframeDocument; - iframe.style.display = 'none'; - __w_pdfjs_require__(69).appendChild(iframe); - iframe.src = 'javascript:'; - iframeDocument = iframe.contentWindow.document; - iframeDocument.open(); - iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); - iframeDocument.close(); - _createDict = iframeDocument.F; - while (i--) { - delete _createDict[PROTOTYPE][enumBugKeys[i]]; - }return _createDict(); -}; -module.exports = Object.create || function create(O, Properties) { - var result; - if (O !== null) { - Empty[PROTOTYPE] = anObject(O); - result = new Empty(); - Empty[PROTOTYPE] = null; - result[IE_PROTO] = O; - } else result = _createDict(); - return Properties === undefined ? result : dPs(result, Properties); -}; +function assert(cond, msg) { + if (!cond) { + unreachable(msg); + } +} -/***/ }), -/* 68 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +function isSameOrigin(baseUrl, otherUrl) { + var base; -"use strict"; + try { + base = new URL(baseUrl); + if (!base.origin || base.origin === "null") { + return false; + } + } catch (e) { + return false; + } -var dP = __w_pdfjs_require__(11); -var anObject = __w_pdfjs_require__(12); -var getKeys = __w_pdfjs_require__(45); -module.exports = __w_pdfjs_require__(15) ? Object.defineProperties : function defineProperties(O, Properties) { - anObject(O); - var keys = getKeys(Properties); - var length = keys.length; - var i = 0; - var P; - while (length > i) { - dP.f(O, P = keys[i++], Properties[P]); - }return O; -}; + var other = new URL(otherUrl, base); + return base.origin === other.origin; +} -/***/ }), -/* 69 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +function _isValidProtocol(url) { + if (!url) { + return false; + } -"use strict"; + switch (url.protocol) { + case "http:": + case "https:": + case "ftp:": + case "mailto:": + case "tel:": + return true; + default: + return false; + } +} -var document = __w_pdfjs_require__(8).document; -module.exports = document && document.documentElement; +function createValidAbsoluteUrl(url, baseUrl) { + if (!url) { + return null; + } -/***/ }), -/* 70 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + try { + var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); -"use strict"; + if (_isValidProtocol(absoluteUrl)) { + return absoluteUrl; + } + } catch (ex) {} + return null; +} -var def = __w_pdfjs_require__(11).f; -var has = __w_pdfjs_require__(21); -var TAG = __w_pdfjs_require__(28)('toStringTag'); -module.exports = function (it, tag, stat) { - if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { +function shadow(obj, prop, value) { + Object.defineProperty(obj, prop, { + value: value, + enumerable: true, configurable: true, - value: tag + writable: false }); -}; + return value; +} -/***/ }), -/* 71 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +var BaseException = function BaseExceptionClosure() { + function BaseException(message) { + if (this.constructor === BaseException) { + unreachable("Cannot initialize BaseException."); + } -"use strict"; + this.message = message; + this.name = this.constructor.name; + } + BaseException.prototype = new Error(); + BaseException.constructor = BaseException; + return BaseException; +}(); -var has = __w_pdfjs_require__(21); -var toObject = __w_pdfjs_require__(51); -var IE_PROTO = __w_pdfjs_require__(47)('IE_PROTO'); -var ObjectProto = Object.prototype; -module.exports = Object.getPrototypeOf || function (O) { - O = toObject(O); - if (has(O, IE_PROTO)) return O[IE_PROTO]; - if (typeof O.constructor == 'function' && O instanceof O.constructor) { - return O.constructor.prototype; - } - return O instanceof Object ? ObjectProto : null; -}; +exports.BaseException = BaseException; -/***/ }), -/* 72 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +var PasswordException = /*#__PURE__*/function (_BaseException) { + _inherits(PasswordException, _BaseException); -"use strict"; + var _super = _createSuper(PasswordException); + + function PasswordException(msg, code) { + var _this; + _classCallCheck(this, PasswordException); -var $iterators = __w_pdfjs_require__(73); -var getKeys = __w_pdfjs_require__(45); -var redefine = __w_pdfjs_require__(20); -var global = __w_pdfjs_require__(8); -var hide = __w_pdfjs_require__(10); -var Iterators = __w_pdfjs_require__(65); -var wks = __w_pdfjs_require__(28); -var ITERATOR = wks('iterator'); -var TO_STRING_TAG = wks('toStringTag'); -var ArrayValues = Iterators.Array; -var DOMIterables = { - CSSRuleList: true, - CSSStyleDeclaration: false, - CSSValueList: false, - ClientRectList: false, - DOMRectList: false, - DOMStringList: false, - DOMTokenList: true, - DataTransferItemList: false, - FileList: false, - HTMLAllCollection: false, - HTMLCollection: false, - HTMLFormElement: false, - HTMLSelectElement: false, - MediaList: true, - MimeTypeArray: false, - NamedNodeMap: false, - NodeList: true, - PaintRequestList: false, - Plugin: false, - PluginArray: false, - SVGLengthList: false, - SVGNumberList: false, - SVGPathSegList: false, - SVGPointList: false, - SVGStringList: false, - SVGTransformList: false, - SourceBufferList: false, - StyleSheetList: true, - TextTrackCueList: false, - TextTrackList: false, - TouchList: false -}; -for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) { - var NAME = collections[i]; - var explicit = DOMIterables[NAME]; - var Collection = global[NAME]; - var proto = Collection && Collection.prototype; - var key; - if (proto) { - if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues); - if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); - Iterators[NAME] = ArrayValues; - if (explicit) for (key in $iterators) { - if (!proto[key]) redefine(proto, key, $iterators[key], true); - } + _this = _super.call(this, msg); + _this.code = code; + return _this; } -} -/***/ }), -/* 73 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return PasswordException; +}(BaseException); -"use strict"; +exports.PasswordException = PasswordException; +var UnknownErrorException = /*#__PURE__*/function (_BaseException2) { + _inherits(UnknownErrorException, _BaseException2); -var addToUnscopables = __w_pdfjs_require__(41); -var step = __w_pdfjs_require__(74); -var Iterators = __w_pdfjs_require__(65); -var toIObject = __w_pdfjs_require__(36); -module.exports = __w_pdfjs_require__(64)(Array, 'Array', function (iterated, kind) { - this._t = toIObject(iterated); - this._i = 0; - this._k = kind; -}, function () { - var O = this._t; - var kind = this._k; - var index = this._i++; - if (!O || index >= O.length) { - this._t = undefined; - return step(1); - } - if (kind == 'keys') return step(0, index); - if (kind == 'values') return step(0, O[index]); - return step(0, [index, O[index]]); -}, 'values'); -Iterators.Arguments = Iterators.Array; -addToUnscopables('keys'); -addToUnscopables('values'); -addToUnscopables('entries'); + var _super2 = _createSuper(UnknownErrorException); -/***/ }), -/* 74 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + function UnknownErrorException(msg, details) { + var _this2; -"use strict"; + _classCallCheck(this, UnknownErrorException); + _this2 = _super2.call(this, msg); + _this2.details = details; + return _this2; + } -module.exports = function (done, value) { - return { - value: value, - done: !!done - }; -}; + return UnknownErrorException; +}(BaseException); -/***/ }), -/* 75 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +exports.UnknownErrorException = UnknownErrorException; -"use strict"; +var InvalidPDFException = /*#__PURE__*/function (_BaseException3) { + _inherits(InvalidPDFException, _BaseException3); + var _super3 = _createSuper(InvalidPDFException); -var LIBRARY = __w_pdfjs_require__(30); -var global = __w_pdfjs_require__(8); -var ctx = __w_pdfjs_require__(23); -var classof = __w_pdfjs_require__(61); -var $export = __w_pdfjs_require__(7); -var isObject = __w_pdfjs_require__(13); -var aFunction = __w_pdfjs_require__(24); -var anInstance = __w_pdfjs_require__(76); -var forOf = __w_pdfjs_require__(77); -var speciesConstructor = __w_pdfjs_require__(81); -var task = __w_pdfjs_require__(82).set; -var microtask = __w_pdfjs_require__(84)(); -var newPromiseCapabilityModule = __w_pdfjs_require__(85); -var perform = __w_pdfjs_require__(86); -var userAgent = __w_pdfjs_require__(87); -var promiseResolve = __w_pdfjs_require__(88); -var PROMISE = 'Promise'; -var TypeError = global.TypeError; -var process = global.process; -var versions = process && process.versions; -var v8 = versions && versions.v8 || ''; -var $Promise = global[PROMISE]; -var isNode = classof(process) == 'process'; -var empty = function empty() {}; -var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; -var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f; -var USE_NATIVE = !!function () { - try { - var promise = $Promise.resolve(1); - var FakePromise = (promise.constructor = {})[__w_pdfjs_require__(28)('species')] = function (exec) { - exec(empty, empty); - }; - return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise && v8.indexOf('6.6') !== 0 && userAgent.indexOf('Chrome/66') === -1; - } catch (e) {} -}(); -var isThenable = function isThenable(it) { - var then; - return isObject(it) && typeof (then = it.then) == 'function' ? then : false; -}; -var notify = function notify(promise, isReject) { - if (promise._n) return; - promise._n = true; - var chain = promise._c; - microtask(function () { - var value = promise._v; - var ok = promise._s == 1; - var i = 0; - var run = function run(reaction) { - var handler = ok ? reaction.ok : reaction.fail; - var resolve = reaction.resolve; - var reject = reaction.reject; - var domain = reaction.domain; - var result, then, exited; - try { - if (handler) { - if (!ok) { - if (promise._h == 2) onHandleUnhandled(promise); - promise._h = 1; - } - if (handler === true) result = value;else { - if (domain) domain.enter(); - result = handler(value); - if (domain) { - domain.exit(); - exited = true; - } - } - if (result === reaction.promise) { - reject(TypeError('Promise-chain cycle')); - } else if (then = isThenable(result)) { - then.call(result, resolve, reject); - } else resolve(result); - } else reject(value); - } catch (e) { - if (domain && !exited) domain.exit(); - reject(e); - } - }; - while (chain.length > i) { - run(chain[i++]); - }promise._c = []; - promise._n = false; - if (isReject && !promise._h) onUnhandled(promise); - }); -}; -var onUnhandled = function onUnhandled(promise) { - task.call(global, function () { - var value = promise._v; - var unhandled = isUnhandled(promise); - var result, handler, console; - if (unhandled) { - result = perform(function () { - if (isNode) { - process.emit('unhandledRejection', value, promise); - } else if (handler = global.onunhandledrejection) { - handler({ - promise: promise, - reason: value - }); - } else if ((console = global.console) && console.error) { - console.error('Unhandled promise rejection', value); - } - }); - promise._h = isNode || isUnhandled(promise) ? 2 : 1; - } - promise._a = undefined; - if (unhandled && result.e) throw result.v; - }); -}; -var isUnhandled = function isUnhandled(promise) { - return promise._h !== 1 && (promise._a || promise._c).length === 0; -}; -var onHandleUnhandled = function onHandleUnhandled(promise) { - task.call(global, function () { - var handler; - if (isNode) { - process.emit('rejectionHandled', promise); - } else if (handler = global.onrejectionhandled) { - handler({ - promise: promise, - reason: promise._v - }); - } - }); -}; -var $reject = function $reject(value) { - var promise = this; - if (promise._d) return; - promise._d = true; - promise = promise._w || promise; - promise._v = value; - promise._s = 2; - if (!promise._a) promise._a = promise._c.slice(); - notify(promise, true); -}; -var $resolve = function $resolve(value) { - var promise = this; - var then; - if (promise._d) return; - promise._d = true; - promise = promise._w || promise; - try { - if (promise === value) throw TypeError("Promise can't be resolved itself"); - if (then = isThenable(value)) { - microtask(function () { - var wrapper = { - _w: promise, - _d: false - }; - try { - then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); - } catch (e) { - $reject.call(wrapper, e); - } - }); - } else { - promise._v = value; - promise._s = 1; - notify(promise, false); - } - } catch (e) { - $reject.call({ - _w: promise, - _d: false - }, e); - } -}; -if (!USE_NATIVE) { - $Promise = function Promise(executor) { - anInstance(this, $Promise, PROMISE, '_h'); - aFunction(executor); - Internal.call(this); - try { - executor(ctx($resolve, this, 1), ctx($reject, this, 1)); - } catch (err) { - $reject.call(this, err); - } - }; - Internal = function Promise(executor) { - this._c = []; - this._a = undefined; - this._s = 0; - this._d = false; - this._v = undefined; - this._h = 0; - this._n = false; - }; - Internal.prototype = __w_pdfjs_require__(89)($Promise.prototype, { - then: function then(onFulfilled, onRejected) { - var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); - reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; - reaction.fail = typeof onRejected == 'function' && onRejected; - reaction.domain = isNode ? process.domain : undefined; - this._c.push(reaction); - if (this._a) this._a.push(reaction); - if (this._s) notify(this, false); - return reaction.promise; - }, - 'catch': function _catch(onRejected) { - return this.then(undefined, onRejected); - } - }); - OwnPromiseCapability = function OwnPromiseCapability() { - var promise = new Internal(); - this.promise = promise; - this.resolve = ctx($resolve, promise, 1); - this.reject = ctx($reject, promise, 1); - }; - newPromiseCapabilityModule.f = newPromiseCapability = function newPromiseCapability(C) { - return C === $Promise || C === Wrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); - }; -} -$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); -__w_pdfjs_require__(70)($Promise, PROMISE); -__w_pdfjs_require__(90)(PROMISE); -Wrapper = __w_pdfjs_require__(9)[PROMISE]; -$export($export.S + $export.F * !USE_NATIVE, PROMISE, { - reject: function reject(r) { - var capability = newPromiseCapability(this); - var $$reject = capability.reject; - $$reject(r); - return capability.promise; - } -}); -$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { - resolve: function resolve(x) { - return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); - } -}); -$export($export.S + $export.F * !(USE_NATIVE && __w_pdfjs_require__(91)(function (iter) { - $Promise.all(iter)['catch'](empty); -})), PROMISE, { - all: function all(iterable) { - var C = this; - var capability = newPromiseCapability(C); - var resolve = capability.resolve; - var reject = capability.reject; - var result = perform(function () { - var values = []; - var index = 0; - var remaining = 1; - forOf(iterable, false, function (promise) { - var $index = index++; - var alreadyCalled = false; - values.push(undefined); - remaining++; - C.resolve(promise).then(function (value) { - if (alreadyCalled) return; - alreadyCalled = true; - values[$index] = value; - --remaining || resolve(values); - }, reject); - }); - --remaining || resolve(values); - }); - if (result.e) reject(result.v); - return capability.promise; - }, - race: function race(iterable) { - var C = this; - var capability = newPromiseCapability(C); - var reject = capability.reject; - var result = perform(function () { - forOf(iterable, false, function (promise) { - C.resolve(promise).then(capability.resolve, reject); - }); - }); - if (result.e) reject(result.v); - return capability.promise; + function InvalidPDFException() { + _classCallCheck(this, InvalidPDFException); + + return _super3.apply(this, arguments); } -}); -/***/ }), -/* 76 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return InvalidPDFException; +}(BaseException); -"use strict"; +exports.InvalidPDFException = InvalidPDFException; +var MissingPDFException = /*#__PURE__*/function (_BaseException4) { + _inherits(MissingPDFException, _BaseException4); -module.exports = function (it, Constructor, name, forbiddenField) { - if (!(it instanceof Constructor) || forbiddenField !== undefined && forbiddenField in it) { - throw TypeError(name + ': incorrect invocation!'); - } - return it; -}; + var _super4 = _createSuper(MissingPDFException); -/***/ }), -/* 77 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + function MissingPDFException() { + _classCallCheck(this, MissingPDFException); -"use strict"; + return _super4.apply(this, arguments); + } + return MissingPDFException; +}(BaseException); -var ctx = __w_pdfjs_require__(23); -var call = __w_pdfjs_require__(78); -var isArrayIter = __w_pdfjs_require__(79); -var anObject = __w_pdfjs_require__(12); -var toLength = __w_pdfjs_require__(38); -var getIterFn = __w_pdfjs_require__(80); -var BREAK = {}; -var RETURN = {}; -var _exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { - var iterFn = ITERATOR ? function () { - return iterable; - } : getIterFn(iterable); - var f = ctx(fn, that, entries ? 2 : 1); - var index = 0; - var length, step, iterator, result; - if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); - if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { - result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); - if (result === BREAK || result === RETURN) return result; - } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { - result = call(iterator, f, step.value, entries); - if (result === BREAK || result === RETURN) return result; - } -}; -_exports.BREAK = BREAK; -_exports.RETURN = RETURN; +exports.MissingPDFException = MissingPDFException; -/***/ }), -/* 78 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +var UnexpectedResponseException = /*#__PURE__*/function (_BaseException5) { + _inherits(UnexpectedResponseException, _BaseException5); -"use strict"; + var _super5 = _createSuper(UnexpectedResponseException); + function UnexpectedResponseException(msg, status) { + var _this3; -var anObject = __w_pdfjs_require__(12); -module.exports = function (iterator, fn, value, entries) { - try { - return entries ? fn(anObject(value)[0], value[1]) : fn(value); - } catch (e) { - var ret = iterator['return']; - if (ret !== undefined) anObject(ret.call(iterator)); - throw e; - } -}; + _classCallCheck(this, UnexpectedResponseException); -/***/ }), -/* 79 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + _this3 = _super5.call(this, msg); + _this3.status = status; + return _this3; + } -"use strict"; + return UnexpectedResponseException; +}(BaseException); +exports.UnexpectedResponseException = UnexpectedResponseException; -var Iterators = __w_pdfjs_require__(65); -var ITERATOR = __w_pdfjs_require__(28)('iterator'); -var ArrayProto = Array.prototype; -module.exports = function (it) { - return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); -}; +var FormatError = /*#__PURE__*/function (_BaseException6) { + _inherits(FormatError, _BaseException6); -/***/ }), -/* 80 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + var _super6 = _createSuper(FormatError); -"use strict"; + function FormatError() { + _classCallCheck(this, FormatError); + return _super6.apply(this, arguments); + } -var classof = __w_pdfjs_require__(61); -var ITERATOR = __w_pdfjs_require__(28)('iterator'); -var Iterators = __w_pdfjs_require__(65); -module.exports = __w_pdfjs_require__(9).getIteratorMethod = function (it) { - if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; -}; + return FormatError; +}(BaseException); -/***/ }), -/* 81 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +exports.FormatError = FormatError; -"use strict"; +var AbortException = /*#__PURE__*/function (_BaseException7) { + _inherits(AbortException, _BaseException7); + var _super7 = _createSuper(AbortException); -var anObject = __w_pdfjs_require__(12); -var aFunction = __w_pdfjs_require__(24); -var SPECIES = __w_pdfjs_require__(28)('species'); -module.exports = function (O, D) { - var C = anObject(O).constructor; - var S; - return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); -}; + function AbortException() { + _classCallCheck(this, AbortException); -/***/ }), -/* 82 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return _super7.apply(this, arguments); + } -"use strict"; + return AbortException; +}(BaseException); +exports.AbortException = AbortException; +var NullCharactersRegExp = /\x00/g; -var ctx = __w_pdfjs_require__(23); -var invoke = __w_pdfjs_require__(83); -var html = __w_pdfjs_require__(69); -var cel = __w_pdfjs_require__(17); -var global = __w_pdfjs_require__(8); -var process = global.process; -var setTask = global.setImmediate; -var clearTask = global.clearImmediate; -var MessageChannel = global.MessageChannel; -var Dispatch = global.Dispatch; -var counter = 0; -var queue = {}; -var ONREADYSTATECHANGE = 'onreadystatechange'; -var defer, channel, port; -var run = function run() { - var id = +this; - if (queue.hasOwnProperty(id)) { - var fn = queue[id]; - delete queue[id]; - fn(); - } -}; -var listener = function listener(event) { - run.call(event.data); -}; -if (!setTask || !clearTask) { - setTask = function setImmediate(fn) { - var args = []; - var i = 1; - while (arguments.length > i) { - args.push(arguments[i++]); - }queue[++counter] = function () { - invoke(typeof fn == 'function' ? fn : Function(fn), args); - }; - defer(counter); - return counter; - }; - clearTask = function clearImmediate(id) { - delete queue[id]; - }; - if (__w_pdfjs_require__(27)(process) == 'process') { - defer = function defer(id) { - process.nextTick(ctx(run, id, 1)); - }; - } else if (Dispatch && Dispatch.now) { - defer = function defer(id) { - Dispatch.now(ctx(run, id, 1)); - }; - } else if (MessageChannel) { - channel = new MessageChannel(); - port = channel.port2; - channel.port1.onmessage = listener; - defer = ctx(port.postMessage, port, 1); - } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) { - defer = function defer(id) { - global.postMessage(id + '', '*'); - }; - global.addEventListener('message', listener, false); - } else if (ONREADYSTATECHANGE in cel('script')) { - defer = function defer(id) { - html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { - html.removeChild(this); - run.call(id); - }; - }; - } else { - defer = function defer(id) { - setTimeout(ctx(run, id, 1), 0); - }; +function removeNullCharacters(str) { + if (typeof str !== "string") { + warn("The argument for removeNullCharacters must be a string."); + return str; } -} -module.exports = { - set: setTask, - clear: clearTask -}; -/***/ }), -/* 83 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return str.replace(NullCharactersRegExp, ""); +} -"use strict"; +function bytesToString(bytes) { + assert(bytes !== null && _typeof(bytes) === "object" && bytes.length !== undefined, "Invalid argument for bytesToString"); + var length = bytes.length; + var MAX_ARGUMENT_COUNT = 8192; + if (length < MAX_ARGUMENT_COUNT) { + return String.fromCharCode.apply(null, bytes); + } -module.exports = function (fn, args, that) { - var un = that === undefined; - switch (args.length) { - case 0: - return un ? fn() : fn.call(that); - case 1: - return un ? fn(args[0]) : fn.call(that, args[0]); - case 2: - return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); - case 3: - return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); - case 4: - return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); - } - return fn.apply(that, args); -}; + var strBuf = []; -/***/ }), -/* 84 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) { + var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); + var chunk = bytes.subarray(i, chunkEnd); + strBuf.push(String.fromCharCode.apply(null, chunk)); + } -"use strict"; + return strBuf.join(""); +} +function stringToBytes(str) { + assert(typeof str === "string", "Invalid argument for stringToBytes"); + var length = str.length; + var bytes = new Uint8Array(length); -var global = __w_pdfjs_require__(8); -var macrotask = __w_pdfjs_require__(82).set; -var Observer = global.MutationObserver || global.WebKitMutationObserver; -var process = global.process; -var Promise = global.Promise; -var isNode = __w_pdfjs_require__(27)(process) == 'process'; -module.exports = function () { - var head, last, notify; - var flush = function flush() { - var parent, fn; - if (isNode && (parent = process.domain)) parent.exit(); - while (head) { - fn = head.fn; - head = head.next; - try { - fn(); - } catch (e) { - if (head) notify();else last = undefined; - throw e; - } - } - last = undefined; - if (parent) parent.enter(); - }; - if (isNode) { - notify = function notify() { - process.nextTick(flush); - }; - } else if (Observer && !(global.navigator && global.navigator.standalone)) { - var toggle = true; - var node = document.createTextNode(''); - new Observer(flush).observe(node, { characterData: true }); - notify = function notify() { - node.data = toggle = !toggle; - }; - } else if (Promise && Promise.resolve) { - var promise = Promise.resolve(undefined); - notify = function notify() { - promise.then(flush); - }; - } else { - notify = function notify() { - macrotask.call(global, flush); - }; + for (var i = 0; i < length; ++i) { + bytes[i] = str.charCodeAt(i) & 0xff; } - return function (fn) { - var task = { - fn: fn, - next: undefined - }; - if (last) last.next = task; - if (!head) { - head = task; - notify(); - } - last = task; - }; -}; -/***/ }), -/* 85 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; + return bytes; +} +function arrayByteLength(arr) { + if (arr.length !== undefined) { + return arr.length; + } -var aFunction = __w_pdfjs_require__(24); -function PromiseCapability(C) { - var resolve, reject; - this.promise = new C(function ($$resolve, $$reject) { - if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); - resolve = $$resolve; - reject = $$reject; - }); - this.resolve = aFunction(resolve); - this.reject = aFunction(reject); + assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument."); + return arr.byteLength; } -module.exports.f = function (C) { - return new PromiseCapability(C); -}; -/***/ }), -/* 86 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +function arraysToBytes(arr) { + var length = arr.length; -"use strict"; + if (length === 1 && arr[0] instanceof Uint8Array) { + return arr[0]; + } + var resultLength = 0; -module.exports = function (exec) { - try { - return { - e: false, - v: exec() - }; - } catch (e) { - return { - e: true, - v: e - }; + for (var i = 0; i < length; i++) { + resultLength += arrayByteLength(arr[i]); } -}; -/***/ }), -/* 87 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + var pos = 0; + var data = new Uint8Array(resultLength); -"use strict"; + for (var _i = 0; _i < length; _i++) { + var item = arr[_i]; + + if (!(item instanceof Uint8Array)) { + if (typeof item === "string") { + item = stringToBytes(item); + } else { + item = new Uint8Array(item); + } + } + var itemLength = item.byteLength; + data.set(item, pos); + pos += itemLength; + } -var global = __w_pdfjs_require__(8); -var navigator = global.navigator; -module.exports = navigator && navigator.userAgent || ''; + return data; +} -/***/ }), -/* 88 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +function string32(value) { + return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); +} -"use strict"; +function isLittleEndian() { + var buffer8 = new Uint8Array(4); + buffer8[0] = 1; + var view32 = new Uint32Array(buffer8.buffer, 0, 1); + return view32[0] === 1; +} +var IsLittleEndianCached = { + get value() { + return shadow(this, "value", isLittleEndian()); + } -var anObject = __w_pdfjs_require__(12); -var isObject = __w_pdfjs_require__(13); -var newPromiseCapability = __w_pdfjs_require__(85); -module.exports = function (C, x) { - anObject(C); - if (isObject(x) && x.constructor === C) return x; - var promiseCapability = newPromiseCapability.f(C); - var resolve = promiseCapability.resolve; - resolve(x); - return promiseCapability.promise; }; +exports.IsLittleEndianCached = IsLittleEndianCached; -/***/ }), -/* 89 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +function isEvalSupported() { + try { + new Function(""); + return true; + } catch (e) { + return false; + } +} +var IsEvalSupportedCached = { + get value() { + return shadow(this, "value", isEvalSupported()); + } -var redefine = __w_pdfjs_require__(20); -module.exports = function (target, src, safe) { - for (var key in src) { - redefine(target, key, src[key], safe); - }return target; }; +exports.IsEvalSupportedCached = IsEvalSupportedCached; +var rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"]; -/***/ }), -/* 90 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +var Util = /*#__PURE__*/function () { + function Util() { + _classCallCheck(this, Util); + } -"use strict"; + _createClass(Util, null, [{ + key: "makeCssRgb", + value: function makeCssRgb(r, g, b) { + rgbBuf[1] = r; + rgbBuf[3] = g; + rgbBuf[5] = b; + return rgbBuf.join(""); + } + }, { + key: "transform", + value: function transform(m1, m2) { + return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]]; + } + }, { + key: "applyTransform", + value: function applyTransform(p, m) { + var xt = p[0] * m[0] + p[1] * m[2] + m[4]; + var yt = p[0] * m[1] + p[1] * m[3] + m[5]; + return [xt, yt]; + } + }, { + key: "applyInverseTransform", + value: function applyInverseTransform(p, m) { + var d = m[0] * m[3] - m[1] * m[2]; + var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; + var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; + return [xt, yt]; + } + }, { + key: "getAxialAlignedBoundingBox", + value: function getAxialAlignedBoundingBox(r, m) { + var p1 = Util.applyTransform(r, m); + var p2 = Util.applyTransform(r.slice(2, 4), m); + var p3 = Util.applyTransform([r[0], r[3]], m); + var p4 = Util.applyTransform([r[2], r[1]], m); + return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])]; + } + }, { + key: "inverseTransform", + value: function inverseTransform(m) { + var d = m[0] * m[3] - m[1] * m[2]; + return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d]; + } + }, { + key: "apply3dTransform", + value: function apply3dTransform(m, v) { + return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]]; + } + }, { + key: "singularValueDecompose2dScale", + value: function singularValueDecompose2dScale(m) { + var transpose = [m[0], m[2], m[1], m[3]]; + var a = m[0] * transpose[0] + m[1] * transpose[2]; + var b = m[0] * transpose[1] + m[1] * transpose[3]; + var c = m[2] * transpose[0] + m[3] * transpose[2]; + var d = m[2] * transpose[1] + m[3] * transpose[3]; + var first = (a + d) / 2; + var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; + var sx = first + second || 1; + var sy = first - second || 1; + return [Math.sqrt(sx), Math.sqrt(sy)]; + } + }, { + key: "normalizeRect", + value: function normalizeRect(rect) { + var r = rect.slice(0); + if (rect[0] > rect[2]) { + r[0] = rect[2]; + r[2] = rect[0]; + } -var global = __w_pdfjs_require__(8); -var dP = __w_pdfjs_require__(11); -var DESCRIPTORS = __w_pdfjs_require__(15); -var SPECIES = __w_pdfjs_require__(28)('species'); -module.exports = function (KEY) { - var C = global[KEY]; - if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { - configurable: true, - get: function get() { - return this; + if (rect[1] > rect[3]) { + r[1] = rect[3]; + r[3] = rect[1]; + } + + return r; } - }); -}; + }, { + key: "intersect", + value: function intersect(rect1, rect2) { + function compare(a, b) { + return a - b; + } -/***/ }), -/* 91 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare); + var orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare); + var result = []; + rect1 = Util.normalizeRect(rect1); + rect2 = Util.normalizeRect(rect2); -"use strict"; + if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) { + result[0] = orderedX[1]; + result[2] = orderedX[2]; + } else { + return null; + } + if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) { + result[1] = orderedY[1]; + result[3] = orderedY[2]; + } else { + return null; + } -var ITERATOR = __w_pdfjs_require__(28)('iterator'); -var SAFE_CLOSING = false; -try { - var riter = [7][ITERATOR](); - riter['return'] = function () { - SAFE_CLOSING = true; - }; - Array.from(riter, function () { - throw 2; - }); -} catch (e) {} -module.exports = function (exec, skipClosing) { - if (!skipClosing && !SAFE_CLOSING) return false; - var safe = false; - try { - var arr = [7]; - var iter = arr[ITERATOR](); - iter.next = function () { - return { done: safe = true }; - }; - arr[ITERATOR] = function () { - return iter; - }; - exec(arr); - } catch (e) {} - return safe; -}; + return result; + } + }]); -/***/ }), -/* 92 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return Util; +}(); -"use strict"; +exports.Util = Util; +var PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC]; +function stringToPDFString(str) { + var length = str.length, + strBuf = []; -var $export = __w_pdfjs_require__(7); -var core = __w_pdfjs_require__(9); -var global = __w_pdfjs_require__(8); -var speciesConstructor = __w_pdfjs_require__(81); -var promiseResolve = __w_pdfjs_require__(88); -$export($export.P + $export.R, 'Promise', { - 'finally': function _finally(onFinally) { - var C = speciesConstructor(this, core.Promise || global.Promise); - var isFunction = typeof onFinally == 'function'; - return this.then(isFunction ? function (x) { - return promiseResolve(C, onFinally()).then(function () { - return x; - }); - } : onFinally, isFunction ? function (e) { - return promiseResolve(C, onFinally()).then(function () { - throw e; - }); - } : onFinally); + if (str[0] === "\xFE" && str[1] === "\xFF") { + for (var i = 2; i < length; i += 2) { + strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1))); + } + } else if (str[0] === "\xFF" && str[1] === "\xFE") { + for (var _i2 = 2; _i2 < length; _i2 += 2) { + strBuf.push(String.fromCharCode(str.charCodeAt(_i2 + 1) << 8 | str.charCodeAt(_i2))); + } + } else { + for (var _i3 = 0; _i3 < length; ++_i3) { + var code = PDFStringTranslateTable[str.charCodeAt(_i3)]; + strBuf.push(code ? String.fromCharCode(code) : str.charAt(_i3)); + } } -}); -/***/ }), -/* 93 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return strBuf.join(""); +} -"use strict"; +function stringToUTF8String(str) { + return decodeURIComponent(escape(str)); +} +function utf8StringToString(str) { + return unescape(encodeURIComponent(str)); +} -var $export = __w_pdfjs_require__(7); -var newPromiseCapability = __w_pdfjs_require__(85); -var perform = __w_pdfjs_require__(86); -$export($export.S, 'Promise', { - 'try': function _try(callbackfn) { - var promiseCapability = newPromiseCapability.f(this); - var result = perform(callbackfn); - (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v); - return promiseCapability.promise; +function isEmptyObj(obj) { + for (var key in obj) { + return false; } -}); -/***/ }), -/* 94 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return true; +} -"use strict"; +function isBool(v) { + return typeof v === "boolean"; +} +function isNum(v) { + return typeof v === "number"; +} -__w_pdfjs_require__(60); -__w_pdfjs_require__(72); -__w_pdfjs_require__(95); -__w_pdfjs_require__(107); -__w_pdfjs_require__(109); -module.exports = __w_pdfjs_require__(9).WeakMap; +function isString(v) { + return typeof v === "string"; +} -/***/ }), -/* 95 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +function isArrayBuffer(v) { + return _typeof(v) === "object" && v !== null && v.byteLength !== undefined; +} -"use strict"; +function isArrayEqual(arr1, arr2) { + if (arr1.length !== arr2.length) { + return false; + } + return arr1.every(function (element, index) { + return element === arr2[index]; + }); +} -var each = __w_pdfjs_require__(96)(0); -var redefine = __w_pdfjs_require__(20); -var meta = __w_pdfjs_require__(100); -var assign = __w_pdfjs_require__(44); -var weak = __w_pdfjs_require__(101); -var isObject = __w_pdfjs_require__(13); -var fails = __w_pdfjs_require__(16); -var validate = __w_pdfjs_require__(102); -var WEAK_MAP = 'WeakMap'; -var getWeak = meta.getWeak; -var isExtensible = Object.isExtensible; -var uncaughtFrozenStore = weak.ufstore; -var tmp = {}; -var InternalMap; -var wrapper = function wrapper(get) { - return function WeakMap() { - return get(this, arguments.length > 0 ? arguments[0] : undefined); - }; -}; -var methods = { - get: function get(key) { - if (isObject(key)) { - var data = getWeak(key); - if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key); - return data ? data[this._i] : undefined; +function createPromiseCapability() { + var capability = Object.create(null); + var isSettled = false; + Object.defineProperty(capability, "settled", { + get: function get() { + return isSettled; } - }, - set: function set(key, value) { - return weak.def(validate(this, WEAK_MAP), key, value); - } -}; -var $WeakMap = module.exports = __w_pdfjs_require__(103)(WEAK_MAP, wrapper, methods, weak, true, true); -if (fails(function () { - return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; -})) { - InternalMap = weak.getConstructor(wrapper, WEAK_MAP); - assign(InternalMap.prototype, methods); - meta.NEED = true; - each(['delete', 'has', 'get', 'set'], function (key) { - var proto = $WeakMap.prototype; - var method = proto[key]; - redefine(proto, key, function (a, b) { - if (isObject(a) && !isExtensible(a)) { - if (!this._f) this._f = new InternalMap(); - var result = this._f[key](a, b); - return key == 'set' ? this : result; - } - return method.call(this, a, b); - }); }); + capability.promise = new Promise(function (resolve, reject) { + capability.resolve = function (data) { + isSettled = true; + resolve(data); + }; + + capability.reject = function (reason) { + isSettled = true; + reject(reason); + }; + }); + return capability; } -/***/ }), -/* 96 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +var createObjectURL = function createObjectURLClosure() { + var digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + return function createObjectURL(data, contentType) { + var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; -"use strict"; + if (!forceDataSchema && URL.createObjectURL) { + var blob = new Blob([data], { + type: contentType + }); + return URL.createObjectURL(blob); + } + var buffer = "data:".concat(contentType, ";base64,"); -var ctx = __w_pdfjs_require__(23); -var IObject = __w_pdfjs_require__(37); -var toObject = __w_pdfjs_require__(51); -var toLength = __w_pdfjs_require__(38); -var asc = __w_pdfjs_require__(97); -module.exports = function (TYPE, $create) { - var IS_MAP = TYPE == 1; - var IS_FILTER = TYPE == 2; - var IS_SOME = TYPE == 3; - var IS_EVERY = TYPE == 4; - var IS_FIND_INDEX = TYPE == 6; - var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; - var create = $create || asc; - return function ($this, callbackfn, that) { - var O = toObject($this); - var self = IObject(O); - var f = ctx(callbackfn, that, 3); - var length = toLength(self.length); - var index = 0; - var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; - var val, res; - for (; length > index; index++) { - if (NO_HOLES || index in self) { - val = self[index]; - res = f(val, index, O); - if (TYPE) { - if (IS_MAP) result[index] = res;else if (res) switch (TYPE) { - case 3: - return true; - case 5: - return val; - case 6: - return index; - case 2: - result.push(val); - } else if (IS_EVERY) return false; - } - } - }return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; + for (var i = 0, ii = data.length; i < ii; i += 3) { + var b1 = data[i] & 0xff; + var b2 = data[i + 1] & 0xff; + var b3 = data[i + 2] & 0xff; + var d1 = b1 >> 2, + d2 = (b1 & 3) << 4 | b2 >> 4; + var d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64; + var d4 = i + 2 < ii ? b3 & 0x3f : 64; + buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; + } + + return buffer; }; -}; +}(); + +exports.createObjectURL = createObjectURL; /***/ }), -/* 97 */ +/* 6 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var speciesConstructor = __w_pdfjs_require__(98); -module.exports = function (original, length) { - return new (speciesConstructor(original))(length); -}; +var _is_node = __w_pdfjs_require__(7); -/***/ }), -/* 98 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -"use strict"; +if (typeof globalThis === "undefined" || !globalThis._pdfjsCompatibilityChecked) { + if (typeof globalThis === "undefined" || globalThis.Math !== Math) { + globalThis = __w_pdfjs_require__(8); + } + globalThis._pdfjsCompatibilityChecked = true; + var hasDOM = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === "object"; + var userAgent = typeof navigator !== "undefined" && navigator.userAgent || ""; + var isIE = /Trident/.test(userAgent); -var isObject = __w_pdfjs_require__(13); -var isArray = __w_pdfjs_require__(99); -var SPECIES = __w_pdfjs_require__(28)('species'); -module.exports = function (original) { - var C; - if (isArray(original)) { - C = original.constructor; - if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; - if (isObject(C)) { - C = C[SPECIES]; - if (C === null) C = undefined; + (function checkNodeBtoa() { + if (globalThis.btoa || !_is_node.isNodeJS) { + return; } - } - return C === undefined ? Array : C; -}; -/***/ }), -/* 99 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + globalThis.btoa = function (chars) { + return Buffer.from(chars, "binary").toString("base64"); + }; + })(); -"use strict"; + (function checkNodeAtob() { + if (globalThis.atob || !_is_node.isNodeJS) { + return; + } + globalThis.atob = function (input) { + return Buffer.from(input, "base64").toString("binary"); + }; + })(); -var cof = __w_pdfjs_require__(27); -module.exports = Array.isArray || function isArray(arg) { - return cof(arg) == 'Array'; -}; + (function checkChildNodeRemove() { + if (!hasDOM) { + return; + } -/***/ }), -/* 100 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + if (typeof Element.prototype.remove !== "undefined") { + return; + } -"use strict"; + Element.prototype.remove = function () { + if (this.parentNode) { + this.parentNode.removeChild(this); + } + }; + })(); + (function checkDOMTokenListAddRemove() { + if (!hasDOM || _is_node.isNodeJS) { + return; + } -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + var div = document.createElement("div"); + div.classList.add("testOne", "testTwo"); -var META = __w_pdfjs_require__(22)('meta'); -var isObject = __w_pdfjs_require__(13); -var has = __w_pdfjs_require__(21); -var setDesc = __w_pdfjs_require__(11).f; -var id = 0; -var isExtensible = Object.isExtensible || function () { - return true; -}; -var FREEZE = !__w_pdfjs_require__(16)(function () { - return isExtensible(Object.preventExtensions({})); -}); -var setMeta = function setMeta(it) { - setDesc(it, META, { - value: { - i: 'O' + ++id, - w: {} + if (div.classList.contains("testOne") === true && div.classList.contains("testTwo") === true) { + return; } - }); -}; -var fastKey = function fastKey(it, create) { - if (!isObject(it)) return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if (!has(it, META)) { - if (!isExtensible(it)) return 'F'; - if (!create) return 'E'; - setMeta(it); - } - return it[META].i; -}; -var getWeak = function getWeak(it, create) { - if (!has(it, META)) { - if (!isExtensible(it)) return true; - if (!create) return false; - setMeta(it); - } - return it[META].w; -}; -var onFreeze = function onFreeze(it) { - if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); - return it; -}; -var meta = module.exports = { - KEY: META, - NEED: false, - fastKey: fastKey, - getWeak: getWeak, - onFreeze: onFreeze -}; -/***/ }), -/* 101 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + var OriginalDOMTokenListAdd = DOMTokenList.prototype.add; + var OriginalDOMTokenListRemove = DOMTokenList.prototype.remove; -"use strict"; + DOMTokenList.prototype.add = function () { + for (var _len = arguments.length, tokens = new Array(_len), _key = 0; _key < _len; _key++) { + tokens[_key] = arguments[_key]; + } + for (var _i = 0, _tokens = tokens; _i < _tokens.length; _i++) { + var token = _tokens[_i]; + OriginalDOMTokenListAdd.call(this, token); + } + }; -var redefineAll = __w_pdfjs_require__(89); -var getWeak = __w_pdfjs_require__(100).getWeak; -var anObject = __w_pdfjs_require__(12); -var isObject = __w_pdfjs_require__(13); -var anInstance = __w_pdfjs_require__(76); -var forOf = __w_pdfjs_require__(77); -var createArrayMethod = __w_pdfjs_require__(96); -var $has = __w_pdfjs_require__(21); -var validate = __w_pdfjs_require__(102); -var arrayFind = createArrayMethod(5); -var arrayFindIndex = createArrayMethod(6); -var id = 0; -var uncaughtFrozenStore = function uncaughtFrozenStore(that) { - return that._l || (that._l = new UncaughtFrozenStore()); -}; -var UncaughtFrozenStore = function UncaughtFrozenStore() { - this.a = []; -}; -var findUncaughtFrozen = function findUncaughtFrozen(store, key) { - return arrayFind(store.a, function (it) { - return it[0] === key; - }); -}; -UncaughtFrozenStore.prototype = { - get: function get(key) { - var entry = findUncaughtFrozen(this, key); - if (entry) return entry[1]; - }, - has: function has(key) { - return !!findUncaughtFrozen(this, key); - }, - set: function set(key, value) { - var entry = findUncaughtFrozen(this, key); - if (entry) entry[1] = value;else this.a.push([key, value]); - }, - 'delete': function _delete(key) { - var index = arrayFindIndex(this.a, function (it) { - return it[0] === key; - }); - if (~index) this.a.splice(index, 1); - return !!~index; - } -}; -module.exports = { - getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) { - var C = wrapper(function (that, iterable) { - anInstance(that, C, NAME, '_i'); - that._t = NAME; - that._i = id++; - that._l = undefined; - if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); - }); - redefineAll(C.prototype, { - 'delete': function _delete(key) { - if (!isObject(key)) return false; - var data = getWeak(key); - if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key); - return data && $has(data, this._i) && delete data[this._i]; - }, - has: function has(key) { - if (!isObject(key)) return false; - var data = getWeak(key); - if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key); - return data && $has(data, this._i); + DOMTokenList.prototype.remove = function () { + for (var _len2 = arguments.length, tokens = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + tokens[_key2] = arguments[_key2]; } - }); - return C; - }, - def: function def(that, key, value) { - var data = getWeak(anObject(key), true); - if (data === true) uncaughtFrozenStore(that).set(key, value);else data[that._i] = value; - return that; - }, - ufstore: uncaughtFrozenStore -}; -/***/ }), -/* 102 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + for (var _i2 = 0, _tokens2 = tokens; _i2 < _tokens2.length; _i2++) { + var token = _tokens2[_i2]; + OriginalDOMTokenListRemove.call(this, token); + } + }; + })(); -"use strict"; + (function checkDOMTokenListToggle() { + if (!hasDOM || _is_node.isNodeJS) { + return; + } + var div = document.createElement("div"); -var isObject = __w_pdfjs_require__(13); -module.exports = function (it, TYPE) { - if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); - return it; -}; + if (div.classList.toggle("test", 0) === false) { + return; + } -/***/ }), -/* 103 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + DOMTokenList.prototype.toggle = function (token) { + var force = arguments.length > 1 ? !!arguments[1] : !this.contains(token); + return this[force ? "add" : "remove"](token), force; + }; + })(); -"use strict"; + (function checkWindowHistoryPushStateReplaceState() { + if (!hasDOM || !isIE) { + return; + } + var OriginalPushState = window.history.pushState; + var OriginalReplaceState = window.history.replaceState; -var global = __w_pdfjs_require__(8); -var $export = __w_pdfjs_require__(7); -var redefine = __w_pdfjs_require__(20); -var redefineAll = __w_pdfjs_require__(89); -var meta = __w_pdfjs_require__(100); -var forOf = __w_pdfjs_require__(77); -var anInstance = __w_pdfjs_require__(76); -var isObject = __w_pdfjs_require__(13); -var fails = __w_pdfjs_require__(16); -var $iterDetect = __w_pdfjs_require__(91); -var setToStringTag = __w_pdfjs_require__(70); -var inheritIfRequired = __w_pdfjs_require__(104); -module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { - var Base = global[NAME]; - var C = Base; - var ADDER = IS_MAP ? 'set' : 'add'; - var proto = C && C.prototype; - var O = {}; - var fixMethod = function fixMethod(KEY) { - var fn = proto[KEY]; - redefine(proto, KEY, KEY == 'delete' ? function (a) { - return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'has' ? function has(a) { - return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'get' ? function get(a) { - return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); - } : KEY == 'add' ? function add(a) { - fn.call(this, a === 0 ? 0 : a); - return this; - } : function set(a, b) { - fn.call(this, a === 0 ? 0 : a, b); - return this; - }); - }; - if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () { - new C().entries().next(); - }))) { - C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); - redefineAll(C.prototype, methods); - meta.NEED = true; - } else { - var instance = new C(); - var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; - var THROWS_ON_PRIMITIVES = fails(function () { - instance.has(1); - }); - var ACCEPT_ITERABLES = $iterDetect(function (iter) { - new C(iter); - }); - var BUGGY_ZERO = !IS_WEAK && fails(function () { - var $instance = new C(); - var index = 5; - while (index--) { - $instance[ADDER](index, index); - }return !$instance.has(-0); - }); - if (!ACCEPT_ITERABLES) { - C = wrapper(function (target, iterable) { - anInstance(target, C, NAME); - var that = inheritIfRequired(new Base(), target, C); - if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); - return that; - }); - C.prototype = proto; - proto.constructor = C; + window.history.pushState = function (state, title, url) { + var args = url === undefined ? [state, title] : [state, title, url]; + OriginalPushState.apply(this, args); + }; + + window.history.replaceState = function (state, title, url) { + var args = url === undefined ? [state, title] : [state, title, url]; + OriginalReplaceState.apply(this, args); + }; + })(); + + (function checkStringStartsWith() { + if (String.prototype.startsWith) { + return; } - if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { - fixMethod('delete'); - fixMethod('has'); - IS_MAP && fixMethod('get'); + + __w_pdfjs_require__(53); + })(); + + (function checkStringEndsWith() { + if (String.prototype.endsWith) { + return; } - if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); - if (IS_WEAK && proto.clear) delete proto.clear; - } - setToStringTag(C, NAME); - O[NAME] = C; - $export($export.G + $export.W + $export.F * (C != Base), O); - if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); - return C; -}; -/***/ }), -/* 104 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + __w_pdfjs_require__(64); + })(); -"use strict"; + (function checkStringIncludes() { + if (String.prototype.includes) { + return; + } + __w_pdfjs_require__(66); + })(); -var isObject = __w_pdfjs_require__(13); -var setPrototypeOf = __w_pdfjs_require__(105).set; -module.exports = function (that, target, C) { - var S = target.constructor; - var P; - if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) { - setPrototypeOf(that, P); - } - return that; -}; + (function checkArrayIncludes() { + if (Array.prototype.includes) { + return; + } -/***/ }), -/* 105 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + __w_pdfjs_require__(68); + })(); -"use strict"; + (function checkArrayFrom() { + if (Array.from) { + return; + } + __w_pdfjs_require__(76); + })(); -var isObject = __w_pdfjs_require__(13); -var anObject = __w_pdfjs_require__(12); -var check = function check(O, proto) { - anObject(O); - if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); -}; -module.exports = { - set: Object.setPrototypeOf || ('__proto__' in {} ? function (test, buggy, set) { - try { - set = __w_pdfjs_require__(23)(Function.call, __w_pdfjs_require__(106).f(Object.prototype, '__proto__').set, 2); - set(test, []); - buggy = !(test instanceof Array); - } catch (e) { - buggy = true; - } - return function setPrototypeOf(O, proto) { - check(O, proto); - if (buggy) O.__proto__ = proto;else set(O, proto); - return O; - }; - }({}, false) : undefined), - check: check -}; + (function checkObjectAssign() { + if (Object.assign) { + return; + } -/***/ }), -/* 106 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + __w_pdfjs_require__(98); + })(); -"use strict"; + (function checkMathLog2() { + if (Math.log2) { + return; + } + Math.log2 = __w_pdfjs_require__(101); + })(); -var pIE = __w_pdfjs_require__(50); -var createDesc = __w_pdfjs_require__(19); -var toIObject = __w_pdfjs_require__(36); -var toPrimitive = __w_pdfjs_require__(18); -var has = __w_pdfjs_require__(21); -var IE8_DOM_DEFINE = __w_pdfjs_require__(14); -var gOPD = Object.getOwnPropertyDescriptor; -exports.f = __w_pdfjs_require__(15) ? gOPD : function getOwnPropertyDescriptor(O, P) { - O = toIObject(O); - P = toPrimitive(P, true); - if (IE8_DOM_DEFINE) try { - return gOPD(O, P); - } catch (e) {} - if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); -}; + (function checkNumberIsNaN() { + if (Number.isNaN) { + return; + } -/***/ }), -/* 107 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + Number.isNaN = __w_pdfjs_require__(103); + })(); -"use strict"; + (function checkNumberIsInteger() { + if (Number.isInteger) { + return; + } + Number.isInteger = __w_pdfjs_require__(105); + })(); -__w_pdfjs_require__(108)('WeakMap'); + (function checkTypedArraySlice() { + if (Uint8Array.prototype.slice) { + return; + } -/***/ }), -/* 108 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + __w_pdfjs_require__(108); + })(); -"use strict"; + (function checkPromise() { + if (globalThis.Promise && globalThis.Promise.allSettled) { + return; + } + + globalThis.Promise = __w_pdfjs_require__(113); + })(); + + (function checkURL() { + globalThis.URL = __w_pdfjs_require__(136); + })(); + (function checkReadableStream() { + var isReadableStreamSupported = false; -var $export = __w_pdfjs_require__(7); -module.exports = function (COLLECTION) { - $export($export.S, COLLECTION, { - of: function of() { - var length = arguments.length; - var A = new Array(length); - while (length--) { - A[length] = arguments[length]; - }return new this(A); + if (typeof ReadableStream !== "undefined") { + try { + new ReadableStream({ + start: function start(controller) { + controller.close(); + } + }); + isReadableStreamSupported = true; + } catch (e) {} } - }); -}; -/***/ }), -/* 109 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + if (isReadableStreamSupported) { + return; + } -"use strict"; + globalThis.ReadableStream = __w_pdfjs_require__(143).ReadableStream; + })(); + (function checkMapEntries() { + if (globalThis.Map && globalThis.Map.prototype.entries) { + return; + } -__w_pdfjs_require__(110)('WeakMap'); + globalThis.Map = __w_pdfjs_require__(144); + })(); -/***/ }), -/* 110 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + (function checkSetEntries() { + if (globalThis.Set && globalThis.Set.prototype.entries) { + return; + } -"use strict"; + globalThis.Set = __w_pdfjs_require__(151); + })(); + + (function checkWeakMap() { + if (globalThis.WeakMap) { + return; + } + globalThis.WeakMap = __w_pdfjs_require__(153); + })(); -var $export = __w_pdfjs_require__(7); -var aFunction = __w_pdfjs_require__(24); -var ctx = __w_pdfjs_require__(23); -var forOf = __w_pdfjs_require__(77); -module.exports = function (COLLECTION) { - $export($export.S, COLLECTION, { - from: function from(source) { - var mapFn = arguments[1]; - var mapping, A, n, cb; - aFunction(this); - mapping = mapFn !== undefined; - if (mapping) aFunction(mapFn); - if (source == undefined) return new this(); - A = []; - if (mapping) { - n = 0; - cb = ctx(mapFn, arguments[2], 2); - forOf(source, false, function (nextItem) { - A.push(cb(nextItem, n++)); - }); - } else { - forOf(source, false, A.push, A); - } - return new this(A); + (function checkWeakSet() { + if (globalThis.WeakSet) { + return; } - }); -}; -/***/ }), -/* 111 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + globalThis.WeakSet = __w_pdfjs_require__(159); + })(); -"use strict"; + (function checkStringCodePointAt() { + if (String.prototype.codePointAt) { + return; + } + __w_pdfjs_require__(161); + })(); -__w_pdfjs_require__(112); -module.exports = __w_pdfjs_require__(9).String.codePointAt; + (function checkStringFromCodePoint() { + if (String.fromCodePoint) { + return; + } -/***/ }), -/* 112 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + String.fromCodePoint = __w_pdfjs_require__(163); + })(); -"use strict"; + (function checkSymbol() { + if (globalThis.Symbol) { + return; + } + __w_pdfjs_require__(165); + })(); -var $export = __w_pdfjs_require__(7); -var $at = __w_pdfjs_require__(63)(false); -$export($export.P, 'String', { - codePointAt: function codePointAt(pos) { - return $at(this, pos); - } -}); + (function checkStringPadStart() { + if (String.prototype.padStart) { + return; + } -/***/ }), -/* 113 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + __w_pdfjs_require__(188); + })(); -"use strict"; + (function checkStringPadEnd() { + if (String.prototype.padEnd) { + return; + } + __w_pdfjs_require__(193); + })(); -__w_pdfjs_require__(114); -module.exports = __w_pdfjs_require__(9).String.fromCodePoint; + (function checkObjectValues() { + if (Object.values) { + return; + } + + Object.values = __w_pdfjs_require__(195); + })(); +} /***/ }), -/* 114 */ +/* 7 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var $export = __w_pdfjs_require__(7); -var toAbsoluteIndex = __w_pdfjs_require__(40); -var fromCharCode = String.fromCharCode; -var $fromCodePoint = String.fromCodePoint; -$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { - fromCodePoint: function fromCodePoint(x) { - var res = []; - var aLen = arguments.length; - var i = 0; - var code; - while (aLen > i) { - code = +arguments[i++]; - if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point'); - res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)); - } - return res.join(''); - } +Object.defineProperty(exports, "__esModule", { + value: true }); +exports.isNodeJS = void 0; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +var isNodeJS = (typeof process === "undefined" ? "undefined" : _typeof(process)) === "object" && process + "" === "[object process]" && !process.versions.nw && !process.versions.electron; +exports.isNodeJS = isNodeJS; /***/ }), -/* 115 */ +/* 8 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +__w_pdfjs_require__(9); +module.exports = __w_pdfjs_require__(11); +/***/ }), +/* 9 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -__w_pdfjs_require__(116); -__w_pdfjs_require__(60); -module.exports = __w_pdfjs_require__(9).Symbol; +var $ = __w_pdfjs_require__(10); +var global = __w_pdfjs_require__(11); +$({ global: true }, { globalThis: global }); /***/ }), -/* 116 */ +/* 10 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +var global = __w_pdfjs_require__(11); +var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f; +var createNonEnumerableProperty = __w_pdfjs_require__(26); +var redefine = __w_pdfjs_require__(29); +var setGlobal = __w_pdfjs_require__(30); +var copyConstructorProperties = __w_pdfjs_require__(40); +var isForced = __w_pdfjs_require__(52); +module.exports = function (options, source) { + var TARGET = options.target; + var GLOBAL = options.global; + var STATIC = options.stat; + var FORCED, target, key, targetProperty, sourceProperty, descriptor; + if (GLOBAL) { + target = global; + } else if (STATIC) { + target = global[TARGET] || setGlobal(TARGET, {}); + } else { + target = (global[TARGET] || {}).prototype; + } + if (target) + for (key in source) { + sourceProperty = source[key]; + if (options.noTargetGet) { + descriptor = getOwnPropertyDescriptor(target, key); + targetProperty = descriptor && descriptor.value; + } else + targetProperty = target[key]; + FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); + if (!FORCED && targetProperty !== undefined) { + if (typeof sourceProperty === typeof targetProperty) + continue; + copyConstructorProperties(sourceProperty, targetProperty); + } + if (options.sham || targetProperty && targetProperty.sham) { + createNonEnumerableProperty(sourceProperty, 'sham', true); + } + redefine(target, key, sourceProperty, options); + } +}; +/***/ }), +/* 11 */ +/***/ (function(module, exports) { -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var global = __w_pdfjs_require__(8); -var has = __w_pdfjs_require__(21); -var DESCRIPTORS = __w_pdfjs_require__(15); -var $export = __w_pdfjs_require__(7); -var redefine = __w_pdfjs_require__(20); -var META = __w_pdfjs_require__(100).KEY; -var $fails = __w_pdfjs_require__(16); -var shared = __w_pdfjs_require__(29); -var setToStringTag = __w_pdfjs_require__(70); -var uid = __w_pdfjs_require__(22); -var wks = __w_pdfjs_require__(28); -var wksExt = __w_pdfjs_require__(117); -var wksDefine = __w_pdfjs_require__(118); -var enumKeys = __w_pdfjs_require__(119); -var isArray = __w_pdfjs_require__(99); -var anObject = __w_pdfjs_require__(12); -var isObject = __w_pdfjs_require__(13); -var toIObject = __w_pdfjs_require__(36); -var toPrimitive = __w_pdfjs_require__(18); -var createDesc = __w_pdfjs_require__(19); -var _create = __w_pdfjs_require__(67); -var gOPNExt = __w_pdfjs_require__(120); -var $GOPD = __w_pdfjs_require__(106); -var $DP = __w_pdfjs_require__(11); -var $keys = __w_pdfjs_require__(45); -var gOPD = $GOPD.f; -var dP = $DP.f; -var gOPN = gOPNExt.f; -var $Symbol = global.Symbol; -var $JSON = global.JSON; -var _stringify = $JSON && $JSON.stringify; -var PROTOTYPE = 'prototype'; -var HIDDEN = wks('_hidden'); -var TO_PRIMITIVE = wks('toPrimitive'); -var isEnum = {}.propertyIsEnumerable; -var SymbolRegistry = shared('symbol-registry'); -var AllSymbols = shared('symbols'); -var OPSymbols = shared('op-symbols'); -var ObjectProto = Object[PROTOTYPE]; -var USE_NATIVE = typeof $Symbol == 'function'; -var QObject = global.QObject; -var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; -var setSymbolDesc = DESCRIPTORS && $fails(function () { - return _create(dP({}, 'a', { - get: function get() { - return dP(this, 'a', { value: 7 }).a; - } - })).a != 7; -}) ? function (it, key, D) { - var protoDesc = gOPD(ObjectProto, key); - if (protoDesc) delete ObjectProto[key]; - dP(it, key, D); - if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); -} : dP; -var wrap = function wrap(tag) { - var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); - sym._k = tag; - return sym; +var check = function (it) { + return it && it.Math == Math && it; }; -var isSymbol = USE_NATIVE && _typeof($Symbol.iterator) == 'symbol' ? function (it) { - return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol'; -} : function (it) { - return it instanceof $Symbol; +module.exports = check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || Function('return this')(); + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var DESCRIPTORS = __w_pdfjs_require__(13); +var propertyIsEnumerableModule = __w_pdfjs_require__(15); +var createPropertyDescriptor = __w_pdfjs_require__(16); +var toIndexedObject = __w_pdfjs_require__(17); +var toPrimitive = __w_pdfjs_require__(21); +var has = __w_pdfjs_require__(23); +var IE8_DOM_DEFINE = __w_pdfjs_require__(24); +var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { + O = toIndexedObject(O); + P = toPrimitive(P, true); + if (IE8_DOM_DEFINE) + try { + return nativeGetOwnPropertyDescriptor(O, P); + } catch (error) { + } + if (has(O, P)) + return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); }; -var $defineProperty = function defineProperty(it, key, D) { - if (it === ObjectProto) $defineProperty(OPSymbols, key, D); - anObject(it); - key = toPrimitive(key, true); - anObject(D); - if (has(AllSymbols, key)) { - if (!D.enumerable) { - if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {})); - it[HIDDEN][key] = true; - } else { - if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; - D = _create(D, { enumerable: createDesc(0, false) }); - } - return setSymbolDesc(it, key, D); + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var fails = __w_pdfjs_require__(14); +module.exports = !fails(function () { + return Object.defineProperty({}, 1, { + get: function () { + return 7; } - return dP(it, key, D); + })[1] != 7; +}); + +/***/ }), +/* 14 */ +/***/ (function(module, exports) { + +module.exports = function (exec) { + try { + return !!exec(); + } catch (error) { + return true; + } }; -var $defineProperties = function defineProperties(it, P) { - anObject(it); - var keys = enumKeys(P = toIObject(P)); - var i = 0; - var l = keys.length; - var key; - while (l > i) { - $defineProperty(it, key = keys[i++], P[key]); - }return it; + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var nativePropertyIsEnumerable = {}.propertyIsEnumerable; +var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); +exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { + var descriptor = getOwnPropertyDescriptor(this, V); + return !!descriptor && descriptor.enumerable; +} : nativePropertyIsEnumerable; + +/***/ }), +/* 16 */ +/***/ (function(module, exports) { + +module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; }; -var $create = function create(it, P) { - return P === undefined ? _create(it) : $defineProperties(_create(it), P); + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var IndexedObject = __w_pdfjs_require__(18); +var requireObjectCoercible = __w_pdfjs_require__(20); +module.exports = function (it) { + return IndexedObject(requireObjectCoercible(it)); }; -var $propertyIsEnumerable = function propertyIsEnumerable(key) { - var E = isEnum.call(this, key = toPrimitive(key, true)); - if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false; - return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var fails = __w_pdfjs_require__(14); +var classof = __w_pdfjs_require__(19); +var split = ''.split; +module.exports = fails(function () { + return !Object('z').propertyIsEnumerable(0); +}) ? function (it) { + return classof(it) == 'String' ? split.call(it, '') : Object(it); +} : Object; + +/***/ }), +/* 19 */ +/***/ (function(module, exports) { + +var toString = {}.toString; +module.exports = function (it) { + return toString.call(it).slice(8, -1); }; -var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { - it = toIObject(it); - key = toPrimitive(key, true); - if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return; - var D = gOPD(it, key); - if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; - return D; + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + +module.exports = function (it) { + if (it == undefined) + throw TypeError("Can't call method on " + it); + return it; }; -var $getOwnPropertyNames = function getOwnPropertyNames(it) { - var names = gOPN(toIObject(it)); - var result = []; - var i = 0; - var key; - while (names.length > i) { - if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); - } - return result; + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var isObject = __w_pdfjs_require__(22); +module.exports = function (input, PREFERRED_STRING) { + if (!isObject(input)) + return input; + var fn, val; + if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) + return val; + if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) + return val; + if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) + return val; + throw TypeError("Can't convert object to primitive value"); }; -var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { - var IS_OP = it === ObjectProto; - var names = gOPN(IS_OP ? OPSymbols : toIObject(it)); - var result = []; - var i = 0; - var key; - while (names.length > i) { - if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]); - } - return result; + +/***/ }), +/* 22 */ +/***/ (function(module, exports) { + +module.exports = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; }; -if (!USE_NATIVE) { - $Symbol = function _Symbol() { - if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); - var tag = uid(arguments.length > 0 ? arguments[0] : undefined); - var $set = function $set(value) { - if (this === ObjectProto) $set.call(OPSymbols, value); - if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; - setSymbolDesc(this, tag, createDesc(1, value)); - }; - if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { - configurable: true, - set: $set - }); - return wrap(tag); - }; - redefine($Symbol[PROTOTYPE], 'toString', function toString() { - return this._k; - }); - $GOPD.f = $getOwnPropertyDescriptor; - $DP.f = $defineProperty; - __w_pdfjs_require__(121).f = gOPNExt.f = $getOwnPropertyNames; - __w_pdfjs_require__(50).f = $propertyIsEnumerable; - __w_pdfjs_require__(49).f = $getOwnPropertySymbols; - if (DESCRIPTORS && !__w_pdfjs_require__(30)) { - redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); - } - wksExt.f = function (name) { - return wrap(wks(name)); - }; -} -$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol }); -for (var es6Symbols = 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split(','), j = 0; es6Symbols.length > j;) { - wks(es6Symbols[j++]); -}for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) { - wksDefine(wellKnownSymbols[k++]); -}$export($export.S + $export.F * !USE_NATIVE, 'Symbol', { - 'for': function _for(key) { - return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key); - }, - keyFor: function keyFor(sym) { - if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); - for (var key in SymbolRegistry) { - if (SymbolRegistry[key] === sym) return key; - } - }, - useSetter: function useSetter() { - setter = true; - }, - useSimple: function useSimple() { - setter = false; - } -}); -$export($export.S + $export.F * !USE_NATIVE, 'Object', { - create: $create, - defineProperty: $defineProperty, - defineProperties: $defineProperties, - getOwnPropertyDescriptor: $getOwnPropertyDescriptor, - getOwnPropertyNames: $getOwnPropertyNames, - getOwnPropertySymbols: $getOwnPropertySymbols -}); -$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { - var S = $Symbol(); - return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; -})), 'JSON', { - stringify: function stringify(it) { - var args = [it]; - var i = 1; - var replacer, $replacer; - while (arguments.length > i) { - args.push(arguments[i++]); - }$replacer = replacer = args[1]; - if (!isObject(replacer) && it === undefined || isSymbol(it)) return; - if (!isArray(replacer)) replacer = function replacer(key, value) { - if (typeof $replacer == 'function') value = $replacer.call(this, key, value); - if (!isSymbol(value)) return value; - }; - args[1] = replacer; - return _stringify.apply($JSON, args); + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + +var hasOwnProperty = {}.hasOwnProperty; +module.exports = function (it, key) { + return hasOwnProperty.call(it, key); +}; + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var DESCRIPTORS = __w_pdfjs_require__(13); +var fails = __w_pdfjs_require__(14); +var createElement = __w_pdfjs_require__(25); +module.exports = !DESCRIPTORS && !fails(function () { + return Object.defineProperty(createElement('div'), 'a', { + get: function () { + return 7; } + }).a != 7; }); -$Symbol[PROTOTYPE][TO_PRIMITIVE] || __w_pdfjs_require__(10)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); -setToStringTag($Symbol, 'Symbol'); -setToStringTag(Math, 'Math', true); -setToStringTag(global.JSON, 'JSON', true); /***/ }), -/* 117 */ +/* 25 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +var global = __w_pdfjs_require__(11); +var isObject = __w_pdfjs_require__(22); +var document = global.document; +var EXISTS = isObject(document) && isObject(document.createElement); +module.exports = function (it) { + return EXISTS ? document.createElement(it) : {}; +}; +/***/ }), +/* 26 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -exports.f = __w_pdfjs_require__(28); +var DESCRIPTORS = __w_pdfjs_require__(13); +var definePropertyModule = __w_pdfjs_require__(27); +var createPropertyDescriptor = __w_pdfjs_require__(16); +module.exports = DESCRIPTORS ? function (object, key, value) { + return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; /***/ }), -/* 118 */ +/* 27 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +var DESCRIPTORS = __w_pdfjs_require__(13); +var IE8_DOM_DEFINE = __w_pdfjs_require__(24); +var anObject = __w_pdfjs_require__(28); +var toPrimitive = __w_pdfjs_require__(21); +var nativeDefineProperty = Object.defineProperty; +exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) + try { + return nativeDefineProperty(O, P, Attributes); + } catch (error) { + } + if ('get' in Attributes || 'set' in Attributes) + throw TypeError('Accessors not supported'); + if ('value' in Attributes) + O[P] = Attributes.value; + return O; +}; +/***/ }), +/* 28 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var global = __w_pdfjs_require__(8); -var core = __w_pdfjs_require__(9); -var LIBRARY = __w_pdfjs_require__(30); -var wksExt = __w_pdfjs_require__(117); -var defineProperty = __w_pdfjs_require__(11).f; -module.exports = function (name) { - var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); - if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); +var isObject = __w_pdfjs_require__(22); +module.exports = function (it) { + if (!isObject(it)) { + throw TypeError(String(it) + ' is not an object'); + } + return it; }; /***/ }), -/* 119 */ +/* 29 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +var global = __w_pdfjs_require__(11); +var createNonEnumerableProperty = __w_pdfjs_require__(26); +var has = __w_pdfjs_require__(23); +var setGlobal = __w_pdfjs_require__(30); +var inspectSource = __w_pdfjs_require__(31); +var InternalStateModule = __w_pdfjs_require__(33); +var getInternalState = InternalStateModule.get; +var enforceInternalState = InternalStateModule.enforce; +var TEMPLATE = String(String).split('String'); +(module.exports = function (O, key, value, options) { + var unsafe = options ? !!options.unsafe : false; + var simple = options ? !!options.enumerable : false; + var noTargetGet = options ? !!options.noTargetGet : false; + if (typeof value == 'function') { + if (typeof key == 'string' && !has(value, 'name')) + createNonEnumerableProperty(value, 'name', key); + enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : ''); + } + if (O === global) { + if (simple) + O[key] = value; + else + setGlobal(key, value); + return; + } else if (!unsafe) { + delete O[key]; + } else if (!noTargetGet && O[key]) { + simple = true; + } + if (simple) + O[key] = value; + else + createNonEnumerableProperty(O, key, value); +})(Function.prototype, 'toString', function toString() { + return typeof this == 'function' && getInternalState(this).source || inspectSource(this); +}); +/***/ }), +/* 30 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var getKeys = __w_pdfjs_require__(45); -var gOPS = __w_pdfjs_require__(49); -var pIE = __w_pdfjs_require__(50); -module.exports = function (it) { - var result = getKeys(it); - var getSymbols = gOPS.f; - if (getSymbols) { - var symbols = getSymbols(it); - var isEnum = pIE.f; - var i = 0; - var key; - while (symbols.length > i) { - if (isEnum.call(it, key = symbols[i++])) result.push(key); - } - } - return result; +var global = __w_pdfjs_require__(11); +var createNonEnumerableProperty = __w_pdfjs_require__(26); +module.exports = function (key, value) { + try { + createNonEnumerableProperty(global, key, value); + } catch (error) { + global[key] = value; + } + return value; }; /***/ }), -/* 120 */ +/* 31 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +var store = __w_pdfjs_require__(32); +var functionToString = Function.toString; +if (typeof store.inspectSource != 'function') { + store.inspectSource = function (it) { + return functionToString.call(it); + }; +} +module.exports = store.inspectSource; + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __w_pdfjs_require__) { +var global = __w_pdfjs_require__(11); +var setGlobal = __w_pdfjs_require__(30); +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || setGlobal(SHARED, {}); +module.exports = store; -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +/***/ }), +/* 33 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var toIObject = __w_pdfjs_require__(36); -var gOPN = __w_pdfjs_require__(121).f; -var toString = {}.toString; -var windowNames = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; -var getWindowNames = function getWindowNames(it) { - try { - return gOPN(it); - } catch (e) { - return windowNames.slice(); - } +var NATIVE_WEAK_MAP = __w_pdfjs_require__(34); +var global = __w_pdfjs_require__(11); +var isObject = __w_pdfjs_require__(22); +var createNonEnumerableProperty = __w_pdfjs_require__(26); +var objectHas = __w_pdfjs_require__(23); +var sharedKey = __w_pdfjs_require__(35); +var hiddenKeys = __w_pdfjs_require__(39); +var WeakMap = global.WeakMap; +var set, get, has; +var enforce = function (it) { + return has(it) ? get(it) : set(it, {}); }; -module.exports.f = function getOwnPropertyNames(it) { - return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); +var getterFor = function (TYPE) { + return function (it) { + var state; + if (!isObject(it) || (state = get(it)).type !== TYPE) { + throw TypeError('Incompatible receiver, ' + TYPE + ' required'); + } + return state; + }; +}; +if (NATIVE_WEAK_MAP) { + var store = new WeakMap(); + var wmget = store.get; + var wmhas = store.has; + var wmset = store.set; + set = function (it, metadata) { + wmset.call(store, it, metadata); + return metadata; + }; + get = function (it) { + return wmget.call(store, it) || {}; + }; + has = function (it) { + return wmhas.call(store, it); + }; +} else { + var STATE = sharedKey('state'); + hiddenKeys[STATE] = true; + set = function (it, metadata) { + createNonEnumerableProperty(it, STATE, metadata); + return metadata; + }; + get = function (it) { + return objectHas(it, STATE) ? it[STATE] : {}; + }; + has = function (it) { + return objectHas(it, STATE); + }; +} +module.exports = { + set: set, + get: get, + has: has, + enforce: enforce, + getterFor: getterFor }; /***/ }), -/* 121 */ +/* 34 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +var global = __w_pdfjs_require__(11); +var inspectSource = __w_pdfjs_require__(31); +var WeakMap = global.WeakMap; +module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap)); +/***/ }), +/* 35 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var $keys = __w_pdfjs_require__(46); -var hiddenKeys = __w_pdfjs_require__(48).concat('length', 'prototype'); -exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { - return $keys(O, hiddenKeys); +var shared = __w_pdfjs_require__(36); +var uid = __w_pdfjs_require__(38); +var keys = shared('keys'); +module.exports = function (key) { + return keys[key] || (keys[key] = uid(key)); }; /***/ }), -/* 122 */ +/* 36 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +var IS_PURE = __w_pdfjs_require__(37); +var store = __w_pdfjs_require__(32); +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: '3.6.5', + mode: IS_PURE ? 'pure' : 'global', + copyright: '© 2020 Denis Pushkarev (zloirock.ru)' +}); +/***/ }), +/* 37 */ +/***/ (function(module, exports) { -__w_pdfjs_require__(123); -module.exports = __w_pdfjs_require__(9).Object.values; +module.exports = false; /***/ }), -/* 123 */ +/* 38 */ +/***/ (function(module, exports) { + +var id = 0; +var postfix = Math.random(); +module.exports = function (key) { + return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); +}; + +/***/ }), +/* 39 */ +/***/ (function(module, exports) { + +module.exports = {}; + +/***/ }), +/* 40 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +var has = __w_pdfjs_require__(23); +var ownKeys = __w_pdfjs_require__(41); +var getOwnPropertyDescriptorModule = __w_pdfjs_require__(12); +var definePropertyModule = __w_pdfjs_require__(27); +module.exports = function (target, source) { + var keys = ownKeys(source); + var defineProperty = definePropertyModule.f; + var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (!has(target, key)) + defineProperty(target, key, getOwnPropertyDescriptor(source, key)); + } +}; + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __w_pdfjs_require__) { +var getBuiltIn = __w_pdfjs_require__(42); +var getOwnPropertyNamesModule = __w_pdfjs_require__(44); +var getOwnPropertySymbolsModule = __w_pdfjs_require__(51); +var anObject = __w_pdfjs_require__(28); +module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { + var keys = getOwnPropertyNamesModule.f(anObject(it)); + var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; + return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; +}; -var $export = __w_pdfjs_require__(7); -var $values = __w_pdfjs_require__(124)(false); -$export($export.S, 'Object', { - values: function values(it) { - return $values(it); - } -}); +/***/ }), +/* 42 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var path = __w_pdfjs_require__(43); +var global = __w_pdfjs_require__(11); +var aFunction = function (variable) { + return typeof variable == 'function' ? variable : undefined; +}; +module.exports = function (namespace, method) { + return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method]; +}; /***/ }), -/* 124 */ +/* 43 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +var global = __w_pdfjs_require__(11); +module.exports = global; +/***/ }), +/* 44 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var getKeys = __w_pdfjs_require__(45); -var toIObject = __w_pdfjs_require__(36); -var isEnum = __w_pdfjs_require__(50).f; -module.exports = function (isEntries) { - return function (it) { - var O = toIObject(it); - var keys = getKeys(O); - var length = keys.length; - var i = 0; - var result = []; - var key; - while (length > i) { - if (isEnum.call(O, key = keys[i++])) { - result.push(isEntries ? [key, O[key]] : O[key]); - } - }return result; - }; +var internalObjectKeys = __w_pdfjs_require__(45); +var enumBugKeys = __w_pdfjs_require__(50); +var hiddenKeys = enumBugKeys.concat('length', 'prototype'); +exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return internalObjectKeys(O, hiddenKeys); }; /***/ }), -/* 125 */ +/* 45 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +var has = __w_pdfjs_require__(23); +var toIndexedObject = __w_pdfjs_require__(17); +var indexOf = __w_pdfjs_require__(46).indexOf; +var hiddenKeys = __w_pdfjs_require__(39); +module.exports = function (object, names) { + var O = toIndexedObject(object); + var i = 0; + var result = []; + var key; + for (key in O) + !has(hiddenKeys, key) && has(O, key) && result.push(key); + while (names.length > i) + if (has(O, key = names[i++])) { + ~indexOf(result, key) || result.push(key); + } + return result; +}; +/***/ }), +/* 46 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var isReadableStreamSupported = false; -if (typeof ReadableStream !== 'undefined') { - try { - new ReadableStream({ - start: function start(controller) { - controller.close(); - } - }); - isReadableStreamSupported = true; - } catch (e) {} -} -if (isReadableStreamSupported) { - exports.ReadableStream = ReadableStream; -} else { - exports.ReadableStream = __w_pdfjs_require__(126).ReadableStream; -} +var toIndexedObject = __w_pdfjs_require__(17); +var toLength = __w_pdfjs_require__(47); +var toAbsoluteIndex = __w_pdfjs_require__(49); +var createMethod = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIndexedObject($this); + var length = toLength(O.length); + var index = toAbsoluteIndex(fromIndex, length); + var value; + if (IS_INCLUDES && el != el) + while (length > index) { + value = O[index++]; + if (value != value) + return true; + } + else + for (; length > index; index++) { + if ((IS_INCLUDES || index in O) && O[index] === el) + return IS_INCLUDES || index || 0; + } + return !IS_INCLUDES && -1; + }; +}; +module.exports = { + includes: createMethod(true), + indexOf: createMethod(false) +}; /***/ }), -/* 126 */ +/* 47 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; +var toInteger = __w_pdfjs_require__(48); +var min = Math.min; +module.exports = function (argument) { + return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; +}; +/***/ }), +/* 48 */ +/***/ (function(module, exports) { -var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +var ceil = Math.ceil; +var floor = Math.floor; +module.exports = function (argument) { + return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); +}; -(function (e, a) { - for (var i in a) { - e[i] = a[i]; - } -})(exports, function (modules) { - var installedModules = {}; - function __w_pdfjs_require__(moduleId) { - if (installedModules[moduleId]) return installedModules[moduleId].exports; - var module = installedModules[moduleId] = { - i: moduleId, - l: false, - exports: {} - }; - modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__); - module.l = true; - return module.exports; - } - __w_pdfjs_require__.m = modules; - __w_pdfjs_require__.c = installedModules; - __w_pdfjs_require__.i = function (value) { - return value; - }; - __w_pdfjs_require__.d = function (exports, name, getter) { - if (!__w_pdfjs_require__.o(exports, name)) { - Object.defineProperty(exports, name, { - configurable: false, - enumerable: true, - get: getter - }); - } - }; - __w_pdfjs_require__.n = function (module) { - var getter = module && module.__esModule ? function getDefault() { - return module['default']; - } : function getModuleExports() { - return module; - }; - __w_pdfjs_require__.d(getter, 'a', getter); - return getter; - }; - __w_pdfjs_require__.o = function (object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; - __w_pdfjs_require__.p = ""; - return __w_pdfjs_require__(__w_pdfjs_require__.s = 7); -}([function (module, exports, __w_pdfjs_require__) { - "use strict"; +/***/ }), +/* 49 */ +/***/ (function(module, exports, __w_pdfjs_require__) { - var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) { - return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj); - } : function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj); - }; - var _require = __w_pdfjs_require__(1), - assert = _require.assert; - function IsPropertyKey(argument) { - return typeof argument === 'string' || (typeof argument === 'undefined' ? 'undefined' : _typeof(argument)) === 'symbol'; - } - exports.typeIsObject = function (x) { - return (typeof x === 'undefined' ? 'undefined' : _typeof(x)) === 'object' && x !== null || typeof x === 'function'; - }; - exports.createDataProperty = function (o, p, v) { - assert(exports.typeIsObject(o)); - Object.defineProperty(o, p, { - value: v, - writable: true, - enumerable: true, - configurable: true - }); +var toInteger = __w_pdfjs_require__(48); +var max = Math.max; +var min = Math.min; +module.exports = function (index, length) { + var integer = toInteger(index); + return integer < 0 ? max(integer + length, 0) : min(integer, length); +}; + +/***/ }), +/* 50 */ +/***/ (function(module, exports) { + +module.exports = [ + 'constructor', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'toLocaleString', + 'toString', + 'valueOf' +]; + +/***/ }), +/* 51 */ +/***/ (function(module, exports) { + +exports.f = Object.getOwnPropertySymbols; + +/***/ }), +/* 52 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var fails = __w_pdfjs_require__(14); +var replacement = /#|\.prototype\./; +var isForced = function (feature, detection) { + var value = data[normalize(feature)]; + return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection; +}; +var normalize = isForced.normalize = function (string) { + return String(string).replace(replacement, '.').toLowerCase(); +}; +var data = isForced.data = {}; +var NATIVE = isForced.NATIVE = 'N'; +var POLYFILL = isForced.POLYFILL = 'P'; +module.exports = isForced; + +/***/ }), +/* 53 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(54); +var entryUnbind = __w_pdfjs_require__(61); +module.exports = entryUnbind('String', 'startsWith'); + +/***/ }), +/* 54 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f; +var toLength = __w_pdfjs_require__(47); +var notARegExp = __w_pdfjs_require__(55); +var requireObjectCoercible = __w_pdfjs_require__(20); +var correctIsRegExpLogic = __w_pdfjs_require__(60); +var IS_PURE = __w_pdfjs_require__(37); +var nativeStartsWith = ''.startsWith; +var min = Math.min; +var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith'); +var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () { + var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith'); + return descriptor && !descriptor.writable; +}(); +$({ + target: 'String', + proto: true, + forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC +}, { + startsWith: function startsWith(searchString) { + var that = String(requireObjectCoercible(this)); + notARegExp(searchString); + var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length)); + var search = String(searchString); + return nativeStartsWith ? nativeStartsWith.call(that, search, index) : that.slice(index, index + search.length) === search; + } +}); + +/***/ }), +/* 55 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var isRegExp = __w_pdfjs_require__(56); +module.exports = function (it) { + if (isRegExp(it)) { + throw TypeError("The method doesn't accept regular expressions"); + } + return it; +}; + +/***/ }), +/* 56 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var isObject = __w_pdfjs_require__(22); +var classof = __w_pdfjs_require__(19); +var wellKnownSymbol = __w_pdfjs_require__(57); +var MATCH = wellKnownSymbol('match'); +module.exports = function (it) { + var isRegExp; + return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp'); +}; + +/***/ }), +/* 57 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var global = __w_pdfjs_require__(11); +var shared = __w_pdfjs_require__(36); +var has = __w_pdfjs_require__(23); +var uid = __w_pdfjs_require__(38); +var NATIVE_SYMBOL = __w_pdfjs_require__(58); +var USE_SYMBOL_AS_UID = __w_pdfjs_require__(59); +var WellKnownSymbolsStore = shared('wks'); +var Symbol = global.Symbol; +var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid; +module.exports = function (name) { + if (!has(WellKnownSymbolsStore, name)) { + if (NATIVE_SYMBOL && has(Symbol, name)) + WellKnownSymbolsStore[name] = Symbol[name]; + else + WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); + } + return WellKnownSymbolsStore[name]; +}; + +/***/ }), +/* 58 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var fails = __w_pdfjs_require__(14); +module.exports = !!Object.getOwnPropertySymbols && !fails(function () { + return !String(Symbol()); +}); + +/***/ }), +/* 59 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var NATIVE_SYMBOL = __w_pdfjs_require__(58); +module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol'; + +/***/ }), +/* 60 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var wellKnownSymbol = __w_pdfjs_require__(57); +var MATCH = wellKnownSymbol('match'); +module.exports = function (METHOD_NAME) { + var regexp = /./; + try { + '/./'[METHOD_NAME](regexp); + } catch (e) { + try { + regexp[MATCH] = false; + return '/./'[METHOD_NAME](regexp); + } catch (f) { + } + } + return false; +}; + +/***/ }), +/* 61 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var global = __w_pdfjs_require__(11); +var bind = __w_pdfjs_require__(62); +var call = Function.call; +module.exports = function (CONSTRUCTOR, METHOD, length) { + return bind(call, global[CONSTRUCTOR].prototype[METHOD], length); +}; + +/***/ }), +/* 62 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var aFunction = __w_pdfjs_require__(63); +module.exports = function (fn, that, length) { + aFunction(fn); + if (that === undefined) + return fn; + switch (length) { + case 0: + return function () { + return fn.call(that); }; - exports.createArrayFromList = function (elements) { - return elements.slice(); + case 1: + return function (a) { + return fn.call(that, a); }; - exports.ArrayBufferCopy = function (dest, destOffset, src, srcOffset, n) { - new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset); + case 2: + return function (a, b) { + return fn.call(that, a, b); }; - exports.CreateIterResultObject = function (value, done) { - assert(typeof done === 'boolean'); - var obj = {}; - Object.defineProperty(obj, 'value', { - value: value, - enumerable: true, - writable: true, - configurable: true - }); - Object.defineProperty(obj, 'done', { - value: done, - enumerable: true, - writable: true, - configurable: true - }); - return obj; + case 3: + return function (a, b, c) { + return fn.call(that, a, b, c); }; - exports.IsFiniteNonNegativeNumber = function (v) { - if (Number.isNaN(v)) { - return false; - } - if (v === Infinity) { - return false; - } - if (v < 0) { - return false; - } - return true; + } + return function () { + return fn.apply(that, arguments); + }; +}; + +/***/ }), +/* 63 */ +/***/ (function(module, exports) { + +module.exports = function (it) { + if (typeof it != 'function') { + throw TypeError(String(it) + ' is not a function'); + } + return it; +}; + +/***/ }), +/* 64 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(65); +var entryUnbind = __w_pdfjs_require__(61); +module.exports = entryUnbind('String', 'endsWith'); + +/***/ }), +/* 65 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f; +var toLength = __w_pdfjs_require__(47); +var notARegExp = __w_pdfjs_require__(55); +var requireObjectCoercible = __w_pdfjs_require__(20); +var correctIsRegExpLogic = __w_pdfjs_require__(60); +var IS_PURE = __w_pdfjs_require__(37); +var nativeEndsWith = ''.endsWith; +var min = Math.min; +var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('endsWith'); +var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () { + var descriptor = getOwnPropertyDescriptor(String.prototype, 'endsWith'); + return descriptor && !descriptor.writable; +}(); +$({ + target: 'String', + proto: true, + forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC +}, { + endsWith: function endsWith(searchString) { + var that = String(requireObjectCoercible(this)); + notARegExp(searchString); + var endPosition = arguments.length > 1 ? arguments[1] : undefined; + var len = toLength(that.length); + var end = endPosition === undefined ? len : min(toLength(endPosition), len); + var search = String(searchString); + return nativeEndsWith ? nativeEndsWith.call(that, search, end) : that.slice(end - search.length, end) === search; + } +}); + +/***/ }), +/* 66 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(67); +var entryUnbind = __w_pdfjs_require__(61); +module.exports = entryUnbind('String', 'includes'); + +/***/ }), +/* 67 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var notARegExp = __w_pdfjs_require__(55); +var requireObjectCoercible = __w_pdfjs_require__(20); +var correctIsRegExpLogic = __w_pdfjs_require__(60); +$({ + target: 'String', + proto: true, + forced: !correctIsRegExpLogic('includes') +}, { + includes: function includes(searchString) { + return !!~String(requireObjectCoercible(this)).indexOf(notARegExp(searchString), arguments.length > 1 ? arguments[1] : undefined); + } +}); + +/***/ }), +/* 68 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(69); +var entryUnbind = __w_pdfjs_require__(61); +module.exports = entryUnbind('Array', 'includes'); + +/***/ }), +/* 69 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var $includes = __w_pdfjs_require__(46).includes; +var addToUnscopables = __w_pdfjs_require__(70); +var arrayMethodUsesToLength = __w_pdfjs_require__(75); +var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { + ACCESSORS: true, + 1: 0 +}); +$({ + target: 'Array', + proto: true, + forced: !USES_TO_LENGTH +}, { + includes: function includes(el) { + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + } +}); +addToUnscopables('includes'); + +/***/ }), +/* 70 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var wellKnownSymbol = __w_pdfjs_require__(57); +var create = __w_pdfjs_require__(71); +var definePropertyModule = __w_pdfjs_require__(27); +var UNSCOPABLES = wellKnownSymbol('unscopables'); +var ArrayPrototype = Array.prototype; +if (ArrayPrototype[UNSCOPABLES] == undefined) { + definePropertyModule.f(ArrayPrototype, UNSCOPABLES, { + configurable: true, + value: create(null) + }); +} +module.exports = function (key) { + ArrayPrototype[UNSCOPABLES][key] = true; +}; + +/***/ }), +/* 71 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var anObject = __w_pdfjs_require__(28); +var defineProperties = __w_pdfjs_require__(72); +var enumBugKeys = __w_pdfjs_require__(50); +var hiddenKeys = __w_pdfjs_require__(39); +var html = __w_pdfjs_require__(74); +var documentCreateElement = __w_pdfjs_require__(25); +var sharedKey = __w_pdfjs_require__(35); +var GT = '>'; +var LT = '<'; +var PROTOTYPE = 'prototype'; +var SCRIPT = 'script'; +var IE_PROTO = sharedKey('IE_PROTO'); +var EmptyConstructor = function () { +}; +var scriptTag = function (content) { + return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; +}; +var NullProtoObjectViaActiveX = function (activeXDocument) { + activeXDocument.write(scriptTag('')); + activeXDocument.close(); + var temp = activeXDocument.parentWindow.Object; + activeXDocument = null; + return temp; +}; +var NullProtoObjectViaIFrame = function () { + var iframe = documentCreateElement('iframe'); + var JS = 'java' + SCRIPT + ':'; + var iframeDocument; + iframe.style.display = 'none'; + html.appendChild(iframe); + iframe.src = String(JS); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(scriptTag('document.F=Object')); + iframeDocument.close(); + return iframeDocument.F; +}; +var activeXDocument; +var NullProtoObject = function () { + try { + activeXDocument = document.domain && new ActiveXObject('htmlfile'); + } catch (error) { + } + NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame(); + var length = enumBugKeys.length; + while (length--) + delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; + return NullProtoObject(); +}; +hiddenKeys[IE_PROTO] = true; +module.exports = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + EmptyConstructor[PROTOTYPE] = anObject(O); + result = new EmptyConstructor(); + EmptyConstructor[PROTOTYPE] = null; + result[IE_PROTO] = O; + } else + result = NullProtoObject(); + return Properties === undefined ? result : defineProperties(result, Properties); +}; + +/***/ }), +/* 72 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var DESCRIPTORS = __w_pdfjs_require__(13); +var definePropertyModule = __w_pdfjs_require__(27); +var anObject = __w_pdfjs_require__(28); +var objectKeys = __w_pdfjs_require__(73); +module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = objectKeys(Properties); + var length = keys.length; + var index = 0; + var key; + while (length > index) + definePropertyModule.f(O, key = keys[index++], Properties[key]); + return O; +}; + +/***/ }), +/* 73 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var internalObjectKeys = __w_pdfjs_require__(45); +var enumBugKeys = __w_pdfjs_require__(50); +module.exports = Object.keys || function keys(O) { + return internalObjectKeys(O, enumBugKeys); +}; + +/***/ }), +/* 74 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var getBuiltIn = __w_pdfjs_require__(42); +module.exports = getBuiltIn('document', 'documentElement'); + +/***/ }), +/* 75 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var DESCRIPTORS = __w_pdfjs_require__(13); +var fails = __w_pdfjs_require__(14); +var has = __w_pdfjs_require__(23); +var defineProperty = Object.defineProperty; +var cache = {}; +var thrower = function (it) { + throw it; +}; +module.exports = function (METHOD_NAME, options) { + if (has(cache, METHOD_NAME)) + return cache[METHOD_NAME]; + if (!options) + options = {}; + var method = [][METHOD_NAME]; + var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false; + var argument0 = has(options, 0) ? options[0] : thrower; + var argument1 = has(options, 1) ? options[1] : undefined; + return cache[METHOD_NAME] = !!method && !fails(function () { + if (ACCESSORS && !DESCRIPTORS) + return true; + var O = { length: -1 }; + if (ACCESSORS) + defineProperty(O, 1, { + enumerable: true, + get: thrower + }); + else + O[1] = 1; + method.call(O, argument0, argument1); + }); +}; + +/***/ }), +/* 76 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(77); +__w_pdfjs_require__(89); +var path = __w_pdfjs_require__(43); +module.exports = path.Array.from; + +/***/ }), +/* 77 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var charAt = __w_pdfjs_require__(78).charAt; +var InternalStateModule = __w_pdfjs_require__(33); +var defineIterator = __w_pdfjs_require__(79); +var STRING_ITERATOR = 'String Iterator'; +var setInternalState = InternalStateModule.set; +var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); +defineIterator(String, 'String', function (iterated) { + setInternalState(this, { + type: STRING_ITERATOR, + string: String(iterated), + index: 0 + }); +}, function next() { + var state = getInternalState(this); + var string = state.string; + var index = state.index; + var point; + if (index >= string.length) + return { + value: undefined, + done: true }; - function Call(F, V, args) { - if (typeof F !== 'function') { - throw new TypeError('Argument is not a function'); - } - return Function.prototype.apply.call(F, V, args); + point = charAt(string, index); + state.index += point.length; + return { + value: point, + done: false + }; +}); + +/***/ }), +/* 78 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var toInteger = __w_pdfjs_require__(48); +var requireObjectCoercible = __w_pdfjs_require__(20); +var createMethod = function (CONVERT_TO_STRING) { + return function ($this, pos) { + var S = String(requireObjectCoercible($this)); + var position = toInteger(pos); + var size = S.length; + var first, second; + if (position < 0 || position >= size) + return CONVERT_TO_STRING ? '' : undefined; + first = S.charCodeAt(position); + return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; + }; +}; +module.exports = { + codeAt: createMethod(false), + charAt: createMethod(true) +}; + +/***/ }), +/* 79 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var createIteratorConstructor = __w_pdfjs_require__(80); +var getPrototypeOf = __w_pdfjs_require__(82); +var setPrototypeOf = __w_pdfjs_require__(87); +var setToStringTag = __w_pdfjs_require__(85); +var createNonEnumerableProperty = __w_pdfjs_require__(26); +var redefine = __w_pdfjs_require__(29); +var wellKnownSymbol = __w_pdfjs_require__(57); +var IS_PURE = __w_pdfjs_require__(37); +var Iterators = __w_pdfjs_require__(86); +var IteratorsCore = __w_pdfjs_require__(81); +var IteratorPrototype = IteratorsCore.IteratorPrototype; +var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; +var ITERATOR = wellKnownSymbol('iterator'); +var KEYS = 'keys'; +var VALUES = 'values'; +var ENTRIES = 'entries'; +var returnThis = function () { + return this; +}; +module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { + createIteratorConstructor(IteratorConstructor, NAME, next); + var getIterationMethod = function (KIND) { + if (KIND === DEFAULT && defaultIterator) + return defaultIterator; + if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) + return IterablePrototype[KIND]; + switch (KIND) { + case KEYS: + return function keys() { + return new IteratorConstructor(this, KIND); + }; + case VALUES: + return function values() { + return new IteratorConstructor(this, KIND); + }; + case ENTRIES: + return function entries() { + return new IteratorConstructor(this, KIND); + }; } - exports.InvokeOrNoop = function (O, P, args) { - assert(O !== undefined); - assert(IsPropertyKey(P)); - assert(Array.isArray(args)); - var method = O[P]; - if (method === undefined) { - return undefined; - } - return Call(method, O, args); - }; - exports.PromiseInvokeOrNoop = function (O, P, args) { - assert(O !== undefined); - assert(IsPropertyKey(P)); - assert(Array.isArray(args)); - try { - return Promise.resolve(exports.InvokeOrNoop(O, P, args)); - } catch (returnValueE) { - return Promise.reject(returnValueE); - } - }; - exports.PromiseInvokeOrPerformFallback = function (O, P, args, F, argsF) { - assert(O !== undefined); - assert(IsPropertyKey(P)); - assert(Array.isArray(args)); - assert(Array.isArray(argsF)); - var method = void 0; - try { - method = O[P]; - } catch (methodE) { - return Promise.reject(methodE); - } - if (method === undefined) { - return F.apply(null, argsF); - } - try { - return Promise.resolve(Call(method, O, args)); - } catch (e) { - return Promise.reject(e); - } - }; - exports.TransferArrayBuffer = function (O) { - return O.slice(); + return function () { + return new IteratorConstructor(this); }; - exports.ValidateAndNormalizeHighWaterMark = function (highWaterMark) { - highWaterMark = Number(highWaterMark); - if (Number.isNaN(highWaterMark) || highWaterMark < 0) { - throw new RangeError('highWaterMark property of a queuing strategy must be non-negative and non-NaN'); - } - return highWaterMark; + }; + var TO_STRING_TAG = NAME + ' Iterator'; + var INCORRECT_VALUES_NAME = false; + var IterablePrototype = Iterable.prototype; + var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT]; + var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); + var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; + var CurrentIteratorPrototype, methods, KEY; + if (anyNativeIterator) { + CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); + if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { + if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { + if (setPrototypeOf) { + setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); + } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') { + createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis); + } + } + setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); + if (IS_PURE) + Iterators[TO_STRING_TAG] = returnThis; + } + } + if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { + INCORRECT_VALUES_NAME = true; + defaultIterator = function values() { + return nativeIterator.call(this); }; - exports.ValidateAndNormalizeQueuingStrategy = function (size, highWaterMark) { - if (size !== undefined && typeof size !== 'function') { - throw new TypeError('size property of a queuing strategy must be a function'); - } - highWaterMark = exports.ValidateAndNormalizeHighWaterMark(highWaterMark); - return { - size: size, - highWaterMark: highWaterMark - }; + } + if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { + createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator); + } + Iterators[NAME] = defaultIterator; + if (DEFAULT) { + methods = { + values: getIterationMethod(VALUES), + keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), + entries: getIterationMethod(ENTRIES) }; -}, function (module, exports, __w_pdfjs_require__) { - "use strict"; + if (FORCED) + for (KEY in methods) { + if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { + redefine(IterablePrototype, KEY, methods[KEY]); + } + } + else + $({ + target: NAME, + proto: true, + forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME + }, methods); + } + return methods; +}; - function rethrowAssertionErrorRejection(e) { - if (e && e.constructor === AssertionError) { - setTimeout(function () { - throw e; - }, 0); - } - } - function AssertionError(message) { - this.name = 'AssertionError'; - this.message = message || ''; - this.stack = new Error().stack; - } - AssertionError.prototype = Object.create(Error.prototype); - AssertionError.prototype.constructor = AssertionError; - function assert(value, message) { - if (!value) { - throw new AssertionError(message); - } - } - module.exports = { - rethrowAssertionErrorRejection: rethrowAssertionErrorRejection, - AssertionError: AssertionError, - assert: assert - }; -}, function (module, exports, __w_pdfjs_require__) { - "use strict"; +/***/ }), +/* 80 */ +/***/ (function(module, exports, __w_pdfjs_require__) { - var _createClass = function () { - function defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - return function (Constructor, protoProps, staticProps) { - if (protoProps) defineProperties(Constructor.prototype, protoProps); - if (staticProps) defineProperties(Constructor, staticProps); - return Constructor; - }; - }(); - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - var _require = __w_pdfjs_require__(0), - InvokeOrNoop = _require.InvokeOrNoop, - PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop, - ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy, - typeIsObject = _require.typeIsObject; - var _require2 = __w_pdfjs_require__(1), - assert = _require2.assert, - rethrowAssertionErrorRejection = _require2.rethrowAssertionErrorRejection; - var _require3 = __w_pdfjs_require__(3), - DequeueValue = _require3.DequeueValue, - EnqueueValueWithSize = _require3.EnqueueValueWithSize, - PeekQueueValue = _require3.PeekQueueValue, - ResetQueue = _require3.ResetQueue; - var WritableStream = function () { - function WritableStream() { - var underlyingSink = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - size = _ref.size, - _ref$highWaterMark = _ref.highWaterMark, - highWaterMark = _ref$highWaterMark === undefined ? 1 : _ref$highWaterMark; - _classCallCheck(this, WritableStream); - this._state = 'writable'; - this._storedError = undefined; - this._writer = undefined; - this._writableStreamController = undefined; - this._writeRequests = []; - this._inFlightWriteRequest = undefined; - this._closeRequest = undefined; - this._inFlightCloseRequest = undefined; - this._pendingAbortRequest = undefined; - this._backpressure = false; - var type = underlyingSink.type; - if (type !== undefined) { - throw new RangeError('Invalid type is specified'); - } - this._writableStreamController = new WritableStreamDefaultController(this, underlyingSink, size, highWaterMark); - this._writableStreamController.__startSteps(); - } - _createClass(WritableStream, [{ - key: 'abort', - value: function abort(reason) { - if (IsWritableStream(this) === false) { - return Promise.reject(streamBrandCheckException('abort')); - } - if (IsWritableStreamLocked(this) === true) { - return Promise.reject(new TypeError('Cannot abort a stream that already has a writer')); - } - return WritableStreamAbort(this, reason); - } - }, { - key: 'getWriter', - value: function getWriter() { - if (IsWritableStream(this) === false) { - throw streamBrandCheckException('getWriter'); - } - return AcquireWritableStreamDefaultWriter(this); - } - }, { - key: 'locked', - get: function get() { - if (IsWritableStream(this) === false) { - throw streamBrandCheckException('locked'); - } - return IsWritableStreamLocked(this); - } - }]); - return WritableStream; - }(); - module.exports = { - AcquireWritableStreamDefaultWriter: AcquireWritableStreamDefaultWriter, - IsWritableStream: IsWritableStream, - IsWritableStreamLocked: IsWritableStreamLocked, - WritableStream: WritableStream, - WritableStreamAbort: WritableStreamAbort, - WritableStreamDefaultControllerError: WritableStreamDefaultControllerError, - WritableStreamDefaultWriterCloseWithErrorPropagation: WritableStreamDefaultWriterCloseWithErrorPropagation, - WritableStreamDefaultWriterRelease: WritableStreamDefaultWriterRelease, - WritableStreamDefaultWriterWrite: WritableStreamDefaultWriterWrite, - WritableStreamCloseQueuedOrInFlight: WritableStreamCloseQueuedOrInFlight +"use strict"; + +var IteratorPrototype = __w_pdfjs_require__(81).IteratorPrototype; +var create = __w_pdfjs_require__(71); +var createPropertyDescriptor = __w_pdfjs_require__(16); +var setToStringTag = __w_pdfjs_require__(85); +var Iterators = __w_pdfjs_require__(86); +var returnThis = function () { + return this; +}; +module.exports = function (IteratorConstructor, NAME, next) { + var TO_STRING_TAG = NAME + ' Iterator'; + IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) }); + setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true); + Iterators[TO_STRING_TAG] = returnThis; + return IteratorConstructor; +}; + +/***/ }), +/* 81 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var getPrototypeOf = __w_pdfjs_require__(82); +var createNonEnumerableProperty = __w_pdfjs_require__(26); +var has = __w_pdfjs_require__(23); +var wellKnownSymbol = __w_pdfjs_require__(57); +var IS_PURE = __w_pdfjs_require__(37); +var ITERATOR = wellKnownSymbol('iterator'); +var BUGGY_SAFARI_ITERATORS = false; +var returnThis = function () { + return this; +}; +var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; +if ([].keys) { + arrayIterator = [].keys(); + if (!('next' in arrayIterator)) + BUGGY_SAFARI_ITERATORS = true; + else { + PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); + if (PrototypeOfArrayIteratorPrototype !== Object.prototype) + IteratorPrototype = PrototypeOfArrayIteratorPrototype; + } +} +if (IteratorPrototype == undefined) + IteratorPrototype = {}; +if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) { + createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis); +} +module.exports = { + IteratorPrototype: IteratorPrototype, + BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS +}; + +/***/ }), +/* 82 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var has = __w_pdfjs_require__(23); +var toObject = __w_pdfjs_require__(83); +var sharedKey = __w_pdfjs_require__(35); +var CORRECT_PROTOTYPE_GETTER = __w_pdfjs_require__(84); +var IE_PROTO = sharedKey('IE_PROTO'); +var ObjectPrototype = Object.prototype; +module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) { + O = toObject(O); + if (has(O, IE_PROTO)) + return O[IE_PROTO]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + } + return O instanceof Object ? ObjectPrototype : null; +}; + +/***/ }), +/* 83 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var requireObjectCoercible = __w_pdfjs_require__(20); +module.exports = function (argument) { + return Object(requireObjectCoercible(argument)); +}; + +/***/ }), +/* 84 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var fails = __w_pdfjs_require__(14); +module.exports = !fails(function () { + function F() { + } + F.prototype.constructor = null; + return Object.getPrototypeOf(new F()) !== F.prototype; +}); + +/***/ }), +/* 85 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineProperty = __w_pdfjs_require__(27).f; +var has = __w_pdfjs_require__(23); +var wellKnownSymbol = __w_pdfjs_require__(57); +var TO_STRING_TAG = wellKnownSymbol('toStringTag'); +module.exports = function (it, TAG, STATIC) { + if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { + defineProperty(it, TO_STRING_TAG, { + configurable: true, + value: TAG + }); + } +}; + +/***/ }), +/* 86 */ +/***/ (function(module, exports) { + +module.exports = {}; + +/***/ }), +/* 87 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var anObject = __w_pdfjs_require__(28); +var aPossiblePrototype = __w_pdfjs_require__(88); +module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { + var CORRECT_SETTER = false; + var test = {}; + var setter; + try { + setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; + setter.call(test, []); + CORRECT_SETTER = test instanceof Array; + } catch (error) { + } + return function setPrototypeOf(O, proto) { + anObject(O); + aPossiblePrototype(proto); + if (CORRECT_SETTER) + setter.call(O, proto); + else + O.__proto__ = proto; + return O; + }; +}() : undefined); + +/***/ }), +/* 88 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var isObject = __w_pdfjs_require__(22); +module.exports = function (it) { + if (!isObject(it) && it !== null) { + throw TypeError("Can't set " + String(it) + ' as a prototype'); + } + return it; +}; + +/***/ }), +/* 89 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var $ = __w_pdfjs_require__(10); +var from = __w_pdfjs_require__(90); +var checkCorrectnessOfIteration = __w_pdfjs_require__(97); +var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { + Array.from(iterable); +}); +$({ + target: 'Array', + stat: true, + forced: INCORRECT_ITERATION +}, { from: from }); + +/***/ }), +/* 90 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var bind = __w_pdfjs_require__(62); +var toObject = __w_pdfjs_require__(83); +var callWithSafeIterationClosing = __w_pdfjs_require__(91); +var isArrayIteratorMethod = __w_pdfjs_require__(92); +var toLength = __w_pdfjs_require__(47); +var createProperty = __w_pdfjs_require__(93); +var getIteratorMethod = __w_pdfjs_require__(94); +module.exports = function from(arrayLike) { + var O = toObject(arrayLike); + var C = typeof this == 'function' ? this : Array; + var argumentsLength = arguments.length; + var mapfn = argumentsLength > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var iteratorMethod = getIteratorMethod(O); + var index = 0; + var length, result, step, iterator, next, value; + if (mapping) + mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); + if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) { + iterator = iteratorMethod.call(O); + next = iterator.next; + result = new C(); + for (; !(step = next.call(iterator)).done; index++) { + value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [ + step.value, + index + ], true) : step.value; + createProperty(result, index, value); + } + } else { + length = toLength(O.length); + result = new C(length); + for (; length > index; index++) { + value = mapping ? mapfn(O[index], index) : O[index]; + createProperty(result, index, value); + } + } + result.length = index; + return result; +}; + +/***/ }), +/* 91 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var anObject = __w_pdfjs_require__(28); +module.exports = function (iterator, fn, value, ENTRIES) { + try { + return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); + } catch (error) { + var returnMethod = iterator['return']; + if (returnMethod !== undefined) + anObject(returnMethod.call(iterator)); + throw error; + } +}; + +/***/ }), +/* 92 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var wellKnownSymbol = __w_pdfjs_require__(57); +var Iterators = __w_pdfjs_require__(86); +var ITERATOR = wellKnownSymbol('iterator'); +var ArrayPrototype = Array.prototype; +module.exports = function (it) { + return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); +}; + +/***/ }), +/* 93 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var toPrimitive = __w_pdfjs_require__(21); +var definePropertyModule = __w_pdfjs_require__(27); +var createPropertyDescriptor = __w_pdfjs_require__(16); +module.exports = function (object, key, value) { + var propertyKey = toPrimitive(key); + if (propertyKey in object) + definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value)); + else + object[propertyKey] = value; +}; + +/***/ }), +/* 94 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var classof = __w_pdfjs_require__(95); +var Iterators = __w_pdfjs_require__(86); +var wellKnownSymbol = __w_pdfjs_require__(57); +var ITERATOR = wellKnownSymbol('iterator'); +module.exports = function (it) { + if (it != undefined) + return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; +}; + +/***/ }), +/* 95 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(96); +var classofRaw = __w_pdfjs_require__(19); +var wellKnownSymbol = __w_pdfjs_require__(57); +var TO_STRING_TAG = wellKnownSymbol('toStringTag'); +var CORRECT_ARGUMENTS = classofRaw(function () { + return arguments; +}()) == 'Arguments'; +var tryGet = function (it, key) { + try { + return it[key]; + } catch (error) { + } +}; +module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { + var O, tag, result; + return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result; +}; + +/***/ }), +/* 96 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var wellKnownSymbol = __w_pdfjs_require__(57); +var TO_STRING_TAG = wellKnownSymbol('toStringTag'); +var test = {}; +test[TO_STRING_TAG] = 'z'; +module.exports = String(test) === '[object z]'; + +/***/ }), +/* 97 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var wellKnownSymbol = __w_pdfjs_require__(57); +var ITERATOR = wellKnownSymbol('iterator'); +var SAFE_CLOSING = false; +try { + var called = 0; + var iteratorWithReturn = { + next: function () { + return { done: !!called++ }; + }, + 'return': function () { + SAFE_CLOSING = true; + } + }; + iteratorWithReturn[ITERATOR] = function () { + return this; + }; + Array.from(iteratorWithReturn, function () { + throw 2; + }); +} catch (error) { +} +module.exports = function (exec, SKIP_CLOSING) { + if (!SKIP_CLOSING && !SAFE_CLOSING) + return false; + var ITERATION_SUPPORT = false; + try { + var object = {}; + object[ITERATOR] = function () { + return { + next: function () { + return { done: ITERATION_SUPPORT = true }; + } + }; }; - function AcquireWritableStreamDefaultWriter(stream) { - return new WritableStreamDefaultWriter(stream); + exec(object); + } catch (error) { + } + return ITERATION_SUPPORT; +}; + +/***/ }), +/* 98 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(99); +var path = __w_pdfjs_require__(43); +module.exports = path.Object.assign; + +/***/ }), +/* 99 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var $ = __w_pdfjs_require__(10); +var assign = __w_pdfjs_require__(100); +$({ + target: 'Object', + stat: true, + forced: Object.assign !== assign +}, { assign: assign }); + +/***/ }), +/* 100 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var DESCRIPTORS = __w_pdfjs_require__(13); +var fails = __w_pdfjs_require__(14); +var objectKeys = __w_pdfjs_require__(73); +var getOwnPropertySymbolsModule = __w_pdfjs_require__(51); +var propertyIsEnumerableModule = __w_pdfjs_require__(15); +var toObject = __w_pdfjs_require__(83); +var IndexedObject = __w_pdfjs_require__(18); +var nativeAssign = Object.assign; +var defineProperty = Object.defineProperty; +module.exports = !nativeAssign || fails(function () { + if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', { + enumerable: true, + get: function () { + defineProperty(this, 'b', { + value: 3, + enumerable: false + }); + } + }), { b: 2 })).b !== 1) + return true; + var A = {}; + var B = {}; + var symbol = Symbol(); + var alphabet = 'abcdefghijklmnopqrst'; + A[symbol] = 7; + alphabet.split('').forEach(function (chr) { + B[chr] = chr; + }); + return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; +}) ? function assign(target, source) { + var T = toObject(target); + var argumentsLength = arguments.length; + var index = 1; + var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; + var propertyIsEnumerable = propertyIsEnumerableModule.f; + while (argumentsLength > index) { + var S = IndexedObject(arguments[index++]); + var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) { + key = keys[j++]; + if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) + T[key] = S[key]; } - function IsWritableStream(x) { - if (!typeIsObject(x)) { - return false; - } - if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) { - return false; - } - return true; + } + return T; +} : nativeAssign; + +/***/ }), +/* 101 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(102); +var path = __w_pdfjs_require__(43); +module.exports = path.Math.log2; + +/***/ }), +/* 102 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var $ = __w_pdfjs_require__(10); +var log = Math.log; +var LN2 = Math.LN2; +$({ + target: 'Math', + stat: true +}, { + log2: function log2(x) { + return log(x) / LN2; + } +}); + +/***/ }), +/* 103 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(104); +var path = __w_pdfjs_require__(43); +module.exports = path.Number.isNaN; + +/***/ }), +/* 104 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var $ = __w_pdfjs_require__(10); +$({ + target: 'Number', + stat: true +}, { + isNaN: function isNaN(number) { + return number != number; + } +}); + +/***/ }), +/* 105 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(106); +var path = __w_pdfjs_require__(43); +module.exports = path.Number.isInteger; + +/***/ }), +/* 106 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var $ = __w_pdfjs_require__(10); +var isInteger = __w_pdfjs_require__(107); +$({ + target: 'Number', + stat: true +}, { isInteger: isInteger }); + +/***/ }), +/* 107 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var isObject = __w_pdfjs_require__(22); +var floor = Math.floor; +module.exports = function isInteger(it) { + return !isObject(it) && isFinite(it) && floor(it) === it; +}; + +/***/ }), +/* 108 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(109); + +/***/ }), +/* 109 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var ArrayBufferViewCore = __w_pdfjs_require__(110); +var speciesConstructor = __w_pdfjs_require__(112); +var fails = __w_pdfjs_require__(14); +var aTypedArray = ArrayBufferViewCore.aTypedArray; +var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; +var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; +var $slice = [].slice; +var FORCED = fails(function () { + new Int8Array(1).slice(); +}); +exportTypedArrayMethod('slice', function slice(start, end) { + var list = $slice.call(aTypedArray(this), start, end); + var C = speciesConstructor(this, this.constructor); + var index = 0; + var length = list.length; + var result = new (aTypedArrayConstructor(C))(length); + while (length > index) + result[index] = list[index++]; + return result; +}, FORCED); + +/***/ }), +/* 110 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var NATIVE_ARRAY_BUFFER = __w_pdfjs_require__(111); +var DESCRIPTORS = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(11); +var isObject = __w_pdfjs_require__(22); +var has = __w_pdfjs_require__(23); +var classof = __w_pdfjs_require__(95); +var createNonEnumerableProperty = __w_pdfjs_require__(26); +var redefine = __w_pdfjs_require__(29); +var defineProperty = __w_pdfjs_require__(27).f; +var getPrototypeOf = __w_pdfjs_require__(82); +var setPrototypeOf = __w_pdfjs_require__(87); +var wellKnownSymbol = __w_pdfjs_require__(57); +var uid = __w_pdfjs_require__(38); +var Int8Array = global.Int8Array; +var Int8ArrayPrototype = Int8Array && Int8Array.prototype; +var Uint8ClampedArray = global.Uint8ClampedArray; +var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype; +var TypedArray = Int8Array && getPrototypeOf(Int8Array); +var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype); +var ObjectPrototype = Object.prototype; +var isPrototypeOf = ObjectPrototype.isPrototypeOf; +var TO_STRING_TAG = wellKnownSymbol('toStringTag'); +var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG'); +var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera'; +var TYPED_ARRAY_TAG_REQIRED = false; +var NAME; +var TypedArrayConstructorsList = { + Int8Array: 1, + Uint8Array: 1, + Uint8ClampedArray: 1, + Int16Array: 2, + Uint16Array: 2, + Int32Array: 4, + Uint32Array: 4, + Float32Array: 4, + Float64Array: 8 +}; +var isView = function isView(it) { + var klass = classof(it); + return klass === 'DataView' || has(TypedArrayConstructorsList, klass); +}; +var isTypedArray = function (it) { + return isObject(it) && has(TypedArrayConstructorsList, classof(it)); +}; +var aTypedArray = function (it) { + if (isTypedArray(it)) + return it; + throw TypeError('Target is not a typed array'); +}; +var aTypedArrayConstructor = function (C) { + if (setPrototypeOf) { + if (isPrototypeOf.call(TypedArray, C)) + return C; + } else + for (var ARRAY in TypedArrayConstructorsList) + if (has(TypedArrayConstructorsList, NAME)) { + var TypedArrayConstructor = global[ARRAY]; + if (TypedArrayConstructor && (C === TypedArrayConstructor || isPrototypeOf.call(TypedArrayConstructor, C))) { + return C; + } + } + throw TypeError('Target is not a typed array constructor'); +}; +var exportTypedArrayMethod = function (KEY, property, forced) { + if (!DESCRIPTORS) + return; + if (forced) + for (var ARRAY in TypedArrayConstructorsList) { + var TypedArrayConstructor = global[ARRAY]; + if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) { + delete TypedArrayConstructor.prototype[KEY]; + } + } + if (!TypedArrayPrototype[KEY] || forced) { + redefine(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property); + } +}; +var exportTypedArrayStaticMethod = function (KEY, property, forced) { + var ARRAY, TypedArrayConstructor; + if (!DESCRIPTORS) + return; + if (setPrototypeOf) { + if (forced) + for (ARRAY in TypedArrayConstructorsList) { + TypedArrayConstructor = global[ARRAY]; + if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) { + delete TypedArrayConstructor[KEY]; + } + } + if (!TypedArray[KEY] || forced) { + try { + return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8Array[KEY] || property); + } catch (error) { + } + } else + return; + } + for (ARRAY in TypedArrayConstructorsList) { + TypedArrayConstructor = global[ARRAY]; + if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) { + redefine(TypedArrayConstructor, KEY, property); + } + } +}; +for (NAME in TypedArrayConstructorsList) { + if (!global[NAME]) + NATIVE_ARRAY_BUFFER_VIEWS = false; +} +if (!NATIVE_ARRAY_BUFFER_VIEWS || typeof TypedArray != 'function' || TypedArray === Function.prototype) { + TypedArray = function TypedArray() { + throw TypeError('Incorrect invocation'); + }; + if (NATIVE_ARRAY_BUFFER_VIEWS) + for (NAME in TypedArrayConstructorsList) { + if (global[NAME]) + setPrototypeOf(global[NAME], TypedArray); } - function IsWritableStreamLocked(stream) { - assert(IsWritableStream(stream) === true, 'IsWritableStreamLocked should only be used on known writable streams'); - if (stream._writer === undefined) { - return false; - } - return true; +} +if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) { + TypedArrayPrototype = TypedArray.prototype; + if (NATIVE_ARRAY_BUFFER_VIEWS) + for (NAME in TypedArrayConstructorsList) { + if (global[NAME]) + setPrototypeOf(global[NAME].prototype, TypedArrayPrototype); } - function WritableStreamAbort(stream, reason) { - var state = stream._state; - if (state === 'closed') { - return Promise.resolve(undefined); - } - if (state === 'errored') { - return Promise.reject(stream._storedError); - } - var error = new TypeError('Requested to abort'); - if (stream._pendingAbortRequest !== undefined) { - return Promise.reject(error); - } - assert(state === 'writable' || state === 'erroring', 'state must be writable or erroring'); - var wasAlreadyErroring = false; - if (state === 'erroring') { - wasAlreadyErroring = true; - reason = undefined; - } - var promise = new Promise(function (resolve, reject) { - stream._pendingAbortRequest = { - _resolve: resolve, - _reject: reject, - _reason: reason, - _wasAlreadyErroring: wasAlreadyErroring - }; - }); - if (wasAlreadyErroring === false) { - WritableStreamStartErroring(stream, error); - } - return promise; - } - function WritableStreamAddWriteRequest(stream) { - assert(IsWritableStreamLocked(stream) === true); - assert(stream._state === 'writable'); - var promise = new Promise(function (resolve, reject) { - var writeRequest = { - _resolve: resolve, - _reject: reject - }; - stream._writeRequests.push(writeRequest); - }); - return promise; - } - function WritableStreamDealWithRejection(stream, error) { - var state = stream._state; - if (state === 'writable') { - WritableStreamStartErroring(stream, error); - return; - } - assert(state === 'erroring'); - WritableStreamFinishErroring(stream); - } - function WritableStreamStartErroring(stream, reason) { - assert(stream._storedError === undefined, 'stream._storedError === undefined'); - assert(stream._state === 'writable', 'state must be writable'); - var controller = stream._writableStreamController; - assert(controller !== undefined, 'controller must not be undefined'); - stream._state = 'erroring'; - stream._storedError = reason; - var writer = stream._writer; - if (writer !== undefined) { - WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason); - } - if (WritableStreamHasOperationMarkedInFlight(stream) === false && controller._started === true) { - WritableStreamFinishErroring(stream); - } - } - function WritableStreamFinishErroring(stream) { - assert(stream._state === 'erroring', 'stream._state === erroring'); - assert(WritableStreamHasOperationMarkedInFlight(stream) === false, 'WritableStreamHasOperationMarkedInFlight(stream) === false'); - stream._state = 'errored'; - stream._writableStreamController.__errorSteps(); - var storedError = stream._storedError; - for (var i = 0; i < stream._writeRequests.length; i++) { - var writeRequest = stream._writeRequests[i]; - writeRequest._reject(storedError); - } - stream._writeRequests = []; - if (stream._pendingAbortRequest === undefined) { - WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); - return; - } - var abortRequest = stream._pendingAbortRequest; - stream._pendingAbortRequest = undefined; - if (abortRequest._wasAlreadyErroring === true) { - abortRequest._reject(storedError); - WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); - return; - } - var promise = stream._writableStreamController.__abortSteps(abortRequest._reason); - promise.then(function () { - abortRequest._resolve(); - WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); - }, function (reason) { - abortRequest._reject(reason); - WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); - }); - } - function WritableStreamFinishInFlightWrite(stream) { - assert(stream._inFlightWriteRequest !== undefined); - stream._inFlightWriteRequest._resolve(undefined); - stream._inFlightWriteRequest = undefined; - } - function WritableStreamFinishInFlightWriteWithError(stream, error) { - assert(stream._inFlightWriteRequest !== undefined); - stream._inFlightWriteRequest._reject(error); - stream._inFlightWriteRequest = undefined; - assert(stream._state === 'writable' || stream._state === 'erroring'); - WritableStreamDealWithRejection(stream, error); - } - function WritableStreamFinishInFlightClose(stream) { - assert(stream._inFlightCloseRequest !== undefined); - stream._inFlightCloseRequest._resolve(undefined); - stream._inFlightCloseRequest = undefined; - var state = stream._state; - assert(state === 'writable' || state === 'erroring'); - if (state === 'erroring') { - stream._storedError = undefined; - if (stream._pendingAbortRequest !== undefined) { - stream._pendingAbortRequest._resolve(); - stream._pendingAbortRequest = undefined; - } - } - stream._state = 'closed'; - var writer = stream._writer; - if (writer !== undefined) { - defaultWriterClosedPromiseResolve(writer); - } - assert(stream._pendingAbortRequest === undefined, 'stream._pendingAbortRequest === undefined'); - assert(stream._storedError === undefined, 'stream._storedError === undefined'); - } - function WritableStreamFinishInFlightCloseWithError(stream, error) { - assert(stream._inFlightCloseRequest !== undefined); - stream._inFlightCloseRequest._reject(error); - stream._inFlightCloseRequest = undefined; - assert(stream._state === 'writable' || stream._state === 'erroring'); - if (stream._pendingAbortRequest !== undefined) { - stream._pendingAbortRequest._reject(error); - stream._pendingAbortRequest = undefined; - } - WritableStreamDealWithRejection(stream, error); - } - function WritableStreamCloseQueuedOrInFlight(stream) { - if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) { - return false; - } - return true; - } - function WritableStreamHasOperationMarkedInFlight(stream) { - if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) { - return false; - } - return true; - } - function WritableStreamMarkCloseRequestInFlight(stream) { - assert(stream._inFlightCloseRequest === undefined); - assert(stream._closeRequest !== undefined); - stream._inFlightCloseRequest = stream._closeRequest; - stream._closeRequest = undefined; - } - function WritableStreamMarkFirstWriteRequestInFlight(stream) { - assert(stream._inFlightWriteRequest === undefined, 'there must be no pending write request'); - assert(stream._writeRequests.length !== 0, 'writeRequests must not be empty'); - stream._inFlightWriteRequest = stream._writeRequests.shift(); - } - function WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream) { - assert(stream._state === 'errored', '_stream_.[[state]] is `"errored"`'); - if (stream._closeRequest !== undefined) { - assert(stream._inFlightCloseRequest === undefined); - stream._closeRequest._reject(stream._storedError); - stream._closeRequest = undefined; - } - var writer = stream._writer; - if (writer !== undefined) { - defaultWriterClosedPromiseReject(writer, stream._storedError); - writer._closedPromise.catch(function () {}); - } - } - function WritableStreamUpdateBackpressure(stream, backpressure) { - assert(stream._state === 'writable'); - assert(WritableStreamCloseQueuedOrInFlight(stream) === false); - var writer = stream._writer; - if (writer !== undefined && backpressure !== stream._backpressure) { - if (backpressure === true) { - defaultWriterReadyPromiseReset(writer); - } else { - assert(backpressure === false); - defaultWriterReadyPromiseResolve(writer); - } - } - stream._backpressure = backpressure; - } - var WritableStreamDefaultWriter = function () { - function WritableStreamDefaultWriter(stream) { - _classCallCheck(this, WritableStreamDefaultWriter); - if (IsWritableStream(stream) === false) { - throw new TypeError('WritableStreamDefaultWriter can only be constructed with a WritableStream instance'); - } - if (IsWritableStreamLocked(stream) === true) { - throw new TypeError('This stream has already been locked for exclusive writing by another writer'); - } - this._ownerWritableStream = stream; - stream._writer = this; - var state = stream._state; - if (state === 'writable') { - if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._backpressure === true) { - defaultWriterReadyPromiseInitialize(this); - } else { - defaultWriterReadyPromiseInitializeAsResolved(this); - } - defaultWriterClosedPromiseInitialize(this); - } else if (state === 'erroring') { - defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError); - this._readyPromise.catch(function () {}); - defaultWriterClosedPromiseInitialize(this); - } else if (state === 'closed') { - defaultWriterReadyPromiseInitializeAsResolved(this); - defaultWriterClosedPromiseInitializeAsResolved(this); - } else { - assert(state === 'errored', 'state must be errored'); - var storedError = stream._storedError; - defaultWriterReadyPromiseInitializeAsRejected(this, storedError); - this._readyPromise.catch(function () {}); - defaultWriterClosedPromiseInitializeAsRejected(this, storedError); - this._closedPromise.catch(function () {}); - } - } - _createClass(WritableStreamDefaultWriter, [{ - key: 'abort', - value: function abort(reason) { - if (IsWritableStreamDefaultWriter(this) === false) { - return Promise.reject(defaultWriterBrandCheckException('abort')); - } - if (this._ownerWritableStream === undefined) { - return Promise.reject(defaultWriterLockException('abort')); - } - return WritableStreamDefaultWriterAbort(this, reason); - } - }, { - key: 'close', - value: function close() { - if (IsWritableStreamDefaultWriter(this) === false) { - return Promise.reject(defaultWriterBrandCheckException('close')); - } - var stream = this._ownerWritableStream; - if (stream === undefined) { - return Promise.reject(defaultWriterLockException('close')); - } - if (WritableStreamCloseQueuedOrInFlight(stream) === true) { - return Promise.reject(new TypeError('cannot close an already-closing stream')); - } - return WritableStreamDefaultWriterClose(this); - } - }, { - key: 'releaseLock', - value: function releaseLock() { - if (IsWritableStreamDefaultWriter(this) === false) { - throw defaultWriterBrandCheckException('releaseLock'); - } - var stream = this._ownerWritableStream; - if (stream === undefined) { - return; - } - assert(stream._writer !== undefined); - WritableStreamDefaultWriterRelease(this); - } - }, { - key: 'write', - value: function write(chunk) { - if (IsWritableStreamDefaultWriter(this) === false) { - return Promise.reject(defaultWriterBrandCheckException('write')); - } - if (this._ownerWritableStream === undefined) { - return Promise.reject(defaultWriterLockException('write to')); - } - return WritableStreamDefaultWriterWrite(this, chunk); - } - }, { - key: 'closed', - get: function get() { - if (IsWritableStreamDefaultWriter(this) === false) { - return Promise.reject(defaultWriterBrandCheckException('closed')); - } - return this._closedPromise; - } - }, { - key: 'desiredSize', - get: function get() { - if (IsWritableStreamDefaultWriter(this) === false) { - throw defaultWriterBrandCheckException('desiredSize'); - } - if (this._ownerWritableStream === undefined) { - throw defaultWriterLockException('desiredSize'); - } - return WritableStreamDefaultWriterGetDesiredSize(this); - } - }, { - key: 'ready', - get: function get() { - if (IsWritableStreamDefaultWriter(this) === false) { - return Promise.reject(defaultWriterBrandCheckException('ready')); - } - return this._readyPromise; - } - }]); - return WritableStreamDefaultWriter; - }(); - function IsWritableStreamDefaultWriter(x) { - if (!typeIsObject(x)) { - return false; - } - if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) { - return false; - } - return true; - } - function WritableStreamDefaultWriterAbort(writer, reason) { - var stream = writer._ownerWritableStream; - assert(stream !== undefined); - return WritableStreamAbort(stream, reason); - } - function WritableStreamDefaultWriterClose(writer) { - var stream = writer._ownerWritableStream; - assert(stream !== undefined); - var state = stream._state; - if (state === 'closed' || state === 'errored') { - return Promise.reject(new TypeError('The stream (in ' + state + ' state) is not in the writable state and cannot be closed')); - } - assert(state === 'writable' || state === 'erroring'); - assert(WritableStreamCloseQueuedOrInFlight(stream) === false); - var promise = new Promise(function (resolve, reject) { - var closeRequest = { - _resolve: resolve, - _reject: reject - }; - stream._closeRequest = closeRequest; - }); - if (stream._backpressure === true && state === 'writable') { - defaultWriterReadyPromiseResolve(writer); - } - WritableStreamDefaultControllerClose(stream._writableStreamController); - return promise; - } - function WritableStreamDefaultWriterCloseWithErrorPropagation(writer) { - var stream = writer._ownerWritableStream; - assert(stream !== undefined); - var state = stream._state; - if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') { - return Promise.resolve(); - } - if (state === 'errored') { - return Promise.reject(stream._storedError); - } - assert(state === 'writable' || state === 'erroring'); - return WritableStreamDefaultWriterClose(writer); - } - function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error) { - if (writer._closedPromiseState === 'pending') { - defaultWriterClosedPromiseReject(writer, error); - } else { - defaultWriterClosedPromiseResetToRejected(writer, error); - } - writer._closedPromise.catch(function () {}); - } - function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) { - if (writer._readyPromiseState === 'pending') { - defaultWriterReadyPromiseReject(writer, error); - } else { - defaultWriterReadyPromiseResetToRejected(writer, error); - } - writer._readyPromise.catch(function () {}); - } - function WritableStreamDefaultWriterGetDesiredSize(writer) { - var stream = writer._ownerWritableStream; - var state = stream._state; - if (state === 'errored' || state === 'erroring') { - return null; - } - if (state === 'closed') { - return 0; - } - return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController); - } - function WritableStreamDefaultWriterRelease(writer) { - var stream = writer._ownerWritableStream; - assert(stream !== undefined); - assert(stream._writer === writer); - var releasedError = new TypeError('Writer was released and can no longer be used to monitor the stream\'s closedness'); - WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError); - WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError); - stream._writer = undefined; - writer._ownerWritableStream = undefined; - } - function WritableStreamDefaultWriterWrite(writer, chunk) { - var stream = writer._ownerWritableStream; - assert(stream !== undefined); - var controller = stream._writableStreamController; - var chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk); - if (stream !== writer._ownerWritableStream) { - return Promise.reject(defaultWriterLockException('write to')); - } - var state = stream._state; - if (state === 'errored') { - return Promise.reject(stream._storedError); - } - if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') { - return Promise.reject(new TypeError('The stream is closing or closed and cannot be written to')); - } - if (state === 'erroring') { - return Promise.reject(stream._storedError); - } - assert(state === 'writable'); - var promise = WritableStreamAddWriteRequest(stream); - WritableStreamDefaultControllerWrite(controller, chunk, chunkSize); - return promise; - } - var WritableStreamDefaultController = function () { - function WritableStreamDefaultController(stream, underlyingSink, size, highWaterMark) { - _classCallCheck(this, WritableStreamDefaultController); - if (IsWritableStream(stream) === false) { - throw new TypeError('WritableStreamDefaultController can only be constructed with a WritableStream instance'); - } - if (stream._writableStreamController !== undefined) { - throw new TypeError('WritableStreamDefaultController instances can only be created by the WritableStream constructor'); - } - this._controlledWritableStream = stream; - this._underlyingSink = underlyingSink; - this._queue = undefined; - this._queueTotalSize = undefined; - ResetQueue(this); - this._started = false; - var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark); - this._strategySize = normalizedStrategy.size; - this._strategyHWM = normalizedStrategy.highWaterMark; - var backpressure = WritableStreamDefaultControllerGetBackpressure(this); - WritableStreamUpdateBackpressure(stream, backpressure); - } - _createClass(WritableStreamDefaultController, [{ - key: 'error', - value: function error(e) { - if (IsWritableStreamDefaultController(this) === false) { - throw new TypeError('WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController'); - } - var state = this._controlledWritableStream._state; - if (state !== 'writable') { - return; - } - WritableStreamDefaultControllerError(this, e); - } - }, { - key: '__abortSteps', - value: function __abortSteps(reason) { - return PromiseInvokeOrNoop(this._underlyingSink, 'abort', [reason]); - } - }, { - key: '__errorSteps', - value: function __errorSteps() { - ResetQueue(this); - } - }, { - key: '__startSteps', - value: function __startSteps() { - var _this = this; - var startResult = InvokeOrNoop(this._underlyingSink, 'start', [this]); - var stream = this._controlledWritableStream; - Promise.resolve(startResult).then(function () { - assert(stream._state === 'writable' || stream._state === 'erroring'); - _this._started = true; - WritableStreamDefaultControllerAdvanceQueueIfNeeded(_this); - }, function (r) { - assert(stream._state === 'writable' || stream._state === 'erroring'); - _this._started = true; - WritableStreamDealWithRejection(stream, r); - }).catch(rethrowAssertionErrorRejection); - } - }]); - return WritableStreamDefaultController; - }(); - function WritableStreamDefaultControllerClose(controller) { - EnqueueValueWithSize(controller, 'close', 0); - WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); - } - function WritableStreamDefaultControllerGetChunkSize(controller, chunk) { - var strategySize = controller._strategySize; - if (strategySize === undefined) { - return 1; - } - try { - return strategySize(chunk); - } catch (chunkSizeE) { - WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE); - return 1; - } - } - function WritableStreamDefaultControllerGetDesiredSize(controller) { - return controller._strategyHWM - controller._queueTotalSize; - } - function WritableStreamDefaultControllerWrite(controller, chunk, chunkSize) { - var writeRecord = { chunk: chunk }; - try { - EnqueueValueWithSize(controller, writeRecord, chunkSize); - } catch (enqueueE) { - WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE); - return; - } - var stream = controller._controlledWritableStream; - if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._state === 'writable') { - var backpressure = WritableStreamDefaultControllerGetBackpressure(controller); - WritableStreamUpdateBackpressure(stream, backpressure); - } - WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); - } - function IsWritableStreamDefaultController(x) { - if (!typeIsObject(x)) { - return false; - } - if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSink')) { - return false; - } - return true; +} +if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) { + setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype); +} +if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) { + TYPED_ARRAY_TAG_REQIRED = true; + defineProperty(TypedArrayPrototype, TO_STRING_TAG, { + get: function () { + return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined; } - function WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller) { - var stream = controller._controlledWritableStream; - if (controller._started === false) { - return; - } - if (stream._inFlightWriteRequest !== undefined) { - return; - } - var state = stream._state; - if (state === 'closed' || state === 'errored') { - return; - } - if (state === 'erroring') { - WritableStreamFinishErroring(stream); - return; - } - if (controller._queue.length === 0) { - return; - } - var writeRecord = PeekQueueValue(controller); - if (writeRecord === 'close') { - WritableStreamDefaultControllerProcessClose(controller); - } else { - WritableStreamDefaultControllerProcessWrite(controller, writeRecord.chunk); - } - } - function WritableStreamDefaultControllerErrorIfNeeded(controller, error) { - if (controller._controlledWritableStream._state === 'writable') { - WritableStreamDefaultControllerError(controller, error); - } - } - function WritableStreamDefaultControllerProcessClose(controller) { - var stream = controller._controlledWritableStream; - WritableStreamMarkCloseRequestInFlight(stream); - DequeueValue(controller); - assert(controller._queue.length === 0, 'queue must be empty once the final write record is dequeued'); - var sinkClosePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'close', []); - sinkClosePromise.then(function () { - WritableStreamFinishInFlightClose(stream); - }, function (reason) { - WritableStreamFinishInFlightCloseWithError(stream, reason); - }).catch(rethrowAssertionErrorRejection); - } - function WritableStreamDefaultControllerProcessWrite(controller, chunk) { - var stream = controller._controlledWritableStream; - WritableStreamMarkFirstWriteRequestInFlight(stream); - var sinkWritePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'write', [chunk, controller]); - sinkWritePromise.then(function () { - WritableStreamFinishInFlightWrite(stream); - var state = stream._state; - assert(state === 'writable' || state === 'erroring'); - DequeueValue(controller); - if (WritableStreamCloseQueuedOrInFlight(stream) === false && state === 'writable') { - var backpressure = WritableStreamDefaultControllerGetBackpressure(controller); - WritableStreamUpdateBackpressure(stream, backpressure); - } - WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); - }, function (reason) { - WritableStreamFinishInFlightWriteWithError(stream, reason); - }).catch(rethrowAssertionErrorRejection); - } - function WritableStreamDefaultControllerGetBackpressure(controller) { - var desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller); - return desiredSize <= 0; - } - function WritableStreamDefaultControllerError(controller, error) { - var stream = controller._controlledWritableStream; - assert(stream._state === 'writable'); - WritableStreamStartErroring(stream, error); - } - function streamBrandCheckException(name) { - return new TypeError('WritableStream.prototype.' + name + ' can only be used on a WritableStream'); - } - function defaultWriterBrandCheckException(name) { - return new TypeError('WritableStreamDefaultWriter.prototype.' + name + ' can only be used on a WritableStreamDefaultWriter'); - } - function defaultWriterLockException(name) { - return new TypeError('Cannot ' + name + ' a stream using a released writer'); - } - function defaultWriterClosedPromiseInitialize(writer) { - writer._closedPromise = new Promise(function (resolve, reject) { - writer._closedPromise_resolve = resolve; - writer._closedPromise_reject = reject; - writer._closedPromiseState = 'pending'; - }); + }); + for (NAME in TypedArrayConstructorsList) + if (global[NAME]) { + createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME); } - function defaultWriterClosedPromiseInitializeAsRejected(writer, reason) { - writer._closedPromise = Promise.reject(reason); - writer._closedPromise_resolve = undefined; - writer._closedPromise_reject = undefined; - writer._closedPromiseState = 'rejected'; - } - function defaultWriterClosedPromiseInitializeAsResolved(writer) { - writer._closedPromise = Promise.resolve(undefined); - writer._closedPromise_resolve = undefined; - writer._closedPromise_reject = undefined; - writer._closedPromiseState = 'resolved'; - } - function defaultWriterClosedPromiseReject(writer, reason) { - assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined'); - assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined'); - assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending'); - writer._closedPromise_reject(reason); - writer._closedPromise_resolve = undefined; - writer._closedPromise_reject = undefined; - writer._closedPromiseState = 'rejected'; - } - function defaultWriterClosedPromiseResetToRejected(writer, reason) { - assert(writer._closedPromise_resolve === undefined, 'writer._closedPromise_resolve === undefined'); - assert(writer._closedPromise_reject === undefined, 'writer._closedPromise_reject === undefined'); - assert(writer._closedPromiseState !== 'pending', 'writer._closedPromiseState is not pending'); - writer._closedPromise = Promise.reject(reason); - writer._closedPromiseState = 'rejected'; - } - function defaultWriterClosedPromiseResolve(writer) { - assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined'); - assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined'); - assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending'); - writer._closedPromise_resolve(undefined); - writer._closedPromise_resolve = undefined; - writer._closedPromise_reject = undefined; - writer._closedPromiseState = 'resolved'; - } - function defaultWriterReadyPromiseInitialize(writer) { - writer._readyPromise = new Promise(function (resolve, reject) { - writer._readyPromise_resolve = resolve; - writer._readyPromise_reject = reject; - }); - writer._readyPromiseState = 'pending'; - } - function defaultWriterReadyPromiseInitializeAsRejected(writer, reason) { - writer._readyPromise = Promise.reject(reason); - writer._readyPromise_resolve = undefined; - writer._readyPromise_reject = undefined; - writer._readyPromiseState = 'rejected'; - } - function defaultWriterReadyPromiseInitializeAsResolved(writer) { - writer._readyPromise = Promise.resolve(undefined); - writer._readyPromise_resolve = undefined; - writer._readyPromise_reject = undefined; - writer._readyPromiseState = 'fulfilled'; - } - function defaultWriterReadyPromiseReject(writer, reason) { - assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined'); - assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined'); - writer._readyPromise_reject(reason); - writer._readyPromise_resolve = undefined; - writer._readyPromise_reject = undefined; - writer._readyPromiseState = 'rejected'; - } - function defaultWriterReadyPromiseReset(writer) { - assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined'); - assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined'); - writer._readyPromise = new Promise(function (resolve, reject) { - writer._readyPromise_resolve = resolve; - writer._readyPromise_reject = reject; - }); - writer._readyPromiseState = 'pending'; - } - function defaultWriterReadyPromiseResetToRejected(writer, reason) { - assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined'); - assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined'); - writer._readyPromise = Promise.reject(reason); - writer._readyPromiseState = 'rejected'; - } - function defaultWriterReadyPromiseResolve(writer) { - assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined'); - assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined'); - writer._readyPromise_resolve(undefined); - writer._readyPromise_resolve = undefined; - writer._readyPromise_reject = undefined; - writer._readyPromiseState = 'fulfilled'; - } -}, function (module, exports, __w_pdfjs_require__) { - "use strict"; +} +module.exports = { + NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS, + TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG, + aTypedArray: aTypedArray, + aTypedArrayConstructor: aTypedArrayConstructor, + exportTypedArrayMethod: exportTypedArrayMethod, + exportTypedArrayStaticMethod: exportTypedArrayStaticMethod, + isView: isView, + isTypedArray: isTypedArray, + TypedArray: TypedArray, + TypedArrayPrototype: TypedArrayPrototype +}; - var _require = __w_pdfjs_require__(0), - IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber; - var _require2 = __w_pdfjs_require__(1), - assert = _require2.assert; - exports.DequeueValue = function (container) { - assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: DequeueValue should only be used on containers with [[queue]] and [[queueTotalSize]].'); - assert(container._queue.length > 0, 'Spec-level failure: should never dequeue from an empty queue.'); - var pair = container._queue.shift(); - container._queueTotalSize -= pair.size; - if (container._queueTotalSize < 0) { - container._queueTotalSize = 0; - } - return pair.value; - }; - exports.EnqueueValueWithSize = function (container, value, size) { - assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: EnqueueValueWithSize should only be used on containers with [[queue]] and ' + '[[queueTotalSize]].'); - size = Number(size); - if (!IsFiniteNonNegativeNumber(size)) { - throw new RangeError('Size must be a finite, non-NaN, non-negative number.'); - } - container._queue.push({ - value: value, - size: size - }); - container._queueTotalSize += size; +/***/ }), +/* 111 */ +/***/ (function(module, exports) { + +module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined'; + +/***/ }), +/* 112 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var anObject = __w_pdfjs_require__(28); +var aFunction = __w_pdfjs_require__(63); +var wellKnownSymbol = __w_pdfjs_require__(57); +var SPECIES = wellKnownSymbol('species'); +module.exports = function (O, defaultConstructor) { + var C = anObject(O).constructor; + var S; + return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S); +}; + +/***/ }), +/* 113 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(114); +__w_pdfjs_require__(77); +__w_pdfjs_require__(116); +__w_pdfjs_require__(119); +__w_pdfjs_require__(134); +__w_pdfjs_require__(135); +var path = __w_pdfjs_require__(43); +module.exports = path.Promise; + +/***/ }), +/* 114 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(96); +var redefine = __w_pdfjs_require__(29); +var toString = __w_pdfjs_require__(115); +if (!TO_STRING_TAG_SUPPORT) { + redefine(Object.prototype, 'toString', toString, { unsafe: true }); +} + +/***/ }), +/* 115 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(96); +var classof = __w_pdfjs_require__(95); +module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() { + return '[object ' + classof(this) + ']'; +}; + +/***/ }), +/* 116 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var global = __w_pdfjs_require__(11); +var DOMIterables = __w_pdfjs_require__(117); +var ArrayIteratorMethods = __w_pdfjs_require__(118); +var createNonEnumerableProperty = __w_pdfjs_require__(26); +var wellKnownSymbol = __w_pdfjs_require__(57); +var ITERATOR = wellKnownSymbol('iterator'); +var TO_STRING_TAG = wellKnownSymbol('toStringTag'); +var ArrayValues = ArrayIteratorMethods.values; +for (var COLLECTION_NAME in DOMIterables) { + var Collection = global[COLLECTION_NAME]; + var CollectionPrototype = Collection && Collection.prototype; + if (CollectionPrototype) { + if (CollectionPrototype[ITERATOR] !== ArrayValues) + try { + createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues); + } catch (error) { + CollectionPrototype[ITERATOR] = ArrayValues; + } + if (!CollectionPrototype[TO_STRING_TAG]) { + createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME); + } + if (DOMIterables[COLLECTION_NAME]) + for (var METHOD_NAME in ArrayIteratorMethods) { + if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) + try { + createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]); + } catch (error) { + CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME]; + } + } + } +} + +/***/ }), +/* 117 */ +/***/ (function(module, exports) { + +module.exports = { + CSSRuleList: 0, + CSSStyleDeclaration: 0, + CSSValueList: 0, + ClientRectList: 0, + DOMRectList: 0, + DOMStringList: 0, + DOMTokenList: 1, + DataTransferItemList: 0, + FileList: 0, + HTMLAllCollection: 0, + HTMLCollection: 0, + HTMLFormElement: 0, + HTMLSelectElement: 0, + MediaList: 0, + MimeTypeArray: 0, + NamedNodeMap: 0, + NodeList: 1, + PaintRequestList: 0, + Plugin: 0, + PluginArray: 0, + SVGLengthList: 0, + SVGNumberList: 0, + SVGPathSegList: 0, + SVGPointList: 0, + SVGStringList: 0, + SVGTransformList: 0, + SourceBufferList: 0, + StyleSheetList: 0, + TextTrackCueList: 0, + TextTrackList: 0, + TouchList: 0 +}; + +/***/ }), +/* 118 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var toIndexedObject = __w_pdfjs_require__(17); +var addToUnscopables = __w_pdfjs_require__(70); +var Iterators = __w_pdfjs_require__(86); +var InternalStateModule = __w_pdfjs_require__(33); +var defineIterator = __w_pdfjs_require__(79); +var ARRAY_ITERATOR = 'Array Iterator'; +var setInternalState = InternalStateModule.set; +var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); +module.exports = defineIterator(Array, 'Array', function (iterated, kind) { + setInternalState(this, { + type: ARRAY_ITERATOR, + target: toIndexedObject(iterated), + index: 0, + kind: kind + }); +}, function () { + var state = getInternalState(this); + var target = state.target; + var kind = state.kind; + var index = state.index++; + if (!target || index >= target.length) { + state.target = undefined; + return { + value: undefined, + done: true }; - exports.PeekQueueValue = function (container) { - assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: PeekQueueValue should only be used on containers with [[queue]] and [[queueTotalSize]].'); - assert(container._queue.length > 0, 'Spec-level failure: should never peek at an empty queue.'); - var pair = container._queue[0]; - return pair.value; + } + if (kind == 'keys') + return { + value: index, + done: false }; - exports.ResetQueue = function (container) { - assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]].'); - container._queue = []; - container._queueTotalSize = 0; + if (kind == 'values') + return { + value: target[index], + done: false }; -}, function (module, exports, __w_pdfjs_require__) { - "use strict"; + return { + value: [ + index, + target[index] + ], + done: false + }; +}, 'values'); +Iterators.Arguments = Iterators.Array; +addToUnscopables('keys'); +addToUnscopables('values'); +addToUnscopables('entries'); - var _createClass = function () { - function defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } +/***/ }), +/* 119 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var IS_PURE = __w_pdfjs_require__(37); +var global = __w_pdfjs_require__(11); +var getBuiltIn = __w_pdfjs_require__(42); +var NativePromise = __w_pdfjs_require__(120); +var redefine = __w_pdfjs_require__(29); +var redefineAll = __w_pdfjs_require__(121); +var setToStringTag = __w_pdfjs_require__(85); +var setSpecies = __w_pdfjs_require__(122); +var isObject = __w_pdfjs_require__(22); +var aFunction = __w_pdfjs_require__(63); +var anInstance = __w_pdfjs_require__(123); +var classof = __w_pdfjs_require__(19); +var inspectSource = __w_pdfjs_require__(31); +var iterate = __w_pdfjs_require__(124); +var checkCorrectnessOfIteration = __w_pdfjs_require__(97); +var speciesConstructor = __w_pdfjs_require__(112); +var task = __w_pdfjs_require__(125).set; +var microtask = __w_pdfjs_require__(128); +var promiseResolve = __w_pdfjs_require__(129); +var hostReportErrors = __w_pdfjs_require__(131); +var newPromiseCapabilityModule = __w_pdfjs_require__(130); +var perform = __w_pdfjs_require__(132); +var InternalStateModule = __w_pdfjs_require__(33); +var isForced = __w_pdfjs_require__(52); +var wellKnownSymbol = __w_pdfjs_require__(57); +var V8_VERSION = __w_pdfjs_require__(133); +var SPECIES = wellKnownSymbol('species'); +var PROMISE = 'Promise'; +var getInternalState = InternalStateModule.get; +var setInternalState = InternalStateModule.set; +var getInternalPromiseState = InternalStateModule.getterFor(PROMISE); +var PromiseConstructor = NativePromise; +var TypeError = global.TypeError; +var document = global.document; +var process = global.process; +var $fetch = getBuiltIn('fetch'); +var newPromiseCapability = newPromiseCapabilityModule.f; +var newGenericPromiseCapability = newPromiseCapability; +var IS_NODE = classof(process) == 'process'; +var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent); +var UNHANDLED_REJECTION = 'unhandledrejection'; +var REJECTION_HANDLED = 'rejectionhandled'; +var PENDING = 0; +var FULFILLED = 1; +var REJECTED = 2; +var HANDLED = 1; +var UNHANDLED = 2; +var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; +var FORCED = isForced(PROMISE, function () { + var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor); + if (!GLOBAL_CORE_JS_PROMISE) { + if (V8_VERSION === 66) + return true; + if (!IS_NODE && typeof PromiseRejectionEvent != 'function') + return true; + } + if (IS_PURE && !PromiseConstructor.prototype['finally']) + return true; + if (V8_VERSION >= 51 && /native code/.test(PromiseConstructor)) + return false; + var promise = PromiseConstructor.resolve(1); + var FakePromise = function (exec) { + exec(function () { + }, function () { + }); + }; + var constructor = promise.constructor = {}; + constructor[SPECIES] = FakePromise; + return !(promise.then(function () { + }) instanceof FakePromise); +}); +var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) { + PromiseConstructor.all(iterable)['catch'](function () { + }); +}); +var isThenable = function (it) { + var then; + return isObject(it) && typeof (then = it.then) == 'function' ? then : false; +}; +var notify = function (promise, state, isReject) { + if (state.notified) + return; + state.notified = true; + var chain = state.reactions; + microtask(function () { + var value = state.value; + var ok = state.state == FULFILLED; + var index = 0; + while (chain.length > index) { + var reaction = chain[index++]; + var handler = ok ? reaction.ok : reaction.fail; + var resolve = reaction.resolve; + var reject = reaction.reject; + var domain = reaction.domain; + var result, then, exited; + try { + if (handler) { + if (!ok) { + if (state.rejection === UNHANDLED) + onHandleUnhandled(promise, state); + state.rejection = HANDLED; + } + if (handler === true) + result = value; + else { + if (domain) + domain.enter(); + result = handler(value); + if (domain) { + domain.exit(); + exited = true; + } + } + if (result === reaction.promise) { + reject(TypeError('Promise-chain cycle')); + } else if (then = isThenable(result)) { + then.call(result, resolve, reject); + } else + resolve(result); + } else + reject(value); + } catch (error) { + if (domain && !exited) + domain.exit(); + reject(error); + } + } + state.reactions = []; + state.notified = false; + if (isReject && !state.rejection) + onUnhandled(promise, state); + }); +}; +var dispatchEvent = function (name, promise, reason) { + var event, handler; + if (DISPATCH_EVENT) { + event = document.createEvent('Event'); + event.promise = promise; + event.reason = reason; + event.initEvent(name, false, true); + global.dispatchEvent(event); + } else + event = { + promise: promise, + reason: reason + }; + if (handler = global['on' + name]) + handler(event); + else if (name === UNHANDLED_REJECTION) + hostReportErrors('Unhandled promise rejection', reason); +}; +var onUnhandled = function (promise, state) { + task.call(global, function () { + var value = state.value; + var IS_UNHANDLED = isUnhandled(state); + var result; + if (IS_UNHANDLED) { + result = perform(function () { + if (IS_NODE) { + process.emit('unhandledRejection', value, promise); + } else + dispatchEvent(UNHANDLED_REJECTION, promise, value); + }); + state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED; + if (result.error) + throw result.value; + } + }); +}; +var isUnhandled = function (state) { + return state.rejection !== HANDLED && !state.parent; +}; +var onHandleUnhandled = function (promise, state) { + task.call(global, function () { + if (IS_NODE) { + process.emit('rejectionHandled', promise); + } else + dispatchEvent(REJECTION_HANDLED, promise, state.value); + }); +}; +var bind = function (fn, promise, state, unwrap) { + return function (value) { + fn(promise, state, value, unwrap); + }; +}; +var internalReject = function (promise, state, value, unwrap) { + if (state.done) + return; + state.done = true; + if (unwrap) + state = unwrap; + state.value = value; + state.state = REJECTED; + notify(promise, state, true); +}; +var internalResolve = function (promise, state, value, unwrap) { + if (state.done) + return; + state.done = true; + if (unwrap) + state = unwrap; + try { + if (promise === value) + throw TypeError("Promise can't be resolved itself"); + var then = isThenable(value); + if (then) { + microtask(function () { + var wrapper = { done: false }; + try { + then.call(value, bind(internalResolve, promise, wrapper, state), bind(internalReject, promise, wrapper, state)); + } catch (error) { + internalReject(promise, wrapper, error, state); } - return function (Constructor, protoProps, staticProps) { - if (protoProps) defineProperties(Constructor.prototype, protoProps); - if (staticProps) defineProperties(Constructor, staticProps); - return Constructor; - }; - }(); - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - var _require = __w_pdfjs_require__(0), - ArrayBufferCopy = _require.ArrayBufferCopy, - CreateIterResultObject = _require.CreateIterResultObject, - IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber, - InvokeOrNoop = _require.InvokeOrNoop, - PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop, - TransferArrayBuffer = _require.TransferArrayBuffer, - ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy, - ValidateAndNormalizeHighWaterMark = _require.ValidateAndNormalizeHighWaterMark; - var _require2 = __w_pdfjs_require__(0), - createArrayFromList = _require2.createArrayFromList, - createDataProperty = _require2.createDataProperty, - typeIsObject = _require2.typeIsObject; - var _require3 = __w_pdfjs_require__(1), - assert = _require3.assert, - rethrowAssertionErrorRejection = _require3.rethrowAssertionErrorRejection; - var _require4 = __w_pdfjs_require__(3), - DequeueValue = _require4.DequeueValue, - EnqueueValueWithSize = _require4.EnqueueValueWithSize, - ResetQueue = _require4.ResetQueue; - var _require5 = __w_pdfjs_require__(2), - AcquireWritableStreamDefaultWriter = _require5.AcquireWritableStreamDefaultWriter, - IsWritableStream = _require5.IsWritableStream, - IsWritableStreamLocked = _require5.IsWritableStreamLocked, - WritableStreamAbort = _require5.WritableStreamAbort, - WritableStreamDefaultWriterCloseWithErrorPropagation = _require5.WritableStreamDefaultWriterCloseWithErrorPropagation, - WritableStreamDefaultWriterRelease = _require5.WritableStreamDefaultWriterRelease, - WritableStreamDefaultWriterWrite = _require5.WritableStreamDefaultWriterWrite, - WritableStreamCloseQueuedOrInFlight = _require5.WritableStreamCloseQueuedOrInFlight; - var ReadableStream = function () { - function ReadableStream() { - var underlyingSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - size = _ref.size, - highWaterMark = _ref.highWaterMark; - _classCallCheck(this, ReadableStream); - this._state = 'readable'; - this._reader = undefined; - this._storedError = undefined; - this._disturbed = false; - this._readableStreamController = undefined; - var type = underlyingSource.type; - var typeString = String(type); - if (typeString === 'bytes') { - if (highWaterMark === undefined) { - highWaterMark = 0; - } - this._readableStreamController = new ReadableByteStreamController(this, underlyingSource, highWaterMark); - } else if (type === undefined) { - if (highWaterMark === undefined) { - highWaterMark = 1; - } - this._readableStreamController = new ReadableStreamDefaultController(this, underlyingSource, size, highWaterMark); - } else { - throw new RangeError('Invalid type is specified'); - } + }); + } else { + state.value = value; + state.state = FULFILLED; + notify(promise, state, false); + } + } catch (error) { + internalReject(promise, { done: false }, error, state); + } +}; +if (FORCED) { + PromiseConstructor = function Promise(executor) { + anInstance(this, PromiseConstructor, PROMISE); + aFunction(executor); + Internal.call(this); + var state = getInternalState(this); + try { + executor(bind(internalResolve, this, state), bind(internalReject, this, state)); + } catch (error) { + internalReject(this, state, error); + } + }; + Internal = function Promise(executor) { + setInternalState(this, { + type: PROMISE, + done: false, + notified: false, + parent: false, + reactions: [], + rejection: false, + state: PENDING, + value: undefined + }); + }; + Internal.prototype = redefineAll(PromiseConstructor.prototype, { + then: function then(onFulfilled, onRejected) { + var state = getInternalPromiseState(this); + var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); + reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; + reaction.fail = typeof onRejected == 'function' && onRejected; + reaction.domain = IS_NODE ? process.domain : undefined; + state.parent = true; + state.reactions.push(reaction); + if (state.state != PENDING) + notify(this, state, false); + return reaction.promise; + }, + 'catch': function (onRejected) { + return this.then(undefined, onRejected); + } + }); + OwnPromiseCapability = function () { + var promise = new Internal(); + var state = getInternalState(promise); + this.promise = promise; + this.resolve = bind(internalResolve, promise, state); + this.reject = bind(internalReject, promise, state); + }; + newPromiseCapabilityModule.f = newPromiseCapability = function (C) { + return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); + }; + if (!IS_PURE && typeof NativePromise == 'function') { + nativeThen = NativePromise.prototype.then; + redefine(NativePromise.prototype, 'then', function then(onFulfilled, onRejected) { + var that = this; + return new PromiseConstructor(function (resolve, reject) { + nativeThen.call(that, resolve, reject); + }).then(onFulfilled, onRejected); + }, { unsafe: true }); + if (typeof $fetch == 'function') + $({ + global: true, + enumerable: true, + forced: true + }, { + fetch: function fetch(input) { + return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments)); } - _createClass(ReadableStream, [{ - key: 'cancel', - value: function cancel(reason) { - if (IsReadableStream(this) === false) { - return Promise.reject(streamBrandCheckException('cancel')); - } - if (IsReadableStreamLocked(this) === true) { - return Promise.reject(new TypeError('Cannot cancel a stream that already has a reader')); - } - return ReadableStreamCancel(this, reason); - } - }, { - key: 'getReader', - value: function getReader() { - var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - mode = _ref2.mode; - if (IsReadableStream(this) === false) { - throw streamBrandCheckException('getReader'); - } - if (mode === undefined) { - return AcquireReadableStreamDefaultReader(this); - } - mode = String(mode); - if (mode === 'byob') { - return AcquireReadableStreamBYOBReader(this); - } - throw new RangeError('Invalid mode is specified'); - } - }, { - key: 'pipeThrough', - value: function pipeThrough(_ref3, options) { - var writable = _ref3.writable, - readable = _ref3.readable; - var promise = this.pipeTo(writable, options); - ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise); - return readable; - } - }, { - key: 'pipeTo', - value: function pipeTo(dest) { - var _this = this; - var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - preventClose = _ref4.preventClose, - preventAbort = _ref4.preventAbort, - preventCancel = _ref4.preventCancel; - if (IsReadableStream(this) === false) { - return Promise.reject(streamBrandCheckException('pipeTo')); - } - if (IsWritableStream(dest) === false) { - return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo\'s first argument must be a WritableStream')); - } - preventClose = Boolean(preventClose); - preventAbort = Boolean(preventAbort); - preventCancel = Boolean(preventCancel); - if (IsReadableStreamLocked(this) === true) { - return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream')); - } - if (IsWritableStreamLocked(dest) === true) { - return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream')); - } - var reader = AcquireReadableStreamDefaultReader(this); - var writer = AcquireWritableStreamDefaultWriter(dest); - var shuttingDown = false; - var currentWrite = Promise.resolve(); - return new Promise(function (resolve, reject) { - function pipeLoop() { - currentWrite = Promise.resolve(); - if (shuttingDown === true) { - return Promise.resolve(); - } - return writer._readyPromise.then(function () { - return ReadableStreamDefaultReaderRead(reader).then(function (_ref5) { - var value = _ref5.value, - done = _ref5.done; - if (done === true) { - return; - } - currentWrite = WritableStreamDefaultWriterWrite(writer, value).catch(function () {}); - }); - }).then(pipeLoop); - } - isOrBecomesErrored(_this, reader._closedPromise, function (storedError) { - if (preventAbort === false) { - shutdownWithAction(function () { - return WritableStreamAbort(dest, storedError); - }, true, storedError); - } else { - shutdown(true, storedError); - } - }); - isOrBecomesErrored(dest, writer._closedPromise, function (storedError) { - if (preventCancel === false) { - shutdownWithAction(function () { - return ReadableStreamCancel(_this, storedError); - }, true, storedError); - } else { - shutdown(true, storedError); - } - }); - isOrBecomesClosed(_this, reader._closedPromise, function () { - if (preventClose === false) { - shutdownWithAction(function () { - return WritableStreamDefaultWriterCloseWithErrorPropagation(writer); - }); - } else { - shutdown(); - } - }); - if (WritableStreamCloseQueuedOrInFlight(dest) === true || dest._state === 'closed') { - var destClosed = new TypeError('the destination writable stream closed before all data could be piped to it'); - if (preventCancel === false) { - shutdownWithAction(function () { - return ReadableStreamCancel(_this, destClosed); - }, true, destClosed); - } else { - shutdown(true, destClosed); - } - } - pipeLoop().catch(function (err) { - currentWrite = Promise.resolve(); - rethrowAssertionErrorRejection(err); - }); - function waitForWritesToFinish() { - var oldCurrentWrite = currentWrite; - return currentWrite.then(function () { - return oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined; - }); - } - function isOrBecomesErrored(stream, promise, action) { - if (stream._state === 'errored') { - action(stream._storedError); - } else { - promise.catch(action).catch(rethrowAssertionErrorRejection); - } - } - function isOrBecomesClosed(stream, promise, action) { - if (stream._state === 'closed') { - action(); - } else { - promise.then(action).catch(rethrowAssertionErrorRejection); - } - } - function shutdownWithAction(action, originalIsError, originalError) { - if (shuttingDown === true) { - return; - } - shuttingDown = true; - if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) { - waitForWritesToFinish().then(doTheRest); - } else { - doTheRest(); - } - function doTheRest() { - action().then(function () { - return finalize(originalIsError, originalError); - }, function (newError) { - return finalize(true, newError); - }).catch(rethrowAssertionErrorRejection); - } - } - function shutdown(isError, error) { - if (shuttingDown === true) { - return; - } - shuttingDown = true; - if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) { - waitForWritesToFinish().then(function () { - return finalize(isError, error); - }).catch(rethrowAssertionErrorRejection); - } else { - finalize(isError, error); - } - } - function finalize(isError, error) { - WritableStreamDefaultWriterRelease(writer); - ReadableStreamReaderGenericRelease(reader); - if (isError) { - reject(error); - } else { - resolve(undefined); - } - } - }); - } - }, { - key: 'tee', - value: function tee() { - if (IsReadableStream(this) === false) { - throw streamBrandCheckException('tee'); - } - var branches = ReadableStreamTee(this, false); - return createArrayFromList(branches); - } - }, { - key: 'locked', - get: function get() { - if (IsReadableStream(this) === false) { - throw streamBrandCheckException('locked'); - } - return IsReadableStreamLocked(this); - } - }]); - return ReadableStream; - }(); - module.exports = { - ReadableStream: ReadableStream, - IsReadableStreamDisturbed: IsReadableStreamDisturbed, - ReadableStreamDefaultControllerClose: ReadableStreamDefaultControllerClose, - ReadableStreamDefaultControllerEnqueue: ReadableStreamDefaultControllerEnqueue, - ReadableStreamDefaultControllerError: ReadableStreamDefaultControllerError, - ReadableStreamDefaultControllerGetDesiredSize: ReadableStreamDefaultControllerGetDesiredSize + }); + } +} +$({ + global: true, + wrap: true, + forced: FORCED +}, { Promise: PromiseConstructor }); +setToStringTag(PromiseConstructor, PROMISE, false, true); +setSpecies(PROMISE); +PromiseWrapper = getBuiltIn(PROMISE); +$({ + target: PROMISE, + stat: true, + forced: FORCED +}, { + reject: function reject(r) { + var capability = newPromiseCapability(this); + capability.reject.call(undefined, r); + return capability.promise; + } +}); +$({ + target: PROMISE, + stat: true, + forced: IS_PURE || FORCED +}, { + resolve: function resolve(x) { + return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x); + } +}); +$({ + target: PROMISE, + stat: true, + forced: INCORRECT_ITERATION +}, { + all: function all(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = perform(function () { + var $promiseResolve = aFunction(C.resolve); + var values = []; + var counter = 0; + var remaining = 1; + iterate(iterable, function (promise) { + var index = counter++; + var alreadyCalled = false; + values.push(undefined); + remaining++; + $promiseResolve.call(C, promise).then(function (value) { + if (alreadyCalled) + return; + alreadyCalled = true; + values[index] = value; + --remaining || resolve(values); + }, reject); + }); + --remaining || resolve(values); + }); + if (result.error) + reject(result.value); + return capability.promise; + }, + race: function race(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var reject = capability.reject; + var result = perform(function () { + var $promiseResolve = aFunction(C.resolve); + iterate(iterable, function (promise) { + $promiseResolve.call(C, promise).then(capability.resolve, reject); + }); + }); + if (result.error) + reject(result.value); + return capability.promise; + } +}); + +/***/ }), +/* 120 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var global = __w_pdfjs_require__(11); +module.exports = global.Promise; + +/***/ }), +/* 121 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var redefine = __w_pdfjs_require__(29); +module.exports = function (target, src, options) { + for (var key in src) + redefine(target, key, src[key], options); + return target; +}; + +/***/ }), +/* 122 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var getBuiltIn = __w_pdfjs_require__(42); +var definePropertyModule = __w_pdfjs_require__(27); +var wellKnownSymbol = __w_pdfjs_require__(57); +var DESCRIPTORS = __w_pdfjs_require__(13); +var SPECIES = wellKnownSymbol('species'); +module.exports = function (CONSTRUCTOR_NAME) { + var Constructor = getBuiltIn(CONSTRUCTOR_NAME); + var defineProperty = definePropertyModule.f; + if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) { + defineProperty(Constructor, SPECIES, { + configurable: true, + get: function () { + return this; + } + }); + } +}; + +/***/ }), +/* 123 */ +/***/ (function(module, exports) { + +module.exports = function (it, Constructor, name) { + if (!(it instanceof Constructor)) { + throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation'); + } + return it; +}; + +/***/ }), +/* 124 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var anObject = __w_pdfjs_require__(28); +var isArrayIteratorMethod = __w_pdfjs_require__(92); +var toLength = __w_pdfjs_require__(47); +var bind = __w_pdfjs_require__(62); +var getIteratorMethod = __w_pdfjs_require__(94); +var callWithSafeIterationClosing = __w_pdfjs_require__(91); +var Result = function (stopped, result) { + this.stopped = stopped; + this.result = result; +}; +var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) { + var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1); + var iterator, iterFn, index, length, result, next, step; + if (IS_ITERATOR) { + iterator = iterable; + } else { + iterFn = getIteratorMethod(iterable); + if (typeof iterFn != 'function') + throw TypeError('Target is not iterable'); + if (isArrayIteratorMethod(iterFn)) { + for (index = 0, length = toLength(iterable.length); length > index; index++) { + result = AS_ENTRIES ? boundFunction(anObject(step = iterable[index])[0], step[1]) : boundFunction(iterable[index]); + if (result && result instanceof Result) + return result; + } + return new Result(false); + } + iterator = iterFn.call(iterable); + } + next = iterator.next; + while (!(step = next.call(iterator)).done) { + result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES); + if (typeof result == 'object' && result && result instanceof Result) + return result; + } + return new Result(false); +}; +iterate.stop = function (result) { + return new Result(true, result); +}; + +/***/ }), +/* 125 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var global = __w_pdfjs_require__(11); +var fails = __w_pdfjs_require__(14); +var classof = __w_pdfjs_require__(19); +var bind = __w_pdfjs_require__(62); +var html = __w_pdfjs_require__(74); +var createElement = __w_pdfjs_require__(25); +var IS_IOS = __w_pdfjs_require__(126); +var location = global.location; +var set = global.setImmediate; +var clear = global.clearImmediate; +var process = global.process; +var MessageChannel = global.MessageChannel; +var Dispatch = global.Dispatch; +var counter = 0; +var queue = {}; +var ONREADYSTATECHANGE = 'onreadystatechange'; +var defer, channel, port; +var run = function (id) { + if (queue.hasOwnProperty(id)) { + var fn = queue[id]; + delete queue[id]; + fn(); + } +}; +var runner = function (id) { + return function () { + run(id); + }; +}; +var listener = function (event) { + run(event.data); +}; +var post = function (id) { + global.postMessage(id + '', location.protocol + '//' + location.host); +}; +if (!set || !clear) { + set = function setImmediate(fn) { + var args = []; + var i = 1; + while (arguments.length > i) + args.push(arguments[i++]); + queue[++counter] = function () { + (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args); }; - function AcquireReadableStreamBYOBReader(stream) { - return new ReadableStreamBYOBReader(stream); - } - function AcquireReadableStreamDefaultReader(stream) { - return new ReadableStreamDefaultReader(stream); - } - function IsReadableStream(x) { - if (!typeIsObject(x)) { - return false; - } - if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) { - return false; - } - return true; - } - function IsReadableStreamDisturbed(stream) { - assert(IsReadableStream(stream) === true, 'IsReadableStreamDisturbed should only be used on known readable streams'); - return stream._disturbed; - } - function IsReadableStreamLocked(stream) { - assert(IsReadableStream(stream) === true, 'IsReadableStreamLocked should only be used on known readable streams'); - if (stream._reader === undefined) { - return false; - } - return true; - } - function ReadableStreamTee(stream, cloneForBranch2) { - assert(IsReadableStream(stream) === true); - assert(typeof cloneForBranch2 === 'boolean'); - var reader = AcquireReadableStreamDefaultReader(stream); - var teeState = { - closedOrErrored: false, - canceled1: false, - canceled2: false, - reason1: undefined, - reason2: undefined - }; - teeState.promise = new Promise(function (resolve) { - teeState._resolve = resolve; - }); - var pull = create_ReadableStreamTeePullFunction(); - pull._reader = reader; - pull._teeState = teeState; - pull._cloneForBranch2 = cloneForBranch2; - var cancel1 = create_ReadableStreamTeeBranch1CancelFunction(); - cancel1._stream = stream; - cancel1._teeState = teeState; - var cancel2 = create_ReadableStreamTeeBranch2CancelFunction(); - cancel2._stream = stream; - cancel2._teeState = teeState; - var underlyingSource1 = Object.create(Object.prototype); - createDataProperty(underlyingSource1, 'pull', pull); - createDataProperty(underlyingSource1, 'cancel', cancel1); - var branch1Stream = new ReadableStream(underlyingSource1); - var underlyingSource2 = Object.create(Object.prototype); - createDataProperty(underlyingSource2, 'pull', pull); - createDataProperty(underlyingSource2, 'cancel', cancel2); - var branch2Stream = new ReadableStream(underlyingSource2); - pull._branch1 = branch1Stream._readableStreamController; - pull._branch2 = branch2Stream._readableStreamController; - reader._closedPromise.catch(function (r) { - if (teeState.closedOrErrored === true) { - return; - } - ReadableStreamDefaultControllerError(pull._branch1, r); - ReadableStreamDefaultControllerError(pull._branch2, r); - teeState.closedOrErrored = true; - }); - return [branch1Stream, branch2Stream]; - } - function create_ReadableStreamTeePullFunction() { - function f() { - var reader = f._reader, - branch1 = f._branch1, - branch2 = f._branch2, - teeState = f._teeState; - return ReadableStreamDefaultReaderRead(reader).then(function (result) { - assert(typeIsObject(result)); - var value = result.value; - var done = result.done; - assert(typeof done === 'boolean'); - if (done === true && teeState.closedOrErrored === false) { - if (teeState.canceled1 === false) { - ReadableStreamDefaultControllerClose(branch1); - } - if (teeState.canceled2 === false) { - ReadableStreamDefaultControllerClose(branch2); - } - teeState.closedOrErrored = true; - } - if (teeState.closedOrErrored === true) { - return; - } - var value1 = value; - var value2 = value; - if (teeState.canceled1 === false) { - ReadableStreamDefaultControllerEnqueue(branch1, value1); - } - if (teeState.canceled2 === false) { - ReadableStreamDefaultControllerEnqueue(branch2, value2); - } - }); - } - return f; - } - function create_ReadableStreamTeeBranch1CancelFunction() { - function f(reason) { - var stream = f._stream, - teeState = f._teeState; - teeState.canceled1 = true; - teeState.reason1 = reason; - if (teeState.canceled2 === true) { - var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]); - var cancelResult = ReadableStreamCancel(stream, compositeReason); - teeState._resolve(cancelResult); - } - return teeState.promise; - } - return f; - } - function create_ReadableStreamTeeBranch2CancelFunction() { - function f(reason) { - var stream = f._stream, - teeState = f._teeState; - teeState.canceled2 = true; - teeState.reason2 = reason; - if (teeState.canceled1 === true) { - var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]); - var cancelResult = ReadableStreamCancel(stream, compositeReason); - teeState._resolve(cancelResult); - } - return teeState.promise; - } - return f; - } - function ReadableStreamAddReadIntoRequest(stream) { - assert(IsReadableStreamBYOBReader(stream._reader) === true); - assert(stream._state === 'readable' || stream._state === 'closed'); - var promise = new Promise(function (resolve, reject) { - var readIntoRequest = { - _resolve: resolve, - _reject: reject - }; - stream._reader._readIntoRequests.push(readIntoRequest); - }); - return promise; - } - function ReadableStreamAddReadRequest(stream) { - assert(IsReadableStreamDefaultReader(stream._reader) === true); - assert(stream._state === 'readable'); - var promise = new Promise(function (resolve, reject) { - var readRequest = { - _resolve: resolve, - _reject: reject - }; - stream._reader._readRequests.push(readRequest); - }); - return promise; - } - function ReadableStreamCancel(stream, reason) { - stream._disturbed = true; - if (stream._state === 'closed') { - return Promise.resolve(undefined); - } - if (stream._state === 'errored') { - return Promise.reject(stream._storedError); - } - ReadableStreamClose(stream); - var sourceCancelPromise = stream._readableStreamController.__cancelSteps(reason); - return sourceCancelPromise.then(function () { - return undefined; + defer(counter); + return counter; + }; + clear = function clearImmediate(id) { + delete queue[id]; + }; + if (classof(process) == 'process') { + defer = function (id) { + process.nextTick(runner(id)); + }; + } else if (Dispatch && Dispatch.now) { + defer = function (id) { + Dispatch.now(runner(id)); + }; + } else if (MessageChannel && !IS_IOS) { + channel = new MessageChannel(); + port = channel.port2; + channel.port1.onmessage = listener; + defer = bind(port.postMessage, port, 1); + } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts && !fails(post) && location.protocol !== 'file:') { + defer = post; + global.addEventListener('message', listener, false); + } else if (ONREADYSTATECHANGE in createElement('script')) { + defer = function (id) { + html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () { + html.removeChild(this); + run(id); + }; + }; + } else { + defer = function (id) { + setTimeout(runner(id), 0); + }; + } +} +module.exports = { + set: set, + clear: clear +}; + +/***/ }), +/* 126 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var userAgent = __w_pdfjs_require__(127); +module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent); + +/***/ }), +/* 127 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var getBuiltIn = __w_pdfjs_require__(42); +module.exports = getBuiltIn('navigator', 'userAgent') || ''; + +/***/ }), +/* 128 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var global = __w_pdfjs_require__(11); +var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f; +var classof = __w_pdfjs_require__(19); +var macrotask = __w_pdfjs_require__(125).set; +var IS_IOS = __w_pdfjs_require__(126); +var MutationObserver = global.MutationObserver || global.WebKitMutationObserver; +var process = global.process; +var Promise = global.Promise; +var IS_NODE = classof(process) == 'process'; +var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask'); +var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; +var flush, head, last, notify, toggle, node, promise, then; +if (!queueMicrotask) { + flush = function () { + var parent, fn; + if (IS_NODE && (parent = process.domain)) + parent.exit(); + while (head) { + fn = head.fn; + head = head.next; + try { + fn(); + } catch (error) { + if (head) + notify(); + else + last = undefined; + throw error; + } + } + last = undefined; + if (parent) + parent.enter(); + }; + if (IS_NODE) { + notify = function () { + process.nextTick(flush); + }; + } else if (MutationObserver && !IS_IOS) { + toggle = true; + node = document.createTextNode(''); + new MutationObserver(flush).observe(node, { characterData: true }); + notify = function () { + node.data = toggle = !toggle; + }; + } else if (Promise && Promise.resolve) { + promise = Promise.resolve(undefined); + then = promise.then; + notify = function () { + then.call(promise, flush); + }; + } else { + notify = function () { + macrotask.call(global, flush); + }; + } +} +module.exports = queueMicrotask || function (fn) { + var task = { + fn: fn, + next: undefined + }; + if (last) + last.next = task; + if (!head) { + head = task; + notify(); + } + last = task; +}; + +/***/ }), +/* 129 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var anObject = __w_pdfjs_require__(28); +var isObject = __w_pdfjs_require__(22); +var newPromiseCapability = __w_pdfjs_require__(130); +module.exports = function (C, x) { + anObject(C); + if (isObject(x) && x.constructor === C) + return x; + var promiseCapability = newPromiseCapability.f(C); + var resolve = promiseCapability.resolve; + resolve(x); + return promiseCapability.promise; +}; + +/***/ }), +/* 130 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var aFunction = __w_pdfjs_require__(63); +var PromiseCapability = function (C) { + var resolve, reject; + this.promise = new C(function ($$resolve, $$reject) { + if (resolve !== undefined || reject !== undefined) + throw TypeError('Bad Promise constructor'); + resolve = $$resolve; + reject = $$reject; + }); + this.resolve = aFunction(resolve); + this.reject = aFunction(reject); +}; +module.exports.f = function (C) { + return new PromiseCapability(C); +}; + +/***/ }), +/* 131 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var global = __w_pdfjs_require__(11); +module.exports = function (a, b) { + var console = global.console; + if (console && console.error) { + arguments.length === 1 ? console.error(a) : console.error(a, b); + } +}; + +/***/ }), +/* 132 */ +/***/ (function(module, exports) { + +module.exports = function (exec) { + try { + return { + error: false, + value: exec() + }; + } catch (error) { + return { + error: true, + value: error + }; + } +}; + +/***/ }), +/* 133 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var global = __w_pdfjs_require__(11); +var userAgent = __w_pdfjs_require__(127); +var process = global.process; +var versions = process && process.versions; +var v8 = versions && versions.v8; +var match, version; +if (v8) { + match = v8.split('.'); + version = match[0] + match[1]; +} else if (userAgent) { + match = userAgent.match(/Edge\/(\d+)/); + if (!match || match[1] >= 74) { + match = userAgent.match(/Chrome\/(\d+)/); + if (match) + version = match[1]; + } +} +module.exports = version && +version; + +/***/ }), +/* 134 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var aFunction = __w_pdfjs_require__(63); +var newPromiseCapabilityModule = __w_pdfjs_require__(130); +var perform = __w_pdfjs_require__(132); +var iterate = __w_pdfjs_require__(124); +$({ + target: 'Promise', + stat: true +}, { + allSettled: function allSettled(iterable) { + var C = this; + var capability = newPromiseCapabilityModule.f(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = perform(function () { + var promiseResolve = aFunction(C.resolve); + var values = []; + var counter = 0; + var remaining = 1; + iterate(iterable, function (promise) { + var index = counter++; + var alreadyCalled = false; + values.push(undefined); + remaining++; + promiseResolve.call(C, promise).then(function (value) { + if (alreadyCalled) + return; + alreadyCalled = true; + values[index] = { + status: 'fulfilled', + value: value + }; + --remaining || resolve(values); + }, function (e) { + if (alreadyCalled) + return; + alreadyCalled = true; + values[index] = { + status: 'rejected', + reason: e + }; + --remaining || resolve(values); }); - } - function ReadableStreamClose(stream) { - assert(stream._state === 'readable'); - stream._state = 'closed'; - var reader = stream._reader; - if (reader === undefined) { - return undefined; - } - if (IsReadableStreamDefaultReader(reader) === true) { - for (var i = 0; i < reader._readRequests.length; i++) { - var _resolve = reader._readRequests[i]._resolve; - _resolve(CreateIterResultObject(undefined, true)); - } - reader._readRequests = []; - } - defaultReaderClosedPromiseResolve(reader); - return undefined; - } - function ReadableStreamError(stream, e) { - assert(IsReadableStream(stream) === true, 'stream must be ReadableStream'); - assert(stream._state === 'readable', 'state must be readable'); - stream._state = 'errored'; - stream._storedError = e; - var reader = stream._reader; - if (reader === undefined) { - return undefined; - } - if (IsReadableStreamDefaultReader(reader) === true) { - for (var i = 0; i < reader._readRequests.length; i++) { - var readRequest = reader._readRequests[i]; - readRequest._reject(e); - } - reader._readRequests = []; - } else { - assert(IsReadableStreamBYOBReader(reader), 'reader must be ReadableStreamBYOBReader'); - for (var _i = 0; _i < reader._readIntoRequests.length; _i++) { - var readIntoRequest = reader._readIntoRequests[_i]; - readIntoRequest._reject(e); - } - reader._readIntoRequests = []; - } - defaultReaderClosedPromiseReject(reader, e); - reader._closedPromise.catch(function () {}); - } - function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) { - var reader = stream._reader; - assert(reader._readIntoRequests.length > 0); - var readIntoRequest = reader._readIntoRequests.shift(); - readIntoRequest._resolve(CreateIterResultObject(chunk, done)); - } - function ReadableStreamFulfillReadRequest(stream, chunk, done) { - var reader = stream._reader; - assert(reader._readRequests.length > 0); - var readRequest = reader._readRequests.shift(); - readRequest._resolve(CreateIterResultObject(chunk, done)); - } - function ReadableStreamGetNumReadIntoRequests(stream) { - return stream._reader._readIntoRequests.length; - } - function ReadableStreamGetNumReadRequests(stream) { - return stream._reader._readRequests.length; - } - function ReadableStreamHasBYOBReader(stream) { - var reader = stream._reader; - if (reader === undefined) { - return false; - } - if (IsReadableStreamBYOBReader(reader) === false) { - return false; - } - return true; - } - function ReadableStreamHasDefaultReader(stream) { - var reader = stream._reader; - if (reader === undefined) { - return false; - } - if (IsReadableStreamDefaultReader(reader) === false) { - return false; - } - return true; - } - var ReadableStreamDefaultReader = function () { - function ReadableStreamDefaultReader(stream) { - _classCallCheck(this, ReadableStreamDefaultReader); - if (IsReadableStream(stream) === false) { - throw new TypeError('ReadableStreamDefaultReader can only be constructed with a ReadableStream instance'); - } - if (IsReadableStreamLocked(stream) === true) { - throw new TypeError('This stream has already been locked for exclusive reading by another reader'); - } - ReadableStreamReaderGenericInitialize(this, stream); - this._readRequests = []; - } - _createClass(ReadableStreamDefaultReader, [{ - key: 'cancel', - value: function cancel(reason) { - if (IsReadableStreamDefaultReader(this) === false) { - return Promise.reject(defaultReaderBrandCheckException('cancel')); - } - if (this._ownerReadableStream === undefined) { - return Promise.reject(readerLockException('cancel')); - } - return ReadableStreamReaderGenericCancel(this, reason); - } - }, { - key: 'read', - value: function read() { - if (IsReadableStreamDefaultReader(this) === false) { - return Promise.reject(defaultReaderBrandCheckException('read')); - } - if (this._ownerReadableStream === undefined) { - return Promise.reject(readerLockException('read from')); - } - return ReadableStreamDefaultReaderRead(this); - } - }, { - key: 'releaseLock', - value: function releaseLock() { - if (IsReadableStreamDefaultReader(this) === false) { - throw defaultReaderBrandCheckException('releaseLock'); - } - if (this._ownerReadableStream === undefined) { - return; - } - if (this._readRequests.length > 0) { - throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled'); - } - ReadableStreamReaderGenericRelease(this); - } - }, { - key: 'closed', - get: function get() { - if (IsReadableStreamDefaultReader(this) === false) { - return Promise.reject(defaultReaderBrandCheckException('closed')); - } - return this._closedPromise; - } - }]); - return ReadableStreamDefaultReader; - }(); - var ReadableStreamBYOBReader = function () { - function ReadableStreamBYOBReader(stream) { - _classCallCheck(this, ReadableStreamBYOBReader); - if (!IsReadableStream(stream)) { - throw new TypeError('ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a ' + 'byte source'); - } - if (IsReadableByteStreamController(stream._readableStreamController) === false) { - throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' + 'source'); - } - if (IsReadableStreamLocked(stream)) { - throw new TypeError('This stream has already been locked for exclusive reading by another reader'); - } - ReadableStreamReaderGenericInitialize(this, stream); - this._readIntoRequests = []; - } - _createClass(ReadableStreamBYOBReader, [{ - key: 'cancel', - value: function cancel(reason) { - if (!IsReadableStreamBYOBReader(this)) { - return Promise.reject(byobReaderBrandCheckException('cancel')); - } - if (this._ownerReadableStream === undefined) { - return Promise.reject(readerLockException('cancel')); - } - return ReadableStreamReaderGenericCancel(this, reason); - } - }, { - key: 'read', - value: function read(view) { - if (!IsReadableStreamBYOBReader(this)) { - return Promise.reject(byobReaderBrandCheckException('read')); - } - if (this._ownerReadableStream === undefined) { - return Promise.reject(readerLockException('read from')); - } - if (!ArrayBuffer.isView(view)) { - return Promise.reject(new TypeError('view must be an array buffer view')); - } - if (view.byteLength === 0) { - return Promise.reject(new TypeError('view must have non-zero byteLength')); - } - return ReadableStreamBYOBReaderRead(this, view); - } - }, { - key: 'releaseLock', - value: function releaseLock() { - if (!IsReadableStreamBYOBReader(this)) { - throw byobReaderBrandCheckException('releaseLock'); - } - if (this._ownerReadableStream === undefined) { - return; - } - if (this._readIntoRequests.length > 0) { - throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled'); - } - ReadableStreamReaderGenericRelease(this); - } - }, { - key: 'closed', - get: function get() { - if (!IsReadableStreamBYOBReader(this)) { - return Promise.reject(byobReaderBrandCheckException('closed')); - } - return this._closedPromise; - } - }]); - return ReadableStreamBYOBReader; - }(); - function IsReadableStreamBYOBReader(x) { - if (!typeIsObject(x)) { - return false; - } - if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) { - return false; - } - return true; - } - function IsReadableStreamDefaultReader(x) { - if (!typeIsObject(x)) { - return false; - } - if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) { - return false; + }); + --remaining || resolve(values); + }); + if (result.error) + reject(result.value); + return capability.promise; + } +}); + +/***/ }), +/* 135 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var IS_PURE = __w_pdfjs_require__(37); +var NativePromise = __w_pdfjs_require__(120); +var fails = __w_pdfjs_require__(14); +var getBuiltIn = __w_pdfjs_require__(42); +var speciesConstructor = __w_pdfjs_require__(112); +var promiseResolve = __w_pdfjs_require__(129); +var redefine = __w_pdfjs_require__(29); +var NON_GENERIC = !!NativePromise && fails(function () { + NativePromise.prototype['finally'].call({ + then: function () { + } + }, function () { + }); +}); +$({ + target: 'Promise', + proto: true, + real: true, + forced: NON_GENERIC +}, { + 'finally': function (onFinally) { + var C = speciesConstructor(this, getBuiltIn('Promise')); + var isFunction = typeof onFinally == 'function'; + return this.then(isFunction ? function (x) { + return promiseResolve(C, onFinally()).then(function () { + return x; + }); + } : onFinally, isFunction ? function (e) { + return promiseResolve(C, onFinally()).then(function () { + throw e; + }); + } : onFinally); + } +}); +if (!IS_PURE && typeof NativePromise == 'function' && !NativePromise.prototype['finally']) { + redefine(NativePromise.prototype, 'finally', getBuiltIn('Promise').prototype['finally']); +} + +/***/ }), +/* 136 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(137); +__w_pdfjs_require__(142); +__w_pdfjs_require__(140); +var path = __w_pdfjs_require__(43); +module.exports = path.URL; + +/***/ }), +/* 137 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +__w_pdfjs_require__(77); +var $ = __w_pdfjs_require__(10); +var DESCRIPTORS = __w_pdfjs_require__(13); +var USE_NATIVE_URL = __w_pdfjs_require__(138); +var global = __w_pdfjs_require__(11); +var defineProperties = __w_pdfjs_require__(72); +var redefine = __w_pdfjs_require__(29); +var anInstance = __w_pdfjs_require__(123); +var has = __w_pdfjs_require__(23); +var assign = __w_pdfjs_require__(100); +var arrayFrom = __w_pdfjs_require__(90); +var codeAt = __w_pdfjs_require__(78).codeAt; +var toASCII = __w_pdfjs_require__(139); +var setToStringTag = __w_pdfjs_require__(85); +var URLSearchParamsModule = __w_pdfjs_require__(140); +var InternalStateModule = __w_pdfjs_require__(33); +var NativeURL = global.URL; +var URLSearchParams = URLSearchParamsModule.URLSearchParams; +var getInternalSearchParamsState = URLSearchParamsModule.getState; +var setInternalState = InternalStateModule.set; +var getInternalURLState = InternalStateModule.getterFor('URL'); +var floor = Math.floor; +var pow = Math.pow; +var INVALID_AUTHORITY = 'Invalid authority'; +var INVALID_SCHEME = 'Invalid scheme'; +var INVALID_HOST = 'Invalid host'; +var INVALID_PORT = 'Invalid port'; +var ALPHA = /[A-Za-z]/; +var ALPHANUMERIC = /[\d+-.A-Za-z]/; +var DIGIT = /\d/; +var HEX_START = /^(0x|0X)/; +var OCT = /^[0-7]+$/; +var DEC = /^\d+$/; +var HEX = /^[\dA-Fa-f]+$/; +var FORBIDDEN_HOST_CODE_POINT = /[\u0000\u0009\u000A\u000D #%/:?@[\\]]/; +var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\u0009\u000A\u000D #/:?@[\\]]/; +var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g; +var TAB_AND_NEW_LINE = /[\u0009\u000A\u000D]/g; +var EOF; +var parseHost = function (url, input) { + var result, codePoints, index; + if (input.charAt(0) == '[') { + if (input.charAt(input.length - 1) != ']') + return INVALID_HOST; + result = parseIPv6(input.slice(1, -1)); + if (!result) + return INVALID_HOST; + url.host = result; + } else if (!isSpecial(url)) { + if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) + return INVALID_HOST; + result = ''; + codePoints = arrayFrom(input); + for (index = 0; index < codePoints.length; index++) { + result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); + } + url.host = result; + } else { + input = toASCII(input); + if (FORBIDDEN_HOST_CODE_POINT.test(input)) + return INVALID_HOST; + result = parseIPv4(input); + if (result === null) + return INVALID_HOST; + url.host = result; + } +}; +var parseIPv4 = function (input) { + var parts = input.split('.'); + var partsLength, numbers, index, part, radix, number, ipv4; + if (parts.length && parts[parts.length - 1] == '') { + parts.pop(); + } + partsLength = parts.length; + if (partsLength > 4) + return input; + numbers = []; + for (index = 0; index < partsLength; index++) { + part = parts[index]; + if (part == '') + return input; + radix = 10; + if (part.length > 1 && part.charAt(0) == '0') { + radix = HEX_START.test(part) ? 16 : 8; + part = part.slice(radix == 8 ? 1 : 2); + } + if (part === '') { + number = 0; + } else { + if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) + return input; + number = parseInt(part, radix); + } + numbers.push(number); + } + for (index = 0; index < partsLength; index++) { + number = numbers[index]; + if (index == partsLength - 1) { + if (number >= pow(256, 5 - partsLength)) + return null; + } else if (number > 255) + return null; + } + ipv4 = numbers.pop(); + for (index = 0; index < numbers.length; index++) { + ipv4 += numbers[index] * pow(256, 3 - index); + } + return ipv4; +}; +var parseIPv6 = function (input) { + var address = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ]; + var pieceIndex = 0; + var compress = null; + var pointer = 0; + var value, length, numbersSeen, ipv4Piece, number, swaps, swap; + var char = function () { + return input.charAt(pointer); + }; + if (char() == ':') { + if (input.charAt(1) != ':') + return; + pointer += 2; + pieceIndex++; + compress = pieceIndex; + } + while (char()) { + if (pieceIndex == 8) + return; + if (char() == ':') { + if (compress !== null) + return; + pointer++; + pieceIndex++; + compress = pieceIndex; + continue; + } + value = length = 0; + while (length < 4 && HEX.test(char())) { + value = value * 16 + parseInt(char(), 16); + pointer++; + length++; + } + if (char() == '.') { + if (length == 0) + return; + pointer -= length; + if (pieceIndex > 6) + return; + numbersSeen = 0; + while (char()) { + ipv4Piece = null; + if (numbersSeen > 0) { + if (char() == '.' && numbersSeen < 4) + pointer++; + else + return; } - return true; - } - function ReadableStreamReaderGenericInitialize(reader, stream) { - reader._ownerReadableStream = stream; - stream._reader = reader; - if (stream._state === 'readable') { - defaultReaderClosedPromiseInitialize(reader); - } else if (stream._state === 'closed') { - defaultReaderClosedPromiseInitializeAsResolved(reader); + if (!DIGIT.test(char())) + return; + while (DIGIT.test(char())) { + number = parseInt(char(), 10); + if (ipv4Piece === null) + ipv4Piece = number; + else if (ipv4Piece == 0) + return; + else + ipv4Piece = ipv4Piece * 10 + number; + if (ipv4Piece > 255) + return; + pointer++; + } + address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece; + numbersSeen++; + if (numbersSeen == 2 || numbersSeen == 4) + pieceIndex++; + } + if (numbersSeen != 4) + return; + break; + } else if (char() == ':') { + pointer++; + if (!char()) + return; + } else if (char()) + return; + address[pieceIndex++] = value; + } + if (compress !== null) { + swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex != 0 && swaps > 0) { + swap = address[pieceIndex]; + address[pieceIndex--] = address[compress + swaps - 1]; + address[compress + --swaps] = swap; + } + } else if (pieceIndex != 8) + return; + return address; +}; +var findLongestZeroSequence = function (ipv6) { + var maxIndex = null; + var maxLength = 1; + var currStart = null; + var currLength = 0; + var index = 0; + for (; index < 8; index++) { + if (ipv6[index] !== 0) { + if (currLength > maxLength) { + maxIndex = currStart; + maxLength = currLength; + } + currStart = null; + currLength = 0; + } else { + if (currStart === null) + currStart = index; + ++currLength; + } + } + if (currLength > maxLength) { + maxIndex = currStart; + maxLength = currLength; + } + return maxIndex; +}; +var serializeHost = function (host) { + var result, index, compress, ignore0; + if (typeof host == 'number') { + result = []; + for (index = 0; index < 4; index++) { + result.unshift(host % 256); + host = floor(host / 256); + } + return result.join('.'); + } else if (typeof host == 'object') { + result = ''; + compress = findLongestZeroSequence(host); + for (index = 0; index < 8; index++) { + if (ignore0 && host[index] === 0) + continue; + if (ignore0) + ignore0 = false; + if (compress === index) { + result += index ? ':' : '::'; + ignore0 = true; + } else { + result += host[index].toString(16); + if (index < 7) + result += ':'; + } + } + return '[' + result + ']'; + } + return host; +}; +var C0ControlPercentEncodeSet = {}; +var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, { + ' ': 1, + '"': 1, + '<': 1, + '>': 1, + '`': 1 +}); +var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, { + '#': 1, + '?': 1, + '{': 1, + '}': 1 +}); +var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, { + '/': 1, + ':': 1, + ';': 1, + '=': 1, + '@': 1, + '[': 1, + '\\': 1, + ']': 1, + '^': 1, + '|': 1 +}); +var percentEncode = function (char, set) { + var code = codeAt(char, 0); + return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char); +}; +var specialSchemes = { + ftp: 21, + file: null, + http: 80, + https: 443, + ws: 80, + wss: 443 +}; +var isSpecial = function (url) { + return has(specialSchemes, url.scheme); +}; +var includesCredentials = function (url) { + return url.username != '' || url.password != ''; +}; +var cannotHaveUsernamePasswordPort = function (url) { + return !url.host || url.cannotBeABaseURL || url.scheme == 'file'; +}; +var isWindowsDriveLetter = function (string, normalized) { + var second; + return string.length == 2 && ALPHA.test(string.charAt(0)) && ((second = string.charAt(1)) == ':' || !normalized && second == '|'); +}; +var startsWithWindowsDriveLetter = function (string) { + var third; + return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (string.length == 2 || ((third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#')); +}; +var shortenURLsPath = function (url) { + var path = url.path; + var pathSize = path.length; + if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { + path.pop(); + } +}; +var isSingleDot = function (segment) { + return segment === '.' || segment.toLowerCase() === '%2e'; +}; +var isDoubleDot = function (segment) { + segment = segment.toLowerCase(); + return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e'; +}; +var SCHEME_START = {}; +var SCHEME = {}; +var NO_SCHEME = {}; +var SPECIAL_RELATIVE_OR_AUTHORITY = {}; +var PATH_OR_AUTHORITY = {}; +var RELATIVE = {}; +var RELATIVE_SLASH = {}; +var SPECIAL_AUTHORITY_SLASHES = {}; +var SPECIAL_AUTHORITY_IGNORE_SLASHES = {}; +var AUTHORITY = {}; +var HOST = {}; +var HOSTNAME = {}; +var PORT = {}; +var FILE = {}; +var FILE_SLASH = {}; +var FILE_HOST = {}; +var PATH_START = {}; +var PATH = {}; +var CANNOT_BE_A_BASE_URL_PATH = {}; +var QUERY = {}; +var FRAGMENT = {}; +var parseURL = function (url, input, stateOverride, base) { + var state = stateOverride || SCHEME_START; + var pointer = 0; + var buffer = ''; + var seenAt = false; + var seenBracket = false; + var seenPasswordToken = false; + var codePoints, char, bufferCodePoints, failure; + if (!stateOverride) { + url.scheme = ''; + url.username = ''; + url.password = ''; + url.host = null; + url.port = null; + url.path = []; + url.query = null; + url.fragment = null; + url.cannotBeABaseURL = false; + input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); + } + input = input.replace(TAB_AND_NEW_LINE, ''); + codePoints = arrayFrom(input); + while (pointer <= codePoints.length) { + char = codePoints[pointer]; + switch (state) { + case SCHEME_START: + if (char && ALPHA.test(char)) { + buffer += char.toLowerCase(); + state = SCHEME; + } else if (!stateOverride) { + state = NO_SCHEME; + continue; + } else + return INVALID_SCHEME; + break; + case SCHEME: + if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) { + buffer += char.toLowerCase(); + } else if (char == ':') { + if (stateOverride && (isSpecial(url) != has(specialSchemes, buffer) || buffer == 'file' && (includesCredentials(url) || url.port !== null) || url.scheme == 'file' && !url.host)) + return; + url.scheme = buffer; + if (stateOverride) { + if (isSpecial(url) && specialSchemes[url.scheme] == url.port) + url.port = null; + return; + } + buffer = ''; + if (url.scheme == 'file') { + state = FILE; + } else if (isSpecial(url) && base && base.scheme == url.scheme) { + state = SPECIAL_RELATIVE_OR_AUTHORITY; + } else if (isSpecial(url)) { + state = SPECIAL_AUTHORITY_SLASHES; + } else if (codePoints[pointer + 1] == '/') { + state = PATH_OR_AUTHORITY; + pointer++; } else { - assert(stream._state === 'errored', 'state must be errored'); - defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError); - reader._closedPromise.catch(function () {}); - } - } - function ReadableStreamReaderGenericCancel(reader, reason) { - var stream = reader._ownerReadableStream; - assert(stream !== undefined); - return ReadableStreamCancel(stream, reason); - } - function ReadableStreamReaderGenericRelease(reader) { - assert(reader._ownerReadableStream !== undefined); - assert(reader._ownerReadableStream._reader === reader); - if (reader._ownerReadableStream._state === 'readable') { - defaultReaderClosedPromiseReject(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness')); + url.cannotBeABaseURL = true; + url.path.push(''); + state = CANNOT_BE_A_BASE_URL_PATH; + } + } else if (!stateOverride) { + buffer = ''; + state = NO_SCHEME; + pointer = 0; + continue; + } else + return INVALID_SCHEME; + break; + case NO_SCHEME: + if (!base || base.cannotBeABaseURL && char != '#') + return INVALID_SCHEME; + if (base.cannotBeABaseURL && char == '#') { + url.scheme = base.scheme; + url.path = base.path.slice(); + url.query = base.query; + url.fragment = ''; + url.cannotBeABaseURL = true; + state = FRAGMENT; + break; + } + state = base.scheme == 'file' ? FILE : RELATIVE; + continue; + case SPECIAL_RELATIVE_OR_AUTHORITY: + if (char == '/' && codePoints[pointer + 1] == '/') { + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; + pointer++; + } else { + state = RELATIVE; + continue; + } + break; + case PATH_OR_AUTHORITY: + if (char == '/') { + state = AUTHORITY; + break; + } else { + state = PATH; + continue; + } + case RELATIVE: + url.scheme = base.scheme; + if (char == EOF) { + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + url.path = base.path.slice(); + url.query = base.query; + } else if (char == '/' || char == '\\' && isSpecial(url)) { + state = RELATIVE_SLASH; + } else if (char == '?') { + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + url.path = base.path.slice(); + url.query = ''; + state = QUERY; + } else if (char == '#') { + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + url.path = base.path.slice(); + url.query = base.query; + url.fragment = ''; + state = FRAGMENT; + } else { + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + url.path = base.path.slice(); + url.path.pop(); + state = PATH; + continue; + } + break; + case RELATIVE_SLASH: + if (isSpecial(url) && (char == '/' || char == '\\')) { + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; + } else if (char == '/') { + state = AUTHORITY; + } else { + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + state = PATH; + continue; + } + break; + case SPECIAL_AUTHORITY_SLASHES: + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; + if (char != '/' || buffer.charAt(pointer + 1) != '/') + continue; + pointer++; + break; + case SPECIAL_AUTHORITY_IGNORE_SLASHES: + if (char != '/' && char != '\\') { + state = AUTHORITY; + continue; + } + break; + case AUTHORITY: + if (char == '@') { + if (seenAt) + buffer = '%40' + buffer; + seenAt = true; + bufferCodePoints = arrayFrom(buffer); + for (var i = 0; i < bufferCodePoints.length; i++) { + var codePoint = bufferCodePoints[i]; + if (codePoint == ':' && !seenPasswordToken) { + seenPasswordToken = true; + continue; + } + var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet); + if (seenPasswordToken) + url.password += encodedCodePoints; + else + url.username += encodedCodePoints; + } + buffer = ''; + } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url)) { + if (seenAt && buffer == '') + return INVALID_AUTHORITY; + pointer -= arrayFrom(buffer).length + 1; + buffer = ''; + state = HOST; + } else + buffer += char; + break; + case HOST: + case HOSTNAME: + if (stateOverride && url.scheme == 'file') { + state = FILE_HOST; + continue; + } else if (char == ':' && !seenBracket) { + if (buffer == '') + return INVALID_HOST; + failure = parseHost(url, buffer); + if (failure) + return failure; + buffer = ''; + state = PORT; + if (stateOverride == HOSTNAME) + return; + } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url)) { + if (isSpecial(url) && buffer == '') + return INVALID_HOST; + if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) + return; + failure = parseHost(url, buffer); + if (failure) + return failure; + buffer = ''; + state = PATH_START; + if (stateOverride) + return; + continue; + } else { + if (char == '[') + seenBracket = true; + else if (char == ']') + seenBracket = false; + buffer += char; + } + break; + case PORT: + if (DIGIT.test(char)) { + buffer += char; + } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url) || stateOverride) { + if (buffer != '') { + var port = parseInt(buffer, 10); + if (port > 0xFFFF) + return INVALID_PORT; + url.port = isSpecial(url) && port === specialSchemes[url.scheme] ? null : port; + buffer = ''; + } + if (stateOverride) + return; + state = PATH_START; + continue; + } else + return INVALID_PORT; + break; + case FILE: + url.scheme = 'file'; + if (char == '/' || char == '\\') + state = FILE_SLASH; + else if (base && base.scheme == 'file') { + if (char == EOF) { + url.host = base.host; + url.path = base.path.slice(); + url.query = base.query; + } else if (char == '?') { + url.host = base.host; + url.path = base.path.slice(); + url.query = ''; + state = QUERY; + } else if (char == '#') { + url.host = base.host; + url.path = base.path.slice(); + url.query = base.query; + url.fragment = ''; + state = FRAGMENT; } else { - defaultReaderClosedPromiseResetToRejected(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness')); - } - reader._closedPromise.catch(function () {}); - reader._ownerReadableStream._reader = undefined; - reader._ownerReadableStream = undefined; + if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { + url.host = base.host; + url.path = base.path.slice(); + shortenURLsPath(url); + } + state = PATH; + continue; + } + } else { + state = PATH; + continue; + } + break; + case FILE_SLASH: + if (char == '/' || char == '\\') { + state = FILE_HOST; + break; + } + if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { + if (isWindowsDriveLetter(base.path[0], true)) + url.path.push(base.path[0]); + else + url.host = base.host; + } + state = PATH; + continue; + case FILE_HOST: + if (char == EOF || char == '/' || char == '\\' || char == '?' || char == '#') { + if (!stateOverride && isWindowsDriveLetter(buffer)) { + state = PATH; + } else if (buffer == '') { + url.host = ''; + if (stateOverride) + return; + state = PATH_START; + } else { + failure = parseHost(url, buffer); + if (failure) + return failure; + if (url.host == 'localhost') + url.host = ''; + if (stateOverride) + return; + buffer = ''; + state = PATH_START; + } + continue; + } else + buffer += char; + break; + case PATH_START: + if (isSpecial(url)) { + state = PATH; + if (char != '/' && char != '\\') + continue; + } else if (!stateOverride && char == '?') { + url.query = ''; + state = QUERY; + } else if (!stateOverride && char == '#') { + url.fragment = ''; + state = FRAGMENT; + } else if (char != EOF) { + state = PATH; + if (char != '/') + continue; + } + break; + case PATH: + if (char == EOF || char == '/' || char == '\\' && isSpecial(url) || !stateOverride && (char == '?' || char == '#')) { + if (isDoubleDot(buffer)) { + shortenURLsPath(url); + if (char != '/' && !(char == '\\' && isSpecial(url))) { + url.path.push(''); + } + } else if (isSingleDot(buffer)) { + if (char != '/' && !(char == '\\' && isSpecial(url))) { + url.path.push(''); + } + } else { + if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) { + if (url.host) + url.host = ''; + buffer = buffer.charAt(0) + ':'; + } + url.path.push(buffer); + } + buffer = ''; + if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) { + while (url.path.length > 1 && url.path[0] === '') { + url.path.shift(); + } + } + if (char == '?') { + url.query = ''; + state = QUERY; + } else if (char == '#') { + url.fragment = ''; + state = FRAGMENT; + } + } else { + buffer += percentEncode(char, pathPercentEncodeSet); + } + break; + case CANNOT_BE_A_BASE_URL_PATH: + if (char == '?') { + url.query = ''; + state = QUERY; + } else if (char == '#') { + url.fragment = ''; + state = FRAGMENT; + } else if (char != EOF) { + url.path[0] += percentEncode(char, C0ControlPercentEncodeSet); + } + break; + case QUERY: + if (!stateOverride && char == '#') { + url.fragment = ''; + state = FRAGMENT; + } else if (char != EOF) { + if (char == "'" && isSpecial(url)) + url.query += '%27'; + else if (char == '#') + url.query += '%23'; + else + url.query += percentEncode(char, C0ControlPercentEncodeSet); + } + break; + case FRAGMENT: + if (char != EOF) + url.fragment += percentEncode(char, fragmentPercentEncodeSet); + break; + } + pointer++; + } +}; +var URLConstructor = function URL(url) { + var that = anInstance(this, URLConstructor, 'URL'); + var base = arguments.length > 1 ? arguments[1] : undefined; + var urlString = String(url); + var state = setInternalState(that, { type: 'URL' }); + var baseState, failure; + if (base !== undefined) { + if (base instanceof URLConstructor) + baseState = getInternalURLState(base); + else { + failure = parseURL(baseState = {}, String(base)); + if (failure) + throw TypeError(failure); + } + } + failure = parseURL(state, urlString, null, baseState); + if (failure) + throw TypeError(failure); + var searchParams = state.searchParams = new URLSearchParams(); + var searchParamsState = getInternalSearchParamsState(searchParams); + searchParamsState.updateSearchParams(state.query); + searchParamsState.updateURL = function () { + state.query = String(searchParams) || null; + }; + if (!DESCRIPTORS) { + that.href = serializeURL.call(that); + that.origin = getOrigin.call(that); + that.protocol = getProtocol.call(that); + that.username = getUsername.call(that); + that.password = getPassword.call(that); + that.host = getHost.call(that); + that.hostname = getHostname.call(that); + that.port = getPort.call(that); + that.pathname = getPathname.call(that); + that.search = getSearch.call(that); + that.searchParams = getSearchParams.call(that); + that.hash = getHash.call(that); + } +}; +var URLPrototype = URLConstructor.prototype; +var serializeURL = function () { + var url = getInternalURLState(this); + var scheme = url.scheme; + var username = url.username; + var password = url.password; + var host = url.host; + var port = url.port; + var path = url.path; + var query = url.query; + var fragment = url.fragment; + var output = scheme + ':'; + if (host !== null) { + output += '//'; + if (includesCredentials(url)) { + output += username + (password ? ':' + password : '') + '@'; + } + output += serializeHost(host); + if (port !== null) + output += ':' + port; + } else if (scheme == 'file') + output += '//'; + output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; + if (query !== null) + output += '?' + query; + if (fragment !== null) + output += '#' + fragment; + return output; +}; +var getOrigin = function () { + var url = getInternalURLState(this); + var scheme = url.scheme; + var port = url.port; + if (scheme == 'blob') + try { + return new URL(scheme.path[0]).origin; + } catch (error) { + return 'null'; } - function ReadableStreamBYOBReaderRead(reader, view) { - var stream = reader._ownerReadableStream; - assert(stream !== undefined); - stream._disturbed = true; - if (stream._state === 'errored') { - return Promise.reject(stream._storedError); - } - return ReadableByteStreamControllerPullInto(stream._readableStreamController, view); + if (scheme == 'file' || !isSpecial(url)) + return 'null'; + return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : ''); +}; +var getProtocol = function () { + return getInternalURLState(this).scheme + ':'; +}; +var getUsername = function () { + return getInternalURLState(this).username; +}; +var getPassword = function () { + return getInternalURLState(this).password; +}; +var getHost = function () { + var url = getInternalURLState(this); + var host = url.host; + var port = url.port; + return host === null ? '' : port === null ? serializeHost(host) : serializeHost(host) + ':' + port; +}; +var getHostname = function () { + var host = getInternalURLState(this).host; + return host === null ? '' : serializeHost(host); +}; +var getPort = function () { + var port = getInternalURLState(this).port; + return port === null ? '' : String(port); +}; +var getPathname = function () { + var url = getInternalURLState(this); + var path = url.path; + return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; +}; +var getSearch = function () { + var query = getInternalURLState(this).query; + return query ? '?' + query : ''; +}; +var getSearchParams = function () { + return getInternalURLState(this).searchParams; +}; +var getHash = function () { + var fragment = getInternalURLState(this).fragment; + return fragment ? '#' + fragment : ''; +}; +var accessorDescriptor = function (getter, setter) { + return { + get: getter, + set: setter, + configurable: true, + enumerable: true + }; +}; +if (DESCRIPTORS) { + defineProperties(URLPrototype, { + href: accessorDescriptor(serializeURL, function (href) { + var url = getInternalURLState(this); + var urlString = String(href); + var failure = parseURL(url, urlString); + if (failure) + throw TypeError(failure); + getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); + }), + origin: accessorDescriptor(getOrigin), + protocol: accessorDescriptor(getProtocol, function (protocol) { + var url = getInternalURLState(this); + parseURL(url, String(protocol) + ':', SCHEME_START); + }), + username: accessorDescriptor(getUsername, function (username) { + var url = getInternalURLState(this); + var codePoints = arrayFrom(String(username)); + if (cannotHaveUsernamePasswordPort(url)) + return; + url.username = ''; + for (var i = 0; i < codePoints.length; i++) { + url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet); + } + }), + password: accessorDescriptor(getPassword, function (password) { + var url = getInternalURLState(this); + var codePoints = arrayFrom(String(password)); + if (cannotHaveUsernamePasswordPort(url)) + return; + url.password = ''; + for (var i = 0; i < codePoints.length; i++) { + url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet); + } + }), + host: accessorDescriptor(getHost, function (host) { + var url = getInternalURLState(this); + if (url.cannotBeABaseURL) + return; + parseURL(url, String(host), HOST); + }), + hostname: accessorDescriptor(getHostname, function (hostname) { + var url = getInternalURLState(this); + if (url.cannotBeABaseURL) + return; + parseURL(url, String(hostname), HOSTNAME); + }), + port: accessorDescriptor(getPort, function (port) { + var url = getInternalURLState(this); + if (cannotHaveUsernamePasswordPort(url)) + return; + port = String(port); + if (port == '') + url.port = null; + else + parseURL(url, port, PORT); + }), + pathname: accessorDescriptor(getPathname, function (pathname) { + var url = getInternalURLState(this); + if (url.cannotBeABaseURL) + return; + url.path = []; + parseURL(url, pathname + '', PATH_START); + }), + search: accessorDescriptor(getSearch, function (search) { + var url = getInternalURLState(this); + search = String(search); + if (search == '') { + url.query = null; + } else { + if ('?' == search.charAt(0)) + search = search.slice(1); + url.query = ''; + parseURL(url, search, QUERY); + } + getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); + }), + searchParams: accessorDescriptor(getSearchParams), + hash: accessorDescriptor(getHash, function (hash) { + var url = getInternalURLState(this); + hash = String(hash); + if (hash == '') { + url.fragment = null; + return; + } + if ('#' == hash.charAt(0)) + hash = hash.slice(1); + url.fragment = ''; + parseURL(url, hash, FRAGMENT); + }) + }); +} +redefine(URLPrototype, 'toJSON', function toJSON() { + return serializeURL.call(this); +}, { enumerable: true }); +redefine(URLPrototype, 'toString', function toString() { + return serializeURL.call(this); +}, { enumerable: true }); +if (NativeURL) { + var nativeCreateObjectURL = NativeURL.createObjectURL; + var nativeRevokeObjectURL = NativeURL.revokeObjectURL; + if (nativeCreateObjectURL) + redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) { + return nativeCreateObjectURL.apply(NativeURL, arguments); + }); + if (nativeRevokeObjectURL) + redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) { + return nativeRevokeObjectURL.apply(NativeURL, arguments); + }); +} +setToStringTag(URLConstructor, 'URL'); +$({ + global: true, + forced: !USE_NATIVE_URL, + sham: !DESCRIPTORS +}, { URL: URLConstructor }); + +/***/ }), +/* 138 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var fails = __w_pdfjs_require__(14); +var wellKnownSymbol = __w_pdfjs_require__(57); +var IS_PURE = __w_pdfjs_require__(37); +var ITERATOR = wellKnownSymbol('iterator'); +module.exports = !fails(function () { + var url = new URL('b?a=1&b=2&c=3', 'http://a'); + var searchParams = url.searchParams; + var result = ''; + url.pathname = 'c%20d'; + searchParams.forEach(function (value, key) { + searchParams['delete']('b'); + result += key + value; + }); + return IS_PURE && !url.toJSON || !searchParams.sort || url.href !== 'http://a/c%20d?a=1&c=3' || searchParams.get('c') !== '3' || String(new URLSearchParams('?a=1')) !== 'a=1' || !searchParams[ITERATOR] || new URL('https://a@b').username !== 'a' || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' || new URL('http://тест').host !== 'xn--e1aybc' || new URL('http://a#б').hash !== '#%D0%B1' || result !== 'a1c3' || new URL('http://x', undefined).host !== 'x'; +}); + +/***/ }), +/* 139 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var maxInt = 2147483647; +var base = 36; +var tMin = 1; +var tMax = 26; +var skew = 38; +var damp = 700; +var initialBias = 72; +var initialN = 128; +var delimiter = '-'; +var regexNonASCII = /[^\0-\u007E]/; +var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; +var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process'; +var baseMinusTMin = base - tMin; +var floor = Math.floor; +var stringFromCharCode = String.fromCharCode; +var ucs2decode = function (string) { + var output = []; + var counter = 0; + var length = string.length; + while (counter < length) { + var value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + var extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + output.push(value); + counter--; + } + } else { + output.push(value); } - function ReadableStreamDefaultReaderRead(reader) { - var stream = reader._ownerReadableStream; - assert(stream !== undefined); - stream._disturbed = true; - if (stream._state === 'closed') { - return Promise.resolve(CreateIterResultObject(undefined, true)); - } - if (stream._state === 'errored') { - return Promise.reject(stream._storedError); - } - assert(stream._state === 'readable'); - return stream._readableStreamController.__pullSteps(); - } - var ReadableStreamDefaultController = function () { - function ReadableStreamDefaultController(stream, underlyingSource, size, highWaterMark) { - _classCallCheck(this, ReadableStreamDefaultController); - if (IsReadableStream(stream) === false) { - throw new TypeError('ReadableStreamDefaultController can only be constructed with a ReadableStream instance'); - } - if (stream._readableStreamController !== undefined) { - throw new TypeError('ReadableStreamDefaultController instances can only be created by the ReadableStream constructor'); - } - this._controlledReadableStream = stream; - this._underlyingSource = underlyingSource; - this._queue = undefined; - this._queueTotalSize = undefined; - ResetQueue(this); - this._started = false; - this._closeRequested = false; - this._pullAgain = false; - this._pulling = false; - var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark); - this._strategySize = normalizedStrategy.size; - this._strategyHWM = normalizedStrategy.highWaterMark; - var controller = this; - var startResult = InvokeOrNoop(underlyingSource, 'start', [this]); - Promise.resolve(startResult).then(function () { - controller._started = true; - assert(controller._pulling === false); - assert(controller._pullAgain === false); - ReadableStreamDefaultControllerCallPullIfNeeded(controller); - }, function (r) { - ReadableStreamDefaultControllerErrorIfNeeded(controller, r); - }).catch(rethrowAssertionErrorRejection); - } - _createClass(ReadableStreamDefaultController, [{ - key: 'close', - value: function close() { - if (IsReadableStreamDefaultController(this) === false) { - throw defaultControllerBrandCheckException('close'); - } - if (this._closeRequested === true) { - throw new TypeError('The stream has already been closed; do not close it again!'); - } - var state = this._controlledReadableStream._state; - if (state !== 'readable') { - throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed'); - } - ReadableStreamDefaultControllerClose(this); - } - }, { - key: 'enqueue', - value: function enqueue(chunk) { - if (IsReadableStreamDefaultController(this) === false) { - throw defaultControllerBrandCheckException('enqueue'); - } - if (this._closeRequested === true) { - throw new TypeError('stream is closed or draining'); - } - var state = this._controlledReadableStream._state; - if (state !== 'readable') { - throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to'); - } - return ReadableStreamDefaultControllerEnqueue(this, chunk); - } - }, { - key: 'error', - value: function error(e) { - if (IsReadableStreamDefaultController(this) === false) { - throw defaultControllerBrandCheckException('error'); - } - var stream = this._controlledReadableStream; - if (stream._state !== 'readable') { - throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored'); - } - ReadableStreamDefaultControllerError(this, e); - } - }, { - key: '__cancelSteps', - value: function __cancelSteps(reason) { - ResetQueue(this); - return PromiseInvokeOrNoop(this._underlyingSource, 'cancel', [reason]); - } - }, { - key: '__pullSteps', - value: function __pullSteps() { - var stream = this._controlledReadableStream; - if (this._queue.length > 0) { - var chunk = DequeueValue(this); - if (this._closeRequested === true && this._queue.length === 0) { - ReadableStreamClose(stream); - } else { - ReadableStreamDefaultControllerCallPullIfNeeded(this); - } - return Promise.resolve(CreateIterResultObject(chunk, false)); - } - var pendingPromise = ReadableStreamAddReadRequest(stream); - ReadableStreamDefaultControllerCallPullIfNeeded(this); - return pendingPromise; - } - }, { - key: 'desiredSize', - get: function get() { - if (IsReadableStreamDefaultController(this) === false) { - throw defaultControllerBrandCheckException('desiredSize'); - } - return ReadableStreamDefaultControllerGetDesiredSize(this); - } - }]); - return ReadableStreamDefaultController; - }(); - function IsReadableStreamDefaultController(x) { - if (!typeIsObject(x)) { - return false; - } - if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSource')) { - return false; - } - return true; + } + return output; +}; +var digitToBasic = function (digit) { + return digit + 22 + 75 * (digit < 26); +}; +var adapt = function (delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); +}; +var encode = function (input) { + var output = []; + input = ucs2decode(input); + var inputLength = input.length; + var n = initialN; + var delta = 0; + var bias = initialBias; + var i, currentValue; + for (i = 0; i < input.length; i++) { + currentValue = input[i]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + var basicLength = output.length; + var handledCPCount = basicLength; + if (basicLength) { + output.push(delimiter); + } + while (handledCPCount < inputLength) { + var m = maxInt; + for (i = 0; i < input.length; i++) { + currentValue = input[i]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + var handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + throw RangeError(OVERFLOW_ERROR); + } + delta += (m - n) * handledCPCountPlusOne; + n = m; + for (i = 0; i < input.length; i++) { + currentValue = input[i]; + if (currentValue < n && ++delta > maxInt) { + throw RangeError(OVERFLOW_ERROR); + } + if (currentValue == n) { + var q = delta; + for (var k = base;; k += base) { + var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; + if (q < t) + break; + var qMinusT = q - t; + var baseMinusT = base - t; + output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT))); + q = floor(qMinusT / baseMinusT); + } + output.push(stringFromCharCode(digitToBasic(q))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + ++delta; + ++n; + } + return output.join(''); +}; +module.exports = function (input) { + var encoded = []; + var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.'); + var i, label; + for (i = 0; i < labels.length; i++) { + label = labels[i]; + encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label); + } + return encoded.join('.'); +}; + +/***/ }), +/* 140 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +__w_pdfjs_require__(118); +var $ = __w_pdfjs_require__(10); +var getBuiltIn = __w_pdfjs_require__(42); +var USE_NATIVE_URL = __w_pdfjs_require__(138); +var redefine = __w_pdfjs_require__(29); +var redefineAll = __w_pdfjs_require__(121); +var setToStringTag = __w_pdfjs_require__(85); +var createIteratorConstructor = __w_pdfjs_require__(80); +var InternalStateModule = __w_pdfjs_require__(33); +var anInstance = __w_pdfjs_require__(123); +var hasOwn = __w_pdfjs_require__(23); +var bind = __w_pdfjs_require__(62); +var classof = __w_pdfjs_require__(95); +var anObject = __w_pdfjs_require__(28); +var isObject = __w_pdfjs_require__(22); +var create = __w_pdfjs_require__(71); +var createPropertyDescriptor = __w_pdfjs_require__(16); +var getIterator = __w_pdfjs_require__(141); +var getIteratorMethod = __w_pdfjs_require__(94); +var wellKnownSymbol = __w_pdfjs_require__(57); +var $fetch = getBuiltIn('fetch'); +var Headers = getBuiltIn('Headers'); +var ITERATOR = wellKnownSymbol('iterator'); +var URL_SEARCH_PARAMS = 'URLSearchParams'; +var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator'; +var setInternalState = InternalStateModule.set; +var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS); +var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR); +var plus = /\+/g; +var sequences = Array(4); +var percentSequence = function (bytes) { + return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\da-f]{2}){' + bytes + '})', 'gi')); +}; +var percentDecode = function (sequence) { + try { + return decodeURIComponent(sequence); + } catch (error) { + return sequence; + } +}; +var deserialize = function (it) { + var result = it.replace(plus, ' '); + var bytes = 4; + try { + return decodeURIComponent(result); + } catch (error) { + while (bytes) { + result = result.replace(percentSequence(bytes--), percentDecode); } - function ReadableStreamDefaultControllerCallPullIfNeeded(controller) { - var shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller); - if (shouldPull === false) { - return undefined; - } - if (controller._pulling === true) { - controller._pullAgain = true; - return undefined; - } - assert(controller._pullAgain === false); - controller._pulling = true; - var pullPromise = PromiseInvokeOrNoop(controller._underlyingSource, 'pull', [controller]); - pullPromise.then(function () { - controller._pulling = false; - if (controller._pullAgain === true) { - controller._pullAgain = false; - return ReadableStreamDefaultControllerCallPullIfNeeded(controller); - } - return undefined; - }, function (e) { - ReadableStreamDefaultControllerErrorIfNeeded(controller, e); - }).catch(rethrowAssertionErrorRejection); - return undefined; + return result; + } +}; +var find = /[!'()~]|%20/g; +var replace = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+' +}; +var replacer = function (match) { + return replace[match]; +}; +var serialize = function (it) { + return encodeURIComponent(it).replace(find, replacer); +}; +var parseSearchParams = function (result, query) { + if (query) { + var attributes = query.split('&'); + var index = 0; + var attribute, entry; + while (index < attributes.length) { + attribute = attributes[index++]; + if (attribute.length) { + entry = attribute.split('='); + result.push({ + key: deserialize(entry.shift()), + value: deserialize(entry.join('=')) + }); + } } - function ReadableStreamDefaultControllerShouldCallPull(controller) { - var stream = controller._controlledReadableStream; - if (stream._state === 'closed' || stream._state === 'errored') { - return false; - } - if (controller._closeRequested === true) { - return false; - } - if (controller._started === false) { - return false; - } - if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) { - return true; - } - var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller); - if (desiredSize > 0) { - return true; - } - return false; + } +}; +var updateSearchParams = function (query) { + this.entries.length = 0; + parseSearchParams(this.entries, query); +}; +var validateArgumentsLength = function (passed, required) { + if (passed < required) + throw TypeError('Not enough arguments'); +}; +var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) { + setInternalState(this, { + type: URL_SEARCH_PARAMS_ITERATOR, + iterator: getIterator(getInternalParamsState(params).entries), + kind: kind + }); +}, 'Iterator', function next() { + var state = getInternalIteratorState(this); + var kind = state.kind; + var step = state.iterator.next(); + var entry = step.value; + if (!step.done) { + step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [ + entry.key, + entry.value + ]; + } + return step; +}); +var URLSearchParamsConstructor = function URLSearchParams() { + anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS); + var init = arguments.length > 0 ? arguments[0] : undefined; + var that = this; + var entries = []; + var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key; + setInternalState(that, { + type: URL_SEARCH_PARAMS, + entries: entries, + updateURL: function () { + }, + updateSearchParams: updateSearchParams + }); + if (init !== undefined) { + if (isObject(init)) { + iteratorMethod = getIteratorMethod(init); + if (typeof iteratorMethod === 'function') { + iterator = iteratorMethod.call(init); + next = iterator.next; + while (!(step = next.call(iterator)).done) { + entryIterator = getIterator(anObject(step.value)); + entryNext = entryIterator.next; + if ((first = entryNext.call(entryIterator)).done || (second = entryNext.call(entryIterator)).done || !entryNext.call(entryIterator).done) + throw TypeError('Expected sequence with length 2'); + entries.push({ + key: first.value + '', + value: second.value + '' + }); + } + } else + for (key in init) + if (hasOwn(init, key)) + entries.push({ + key: key, + value: init[key] + '' + }); + } else { + parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + ''); } - function ReadableStreamDefaultControllerClose(controller) { - var stream = controller._controlledReadableStream; - assert(controller._closeRequested === false); - assert(stream._state === 'readable'); - controller._closeRequested = true; - if (controller._queue.length === 0) { - ReadableStreamClose(stream); - } - } - function ReadableStreamDefaultControllerEnqueue(controller, chunk) { - var stream = controller._controlledReadableStream; - assert(controller._closeRequested === false); - assert(stream._state === 'readable'); - if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) { - ReadableStreamFulfillReadRequest(stream, chunk, false); - } else { - var chunkSize = 1; - if (controller._strategySize !== undefined) { - var strategySize = controller._strategySize; - try { - chunkSize = strategySize(chunk); - } catch (chunkSizeE) { - ReadableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE); - throw chunkSizeE; - } - } - try { - EnqueueValueWithSize(controller, chunk, chunkSize); - } catch (enqueueE) { - ReadableStreamDefaultControllerErrorIfNeeded(controller, enqueueE); - throw enqueueE; - } - } - ReadableStreamDefaultControllerCallPullIfNeeded(controller); - return undefined; + } +}; +var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype; +redefineAll(URLSearchParamsPrototype, { + append: function append(name, value) { + validateArgumentsLength(arguments.length, 2); + var state = getInternalParamsState(this); + state.entries.push({ + key: name + '', + value: value + '' + }); + state.updateURL(); + }, + 'delete': function (name) { + validateArgumentsLength(arguments.length, 1); + var state = getInternalParamsState(this); + var entries = state.entries; + var key = name + ''; + var index = 0; + while (index < entries.length) { + if (entries[index].key === key) + entries.splice(index, 1); + else + index++; + } + state.updateURL(); + }, + get: function get(name) { + validateArgumentsLength(arguments.length, 1); + var entries = getInternalParamsState(this).entries; + var key = name + ''; + var index = 0; + for (; index < entries.length; index++) { + if (entries[index].key === key) + return entries[index].value; } - function ReadableStreamDefaultControllerError(controller, e) { - var stream = controller._controlledReadableStream; - assert(stream._state === 'readable'); - ResetQueue(controller); - ReadableStreamError(stream, e); + return null; + }, + getAll: function getAll(name) { + validateArgumentsLength(arguments.length, 1); + var entries = getInternalParamsState(this).entries; + var key = name + ''; + var result = []; + var index = 0; + for (; index < entries.length; index++) { + if (entries[index].key === key) + result.push(entries[index].value); } - function ReadableStreamDefaultControllerErrorIfNeeded(controller, e) { - if (controller._controlledReadableStream._state === 'readable') { - ReadableStreamDefaultControllerError(controller, e); - } + return result; + }, + has: function has(name) { + validateArgumentsLength(arguments.length, 1); + var entries = getInternalParamsState(this).entries; + var key = name + ''; + var index = 0; + while (index < entries.length) { + if (entries[index++].key === key) + return true; } - function ReadableStreamDefaultControllerGetDesiredSize(controller) { - var stream = controller._controlledReadableStream; - var state = stream._state; - if (state === 'errored') { - return null; - } - if (state === 'closed') { - return 0; + return false; + }, + set: function set(name, value) { + validateArgumentsLength(arguments.length, 1); + var state = getInternalParamsState(this); + var entries = state.entries; + var found = false; + var key = name + ''; + var val = value + ''; + var index = 0; + var entry; + for (; index < entries.length; index++) { + entry = entries[index]; + if (entry.key === key) { + if (found) + entries.splice(index--, 1); + else { + found = true; + entry.value = val; + } + } + } + if (!found) + entries.push({ + key: key, + value: val + }); + state.updateURL(); + }, + sort: function sort() { + var state = getInternalParamsState(this); + var entries = state.entries; + var slice = entries.slice(); + var entry, entriesIndex, sliceIndex; + entries.length = 0; + for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) { + entry = slice[sliceIndex]; + for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) { + if (entries[entriesIndex].key > entry.key) { + entries.splice(entriesIndex, 0, entry); + break; + } + } + if (entriesIndex === sliceIndex) + entries.push(entry); + } + state.updateURL(); + }, + forEach: function forEach(callback) { + var entries = getInternalParamsState(this).entries; + var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3); + var index = 0; + var entry; + while (index < entries.length) { + entry = entries[index++]; + boundFunction(entry.value, entry.key, this); + } + }, + keys: function keys() { + return new URLSearchParamsIterator(this, 'keys'); + }, + values: function values() { + return new URLSearchParamsIterator(this, 'values'); + }, + entries: function entries() { + return new URLSearchParamsIterator(this, 'entries'); + } +}, { enumerable: true }); +redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries); +redefine(URLSearchParamsPrototype, 'toString', function toString() { + var entries = getInternalParamsState(this).entries; + var result = []; + var index = 0; + var entry; + while (index < entries.length) { + entry = entries[index++]; + result.push(serialize(entry.key) + '=' + serialize(entry.value)); + } + return result.join('&'); +}, { enumerable: true }); +setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS); +$({ + global: true, + forced: !USE_NATIVE_URL +}, { URLSearchParams: URLSearchParamsConstructor }); +if (!USE_NATIVE_URL && typeof $fetch == 'function' && typeof Headers == 'function') { + $({ + global: true, + enumerable: true, + forced: true + }, { + fetch: function fetch(input) { + var args = [input]; + var init, body, headers; + if (arguments.length > 1) { + init = arguments[1]; + if (isObject(init)) { + body = init.body; + if (classof(body) === URL_SEARCH_PARAMS) { + headers = init.headers ? new Headers(init.headers) : new Headers(); + if (!headers.has('content-type')) { + headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); + } + init = create(init, { + body: createPropertyDescriptor(0, String(body)), + headers: createPropertyDescriptor(0, headers) + }); + } } - return controller._strategyHWM - controller._queueTotalSize; + args.push(init); + } + return $fetch.apply(this, args); } - var ReadableStreamBYOBRequest = function () { - function ReadableStreamBYOBRequest(controller, view) { - _classCallCheck(this, ReadableStreamBYOBRequest); - this._associatedReadableByteStreamController = controller; - this._view = view; - } - _createClass(ReadableStreamBYOBRequest, [{ - key: 'respond', - value: function respond(bytesWritten) { - if (IsReadableStreamBYOBRequest(this) === false) { - throw byobRequestBrandCheckException('respond'); - } - if (this._associatedReadableByteStreamController === undefined) { - throw new TypeError('This BYOB request has been invalidated'); - } - ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten); - } - }, { - key: 'respondWithNewView', - value: function respondWithNewView(view) { - if (IsReadableStreamBYOBRequest(this) === false) { - throw byobRequestBrandCheckException('respond'); - } - if (this._associatedReadableByteStreamController === undefined) { - throw new TypeError('This BYOB request has been invalidated'); - } - if (!ArrayBuffer.isView(view)) { - throw new TypeError('You can only respond with array buffer views'); - } - ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view); - } - }, { - key: 'view', - get: function get() { - return this._view; - } - }]); - return ReadableStreamBYOBRequest; - }(); - var ReadableByteStreamController = function () { - function ReadableByteStreamController(stream, underlyingByteSource, highWaterMark) { - _classCallCheck(this, ReadableByteStreamController); - if (IsReadableStream(stream) === false) { - throw new TypeError('ReadableByteStreamController can only be constructed with a ReadableStream instance given ' + 'a byte source'); - } - if (stream._readableStreamController !== undefined) { - throw new TypeError('ReadableByteStreamController instances can only be created by the ReadableStream constructor given a byte ' + 'source'); - } - this._controlledReadableStream = stream; - this._underlyingByteSource = underlyingByteSource; - this._pullAgain = false; - this._pulling = false; - ReadableByteStreamControllerClearPendingPullIntos(this); - this._queue = this._queueTotalSize = undefined; - ResetQueue(this); - this._closeRequested = false; - this._started = false; - this._strategyHWM = ValidateAndNormalizeHighWaterMark(highWaterMark); - var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize; - if (autoAllocateChunkSize !== undefined) { - if (Number.isInteger(autoAllocateChunkSize) === false || autoAllocateChunkSize <= 0) { - throw new RangeError('autoAllocateChunkSize must be a positive integer'); - } - } - this._autoAllocateChunkSize = autoAllocateChunkSize; - this._pendingPullIntos = []; - var controller = this; - var startResult = InvokeOrNoop(underlyingByteSource, 'start', [this]); - Promise.resolve(startResult).then(function () { - controller._started = true; - assert(controller._pulling === false); - assert(controller._pullAgain === false); - ReadableByteStreamControllerCallPullIfNeeded(controller); - }, function (r) { - if (stream._state === 'readable') { - ReadableByteStreamControllerError(controller, r); - } - }).catch(rethrowAssertionErrorRejection); - } - _createClass(ReadableByteStreamController, [{ - key: 'close', - value: function close() { - if (IsReadableByteStreamController(this) === false) { - throw byteStreamControllerBrandCheckException('close'); - } - if (this._closeRequested === true) { - throw new TypeError('The stream has already been closed; do not close it again!'); - } - var state = this._controlledReadableStream._state; - if (state !== 'readable') { - throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed'); - } - ReadableByteStreamControllerClose(this); - } - }, { - key: 'enqueue', - value: function enqueue(chunk) { - if (IsReadableByteStreamController(this) === false) { - throw byteStreamControllerBrandCheckException('enqueue'); - } - if (this._closeRequested === true) { - throw new TypeError('stream is closed or draining'); - } - var state = this._controlledReadableStream._state; - if (state !== 'readable') { - throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to'); - } - if (!ArrayBuffer.isView(chunk)) { - throw new TypeError('You can only enqueue array buffer views when using a ReadableByteStreamController'); - } - ReadableByteStreamControllerEnqueue(this, chunk); - } - }, { - key: 'error', - value: function error(e) { - if (IsReadableByteStreamController(this) === false) { - throw byteStreamControllerBrandCheckException('error'); - } - var stream = this._controlledReadableStream; - if (stream._state !== 'readable') { - throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored'); - } - ReadableByteStreamControllerError(this, e); - } - }, { - key: '__cancelSteps', - value: function __cancelSteps(reason) { - if (this._pendingPullIntos.length > 0) { - var firstDescriptor = this._pendingPullIntos[0]; - firstDescriptor.bytesFilled = 0; - } - ResetQueue(this); - return PromiseInvokeOrNoop(this._underlyingByteSource, 'cancel', [reason]); - } - }, { - key: '__pullSteps', - value: function __pullSteps() { - var stream = this._controlledReadableStream; - assert(ReadableStreamHasDefaultReader(stream) === true); - if (this._queueTotalSize > 0) { - assert(ReadableStreamGetNumReadRequests(stream) === 0); - var entry = this._queue.shift(); - this._queueTotalSize -= entry.byteLength; - ReadableByteStreamControllerHandleQueueDrain(this); - var view = void 0; - try { - view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength); - } catch (viewE) { - return Promise.reject(viewE); - } - return Promise.resolve(CreateIterResultObject(view, false)); - } - var autoAllocateChunkSize = this._autoAllocateChunkSize; - if (autoAllocateChunkSize !== undefined) { - var buffer = void 0; - try { - buffer = new ArrayBuffer(autoAllocateChunkSize); - } catch (bufferE) { - return Promise.reject(bufferE); - } - var pullIntoDescriptor = { - buffer: buffer, - byteOffset: 0, - byteLength: autoAllocateChunkSize, - bytesFilled: 0, - elementSize: 1, - ctor: Uint8Array, - readerType: 'default' - }; - this._pendingPullIntos.push(pullIntoDescriptor); - } - var promise = ReadableStreamAddReadRequest(stream); - ReadableByteStreamControllerCallPullIfNeeded(this); - return promise; - } - }, { - key: 'byobRequest', - get: function get() { - if (IsReadableByteStreamController(this) === false) { - throw byteStreamControllerBrandCheckException('byobRequest'); - } - if (this._byobRequest === undefined && this._pendingPullIntos.length > 0) { - var firstDescriptor = this._pendingPullIntos[0]; - var view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled); - this._byobRequest = new ReadableStreamBYOBRequest(this, view); - } - return this._byobRequest; - } - }, { - key: 'desiredSize', - get: function get() { - if (IsReadableByteStreamController(this) === false) { - throw byteStreamControllerBrandCheckException('desiredSize'); - } - return ReadableByteStreamControllerGetDesiredSize(this); - } - }]); - return ReadableByteStreamController; - }(); - function IsReadableByteStreamController(x) { - if (!typeIsObject(x)) { - return false; - } - if (!Object.prototype.hasOwnProperty.call(x, '_underlyingByteSource')) { - return false; - } - return true; + }); +} +module.exports = { + URLSearchParams: URLSearchParamsConstructor, + getState: getInternalParamsState +}; + +/***/ }), +/* 141 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var anObject = __w_pdfjs_require__(28); +var getIteratorMethod = __w_pdfjs_require__(94); +module.exports = function (it) { + var iteratorMethod = getIteratorMethod(it); + if (typeof iteratorMethod != 'function') { + throw TypeError(String(it) + ' is not iterable'); + } + return anObject(iteratorMethod.call(it)); +}; + +/***/ }), +/* 142 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +$({ + target: 'URL', + proto: true, + enumerable: true +}, { + toJSON: function toJSON() { + return URL.prototype.toString.call(this); + } +}); + +/***/ }), +/* 143 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +(function (global, factory) { + true ? factory(exports) : undefined; +}(this, function (exports) { + 'use strict'; + var SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol : function (description) { + return "Symbol(" + description + ")"; + }; + function noop() { + } + var NumberIsNaN = Number.isNaN || function (x) { + return x !== x; + }; + var rethrowAssertionErrorRejection = noop; + function typeIsObject(x) { + return typeof x === 'object' && x !== null || typeof x === 'function'; + } + function createArrayFromList(elements) { + return elements.slice(); + } + function ArrayBufferCopy(dest, destOffset, src, srcOffset, n) { + new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset); + } + function IsFiniteNonNegativeNumber(v) { + if (IsNonNegativeNumber(v) === false) { + return false; + } + if (v === Infinity) { + return false; } - function IsReadableStreamBYOBRequest(x) { - if (!typeIsObject(x)) { - return false; - } - if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) { - return false; - } - return true; + return true; + } + function IsNonNegativeNumber(v) { + if (typeof v !== 'number') { + return false; } - function ReadableByteStreamControllerCallPullIfNeeded(controller) { - var shouldPull = ReadableByteStreamControllerShouldCallPull(controller); - if (shouldPull === false) { - return undefined; - } - if (controller._pulling === true) { - controller._pullAgain = true; - return undefined; - } - assert(controller._pullAgain === false); - controller._pulling = true; - var pullPromise = PromiseInvokeOrNoop(controller._underlyingByteSource, 'pull', [controller]); - pullPromise.then(function () { - controller._pulling = false; - if (controller._pullAgain === true) { - controller._pullAgain = false; - ReadableByteStreamControllerCallPullIfNeeded(controller); - } - }, function (e) { - if (controller._controlledReadableStream._state === 'readable') { - ReadableByteStreamControllerError(controller, e); - } - }).catch(rethrowAssertionErrorRejection); - return undefined; + if (NumberIsNaN(v)) { + return false; } - function ReadableByteStreamControllerClearPendingPullIntos(controller) { - ReadableByteStreamControllerInvalidateBYOBRequest(controller); - controller._pendingPullIntos = []; + if (v < 0) { + return false; } - function ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor) { - assert(stream._state !== 'errored', 'state must not be errored'); - var done = false; - if (stream._state === 'closed') { - assert(pullIntoDescriptor.bytesFilled === 0); - done = true; + return true; + } + function Call(F, V, args) { + if (typeof F !== 'function') { + throw new TypeError('Argument is not a function'); + } + return Function.prototype.apply.call(F, V, args); + } + function CreateAlgorithmFromUnderlyingMethod(underlyingObject, methodName, algoArgCount, extraArgs) { + var method = underlyingObject[methodName]; + if (method !== undefined) { + if (typeof method !== 'function') { + throw new TypeError(method + " is not a method"); + } + switch (algoArgCount) { + case 0: { + return function () { + return PromiseCall(method, underlyingObject, extraArgs); + }; + } + case 1: { + return function (arg) { + var fullArgs = [arg].concat(extraArgs); + return PromiseCall(method, underlyingObject, fullArgs); + }; + } + } + } + return function () { + return promiseResolvedWith(undefined); + }; + } + function InvokeOrNoop(O, P, args) { + var method = O[P]; + if (method === undefined) { + return undefined; + } + return Call(method, O, args); + } + function PromiseCall(F, V, args) { + try { + return promiseResolvedWith(Call(F, V, args)); + } catch (value) { + return promiseRejectedWith(value); + } + } + function TransferArrayBuffer(O) { + return O; + } + function IsDetachedBuffer(O) { + return false; + } + function ValidateAndNormalizeHighWaterMark(highWaterMark) { + highWaterMark = Number(highWaterMark); + if (NumberIsNaN(highWaterMark) || highWaterMark < 0) { + throw new RangeError('highWaterMark property of a queuing strategy must be non-negative and non-NaN'); + } + return highWaterMark; + } + function MakeSizeAlgorithmFromSizeFunction(size) { + if (size === undefined) { + return function () { + return 1; + }; + } + if (typeof size !== 'function') { + throw new TypeError('size property of a queuing strategy must be a function'); + } + return function (chunk) { + return size(chunk); + }; + } + var originalPromise = Promise; + var originalPromiseThen = Promise.prototype.then; + var originalPromiseResolve = Promise.resolve.bind(originalPromise); + var originalPromiseReject = Promise.reject.bind(originalPromise); + function newPromise(executor) { + return new originalPromise(executor); + } + function promiseResolvedWith(value) { + return originalPromiseResolve(value); + } + function promiseRejectedWith(reason) { + return originalPromiseReject(reason); + } + function PerformPromiseThen(promise, onFulfilled, onRejected) { + return originalPromiseThen.call(promise, onFulfilled, onRejected); + } + function uponPromise(promise, onFulfilled, onRejected) { + PerformPromiseThen(PerformPromiseThen(promise, onFulfilled, onRejected), undefined, rethrowAssertionErrorRejection); + } + function uponFulfillment(promise, onFulfilled) { + uponPromise(promise, onFulfilled); + } + function uponRejection(promise, onRejected) { + uponPromise(promise, undefined, onRejected); + } + function transformPromiseWith(promise, fulfillmentHandler, rejectionHandler) { + return PerformPromiseThen(promise, fulfillmentHandler, rejectionHandler); + } + function setPromiseIsHandledToTrue(promise) { + PerformPromiseThen(promise, undefined, rethrowAssertionErrorRejection); + } + var QUEUE_MAX_ARRAY_SIZE = 16384; + var SimpleQueue = function () { + function SimpleQueue() { + this._cursor = 0; + this._size = 0; + this._front = { + _elements: [], + _next: undefined + }; + this._back = this._front; + this._cursor = 0; + this._size = 0; + } + Object.defineProperty(SimpleQueue.prototype, "length", { + get: function () { + return this._size; + }, + enumerable: true, + configurable: true + }); + SimpleQueue.prototype.push = function (element) { + var oldBack = this._back; + var newBack = oldBack; + if (oldBack._elements.length === QUEUE_MAX_ARRAY_SIZE - 1) { + newBack = { + _elements: [], + _next: undefined + }; + } + oldBack._elements.push(element); + if (newBack !== oldBack) { + this._back = newBack; + oldBack._next = newBack; + } + ++this._size; + }; + SimpleQueue.prototype.shift = function () { + var oldFront = this._front; + var newFront = oldFront; + var oldCursor = this._cursor; + var newCursor = oldCursor + 1; + var elements = oldFront._elements; + var element = elements[oldCursor]; + if (newCursor === QUEUE_MAX_ARRAY_SIZE) { + newFront = oldFront._next; + newCursor = 0; + } + --this._size; + this._cursor = newCursor; + if (oldFront !== newFront) { + this._front = newFront; + } + elements[oldCursor] = undefined; + return element; + }; + SimpleQueue.prototype.forEach = function (callback) { + var i = this._cursor; + var node = this._front; + var elements = node._elements; + while (i !== elements.length || node._next !== undefined) { + if (i === elements.length) { + node = node._next; + elements = node._elements; + i = 0; + if (elements.length === 0) { + break; + } } - var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor); - if (pullIntoDescriptor.readerType === 'default') { - ReadableStreamFulfillReadRequest(stream, filledView, done); - } else { - assert(pullIntoDescriptor.readerType === 'byob'); - ReadableStreamFulfillReadIntoRequest(stream, filledView, done); - } - } - function ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor) { - var bytesFilled = pullIntoDescriptor.bytesFilled; - var elementSize = pullIntoDescriptor.elementSize; - assert(bytesFilled <= pullIntoDescriptor.byteLength); - assert(bytesFilled % elementSize === 0); - return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize); - } - function ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byteOffset, byteLength) { - controller._queue.push({ - buffer: buffer, - byteOffset: byteOffset, - byteLength: byteLength + callback(elements[i]); + ++i; + } + }; + SimpleQueue.prototype.peek = function () { + var front = this._front; + var cursor = this._cursor; + return front._elements[cursor]; + }; + return SimpleQueue; + }(); + function ReadableStreamCreateReadResult(value, done, forAuthorCode) { + var prototype = null; + if (forAuthorCode === true) { + prototype = Object.prototype; + } + var obj = Object.create(prototype); + obj.value = value; + obj.done = done; + return obj; + } + function ReadableStreamReaderGenericInitialize(reader, stream) { + reader._forAuthorCode = true; + reader._ownerReadableStream = stream; + stream._reader = reader; + if (stream._state === 'readable') { + defaultReaderClosedPromiseInitialize(reader); + } else if (stream._state === 'closed') { + defaultReaderClosedPromiseInitializeAsResolved(reader); + } else { + defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError); + } + } + function ReadableStreamReaderGenericCancel(reader, reason) { + var stream = reader._ownerReadableStream; + return ReadableStreamCancel(stream, reason); + } + function ReadableStreamReaderGenericRelease(reader) { + if (reader._ownerReadableStream._state === 'readable') { + defaultReaderClosedPromiseReject(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness')); + } else { + defaultReaderClosedPromiseResetToRejected(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness')); + } + reader._ownerReadableStream._reader = undefined; + reader._ownerReadableStream = undefined; + } + function readerLockException(name) { + return new TypeError('Cannot ' + name + ' a stream using a released reader'); + } + function defaultReaderClosedPromiseInitialize(reader) { + reader._closedPromise = newPromise(function (resolve, reject) { + reader._closedPromise_resolve = resolve; + reader._closedPromise_reject = reject; + }); + } + function defaultReaderClosedPromiseInitializeAsRejected(reader, reason) { + defaultReaderClosedPromiseInitialize(reader); + defaultReaderClosedPromiseReject(reader, reason); + } + function defaultReaderClosedPromiseInitializeAsResolved(reader) { + defaultReaderClosedPromiseInitialize(reader); + defaultReaderClosedPromiseResolve(reader); + } + function defaultReaderClosedPromiseReject(reader, reason) { + setPromiseIsHandledToTrue(reader._closedPromise); + reader._closedPromise_reject(reason); + reader._closedPromise_resolve = undefined; + reader._closedPromise_reject = undefined; + } + function defaultReaderClosedPromiseResetToRejected(reader, reason) { + defaultReaderClosedPromiseInitializeAsRejected(reader, reason); + } + function defaultReaderClosedPromiseResolve(reader) { + reader._closedPromise_resolve(undefined); + reader._closedPromise_resolve = undefined; + reader._closedPromise_reject = undefined; + } + var CancelSteps = SymbolPolyfill('[[CancelSteps]]'); + var PullSteps = SymbolPolyfill('[[PullSteps]]'); + function AcquireReadableStreamDefaultReader(stream, forAuthorCode) { + if (forAuthorCode === void 0) { + forAuthorCode = false; + } + var reader = new ReadableStreamDefaultReader(stream); + reader._forAuthorCode = forAuthorCode; + return reader; + } + function ReadableStreamAddReadRequest(stream) { + var promise = newPromise(function (resolve, reject) { + var readRequest = { + _resolve: resolve, + _reject: reject + }; + stream._reader._readRequests.push(readRequest); + }); + return promise; + } + function ReadableStreamFulfillReadRequest(stream, chunk, done) { + var reader = stream._reader; + var readRequest = reader._readRequests.shift(); + readRequest._resolve(ReadableStreamCreateReadResult(chunk, done, reader._forAuthorCode)); + } + function ReadableStreamGetNumReadRequests(stream) { + return stream._reader._readRequests.length; + } + function ReadableStreamHasDefaultReader(stream) { + var reader = stream._reader; + if (reader === undefined) { + return false; + } + if (!IsReadableStreamDefaultReader(reader)) { + return false; + } + return true; + } + var ReadableStreamDefaultReader = function () { + function ReadableStreamDefaultReader(stream) { + if (IsReadableStream(stream) === false) { + throw new TypeError('ReadableStreamDefaultReader can only be constructed with a ReadableStream instance'); + } + if (IsReadableStreamLocked(stream) === true) { + throw new TypeError('This stream has already been locked for exclusive reading by another reader'); + } + ReadableStreamReaderGenericInitialize(this, stream); + this._readRequests = new SimpleQueue(); + } + Object.defineProperty(ReadableStreamDefaultReader.prototype, "closed", { + get: function () { + if (!IsReadableStreamDefaultReader(this)) { + return promiseRejectedWith(defaultReaderBrandCheckException('closed')); + } + return this._closedPromise; + }, + enumerable: true, + configurable: true + }); + ReadableStreamDefaultReader.prototype.cancel = function (reason) { + if (!IsReadableStreamDefaultReader(this)) { + return promiseRejectedWith(defaultReaderBrandCheckException('cancel')); + } + if (this._ownerReadableStream === undefined) { + return promiseRejectedWith(readerLockException('cancel')); + } + return ReadableStreamReaderGenericCancel(this, reason); + }; + ReadableStreamDefaultReader.prototype.read = function () { + if (!IsReadableStreamDefaultReader(this)) { + return promiseRejectedWith(defaultReaderBrandCheckException('read')); + } + if (this._ownerReadableStream === undefined) { + return promiseRejectedWith(readerLockException('read from')); + } + return ReadableStreamDefaultReaderRead(this); + }; + ReadableStreamDefaultReader.prototype.releaseLock = function () { + if (!IsReadableStreamDefaultReader(this)) { + throw defaultReaderBrandCheckException('releaseLock'); + } + if (this._ownerReadableStream === undefined) { + return; + } + if (this._readRequests.length > 0) { + throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled'); + } + ReadableStreamReaderGenericRelease(this); + }; + return ReadableStreamDefaultReader; + }(); + function IsReadableStreamDefaultReader(x) { + if (!typeIsObject(x)) { + return false; + } + if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) { + return false; + } + return true; + } + function ReadableStreamDefaultReaderRead(reader) { + var stream = reader._ownerReadableStream; + stream._disturbed = true; + if (stream._state === 'closed') { + return promiseResolvedWith(ReadableStreamCreateReadResult(undefined, true, reader._forAuthorCode)); + } + if (stream._state === 'errored') { + return promiseRejectedWith(stream._storedError); + } + return stream._readableStreamController[PullSteps](); + } + function defaultReaderBrandCheckException(name) { + return new TypeError("ReadableStreamDefaultReader.prototype." + name + " can only be used on a ReadableStreamDefaultReader"); + } + var _a; + var AsyncIteratorPrototype; + if (typeof SymbolPolyfill.asyncIterator === 'symbol') { + AsyncIteratorPrototype = (_a = {}, _a[SymbolPolyfill.asyncIterator] = function () { + return this; + }, _a); + Object.defineProperty(AsyncIteratorPrototype, SymbolPolyfill.asyncIterator, { enumerable: false }); + } + var ReadableStreamAsyncIteratorPrototype = { + next: function () { + if (IsReadableStreamAsyncIterator(this) === false) { + return promiseRejectedWith(streamAsyncIteratorBrandCheckException('next')); + } + var reader = this._asyncIteratorReader; + if (reader._ownerReadableStream === undefined) { + return promiseRejectedWith(readerLockException('iterate')); + } + return transformPromiseWith(ReadableStreamDefaultReaderRead(reader), function (result) { + var done = result.done; + if (done) { + ReadableStreamReaderGenericRelease(reader); + } + var value = result.value; + return ReadableStreamCreateReadResult(value, done, true); + }); + }, + return: function (value) { + if (IsReadableStreamAsyncIterator(this) === false) { + return promiseRejectedWith(streamAsyncIteratorBrandCheckException('next')); + } + var reader = this._asyncIteratorReader; + if (reader._ownerReadableStream === undefined) { + return promiseRejectedWith(readerLockException('finish iterating')); + } + if (reader._readRequests.length > 0) { + return promiseRejectedWith(new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled')); + } + if (this._preventCancel === false) { + var result = ReadableStreamReaderGenericCancel(reader, value); + ReadableStreamReaderGenericRelease(reader); + return transformPromiseWith(result, function () { + return ReadableStreamCreateReadResult(value, true, true); }); - controller._queueTotalSize += byteLength; - } - function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) { - var elementSize = pullIntoDescriptor.elementSize; - var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize; - var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled); - var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy; - var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize; - var totalBytesToCopyRemaining = maxBytesToCopy; - var ready = false; - if (maxAlignedBytes > currentAlignedBytes) { - totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled; - ready = true; - } - var queue = controller._queue; - while (totalBytesToCopyRemaining > 0) { - var headOfQueue = queue[0]; - var bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength); - var destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled; - ArrayBufferCopy(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy); - if (headOfQueue.byteLength === bytesToCopy) { - queue.shift(); - } else { - headOfQueue.byteOffset += bytesToCopy; - headOfQueue.byteLength -= bytesToCopy; - } - controller._queueTotalSize -= bytesToCopy; - ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor); - totalBytesToCopyRemaining -= bytesToCopy; - } - if (ready === false) { - assert(controller._queueTotalSize === 0, 'queue must be empty'); - assert(pullIntoDescriptor.bytesFilled > 0); - assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize); - } - return ready; + } + ReadableStreamReaderGenericRelease(reader); + return promiseResolvedWith(ReadableStreamCreateReadResult(value, true, true)); + } + }; + if (AsyncIteratorPrototype !== undefined) { + Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype); + } + Object.defineProperty(ReadableStreamAsyncIteratorPrototype, 'next', { enumerable: false }); + Object.defineProperty(ReadableStreamAsyncIteratorPrototype, 'return', { enumerable: false }); + function AcquireReadableStreamAsyncIterator(stream, preventCancel) { + if (preventCancel === void 0) { + preventCancel = false; + } + var reader = AcquireReadableStreamDefaultReader(stream); + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype); + iterator._asyncIteratorReader = reader; + iterator._preventCancel = Boolean(preventCancel); + return iterator; + } + function IsReadableStreamAsyncIterator(x) { + if (!typeIsObject(x)) { + return false; + } + if (!Object.prototype.hasOwnProperty.call(x, '_asyncIteratorReader')) { + return false; + } + return true; + } + function streamAsyncIteratorBrandCheckException(name) { + return new TypeError("ReadableStreamAsyncIterator." + name + " can only be used on a ReadableSteamAsyncIterator"); + } + function DequeueValue(container) { + var pair = container._queue.shift(); + container._queueTotalSize -= pair.size; + if (container._queueTotalSize < 0) { + container._queueTotalSize = 0; + } + return pair.value; + } + function EnqueueValueWithSize(container, value, size) { + size = Number(size); + if (!IsFiniteNonNegativeNumber(size)) { + throw new RangeError('Size must be a finite, non-NaN, non-negative number.'); + } + container._queue.push({ + value: value, + size: size + }); + container._queueTotalSize += size; + } + function PeekQueueValue(container) { + var pair = container._queue.peek(); + return pair.value; + } + function ResetQueue(container) { + container._queue = new SimpleQueue(); + container._queueTotalSize = 0; + } + var AbortSteps = SymbolPolyfill('[[AbortSteps]]'); + var ErrorSteps = SymbolPolyfill('[[ErrorSteps]]'); + var WritableStream = function () { + function WritableStream(underlyingSink, strategy) { + if (underlyingSink === void 0) { + underlyingSink = {}; + } + if (strategy === void 0) { + strategy = {}; + } + InitializeWritableStream(this); + var size = strategy.size; + var highWaterMark = strategy.highWaterMark; + var type = underlyingSink.type; + if (type !== undefined) { + throw new RangeError('Invalid type is specified'); + } + var sizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(size); + if (highWaterMark === undefined) { + highWaterMark = 1; + } + highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark); + SetUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, highWaterMark, sizeAlgorithm); + } + Object.defineProperty(WritableStream.prototype, "locked", { + get: function () { + if (IsWritableStream(this) === false) { + throw streamBrandCheckException('locked'); + } + return IsWritableStreamLocked(this); + }, + enumerable: true, + configurable: true + }); + WritableStream.prototype.abort = function (reason) { + if (IsWritableStream(this) === false) { + return promiseRejectedWith(streamBrandCheckException('abort')); + } + if (IsWritableStreamLocked(this) === true) { + return promiseRejectedWith(new TypeError('Cannot abort a stream that already has a writer')); + } + return WritableStreamAbort(this, reason); + }; + WritableStream.prototype.close = function () { + if (IsWritableStream(this) === false) { + return promiseRejectedWith(streamBrandCheckException('close')); + } + if (IsWritableStreamLocked(this) === true) { + return promiseRejectedWith(new TypeError('Cannot close a stream that already has a writer')); + } + if (WritableStreamCloseQueuedOrInFlight(this) === true) { + return promiseRejectedWith(new TypeError('Cannot close an already-closing stream')); + } + return WritableStreamClose(this); + }; + WritableStream.prototype.getWriter = function () { + if (IsWritableStream(this) === false) { + throw streamBrandCheckException('getWriter'); + } + return AcquireWritableStreamDefaultWriter(this); + }; + return WritableStream; + }(); + function AcquireWritableStreamDefaultWriter(stream) { + return new WritableStreamDefaultWriter(stream); + } + function CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) { + if (highWaterMark === void 0) { + highWaterMark = 1; + } + if (sizeAlgorithm === void 0) { + sizeAlgorithm = function () { + return 1; + }; + } + var stream = Object.create(WritableStream.prototype); + InitializeWritableStream(stream); + var controller = Object.create(WritableStreamDefaultController.prototype); + SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm); + return stream; + } + function InitializeWritableStream(stream) { + stream._state = 'writable'; + stream._storedError = undefined; + stream._writer = undefined; + stream._writableStreamController = undefined; + stream._writeRequests = new SimpleQueue(); + stream._inFlightWriteRequest = undefined; + stream._closeRequest = undefined; + stream._inFlightCloseRequest = undefined; + stream._pendingAbortRequest = undefined; + stream._backpressure = false; + } + function IsWritableStream(x) { + if (!typeIsObject(x)) { + return false; + } + if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) { + return false; + } + return true; + } + function IsWritableStreamLocked(stream) { + if (stream._writer === undefined) { + return false; } - function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) { - assert(controller._pendingPullIntos.length === 0 || controller._pendingPullIntos[0] === pullIntoDescriptor); - ReadableByteStreamControllerInvalidateBYOBRequest(controller); - pullIntoDescriptor.bytesFilled += size; + return true; + } + function WritableStreamAbort(stream, reason) { + var state = stream._state; + if (state === 'closed' || state === 'errored') { + return promiseResolvedWith(undefined); + } + if (stream._pendingAbortRequest !== undefined) { + return stream._pendingAbortRequest._promise; + } + var wasAlreadyErroring = false; + if (state === 'erroring') { + wasAlreadyErroring = true; + reason = undefined; + } + var promise = newPromise(function (resolve, reject) { + stream._pendingAbortRequest = { + _promise: undefined, + _resolve: resolve, + _reject: reject, + _reason: reason, + _wasAlreadyErroring: wasAlreadyErroring + }; + }); + stream._pendingAbortRequest._promise = promise; + if (wasAlreadyErroring === false) { + WritableStreamStartErroring(stream, reason); + } + return promise; + } + function WritableStreamClose(stream) { + var state = stream._state; + if (state === 'closed' || state === 'errored') { + return promiseRejectedWith(new TypeError("The stream (in " + state + " state) is not in the writable state and cannot be closed")); + } + var promise = newPromise(function (resolve, reject) { + var closeRequest = { + _resolve: resolve, + _reject: reject + }; + stream._closeRequest = closeRequest; + }); + var writer = stream._writer; + if (writer !== undefined && stream._backpressure === true && state === 'writable') { + defaultWriterReadyPromiseResolve(writer); + } + WritableStreamDefaultControllerClose(stream._writableStreamController); + return promise; + } + function WritableStreamAddWriteRequest(stream) { + var promise = newPromise(function (resolve, reject) { + var writeRequest = { + _resolve: resolve, + _reject: reject + }; + stream._writeRequests.push(writeRequest); + }); + return promise; + } + function WritableStreamDealWithRejection(stream, error) { + var state = stream._state; + if (state === 'writable') { + WritableStreamStartErroring(stream, error); + return; + } + WritableStreamFinishErroring(stream); + } + function WritableStreamStartErroring(stream, reason) { + var controller = stream._writableStreamController; + stream._state = 'erroring'; + stream._storedError = reason; + var writer = stream._writer; + if (writer !== undefined) { + WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason); + } + if (WritableStreamHasOperationMarkedInFlight(stream) === false && controller._started === true) { + WritableStreamFinishErroring(stream); + } + } + function WritableStreamFinishErroring(stream) { + stream._state = 'errored'; + stream._writableStreamController[ErrorSteps](); + var storedError = stream._storedError; + stream._writeRequests.forEach(function (writeRequest) { + writeRequest._reject(storedError); + }); + stream._writeRequests = new SimpleQueue(); + if (stream._pendingAbortRequest === undefined) { + WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); + return; + } + var abortRequest = stream._pendingAbortRequest; + stream._pendingAbortRequest = undefined; + if (abortRequest._wasAlreadyErroring === true) { + abortRequest._reject(storedError); + WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); + return; + } + var promise = stream._writableStreamController[AbortSteps](abortRequest._reason); + uponPromise(promise, function () { + abortRequest._resolve(); + WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); + }, function (reason) { + abortRequest._reject(reason); + WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); + }); + } + function WritableStreamFinishInFlightWrite(stream) { + stream._inFlightWriteRequest._resolve(undefined); + stream._inFlightWriteRequest = undefined; + } + function WritableStreamFinishInFlightWriteWithError(stream, error) { + stream._inFlightWriteRequest._reject(error); + stream._inFlightWriteRequest = undefined; + WritableStreamDealWithRejection(stream, error); + } + function WritableStreamFinishInFlightClose(stream) { + stream._inFlightCloseRequest._resolve(undefined); + stream._inFlightCloseRequest = undefined; + var state = stream._state; + if (state === 'erroring') { + stream._storedError = undefined; + if (stream._pendingAbortRequest !== undefined) { + stream._pendingAbortRequest._resolve(); + stream._pendingAbortRequest = undefined; + } + } + stream._state = 'closed'; + var writer = stream._writer; + if (writer !== undefined) { + defaultWriterClosedPromiseResolve(writer); + } + } + function WritableStreamFinishInFlightCloseWithError(stream, error) { + stream._inFlightCloseRequest._reject(error); + stream._inFlightCloseRequest = undefined; + if (stream._pendingAbortRequest !== undefined) { + stream._pendingAbortRequest._reject(error); + stream._pendingAbortRequest = undefined; + } + WritableStreamDealWithRejection(stream, error); + } + function WritableStreamCloseQueuedOrInFlight(stream) { + if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) { + return false; + } + return true; + } + function WritableStreamHasOperationMarkedInFlight(stream) { + if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) { + return false; } - function ReadableByteStreamControllerHandleQueueDrain(controller) { - assert(controller._controlledReadableStream._state === 'readable'); - if (controller._queueTotalSize === 0 && controller._closeRequested === true) { - ReadableStreamClose(controller._controlledReadableStream); + return true; + } + function WritableStreamMarkCloseRequestInFlight(stream) { + stream._inFlightCloseRequest = stream._closeRequest; + stream._closeRequest = undefined; + } + function WritableStreamMarkFirstWriteRequestInFlight(stream) { + stream._inFlightWriteRequest = stream._writeRequests.shift(); + } + function WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream) { + if (stream._closeRequest !== undefined) { + stream._closeRequest._reject(stream._storedError); + stream._closeRequest = undefined; + } + var writer = stream._writer; + if (writer !== undefined) { + defaultWriterClosedPromiseReject(writer, stream._storedError); + } + } + function WritableStreamUpdateBackpressure(stream, backpressure) { + var writer = stream._writer; + if (writer !== undefined && backpressure !== stream._backpressure) { + if (backpressure === true) { + defaultWriterReadyPromiseReset(writer); + } else { + defaultWriterReadyPromiseResolve(writer); + } + } + stream._backpressure = backpressure; + } + var WritableStreamDefaultWriter = function () { + function WritableStreamDefaultWriter(stream) { + if (IsWritableStream(stream) === false) { + throw new TypeError('WritableStreamDefaultWriter can only be constructed with a WritableStream instance'); + } + if (IsWritableStreamLocked(stream) === true) { + throw new TypeError('This stream has already been locked for exclusive writing by another writer'); + } + this._ownerWritableStream = stream; + stream._writer = this; + var state = stream._state; + if (state === 'writable') { + if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._backpressure === true) { + defaultWriterReadyPromiseInitialize(this); } else { - ReadableByteStreamControllerCallPullIfNeeded(controller); - } + defaultWriterReadyPromiseInitializeAsResolved(this); + } + defaultWriterClosedPromiseInitialize(this); + } else if (state === 'erroring') { + defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError); + defaultWriterClosedPromiseInitialize(this); + } else if (state === 'closed') { + defaultWriterReadyPromiseInitializeAsResolved(this); + defaultWriterClosedPromiseInitializeAsResolved(this); + } else { + var storedError = stream._storedError; + defaultWriterReadyPromiseInitializeAsRejected(this, storedError); + defaultWriterClosedPromiseInitializeAsRejected(this, storedError); + } + } + Object.defineProperty(WritableStreamDefaultWriter.prototype, "closed", { + get: function () { + if (IsWritableStreamDefaultWriter(this) === false) { + return promiseRejectedWith(defaultWriterBrandCheckException('closed')); + } + return this._closedPromise; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WritableStreamDefaultWriter.prototype, "desiredSize", { + get: function () { + if (IsWritableStreamDefaultWriter(this) === false) { + throw defaultWriterBrandCheckException('desiredSize'); + } + if (this._ownerWritableStream === undefined) { + throw defaultWriterLockException('desiredSize'); + } + return WritableStreamDefaultWriterGetDesiredSize(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WritableStreamDefaultWriter.prototype, "ready", { + get: function () { + if (IsWritableStreamDefaultWriter(this) === false) { + return promiseRejectedWith(defaultWriterBrandCheckException('ready')); + } + return this._readyPromise; + }, + enumerable: true, + configurable: true + }); + WritableStreamDefaultWriter.prototype.abort = function (reason) { + if (IsWritableStreamDefaultWriter(this) === false) { + return promiseRejectedWith(defaultWriterBrandCheckException('abort')); + } + if (this._ownerWritableStream === undefined) { + return promiseRejectedWith(defaultWriterLockException('abort')); + } + return WritableStreamDefaultWriterAbort(this, reason); + }; + WritableStreamDefaultWriter.prototype.close = function () { + if (IsWritableStreamDefaultWriter(this) === false) { + return promiseRejectedWith(defaultWriterBrandCheckException('close')); + } + var stream = this._ownerWritableStream; + if (stream === undefined) { + return promiseRejectedWith(defaultWriterLockException('close')); + } + if (WritableStreamCloseQueuedOrInFlight(stream) === true) { + return promiseRejectedWith(new TypeError('Cannot close an already-closing stream')); + } + return WritableStreamDefaultWriterClose(this); + }; + WritableStreamDefaultWriter.prototype.releaseLock = function () { + if (IsWritableStreamDefaultWriter(this) === false) { + throw defaultWriterBrandCheckException('releaseLock'); + } + var stream = this._ownerWritableStream; + if (stream === undefined) { + return; + } + WritableStreamDefaultWriterRelease(this); + }; + WritableStreamDefaultWriter.prototype.write = function (chunk) { + if (IsWritableStreamDefaultWriter(this) === false) { + return promiseRejectedWith(defaultWriterBrandCheckException('write')); + } + if (this._ownerWritableStream === undefined) { + return promiseRejectedWith(defaultWriterLockException('write to')); + } + return WritableStreamDefaultWriterWrite(this, chunk); + }; + return WritableStreamDefaultWriter; + }(); + function IsWritableStreamDefaultWriter(x) { + if (!typeIsObject(x)) { + return false; } - function ReadableByteStreamControllerInvalidateBYOBRequest(controller) { - if (controller._byobRequest === undefined) { - return; - } - controller._byobRequest._associatedReadableByteStreamController = undefined; - controller._byobRequest._view = undefined; - controller._byobRequest = undefined; + if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) { + return false; } - function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller) { - assert(controller._closeRequested === false); - while (controller._pendingPullIntos.length > 0) { - if (controller._queueTotalSize === 0) { - return; - } - var pullIntoDescriptor = controller._pendingPullIntos[0]; - if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) { - ReadableByteStreamControllerShiftPendingPullInto(controller); - ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor); - } - } + return true; + } + function WritableStreamDefaultWriterAbort(writer, reason) { + var stream = writer._ownerWritableStream; + return WritableStreamAbort(stream, reason); + } + function WritableStreamDefaultWriterClose(writer) { + var stream = writer._ownerWritableStream; + return WritableStreamClose(stream); + } + function WritableStreamDefaultWriterCloseWithErrorPropagation(writer) { + var stream = writer._ownerWritableStream; + var state = stream._state; + if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') { + return promiseResolvedWith(undefined); + } + if (state === 'errored') { + return promiseRejectedWith(stream._storedError); + } + return WritableStreamDefaultWriterClose(writer); + } + function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error) { + if (writer._closedPromiseState === 'pending') { + defaultWriterClosedPromiseReject(writer, error); + } else { + defaultWriterClosedPromiseResetToRejected(writer, error); } - function ReadableByteStreamControllerPullInto(controller, view) { - var stream = controller._controlledReadableStream; - var elementSize = 1; - if (view.constructor !== DataView) { - elementSize = view.constructor.BYTES_PER_ELEMENT; - } - var ctor = view.constructor; - var pullIntoDescriptor = { - buffer: view.buffer, - byteOffset: view.byteOffset, - byteLength: view.byteLength, - bytesFilled: 0, - elementSize: elementSize, - ctor: ctor, - readerType: 'byob' - }; - if (controller._pendingPullIntos.length > 0) { - pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer); - controller._pendingPullIntos.push(pullIntoDescriptor); - return ReadableStreamAddReadIntoRequest(stream); - } - if (stream._state === 'closed') { - var emptyView = new view.constructor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0); - return Promise.resolve(CreateIterResultObject(emptyView, true)); - } - if (controller._queueTotalSize > 0) { - if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) { - var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor); - ReadableByteStreamControllerHandleQueueDrain(controller); - return Promise.resolve(CreateIterResultObject(filledView, false)); - } - if (controller._closeRequested === true) { - var e = new TypeError('Insufficient bytes to fill elements in the given buffer'); - ReadableByteStreamControllerError(controller, e); - return Promise.reject(e); - } - } - pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer); - controller._pendingPullIntos.push(pullIntoDescriptor); - var promise = ReadableStreamAddReadIntoRequest(stream); - ReadableByteStreamControllerCallPullIfNeeded(controller); - return promise; + } + function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) { + if (writer._readyPromiseState === 'pending') { + defaultWriterReadyPromiseReject(writer, error); + } else { + defaultWriterReadyPromiseResetToRejected(writer, error); + } + } + function WritableStreamDefaultWriterGetDesiredSize(writer) { + var stream = writer._ownerWritableStream; + var state = stream._state; + if (state === 'errored' || state === 'erroring') { + return null; + } + if (state === 'closed') { + return 0; + } + return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController); + } + function WritableStreamDefaultWriterRelease(writer) { + var stream = writer._ownerWritableStream; + var releasedError = new TypeError('Writer was released and can no longer be used to monitor the stream\'s closedness'); + WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError); + WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError); + stream._writer = undefined; + writer._ownerWritableStream = undefined; + } + function WritableStreamDefaultWriterWrite(writer, chunk) { + var stream = writer._ownerWritableStream; + var controller = stream._writableStreamController; + var chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk); + if (stream !== writer._ownerWritableStream) { + return promiseRejectedWith(defaultWriterLockException('write to')); + } + var state = stream._state; + if (state === 'errored') { + return promiseRejectedWith(stream._storedError); + } + if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') { + return promiseRejectedWith(new TypeError('The stream is closing or closed and cannot be written to')); + } + if (state === 'erroring') { + return promiseRejectedWith(stream._storedError); + } + var promise = WritableStreamAddWriteRequest(stream); + WritableStreamDefaultControllerWrite(controller, chunk, chunkSize); + return promise; + } + var WritableStreamDefaultController = function () { + function WritableStreamDefaultController() { + throw new TypeError('WritableStreamDefaultController cannot be constructed explicitly'); + } + WritableStreamDefaultController.prototype.error = function (e) { + if (IsWritableStreamDefaultController(this) === false) { + throw new TypeError('WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController'); + } + var state = this._controlledWritableStream._state; + if (state !== 'writable') { + return; + } + WritableStreamDefaultControllerError(this, e); + }; + WritableStreamDefaultController.prototype[AbortSteps] = function (reason) { + var result = this._abortAlgorithm(reason); + WritableStreamDefaultControllerClearAlgorithms(this); + return result; + }; + WritableStreamDefaultController.prototype[ErrorSteps] = function () { + ResetQueue(this); + }; + return WritableStreamDefaultController; + }(); + function IsWritableStreamDefaultController(x) { + if (!typeIsObject(x)) { + return false; } - function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) { - firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer); - assert(firstDescriptor.bytesFilled === 0, 'bytesFilled must be 0'); - var stream = controller._controlledReadableStream; - if (ReadableStreamHasBYOBReader(stream) === true) { - while (ReadableStreamGetNumReadIntoRequests(stream) > 0) { - var pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller); - ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor); - } - } + if (!Object.prototype.hasOwnProperty.call(x, '_controlledWritableStream')) { + return false; } - function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) { - if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) { - throw new RangeError('bytesWritten out of range'); - } - ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor); - if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) { - return; - } - ReadableByteStreamControllerShiftPendingPullInto(controller); - var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize; - if (remainderSize > 0) { - var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled; - var remainder = pullIntoDescriptor.buffer.slice(end - remainderSize, end); - ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength); - } - pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer); - pullIntoDescriptor.bytesFilled -= remainderSize; - ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor); - ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller); - } - function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) { - var firstDescriptor = controller._pendingPullIntos[0]; - var stream = controller._controlledReadableStream; - if (stream._state === 'closed') { - if (bytesWritten !== 0) { - throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream'); - } - ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor); - } else { - assert(stream._state === 'readable'); - ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor); - } + return true; + } + function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) { + controller._controlledWritableStream = stream; + stream._writableStreamController = controller; + controller._queue = undefined; + controller._queueTotalSize = undefined; + ResetQueue(controller); + controller._started = false; + controller._strategySizeAlgorithm = sizeAlgorithm; + controller._strategyHWM = highWaterMark; + controller._writeAlgorithm = writeAlgorithm; + controller._closeAlgorithm = closeAlgorithm; + controller._abortAlgorithm = abortAlgorithm; + var backpressure = WritableStreamDefaultControllerGetBackpressure(controller); + WritableStreamUpdateBackpressure(stream, backpressure); + var startResult = startAlgorithm(); + var startPromise = promiseResolvedWith(startResult); + uponPromise(startPromise, function () { + controller._started = true; + WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); + }, function (r) { + controller._started = true; + WritableStreamDealWithRejection(stream, r); + }); + } + function SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyingSink, highWaterMark, sizeAlgorithm) { + var controller = Object.create(WritableStreamDefaultController.prototype); + function startAlgorithm() { + return InvokeOrNoop(underlyingSink, 'start', [controller]); + } + var writeAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, 'write', 1, [controller]); + var closeAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, 'close', 0, []); + var abortAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, 'abort', 1, []); + SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm); + } + function WritableStreamDefaultControllerClearAlgorithms(controller) { + controller._writeAlgorithm = undefined; + controller._closeAlgorithm = undefined; + controller._abortAlgorithm = undefined; + controller._strategySizeAlgorithm = undefined; + } + function WritableStreamDefaultControllerClose(controller) { + EnqueueValueWithSize(controller, 'close', 0); + WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); + } + function WritableStreamDefaultControllerGetChunkSize(controller, chunk) { + try { + return controller._strategySizeAlgorithm(chunk); + } catch (chunkSizeE) { + WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE); + return 1; + } + } + function WritableStreamDefaultControllerGetDesiredSize(controller) { + return controller._strategyHWM - controller._queueTotalSize; + } + function WritableStreamDefaultControllerWrite(controller, chunk, chunkSize) { + var writeRecord = { chunk: chunk }; + try { + EnqueueValueWithSize(controller, writeRecord, chunkSize); + } catch (enqueueE) { + WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE); + return; + } + var stream = controller._controlledWritableStream; + if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._state === 'writable') { + var backpressure = WritableStreamDefaultControllerGetBackpressure(controller); + WritableStreamUpdateBackpressure(stream, backpressure); + } + WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); + } + function WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller) { + var stream = controller._controlledWritableStream; + if (controller._started === false) { + return; + } + if (stream._inFlightWriteRequest !== undefined) { + return; + } + var state = stream._state; + if (state === 'erroring') { + WritableStreamFinishErroring(stream); + return; + } + if (controller._queue.length === 0) { + return; + } + var writeRecord = PeekQueueValue(controller); + if (writeRecord === 'close') { + WritableStreamDefaultControllerProcessClose(controller); + } else { + WritableStreamDefaultControllerProcessWrite(controller, writeRecord.chunk); + } + } + function WritableStreamDefaultControllerErrorIfNeeded(controller, error) { + if (controller._controlledWritableStream._state === 'writable') { + WritableStreamDefaultControllerError(controller, error); + } + } + function WritableStreamDefaultControllerProcessClose(controller) { + var stream = controller._controlledWritableStream; + WritableStreamMarkCloseRequestInFlight(stream); + DequeueValue(controller); + var sinkClosePromise = controller._closeAlgorithm(); + WritableStreamDefaultControllerClearAlgorithms(controller); + uponPromise(sinkClosePromise, function () { + WritableStreamFinishInFlightClose(stream); + }, function (reason) { + WritableStreamFinishInFlightCloseWithError(stream, reason); + }); + } + function WritableStreamDefaultControllerProcessWrite(controller, chunk) { + var stream = controller._controlledWritableStream; + WritableStreamMarkFirstWriteRequestInFlight(stream); + var sinkWritePromise = controller._writeAlgorithm(chunk); + uponPromise(sinkWritePromise, function () { + WritableStreamFinishInFlightWrite(stream); + var state = stream._state; + DequeueValue(controller); + if (WritableStreamCloseQueuedOrInFlight(stream) === false && state === 'writable') { + var backpressure = WritableStreamDefaultControllerGetBackpressure(controller); + WritableStreamUpdateBackpressure(stream, backpressure); + } + WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); + }, function (reason) { + if (stream._state === 'writable') { + WritableStreamDefaultControllerClearAlgorithms(controller); + } + WritableStreamFinishInFlightWriteWithError(stream, reason); + }); + } + function WritableStreamDefaultControllerGetBackpressure(controller) { + var desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller); + return desiredSize <= 0; + } + function WritableStreamDefaultControllerError(controller, error) { + var stream = controller._controlledWritableStream; + WritableStreamDefaultControllerClearAlgorithms(controller); + WritableStreamStartErroring(stream, error); + } + function streamBrandCheckException(name) { + return new TypeError("WritableStream.prototype." + name + " can only be used on a WritableStream"); + } + function defaultWriterBrandCheckException(name) { + return new TypeError("WritableStreamDefaultWriter.prototype." + name + " can only be used on a WritableStreamDefaultWriter"); + } + function defaultWriterLockException(name) { + return new TypeError('Cannot ' + name + ' a stream using a released writer'); + } + function defaultWriterClosedPromiseInitialize(writer) { + writer._closedPromise = newPromise(function (resolve, reject) { + writer._closedPromise_resolve = resolve; + writer._closedPromise_reject = reject; + writer._closedPromiseState = 'pending'; + }); + } + function defaultWriterClosedPromiseInitializeAsRejected(writer, reason) { + defaultWriterClosedPromiseInitialize(writer); + defaultWriterClosedPromiseReject(writer, reason); + } + function defaultWriterClosedPromiseInitializeAsResolved(writer) { + defaultWriterClosedPromiseInitialize(writer); + defaultWriterClosedPromiseResolve(writer); + } + function defaultWriterClosedPromiseReject(writer, reason) { + setPromiseIsHandledToTrue(writer._closedPromise); + writer._closedPromise_reject(reason); + writer._closedPromise_resolve = undefined; + writer._closedPromise_reject = undefined; + writer._closedPromiseState = 'rejected'; + } + function defaultWriterClosedPromiseResetToRejected(writer, reason) { + defaultWriterClosedPromiseInitializeAsRejected(writer, reason); + } + function defaultWriterClosedPromiseResolve(writer) { + writer._closedPromise_resolve(undefined); + writer._closedPromise_resolve = undefined; + writer._closedPromise_reject = undefined; + writer._closedPromiseState = 'resolved'; + } + function defaultWriterReadyPromiseInitialize(writer) { + writer._readyPromise = newPromise(function (resolve, reject) { + writer._readyPromise_resolve = resolve; + writer._readyPromise_reject = reject; + }); + writer._readyPromiseState = 'pending'; + } + function defaultWriterReadyPromiseInitializeAsRejected(writer, reason) { + defaultWriterReadyPromiseInitialize(writer); + defaultWriterReadyPromiseReject(writer, reason); + } + function defaultWriterReadyPromiseInitializeAsResolved(writer) { + defaultWriterReadyPromiseInitialize(writer); + defaultWriterReadyPromiseResolve(writer); + } + function defaultWriterReadyPromiseReject(writer, reason) { + setPromiseIsHandledToTrue(writer._readyPromise); + writer._readyPromise_reject(reason); + writer._readyPromise_resolve = undefined; + writer._readyPromise_reject = undefined; + writer._readyPromiseState = 'rejected'; + } + function defaultWriterReadyPromiseReset(writer) { + defaultWriterReadyPromiseInitialize(writer); + } + function defaultWriterReadyPromiseResetToRejected(writer, reason) { + defaultWriterReadyPromiseInitializeAsRejected(writer, reason); + } + function defaultWriterReadyPromiseResolve(writer) { + writer._readyPromise_resolve(undefined); + writer._readyPromise_resolve = undefined; + writer._readyPromise_reject = undefined; + writer._readyPromiseState = 'fulfilled'; + } + function isAbortSignal(value) { + if (typeof value !== 'object' || value === null) { + return false; } - function ReadableByteStreamControllerShiftPendingPullInto(controller) { - var descriptor = controller._pendingPullIntos.shift(); - ReadableByteStreamControllerInvalidateBYOBRequest(controller); - return descriptor; + try { + return typeof value.aborted === 'boolean'; + } catch (_a) { + return false; } - function ReadableByteStreamControllerShouldCallPull(controller) { - var stream = controller._controlledReadableStream; - if (stream._state !== 'readable') { - return false; + } + var NativeDOMException = typeof DOMException !== 'undefined' ? DOMException : undefined; + function isDOMExceptionConstructor(ctor) { + if (!(typeof ctor === 'function' || typeof ctor === 'object')) { + return false; + } + try { + new ctor(); + return true; + } catch (_a) { + return false; + } + } + function createDOMExceptionPolyfill() { + var ctor = function DOMException(message, name) { + this.message = message || ''; + this.name = name || 'Error'; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + }; + ctor.prototype = Object.create(Error.prototype); + Object.defineProperty(ctor.prototype, 'constructor', { + value: ctor, + writable: true, + configurable: true + }); + return ctor; + } + var DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill(); + function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) { + var reader = AcquireReadableStreamDefaultReader(source); + var writer = AcquireWritableStreamDefaultWriter(dest); + source._disturbed = true; + var shuttingDown = false; + var currentWrite = promiseResolvedWith(undefined); + return newPromise(function (resolve, reject) { + var abortAlgorithm; + if (signal !== undefined) { + abortAlgorithm = function () { + var error = new DOMException$1('Aborted', 'AbortError'); + var actions = []; + if (preventAbort === false) { + actions.push(function () { + if (dest._state === 'writable') { + return WritableStreamAbort(dest, error); + } + return promiseResolvedWith(undefined); + }); + } + if (preventCancel === false) { + actions.push(function () { + if (source._state === 'readable') { + return ReadableStreamCancel(source, error); + } + return promiseResolvedWith(undefined); + }); + } + shutdownWithAction(function () { + return Promise.all(actions.map(function (action) { + return action(); + })); + }, true, error); + }; + if (signal.aborted === true) { + abortAlgorithm(); + return; + } + signal.addEventListener('abort', abortAlgorithm); + } + function pipeLoop() { + return newPromise(function (resolveLoop, rejectLoop) { + function next(done) { + if (done) { + resolveLoop(); + } else { + PerformPromiseThen(pipeStep(), next, rejectLoop); + } + } + next(false); + }); + } + function pipeStep() { + if (shuttingDown === true) { + return promiseResolvedWith(true); } - if (controller._closeRequested === true) { + return PerformPromiseThen(writer._readyPromise, function () { + return PerformPromiseThen(ReadableStreamDefaultReaderRead(reader), function (result) { + if (result.done === true) { + return true; + } + currentWrite = PerformPromiseThen(WritableStreamDefaultWriterWrite(writer, result.value), undefined, noop); return false; + }); + }); + } + isOrBecomesErrored(source, reader._closedPromise, function (storedError) { + if (preventAbort === false) { + shutdownWithAction(function () { + return WritableStreamAbort(dest, storedError); + }, true, storedError); + } else { + shutdown(true, storedError); + } + }); + isOrBecomesErrored(dest, writer._closedPromise, function (storedError) { + if (preventCancel === false) { + shutdownWithAction(function () { + return ReadableStreamCancel(source, storedError); + }, true, storedError); + } else { + shutdown(true, storedError); + } + }); + isOrBecomesClosed(source, reader._closedPromise, function () { + if (preventClose === false) { + shutdownWithAction(function () { + return WritableStreamDefaultWriterCloseWithErrorPropagation(writer); + }); + } else { + shutdown(); + } + }); + if (WritableStreamCloseQueuedOrInFlight(dest) === true || dest._state === 'closed') { + var destClosed_1 = new TypeError('the destination writable stream closed before all data could be piped to it'); + if (preventCancel === false) { + shutdownWithAction(function () { + return ReadableStreamCancel(source, destClosed_1); + }, true, destClosed_1); + } else { + shutdown(true, destClosed_1); + } + } + setPromiseIsHandledToTrue(pipeLoop()); + function waitForWritesToFinish() { + var oldCurrentWrite = currentWrite; + return PerformPromiseThen(currentWrite, function () { + return oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined; + }); + } + function isOrBecomesErrored(stream, promise, action) { + if (stream._state === 'errored') { + action(stream._storedError); + } else { + uponRejection(promise, action); } - if (controller._started === false) { - return false; + } + function isOrBecomesClosed(stream, promise, action) { + if (stream._state === 'closed') { + action(); + } else { + uponFulfillment(promise, action); } - if (ReadableStreamHasDefaultReader(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) { - return true; + } + function shutdownWithAction(action, originalIsError, originalError) { + if (shuttingDown === true) { + return; } - if (ReadableStreamHasBYOBReader(stream) === true && ReadableStreamGetNumReadIntoRequests(stream) > 0) { - return true; + shuttingDown = true; + if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) { + uponFulfillment(waitForWritesToFinish(), doTheRest); + } else { + doTheRest(); + } + function doTheRest() { + uponPromise(action(), function () { + return finalize(originalIsError, originalError); + }, function (newError) { + return finalize(true, newError); + }); + } + } + function shutdown(isError, error) { + if (shuttingDown === true) { + return; + } + shuttingDown = true; + if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) { + uponFulfillment(waitForWritesToFinish(), function () { + return finalize(isError, error); + }); + } else { + finalize(isError, error); } - if (ReadableByteStreamControllerGetDesiredSize(controller) > 0) { - return true; + } + function finalize(isError, error) { + WritableStreamDefaultWriterRelease(writer); + ReadableStreamReaderGenericRelease(reader); + if (signal !== undefined) { + signal.removeEventListener('abort', abortAlgorithm); } - return false; - } - function ReadableByteStreamControllerClose(controller) { - var stream = controller._controlledReadableStream; - assert(controller._closeRequested === false); - assert(stream._state === 'readable'); - if (controller._queueTotalSize > 0) { - controller._closeRequested = true; - return; + if (isError) { + reject(error); + } else { + resolve(undefined); } - if (controller._pendingPullIntos.length > 0) { - var firstPendingPullInto = controller._pendingPullIntos[0]; - if (firstPendingPullInto.bytesFilled > 0) { - var e = new TypeError('Insufficient bytes to fill elements in the given buffer'); - ReadableByteStreamControllerError(controller, e); - throw e; - } - } - ReadableStreamClose(stream); - } - function ReadableByteStreamControllerEnqueue(controller, chunk) { - var stream = controller._controlledReadableStream; - assert(controller._closeRequested === false); - assert(stream._state === 'readable'); - var buffer = chunk.buffer; - var byteOffset = chunk.byteOffset; - var byteLength = chunk.byteLength; - var transferredBuffer = TransferArrayBuffer(buffer); - if (ReadableStreamHasDefaultReader(stream) === true) { - if (ReadableStreamGetNumReadRequests(stream) === 0) { - ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); - } else { - assert(controller._queue.length === 0); - var transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength); - ReadableStreamFulfillReadRequest(stream, transferredView, false); - } - } else if (ReadableStreamHasBYOBReader(stream) === true) { - ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); - ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller); + } + }); + } + var ReadableStreamDefaultController = function () { + function ReadableStreamDefaultController() { + throw new TypeError(); + } + Object.defineProperty(ReadableStreamDefaultController.prototype, "desiredSize", { + get: function () { + if (IsReadableStreamDefaultController(this) === false) { + throw defaultControllerBrandCheckException('desiredSize'); + } + return ReadableStreamDefaultControllerGetDesiredSize(this); + }, + enumerable: true, + configurable: true + }); + ReadableStreamDefaultController.prototype.close = function () { + if (IsReadableStreamDefaultController(this) === false) { + throw defaultControllerBrandCheckException('close'); + } + if (ReadableStreamDefaultControllerCanCloseOrEnqueue(this) === false) { + throw new TypeError('The stream is not in a state that permits close'); + } + ReadableStreamDefaultControllerClose(this); + }; + ReadableStreamDefaultController.prototype.enqueue = function (chunk) { + if (IsReadableStreamDefaultController(this) === false) { + throw defaultControllerBrandCheckException('enqueue'); + } + if (ReadableStreamDefaultControllerCanCloseOrEnqueue(this) === false) { + throw new TypeError('The stream is not in a state that permits enqueue'); + } + return ReadableStreamDefaultControllerEnqueue(this, chunk); + }; + ReadableStreamDefaultController.prototype.error = function (e) { + if (IsReadableStreamDefaultController(this) === false) { + throw defaultControllerBrandCheckException('error'); + } + ReadableStreamDefaultControllerError(this, e); + }; + ReadableStreamDefaultController.prototype[CancelSteps] = function (reason) { + ResetQueue(this); + var result = this._cancelAlgorithm(reason); + ReadableStreamDefaultControllerClearAlgorithms(this); + return result; + }; + ReadableStreamDefaultController.prototype[PullSteps] = function () { + var stream = this._controlledReadableStream; + if (this._queue.length > 0) { + var chunk = DequeueValue(this); + if (this._closeRequested === true && this._queue.length === 0) { + ReadableStreamDefaultControllerClearAlgorithms(this); + ReadableStreamClose(stream); } else { - assert(IsReadableStreamLocked(stream) === false, 'stream must not be locked'); - ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); + ReadableStreamDefaultControllerCallPullIfNeeded(this); } + return promiseResolvedWith(ReadableStreamCreateReadResult(chunk, false, stream._reader._forAuthorCode)); + } + var pendingPromise = ReadableStreamAddReadRequest(stream); + ReadableStreamDefaultControllerCallPullIfNeeded(this); + return pendingPromise; + }; + return ReadableStreamDefaultController; + }(); + function IsReadableStreamDefaultController(x) { + if (!typeIsObject(x)) { + return false; } - function ReadableByteStreamControllerError(controller, e) { - var stream = controller._controlledReadableStream; - assert(stream._state === 'readable'); - ReadableByteStreamControllerClearPendingPullIntos(controller); - ResetQueue(controller); - ReadableStreamError(stream, e); + if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableStream')) { + return false; } - function ReadableByteStreamControllerGetDesiredSize(controller) { - var stream = controller._controlledReadableStream; - var state = stream._state; - if (state === 'errored') { - return null; - } - if (state === 'closed') { - return 0; - } - return controller._strategyHWM - controller._queueTotalSize; + return true; + } + function ReadableStreamDefaultControllerCallPullIfNeeded(controller) { + var shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller); + if (shouldPull === false) { + return; + } + if (controller._pulling === true) { + controller._pullAgain = true; + return; + } + controller._pulling = true; + var pullPromise = controller._pullAlgorithm(); + uponPromise(pullPromise, function () { + controller._pulling = false; + if (controller._pullAgain === true) { + controller._pullAgain = false; + ReadableStreamDefaultControllerCallPullIfNeeded(controller); + } + }, function (e) { + ReadableStreamDefaultControllerError(controller, e); + }); + } + function ReadableStreamDefaultControllerShouldCallPull(controller) { + var stream = controller._controlledReadableStream; + if (ReadableStreamDefaultControllerCanCloseOrEnqueue(controller) === false) { + return false; + } + if (controller._started === false) { + return false; + } + if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) { + return true; + } + var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller); + if (desiredSize > 0) { + return true; + } + return false; + } + function ReadableStreamDefaultControllerClearAlgorithms(controller) { + controller._pullAlgorithm = undefined; + controller._cancelAlgorithm = undefined; + controller._strategySizeAlgorithm = undefined; + } + function ReadableStreamDefaultControllerClose(controller) { + var stream = controller._controlledReadableStream; + controller._closeRequested = true; + if (controller._queue.length === 0) { + ReadableStreamDefaultControllerClearAlgorithms(controller); + ReadableStreamClose(stream); + } + } + function ReadableStreamDefaultControllerEnqueue(controller, chunk) { + var stream = controller._controlledReadableStream; + if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) { + ReadableStreamFulfillReadRequest(stream, chunk, false); + } else { + var chunkSize = void 0; + try { + chunkSize = controller._strategySizeAlgorithm(chunk); + } catch (chunkSizeE) { + ReadableStreamDefaultControllerError(controller, chunkSizeE); + throw chunkSizeE; + } + try { + EnqueueValueWithSize(controller, chunk, chunkSize); + } catch (enqueueE) { + ReadableStreamDefaultControllerError(controller, enqueueE); + throw enqueueE; + } + } + ReadableStreamDefaultControllerCallPullIfNeeded(controller); + } + function ReadableStreamDefaultControllerError(controller, e) { + var stream = controller._controlledReadableStream; + if (stream._state !== 'readable') { + return; + } + ResetQueue(controller); + ReadableStreamDefaultControllerClearAlgorithms(controller); + ReadableStreamError(stream, e); + } + function ReadableStreamDefaultControllerGetDesiredSize(controller) { + var stream = controller._controlledReadableStream; + var state = stream._state; + if (state === 'errored') { + return null; + } + if (state === 'closed') { + return 0; + } + return controller._strategyHWM - controller._queueTotalSize; + } + function ReadableStreamDefaultControllerHasBackpressure(controller) { + if (ReadableStreamDefaultControllerShouldCallPull(controller) === true) { + return false; } - function ReadableByteStreamControllerRespond(controller, bytesWritten) { - bytesWritten = Number(bytesWritten); - if (IsFiniteNonNegativeNumber(bytesWritten) === false) { - throw new RangeError('bytesWritten must be a finite'); - } - assert(controller._pendingPullIntos.length > 0); - ReadableByteStreamControllerRespondInternal(controller, bytesWritten); - } - function ReadableByteStreamControllerRespondWithNewView(controller, view) { - assert(controller._pendingPullIntos.length > 0); - var firstDescriptor = controller._pendingPullIntos[0]; - if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) { - throw new RangeError('The region specified by view does not match byobRequest'); - } - if (firstDescriptor.byteLength !== view.byteLength) { - throw new RangeError('The buffer of view has different capacity than byobRequest'); + return true; + } + function ReadableStreamDefaultControllerCanCloseOrEnqueue(controller) { + var state = controller._controlledReadableStream._state; + if (controller._closeRequested === false && state === 'readable') { + return true; + } + return false; + } + function SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm) { + controller._controlledReadableStream = stream; + controller._queue = undefined; + controller._queueTotalSize = undefined; + ResetQueue(controller); + controller._started = false; + controller._closeRequested = false; + controller._pullAgain = false; + controller._pulling = false; + controller._strategySizeAlgorithm = sizeAlgorithm; + controller._strategyHWM = highWaterMark; + controller._pullAlgorithm = pullAlgorithm; + controller._cancelAlgorithm = cancelAlgorithm; + stream._readableStreamController = controller; + var startResult = startAlgorithm(); + uponPromise(promiseResolvedWith(startResult), function () { + controller._started = true; + ReadableStreamDefaultControllerCallPullIfNeeded(controller); + }, function (r) { + ReadableStreamDefaultControllerError(controller, r); + }); + } + function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underlyingSource, highWaterMark, sizeAlgorithm) { + var controller = Object.create(ReadableStreamDefaultController.prototype); + function startAlgorithm() { + return InvokeOrNoop(underlyingSource, 'start', [controller]); + } + var pullAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSource, 'pull', 0, [controller]); + var cancelAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSource, 'cancel', 1, []); + SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm); + } + function defaultControllerBrandCheckException(name) { + return new TypeError("ReadableStreamDefaultController.prototype." + name + " can only be used on a ReadableStreamDefaultController"); + } + function ReadableStreamTee(stream, cloneForBranch2) { + var reader = AcquireReadableStreamDefaultReader(stream); + var reading = false; + var canceled1 = false; + var canceled2 = false; + var reason1; + var reason2; + var branch1; + var branch2; + var resolveCancelPromise; + var cancelPromise = newPromise(function (resolve) { + resolveCancelPromise = resolve; + }); + function pullAlgorithm() { + if (reading === true) { + return promiseResolvedWith(undefined); + } + reading = true; + var readPromise = transformPromiseWith(ReadableStreamDefaultReaderRead(reader), function (result) { + reading = false; + var done = result.done; + if (done === true) { + if (canceled1 === false) { + ReadableStreamDefaultControllerClose(branch1._readableStreamController); + } + if (canceled2 === false) { + ReadableStreamDefaultControllerClose(branch2._readableStreamController); + } + return; + } + var value = result.value; + var value1 = value; + var value2 = value; + if (canceled1 === false) { + ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController, value1); + } + if (canceled2 === false) { + ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, value2); + } + }); + setPromiseIsHandledToTrue(readPromise); + return promiseResolvedWith(undefined); + } + function cancel1Algorithm(reason) { + canceled1 = true; + reason1 = reason; + if (canceled2 === true) { + var compositeReason = createArrayFromList([ + reason1, + reason2 + ]); + var cancelResult = ReadableStreamCancel(stream, compositeReason); + resolveCancelPromise(cancelResult); + } + return cancelPromise; + } + function cancel2Algorithm(reason) { + canceled2 = true; + reason2 = reason; + if (canceled1 === true) { + var compositeReason = createArrayFromList([ + reason1, + reason2 + ]); + var cancelResult = ReadableStreamCancel(stream, compositeReason); + resolveCancelPromise(cancelResult); + } + return cancelPromise; + } + function startAlgorithm() { + } + branch1 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel1Algorithm); + branch2 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel2Algorithm); + uponRejection(reader._closedPromise, function (r) { + ReadableStreamDefaultControllerError(branch1._readableStreamController, r); + ReadableStreamDefaultControllerError(branch2._readableStreamController, r); + }); + return [ + branch1, + branch2 + ]; + } + var NumberIsInteger = Number.isInteger || function (value) { + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; + }; + var ReadableStreamBYOBRequest = function () { + function ReadableStreamBYOBRequest() { + throw new TypeError('ReadableStreamBYOBRequest cannot be used directly'); + } + Object.defineProperty(ReadableStreamBYOBRequest.prototype, "view", { + get: function () { + if (IsReadableStreamBYOBRequest(this) === false) { + throw byobRequestBrandCheckException('view'); + } + return this._view; + }, + enumerable: true, + configurable: true + }); + ReadableStreamBYOBRequest.prototype.respond = function (bytesWritten) { + if (IsReadableStreamBYOBRequest(this) === false) { + throw byobRequestBrandCheckException('respond'); + } + if (this._associatedReadableByteStreamController === undefined) { + throw new TypeError('This BYOB request has been invalidated'); + } + if (IsDetachedBuffer(this._view.buffer) === true); + ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten); + }; + ReadableStreamBYOBRequest.prototype.respondWithNewView = function (view) { + if (IsReadableStreamBYOBRequest(this) === false) { + throw byobRequestBrandCheckException('respond'); + } + if (this._associatedReadableByteStreamController === undefined) { + throw new TypeError('This BYOB request has been invalidated'); + } + if (!ArrayBuffer.isView(view)) { + throw new TypeError('You can only respond with array buffer views'); + } + if (IsDetachedBuffer(view.buffer) === true); + ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view); + }; + return ReadableStreamBYOBRequest; + }(); + var ReadableByteStreamController = function () { + function ReadableByteStreamController() { + throw new TypeError('ReadableByteStreamController constructor cannot be used directly'); + } + Object.defineProperty(ReadableByteStreamController.prototype, "byobRequest", { + get: function () { + if (IsReadableByteStreamController(this) === false) { + throw byteStreamControllerBrandCheckException('byobRequest'); + } + if (this._byobRequest === undefined && this._pendingPullIntos.length > 0) { + var firstDescriptor = this._pendingPullIntos.peek(); + var view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled); + var byobRequest = Object.create(ReadableStreamBYOBRequest.prototype); + SetUpReadableStreamBYOBRequest(byobRequest, this, view); + this._byobRequest = byobRequest; + } + return this._byobRequest; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ReadableByteStreamController.prototype, "desiredSize", { + get: function () { + if (IsReadableByteStreamController(this) === false) { + throw byteStreamControllerBrandCheckException('desiredSize'); + } + return ReadableByteStreamControllerGetDesiredSize(this); + }, + enumerable: true, + configurable: true + }); + ReadableByteStreamController.prototype.close = function () { + if (IsReadableByteStreamController(this) === false) { + throw byteStreamControllerBrandCheckException('close'); + } + if (this._closeRequested === true) { + throw new TypeError('The stream has already been closed; do not close it again!'); + } + var state = this._controlledReadableByteStream._state; + if (state !== 'readable') { + throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be closed"); + } + ReadableByteStreamControllerClose(this); + }; + ReadableByteStreamController.prototype.enqueue = function (chunk) { + if (IsReadableByteStreamController(this) === false) { + throw byteStreamControllerBrandCheckException('enqueue'); + } + if (this._closeRequested === true) { + throw new TypeError('stream is closed or draining'); + } + var state = this._controlledReadableByteStream._state; + if (state !== 'readable') { + throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be enqueued to"); + } + if (!ArrayBuffer.isView(chunk)) { + throw new TypeError('You can only enqueue array buffer views when using a ReadableByteStreamController'); + } + if (IsDetachedBuffer(chunk.buffer) === true); + ReadableByteStreamControllerEnqueue(this, chunk); + }; + ReadableByteStreamController.prototype.error = function (e) { + if (IsReadableByteStreamController(this) === false) { + throw byteStreamControllerBrandCheckException('error'); + } + ReadableByteStreamControllerError(this, e); + }; + ReadableByteStreamController.prototype[CancelSteps] = function (reason) { + if (this._pendingPullIntos.length > 0) { + var firstDescriptor = this._pendingPullIntos.peek(); + firstDescriptor.bytesFilled = 0; + } + ResetQueue(this); + var result = this._cancelAlgorithm(reason); + ReadableByteStreamControllerClearAlgorithms(this); + return result; + }; + ReadableByteStreamController.prototype[PullSteps] = function () { + var stream = this._controlledReadableByteStream; + if (this._queueTotalSize > 0) { + var entry = this._queue.shift(); + this._queueTotalSize -= entry.byteLength; + ReadableByteStreamControllerHandleQueueDrain(this); + var view = void 0; + try { + view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength); + } catch (viewE) { + return promiseRejectedWith(viewE); + } + return promiseResolvedWith(ReadableStreamCreateReadResult(view, false, stream._reader._forAuthorCode)); + } + var autoAllocateChunkSize = this._autoAllocateChunkSize; + if (autoAllocateChunkSize !== undefined) { + var buffer = void 0; + try { + buffer = new ArrayBuffer(autoAllocateChunkSize); + } catch (bufferE) { + return promiseRejectedWith(bufferE); } - firstDescriptor.buffer = view.buffer; - ReadableByteStreamControllerRespondInternal(controller, view.byteLength); + var pullIntoDescriptor = { + buffer: buffer, + byteOffset: 0, + byteLength: autoAllocateChunkSize, + bytesFilled: 0, + elementSize: 1, + ctor: Uint8Array, + readerType: 'default' + }; + this._pendingPullIntos.push(pullIntoDescriptor); + } + var promise = ReadableStreamAddReadRequest(stream); + ReadableByteStreamControllerCallPullIfNeeded(this); + return promise; + }; + return ReadableByteStreamController; + }(); + function IsReadableByteStreamController(x) { + if (!typeIsObject(x)) { + return false; } - function streamBrandCheckException(name) { - return new TypeError('ReadableStream.prototype.' + name + ' can only be used on a ReadableStream'); + if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableByteStream')) { + return false; } - function readerLockException(name) { - return new TypeError('Cannot ' + name + ' a stream using a released reader'); + return true; + } + function IsReadableStreamBYOBRequest(x) { + if (!typeIsObject(x)) { + return false; } - function defaultReaderBrandCheckException(name) { - return new TypeError('ReadableStreamDefaultReader.prototype.' + name + ' can only be used on a ReadableStreamDefaultReader'); + if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) { + return false; } - function defaultReaderClosedPromiseInitialize(reader) { - reader._closedPromise = new Promise(function (resolve, reject) { - reader._closedPromise_resolve = resolve; - reader._closedPromise_reject = reject; - }); + return true; + } + function ReadableByteStreamControllerCallPullIfNeeded(controller) { + var shouldPull = ReadableByteStreamControllerShouldCallPull(controller); + if (shouldPull === false) { + return; + } + if (controller._pulling === true) { + controller._pullAgain = true; + return; + } + controller._pulling = true; + var pullPromise = controller._pullAlgorithm(); + uponPromise(pullPromise, function () { + controller._pulling = false; + if (controller._pullAgain === true) { + controller._pullAgain = false; + ReadableByteStreamControllerCallPullIfNeeded(controller); + } + }, function (e) { + ReadableByteStreamControllerError(controller, e); + }); + } + function ReadableByteStreamControllerClearPendingPullIntos(controller) { + ReadableByteStreamControllerInvalidateBYOBRequest(controller); + controller._pendingPullIntos = new SimpleQueue(); + } + function ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor) { + var done = false; + if (stream._state === 'closed') { + done = true; + } + var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor); + if (pullIntoDescriptor.readerType === 'default') { + ReadableStreamFulfillReadRequest(stream, filledView, done); + } else { + ReadableStreamFulfillReadIntoRequest(stream, filledView, done); + } + } + function ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor) { + var bytesFilled = pullIntoDescriptor.bytesFilled; + var elementSize = pullIntoDescriptor.elementSize; + return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize); + } + function ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byteOffset, byteLength) { + controller._queue.push({ + buffer: buffer, + byteOffset: byteOffset, + byteLength: byteLength + }); + controller._queueTotalSize += byteLength; + } + function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) { + var elementSize = pullIntoDescriptor.elementSize; + var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize; + var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled); + var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy; + var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize; + var totalBytesToCopyRemaining = maxBytesToCopy; + var ready = false; + if (maxAlignedBytes > currentAlignedBytes) { + totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled; + ready = true; + } + var queue = controller._queue; + while (totalBytesToCopyRemaining > 0) { + var headOfQueue = queue.peek(); + var bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength); + var destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled; + ArrayBufferCopy(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy); + if (headOfQueue.byteLength === bytesToCopy) { + queue.shift(); + } else { + headOfQueue.byteOffset += bytesToCopy; + headOfQueue.byteLength -= bytesToCopy; + } + controller._queueTotalSize -= bytesToCopy; + ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor); + totalBytesToCopyRemaining -= bytesToCopy; + } + return ready; + } + function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) { + ReadableByteStreamControllerInvalidateBYOBRequest(controller); + pullIntoDescriptor.bytesFilled += size; + } + function ReadableByteStreamControllerHandleQueueDrain(controller) { + if (controller._queueTotalSize === 0 && controller._closeRequested === true) { + ReadableByteStreamControllerClearAlgorithms(controller); + ReadableStreamClose(controller._controlledReadableByteStream); + } else { + ReadableByteStreamControllerCallPullIfNeeded(controller); + } + } + function ReadableByteStreamControllerInvalidateBYOBRequest(controller) { + if (controller._byobRequest === undefined) { + return; + } + controller._byobRequest._associatedReadableByteStreamController = undefined; + controller._byobRequest._view = undefined; + controller._byobRequest = undefined; + } + function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller) { + while (controller._pendingPullIntos.length > 0) { + if (controller._queueTotalSize === 0) { + return; + } + var pullIntoDescriptor = controller._pendingPullIntos.peek(); + if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) { + ReadableByteStreamControllerShiftPendingPullInto(controller); + ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor); + } + } + } + function ReadableByteStreamControllerPullInto(controller, view) { + var stream = controller._controlledReadableByteStream; + var elementSize = 1; + if (view.constructor !== DataView) { + elementSize = view.constructor.BYTES_PER_ELEMENT; + } + var ctor = view.constructor; + var buffer = TransferArrayBuffer(view.buffer); + var pullIntoDescriptor = { + buffer: buffer, + byteOffset: view.byteOffset, + byteLength: view.byteLength, + bytesFilled: 0, + elementSize: elementSize, + ctor: ctor, + readerType: 'byob' + }; + if (controller._pendingPullIntos.length > 0) { + controller._pendingPullIntos.push(pullIntoDescriptor); + return ReadableStreamAddReadIntoRequest(stream); } - function defaultReaderClosedPromiseInitializeAsRejected(reader, reason) { - reader._closedPromise = Promise.reject(reason); - reader._closedPromise_resolve = undefined; - reader._closedPromise_reject = undefined; + if (stream._state === 'closed') { + var emptyView = new ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0); + return promiseResolvedWith(ReadableStreamCreateReadResult(emptyView, true, stream._reader._forAuthorCode)); } - function defaultReaderClosedPromiseInitializeAsResolved(reader) { - reader._closedPromise = Promise.resolve(undefined); - reader._closedPromise_resolve = undefined; - reader._closedPromise_reject = undefined; + if (controller._queueTotalSize > 0) { + if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) { + var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor); + ReadableByteStreamControllerHandleQueueDrain(controller); + return promiseResolvedWith(ReadableStreamCreateReadResult(filledView, false, stream._reader._forAuthorCode)); + } + if (controller._closeRequested === true) { + var e = new TypeError('Insufficient bytes to fill elements in the given buffer'); + ReadableByteStreamControllerError(controller, e); + return promiseRejectedWith(e); + } + } + controller._pendingPullIntos.push(pullIntoDescriptor); + var promise = ReadableStreamAddReadIntoRequest(stream); + ReadableByteStreamControllerCallPullIfNeeded(controller); + return promise; + } + function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) { + firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer); + var stream = controller._controlledReadableByteStream; + if (ReadableStreamHasBYOBReader(stream) === true) { + while (ReadableStreamGetNumReadIntoRequests(stream) > 0) { + var pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller); + ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor); + } + } + } + function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) { + if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) { + throw new RangeError('bytesWritten out of range'); + } + ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor); + if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) { + return; + } + ReadableByteStreamControllerShiftPendingPullInto(controller); + var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize; + if (remainderSize > 0) { + var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled; + var remainder = pullIntoDescriptor.buffer.slice(end - remainderSize, end); + ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength); + } + pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer); + pullIntoDescriptor.bytesFilled -= remainderSize; + ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor); + ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller); + } + function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) { + var firstDescriptor = controller._pendingPullIntos.peek(); + var stream = controller._controlledReadableByteStream; + if (stream._state === 'closed') { + if (bytesWritten !== 0) { + throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream'); + } + ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor); + } else { + ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor); + } + ReadableByteStreamControllerCallPullIfNeeded(controller); + } + function ReadableByteStreamControllerShiftPendingPullInto(controller) { + var descriptor = controller._pendingPullIntos.shift(); + ReadableByteStreamControllerInvalidateBYOBRequest(controller); + return descriptor; + } + function ReadableByteStreamControllerShouldCallPull(controller) { + var stream = controller._controlledReadableByteStream; + if (stream._state !== 'readable') { + return false; + } + if (controller._closeRequested === true) { + return false; + } + if (controller._started === false) { + return false; + } + if (ReadableStreamHasDefaultReader(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) { + return true; + } + if (ReadableStreamHasBYOBReader(stream) === true && ReadableStreamGetNumReadIntoRequests(stream) > 0) { + return true; + } + var desiredSize = ReadableByteStreamControllerGetDesiredSize(controller); + if (desiredSize > 0) { + return true; + } + return false; + } + function ReadableByteStreamControllerClearAlgorithms(controller) { + controller._pullAlgorithm = undefined; + controller._cancelAlgorithm = undefined; + } + function ReadableByteStreamControllerClose(controller) { + var stream = controller._controlledReadableByteStream; + if (controller._queueTotalSize > 0) { + controller._closeRequested = true; + return; + } + if (controller._pendingPullIntos.length > 0) { + var firstPendingPullInto = controller._pendingPullIntos.peek(); + if (firstPendingPullInto.bytesFilled > 0) { + var e = new TypeError('Insufficient bytes to fill elements in the given buffer'); + ReadableByteStreamControllerError(controller, e); + throw e; + } + } + ReadableByteStreamControllerClearAlgorithms(controller); + ReadableStreamClose(stream); + } + function ReadableByteStreamControllerEnqueue(controller, chunk) { + var stream = controller._controlledReadableByteStream; + var buffer = chunk.buffer; + var byteOffset = chunk.byteOffset; + var byteLength = chunk.byteLength; + var transferredBuffer = TransferArrayBuffer(buffer); + if (ReadableStreamHasDefaultReader(stream) === true) { + if (ReadableStreamGetNumReadRequests(stream) === 0) { + ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); + } else { + var transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength); + ReadableStreamFulfillReadRequest(stream, transferredView, false); + } + } else if (ReadableStreamHasBYOBReader(stream) === true) { + ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); + ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller); + } else { + ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); + } + ReadableByteStreamControllerCallPullIfNeeded(controller); + } + function ReadableByteStreamControllerError(controller, e) { + var stream = controller._controlledReadableByteStream; + if (stream._state !== 'readable') { + return; + } + ReadableByteStreamControllerClearPendingPullIntos(controller); + ResetQueue(controller); + ReadableByteStreamControllerClearAlgorithms(controller); + ReadableStreamError(stream, e); + } + function ReadableByteStreamControllerGetDesiredSize(controller) { + var stream = controller._controlledReadableByteStream; + var state = stream._state; + if (state === 'errored') { + return null; + } + if (state === 'closed') { + return 0; + } + return controller._strategyHWM - controller._queueTotalSize; + } + function ReadableByteStreamControllerRespond(controller, bytesWritten) { + bytesWritten = Number(bytesWritten); + if (IsFiniteNonNegativeNumber(bytesWritten) === false) { + throw new RangeError('bytesWritten must be a finite'); + } + ReadableByteStreamControllerRespondInternal(controller, bytesWritten); + } + function ReadableByteStreamControllerRespondWithNewView(controller, view) { + var firstDescriptor = controller._pendingPullIntos.peek(); + if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) { + throw new RangeError('The region specified by view does not match byobRequest'); + } + if (firstDescriptor.byteLength !== view.byteLength) { + throw new RangeError('The buffer of view has different capacity than byobRequest'); + } + firstDescriptor.buffer = view.buffer; + ReadableByteStreamControllerRespondInternal(controller, view.byteLength); + } + function SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize) { + controller._controlledReadableByteStream = stream; + controller._pullAgain = false; + controller._pulling = false; + controller._byobRequest = undefined; + controller._queue = controller._queueTotalSize = undefined; + ResetQueue(controller); + controller._closeRequested = false; + controller._started = false; + controller._strategyHWM = ValidateAndNormalizeHighWaterMark(highWaterMark); + controller._pullAlgorithm = pullAlgorithm; + controller._cancelAlgorithm = cancelAlgorithm; + controller._autoAllocateChunkSize = autoAllocateChunkSize; + controller._pendingPullIntos = new SimpleQueue(); + stream._readableStreamController = controller; + var startResult = startAlgorithm(); + uponPromise(promiseResolvedWith(startResult), function () { + controller._started = true; + ReadableByteStreamControllerCallPullIfNeeded(controller); + }, function (r) { + ReadableByteStreamControllerError(controller, r); + }); + } + function SetUpReadableByteStreamControllerFromUnderlyingSource(stream, underlyingByteSource, highWaterMark) { + var controller = Object.create(ReadableByteStreamController.prototype); + function startAlgorithm() { + return InvokeOrNoop(underlyingByteSource, 'start', [controller]); + } + var pullAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingByteSource, 'pull', 0, [controller]); + var cancelAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingByteSource, 'cancel', 1, []); + var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize; + if (autoAllocateChunkSize !== undefined) { + autoAllocateChunkSize = Number(autoAllocateChunkSize); + if (NumberIsInteger(autoAllocateChunkSize) === false || autoAllocateChunkSize <= 0) { + throw new RangeError('autoAllocateChunkSize must be a positive integer'); + } + } + SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize); + } + function SetUpReadableStreamBYOBRequest(request, controller, view) { + request._associatedReadableByteStreamController = controller; + request._view = view; + } + function byobRequestBrandCheckException(name) { + return new TypeError("ReadableStreamBYOBRequest.prototype." + name + " can only be used on a ReadableStreamBYOBRequest"); + } + function byteStreamControllerBrandCheckException(name) { + return new TypeError("ReadableByteStreamController.prototype." + name + " can only be used on a ReadableByteStreamController"); + } + function AcquireReadableStreamBYOBReader(stream, forAuthorCode) { + if (forAuthorCode === void 0) { + forAuthorCode = false; + } + var reader = new ReadableStreamBYOBReader(stream); + reader._forAuthorCode = forAuthorCode; + return reader; + } + function ReadableStreamAddReadIntoRequest(stream) { + var promise = newPromise(function (resolve, reject) { + var readIntoRequest = { + _resolve: resolve, + _reject: reject + }; + stream._reader._readIntoRequests.push(readIntoRequest); + }); + return promise; + } + function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) { + var reader = stream._reader; + var readIntoRequest = reader._readIntoRequests.shift(); + readIntoRequest._resolve(ReadableStreamCreateReadResult(chunk, done, reader._forAuthorCode)); + } + function ReadableStreamGetNumReadIntoRequests(stream) { + return stream._reader._readIntoRequests.length; + } + function ReadableStreamHasBYOBReader(stream) { + var reader = stream._reader; + if (reader === undefined) { + return false; + } + if (!IsReadableStreamBYOBReader(reader)) { + return false; } - function defaultReaderClosedPromiseReject(reader, reason) { - assert(reader._closedPromise_resolve !== undefined); - assert(reader._closedPromise_reject !== undefined); - reader._closedPromise_reject(reason); - reader._closedPromise_resolve = undefined; - reader._closedPromise_reject = undefined; + return true; + } + var ReadableStreamBYOBReader = function () { + function ReadableStreamBYOBReader(stream) { + if (!IsReadableStream(stream)) { + throw new TypeError('ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a ' + 'byte source'); + } + if (IsReadableByteStreamController(stream._readableStreamController) === false) { + throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' + 'source'); + } + if (IsReadableStreamLocked(stream)) { + throw new TypeError('This stream has already been locked for exclusive reading by another reader'); + } + ReadableStreamReaderGenericInitialize(this, stream); + this._readIntoRequests = new SimpleQueue(); + } + Object.defineProperty(ReadableStreamBYOBReader.prototype, "closed", { + get: function () { + if (!IsReadableStreamBYOBReader(this)) { + return promiseRejectedWith(byobReaderBrandCheckException('closed')); + } + return this._closedPromise; + }, + enumerable: true, + configurable: true + }); + ReadableStreamBYOBReader.prototype.cancel = function (reason) { + if (!IsReadableStreamBYOBReader(this)) { + return promiseRejectedWith(byobReaderBrandCheckException('cancel')); + } + if (this._ownerReadableStream === undefined) { + return promiseRejectedWith(readerLockException('cancel')); + } + return ReadableStreamReaderGenericCancel(this, reason); + }; + ReadableStreamBYOBReader.prototype.read = function (view) { + if (!IsReadableStreamBYOBReader(this)) { + return promiseRejectedWith(byobReaderBrandCheckException('read')); + } + if (this._ownerReadableStream === undefined) { + return promiseRejectedWith(readerLockException('read from')); + } + if (!ArrayBuffer.isView(view)) { + return promiseRejectedWith(new TypeError('view must be an array buffer view')); + } + if (IsDetachedBuffer(view.buffer) === true); + if (view.byteLength === 0) { + return promiseRejectedWith(new TypeError('view must have non-zero byteLength')); + } + return ReadableStreamBYOBReaderRead(this, view); + }; + ReadableStreamBYOBReader.prototype.releaseLock = function () { + if (!IsReadableStreamBYOBReader(this)) { + throw byobReaderBrandCheckException('releaseLock'); + } + if (this._ownerReadableStream === undefined) { + return; + } + if (this._readIntoRequests.length > 0) { + throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled'); + } + ReadableStreamReaderGenericRelease(this); + }; + return ReadableStreamBYOBReader; + }(); + function IsReadableStreamBYOBReader(x) { + if (!typeIsObject(x)) { + return false; } - function defaultReaderClosedPromiseResetToRejected(reader, reason) { - assert(reader._closedPromise_resolve === undefined); - assert(reader._closedPromise_reject === undefined); - reader._closedPromise = Promise.reject(reason); + if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) { + return false; } - function defaultReaderClosedPromiseResolve(reader) { - assert(reader._closedPromise_resolve !== undefined); - assert(reader._closedPromise_reject !== undefined); - reader._closedPromise_resolve(undefined); - reader._closedPromise_resolve = undefined; - reader._closedPromise_reject = undefined; + return true; + } + function ReadableStreamBYOBReaderRead(reader, view) { + var stream = reader._ownerReadableStream; + stream._disturbed = true; + if (stream._state === 'errored') { + return promiseRejectedWith(stream._storedError); + } + return ReadableByteStreamControllerPullInto(stream._readableStreamController, view); + } + function byobReaderBrandCheckException(name) { + return new TypeError("ReadableStreamBYOBReader.prototype." + name + " can only be used on a ReadableStreamBYOBReader"); + } + var ReadableStream = function () { + function ReadableStream(underlyingSource, strategy) { + if (underlyingSource === void 0) { + underlyingSource = {}; + } + if (strategy === void 0) { + strategy = {}; + } + InitializeReadableStream(this); + var size = strategy.size; + var highWaterMark = strategy.highWaterMark; + var type = underlyingSource.type; + var typeString = String(type); + if (typeString === 'bytes') { + if (size !== undefined) { + throw new RangeError('The strategy for a byte stream cannot have a size function'); + } + if (highWaterMark === undefined) { + highWaterMark = 0; + } + highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark); + SetUpReadableByteStreamControllerFromUnderlyingSource(this, underlyingSource, highWaterMark); + } else if (type === undefined) { + var sizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(size); + if (highWaterMark === undefined) { + highWaterMark = 1; + } + highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark); + SetUpReadableStreamDefaultControllerFromUnderlyingSource(this, underlyingSource, highWaterMark, sizeAlgorithm); + } else { + throw new RangeError('Invalid type is specified'); + } + } + Object.defineProperty(ReadableStream.prototype, "locked", { + get: function () { + if (IsReadableStream(this) === false) { + throw streamBrandCheckException$1('locked'); + } + return IsReadableStreamLocked(this); + }, + enumerable: true, + configurable: true + }); + ReadableStream.prototype.cancel = function (reason) { + if (IsReadableStream(this) === false) { + return promiseRejectedWith(streamBrandCheckException$1('cancel')); + } + if (IsReadableStreamLocked(this) === true) { + return promiseRejectedWith(new TypeError('Cannot cancel a stream that already has a reader')); + } + return ReadableStreamCancel(this, reason); + }; + ReadableStream.prototype.getReader = function (_a) { + var mode = (_a === void 0 ? {} : _a).mode; + if (IsReadableStream(this) === false) { + throw streamBrandCheckException$1('getReader'); + } + if (mode === undefined) { + return AcquireReadableStreamDefaultReader(this, true); + } + mode = String(mode); + if (mode === 'byob') { + return AcquireReadableStreamBYOBReader(this, true); + } + throw new RangeError('Invalid mode is specified'); + }; + ReadableStream.prototype.pipeThrough = function (_a, _b) { + var writable = _a.writable, readable = _a.readable; + var _c = _b === void 0 ? {} : _b, preventClose = _c.preventClose, preventAbort = _c.preventAbort, preventCancel = _c.preventCancel, signal = _c.signal; + if (IsReadableStream(this) === false) { + throw streamBrandCheckException$1('pipeThrough'); + } + if (IsWritableStream(writable) === false) { + throw new TypeError('writable argument to pipeThrough must be a WritableStream'); + } + if (IsReadableStream(readable) === false) { + throw new TypeError('readable argument to pipeThrough must be a ReadableStream'); + } + preventClose = Boolean(preventClose); + preventAbort = Boolean(preventAbort); + preventCancel = Boolean(preventCancel); + if (signal !== undefined && !isAbortSignal(signal)) { + throw new TypeError('ReadableStream.prototype.pipeThrough\'s signal option must be an AbortSignal'); + } + if (IsReadableStreamLocked(this) === true) { + throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream'); + } + if (IsWritableStreamLocked(writable) === true) { + throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream'); + } + var promise = ReadableStreamPipeTo(this, writable, preventClose, preventAbort, preventCancel, signal); + setPromiseIsHandledToTrue(promise); + return readable; + }; + ReadableStream.prototype.pipeTo = function (dest, _a) { + var _b = _a === void 0 ? {} : _a, preventClose = _b.preventClose, preventAbort = _b.preventAbort, preventCancel = _b.preventCancel, signal = _b.signal; + if (IsReadableStream(this) === false) { + return promiseRejectedWith(streamBrandCheckException$1('pipeTo')); + } + if (IsWritableStream(dest) === false) { + return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo\'s first argument must be a WritableStream')); + } + preventClose = Boolean(preventClose); + preventAbort = Boolean(preventAbort); + preventCancel = Boolean(preventCancel); + if (signal !== undefined && !isAbortSignal(signal)) { + return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo\'s signal option must be an AbortSignal')); + } + if (IsReadableStreamLocked(this) === true) { + return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream')); + } + if (IsWritableStreamLocked(dest) === true) { + return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream')); + } + return ReadableStreamPipeTo(this, dest, preventClose, preventAbort, preventCancel, signal); + }; + ReadableStream.prototype.tee = function () { + if (IsReadableStream(this) === false) { + throw streamBrandCheckException$1('tee'); + } + var branches = ReadableStreamTee(this); + return createArrayFromList(branches); + }; + ReadableStream.prototype.getIterator = function (_a) { + var _b = (_a === void 0 ? {} : _a).preventCancel, preventCancel = _b === void 0 ? false : _b; + if (IsReadableStream(this) === false) { + throw streamBrandCheckException$1('getIterator'); + } + return AcquireReadableStreamAsyncIterator(this, preventCancel); + }; + return ReadableStream; + }(); + if (typeof SymbolPolyfill.asyncIterator === 'symbol') { + Object.defineProperty(ReadableStream.prototype, SymbolPolyfill.asyncIterator, { + value: ReadableStream.prototype.getIterator, + enumerable: false, + writable: true, + configurable: true + }); + } + function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm) { + if (highWaterMark === void 0) { + highWaterMark = 1; + } + if (sizeAlgorithm === void 0) { + sizeAlgorithm = function () { + return 1; + }; + } + var stream = Object.create(ReadableStream.prototype); + InitializeReadableStream(stream); + var controller = Object.create(ReadableStreamDefaultController.prototype); + SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm); + return stream; + } + function InitializeReadableStream(stream) { + stream._state = 'readable'; + stream._reader = undefined; + stream._storedError = undefined; + stream._disturbed = false; + } + function IsReadableStream(x) { + if (!typeIsObject(x)) { + return false; + } + if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) { + return false; } - function byobReaderBrandCheckException(name) { - return new TypeError('ReadableStreamBYOBReader.prototype.' + name + ' can only be used on a ReadableStreamBYOBReader'); + return true; + } + function IsReadableStreamLocked(stream) { + if (stream._reader === undefined) { + return false; } - function defaultControllerBrandCheckException(name) { - return new TypeError('ReadableStreamDefaultController.prototype.' + name + ' can only be used on a ReadableStreamDefaultController'); + return true; + } + function ReadableStreamCancel(stream, reason) { + stream._disturbed = true; + if (stream._state === 'closed') { + return promiseResolvedWith(undefined); + } + if (stream._state === 'errored') { + return promiseRejectedWith(stream._storedError); + } + ReadableStreamClose(stream); + var sourceCancelPromise = stream._readableStreamController[CancelSteps](reason); + return transformPromiseWith(sourceCancelPromise, noop); + } + function ReadableStreamClose(stream) { + stream._state = 'closed'; + var reader = stream._reader; + if (reader === undefined) { + return; + } + if (IsReadableStreamDefaultReader(reader)) { + reader._readRequests.forEach(function (readRequest) { + readRequest._resolve(ReadableStreamCreateReadResult(undefined, true, reader._forAuthorCode)); + }); + reader._readRequests = new SimpleQueue(); + } + defaultReaderClosedPromiseResolve(reader); + } + function ReadableStreamError(stream, e) { + stream._state = 'errored'; + stream._storedError = e; + var reader = stream._reader; + if (reader === undefined) { + return; + } + if (IsReadableStreamDefaultReader(reader)) { + reader._readRequests.forEach(function (readRequest) { + readRequest._reject(e); + }); + reader._readRequests = new SimpleQueue(); + } else { + reader._readIntoRequests.forEach(function (readIntoRequest) { + readIntoRequest._reject(e); + }); + reader._readIntoRequests = new SimpleQueue(); + } + defaultReaderClosedPromiseReject(reader, e); + } + function streamBrandCheckException$1(name) { + return new TypeError("ReadableStream.prototype." + name + " can only be used on a ReadableStream"); + } + var ByteLengthQueuingStrategy = function () { + function ByteLengthQueuingStrategy(_a) { + var highWaterMark = _a.highWaterMark; + this.highWaterMark = highWaterMark; + } + ByteLengthQueuingStrategy.prototype.size = function (chunk) { + return chunk.byteLength; + }; + return ByteLengthQueuingStrategy; + }(); + var CountQueuingStrategy = function () { + function CountQueuingStrategy(_a) { + var highWaterMark = _a.highWaterMark; + this.highWaterMark = highWaterMark; + } + CountQueuingStrategy.prototype.size = function () { + return 1; + }; + return CountQueuingStrategy; + }(); + var TransformStream = function () { + function TransformStream(transformer, writableStrategy, readableStrategy) { + if (transformer === void 0) { + transformer = {}; + } + if (writableStrategy === void 0) { + writableStrategy = {}; + } + if (readableStrategy === void 0) { + readableStrategy = {}; + } + var writableSizeFunction = writableStrategy.size; + var writableHighWaterMark = writableStrategy.highWaterMark; + var readableSizeFunction = readableStrategy.size; + var readableHighWaterMark = readableStrategy.highWaterMark; + var writableType = transformer.writableType; + if (writableType !== undefined) { + throw new RangeError('Invalid writable type specified'); + } + var writableSizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(writableSizeFunction); + if (writableHighWaterMark === undefined) { + writableHighWaterMark = 1; + } + writableHighWaterMark = ValidateAndNormalizeHighWaterMark(writableHighWaterMark); + var readableType = transformer.readableType; + if (readableType !== undefined) { + throw new RangeError('Invalid readable type specified'); + } + var readableSizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(readableSizeFunction); + if (readableHighWaterMark === undefined) { + readableHighWaterMark = 0; + } + readableHighWaterMark = ValidateAndNormalizeHighWaterMark(readableHighWaterMark); + var startPromise_resolve; + var startPromise = newPromise(function (resolve) { + startPromise_resolve = resolve; + }); + InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm); + SetUpTransformStreamDefaultControllerFromTransformer(this, transformer); + var startResult = InvokeOrNoop(transformer, 'start', [this._transformStreamController]); + startPromise_resolve(startResult); + } + Object.defineProperty(TransformStream.prototype, "readable", { + get: function () { + if (IsTransformStream(this) === false) { + throw streamBrandCheckException$2('readable'); + } + return this._readable; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(TransformStream.prototype, "writable", { + get: function () { + if (IsTransformStream(this) === false) { + throw streamBrandCheckException$2('writable'); + } + return this._writable; + }, + enumerable: true, + configurable: true + }); + return TransformStream; + }(); + function InitializeTransformStream(stream, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm) { + function startAlgorithm() { + return startPromise; + } + function writeAlgorithm(chunk) { + return TransformStreamDefaultSinkWriteAlgorithm(stream, chunk); + } + function abortAlgorithm(reason) { + return TransformStreamDefaultSinkAbortAlgorithm(stream, reason); + } + function closeAlgorithm() { + return TransformStreamDefaultSinkCloseAlgorithm(stream); + } + stream._writable = CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, writableHighWaterMark, writableSizeAlgorithm); + function pullAlgorithm() { + return TransformStreamDefaultSourcePullAlgorithm(stream); + } + function cancelAlgorithm(reason) { + TransformStreamErrorWritableAndUnblockWrite(stream, reason); + return promiseResolvedWith(undefined); + } + stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark, readableSizeAlgorithm); + stream._backpressure = undefined; + stream._backpressureChangePromise = undefined; + stream._backpressureChangePromise_resolve = undefined; + TransformStreamSetBackpressure(stream, true); + stream._transformStreamController = undefined; + } + function IsTransformStream(x) { + if (!typeIsObject(x)) { + return false; + } + if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) { + return false; } - function byobRequestBrandCheckException(name) { - return new TypeError('ReadableStreamBYOBRequest.prototype.' + name + ' can only be used on a ReadableStreamBYOBRequest'); + return true; + } + function TransformStreamError(stream, e) { + ReadableStreamDefaultControllerError(stream._readable._readableStreamController, e); + TransformStreamErrorWritableAndUnblockWrite(stream, e); + } + function TransformStreamErrorWritableAndUnblockWrite(stream, e) { + TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController); + WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e); + if (stream._backpressure === true) { + TransformStreamSetBackpressure(stream, false); + } + } + function TransformStreamSetBackpressure(stream, backpressure) { + if (stream._backpressureChangePromise !== undefined) { + stream._backpressureChangePromise_resolve(); + } + stream._backpressureChangePromise = newPromise(function (resolve) { + stream._backpressureChangePromise_resolve = resolve; + }); + stream._backpressure = backpressure; + } + var TransformStreamDefaultController = function () { + function TransformStreamDefaultController() { + throw new TypeError('TransformStreamDefaultController instances cannot be created directly'); + } + Object.defineProperty(TransformStreamDefaultController.prototype, "desiredSize", { + get: function () { + if (IsTransformStreamDefaultController(this) === false) { + throw defaultControllerBrandCheckException$1('desiredSize'); + } + var readableController = this._controlledTransformStream._readable._readableStreamController; + return ReadableStreamDefaultControllerGetDesiredSize(readableController); + }, + enumerable: true, + configurable: true + }); + TransformStreamDefaultController.prototype.enqueue = function (chunk) { + if (IsTransformStreamDefaultController(this) === false) { + throw defaultControllerBrandCheckException$1('enqueue'); + } + TransformStreamDefaultControllerEnqueue(this, chunk); + }; + TransformStreamDefaultController.prototype.error = function (reason) { + if (IsTransformStreamDefaultController(this) === false) { + throw defaultControllerBrandCheckException$1('error'); + } + TransformStreamDefaultControllerError(this, reason); + }; + TransformStreamDefaultController.prototype.terminate = function () { + if (IsTransformStreamDefaultController(this) === false) { + throw defaultControllerBrandCheckException$1('terminate'); + } + TransformStreamDefaultControllerTerminate(this); + }; + return TransformStreamDefaultController; + }(); + function IsTransformStreamDefaultController(x) { + if (!typeIsObject(x)) { + return false; } - function byteStreamControllerBrandCheckException(name) { - return new TypeError('ReadableByteStreamController.prototype.' + name + ' can only be used on a ReadableByteStreamController'); + if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) { + return false; } - function ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise) { - try { - Promise.prototype.then.call(promise, undefined, function () {}); - } catch (e) {} + return true; + } + function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm) { + controller._controlledTransformStream = stream; + stream._transformStreamController = controller; + controller._transformAlgorithm = transformAlgorithm; + controller._flushAlgorithm = flushAlgorithm; + } + function SetUpTransformStreamDefaultControllerFromTransformer(stream, transformer) { + var controller = Object.create(TransformStreamDefaultController.prototype); + var transformAlgorithm = function (chunk) { + try { + TransformStreamDefaultControllerEnqueue(controller, chunk); + return promiseResolvedWith(undefined); + } catch (transformResultE) { + return promiseRejectedWith(transformResultE); + } + }; + var transformMethod = transformer.transform; + if (transformMethod !== undefined) { + if (typeof transformMethod !== 'function') { + throw new TypeError('transform is not a method'); + } + transformAlgorithm = function (chunk) { + return PromiseCall(transformMethod, transformer, [ + chunk, + controller + ]); + }; + } + var flushAlgorithm = CreateAlgorithmFromUnderlyingMethod(transformer, 'flush', 0, [controller]); + SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm); + } + function TransformStreamDefaultControllerClearAlgorithms(controller) { + controller._transformAlgorithm = undefined; + controller._flushAlgorithm = undefined; + } + function TransformStreamDefaultControllerEnqueue(controller, chunk) { + var stream = controller._controlledTransformStream; + var readableController = stream._readable._readableStreamController; + if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === false) { + throw new TypeError('Readable side is not in a state that permits enqueue'); } -}, function (module, exports, __w_pdfjs_require__) { - "use strict"; + try { + ReadableStreamDefaultControllerEnqueue(readableController, chunk); + } catch (e) { + TransformStreamErrorWritableAndUnblockWrite(stream, e); + throw stream._readable._storedError; + } + var backpressure = ReadableStreamDefaultControllerHasBackpressure(readableController); + if (backpressure !== stream._backpressure) { + TransformStreamSetBackpressure(stream, true); + } + } + function TransformStreamDefaultControllerError(controller, e) { + TransformStreamError(controller._controlledTransformStream, e); + } + function TransformStreamDefaultControllerPerformTransform(controller, chunk) { + var transformPromise = controller._transformAlgorithm(chunk); + return transformPromiseWith(transformPromise, undefined, function (r) { + TransformStreamError(controller._controlledTransformStream, r); + throw r; + }); + } + function TransformStreamDefaultControllerTerminate(controller) { + var stream = controller._controlledTransformStream; + var readableController = stream._readable._readableStreamController; + if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === true) { + ReadableStreamDefaultControllerClose(readableController); + } + var error = new TypeError('TransformStream terminated'); + TransformStreamErrorWritableAndUnblockWrite(stream, error); + } + function TransformStreamDefaultSinkWriteAlgorithm(stream, chunk) { + var controller = stream._transformStreamController; + if (stream._backpressure === true) { + var backpressureChangePromise = stream._backpressureChangePromise; + return transformPromiseWith(backpressureChangePromise, function () { + var writable = stream._writable; + var state = writable._state; + if (state === 'erroring') { + throw writable._storedError; + } + return TransformStreamDefaultControllerPerformTransform(controller, chunk); + }); + } + return TransformStreamDefaultControllerPerformTransform(controller, chunk); + } + function TransformStreamDefaultSinkAbortAlgorithm(stream, reason) { + TransformStreamError(stream, reason); + return promiseResolvedWith(undefined); + } + function TransformStreamDefaultSinkCloseAlgorithm(stream) { + var readable = stream._readable; + var controller = stream._transformStreamController; + var flushPromise = controller._flushAlgorithm(); + TransformStreamDefaultControllerClearAlgorithms(controller); + return transformPromiseWith(flushPromise, function () { + if (readable._state === 'errored') { + throw readable._storedError; + } + var readableController = readable._readableStreamController; + if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === true) { + ReadableStreamDefaultControllerClose(readableController); + } + }, function (r) { + TransformStreamError(stream, r); + throw readable._storedError; + }); + } + function TransformStreamDefaultSourcePullAlgorithm(stream) { + TransformStreamSetBackpressure(stream, false); + return stream._backpressureChangePromise; + } + function defaultControllerBrandCheckException$1(name) { + return new TypeError("TransformStreamDefaultController.prototype." + name + " can only be used on a TransformStreamDefaultController"); + } + function streamBrandCheckException$2(name) { + return new TypeError("TransformStream.prototype." + name + " can only be used on a TransformStream"); + } + exports.ByteLengthQueuingStrategy = ByteLengthQueuingStrategy; + exports.CountQueuingStrategy = CountQueuingStrategy; + exports.ReadableStream = ReadableStream; + exports.TransformStream = TransformStream; + exports.WritableStream = WritableStream; + Object.defineProperty(exports, '__esModule', { value: true }); +})); - var transformStream = __w_pdfjs_require__(6); - var readableStream = __w_pdfjs_require__(4); - var writableStream = __w_pdfjs_require__(2); - exports.TransformStream = transformStream.TransformStream; - exports.ReadableStream = readableStream.ReadableStream; - exports.IsReadableStreamDisturbed = readableStream.IsReadableStreamDisturbed; - exports.ReadableStreamDefaultControllerClose = readableStream.ReadableStreamDefaultControllerClose; - exports.ReadableStreamDefaultControllerEnqueue = readableStream.ReadableStreamDefaultControllerEnqueue; - exports.ReadableStreamDefaultControllerError = readableStream.ReadableStreamDefaultControllerError; - exports.ReadableStreamDefaultControllerGetDesiredSize = readableStream.ReadableStreamDefaultControllerGetDesiredSize; - exports.AcquireWritableStreamDefaultWriter = writableStream.AcquireWritableStreamDefaultWriter; - exports.IsWritableStream = writableStream.IsWritableStream; - exports.IsWritableStreamLocked = writableStream.IsWritableStreamLocked; - exports.WritableStream = writableStream.WritableStream; - exports.WritableStreamAbort = writableStream.WritableStreamAbort; - exports.WritableStreamDefaultControllerError = writableStream.WritableStreamDefaultControllerError; - exports.WritableStreamDefaultWriterCloseWithErrorPropagation = writableStream.WritableStreamDefaultWriterCloseWithErrorPropagation; - exports.WritableStreamDefaultWriterRelease = writableStream.WritableStreamDefaultWriterRelease; - exports.WritableStreamDefaultWriterWrite = writableStream.WritableStreamDefaultWriterWrite; -}, function (module, exports, __w_pdfjs_require__) { - "use strict"; +/***/ }), +/* 144 */ +/***/ (function(module, exports, __w_pdfjs_require__) { - var _createClass = function () { - function defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - return function (Constructor, protoProps, staticProps) { - if (protoProps) defineProperties(Constructor.prototype, protoProps); - if (staticProps) defineProperties(Constructor, staticProps); - return Constructor; - }; - }(); - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - var _require = __w_pdfjs_require__(1), - assert = _require.assert; - var _require2 = __w_pdfjs_require__(0), - InvokeOrNoop = _require2.InvokeOrNoop, - PromiseInvokeOrPerformFallback = _require2.PromiseInvokeOrPerformFallback, - PromiseInvokeOrNoop = _require2.PromiseInvokeOrNoop, - typeIsObject = _require2.typeIsObject; - var _require3 = __w_pdfjs_require__(4), - ReadableStream = _require3.ReadableStream, - ReadableStreamDefaultControllerClose = _require3.ReadableStreamDefaultControllerClose, - ReadableStreamDefaultControllerEnqueue = _require3.ReadableStreamDefaultControllerEnqueue, - ReadableStreamDefaultControllerError = _require3.ReadableStreamDefaultControllerError, - ReadableStreamDefaultControllerGetDesiredSize = _require3.ReadableStreamDefaultControllerGetDesiredSize; - var _require4 = __w_pdfjs_require__(2), - WritableStream = _require4.WritableStream, - WritableStreamDefaultControllerError = _require4.WritableStreamDefaultControllerError; - function TransformStreamCloseReadable(transformStream) { - if (transformStream._errored === true) { - throw new TypeError('TransformStream is already errored'); - } - if (transformStream._readableClosed === true) { - throw new TypeError('Readable side is already closed'); - } - TransformStreamCloseReadableInternal(transformStream); - } - function TransformStreamEnqueueToReadable(transformStream, chunk) { - if (transformStream._errored === true) { - throw new TypeError('TransformStream is already errored'); - } - if (transformStream._readableClosed === true) { - throw new TypeError('Readable side is already closed'); - } - var controller = transformStream._readableController; - try { - ReadableStreamDefaultControllerEnqueue(controller, chunk); - } catch (e) { - transformStream._readableClosed = true; - TransformStreamErrorIfNeeded(transformStream, e); - throw transformStream._storedError; - } - var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller); - var maybeBackpressure = desiredSize <= 0; - if (maybeBackpressure === true && transformStream._backpressure === false) { - TransformStreamSetBackpressure(transformStream, true); - } - } - function TransformStreamError(transformStream, e) { - if (transformStream._errored === true) { - throw new TypeError('TransformStream is already errored'); - } - TransformStreamErrorInternal(transformStream, e); - } - function TransformStreamCloseReadableInternal(transformStream) { - assert(transformStream._errored === false); - assert(transformStream._readableClosed === false); - try { - ReadableStreamDefaultControllerClose(transformStream._readableController); - } catch (e) { - assert(false); - } - transformStream._readableClosed = true; - } - function TransformStreamErrorIfNeeded(transformStream, e) { - if (transformStream._errored === false) { - TransformStreamErrorInternal(transformStream, e); - } - } - function TransformStreamErrorInternal(transformStream, e) { - assert(transformStream._errored === false); - transformStream._errored = true; - transformStream._storedError = e; - if (transformStream._writableDone === false) { - WritableStreamDefaultControllerError(transformStream._writableController, e); - } - if (transformStream._readableClosed === false) { - ReadableStreamDefaultControllerError(transformStream._readableController, e); - } - } - function TransformStreamReadableReadyPromise(transformStream) { - assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized'); - if (transformStream._backpressure === false) { - return Promise.resolve(); - } - assert(transformStream._backpressure === true, '_backpressure should have been initialized'); - return transformStream._backpressureChangePromise; - } - function TransformStreamSetBackpressure(transformStream, backpressure) { - assert(transformStream._backpressure !== backpressure, 'TransformStreamSetBackpressure() should be called only when backpressure is changed'); - if (transformStream._backpressureChangePromise !== undefined) { - transformStream._backpressureChangePromise_resolve(backpressure); - } - transformStream._backpressureChangePromise = new Promise(function (resolve) { - transformStream._backpressureChangePromise_resolve = resolve; - }); - transformStream._backpressureChangePromise.then(function (resolution) { - assert(resolution !== backpressure, '_backpressureChangePromise should be fulfilled only when backpressure is changed'); - }); - transformStream._backpressure = backpressure; - } - function TransformStreamDefaultTransform(chunk, transformStreamController) { - var transformStream = transformStreamController._controlledTransformStream; - TransformStreamEnqueueToReadable(transformStream, chunk); - return Promise.resolve(); - } - function TransformStreamTransform(transformStream, chunk) { - assert(transformStream._errored === false); - assert(transformStream._transforming === false); - assert(transformStream._backpressure === false); - transformStream._transforming = true; - var transformer = transformStream._transformer; - var controller = transformStream._transformStreamController; - var transformPromise = PromiseInvokeOrPerformFallback(transformer, 'transform', [chunk, controller], TransformStreamDefaultTransform, [chunk, controller]); - return transformPromise.then(function () { - transformStream._transforming = false; - return TransformStreamReadableReadyPromise(transformStream); - }, function (e) { - TransformStreamErrorIfNeeded(transformStream, e); - return Promise.reject(e); - }); - } - function IsTransformStreamDefaultController(x) { - if (!typeIsObject(x)) { - return false; - } - if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) { - return false; - } - return true; - } - function IsTransformStream(x) { - if (!typeIsObject(x)) { - return false; - } - if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) { - return false; - } - return true; - } - var TransformStreamSink = function () { - function TransformStreamSink(transformStream, startPromise) { - _classCallCheck(this, TransformStreamSink); - this._transformStream = transformStream; - this._startPromise = startPromise; - } - _createClass(TransformStreamSink, [{ - key: 'start', - value: function start(c) { - var transformStream = this._transformStream; - transformStream._writableController = c; - return this._startPromise.then(function () { - return TransformStreamReadableReadyPromise(transformStream); - }); - } - }, { - key: 'write', - value: function write(chunk) { - var transformStream = this._transformStream; - return TransformStreamTransform(transformStream, chunk); - } - }, { - key: 'abort', - value: function abort() { - var transformStream = this._transformStream; - transformStream._writableDone = true; - TransformStreamErrorInternal(transformStream, new TypeError('Writable side aborted')); - } - }, { - key: 'close', - value: function close() { - var transformStream = this._transformStream; - assert(transformStream._transforming === false); - transformStream._writableDone = true; - var flushPromise = PromiseInvokeOrNoop(transformStream._transformer, 'flush', [transformStream._transformStreamController]); - return flushPromise.then(function () { - if (transformStream._errored === true) { - return Promise.reject(transformStream._storedError); - } - if (transformStream._readableClosed === false) { - TransformStreamCloseReadableInternal(transformStream); - } - return Promise.resolve(); - }).catch(function (r) { - TransformStreamErrorIfNeeded(transformStream, r); - return Promise.reject(transformStream._storedError); - }); - } - }]); - return TransformStreamSink; - }(); - var TransformStreamSource = function () { - function TransformStreamSource(transformStream, startPromise) { - _classCallCheck(this, TransformStreamSource); - this._transformStream = transformStream; - this._startPromise = startPromise; - } - _createClass(TransformStreamSource, [{ - key: 'start', - value: function start(c) { - var transformStream = this._transformStream; - transformStream._readableController = c; - return this._startPromise.then(function () { - assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized'); - if (transformStream._backpressure === true) { - return Promise.resolve(); - } - assert(transformStream._backpressure === false, '_backpressure should have been initialized'); - return transformStream._backpressureChangePromise; - }); - } - }, { - key: 'pull', - value: function pull() { - var transformStream = this._transformStream; - assert(transformStream._backpressure === true, 'pull() should be never called while _backpressure is false'); - assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized'); - TransformStreamSetBackpressure(transformStream, false); - return transformStream._backpressureChangePromise; - } - }, { - key: 'cancel', - value: function cancel() { - var transformStream = this._transformStream; - transformStream._readableClosed = true; - TransformStreamErrorInternal(transformStream, new TypeError('Readable side canceled')); - } - }]); - return TransformStreamSource; - }(); - var TransformStreamDefaultController = function () { - function TransformStreamDefaultController(transformStream) { - _classCallCheck(this, TransformStreamDefaultController); - if (IsTransformStream(transformStream) === false) { - throw new TypeError('TransformStreamDefaultController can only be ' + 'constructed with a TransformStream instance'); - } - if (transformStream._transformStreamController !== undefined) { - throw new TypeError('TransformStreamDefaultController instances can ' + 'only be created by the TransformStream constructor'); - } - this._controlledTransformStream = transformStream; - } - _createClass(TransformStreamDefaultController, [{ - key: 'enqueue', - value: function enqueue(chunk) { - if (IsTransformStreamDefaultController(this) === false) { - throw defaultControllerBrandCheckException('enqueue'); - } - TransformStreamEnqueueToReadable(this._controlledTransformStream, chunk); - } - }, { - key: 'close', - value: function close() { - if (IsTransformStreamDefaultController(this) === false) { - throw defaultControllerBrandCheckException('close'); - } - TransformStreamCloseReadable(this._controlledTransformStream); - } - }, { - key: 'error', - value: function error(reason) { - if (IsTransformStreamDefaultController(this) === false) { - throw defaultControllerBrandCheckException('error'); - } - TransformStreamError(this._controlledTransformStream, reason); - } - }, { - key: 'desiredSize', - get: function get() { - if (IsTransformStreamDefaultController(this) === false) { - throw defaultControllerBrandCheckException('desiredSize'); - } - var transformStream = this._controlledTransformStream; - var readableController = transformStream._readableController; - return ReadableStreamDefaultControllerGetDesiredSize(readableController); - } - }]); - return TransformStreamDefaultController; - }(); - var TransformStream = function () { - function TransformStream() { - var transformer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - _classCallCheck(this, TransformStream); - this._transformer = transformer; - var readableStrategy = transformer.readableStrategy, - writableStrategy = transformer.writableStrategy; - this._transforming = false; - this._errored = false; - this._storedError = undefined; - this._writableController = undefined; - this._readableController = undefined; - this._transformStreamController = undefined; - this._writableDone = false; - this._readableClosed = false; - this._backpressure = undefined; - this._backpressureChangePromise = undefined; - this._backpressureChangePromise_resolve = undefined; - this._transformStreamController = new TransformStreamDefaultController(this); - var startPromise_resolve = void 0; - var startPromise = new Promise(function (resolve) { - startPromise_resolve = resolve; - }); - var source = new TransformStreamSource(this, startPromise); - this._readable = new ReadableStream(source, readableStrategy); - var sink = new TransformStreamSink(this, startPromise); - this._writable = new WritableStream(sink, writableStrategy); - assert(this._writableController !== undefined); - assert(this._readableController !== undefined); - var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(this._readableController); - TransformStreamSetBackpressure(this, desiredSize <= 0); - var transformStream = this; - var startResult = InvokeOrNoop(transformer, 'start', [transformStream._transformStreamController]); - startPromise_resolve(startResult); - startPromise.catch(function (e) { - if (transformStream._errored === false) { - transformStream._errored = true; - transformStream._storedError = e; - } - }); - } - _createClass(TransformStream, [{ - key: 'readable', - get: function get() { - if (IsTransformStream(this) === false) { - throw streamBrandCheckException('readable'); - } - return this._readable; - } - }, { - key: 'writable', - get: function get() { - if (IsTransformStream(this) === false) { - throw streamBrandCheckException('writable'); - } - return this._writable; - } - }]); - return TransformStream; - }(); - module.exports = { TransformStream: TransformStream }; - function defaultControllerBrandCheckException(name) { - return new TypeError('TransformStreamDefaultController.prototype.' + name + ' can only be used on a TransformStreamDefaultController'); - } - function streamBrandCheckException(name) { - return new TypeError('TransformStream.prototype.' + name + ' can only be used on a TransformStream'); - } -}, function (module, exports, __w_pdfjs_require__) { - module.exports = __w_pdfjs_require__(5); -}])); +__w_pdfjs_require__(145); +__w_pdfjs_require__(114); +__w_pdfjs_require__(77); +__w_pdfjs_require__(116); +var path = __w_pdfjs_require__(43); +module.exports = path.Map; /***/ }), -/* 127 */ +/* 145 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; +var collection = __w_pdfjs_require__(146); +var collectionStrong = __w_pdfjs_require__(150); +module.exports = collection('Map', function (init) { + return function Map() { + return init(this, arguments.length ? arguments[0] : undefined); + }; +}, collectionStrong); + +/***/ }), +/* 146 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +"use strict"; -{ - var isURLSupported = false; - try { - if (typeof URL === 'function' && _typeof(URL.prototype) === 'object' && 'origin' in URL.prototype) { - var u = new URL('b', 'http://a'); - u.pathname = 'c%20d'; - isURLSupported = u.href === 'http://a/c%20d'; - } - } catch (ex) {} - if (isURLSupported) { - exports.URL = URL; - } else { - var PolyfillURL = __w_pdfjs_require__(128).URL; - var OriginalURL = __w_pdfjs_require__(3).URL; - if (OriginalURL) { - PolyfillURL.createObjectURL = function (blob) { - return OriginalURL.createObjectURL.apply(OriginalURL, arguments); - }; - PolyfillURL.revokeObjectURL = function (url) { - OriginalURL.revokeObjectURL(url); - }; - } - exports.URL = PolyfillURL; +var $ = __w_pdfjs_require__(10); +var global = __w_pdfjs_require__(11); +var isForced = __w_pdfjs_require__(52); +var redefine = __w_pdfjs_require__(29); +var InternalMetadataModule = __w_pdfjs_require__(147); +var iterate = __w_pdfjs_require__(124); +var anInstance = __w_pdfjs_require__(123); +var isObject = __w_pdfjs_require__(22); +var fails = __w_pdfjs_require__(14); +var checkCorrectnessOfIteration = __w_pdfjs_require__(97); +var setToStringTag = __w_pdfjs_require__(85); +var inheritIfRequired = __w_pdfjs_require__(149); +module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { + var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; + var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; + var ADDER = IS_MAP ? 'set' : 'add'; + var NativeConstructor = global[CONSTRUCTOR_NAME]; + var NativePrototype = NativeConstructor && NativeConstructor.prototype; + var Constructor = NativeConstructor; + var exported = {}; + var fixMethod = function (KEY) { + var nativeMethod = NativePrototype[KEY]; + redefine(NativePrototype, KEY, KEY == 'add' ? function add(value) { + nativeMethod.call(this, value === 0 ? 0 : value); + return this; + } : KEY == 'delete' ? function (key) { + return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); + } : KEY == 'get' ? function get(key) { + return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key); + } : KEY == 'has' ? function has(key) { + return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); + } : function set(key, value) { + nativeMethod.call(this, key === 0 ? 0 : key, value); + return this; + }); + }; + if (isForced(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () { + new NativeConstructor().entries().next(); + })))) { + Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); + InternalMetadataModule.REQUIRED = true; + } else if (isForced(CONSTRUCTOR_NAME, true)) { + var instance = new Constructor(); + var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; + var THROWS_ON_PRIMITIVES = fails(function () { + instance.has(1); + }); + var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { + new NativeConstructor(iterable); + }); + var BUGGY_ZERO = !IS_WEAK && fails(function () { + var $instance = new NativeConstructor(); + var index = 5; + while (index--) + $instance[ADDER](index, index); + return !$instance.has(-0); + }); + if (!ACCEPT_ITERABLES) { + Constructor = wrapper(function (dummy, iterable) { + anInstance(dummy, Constructor, CONSTRUCTOR_NAME); + var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); + if (iterable != undefined) + iterate(iterable, that[ADDER], that, IS_MAP); + return that; + }); + Constructor.prototype = NativePrototype; + NativePrototype.constructor = Constructor; + } + if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { + fixMethod('delete'); + fixMethod('has'); + IS_MAP && fixMethod('get'); + } + if (BUGGY_ZERO || HASNT_CHAINING) + fixMethod(ADDER); + if (IS_WEAK && NativePrototype.clear) + delete NativePrototype.clear; + } + exported[CONSTRUCTOR_NAME] = Constructor; + $({ + global: true, + forced: Constructor != NativeConstructor + }, exported); + setToStringTag(Constructor, CONSTRUCTOR_NAME); + if (!IS_WEAK) + common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); + return Constructor; +}; + +/***/ }), +/* 147 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var hiddenKeys = __w_pdfjs_require__(39); +var isObject = __w_pdfjs_require__(22); +var has = __w_pdfjs_require__(23); +var defineProperty = __w_pdfjs_require__(27).f; +var uid = __w_pdfjs_require__(38); +var FREEZING = __w_pdfjs_require__(148); +var METADATA = uid('meta'); +var id = 0; +var isExtensible = Object.isExtensible || function () { + return true; +}; +var setMetadata = function (it) { + defineProperty(it, METADATA, { + value: { + objectID: 'O' + ++id, + weakData: {} } -} + }); +}; +var fastKey = function (it, create) { + if (!isObject(it)) + return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, METADATA)) { + if (!isExtensible(it)) + return 'F'; + if (!create) + return 'E'; + setMetadata(it); + } + return it[METADATA].objectID; +}; +var getWeakData = function (it, create) { + if (!has(it, METADATA)) { + if (!isExtensible(it)) + return true; + if (!create) + return false; + setMetadata(it); + } + return it[METADATA].weakData; +}; +var onFreeze = function (it) { + if (FREEZING && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) + setMetadata(it); + return it; +}; +var meta = module.exports = { + REQUIRED: false, + fastKey: fastKey, + getWeakData: getWeakData, + onFreeze: onFreeze +}; +hiddenKeys[METADATA] = true; /***/ }), -/* 128 */ +/* 148 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var fails = __w_pdfjs_require__(14); +module.exports = !fails(function () { + return Object.isExtensible(Object.preventExtensions({})); +}); + +/***/ }), +/* 149 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var isObject = __w_pdfjs_require__(22); +var setPrototypeOf = __w_pdfjs_require__(87); +module.exports = function ($this, dummy, Wrapper) { + var NewTarget, NewTargetPrototype; + if (setPrototypeOf && typeof (NewTarget = dummy.constructor) == 'function' && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype) + setPrototypeOf($this, NewTargetPrototype); + return $this; +}; + +/***/ }), +/* 150 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; +var defineProperty = __w_pdfjs_require__(27).f; +var create = __w_pdfjs_require__(71); +var redefineAll = __w_pdfjs_require__(121); +var bind = __w_pdfjs_require__(62); +var anInstance = __w_pdfjs_require__(123); +var iterate = __w_pdfjs_require__(124); +var defineIterator = __w_pdfjs_require__(79); +var setSpecies = __w_pdfjs_require__(122); +var DESCRIPTORS = __w_pdfjs_require__(13); +var fastKey = __w_pdfjs_require__(147).fastKey; +var InternalStateModule = __w_pdfjs_require__(33); +var setInternalState = InternalStateModule.set; +var internalStateGetterFor = InternalStateModule.getterFor; +module.exports = { + getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, CONSTRUCTOR_NAME); + setInternalState(that, { + type: CONSTRUCTOR_NAME, + index: create(null), + first: undefined, + last: undefined, + size: 0 + }); + if (!DESCRIPTORS) + that.size = 0; + if (iterable != undefined) + iterate(iterable, that[ADDER], that, IS_MAP); + }); + var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); + var define = function (that, key, value) { + var state = getInternalState(that); + var entry = getEntry(that, key); + var previous, index; + if (entry) { + entry.value = value; + } else { + state.last = entry = { + index: index = fastKey(key, true), + key: key, + value: value, + previous: previous = state.last, + next: undefined, + removed: false + }; + if (!state.first) + state.first = entry; + if (previous) + previous.next = entry; + if (DESCRIPTORS) + state.size++; + else + that.size++; + if (index !== 'F') + state.index[index] = entry; + } + return that; + }; + var getEntry = function (that, key) { + var state = getInternalState(that); + var index = fastKey(key); + var entry; + if (index !== 'F') + return state.index[index]; + for (entry = state.first; entry; entry = entry.next) { + if (entry.key == key) + return entry; + } + }; + redefineAll(C.prototype, { + clear: function clear() { + var that = this; + var state = getInternalState(that); + var data = state.index; + var entry = state.first; + while (entry) { + entry.removed = true; + if (entry.previous) + entry.previous = entry.previous.next = undefined; + delete data[entry.index]; + entry = entry.next; + } + state.first = state.last = undefined; + if (DESCRIPTORS) + state.size = 0; + else + that.size = 0; + }, + 'delete': function (key) { + var that = this; + var state = getInternalState(that); + var entry = getEntry(that, key); + if (entry) { + var next = entry.next; + var prev = entry.previous; + delete state.index[entry.index]; + entry.removed = true; + if (prev) + prev.next = next; + if (next) + next.previous = prev; + if (state.first == entry) + state.first = next; + if (state.last == entry) + state.last = prev; + if (DESCRIPTORS) + state.size--; + else + that.size--; + } + return !!entry; + }, + forEach: function forEach(callbackfn) { + var state = getInternalState(this); + var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); + var entry; + while (entry = entry ? entry.next : state.first) { + boundFunction(entry.value, entry.key, this); + while (entry && entry.removed) + entry = entry.previous; + } + }, + has: function has(key) { + return !!getEntry(this, key); + } + }); + redefineAll(C.prototype, IS_MAP ? { + get: function get(key) { + var entry = getEntry(this, key); + return entry && entry.value; + }, + set: function set(key, value) { + return define(this, key === 0 ? 0 : key, value); + } + } : { + add: function add(value) { + return define(this, value = value === 0 ? 0 : value, value); + } + }); + if (DESCRIPTORS) + defineProperty(C.prototype, 'size', { + get: function () { + return getInternalState(this).size; + } + }); + return C; + }, + setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) { + var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; + var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME); + var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME); + defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) { + setInternalState(this, { + type: ITERATOR_NAME, + target: iterated, + state: getInternalCollectionState(iterated), + kind: kind, + last: undefined + }); + }, function () { + var state = getInternalIteratorState(this); + var kind = state.kind; + var entry = state.last; + while (entry && entry.removed) + entry = entry.previous; + if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { + state.target = undefined; + return { + value: undefined, + done: true + }; + } + if (kind == 'keys') + return { + value: entry.key, + done: false + }; + if (kind == 'values') + return { + value: entry.value, + done: false + }; + return { + value: [ + entry.key, + entry.value + ], + done: false + }; + }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); + setSpecies(CONSTRUCTOR_NAME); + } +}; -(function URLConstructorClosure() { - 'use strict'; - - var relative = Object.create(null); - relative['ftp'] = 21; - relative['file'] = 0; - relative['gopher'] = 70; - relative['http'] = 80; - relative['https'] = 443; - relative['ws'] = 80; - relative['wss'] = 443; - var relativePathDotMapping = Object.create(null); - relativePathDotMapping['%2e'] = '.'; - relativePathDotMapping['.%2e'] = '..'; - relativePathDotMapping['%2e.'] = '..'; - relativePathDotMapping['%2e%2e'] = '..'; - function isRelativeScheme(scheme) { - return relative[scheme] !== undefined; - } - function invalid() { - clear.call(this); - this._isInvalid = true; - } - function IDNAToASCII(h) { - if (h === '') { - invalid.call(this); - } - return h.toLowerCase(); - } - function percentEscape(c) { - var unicode = c.charCodeAt(0); - if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1) { - return c; - } - return encodeURIComponent(c); - } - function percentEscapeQuery(c) { - var unicode = c.charCodeAt(0); - if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1) { - return c; - } - return encodeURIComponent(c); - } - var EOF, - ALPHA = /[a-zA-Z]/, - ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/; - function parse(input, stateOverride, base) { - function err(message) { - errors.push(message); - } - var state = stateOverride || 'scheme start', - cursor = 0, - buffer = '', - seenAt = false, - seenBracket = false, - errors = []; - loop: while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) { - var c = input[cursor]; - switch (state) { - case 'scheme start': - if (c && ALPHA.test(c)) { - buffer += c.toLowerCase(); - state = 'scheme'; - } else if (!stateOverride) { - buffer = ''; - state = 'no scheme'; - continue; - } else { - err('Invalid scheme.'); - break loop; - } - break; - case 'scheme': - if (c && ALPHANUMERIC.test(c)) { - buffer += c.toLowerCase(); - } else if (c === ':') { - this._scheme = buffer; - buffer = ''; - if (stateOverride) { - break loop; - } - if (isRelativeScheme(this._scheme)) { - this._isRelative = true; - } - if (this._scheme === 'file') { - state = 'relative'; - } else if (this._isRelative && base && base._scheme === this._scheme) { - state = 'relative or authority'; - } else if (this._isRelative) { - state = 'authority first slash'; - } else { - state = 'scheme data'; - } - } else if (!stateOverride) { - buffer = ''; - cursor = 0; - state = 'no scheme'; - continue; - } else if (c === EOF) { - break loop; - } else { - err('Code point not allowed in scheme: ' + c); - break loop; - } - break; - case 'scheme data': - if (c === '?') { - this._query = '?'; - state = 'query'; - } else if (c === '#') { - this._fragment = '#'; - state = 'fragment'; - } else { - if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { - this._schemeData += percentEscape(c); - } - } - break; - case 'no scheme': - if (!base || !isRelativeScheme(base._scheme)) { - err('Missing scheme.'); - invalid.call(this); - } else { - state = 'relative'; - continue; - } - break; - case 'relative or authority': - if (c === '/' && input[cursor + 1] === '/') { - state = 'authority ignore slashes'; - } else { - err('Expected /, got: ' + c); - state = 'relative'; - continue; - } - break; - case 'relative': - this._isRelative = true; - if (this._scheme !== 'file') { - this._scheme = base._scheme; - } - if (c === EOF) { - this._host = base._host; - this._port = base._port; - this._path = base._path.slice(); - this._query = base._query; - this._username = base._username; - this._password = base._password; - break loop; - } else if (c === '/' || c === '\\') { - if (c === '\\') { - err('\\ is an invalid code point.'); - } - state = 'relative slash'; - } else if (c === '?') { - this._host = base._host; - this._port = base._port; - this._path = base._path.slice(); - this._query = '?'; - this._username = base._username; - this._password = base._password; - state = 'query'; - } else if (c === '#') { - this._host = base._host; - this._port = base._port; - this._path = base._path.slice(); - this._query = base._query; - this._fragment = '#'; - this._username = base._username; - this._password = base._password; - state = 'fragment'; - } else { - var nextC = input[cursor + 1]; - var nextNextC = input[cursor + 2]; - if (this._scheme !== 'file' || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || nextNextC !== EOF && nextNextC !== '/' && nextNextC !== '\\' && nextNextC !== '?' && nextNextC !== '#') { - this._host = base._host; - this._port = base._port; - this._username = base._username; - this._password = base._password; - this._path = base._path.slice(); - this._path.pop(); - } - state = 'relative path'; - continue; - } - break; - case 'relative slash': - if (c === '/' || c === '\\') { - if (c === '\\') { - err('\\ is an invalid code point.'); - } - if (this._scheme === 'file') { - state = 'file host'; - } else { - state = 'authority ignore slashes'; - } - } else { - if (this._scheme !== 'file') { - this._host = base._host; - this._port = base._port; - this._username = base._username; - this._password = base._password; - } - state = 'relative path'; - continue; - } - break; - case 'authority first slash': - if (c === '/') { - state = 'authority second slash'; - } else { - err('Expected \'/\', got: ' + c); - state = 'authority ignore slashes'; - continue; - } - break; - case 'authority second slash': - state = 'authority ignore slashes'; - if (c !== '/') { - err('Expected \'/\', got: ' + c); - continue; - } - break; - case 'authority ignore slashes': - if (c !== '/' && c !== '\\') { - state = 'authority'; - continue; - } else { - err('Expected authority, got: ' + c); - } - break; - case 'authority': - if (c === '@') { - if (seenAt) { - err('@ already seen.'); - buffer += '%40'; - } - seenAt = true; - for (var i = 0; i < buffer.length; i++) { - var cp = buffer[i]; - if (cp === '\t' || cp === '\n' || cp === '\r') { - err('Invalid whitespace in authority.'); - continue; - } - if (cp === ':' && this._password === null) { - this._password = ''; - continue; - } - var tempC = percentEscape(cp); - if (this._password !== null) { - this._password += tempC; - } else { - this._username += tempC; - } - } - buffer = ''; - } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') { - cursor -= buffer.length; - buffer = ''; - state = 'host'; - continue; - } else { - buffer += c; - } - break; - case 'file host': - if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') { - if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) { - state = 'relative path'; - } else if (buffer.length === 0) { - state = 'relative path start'; - } else { - this._host = IDNAToASCII.call(this, buffer); - buffer = ''; - state = 'relative path start'; - } - continue; - } else if (c === '\t' || c === '\n' || c === '\r') { - err('Invalid whitespace in file host.'); - } else { - buffer += c; - } - break; - case 'host': - case 'hostname': - if (c === ':' && !seenBracket) { - this._host = IDNAToASCII.call(this, buffer); - buffer = ''; - state = 'port'; - if (stateOverride === 'hostname') { - break loop; - } - } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') { - this._host = IDNAToASCII.call(this, buffer); - buffer = ''; - state = 'relative path start'; - if (stateOverride) { - break loop; - } - continue; - } else if (c !== '\t' && c !== '\n' && c !== '\r') { - if (c === '[') { - seenBracket = true; - } else if (c === ']') { - seenBracket = false; - } - buffer += c; - } else { - err('Invalid code point in host/hostname: ' + c); - } - break; - case 'port': - if (/[0-9]/.test(c)) { - buffer += c; - } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) { - if (buffer !== '') { - var temp = parseInt(buffer, 10); - if (temp !== relative[this._scheme]) { - this._port = temp + ''; - } - buffer = ''; - } - if (stateOverride) { - break loop; - } - state = 'relative path start'; - continue; - } else if (c === '\t' || c === '\n' || c === '\r') { - err('Invalid code point in port: ' + c); - } else { - invalid.call(this); - } - break; - case 'relative path start': - if (c === '\\') { - err('\'\\\' not allowed in path.'); - } - state = 'relative path'; - if (c !== '/' && c !== '\\') { - continue; - } - break; - case 'relative path': - if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) { - if (c === '\\') { - err('\\ not allowed in relative path.'); - } - var tmp; - if (tmp = relativePathDotMapping[buffer.toLowerCase()]) { - buffer = tmp; - } - if (buffer === '..') { - this._path.pop(); - if (c !== '/' && c !== '\\') { - this._path.push(''); - } - } else if (buffer === '.' && c !== '/' && c !== '\\') { - this._path.push(''); - } else if (buffer !== '.') { - if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') { - buffer = buffer[0] + ':'; - } - this._path.push(buffer); - } - buffer = ''; - if (c === '?') { - this._query = '?'; - state = 'query'; - } else if (c === '#') { - this._fragment = '#'; - state = 'fragment'; - } - } else if (c !== '\t' && c !== '\n' && c !== '\r') { - buffer += percentEscape(c); - } - break; - case 'query': - if (!stateOverride && c === '#') { - this._fragment = '#'; - state = 'fragment'; - } else if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { - this._query += percentEscapeQuery(c); - } - break; - case 'fragment': - if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { - this._fragment += c; - } - break; - } - cursor++; - } - } - function clear() { - this._scheme = ''; - this._schemeData = ''; - this._username = ''; - this._password = null; - this._host = ''; - this._port = ''; - this._path = []; - this._query = ''; - this._fragment = ''; - this._isInvalid = false; - this._isRelative = false; - } - function JURL(url, base) { - if (base !== undefined && !(base instanceof JURL)) { - base = new JURL(String(base)); - } - this._url = url; - clear.call(this); - var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, ''); - parse.call(this, input, null, base); - } - JURL.prototype = { - toString: function toString() { - return this.href; - }, +/***/ }), +/* 151 */ +/***/ (function(module, exports, __w_pdfjs_require__) { - get href() { - if (this._isInvalid) { - return this._url; - } - var authority = ''; - if (this._username !== '' || this._password !== null) { - authority = this._username + (this._password !== null ? ':' + this._password : '') + '@'; - } - return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment; - }, - set href(value) { - clear.call(this); - parse.call(this, value); - }, - get protocol() { - return this._scheme + ':'; - }, - set protocol(value) { - if (this._isInvalid) { - return; - } - parse.call(this, value + ':', 'scheme start'); - }, - get host() { - return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host; - }, - set host(value) { - if (this._isInvalid || !this._isRelative) { - return; - } - parse.call(this, value, 'host'); - }, - get hostname() { - return this._host; - }, - set hostname(value) { - if (this._isInvalid || !this._isRelative) { - return; - } - parse.call(this, value, 'hostname'); - }, - get port() { - return this._port; - }, - set port(value) { - if (this._isInvalid || !this._isRelative) { - return; - } - parse.call(this, value, 'port'); - }, - get pathname() { - return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData; - }, - set pathname(value) { - if (this._isInvalid || !this._isRelative) { - return; - } - this._path = []; - parse.call(this, value, 'relative path start'); - }, - get search() { - return this._isInvalid || !this._query || this._query === '?' ? '' : this._query; - }, - set search(value) { - if (this._isInvalid || !this._isRelative) { - return; - } - this._query = '?'; - if (value[0] === '?') { - value = value.slice(1); - } - parse.call(this, value, 'query'); - }, - get hash() { - return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment; - }, - set hash(value) { - if (this._isInvalid) { - return; - } - this._fragment = '#'; - if (value[0] === '#') { - value = value.slice(1); - } - parse.call(this, value, 'fragment'); - }, - get origin() { - var host; - if (this._isInvalid || !this._scheme) { - return ''; - } - switch (this._scheme) { - case 'data': - case 'file': - case 'javascript': - case 'mailto': - return 'null'; - case 'blob': - try { - return new JURL(this._schemeData).origin || 'null'; - } catch (_) {} - return 'null'; - } - host = this.host; - if (!host) { - return ''; - } - return this._scheme + '://' + host; - } - }; - exports.URL = JURL; -})(); +__w_pdfjs_require__(152); +__w_pdfjs_require__(114); +__w_pdfjs_require__(77); +__w_pdfjs_require__(116); +var path = __w_pdfjs_require__(43); +module.exports = path.Set; /***/ }), -/* 129 */ +/* 152 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; +var collection = __w_pdfjs_require__(146); +var collectionStrong = __w_pdfjs_require__(150); +module.exports = collection('Set', function (init) { + return function Set() { + return init(this, arguments.length ? arguments[0] : undefined); + }; +}, collectionStrong); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.build = exports.version = exports.setPDFNetworkStreamFactory = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFWorker = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.getDocument = undefined; +/***/ }), +/* 153 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); +__w_pdfjs_require__(114); +__w_pdfjs_require__(154); +__w_pdfjs_require__(116); +var path = __w_pdfjs_require__(43); +module.exports = path.WeakMap; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +/***/ }), +/* 154 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +"use strict"; -var _util = __w_pdfjs_require__(1); +var global = __w_pdfjs_require__(11); +var redefineAll = __w_pdfjs_require__(121); +var InternalMetadataModule = __w_pdfjs_require__(147); +var collection = __w_pdfjs_require__(146); +var collectionWeak = __w_pdfjs_require__(155); +var isObject = __w_pdfjs_require__(22); +var enforceIternalState = __w_pdfjs_require__(33).enforce; +var NATIVE_WEAK_MAP = __w_pdfjs_require__(34); +var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; +var isExtensible = Object.isExtensible; +var InternalWeakMap; +var wrapper = function (init) { + return function WeakMap() { + return init(this, arguments.length ? arguments[0] : undefined); + }; +}; +var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak); +if (NATIVE_WEAK_MAP && IS_IE11) { + InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true); + InternalMetadataModule.REQUIRED = true; + var WeakMapPrototype = $WeakMap.prototype; + var nativeDelete = WeakMapPrototype['delete']; + var nativeHas = WeakMapPrototype.has; + var nativeGet = WeakMapPrototype.get; + var nativeSet = WeakMapPrototype.set; + redefineAll(WeakMapPrototype, { + 'delete': function (key) { + if (isObject(key) && !isExtensible(key)) { + var state = enforceIternalState(this); + if (!state.frozen) + state.frozen = new InternalWeakMap(); + return nativeDelete.call(this, key) || state.frozen['delete'](key); + } + return nativeDelete.call(this, key); + }, + has: function has(key) { + if (isObject(key) && !isExtensible(key)) { + var state = enforceIternalState(this); + if (!state.frozen) + state.frozen = new InternalWeakMap(); + return nativeHas.call(this, key) || state.frozen.has(key); + } + return nativeHas.call(this, key); + }, + get: function get(key) { + if (isObject(key) && !isExtensible(key)) { + var state = enforceIternalState(this); + if (!state.frozen) + state.frozen = new InternalWeakMap(); + return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key); + } + return nativeGet.call(this, key); + }, + set: function set(key, value) { + if (isObject(key) && !isExtensible(key)) { + var state = enforceIternalState(this); + if (!state.frozen) + state.frozen = new InternalWeakMap(); + nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value); + } else + nativeSet.call(this, key, value); + return this; + } + }); +} -var _dom_utils = __w_pdfjs_require__(130); +/***/ }), +/* 155 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var _font_loader = __w_pdfjs_require__(131); +"use strict"; -var _api_compatibility = __w_pdfjs_require__(132); +var redefineAll = __w_pdfjs_require__(121); +var getWeakData = __w_pdfjs_require__(147).getWeakData; +var anObject = __w_pdfjs_require__(28); +var isObject = __w_pdfjs_require__(22); +var anInstance = __w_pdfjs_require__(123); +var iterate = __w_pdfjs_require__(124); +var ArrayIterationModule = __w_pdfjs_require__(156); +var $has = __w_pdfjs_require__(23); +var InternalStateModule = __w_pdfjs_require__(33); +var setInternalState = InternalStateModule.set; +var internalStateGetterFor = InternalStateModule.getterFor; +var find = ArrayIterationModule.find; +var findIndex = ArrayIterationModule.findIndex; +var id = 0; +var uncaughtFrozenStore = function (store) { + return store.frozen || (store.frozen = new UncaughtFrozenStore()); +}; +var UncaughtFrozenStore = function () { + this.entries = []; +}; +var findUncaughtFrozen = function (store, key) { + return find(store.entries, function (it) { + return it[0] === key; + }); +}; +UncaughtFrozenStore.prototype = { + get: function (key) { + var entry = findUncaughtFrozen(this, key); + if (entry) + return entry[1]; + }, + has: function (key) { + return !!findUncaughtFrozen(this, key); + }, + set: function (key, value) { + var entry = findUncaughtFrozen(this, key); + if (entry) + entry[1] = value; + else + this.entries.push([ + key, + value + ]); + }, + 'delete': function (key) { + var index = findIndex(this.entries, function (it) { + return it[0] === key; + }); + if (~index) + this.entries.splice(index, 1); + return !!~index; + } +}; +module.exports = { + getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, CONSTRUCTOR_NAME); + setInternalState(that, { + type: CONSTRUCTOR_NAME, + id: id++, + frozen: undefined + }); + if (iterable != undefined) + iterate(iterable, that[ADDER], that, IS_MAP); + }); + var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); + var define = function (that, key, value) { + var state = getInternalState(that); + var data = getWeakData(anObject(key), true); + if (data === true) + uncaughtFrozenStore(state).set(key, value); + else + data[state.id] = value; + return that; + }; + redefineAll(C.prototype, { + 'delete': function (key) { + var state = getInternalState(this); + if (!isObject(key)) + return false; + var data = getWeakData(key); + if (data === true) + return uncaughtFrozenStore(state)['delete'](key); + return data && $has(data, state.id) && delete data[state.id]; + }, + has: function has(key) { + var state = getInternalState(this); + if (!isObject(key)) + return false; + var data = getWeakData(key); + if (data === true) + return uncaughtFrozenStore(state).has(key); + return data && $has(data, state.id); + } + }); + redefineAll(C.prototype, IS_MAP ? { + get: function get(key) { + var state = getInternalState(this); + if (isObject(key)) { + var data = getWeakData(key); + if (data === true) + return uncaughtFrozenStore(state).get(key); + return data ? data[state.id] : undefined; + } + }, + set: function set(key, value) { + return define(this, key, value); + } + } : { + add: function add(value) { + return define(this, value, true); + } + }); + return C; + } +}; -var _canvas = __w_pdfjs_require__(133); +/***/ }), +/* 156 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var _global_scope = __w_pdfjs_require__(3); +var bind = __w_pdfjs_require__(62); +var IndexedObject = __w_pdfjs_require__(18); +var toObject = __w_pdfjs_require__(83); +var toLength = __w_pdfjs_require__(47); +var arraySpeciesCreate = __w_pdfjs_require__(157); +var push = [].push; +var createMethod = function (TYPE) { + var IS_MAP = TYPE == 1; + var IS_FILTER = TYPE == 2; + var IS_SOME = TYPE == 3; + var IS_EVERY = TYPE == 4; + var IS_FIND_INDEX = TYPE == 6; + var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; + return function ($this, callbackfn, that, specificCreate) { + var O = toObject($this); + var self = IndexedObject(O); + var boundFunction = bind(callbackfn, that, 3); + var length = toLength(self.length); + var index = 0; + var create = specificCreate || arraySpeciesCreate; + var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; + var value, result; + for (; length > index; index++) + if (NO_HOLES || index in self) { + value = self[index]; + result = boundFunction(value, index, O); + if (TYPE) { + if (IS_MAP) + target[index] = result; + else if (result) + switch (TYPE) { + case 3: + return true; + case 5: + return value; + case 6: + return index; + case 2: + push.call(target, value); + } + else if (IS_EVERY) + return false; + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; + }; +}; +module.exports = { + forEach: createMethod(0), + map: createMethod(1), + filter: createMethod(2), + some: createMethod(3), + every: createMethod(4), + find: createMethod(5), + findIndex: createMethod(6) +}; -var _global_scope2 = _interopRequireDefault(_global_scope); +/***/ }), +/* 157 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var _worker_options = __w_pdfjs_require__(135); +var isObject = __w_pdfjs_require__(22); +var isArray = __w_pdfjs_require__(158); +var wellKnownSymbol = __w_pdfjs_require__(57); +var SPECIES = wellKnownSymbol('species'); +module.exports = function (originalArray, length) { + var C; + if (isArray(originalArray)) { + C = originalArray.constructor; + if (typeof C == 'function' && (C === Array || isArray(C.prototype))) + C = undefined; + else if (isObject(C)) { + C = C[SPECIES]; + if (C === null) + C = undefined; + } + } + return new (C === undefined ? Array : C)(length === 0 ? 0 : length); +}; -var _message_handler = __w_pdfjs_require__(136); +/***/ }), +/* 158 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var _metadata = __w_pdfjs_require__(141); +var classof = __w_pdfjs_require__(19); +module.exports = Array.isArray || function isArray(arg) { + return classof(arg) == 'Array'; +}; -var _transport_stream = __w_pdfjs_require__(143); +/***/ }), +/* 159 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -var _webgl = __w_pdfjs_require__(144); +__w_pdfjs_require__(114); +__w_pdfjs_require__(160); +__w_pdfjs_require__(116); +var path = __w_pdfjs_require__(43); +module.exports = path.WeakSet; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/***/ }), +/* 160 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } +"use strict"; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var collection = __w_pdfjs_require__(146); +var collectionWeak = __w_pdfjs_require__(155); +collection('WeakSet', function (init) { + return function WeakSet() { + return init(this, arguments.length ? arguments[0] : undefined); + }; +}, collectionWeak); -var DEFAULT_RANGE_CHUNK_SIZE = 65536; -var isWorkerDisabled = false; -var fallbackWorkerSrc = void 0; -var fakeWorkerFilesLoader = null; -{ - var useRequireEnsure = false; - if (typeof window === 'undefined') { - isWorkerDisabled = true; - if (typeof require.ensure === 'undefined') { - require.ensure = require('node-ensure'); - } - useRequireEnsure = true; - } else if (typeof require !== 'undefined' && typeof require.ensure === 'function') { - useRequireEnsure = true; +/***/ }), +/* 161 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(162); +var entryUnbind = __w_pdfjs_require__(61); +module.exports = entryUnbind('String', 'codePointAt'); + +/***/ }), +/* 162 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var codeAt = __w_pdfjs_require__(78).codeAt; +$({ + target: 'String', + proto: true +}, { + codePointAt: function codePointAt(pos) { + return codeAt(this, pos); + } +}); + +/***/ }), +/* 163 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(164); +var path = __w_pdfjs_require__(43); +module.exports = path.String.fromCodePoint; + +/***/ }), +/* 164 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var $ = __w_pdfjs_require__(10); +var toAbsoluteIndex = __w_pdfjs_require__(49); +var fromCharCode = String.fromCharCode; +var nativeFromCodePoint = String.fromCodePoint; +var INCORRECT_LENGTH = !!nativeFromCodePoint && nativeFromCodePoint.length != 1; +$({ + target: 'String', + stat: true, + forced: INCORRECT_LENGTH +}, { + fromCodePoint: function fromCodePoint(x) { + var elements = []; + var length = arguments.length; + var i = 0; + var code; + while (length > i) { + code = +arguments[i++]; + if (toAbsoluteIndex(code, 0x10FFFF) !== code) + throw RangeError(code + ' is not a valid code point'); + elements.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00)); } - if (typeof requirejs !== 'undefined' && requirejs.toUrl) { - fallbackWorkerSrc = requirejs.toUrl('pdfjs-dist/build/pdf.worker.js'); + return elements.join(''); + } +}); + +/***/ }), +/* 165 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(166); +__w_pdfjs_require__(114); +__w_pdfjs_require__(168); +__w_pdfjs_require__(172); +__w_pdfjs_require__(173); +__w_pdfjs_require__(174); +__w_pdfjs_require__(175); +__w_pdfjs_require__(176); +__w_pdfjs_require__(177); +__w_pdfjs_require__(178); +__w_pdfjs_require__(179); +__w_pdfjs_require__(180); +__w_pdfjs_require__(181); +__w_pdfjs_require__(182); +__w_pdfjs_require__(183); +__w_pdfjs_require__(184); +__w_pdfjs_require__(185); +__w_pdfjs_require__(186); +__w_pdfjs_require__(187); +var path = __w_pdfjs_require__(43); +module.exports = path.Symbol; + +/***/ }), +/* 166 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var fails = __w_pdfjs_require__(14); +var isArray = __w_pdfjs_require__(158); +var isObject = __w_pdfjs_require__(22); +var toObject = __w_pdfjs_require__(83); +var toLength = __w_pdfjs_require__(47); +var createProperty = __w_pdfjs_require__(93); +var arraySpeciesCreate = __w_pdfjs_require__(157); +var arrayMethodHasSpeciesSupport = __w_pdfjs_require__(167); +var wellKnownSymbol = __w_pdfjs_require__(57); +var V8_VERSION = __w_pdfjs_require__(133); +var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); +var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; +var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; +var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () { + var array = []; + array[IS_CONCAT_SPREADABLE] = false; + return array.concat()[0] !== array; +}); +var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); +var isConcatSpreadable = function (O) { + if (!isObject(O)) + return false; + var spreadable = O[IS_CONCAT_SPREADABLE]; + return spreadable !== undefined ? !!spreadable : isArray(O); +}; +var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; +$({ + target: 'Array', + proto: true, + forced: FORCED +}, { + concat: function concat(arg) { + var O = toObject(this); + var A = arraySpeciesCreate(O, 0); + var n = 0; + var i, k, length, len, E; + for (i = -1, length = arguments.length; i < length; i++) { + E = i === -1 ? O : arguments[i]; + if (isConcatSpreadable(E)) { + len = toLength(E.length); + if (n + len > MAX_SAFE_INTEGER) + throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + for (k = 0; k < len; k++, n++) + if (k in E) + createProperty(A, n, E[k]); + } else { + if (n >= MAX_SAFE_INTEGER) + throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + createProperty(A, n++, E); + } + } + A.length = n; + return A; + } +}); + +/***/ }), +/* 167 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var fails = __w_pdfjs_require__(14); +var wellKnownSymbol = __w_pdfjs_require__(57); +var V8_VERSION = __w_pdfjs_require__(133); +var SPECIES = wellKnownSymbol('species'); +module.exports = function (METHOD_NAME) { + return V8_VERSION >= 51 || !fails(function () { + var array = []; + var constructor = array.constructor = {}; + constructor[SPECIES] = function () { + return { foo: 1 }; + }; + return array[METHOD_NAME](Boolean).foo !== 1; + }); +}; + +/***/ }), +/* 168 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var global = __w_pdfjs_require__(11); +var getBuiltIn = __w_pdfjs_require__(42); +var IS_PURE = __w_pdfjs_require__(37); +var DESCRIPTORS = __w_pdfjs_require__(13); +var NATIVE_SYMBOL = __w_pdfjs_require__(58); +var USE_SYMBOL_AS_UID = __w_pdfjs_require__(59); +var fails = __w_pdfjs_require__(14); +var has = __w_pdfjs_require__(23); +var isArray = __w_pdfjs_require__(158); +var isObject = __w_pdfjs_require__(22); +var anObject = __w_pdfjs_require__(28); +var toObject = __w_pdfjs_require__(83); +var toIndexedObject = __w_pdfjs_require__(17); +var toPrimitive = __w_pdfjs_require__(21); +var createPropertyDescriptor = __w_pdfjs_require__(16); +var nativeObjectCreate = __w_pdfjs_require__(71); +var objectKeys = __w_pdfjs_require__(73); +var getOwnPropertyNamesModule = __w_pdfjs_require__(44); +var getOwnPropertyNamesExternal = __w_pdfjs_require__(169); +var getOwnPropertySymbolsModule = __w_pdfjs_require__(51); +var getOwnPropertyDescriptorModule = __w_pdfjs_require__(12); +var definePropertyModule = __w_pdfjs_require__(27); +var propertyIsEnumerableModule = __w_pdfjs_require__(15); +var createNonEnumerableProperty = __w_pdfjs_require__(26); +var redefine = __w_pdfjs_require__(29); +var shared = __w_pdfjs_require__(36); +var sharedKey = __w_pdfjs_require__(35); +var hiddenKeys = __w_pdfjs_require__(39); +var uid = __w_pdfjs_require__(38); +var wellKnownSymbol = __w_pdfjs_require__(57); +var wrappedWellKnownSymbolModule = __w_pdfjs_require__(170); +var defineWellKnownSymbol = __w_pdfjs_require__(171); +var setToStringTag = __w_pdfjs_require__(85); +var InternalStateModule = __w_pdfjs_require__(33); +var $forEach = __w_pdfjs_require__(156).forEach; +var HIDDEN = sharedKey('hidden'); +var SYMBOL = 'Symbol'; +var PROTOTYPE = 'prototype'; +var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); +var setInternalState = InternalStateModule.set; +var getInternalState = InternalStateModule.getterFor(SYMBOL); +var ObjectPrototype = Object[PROTOTYPE]; +var $Symbol = global.Symbol; +var $stringify = getBuiltIn('JSON', 'stringify'); +var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; +var nativeDefineProperty = definePropertyModule.f; +var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; +var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; +var AllSymbols = shared('symbols'); +var ObjectPrototypeSymbols = shared('op-symbols'); +var StringToSymbolRegistry = shared('string-to-symbol-registry'); +var SymbolToStringRegistry = shared('symbol-to-string-registry'); +var WellKnownSymbolsStore = shared('wks'); +var QObject = global.QObject; +var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; +var setSymbolDescriptor = DESCRIPTORS && fails(function () { + return nativeObjectCreate(nativeDefineProperty({}, 'a', { + get: function () { + return nativeDefineProperty(this, 'a', { value: 7 }).a; + } + })).a != 7; +}) ? function (O, P, Attributes) { + var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P); + if (ObjectPrototypeDescriptor) + delete ObjectPrototype[P]; + nativeDefineProperty(O, P, Attributes); + if (ObjectPrototypeDescriptor && O !== ObjectPrototype) { + nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor); + } +} : nativeDefineProperty; +var wrap = function (tag, description) { + var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]); + setInternalState(symbol, { + type: SYMBOL, + tag: tag, + description: description + }); + if (!DESCRIPTORS) + symbol.description = description; + return symbol; +}; +var isSymbol = USE_SYMBOL_AS_UID ? function (it) { + return typeof it == 'symbol'; +} : function (it) { + return Object(it) instanceof $Symbol; +}; +var $defineProperty = function defineProperty(O, P, Attributes) { + if (O === ObjectPrototype) + $defineProperty(ObjectPrototypeSymbols, P, Attributes); + anObject(O); + var key = toPrimitive(P, true); + anObject(Attributes); + if (has(AllSymbols, key)) { + if (!Attributes.enumerable) { + if (!has(O, HIDDEN)) + nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {})); + O[HIDDEN][key] = true; + } else { + if (has(O, HIDDEN) && O[HIDDEN][key]) + O[HIDDEN][key] = false; + Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) }); } - var dynamicLoaderSupported = typeof requirejs !== 'undefined' && requirejs.load; - fakeWorkerFilesLoader = useRequireEnsure ? function () { - return new Promise(function (resolve, reject) { - require.ensure([], function () { - try { - var worker = void 0; - worker = require('./pdf.worker.js'); - resolve(worker.WorkerMessageHandler); - } catch (ex) { - reject(ex); - } - }, reject, 'pdfjsWorker'); - }); - } : dynamicLoaderSupported ? function () { - return new Promise(function (resolve, reject) { - requirejs(['pdfjs-dist/build/pdf.worker'], function (worker) { - try { - resolve(worker.WorkerMessageHandler); - } catch (ex) { - reject(ex); - } - }, reject); - }); - } : null; - if (!fallbackWorkerSrc && typeof document !== 'undefined') { - var pdfjsFilePath = document.currentScript && document.currentScript.src; - if (pdfjsFilePath) { - fallbackWorkerSrc = pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, '.worker$1$2'); - } + return setSymbolDescriptor(O, key, Attributes); + } + return nativeDefineProperty(O, key, Attributes); +}; +var $defineProperties = function defineProperties(O, Properties) { + anObject(O); + var properties = toIndexedObject(Properties); + var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); + $forEach(keys, function (key) { + if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) + $defineProperty(O, key, properties[key]); + }); + return O; +}; +var $create = function create(O, Properties) { + return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); +}; +var $propertyIsEnumerable = function propertyIsEnumerable(V) { + var P = toPrimitive(V, true); + var enumerable = nativePropertyIsEnumerable.call(this, P); + if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) + return false; + return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; +}; +var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { + var it = toIndexedObject(O); + var key = toPrimitive(P, true); + if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) + return; + var descriptor = nativeGetOwnPropertyDescriptor(it, key); + if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) { + descriptor.enumerable = true; + } + return descriptor; +}; +var $getOwnPropertyNames = function getOwnPropertyNames(O) { + var names = nativeGetOwnPropertyNames(toIndexedObject(O)); + var result = []; + $forEach(names, function (key) { + if (!has(AllSymbols, key) && !has(hiddenKeys, key)) + result.push(key); + }); + return result; +}; +var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { + var IS_OBJECT_PROTOTYPE = O === ObjectPrototype; + var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O)); + var result = []; + $forEach(names, function (key) { + if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) { + result.push(AllSymbols[key]); + } + }); + return result; +}; +if (!NATIVE_SYMBOL) { + $Symbol = function Symbol() { + if (this instanceof $Symbol) + throw TypeError('Symbol is not a constructor'); + var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]); + var tag = uid(description); + var setter = function (value) { + if (this === ObjectPrototype) + setter.call(ObjectPrototypeSymbols, value); + if (has(this, HIDDEN) && has(this[HIDDEN], tag)) + this[HIDDEN][tag] = false; + setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value)); + }; + if (DESCRIPTORS && USE_SETTER) + setSymbolDescriptor(ObjectPrototype, tag, { + configurable: true, + set: setter + }); + return wrap(tag, description); + }; + redefine($Symbol[PROTOTYPE], 'toString', function toString() { + return getInternalState(this).tag; + }); + redefine($Symbol, 'withoutSetter', function (description) { + return wrap(uid(description), description); + }); + propertyIsEnumerableModule.f = $propertyIsEnumerable; + definePropertyModule.f = $defineProperty; + getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor; + getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; + getOwnPropertySymbolsModule.f = $getOwnPropertySymbols; + wrappedWellKnownSymbolModule.f = function (name) { + return wrap(wellKnownSymbol(name), name); + }; + if (DESCRIPTORS) { + nativeDefineProperty($Symbol[PROTOTYPE], 'description', { + configurable: true, + get: function description() { + return getInternalState(this).description; + } + }); + if (!IS_PURE) { + redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true }); + } + } +} +$({ + global: true, + wrap: true, + forced: !NATIVE_SYMBOL, + sham: !NATIVE_SYMBOL +}, { Symbol: $Symbol }); +$forEach(objectKeys(WellKnownSymbolsStore), function (name) { + defineWellKnownSymbol(name); +}); +$({ + target: SYMBOL, + stat: true, + forced: !NATIVE_SYMBOL +}, { + 'for': function (key) { + var string = String(key); + if (has(StringToSymbolRegistry, string)) + return StringToSymbolRegistry[string]; + var symbol = $Symbol(string); + StringToSymbolRegistry[string] = symbol; + SymbolToStringRegistry[symbol] = string; + return symbol; + }, + keyFor: function keyFor(sym) { + if (!isSymbol(sym)) + throw TypeError(sym + ' is not a symbol'); + if (has(SymbolToStringRegistry, sym)) + return SymbolToStringRegistry[sym]; + }, + useSetter: function () { + USE_SETTER = true; + }, + useSimple: function () { + USE_SETTER = false; + } +}); +$({ + target: 'Object', + stat: true, + forced: !NATIVE_SYMBOL, + sham: !DESCRIPTORS +}, { + create: $create, + defineProperty: $defineProperty, + defineProperties: $defineProperties, + getOwnPropertyDescriptor: $getOwnPropertyDescriptor +}); +$({ + target: 'Object', + stat: true, + forced: !NATIVE_SYMBOL +}, { + getOwnPropertyNames: $getOwnPropertyNames, + getOwnPropertySymbols: $getOwnPropertySymbols +}); +$({ + target: 'Object', + stat: true, + forced: fails(function () { + getOwnPropertySymbolsModule.f(1); + }) +}, { + getOwnPropertySymbols: function getOwnPropertySymbols(it) { + return getOwnPropertySymbolsModule.f(toObject(it)); + } +}); +if ($stringify) { + var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () { + var symbol = $Symbol(); + return $stringify([symbol]) != '[null]' || $stringify({ a: symbol }) != '{}' || $stringify(Object(symbol)) != '{}'; + }); + $({ + target: 'JSON', + stat: true, + forced: FORCED_JSON_STRINGIFY + }, { + stringify: function stringify(it, replacer, space) { + var args = [it]; + var index = 1; + var $replacer; + while (arguments.length > index) + args.push(arguments[index++]); + $replacer = replacer; + if (!isObject(replacer) && it === undefined || isSymbol(it)) + return; + if (!isArray(replacer)) + replacer = function (key, value) { + if (typeof $replacer == 'function') + value = $replacer.call(this, key, value); + if (!isSymbol(value)) + return value; + }; + args[1] = replacer; + return $stringify.apply(null, args); } + }); +} +if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) { + createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +} +setToStringTag($Symbol, SYMBOL); +hiddenKeys[HIDDEN] = true; + +/***/ }), +/* 169 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var toIndexedObject = __w_pdfjs_require__(17); +var nativeGetOwnPropertyNames = __w_pdfjs_require__(44).f; +var toString = {}.toString; +var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; +var getWindowNames = function (it) { + try { + return nativeGetOwnPropertyNames(it); + } catch (error) { + return windowNames.slice(); + } +}; +module.exports.f = function getOwnPropertyNames(it) { + return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : nativeGetOwnPropertyNames(toIndexedObject(it)); +}; + +/***/ }), +/* 170 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var wellKnownSymbol = __w_pdfjs_require__(57); +exports.f = wellKnownSymbol; + +/***/ }), +/* 171 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var path = __w_pdfjs_require__(43); +var has = __w_pdfjs_require__(23); +var wrappedWellKnownSymbolModule = __w_pdfjs_require__(170); +var defineProperty = __w_pdfjs_require__(27).f; +module.exports = function (NAME) { + var Symbol = path.Symbol || (path.Symbol = {}); + if (!has(Symbol, NAME)) + defineProperty(Symbol, NAME, { value: wrappedWellKnownSymbolModule.f(NAME) }); +}; + +/***/ }), +/* 172 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('asyncIterator'); + +/***/ }), +/* 173 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var DESCRIPTORS = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(11); +var has = __w_pdfjs_require__(23); +var isObject = __w_pdfjs_require__(22); +var defineProperty = __w_pdfjs_require__(27).f; +var copyConstructorProperties = __w_pdfjs_require__(40); +var NativeSymbol = global.Symbol; +if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) || NativeSymbol().description !== undefined)) { + var EmptyStringDescriptionStore = {}; + var SymbolWrapper = function Symbol() { + var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]); + var result = this instanceof SymbolWrapper ? new NativeSymbol(description) : description === undefined ? NativeSymbol() : NativeSymbol(description); + if (description === '') + EmptyStringDescriptionStore[result] = true; + return result; + }; + copyConstructorProperties(SymbolWrapper, NativeSymbol); + var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype; + symbolPrototype.constructor = SymbolWrapper; + var symbolToString = symbolPrototype.toString; + var native = String(NativeSymbol('test')) == 'Symbol(test)'; + var regexp = /^Symbol\((.*)\)[^)]+$/; + defineProperty(symbolPrototype, 'description', { + configurable: true, + get: function description() { + var symbol = isObject(this) ? this.valueOf() : this; + var string = symbolToString.call(symbol); + if (has(EmptyStringDescriptionStore, symbol)) + return ''; + var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1'); + return desc === '' ? undefined : desc; + } + }); + $({ + global: true, + forced: true + }, { Symbol: SymbolWrapper }); } + +/***/ }), +/* 174 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('hasInstance'); + +/***/ }), +/* 175 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('isConcatSpreadable'); + +/***/ }), +/* 176 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('iterator'); + +/***/ }), +/* 177 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('match'); + +/***/ }), +/* 178 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('matchAll'); + +/***/ }), +/* 179 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('replace'); + +/***/ }), +/* 180 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('search'); + +/***/ }), +/* 181 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('species'); + +/***/ }), +/* 182 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('split'); + +/***/ }), +/* 183 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('toPrimitive'); + +/***/ }), +/* 184 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('toStringTag'); + +/***/ }), +/* 185 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var defineWellKnownSymbol = __w_pdfjs_require__(171); +defineWellKnownSymbol('unscopables'); + +/***/ }), +/* 186 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var setToStringTag = __w_pdfjs_require__(85); +setToStringTag(Math, 'Math', true); + +/***/ }), +/* 187 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var global = __w_pdfjs_require__(11); +var setToStringTag = __w_pdfjs_require__(85); +setToStringTag(global.JSON, 'JSON', true); + +/***/ }), +/* 188 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(189); +var entryUnbind = __w_pdfjs_require__(61); +module.exports = entryUnbind('String', 'padStart'); + +/***/ }), +/* 189 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var $padStart = __w_pdfjs_require__(190).start; +var WEBKIT_BUG = __w_pdfjs_require__(192); +$({ + target: 'String', + proto: true, + forced: WEBKIT_BUG +}, { + padStart: function padStart(maxLength) { + return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +/***/ }), +/* 190 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var toLength = __w_pdfjs_require__(47); +var repeat = __w_pdfjs_require__(191); +var requireObjectCoercible = __w_pdfjs_require__(20); +var ceil = Math.ceil; +var createMethod = function (IS_END) { + return function ($this, maxLength, fillString) { + var S = String(requireObjectCoercible($this)); + var stringLength = S.length; + var fillStr = fillString === undefined ? ' ' : String(fillString); + var intMaxLength = toLength(maxLength); + var fillLen, stringFiller; + if (intMaxLength <= stringLength || fillStr == '') + return S; + fillLen = intMaxLength - stringLength; + stringFiller = repeat.call(fillStr, ceil(fillLen / fillStr.length)); + if (stringFiller.length > fillLen) + stringFiller = stringFiller.slice(0, fillLen); + return IS_END ? S + stringFiller : stringFiller + S; + }; +}; +module.exports = { + start: createMethod(false), + end: createMethod(true) +}; + +/***/ }), +/* 191 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var toInteger = __w_pdfjs_require__(48); +var requireObjectCoercible = __w_pdfjs_require__(20); +module.exports = ''.repeat || function repeat(count) { + var str = String(requireObjectCoercible(this)); + var result = ''; + var n = toInteger(count); + if (n < 0 || n == Infinity) + throw RangeError('Wrong number of repetitions'); + for (; n > 0; (n >>>= 1) && (str += str)) + if (n & 1) + result += str; + return result; +}; + +/***/ }), +/* 192 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var userAgent = __w_pdfjs_require__(127); +module.exports = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent); + +/***/ }), +/* 193 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(194); +var entryUnbind = __w_pdfjs_require__(61); +module.exports = entryUnbind('String', 'padEnd'); + +/***/ }), +/* 194 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + +var $ = __w_pdfjs_require__(10); +var $padEnd = __w_pdfjs_require__(190).end; +var WEBKIT_BUG = __w_pdfjs_require__(192); +$({ + target: 'String', + proto: true, + forced: WEBKIT_BUG +}, { + padEnd: function padEnd(maxLength) { + return $padEnd(this, maxLength, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +/***/ }), +/* 195 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +__w_pdfjs_require__(196); +var path = __w_pdfjs_require__(43); +module.exports = path.Object.values; + +/***/ }), +/* 196 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var $ = __w_pdfjs_require__(10); +var $values = __w_pdfjs_require__(197).values; +$({ + target: 'Object', + stat: true +}, { + values: function values(O) { + return $values(O); + } +}); + +/***/ }), +/* 197 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +var DESCRIPTORS = __w_pdfjs_require__(13); +var objectKeys = __w_pdfjs_require__(73); +var toIndexedObject = __w_pdfjs_require__(17); +var propertyIsEnumerable = __w_pdfjs_require__(15).f; +var createMethod = function (TO_ENTRIES) { + return function (it) { + var O = toIndexedObject(it); + var keys = objectKeys(O); + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) { + key = keys[i++]; + if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) { + result.push(TO_ENTRIES ? [ + key, + O[key] + ] : O[key]); + } + } + return result; + }; +}; +module.exports = { + entries: createMethod(true), + values: createMethod(false) +}; + +/***/ }), +/* 198 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getDocument = getDocument; +exports.setPDFNetworkStreamFactory = setPDFNetworkStreamFactory; +exports.build = exports.version = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFWorker = exports.PDFDataRangeTransport = exports.LoopbackPort = void 0; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); + +var _util = __w_pdfjs_require__(5); + +var _display_utils = __w_pdfjs_require__(1); + +var _font_loader = __w_pdfjs_require__(199); + +var _api_compatibility = __w_pdfjs_require__(200); + +var _canvas = __w_pdfjs_require__(201); + +var _worker_options = __w_pdfjs_require__(203); + +var _is_node = __w_pdfjs_require__(7); + +var _message_handler = __w_pdfjs_require__(204); + +var _metadata = __w_pdfjs_require__(205); + +var _transport_stream = __w_pdfjs_require__(207); + +var _webgl = __w_pdfjs_require__(208); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +var DEFAULT_RANGE_CHUNK_SIZE = 65536; +var RENDERING_CANCELLED_TIMEOUT = 100; var createPDFNetworkStream; + function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) { createPDFNetworkStream = pdfNetworkStreamFactory; } + function getDocument(src) { var task = new PDFDocumentLoadingTask(); var source; - if (typeof src === 'string') { - source = { url: src }; + + if (typeof src === "string") { + source = { + url: src + }; } else if ((0, _util.isArrayBuffer)(src)) { - source = { data: src }; + source = { + data: src + }; } else if (src instanceof PDFDataRangeTransport) { - source = { range: src }; + source = { + range: src + }; } else { - if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) !== 'object') { - throw new Error('Invalid parameter in getDocument, ' + 'need either Uint8Array, string or a parameter object'); + if (_typeof(src) !== "object") { + throw new Error("Invalid parameter in getDocument, " + "need either Uint8Array, string or a parameter object"); } + if (!src.url && !src.data && !src.range) { - throw new Error('Invalid parameter object: need either .data, .range or .url'); + throw new Error("Invalid parameter object: need either .data, .range or .url"); } + source = src; } + var params = Object.create(null); - var rangeTransport = null; - var worker = null; + var rangeTransport = null, + worker = null; + for (var key in source) { - if (key === 'url' && typeof window !== 'undefined') { - params[key] = new _util.URL(source[key], window.location).href; + if (key === "url" && typeof window !== "undefined") { + params[key] = new URL(source[key], window.location).href; continue; - } else if (key === 'range') { + } else if (key === "range") { rangeTransport = source[key]; continue; - } else if (key === 'worker') { + } else if (key === "worker") { worker = source[key]; continue; - } else if (key === 'data' && !(source[key] instanceof Uint8Array)) { + } else if (key === "data" && !(source[key] instanceof Uint8Array)) { var pdfBytes = source[key]; - if (typeof pdfBytes === 'string') { + + if (typeof pdfBytes === "string") { params[key] = (0, _util.stringToBytes)(pdfBytes); - } else if ((typeof pdfBytes === 'undefined' ? 'undefined' : _typeof(pdfBytes)) === 'object' && pdfBytes !== null && !isNaN(pdfBytes.length)) { + } else if (_typeof(pdfBytes) === "object" && pdfBytes !== null && !isNaN(pdfBytes.length)) { params[key] = new Uint8Array(pdfBytes); } else if ((0, _util.isArrayBuffer)(pdfBytes)) { params[key] = new Uint8Array(pdfBytes); } else { - throw new Error('Invalid PDF binary data: either typed array, ' + 'string or array-like object is expected in the ' + 'data property.'); + throw new Error("Invalid PDF binary data: either typed array, " + "string or array-like object is expected in the " + "data property."); } + continue; } + params[key] = source[key]; } + params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; - params.CMapReaderFactory = params.CMapReaderFactory || _dom_utils.DOMCMapReaderFactory; + params.CMapReaderFactory = params.CMapReaderFactory || _display_utils.DOMCMapReaderFactory; params.ignoreErrors = params.stopAtErrors !== true; + params.fontExtraProperties = params.fontExtraProperties === true; params.pdfBug = params.pdfBug === true; - var NativeImageDecoderValues = Object.values(_util.NativeImageDecoding); - if (params.nativeImageDecoderSupport === undefined || !NativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) { - params.nativeImageDecoderSupport = _api_compatibility.apiCompatibilityParams.nativeImageDecoderSupport || _util.NativeImageDecoding.DECODE; - } + if (!Number.isInteger(params.maxImageSize)) { params.maxImageSize = -1; } - if (typeof params.isEvalSupported !== 'boolean') { + + if (typeof params.isEvalSupported !== "boolean") { params.isEvalSupported = true; } - if (typeof params.disableFontFace !== 'boolean') { + + if (typeof params.disableFontFace !== "boolean") { params.disableFontFace = _api_compatibility.apiCompatibilityParams.disableFontFace || false; } - if (typeof params.disableRange !== 'boolean') { + + if (typeof params.disableRange !== "boolean") { params.disableRange = false; } - if (typeof params.disableStream !== 'boolean') { + + if (typeof params.disableStream !== "boolean") { params.disableStream = false; } - if (typeof params.disableAutoFetch !== 'boolean') { + + if (typeof params.disableAutoFetch !== "boolean") { params.disableAutoFetch = false; } - if (typeof params.disableCreateObjectURL !== 'boolean') { - params.disableCreateObjectURL = _api_compatibility.apiCompatibilityParams.disableCreateObjectURL || false; - } + (0, _util.setVerbosityLevel)(params.verbosity); + if (!worker) { var workerParams = { - postMessageTransfers: params.postMessageTransfers, - verbosity: params.verbosity + verbosity: params.verbosity, + port: _worker_options.GlobalWorkerOptions.workerPort }; - var workerPort = _worker_options.GlobalWorkerOptions.workerPort; - if (workerPort) { - workerParams.port = workerPort; - worker = PDFWorker.fromPort(workerParams); - } else { - worker = new PDFWorker(workerParams); - } + worker = workerParams.port ? PDFWorker.fromPort(workerParams) : new PDFWorker(workerParams); task._worker = worker; } + var docId = task.docId; worker.promise.then(function () { if (task.destroyed) { - throw new Error('Loading aborted'); + throw new Error("Loading aborted"); } - return _fetchDocument(worker, params, rangeTransport, docId).then(function (workerId) { - if (task.destroyed) { - throw new Error('Loading aborted'); - } - var networkStream = void 0; + + var workerIdPromise = _fetchDocument(worker, params, rangeTransport, docId); + + var networkStreamPromise = new Promise(function (resolve) { + var networkStream; + if (rangeTransport) { networkStream = new _transport_stream.PDFDataTransportStream({ length: params.length, initialData: params.initialData, + progressiveDone: params.progressiveDone, disableRange: params.disableRange, disableStream: params.disableStream }, rangeTransport); @@ -8020,26 +12273,42 @@ function getDocument(src) { disableStream: params.disableStream }); } + + resolve(networkStream); + }); + return Promise.all([workerIdPromise, networkStreamPromise]).then(function (_ref) { + var _ref2 = _slicedToArray(_ref, 2), + workerId = _ref2[0], + networkStream = _ref2[1]; + + if (task.destroyed) { + throw new Error("Loading aborted"); + } + var messageHandler = new _message_handler.MessageHandler(docId, workerId, worker.port); messageHandler.postMessageTransfers = worker.postMessageTransfers; var transport = new WorkerTransport(messageHandler, task, networkStream, params); task._transport = transport; - messageHandler.send('Ready', null); + messageHandler.send("Ready", null); }); - }).catch(task._capability.reject); + })["catch"](task._capability.reject); return task; } + function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { if (worker.destroyed) { - return Promise.reject(new Error('Worker was destroyed')); + return Promise.reject(new Error("Worker was destroyed")); } + if (pdfDataRangeTransport) { source.length = pdfDataRangeTransport.length; source.initialData = pdfDataRangeTransport.initialData; + source.progressiveDone = pdfDataRangeTransport.progressiveDone; } - return worker.messageHandler.sendWithPromise('GetDocRequest', { + + return worker.messageHandler.sendWithPromise("GetDocRequest", { docId: docId, - apiVersion: '2.0.943', + apiVersion: '2.5.207', source: { data: source.data, url: source.url, @@ -8050,310 +12319,351 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { }, maxImageSize: source.maxImageSize, disableFontFace: source.disableFontFace, - disableCreateObjectURL: source.disableCreateObjectURL, postMessageTransfers: worker.postMessageTransfers, docBaseUrl: source.docBaseUrl, - nativeImageDecoderSupport: source.nativeImageDecoderSupport, ignoreErrors: source.ignoreErrors, - isEvalSupported: source.isEvalSupported + isEvalSupported: source.isEvalSupported, + fontExtraProperties: source.fontExtraProperties }).then(function (workerId) { if (worker.destroyed) { - throw new Error('Worker was destroyed'); + throw new Error("Worker was destroyed"); } + return workerId; }); } + var PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() { var nextDocumentId = 0; - function PDFDocumentLoadingTask() { - this._capability = (0, _util.createPromiseCapability)(); - this._transport = null; - this._worker = null; - this.docId = 'd' + nextDocumentId++; - this.destroyed = false; - this.onPassword = null; - this.onProgress = null; - this.onUnsupportedFeature = null; - } - PDFDocumentLoadingTask.prototype = { - get promise() { - return this._capability.promise; - }, - destroy: function destroy() { - var _this = this; - this.destroyed = true; - var transportDestroyed = !this._transport ? Promise.resolve() : this._transport.destroy(); - return transportDestroyed.then(function () { - _this._transport = null; - if (_this._worker) { - _this._worker.destroy(); - _this._worker = null; - } - }); - }, + var PDFDocumentLoadingTask = /*#__PURE__*/function () { + function PDFDocumentLoadingTask() { + _classCallCheck(this, PDFDocumentLoadingTask); - then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) { - return this.promise.then.apply(this.promise, arguments); + this._capability = (0, _util.createPromiseCapability)(); + this._transport = null; + this._worker = null; + this.docId = "d" + nextDocumentId++; + this.destroyed = false; + this.onPassword = null; + this.onProgress = null; + this.onUnsupportedFeature = null; } - }; + + _createClass(PDFDocumentLoadingTask, [{ + key: "destroy", + value: function destroy() { + var _this = this; + + this.destroyed = true; + var transportDestroyed = !this._transport ? Promise.resolve() : this._transport.destroy(); + return transportDestroyed.then(function () { + _this._transport = null; + + if (_this._worker) { + _this._worker.destroy(); + + _this._worker = null; + } + }); + } + }, { + key: "promise", + get: function get() { + return this._capability.promise; + } + }]); + + return PDFDocumentLoadingTask; + }(); + return PDFDocumentLoadingTask; }(); -var PDFDataRangeTransport = function () { +var PDFDataRangeTransport = /*#__PURE__*/function () { function PDFDataRangeTransport(length, initialData) { + var progressiveDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + _classCallCheck(this, PDFDataRangeTransport); this.length = length; this.initialData = initialData; + this.progressiveDone = progressiveDone; this._rangeListeners = []; this._progressListeners = []; this._progressiveReadListeners = []; + this._progressiveDoneListeners = []; this._readyCapability = (0, _util.createPromiseCapability)(); } _createClass(PDFDataRangeTransport, [{ - key: 'addRangeListener', + key: "addRangeListener", value: function addRangeListener(listener) { this._rangeListeners.push(listener); } }, { - key: 'addProgressListener', + key: "addProgressListener", value: function addProgressListener(listener) { this._progressListeners.push(listener); } }, { - key: 'addProgressiveReadListener', + key: "addProgressiveReadListener", value: function addProgressiveReadListener(listener) { this._progressiveReadListeners.push(listener); } }, { - key: 'onDataRange', + key: "addProgressiveDoneListener", + value: function addProgressiveDoneListener(listener) { + this._progressiveDoneListeners.push(listener); + } + }, { + key: "onDataRange", value: function onDataRange(begin, chunk) { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; + var _iterator = _createForOfIteratorHelper(this._rangeListeners), + _step; try { - for (var _iterator = this._rangeListeners[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + for (_iterator.s(); !(_step = _iterator.n()).done;) { var listener = _step.value; - listener(begin, chunk); } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } } }, { - key: 'onDataProgress', - value: function onDataProgress(loaded) { + key: "onDataProgress", + value: function onDataProgress(loaded, total) { var _this2 = this; this._readyCapability.promise.then(function () { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; + var _iterator2 = _createForOfIteratorHelper(_this2._progressListeners), + _step2; try { - for (var _iterator2 = _this2._progressListeners[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var listener = _step2.value; - - listener(loaded); + listener(loaded, total); } } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; + _iterator2.e(err); } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } + _iterator2.f(); } }); } }, { - key: 'onDataProgressiveRead', + key: "onDataProgressiveRead", value: function onDataProgressiveRead(chunk) { var _this3 = this; this._readyCapability.promise.then(function () { - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; + var _iterator3 = _createForOfIteratorHelper(_this3._progressiveReadListeners), + _step3; try { - for (var _iterator3 = _this3._progressiveReadListeners[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { var listener = _step3.value; - listener(chunk); } } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; + _iterator3.e(err); } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } + _iterator3.f(); + } + }); + } + }, { + key: "onDataProgressiveDone", + value: function onDataProgressiveDone() { + var _this4 = this; + + this._readyCapability.promise.then(function () { + var _iterator4 = _createForOfIteratorHelper(_this4._progressiveDoneListeners), + _step4; + + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var listener = _step4.value; + listener(); } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); } }); } }, { - key: 'transportReady', + key: "transportReady", value: function transportReady() { this._readyCapability.resolve(); } }, { - key: 'requestDataRange', + key: "requestDataRange", value: function requestDataRange(begin, end) { - (0, _util.unreachable)('Abstract method PDFDataRangeTransport.requestDataRange'); + (0, _util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange"); } }, { - key: 'abort', + key: "abort", value: function abort() {} }]); return PDFDataRangeTransport; }(); -var PDFDocumentProxy = function () { - function PDFDocumentProxy(pdfInfo, transport, loadingTask) { +exports.PDFDataRangeTransport = PDFDataRangeTransport; + +var PDFDocumentProxy = /*#__PURE__*/function () { + function PDFDocumentProxy(pdfInfo, transport) { _classCallCheck(this, PDFDocumentProxy); - this.loadingTask = loadingTask; this._pdfInfo = pdfInfo; this._transport = transport; } _createClass(PDFDocumentProxy, [{ - key: 'getPage', + key: "getPage", value: function getPage(pageNumber) { return this._transport.getPage(pageNumber); } }, { - key: 'getPageIndex', + key: "getPageIndex", value: function getPageIndex(ref) { return this._transport.getPageIndex(ref); } }, { - key: 'getDestinations', + key: "getDestinations", value: function getDestinations() { return this._transport.getDestinations(); } }, { - key: 'getDestination', + key: "getDestination", value: function getDestination(id) { return this._transport.getDestination(id); } }, { - key: 'getPageLabels', + key: "getPageLabels", value: function getPageLabels() { return this._transport.getPageLabels(); } }, { - key: 'getPageMode', + key: "getPageLayout", + value: function getPageLayout() { + return this._transport.getPageLayout(); + } + }, { + key: "getPageMode", value: function getPageMode() { return this._transport.getPageMode(); } }, { - key: 'getAttachments', + key: "getViewerPreferences", + value: function getViewerPreferences() { + return this._transport.getViewerPreferences(); + } + }, { + key: "getOpenAction", + value: function getOpenAction() { + return this._transport.getOpenAction(); + } + }, { + key: "getOpenActionDestination", + value: function getOpenActionDestination() { + (0, _display_utils.deprecated)("getOpenActionDestination, use getOpenAction instead."); + return this.getOpenAction().then(function (openAction) { + return openAction && openAction.dest ? openAction.dest : null; + }); + } + }, { + key: "getAttachments", value: function getAttachments() { return this._transport.getAttachments(); } }, { - key: 'getJavaScript', + key: "getJavaScript", value: function getJavaScript() { return this._transport.getJavaScript(); } }, { - key: 'getOutline', + key: "getOutline", value: function getOutline() { return this._transport.getOutline(); } }, { - key: 'getPermissions', + key: "getPermissions", value: function getPermissions() { return this._transport.getPermissions(); } }, { - key: 'getMetadata', + key: "getMetadata", value: function getMetadata() { return this._transport.getMetadata(); } }, { - key: 'getData', + key: "getData", value: function getData() { return this._transport.getData(); } }, { - key: 'getDownloadInfo', + key: "getDownloadInfo", value: function getDownloadInfo() { return this._transport.downloadInfoCapability.promise; } }, { - key: 'getStats', + key: "getStats", value: function getStats() { return this._transport.getStats(); } }, { - key: 'cleanup', + key: "cleanup", value: function cleanup() { - this._transport.startCleanup(); + return this._transport.startCleanup(); } }, { - key: 'destroy', + key: "destroy", value: function destroy() { return this.loadingTask.destroy(); } }, { - key: 'numPages', + key: "numPages", get: function get() { return this._pdfInfo.numPages; } }, { - key: 'fingerprint', + key: "fingerprint", get: function get() { return this._pdfInfo.fingerprint; } }, { - key: 'loadingParams', + key: "loadingParams", get: function get() { return this._transport.loadingParams; } + }, { + key: "loadingTask", + get: function get() { + return this._transport.loadingTask; + } }]); return PDFDocumentProxy; }(); -var PDFPageProxy = function PDFPageProxyClosure() { +exports.PDFDocumentProxy = PDFDocumentProxy; + +var PDFPageProxy = /*#__PURE__*/function () { function PDFPageProxy(pageIndex, pageInfo, transport) { var pdfBug = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - this.pageIndex = pageIndex; + _classCallCheck(this, PDFPageProxy); + + this._pageIndex = pageIndex; this._pageInfo = pageInfo; - this.transport = transport; - this._stats = pdfBug ? new _dom_utils.StatTimer() : _dom_utils.DummyStatTimer; + this._transport = transport; + this._stats = pdfBug ? new _display_utils.StatTimer() : null; this._pdfBug = pdfBug; this.commonObjs = transport.commonObjs; this.objs = new PDFObjects(); @@ -8362,125 +12672,205 @@ var PDFPageProxy = function PDFPageProxyClosure() { this.intentStates = Object.create(null); this.destroyed = false; } - PDFPageProxy.prototype = { - get pageNumber() { - return this.pageIndex + 1; - }, - get rotate() { - return this._pageInfo.rotate; - }, - get ref() { - return this._pageInfo.ref; - }, - get userUnit() { - return this._pageInfo.userUnit; - }, - get view() { - return this._pageInfo.view; - }, - getViewport: function getViewport(scale) { - var rotate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.rotate; - var dontFlip = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - return new _dom_utils.PageViewport({ + _createClass(PDFPageProxy, [{ + key: "getViewport", + value: function getViewport() { + var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + scale = _ref3.scale, + _ref3$rotation = _ref3.rotation, + rotation = _ref3$rotation === void 0 ? this.rotate : _ref3$rotation, + _ref3$offsetX = _ref3.offsetX, + offsetX = _ref3$offsetX === void 0 ? 0 : _ref3$offsetX, + _ref3$offsetY = _ref3.offsetY, + offsetY = _ref3$offsetY === void 0 ? 0 : _ref3$offsetY, + _ref3$dontFlip = _ref3.dontFlip, + dontFlip = _ref3$dontFlip === void 0 ? false : _ref3$dontFlip; + + return new _display_utils.PageViewport({ viewBox: this.view, scale: scale, - rotation: rotate, + rotation: rotation, + offsetX: offsetX, + offsetY: offsetY, dontFlip: dontFlip }); - }, + } + }, { + key: "getAnnotations", + value: function getAnnotations() { + var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref4$intent = _ref4.intent, + intent = _ref4$intent === void 0 ? null : _ref4$intent; - getAnnotations: function PDFPageProxy_getAnnotations(params) { - var intent = params && params.intent || null; if (!this.annotationsPromise || this.annotationsIntent !== intent) { - this.annotationsPromise = this.transport.getAnnotations(this.pageIndex, intent); + this.annotationsPromise = this._transport.getAnnotations(this._pageIndex, intent); this.annotationsIntent = intent; } + return this.annotationsPromise; - }, - render: function PDFPageProxy_render(params) { - var _this4 = this; + } + }, { + key: "render", + value: function render(_ref5) { + var _this5 = this; - var stats = this._stats; - stats.time('Overall'); + var canvasContext = _ref5.canvasContext, + viewport = _ref5.viewport, + _ref5$intent = _ref5.intent, + intent = _ref5$intent === void 0 ? "display" : _ref5$intent, + _ref5$enableWebGL = _ref5.enableWebGL, + enableWebGL = _ref5$enableWebGL === void 0 ? false : _ref5$enableWebGL, + _ref5$renderInteracti = _ref5.renderInteractiveForms, + renderInteractiveForms = _ref5$renderInteracti === void 0 ? false : _ref5$renderInteracti, + _ref5$transform = _ref5.transform, + transform = _ref5$transform === void 0 ? null : _ref5$transform, + _ref5$imageLayer = _ref5.imageLayer, + imageLayer = _ref5$imageLayer === void 0 ? null : _ref5$imageLayer, + _ref5$canvasFactory = _ref5.canvasFactory, + canvasFactory = _ref5$canvasFactory === void 0 ? null : _ref5$canvasFactory, + _ref5$background = _ref5.background, + background = _ref5$background === void 0 ? null : _ref5$background; + + if (this._stats) { + this._stats.time("Overall"); + } + + var renderingIntent = intent === "print" ? "print" : "display"; this.pendingCleanup = false; - var renderingIntent = params.intent === 'print' ? 'print' : 'display'; - var canvasFactory = params.canvasFactory || new _dom_utils.DOMCanvasFactory(); - var webGLContext = new _webgl.WebGLContext({ enable: params.enableWebGL }); + if (!this.intentStates[renderingIntent]) { this.intentStates[renderingIntent] = Object.create(null); } + var intentState = this.intentStates[renderingIntent]; + + if (intentState.streamReaderCancelTimeout) { + clearTimeout(intentState.streamReaderCancelTimeout); + intentState.streamReaderCancelTimeout = null; + } + + var canvasFactoryInstance = canvasFactory || new _display_utils.DOMCanvasFactory(); + var webGLContext = new _webgl.WebGLContext({ + enable: enableWebGL + }); + if (!intentState.displayReadyCapability) { - intentState.receivingOperatorList = true; intentState.displayReadyCapability = (0, _util.createPromiseCapability)(); intentState.operatorList = { fnArray: [], argsArray: [], lastChunk: false }; - stats.time('Page Request'); - this.transport.messageHandler.send('RenderPageRequest', { - pageIndex: this.pageNumber - 1, + + if (this._stats) { + this._stats.time("Page Request"); + } + + this._pumpOperatorList({ + pageIndex: this._pageIndex, intent: renderingIntent, - renderInteractiveForms: params.renderInteractiveForms === true + renderInteractiveForms: renderInteractiveForms === true }); } + var complete = function complete(error) { var i = intentState.renderTasks.indexOf(internalRenderTask); + if (i >= 0) { intentState.renderTasks.splice(i, 1); } - if (_this4.cleanupAfterRender) { - _this4.pendingCleanup = true; + + if (_this5.cleanupAfterRender || renderingIntent === "print") { + _this5.pendingCleanup = true; } - _this4._tryCleanup(); + + _this5._tryCleanup(); + if (error) { internalRenderTask.capability.reject(error); + + _this5._abortOperatorList({ + intentState: intentState, + reason: error + }); } else { internalRenderTask.capability.resolve(); } - stats.timeEnd('Rendering'); - stats.timeEnd('Overall'); + + if (_this5._stats) { + _this5._stats.timeEnd("Rendering"); + + _this5._stats.timeEnd("Overall"); + } }; - var internalRenderTask = new InternalRenderTask(complete, params, this.objs, this.commonObjs, intentState.operatorList, this.pageNumber, canvasFactory, webGLContext, this._pdfBug); - internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print'; + + var internalRenderTask = new InternalRenderTask({ + callback: complete, + params: { + canvasContext: canvasContext, + viewport: viewport, + transform: transform, + imageLayer: imageLayer, + background: background + }, + objs: this.objs, + commonObjs: this.commonObjs, + operatorList: intentState.operatorList, + pageIndex: this._pageIndex, + canvasFactory: canvasFactoryInstance, + webGLContext: webGLContext, + useRequestAnimationFrame: renderingIntent !== "print", + pdfBug: this._pdfBug + }); + if (!intentState.renderTasks) { intentState.renderTasks = []; } + intentState.renderTasks.push(internalRenderTask); var renderTask = internalRenderTask.task; intentState.displayReadyCapability.promise.then(function (transparency) { - if (_this4.pendingCleanup) { + if (_this5.pendingCleanup) { complete(); return; } - stats.time('Rendering'); + + if (_this5._stats) { + _this5._stats.time("Rendering"); + } + internalRenderTask.initializeGraphics(transparency); internalRenderTask.operatorListChanged(); - }).catch(complete); + })["catch"](complete); return renderTask; - }, - getOperatorList: function PDFPageProxy_getOperatorList() { + } + }, { + key: "getOperatorList", + value: function getOperatorList() { function operatorListChanged() { if (intentState.operatorList.lastChunk) { intentState.opListReadCapability.resolve(intentState.operatorList); var i = intentState.renderTasks.indexOf(opListTask); + if (i >= 0) { intentState.renderTasks.splice(i, 1); } } } - var renderingIntent = 'oplist'; + + var renderingIntent = "oplist"; + if (!this.intentStates[renderingIntent]) { this.intentStates[renderingIntent] = Object.create(null); } + var intentState = this.intentStates[renderingIntent]; var opListTask; + if (!intentState.opListReadCapability) { opListTask = {}; opListTask.operatorListChanged = operatorListChanged; - intentState.receivingOperatorList = true; intentState.opListReadCapability = (0, _util.createPromiseCapability)(); intentState.renderTasks = []; intentState.renderTasks.push(opListTask); @@ -8489,50 +12879,66 @@ var PDFPageProxy = function PDFPageProxyClosure() { argsArray: [], lastChunk: false }; - this._stats.time('Page Request'); - this.transport.messageHandler.send('RenderPageRequest', { - pageIndex: this.pageIndex, + + if (this._stats) { + this._stats.time("Page Request"); + } + + this._pumpOperatorList({ + pageIndex: this._pageIndex, intent: renderingIntent }); } + return intentState.opListReadCapability.promise; - }, - streamTextContent: function streamTextContent() { - var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + } + }, { + key: "streamTextContent", + value: function streamTextContent() { + var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref6$normalizeWhites = _ref6.normalizeWhitespace, + normalizeWhitespace = _ref6$normalizeWhites === void 0 ? false : _ref6$normalizeWhites, + _ref6$disableCombineT = _ref6.disableCombineTextItems, + disableCombineTextItems = _ref6$disableCombineT === void 0 ? false : _ref6$disableCombineT; var TEXT_CONTENT_CHUNK_SIZE = 100; - return this.transport.messageHandler.sendWithStream('GetTextContent', { - pageIndex: this.pageNumber - 1, - normalizeWhitespace: params.normalizeWhitespace === true, - combineTextItems: params.disableCombineTextItems !== true + return this._transport.messageHandler.sendWithStream("GetTextContent", { + pageIndex: this._pageIndex, + normalizeWhitespace: normalizeWhitespace === true, + combineTextItems: disableCombineTextItems !== true }, { highWaterMark: TEXT_CONTENT_CHUNK_SIZE, size: function size(textContent) { return textContent.items.length; } }); - }, - - getTextContent: function PDFPageProxy_getTextContent(params) { - params = params || {}; + } + }, { + key: "getTextContent", + value: function getTextContent() { + var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var readableStream = this.streamTextContent(params); return new Promise(function (resolve, reject) { function pump() { - reader.read().then(function (_ref) { + reader.read().then(function (_ref7) { var _textContent$items; - var value = _ref.value, - done = _ref.done; + var value = _ref7.value, + done = _ref7.done; if (done) { resolve(textContent); return; } + Object.assign(textContent.styles, value.styles); + (_textContent$items = textContent.items).push.apply(_textContent$items, _toConsumableArray(value.items)); + pump(); }, reject); } + var reader = readableStream.getReader(); var textContent = { items: [], @@ -8540,396 +12946,728 @@ var PDFPageProxy = function PDFPageProxyClosure() { }; pump(); }); - }, - _destroy: function PDFPageProxy_destroy() { + } + }, { + key: "_destroy", + value: function _destroy() { + var _this6 = this; + this.destroyed = true; - this.transport.pageCache[this.pageIndex] = null; + this._transport.pageCache[this._pageIndex] = null; var waitOn = []; Object.keys(this.intentStates).forEach(function (intent) { - if (intent === 'oplist') { + var intentState = _this6.intentStates[intent]; + + _this6._abortOperatorList({ + intentState: intentState, + reason: new Error("Page was destroyed."), + force: true + }); + + if (intent === "oplist") { return; } - var intentState = this.intentStates[intent]; + intentState.renderTasks.forEach(function (renderTask) { - var renderCompleted = renderTask.capability.promise.catch(function () {}); + var renderCompleted = renderTask.capability.promise["catch"](function () {}); waitOn.push(renderCompleted); renderTask.cancel(); }); - }, this); + }); this.objs.clear(); this.annotationsPromise = null; this.pendingCleanup = false; return Promise.all(waitOn); - }, - cleanup: function cleanup() { + } + }, { + key: "cleanup", + value: function cleanup() { var resetStats = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - this.pendingCleanup = true; - this._tryCleanup(resetStats); - }, - _tryCleanup: function _tryCleanup() { + return this._tryCleanup(resetStats); + } + }, { + key: "_tryCleanup", + value: function _tryCleanup() { + var _this7 = this; + var resetStats = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!this.pendingCleanup || Object.keys(this.intentStates).some(function (intent) { - var intentState = this.intentStates[intent]; - return intentState.renderTasks.length !== 0 || intentState.receivingOperatorList; - }, this)) { - return; + var intentState = _this7.intentStates[intent]; + return intentState.renderTasks.length !== 0 || !intentState.operatorList.lastChunk; + })) { + return false; } + Object.keys(this.intentStates).forEach(function (intent) { - delete this.intentStates[intent]; - }, this); + delete _this7.intentStates[intent]; + }); this.objs.clear(); this.annotationsPromise = null; - if (resetStats && this._stats instanceof _dom_utils.StatTimer) { - this._stats = new _dom_utils.StatTimer(); + + if (resetStats && this._stats) { + this._stats = new _display_utils.StatTimer(); } - this.pendingCleanup = false; - }, - _startRenderPage: function PDFPageProxy_startRenderPage(transparency, intent) { + this.pendingCleanup = false; + return true; + } + }, { + key: "_startRenderPage", + value: function _startRenderPage(transparency, intent) { var intentState = this.intentStates[intent]; + + if (!intentState) { + return; + } + + if (this._stats) { + this._stats.timeEnd("Page Request"); + } + if (intentState.displayReadyCapability) { intentState.displayReadyCapability.resolve(transparency); } - }, - _renderPageChunk: function PDFPageProxy_renderPageChunk(operatorListChunk, intent) { - var intentState = this.intentStates[intent]; - var i, ii; - for (i = 0, ii = operatorListChunk.length; i < ii; i++) { + } + }, { + key: "_renderPageChunk", + value: function _renderPageChunk(operatorListChunk, intentState) { + for (var i = 0, ii = operatorListChunk.length; i < ii; i++) { intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]); intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]); } + intentState.operatorList.lastChunk = operatorListChunk.lastChunk; - for (i = 0; i < intentState.renderTasks.length; i++) { - intentState.renderTasks[i].operatorListChanged(); + + for (var _i2 = 0; _i2 < intentState.renderTasks.length; _i2++) { + intentState.renderTasks[_i2].operatorListChanged(); } + if (operatorListChunk.lastChunk) { - intentState.receivingOperatorList = false; this._tryCleanup(); } - }, - get stats() { - return this._stats instanceof _dom_utils.StatTimer ? this._stats : null; } - }; - return PDFPageProxy; -}(); + }, { + key: "_pumpOperatorList", + value: function _pumpOperatorList(args) { + var _this8 = this; -var LoopbackPort = function () { - function LoopbackPort() { - var defer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + (0, _util.assert)(args.intent, 'PDFPageProxy._pumpOperatorList: Expected "intent" argument.'); - _classCallCheck(this, LoopbackPort); + var readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", args); - this._listeners = []; - this._defer = defer; - this._deferred = Promise.resolve(undefined); - } + var reader = readableStream.getReader(); + var intentState = this.intentStates[args.intent]; + intentState.streamReader = reader; - _createClass(LoopbackPort, [{ - key: 'postMessage', - value: function postMessage(obj, transfers) { - var _this5 = this; + var pump = function pump() { + reader.read().then(function (_ref8) { + var value = _ref8.value, + done = _ref8.done; - function cloneValue(value) { - if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object' || value === null) { - return value; - } - if (cloned.has(value)) { - return cloned.get(value); - } - var result; - var buffer; - if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) { - var transferable = transfers && transfers.includes(buffer); - if (value === buffer) { - result = value; - } else if (transferable) { - result = new value.constructor(buffer, value.byteOffset, value.byteLength); - } else { - result = new value.constructor(value); + if (done) { + intentState.streamReader = null; + return; } - cloned.set(value, result); - return result; - } - result = Array.isArray(value) ? [] : {}; - cloned.set(value, result); - for (var i in value) { - var desc, - p = value; - while (!(desc = Object.getOwnPropertyDescriptor(p, i))) { - p = Object.getPrototypeOf(p); + + if (_this8._transport.destroyed) { + return; } - if (typeof desc.value === 'undefined' || typeof desc.value === 'function') { - continue; + + _this8._renderPageChunk(value, intentState); + + pump(); + }, function (reason) { + intentState.streamReader = null; + + if (_this8._transport.destroyed) { + return; } - result[i] = cloneValue(desc.value); - } - return result; - } - if (!this._defer) { - this._listeners.forEach(function (listener) { - listener.call(this, { data: obj }); - }, this); - return; - } - var cloned = new WeakMap(); - var e = { data: cloneValue(obj) }; - this._deferred.then(function () { - _this5._listeners.forEach(function (listener) { - listener.call(this, e); - }, _this5); - }); + + if (intentState.operatorList) { + intentState.operatorList.lastChunk = true; + + for (var i = 0; i < intentState.renderTasks.length; i++) { + intentState.renderTasks[i].operatorListChanged(); + } + + _this8._tryCleanup(); + } + + if (intentState.displayReadyCapability) { + intentState.displayReadyCapability.reject(reason); + } else if (intentState.opListReadCapability) { + intentState.opListReadCapability.reject(reason); + } else { + throw reason; + } + }); + }; + + pump(); + } + }, { + key: "_abortOperatorList", + value: function _abortOperatorList(_ref9) { + var _this9 = this; + + var intentState = _ref9.intentState, + reason = _ref9.reason, + _ref9$force = _ref9.force, + force = _ref9$force === void 0 ? false : _ref9$force; + (0, _util.assert)(reason instanceof Error || _typeof(reason) === "object" && reason !== null, 'PDFPageProxy._abortOperatorList: Expected "reason" argument.'); + + if (!intentState.streamReader) { + return; + } + + if (!force) { + if (intentState.renderTasks.length !== 0) { + return; + } + + if (reason instanceof _display_utils.RenderingCancelledException) { + intentState.streamReaderCancelTimeout = setTimeout(function () { + _this9._abortOperatorList({ + intentState: intentState, + reason: reason, + force: true + }); + + intentState.streamReaderCancelTimeout = null; + }, RENDERING_CANCELLED_TIMEOUT); + return; + } + } + + intentState.streamReader.cancel(new _util.AbortException(reason && reason.message)); + intentState.streamReader = null; + + if (this._transport.destroyed) { + return; + } + + Object.keys(this.intentStates).some(function (intent) { + if (_this9.intentStates[intent] === intentState) { + delete _this9.intentStates[intent]; + return true; + } + + return false; + }); + this.cleanup(); + } + }, { + key: "pageNumber", + get: function get() { + return this._pageIndex + 1; + } + }, { + key: "rotate", + get: function get() { + return this._pageInfo.rotate; + } + }, { + key: "ref", + get: function get() { + return this._pageInfo.ref; + } + }, { + key: "userUnit", + get: function get() { + return this._pageInfo.userUnit; + } + }, { + key: "view", + get: function get() { + return this._pageInfo.view; + } + }, { + key: "stats", + get: function get() { + return this._stats; + } + }]); + + return PDFPageProxy; +}(); + +exports.PDFPageProxy = PDFPageProxy; + +var LoopbackPort = /*#__PURE__*/function () { + function LoopbackPort() { + var defer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + + _classCallCheck(this, LoopbackPort); + + this._listeners = []; + this._defer = defer; + this._deferred = Promise.resolve(undefined); + } + + _createClass(LoopbackPort, [{ + key: "postMessage", + value: function postMessage(obj, transfers) { + var _this10 = this; + + function cloneValue(value) { + if (_typeof(value) !== "object" || value === null) { + return value; + } + + if (cloned.has(value)) { + return cloned.get(value); + } + + var buffer, result; + + if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) { + var transferable = transfers && transfers.includes(buffer); + + if (transferable) { + result = new value.constructor(buffer, value.byteOffset, value.byteLength); + } else { + result = new value.constructor(value); + } + + cloned.set(value, result); + return result; + } + + result = Array.isArray(value) ? [] : {}; + cloned.set(value, result); + + for (var i in value) { + var desc = void 0, + p = value; + + while (!(desc = Object.getOwnPropertyDescriptor(p, i))) { + p = Object.getPrototypeOf(p); + } + + if (typeof desc.value === "undefined") { + continue; + } + + if (typeof desc.value === "function") { + if (value.hasOwnProperty && value.hasOwnProperty(i)) { + throw new Error("LoopbackPort.postMessage - cannot clone: ".concat(value[i])); + } + + continue; + } + + result[i] = cloneValue(desc.value); + } + + return result; + } + + if (!this._defer) { + this._listeners.forEach(function (listener) { + listener.call(_this10, { + data: obj + }); + }); + + return; + } + + var cloned = new WeakMap(); + var e = { + data: cloneValue(obj) + }; + + this._deferred.then(function () { + _this10._listeners.forEach(function (listener) { + listener.call(_this10, e); + }); + }); } }, { - key: 'addEventListener', + key: "addEventListener", value: function addEventListener(name, listener) { this._listeners.push(listener); } }, { - key: 'removeEventListener', + key: "removeEventListener", value: function removeEventListener(name, listener) { var i = this._listeners.indexOf(listener); + this._listeners.splice(i, 1); } }, { - key: 'terminate', + key: "terminate", value: function terminate() { - this._listeners = []; + this._listeners.length = 0; } }]); return LoopbackPort; }(); +exports.LoopbackPort = LoopbackPort; + var PDFWorker = function PDFWorkerClosure() { + var pdfWorkerPorts = new WeakMap(); + var isWorkerDisabled = false; + var fallbackWorkerSrc; var nextFakeWorkerId = 0; - function getWorkerSrc() { + var fakeWorkerCapability; + + if (_is_node.isNodeJS && typeof require === "function") { + isWorkerDisabled = true; + fallbackWorkerSrc = "./pdf.worker.js"; + } else if ((typeof document === "undefined" ? "undefined" : _typeof(document)) === "object" && "currentScript" in document) { + var pdfjsFilePath = document.currentScript && document.currentScript.src; + + if (pdfjsFilePath) { + fallbackWorkerSrc = pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, ".worker$1$2"); + } + } + + function _getWorkerSrc() { if (_worker_options.GlobalWorkerOptions.workerSrc) { return _worker_options.GlobalWorkerOptions.workerSrc; } - if (typeof fallbackWorkerSrc !== 'undefined') { + + if (typeof fallbackWorkerSrc !== "undefined") { + if (!_is_node.isNodeJS) { + (0, _display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'); + } + return fallbackWorkerSrc; } + throw new Error('No "GlobalWorkerOptions.workerSrc" specified.'); } + function getMainThreadWorkerMessageHandler() { + var mainWorkerMessageHandler; + try { - if (typeof window !== 'undefined') { - return window.pdfjsWorker && window.pdfjsWorker.WorkerMessageHandler; - } + mainWorkerMessageHandler = globalThis.pdfjsWorker && globalThis.pdfjsWorker.WorkerMessageHandler; } catch (ex) {} - return null; + + return mainWorkerMessageHandler || null; } - var fakeWorkerFilesLoadedCapability = void 0; + function setupFakeWorkerGlobal() { - if (fakeWorkerFilesLoadedCapability) { - return fakeWorkerFilesLoadedCapability.promise; - } - fakeWorkerFilesLoadedCapability = (0, _util.createPromiseCapability)(); - var mainWorkerMessageHandler = getMainThreadWorkerMessageHandler(); - if (mainWorkerMessageHandler) { - fakeWorkerFilesLoadedCapability.resolve(mainWorkerMessageHandler); - return fakeWorkerFilesLoadedCapability.promise; - } - var loader = fakeWorkerFilesLoader || function () { - return (0, _dom_utils.loadScript)(getWorkerSrc()).then(function () { - return window.pdfjsWorker.WorkerMessageHandler; - }); - }; - loader().then(fakeWorkerFilesLoadedCapability.resolve, fakeWorkerFilesLoadedCapability.reject); - return fakeWorkerFilesLoadedCapability.promise; + if (fakeWorkerCapability) { + return fakeWorkerCapability.promise; + } + + fakeWorkerCapability = (0, _util.createPromiseCapability)(); + + var loader = /*#__PURE__*/function () { + var _ref10 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() { + var mainWorkerMessageHandler, worker; + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + mainWorkerMessageHandler = getMainThreadWorkerMessageHandler(); + + if (!mainWorkerMessageHandler) { + _context.next = 3; + break; + } + + return _context.abrupt("return", mainWorkerMessageHandler); + + case 3: + if (!(_is_node.isNodeJS && typeof require === "function")) { + _context.next = 6; + break; + } + + worker = eval("require")(_getWorkerSrc()); + return _context.abrupt("return", worker.WorkerMessageHandler); + + case 6: + _context.next = 8; + return (0, _display_utils.loadScript)(_getWorkerSrc()); + + case 8: + return _context.abrupt("return", window.pdfjsWorker.WorkerMessageHandler); + + case 9: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + + return function loader() { + return _ref10.apply(this, arguments); + }; + }(); + + loader().then(fakeWorkerCapability.resolve, fakeWorkerCapability.reject); + return fakeWorkerCapability.promise; } + function createCDNWrapper(url) { - var wrapper = 'importScripts(\'' + url + '\');'; - return _util.URL.createObjectURL(new Blob([wrapper])); - } - var pdfWorkerPorts = new WeakMap(); - function PDFWorker() { - var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref2$name = _ref2.name, - name = _ref2$name === undefined ? null : _ref2$name, - _ref2$port = _ref2.port, - port = _ref2$port === undefined ? null : _ref2$port, - _ref2$postMessageTran = _ref2.postMessageTransfers, - postMessageTransfers = _ref2$postMessageTran === undefined ? true : _ref2$postMessageTran, - _ref2$verbosity = _ref2.verbosity, - verbosity = _ref2$verbosity === undefined ? (0, _util.getVerbosityLevel)() : _ref2$verbosity; - - if (port && pdfWorkerPorts.has(port)) { - throw new Error('Cannot use more than one PDFWorker per port'); - } - this.name = name; - this.destroyed = false; - this.postMessageTransfers = postMessageTransfers !== false; - this.verbosity = verbosity; - this._readyCapability = (0, _util.createPromiseCapability)(); - this._port = null; - this._webWorker = null; - this._messageHandler = null; - if (port) { - pdfWorkerPorts.set(port, this); - this._initializeFromPort(port); - return; - } - this._initialize(); + var wrapper = "importScripts('" + url + "');"; + return URL.createObjectURL(new Blob([wrapper])); } - PDFWorker.prototype = { - get promise() { - return this._readyCapability.promise; - }, - get port() { - return this._port; - }, - get messageHandler() { - return this._messageHandler; - }, - _initializeFromPort: function PDFWorker_initializeFromPort(port) { - this._port = port; - this._messageHandler = new _message_handler.MessageHandler('main', 'worker', port); - this._messageHandler.on('ready', function () {}); - this._readyCapability.resolve(); - }, - _initialize: function PDFWorker_initialize() { - var _this6 = this; - if (typeof Worker !== 'undefined' && !isWorkerDisabled && !getMainThreadWorkerMessageHandler()) { - var workerSrc = getWorkerSrc(); - try { - if (!(0, _util.isSameOrigin)(window.location.href, workerSrc)) { - workerSrc = createCDNWrapper(new _util.URL(workerSrc, window.location).href); - } - var worker = new Worker(workerSrc); - var messageHandler = new _message_handler.MessageHandler('main', 'worker', worker); - var terminateEarly = function terminateEarly() { - worker.removeEventListener('error', onWorkerError); - messageHandler.destroy(); - worker.terminate(); - if (_this6.destroyed) { - _this6._readyCapability.reject(new Error('Worker was destroyed')); - } else { - _this6._setupFakeWorker(); - } - }; - var onWorkerError = function onWorkerError() { - if (!_this6._webWorker) { - terminateEarly(); - } - }; - worker.addEventListener('error', onWorkerError); - messageHandler.on('test', function (data) { - worker.removeEventListener('error', onWorkerError); - if (_this6.destroyed) { - terminateEarly(); - return; - } - if (data && data.supportTypedArray) { - _this6._messageHandler = messageHandler; - _this6._port = worker; - _this6._webWorker = worker; - if (!data.supportTransfers) { - _this6.postMessageTransfers = false; - } - _this6._readyCapability.resolve(); - messageHandler.send('configure', { verbosity: _this6.verbosity }); - } else { - _this6._setupFakeWorker(); - messageHandler.destroy(); - worker.terminate(); - } - }); - messageHandler.on('ready', function (data) { - worker.removeEventListener('error', onWorkerError); - if (_this6.destroyed) { - terminateEarly(); - return; - } - try { - sendTest(); - } catch (e) { - _this6._setupFakeWorker(); - } - }); - var sendTest = function sendTest() { - var testObj = new Uint8Array([_this6.postMessageTransfers ? 255 : 0]); - try { - messageHandler.send('test', testObj, [testObj.buffer]); - } catch (ex) { - (0, _util.info)('Cannot use postMessage transfers'); - testObj[0] = 0; - messageHandler.send('test', testObj); - } - }; - sendTest(); - return; - } catch (e) { - (0, _util.info)('The worker has been disabled.'); - } - } - this._setupFakeWorker(); - }, - _setupFakeWorker: function PDFWorker_setupFakeWorker() { - var _this7 = this; + var PDFWorker = /*#__PURE__*/function () { + function PDFWorker() { + var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref11$name = _ref11.name, + name = _ref11$name === void 0 ? null : _ref11$name, + _ref11$port = _ref11.port, + port = _ref11$port === void 0 ? null : _ref11$port, + _ref11$verbosity = _ref11.verbosity, + verbosity = _ref11$verbosity === void 0 ? (0, _util.getVerbosityLevel)() : _ref11$verbosity; - if (!isWorkerDisabled) { - (0, _util.warn)('Setting up fake worker.'); - isWorkerDisabled = true; - } - setupFakeWorkerGlobal().then(function (WorkerMessageHandler) { - if (_this7.destroyed) { - _this7._readyCapability.reject(new Error('Worker was destroyed')); - return; - } - var port = new LoopbackPort(); - _this7._port = port; - var id = 'fake' + nextFakeWorkerId++; - var workerHandler = new _message_handler.MessageHandler(id + '_worker', id, port); - WorkerMessageHandler.setup(workerHandler, port); - var messageHandler = new _message_handler.MessageHandler(id, id + '_worker', port); - _this7._messageHandler = messageHandler; - _this7._readyCapability.resolve(); - }).catch(function (reason) { - _this7._readyCapability.reject(new Error('Setting up fake worker failed: "' + reason.message + '".')); - }); - }, - destroy: function PDFWorker_destroy() { - this.destroyed = true; - if (this._webWorker) { - this._webWorker.terminate(); - this._webWorker = null; + _classCallCheck(this, PDFWorker); + + if (port && pdfWorkerPorts.has(port)) { + throw new Error("Cannot use more than one PDFWorker per port"); } - pdfWorkerPorts.delete(this._port); + + this.name = name; + this.destroyed = false; + this.postMessageTransfers = true; + this.verbosity = verbosity; + this._readyCapability = (0, _util.createPromiseCapability)(); this._port = null; - if (this._messageHandler) { - this._messageHandler.destroy(); - this._messageHandler = null; + this._webWorker = null; + this._messageHandler = null; + + if (port) { + pdfWorkerPorts.set(port, this); + + this._initializeFromPort(port); + + return; } + + this._initialize(); } - }; - PDFWorker.fromPort = function (params) { - if (!params || !params.port) { - throw new Error('PDFWorker.fromPort - invalid method signature.'); - } - if (pdfWorkerPorts.has(params.port)) { - return pdfWorkerPorts.get(params.port); - } - return new PDFWorker(params); - }; - PDFWorker.getWorkerSrc = function () { - return getWorkerSrc(); - }; - return PDFWorker; -}(); -var WorkerTransport = function () { - function WorkerTransport(messageHandler, loadingTask, networkStream, params) { - _classCallCheck(this, WorkerTransport); + _createClass(PDFWorker, [{ + key: "_initializeFromPort", + value: function _initializeFromPort(port) { + this._port = port; + this._messageHandler = new _message_handler.MessageHandler("main", "worker", port); + + this._messageHandler.on("ready", function () {}); + + this._readyCapability.resolve(); + } + }, { + key: "_initialize", + value: function _initialize() { + var _this11 = this; + + if (typeof Worker !== "undefined" && !isWorkerDisabled && !getMainThreadWorkerMessageHandler()) { + var workerSrc = _getWorkerSrc(); + + try { + if (!(0, _util.isSameOrigin)(window.location.href, workerSrc)) { + workerSrc = createCDNWrapper(new URL(workerSrc, window.location).href); + } + + var worker = new Worker(workerSrc); + var messageHandler = new _message_handler.MessageHandler("main", "worker", worker); + + var terminateEarly = function terminateEarly() { + worker.removeEventListener("error", onWorkerError); + messageHandler.destroy(); + worker.terminate(); + + if (_this11.destroyed) { + _this11._readyCapability.reject(new Error("Worker was destroyed")); + } else { + _this11._setupFakeWorker(); + } + }; + + var onWorkerError = function onWorkerError() { + if (!_this11._webWorker) { + terminateEarly(); + } + }; + + worker.addEventListener("error", onWorkerError); + messageHandler.on("test", function (data) { + worker.removeEventListener("error", onWorkerError); + + if (_this11.destroyed) { + terminateEarly(); + return; + } + + if (data) { + _this11._messageHandler = messageHandler; + _this11._port = worker; + _this11._webWorker = worker; + + if (!data.supportTransfers) { + _this11.postMessageTransfers = false; + } + + _this11._readyCapability.resolve(); + + messageHandler.send("configure", { + verbosity: _this11.verbosity + }); + } else { + _this11._setupFakeWorker(); + + messageHandler.destroy(); + worker.terminate(); + } + }); + messageHandler.on("ready", function (data) { + worker.removeEventListener("error", onWorkerError); + + if (_this11.destroyed) { + terminateEarly(); + return; + } + + try { + sendTest(); + } catch (e) { + _this11._setupFakeWorker(); + } + }); + + var sendTest = function sendTest() { + var testObj = new Uint8Array([_this11.postMessageTransfers ? 255 : 0]); + + try { + messageHandler.send("test", testObj, [testObj.buffer]); + } catch (ex) { + (0, _util.warn)("Cannot use postMessage transfers."); + testObj[0] = 0; + messageHandler.send("test", testObj); + } + }; + + sendTest(); + return; + } catch (e) { + (0, _util.info)("The worker has been disabled."); + } + } + + this._setupFakeWorker(); + } + }, { + key: "_setupFakeWorker", + value: function _setupFakeWorker() { + var _this12 = this; + + if (!isWorkerDisabled) { + (0, _util.warn)("Setting up fake worker."); + isWorkerDisabled = true; + } + + setupFakeWorkerGlobal().then(function (WorkerMessageHandler) { + if (_this12.destroyed) { + _this12._readyCapability.reject(new Error("Worker was destroyed")); + + return; + } + + var port = new LoopbackPort(); + _this12._port = port; + var id = "fake" + nextFakeWorkerId++; + var workerHandler = new _message_handler.MessageHandler(id + "_worker", id, port); + WorkerMessageHandler.setup(workerHandler, port); + var messageHandler = new _message_handler.MessageHandler(id, id + "_worker", port); + _this12._messageHandler = messageHandler; + + _this12._readyCapability.resolve(); + + messageHandler.send("configure", { + verbosity: _this12.verbosity + }); + })["catch"](function (reason) { + _this12._readyCapability.reject(new Error("Setting up fake worker failed: \"".concat(reason.message, "\"."))); + }); + } + }, { + key: "destroy", + value: function destroy() { + this.destroyed = true; + + if (this._webWorker) { + this._webWorker.terminate(); + + this._webWorker = null; + } + + pdfWorkerPorts["delete"](this._port); + this._port = null; + + if (this._messageHandler) { + this._messageHandler.destroy(); + + this._messageHandler = null; + } + } + }, { + key: "promise", + get: function get() { + return this._readyCapability.promise; + } + }, { + key: "port", + get: function get() { + return this._port; + } + }, { + key: "messageHandler", + get: function get() { + return this._messageHandler; + } + }], [{ + key: "fromPort", + value: function fromPort(params) { + if (!params || !params.port) { + throw new Error("PDFWorker.fromPort - invalid method signature."); + } + + if (pdfWorkerPorts.has(params.port)) { + return pdfWorkerPorts.get(params.port); + } + + return new PDFWorker(params); + } + }, { + key: "getWorkerSrc", + value: function getWorkerSrc() { + return _getWorkerSrc(); + } + }]); + + return PDFWorker; + }(); + + return PDFWorker; +}(); + +exports.PDFWorker = PDFWorker; + +var WorkerTransport = /*#__PURE__*/function () { + function WorkerTransport(messageHandler, loadingTask, networkStream, params) { + _classCallCheck(this, WorkerTransport); this.messageHandler = messageHandler; this.loadingTask = loadingTask; this.commonObjs = new PDFObjects(); - this.fontLoader = new _font_loader.FontLoader(loadingTask.docId); + this.fontLoader = new _font_loader.FontLoader({ + docId: loadingTask.docId, + onUnsupportedFeature: this._onUnsupportedFeature.bind(this) + }); this._params = params; this.CMapReaderFactory = new params.CMapReaderFactory({ baseUrl: params.cMapUrl, @@ -8948,87 +13686,96 @@ var WorkerTransport = function () { } _createClass(WorkerTransport, [{ - key: 'destroy', + key: "destroy", value: function destroy() { - var _this8 = this; + var _this13 = this; if (this.destroyCapability) { return this.destroyCapability.promise; } + this.destroyed = true; this.destroyCapability = (0, _util.createPromiseCapability)(); + if (this._passwordCapability) { - this._passwordCapability.reject(new Error('Worker was destroyed during onPassword callback')); + this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback")); } + var waitOn = []; this.pageCache.forEach(function (page) { if (page) { waitOn.push(page._destroy()); } }); - this.pageCache = []; - this.pagePromises = []; - var terminated = this.messageHandler.sendWithPromise('Terminate', null); + this.pageCache.length = 0; + this.pagePromises.length = 0; + var terminated = this.messageHandler.sendWithPromise("Terminate", null); waitOn.push(terminated); Promise.all(waitOn).then(function () { - _this8.fontLoader.clear(); - if (_this8._networkStream) { - _this8._networkStream.cancelAllRequests(); + _this13.fontLoader.clear(); + + if (_this13._networkStream) { + _this13._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")); } - if (_this8.messageHandler) { - _this8.messageHandler.destroy(); - _this8.messageHandler = null; + + if (_this13.messageHandler) { + _this13.messageHandler.destroy(); + + _this13.messageHandler = null; } - _this8.destroyCapability.resolve(); + + _this13.destroyCapability.resolve(); }, this.destroyCapability.reject); return this.destroyCapability.promise; } }, { - key: 'setupMessageHandler', + key: "setupMessageHandler", value: function setupMessageHandler() { + var _this14 = this; + var messageHandler = this.messageHandler, loadingTask = this.loadingTask; + messageHandler.on("GetReader", function (data, sink) { + (0, _util.assert)(_this14._networkStream, "GetReader - no `IPDFStream` instance available."); + _this14._fullReader = _this14._networkStream.getFullReader(); - messageHandler.on('GetReader', function (data, sink) { - var _this9 = this; - - (0, _util.assert)(this._networkStream); - this._fullReader = this._networkStream.getFullReader(); - this._fullReader.onProgress = function (evt) { - _this9._lastProgress = { + _this14._fullReader.onProgress = function (evt) { + _this14._lastProgress = { loaded: evt.loaded, total: evt.total }; }; + sink.onPull = function () { - _this9._fullReader.read().then(function (_ref3) { - var value = _ref3.value, - done = _ref3.done; + _this14._fullReader.read().then(function (_ref12) { + var value = _ref12.value, + done = _ref12.done; if (done) { sink.close(); return; } - (0, _util.assert)((0, _util.isArrayBuffer)(value)); + + (0, _util.assert)((0, _util.isArrayBuffer)(value), "GetReader - expected an ArrayBuffer."); sink.enqueue(new Uint8Array(value), 1, [value]); - }).catch(function (reason) { + })["catch"](function (reason) { sink.error(reason); }); }; + sink.onCancel = function (reason) { - _this9._fullReader.cancel(reason); + _this14._fullReader.cancel(reason); }; - }, this); - messageHandler.on('ReaderHeadersReady', function (data) { - var _this10 = this; - + }); + messageHandler.on("ReaderHeadersReady", function (data) { var headersCapability = (0, _util.createPromiseCapability)(); - var fullReader = this._fullReader; + var fullReader = _this14._fullReader; fullReader.headersReady.then(function () { if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) { - if (_this10._lastProgress && loadingTask.onProgress) { - loadingTask.onProgress(_this10._lastProgress); + if (_this14._lastProgress && loadingTask.onProgress) { + loadingTask.onProgress(_this14._lastProgress); } + fullReader.onProgress = function (evt) { if (loadingTask.onProgress) { loadingTask.onProgress({ @@ -9038,6 +13785,7 @@ var WorkerTransport = function () { } }; } + headersCapability.resolve({ isStreamingSupported: fullReader.isStreamingSupported, isRangeSupported: fullReader.isRangeSupported, @@ -9045,97 +13793,113 @@ var WorkerTransport = function () { }); }, headersCapability.reject); return headersCapability.promise; - }, this); - messageHandler.on('GetRangeReader', function (data, sink) { - (0, _util.assert)(this._networkStream); - var rangeReader = this._networkStream.getRangeReader(data.begin, data.end); + }); + messageHandler.on("GetRangeReader", function (data, sink) { + (0, _util.assert)(_this14._networkStream, "GetRangeReader - no `IPDFStream` instance available."); + + var rangeReader = _this14._networkStream.getRangeReader(data.begin, data.end); + + if (!rangeReader) { + sink.close(); + return; + } + sink.onPull = function () { - rangeReader.read().then(function (_ref4) { - var value = _ref4.value, - done = _ref4.done; + rangeReader.read().then(function (_ref13) { + var value = _ref13.value, + done = _ref13.done; if (done) { sink.close(); return; } - (0, _util.assert)((0, _util.isArrayBuffer)(value)); + + (0, _util.assert)((0, _util.isArrayBuffer)(value), "GetRangeReader - expected an ArrayBuffer."); sink.enqueue(new Uint8Array(value), 1, [value]); - }).catch(function (reason) { + })["catch"](function (reason) { sink.error(reason); }); }; + sink.onCancel = function (reason) { rangeReader.cancel(reason); }; - }, this); - messageHandler.on('GetDoc', function (_ref5) { - var pdfInfo = _ref5.pdfInfo; - - this.numPages = pdfInfo.numPages; - this.pdfDocument = new PDFDocumentProxy(pdfInfo, this, loadingTask); - loadingTask._capability.resolve(this.pdfDocument); - }, this); - messageHandler.on('PasswordRequest', function (exception) { - var _this11 = this; + }); + messageHandler.on("GetDoc", function (_ref14) { + var pdfInfo = _ref14.pdfInfo; + _this14._numPages = pdfInfo.numPages; + + loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, _this14)); + }); + messageHandler.on("DocException", function (ex) { + var reason; + + switch (ex.name) { + case "PasswordException": + reason = new _util.PasswordException(ex.message, ex.code); + break; + + case "InvalidPDFException": + reason = new _util.InvalidPDFException(ex.message); + break; + + case "MissingPDFException": + reason = new _util.MissingPDFException(ex.message); + break; + + case "UnexpectedResponseException": + reason = new _util.UnexpectedResponseException(ex.message, ex.status); + break; + + case "UnknownErrorException": + reason = new _util.UnknownErrorException(ex.message, ex.details); + break; + } + + loadingTask._capability.reject(reason); + }); + messageHandler.on("PasswordRequest", function (exception) { + _this14._passwordCapability = (0, _util.createPromiseCapability)(); - this._passwordCapability = (0, _util.createPromiseCapability)(); if (loadingTask.onPassword) { var updatePassword = function updatePassword(password) { - _this11._passwordCapability.resolve({ password: password }); + _this14._passwordCapability.resolve({ + password: password + }); }; + try { loadingTask.onPassword(updatePassword, exception.code); } catch (ex) { - this._passwordCapability.reject(ex); + _this14._passwordCapability.reject(ex); } } else { - this._passwordCapability.reject(new _util.PasswordException(exception.message, exception.code)); + _this14._passwordCapability.reject(new _util.PasswordException(exception.message, exception.code)); } - return this._passwordCapability.promise; - }, this); - messageHandler.on('PasswordException', function (exception) { - loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code)); - }, this); - messageHandler.on('InvalidPDF', function (exception) { - loadingTask._capability.reject(new _util.InvalidPDFException(exception.message)); - }, this); - messageHandler.on('MissingPDF', function (exception) { - loadingTask._capability.reject(new _util.MissingPDFException(exception.message)); - }, this); - messageHandler.on('UnexpectedResponse', function (exception) { - loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status)); - }, this); - messageHandler.on('UnknownError', function (exception) { - loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details)); - }, this); - messageHandler.on('DataLoaded', function (data) { + + return _this14._passwordCapability.promise; + }); + messageHandler.on("DataLoaded", function (data) { if (loadingTask.onProgress) { loadingTask.onProgress({ loaded: data.length, total: data.length }); } - this.downloadInfoCapability.resolve(data); - }, this); - messageHandler.on('StartRenderPage', function (data) { - if (this.destroyed) { - return; - } - var page = this.pageCache[data.pageIndex]; - page._stats.timeEnd('Page Request'); - page._startRenderPage(data.transparency, data.intent); - }, this); - messageHandler.on('RenderPageChunk', function (data) { - if (this.destroyed) { + + _this14.downloadInfoCapability.resolve(data); + }); + messageHandler.on("StartRenderPage", function (data) { + if (_this14.destroyed) { return; } - var page = this.pageCache[data.pageIndex]; - page._renderPageChunk(data.operatorList, data.intent); - }, this); - messageHandler.on('commonobj', function (data) { - var _this12 = this; - if (this.destroyed) { + var page = _this14.pageCache[data.pageIndex]; + + page._startRenderPage(data.transparency, data.intent); + }); + messageHandler.on("commonobj", function (data) { + if (_this14.destroyed) { return; } @@ -9144,48 +13908,69 @@ var WorkerTransport = function () { type = _data[1], exportedData = _data[2]; - if (this.commonObjs.hasData(id)) { + if (_this14.commonObjs.has(id)) { return; } + switch (type) { - case 'Font': - var params = this._params; - if ('error' in exportedData) { + case "Font": + var params = _this14._params; + + if ("error" in exportedData) { var exportedError = exportedData.error; - (0, _util.warn)('Error during font loading: ' + exportedError); - this.commonObjs.resolve(id, exportedError); + (0, _util.warn)("Error during font loading: ".concat(exportedError)); + + _this14.commonObjs.resolve(id, exportedError); + break; } + var fontRegistry = null; - if (params.pdfBug && _global_scope2.default.FontInspector && _global_scope2.default.FontInspector.enabled) { + + if (params.pdfBug && globalThis.FontInspector && globalThis.FontInspector.enabled) { fontRegistry = { registerFont: function registerFont(font, url) { - _global_scope2.default['FontInspector'].fontAdded(font, url); + globalThis.FontInspector.fontAdded(font, url); } }; } + var font = new _font_loader.FontFaceObject(exportedData, { isEvalSupported: params.isEvalSupported, disableFontFace: params.disableFontFace, ignoreErrors: params.ignoreErrors, - onUnsupportedFeature: this._onUnsupportedFeature.bind(this), + onUnsupportedFeature: _this14._onUnsupportedFeature.bind(_this14), fontRegistry: fontRegistry }); - var fontReady = function fontReady(fontObjs) { - _this12.commonObjs.resolve(id, font); - }; - this.fontLoader.bind([font], fontReady); + + _this14.fontLoader.bind(font)["catch"](function (reason) { + return messageHandler.sendWithPromise("FontFallback", { + id: id + }); + })["finally"](function () { + if (!params.fontExtraProperties && font.data) { + font.data = null; + } + + _this14.commonObjs.resolve(id, font); + }); + break; - case 'FontPath': - this.commonObjs.resolve(id, exportedData); + + case "FontPath": + case "FontType3Res": + case "Image": + _this14.commonObjs.resolve(id, exportedData); + break; + default: - throw new Error('Got unknown common object type ' + type); + throw new Error("Got unknown common object type ".concat(type)); } - }, this); - messageHandler.on('obj', function (data) { - if (this.destroyed) { - return; + }); + messageHandler.on("obj", function (data) { + if (_this14.destroyed) { + return undefined; } var _data2 = _slicedToArray(data, 4), @@ -9194,265 +13979,239 @@ var WorkerTransport = function () { type = _data2[2], imageData = _data2[3]; - var pageProxy = this.pageCache[pageIndex]; - if (pageProxy.objs.hasData(id)) { - return; + var pageProxy = _this14.pageCache[pageIndex]; + + if (pageProxy.objs.has(id)) { + return undefined; } + switch (type) { - case 'JpegStream': - return new Promise(function (resolve, reject) { - var img = new Image(); - img.onload = function () { - resolve(img); - }; - img.onerror = function () { - reject(new Error('Error during JPEG image loading')); - }; - img.src = imageData; - }).then(function (img) { - pageProxy.objs.resolve(id, img); - }); - case 'Image': + case "Image": pageProxy.objs.resolve(id, imageData); var MAX_IMAGE_SIZE_TO_STORE = 8000000; - if (imageData && 'data' in imageData && imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) { + + if (imageData && "data" in imageData && imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) { pageProxy.cleanupAfterRender = true; } + break; + default: - throw new Error('Got unknown object type ' + type); + throw new Error("Got unknown object type ".concat(type)); } - }, this); - messageHandler.on('DocProgress', function (data) { - if (this.destroyed) { + + return undefined; + }); + messageHandler.on("DocProgress", function (data) { + if (_this14.destroyed) { return; } + if (loadingTask.onProgress) { loadingTask.onProgress({ loaded: data.loaded, total: data.total }); } - }, this); - messageHandler.on('PageError', function (data) { - if (this.destroyed) { + }); + messageHandler.on("UnsupportedFeature", this._onUnsupportedFeature.bind(this)); + messageHandler.on("FetchBuiltInCMap", function (data, sink) { + if (_this14.destroyed) { + sink.error(new Error("Worker was destroyed")); return; } - var page = this.pageCache[data.pageNum - 1]; - var intentState = page.intentStates[data.intent]; - if (intentState.displayReadyCapability) { - intentState.displayReadyCapability.reject(data.error); - } else { - throw new Error(data.error); - } - if (intentState.operatorList) { - intentState.operatorList.lastChunk = true; - for (var i = 0; i < intentState.renderTasks.length; i++) { - intentState.renderTasks[i].operatorListChanged(); + + var fetched = false; + + sink.onPull = function () { + if (fetched) { + sink.close(); + return; } - } - }, this); - messageHandler.on('UnsupportedFeature', this._onUnsupportedFeature, this); - messageHandler.on('JpegDecode', function (data) { - if (this.destroyed) { - return Promise.reject(new Error('Worker was destroyed')); - } - if (typeof document === 'undefined') { - return Promise.reject(new Error('"document" is not defined.')); - } - var _data3 = _slicedToArray(data, 2), - imageUrl = _data3[0], - components = _data3[1]; + fetched = true; - if (components !== 3 && components !== 1) { - return Promise.reject(new Error('Only 3 components or 1 component can be returned')); - } - return new Promise(function (resolve, reject) { - var img = new Image(); - img.onload = function () { - var width = img.width; - var height = img.height; - var size = width * height; - var rgbaLength = size * 4; - var buf = new Uint8ClampedArray(size * components); - var tmpCanvas = document.createElement('canvas'); - tmpCanvas.width = width; - tmpCanvas.height = height; - var tmpCtx = tmpCanvas.getContext('2d'); - tmpCtx.drawImage(img, 0, 0); - var data = tmpCtx.getImageData(0, 0, width, height).data; - if (components === 3) { - for (var i = 0, j = 0; i < rgbaLength; i += 4, j += 3) { - buf[j] = data[i]; - buf[j + 1] = data[i + 1]; - buf[j + 2] = data[i + 2]; - } - } else if (components === 1) { - for (var _i = 0, _j = 0; _i < rgbaLength; _i += 4, _j++) { - buf[_j] = data[_i]; - } - } - resolve({ - data: buf, - width: width, - height: height - }); - }; - img.onerror = function () { - reject(new Error('JpegDecode failed to load image')); - }; - img.src = imageUrl; - }); - }, this); - messageHandler.on('FetchBuiltInCMap', function (data) { - if (this.destroyed) { - return Promise.reject(new Error('Worker was destroyed')); - } - return this.CMapReaderFactory.fetch({ name: data.name }); - }, this); + _this14.CMapReaderFactory.fetch(data).then(function (builtInCMap) { + sink.enqueue(builtInCMap, 1, [builtInCMap.cMapData.buffer]); + })["catch"](function (reason) { + sink.error(reason); + }); + }; + }); } }, { - key: '_onUnsupportedFeature', - value: function _onUnsupportedFeature(_ref6) { - var featureId = _ref6.featureId; + key: "_onUnsupportedFeature", + value: function _onUnsupportedFeature(_ref15) { + var featureId = _ref15.featureId; if (this.destroyed) { return; } + if (this.loadingTask.onUnsupportedFeature) { this.loadingTask.onUnsupportedFeature(featureId); } } }, { - key: 'getData', + key: "getData", value: function getData() { - return this.messageHandler.sendWithPromise('GetData', null); + return this.messageHandler.sendWithPromise("GetData", null); } }, { - key: 'getPage', + key: "getPage", value: function getPage(pageNumber) { - var _this13 = this; + var _this15 = this; - if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this.numPages) { - return Promise.reject(new Error('Invalid page request')); + if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) { + return Promise.reject(new Error("Invalid page request")); } + var pageIndex = pageNumber - 1; + if (pageIndex in this.pagePromises) { return this.pagePromises[pageIndex]; } - var promise = this.messageHandler.sendWithPromise('GetPage', { pageIndex: pageIndex }).then(function (pageInfo) { - if (_this13.destroyed) { - throw new Error('Transport destroyed'); + + var promise = this.messageHandler.sendWithPromise("GetPage", { + pageIndex: pageIndex + }).then(function (pageInfo) { + if (_this15.destroyed) { + throw new Error("Transport destroyed"); } - var page = new PDFPageProxy(pageIndex, pageInfo, _this13, _this13._params.pdfBug); - _this13.pageCache[pageIndex] = page; + + var page = new PDFPageProxy(pageIndex, pageInfo, _this15, _this15._params.pdfBug); + _this15.pageCache[pageIndex] = page; return page; }); this.pagePromises[pageIndex] = promise; return promise; } }, { - key: 'getPageIndex', + key: "getPageIndex", value: function getPageIndex(ref) { - return this.messageHandler.sendWithPromise('GetPageIndex', { ref: ref }).catch(function (reason) { + return this.messageHandler.sendWithPromise("GetPageIndex", { + ref: ref + })["catch"](function (reason) { return Promise.reject(new Error(reason)); }); } }, { - key: 'getAnnotations', + key: "getAnnotations", value: function getAnnotations(pageIndex, intent) { - return this.messageHandler.sendWithPromise('GetAnnotations', { + return this.messageHandler.sendWithPromise("GetAnnotations", { pageIndex: pageIndex, intent: intent }); } }, { - key: 'getDestinations', + key: "getDestinations", value: function getDestinations() { - return this.messageHandler.sendWithPromise('GetDestinations', null); + return this.messageHandler.sendWithPromise("GetDestinations", null); } }, { - key: 'getDestination', + key: "getDestination", value: function getDestination(id) { - if (typeof id !== 'string') { - return Promise.reject(new Error('Invalid destination request.')); + if (typeof id !== "string") { + return Promise.reject(new Error("Invalid destination request.")); } - return this.messageHandler.sendWithPromise('GetDestination', { id: id }); + + return this.messageHandler.sendWithPromise("GetDestination", { + id: id + }); } }, { - key: 'getPageLabels', + key: "getPageLabels", value: function getPageLabels() { - return this.messageHandler.sendWithPromise('GetPageLabels', null); + return this.messageHandler.sendWithPromise("GetPageLabels", null); + } + }, { + key: "getPageLayout", + value: function getPageLayout() { + return this.messageHandler.sendWithPromise("GetPageLayout", null); } }, { - key: 'getPageMode', + key: "getPageMode", value: function getPageMode() { - return this.messageHandler.sendWithPromise('GetPageMode', null); + return this.messageHandler.sendWithPromise("GetPageMode", null); } }, { - key: 'getAttachments', + key: "getViewerPreferences", + value: function getViewerPreferences() { + return this.messageHandler.sendWithPromise("GetViewerPreferences", null); + } + }, { + key: "getOpenAction", + value: function getOpenAction() { + return this.messageHandler.sendWithPromise("GetOpenAction", null); + } + }, { + key: "getAttachments", value: function getAttachments() { - return this.messageHandler.sendWithPromise('GetAttachments', null); + return this.messageHandler.sendWithPromise("GetAttachments", null); } }, { - key: 'getJavaScript', + key: "getJavaScript", value: function getJavaScript() { - return this.messageHandler.sendWithPromise('GetJavaScript', null); + return this.messageHandler.sendWithPromise("GetJavaScript", null); } }, { - key: 'getOutline', + key: "getOutline", value: function getOutline() { - return this.messageHandler.sendWithPromise('GetOutline', null); + return this.messageHandler.sendWithPromise("GetOutline", null); } }, { - key: 'getPermissions', + key: "getPermissions", value: function getPermissions() { - return this.messageHandler.sendWithPromise('GetPermissions', null); + return this.messageHandler.sendWithPromise("GetPermissions", null); } }, { - key: 'getMetadata', + key: "getMetadata", value: function getMetadata() { - var _this14 = this; + var _this16 = this; - return this.messageHandler.sendWithPromise('GetMetadata', null).then(function (results) { + return this.messageHandler.sendWithPromise("GetMetadata", null).then(function (results) { return { info: results[0], metadata: results[1] ? new _metadata.Metadata(results[1]) : null, - contentDispositionFilename: _this14._fullReader ? _this14._fullReader.filename : null + contentDispositionFilename: _this16._fullReader ? _this16._fullReader.filename : null }; }); } }, { - key: 'getStats', + key: "getStats", value: function getStats() { - return this.messageHandler.sendWithPromise('GetStats', null); + return this.messageHandler.sendWithPromise("GetStats", null); } }, { - key: 'startCleanup', + key: "startCleanup", value: function startCleanup() { - var _this15 = this; + var _this17 = this; + + return this.messageHandler.sendWithPromise("Cleanup", null).then(function () { + for (var i = 0, ii = _this17.pageCache.length; i < ii; i++) { + var page = _this17.pageCache[i]; - this.messageHandler.sendWithPromise('Cleanup', null).then(function () { - for (var i = 0, ii = _this15.pageCache.length; i < ii; i++) { - var page = _this15.pageCache[i]; if (page) { - page.cleanup(); + var cleanupSuccessful = page.cleanup(); + + if (!cleanupSuccessful) { + throw new Error("startCleanup: Page ".concat(i + 1, " is currently rendering.")); + } } } - _this15.commonObjs.clear(); - _this15.fontLoader.clear(); + + _this17.commonObjs.clear(); + + _this17.fontLoader.clear(); }); } }, { - key: 'loadingParams', + key: "loadingParams", get: function get() { var params = this._params; - return (0, _util.shadow)(this, 'loadingParams', { + return (0, _util.shadow)(this, "loadingParams", { disableAutoFetch: params.disableAutoFetch, - disableCreateObjectURL: params.disableCreateObjectURL, - disableFontFace: params.disableFontFace, - nativeImageDecoderSupport: params.nativeImageDecoderSupport + disableFontFace: params.disableFontFace }); } }]); @@ -9460,224 +14219,306 @@ var WorkerTransport = function () { return WorkerTransport; }(); -var PDFObjects = function PDFObjectsClosure() { +var PDFObjects = /*#__PURE__*/function () { function PDFObjects() { - this.objs = Object.create(null); + _classCallCheck(this, PDFObjects); + + this._objs = Object.create(null); } - PDFObjects.prototype = { - ensureObj: function PDFObjects_ensureObj(objId) { - if (this.objs[objId]) { - return this.objs[objId]; + + _createClass(PDFObjects, [{ + key: "_ensureObj", + value: function _ensureObj(objId) { + if (this._objs[objId]) { + return this._objs[objId]; } - var obj = { + + return this._objs[objId] = { capability: (0, _util.createPromiseCapability)(), data: null, resolved: false }; - this.objs[objId] = obj; - return obj; - }, - get: function PDFObjects_get(objId, callback) { + } + }, { + key: "get", + value: function get(objId) { + var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + if (callback) { - this.ensureObj(objId).capability.promise.then(callback); + this._ensureObj(objId).capability.promise.then(callback); + return null; } - var obj = this.objs[objId]; + + var obj = this._objs[objId]; + if (!obj || !obj.resolved) { - throw new Error('Requesting object that isn\'t resolved yet ' + objId); + throw new Error("Requesting object that isn't resolved yet ".concat(objId, ".")); } + return obj.data; - }, - resolve: function PDFObjects_resolve(objId, data) { - var obj = this.ensureObj(objId); + } + }, { + key: "has", + value: function has(objId) { + var obj = this._objs[objId]; + return obj ? obj.resolved : false; + } + }, { + key: "resolve", + value: function resolve(objId, data) { + var obj = this._ensureObj(objId); + obj.resolved = true; obj.data = data; obj.capability.resolve(data); - }, - isResolved: function PDFObjects_isResolved(objId) { - var objs = this.objs; - if (!objs[objId]) { - return false; - } - return objs[objId].resolved; - }, - hasData: function PDFObjects_hasData(objId) { - return this.isResolved(objId); - }, - getData: function PDFObjects_getData(objId) { - var objs = this.objs; - if (!objs[objId] || !objs[objId].resolved) { - return null; - } - return objs[objId].data; - }, - clear: function PDFObjects_clear() { - this.objs = Object.create(null); } - }; + }, { + key: "clear", + value: function clear() { + this._objs = Object.create(null); + } + }]); + return PDFObjects; }(); -var RenderTask = function RenderTaskClosure() { + +var RenderTask = /*#__PURE__*/function () { function RenderTask(internalRenderTask) { + _classCallCheck(this, RenderTask); + this._internalRenderTask = internalRenderTask; this.onContinue = null; } - RenderTask.prototype = { - get promise() { - return this._internalRenderTask.capability.promise; - }, - cancel: function RenderTask_cancel() { + + _createClass(RenderTask, [{ + key: "cancel", + value: function cancel() { this._internalRenderTask.cancel(); - }, - then: function RenderTask_then(onFulfilled, onRejected) { - return this.promise.then.apply(this.promise, arguments); } - }; + }, { + key: "promise", + get: function get() { + return this._internalRenderTask.capability.promise; + } + }]); + return RenderTask; }(); + var InternalRenderTask = function InternalRenderTaskClosure() { - var canvasInRendering = new WeakMap(); - function InternalRenderTask(callback, params, objs, commonObjs, operatorList, pageNumber, canvasFactory, webGLContext) { - var pdfBug = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false; + var canvasInRendering = new WeakSet(); + + var InternalRenderTask = /*#__PURE__*/function () { + function InternalRenderTask(_ref16) { + var callback = _ref16.callback, + params = _ref16.params, + objs = _ref16.objs, + commonObjs = _ref16.commonObjs, + operatorList = _ref16.operatorList, + pageIndex = _ref16.pageIndex, + canvasFactory = _ref16.canvasFactory, + webGLContext = _ref16.webGLContext, + _ref16$useRequestAnim = _ref16.useRequestAnimationFrame, + useRequestAnimationFrame = _ref16$useRequestAnim === void 0 ? false : _ref16$useRequestAnim, + _ref16$pdfBug = _ref16.pdfBug, + pdfBug = _ref16$pdfBug === void 0 ? false : _ref16$pdfBug; + + _classCallCheck(this, InternalRenderTask); + + this.callback = callback; + this.params = params; + this.objs = objs; + this.commonObjs = commonObjs; + this.operatorListIdx = null; + this.operatorList = operatorList; + this._pageIndex = pageIndex; + this.canvasFactory = canvasFactory; + this.webGLContext = webGLContext; + this._pdfBug = pdfBug; + this.running = false; + this.graphicsReadyCallback = null; + this.graphicsReady = false; + this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== "undefined"; + this.cancelled = false; + this.capability = (0, _util.createPromiseCapability)(); + this.task = new RenderTask(this); + this._continueBound = this._continue.bind(this); + this._scheduleNextBound = this._scheduleNext.bind(this); + this._nextBound = this._next.bind(this); + this._canvas = params.canvasContext.canvas; + } + + _createClass(InternalRenderTask, [{ + key: "initializeGraphics", + value: function initializeGraphics() { + var transparency = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + if (this.cancelled) { + return; + } - this.callback = callback; - this.params = params; - this.objs = objs; - this.commonObjs = commonObjs; - this.operatorListIdx = null; - this.operatorList = operatorList; - this.pageNumber = pageNumber; - this.canvasFactory = canvasFactory; - this.webGLContext = webGLContext; - this._pdfBug = pdfBug; - this.running = false; - this.graphicsReadyCallback = null; - this.graphicsReady = false; - this.useRequestAnimationFrame = false; - this.cancelled = false; - this.capability = (0, _util.createPromiseCapability)(); - this.task = new RenderTask(this); - this._continueBound = this._continue.bind(this); - this._scheduleNextBound = this._scheduleNext.bind(this); - this._nextBound = this._next.bind(this); - this._canvas = params.canvasContext.canvas; - } - InternalRenderTask.prototype = { - initializeGraphics: function initializeGraphics(transparency) { - if (this.cancelled) { - return; - } - if (this._canvas) { - if (canvasInRendering.has(this._canvas)) { - throw new Error('Cannot use the same canvas during multiple render() operations. ' + 'Use different canvas or ensure previous operations were ' + 'cancelled or completed.'); + if (this._canvas) { + if (canvasInRendering.has(this._canvas)) { + throw new Error("Cannot use the same canvas during multiple render() operations. " + "Use different canvas or ensure previous operations were " + "cancelled or completed."); + } + + canvasInRendering.add(this._canvas); } - canvasInRendering.set(this._canvas, this); - } - if (this._pdfBug && _global_scope2.default.StepperManager && _global_scope2.default.StepperManager.enabled) { - this.stepper = _global_scope2.default.StepperManager.create(this.pageNumber - 1); - this.stepper.init(this.operatorList); - this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint(); - } - var params = this.params; - this.gfx = new _canvas.CanvasGraphics(params.canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.webGLContext, params.imageLayer); - this.gfx.beginDrawing({ - transform: params.transform, - viewport: params.viewport, - transparency: transparency, - background: params.background - }); - this.operatorListIdx = 0; - this.graphicsReady = true; - if (this.graphicsReadyCallback) { - this.graphicsReadyCallback(); - } - }, - cancel: function InternalRenderTask_cancel() { - this.running = false; - this.cancelled = true; - if (this._canvas) { - canvasInRendering.delete(this._canvas); - } - this.callback(new _dom_utils.RenderingCancelledException('Rendering cancelled, page ' + this.pageNumber, 'canvas')); - }, - operatorListChanged: function InternalRenderTask_operatorListChanged() { - if (!this.graphicsReady) { - if (!this.graphicsReadyCallback) { - this.graphicsReadyCallback = this._continueBound; + if (this._pdfBug && globalThis.StepperManager && globalThis.StepperManager.enabled) { + this.stepper = globalThis.StepperManager.create(this._pageIndex); + this.stepper.init(this.operatorList); + this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint(); + } + + var _this$params = this.params, + canvasContext = _this$params.canvasContext, + viewport = _this$params.viewport, + transform = _this$params.transform, + imageLayer = _this$params.imageLayer, + background = _this$params.background; + this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.webGLContext, imageLayer); + this.gfx.beginDrawing({ + transform: transform, + viewport: viewport, + transparency: transparency, + background: background + }); + this.operatorListIdx = 0; + this.graphicsReady = true; + + if (this.graphicsReadyCallback) { + this.graphicsReadyCallback(); } - return; - } - if (this.stepper) { - this.stepper.updateOperatorList(this.operatorList); - } - if (this.running) { - return; - } - this._continue(); - }, - _continue: function InternalRenderTask__continue() { - this.running = true; - if (this.cancelled) { - return; } - if (this.task.onContinue) { - this.task.onContinue(this._scheduleNextBound); - } else { - this._scheduleNext(); + }, { + key: "cancel", + value: function cancel() { + var error = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + this.running = false; + this.cancelled = true; + + if (this.gfx) { + this.gfx.endDrawing(); + } + + if (this._canvas) { + canvasInRendering["delete"](this._canvas); + } + + this.callback(error || new _display_utils.RenderingCancelledException("Rendering cancelled, page ".concat(this._pageIndex + 1), "canvas")); } - }, - _scheduleNext: function InternalRenderTask__scheduleNext() { - var _this16 = this; + }, { + key: "operatorListChanged", + value: function operatorListChanged() { + if (!this.graphicsReady) { + if (!this.graphicsReadyCallback) { + this.graphicsReadyCallback = this._continueBound; + } - if (this.useRequestAnimationFrame && typeof window !== 'undefined') { - window.requestAnimationFrame(function () { - _this16._nextBound().catch(_this16.callback); - }); - } else { - Promise.resolve().then(this._nextBound).catch(this.callback); + return; + } + + if (this.stepper) { + this.stepper.updateOperatorList(this.operatorList); + } + + if (this.running) { + return; + } + + this._continue(); } - }, - _next: function InternalRenderTask__next() { - var _this17 = this; + }, { + key: "_continue", + value: function _continue() { + this.running = true; - return new Promise(function () { - if (_this17.cancelled) { + if (this.cancelled) { return; } - _this17.operatorListIdx = _this17.gfx.executeOperatorList(_this17.operatorList, _this17.operatorListIdx, _this17._continueBound, _this17.stepper); - if (_this17.operatorListIdx === _this17.operatorList.argsArray.length) { - _this17.running = false; - if (_this17.operatorList.lastChunk) { - _this17.gfx.endDrawing(); - if (_this17._canvas) { - canvasInRendering.delete(_this17._canvas); + + if (this.task.onContinue) { + this.task.onContinue(this._scheduleNextBound); + } else { + this._scheduleNext(); + } + } + }, { + key: "_scheduleNext", + value: function _scheduleNext() { + var _this18 = this; + + if (this._useRequestAnimationFrame) { + window.requestAnimationFrame(function () { + _this18._nextBound()["catch"](_this18.cancel.bind(_this18)); + }); + } else { + Promise.resolve().then(this._nextBound)["catch"](this.cancel.bind(this)); + } + } + }, { + key: "_next", + value: function () { + var _next2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() { + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (!this.cancelled) { + _context2.next = 2; + break; + } + + return _context2.abrupt("return"); + + case 2: + this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper); + + if (this.operatorListIdx === this.operatorList.argsArray.length) { + this.running = false; + + if (this.operatorList.lastChunk) { + this.gfx.endDrawing(); + + if (this._canvas) { + canvasInRendering["delete"](this._canvas); + } + + this.callback(); + } + } + + case 4: + case "end": + return _context2.stop(); + } } - _this17.callback(); - } + }, _callee2, this); + })); + + function _next() { + return _next2.apply(this, arguments); } - }); - } - }; + + return _next; + }() + }]); + + return InternalRenderTask; + }(); + return InternalRenderTask; }(); -var version, build; -{ - exports.version = version = '2.0.943'; - exports.build = build = 'dc98bf76'; -} -exports.getDocument = getDocument; -exports.LoopbackPort = LoopbackPort; -exports.PDFDataRangeTransport = PDFDataRangeTransport; -exports.PDFWorker = PDFWorker; -exports.PDFDocumentProxy = PDFDocumentProxy; -exports.PDFPageProxy = PDFPageProxy; -exports.setPDFNetworkStreamFactory = setPDFNetworkStreamFactory; + +var version = '2.5.207'; exports.version = version; +var build = '0974d6052'; exports.build = build; /***/ }), -/* 130 */ +/* 199 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -9686,676 +14527,343 @@ exports.build = build; Object.defineProperty(exports, "__esModule", { value: true }); -exports.loadScript = exports.DummyStatTimer = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.getFilenameFromUrl = exports.addLinkAttributes = exports.RenderingCancelledException = exports.PageViewport = undefined; +exports.FontLoader = exports.FontFaceObject = void 0; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); -var _util = __w_pdfjs_require__(1); +var _util = __w_pdfjs_require__(5); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var DEFAULT_LINK_REL = 'noopener noreferrer nofollow'; -var SVG_NS = 'http://www.w3.org/2000/svg'; +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -var DOMCanvasFactory = function () { - function DOMCanvasFactory() { - _classCallCheck(this, DOMCanvasFactory); +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var BaseFontLoader = /*#__PURE__*/function () { + function BaseFontLoader(_ref) { + var docId = _ref.docId, + onUnsupportedFeature = _ref.onUnsupportedFeature; + + _classCallCheck(this, BaseFontLoader); + + if (this.constructor === BaseFontLoader) { + (0, _util.unreachable)("Cannot initialize BaseFontLoader."); + } + + this.docId = docId; + this._onUnsupportedFeature = onUnsupportedFeature; + this.nativeFontFaces = []; + this.styleElement = null; } - _createClass(DOMCanvasFactory, [{ - key: 'create', - value: function create(width, height) { - if (width <= 0 || height <= 0) { - throw new Error('invalid canvas size'); - } - var canvas = document.createElement('canvas'); - var context = canvas.getContext('2d'); - canvas.width = width; - canvas.height = height; - return { - canvas: canvas, - context: context - }; + _createClass(BaseFontLoader, [{ + key: "addNativeFontFace", + value: function addNativeFontFace(nativeFontFace) { + this.nativeFontFaces.push(nativeFontFace); + document.fonts.add(nativeFontFace); } }, { - key: 'reset', - value: function reset(canvasAndContext, width, height) { - if (!canvasAndContext.canvas) { - throw new Error('canvas is not specified'); - } - if (width <= 0 || height <= 0) { - throw new Error('invalid canvas size'); + key: "insertRule", + value: function insertRule(rule) { + var styleElement = this.styleElement; + + if (!styleElement) { + styleElement = this.styleElement = document.createElement("style"); + styleElement.id = "PDFJS_FONT_STYLE_TAG_".concat(this.docId); + document.documentElement.getElementsByTagName("head")[0].appendChild(styleElement); } - canvasAndContext.canvas.width = width; - canvasAndContext.canvas.height = height; + + var styleSheet = styleElement.sheet; + styleSheet.insertRule(rule, styleSheet.cssRules.length); } }, { - key: 'destroy', - value: function destroy(canvasAndContext) { - if (!canvasAndContext.canvas) { - throw new Error('canvas is not specified'); + key: "clear", + value: function clear() { + this.nativeFontFaces.forEach(function (nativeFontFace) { + document.fonts["delete"](nativeFontFace); + }); + this.nativeFontFaces.length = 0; + + if (this.styleElement) { + this.styleElement.remove(); + this.styleElement = null; } - canvasAndContext.canvas.width = 0; - canvasAndContext.canvas.height = 0; - canvasAndContext.canvas = null; - canvasAndContext.context = null; } - }]); + }, { + key: "bind", + value: function () { + var _bind = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(font) { + var _this = this; - return DOMCanvasFactory; -}(); + var nativeFontFace, rule; + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!(font.attached || font.missingFile)) { + _context.next = 2; + break; + } -var DOMCMapReaderFactory = function () { - function DOMCMapReaderFactory(_ref) { - var _ref$baseUrl = _ref.baseUrl, - baseUrl = _ref$baseUrl === undefined ? null : _ref$baseUrl, - _ref$isCompressed = _ref.isCompressed, - isCompressed = _ref$isCompressed === undefined ? false : _ref$isCompressed; + return _context.abrupt("return"); - _classCallCheck(this, DOMCMapReaderFactory); + case 2: + font.attached = true; - this.baseUrl = baseUrl; - this.isCompressed = isCompressed; - } + if (!this.isFontLoadingAPISupported) { + _context.next = 19; + break; + } - _createClass(DOMCMapReaderFactory, [{ - key: 'fetch', - value: function fetch(_ref2) { - var _this = this; + nativeFontFace = font.createNativeFontFace(); - var name = _ref2.name; + if (!nativeFontFace) { + _context.next = 18; + break; + } - if (!this.baseUrl) { - return Promise.reject(new Error('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.')); - } - if (!name) { - return Promise.reject(new Error('CMap name must be specified.')); - } - return new Promise(function (resolve, reject) { - var url = _this.baseUrl + name + (_this.isCompressed ? '.bcmap' : ''); - var request = new XMLHttpRequest(); - request.open('GET', url, true); - if (_this.isCompressed) { - request.responseType = 'arraybuffer'; - } - request.onreadystatechange = function () { - if (request.readyState !== XMLHttpRequest.DONE) { - return; - } - if (request.status === 200 || request.status === 0) { - var data = void 0; - if (_this.isCompressed && request.response) { - data = new Uint8Array(request.response); - } else if (!_this.isCompressed && request.responseText) { - data = (0, _util.stringToBytes)(request.responseText); - } - if (data) { - resolve({ - cMapData: data, - compressionType: _this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE - }); - return; - } - } - reject(new Error('Unable to load ' + (_this.isCompressed ? 'binary ' : '') + 'CMap at: ' + url)); - }; - request.send(null); - }); - } - }]); + this.addNativeFontFace(nativeFontFace); + _context.prev = 7; + _context.next = 10; + return nativeFontFace.loaded; - return DOMCMapReaderFactory; -}(); + case 10: + _context.next = 18; + break; -var DOMSVGFactory = function () { - function DOMSVGFactory() { - _classCallCheck(this, DOMSVGFactory); - } + case 12: + _context.prev = 12; + _context.t0 = _context["catch"](7); - _createClass(DOMSVGFactory, [{ - key: 'create', - value: function create(width, height) { - (0, _util.assert)(width > 0 && height > 0, 'Invalid SVG dimensions'); - var svg = document.createElementNS(SVG_NS, 'svg:svg'); - svg.setAttribute('version', '1.1'); - svg.setAttribute('width', width + 'px'); - svg.setAttribute('height', height + 'px'); - svg.setAttribute('preserveAspectRatio', 'none'); - svg.setAttribute('viewBox', '0 0 ' + width + ' ' + height); - return svg; - } - }, { - key: 'createElement', - value: function createElement(type) { - (0, _util.assert)(typeof type === 'string', 'Invalid SVG element type'); - return document.createElementNS(SVG_NS, type); - } - }]); + this._onUnsupportedFeature({ + featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadNative + }); - return DOMSVGFactory; -}(); + (0, _util.warn)("Failed to load font '".concat(nativeFontFace.family, "': '").concat(_context.t0, "'.")); + font.disableFontFace = true; + throw _context.t0; -var PageViewport = function () { - function PageViewport(_ref3) { - var viewBox = _ref3.viewBox, - scale = _ref3.scale, - rotation = _ref3.rotation, - _ref3$offsetX = _ref3.offsetX, - offsetX = _ref3$offsetX === undefined ? 0 : _ref3$offsetX, - _ref3$offsetY = _ref3.offsetY, - offsetY = _ref3$offsetY === undefined ? 0 : _ref3$offsetY, - _ref3$dontFlip = _ref3.dontFlip, - dontFlip = _ref3$dontFlip === undefined ? false : _ref3$dontFlip; + case 18: + return _context.abrupt("return"); - _classCallCheck(this, PageViewport); + case 19: + rule = font.createFontFaceRule(); - this.viewBox = viewBox; - this.scale = scale; - this.rotation = rotation; - this.offsetX = offsetX; - this.offsetY = offsetY; - var centerX = (viewBox[2] + viewBox[0]) / 2; - var centerY = (viewBox[3] + viewBox[1]) / 2; - var rotateA = void 0, - rotateB = void 0, - rotateC = void 0, - rotateD = void 0; - rotation = rotation % 360; - rotation = rotation < 0 ? rotation + 360 : rotation; - switch (rotation) { - case 180: - rotateA = -1; - rotateB = 0; - rotateC = 0; - rotateD = 1; - break; - case 90: - rotateA = 0; - rotateB = 1; - rotateC = 1; - rotateD = 0; - break; - case 270: - rotateA = 0; - rotateB = -1; - rotateC = -1; - rotateD = 0; - break; - default: - rotateA = 1; - rotateB = 0; - rotateC = 0; - rotateD = -1; - break; - } - if (dontFlip) { - rotateC = -rotateC; - rotateD = -rotateD; - } - var offsetCanvasX = void 0, - offsetCanvasY = void 0; - var width = void 0, - height = void 0; - if (rotateA === 0) { - offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; - offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; - width = Math.abs(viewBox[3] - viewBox[1]) * scale; - height = Math.abs(viewBox[2] - viewBox[0]) * scale; - } else { - offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; - offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; - width = Math.abs(viewBox[2] - viewBox[0]) * scale; - height = Math.abs(viewBox[3] - viewBox[1]) * scale; - } - this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY]; - this.width = width; - this.height = height; - } - - _createClass(PageViewport, [{ - key: 'clone', - value: function clone() { - var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref4$scale = _ref4.scale, - scale = _ref4$scale === undefined ? this.scale : _ref4$scale, - _ref4$rotation = _ref4.rotation, - rotation = _ref4$rotation === undefined ? this.rotation : _ref4$rotation, - _ref4$dontFlip = _ref4.dontFlip, - dontFlip = _ref4$dontFlip === undefined ? false : _ref4$dontFlip; - - return new PageViewport({ - viewBox: this.viewBox.slice(), - scale: scale, - rotation: rotation, - offsetX: this.offsetX, - offsetY: this.offsetY, - dontFlip: dontFlip - }); - } - }, { - key: 'convertToViewportPoint', - value: function convertToViewportPoint(x, y) { - return _util.Util.applyTransform([x, y], this.transform); - } - }, { - key: 'convertToViewportRectangle', - value: function convertToViewportRectangle(rect) { - var tl = _util.Util.applyTransform([rect[0], rect[1]], this.transform); - var br = _util.Util.applyTransform([rect[2], rect[3]], this.transform); - return [tl[0], tl[1], br[0], br[1]]; - } - }, { - key: 'convertToPdfPoint', - value: function convertToPdfPoint(x, y) { - return _util.Util.applyInverseTransform([x, y], this.transform); - } - }]); - - return PageViewport; -}(); - -var RenderingCancelledException = function RenderingCancelledException() { - function RenderingCancelledException(msg, type) { - this.message = msg; - this.type = type; - } - RenderingCancelledException.prototype = new Error(); - RenderingCancelledException.prototype.name = 'RenderingCancelledException'; - RenderingCancelledException.constructor = RenderingCancelledException; - return RenderingCancelledException; -}(); -var LinkTarget = { - NONE: 0, - SELF: 1, - BLANK: 2, - PARENT: 3, - TOP: 4 -}; -var LinkTargetStringMap = ['', '_self', '_blank', '_parent', '_top']; -function addLinkAttributes(link) { - var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - url = _ref5.url, - target = _ref5.target, - rel = _ref5.rel; - - link.href = link.title = url ? (0, _util.removeNullCharacters)(url) : ''; - if (url) { - var LinkTargetValues = Object.values(LinkTarget); - var targetIndex = LinkTargetValues.includes(target) ? target : LinkTarget.NONE; - link.target = LinkTargetStringMap[targetIndex]; - link.rel = typeof rel === 'string' ? rel : DEFAULT_LINK_REL; - } -} -function getFilenameFromUrl(url) { - var anchor = url.indexOf('#'); - var query = url.indexOf('?'); - var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length); - return url.substring(url.lastIndexOf('/', end) + 1, end); -} - -var StatTimer = function () { - function StatTimer() { - var enable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - - _classCallCheck(this, StatTimer); - - this.enabled = !!enable; - this.started = Object.create(null); - this.times = []; - } - - _createClass(StatTimer, [{ - key: 'time', - value: function time(name) { - if (!this.enabled) { - return; - } - if (name in this.started) { - (0, _util.warn)('Timer is already running for ' + name); - } - this.started[name] = Date.now(); - } - }, { - key: 'timeEnd', - value: function timeEnd(name) { - if (!this.enabled) { - return; - } - if (!(name in this.started)) { - (0, _util.warn)('Timer has not been started for ' + name); - } - this.times.push({ - 'name': name, - 'start': this.started[name], - 'end': Date.now() - }); - delete this.started[name]; - } - }, { - key: 'toString', - value: function toString() { - var times = this.times; - var out = '', - longest = 0; - for (var i = 0, ii = times.length; i < ii; ++i) { - var name = times[i]['name']; - if (name.length > longest) { - longest = name.length; - } - } - for (var _i = 0, _ii = times.length; _i < _ii; ++_i) { - var span = times[_i]; - var duration = span.end - span.start; - out += span['name'].padEnd(longest) + ' ' + duration + 'ms\n'; - } - return out; - } - }]); - - return StatTimer; -}(); - -var DummyStatTimer = function () { - function DummyStatTimer() { - _classCallCheck(this, DummyStatTimer); - - (0, _util.unreachable)('Cannot initialize DummyStatTimer.'); - } - - _createClass(DummyStatTimer, null, [{ - key: 'time', - value: function time(name) {} - }, { - key: 'timeEnd', - value: function timeEnd(name) {} - }, { - key: 'toString', - value: function toString() { - return ''; - } - }]); - - return DummyStatTimer; -}(); - -function loadScript(src) { - return new Promise(function (resolve, reject) { - var script = document.createElement('script'); - script.src = src; - script.onload = resolve; - script.onerror = function () { - reject(new Error('Cannot load script at: ' + script.src)); - }; - (document.head || document.documentElement).appendChild(script); - }); -} -exports.PageViewport = PageViewport; -exports.RenderingCancelledException = RenderingCancelledException; -exports.addLinkAttributes = addLinkAttributes; -exports.getFilenameFromUrl = getFilenameFromUrl; -exports.LinkTarget = LinkTarget; -exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL; -exports.DOMCanvasFactory = DOMCanvasFactory; -exports.DOMCMapReaderFactory = DOMCMapReaderFactory; -exports.DOMSVGFactory = DOMSVGFactory; -exports.StatTimer = StatTimer; -exports.DummyStatTimer = DummyStatTimer; -exports.loadScript = loadScript; - -/***/ }), -/* 131 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.FontLoader = exports.FontFaceObject = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _util = __w_pdfjs_require__(1); - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + if (!rule) { + _context.next = 26; + break; + } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + this.insertRule(rule); -var BaseFontLoader = function () { - function BaseFontLoader(docId) { - _classCallCheck(this, BaseFontLoader); + if (!this.isSyncFontLoadingSupported) { + _context.next = 24; + break; + } - if (this.constructor === BaseFontLoader) { - (0, _util.unreachable)('Cannot initialize BaseFontLoader.'); - } - this.docId = docId; - this.nativeFontFaces = []; - this.styleElement = null; - this.loadingContext = { - requests: [], - nextRequestId: 0 - }; - } + return _context.abrupt("return"); - _createClass(BaseFontLoader, [{ - key: 'addNativeFontFace', - value: function addNativeFontFace(nativeFontFace) { - this.nativeFontFaces.push(nativeFontFace); - document.fonts.add(nativeFontFace); - } - }, { - key: 'insertRule', - value: function insertRule(rule) { - var styleElement = this.styleElement; - if (!styleElement) { - styleElement = this.styleElement = document.createElement('style'); - styleElement.id = 'PDFJS_FONT_STYLE_TAG_' + this.docId; - document.documentElement.getElementsByTagName('head')[0].appendChild(styleElement); - } - var styleSheet = styleElement.sheet; - styleSheet.insertRule(rule, styleSheet.cssRules.length); - } - }, { - key: 'clear', - value: function clear() { - this.nativeFontFaces.forEach(function (nativeFontFace) { - document.fonts.delete(nativeFontFace); - }); - this.nativeFontFaces.length = 0; - if (this.styleElement) { - this.styleElement.remove(); - this.styleElement = null; - } - } - }, { - key: 'bind', - value: function bind(fonts, callback) { - var rules = []; - var fontsToLoad = []; - var fontLoadPromises = []; - var getNativeFontPromise = function getNativeFontPromise(nativeFontFace) { - return nativeFontFace.loaded.catch(function (reason) { - (0, _util.warn)('Failed to load font "' + nativeFontFace.family + '": ' + reason); - }); - }; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; + case 24: + _context.next = 26; + return new Promise(function (resolve) { + var request = _this._queueLoadingCallback(resolve); - try { - for (var _iterator = fonts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var font = _step.value; + _this._prepareFontLoadEvent([rule], [font], request); + }); - if (font.attached || font.missingFile) { - continue; - } - font.attached = true; - if (this.isFontLoadingAPISupported) { - var nativeFontFace = font.createNativeFontFace(); - if (nativeFontFace) { - this.addNativeFontFace(nativeFontFace); - fontLoadPromises.push(getNativeFontPromise(nativeFontFace)); - } - } else { - var rule = font.createFontFaceRule(); - if (rule) { - this.insertRule(rule); - rules.push(rule); - fontsToLoad.push(font); + case 26: + case "end": + return _context.stop(); } } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } + }, _callee, this, [[7, 12]]); + })); - var request = this._queueLoadingCallback(callback); - if (this.isFontLoadingAPISupported) { - Promise.all(fontLoadPromises).then(request.complete); - } else if (rules.length > 0 && !this.isSyncFontLoadingSupported) { - this._prepareFontLoadEvent(rules, fontsToLoad, request); - } else { - request.complete(); + function bind(_x) { + return _bind.apply(this, arguments); } - } + + return bind; + }() }, { - key: '_queueLoadingCallback', + key: "_queueLoadingCallback", value: function _queueLoadingCallback(callback) { - function completeRequest() { - (0, _util.assert)(!request.done, 'completeRequest() cannot be called twice.'); - request.done = true; - while (context.requests.length > 0 && context.requests[0].done) { - var otherRequest = context.requests.shift(); - setTimeout(otherRequest.callback, 0); - } - } - var context = this.loadingContext; - var request = { - id: 'pdfjs-font-loading-' + context.nextRequestId++, - done: false, - complete: completeRequest, - callback: callback - }; - context.requests.push(request); - return request; + (0, _util.unreachable)("Abstract method `_queueLoadingCallback`."); } }, { - key: '_prepareFontLoadEvent', + key: "_prepareFontLoadEvent", value: function _prepareFontLoadEvent(rules, fontsToLoad, request) { - (0, _util.unreachable)('Abstract method `_prepareFontLoadEvent`.'); + (0, _util.unreachable)("Abstract method `_prepareFontLoadEvent`."); } }, { - key: 'isFontLoadingAPISupported', + key: "isFontLoadingAPISupported", get: function get() { - (0, _util.unreachable)('Abstract method `isFontLoadingAPISupported`.'); + var supported = typeof document !== "undefined" && !!document.fonts; + return (0, _util.shadow)(this, "isFontLoadingAPISupported", supported); } }, { - key: 'isSyncFontLoadingSupported', + key: "isSyncFontLoadingSupported", get: function get() { - (0, _util.unreachable)('Abstract method `isSyncFontLoadingSupported`.'); + (0, _util.unreachable)("Abstract method `isSyncFontLoadingSupported`."); } }, { - key: '_loadTestFont', + key: "_loadTestFont", get: function get() { - (0, _util.unreachable)('Abstract method `_loadTestFont`.'); + (0, _util.unreachable)("Abstract method `_loadTestFont`."); } }]); return BaseFontLoader; }(); -var FontLoader = void 0; +var FontLoader; +exports.FontLoader = FontLoader; { - exports.FontLoader = FontLoader = function (_BaseFontLoader) { + exports.FontLoader = FontLoader = /*#__PURE__*/function (_BaseFontLoader) { _inherits(GenericFontLoader, _BaseFontLoader); + var _super = _createSuper(GenericFontLoader); + function GenericFontLoader(docId) { - _classCallCheck(this, GenericFontLoader); + var _this2; - var _this = _possibleConstructorReturn(this, (GenericFontLoader.__proto__ || Object.getPrototypeOf(GenericFontLoader)).call(this, docId)); + _classCallCheck(this, GenericFontLoader); - _this.loadTestFontId = 0; - return _this; + _this2 = _super.call(this, docId); + _this2.loadingContext = { + requests: [], + nextRequestId: 0 + }; + _this2.loadTestFontId = 0; + return _this2; } _createClass(GenericFontLoader, [{ - key: '_prepareFontLoadEvent', + key: "_queueLoadingCallback", + value: function _queueLoadingCallback(callback) { + function completeRequest() { + (0, _util.assert)(!request.done, "completeRequest() cannot be called twice."); + request.done = true; + + while (context.requests.length > 0 && context.requests[0].done) { + var otherRequest = context.requests.shift(); + setTimeout(otherRequest.callback, 0); + } + } + + var context = this.loadingContext; + var request = { + id: "pdfjs-font-loading-".concat(context.nextRequestId++), + done: false, + complete: completeRequest, + callback: callback + }; + context.requests.push(request); + return request; + } + }, { + key: "_prepareFontLoadEvent", value: function _prepareFontLoadEvent(rules, fonts, request) { function int32(data, offset) { return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff; } + function spliceString(s, offset, remove, insert) { var chunk1 = s.substring(0, offset); var chunk2 = s.substring(offset + remove); return chunk1 + insert + chunk2; } - var i = void 0, - ii = void 0; - var canvas = document.createElement('canvas'); + + var i, ii; + var canvas = document.createElement("canvas"); canvas.width = 1; canvas.height = 1; - var ctx = canvas.getContext('2d'); + var ctx = canvas.getContext("2d"); var called = 0; + function isFontReady(name, callback) { called++; + if (called > 30) { - (0, _util.warn)('Load test font never loaded.'); + (0, _util.warn)("Load test font never loaded."); callback(); return; } - ctx.font = '30px ' + name; - ctx.fillText('.', 0, 20); + + ctx.font = "30px " + name; + ctx.fillText(".", 0, 20); var imageData = ctx.getImageData(0, 0, 1, 1); + if (imageData.data[3] > 0) { callback(); return; } + setTimeout(isFontReady.bind(null, name, callback)); } - var loadTestFontId = 'lt' + Date.now() + this.loadTestFontId++; + + var loadTestFontId = "lt".concat(Date.now()).concat(this.loadTestFontId++); var data = this._loadTestFont; var COMMENT_OFFSET = 976; data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId); var CFF_CHECKSUM_OFFSET = 16; var XXXX_VALUE = 0x58585858; var checksum = int32(data, CFF_CHECKSUM_OFFSET); + for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) { checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0; } + if (i < loadTestFontId.length) { - checksum = checksum - XXXX_VALUE + int32(loadTestFontId + 'XXX', i) | 0; + checksum = checksum - XXXX_VALUE + int32(loadTestFontId + "XXX", i) | 0; } + data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, (0, _util.string32)(checksum)); - var url = 'url(data:font/opentype;base64,' + btoa(data) + ');'; - var rule = '@font-face {font-family:"' + loadTestFontId + '";src:' + url + '}'; + var url = "url(data:font/opentype;base64,".concat(btoa(data), ");"); + var rule = "@font-face {font-family:\"".concat(loadTestFontId, "\";src:").concat(url, "}"); this.insertRule(rule); var names = []; + for (i = 0, ii = fonts.length; i < ii; i++) { names.push(fonts[i].loadedName); } + names.push(loadTestFontId); - var div = document.createElement('div'); - div.setAttribute('style', 'visibility: hidden;' + 'width: 10px; height: 10px;' + 'position: absolute; top: 0px; left: 0px;'); + var div = document.createElement("div"); + div.style.visibility = "hidden"; + div.style.width = div.style.height = "10px"; + div.style.position = "absolute"; + div.style.top = div.style.left = "0px"; + for (i = 0, ii = names.length; i < ii; ++i) { - var span = document.createElement('span'); - span.textContent = 'Hi'; + var span = document.createElement("span"); + span.textContent = "Hi"; span.style.fontFamily = names[i]; div.appendChild(span); } + document.body.appendChild(div); isFontReady(loadTestFontId, function () { document.body.removeChild(div); @@ -10363,69 +14871,58 @@ var FontLoader = void 0; }); } }, { - key: 'isFontLoadingAPISupported', - get: function get() { - var supported = typeof document !== 'undefined' && !!document.fonts; - if (supported && typeof navigator !== 'undefined') { - var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent); - if (m && m[1] < 63) { - supported = false; - } - } - return (0, _util.shadow)(this, 'isFontLoadingAPISupported', supported); - } - }, { - key: 'isSyncFontLoadingSupported', + key: "isSyncFontLoadingSupported", get: function get() { var supported = false; - if (typeof navigator === 'undefined') { + + if (typeof navigator === "undefined") { supported = true; } else { var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent); + if (m && m[1] >= 14) { supported = true; } } - return (0, _util.shadow)(this, 'isSyncFontLoadingSupported', supported); + + return (0, _util.shadow)(this, "isSyncFontLoadingSupported", supported); } }, { - key: '_loadTestFont', + key: "_loadTestFont", get: function get() { var getLoadTestFont = function getLoadTestFont() { - return atob('T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA' + 'FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA' + 'ALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgA' + 'AAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1' + 'AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD' + '6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACM' + 'AooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4D' + 'IP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAA' + 'AAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUA' + 'AQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgAB' + 'AAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABY' + 'AAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAA'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YWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3" + "Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj" + "FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="); }; - return (0, _util.shadow)(this, '_loadTestFont', getLoadTestFont()); + + return (0, _util.shadow)(this, "_loadTestFont", getLoadTestFont()); } }]); return GenericFontLoader; }(BaseFontLoader); } -var IsEvalSupportedCached = { - get value() { - return (0, _util.shadow)(this, 'value', (0, _util.isEvalSupported)()); - } -}; -var FontFaceObject = function () { - function FontFaceObject(translatedData, _ref) { - var _ref$isEvalSupported = _ref.isEvalSupported, - isEvalSupported = _ref$isEvalSupported === undefined ? true : _ref$isEvalSupported, - _ref$disableFontFace = _ref.disableFontFace, - disableFontFace = _ref$disableFontFace === undefined ? false : _ref$disableFontFace, - _ref$ignoreErrors = _ref.ignoreErrors, - ignoreErrors = _ref$ignoreErrors === undefined ? false : _ref$ignoreErrors, - _ref$onUnsupportedFea = _ref.onUnsupportedFeature, - onUnsupportedFeature = _ref$onUnsupportedFea === undefined ? null : _ref$onUnsupportedFea, - _ref$fontRegistry = _ref.fontRegistry, - fontRegistry = _ref$fontRegistry === undefined ? null : _ref$fontRegistry; +var FontFaceObject = /*#__PURE__*/function () { + function FontFaceObject(translatedData, _ref2) { + var _ref2$isEvalSupported = _ref2.isEvalSupported, + isEvalSupported = _ref2$isEvalSupported === void 0 ? true : _ref2$isEvalSupported, + _ref2$disableFontFace = _ref2.disableFontFace, + disableFontFace = _ref2$disableFontFace === void 0 ? false : _ref2$disableFontFace, + _ref2$ignoreErrors = _ref2.ignoreErrors, + ignoreErrors = _ref2$ignoreErrors === void 0 ? false : _ref2$ignoreErrors, + _ref2$onUnsupportedFe = _ref2.onUnsupportedFeature, + onUnsupportedFeature = _ref2$onUnsupportedFe === void 0 ? null : _ref2$onUnsupportedFe, + _ref2$fontRegistry = _ref2.fontRegistry, + fontRegistry = _ref2$fontRegistry === void 0 ? null : _ref2$fontRegistry; _classCallCheck(this, FontFaceObject); this.compiledGlyphs = Object.create(null); + for (var i in translatedData) { this[i] = translatedData[i]; } + this.isEvalSupported = isEvalSupported !== false; this.disableFontFace = disableFontFace === true; this.ignoreErrors = ignoreErrors === true; @@ -10434,71 +14931,90 @@ var FontFaceObject = function () { } _createClass(FontFaceObject, [{ - key: 'createNativeFontFace', + key: "createNativeFontFace", value: function createNativeFontFace() { if (!this.data || this.disableFontFace) { return null; } + var nativeFontFace = new FontFace(this.loadedName, this.data, {}); + if (this.fontRegistry) { this.fontRegistry.registerFont(this); } + return nativeFontFace; } }, { - key: 'createFontFaceRule', + key: "createFontFaceRule", value: function createFontFaceRule() { if (!this.data || this.disableFontFace) { return null; } + var data = (0, _util.bytesToString)(new Uint8Array(this.data)); - var url = 'url(data:' + this.mimetype + ';base64,' + btoa(data) + ');'; - var rule = '@font-face {font-family:"' + this.loadedName + '";src:' + url + '}'; + var url = "url(data:".concat(this.mimetype, ";base64,").concat(btoa(data), ");"); + var rule = "@font-face {font-family:\"".concat(this.loadedName, "\";src:").concat(url, "}"); + if (this.fontRegistry) { this.fontRegistry.registerFont(this, url); } + return rule; } }, { - key: 'getPathGenerator', + key: "getPathGenerator", value: function getPathGenerator(objs, character) { if (this.compiledGlyphs[character] !== undefined) { return this.compiledGlyphs[character]; } - var cmds = void 0, - current = void 0; + + var cmds, current; + try { - cmds = objs.get(this.loadedName + '_path_' + character); + cmds = objs.get(this.loadedName + "_path_" + character); } catch (ex) { if (!this.ignoreErrors) { throw ex; } + if (this._onUnsupportedFeature) { - this._onUnsupportedFeature({ featureId: _util.UNSUPPORTED_FEATURES.font }); + this._onUnsupportedFeature({ + featureId: _util.UNSUPPORTED_FEATURES.errorFontGetPath + }); } - (0, _util.warn)('getPathGenerator - ignoring character: "' + ex + '".'); + + (0, _util.warn)("getPathGenerator - ignoring character: \"".concat(ex, "\".")); return this.compiledGlyphs[character] = function (c, size) {}; } - if (this.isEvalSupported && IsEvalSupportedCached.value) { - var args = void 0, - js = ''; + + if (this.isEvalSupported && _util.IsEvalSupportedCached.value) { + var args, + js = ""; + for (var i = 0, ii = cmds.length; i < ii; i++) { current = cmds[i]; + if (current.args !== undefined) { - args = current.args.join(','); + args = current.args.join(","); } else { - args = ''; + args = ""; } - js += 'c.' + current.cmd + '(' + args + ');\n'; + + js += "c." + current.cmd + "(" + args + ");\n"; } - return this.compiledGlyphs[character] = new Function('c', 'size', js); + + return this.compiledGlyphs[character] = new Function("c", "size", js); } + return this.compiledGlyphs[character] = function (c, size) { for (var _i = 0, _ii = cmds.length; _i < _ii; _i++) { current = cmds[_i]; - if (current.cmd === 'scale') { + + if (current.cmd === "scale") { current.args = [size, -size]; } + c[current.cmd].apply(c, current.args); } }; @@ -10509,37 +15025,34 @@ var FontFaceObject = function () { }(); exports.FontFaceObject = FontFaceObject; -exports.FontLoader = FontLoader; /***/ }), -/* 132 */ +/* 200 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.apiCompatibilityParams = void 0; + +var _is_node = __w_pdfjs_require__(7); + var compatibilityParams = Object.create(null); { - var isNodeJS = __w_pdfjs_require__(4); - var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || ''; - var isIE = /Trident/.test(userAgent); - var isIOSChrome = /CriOS/.test(userAgent); - (function checkOnBlobSupport() { - if (isIE || isIOSChrome) { - compatibilityParams.disableCreateObjectURL = true; - } - })(); - (function checkFontFaceAndImage() { - if (isNodeJS()) { + (function checkFontFace() { + if (_is_node.isNodeJS) { compatibilityParams.disableFontFace = true; - compatibilityParams.nativeImageDecoderSupport = 'none'; } })(); } -exports.apiCompatibilityParams = Object.freeze(compatibilityParams); +var apiCompatibilityParams = Object.freeze(compatibilityParams); +exports.apiCompatibilityParams = apiCompatibilityParams; /***/ }), -/* 133 */ +/* 201 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -10548,11 +15061,17 @@ exports.apiCompatibilityParams = Object.freeze(compatibilityParams); Object.defineProperty(exports, "__esModule", { value: true }); -exports.CanvasGraphics = undefined; +exports.CanvasGraphics = void 0; + +var _util = __w_pdfjs_require__(5); -var _util = __w_pdfjs_require__(1); +var _pattern_helper = __w_pdfjs_require__(202); -var _pattern_helper = __w_pdfjs_require__(134); +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var MIN_FONT_SIZE = 16; var MAX_FONT_SIZE = 100; @@ -10561,11 +15080,7 @@ var MIN_WIDTH_FACTOR = 0.65; var COMPILE_TYPE3_GLYPHS = true; var MAX_SIZE_TO_COMPILE = 1000; var FULL_CHUNK_HEIGHT = 16; -var IsLittleEndianCached = { - get value() { - return (0, _util.shadow)(IsLittleEndianCached, 'value', (0, _util.isLittleEndian)()); - } -}; + function addContextCurrentTransform(ctx) { if (!ctx.mozCurrentTransform) { ctx._originalSave = ctx.save; @@ -10577,12 +15092,12 @@ function addContextCurrentTransform(ctx) { ctx._originalSetTransform = ctx.setTransform; ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0]; ctx._transformStack = []; - Object.defineProperty(ctx, 'mozCurrentTransform', { + Object.defineProperty(ctx, "mozCurrentTransform", { get: function getCurrentTransform() { return this._transformMatrix; } }); - Object.defineProperty(ctx, 'mozCurrentTransformInverse', { + Object.defineProperty(ctx, "mozCurrentTransformInverse", { get: function getCurrentTransformInverse() { var m = this._transformMatrix; var a = m[0], @@ -10596,59 +15111,79 @@ function addContextCurrentTransform(ctx) { return [d / ad_bc, b / bc_ad, c / bc_ad, a / ad_bc, (d * e - c * f) / bc_ad, (b * e - a * f) / ad_bc]; } }); + ctx.save = function ctxSave() { var old = this._transformMatrix; + this._transformStack.push(old); + this._transformMatrix = old.slice(0, 6); + this._originalSave(); }; + ctx.restore = function ctxRestore() { var prev = this._transformStack.pop(); + if (prev) { this._transformMatrix = prev; + this._originalRestore(); } }; + ctx.translate = function ctxTranslate(x, y) { var m = this._transformMatrix; m[4] = m[0] * x + m[2] * y + m[4]; m[5] = m[1] * x + m[3] * y + m[5]; + this._originalTranslate(x, y); }; + ctx.scale = function ctxScale(x, y) { var m = this._transformMatrix; m[0] = m[0] * x; m[1] = m[1] * x; m[2] = m[2] * y; m[3] = m[3] * y; + this._originalScale(x, y); }; + ctx.transform = function ctxTransform(a, b, c, d, e, f) { var m = this._transformMatrix; this._transformMatrix = [m[0] * a + m[2] * b, m[1] * a + m[3] * b, m[0] * c + m[2] * d, m[1] * c + m[3] * d, m[0] * e + m[2] * f + m[4], m[1] * e + m[3] * f + m[5]]; + ctx._originalTransform(a, b, c, d, e, f); }; + ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) { this._transformMatrix = [a, b, c, d, e, f]; + ctx._originalSetTransform(a, b, c, d, e, f); }; + ctx.rotate = function ctxRotate(angle) { var cosValue = Math.cos(angle); var sinValue = Math.sin(angle); var m = this._transformMatrix; this._transformMatrix = [m[0] * cosValue + m[2] * sinValue, m[1] * cosValue + m[3] * sinValue, m[0] * -sinValue + m[2] * cosValue, m[1] * -sinValue + m[3] * cosValue, m[4], m[5]]; + this._originalRotate(angle); }; } } + var CachedCanvases = function CachedCanvasesClosure() { function CachedCanvases(canvasFactory) { this.canvasFactory = canvasFactory; this.cache = Object.create(null); } + CachedCanvases.prototype = { getCanvas: function CachedCanvases_getCanvas(id, width, height, trackTransform) { var canvasEntry; + if (this.cache[id] !== undefined) { canvasEntry = this.cache[id]; this.canvasFactory.reset(canvasEntry, width, height); @@ -10657,9 +15192,11 @@ var CachedCanvases = function CachedCanvasesClosure() { canvasEntry = this.canvasFactory.create(width, height); this.cache[id] = canvasEntry; } + if (trackTransform) { addContextCurrentTransform(canvasEntry.context); } + return canvasEntry; }, clear: function clear() { @@ -10672,6 +15209,7 @@ var CachedCanvases = function CachedCanvasesClosure() { }; return CachedCanvases; }(); + function compileType3Glyph(imgData) { var POINT_TO_PROCESS_LIMIT = 1000; var width = imgData.width, @@ -10687,96 +15225,126 @@ function compileType3Glyph(imgData) { var data = new Uint8Array(lineSize * height), pos = 0, ii; + for (i = 0, ii = data0.length; i < ii; i++) { var mask = 128, elem = data0[i]; + while (mask > 0) { data[pos++] = elem & mask ? 0 : 255; mask >>= 1; } } + var count = 0; pos = 0; + if (data[pos] !== 0) { points[0] = 1; ++count; } + for (j = 1; j < width; j++) { if (data[pos] !== data[pos + 1]) { points[j] = data[pos] ? 2 : 1; ++count; } + pos++; } + if (data[pos] !== 0) { points[j] = 2; ++count; } + for (i = 1; i < height; i++) { pos = i * lineSize; j0 = i * width1; + if (data[pos - lineSize] !== data[pos]) { points[j0] = data[pos] ? 1 : 8; ++count; } + var sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0); + for (j = 1; j < width; j++) { sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0); + if (POINT_TYPES[sum]) { points[j0 + j] = POINT_TYPES[sum]; ++count; } + pos++; } + if (data[pos - lineSize] !== data[pos]) { points[j0 + j] = data[pos] ? 2 : 4; ++count; } + if (count > POINT_TO_PROCESS_LIMIT) { return null; } } + pos = lineSize * (height - 1); j0 = i * width1; + if (data[pos] !== 0) { points[j0] = 8; ++count; } + for (j = 1; j < width; j++) { if (data[pos] !== data[pos + 1]) { points[j0 + j] = data[pos] ? 4 : 8; ++count; } + pos++; } + if (data[pos] !== 0) { points[j0 + j] = 4; ++count; } + if (count > POINT_TO_PROCESS_LIMIT) { return null; } + var steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]); var outlines = []; + for (i = 0; count && i <= height; i++) { var p = i * width1; var end = p + width; + while (p < end && !points[p]) { p++; } + if (p === end) { continue; } + var coords = [p % width1, i]; var type = points[p], p0 = p, pp; + do { var step = steps[type]; + do { p += step; } while (!points[p]); + pp = points[p]; + if (pp !== 5 && pp !== 10) { type = pp; points[p] = 0; @@ -10784,31 +15352,42 @@ function compileType3Glyph(imgData) { type = pp & 0x33 * type >> 4; points[p] &= type >> 2 | type << 2; } + coords.push(p % width1); coords.push(p / width1 | 0); - --count; + + if (!points[p]) { + --count; + } } while (p0 !== p); + outlines.push(coords); --i; } + var drawOutline = function drawOutline(c) { c.save(); c.scale(1 / width, -1 / height); c.translate(0, -height); c.beginPath(); - for (var i = 0, ii = outlines.length; i < ii; i++) { - var o = outlines[i]; + + for (var k = 0, kk = outlines.length; k < kk; k++) { + var o = outlines[k]; c.moveTo(o[0], o[1]); - for (var j = 2, jj = o.length; j < jj; j += 2) { - c.lineTo(o[j], o[j + 1]); + + for (var l = 2, ll = o.length; l < ll; l += 2) { + c.lineTo(o[l], o[l + 1]); } } + c.fill(); c.beginPath(); c.restore(); }; + return drawOutline; } + var CanvasExtraState = function CanvasExtraStateClosure() { function CanvasExtraState() { this.alphaIsShape = false; @@ -10827,8 +15406,8 @@ var CanvasExtraState = function CanvasExtraStateClosure() { this.textHScale = 1; this.textRenderingMode = _util.TextRenderingMode.FILL; this.textRise = 0; - this.fillColor = '#000000'; - this.strokeColor = '#000000'; + this.fillColor = "#000000"; + this.strokeColor = "#000000"; this.patternFill = false; this.fillAlpha = 1; this.strokeAlpha = 1; @@ -10836,6 +15415,7 @@ var CanvasExtraState = function CanvasExtraStateClosure() { this.activeSMask = null; this.resumeSMaskCtx = null; } + CanvasExtraState.prototype = { clone: function CanvasExtraState_clone() { return Object.create(this); @@ -10847,9 +15427,11 @@ var CanvasExtraState = function CanvasExtraStateClosure() { }; return CanvasExtraState; }(); + var CanvasGraphics = function CanvasGraphicsClosure() { var EXECUTION_TIME = 15; var EXECUTION_STEPS = 10; + function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, webGLContext, imageLayer) { this.ctx = canvasCtx; this.current = new CanvasExtraState(); @@ -10872,16 +15454,20 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.smaskCounter = 0; this.tempSMask = null; this.cachedCanvases = new CachedCanvases(this.canvasFactory); + if (canvasCtx) { addContextCurrentTransform(canvasCtx); } + this._cachedGetSinglePixelWidth = null; } + function putBinaryImageData(ctx, imgData) { - if (typeof ImageData !== 'undefined' && imgData instanceof ImageData) { + if (typeof ImageData !== "undefined" && imgData instanceof ImageData) { ctx.putImageData(imgData, 0, 0); return; } + var height = imgData.height, width = imgData.width; var partialChunkHeight = height % FULL_CHUNK_HEIGHT; @@ -10893,16 +15479,19 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var src = imgData.data; var dest = chunkImgData.data; var i, j, thisChunkHeight, elemsInThisChunk; + if (imgData.kind === _util.ImageKind.GRAYSCALE_1BPP) { var srcLength = src.byteLength; var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2); var dest32DataLength = dest32.length; var fullSrcDiff = width + 7 >> 3; - var white = 0xFFFFFFFF; - var black = IsLittleEndianCached.value ? 0xFF000000 : 0x000000FF; + var white = 0xffffffff; + var black = _util.IsLittleEndianCached.value ? 0xff000000 : 0x000000ff; + for (i = 0; i < totalChunks; i++) { thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; destPos = 0; + for (j = 0; j < thisChunkHeight; j++) { var srcDiff = srcLength - srcPos; var k = 0; @@ -10910,6 +15499,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var kEndUnrolled = kEnd & ~7; var mask = 0; var srcByte = 0; + for (; k < kEndUnrolled; k += 8) { srcByte = src[srcPos++]; dest32[destPos++] = srcByte & 128 ? white : black; @@ -10921,29 +15511,35 @@ var CanvasGraphics = function CanvasGraphicsClosure() { dest32[destPos++] = srcByte & 2 ? white : black; dest32[destPos++] = srcByte & 1 ? white : black; } + for (; k < kEnd; k++) { if (mask === 0) { srcByte = src[srcPos++]; mask = 128; } + dest32[destPos++] = srcByte & mask ? white : black; mask >>= 1; } } + while (destPos < dest32DataLength) { dest32[destPos++] = 0; } + ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); } } else if (imgData.kind === _util.ImageKind.RGBA_32BPP) { j = 0; elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4; + for (i = 0; i < fullChunks; i++) { dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); srcPos += elemsInThisChunk; ctx.putImageData(chunkImgData, 0, j); j += FULL_CHUNK_HEIGHT; } + if (i < totalChunks) { elemsInThisChunk = width * partialChunkHeight * 4; dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); @@ -10952,24 +15548,29 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } else if (imgData.kind === _util.ImageKind.RGB_24BPP) { thisChunkHeight = FULL_CHUNK_HEIGHT; elemsInThisChunk = width * thisChunkHeight; + for (i = 0; i < totalChunks; i++) { if (i >= fullChunks) { thisChunkHeight = partialChunkHeight; elemsInThisChunk = width * thisChunkHeight; } + destPos = 0; + for (j = elemsInThisChunk; j--;) { dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++]; dest[destPos++] = 255; } + ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); } } else { - throw new Error('bad image kind: ' + imgData.kind); + throw new Error("bad image kind: ".concat(imgData.kind)); } } + function putBinaryImageMask(ctx, imgData) { var height = imgData.height, width = imgData.width; @@ -10980,57 +15581,71 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var srcPos = 0; var src = imgData.data; var dest = chunkImgData.data; + for (var i = 0; i < totalChunks; i++) { var thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; var destPos = 3; + for (var j = 0; j < thisChunkHeight; j++) { var mask = 0; + for (var k = 0; k < width; k++) { if (!mask) { var elem = src[srcPos++]; mask = 128; } + dest[destPos] = elem & mask ? 0 : 255; destPos += 4; mask >>= 1; } } + ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); } } + function copyCtxState(sourceCtx, destCtx) { - var properties = ['strokeStyle', 'fillStyle', 'fillRule', 'globalAlpha', 'lineWidth', 'lineCap', 'lineJoin', 'miterLimit', 'globalCompositeOperation', 'font']; + var properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font"]; + for (var i = 0, ii = properties.length; i < ii; i++) { var property = properties[i]; + if (sourceCtx[property] !== undefined) { destCtx[property] = sourceCtx[property]; } } + if (sourceCtx.setLineDash !== undefined) { destCtx.setLineDash(sourceCtx.getLineDash()); destCtx.lineDashOffset = sourceCtx.lineDashOffset; } } + function resetCtxToDefault(ctx) { - ctx.strokeStyle = '#000000'; - ctx.fillStyle = '#000000'; - ctx.fillRule = 'nonzero'; + ctx.strokeStyle = "#000000"; + ctx.fillStyle = "#000000"; + ctx.fillRule = "nonzero"; ctx.globalAlpha = 1; ctx.lineWidth = 1; - ctx.lineCap = 'butt'; - ctx.lineJoin = 'miter'; + ctx.lineCap = "butt"; + ctx.lineJoin = "miter"; ctx.miterLimit = 10; - ctx.globalCompositeOperation = 'source-over'; - ctx.font = '10px sans-serif'; + ctx.globalCompositeOperation = "source-over"; + ctx.font = "10px sans-serif"; + if (ctx.setLineDash !== undefined) { ctx.setLineDash([]); ctx.lineDashOffset = 0; } } + function composeSMaskBackdrop(bytes, r0, g0, b0) { var length = bytes.length; + for (var i = 3; i < length; i += 4) { var alpha = bytes[i]; + if (alpha === 0) { bytes[i - 3] = r0; bytes[i - 2] = g0; @@ -11043,50 +15658,62 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } } } + function composeSMaskAlpha(maskData, layerData, transferMap) { var length = maskData.length; var scale = 1 / 255; + for (var i = 3; i < length; i += 4) { var alpha = transferMap ? transferMap[maskData[i]] : maskData[i]; layerData[i] = layerData[i] * alpha * scale | 0; } } + function composeSMaskLuminosity(maskData, layerData, transferMap) { var length = maskData.length; + for (var i = 3; i < length; i += 4) { var y = maskData[i - 3] * 77 + maskData[i - 2] * 152 + maskData[i - 1] * 28; layerData[i] = transferMap ? layerData[i] * transferMap[y >> 8] >> 8 : layerData[i] * y >> 16; } } + function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap) { var hasBackdrop = !!backdrop; var r0 = hasBackdrop ? backdrop[0] : 0; var g0 = hasBackdrop ? backdrop[1] : 0; var b0 = hasBackdrop ? backdrop[2] : 0; var composeFn; - if (subtype === 'Luminosity') { + + if (subtype === "Luminosity") { composeFn = composeSMaskLuminosity; } else { composeFn = composeSMaskAlpha; } + var PIXELS_TO_PROCESS = 1048576; var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width)); + for (var row = 0; row < height; row += chunkSize) { var chunkHeight = Math.min(chunkSize, height - row); var maskData = maskCtx.getImageData(0, row, width, chunkHeight); var layerData = layerCtx.getImageData(0, row, width, chunkHeight); + if (hasBackdrop) { composeSMaskBackdrop(maskData.data, r0, g0, b0); } + composeFn(maskData.data, layerData.data, transferMap); maskCtx.putImageData(layerData, 0, row); } } + function composeSMask(ctx, smask, layerCtx, webGLContext) { var mask = smask.canvas; var maskCtx = smask.context; ctx.setTransform(smask.scaleX, 0, 0, smask.scaleY, smask.offsetX, smask.offsetY); var backdrop = smask.backdrop || null; + if (!smask.transferMap && webGLContext.isEnabled) { var composed = webGLContext.composeSMask({ layer: layerCtx.canvas, @@ -11100,90 +15727,113 @@ var CanvasGraphics = function CanvasGraphicsClosure() { ctx.drawImage(composed, smask.offsetX, smask.offsetY); return; } + genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height, smask.subtype, backdrop, smask.transferMap); ctx.drawImage(mask, 0, 0); } - var LINE_CAP_STYLES = ['butt', 'round', 'square']; - var LINE_JOIN_STYLES = ['miter', 'round', 'bevel']; + + var LINE_CAP_STYLES = ["butt", "round", "square"]; + var LINE_JOIN_STYLES = ["miter", "round", "bevel"]; var NORMAL_CLIP = {}; var EO_CLIP = {}; CanvasGraphics.prototype = { beginDrawing: function beginDrawing(_ref) { var transform = _ref.transform, viewport = _ref.viewport, - transparency = _ref.transparency, + _ref$transparency = _ref.transparency, + transparency = _ref$transparency === void 0 ? false : _ref$transparency, _ref$background = _ref.background, - background = _ref$background === undefined ? null : _ref$background; - + background = _ref$background === void 0 ? null : _ref$background; var width = this.ctx.canvas.width; var height = this.ctx.canvas.height; this.ctx.save(); - this.ctx.fillStyle = background || 'rgb(255, 255, 255)'; + this.ctx.fillStyle = background || "rgb(255, 255, 255)"; this.ctx.fillRect(0, 0, width, height); this.ctx.restore(); + if (transparency) { - var transparentCanvas = this.cachedCanvases.getCanvas('transparent', width, height, true); + var transparentCanvas = this.cachedCanvases.getCanvas("transparent", width, height, true); this.compositeCtx = this.ctx; this.transparentCanvas = transparentCanvas.canvas; this.ctx = transparentCanvas.context; this.ctx.save(); this.ctx.transform.apply(this.ctx, this.compositeCtx.mozCurrentTransform); } + this.ctx.save(); resetCtxToDefault(this.ctx); + if (transform) { this.ctx.transform.apply(this.ctx, transform); } + this.ctx.transform.apply(this.ctx, viewport.transform); this.baseTransform = this.ctx.mozCurrentTransform.slice(); + if (this.imageLayer) { this.imageLayer.beginLayout(); } }, - executeOperatorList: function CanvasGraphics_executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) { var argsArray = operatorList.argsArray; var fnArray = operatorList.fnArray; var i = executionStartIdx || 0; var argsArrayLen = argsArray.length; + if (argsArrayLen === i) { return i; } - var chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === 'function'; + + var chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function"; var endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0; var steps = 0; var commonObjs = this.commonObjs; var objs = this.objs; var fnId; + while (true) { if (stepper !== undefined && i === stepper.nextBreakPoint) { stepper.breakIt(i, continueCallback); return i; } + fnId = fnArray[i]; + if (fnId !== _util.OPS.dependency) { this[fnId].apply(this, argsArray[i]); } else { - var deps = argsArray[i]; - for (var n = 0, nn = deps.length; n < nn; n++) { - var depObjId = deps[n]; - var common = depObjId[0] === 'g' && depObjId[1] === '_'; - var objsPool = common ? commonObjs : objs; - if (!objsPool.isResolved(depObjId)) { - objsPool.get(depObjId, continueCallback); - return i; + var _iterator = _createForOfIteratorHelper(argsArray[i]), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var depObjId = _step.value; + var objsPool = depObjId.startsWith("g_") ? commonObjs : objs; + + if (!objsPool.has(depObjId)) { + objsPool.get(depObjId, continueCallback); + return i; + } } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); } } + i++; + if (i === argsArrayLen) { return i; } + if (chunkOperations && ++steps > EXECUTION_STEPS) { if (Date.now() > endTime) { continueCallback(); return i; } + steps = 0; } } @@ -11192,7 +15842,9 @@ var CanvasGraphics = function CanvasGraphicsClosure() { if (this.current.activeSMask !== null) { this.endSMaskGroup(); } + this.ctx.restore(); + if (this.transparentCanvas) { this.ctx = this.compositeCtx; this.ctx.save(); @@ -11201,8 +15853,10 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.ctx.restore(); this.transparentCanvas = null; } + this.cachedCanvases.clear(); this.webGLContext.clear(); + if (this.imageLayer) { this.imageLayer.endLayout(); } @@ -11222,54 +15876,67 @@ var CanvasGraphics = function CanvasGraphicsClosure() { }, setDash: function CanvasGraphics_setDash(dashArray, dashPhase) { var ctx = this.ctx; + if (ctx.setLineDash !== undefined) { ctx.setLineDash(dashArray); ctx.lineDashOffset = dashPhase; } }, - setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) {}, - setFlatness: function CanvasGraphics_setFlatness(flatness) {}, + setRenderingIntent: function setRenderingIntent(intent) {}, + setFlatness: function setFlatness(flatness) {}, setGState: function CanvasGraphics_setGState(states) { for (var i = 0, ii = states.length; i < ii; i++) { var state = states[i]; var key = state[0]; var value = state[1]; + switch (key) { - case 'LW': + case "LW": this.setLineWidth(value); break; - case 'LC': + + case "LC": this.setLineCap(value); break; - case 'LJ': + + case "LJ": this.setLineJoin(value); break; - case 'ML': + + case "ML": this.setMiterLimit(value); break; - case 'D': + + case "D": this.setDash(value[0], value[1]); break; - case 'RI': + + case "RI": this.setRenderingIntent(value); break; - case 'FL': + + case "FL": this.setFlatness(value); break; - case 'Font': + + case "Font": this.setFont(value[0], value[1]); break; - case 'CA': + + case "CA": this.current.strokeAlpha = state[1]; break; - case 'ca': + + case "ca": this.current.fillAlpha = state[1]; this.ctx.globalAlpha = state[1]; break; - case 'BM': + + case "BM": this.ctx.globalCompositeOperation = value; break; - case 'SMask': + + case "SMask": if (this.current.activeSMask) { if (this.stateStack.length > 0 && this.stateStack[this.stateStack.length - 1].activeSMask === this.current.activeSMask) { this.suspendSMaskGroup(); @@ -11277,10 +15944,13 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.endSMaskGroup(); } } + this.current.activeSMask = value ? this.tempSMask : null; + if (this.current.activeSMask) { this.beginSMaskGroup(); } + this.tempSMask = null; break; } @@ -11290,7 +15960,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var activeSMask = this.current.activeSMask; var drawnWidth = activeSMask.canvas.width; var drawnHeight = activeSMask.canvas.height; - var cacheId = 'smaskGroupAt' + this.groupLevel; + var cacheId = "smaskGroupAt" + this.groupLevel; var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); var currentCtx = this.ctx; var currentTransform = currentCtx.mozCurrentTransform; @@ -11302,7 +15972,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { activeSMask.startTransformInverse = groupCtx.mozCurrentTransformInverse; copyCtxState(currentCtx, groupCtx); this.ctx = groupCtx; - this.setGState([['BM', 'source-over'], ['ca', 1], ['CA', 1]]); + this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]); this.groupStack.push(currentCtx); this.groupLevel++; }, @@ -11315,7 +15985,9 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.ctx.save(); copyCtxState(groupCtx, this.ctx); this.current.resumeSMaskCtx = groupCtx; + var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); + this.ctx.transform.apply(this.ctx, deltaTransform); groupCtx.save(); groupCtx.setTransform(1, 0, 0, 1, 0, 0); @@ -11336,7 +16008,9 @@ var CanvasGraphics = function CanvasGraphicsClosure() { composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext); this.ctx.restore(); copyCtxState(groupCtx, this.ctx); + var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); + this.ctx.transform.apply(this.ctx, deltaTransform); }, save: function CanvasGraphics_save() { @@ -11350,9 +16024,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() { 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 = this.stateStack.pop(); this.ctx.restore(); @@ -11369,6 +16045,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var current = this.current; var x = current.x, y = current.y; + for (var i = 0, j = 0, ii = ops.length; i < ii; i++) { switch (ops[i] | 0) { case _util.OPS.rectangle: @@ -11376,12 +16053,15 @@ var CanvasGraphics = function CanvasGraphicsClosure() { y = args[j++]; var width = args[j++]; var height = args[j++]; + if (width === 0) { width = this.getSinglePixelWidth(); } + if (height === 0) { height = this.getSinglePixelWidth(); } + var xw = x + width; var yh = y + height; this.ctx.moveTo(x, y); @@ -11391,61 +16071,76 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.ctx.lineTo(x, y); this.ctx.closePath(); break; + case _util.OPS.moveTo: x = args[j++]; y = args[j++]; ctx.moveTo(x, y); break; + case _util.OPS.lineTo: x = args[j++]; y = args[j++]; ctx.lineTo(x, y); break; + case _util.OPS.curveTo: x = args[j + 4]; y = args[j + 5]; ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y); j += 6; break; + case _util.OPS.curveTo2: ctx.bezierCurveTo(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: x = args[j + 2]; y = args[j + 3]; ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y); j += 4; break; + case _util.OPS.closePath: ctx.closePath(); break; } } + current.setCurrentPoint(x, y); }, closePath: function CanvasGraphics_closePath() { this.ctx.closePath(); }, stroke: function CanvasGraphics_stroke(consumePath) { - consumePath = typeof consumePath !== 'undefined' ? consumePath : true; + consumePath = typeof consumePath !== "undefined" ? consumePath : true; var ctx = this.ctx; var strokeColor = this.current.strokeColor; - ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth); ctx.globalAlpha = this.current.strokeAlpha; - if (strokeColor && strokeColor.hasOwnProperty('type') && strokeColor.type === 'Pattern') { + + if (strokeColor && strokeColor.hasOwnProperty("type") && strokeColor.type === "Pattern") { ctx.save(); + var transform = ctx.mozCurrentTransform; + + var scale = _util.Util.singularValueDecompose2dScale(transform)[0]; + ctx.strokeStyle = strokeColor.getPattern(ctx, this); + ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth * scale); ctx.stroke(); ctx.restore(); } else { + ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth); ctx.stroke(); } + if (consumePath) { this.consumePath(); } + ctx.globalAlpha = this.current.fillAlpha; }, closeStroke: function CanvasGraphics_closeStroke() { @@ -11453,28 +16148,34 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.stroke(); }, fill: function CanvasGraphics_fill(consumePath) { - consumePath = typeof consumePath !== 'undefined' ? consumePath : true; + consumePath = typeof consumePath !== "undefined" ? consumePath : true; var ctx = this.ctx; var fillColor = this.current.fillColor; var isPatternFill = this.current.patternFill; var needRestore = false; + if (isPatternFill) { ctx.save(); + if (this.baseTransform) { ctx.setTransform.apply(ctx, this.baseTransform); } + ctx.fillStyle = fillColor.getPattern(ctx, this); needRestore = true; } + if (this.pendingEOFill) { - ctx.fill('evenodd'); + ctx.fill("evenodd"); this.pendingEOFill = false; } else { ctx.fill(); } + if (needRestore) { ctx.restore(); } + if (consumePath) { this.consumePath(); } @@ -11519,18 +16220,22 @@ var CanvasGraphics = function CanvasGraphicsClosure() { endText: function CanvasGraphics_endText() { var paths = this.pendingTextPaths; var ctx = this.ctx; + if (paths === undefined) { ctx.beginPath(); return; } + ctx.save(); ctx.beginPath(); + for (var i = 0; i < paths.length; i++) { var path = paths[i]; ctx.setTransform.apply(ctx, path.transform); ctx.translate(path.x, path.y); path.addToPath(ctx, path.fontSize); } + ctx.restore(); ctx.clip(); ctx.beginPath(); @@ -11551,32 +16256,52 @@ var CanvasGraphics = function CanvasGraphicsClosure() { setFont: function CanvasGraphics_setFont(fontRefName, size) { var fontObj = this.commonObjs.get(fontRefName); var current = this.current; + if (!fontObj) { - throw new Error('Can\'t find font for ' + fontRefName); + throw new Error("Can't find font for ".concat(fontRefName)); } + current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; + if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) { - (0, _util.warn)('Invalid font matrix for font ' + fontRefName); + (0, _util.warn)("Invalid font matrix for font " + fontRefName); } + if (size < 0) { size = -size; current.fontDirection = -1; } else { current.fontDirection = 1; } + this.current.font = fontObj; this.current.fontSize = size; + if (fontObj.isType3Font) { return; } - var name = fontObj.loadedName || 'sans-serif'; - var bold = fontObj.black ? '900' : fontObj.bold ? 'bold' : 'normal'; - var italic = fontObj.italic ? 'italic' : 'normal'; - var typeface = '"' + name + '", ' + fontObj.fallbackName; - var browserFontSize = size < MIN_FONT_SIZE ? MIN_FONT_SIZE : size > MAX_FONT_SIZE ? MAX_FONT_SIZE : size; + + var name = fontObj.loadedName || "sans-serif"; + var bold = "normal"; + + if (fontObj.black) { + bold = "900"; + } else if (fontObj.bold) { + bold = "bold"; + } + + var italic = fontObj.italic ? "italic" : "normal"; + var typeface = "\"".concat(name, "\", ").concat(fontObj.fallbackName); + var browserFontSize = size; + + if (size < MIN_FONT_SIZE) { + browserFontSize = MIN_FONT_SIZE; + } else if (size > MAX_FONT_SIZE) { + browserFontSize = MAX_FONT_SIZE; + } + this.current.fontSizeScale = size / browserFontSize; - var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface; - this.ctx.font = rule; + this.ctx.font = "".concat(italic, " ").concat(bold, " ").concat(browserFontSize, "px ").concat(typeface); }, setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) { this.current.textRenderingMode = mode; @@ -11609,34 +16334,42 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var fontSize = current.fontSize / current.fontSizeScale; var fillStrokeMode = textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; var isAddToPathSet = !!(textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); - var patternFill = current.patternFill && font.data; + var patternFill = current.patternFill && !font.missingFile; var addToPath; + if (font.disableFontFace || isAddToPathSet || patternFill) { addToPath = font.getPathGenerator(this.commonObjs, character); } + if (font.disableFontFace || patternFill) { ctx.save(); ctx.translate(x, y); ctx.beginPath(); addToPath(ctx, fontSize); + if (patternTransform) { ctx.setTransform.apply(ctx, patternTransform); } + if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { ctx.fill(); } + if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { ctx.stroke(); } + ctx.restore(); } else { if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { ctx.fillText(character, x, y); } + if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { ctx.strokeText(character, x, y); } } + if (isAddToPathSet) { var paths = this.pendingTextPaths || (this.pendingTextPaths = []); paths.push({ @@ -11650,29 +16383,38 @@ var CanvasGraphics = function CanvasGraphicsClosure() { }, get isFontSubpixelAAEnabled() { - var ctx = this.canvasFactory.create(10, 10).context; + var _this$cachedCanvases$ = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10), + ctx = _this$cachedCanvases$.context; + ctx.scale(1.5, 1); - ctx.fillText('I', 0, 10); + ctx.fillText("I", 0, 10); var data = ctx.getImageData(0, 0, 10, 10).data; var enabled = false; + for (var i = 3; i < data.length; i += 4) { if (data[i] > 0 && data[i] < 255) { enabled = true; break; } } - return (0, _util.shadow)(this, 'isFontSubpixelAAEnabled', enabled); + + return (0, _util.shadow)(this, "isFontSubpixelAAEnabled", enabled); }, + showText: function CanvasGraphics_showText(glyphs) { var current = this.current; var font = current.font; + if (font.isType3Font) { return this.showType3Text(glyphs); } + var fontSize = current.fontSize; + if (fontSize === 0) { - return; + return undefined; } + var ctx = this.ctx; var fontSizeScale = current.fontSizeScale; var charSpacing = current.charSpacing; @@ -11686,7 +16428,8 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var widthAdvanceScale = fontSize * current.fontMatrix[0]; var simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill; ctx.save(); - var patternTransform = void 0; + var patternTransform; + if (current.patternFill) { ctx.save(); var pattern = current.fillColor.getPattern(ctx, this); @@ -11694,17 +16437,22 @@ var CanvasGraphics = function CanvasGraphicsClosure() { ctx.restore(); ctx.fillStyle = pattern; } + ctx.transform.apply(ctx, current.textMatrix); ctx.translate(current.x, current.y + current.textRise); + if (fontDirection > 0) { ctx.scale(textHScale, -1); } else { ctx.scale(textHScale, 1); } + var lineWidth = current.lineWidth; var scale = current.textMatrixScale; + if (scale === 0 || lineWidth === 0) { var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; + if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { this._cachedGetSinglePixelWidth = null; lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR; @@ -11712,25 +16460,31 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } else { lineWidth /= scale; } + if (fontSizeScale !== 1.0) { ctx.scale(fontSizeScale, fontSizeScale); lineWidth /= fontSizeScale; } + ctx.lineWidth = lineWidth; var x = 0, i; + for (i = 0; i < glyphsLength; ++i) { var glyph = glyphs[i]; + if ((0, _util.isNum)(glyph)) { x += spacingDir * glyph * fontSize / 1000; continue; } + var restoreNeeded = false; var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; var character = glyph.fontChar; var accent = glyph.accent; var scaledX, scaledY, scaledAccentX, scaledAccentY; var width = glyph.width; + if (vertical) { var vmetric, vx, vy; vmetric = glyph.vmetric || defaultVMetrics; @@ -11744,8 +16498,10 @@ var CanvasGraphics = function CanvasGraphicsClosure() { scaledX = x / fontSizeScale; scaledY = 0; } + if (font.remeasure && width > 0) { var measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale; + if (width < measuredWidth && this.isFontSubpixelAAEnabled) { var characterScaleX = width / measuredWidth; restoreNeeded = true; @@ -11756,11 +16512,13 @@ var CanvasGraphics = function CanvasGraphicsClosure() { scaledX += (width - measuredWidth) / 2000 * fontSize / fontSizeScale; } } + if (glyph.isInFont || font.missingFile) { if (simpleFillText && !accent) { ctx.fillText(character, scaledX, scaledY); } else { this.paintChar(character, scaledX, scaledY, patternTransform); + if (accent) { scaledAccentX = scaledX + accent.offset.x / fontSizeScale; scaledAccentY = scaledY - accent.offset.y / fontSizeScale; @@ -11768,17 +16526,28 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } } } - var charWidth = width * widthAdvanceScale + spacing * fontDirection; + + var charWidth; + + if (vertical) { + charWidth = width * widthAdvanceScale - spacing * fontDirection; + } else { + charWidth = width * widthAdvanceScale + spacing * fontDirection; + } + x += charWidth; + if (restoreNeeded) { ctx.restore(); } } + if (vertical) { - current.y -= x * textHScale; + current.y -= x; } else { current.x += x * textHScale; } + ctx.restore(); }, showType3Text: function CanvasGraphics_showType3Text(glyphs) { @@ -11795,39 +16564,49 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var glyphsLength = glyphs.length; var isTextInvisible = current.textRenderingMode === _util.TextRenderingMode.INVISIBLE; var i, glyph, width, spacingLength; + if (isTextInvisible || fontSize === 0) { return; } + this._cachedGetSinglePixelWidth = null; ctx.save(); ctx.transform.apply(ctx, current.textMatrix); ctx.translate(current.x, current.y); ctx.scale(textHScale, fontDirection); + for (i = 0; i < glyphsLength; ++i) { glyph = glyphs[i]; + if ((0, _util.isNum)(glyph)) { spacingLength = spacingDir * glyph * fontSize / 1000; this.ctx.translate(spacingLength, 0); current.x += spacingLength * textHScale; continue; } + var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; var operatorList = font.charProcOperatorList[glyph.operatorListId]; + if (!operatorList) { - (0, _util.warn)('Type3 character "' + glyph.operatorListId + '" is not available.'); + (0, _util.warn)("Type3 character \"".concat(glyph.operatorListId, "\" is not available.")); continue; } + this.processingType3 = glyph; this.save(); ctx.scale(fontSize, fontSize); ctx.transform.apply(ctx, fontMatrix); this.executeOperatorList(operatorList); this.restore(); + var transformed = _util.Util.applyTransform([glyph.width, 0], fontMatrix); + width = transformed[0] * fontSize + spacing; ctx.translate(width, 0); current.x += width * textHScale; } + ctx.restore(); this.processingType3 = null; }, @@ -11841,7 +16620,8 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var _this = this; var pattern; - if (IR[0] === 'TilingPattern') { + + if (IR[0] === "TilingPattern") { var color = IR[1]; var baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice(); var canvasGraphicsFactory = { @@ -11853,6 +16633,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } else { pattern = (0, _pattern_helper.getShadingPatternFromIR)(IR); } + return pattern; }, setStrokeColorN: function CanvasGraphics_setStrokeColorN() { @@ -11864,11 +16645,13 @@ var CanvasGraphics = function CanvasGraphicsClosure() { }, setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) { var color = _util.Util.makeCssRgb(r, g, b); + this.ctx.strokeStyle = color; this.current.strokeColor = color; }, setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) { var color = _util.Util.makeCssRgb(r, g, b); + this.ctx.fillStyle = color; this.current.fillColor = color; this.current.patternFill = false; @@ -11879,14 +16662,20 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var pattern = (0, _pattern_helper.getShadingPatternFromIR)(patternIR); ctx.fillStyle = pattern.getPattern(ctx, this, true); var inv = ctx.mozCurrentTransformInverse; + if (inv) { var canvas = ctx.canvas; var width = canvas.width; var height = canvas.height; + var bl = _util.Util.applyTransform([0, 0], inv); + var br = _util.Util.applyTransform([0, height], inv); + var ul = _util.Util.applyTransform([width, 0], inv); + var ur = _util.Util.applyTransform([width, height], inv); + var x0 = Math.min(bl[0], br[0], ul[0], ur[0]); var y0 = Math.min(bl[1], br[1], ul[1], ur[1]); var x1 = Math.max(bl[0], br[0], ul[0], ur[0]); @@ -11895,22 +16684,26 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } else { this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10); } + this.restore(); }, beginInlineImage: function CanvasGraphics_beginInlineImage() { - (0, _util.unreachable)('Should not call beginInlineImage'); + (0, _util.unreachable)("Should not call beginInlineImage"); }, beginImageData: function CanvasGraphics_beginImageData() { - (0, _util.unreachable)('Should not call beginImageData'); + (0, _util.unreachable)("Should not call beginImageData"); }, paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix, bbox) { this.save(); this.baseTransformStack.push(this.baseTransform); + if (Array.isArray(matrix) && matrix.length === 6) { this.transform.apply(this, matrix); } + this.baseTransform = this.ctx.mozCurrentTransform; - if (Array.isArray(bbox) && bbox.length === 4) { + + if (bbox) { var width = bbox[2] - bbox[0]; var height = bbox[3] - bbox[1]; this.ctx.rect(bbox[0], bbox[1], width, height); @@ -11925,20 +16718,27 @@ var CanvasGraphics = function CanvasGraphicsClosure() { beginGroup: function CanvasGraphics_beginGroup(group) { this.save(); var currentCtx = this.ctx; + if (!group.isolated) { - (0, _util.info)('TODO: Support non-isolated groups.'); + (0, _util.info)("TODO: Support non-isolated groups."); } + if (group.knockout) { - (0, _util.warn)('Knockout groups not supported.'); + (0, _util.warn)("Knockout groups not supported."); } + var currentTransform = currentCtx.mozCurrentTransform; + if (group.matrix) { currentCtx.transform.apply(currentCtx, group.matrix); } + if (!group.bbox) { - throw new Error('Bounding box is required.'); + throw new Error("Bounding box is required."); } + var bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform); + var canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height]; bounds = _util.Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0]; var offsetX = Math.floor(bounds[0]); @@ -11947,23 +16747,29 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1); var scaleX = 1, scaleY = 1; + if (drawnWidth > MAX_GROUP_SIZE) { scaleX = drawnWidth / MAX_GROUP_SIZE; drawnWidth = MAX_GROUP_SIZE; } + if (drawnHeight > MAX_GROUP_SIZE) { scaleY = drawnHeight / MAX_GROUP_SIZE; drawnHeight = MAX_GROUP_SIZE; } - var cacheId = 'groupAt' + this.groupLevel; + + var cacheId = "groupAt" + this.groupLevel; + if (group.smask) { - cacheId += '_smask_' + this.smaskCounter++ % 2; + cacheId += "_smask_" + this.smaskCounter++ % 2; } + var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); var groupCtx = scratchCanvas.context; groupCtx.scale(1 / scaleX, 1 / scaleY); groupCtx.translate(-offsetX, -offsetY); groupCtx.transform.apply(groupCtx, currentTransform); + if (group.smask) { this.smaskStack.push({ canvas: scratchCanvas.canvas, @@ -11982,9 +16788,10 @@ var CanvasGraphics = function CanvasGraphicsClosure() { currentCtx.translate(offsetX, offsetY); currentCtx.scale(scaleX, scaleY); } + copyCtxState(currentCtx, groupCtx); this.ctx = groupCtx; - this.setGState([['BM', 'source-over'], ['ca', 1], ['CA', 1]]); + this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]); this.groupStack.push(currentCtx); this.groupLevel++; this.current.activeSMask = null; @@ -11993,20 +16800,24 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.groupLevel--; var groupCtx = this.ctx; this.ctx = this.groupStack.pop(); + if (this.ctx.imageSmoothingEnabled !== undefined) { this.ctx.imageSmoothingEnabled = false; } else { this.ctx.mozImageSmoothingEnabled = false; } + if (group.smask) { this.tempSMask = this.smaskStack.pop(); } else { this.ctx.drawImage(groupCtx.canvas, 0, 0); } + this.restore(); }, beginAnnotations: function CanvasGraphics_beginAnnotations() { this.save(); + if (this.baseTransform) { this.ctx.setTransform.apply(this.ctx, this.baseTransform); } @@ -12018,6 +16829,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.save(); resetCtxToDefault(this.ctx); this.current = new CanvasExtraState(); + if (Array.isArray(rect) && rect.length === 4) { var width = rect[2] - rect[0]; var height = rect[3] - rect[1]; @@ -12025,35 +16837,13 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.clip(); this.endPath(); } + this.transform.apply(this, transform); this.transform.apply(this, matrix); }, endAnnotation: function CanvasGraphics_endAnnotation() { this.restore(); }, - paintJpegXObject: function CanvasGraphics_paintJpegXObject(objId, w, h) { - var domImage = this.objs.get(objId); - if (!domImage) { - (0, _util.warn)('Dependent image isn\'t ready yet'); - return; - } - this.save(); - var ctx = this.ctx; - ctx.scale(1 / w, -1 / h); - ctx.drawImage(domImage, 0, 0, domImage.width, domImage.height, 0, -h, w, h); - if (this.imageLayer) { - var currentTransform = ctx.mozCurrentTransformInverse; - var position = this.getCanvasPosition(0, 0); - this.imageLayer.appendImage({ - objId: objId, - left: position[0], - top: position[1], - width: w / currentTransform[0], - height: h / currentTransform[3] - }); - } - this.restore(); - }, paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) { var ctx = this.ctx; var width = img.width, @@ -12061,6 +16851,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var fillColor = this.current.fillColor; var isPatternFill = this.current.patternFill; var glyph = this.processingType3; + if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) { if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) { glyph.compiled = compileType3Glyph({ @@ -12072,15 +16863,17 @@ var CanvasGraphics = function CanvasGraphicsClosure() { glyph.compiled = null; } } + if (glyph && glyph.compiled) { glyph.compiled(ctx); return; } - var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', width, height); + + var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); var maskCtx = maskCanvas.context; maskCtx.save(); putBinaryImageMask(maskCtx, img); - maskCtx.globalCompositeOperation = 'source-in'; + maskCtx.globalCompositeOperation = "source-in"; maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; maskCtx.fillRect(0, 0, width, height); maskCtx.restore(); @@ -12091,15 +16884,16 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var height = imgData.height; var fillColor = this.current.fillColor; var isPatternFill = this.current.patternFill; - var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', width, height); + var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); var maskCtx = maskCanvas.context; maskCtx.save(); putBinaryImageMask(maskCtx, imgData); - maskCtx.globalCompositeOperation = 'source-in'; + maskCtx.globalCompositeOperation = "source-in"; maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; maskCtx.fillRect(0, 0, width, height); maskCtx.restore(); var ctx = this.ctx; + for (var i = 0, ii = positions.length; i < ii; i += 2) { ctx.save(); ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]); @@ -12112,15 +16906,16 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var ctx = this.ctx; var fillColor = this.current.fillColor; var isPatternFill = this.current.patternFill; + for (var i = 0, ii = images.length; i < ii; i++) { var image = images[i]; var width = image.width, height = image.height; - var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', width, height); + var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); var maskCtx = maskCanvas.context; maskCtx.save(); putBinaryImageMask(maskCtx, image); - maskCtx.globalCompositeOperation = 'source-in'; + maskCtx.globalCompositeOperation = "source-in"; maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; maskCtx.fillRect(0, 0, width, height); maskCtx.restore(); @@ -12132,22 +16927,27 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } }, paintImageXObject: function CanvasGraphics_paintImageXObject(objId) { - var imgData = this.objs.get(objId); + var imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId); + if (!imgData) { - (0, _util.warn)('Dependent image isn\'t ready yet'); + (0, _util.warn)("Dependent image isn't ready yet"); return; } + this.paintInlineImageXObject(imgData); }, paintImageXObjectRepeat: function CanvasGraphics_paintImageXObjectRepeat(objId, scaleX, scaleY, positions) { - var imgData = this.objs.get(objId); + var imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId); + if (!imgData) { - (0, _util.warn)('Dependent image isn\'t ready yet'); + (0, _util.warn)("Dependent image isn't ready yet"); return; } + var width = imgData.width; var height = imgData.height; var map = []; + for (var i = 0, ii = positions.length; i < ii; i += 2) { map.push({ transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]], @@ -12157,6 +16957,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { h: height }); } + this.paintInlineImageXObjectGroup(imgData, map); }, paintInlineImageXObject: function CanvasGraphics_paintInlineImageXObject(imgData) { @@ -12173,28 +16974,34 @@ var CanvasGraphics = function CanvasGraphicsClosure() { d = currentTransform[3]; var heightScale = Math.max(Math.sqrt(c * c + d * d), 1); var imgToPaint, tmpCanvas; - if (typeof HTMLElement === 'function' && imgData instanceof HTMLElement || !imgData.data) { + + if (typeof HTMLElement === "function" && imgData instanceof HTMLElement || !imgData.data) { imgToPaint = imgData; } else { - tmpCanvas = this.cachedCanvases.getCanvas('inlineImage', width, height); + tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height); var tmpCtx = tmpCanvas.context; putBinaryImageData(tmpCtx, imgData); imgToPaint = tmpCanvas.canvas; } + var paintWidth = width, paintHeight = height; - var tmpCanvasId = 'prescale1'; + var tmpCanvasId = "prescale1"; + while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) { var newWidth = paintWidth, newHeight = paintHeight; + if (widthScale > 2 && paintWidth > 1) { newWidth = Math.ceil(paintWidth / 2); widthScale /= paintWidth / newWidth; } + if (heightScale > 2 && paintHeight > 1) { newHeight = Math.ceil(paintHeight / 2); heightScale /= paintHeight / newHeight; } + tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight); tmpCtx = tmpCanvas.context; tmpCtx.clearRect(0, 0, newWidth, newHeight); @@ -12202,9 +17009,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() { imgToPaint = tmpCanvas.canvas; paintWidth = newWidth; paintHeight = newHeight; - tmpCanvasId = tmpCanvasId === 'prescale1' ? 'prescale2' : 'prescale1'; + tmpCanvasId = tmpCanvasId === "prescale1" ? "prescale2" : "prescale1"; } + ctx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, -height, width, height); + if (this.imageLayer) { var position = this.getCanvasPosition(0, -height); this.imageLayer.appendImage({ @@ -12215,1458 +17024,4211 @@ var CanvasGraphics = function CanvasGraphicsClosure() { height: height / currentTransform[3] }); } - this.restore(); + + this.restore(); + }, + paintInlineImageXObjectGroup: function CanvasGraphics_paintInlineImageXObjectGroup(imgData, map) { + var ctx = this.ctx; + var w = imgData.width; + var h = imgData.height; + var tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h); + var tmpCtx = tmpCanvas.context; + putBinaryImageData(tmpCtx, imgData); + + for (var i = 0, ii = map.length; i < ii; i++) { + var entry = map[i]; + ctx.save(); + ctx.transform.apply(ctx, entry.transform); + ctx.scale(1, -1); + ctx.drawImage(tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1); + + if (this.imageLayer) { + var position = this.getCanvasPosition(entry.x, entry.y); + this.imageLayer.appendImage({ + imgData: imgData, + left: position[0], + top: position[1], + width: w, + height: h + }); + } + + ctx.restore(); + } + }, + paintSolidColorImageMask: function CanvasGraphics_paintSolidColorImageMask() { + this.ctx.fillRect(0, 0, 1, 1); + }, + paintXObject: function CanvasGraphics_paintXObject() { + (0, _util.warn)("Unsupported 'paintXObject' command."); + }, + markPoint: function CanvasGraphics_markPoint(tag) {}, + markPointProps: function CanvasGraphics_markPointProps(tag, properties) {}, + beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {}, + beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(tag, properties) {}, + endMarkedContent: function CanvasGraphics_endMarkedContent() {}, + beginCompat: function CanvasGraphics_beginCompat() {}, + endCompat: function CanvasGraphics_endCompat() {}, + consumePath: function CanvasGraphics_consumePath() { + var ctx = this.ctx; + + if (this.pendingClip) { + if (this.pendingClip === EO_CLIP) { + ctx.clip("evenodd"); + } else { + ctx.clip(); + } + + this.pendingClip = null; + } + + ctx.beginPath(); + }, + getSinglePixelWidth: function getSinglePixelWidth(scale) { + if (this._cachedGetSinglePixelWidth === null) { + var inverse = this.ctx.mozCurrentTransformInverse; + this._cachedGetSinglePixelWidth = Math.sqrt(Math.max(inverse[0] * inverse[0] + inverse[1] * inverse[1], inverse[2] * inverse[2] + inverse[3] * inverse[3])); + } + + return this._cachedGetSinglePixelWidth; + }, + getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) { + var transform = this.ctx.mozCurrentTransform; + return [transform[0] * x + transform[2] * y + transform[4], transform[1] * x + transform[3] * y + transform[5]]; + } + }; + + for (var op in _util.OPS) { + CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op]; + } + + return CanvasGraphics; +}(); + +exports.CanvasGraphics = CanvasGraphics; + +/***/ }), +/* 202 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getShadingPatternFromIR = getShadingPatternFromIR; +exports.TilingPattern = void 0; + +var _util = __w_pdfjs_require__(5); + +var ShadingIRs = {}; + +function applyBoundingBox(ctx, bbox) { + if (!bbox || typeof Path2D === "undefined") { + return; + } + + var width = bbox[2] - bbox[0]; + var height = bbox[3] - bbox[1]; + var region = new Path2D(); + region.rect(bbox[0], bbox[1], width, height); + ctx.clip(region); +} + +ShadingIRs.RadialAxial = { + fromIR: function RadialAxial_fromIR(raw) { + var type = raw[1]; + var bbox = raw[2]; + var colorStops = raw[3]; + var p0 = raw[4]; + var p1 = raw[5]; + var r0 = raw[6]; + var r1 = raw[7]; + return { + type: "Pattern", + getPattern: function RadialAxial_getPattern(ctx) { + applyBoundingBox(ctx, bbox); + var grad; + + if (type === "axial") { + grad = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]); + } else if (type === "radial") { + grad = ctx.createRadialGradient(p0[0], p0[1], r0, p1[0], p1[1], r1); + } + + for (var i = 0, ii = colorStops.length; i < ii; ++i) { + var c = colorStops[i]; + grad.addColorStop(c[0], c[1]); + } + + return grad; + } + }; + } +}; + +var createMeshCanvas = function createMeshCanvasClosure() { + function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) { + var coords = context.coords, + colors = context.colors; + var bytes = data.data, + rowSize = data.width * 4; + var tmp; + + if (coords[p1 + 1] > coords[p2 + 1]) { + tmp = p1; + p1 = p2; + p2 = tmp; + tmp = c1; + c1 = c2; + c2 = tmp; + } + + if (coords[p2 + 1] > coords[p3 + 1]) { + tmp = p2; + p2 = p3; + p3 = tmp; + tmp = c2; + c2 = c3; + c3 = tmp; + } + + if (coords[p1 + 1] > coords[p2 + 1]) { + tmp = p1; + p1 = p2; + p2 = tmp; + tmp = c1; + c1 = c2; + c2 = tmp; + } + + var x1 = (coords[p1] + context.offsetX) * context.scaleX; + var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY; + var x2 = (coords[p2] + context.offsetX) * context.scaleX; + var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY; + var x3 = (coords[p3] + context.offsetX) * context.scaleX; + var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY; + + if (y1 >= y3) { + return; + } + + var c1r = colors[c1], + c1g = colors[c1 + 1], + c1b = colors[c1 + 2]; + var c2r = colors[c2], + c2g = colors[c2 + 1], + c2b = colors[c2 + 2]; + var c3r = colors[c3], + c3g = colors[c3 + 1], + c3b = colors[c3 + 2]; + var minY = Math.round(y1), + maxY = Math.round(y3); + var xa, car, cag, cab; + var xb, cbr, cbg, cbb; + + for (var y = minY; y <= maxY; y++) { + if (y < y2) { + var _k = void 0; + + if (y < y1) { + _k = 0; + } else if (y1 === y2) { + _k = 1; + } else { + _k = (y1 - y) / (y1 - y2); + } + + xa = x1 - (x1 - x2) * _k; + car = c1r - (c1r - c2r) * _k; + cag = c1g - (c1g - c2g) * _k; + cab = c1b - (c1b - c2b) * _k; + } else { + var _k2 = void 0; + + if (y > y3) { + _k2 = 1; + } else if (y2 === y3) { + _k2 = 0; + } else { + _k2 = (y2 - y) / (y2 - y3); + } + + xa = x2 - (x2 - x3) * _k2; + car = c2r - (c2r - c3r) * _k2; + cag = c2g - (c2g - c3g) * _k2; + cab = c2b - (c2b - c3b) * _k2; + } + + var k = void 0; + + if (y < y1) { + k = 0; + } else if (y > y3) { + k = 1; + } else { + k = (y1 - y) / (y1 - y3); + } + + xb = x1 - (x1 - x3) * k; + cbr = c1r - (c1r - c3r) * k; + cbg = c1g - (c1g - c3g) * k; + cbb = c1b - (c1b - c3b) * k; + var x1_ = Math.round(Math.min(xa, xb)); + var x2_ = Math.round(Math.max(xa, xb)); + var j = rowSize * y + x1_ * 4; + + for (var x = x1_; x <= x2_; x++) { + k = (xa - x) / (xa - xb); + + if (k < 0) { + k = 0; + } else if (k > 1) { + k = 1; + } + + bytes[j++] = car - (car - cbr) * k | 0; + bytes[j++] = cag - (cag - cbg) * k | 0; + bytes[j++] = cab - (cab - cbb) * k | 0; + bytes[j++] = 255; + } + } + } + + function drawFigure(data, figure, context) { + var ps = figure.coords; + var cs = figure.colors; + var i, ii; + + switch (figure.type) { + case "lattice": + var verticesPerRow = figure.verticesPerRow; + var rows = Math.floor(ps.length / verticesPerRow) - 1; + var cols = verticesPerRow - 1; + + for (i = 0; i < rows; i++) { + var q = i * verticesPerRow; + + for (var j = 0; j < cols; j++, q++) { + drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]); + drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]); + } + } + + break; + + case "triangles": + for (i = 0, ii = ps.length; i < ii; i += 3) { + drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]); + } + + break; + + default: + throw new Error("illegal figure"); + } + } + + function createMeshCanvas(bounds, combinesScale, coords, colors, figures, backgroundColor, cachedCanvases, webGLContext) { + var EXPECTED_SCALE = 1.1; + var MAX_PATTERN_SIZE = 3000; + var BORDER_SIZE = 2; + var offsetX = Math.floor(bounds[0]); + var offsetY = Math.floor(bounds[1]); + var boundsWidth = Math.ceil(bounds[2]) - offsetX; + var boundsHeight = Math.ceil(bounds[3]) - offsetY; + var width = Math.min(Math.ceil(Math.abs(boundsWidth * combinesScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); + var height = Math.min(Math.ceil(Math.abs(boundsHeight * combinesScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); + var scaleX = boundsWidth / width; + var scaleY = boundsHeight / height; + var context = { + coords: coords, + colors: colors, + offsetX: -offsetX, + offsetY: -offsetY, + scaleX: 1 / scaleX, + scaleY: 1 / scaleY + }; + var paddedWidth = width + BORDER_SIZE * 2; + var paddedHeight = height + BORDER_SIZE * 2; + var canvas, tmpCanvas, i, ii; + + if (webGLContext.isEnabled) { + canvas = webGLContext.drawFigures({ + width: width, + height: height, + backgroundColor: backgroundColor, + figures: figures, + context: context + }); + tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false); + tmpCanvas.context.drawImage(canvas, BORDER_SIZE, BORDER_SIZE); + canvas = tmpCanvas.canvas; + } else { + tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false); + var tmpCtx = tmpCanvas.context; + var data = tmpCtx.createImageData(width, height); + + if (backgroundColor) { + var bytes = data.data; + + for (i = 0, ii = bytes.length; i < ii; i += 4) { + bytes[i] = backgroundColor[0]; + bytes[i + 1] = backgroundColor[1]; + bytes[i + 2] = backgroundColor[2]; + bytes[i + 3] = 255; + } + } + + for (i = 0; i < figures.length; i++) { + drawFigure(data, figures[i], context); + } + + tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE); + canvas = tmpCanvas.canvas; + } + + return { + canvas: canvas, + offsetX: offsetX - BORDER_SIZE * scaleX, + offsetY: offsetY - BORDER_SIZE * scaleY, + scaleX: scaleX, + scaleY: scaleY + }; + } + + return createMeshCanvas; +}(); + +ShadingIRs.Mesh = { + fromIR: function Mesh_fromIR(raw) { + var coords = raw[2]; + var colors = raw[3]; + var figures = raw[4]; + var bounds = raw[5]; + var matrix = raw[6]; + var bbox = raw[7]; + var background = raw[8]; + return { + type: "Pattern", + getPattern: function Mesh_getPattern(ctx, owner, shadingFill) { + applyBoundingBox(ctx, bbox); + var scale; + + if (shadingFill) { + scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform); + } else { + scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform); + + if (matrix) { + var matrixScale = _util.Util.singularValueDecompose2dScale(matrix); + + scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]]; + } + } + + var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords, colors, figures, shadingFill ? null : background, owner.cachedCanvases, owner.webGLContext); + + if (!shadingFill) { + ctx.setTransform.apply(ctx, owner.baseTransform); + + if (matrix) { + ctx.transform.apply(ctx, matrix); + } + } + + ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY); + ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY); + return ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat"); + } + }; + } +}; +ShadingIRs.Dummy = { + fromIR: function Dummy_fromIR() { + return { + type: "Pattern", + getPattern: function Dummy_fromIR_getPattern() { + return "hotpink"; + } + }; + } +}; + +function getShadingPatternFromIR(raw) { + var shadingIR = ShadingIRs[raw[0]]; + + if (!shadingIR) { + throw new Error("Unknown IR type: ".concat(raw[0])); + } + + return shadingIR.fromIR(raw); +} + +var TilingPattern = function TilingPatternClosure() { + var PaintType = { + COLORED: 1, + UNCOLORED: 2 + }; + var MAX_PATTERN_SIZE = 3000; + + function TilingPattern(IR, color, ctx, canvasGraphicsFactory, baseTransform) { + this.operatorList = IR[2]; + this.matrix = IR[3] || [1, 0, 0, 1, 0, 0]; + this.bbox = IR[4]; + this.xstep = IR[5]; + this.ystep = IR[6]; + this.paintType = IR[7]; + this.tilingType = IR[8]; + this.color = color; + this.canvasGraphicsFactory = canvasGraphicsFactory; + this.baseTransform = baseTransform; + this.type = "Pattern"; + this.ctx = ctx; + } + + TilingPattern.prototype = { + createPatternCanvas: function TilinPattern_createPatternCanvas(owner) { + var operatorList = this.operatorList; + var bbox = this.bbox; + var xstep = this.xstep; + var ystep = this.ystep; + var paintType = this.paintType; + var tilingType = this.tilingType; + var color = this.color; + var canvasGraphicsFactory = this.canvasGraphicsFactory; + (0, _util.info)("TilingType: " + tilingType); + var x0 = bbox[0], + y0 = bbox[1], + x1 = bbox[2], + y1 = bbox[3]; + + var matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix); + + var curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform); + + var combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]]; + var dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]); + var dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]); + var tmpCanvas = owner.cachedCanvases.getCanvas("pattern", dimx.size, dimy.size, true); + var tmpCtx = tmpCanvas.context; + var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx); + graphics.groupLevel = owner.groupLevel; + this.setFillAndStrokeStyleToContext(graphics, paintType, color); + graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0); + graphics.transform(1, 0, 0, 1, -x0, -y0); + this.clipBbox(graphics, bbox, x0, y0, x1, y1); + graphics.executeOperatorList(operatorList); + this.ctx.transform(1, 0, 0, 1, x0, y0); + this.ctx.scale(1 / dimx.scale, 1 / dimy.scale); + return tmpCanvas.canvas; + }, + getSizeAndScale: function TilingPattern_getSizeAndScale(step, realOutputSize, scale) { + step = Math.abs(step); + var maxSize = Math.max(MAX_PATTERN_SIZE, realOutputSize); + var size = Math.ceil(step * scale); + + if (size >= maxSize) { + size = maxSize; + } else { + scale = size / step; + } + + return { + scale: scale, + size: size + }; + }, + clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) { + if (Array.isArray(bbox) && bbox.length === 4) { + var bboxWidth = x1 - x0; + var bboxHeight = y1 - y0; + graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight); + graphics.clip(); + graphics.endPath(); + } + }, + setFillAndStrokeStyleToContext: function setFillAndStrokeStyleToContext(graphics, paintType, color) { + var context = graphics.ctx, + current = graphics.current; + + switch (paintType) { + case PaintType.COLORED: + var ctx = this.ctx; + context.fillStyle = ctx.fillStyle; + context.strokeStyle = ctx.strokeStyle; + current.fillColor = ctx.fillStyle; + current.strokeColor = ctx.strokeStyle; + break; + + case PaintType.UNCOLORED: + var cssColor = _util.Util.makeCssRgb(color[0], color[1], color[2]); + + context.fillStyle = cssColor; + context.strokeStyle = cssColor; + current.fillColor = cssColor; + current.strokeColor = cssColor; + break; + + default: + throw new _util.FormatError("Unsupported paint type: ".concat(paintType)); + } + }, + getPattern: function TilingPattern_getPattern(ctx, owner) { + ctx = this.ctx; + ctx.setTransform.apply(ctx, this.baseTransform); + ctx.transform.apply(ctx, this.matrix); + var temporaryPatternCanvas = this.createPatternCanvas(owner); + return ctx.createPattern(temporaryPatternCanvas, "repeat"); + } + }; + return TilingPattern; +}(); + +exports.TilingPattern = TilingPattern; + +/***/ }), +/* 203 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.GlobalWorkerOptions = void 0; +var GlobalWorkerOptions = Object.create(null); +exports.GlobalWorkerOptions = GlobalWorkerOptions; +GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ? null : GlobalWorkerOptions.workerPort; +GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? "" : GlobalWorkerOptions.workerSrc; + +/***/ }), +/* 204 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.MessageHandler = void 0; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); + +var _util = __w_pdfjs_require__(5); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +var CallbackKind = { + UNKNOWN: 0, + DATA: 1, + ERROR: 2 +}; +var StreamKind = { + UNKNOWN: 0, + CANCEL: 1, + CANCEL_COMPLETE: 2, + CLOSE: 3, + ENQUEUE: 4, + ERROR: 5, + PULL: 6, + PULL_COMPLETE: 7, + START_COMPLETE: 8 +}; + +function wrapReason(reason) { + if (_typeof(reason) !== "object" || reason === null) { + return reason; + } + + switch (reason.name) { + case "AbortException": + return new _util.AbortException(reason.message); + + case "MissingPDFException": + return new _util.MissingPDFException(reason.message); + + case "UnexpectedResponseException": + return new _util.UnexpectedResponseException(reason.message, reason.status); + + case "UnknownErrorException": + return new _util.UnknownErrorException(reason.message, reason.details); + + default: + return new _util.UnknownErrorException(reason.message, reason.toString()); + } +} + +var MessageHandler = /*#__PURE__*/function () { + function MessageHandler(sourceName, targetName, comObj) { + var _this = this; + + _classCallCheck(this, MessageHandler); + + this.sourceName = sourceName; + this.targetName = targetName; + 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); + this.actionHandler = Object.create(null); + + this._onComObjOnMessage = function (event) { + var data = event.data; + + if (data.targetName !== _this.sourceName) { + return; + } + + if (data.stream) { + _this._processStreamMessage(data); + + return; + } + + if (data.callback) { + var callbackId = data.callbackId; + var capability = _this.callbackCapabilities[callbackId]; + + if (!capability) { + throw new Error("Cannot resolve callback ".concat(callbackId)); + } + + delete _this.callbackCapabilities[callbackId]; + + if (data.callback === CallbackKind.DATA) { + capability.resolve(data.data); + } else if (data.callback === CallbackKind.ERROR) { + capability.reject(wrapReason(data.reason)); + } else { + throw new Error("Unexpected callback case"); + } + + return; + } + + var action = _this.actionHandler[data.action]; + + if (!action) { + throw new Error("Unknown action from worker: ".concat(data.action)); + } + + if (data.callbackId) { + var cbSourceName = _this.sourceName; + var cbTargetName = data.sourceName; + new Promise(function (resolve) { + resolve(action(data.data)); + }).then(function (result) { + comObj.postMessage({ + sourceName: cbSourceName, + targetName: cbTargetName, + callback: CallbackKind.DATA, + callbackId: data.callbackId, + data: result + }); + }, function (reason) { + comObj.postMessage({ + sourceName: cbSourceName, + targetName: cbTargetName, + callback: CallbackKind.ERROR, + callbackId: data.callbackId, + reason: wrapReason(reason) + }); + }); + return; + } + + if (data.streamId) { + _this._createStreamSink(data); + + return; + } + + action(data.data); + }; + + comObj.addEventListener("message", this._onComObjOnMessage); + } + + _createClass(MessageHandler, [{ + key: "on", + value: function on(actionName, handler) { + var ah = this.actionHandler; + + if (ah[actionName]) { + throw new Error("There is already an actionName called \"".concat(actionName, "\"")); + } + + ah[actionName] = handler; + } + }, { + key: "send", + value: function send(actionName, data, transfers) { + this._postMessage({ + sourceName: this.sourceName, + targetName: this.targetName, + action: actionName, + data: data + }, transfers); + } + }, { + key: "sendWithPromise", + value: function sendWithPromise(actionName, data, transfers) { + var callbackId = this.callbackId++; + var capability = (0, _util.createPromiseCapability)(); + this.callbackCapabilities[callbackId] = capability; + + try { + this._postMessage({ + sourceName: this.sourceName, + targetName: this.targetName, + action: actionName, + callbackId: callbackId, + data: data + }, transfers); + } catch (ex) { + capability.reject(ex); + } + + return capability.promise; + } + }, { + key: "sendWithStream", + value: function sendWithStream(actionName, data, queueingStrategy, transfers) { + var _this2 = this; + + var streamId = this.streamId++; + var sourceName = this.sourceName; + var targetName = this.targetName; + var comObj = this.comObj; + return new ReadableStream({ + start: function start(controller) { + var startCapability = (0, _util.createPromiseCapability)(); + _this2.streamControllers[streamId] = { + controller: controller, + startCall: startCapability, + pullCall: null, + cancelCall: null, + isClosed: false + }; + + _this2._postMessage({ + sourceName: sourceName, + targetName: targetName, + action: actionName, + streamId: streamId, + data: data, + desiredSize: controller.desiredSize + }, transfers); + + return startCapability.promise; + }, + pull: function pull(controller) { + var pullCapability = (0, _util.createPromiseCapability)(); + _this2.streamControllers[streamId].pullCall = pullCapability; + comObj.postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.PULL, + streamId: streamId, + desiredSize: controller.desiredSize + }); + return pullCapability.promise; + }, + cancel: function cancel(reason) { + (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason"); + var cancelCapability = (0, _util.createPromiseCapability)(); + _this2.streamControllers[streamId].cancelCall = cancelCapability; + _this2.streamControllers[streamId].isClosed = true; + comObj.postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.CANCEL, + streamId: streamId, + reason: wrapReason(reason) + }); + return cancelCapability.promise; + } + }, queueingStrategy); + } + }, { + key: "_createStreamSink", + value: function _createStreamSink(data) { + var self = this; + var action = this.actionHandler[data.action]; + var streamId = data.streamId; + var sourceName = this.sourceName; + var targetName = data.sourceName; + var comObj = this.comObj; + var streamSink = { + enqueue: function enqueue(chunk) { + var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + var transfers = arguments.length > 2 ? arguments[2] : undefined; + + if (this.isCancelled) { + return; + } + + var lastDesiredSize = this.desiredSize; + this.desiredSize -= size; + + if (lastDesiredSize > 0 && this.desiredSize <= 0) { + this.sinkCapability = (0, _util.createPromiseCapability)(); + this.ready = this.sinkCapability.promise; + } + + self._postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.ENQUEUE, + streamId: streamId, + chunk: chunk + }, transfers); + }, + close: function close() { + if (this.isCancelled) { + return; + } + + this.isCancelled = true; + comObj.postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.CLOSE, + streamId: streamId + }); + delete self.streamSinks[streamId]; + }, + error: function error(reason) { + (0, _util.assert)(reason instanceof Error, "error must have a valid reason"); + + if (this.isCancelled) { + return; + } + + this.isCancelled = true; + comObj.postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.ERROR, + streamId: streamId, + reason: wrapReason(reason) + }); + }, + sinkCapability: (0, _util.createPromiseCapability)(), + onPull: null, + onCancel: null, + isCancelled: false, + desiredSize: data.desiredSize, + ready: null + }; + streamSink.sinkCapability.resolve(); + streamSink.ready = streamSink.sinkCapability.promise; + this.streamSinks[streamId] = streamSink; + new Promise(function (resolve) { + resolve(action(data.data, streamSink)); + }).then(function () { + comObj.postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.START_COMPLETE, + streamId: streamId, + success: true + }); + }, function (reason) { + comObj.postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.START_COMPLETE, + streamId: streamId, + reason: wrapReason(reason) + }); + }); + } + }, { + key: "_processStreamMessage", + value: function _processStreamMessage(data) { + var streamId = data.streamId; + var sourceName = this.sourceName; + var targetName = data.sourceName; + var comObj = this.comObj; + + switch (data.stream) { + case StreamKind.START_COMPLETE: + if (data.success) { + this.streamControllers[streamId].startCall.resolve(); + } else { + this.streamControllers[streamId].startCall.reject(wrapReason(data.reason)); + } + + break; + + case StreamKind.PULL_COMPLETE: + if (data.success) { + this.streamControllers[streamId].pullCall.resolve(); + } else { + this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason)); + } + + break; + + case StreamKind.PULL: + if (!this.streamSinks[streamId]) { + comObj.postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.PULL_COMPLETE, + streamId: streamId, + success: true + }); + break; + } + + if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) { + this.streamSinks[streamId].sinkCapability.resolve(); + } + + this.streamSinks[streamId].desiredSize = data.desiredSize; + var onPull = this.streamSinks[data.streamId].onPull; + new Promise(function (resolve) { + resolve(onPull && onPull()); + }).then(function () { + comObj.postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.PULL_COMPLETE, + streamId: streamId, + success: true + }); + }, function (reason) { + comObj.postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.PULL_COMPLETE, + streamId: streamId, + reason: wrapReason(reason) + }); + }); + break; + + case StreamKind.ENQUEUE: + (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller"); + + if (this.streamControllers[streamId].isClosed) { + break; + } + + this.streamControllers[streamId].controller.enqueue(data.chunk); + break; + + case StreamKind.CLOSE: + (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller"); + + if (this.streamControllers[streamId].isClosed) { + break; + } + + this.streamControllers[streamId].isClosed = true; + this.streamControllers[streamId].controller.close(); + + this._deleteStreamController(streamId); + + break; + + case StreamKind.ERROR: + (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller"); + this.streamControllers[streamId].controller.error(wrapReason(data.reason)); + + this._deleteStreamController(streamId); + + break; + + case StreamKind.CANCEL_COMPLETE: + if (data.success) { + this.streamControllers[streamId].cancelCall.resolve(); + } else { + this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason)); + } + + this._deleteStreamController(streamId); + + break; + + case StreamKind.CANCEL: + if (!this.streamSinks[streamId]) { + break; + } + + var onCancel = this.streamSinks[data.streamId].onCancel; + new Promise(function (resolve) { + resolve(onCancel && onCancel(wrapReason(data.reason))); + }).then(function () { + comObj.postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.CANCEL_COMPLETE, + streamId: streamId, + success: true + }); + }, function (reason) { + comObj.postMessage({ + sourceName: sourceName, + targetName: targetName, + stream: StreamKind.CANCEL_COMPLETE, + streamId: streamId, + reason: wrapReason(reason) + }); + }); + this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason)); + this.streamSinks[streamId].isCancelled = true; + delete this.streamSinks[streamId]; + break; + + default: + throw new Error("Unexpected stream case"); + } + } + }, { + key: "_deleteStreamController", + value: function () { + var _deleteStreamController2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(streamId) { + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) { + return capability && capability.promise; + })); + + case 2: + delete this.streamControllers[streamId]; + + case 3: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function _deleteStreamController(_x) { + return _deleteStreamController2.apply(this, arguments); + } + + return _deleteStreamController; + }() + }, { + key: "_postMessage", + value: function _postMessage(message, transfers) { + if (transfers && this.postMessageTransfers) { + this.comObj.postMessage(message, transfers); + } else { + this.comObj.postMessage(message); + } + } + }, { + key: "destroy", + value: function destroy() { + this.comObj.removeEventListener("message", this._onComObjOnMessage); + } + }]); + + return MessageHandler; +}(); + +exports.MessageHandler = MessageHandler; + +/***/ }), +/* 205 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Metadata = void 0; + +var _util = __w_pdfjs_require__(5); + +var _xml_parser = __w_pdfjs_require__(206); + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var Metadata = /*#__PURE__*/function () { + function Metadata(data) { + _classCallCheck(this, Metadata); + + (0, _util.assert)(typeof data === "string", "Metadata: input is not a string"); + data = this._repair(data); + var parser = new _xml_parser.SimpleXMLParser(); + var xmlDocument = parser.parseFromString(data); + this._metadataMap = new Map(); + + if (xmlDocument) { + this._parse(xmlDocument); + } + } + + _createClass(Metadata, [{ + key: "_repair", + value: function _repair(data) { + return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) { + var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) { + return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1); + }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) { + switch (name) { + case "amp": + return "&"; + + case "apos": + return "'"; + + case "gt": + return ">"; + + case "lt": + return "<"; + + case "quot": + return '"'; + } + + throw new Error("_repair: ".concat(name, " isn't defined.")); + }); + var chars = ""; + + for (var i = 0, ii = bytes.length; i < ii; i += 2) { + var code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); + + if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) { + chars += String.fromCharCode(code); + } else { + chars += "&#x" + (0x10000 + code).toString(16).substring(1) + ";"; + } + } + + return ">" + chars; + }); + } + }, { + key: "_parse", + value: function _parse(xmlDocument) { + var rdf = xmlDocument.documentElement; + + if (rdf.nodeName.toLowerCase() !== "rdf:rdf") { + rdf = rdf.firstChild; + + while (rdf && rdf.nodeName.toLowerCase() !== "rdf:rdf") { + rdf = rdf.nextSibling; + } + } + + var nodeName = rdf ? rdf.nodeName.toLowerCase() : null; + + if (!rdf || nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) { + return; + } + + var children = rdf.childNodes; + + for (var i = 0, ii = children.length; i < ii; i++) { + var desc = children[i]; + + if (desc.nodeName.toLowerCase() !== "rdf:description") { + continue; + } + + for (var j = 0, jj = desc.childNodes.length; j < jj; j++) { + if (desc.childNodes[j].nodeName.toLowerCase() !== "#text") { + var entry = desc.childNodes[j]; + var name = entry.nodeName.toLowerCase(); + + this._metadataMap.set(name, entry.textContent.trim()); + } + } + } + } + }, { + key: "get", + value: function get(name) { + return this._metadataMap.has(name) ? this._metadataMap.get(name) : null; + } + }, { + key: "getAll", + value: function getAll() { + var obj = Object.create(null); + + var _iterator = _createForOfIteratorHelper(this._metadataMap), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _step$value = _slicedToArray(_step.value, 2), + key = _step$value[0], + value = _step$value[1]; + + obj[key] = value; + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + return obj; + } + }, { + key: "has", + value: function has(name) { + return this._metadataMap.has(name); + } + }]); + + return Metadata; +}(); + +exports.Metadata = Metadata; + +/***/ }), +/* 206 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.SimpleXMLParser = void 0; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var XMLParserErrorCode = { + NoError: 0, + EndOfDocument: -1, + UnterminatedCdat: -2, + UnterminatedXmlDeclaration: -3, + UnterminatedDoctypeDeclaration: -4, + UnterminatedComment: -5, + MalformedElement: -6, + OutOfMemory: -7, + UnterminatedAttributeValue: -8, + UnterminatedElement: -9, + ElementNeverBegun: -10 +}; + +function isWhitespace(s, index) { + var ch = s[index]; + return ch === " " || ch === "\n" || ch === "\r" || ch === "\t"; +} + +function isWhitespaceString(s) { + for (var i = 0, ii = s.length; i < ii; i++) { + if (!isWhitespace(s, i)) { + return false; + } + } + + return true; +} + +var XMLParserBase = /*#__PURE__*/function () { + function XMLParserBase() { + _classCallCheck(this, XMLParserBase); + } + + _createClass(XMLParserBase, [{ + key: "_resolveEntities", + value: function _resolveEntities(s) { + var _this = this; + + return s.replace(/&([^;]+);/g, function (all, entity) { + if (entity.substring(0, 2) === "#x") { + return String.fromCharCode(parseInt(entity.substring(2), 16)); + } else if (entity.substring(0, 1) === "#") { + return String.fromCharCode(parseInt(entity.substring(1), 10)); + } + + switch (entity) { + case "lt": + return "<"; + + case "gt": + return ">"; + + case "amp": + return "&"; + + case "quot": + return '"'; + } + + return _this.onResolveEntity(entity); + }); + } + }, { + key: "_parseContent", + value: function _parseContent(s, start) { + var attributes = []; + var pos = start; + + function skipWs() { + while (pos < s.length && isWhitespace(s, pos)) { + ++pos; + } + } + + while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { + ++pos; + } + + var name = s.substring(start, pos); + skipWs(); + + while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") { + skipWs(); + var attrName = "", + attrValue = ""; + + while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") { + attrName += s[pos]; + ++pos; + } + + skipWs(); + + if (s[pos] !== "=") { + return null; + } + + ++pos; + skipWs(); + var attrEndChar = s[pos]; + + if (attrEndChar !== '"' && attrEndChar !== "'") { + return null; + } + + var attrEndIndex = s.indexOf(attrEndChar, ++pos); + + if (attrEndIndex < 0) { + return null; + } + + attrValue = s.substring(pos, attrEndIndex); + attributes.push({ + name: attrName, + value: this._resolveEntities(attrValue) + }); + pos = attrEndIndex + 1; + skipWs(); + } + + return { + name: name, + attributes: attributes, + parsed: pos - start + }; + } + }, { + key: "_parseProcessingInstruction", + value: function _parseProcessingInstruction(s, start) { + var pos = start; + + function skipWs() { + while (pos < s.length && isWhitespace(s, pos)) { + ++pos; + } + } + + while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { + ++pos; + } + + var name = s.substring(start, pos); + skipWs(); + var attrStart = pos; + + while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) { + ++pos; + } + + var value = s.substring(attrStart, pos); + return { + name: name, + value: value, + parsed: pos - start + }; + } + }, { + key: "parseXml", + value: function parseXml(s) { + var i = 0; + + while (i < s.length) { + var ch = s[i]; + var j = i; + + if (ch === "<") { + ++j; + var ch2 = s[j]; + var q = void 0; + + switch (ch2) { + case "/": + ++j; + q = s.indexOf(">", j); + + if (q < 0) { + this.onError(XMLParserErrorCode.UnterminatedElement); + return; + } + + this.onEndElement(s.substring(j, q)); + j = q + 1; + break; + + case "?": + ++j; + + var pi = this._parseProcessingInstruction(s, j); + + if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") { + this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration); + return; + } + + this.onPi(pi.name, pi.value); + j += pi.parsed + 2; + break; + + case "!": + if (s.substring(j + 1, j + 3) === "--") { + q = s.indexOf("-->", j + 3); + + if (q < 0) { + this.onError(XMLParserErrorCode.UnterminatedComment); + return; + } + + this.onComment(s.substring(j + 3, q)); + j = q + 3; + } else if (s.substring(j + 1, j + 8) === "[CDATA[") { + q = s.indexOf("]]>", j + 8); + + if (q < 0) { + this.onError(XMLParserErrorCode.UnterminatedCdat); + return; + } + + this.onCdata(s.substring(j + 8, q)); + j = q + 3; + } else if (s.substring(j + 1, j + 8) === "DOCTYPE") { + var q2 = s.indexOf("[", j + 8); + var complexDoctype = false; + q = s.indexOf(">", j + 8); + + if (q < 0) { + this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); + return; + } + + if (q2 > 0 && q > q2) { + q = s.indexOf("]>", j + 8); + + if (q < 0) { + this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); + return; + } + + complexDoctype = true; + } + + var doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0)); + this.onDoctype(doctypeContent); + j = q + (complexDoctype ? 2 : 1); + } else { + this.onError(XMLParserErrorCode.MalformedElement); + return; + } + + break; + + default: + var content = this._parseContent(s, j); + + if (content === null) { + this.onError(XMLParserErrorCode.MalformedElement); + return; + } + + var isClosed = false; + + if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") { + isClosed = true; + } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") { + this.onError(XMLParserErrorCode.UnterminatedElement); + return; + } + + this.onBeginElement(content.name, content.attributes, isClosed); + j += content.parsed + (isClosed ? 2 : 1); + break; + } + } else { + while (j < s.length && s[j] !== "<") { + j++; + } + + var text = s.substring(i, j); + this.onText(this._resolveEntities(text)); + } + + i = j; + } + } + }, { + key: "onResolveEntity", + value: function onResolveEntity(name) { + return "&".concat(name, ";"); + } + }, { + key: "onPi", + value: function onPi(name, value) {} + }, { + key: "onComment", + value: function onComment(text) {} + }, { + key: "onCdata", + value: function onCdata(text) {} + }, { + key: "onDoctype", + value: function onDoctype(doctypeContent) {} + }, { + key: "onText", + value: function onText(text) {} + }, { + key: "onBeginElement", + value: function onBeginElement(name, attributes, isEmpty) {} + }, { + key: "onEndElement", + value: function onEndElement(name) {} + }, { + key: "onError", + value: function onError(code) {} + }]); + + return XMLParserBase; +}(); + +var SimpleDOMNode = /*#__PURE__*/function () { + function SimpleDOMNode(nodeName, nodeValue) { + _classCallCheck(this, SimpleDOMNode); + + this.nodeName = nodeName; + this.nodeValue = nodeValue; + Object.defineProperty(this, "parentNode", { + value: null, + writable: true + }); + } + + _createClass(SimpleDOMNode, [{ + key: "hasChildNodes", + value: function hasChildNodes() { + return this.childNodes && this.childNodes.length > 0; + } + }, { + key: "firstChild", + get: function get() { + return this.childNodes && this.childNodes[0]; + } + }, { + key: "nextSibling", + get: function get() { + var childNodes = this.parentNode.childNodes; + + if (!childNodes) { + return undefined; + } + + var index = childNodes.indexOf(this); + + if (index === -1) { + return undefined; + } + + return childNodes[index + 1]; + } + }, { + key: "textContent", + get: function get() { + if (!this.childNodes) { + return this.nodeValue || ""; + } + + return this.childNodes.map(function (child) { + return child.textContent; + }).join(""); + } + }]); + + return SimpleDOMNode; +}(); + +var SimpleXMLParser = /*#__PURE__*/function (_XMLParserBase) { + _inherits(SimpleXMLParser, _XMLParserBase); + + var _super = _createSuper(SimpleXMLParser); + + function SimpleXMLParser() { + var _this2; + + _classCallCheck(this, SimpleXMLParser); + + _this2 = _super.call(this); + _this2._currentFragment = null; + _this2._stack = null; + _this2._errorCode = XMLParserErrorCode.NoError; + return _this2; + } + + _createClass(SimpleXMLParser, [{ + key: "parseFromString", + value: function parseFromString(data) { + this._currentFragment = []; + this._stack = []; + this._errorCode = XMLParserErrorCode.NoError; + this.parseXml(data); + + if (this._errorCode !== XMLParserErrorCode.NoError) { + return undefined; + } + + var _this$_currentFragmen = _slicedToArray(this._currentFragment, 1), + documentElement = _this$_currentFragmen[0]; + + if (!documentElement) { + return undefined; + } + + return { + documentElement: documentElement + }; + } + }, { + key: "onResolveEntity", + value: function onResolveEntity(name) { + switch (name) { + case "apos": + return "'"; + } + + return _get(_getPrototypeOf(SimpleXMLParser.prototype), "onResolveEntity", this).call(this, name); + } + }, { + key: "onText", + value: function onText(text) { + if (isWhitespaceString(text)) { + return; + } + + var node = new SimpleDOMNode("#text", text); + + this._currentFragment.push(node); + } + }, { + key: "onCdata", + value: function onCdata(text) { + var node = new SimpleDOMNode("#text", text); + + this._currentFragment.push(node); + } + }, { + key: "onBeginElement", + value: function onBeginElement(name, attributes, isEmpty) { + var node = new SimpleDOMNode(name); + node.childNodes = []; + + this._currentFragment.push(node); + + if (isEmpty) { + return; + } + + this._stack.push(this._currentFragment); + + this._currentFragment = node.childNodes; + } + }, { + key: "onEndElement", + value: function onEndElement(name) { + this._currentFragment = this._stack.pop() || []; + var lastElement = this._currentFragment[this._currentFragment.length - 1]; + + if (!lastElement) { + return; + } + + for (var i = 0, ii = lastElement.childNodes.length; i < ii; i++) { + lastElement.childNodes[i].parentNode = lastElement; + } + } + }, { + key: "onError", + value: function onError(code) { + this._errorCode = code; + } + }]); + + return SimpleXMLParser; +}(XMLParserBase); + +exports.SimpleXMLParser = SimpleXMLParser; + +/***/ }), +/* 207 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFDataTransportStream = void 0; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); + +var _util = __w_pdfjs_require__(5); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var PDFDataTransportStream = /*#__PURE__*/function () { + function PDFDataTransportStream(params, pdfDataRangeTransport) { + var _this = this; + + _classCallCheck(this, PDFDataTransportStream); + + (0, _util.assert)(pdfDataRangeTransport, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'); + this._queuedChunks = []; + this._progressiveDone = params.progressiveDone || false; + var initialData = params.initialData; + + if (initialData && initialData.length > 0) { + var buffer = new Uint8Array(initialData).buffer; + + this._queuedChunks.push(buffer); + } + + this._pdfDataRangeTransport = pdfDataRangeTransport; + this._isStreamingSupported = !params.disableStream; + this._isRangeSupported = !params.disableRange; + this._contentLength = params.length; + this._fullRequestReader = null; + this._rangeReaders = []; + + this._pdfDataRangeTransport.addRangeListener(function (begin, chunk) { + _this._onReceiveData({ + begin: begin, + chunk: chunk + }); + }); + + this._pdfDataRangeTransport.addProgressListener(function (loaded, total) { + _this._onProgress({ + loaded: loaded, + total: total + }); + }); + + this._pdfDataRangeTransport.addProgressiveReadListener(function (chunk) { + _this._onReceiveData({ + chunk: chunk + }); + }); + + this._pdfDataRangeTransport.addProgressiveDoneListener(function () { + _this._onProgressiveDone(); + }); + + this._pdfDataRangeTransport.transportReady(); + } + + _createClass(PDFDataTransportStream, [{ + key: "_onReceiveData", + value: function _onReceiveData(args) { + var buffer = new Uint8Array(args.chunk).buffer; + + if (args.begin === undefined) { + if (this._fullRequestReader) { + this._fullRequestReader._enqueue(buffer); + } else { + this._queuedChunks.push(buffer); + } + } else { + var found = this._rangeReaders.some(function (rangeReader) { + if (rangeReader._begin !== args.begin) { + return false; + } + + rangeReader._enqueue(buffer); + + return true; + }); + + (0, _util.assert)(found, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."); + } + } + }, { + key: "_onProgress", + value: function _onProgress(evt) { + if (evt.total === undefined) { + var firstReader = this._rangeReaders[0]; + + if (firstReader && firstReader.onProgress) { + firstReader.onProgress({ + loaded: evt.loaded + }); + } + } else { + var fullReader = this._fullRequestReader; + + if (fullReader && fullReader.onProgress) { + fullReader.onProgress({ + loaded: evt.loaded, + total: evt.total + }); + } + } + } + }, { + key: "_onProgressiveDone", + value: function _onProgressiveDone() { + if (this._fullRequestReader) { + this._fullRequestReader.progressiveDone(); + } + + this._progressiveDone = true; + } + }, { + key: "_removeRangeReader", + value: function _removeRangeReader(reader) { + var i = this._rangeReaders.indexOf(reader); + + if (i >= 0) { + this._rangeReaders.splice(i, 1); + } + } + }, { + key: "getFullReader", + value: function getFullReader() { + (0, _util.assert)(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once."); + var queuedChunks = this._queuedChunks; + this._queuedChunks = null; + return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone); + } + }, { + key: "getRangeReader", + value: function getRangeReader(begin, end) { + if (end <= this._progressiveDataLength) { + return null; + } + + var reader = new PDFDataTransportStreamRangeReader(this, begin, end); + + this._pdfDataRangeTransport.requestDataRange(begin, end); + + this._rangeReaders.push(reader); + + return reader; + } + }, { + key: "cancelAllRequests", + value: function cancelAllRequests(reason) { + if (this._fullRequestReader) { + this._fullRequestReader.cancel(reason); + } + + var readers = this._rangeReaders.slice(0); + + readers.forEach(function (rangeReader) { + rangeReader.cancel(reason); + }); + + this._pdfDataRangeTransport.abort(); + } + }, { + key: "_progressiveDataLength", + get: function get() { + return this._fullRequestReader ? this._fullRequestReader._loaded : 0; + } + }]); + + return PDFDataTransportStream; +}(); + +exports.PDFDataTransportStream = PDFDataTransportStream; + +var PDFDataTransportStreamReader = /*#__PURE__*/function () { + function PDFDataTransportStreamReader(stream, queuedChunks) { + var progressiveDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + _classCallCheck(this, PDFDataTransportStreamReader); + + this._stream = stream; + this._done = progressiveDone || false; + this._filename = null; + this._queuedChunks = queuedChunks || []; + this._loaded = 0; + + var _iterator = _createForOfIteratorHelper(this._queuedChunks), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var chunk = _step.value; + this._loaded += chunk.byteLength; + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + this._requests = []; + this._headersReady = Promise.resolve(); + stream._fullRequestReader = this; + this.onProgress = null; + } + + _createClass(PDFDataTransportStreamReader, [{ + key: "_enqueue", + value: function _enqueue(chunk) { + if (this._done) { + return; + } + + if (this._requests.length > 0) { + var requestCapability = this._requests.shift(); + + requestCapability.resolve({ + value: chunk, + done: false + }); + } else { + this._queuedChunks.push(chunk); + } + + this._loaded += chunk.byteLength; + } + }, { + key: "read", + value: function () { + var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() { + var chunk, requestCapability; + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!(this._queuedChunks.length > 0)) { + _context.next = 3; + break; + } + + chunk = this._queuedChunks.shift(); + return _context.abrupt("return", { + value: chunk, + done: false + }); + + case 3: + if (!this._done) { + _context.next = 5; + break; + } + + return _context.abrupt("return", { + value: undefined, + done: true + }); + + case 5: + requestCapability = (0, _util.createPromiseCapability)(); + + this._requests.push(requestCapability); + + return _context.abrupt("return", requestCapability.promise); + + case 8: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function read() { + return _read.apply(this, arguments); + } + + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + this._done = true; + + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); + }); + + this._requests = []; + } + }, { + key: "progressiveDone", + value: function progressiveDone() { + if (this._done) { + return; + } + + this._done = true; + } + }, { + key: "headersReady", + get: function get() { + return this._headersReady; + } + }, { + key: "filename", + get: function get() { + return this._filename; + } + }, { + key: "isRangeSupported", + get: function get() { + return this._stream._isRangeSupported; + } + }, { + key: "isStreamingSupported", + get: function get() { + return this._stream._isStreamingSupported; + } + }, { + key: "contentLength", + get: function get() { + return this._stream._contentLength; + } + }]); + + return PDFDataTransportStreamReader; +}(); + +var PDFDataTransportStreamRangeReader = /*#__PURE__*/function () { + function PDFDataTransportStreamRangeReader(stream, begin, end) { + _classCallCheck(this, PDFDataTransportStreamRangeReader); + + this._stream = stream; + this._begin = begin; + this._end = end; + this._queuedChunk = null; + this._requests = []; + this._done = false; + this.onProgress = null; + } + + _createClass(PDFDataTransportStreamRangeReader, [{ + key: "_enqueue", + value: function _enqueue(chunk) { + if (this._done) { + return; + } + + if (this._requests.length === 0) { + this._queuedChunk = chunk; + } else { + var requestsCapability = this._requests.shift(); + + requestsCapability.resolve({ + value: chunk, + done: false + }); + + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); + }); + + this._requests = []; + } + + this._done = true; + + this._stream._removeRangeReader(this); + } + }, { + key: "read", + value: function () { + var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() { + var chunk, requestCapability; + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (!this._queuedChunk) { + _context2.next = 4; + break; + } + + chunk = this._queuedChunk; + this._queuedChunk = null; + return _context2.abrupt("return", { + value: chunk, + done: false + }); + + case 4: + if (!this._done) { + _context2.next = 6; + break; + } + + return _context2.abrupt("return", { + value: undefined, + done: true + }); + + case 6: + requestCapability = (0, _util.createPromiseCapability)(); + + this._requests.push(requestCapability); + + return _context2.abrupt("return", requestCapability.promise); + + case 9: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function read() { + return _read2.apply(this, arguments); + } + + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + this._done = true; + + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); + }); + + this._requests = []; + + this._stream._removeRangeReader(this); + } + }, { + key: "isStreamingSupported", + get: function get() { + return false; + } + }]); + + return PDFDataTransportStreamRangeReader; +}(); + +/***/ }), +/* 208 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.WebGLContext = void 0; + +var _util = __w_pdfjs_require__(5); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var WebGLContext = /*#__PURE__*/function () { + function WebGLContext(_ref) { + var _ref$enable = _ref.enable, + enable = _ref$enable === void 0 ? false : _ref$enable; + + _classCallCheck(this, WebGLContext); + + this._enabled = enable === true; + } + + _createClass(WebGLContext, [{ + key: "composeSMask", + value: function composeSMask(_ref2) { + var layer = _ref2.layer, + mask = _ref2.mask, + properties = _ref2.properties; + return WebGLUtils.composeSMask(layer, mask, properties); + } + }, { + key: "drawFigures", + value: function drawFigures(_ref3) { + var width = _ref3.width, + height = _ref3.height, + backgroundColor = _ref3.backgroundColor, + figures = _ref3.figures, + context = _ref3.context; + return WebGLUtils.drawFigures(width, height, backgroundColor, figures, context); + } + }, { + key: "clear", + value: function clear() { + WebGLUtils.cleanup(); + } + }, { + key: "isEnabled", + get: function get() { + var enabled = this._enabled; + + if (enabled) { + enabled = WebGLUtils.tryInitGL(); + } + + return (0, _util.shadow)(this, "isEnabled", enabled); + } + }]); + + return WebGLContext; +}(); + +exports.WebGLContext = WebGLContext; + +var WebGLUtils = function WebGLUtilsClosure() { + function loadShader(gl, code, shaderType) { + var shader = gl.createShader(shaderType); + gl.shaderSource(shader, code); + gl.compileShader(shader); + var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS); + + if (!compiled) { + var errorMsg = gl.getShaderInfoLog(shader); + throw new Error("Error during shader compilation: " + errorMsg); + } + + return shader; + } + + function createVertexShader(gl, code) { + return loadShader(gl, code, gl.VERTEX_SHADER); + } + + function createFragmentShader(gl, code) { + return loadShader(gl, code, gl.FRAGMENT_SHADER); + } + + function createProgram(gl, shaders) { + var program = gl.createProgram(); + + for (var i = 0, ii = shaders.length; i < ii; ++i) { + gl.attachShader(program, shaders[i]); + } + + gl.linkProgram(program); + var linked = gl.getProgramParameter(program, gl.LINK_STATUS); + + if (!linked) { + var errorMsg = gl.getProgramInfoLog(program); + throw new Error("Error during program linking: " + errorMsg); + } + + return program; + } + + function createTexture(gl, image, textureId) { + gl.activeTexture(textureId); + var texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); + return texture; + } + + var currentGL, currentCanvas; + + function generateGL() { + if (currentGL) { + return; + } + + currentCanvas = document.createElement("canvas"); + currentGL = currentCanvas.getContext("webgl", { + premultipliedalpha: false + }); + } + + var smaskVertexShaderCode = "\ + attribute vec2 a_position; \ + attribute vec2 a_texCoord; \ + \ + uniform vec2 u_resolution; \ + \ + varying vec2 v_texCoord; \ + \ + void main() { \ + vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \ + gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ + \ + v_texCoord = a_texCoord; \ + } "; + var smaskFragmentShaderCode = "\ + precision mediump float; \ + \ + uniform vec4 u_backdrop; \ + uniform int u_subtype; \ + uniform sampler2D u_image; \ + uniform sampler2D u_mask; \ + \ + varying vec2 v_texCoord; \ + \ + void main() { \ + vec4 imageColor = texture2D(u_image, v_texCoord); \ + vec4 maskColor = texture2D(u_mask, v_texCoord); \ + if (u_backdrop.a > 0.0) { \ + maskColor.rgb = maskColor.rgb * maskColor.a + \ + u_backdrop.rgb * (1.0 - maskColor.a); \ + } \ + float lum; \ + if (u_subtype == 0) { \ + lum = maskColor.a; \ + } else { \ + lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \ + maskColor.b * 0.11; \ + } \ + imageColor.a *= lum; \ + imageColor.rgb *= imageColor.a; \ + gl_FragColor = imageColor; \ + } "; + var smaskCache = null; + + function initSmaskGL() { + var canvas, gl; + generateGL(); + canvas = currentCanvas; + currentCanvas = null; + gl = currentGL; + currentGL = null; + var vertexShader = createVertexShader(gl, smaskVertexShaderCode); + var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode); + var program = createProgram(gl, [vertexShader, fragmentShader]); + gl.useProgram(program); + var cache = {}; + cache.gl = gl; + cache.canvas = canvas; + cache.resolutionLocation = gl.getUniformLocation(program, "u_resolution"); + cache.positionLocation = gl.getAttribLocation(program, "a_position"); + cache.backdropLocation = gl.getUniformLocation(program, "u_backdrop"); + cache.subtypeLocation = gl.getUniformLocation(program, "u_subtype"); + var texCoordLocation = gl.getAttribLocation(program, "a_texCoord"); + var texLayerLocation = gl.getUniformLocation(program, "u_image"); + var texMaskLocation = gl.getUniformLocation(program, "u_mask"); + var texCoordBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0]), gl.STATIC_DRAW); + gl.enableVertexAttribArray(texCoordLocation); + gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0); + gl.uniform1i(texLayerLocation, 0); + gl.uniform1i(texMaskLocation, 1); + smaskCache = cache; + } + + function composeSMask(layer, mask, properties) { + var width = layer.width, + height = layer.height; + + if (!smaskCache) { + initSmaskGL(); + } + + var cache = smaskCache, + canvas = cache.canvas, + gl = cache.gl; + canvas.width = width; + canvas.height = height; + gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + gl.uniform2f(cache.resolutionLocation, width, height); + + if (properties.backdrop) { + gl.uniform4f(cache.resolutionLocation, properties.backdrop[0], properties.backdrop[1], properties.backdrop[2], 1); + } else { + gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0); + } + + gl.uniform1i(cache.subtypeLocation, properties.subtype === "Luminosity" ? 1 : 0); + var texture = createTexture(gl, layer, gl.TEXTURE0); + var maskTexture = createTexture(gl, mask, gl.TEXTURE1); + var buffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, width, 0, 0, height, 0, height, width, 0, width, height]), gl.STATIC_DRAW); + gl.enableVertexAttribArray(cache.positionLocation); + gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); + gl.clearColor(0, 0, 0, 0); + gl.enable(gl.BLEND); + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); + gl.clear(gl.COLOR_BUFFER_BIT); + gl.drawArrays(gl.TRIANGLES, 0, 6); + gl.flush(); + gl.deleteTexture(texture); + gl.deleteTexture(maskTexture); + gl.deleteBuffer(buffer); + return canvas; + } + + var figuresVertexShaderCode = "\ + attribute vec2 a_position; \ + attribute vec3 a_color; \ + \ + uniform vec2 u_resolution; \ + uniform vec2 u_scale; \ + uniform vec2 u_offset; \ + \ + varying vec4 v_color; \ + \ + void main() { \ + vec2 position = (a_position + u_offset) * u_scale; \ + vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \ + gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ + \ + v_color = vec4(a_color / 255.0, 1.0); \ + } "; + var figuresFragmentShaderCode = "\ + precision mediump float; \ + \ + varying vec4 v_color; \ + \ + void main() { \ + gl_FragColor = v_color; \ + } "; + var figuresCache = null; + + function initFiguresGL() { + var canvas, gl; + generateGL(); + canvas = currentCanvas; + currentCanvas = null; + gl = currentGL; + currentGL = null; + var vertexShader = createVertexShader(gl, figuresVertexShaderCode); + var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode); + var program = createProgram(gl, [vertexShader, fragmentShader]); + gl.useProgram(program); + var cache = {}; + cache.gl = gl; + cache.canvas = canvas; + cache.resolutionLocation = gl.getUniformLocation(program, "u_resolution"); + cache.scaleLocation = gl.getUniformLocation(program, "u_scale"); + cache.offsetLocation = gl.getUniformLocation(program, "u_offset"); + cache.positionLocation = gl.getAttribLocation(program, "a_position"); + cache.colorLocation = gl.getAttribLocation(program, "a_color"); + figuresCache = cache; + } + + function drawFigures(width, height, backgroundColor, figures, context) { + if (!figuresCache) { + initFiguresGL(); + } + + var cache = figuresCache, + canvas = cache.canvas, + gl = cache.gl; + canvas.width = width; + canvas.height = height; + gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + gl.uniform2f(cache.resolutionLocation, width, height); + var count = 0; + var i, ii, rows; + + for (i = 0, ii = figures.length; i < ii; i++) { + switch (figures[i].type) { + case "lattice": + rows = figures[i].coords.length / figures[i].verticesPerRow | 0; + count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6; + break; + + case "triangles": + count += figures[i].coords.length; + break; + } + } + + var coords = new Float32Array(count * 2); + var colors = new Uint8Array(count * 3); + var coordsMap = context.coords, + colorsMap = context.colors; + var pIndex = 0, + cIndex = 0; + + for (i = 0, ii = figures.length; i < ii; i++) { + var figure = figures[i], + ps = figure.coords, + cs = figure.colors; + + switch (figure.type) { + case "lattice": + var cols = figure.verticesPerRow; + rows = ps.length / cols | 0; + + for (var row = 1; row < rows; row++) { + var offset = row * cols + 1; + + for (var col = 1; col < cols; col++, offset++) { + coords[pIndex] = coordsMap[ps[offset - cols - 1]]; + coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1]; + coords[pIndex + 2] = coordsMap[ps[offset - cols]]; + coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1]; + coords[pIndex + 4] = coordsMap[ps[offset - 1]]; + coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1]; + colors[cIndex] = colorsMap[cs[offset - cols - 1]]; + colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1]; + colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2]; + colors[cIndex + 3] = colorsMap[cs[offset - cols]]; + colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1]; + colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2]; + colors[cIndex + 6] = colorsMap[cs[offset - 1]]; + colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1]; + colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2]; + coords[pIndex + 6] = coords[pIndex + 2]; + coords[pIndex + 7] = coords[pIndex + 3]; + coords[pIndex + 8] = coords[pIndex + 4]; + coords[pIndex + 9] = coords[pIndex + 5]; + coords[pIndex + 10] = coordsMap[ps[offset]]; + coords[pIndex + 11] = coordsMap[ps[offset] + 1]; + colors[cIndex + 9] = colors[cIndex + 3]; + colors[cIndex + 10] = colors[cIndex + 4]; + colors[cIndex + 11] = colors[cIndex + 5]; + colors[cIndex + 12] = colors[cIndex + 6]; + colors[cIndex + 13] = colors[cIndex + 7]; + colors[cIndex + 14] = colors[cIndex + 8]; + colors[cIndex + 15] = colorsMap[cs[offset]]; + colors[cIndex + 16] = colorsMap[cs[offset] + 1]; + colors[cIndex + 17] = colorsMap[cs[offset] + 2]; + pIndex += 12; + cIndex += 18; + } + } + + break; + + case "triangles": + for (var j = 0, jj = ps.length; j < jj; j++) { + coords[pIndex] = coordsMap[ps[j]]; + coords[pIndex + 1] = coordsMap[ps[j] + 1]; + colors[cIndex] = colorsMap[cs[j]]; + colors[cIndex + 1] = colorsMap[cs[j] + 1]; + colors[cIndex + 2] = colorsMap[cs[j] + 2]; + pIndex += 2; + cIndex += 3; + } + + break; + } + } + + if (backgroundColor) { + gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255, backgroundColor[2] / 255, 1.0); + } else { + gl.clearColor(0, 0, 0, 0); + } + + gl.clear(gl.COLOR_BUFFER_BIT); + var coordsBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer); + gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW); + gl.enableVertexAttribArray(cache.positionLocation); + gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); + var colorsBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer); + gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW); + gl.enableVertexAttribArray(cache.colorLocation); + gl.vertexAttribPointer(cache.colorLocation, 3, gl.UNSIGNED_BYTE, false, 0, 0); + gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY); + gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY); + gl.drawArrays(gl.TRIANGLES, 0, count); + gl.flush(); + gl.deleteBuffer(coordsBuffer); + gl.deleteBuffer(colorsBuffer); + return canvas; + } + + return { + tryInitGL: function tryInitGL() { + try { + generateGL(); + return !!currentGL; + } catch (ex) {} + + return false; }, - paintInlineImageXObjectGroup: function CanvasGraphics_paintInlineImageXObjectGroup(imgData, map) { - var ctx = this.ctx; - var w = imgData.width; - var h = imgData.height; - var tmpCanvas = this.cachedCanvases.getCanvas('inlineImage', w, h); - var tmpCtx = tmpCanvas.context; - putBinaryImageData(tmpCtx, imgData); - for (var i = 0, ii = map.length; i < ii; i++) { - var entry = map[i]; - ctx.save(); - ctx.transform.apply(ctx, entry.transform); - ctx.scale(1, -1); - ctx.drawImage(tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1); - if (this.imageLayer) { - var position = this.getCanvasPosition(entry.x, entry.y); - this.imageLayer.appendImage({ - imgData: imgData, - left: position[0], - top: position[1], - width: w, - height: h - }); - } - ctx.restore(); + composeSMask: composeSMask, + drawFigures: drawFigures, + cleanup: function cleanup() { + if (smaskCache && smaskCache.canvas) { + smaskCache.canvas.width = 0; + smaskCache.canvas.height = 0; } - }, - paintSolidColorImageMask: function CanvasGraphics_paintSolidColorImageMask() { - this.ctx.fillRect(0, 0, 1, 1); - }, - paintXObject: function CanvasGraphics_paintXObject() { - (0, _util.warn)('Unsupported \'paintXObject\' command.'); - }, - markPoint: function CanvasGraphics_markPoint(tag) {}, - markPointProps: function CanvasGraphics_markPointProps(tag, properties) {}, - beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {}, - beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(tag, properties) {}, - endMarkedContent: function CanvasGraphics_endMarkedContent() {}, - beginCompat: function CanvasGraphics_beginCompat() {}, - endCompat: function CanvasGraphics_endCompat() {}, - consumePath: function CanvasGraphics_consumePath() { - var ctx = this.ctx; - if (this.pendingClip) { - if (this.pendingClip === EO_CLIP) { - ctx.clip('evenodd'); - } else { - ctx.clip(); - } - this.pendingClip = null; + + if (figuresCache && figuresCache.canvas) { + figuresCache.canvas.width = 0; + figuresCache.canvas.height = 0; } - ctx.beginPath(); - }, - getSinglePixelWidth: function getSinglePixelWidth(scale) { - if (this._cachedGetSinglePixelWidth === null) { - var inverse = this.ctx.mozCurrentTransformInverse; - this._cachedGetSinglePixelWidth = Math.sqrt(Math.max(inverse[0] * inverse[0] + inverse[1] * inverse[1], inverse[2] * inverse[2] + inverse[3] * inverse[3])); + + smaskCache = null; + figuresCache = null; + } + }; +}(); + +/***/ }), +/* 209 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.AnnotationLayer = void 0; + +var _display_utils = __w_pdfjs_require__(1); + +var _util = __w_pdfjs_require__(5); + +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var AnnotationElementFactory = /*#__PURE__*/function () { + function AnnotationElementFactory() { + _classCallCheck(this, AnnotationElementFactory); + } + + _createClass(AnnotationElementFactory, null, [{ + key: "create", + value: function create(parameters) { + var subtype = parameters.data.annotationType; + + switch (subtype) { + case _util.AnnotationType.LINK: + return new LinkAnnotationElement(parameters); + + case _util.AnnotationType.TEXT: + return new TextAnnotationElement(parameters); + + case _util.AnnotationType.WIDGET: + var fieldType = parameters.data.fieldType; + + switch (fieldType) { + case "Tx": + return new TextWidgetAnnotationElement(parameters); + + case "Btn": + if (parameters.data.radioButton) { + return new RadioButtonWidgetAnnotationElement(parameters); + } else if (parameters.data.checkBox) { + return new CheckboxWidgetAnnotationElement(parameters); + } + + return new PushButtonWidgetAnnotationElement(parameters); + + case "Ch": + return new ChoiceWidgetAnnotationElement(parameters); + } + + return new WidgetAnnotationElement(parameters); + + case _util.AnnotationType.POPUP: + return new PopupAnnotationElement(parameters); + + case _util.AnnotationType.FREETEXT: + return new FreeTextAnnotationElement(parameters); + + case _util.AnnotationType.LINE: + return new LineAnnotationElement(parameters); + + case _util.AnnotationType.SQUARE: + return new SquareAnnotationElement(parameters); + + case _util.AnnotationType.CIRCLE: + return new CircleAnnotationElement(parameters); + + case _util.AnnotationType.POLYLINE: + return new PolylineAnnotationElement(parameters); + + case _util.AnnotationType.CARET: + return new CaretAnnotationElement(parameters); + + case _util.AnnotationType.INK: + return new InkAnnotationElement(parameters); + + case _util.AnnotationType.POLYGON: + return new PolygonAnnotationElement(parameters); + + case _util.AnnotationType.HIGHLIGHT: + return new HighlightAnnotationElement(parameters); + + case _util.AnnotationType.UNDERLINE: + return new UnderlineAnnotationElement(parameters); + + case _util.AnnotationType.SQUIGGLY: + return new SquigglyAnnotationElement(parameters); + + case _util.AnnotationType.STRIKEOUT: + return new StrikeOutAnnotationElement(parameters); + + case _util.AnnotationType.STAMP: + return new StampAnnotationElement(parameters); + + case _util.AnnotationType.FILEATTACHMENT: + return new FileAttachmentAnnotationElement(parameters); + + default: + return new AnnotationElement(parameters); } - return this._cachedGetSinglePixelWidth; - }, + } + }]); - getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) { - var transform = this.ctx.mozCurrentTransform; - return [transform[0] * x + transform[2] * y + transform[4], transform[1] * x + transform[3] * y + transform[5]]; + return AnnotationElementFactory; +}(); + +var AnnotationElement = /*#__PURE__*/function () { + function AnnotationElement(parameters) { + var isRenderable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var ignoreBorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + _classCallCheck(this, AnnotationElement); + + this.isRenderable = isRenderable; + this.data = parameters.data; + this.layer = parameters.layer; + this.page = parameters.page; + this.viewport = parameters.viewport; + this.linkService = parameters.linkService; + this.downloadManager = parameters.downloadManager; + this.imageResourcesPath = parameters.imageResourcesPath; + this.renderInteractiveForms = parameters.renderInteractiveForms; + this.svgFactory = parameters.svgFactory; + + if (isRenderable) { + this.container = this._createContainer(ignoreBorder); } - }; - for (var op in _util.OPS) { - CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op]; } - return CanvasGraphics; -}(); -exports.CanvasGraphics = CanvasGraphics; -/***/ }), -/* 134 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + _createClass(AnnotationElement, [{ + key: "_createContainer", + value: function _createContainer() { + var ignoreBorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var data = this.data, + page = this.page, + viewport = this.viewport; + var container = document.createElement("section"); + var width = data.rect[2] - data.rect[0]; + var height = data.rect[3] - data.rect[1]; + container.setAttribute("data-annotation-id", data.id); -"use strict"; + var 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(".concat(viewport.transform.join(","), ")"); + container.style.transformOrigin = "-".concat(rect[0], "px -").concat(rect[1], "px"); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.TilingPattern = exports.getShadingPatternFromIR = undefined; + if (!ignoreBorder && data.borderStyle.width > 0) { + container.style.borderWidth = "".concat(data.borderStyle.width, "px"); -var _util = __w_pdfjs_require__(1); + if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) { + width = width - 2 * data.borderStyle.width; + height = height - 2 * data.borderStyle.width; + } -var ShadingIRs = {}; -ShadingIRs.RadialAxial = { - fromIR: function RadialAxial_fromIR(raw) { - var type = raw[1]; - var colorStops = raw[2]; - var p0 = raw[3]; - var p1 = raw[4]; - var r0 = raw[5]; - var r1 = raw[6]; - return { - type: 'Pattern', - getPattern: function RadialAxial_getPattern(ctx) { - var grad; - if (type === 'axial') { - grad = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]); - } else if (type === 'radial') { - grad = ctx.createRadialGradient(p0[0], p0[1], r0, p1[0], p1[1], r1); + var horizontalRadius = data.borderStyle.horizontalCornerRadius; + var verticalRadius = data.borderStyle.verticalCornerRadius; + + if (horizontalRadius > 0 || verticalRadius > 0) { + var radius = "".concat(horizontalRadius, "px / ").concat(verticalRadius, "px"); + container.style.borderRadius = radius; } - for (var i = 0, ii = colorStops.length; i < ii; ++i) { - var c = colorStops[i]; - grad.addColorStop(c[0], c[1]); + + switch (data.borderStyle.style) { + case _util.AnnotationBorderStyleType.SOLID: + container.style.borderStyle = "solid"; + break; + + case _util.AnnotationBorderStyleType.DASHED: + container.style.borderStyle = "dashed"; + break; + + case _util.AnnotationBorderStyleType.BEVELED: + (0, _util.warn)("Unimplemented border style: beveled"); + break; + + case _util.AnnotationBorderStyleType.INSET: + (0, _util.warn)("Unimplemented border style: inset"); + break; + + case _util.AnnotationBorderStyleType.UNDERLINE: + container.style.borderBottomStyle = "solid"; + break; + + default: + break; + } + + if (data.color) { + container.style.borderColor = _util.Util.makeCssRgb(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0); + } else { + container.style.borderWidth = 0; } - return grad; } - }; - } -}; -var createMeshCanvas = function createMeshCanvasClosure() { - function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) { - var coords = context.coords, - colors = context.colors; - var bytes = data.data, - rowSize = data.width * 4; - var tmp; - if (coords[p1 + 1] > coords[p2 + 1]) { - tmp = p1; - p1 = p2; - p2 = tmp; - tmp = c1; - c1 = c2; - c2 = tmp; - } - if (coords[p2 + 1] > coords[p3 + 1]) { - tmp = p2; - p2 = p3; - p3 = tmp; - tmp = c2; - c2 = c3; - c3 = tmp; + + container.style.left = "".concat(rect[0], "px"); + container.style.top = "".concat(rect[1], "px"); + container.style.width = "".concat(width, "px"); + container.style.height = "".concat(height, "px"); + return container; } - if (coords[p1 + 1] > coords[p2 + 1]) { - tmp = p1; - p1 = p2; - p2 = tmp; - tmp = c1; - c1 = c2; - c2 = tmp; + }, { + key: "_createPopup", + value: function _createPopup(container, trigger, data) { + if (!trigger) { + trigger = document.createElement("div"); + trigger.style.height = container.style.height; + trigger.style.width = container.style.width; + container.appendChild(trigger); + } + + var popupElement = new PopupElement({ + container: container, + trigger: trigger, + color: data.color, + title: data.title, + modificationDate: data.modificationDate, + contents: data.contents, + hideWrapper: true + }); + var popup = popupElement.render(); + popup.style.left = container.style.width; + container.appendChild(popup); } - var x1 = (coords[p1] + context.offsetX) * context.scaleX; - var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY; - var x2 = (coords[p2] + context.offsetX) * context.scaleX; - var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY; - var x3 = (coords[p3] + context.offsetX) * context.scaleX; - var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY; - if (y1 >= y3) { - return; + }, { + key: "render", + value: function render() { + (0, _util.unreachable)("Abstract method `AnnotationElement.render` called"); } - var c1r = colors[c1], - c1g = colors[c1 + 1], - c1b = colors[c1 + 2]; - var c2r = colors[c2], - c2g = colors[c2 + 1], - c2b = colors[c2 + 2]; - var c3r = colors[c3], - c3g = colors[c3 + 1], - c3b = colors[c3 + 2]; - var minY = Math.round(y1), - maxY = Math.round(y3); - var xa, car, cag, cab; - var xb, cbr, cbg, cbb; - var k; - for (var y = minY; y <= maxY; y++) { - if (y < y2) { - k = y < y1 ? 0 : y1 === y2 ? 1 : (y1 - y) / (y1 - y2); - xa = x1 - (x1 - x2) * k; - car = c1r - (c1r - c2r) * k; - cag = c1g - (c1g - c2g) * k; - cab = c1b - (c1b - c2b) * k; + }]); + + return AnnotationElement; +}(); + +var LinkAnnotationElement = /*#__PURE__*/function (_AnnotationElement) { + _inherits(LinkAnnotationElement, _AnnotationElement); + + var _super = _createSuper(LinkAnnotationElement); + + function LinkAnnotationElement(parameters) { + _classCallCheck(this, LinkAnnotationElement); + + var isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action); + return _super.call(this, parameters, isRenderable); + } + + _createClass(LinkAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "linkAnnotation"; + var data = this.data, + linkService = this.linkService; + var link = document.createElement("a"); + + if (data.url) { + (0, _display_utils.addLinkAttributes)(link, { + url: data.url, + target: data.newWindow ? _display_utils.LinkTarget.BLANK : linkService.externalLinkTarget, + rel: linkService.externalLinkRel, + enabled: linkService.externalLinkEnabled + }); + } else if (data.action) { + this._bindNamedAction(link, data.action); } else { - k = y > y3 ? 1 : y2 === y3 ? 0 : (y2 - y) / (y2 - y3); - xa = x2 - (x2 - x3) * k; - car = c2r - (c2r - c3r) * k; - cag = c2g - (c2g - c3g) * k; - cab = c2b - (c2b - c3b) * k; - } - k = y < y1 ? 0 : y > y3 ? 1 : (y1 - y) / (y1 - y3); - xb = x1 - (x1 - x3) * k; - cbr = c1r - (c1r - c3r) * k; - cbg = c1g - (c1g - c3g) * k; - cbb = c1b - (c1b - c3b) * k; - var x1_ = Math.round(Math.min(xa, xb)); - var x2_ = Math.round(Math.max(xa, xb)); - var j = rowSize * y + x1_ * 4; - for (var x = x1_; x <= x2_; x++) { - k = (xa - x) / (xa - xb); - k = k < 0 ? 0 : k > 1 ? 1 : k; - bytes[j++] = car - (car - cbr) * k | 0; - bytes[j++] = cag - (cag - cbg) * k | 0; - bytes[j++] = cab - (cab - cbb) * k | 0; - bytes[j++] = 255; + this._bindLink(link, data.dest); } + + this.container.appendChild(link); + return this.container; } - } - function drawFigure(data, figure, context) { - var ps = figure.coords; - var cs = figure.colors; - var i, ii; - switch (figure.type) { - case 'lattice': - var verticesPerRow = figure.verticesPerRow; - var rows = Math.floor(ps.length / verticesPerRow) - 1; - var cols = verticesPerRow - 1; - for (i = 0; i < rows; i++) { - var q = i * verticesPerRow; - for (var j = 0; j < cols; j++, q++) { - drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]); - drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]); - } - } - break; - case 'triangles': - for (i = 0, ii = ps.length; i < ii; i += 3) { - drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]); + }, { + key: "_bindLink", + value: function _bindLink(link, destination) { + var _this = this; + + link.href = this.linkService.getDestinationHash(destination); + + link.onclick = function () { + if (destination) { + _this.linkService.navigateTo(destination); } - break; - default: - throw new Error('illegal figure'); + + return false; + }; + + if (destination) { + link.className = "internalLink"; + } + } + }, { + key: "_bindNamedAction", + value: function _bindNamedAction(link, action) { + var _this2 = this; + + link.href = this.linkService.getAnchorUrl(""); + + link.onclick = function () { + _this2.linkService.executeNamedAction(action); + + return false; + }; + + link.className = "internalLink"; } + }]); + + return LinkAnnotationElement; +}(AnnotationElement); + +var TextAnnotationElement = /*#__PURE__*/function (_AnnotationElement2) { + _inherits(TextAnnotationElement, _AnnotationElement2); + + var _super2 = _createSuper(TextAnnotationElement); + + function TextAnnotationElement(parameters) { + _classCallCheck(this, TextAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _super2.call(this, parameters, isRenderable); } - function createMeshCanvas(bounds, combinesScale, coords, colors, figures, backgroundColor, cachedCanvases, webGLContext) { - var EXPECTED_SCALE = 1.1; - var MAX_PATTERN_SIZE = 3000; - var BORDER_SIZE = 2; - var offsetX = Math.floor(bounds[0]); - var offsetY = Math.floor(bounds[1]); - var boundsWidth = Math.ceil(bounds[2]) - offsetX; - var boundsHeight = Math.ceil(bounds[3]) - offsetY; - var width = Math.min(Math.ceil(Math.abs(boundsWidth * combinesScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); - var height = Math.min(Math.ceil(Math.abs(boundsHeight * combinesScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); - var scaleX = boundsWidth / width; - var scaleY = boundsHeight / height; - var context = { - coords: coords, - colors: colors, - offsetX: -offsetX, - offsetY: -offsetY, - scaleX: 1 / scaleX, - scaleY: 1 / scaleY - }; - var paddedWidth = width + BORDER_SIZE * 2; - var paddedHeight = height + BORDER_SIZE * 2; - var canvas, tmpCanvas, i, ii; - if (webGLContext.isEnabled) { - canvas = webGLContext.drawFigures({ - width: width, - height: height, - backgroundColor: backgroundColor, - figures: figures, - context: context + + _createClass(TextAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "textAnnotation"; + var image = document.createElement("img"); + image.style.height = this.container.style.height; + image.style.width = this.container.style.width; + image.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg"; + image.alt = "[{{type}} Annotation]"; + image.dataset.l10nId = "text_annotation_type"; + image.dataset.l10nArgs = JSON.stringify({ + type: this.data.name }); - tmpCanvas = cachedCanvases.getCanvas('mesh', paddedWidth, paddedHeight, false); - tmpCanvas.context.drawImage(canvas, BORDER_SIZE, BORDER_SIZE); - canvas = tmpCanvas.canvas; - } else { - tmpCanvas = cachedCanvases.getCanvas('mesh', paddedWidth, paddedHeight, false); - var tmpCtx = tmpCanvas.context; - var data = tmpCtx.createImageData(width, height); - if (backgroundColor) { - var bytes = data.data; - for (i = 0, ii = bytes.length; i < ii; i += 4) { - bytes[i] = backgroundColor[0]; - bytes[i + 1] = backgroundColor[1]; - bytes[i + 2] = backgroundColor[2]; - bytes[i + 3] = 255; - } - } - for (i = 0; i < figures.length; i++) { - drawFigure(data, figures[i], context); + + if (!this.data.hasPopup) { + this._createPopup(this.container, image, this.data); } - tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE); - canvas = tmpCanvas.canvas; + + this.container.appendChild(image); + return this.container; } - return { - canvas: canvas, - offsetX: offsetX - BORDER_SIZE * scaleX, - offsetY: offsetY - BORDER_SIZE * scaleY, - scaleX: scaleX, - scaleY: scaleY - }; + }]); + + return TextAnnotationElement; +}(AnnotationElement); + +var WidgetAnnotationElement = /*#__PURE__*/function (_AnnotationElement3) { + _inherits(WidgetAnnotationElement, _AnnotationElement3); + + var _super3 = _createSuper(WidgetAnnotationElement); + + function WidgetAnnotationElement() { + _classCallCheck(this, WidgetAnnotationElement); + + return _super3.apply(this, arguments); } - return createMeshCanvas; -}(); -ShadingIRs.Mesh = { - fromIR: function Mesh_fromIR(raw) { - var coords = raw[2]; - var colors = raw[3]; - var figures = raw[4]; - var bounds = raw[5]; - var matrix = raw[6]; - var background = raw[8]; - return { - type: 'Pattern', - getPattern: function Mesh_getPattern(ctx, owner, shadingFill) { - var scale; - if (shadingFill) { - scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform); + + _createClass(WidgetAnnotationElement, [{ + key: "render", + value: function render() { + return this.container; + } + }]); + + return WidgetAnnotationElement; +}(AnnotationElement); + +var TextWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem) { + _inherits(TextWidgetAnnotationElement, _WidgetAnnotationElem); + + var _super4 = _createSuper(TextWidgetAnnotationElement); + + function TextWidgetAnnotationElement(parameters) { + _classCallCheck(this, TextWidgetAnnotationElement); + + var isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue; + return _super4.call(this, parameters, isRenderable); + } + + _createClass(TextWidgetAnnotationElement, [{ + key: "render", + value: function render() { + var TEXT_ALIGNMENT = ["left", "center", "right"]; + this.container.className = "textWidgetAnnotation"; + var element = null; + + if (this.renderInteractiveForms) { + if (this.data.multiLine) { + element = document.createElement("textarea"); + element.textContent = this.data.fieldValue; } else { - scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform); - if (matrix) { - var matrixScale = _util.Util.singularValueDecompose2dScale(matrix); - scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]]; - } + element = document.createElement("input"); + element.type = "text"; + element.setAttribute("value", this.data.fieldValue); } - var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords, colors, figures, shadingFill ? null : background, owner.cachedCanvases, owner.webGLContext); - if (!shadingFill) { - ctx.setTransform.apply(ctx, owner.baseTransform); - if (matrix) { - ctx.transform.apply(ctx, matrix); - } + + element.disabled = this.data.readOnly; + element.name = this.data.fieldName; + + if (this.data.maxLen !== null) { + element.maxLength = this.data.maxLen; } - ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY); - ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY); - return ctx.createPattern(temporaryPatternCanvas.canvas, 'no-repeat'); - } - }; - } -}; -ShadingIRs.Dummy = { - fromIR: function Dummy_fromIR() { - return { - type: 'Pattern', - getPattern: function Dummy_fromIR_getPattern() { - return 'hotpink'; - } - }; - } -}; -function getShadingPatternFromIR(raw) { - var shadingIR = ShadingIRs[raw[0]]; - if (!shadingIR) { - throw new Error('Unknown IR type: ' + raw[0]); - } - return shadingIR.fromIR(raw); -} -var TilingPattern = function TilingPatternClosure() { - var PaintType = { - COLORED: 1, - UNCOLORED: 2 - }; - var MAX_PATTERN_SIZE = 3000; - function TilingPattern(IR, color, ctx, canvasGraphicsFactory, baseTransform) { - this.operatorList = IR[2]; - this.matrix = IR[3] || [1, 0, 0, 1, 0, 0]; - this.bbox = IR[4]; - this.xstep = IR[5]; - this.ystep = IR[6]; - this.paintType = IR[7]; - this.tilingType = IR[8]; - this.color = color; - this.canvasGraphicsFactory = canvasGraphicsFactory; - this.baseTransform = baseTransform; - this.type = 'Pattern'; - this.ctx = ctx; - } - TilingPattern.prototype = { - createPatternCanvas: function TilinPattern_createPatternCanvas(owner) { - var operatorList = this.operatorList; - var bbox = this.bbox; - var xstep = this.xstep; - var ystep = this.ystep; - var paintType = this.paintType; - var tilingType = this.tilingType; - var color = this.color; - var canvasGraphicsFactory = this.canvasGraphicsFactory; - (0, _util.info)('TilingType: ' + tilingType); - var x0 = bbox[0], - y0 = bbox[1], - x1 = bbox[2], - y1 = bbox[3]; - var topLeft = [x0, y0]; - var botRight = [x0 + xstep, y0 + ystep]; - var width = botRight[0] - topLeft[0]; - var height = botRight[1] - topLeft[1]; - var matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix); - var curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform); - var combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]]; - width = Math.min(Math.ceil(Math.abs(width * combinedScale[0])), MAX_PATTERN_SIZE); - height = Math.min(Math.ceil(Math.abs(height * combinedScale[1])), MAX_PATTERN_SIZE); - var tmpCanvas = owner.cachedCanvases.getCanvas('pattern', width, height, true); - var tmpCtx = tmpCanvas.context; - var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx); - graphics.groupLevel = owner.groupLevel; - this.setFillAndStrokeStyleToContext(graphics, paintType, color); - this.setScale(width, height, xstep, ystep); - this.transformToScale(graphics); - var tmpTranslate = [1, 0, 0, 1, -topLeft[0], -topLeft[1]]; - graphics.transform.apply(graphics, tmpTranslate); - this.clipBbox(graphics, bbox, x0, y0, x1, y1); - graphics.executeOperatorList(operatorList); - return tmpCanvas.canvas; - }, - setScale: function TilingPattern_setScale(width, height, xstep, ystep) { - this.scale = [width / xstep, height / ystep]; - }, - transformToScale: function TilingPattern_transformToScale(graphics) { - var scale = this.scale; - var tmpScale = [scale[0], 0, 0, scale[1], 0, 0]; - graphics.transform.apply(graphics, tmpScale); - }, - scaleToContext: function TilingPattern_scaleToContext() { - var scale = this.scale; - this.ctx.scale(1 / scale[0], 1 / scale[1]); - }, - clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) { - if (Array.isArray(bbox) && bbox.length === 4) { - var bboxWidth = x1 - x0; - var bboxHeight = y1 - y0; - graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight); - graphics.clip(); - graphics.endPath(); + + if (this.data.comb) { + var fieldWidth = this.data.rect[2] - this.data.rect[0]; + var combWidth = fieldWidth / this.data.maxLen; + element.classList.add("comb"); + element.style.letterSpacing = "calc(".concat(combWidth, "px - 1ch)"); + } + } else { + element = document.createElement("div"); + element.textContent = this.data.fieldValue; + element.style.verticalAlign = "middle"; + element.style.display = "table-cell"; + var font = null; + + if (this.data.fontRefName && this.page.commonObjs.has(this.data.fontRefName)) { + font = this.page.commonObjs.get(this.data.fontRefName); + } + + this._setTextStyle(element, font); } - }, - setFillAndStrokeStyleToContext: function setFillAndStrokeStyleToContext(graphics, paintType, color) { - var context = graphics.ctx, - current = graphics.current; - switch (paintType) { - case PaintType.COLORED: - var ctx = this.ctx; - context.fillStyle = ctx.fillStyle; - context.strokeStyle = ctx.strokeStyle; - current.fillColor = ctx.fillStyle; - current.strokeColor = ctx.strokeStyle; - break; - case PaintType.UNCOLORED: - var cssColor = _util.Util.makeCssRgb(color[0], color[1], color[2]); - context.fillStyle = cssColor; - context.strokeStyle = cssColor; - current.fillColor = cssColor; - current.strokeColor = cssColor; - break; - default: - throw new _util.FormatError('Unsupported paint type: ' + paintType); + + if (this.data.textAlignment !== null) { + element.style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment]; } - }, - getPattern: function TilingPattern_getPattern(ctx, owner) { - var temporaryPatternCanvas = this.createPatternCanvas(owner); - ctx = this.ctx; - ctx.setTransform.apply(ctx, this.baseTransform); - ctx.transform.apply(ctx, this.matrix); - this.scaleToContext(); - return ctx.createPattern(temporaryPatternCanvas, 'repeat'); + + this.container.appendChild(element); + return this.container; } - }; - return TilingPattern; -}(); -exports.getShadingPatternFromIR = getShadingPatternFromIR; -exports.TilingPattern = TilingPattern; + }, { + key: "_setTextStyle", + value: function _setTextStyle(element, font) { + var style = element.style; + style.fontSize = "".concat(this.data.fontSize, "px"); + style.direction = this.data.fontDirection < 0 ? "rtl" : "ltr"; -/***/ }), -/* 135 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + if (!font) { + return; + } -"use strict"; + var bold = "normal"; + if (font.black) { + bold = "900"; + } else if (font.bold) { + bold = "bold"; + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -var GlobalWorkerOptions = Object.create(null); -GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ? null : GlobalWorkerOptions.workerPort; -GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? '' : GlobalWorkerOptions.workerSrc; -exports.GlobalWorkerOptions = GlobalWorkerOptions; + style.fontWeight = bold; + style.fontStyle = font.italic ? "italic" : "normal"; + var fontFamily = font.loadedName ? "\"".concat(font.loadedName, "\", ") : ""; + var fallbackName = font.fallbackName || "Helvetica, sans-serif"; + style.fontFamily = fontFamily + fallbackName; + } + }]); -/***/ }), -/* 136 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return TextWidgetAnnotationElement; +}(WidgetAnnotationElement); -"use strict"; +var CheckboxWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem2) { + _inherits(CheckboxWidgetAnnotationElement, _WidgetAnnotationElem2); + var _super5 = _createSuper(CheckboxWidgetAnnotationElement); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.MessageHandler = undefined; + function CheckboxWidgetAnnotationElement(parameters) { + _classCallCheck(this, CheckboxWidgetAnnotationElement); -var _regenerator = __w_pdfjs_require__(137); + return _super5.call(this, parameters, parameters.renderInteractiveForms); + } -var _regenerator2 = _interopRequireDefault(_regenerator); + _createClass(CheckboxWidgetAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "buttonWidgetAnnotation checkBox"; + var element = document.createElement("input"); + element.disabled = this.data.readOnly; + element.type = "checkbox"; + element.name = this.data.fieldName; -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + if (this.data.fieldValue && this.data.fieldValue !== "Off") { + element.setAttribute("checked", true); + } -var resolveCall = function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(fn, args) { - var thisArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - return _regenerator2.default.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (fn) { - _context.next = 2; - break; - } + this.container.appendChild(element); + return this.container; + } + }]); + + return CheckboxWidgetAnnotationElement; +}(WidgetAnnotationElement); - return _context.abrupt('return'); +var RadioButtonWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem3) { + _inherits(RadioButtonWidgetAnnotationElement, _WidgetAnnotationElem3); - case 2: - return _context.abrupt('return', fn.apply(thisArg, args)); + var _super6 = _createSuper(RadioButtonWidgetAnnotationElement); - case 3: - case 'end': - return _context.stop(); - } + function RadioButtonWidgetAnnotationElement(parameters) { + _classCallCheck(this, RadioButtonWidgetAnnotationElement); + + return _super6.call(this, parameters, parameters.renderInteractiveForms); + } + + _createClass(RadioButtonWidgetAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "buttonWidgetAnnotation radioButton"; + var element = document.createElement("input"); + element.disabled = this.data.readOnly; + element.type = "radio"; + element.name = this.data.fieldName; + + if (this.data.fieldValue === this.data.buttonValue) { + element.setAttribute("checked", true); } - }, _callee, this); - })); - return function resolveCall(_x2, _x3) { - return _ref.apply(this, arguments); - }; -}(); + this.container.appendChild(element); + return this.container; + } + }]); -var _util = __w_pdfjs_require__(1); + return RadioButtonWidgetAnnotationElement; +}(WidgetAnnotationElement); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var PushButtonWidgetAnnotationElement = /*#__PURE__*/function (_LinkAnnotationElemen) { + _inherits(PushButtonWidgetAnnotationElement, _LinkAnnotationElemen); -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + var _super7 = _createSuper(PushButtonWidgetAnnotationElement); -function wrapReason(reason) { - if ((typeof reason === 'undefined' ? 'undefined' : _typeof(reason)) !== 'object') { - return reason; - } - switch (reason.name) { - case 'AbortException': - return new _util.AbortException(reason.message); - case 'MissingPDFException': - return new _util.MissingPDFException(reason.message); - case 'UnexpectedResponseException': - return new _util.UnexpectedResponseException(reason.message, reason.status); - default: - return new _util.UnknownErrorException(reason.message, reason.details); - } -} -function makeReasonSerializable(reason) { - if (!(reason instanceof Error) || reason instanceof _util.AbortException || reason instanceof _util.MissingPDFException || reason instanceof _util.UnexpectedResponseException || reason instanceof _util.UnknownErrorException) { - return reason; - } - return new _util.UnknownErrorException(reason.message, reason.toString()); -} -function resolveOrReject(capability, success, reason) { - if (success) { - capability.resolve(); - } else { - capability.reject(reason); + function PushButtonWidgetAnnotationElement() { + _classCallCheck(this, PushButtonWidgetAnnotationElement); + + return _super7.apply(this, arguments); } -} -function finalize(promise) { - return Promise.resolve(promise).catch(function () {}); -} -function MessageHandler(sourceName, targetName, comObj) { - var _this = this; - - this.sourceName = sourceName; - this.targetName = targetName; - this.comObj = comObj; - this.callbackId = 1; - this.streamId = 1; - this.postMessageTransfers = true; - this.streamSinks = Object.create(null); - this.streamControllers = Object.create(null); - var callbacksCapabilities = this.callbacksCapabilities = Object.create(null); - var ah = this.actionHandler = Object.create(null); - this._onComObjOnMessage = function (event) { - var data = event.data; - if (data.targetName !== _this.sourceName) { - return; + + _createClass(PushButtonWidgetAnnotationElement, [{ + key: "render", + value: function render() { + var container = _get(_getPrototypeOf(PushButtonWidgetAnnotationElement.prototype), "render", this).call(this); + + container.className = "buttonWidgetAnnotation pushButton"; + return container; } - if (data.stream) { - _this._processStreamMessage(data); - } else if (data.isReply) { - var callbackId = data.callbackId; - if (data.callbackId in callbacksCapabilities) { - var callback = callbacksCapabilities[callbackId]; - delete callbacksCapabilities[callbackId]; - if ('error' in data) { - callback.reject(wrapReason(data.error)); - } else { - callback.resolve(data.data); + }]); + + return PushButtonWidgetAnnotationElement; +}(LinkAnnotationElement); + +var ChoiceWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem4) { + _inherits(ChoiceWidgetAnnotationElement, _WidgetAnnotationElem4); + + var _super8 = _createSuper(ChoiceWidgetAnnotationElement); + + function ChoiceWidgetAnnotationElement(parameters) { + _classCallCheck(this, ChoiceWidgetAnnotationElement); + + return _super8.call(this, parameters, parameters.renderInteractiveForms); + } + + _createClass(ChoiceWidgetAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "choiceWidgetAnnotation"; + var selectElement = document.createElement("select"); + selectElement.disabled = this.data.readOnly; + selectElement.name = this.data.fieldName; + + if (!this.data.combo) { + selectElement.size = this.data.options.length; + + if (this.data.multiSelect) { + selectElement.multiple = true; } - } else { - throw new Error('Cannot resolve callback ' + callbackId); - } - } else if (data.action in ah) { - var action = ah[data.action]; - if (data.callbackId) { - var _sourceName = _this.sourceName; - var _targetName = data.sourceName; - Promise.resolve().then(function () { - return action[0].call(action[1], data.data); - }).then(function (result) { - comObj.postMessage({ - sourceName: _sourceName, - targetName: _targetName, - isReply: true, - callbackId: data.callbackId, - data: result - }); - }, function (reason) { - comObj.postMessage({ - sourceName: _sourceName, - targetName: _targetName, - isReply: true, - callbackId: data.callbackId, - error: makeReasonSerializable(reason) - }); - }); - } else if (data.streamId) { - _this._createStreamSink(data); - } else { - action[0].call(action[1], data.data); } - } else { - throw new Error('Unknown action from worker: ' + data.action); - } - }; - comObj.addEventListener('message', this._onComObjOnMessage); -} -MessageHandler.prototype = { - on: function on(actionName, handler, scope) { - var ah = this.actionHandler; - if (ah[actionName]) { - throw new Error('There is already an actionName called "' + actionName + '"'); - } - ah[actionName] = [handler, scope]; - }, - send: function send(actionName, data, transfers) { - var message = { - sourceName: this.sourceName, - targetName: this.targetName, - action: actionName, - data: data - }; - this.postMessage(message, transfers); - }, - sendWithPromise: function sendWithPromise(actionName, data, transfers) { - var callbackId = this.callbackId++; - var message = { - sourceName: this.sourceName, - targetName: this.targetName, - action: actionName, - data: data, - callbackId: callbackId - }; - var capability = (0, _util.createPromiseCapability)(); - this.callbacksCapabilities[callbackId] = capability; - try { - this.postMessage(message, transfers); - } catch (e) { - capability.reject(e); - } - return capability.promise; - }, - sendWithStream: function sendWithStream(actionName, data, queueingStrategy, transfers) { - var _this2 = this; - var streamId = this.streamId++; - var sourceName = this.sourceName; - var targetName = this.targetName; - return new _util.ReadableStream({ - start: function start(controller) { - var startCapability = (0, _util.createPromiseCapability)(); - _this2.streamControllers[streamId] = { - controller: controller, - startCall: startCapability, - isClosed: false - }; - _this2.postMessage({ - sourceName: sourceName, - targetName: targetName, - action: actionName, - streamId: streamId, - data: data, - desiredSize: controller.desiredSize - }); - return startCapability.promise; - }, - pull: function pull(controller) { - var pullCapability = (0, _util.createPromiseCapability)(); - _this2.streamControllers[streamId].pullCall = pullCapability; - _this2.postMessage({ - sourceName: sourceName, - targetName: targetName, - stream: 'pull', - streamId: streamId, - desiredSize: controller.desiredSize - }); - return pullCapability.promise; - }, - cancel: function cancel(reason) { - var cancelCapability = (0, _util.createPromiseCapability)(); - _this2.streamControllers[streamId].cancelCall = cancelCapability; - _this2.streamControllers[streamId].isClosed = true; - _this2.postMessage({ - sourceName: sourceName, - targetName: targetName, - stream: 'cancel', - reason: reason, - streamId: streamId - }); - return cancelCapability.promise; - } - }, queueingStrategy); - }, - _createStreamSink: function _createStreamSink(data) { - var _this3 = this; - - var self = this; - var action = this.actionHandler[data.action]; - var streamId = data.streamId; - var desiredSize = data.desiredSize; - var sourceName = this.sourceName; - var targetName = data.sourceName; - var capability = (0, _util.createPromiseCapability)(); - var sendStreamRequest = function sendStreamRequest(_ref2) { - var stream = _ref2.stream, - chunk = _ref2.chunk, - transfers = _ref2.transfers, - success = _ref2.success, - reason = _ref2.reason; - - _this3.postMessage({ - sourceName: sourceName, - targetName: targetName, - stream: stream, - streamId: streamId, - chunk: chunk, - success: success, - reason: reason - }, transfers); - }; - var streamSink = { - enqueue: function enqueue(chunk) { - var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - var transfers = arguments[2]; + var _iterator = _createForOfIteratorHelper(this.data.options), + _step; - if (this.isCancelled) { - return; - } - var lastDesiredSize = this.desiredSize; - this.desiredSize -= size; - if (lastDesiredSize > 0 && this.desiredSize <= 0) { - this.sinkCapability = (0, _util.createPromiseCapability)(); - this.ready = this.sinkCapability.promise; - } - sendStreamRequest({ - stream: 'enqueue', - chunk: chunk, - transfers: transfers - }); - }, - close: function close() { - if (this.isCancelled) { - return; - } - this.isCancelled = true; - sendStreamRequest({ stream: 'close' }); - delete self.streamSinks[streamId]; - }, - error: function error(reason) { - if (this.isCancelled) { - return; - } - this.isCancelled = true; - sendStreamRequest({ - stream: 'error', - reason: reason - }); - }, - - sinkCapability: capability, - onPull: null, - onCancel: null, - isCancelled: false, - desiredSize: desiredSize, - ready: null - }; - streamSink.sinkCapability.resolve(); - streamSink.ready = streamSink.sinkCapability.promise; - this.streamSinks[streamId] = streamSink; - resolveCall(action[0], [data.data, streamSink], action[1]).then(function () { - sendStreamRequest({ - stream: 'start_complete', - success: true - }); - }, function (reason) { - sendStreamRequest({ - stream: 'start_complete', - success: false, - reason: reason - }); - }); - }, - _processStreamMessage: function _processStreamMessage(data) { - var _this4 = this; - - var sourceName = this.sourceName; - var targetName = data.sourceName; - var streamId = data.streamId; - var sendStreamResponse = function sendStreamResponse(_ref3) { - var stream = _ref3.stream, - success = _ref3.success, - reason = _ref3.reason; - - _this4.comObj.postMessage({ - sourceName: sourceName, - targetName: targetName, - stream: stream, - success: success, - streamId: streamId, - reason: reason - }); - }; - var deleteStreamController = function deleteStreamController() { - Promise.all([_this4.streamControllers[data.streamId].startCall, _this4.streamControllers[data.streamId].pullCall, _this4.streamControllers[data.streamId].cancelCall].map(function (capability) { - return capability && finalize(capability.promise); - })).then(function () { - delete _this4.streamControllers[data.streamId]; - }); - }; - switch (data.stream) { - case 'start_complete': - resolveOrReject(this.streamControllers[data.streamId].startCall, data.success, wrapReason(data.reason)); - break; - case 'pull_complete': - resolveOrReject(this.streamControllers[data.streamId].pullCall, data.success, wrapReason(data.reason)); - break; - case 'pull': - if (!this.streamSinks[data.streamId]) { - sendStreamResponse({ - stream: 'pull_complete', - success: true - }); - break; - } - if (this.streamSinks[data.streamId].desiredSize <= 0 && data.desiredSize > 0) { - this.streamSinks[data.streamId].sinkCapability.resolve(); - } - this.streamSinks[data.streamId].desiredSize = data.desiredSize; - resolveCall(this.streamSinks[data.streamId].onPull).then(function () { - sendStreamResponse({ - stream: 'pull_complete', - success: true - }); - }, function (reason) { - sendStreamResponse({ - stream: 'pull_complete', - success: false, - reason: reason - }); - }); - break; - case 'enqueue': - (0, _util.assert)(this.streamControllers[data.streamId], 'enqueue should have stream controller'); - if (!this.streamControllers[data.streamId].isClosed) { - this.streamControllers[data.streamId].controller.enqueue(data.chunk); - } - break; - case 'close': - (0, _util.assert)(this.streamControllers[data.streamId], 'close should have stream controller'); - if (this.streamControllers[data.streamId].isClosed) { - break; - } - this.streamControllers[data.streamId].isClosed = true; - this.streamControllers[data.streamId].controller.close(); - deleteStreamController(); - break; - case 'error': - (0, _util.assert)(this.streamControllers[data.streamId], 'error should have stream controller'); - this.streamControllers[data.streamId].controller.error(wrapReason(data.reason)); - deleteStreamController(); - break; - case 'cancel_complete': - resolveOrReject(this.streamControllers[data.streamId].cancelCall, data.success, wrapReason(data.reason)); - deleteStreamController(); - break; - case 'cancel': - if (!this.streamSinks[data.streamId]) { - break; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var option = _step.value; + var optionElement = document.createElement("option"); + optionElement.textContent = option.displayValue; + optionElement.value = option.exportValue; + + if (this.data.fieldValue.includes(option.displayValue)) { + optionElement.setAttribute("selected", true); + } + + selectElement.appendChild(optionElement); } - resolveCall(this.streamSinks[data.streamId].onCancel, [wrapReason(data.reason)]).then(function () { - sendStreamResponse({ - stream: 'cancel_complete', - success: true - }); - }, function (reason) { - sendStreamResponse({ - stream: 'cancel_complete', - success: false, - reason: reason - }); - }); - this.streamSinks[data.streamId].sinkCapability.reject(wrapReason(data.reason)); - this.streamSinks[data.streamId].isCancelled = true; - delete this.streamSinks[data.streamId]; - break; - default: - throw new Error('Unexpected stream case'); - } - }, - postMessage: function postMessage(message, transfers) { - if (transfers && this.postMessageTransfers) { - this.comObj.postMessage(message, transfers); - } else { - this.comObj.postMessage(message); + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + this.container.appendChild(selectElement); + return this.container; } - }, - destroy: function destroy() { - this.comObj.removeEventListener('message', this._onComObjOnMessage); + }]); + + return ChoiceWidgetAnnotationElement; +}(WidgetAnnotationElement); + +var PopupAnnotationElement = /*#__PURE__*/function (_AnnotationElement4) { + _inherits(PopupAnnotationElement, _AnnotationElement4); + + var _super9 = _createSuper(PopupAnnotationElement); + + function PopupAnnotationElement(parameters) { + _classCallCheck(this, PopupAnnotationElement); + + var isRenderable = !!(parameters.data.title || parameters.data.contents); + return _super9.call(this, parameters, isRenderable); } -}; -exports.MessageHandler = MessageHandler; -/***/ }), -/* 137 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + _createClass(PopupAnnotationElement, [{ + key: "render", + value: function render() { + var IGNORE_TYPES = ["Line", "Square", "Circle", "PolyLine", "Polygon", "Ink"]; + this.container.className = "popupAnnotation"; -"use strict"; + if (IGNORE_TYPES.includes(this.data.parentType)) { + return this.container; + } + var selector = "[data-annotation-id=\"".concat(this.data.parentId, "\"]"); + var parentElement = this.layer.querySelector(selector); -module.exports = __w_pdfjs_require__(138); + if (!parentElement) { + return this.container; + } -/***/ }), -/* 138 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + var popup = new PopupElement({ + container: this.container, + trigger: parentElement, + color: this.data.color, + title: this.data.title, + modificationDate: this.data.modificationDate, + contents: this.data.contents + }); + var parentLeft = parseFloat(parentElement.style.left); + var parentWidth = parseFloat(parentElement.style.width); + this.container.style.transformOrigin = "-".concat(parentLeft + parentWidth, "px -").concat(parentElement.style.top); + this.container.style.left = "".concat(parentLeft + parentWidth, "px"); + this.container.appendChild(popup.render()); + return this.container; + } + }]); -"use strict"; + return PopupAnnotationElement; +}(AnnotationElement); +var PopupElement = /*#__PURE__*/function () { + function PopupElement(parameters) { + _classCallCheck(this, PopupElement); -var g = function () { - return this; -}() || Function("return this")(); -var hadRuntime = g.regeneratorRuntime && Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; -var oldRuntime = hadRuntime && g.regeneratorRuntime; -g.regeneratorRuntime = undefined; -module.exports = __w_pdfjs_require__(139); -if (hadRuntime) { - g.regeneratorRuntime = oldRuntime; -} else { - try { - delete g.regeneratorRuntime; - } catch (e) { - g.regeneratorRuntime = undefined; + this.container = parameters.container; + this.trigger = parameters.trigger; + this.color = parameters.color; + this.title = parameters.title; + this.modificationDate = parameters.modificationDate; + this.contents = parameters.contents; + this.hideWrapper = parameters.hideWrapper || false; + this.pinned = false; } -} -/***/ }), -/* 139 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + _createClass(PopupElement, [{ + key: "render", + value: function render() { + var BACKGROUND_ENLIGHT = 0.7; + var wrapper = document.createElement("div"); + wrapper.className = "popupWrapper"; + this.hideElement = this.hideWrapper ? wrapper : this.container; + this.hideElement.setAttribute("hidden", true); + var popup = document.createElement("div"); + popup.className = "popup"; + var color = this.color; -"use strict"; -/* WEBPACK VAR INJECTION */(function(module) { + if (color) { + var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0]; + var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1]; + var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2]; + popup.style.backgroundColor = _util.Util.makeCssRgb(r | 0, g | 0, b | 0); + } -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + var title = document.createElement("h1"); + title.textContent = this.title; + popup.appendChild(title); -!function (global) { - "use strict"; + var dateObject = _display_utils.PDFDateString.toDateObject(this.modificationDate); - var Op = Object.prototype; - var hasOwn = Op.hasOwnProperty; - var undefined; - var $Symbol = typeof Symbol === "function" ? Symbol : {}; - var iteratorSymbol = $Symbol.iterator || "@@iterator"; - var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; - var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - var inModule = ( false ? undefined : _typeof(module)) === "object"; - var runtime = global.regeneratorRuntime; - if (runtime) { - if (inModule) { - module.exports = runtime; - } - return; - } - runtime = global.regeneratorRuntime = inModule ? module.exports : {}; - function wrap(innerFn, outerFn, self, tryLocsList) { - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; - var generator = Object.create(protoGenerator.prototype); - var context = new Context(tryLocsList || []); - generator._invoke = makeInvokeMethod(innerFn, self, context); - return generator; - } - runtime.wrap = wrap; - function tryCatch(fn, obj, arg) { - try { - return { - type: "normal", - arg: fn.call(obj, arg) - }; - } catch (err) { - return { - type: "throw", - arg: err - }; - } - } - var GenStateSuspendedStart = "suspendedStart"; - var GenStateSuspendedYield = "suspendedYield"; - var GenStateExecuting = "executing"; - var GenStateCompleted = "completed"; - var ContinueSentinel = {}; - function Generator() {} - function GeneratorFunction() {} - function GeneratorFunctionPrototype() {} - var IteratorPrototype = {}; - IteratorPrototype[iteratorSymbol] = function () { - return this; - }; - var getProto = Object.getPrototypeOf; - var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); - if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { - IteratorPrototype = NativeIteratorPrototype; - } - var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); - GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; - GeneratorFunctionPrototype.constructor = GeneratorFunction; - GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function (method) { - prototype[method] = function (arg) { - return this._invoke(method, arg); - }; - }); - } - runtime.isGeneratorFunction = function (genFun) { - var ctor = typeof genFun === "function" && genFun.constructor; - return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false; - }; - runtime.mark = function (genFun) { - if (Object.setPrototypeOf) { - Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); - } else { - genFun.__proto__ = GeneratorFunctionPrototype; - if (!(toStringTagSymbol in genFun)) { - genFun[toStringTagSymbol] = "GeneratorFunction"; - } - } - genFun.prototype = Object.create(Gp); - return genFun; - }; - runtime.awrap = function (arg) { - return { __await: arg }; - }; - function AsyncIterator(generator) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); - if (record.type === "throw") { - reject(record.arg); - } else { - var result = record.arg; - var value = result.value; - if (value && (typeof value === "undefined" ? "undefined" : _typeof(value)) === "object" && hasOwn.call(value, "__await")) { - return Promise.resolve(value.__await).then(function (value) { - invoke("next", value, resolve, reject); - }, function (err) { - invoke("throw", err, resolve, reject); - }); - } - return Promise.resolve(value).then(function (unwrapped) { - result.value = unwrapped; - resolve(result); - }, reject); - } - } - var previousPromise; - function enqueue(method, arg) { - function callInvokeWithMethodAndArg() { - return new Promise(function (resolve, reject) { - invoke(method, arg, resolve, reject); + if (dateObject) { + var modificationDate = document.createElement("span"); + modificationDate.textContent = "{{date}}, {{time}}"; + modificationDate.dataset.l10nId = "annotation_date_string"; + modificationDate.dataset.l10nArgs = JSON.stringify({ + date: dateObject.toLocaleDateString(), + time: dateObject.toLocaleTimeString() }); + popup.appendChild(modificationDate); } - return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + + var contents = this._formatContents(this.contents); + + popup.appendChild(contents); + this.trigger.addEventListener("click", this._toggle.bind(this)); + this.trigger.addEventListener("mouseover", this._show.bind(this, false)); + this.trigger.addEventListener("mouseout", this._hide.bind(this, false)); + popup.addEventListener("click", this._hide.bind(this, true)); + wrapper.appendChild(popup); + return wrapper; } - this._invoke = enqueue; - } - defineIteratorMethods(AsyncIterator.prototype); - AsyncIterator.prototype[asyncIteratorSymbol] = function () { - return this; - }; - runtime.AsyncIterator = AsyncIterator; - runtime.async = function (innerFn, outerFn, self, tryLocsList) { - var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList)); - return runtime.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { - return result.done ? result.value : iter.next(); - }); - }; - function makeInvokeMethod(innerFn, self, context) { - var state = GenStateSuspendedStart; - return function invoke(method, arg) { - if (state === GenStateExecuting) { - throw new Error("Generator is already running"); - } - if (state === GenStateCompleted) { - if (method === "throw") { - throw arg; - } - return doneResult(); - } - context.method = method; - context.arg = arg; - while (true) { - var delegate = context.delegate; - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } - } - if (context.method === "next") { - context.sent = context._sent = context.arg; - } else if (context.method === "throw") { - if (state === GenStateSuspendedStart) { - state = GenStateCompleted; - throw context.arg; - } - context.dispatchException(context.arg); - } else if (context.method === "return") { - context.abrupt("return", context.arg); - } - state = GenStateExecuting; - var record = tryCatch(innerFn, self, context); - if (record.type === "normal") { - state = context.done ? GenStateCompleted : GenStateSuspendedYield; - if (record.arg === ContinueSentinel) { - continue; - } - return { - value: record.arg, - done: context.done - }; - } else if (record.type === "throw") { - state = GenStateCompleted; - context.method = "throw"; - context.arg = record.arg; - } - } - }; - } - function maybeInvokeDelegate(delegate, context) { - var method = delegate.iterator[context.method]; - if (method === undefined) { - context.delegate = null; - if (context.method === "throw") { - if (delegate.iterator.return) { - context.method = "return"; - context.arg = undefined; - maybeInvokeDelegate(delegate, context); - if (context.method === "throw") { - return ContinueSentinel; - } + }, { + key: "_formatContents", + value: function _formatContents(contents) { + var p = document.createElement("p"); + var lines = contents.split(/(?:\r\n?|\n)/); + + for (var i = 0, ii = lines.length; i < ii; ++i) { + var line = lines[i]; + p.appendChild(document.createTextNode(line)); + + if (i < ii - 1) { + p.appendChild(document.createElement("br")); } - context.method = "throw"; - context.arg = new TypeError("The iterator does not provide a 'throw' method"); } - return ContinueSentinel; + + return p; } - var record = tryCatch(method, delegate.iterator, context.arg); - if (record.type === "throw") { - context.method = "throw"; - context.arg = record.arg; - context.delegate = null; - return ContinueSentinel; + }, { + key: "_toggle", + value: function _toggle() { + if (this.pinned) { + this._hide(true); + } else { + this._show(true); + } } - var info = record.arg; - if (!info) { - context.method = "throw"; - context.arg = new TypeError("iterator result is not an object"); - context.delegate = null; - return ContinueSentinel; + }, { + key: "_show", + value: function _show() { + var pin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + if (pin) { + this.pinned = true; + } + + if (this.hideElement.hasAttribute("hidden")) { + this.hideElement.removeAttribute("hidden"); + this.container.style.zIndex += 1; + } } - if (info.done) { - context[delegate.resultName] = info.value; - context.next = delegate.nextLoc; - if (context.method !== "return") { - context.method = "next"; - context.arg = undefined; + }, { + key: "_hide", + value: function _hide() { + var unpin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + + if (unpin) { + this.pinned = false; + } + + if (!this.hideElement.hasAttribute("hidden") && !this.pinned) { + this.hideElement.setAttribute("hidden", true); + this.container.style.zIndex -= 1; } - } else { - return info; } - context.delegate = null; - return ContinueSentinel; + }]); + + return PopupElement; +}(); + +var FreeTextAnnotationElement = /*#__PURE__*/function (_AnnotationElement5) { + _inherits(FreeTextAnnotationElement, _AnnotationElement5); + + var _super10 = _createSuper(FreeTextAnnotationElement); + + function FreeTextAnnotationElement(parameters) { + _classCallCheck(this, FreeTextAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _super10.call(this, parameters, isRenderable, true); } - defineIteratorMethods(Gp); - Gp[toStringTagSymbol] = "Generator"; - Gp[iteratorSymbol] = function () { - return this; - }; - Gp.toString = function () { - return "[object Generator]"; - }; - function pushTryEntry(locs) { - var entry = { tryLoc: locs[0] }; - if (1 in locs) { - entry.catchLoc = locs[1]; - } - if (2 in locs) { - entry.finallyLoc = locs[2]; - entry.afterLoc = locs[3]; + + _createClass(FreeTextAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "freeTextAnnotation"; + + if (!this.data.hasPopup) { + this._createPopup(this.container, null, this.data); + } + + return this.container; } - this.tryEntries.push(entry); + }]); + + return FreeTextAnnotationElement; +}(AnnotationElement); + +var LineAnnotationElement = /*#__PURE__*/function (_AnnotationElement6) { + _inherits(LineAnnotationElement, _AnnotationElement6); + + var _super11 = _createSuper(LineAnnotationElement); + + function LineAnnotationElement(parameters) { + _classCallCheck(this, LineAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _super11.call(this, parameters, isRenderable, true); } - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal"; - delete record.arg; - entry.completion = record; + + _createClass(LineAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "lineAnnotation"; + var data = this.data; + var width = data.rect[2] - data.rect[0]; + var height = data.rect[3] - data.rect[1]; + var svg = this.svgFactory.create(width, height); + var line = this.svgFactory.createElement("svg:line"); + line.setAttribute("x1", data.rect[2] - data.lineCoordinates[0]); + line.setAttribute("y1", data.rect[3] - data.lineCoordinates[1]); + line.setAttribute("x2", data.rect[2] - data.lineCoordinates[2]); + line.setAttribute("y2", data.rect[3] - data.lineCoordinates[3]); + line.setAttribute("stroke-width", data.borderStyle.width || 1); + line.setAttribute("stroke", "transparent"); + svg.appendChild(line); + this.container.append(svg); + + this._createPopup(this.container, line, data); + + return this.container; + } + }]); + + return LineAnnotationElement; +}(AnnotationElement); + +var SquareAnnotationElement = /*#__PURE__*/function (_AnnotationElement7) { + _inherits(SquareAnnotationElement, _AnnotationElement7); + + var _super12 = _createSuper(SquareAnnotationElement); + + function SquareAnnotationElement(parameters) { + _classCallCheck(this, SquareAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _super12.call(this, parameters, isRenderable, true); } - function Context(tryLocsList) { - this.tryEntries = [{ tryLoc: "root" }]; - tryLocsList.forEach(pushTryEntry, this); - this.reset(true); + + _createClass(SquareAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "squareAnnotation"; + var data = this.data; + var width = data.rect[2] - data.rect[0]; + var height = data.rect[3] - data.rect[1]; + var svg = this.svgFactory.create(width, height); + var borderWidth = data.borderStyle.width; + var square = this.svgFactory.createElement("svg:rect"); + square.setAttribute("x", borderWidth / 2); + square.setAttribute("y", borderWidth / 2); + square.setAttribute("width", width - borderWidth); + square.setAttribute("height", height - borderWidth); + square.setAttribute("stroke-width", borderWidth || 1); + square.setAttribute("stroke", "transparent"); + square.setAttribute("fill", "none"); + svg.appendChild(square); + this.container.append(svg); + + this._createPopup(this.container, square, data); + + return this.container; + } + }]); + + return SquareAnnotationElement; +}(AnnotationElement); + +var CircleAnnotationElement = /*#__PURE__*/function (_AnnotationElement8) { + _inherits(CircleAnnotationElement, _AnnotationElement8); + + var _super13 = _createSuper(CircleAnnotationElement); + + function CircleAnnotationElement(parameters) { + _classCallCheck(this, CircleAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _super13.call(this, parameters, isRenderable, true); } - runtime.keys = function (object) { - var keys = []; - for (var key in object) { - keys.push(key); + + _createClass(CircleAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "circleAnnotation"; + var data = this.data; + var width = data.rect[2] - data.rect[0]; + var height = data.rect[3] - data.rect[1]; + var svg = this.svgFactory.create(width, height); + var borderWidth = data.borderStyle.width; + var circle = this.svgFactory.createElement("svg:ellipse"); + circle.setAttribute("cx", width / 2); + circle.setAttribute("cy", height / 2); + circle.setAttribute("rx", width / 2 - borderWidth / 2); + circle.setAttribute("ry", height / 2 - borderWidth / 2); + circle.setAttribute("stroke-width", borderWidth || 1); + circle.setAttribute("stroke", "transparent"); + circle.setAttribute("fill", "none"); + svg.appendChild(circle); + this.container.append(svg); + + this._createPopup(this.container, circle, data); + + return this.container; } - keys.reverse(); - return function next() { - while (keys.length) { - var key = keys.pop(); - if (key in object) { - next.value = key; - next.done = false; - return next; + }]); + + return CircleAnnotationElement; +}(AnnotationElement); + +var PolylineAnnotationElement = /*#__PURE__*/function (_AnnotationElement9) { + _inherits(PolylineAnnotationElement, _AnnotationElement9); + + var _super14 = _createSuper(PolylineAnnotationElement); + + function PolylineAnnotationElement(parameters) { + var _this3; + + _classCallCheck(this, PolylineAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + _this3 = _super14.call(this, parameters, isRenderable, true); + _this3.containerClassName = "polylineAnnotation"; + _this3.svgElementName = "svg:polyline"; + return _this3; + } + + _createClass(PolylineAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = this.containerClassName; + var data = this.data; + var width = data.rect[2] - data.rect[0]; + var height = data.rect[3] - data.rect[1]; + var svg = this.svgFactory.create(width, height); + var points = []; + + var _iterator2 = _createForOfIteratorHelper(data.vertices), + _step2; + + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var coordinate = _step2.value; + var x = coordinate.x - data.rect[0]; + var y = data.rect[3] - coordinate.y; + points.push(x + "," + y); } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); } - next.done = true; - return next; - }; - }; - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) { - return iteratorMethod.call(iterable); - } - if (typeof iterable.next === "function") { - return iterable; - } - if (!isNaN(iterable.length)) { - var i = -1, - next = function next() { - while (++i < iterable.length) { - if (hasOwn.call(iterable, i)) { - next.value = iterable[i]; - next.done = false; - return next; - } - } - next.value = undefined; - next.done = true; - return next; - }; - return next.next = next; + + points = points.join(" "); + var polyline = this.svgFactory.createElement(this.svgElementName); + polyline.setAttribute("points", points); + polyline.setAttribute("stroke-width", data.borderStyle.width || 1); + polyline.setAttribute("stroke", "transparent"); + polyline.setAttribute("fill", "none"); + svg.appendChild(polyline); + this.container.append(svg); + + this._createPopup(this.container, polyline, data); + + return this.container; + } + }]); + + return PolylineAnnotationElement; +}(AnnotationElement); + +var PolygonAnnotationElement = /*#__PURE__*/function (_PolylineAnnotationEl) { + _inherits(PolygonAnnotationElement, _PolylineAnnotationEl); + + var _super15 = _createSuper(PolygonAnnotationElement); + + function PolygonAnnotationElement(parameters) { + var _this4; + + _classCallCheck(this, PolygonAnnotationElement); + + _this4 = _super15.call(this, parameters); + _this4.containerClassName = "polygonAnnotation"; + _this4.svgElementName = "svg:polygon"; + return _this4; + } + + return PolygonAnnotationElement; +}(PolylineAnnotationElement); + +var CaretAnnotationElement = /*#__PURE__*/function (_AnnotationElement10) { + _inherits(CaretAnnotationElement, _AnnotationElement10); + + var _super16 = _createSuper(CaretAnnotationElement); + + function CaretAnnotationElement(parameters) { + _classCallCheck(this, CaretAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _super16.call(this, parameters, isRenderable, true); + } + + _createClass(CaretAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "caretAnnotation"; + + if (!this.data.hasPopup) { + this._createPopup(this.container, null, this.data); } + + return this.container; } - return { next: doneResult }; - } - runtime.values = values; - function doneResult() { - return { - value: undefined, - done: true - }; + }]); + + return CaretAnnotationElement; +}(AnnotationElement); + +var InkAnnotationElement = /*#__PURE__*/function (_AnnotationElement11) { + _inherits(InkAnnotationElement, _AnnotationElement11); + + var _super17 = _createSuper(InkAnnotationElement); + + function InkAnnotationElement(parameters) { + var _this5; + + _classCallCheck(this, InkAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + _this5 = _super17.call(this, parameters, isRenderable, true); + _this5.containerClassName = "inkAnnotation"; + _this5.svgElementName = "svg:polyline"; + return _this5; } - Context.prototype = { - constructor: Context, - reset: function reset(skipTempReset) { - this.prev = 0; - this.next = 0; - this.sent = this._sent = undefined; - this.done = false; - this.delegate = null; - this.method = "next"; - this.arg = undefined; - this.tryEntries.forEach(resetTryEntry); - if (!skipTempReset) { - for (var name in this) { - if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { - this[name] = undefined; + + _createClass(InkAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = this.containerClassName; + var data = this.data; + var width = data.rect[2] - data.rect[0]; + var height = data.rect[3] - data.rect[1]; + var svg = this.svgFactory.create(width, height); + + var _iterator3 = _createForOfIteratorHelper(data.inkLists), + _step3; + + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var inkList = _step3.value; + var points = []; + + var _iterator4 = _createForOfIteratorHelper(inkList), + _step4; + + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var coordinate = _step4.value; + var x = coordinate.x - data.rect[0]; + var y = data.rect[3] - coordinate.y; + points.push("".concat(x, ",").concat(y)); + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); } + + points = points.join(" "); + var polyline = this.svgFactory.createElement(this.svgElementName); + polyline.setAttribute("points", points); + polyline.setAttribute("stroke-width", data.borderStyle.width || 1); + polyline.setAttribute("stroke", "transparent"); + polyline.setAttribute("fill", "none"); + + this._createPopup(this.container, polyline, data); + + svg.appendChild(polyline); } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); } - }, - stop: function stop() { - this.done = true; - var rootEntry = this.tryEntries[0]; - var rootRecord = rootEntry.completion; - if (rootRecord.type === "throw") { - throw rootRecord.arg; + + this.container.append(svg); + return this.container; + } + }]); + + return InkAnnotationElement; +}(AnnotationElement); + +var HighlightAnnotationElement = /*#__PURE__*/function (_AnnotationElement12) { + _inherits(HighlightAnnotationElement, _AnnotationElement12); + + var _super18 = _createSuper(HighlightAnnotationElement); + + function HighlightAnnotationElement(parameters) { + _classCallCheck(this, HighlightAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _super18.call(this, parameters, isRenderable, true); + } + + _createClass(HighlightAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "highlightAnnotation"; + + if (!this.data.hasPopup) { + this._createPopup(this.container, null, this.data); } - return this.rval; - }, - dispatchException: function dispatchException(exception) { - if (this.done) { - throw exception; + + return this.container; + } + }]); + + return HighlightAnnotationElement; +}(AnnotationElement); + +var UnderlineAnnotationElement = /*#__PURE__*/function (_AnnotationElement13) { + _inherits(UnderlineAnnotationElement, _AnnotationElement13); + + var _super19 = _createSuper(UnderlineAnnotationElement); + + function UnderlineAnnotationElement(parameters) { + _classCallCheck(this, UnderlineAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _super19.call(this, parameters, isRenderable, true); + } + + _createClass(UnderlineAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "underlineAnnotation"; + + if (!this.data.hasPopup) { + this._createPopup(this.container, null, this.data); } - var context = this; - function handle(loc, caught) { - record.type = "throw"; - record.arg = exception; - context.next = loc; - if (caught) { - context.method = "next"; - context.arg = undefined; - } - return !!caught; + + return this.container; + } + }]); + + return UnderlineAnnotationElement; +}(AnnotationElement); + +var SquigglyAnnotationElement = /*#__PURE__*/function (_AnnotationElement14) { + _inherits(SquigglyAnnotationElement, _AnnotationElement14); + + var _super20 = _createSuper(SquigglyAnnotationElement); + + function SquigglyAnnotationElement(parameters) { + _classCallCheck(this, SquigglyAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _super20.call(this, parameters, isRenderable, true); + } + + _createClass(SquigglyAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "squigglyAnnotation"; + + if (!this.data.hasPopup) { + this._createPopup(this.container, null, this.data); } - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - var record = entry.completion; - if (entry.tryLoc === "root") { - return handle("end"); - } - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"); - var hasFinally = hasOwn.call(entry, "finallyLoc"); - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } else if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - } else if (hasCatch) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } - } else if (hasFinally) { - if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - } else { - throw new Error("try statement without catch or finally"); - } - } + + return this.container; + } + }]); + + return SquigglyAnnotationElement; +}(AnnotationElement); + +var StrikeOutAnnotationElement = /*#__PURE__*/function (_AnnotationElement15) { + _inherits(StrikeOutAnnotationElement, _AnnotationElement15); + + var _super21 = _createSuper(StrikeOutAnnotationElement); + + function StrikeOutAnnotationElement(parameters) { + _classCallCheck(this, StrikeOutAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _super21.call(this, parameters, isRenderable, true); + } + + _createClass(StrikeOutAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "strikeoutAnnotation"; + + if (!this.data.hasPopup) { + this._createPopup(this.container, null, this.data); } - }, - abrupt: function abrupt(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } + + return this.container; + } + }]); + + return StrikeOutAnnotationElement; +}(AnnotationElement); + +var StampAnnotationElement = /*#__PURE__*/function (_AnnotationElement16) { + _inherits(StampAnnotationElement, _AnnotationElement16); + + var _super22 = _createSuper(StampAnnotationElement); + + function StampAnnotationElement(parameters) { + _classCallCheck(this, StampAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _super22.call(this, parameters, isRenderable, true); + } + + _createClass(StampAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "stampAnnotation"; + + if (!this.data.hasPopup) { + this._createPopup(this.container, null, this.data); } - if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { - finallyEntry = null; + + return this.container; + } + }]); + + return StampAnnotationElement; +}(AnnotationElement); + +var FileAttachmentAnnotationElement = /*#__PURE__*/function (_AnnotationElement17) { + _inherits(FileAttachmentAnnotationElement, _AnnotationElement17); + + var _super23 = _createSuper(FileAttachmentAnnotationElement); + + function FileAttachmentAnnotationElement(parameters) { + var _this6; + + _classCallCheck(this, FileAttachmentAnnotationElement); + + _this6 = _super23.call(this, parameters, true); + var _this6$data$file = _this6.data.file, + filename = _this6$data$file.filename, + content = _this6$data$file.content; + _this6.filename = (0, _display_utils.getFilenameFromUrl)(filename); + _this6.content = content; + + if (_this6.linkService.eventBus) { + _this6.linkService.eventBus.dispatch("fileattachmentannotation", { + source: _assertThisInitialized(_this6), + id: (0, _util.stringToPDFString)(filename), + filename: filename, + content: content + }); + } + + return _this6; + } + + _createClass(FileAttachmentAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = "fileAttachmentAnnotation"; + var trigger = document.createElement("div"); + trigger.style.height = this.container.style.height; + trigger.style.width = this.container.style.width; + trigger.addEventListener("dblclick", this._download.bind(this)); + + if (!this.data.hasPopup && (this.data.title || this.data.contents)) { + this._createPopup(this.container, trigger, this.data); } - var record = finallyEntry ? finallyEntry.completion : {}; - record.type = type; - record.arg = arg; - if (finallyEntry) { - this.method = "next"; - this.next = finallyEntry.finallyLoc; - return ContinueSentinel; + + this.container.appendChild(trigger); + return this.container; + } + }, { + key: "_download", + value: function _download() { + if (!this.downloadManager) { + (0, _util.warn)("Download cannot be started due to unavailable download manager"); + return; } - return this.complete(record); - }, - complete: function complete(record, afterLoc) { - if (record.type === "throw") { - throw record.arg; + + this.downloadManager.downloadData(this.content, this.filename, ""); + } + }]); + + return FileAttachmentAnnotationElement; +}(AnnotationElement); + +var AnnotationLayer = /*#__PURE__*/function () { + function AnnotationLayer() { + _classCallCheck(this, AnnotationLayer); + } + + _createClass(AnnotationLayer, null, [{ + key: "render", + value: function render(parameters) { + var sortedAnnotations = [], + popupAnnotations = []; + + var _iterator5 = _createForOfIteratorHelper(parameters.annotations), + _step5; + + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { + var _data = _step5.value; + + if (!_data) { + continue; + } + + if (_data.annotationType === _util.AnnotationType.POPUP) { + popupAnnotations.push(_data); + continue; + } + + sortedAnnotations.push(_data); + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); } - if (record.type === "break" || record.type === "continue") { - this.next = record.arg; - } else if (record.type === "return") { - this.rval = this.arg = record.arg; - this.method = "return"; - this.next = "end"; - } else if (record.type === "normal" && afterLoc) { - this.next = afterLoc; + + if (popupAnnotations.length) { + sortedAnnotations.push.apply(sortedAnnotations, popupAnnotations); } - return ContinueSentinel; - }, - finish: function finish(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) { - this.complete(entry.completion, entry.afterLoc); - resetTryEntry(entry); - return ContinueSentinel; + + for (var _i = 0, _sortedAnnotations = sortedAnnotations; _i < _sortedAnnotations.length; _i++) { + var data = _sortedAnnotations[_i]; + var element = AnnotationElementFactory.create({ + data: data, + layer: parameters.div, + page: parameters.page, + viewport: parameters.viewport, + linkService: parameters.linkService, + downloadManager: parameters.downloadManager, + imageResourcesPath: parameters.imageResourcesPath || "", + renderInteractiveForms: parameters.renderInteractiveForms || false, + svgFactory: new _display_utils.DOMSVGFactory() + }); + + if (element.isRenderable) { + parameters.div.appendChild(element.render()); } } - }, - "catch": function _catch(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if (record.type === "throw") { - var thrown = record.arg; - resetTryEntry(entry); + } + }, { + key: "update", + value: function update(parameters) { + var _iterator6 = _createForOfIteratorHelper(parameters.annotations), + _step6; + + try { + for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { + var data = _step6.value; + var element = parameters.div.querySelector("[data-annotation-id=\"".concat(data.id, "\"]")); + + if (element) { + element.style.transform = "matrix(".concat(parameters.viewport.transform.join(","), ")"); } - return thrown; } + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); } - throw new Error("illegal catch attempt"); - }, - delegateYield: function delegateYield(iterable, resultName, nextLoc) { - this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }; - if (this.method === "next") { - this.arg = undefined; - } - return ContinueSentinel; - } - }; -}(function () { - return this; -}() || Function("return this")()); -/* WEBPACK VAR INJECTION */}.call(this, __w_pdfjs_require__(140)(module))) - -/***/ }), -/* 140 */ -/***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; + parameters.div.removeAttribute("hidden"); + } + }]); + return AnnotationLayer; +}(); -module.exports = function (module) { - if (!module.webpackPolyfill) { - module.deprecate = function () {}; - module.paths = []; - if (!module.children) module.children = []; - Object.defineProperty(module, "loaded", { - enumerable: true, - get: function get() { - return module.l; - } - }); - Object.defineProperty(module, "id", { - enumerable: true, - get: function get() { - return module.i; - } - }); - module.webpackPolyfill = 1; - } - return module; -}; +exports.AnnotationLayer = AnnotationLayer; /***/ }), -/* 141 */ +/* 210 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -13675,853 +21237,691 @@ module.exports = function (module) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.Metadata = undefined; +exports.renderTextLayer = void 0; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _util = __w_pdfjs_require__(5); -var _util = __w_pdfjs_require__(1); +var renderTextLayer = function renderTextLayerClosure() { + var MAX_TEXT_DIVS_TO_RENDER = 100000; + var NonWhitespaceRegexp = /\S/; -var _xml_parser = __w_pdfjs_require__(142); + function isAllWhitespace(str) { + return !NonWhitespaceRegexp.test(str); + } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + function appendText(task, geom, styles) { + var textDiv = document.createElement("span"); + var textDivProperties = { + angle: 0, + canvasWidth: 0, + isWhitespace: false, + originalTransform: null, + paddingBottom: 0, + paddingLeft: 0, + paddingRight: 0, + paddingTop: 0, + scale: 1 + }; -var Metadata = function () { - function Metadata(data) { - _classCallCheck(this, Metadata); + task._textDivs.push(textDiv); - (0, _util.assert)(typeof data === 'string', 'Metadata: input is not a string'); - data = this._repair(data); - var parser = new _xml_parser.SimpleXMLParser(); - var xmlDocument = parser.parseFromString(data); - this._metadata = Object.create(null); - if (xmlDocument) { - this._parse(xmlDocument); + if (isAllWhitespace(geom.str)) { + textDivProperties.isWhitespace = true; + + task._textDivProperties.set(textDiv, textDivProperties); + + return; } - } - _createClass(Metadata, [{ - key: '_repair', - value: function _repair(data) { - return data.replace(/>\\376\\377([^<]+)/g, function (all, codes) { - var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) { - return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1); - }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) { - switch (name) { - case 'amp': - return '&'; - case 'apos': - return '\''; - case 'gt': - return '>'; - case 'lt': - return '<'; - case 'quot': - return '\"'; - } - throw new Error('_repair: ' + name + ' isn\'t defined.'); - }); - var chars = ''; - for (var i = 0, ii = bytes.length; i < ii; i += 2) { - var code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); - if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) { - chars += String.fromCharCode(code); - } else { - chars += '&#x' + (0x10000 + code).toString(16).substring(1) + ';'; - } - } - return '>' + chars; - }); + var tx = _util.Util.transform(task._viewport.transform, geom.transform); + + var angle = Math.atan2(tx[1], tx[0]); + var style = styles[geom.fontName]; + + if (style.vertical) { + angle += Math.PI / 2; } - }, { - key: '_parse', - value: function _parse(xmlDocument) { - var rdf = xmlDocument.documentElement; - if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') { - rdf = rdf.firstChild; - while (rdf && rdf.nodeName.toLowerCase() !== 'rdf:rdf') { - rdf = rdf.nextSibling; - } + + var fontHeight = Math.sqrt(tx[2] * tx[2] + tx[3] * tx[3]); + var fontAscent = fontHeight; + + if (style.ascent) { + fontAscent = style.ascent * fontAscent; + } else if (style.descent) { + fontAscent = (1 + style.descent) * fontAscent; + } + + var left, top; + + if (angle === 0) { + left = tx[4]; + top = tx[5] - fontAscent; + } else { + left = tx[4] + fontAscent * Math.sin(angle); + top = tx[5] - fontAscent * Math.cos(angle); + } + + textDiv.style.left = "".concat(left, "px"); + textDiv.style.top = "".concat(top, "px"); + textDiv.style.fontSize = "".concat(fontHeight, "px"); + textDiv.style.fontFamily = style.fontFamily; + textDiv.textContent = geom.str; + + if (task._fontInspectorEnabled) { + textDiv.dataset.fontName = geom.fontName; + } + + if (angle !== 0) { + textDivProperties.angle = angle * (180 / Math.PI); + } + + var shouldScaleText = false; + + if (geom.str.length > 1) { + shouldScaleText = true; + } else if (geom.transform[0] !== geom.transform[3]) { + var absScaleX = Math.abs(geom.transform[0]), + absScaleY = Math.abs(geom.transform[3]); + + if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) { + shouldScaleText = true; } - var nodeName = rdf ? rdf.nodeName.toLowerCase() : null; - if (!rdf || nodeName !== 'rdf:rdf' || !rdf.hasChildNodes()) { - return; + } + + if (shouldScaleText) { + if (style.vertical) { + textDivProperties.canvasWidth = geom.height * task._viewport.scale; + } else { + textDivProperties.canvasWidth = geom.width * task._viewport.scale; + } + } + + task._textDivProperties.set(textDiv, textDivProperties); + + if (task._textContentStream) { + task._layoutText(textDiv); + } + + if (task._enhanceTextSelection) { + var angleCos = 1, + angleSin = 0; + + if (angle !== 0) { + angleCos = Math.cos(angle); + angleSin = Math.sin(angle); } - var children = rdf.childNodes; - for (var i = 0, ii = children.length; i < ii; i++) { - var desc = children[i]; - if (desc.nodeName.toLowerCase() !== 'rdf:description') { - continue; - } - for (var j = 0, jj = desc.childNodes.length; j < jj; j++) { - if (desc.childNodes[j].nodeName.toLowerCase() !== '#text') { - var entry = desc.childNodes[j]; - var name = entry.nodeName.toLowerCase(); - this._metadata[name] = entry.textContent.trim(); - } - } + + var divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale; + var divHeight = fontHeight; + var m, b; + + if (angle !== 0) { + m = [angleCos, angleSin, -angleSin, angleCos, left, top]; + b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m); + } else { + b = [left, top, left + divWidth, top + divHeight]; } + + task._bounds.push({ + left: b[0], + top: b[1], + right: b[2], + bottom: b[3], + div: textDiv, + size: [divWidth, divHeight], + m: m + }); } - }, { - key: 'get', - value: function get(name) { - return this._metadata[name] || null; + } + + function render(task) { + if (task._canceled) { + return; } - }, { - key: 'getAll', - value: function getAll() { - return this._metadata; + + var textDivs = task._textDivs; + var capability = task._capability; + var textDivsLength = textDivs.length; + + if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) { + task._renderingDone = true; + capability.resolve(); + return; } - }, { - key: 'has', - value: function has(name) { - return typeof this._metadata[name] !== 'undefined'; + + if (!task._textContentStream) { + for (var i = 0; i < textDivsLength; i++) { + task._layoutText(textDivs[i]); + } } - }]); - return Metadata; -}(); + task._renderingDone = true; + capability.resolve(); + } -exports.Metadata = Metadata; + function findPositiveMin(ts, offset, count) { + var result = 0; -/***/ }), -/* 142 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + for (var i = 0; i < count; i++) { + var t = ts[offset++]; -"use strict"; + if (t > 0) { + result = result ? Math.min(t, result) : t; + } + } + return result; + } -Object.defineProperty(exports, "__esModule", { - value: true -}); + function expand(task) { + var bounds = task._bounds; + var viewport = task._viewport; + var expanded = expandBounds(viewport.width, viewport.height, bounds); -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + for (var i = 0; i < expanded.length; i++) { + var div = bounds[i].div; -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + var divProperties = task._textDivProperties.get(div); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + if (divProperties.angle === 0) { + divProperties.paddingLeft = bounds[i].left - expanded[i].left; + divProperties.paddingTop = bounds[i].top - expanded[i].top; + divProperties.paddingRight = expanded[i].right - bounds[i].right; + divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom; -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + task._textDivProperties.set(div, divProperties); -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + continue; + } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + var e = expanded[i], + b = bounds[i]; + var m = b.m, + c = m[0], + s = m[1]; + var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size]; + var ts = new Float64Array(64); + points.forEach(function (p, j) { + var t = _util.Util.applyTransform(p, m); -var XMLParserErrorCode = { - NoError: 0, - EndOfDocument: -1, - UnterminatedCdat: -2, - UnterminatedXmlDeclaration: -3, - UnterminatedDoctypeDeclaration: -4, - UnterminatedComment: -5, - MalformedElement: -6, - OutOfMemory: -7, - UnterminatedAttributeValue: -8, - UnterminatedElement: -9, - ElementNeverBegun: -10 -}; -function isWhitespace(s, index) { - var ch = s[index]; - return ch === ' ' || ch === '\n' || ch === '\r' || ch === '\t'; -} -function isWhitespaceString(s) { - for (var i = 0, ii = s.length; i < ii; i++) { - if (!isWhitespace(s, i)) { - return false; + ts[j + 0] = c && (e.left - t[0]) / c; + ts[j + 4] = s && (e.top - t[1]) / s; + ts[j + 8] = c && (e.right - t[0]) / c; + ts[j + 12] = s && (e.bottom - t[1]) / s; + ts[j + 16] = s && (e.left - t[0]) / -s; + ts[j + 20] = c && (e.top - t[1]) / c; + ts[j + 24] = s && (e.right - t[0]) / -s; + ts[j + 28] = c && (e.bottom - t[1]) / c; + ts[j + 32] = c && (e.left - t[0]) / -c; + ts[j + 36] = s && (e.top - t[1]) / -s; + ts[j + 40] = c && (e.right - t[0]) / -c; + ts[j + 44] = s && (e.bottom - t[1]) / -s; + ts[j + 48] = s && (e.left - t[0]) / s; + ts[j + 52] = c && (e.top - t[1]) / -c; + ts[j + 56] = s && (e.right - t[0]) / s; + ts[j + 60] = c && (e.bottom - t[1]) / -c; + }); + var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s)); + divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale; + divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale; + divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale; + divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale; + + task._textDivProperties.set(div, divProperties); } } - return true; -} -var XMLParserBase = function () { - function XMLParserBase() { - _classCallCheck(this, XMLParserBase); + function expandBounds(width, height, boxes) { + var bounds = boxes.map(function (box, i) { + return { + x1: box.left, + y1: box.top, + x2: box.right, + y2: box.bottom, + index: i, + x1New: undefined, + x2New: undefined + }; + }); + expandBoundsLTR(width, bounds); + var expanded = new Array(boxes.length); + bounds.forEach(function (b) { + var i = b.index; + expanded[i] = { + left: b.x1New, + top: 0, + right: b.x2New, + bottom: 0 + }; + }); + boxes.map(function (box, i) { + var e = expanded[i], + b = bounds[i]; + b.x1 = box.top; + b.y1 = width - e.right; + b.x2 = box.bottom; + b.y2 = width - e.left; + b.index = i; + b.x1New = undefined; + b.x2New = undefined; + }); + expandBoundsLTR(height, bounds); + bounds.forEach(function (b) { + var i = b.index; + expanded[i].top = b.x1New; + expanded[i].bottom = b.x2New; + }); + return expanded; } - _createClass(XMLParserBase, [{ - key: '_resolveEntities', - value: function _resolveEntities(s) { - return s.replace(/&([^;]+);/g, function (all, entity) { - if (entity.substring(0, 2) === '#x') { - return String.fromCharCode(parseInt(entity.substring(2), 16)); - } else if (entity.substring(0, 1) === '#') { - return String.fromCharCode(parseInt(entity.substring(1), 10)); + function expandBoundsLTR(width, bounds) { + bounds.sort(function (a, b) { + return a.x1 - b.x1 || a.index - b.index; + }); + var fakeBoundary = { + x1: -Infinity, + y1: -Infinity, + x2: 0, + y2: Infinity, + index: -1, + x1New: 0, + x2New: 0 + }; + var horizon = [{ + start: -Infinity, + end: Infinity, + boundary: fakeBoundary + }]; + bounds.forEach(function (boundary) { + var i = 0; + + while (i < horizon.length && horizon[i].end <= boundary.y1) { + i++; + } + + var j = horizon.length - 1; + + while (j >= 0 && horizon[j].start >= boundary.y2) { + j--; + } + + var horizonPart, affectedBoundary; + var q, + k, + maxXNew = -Infinity; + + for (q = i; q <= j; q++) { + horizonPart = horizon[q]; + affectedBoundary = horizonPart.boundary; + var xNew; + + if (affectedBoundary.x2 > boundary.x1) { + xNew = affectedBoundary.index > boundary.index ? affectedBoundary.x1New : boundary.x1; + } else if (affectedBoundary.x2New === undefined) { + xNew = (affectedBoundary.x2 + boundary.x1) / 2; + } else { + xNew = affectedBoundary.x2New; } - switch (entity) { - case 'lt': - return '<'; - case 'gt': - return '>'; - case 'amp': - return '&'; - case 'quot': - return '\"'; + + if (xNew > maxXNew) { + maxXNew = xNew; } - return this.onResolveEntity(entity); - }); - } - }, { - key: '_parseContent', - value: function _parseContent(s, start) { - var pos = start, - name = void 0, - attributes = []; - function skipWs() { - while (pos < s.length && isWhitespace(s, pos)) { - ++pos; + } + + boundary.x1New = maxXNew; + + for (q = i; q <= j; q++) { + horizonPart = horizon[q]; + affectedBoundary = horizonPart.boundary; + + if (affectedBoundary.x2New === undefined) { + if (affectedBoundary.x2 > boundary.x1) { + if (affectedBoundary.index > boundary.index) { + affectedBoundary.x2New = affectedBoundary.x2; + } + } else { + affectedBoundary.x2New = maxXNew; + } + } else if (affectedBoundary.x2New > maxXNew) { + affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2); } } - while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== '>' && s[pos] !== '/') { - ++pos; - } - name = s.substring(start, pos); - skipWs(); - while (pos < s.length && s[pos] !== '>' && s[pos] !== '/' && s[pos] !== '?') { - skipWs(); - var attrName = '', - attrValue = ''; - while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== '=') { - attrName += s[pos]; - ++pos; + + var changedHorizon = [], + lastBoundary = null; + + for (q = i; q <= j; q++) { + horizonPart = horizon[q]; + affectedBoundary = horizonPart.boundary; + var useBoundary = affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary; + + if (lastBoundary === useBoundary) { + changedHorizon[changedHorizon.length - 1].end = horizonPart.end; + } else { + changedHorizon.push({ + start: horizonPart.start, + end: horizonPart.end, + boundary: useBoundary + }); + lastBoundary = useBoundary; } - skipWs(); - if (s[pos] !== '=') { - return null; + } + + if (horizon[i].start < boundary.y1) { + changedHorizon[0].start = boundary.y1; + changedHorizon.unshift({ + start: horizon[i].start, + end: boundary.y1, + boundary: horizon[i].boundary + }); + } + + if (boundary.y2 < horizon[j].end) { + changedHorizon[changedHorizon.length - 1].end = boundary.y2; + changedHorizon.push({ + start: boundary.y2, + end: horizon[j].end, + boundary: horizon[j].boundary + }); + } + + for (q = i; q <= j; q++) { + horizonPart = horizon[q]; + affectedBoundary = horizonPart.boundary; + + if (affectedBoundary.x2New !== undefined) { + continue; } - ++pos; - skipWs(); - var attrEndChar = s[pos]; - if (attrEndChar !== '\"' && attrEndChar !== '\'') { - return null; + + var used = false; + + for (k = i - 1; !used && k >= 0 && horizon[k].start >= affectedBoundary.y1; k--) { + used = horizon[k].boundary === affectedBoundary; } - var attrEndIndex = s.indexOf(attrEndChar, ++pos); - if (attrEndIndex < 0) { - return null; + + for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) { + used = horizon[k].boundary === affectedBoundary; } - attrValue = s.substring(pos, attrEndIndex); - attributes.push({ - name: attrName, - value: this._resolveEntities(attrValue) - }); - pos = attrEndIndex + 1; - skipWs(); - } - return { - name: name, - attributes: attributes, - parsed: pos - start - }; - } - }, { - key: '_parseProcessingInstruction', - value: function _parseProcessingInstruction(s, start) { - var pos = start, - name = void 0, - value = void 0; - function skipWs() { - while (pos < s.length && isWhitespace(s, pos)) { - ++pos; + + for (k = 0; !used && k < changedHorizon.length; k++) { + used = changedHorizon[k].boundary === affectedBoundary; } - } - while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== '>' && s[pos] !== '/') { - ++pos; - } - name = s.substring(start, pos); - skipWs(); - var attrStart = pos; - while (pos < s.length && (s[pos] !== '?' || s[pos + 1] !== '>')) { - ++pos; - } - value = s.substring(attrStart, pos); - return { - name: name, - value: value, - parsed: pos - start - }; - } - }, { - key: 'parseXml', - value: function parseXml(s) { - var i = 0; - while (i < s.length) { - var ch = s[i]; - var j = i; - if (ch === '<') { - ++j; - var ch2 = s[j]; - var q = void 0; - switch (ch2) { - case '/': - ++j; - q = s.indexOf('>', j); - if (q < 0) { - this.onError(XMLParserErrorCode.UnterminatedElement); - return; - } - this.onEndElement(s.substring(j, q)); - j = q + 1; - break; - case '?': - ++j; - var pi = this._parseProcessingInstruction(s, j); - if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== '?>') { - this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration); - return; - } - this.onPi(pi.name, pi.value); - j += pi.parsed + 2; - break; - case '!': - if (s.substring(j + 1, j + 3) === '--') { - q = s.indexOf('-->', j + 3); - if (q < 0) { - this.onError(XMLParserErrorCode.UnterminatedComment); - return; - } - this.onComment(s.substring(j + 3, q)); - j = q + 3; - } else if (s.substring(j + 1, j + 8) === '[CDATA[') { - q = s.indexOf(']]>', j + 8); - if (q < 0) { - this.onError(XMLParserErrorCode.UnterminatedCdat); - return; - } - this.onCdata(s.substring(j + 8, q)); - j = q + 3; - } else if (s.substring(j + 1, j + 8) === 'DOCTYPE') { - var q2 = s.indexOf('[', j + 8); - var complexDoctype = false; - q = s.indexOf('>', j + 8); - if (q < 0) { - this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); - return; - } - if (q2 > 0 && q > q2) { - q = s.indexOf(']>', j + 8); - if (q < 0) { - this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); - return; - } - complexDoctype = true; - } - var doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0)); - this.onDoctype(doctypeContent); - j = q + (complexDoctype ? 2 : 1); - } else { - this.onError(XMLParserErrorCode.MalformedElement); - return; - } - break; - default: - var content = this._parseContent(s, j); - if (content === null) { - this.onError(XMLParserErrorCode.MalformedElement); - return; - } - var isClosed = false; - if (s.substring(j + content.parsed, j + content.parsed + 2) === '/>') { - isClosed = true; - } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== '>') { - this.onError(XMLParserErrorCode.UnterminatedElement); - return; - } - this.onBeginElement(content.name, content.attributes, isClosed); - j += content.parsed + (isClosed ? 2 : 1); - break; - } - } else { - while (j < s.length && s[j] !== '<') { - j++; - } - var text = s.substring(i, j); - this.onText(this._resolveEntities(text)); + + if (!used) { + affectedBoundary.x2New = maxXNew; } - i = j; } - } - }, { - key: 'onResolveEntity', - value: function onResolveEntity(name) { - return '&' + name + ';'; - } - }, { - key: 'onPi', - value: function onPi(name, value) {} - }, { - key: 'onComment', - value: function onComment(text) {} - }, { - key: 'onCdata', - value: function onCdata(text) {} - }, { - key: 'onDoctype', - value: function onDoctype(doctypeContent) {} - }, { - key: 'onText', - value: function onText(text) {} - }, { - key: 'onBeginElement', - value: function onBeginElement(name, attributes, isEmpty) {} - }, { - key: 'onEndElement', - value: function onEndElement(name) {} - }, { - key: 'onError', - value: function onError(code) {} - }]); - - return XMLParserBase; -}(); -var SimpleDOMNode = function () { - function SimpleDOMNode(nodeName, nodeValue) { - _classCallCheck(this, SimpleDOMNode); + Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon)); + }); + horizon.forEach(function (horizonPart) { + var affectedBoundary = horizonPart.boundary; - this.nodeName = nodeName; - this.nodeValue = nodeValue; - Object.defineProperty(this, 'parentNode', { - value: null, - writable: true + if (affectedBoundary.x2New === undefined) { + affectedBoundary.x2New = Math.max(width, affectedBoundary.x2); + } }); } - _createClass(SimpleDOMNode, [{ - key: 'hasChildNodes', - value: function hasChildNodes() { - return this.childNodes && this.childNodes.length > 0; - } - }, { - key: 'firstChild', - get: function get() { - return this.childNodes[0]; - } - }, { - key: 'nextSibling', - get: function get() { - var index = this.parentNode.childNodes.indexOf(this); - return this.parentNode.childNodes[index + 1]; - } - }, { - key: 'textContent', - get: function get() { - if (!this.childNodes) { - return this.nodeValue || ''; - } - return this.childNodes.map(function (child) { - return child.textContent; - }).join(''); - } - }]); + function TextLayerRenderTask(_ref) { + var _this = this; + + var textContent = _ref.textContent, + textContentStream = _ref.textContentStream, + container = _ref.container, + viewport = _ref.viewport, + textDivs = _ref.textDivs, + textContentItemsStr = _ref.textContentItemsStr, + enhanceTextSelection = _ref.enhanceTextSelection; + this._textContent = textContent; + this._textContentStream = textContentStream; + this._container = container; + this._viewport = viewport; + this._textDivs = textDivs || []; + this._textContentItemsStr = textContentItemsStr || []; + this._enhanceTextSelection = !!enhanceTextSelection; + this._fontInspectorEnabled = !!(globalThis.FontInspector && globalThis.FontInspector.enabled); + this._reader = null; + this._layoutTextLastFontSize = null; + this._layoutTextLastFontFamily = null; + this._layoutTextCtx = null; + this._textDivProperties = new WeakMap(); + this._renderingDone = false; + this._canceled = false; + this._capability = (0, _util.createPromiseCapability)(); + this._renderTimer = null; + this._bounds = []; - return SimpleDOMNode; -}(); + this._capability.promise["finally"](function () { + if (_this._layoutTextCtx) { + _this._layoutTextCtx.canvas.width = 0; + _this._layoutTextCtx.canvas.height = 0; + _this._layoutTextCtx = null; + } + })["catch"](function () {}); + } -var SimpleXMLParser = function (_XMLParserBase) { - _inherits(SimpleXMLParser, _XMLParserBase); + TextLayerRenderTask.prototype = { + get promise() { + return this._capability.promise; + }, - function SimpleXMLParser() { - _classCallCheck(this, SimpleXMLParser); + cancel: function TextLayer_cancel() { + this._canceled = true; - var _this = _possibleConstructorReturn(this, (SimpleXMLParser.__proto__ || Object.getPrototypeOf(SimpleXMLParser)).call(this)); + if (this._reader) { + this._reader.cancel(new _util.AbortException("TextLayer task cancelled.")); - _this._currentFragment = null; - _this._stack = null; - _this._errorCode = XMLParserErrorCode.NoError; - return _this; - } + this._reader = null; + } - _createClass(SimpleXMLParser, [{ - key: 'parseFromString', - value: function parseFromString(data) { - this._currentFragment = []; - this._stack = []; - this._errorCode = XMLParserErrorCode.NoError; - this.parseXml(data); - if (this._errorCode !== XMLParserErrorCode.NoError) { - return undefined; + if (this._renderTimer !== null) { + clearTimeout(this._renderTimer); + this._renderTimer = null; } - var _currentFragment = _slicedToArray(this._currentFragment, 1), - documentElement = _currentFragment[0]; + this._capability.reject(new Error("TextLayer task cancelled.")); + }, + _processItems: function _processItems(items, styleCache) { + for (var i = 0, len = items.length; i < len; i++) { + this._textContentItemsStr.push(items[i].str); - if (!documentElement) { - return undefined; - } - return { documentElement: documentElement }; - } - }, { - key: 'onResolveEntity', - value: function onResolveEntity(name) { - switch (name) { - case 'apos': - return '\''; - } - return _get(SimpleXMLParser.prototype.__proto__ || Object.getPrototypeOf(SimpleXMLParser.prototype), 'onResolveEntity', this).call(this, name); - } - }, { - key: 'onText', - value: function onText(text) { - if (isWhitespaceString(text)) { - return; + appendText(this, items[i], styleCache); } - var node = new SimpleDOMNode('#text', text); - this._currentFragment.push(node); - } - }, { - key: 'onCdata', - value: function onCdata(text) { - var node = new SimpleDOMNode('#text', text); - this._currentFragment.push(node); - } - }, { - key: 'onBeginElement', - value: function onBeginElement(name, attributes, isEmpty) { - var node = new SimpleDOMNode(name); - node.childNodes = []; - this._currentFragment.push(node); - if (isEmpty) { + }, + _layoutText: function _layoutText(textDiv) { + var textDivProperties = this._textDivProperties.get(textDiv); + + if (textDivProperties.isWhitespace) { return; } - this._stack.push(this._currentFragment); - this._currentFragment = node.childNodes; - } - }, { - key: 'onEndElement', - value: function onEndElement(name) { - this._currentFragment = this._stack.pop(); - var lastElement = this._currentFragment[this._currentFragment.length - 1]; - for (var i = 0, ii = lastElement.childNodes.length; i < ii; i++) { - lastElement.childNodes[i].parentNode = lastElement; - } - } - }, { - key: 'onError', - value: function onError(code) { - this._errorCode = code; - } - }]); - - return SimpleXMLParser; -}(XMLParserBase); - -exports.SimpleXMLParser = SimpleXMLParser; - -/***/ }), -/* 143 */ -/***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; + var transform = ""; + if (textDivProperties.canvasWidth !== 0) { + var _textDiv$style = textDiv.style, + fontSize = _textDiv$style.fontSize, + fontFamily = _textDiv$style.fontFamily; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.PDFDataTransportStream = undefined; + if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) { + this._layoutTextCtx.font = "".concat(fontSize, " ").concat(fontFamily); + this._layoutTextLastFontSize = fontSize; + this._layoutTextLastFontFamily = fontFamily; + } -var _regenerator = __w_pdfjs_require__(137); + var _this$_layoutTextCtx$ = this._layoutTextCtx.measureText(textDiv.textContent), + width = _this$_layoutTextCtx$.width; -var _regenerator2 = _interopRequireDefault(_regenerator); + if (width > 0) { + textDivProperties.scale = textDivProperties.canvasWidth / width; + transform = "scaleX(".concat(textDivProperties.scale, ")"); + } + } -var _util = __w_pdfjs_require__(1); + if (textDivProperties.angle !== 0) { + transform = "rotate(".concat(textDivProperties.angle, "deg) ").concat(transform); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (transform.length > 0) { + if (this._enhanceTextSelection) { + textDivProperties.originalTransform = transform; + } -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + textDiv.style.transform = transform; + } -var PDFDataTransportStream = function PDFDataTransportStreamClosure() { - function PDFDataTransportStream(params, pdfDataRangeTransport) { - var _this = this; + this._textDivProperties.set(textDiv, textDivProperties); - (0, _util.assert)(pdfDataRangeTransport); - this._queuedChunks = []; - var initialData = params.initialData; - if (initialData && initialData.length > 0) { - var buffer = new Uint8Array(initialData).buffer; - this._queuedChunks.push(buffer); - } - this._pdfDataRangeTransport = pdfDataRangeTransport; - this._isStreamingSupported = !params.disableStream; - this._isRangeSupported = !params.disableRange; - this._contentLength = params.length; - this._fullRequestReader = null; - this._rangeReaders = []; - this._pdfDataRangeTransport.addRangeListener(function (begin, chunk) { - _this._onReceiveData({ - begin: begin, - chunk: chunk - }); - }); - this._pdfDataRangeTransport.addProgressListener(function (loaded) { - _this._onProgress({ loaded: loaded }); - }); - this._pdfDataRangeTransport.addProgressiveReadListener(function (chunk) { - _this._onReceiveData({ chunk: chunk }); - }); - this._pdfDataRangeTransport.transportReady(); - } - PDFDataTransportStream.prototype = { - _onReceiveData: function PDFDataTransportStream_onReceiveData(args) { - var buffer = new Uint8Array(args.chunk).buffer; - if (args.begin === undefined) { - if (this._fullRequestReader) { - this._fullRequestReader._enqueue(buffer); - } else { - this._queuedChunks.push(buffer); - } - } else { - var found = this._rangeReaders.some(function (rangeReader) { - if (rangeReader._begin !== args.begin) { - return false; - } - rangeReader._enqueue(buffer); - return true; - }); - (0, _util.assert)(found); - } - }, - _onProgress: function PDFDataTransportStream_onDataProgress(evt) { - if (this._rangeReaders.length > 0) { - var firstReader = this._rangeReaders[0]; - if (firstReader.onProgress) { - firstReader.onProgress({ loaded: evt.loaded }); - } - } - }, - _removeRangeReader: function PDFDataTransportStream_removeRangeReader(reader) { - var i = this._rangeReaders.indexOf(reader); - if (i >= 0) { - this._rangeReaders.splice(i, 1); - } - }, - getFullReader: function PDFDataTransportStream_getFullReader() { - (0, _util.assert)(!this._fullRequestReader); - var queuedChunks = this._queuedChunks; - this._queuedChunks = null; - return new PDFDataTransportStreamReader(this, queuedChunks); - }, - getRangeReader: function PDFDataTransportStream_getRangeReader(begin, end) { - var reader = new PDFDataTransportStreamRangeReader(this, begin, end); - this._pdfDataRangeTransport.requestDataRange(begin, end); - this._rangeReaders.push(reader); - return reader; + this._container.appendChild(textDiv); }, - cancelAllRequests: function PDFDataTransportStream_cancelAllRequests(reason) { - if (this._fullRequestReader) { - this._fullRequestReader.cancel(reason); - } - var readers = this._rangeReaders.slice(0); - readers.forEach(function (rangeReader) { - rangeReader.cancel(reason); + _render: function TextLayer_render(timeout) { + var _this2 = this; + + var capability = (0, _util.createPromiseCapability)(); + var styleCache = Object.create(null); + var canvas = document.createElement("canvas"); + canvas.mozOpaque = true; + this._layoutTextCtx = canvas.getContext("2d", { + alpha: false }); - this._pdfDataRangeTransport.abort(); - } - }; - function PDFDataTransportStreamReader(stream, queuedChunks) { - this._stream = stream; - this._done = false; - this._filename = null; - this._queuedChunks = queuedChunks || []; - this._requests = []; - this._headersReady = Promise.resolve(); - stream._fullRequestReader = this; - this.onProgress = null; - } - PDFDataTransportStreamReader.prototype = { - _enqueue: function PDFDataTransportStreamReader_enqueue(chunk) { - if (this._done) { - return; - } - if (this._requests.length > 0) { - var requestCapability = this._requests.shift(); - requestCapability.resolve({ - value: chunk, - done: false - }); - return; - } - this._queuedChunks.push(chunk); - }, - get headersReady() { - return this._headersReady; - }, - get filename() { - return this._filename; - }, - get isRangeSupported() { - return this._stream._isRangeSupported; - }, - get isStreamingSupported() { - return this._stream._isStreamingSupported; - }, - get contentLength() { - return this._stream._contentLength; - }, - read: function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { - var chunk, requestCapability; - return _regenerator2.default.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (!(this._queuedChunks.length > 0)) { - _context.next = 3; - break; - } - chunk = this._queuedChunks.shift(); - return _context.abrupt('return', { - value: chunk, - done: false - }); + if (this._textContent) { + var textItems = this._textContent.items; + var textStyles = this._textContent.styles; - case 3: - if (!this._done) { - _context.next = 5; - break; - } + this._processItems(textItems, textStyles); - return _context.abrupt('return', { - value: undefined, - done: true - }); + capability.resolve(); + } else if (this._textContentStream) { + var pump = function pump() { + _this2._reader.read().then(function (_ref2) { + var value = _ref2.value, + done = _ref2.done; - case 5: - requestCapability = (0, _util.createPromiseCapability)(); + if (done) { + capability.resolve(); + return; + } - this._requests.push(requestCapability); - return _context.abrupt('return', requestCapability.promise); + Object.assign(styleCache, value.styles); + + _this2._processItems(value.items, styleCache); - case 8: - case 'end': - return _context.stop(); - } - } - }, _callee, this); - })); + pump(); + }, capability.reject); + }; - function read() { - return _ref.apply(this, arguments); + this._reader = this._textContentStream.getReader(); + pump(); + } else { + throw new Error('Neither "textContent" nor "textContentStream"' + " parameters specified."); } - return read; - }(), + capability.promise.then(function () { + styleCache = null; - cancel: function PDFDataTransportStreamReader_cancel(reason) { - this._done = true; - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); - }); - this._requests = []; - } - }; - function PDFDataTransportStreamRangeReader(stream, begin, end) { - this._stream = stream; - this._begin = begin; - this._end = end; - this._queuedChunk = null; - this._requests = []; - this._done = false; - this.onProgress = null; - } - PDFDataTransportStreamRangeReader.prototype = { - _enqueue: function PDFDataTransportStreamRangeReader_enqueue(chunk) { - if (this._done) { + if (!timeout) { + render(_this2); + } else { + _this2._renderTimer = setTimeout(function () { + render(_this2); + _this2._renderTimer = null; + }, timeout); + } + }, this._capability.reject); + }, + expandTextDivs: function TextLayer_expandTextDivs(expandDivs) { + if (!this._enhanceTextSelection || !this._renderingDone) { return; } - if (this._requests.length === 0) { - this._queuedChunk = chunk; - } else { - var requestsCapability = this._requests.shift(); - requestsCapability.resolve({ - value: chunk, - done: false - }); - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); - }); - this._requests = []; + + if (this._bounds !== null) { + expand(this); + this._bounds = null; } - this._done = true; - this._stream._removeRangeReader(this); - }, - get isStreamingSupported() { - return false; - }, - read: function () { - var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() { - var chunk, requestCapability; - return _regenerator2.default.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - if (!this._queuedChunk) { - _context2.next = 4; - break; - } - chunk = this._queuedChunk; + var transformBuf = [], + paddingBuf = []; - this._queuedChunk = null; - return _context2.abrupt('return', { - value: chunk, - done: false - }); + for (var i = 0, ii = this._textDivs.length; i < ii; i++) { + var div = this._textDivs[i]; - case 4: - if (!this._done) { - _context2.next = 6; - break; - } + var divProps = this._textDivProperties.get(div); - return _context2.abrupt('return', { - value: undefined, - done: true - }); + if (divProps.isWhitespace) { + continue; + } - case 6: - requestCapability = (0, _util.createPromiseCapability)(); + if (expandDivs) { + transformBuf.length = 0; + paddingBuf.length = 0; - this._requests.push(requestCapability); - return _context2.abrupt('return', requestCapability.promise); + if (divProps.originalTransform) { + transformBuf.push(divProps.originalTransform); + } - case 9: - case 'end': - return _context2.stop(); - } + if (divProps.paddingTop > 0) { + paddingBuf.push("".concat(divProps.paddingTop, "px")); + transformBuf.push("translateY(".concat(-divProps.paddingTop, "px)")); + } else { + paddingBuf.push(0); } - }, _callee2, this); - })); - function read() { - return _ref2.apply(this, arguments); - } + if (divProps.paddingRight > 0) { + paddingBuf.push("".concat(divProps.paddingRight / divProps.scale, "px")); + } else { + paddingBuf.push(0); + } - return read; - }(), + if (divProps.paddingBottom > 0) { + paddingBuf.push("".concat(divProps.paddingBottom, "px")); + } else { + paddingBuf.push(0); + } - cancel: function PDFDataTransportStreamRangeReader_cancel(reason) { - this._done = true; - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); - }); - this._requests = []; - this._stream._removeRangeReader(this); + if (divProps.paddingLeft > 0) { + paddingBuf.push("".concat(divProps.paddingLeft / divProps.scale, "px")); + transformBuf.push("translateX(".concat(-divProps.paddingLeft / divProps.scale, "px)")); + } else { + paddingBuf.push(0); + } + + div.style.padding = paddingBuf.join(" "); + + if (transformBuf.length) { + div.style.transform = transformBuf.join(" "); + } + } else { + div.style.padding = null; + div.style.transform = divProps.originalTransform; + } + } } }; - return PDFDataTransportStream; + + function renderTextLayer(renderParameters) { + var task = new TextLayerRenderTask({ + textContent: renderParameters.textContent, + textContentStream: renderParameters.textContentStream, + container: renderParameters.container, + viewport: renderParameters.viewport, + textDivs: renderParameters.textDivs, + textContentItemsStr: renderParameters.textContentItemsStr, + enhanceTextSelection: renderParameters.enhanceTextSelection + }); + + task._render(renderParameters.timeout); + + return task; + } + + return renderTextLayer; }(); -exports.PDFDataTransportStream = PDFDataTransportStream; + +exports.renderTextLayer = renderTextLayer; /***/ }), -/* 144 */ +/* 211 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -14530,969 +21930,1734 @@ exports.PDFDataTransportStream = PDFDataTransportStream; Object.defineProperty(exports, "__esModule", { value: true }); -exports.WebGLContext = undefined; +exports.SVGGraphics = void 0; + +var _util = __w_pdfjs_require__(5); + +var _display_utils = __w_pdfjs_require__(1); + +var _is_node = __w_pdfjs_require__(7); + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var SVGGraphics = function SVGGraphics() { + throw new Error("Not implemented: SVGGraphics"); +}; + +exports.SVGGraphics = SVGGraphics; +{ + var opListToTree = function opListToTree(opList) { + var opTree = []; + var tmp = []; + + var _iterator = _createForOfIteratorHelper(opList), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var opListElement = _step.value; + + if (opListElement.fn === "save") { + opTree.push({ + fnId: 92, + fn: "group", + items: [] + }); + tmp.push(opTree); + opTree = opTree[opTree.length - 1].items; + continue; + } + + if (opListElement.fn === "restore") { + opTree = tmp.pop(); + } else { + opTree.push(opListElement); + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + return opTree; + }; + + var pf = function pf(value) { + if (Number.isInteger(value)) { + return value.toString(); + } + + var s = value.toFixed(10); + var i = s.length - 1; + + if (s[i] !== "0") { + return s; + } + + do { + i--; + } while (s[i] === "0"); + + return s.substring(0, s[i] === "." ? i : i + 1); + }; + + var pm = function pm(m) { + if (m[4] === 0 && m[5] === 0) { + if (m[1] === 0 && m[2] === 0) { + if (m[0] === 1 && m[3] === 1) { + return ""; + } + + return "scale(".concat(pf(m[0]), " ").concat(pf(m[3]), ")"); + } + + if (m[0] === m[3] && m[1] === -m[2]) { + var a = Math.acos(m[0]) * 180 / Math.PI; + return "rotate(".concat(pf(a), ")"); + } + } else { + if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) { + return "translate(".concat(pf(m[4]), " ").concat(pf(m[5]), ")"); + } + } + + return "matrix(".concat(pf(m[0]), " ").concat(pf(m[1]), " ").concat(pf(m[2]), " ").concat(pf(m[3]), " ").concat(pf(m[4]), " ") + "".concat(pf(m[5]), ")"); + }; + + var SVG_DEFAULTS = { + fontStyle: "normal", + fontWeight: "normal", + fillColor: "#000000" + }; + var XML_NS = "http://www.w3.org/XML/1998/namespace"; + var XLINK_NS = "http://www.w3.org/1999/xlink"; + var LINE_CAP_STYLES = ["butt", "round", "square"]; + var LINE_JOIN_STYLES = ["miter", "round", "bevel"]; + + var convertImgDataToPng = function () { + var PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]); + var CHUNK_WRAPPER_SIZE = 12; + var crcTable = new Int32Array(256); + + for (var i = 0; i < 256; i++) { + var c = i; + + for (var h = 0; h < 8; h++) { + if (c & 1) { + c = 0xedb88320 ^ c >> 1 & 0x7fffffff; + } else { + c = c >> 1 & 0x7fffffff; + } + } + + crcTable[i] = c; + } + + function crc32(data, start, end) { + var crc = -1; + + for (var _i = start; _i < end; _i++) { + var a = (crc ^ data[_i]) & 0xff; + var b = crcTable[a]; + crc = crc >>> 8 ^ b; + } + + return crc ^ -1; + } + + function writePngChunk(type, body, data, offset) { + var p = offset; + var len = body.length; + data[p] = len >> 24 & 0xff; + data[p + 1] = len >> 16 & 0xff; + data[p + 2] = len >> 8 & 0xff; + data[p + 3] = len & 0xff; + p += 4; + data[p] = type.charCodeAt(0) & 0xff; + data[p + 1] = type.charCodeAt(1) & 0xff; + data[p + 2] = type.charCodeAt(2) & 0xff; + data[p + 3] = type.charCodeAt(3) & 0xff; + p += 4; + data.set(body, p); + p += body.length; + var crc = crc32(data, offset + 4, p); + data[p] = crc >> 24 & 0xff; + data[p + 1] = crc >> 16 & 0xff; + data[p + 2] = crc >> 8 & 0xff; + data[p + 3] = crc & 0xff; + } -var _util = __w_pdfjs_require__(1); + function adler32(data, start, end) { + var a = 1; + var b = 0; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + for (var _i2 = start; _i2 < end; ++_i2) { + a = (a + (data[_i2] & 0xff)) % 65521; + b = (b + a) % 65521; + } -var WebGLContext = function () { - function WebGLContext(_ref) { - var _ref$enable = _ref.enable, - enable = _ref$enable === undefined ? false : _ref$enable; + return b << 16 | a; + } - _classCallCheck(this, WebGLContext); + function deflateSync(literals) { + if (!_is_node.isNodeJS) { + return deflateSyncUncompressed(literals); + } - this._enabled = enable === true; - } + try { + var input; - _createClass(WebGLContext, [{ - key: 'composeSMask', - value: function composeSMask(_ref2) { - var layer = _ref2.layer, - mask = _ref2.mask, - properties = _ref2.properties; + if (parseInt(process.versions.node) >= 8) { + input = literals; + } else { + input = Buffer.from(literals); + } - return WebGLUtils.composeSMask(layer, mask, properties); - } - }, { - key: 'drawFigures', - value: function drawFigures(_ref3) { - var width = _ref3.width, - height = _ref3.height, - backgroundColor = _ref3.backgroundColor, - figures = _ref3.figures, - context = _ref3.context; + var output = require("zlib").deflateSync(input, { + level: 9 + }); - return WebGLUtils.drawFigures(width, height, backgroundColor, figures, context); - } - }, { - key: 'clear', - value: function clear() { - WebGLUtils.cleanup(); - } - }, { - key: 'isEnabled', - get: function get() { - var enabled = this._enabled; - if (enabled) { - enabled = WebGLUtils.tryInitGL(); + return output instanceof Uint8Array ? output : new Uint8Array(output); + } catch (e) { + (0, _util.warn)("Not compressing PNG because zlib.deflateSync is unavailable: " + e); } - return (0, _util.shadow)(this, 'isEnabled', enabled); - } - }]); - - return WebGLContext; -}(); -var WebGLUtils = function WebGLUtilsClosure() { - function loadShader(gl, code, shaderType) { - var shader = gl.createShader(shaderType); - gl.shaderSource(shader, code); - gl.compileShader(shader); - var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS); - if (!compiled) { - var errorMsg = gl.getShaderInfoLog(shader); - throw new Error('Error during shader compilation: ' + errorMsg); - } - return shader; - } - function createVertexShader(gl, code) { - return loadShader(gl, code, gl.VERTEX_SHADER); - } - function createFragmentShader(gl, code) { - return loadShader(gl, code, gl.FRAGMENT_SHADER); - } - function createProgram(gl, shaders) { - var program = gl.createProgram(); - for (var i = 0, ii = shaders.length; i < ii; ++i) { - gl.attachShader(program, shaders[i]); - } - gl.linkProgram(program); - var linked = gl.getProgramParameter(program, gl.LINK_STATUS); - if (!linked) { - var errorMsg = gl.getProgramInfoLog(program); - throw new Error('Error during program linking: ' + errorMsg); - } - return program; - } - function createTexture(gl, image, textureId) { - gl.activeTexture(textureId); - var texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); - return texture; - } - var currentGL, currentCanvas; - function generateGL() { - if (currentGL) { - return; - } - currentCanvas = document.createElement('canvas'); - currentGL = currentCanvas.getContext('webgl', { premultipliedalpha: false }); - } - var smaskVertexShaderCode = '\ - attribute vec2 a_position; \ - attribute vec2 a_texCoord; \ - \ - uniform vec2 u_resolution; \ - \ - varying vec2 v_texCoord; \ - \ - void main() { \ - vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \ - gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ - \ - v_texCoord = a_texCoord; \ - } '; - var smaskFragmentShaderCode = '\ - precision mediump float; \ - \ - uniform vec4 u_backdrop; \ - uniform int u_subtype; \ - uniform sampler2D u_image; \ - uniform sampler2D u_mask; \ - \ - varying vec2 v_texCoord; \ - \ - void main() { \ - vec4 imageColor = texture2D(u_image, v_texCoord); \ - vec4 maskColor = texture2D(u_mask, v_texCoord); \ - if (u_backdrop.a > 0.0) { \ - maskColor.rgb = maskColor.rgb * maskColor.a + \ - u_backdrop.rgb * (1.0 - maskColor.a); \ - } \ - float lum; \ - if (u_subtype == 0) { \ - lum = maskColor.a; \ - } else { \ - lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \ - maskColor.b * 0.11; \ - } \ - imageColor.a *= lum; \ - imageColor.rgb *= imageColor.a; \ - gl_FragColor = imageColor; \ - } '; - var smaskCache = null; - function initSmaskGL() { - var canvas, gl; - generateGL(); - canvas = currentCanvas; - currentCanvas = null; - gl = currentGL; - currentGL = null; - var vertexShader = createVertexShader(gl, smaskVertexShaderCode); - var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode); - var program = createProgram(gl, [vertexShader, fragmentShader]); - gl.useProgram(program); - var cache = {}; - cache.gl = gl; - cache.canvas = canvas; - cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution'); - cache.positionLocation = gl.getAttribLocation(program, 'a_position'); - cache.backdropLocation = gl.getUniformLocation(program, 'u_backdrop'); - cache.subtypeLocation = gl.getUniformLocation(program, 'u_subtype'); - var texCoordLocation = gl.getAttribLocation(program, 'a_texCoord'); - var texLayerLocation = gl.getUniformLocation(program, 'u_image'); - var texMaskLocation = gl.getUniformLocation(program, 'u_mask'); - var texCoordBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0]), gl.STATIC_DRAW); - gl.enableVertexAttribArray(texCoordLocation); - gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0); - gl.uniform1i(texLayerLocation, 0); - gl.uniform1i(texMaskLocation, 1); - smaskCache = cache; - } - function composeSMask(layer, mask, properties) { - var width = layer.width, - height = layer.height; - if (!smaskCache) { - initSmaskGL(); - } - var cache = smaskCache, - canvas = cache.canvas, - gl = cache.gl; - canvas.width = width; - canvas.height = height; - gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); - gl.uniform2f(cache.resolutionLocation, width, height); - if (properties.backdrop) { - gl.uniform4f(cache.resolutionLocation, properties.backdrop[0], properties.backdrop[1], properties.backdrop[2], 1); - } else { - gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0); + return deflateSyncUncompressed(literals); } - gl.uniform1i(cache.subtypeLocation, properties.subtype === 'Luminosity' ? 1 : 0); - var texture = createTexture(gl, layer, gl.TEXTURE0); - var maskTexture = createTexture(gl, mask, gl.TEXTURE1); - var buffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, width, 0, 0, height, 0, height, width, 0, width, height]), gl.STATIC_DRAW); - gl.enableVertexAttribArray(cache.positionLocation); - gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); - gl.clearColor(0, 0, 0, 0); - gl.enable(gl.BLEND); - gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - gl.clear(gl.COLOR_BUFFER_BIT); - gl.drawArrays(gl.TRIANGLES, 0, 6); - gl.flush(); - gl.deleteTexture(texture); - gl.deleteTexture(maskTexture); - gl.deleteBuffer(buffer); - return canvas; - } - var figuresVertexShaderCode = '\ - attribute vec2 a_position; \ - attribute vec3 a_color; \ - \ - uniform vec2 u_resolution; \ - uniform vec2 u_scale; \ - uniform vec2 u_offset; \ - \ - varying vec4 v_color; \ - \ - void main() { \ - vec2 position = (a_position + u_offset) * u_scale; \ - vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \ - gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ - \ - v_color = vec4(a_color / 255.0, 1.0); \ - } '; - var figuresFragmentShaderCode = '\ - precision mediump float; \ - \ - varying vec4 v_color; \ - \ - void main() { \ - gl_FragColor = v_color; \ - } '; - var figuresCache = null; - function initFiguresGL() { - var canvas, gl; - generateGL(); - canvas = currentCanvas; - currentCanvas = null; - gl = currentGL; - currentGL = null; - var vertexShader = createVertexShader(gl, figuresVertexShaderCode); - var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode); - var program = createProgram(gl, [vertexShader, fragmentShader]); - gl.useProgram(program); - var cache = {}; - cache.gl = gl; - cache.canvas = canvas; - cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution'); - cache.scaleLocation = gl.getUniformLocation(program, 'u_scale'); - cache.offsetLocation = gl.getUniformLocation(program, 'u_offset'); - cache.positionLocation = gl.getAttribLocation(program, 'a_position'); - cache.colorLocation = gl.getAttribLocation(program, 'a_color'); - figuresCache = cache; - } - function drawFigures(width, height, backgroundColor, figures, context) { - if (!figuresCache) { - initFiguresGL(); + + function deflateSyncUncompressed(literals) { + var len = literals.length; + var maxBlockLength = 0xffff; + var deflateBlocks = Math.ceil(len / maxBlockLength); + var idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4); + var pi = 0; + idat[pi++] = 0x78; + idat[pi++] = 0x9c; + var pos = 0; + + while (len > maxBlockLength) { + idat[pi++] = 0x00; + idat[pi++] = 0xff; + idat[pi++] = 0xff; + idat[pi++] = 0x00; + idat[pi++] = 0x00; + idat.set(literals.subarray(pos, pos + maxBlockLength), pi); + pi += maxBlockLength; + pos += maxBlockLength; + len -= maxBlockLength; + } + + idat[pi++] = 0x01; + idat[pi++] = len & 0xff; + idat[pi++] = len >> 8 & 0xff; + idat[pi++] = ~len & 0xffff & 0xff; + idat[pi++] = (~len & 0xffff) >> 8 & 0xff; + idat.set(literals.subarray(pos), pi); + pi += literals.length - pos; + var adler = adler32(literals, 0, literals.length); + idat[pi++] = adler >> 24 & 0xff; + idat[pi++] = adler >> 16 & 0xff; + idat[pi++] = adler >> 8 & 0xff; + idat[pi++] = adler & 0xff; + return idat; } - var cache = figuresCache, - canvas = cache.canvas, - gl = cache.gl; - canvas.width = width; - canvas.height = height; - gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); - gl.uniform2f(cache.resolutionLocation, width, height); - var count = 0; - var i, ii, rows; - for (i = 0, ii = figures.length; i < ii; i++) { - switch (figures[i].type) { - case 'lattice': - rows = figures[i].coords.length / figures[i].verticesPerRow | 0; - count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6; + + function encode(imgData, kind, forceDataSchema, isMask) { + var width = imgData.width; + var height = imgData.height; + var bitDepth, colorType, lineSize; + var bytes = imgData.data; + + switch (kind) { + case _util.ImageKind.GRAYSCALE_1BPP: + colorType = 0; + bitDepth = 1; + lineSize = width + 7 >> 3; break; - case 'triangles': - count += figures[i].coords.length; + + case _util.ImageKind.RGB_24BPP: + colorType = 2; + bitDepth = 8; + lineSize = width * 3; + break; + + case _util.ImageKind.RGBA_32BPP: + colorType = 6; + bitDepth = 8; + lineSize = width * 4; break; + + default: + throw new Error("invalid format"); + } + + var literals = new Uint8Array((1 + lineSize) * height); + var offsetLiterals = 0, + offsetBytes = 0; + + for (var y = 0; y < height; ++y) { + literals[offsetLiterals++] = 0; + literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals); + offsetBytes += lineSize; + offsetLiterals += lineSize; + } + + if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) { + offsetLiterals = 0; + + for (var _y = 0; _y < height; _y++) { + offsetLiterals++; + + for (var _i3 = 0; _i3 < lineSize; _i3++) { + literals[offsetLiterals++] ^= 0xff; + } + } } + + var ihdr = new Uint8Array([width >> 24 & 0xff, width >> 16 & 0xff, width >> 8 & 0xff, width & 0xff, height >> 24 & 0xff, height >> 16 & 0xff, height >> 8 & 0xff, height & 0xff, bitDepth, colorType, 0x00, 0x00, 0x00]); + var idat = deflateSync(literals); + var pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length; + var data = new Uint8Array(pngLength); + var offset = 0; + data.set(PNG_HEADER, offset); + offset += PNG_HEADER.length; + writePngChunk("IHDR", ihdr, data, offset); + offset += CHUNK_WRAPPER_SIZE + ihdr.length; + writePngChunk("IDATA", idat, data, offset); + offset += CHUNK_WRAPPER_SIZE + idat.length; + writePngChunk("IEND", new Uint8Array(0), data, offset); + return (0, _util.createObjectURL)(data, "image/png", forceDataSchema); } - var coords = new Float32Array(count * 2); - var colors = new Uint8Array(count * 3); - var coordsMap = context.coords, - colorsMap = context.colors; - var pIndex = 0, - cIndex = 0; - for (i = 0, ii = figures.length; i < ii; i++) { - var figure = figures[i], - ps = figure.coords, - cs = figure.colors; - switch (figure.type) { - case 'lattice': - var cols = figure.verticesPerRow; - rows = ps.length / cols | 0; - for (var row = 1; row < rows; row++) { - var offset = row * cols + 1; - for (var col = 1; col < cols; col++, offset++) { - coords[pIndex] = coordsMap[ps[offset - cols - 1]]; - coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1]; - coords[pIndex + 2] = coordsMap[ps[offset - cols]]; - coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1]; - coords[pIndex + 4] = coordsMap[ps[offset - 1]]; - coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1]; - colors[cIndex] = colorsMap[cs[offset - cols - 1]]; - colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1]; - colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2]; - colors[cIndex + 3] = colorsMap[cs[offset - cols]]; - colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1]; - colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2]; - colors[cIndex + 6] = colorsMap[cs[offset - 1]]; - colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1]; - colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2]; - coords[pIndex + 6] = coords[pIndex + 2]; - coords[pIndex + 7] = coords[pIndex + 3]; - coords[pIndex + 8] = coords[pIndex + 4]; - coords[pIndex + 9] = coords[pIndex + 5]; - coords[pIndex + 10] = coordsMap[ps[offset]]; - coords[pIndex + 11] = coordsMap[ps[offset] + 1]; - colors[cIndex + 9] = colors[cIndex + 3]; - colors[cIndex + 10] = colors[cIndex + 4]; - colors[cIndex + 11] = colors[cIndex + 5]; - colors[cIndex + 12] = colors[cIndex + 6]; - colors[cIndex + 13] = colors[cIndex + 7]; - colors[cIndex + 14] = colors[cIndex + 8]; - colors[cIndex + 15] = colorsMap[cs[offset]]; - colors[cIndex + 16] = colorsMap[cs[offset] + 1]; - colors[cIndex + 17] = colorsMap[cs[offset] + 2]; - pIndex += 12; - cIndex += 18; + + return function convertImgDataToPng(imgData, forceDataSchema, isMask) { + var kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind; + return encode(imgData, kind, forceDataSchema, isMask); + }; + }(); + + var SVGExtraState = /*#__PURE__*/function () { + function SVGExtraState() { + _classCallCheck(this, SVGExtraState); + + this.fontSizeScale = 1; + this.fontWeight = SVG_DEFAULTS.fontWeight; + this.fontSize = 0; + this.textMatrix = _util.IDENTITY_MATRIX; + this.fontMatrix = _util.FONT_IDENTITY_MATRIX; + this.leading = 0; + this.textRenderingMode = _util.TextRenderingMode.FILL; + this.textMatrixScale = 1; + this.x = 0; + this.y = 0; + this.lineX = 0; + this.lineY = 0; + this.charSpacing = 0; + this.wordSpacing = 0; + this.textHScale = 1; + this.textRise = 0; + this.fillColor = SVG_DEFAULTS.fillColor; + this.strokeColor = "#000000"; + this.fillAlpha = 1; + this.strokeAlpha = 1; + this.lineWidth = 1; + this.lineJoin = ""; + this.lineCap = ""; + this.miterLimit = 0; + this.dashArray = []; + this.dashPhase = 0; + this.dependencies = []; + this.activeClipUrl = null; + this.clipGroup = null; + this.maskId = ""; + } + + _createClass(SVGExtraState, [{ + key: "clone", + value: function clone() { + return Object.create(this); + } + }, { + key: "setCurrentPoint", + value: function setCurrentPoint(x, y) { + this.x = x; + this.y = y; + } + }]); + + return SVGExtraState; + }(); + + var clipCount = 0; + var maskCount = 0; + var shadingCount = 0; + + exports.SVGGraphics = SVGGraphics = /*#__PURE__*/function () { + function SVGGraphics(commonObjs, objs) { + var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + _classCallCheck(this, SVGGraphics); + + this.svgFactory = new _display_utils.DOMSVGFactory(); + this.current = new SVGExtraState(); + this.transformMatrix = _util.IDENTITY_MATRIX; + this.transformStack = []; + this.extraStack = []; + this.commonObjs = commonObjs; + this.objs = objs; + this.pendingClip = null; + this.pendingEOFill = false; + this.embedFonts = false; + this.embeddedFonts = Object.create(null); + this.cssStyle = null; + this.forceDataSchema = !!forceDataSchema; + this._operatorIdMapping = []; + + for (var op in _util.OPS) { + this._operatorIdMapping[_util.OPS[op]] = op; + } + } + + _createClass(SVGGraphics, [{ + key: "save", + value: function save() { + this.transformStack.push(this.transformMatrix); + var old = this.current; + this.extraStack.push(old); + this.current = old.clone(); + } + }, { + key: "restore", + value: function restore() { + this.transformMatrix = this.transformStack.pop(); + this.current = this.extraStack.pop(); + this.pendingClip = null; + this.tgrp = null; + } + }, { + key: "group", + value: function group(items) { + this.save(); + this.executeOpTree(items); + this.restore(); + } + }, { + key: "loadDependencies", + value: function loadDependencies(operatorList) { + var _this = this; + + var fnArray = operatorList.fnArray; + var argsArray = operatorList.argsArray; + + for (var i = 0, ii = fnArray.length; i < ii; i++) { + if (fnArray[i] !== _util.OPS.dependency) { + continue; + } + + var _iterator2 = _createForOfIteratorHelper(argsArray[i]), + _step2; + + try { + var _loop = function _loop() { + var obj = _step2.value; + var objsPool = obj.startsWith("g_") ? _this.commonObjs : _this.objs; + var promise = new Promise(function (resolve) { + objsPool.get(obj, resolve); + }); + + _this.current.dependencies.push(promise); + }; + + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + _loop(); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } + + return Promise.all(this.current.dependencies); + } + }, { + key: "transform", + value: function transform(a, b, c, d, e, f) { + var transformMatrix = [a, b, c, d, e, f]; + this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix); + this.tgrp = null; + } + }, { + key: "getSVG", + value: function getSVG(operatorList, viewport) { + var _this2 = this; + + this.viewport = viewport; + + var svgElement = this._initialize(viewport); + + return this.loadDependencies(operatorList).then(function () { + _this2.transformMatrix = _util.IDENTITY_MATRIX; + + _this2.executeOpTree(_this2.convertOpList(operatorList)); + + return svgElement; + }); + } + }, { + key: "convertOpList", + value: function convertOpList(operatorList) { + var operatorIdMapping = this._operatorIdMapping; + var argsArray = operatorList.argsArray; + var fnArray = operatorList.fnArray; + var opList = []; + + for (var i = 0, ii = fnArray.length; i < ii; i++) { + var fnId = fnArray[i]; + opList.push({ + fnId: fnId, + fn: operatorIdMapping[fnId], + args: argsArray[i] + }); + } + + return opListToTree(opList); + } + }, { + key: "executeOpTree", + value: function executeOpTree(opTree) { + var _iterator3 = _createForOfIteratorHelper(opTree), + _step3; + + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var opTreeElement = _step3.value; + var fn = opTreeElement.fn; + var fnId = opTreeElement.fnId; + var args = opTreeElement.args; + + switch (fnId | 0) { + case _util.OPS.beginText: + this.beginText(); + break; + + case _util.OPS.dependency: + break; + + case _util.OPS.setLeading: + this.setLeading(args); + break; + + case _util.OPS.setLeadingMoveText: + this.setLeadingMoveText(args[0], args[1]); + break; + + case _util.OPS.setFont: + this.setFont(args); + break; + + case _util.OPS.showText: + this.showText(args[0]); + break; + + case _util.OPS.showSpacedText: + this.showText(args[0]); + break; + + case _util.OPS.endText: + this.endText(); + break; + + case _util.OPS.moveText: + this.moveText(args[0], args[1]); + break; + + case _util.OPS.setCharSpacing: + this.setCharSpacing(args[0]); + break; + + case _util.OPS.setWordSpacing: + this.setWordSpacing(args[0]); + break; + + case _util.OPS.setHScale: + this.setHScale(args[0]); + break; + + case _util.OPS.setTextMatrix: + this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); + break; + + case _util.OPS.setTextRise: + this.setTextRise(args[0]); + break; + + case _util.OPS.setTextRenderingMode: + this.setTextRenderingMode(args[0]); + break; + + case _util.OPS.setLineWidth: + this.setLineWidth(args[0]); + break; + + case _util.OPS.setLineJoin: + this.setLineJoin(args[0]); + break; + + case _util.OPS.setLineCap: + this.setLineCap(args[0]); + break; + + case _util.OPS.setMiterLimit: + this.setMiterLimit(args[0]); + break; + + case _util.OPS.setFillRGBColor: + this.setFillRGBColor(args[0], args[1], args[2]); + break; + + case _util.OPS.setStrokeRGBColor: + this.setStrokeRGBColor(args[0], args[1], args[2]); + break; + + case _util.OPS.setStrokeColorN: + this.setStrokeColorN(args); + break; + + case _util.OPS.setFillColorN: + this.setFillColorN(args); + break; + + case _util.OPS.shadingFill: + this.shadingFill(args[0]); + break; + + case _util.OPS.setDash: + this.setDash(args[0], args[1]); + break; + + case _util.OPS.setRenderingIntent: + this.setRenderingIntent(args[0]); + break; + + case _util.OPS.setFlatness: + this.setFlatness(args[0]); + break; + + case _util.OPS.setGState: + this.setGState(args[0]); + break; + + case _util.OPS.fill: + this.fill(); + break; + + case _util.OPS.eoFill: + this.eoFill(); + break; + + case _util.OPS.stroke: + this.stroke(); + break; + + case _util.OPS.fillStroke: + this.fillStroke(); + break; + + case _util.OPS.eoFillStroke: + this.eoFillStroke(); + break; + + case _util.OPS.clip: + this.clip("nonzero"); + break; + + case _util.OPS.eoClip: + this.clip("evenodd"); + break; + + case _util.OPS.paintSolidColorImageMask: + this.paintSolidColorImageMask(); + break; + + case _util.OPS.paintImageXObject: + this.paintImageXObject(args[0]); + break; + + case _util.OPS.paintInlineImageXObject: + this.paintInlineImageXObject(args[0]); + break; + + case _util.OPS.paintImageMaskXObject: + this.paintImageMaskXObject(args[0]); + break; + + case _util.OPS.paintFormXObjectBegin: + this.paintFormXObjectBegin(args[0], args[1]); + break; + + case _util.OPS.paintFormXObjectEnd: + this.paintFormXObjectEnd(); + break; + + case _util.OPS.closePath: + this.closePath(); + break; + + case _util.OPS.closeStroke: + this.closeStroke(); + break; + + case _util.OPS.closeFillStroke: + this.closeFillStroke(); + break; + + case _util.OPS.closeEOFillStroke: + this.closeEOFillStroke(); + break; + + case _util.OPS.nextLine: + this.nextLine(); + break; + + case _util.OPS.transform: + this.transform(args[0], args[1], args[2], args[3], args[4], args[5]); + break; + + case _util.OPS.constructPath: + this.constructPath(args[0], args[1]); + break; + + case _util.OPS.endPath: + this.endPath(); + break; + + case 92: + this.group(opTreeElement.items); + break; + + default: + (0, _util.warn)("Unimplemented operator ".concat(fn)); + break; } } - break; - case 'triangles': - for (var j = 0, jj = ps.length; j < jj; j++) { - coords[pIndex] = coordsMap[ps[j]]; - coords[pIndex + 1] = coordsMap[ps[j] + 1]; - colors[cIndex] = colorsMap[cs[j]]; - colors[cIndex + 1] = colorsMap[cs[j] + 1]; - colors[cIndex + 2] = colorsMap[cs[j] + 2]; - pIndex += 2; - cIndex += 3; - } - break; + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } } - } - if (backgroundColor) { - gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255, backgroundColor[2] / 255, 1.0); - } else { - gl.clearColor(0, 0, 0, 0); - } - gl.clear(gl.COLOR_BUFFER_BIT); - var coordsBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer); - gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW); - gl.enableVertexAttribArray(cache.positionLocation); - gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); - var colorsBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer); - gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW); - gl.enableVertexAttribArray(cache.colorLocation); - gl.vertexAttribPointer(cache.colorLocation, 3, gl.UNSIGNED_BYTE, false, 0, 0); - gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY); - gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY); - gl.drawArrays(gl.TRIANGLES, 0, count); - gl.flush(); - gl.deleteBuffer(coordsBuffer); - gl.deleteBuffer(colorsBuffer); - return canvas; - } - return { - tryInitGL: function tryInitGL() { - try { - generateGL(); - return !!currentGL; - } catch (ex) {} - return false; - }, - - composeSMask: composeSMask, - drawFigures: drawFigures, - cleanup: function cleanup() { - if (smaskCache && smaskCache.canvas) { - smaskCache.canvas.width = 0; - smaskCache.canvas.height = 0; + }, { + key: "setWordSpacing", + value: function setWordSpacing(wordSpacing) { + this.current.wordSpacing = wordSpacing; } - if (figuresCache && figuresCache.canvas) { - figuresCache.canvas.width = 0; - figuresCache.canvas.height = 0; + }, { + key: "setCharSpacing", + value: function setCharSpacing(charSpacing) { + this.current.charSpacing = charSpacing; } - smaskCache = null; - figuresCache = null; - } - }; -}(); -exports.WebGLContext = WebGLContext; + }, { + key: "nextLine", + value: function nextLine() { + this.moveText(0, this.current.leading); + } + }, { + key: "setTextMatrix", + value: function setTextMatrix(a, b, c, d, e, f) { + var current = this.current; + current.textMatrix = current.lineMatrix = [a, b, c, d, e, f]; + current.textMatrixScale = Math.sqrt(a * a + b * b); + current.x = current.lineX = 0; + current.y = current.lineY = 0; + current.xcoords = []; + current.ycoords = []; + current.tspan = this.svgFactory.createElement("svg:tspan"); + current.tspan.setAttributeNS(null, "font-family", current.fontFamily); + current.tspan.setAttributeNS(null, "font-size", "".concat(pf(current.fontSize), "px")); + current.tspan.setAttributeNS(null, "y", pf(-current.y)); + current.txtElement = this.svgFactory.createElement("svg:text"); + current.txtElement.appendChild(current.tspan); + } + }, { + key: "beginText", + value: function beginText() { + var current = this.current; + current.x = current.lineX = 0; + current.y = current.lineY = 0; + current.textMatrix = _util.IDENTITY_MATRIX; + current.lineMatrix = _util.IDENTITY_MATRIX; + current.textMatrixScale = 1; + current.tspan = this.svgFactory.createElement("svg:tspan"); + current.txtElement = this.svgFactory.createElement("svg:text"); + current.txtgrp = this.svgFactory.createElement("svg:g"); + current.xcoords = []; + current.ycoords = []; + } + }, { + key: "moveText", + value: function moveText(x, y) { + var current = this.current; + current.x = current.lineX += x; + current.y = current.lineY += y; + current.xcoords = []; + current.ycoords = []; + current.tspan = this.svgFactory.createElement("svg:tspan"); + current.tspan.setAttributeNS(null, "font-family", current.fontFamily); + current.tspan.setAttributeNS(null, "font-size", "".concat(pf(current.fontSize), "px")); + current.tspan.setAttributeNS(null, "y", pf(-current.y)); + } + }, { + key: "showText", + value: function showText(glyphs) { + var current = this.current; + var font = current.font; + var fontSize = current.fontSize; + + if (fontSize === 0) { + return; + } + + var fontSizeScale = current.fontSizeScale; + var charSpacing = current.charSpacing; + var wordSpacing = current.wordSpacing; + var fontDirection = current.fontDirection; + var textHScale = current.textHScale * fontDirection; + var vertical = font.vertical; + var spacingDir = vertical ? 1 : -1; + var defaultVMetrics = font.defaultVMetrics; + var widthAdvanceScale = fontSize * current.fontMatrix[0]; + var x = 0; + + var _iterator4 = _createForOfIteratorHelper(glyphs), + _step4; + + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var glyph = _step4.value; + + if (glyph === null) { + x += fontDirection * wordSpacing; + continue; + } else if ((0, _util.isNum)(glyph)) { + x += spacingDir * glyph * fontSize / 1000; + continue; + } + + var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; + var character = glyph.fontChar; + var scaledX = void 0, + scaledY = void 0; + var width = glyph.width; + + if (vertical) { + var vx = void 0; + var vmetric = glyph.vmetric || defaultVMetrics; + vx = glyph.vmetric ? vmetric[1] : width * 0.5; + vx = -vx * widthAdvanceScale; + var vy = vmetric[2] * widthAdvanceScale; + width = vmetric ? -vmetric[0] : width; + scaledX = vx / fontSizeScale; + scaledY = (x + vy) / fontSizeScale; + } else { + scaledX = x / fontSizeScale; + scaledY = 0; + } + + if (glyph.isInFont || font.missingFile) { + current.xcoords.push(current.x + scaledX); + + if (vertical) { + current.ycoords.push(-current.y + scaledY); + } + + current.tspan.textContent += character; + } else {} + + var charWidth = void 0; + + if (vertical) { + charWidth = width * widthAdvanceScale - spacing * fontDirection; + } else { + charWidth = width * widthAdvanceScale + spacing * fontDirection; + } + + x += charWidth; + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + + current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" ")); + + if (vertical) { + current.tspan.setAttributeNS(null, "y", current.ycoords.map(pf).join(" ")); + } else { + current.tspan.setAttributeNS(null, "y", pf(-current.y)); + } + + if (vertical) { + current.y -= x; + } else { + current.x += x * textHScale; + } + + current.tspan.setAttributeNS(null, "font-family", current.fontFamily); + current.tspan.setAttributeNS(null, "font-size", "".concat(pf(current.fontSize), "px")); -/***/ }), -/* 145 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + if (current.fontStyle !== SVG_DEFAULTS.fontStyle) { + current.tspan.setAttributeNS(null, "font-style", current.fontStyle); + } -"use strict"; + if (current.fontWeight !== SVG_DEFAULTS.fontWeight) { + current.tspan.setAttributeNS(null, "font-weight", current.fontWeight); + } + var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.renderTextLayer = undefined; + if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { + if (current.fillColor !== SVG_DEFAULTS.fillColor) { + current.tspan.setAttributeNS(null, "fill", current.fillColor); + } -var _util = __w_pdfjs_require__(1); + if (current.fillAlpha < 1) { + current.tspan.setAttributeNS(null, "fill-opacity", current.fillAlpha); + } + } else if (current.textRenderingMode === _util.TextRenderingMode.ADD_TO_PATH) { + current.tspan.setAttributeNS(null, "fill", "transparent"); + } else { + current.tspan.setAttributeNS(null, "fill", "none"); + } -var _global_scope = __w_pdfjs_require__(3); + if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { + var lineWidthScale = 1 / (current.textMatrixScale || 1); -var _global_scope2 = _interopRequireDefault(_global_scope); + this._setStrokeAttributes(current.tspan, lineWidthScale); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var textMatrix = current.textMatrix; -var renderTextLayer = function renderTextLayerClosure() { - var MAX_TEXT_DIVS_TO_RENDER = 100000; - var NonWhitespaceRegexp = /\S/; - function isAllWhitespace(str) { - return !NonWhitespaceRegexp.test(str); - } - var styleBuf = ['left: ', 0, 'px; top: ', 0, 'px; font-size: ', 0, 'px; font-family: ', '', ';']; - function appendText(task, geom, styles) { - var textDiv = document.createElement('div'); - var textDivProperties = { - style: null, - angle: 0, - canvasWidth: 0, - isWhitespace: false, - originalTransform: null, - paddingBottom: 0, - paddingLeft: 0, - paddingRight: 0, - paddingTop: 0, - scale: 1 - }; - task._textDivs.push(textDiv); - if (isAllWhitespace(geom.str)) { - textDivProperties.isWhitespace = true; - task._textDivProperties.set(textDiv, textDivProperties); - return; - } - var tx = _util.Util.transform(task._viewport.transform, geom.transform); - var angle = Math.atan2(tx[1], tx[0]); - var style = styles[geom.fontName]; - if (style.vertical) { - angle += Math.PI / 2; - } - var fontHeight = Math.sqrt(tx[2] * tx[2] + tx[3] * tx[3]); - var fontAscent = fontHeight; - if (style.ascent) { - fontAscent = style.ascent * fontAscent; - } else if (style.descent) { - fontAscent = (1 + style.descent) * fontAscent; - } - var left; - var top; - if (angle === 0) { - left = tx[4]; - top = tx[5] - fontAscent; - } else { - left = tx[4] + fontAscent * Math.sin(angle); - top = tx[5] - fontAscent * Math.cos(angle); - } - styleBuf[1] = left; - styleBuf[3] = top; - styleBuf[5] = fontHeight; - styleBuf[7] = style.fontFamily; - textDivProperties.style = styleBuf.join(''); - textDiv.setAttribute('style', textDivProperties.style); - textDiv.textContent = geom.str; - if (task._fontInspectorEnabled) { - textDiv.dataset.fontName = geom.fontName; - } - if (angle !== 0) { - textDivProperties.angle = angle * (180 / Math.PI); - } - if (geom.str.length > 1) { - if (style.vertical) { - textDivProperties.canvasWidth = geom.height * task._viewport.scale; - } else { - textDivProperties.canvasWidth = geom.width * task._viewport.scale; - } - } - task._textDivProperties.set(textDiv, textDivProperties); - if (task._textContentStream) { - task._layoutText(textDiv); - } - if (task._enhanceTextSelection) { - var angleCos = 1, - angleSin = 0; - if (angle !== 0) { - angleCos = Math.cos(angle); - angleSin = Math.sin(angle); - } - var divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale; - var divHeight = fontHeight; - var m, b; - if (angle !== 0) { - m = [angleCos, angleSin, -angleSin, angleCos, left, top]; - b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m); - } else { - b = [left, top, left + divWidth, top + divHeight]; - } - task._bounds.push({ - left: b[0], - top: b[1], - right: b[2], - bottom: b[3], - div: textDiv, - size: [divWidth, divHeight], - m: m - }); - } - } - function render(task) { - if (task._canceled) { - return; - } - var textDivs = task._textDivs; - var capability = task._capability; - var textDivsLength = textDivs.length; - if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) { - task._renderingDone = true; - capability.resolve(); - return; - } - if (!task._textContentStream) { - for (var i = 0; i < textDivsLength; i++) { - task._layoutText(textDivs[i]); + if (current.textRise !== 0) { + textMatrix = textMatrix.slice(); + textMatrix[5] += current.textRise; + } + + current.txtElement.setAttributeNS(null, "transform", "".concat(pm(textMatrix), " scale(").concat(pf(textHScale), ", -1)")); + current.txtElement.setAttributeNS(XML_NS, "xml:space", "preserve"); + current.txtElement.appendChild(current.tspan); + current.txtgrp.appendChild(current.txtElement); + + this._ensureTransformGroup().appendChild(current.txtElement); } - } - task._renderingDone = true; - capability.resolve(); - } - function expand(task) { - var bounds = task._bounds; - var viewport = task._viewport; - var expanded = expandBounds(viewport.width, viewport.height, bounds); - for (var i = 0; i < expanded.length; i++) { - var div = bounds[i].div; - var divProperties = task._textDivProperties.get(div); - if (divProperties.angle === 0) { - divProperties.paddingLeft = bounds[i].left - expanded[i].left; - divProperties.paddingTop = bounds[i].top - expanded[i].top; - divProperties.paddingRight = expanded[i].right - bounds[i].right; - divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom; - task._textDivProperties.set(div, divProperties); - continue; + }, { + key: "setLeadingMoveText", + value: function setLeadingMoveText(x, y) { + this.setLeading(-y); + this.moveText(x, y); } - var e = expanded[i], - b = bounds[i]; - var m = b.m, - c = m[0], - s = m[1]; - var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size]; - var ts = new Float64Array(64); - points.forEach(function (p, i) { - var t = _util.Util.applyTransform(p, m); - ts[i + 0] = c && (e.left - t[0]) / c; - ts[i + 4] = s && (e.top - t[1]) / s; - ts[i + 8] = c && (e.right - t[0]) / c; - ts[i + 12] = s && (e.bottom - t[1]) / s; - ts[i + 16] = s && (e.left - t[0]) / -s; - ts[i + 20] = c && (e.top - t[1]) / c; - ts[i + 24] = s && (e.right - t[0]) / -s; - ts[i + 28] = c && (e.bottom - t[1]) / c; - ts[i + 32] = c && (e.left - t[0]) / -c; - ts[i + 36] = s && (e.top - t[1]) / -s; - ts[i + 40] = c && (e.right - t[0]) / -c; - ts[i + 44] = s && (e.bottom - t[1]) / -s; - ts[i + 48] = s && (e.left - t[0]) / s; - ts[i + 52] = c && (e.top - t[1]) / -c; - ts[i + 56] = s && (e.right - t[0]) / s; - ts[i + 60] = c && (e.bottom - t[1]) / -c; - }); - var findPositiveMin = function findPositiveMin(ts, offset, count) { - var result = 0; - for (var i = 0; i < count; i++) { - var t = ts[offset++]; - if (t > 0) { - result = result ? Math.min(t, result) : t; - } + }, { + key: "addFontStyle", + value: function addFontStyle(fontObj) { + if (!fontObj.data) { + throw new Error("addFontStyle: No font data available, " + 'ensure that the "fontExtraProperties" API parameter is set.'); } - return result; - }; - var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s)); - divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale; - divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale; - divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale; - divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale; - task._textDivProperties.set(div, divProperties); - } - } - function expandBounds(width, height, boxes) { - var bounds = boxes.map(function (box, i) { - return { - x1: box.left, - y1: box.top, - x2: box.right, - y2: box.bottom, - index: i, - x1New: undefined, - x2New: undefined - }; - }); - expandBoundsLTR(width, bounds); - var expanded = new Array(boxes.length); - bounds.forEach(function (b) { - var i = b.index; - expanded[i] = { - left: b.x1New, - top: 0, - right: b.x2New, - bottom: 0 - }; - }); - boxes.map(function (box, i) { - var e = expanded[i], - b = bounds[i]; - b.x1 = box.top; - b.y1 = width - e.right; - b.x2 = box.bottom; - b.y2 = width - e.left; - b.index = i; - b.x1New = undefined; - b.x2New = undefined; - }); - expandBoundsLTR(height, bounds); - bounds.forEach(function (b) { - var i = b.index; - expanded[i].top = b.x1New; - expanded[i].bottom = b.x2New; - }); - return expanded; - } - function expandBoundsLTR(width, bounds) { - bounds.sort(function (a, b) { - return a.x1 - b.x1 || a.index - b.index; - }); - var fakeBoundary = { - x1: -Infinity, - y1: -Infinity, - x2: 0, - y2: Infinity, - index: -1, - x1New: 0, - x2New: 0 - }; - var horizon = [{ - start: -Infinity, - end: Infinity, - boundary: fakeBoundary - }]; - bounds.forEach(function (boundary) { - var i = 0; - while (i < horizon.length && horizon[i].end <= boundary.y1) { - i++; + + if (!this.cssStyle) { + this.cssStyle = this.svgFactory.createElement("svg:style"); + this.cssStyle.setAttributeNS(null, "type", "text/css"); + this.defs.appendChild(this.cssStyle); + } + + var url = (0, _util.createObjectURL)(fontObj.data, fontObj.mimetype, this.forceDataSchema); + this.cssStyle.textContent += "@font-face { font-family: \"".concat(fontObj.loadedName, "\";") + " src: url(".concat(url, "); }\n"); + } + }, { + key: "setFont", + value: function setFont(details) { + var current = this.current; + var fontObj = this.commonObjs.get(details[0]); + var size = details[1]; + current.font = fontObj; + + if (this.embedFonts && !fontObj.missingFile && !this.embeddedFonts[fontObj.loadedName]) { + this.addFontStyle(fontObj); + this.embeddedFonts[fontObj.loadedName] = fontObj; + } + + current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; + var bold = "normal"; + + if (fontObj.black) { + bold = "900"; + } else if (fontObj.bold) { + bold = "bold"; + } + + var italic = fontObj.italic ? "italic" : "normal"; + + if (size < 0) { + size = -size; + current.fontDirection = -1; + } else { + current.fontDirection = 1; + } + + current.fontSize = size; + current.fontFamily = fontObj.loadedName; + current.fontWeight = bold; + current.fontStyle = italic; + current.tspan = this.svgFactory.createElement("svg:tspan"); + current.tspan.setAttributeNS(null, "y", pf(-current.y)); + current.xcoords = []; + current.ycoords = []; } - var j = horizon.length - 1; - while (j >= 0 && horizon[j].start >= boundary.y2) { - j--; + }, { + key: "endText", + value: function endText() { + var current = this.current; + + if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement && current.txtElement.hasChildNodes()) { + current.element = current.txtElement; + this.clip("nonzero"); + this.endPath(); + } } - var horizonPart, affectedBoundary; - var q, - k, - maxXNew = -Infinity; - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - var xNew; - if (affectedBoundary.x2 > boundary.x1) { - xNew = affectedBoundary.index > boundary.index ? affectedBoundary.x1New : boundary.x1; - } else if (affectedBoundary.x2New === undefined) { - xNew = (affectedBoundary.x2 + boundary.x1) / 2; - } else { - xNew = affectedBoundary.x2New; + }, { + key: "setLineWidth", + value: function setLineWidth(width) { + if (width > 0) { + this.current.lineWidth = width; } - if (xNew > maxXNew) { - maxXNew = xNew; + } + }, { + key: "setLineCap", + value: function setLineCap(style) { + this.current.lineCap = LINE_CAP_STYLES[style]; + } + }, { + key: "setLineJoin", + value: function setLineJoin(style) { + this.current.lineJoin = LINE_JOIN_STYLES[style]; + } + }, { + key: "setMiterLimit", + value: function setMiterLimit(limit) { + this.current.miterLimit = limit; + } + }, { + key: "setStrokeAlpha", + value: function setStrokeAlpha(strokeAlpha) { + this.current.strokeAlpha = strokeAlpha; + } + }, { + key: "setStrokeRGBColor", + value: function setStrokeRGBColor(r, g, b) { + this.current.strokeColor = _util.Util.makeCssRgb(r, g, b); + } + }, { + key: "setFillAlpha", + value: function setFillAlpha(fillAlpha) { + this.current.fillAlpha = fillAlpha; + } + }, { + key: "setFillRGBColor", + value: function setFillRGBColor(r, g, b) { + this.current.fillColor = _util.Util.makeCssRgb(r, g, b); + this.current.tspan = this.svgFactory.createElement("svg:tspan"); + this.current.xcoords = []; + this.current.ycoords = []; + } + }, { + key: "setStrokeColorN", + value: function setStrokeColorN(args) { + this.current.strokeColor = this._makeColorN_Pattern(args); + } + }, { + key: "setFillColorN", + value: function setFillColorN(args) { + this.current.fillColor = this._makeColorN_Pattern(args); + } + }, { + key: "shadingFill", + value: function shadingFill(args) { + var width = this.viewport.width; + var height = this.viewport.height; + + var inv = _util.Util.inverseTransform(this.transformMatrix); + + var bl = _util.Util.applyTransform([0, 0], inv); + + var br = _util.Util.applyTransform([0, height], inv); + + var ul = _util.Util.applyTransform([width, 0], inv); + + var ur = _util.Util.applyTransform([width, height], inv); + + var x0 = Math.min(bl[0], br[0], ul[0], ur[0]); + var y0 = Math.min(bl[1], br[1], ul[1], ur[1]); + var x1 = Math.max(bl[0], br[0], ul[0], ur[0]); + var y1 = Math.max(bl[1], br[1], ul[1], ur[1]); + var rect = this.svgFactory.createElement("svg:rect"); + rect.setAttributeNS(null, "x", x0); + rect.setAttributeNS(null, "y", y0); + rect.setAttributeNS(null, "width", x1 - x0); + rect.setAttributeNS(null, "height", y1 - y0); + rect.setAttributeNS(null, "fill", this._makeShadingPattern(args)); + + if (this.current.fillAlpha < 1) { + rect.setAttributeNS(null, "fill-opacity", this.current.fillAlpha); } + + this._ensureTransformGroup().appendChild(rect); } - boundary.x1New = maxXNew; - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - if (affectedBoundary.x2New === undefined) { - if (affectedBoundary.x2 > boundary.x1) { - if (affectedBoundary.index > boundary.index) { - affectedBoundary.x2New = affectedBoundary.x2; + }, { + key: "_makeColorN_Pattern", + value: function _makeColorN_Pattern(args) { + if (args[0] === "TilingPattern") { + return this._makeTilingPattern(args); + } + + return this._makeShadingPattern(args); + } + }, { + key: "_makeTilingPattern", + value: function _makeTilingPattern(args) { + var color = args[1]; + var operatorList = args[2]; + var matrix = args[3] || _util.IDENTITY_MATRIX; + + var _args$ = _slicedToArray(args[4], 4), + x0 = _args$[0], + y0 = _args$[1], + x1 = _args$[2], + y1 = _args$[3]; + + var xstep = args[5]; + var ystep = args[6]; + var paintType = args[7]; + var tilingId = "shading".concat(shadingCount++); + + var _Util$applyTransform = _util.Util.applyTransform([x0, y0], matrix), + _Util$applyTransform2 = _slicedToArray(_Util$applyTransform, 2), + tx0 = _Util$applyTransform2[0], + ty0 = _Util$applyTransform2[1]; + + var _Util$applyTransform3 = _util.Util.applyTransform([x1, y1], matrix), + _Util$applyTransform4 = _slicedToArray(_Util$applyTransform3, 2), + tx1 = _Util$applyTransform4[0], + ty1 = _Util$applyTransform4[1]; + + var _Util$singularValueDe = _util.Util.singularValueDecompose2dScale(matrix), + _Util$singularValueDe2 = _slicedToArray(_Util$singularValueDe, 2), + xscale = _Util$singularValueDe2[0], + yscale = _Util$singularValueDe2[1]; + + var txstep = xstep * xscale; + var tystep = ystep * yscale; + var tiling = this.svgFactory.createElement("svg:pattern"); + tiling.setAttributeNS(null, "id", tilingId); + tiling.setAttributeNS(null, "patternUnits", "userSpaceOnUse"); + tiling.setAttributeNS(null, "width", txstep); + tiling.setAttributeNS(null, "height", tystep); + tiling.setAttributeNS(null, "x", "".concat(tx0)); + tiling.setAttributeNS(null, "y", "".concat(ty0)); + var svg = this.svg; + var transformMatrix = this.transformMatrix; + var fillColor = this.current.fillColor; + var strokeColor = this.current.strokeColor; + var bbox = this.svgFactory.create(tx1 - tx0, ty1 - ty0); + this.svg = bbox; + this.transformMatrix = matrix; + + if (paintType === 2) { + var cssColor = _util.Util.makeCssRgb.apply(_util.Util, _toConsumableArray(color)); + + this.current.fillColor = cssColor; + this.current.strokeColor = cssColor; + } + + this.executeOpTree(this.convertOpList(operatorList)); + this.svg = svg; + this.transformMatrix = transformMatrix; + this.current.fillColor = fillColor; + this.current.strokeColor = strokeColor; + tiling.appendChild(bbox.childNodes[0]); + this.defs.appendChild(tiling); + return "url(#".concat(tilingId, ")"); + } + }, { + key: "_makeShadingPattern", + value: function _makeShadingPattern(args) { + switch (args[0]) { + case "RadialAxial": + var shadingId = "shading".concat(shadingCount++); + var colorStops = args[3]; + var gradient; + + switch (args[1]) { + case "axial": + var point0 = args[4]; + var point1 = args[5]; + gradient = this.svgFactory.createElement("svg:linearGradient"); + gradient.setAttributeNS(null, "id", shadingId); + gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse"); + gradient.setAttributeNS(null, "x1", point0[0]); + gradient.setAttributeNS(null, "y1", point0[1]); + gradient.setAttributeNS(null, "x2", point1[0]); + gradient.setAttributeNS(null, "y2", point1[1]); + break; + + case "radial": + var focalPoint = args[4]; + var circlePoint = args[5]; + var focalRadius = args[6]; + var circleRadius = args[7]; + gradient = this.svgFactory.createElement("svg:radialGradient"); + gradient.setAttributeNS(null, "id", shadingId); + gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse"); + gradient.setAttributeNS(null, "cx", circlePoint[0]); + gradient.setAttributeNS(null, "cy", circlePoint[1]); + gradient.setAttributeNS(null, "r", circleRadius); + gradient.setAttributeNS(null, "fx", focalPoint[0]); + gradient.setAttributeNS(null, "fy", focalPoint[1]); + gradient.setAttributeNS(null, "fr", focalRadius); + break; + + default: + throw new Error("Unknown RadialAxial type: ".concat(args[1])); + } + + var _iterator5 = _createForOfIteratorHelper(colorStops), + _step5; + + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { + var colorStop = _step5.value; + var stop = this.svgFactory.createElement("svg:stop"); + stop.setAttributeNS(null, "offset", colorStop[0]); + stop.setAttributeNS(null, "stop-color", colorStop[1]); + gradient.appendChild(stop); + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + + this.defs.appendChild(gradient); + return "url(#".concat(shadingId, ")"); + + case "Mesh": + (0, _util.warn)("Unimplemented pattern Mesh"); + return null; + + case "Dummy": + return "hotpink"; + + default: + throw new Error("Unknown IR type: ".concat(args[0])); + } + } + }, { + key: "setDash", + value: function setDash(dashArray, dashPhase) { + this.current.dashArray = dashArray; + this.current.dashPhase = dashPhase; + } + }, { + key: "constructPath", + value: function constructPath(ops, args) { + var current = this.current; + var x = current.x, + y = current.y; + var d = []; + var j = 0; + + var _iterator6 = _createForOfIteratorHelper(ops), + _step6; + + try { + for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { + var op = _step6.value; + + switch (op | 0) { + case _util.OPS.rectangle: + x = args[j++]; + y = args[j++]; + var width = args[j++]; + var height = args[j++]; + var xw = x + width; + var yh = y + height; + d.push("M", pf(x), pf(y), "L", pf(xw), pf(y), "L", pf(xw), pf(yh), "L", pf(x), pf(yh), "Z"); + break; + + case _util.OPS.moveTo: + x = args[j++]; + y = args[j++]; + d.push("M", pf(x), pf(y)); + break; + + case _util.OPS.lineTo: + x = args[j++]; + y = args[j++]; + d.push("L", pf(x), pf(y)); + break; + + case _util.OPS.curveTo: + x = args[j + 4]; + y = args[j + 5]; + d.push("C", pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y)); + j += 6; + break; + + case _util.OPS.curveTo2: + d.push("C", pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3])); + x = args[j + 2]; + y = args[j + 3]; + j += 4; + break; + + case _util.OPS.curveTo3: + x = args[j + 2]; + y = args[j + 3]; + d.push("C", pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y)); + j += 4; + break; + + case _util.OPS.closePath: + d.push("Z"); + break; } - } else { - affectedBoundary.x2New = maxXNew; } - } else if (affectedBoundary.x2New > maxXNew) { - affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2); + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); + } + + d = d.join(" "); + + if (current.path && ops.length > 0 && ops[0] !== _util.OPS.rectangle && ops[0] !== _util.OPS.moveTo) { + d = current.path.getAttributeNS(null, "d") + d; + } else { + current.path = this.svgFactory.createElement("svg:path"); + + this._ensureTransformGroup().appendChild(current.path); } + + current.path.setAttributeNS(null, "d", d); + current.path.setAttributeNS(null, "fill", "none"); + current.element = current.path; + current.setCurrentPoint(x, y); } - var changedHorizon = [], - lastBoundary = null; - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - var useBoundary = affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary; - if (lastBoundary === useBoundary) { - changedHorizon[changedHorizon.length - 1].end = horizonPart.end; + }, { + key: "endPath", + value: function endPath() { + var current = this.current; + current.path = null; + + if (!this.pendingClip) { + return; + } + + if (!current.element) { + this.pendingClip = null; + return; + } + + var clipId = "clippath".concat(clipCount++); + var clipPath = this.svgFactory.createElement("svg:clipPath"); + clipPath.setAttributeNS(null, "id", clipId); + clipPath.setAttributeNS(null, "transform", pm(this.transformMatrix)); + var clipElement = current.element.cloneNode(true); + + if (this.pendingClip === "evenodd") { + clipElement.setAttributeNS(null, "clip-rule", "evenodd"); } else { - changedHorizon.push({ - start: horizonPart.start, - end: horizonPart.end, - boundary: useBoundary + clipElement.setAttributeNS(null, "clip-rule", "nonzero"); + } + + this.pendingClip = null; + clipPath.appendChild(clipElement); + this.defs.appendChild(clipPath); + + if (current.activeClipUrl) { + current.clipGroup = null; + this.extraStack.forEach(function (prev) { + prev.clipGroup = null; }); - lastBoundary = useBoundary; + clipPath.setAttributeNS(null, "clip-path", current.activeClipUrl); } + + current.activeClipUrl = "url(#".concat(clipId, ")"); + this.tgrp = null; } - if (horizon[i].start < boundary.y1) { - changedHorizon[0].start = boundary.y1; - changedHorizon.unshift({ - start: horizon[i].start, - end: boundary.y1, - boundary: horizon[i].boundary - }); - } - if (boundary.y2 < horizon[j].end) { - changedHorizon[changedHorizon.length - 1].end = boundary.y2; - changedHorizon.push({ - start: boundary.y2, - end: horizon[j].end, - boundary: horizon[j].boundary - }); + }, { + key: "clip", + value: function clip(type) { + this.pendingClip = type; } - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - if (affectedBoundary.x2New !== undefined) { - continue; - } - var used = false; - for (k = i - 1; !used && k >= 0 && horizon[k].start >= affectedBoundary.y1; k--) { - used = horizon[k].boundary === affectedBoundary; + }, { + key: "closePath", + value: function closePath() { + var current = this.current; + + if (current.path) { + var d = "".concat(current.path.getAttributeNS(null, "d"), "Z"); + current.path.setAttributeNS(null, "d", d); } - for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) { - used = horizon[k].boundary === affectedBoundary; + } + }, { + key: "setLeading", + value: function setLeading(leading) { + this.current.leading = -leading; + } + }, { + key: "setTextRise", + value: function setTextRise(textRise) { + this.current.textRise = textRise; + } + }, { + key: "setTextRenderingMode", + value: function setTextRenderingMode(textRenderingMode) { + this.current.textRenderingMode = textRenderingMode; + } + }, { + key: "setHScale", + value: function setHScale(scale) { + this.current.textHScale = scale / 100; + } + }, { + key: "setRenderingIntent", + value: function setRenderingIntent(intent) {} + }, { + key: "setFlatness", + value: function setFlatness(flatness) {} + }, { + key: "setGState", + value: function setGState(states) { + var _iterator7 = _createForOfIteratorHelper(states), + _step7; + + try { + for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { + var _step7$value = _slicedToArray(_step7.value, 2), + key = _step7$value[0], + value = _step7$value[1]; + + switch (key) { + case "LW": + this.setLineWidth(value); + break; + + case "LC": + this.setLineCap(value); + break; + + case "LJ": + this.setLineJoin(value); + break; + + case "ML": + this.setMiterLimit(value); + break; + + case "D": + this.setDash(value[0], value[1]); + break; + + case "RI": + this.setRenderingIntent(value); + break; + + case "FL": + this.setFlatness(value); + break; + + case "Font": + this.setFont(value); + break; + + case "CA": + this.setStrokeAlpha(value); + break; + + case "ca": + this.setFillAlpha(value); + break; + + default: + (0, _util.warn)("Unimplemented graphic state operator ".concat(key)); + break; + } + } + } catch (err) { + _iterator7.e(err); + } finally { + _iterator7.f(); } - for (k = 0; !used && k < changedHorizon.length; k++) { - used = changedHorizon[k].boundary === affectedBoundary; + } + }, { + key: "fill", + value: function fill() { + var current = this.current; + + if (current.element) { + current.element.setAttributeNS(null, "fill", current.fillColor); + current.element.setAttributeNS(null, "fill-opacity", current.fillAlpha); + this.endPath(); } - if (!used) { - affectedBoundary.x2New = maxXNew; + } + }, { + key: "stroke", + value: function stroke() { + var current = this.current; + + if (current.element) { + this._setStrokeAttributes(current.element); + + current.element.setAttributeNS(null, "fill", "none"); + this.endPath(); } } - Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon)); - }); - horizon.forEach(function (horizonPart) { - var affectedBoundary = horizonPart.boundary; - if (affectedBoundary.x2New === undefined) { - affectedBoundary.x2New = Math.max(width, affectedBoundary.x2); + }, { + key: "_setStrokeAttributes", + value: function _setStrokeAttributes(element) { + var lineWidthScale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + var current = this.current; + var dashArray = current.dashArray; + + if (lineWidthScale !== 1 && dashArray.length > 0) { + dashArray = dashArray.map(function (value) { + return lineWidthScale * value; + }); + } + + element.setAttributeNS(null, "stroke", current.strokeColor); + element.setAttributeNS(null, "stroke-opacity", current.strokeAlpha); + element.setAttributeNS(null, "stroke-miterlimit", pf(current.miterLimit)); + element.setAttributeNS(null, "stroke-linecap", current.lineCap); + element.setAttributeNS(null, "stroke-linejoin", current.lineJoin); + element.setAttributeNS(null, "stroke-width", pf(lineWidthScale * current.lineWidth) + "px"); + element.setAttributeNS(null, "stroke-dasharray", dashArray.map(pf).join(" ")); + element.setAttributeNS(null, "stroke-dashoffset", pf(lineWidthScale * current.dashPhase) + "px"); } - }); - } - function TextLayerRenderTask(_ref) { - var textContent = _ref.textContent, - textContentStream = _ref.textContentStream, - container = _ref.container, - viewport = _ref.viewport, - textDivs = _ref.textDivs, - textContentItemsStr = _ref.textContentItemsStr, - enhanceTextSelection = _ref.enhanceTextSelection; + }, { + key: "eoFill", + value: function eoFill() { + if (this.current.element) { + this.current.element.setAttributeNS(null, "fill-rule", "evenodd"); + } - this._textContent = textContent; - this._textContentStream = textContentStream; - this._container = container; - this._viewport = viewport; - this._textDivs = textDivs || []; - this._textContentItemsStr = textContentItemsStr || []; - this._enhanceTextSelection = !!enhanceTextSelection; - this._fontInspectorEnabled = !!(_global_scope2.default.FontInspector && _global_scope2.default.FontInspector.enabled); - this._reader = null; - this._layoutTextLastFontSize = null; - this._layoutTextLastFontFamily = null; - this._layoutTextCtx = null; - this._textDivProperties = new WeakMap(); - this._renderingDone = false; - this._canceled = false; - this._capability = (0, _util.createPromiseCapability)(); - this._renderTimer = null; - this._bounds = []; - } - TextLayerRenderTask.prototype = { - get promise() { - return this._capability.promise; - }, - cancel: function TextLayer_cancel() { - if (this._reader) { - this._reader.cancel(new _util.AbortException('text layer task cancelled')); - this._reader = null; + this.fill(); } - this._canceled = true; - if (this._renderTimer !== null) { - clearTimeout(this._renderTimer); - this._renderTimer = null; + }, { + key: "fillStroke", + value: function fillStroke() { + this.stroke(); + this.fill(); } - this._capability.reject('canceled'); - }, - _processItems: function _processItems(items, styleCache) { - for (var i = 0, len = items.length; i < len; i++) { - this._textContentItemsStr.push(items[i].str); - appendText(this, items[i], styleCache); + }, { + key: "eoFillStroke", + value: function eoFillStroke() { + if (this.current.element) { + this.current.element.setAttributeNS(null, "fill-rule", "evenodd"); + } + + this.fillStroke(); } - }, - _layoutText: function _layoutText(textDiv) { - var textLayerFrag = this._container; - var textDivProperties = this._textDivProperties.get(textDiv); - if (textDivProperties.isWhitespace) { - return; + }, { + key: "closeStroke", + value: function closeStroke() { + this.closePath(); + this.stroke(); } - var fontSize = textDiv.style.fontSize; - var fontFamily = textDiv.style.fontFamily; - if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) { - this._layoutTextCtx.font = fontSize + ' ' + fontFamily; - this._layoutTextLastFontSize = fontSize; - this._layoutTextLastFontFamily = fontFamily; + }, { + key: "closeFillStroke", + value: function closeFillStroke() { + this.closePath(); + this.fillStroke(); } - var width = this._layoutTextCtx.measureText(textDiv.textContent).width; - var transform = ''; - if (textDivProperties.canvasWidth !== 0 && width > 0) { - textDivProperties.scale = textDivProperties.canvasWidth / width; - transform = 'scaleX(' + textDivProperties.scale + ')'; + }, { + key: "closeEOFillStroke", + value: function closeEOFillStroke() { + this.closePath(); + this.eoFillStroke(); } - if (textDivProperties.angle !== 0) { - transform = 'rotate(' + textDivProperties.angle + 'deg) ' + transform; + }, { + key: "paintSolidColorImageMask", + value: function paintSolidColorImageMask() { + var rect = this.svgFactory.createElement("svg:rect"); + rect.setAttributeNS(null, "x", "0"); + rect.setAttributeNS(null, "y", "0"); + rect.setAttributeNS(null, "width", "1px"); + rect.setAttributeNS(null, "height", "1px"); + rect.setAttributeNS(null, "fill", this.current.fillColor); + + this._ensureTransformGroup().appendChild(rect); } - if (transform !== '') { - textDivProperties.originalTransform = transform; - textDiv.style.transform = transform; + }, { + key: "paintImageXObject", + value: function paintImageXObject(objId) { + var imgData = this.objs.get(objId); + + if (!imgData) { + (0, _util.warn)("Dependent image with object ID ".concat(objId, " is not ready yet")); + return; + } + + this.paintInlineImageXObject(imgData); } - this._textDivProperties.set(textDiv, textDivProperties); - textLayerFrag.appendChild(textDiv); - }, + }, { + key: "paintInlineImageXObject", + value: function paintInlineImageXObject(imgData, mask) { + var width = imgData.width; + var height = imgData.height; + var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask); + var cliprect = this.svgFactory.createElement("svg:rect"); + cliprect.setAttributeNS(null, "x", "0"); + cliprect.setAttributeNS(null, "y", "0"); + cliprect.setAttributeNS(null, "width", pf(width)); + cliprect.setAttributeNS(null, "height", pf(height)); + this.current.element = cliprect; + this.clip("nonzero"); + var imgEl = this.svgFactory.createElement("svg:image"); + imgEl.setAttributeNS(XLINK_NS, "xlink:href", imgSrc); + imgEl.setAttributeNS(null, "x", "0"); + imgEl.setAttributeNS(null, "y", pf(-height)); + imgEl.setAttributeNS(null, "width", pf(width) + "px"); + imgEl.setAttributeNS(null, "height", pf(height) + "px"); + imgEl.setAttributeNS(null, "transform", "scale(".concat(pf(1 / width), " ").concat(pf(-1 / height), ")")); - _render: function TextLayer_render(timeout) { - var _this = this; + if (mask) { + mask.appendChild(imgEl); + } else { + this._ensureTransformGroup().appendChild(imgEl); + } + } + }, { + key: "paintImageMaskXObject", + value: function paintImageMaskXObject(imgData) { + var current = this.current; + var width = imgData.width; + var height = imgData.height; + var fillColor = current.fillColor; + current.maskId = "mask".concat(maskCount++); + var mask = this.svgFactory.createElement("svg:mask"); + mask.setAttributeNS(null, "id", current.maskId); + var rect = this.svgFactory.createElement("svg:rect"); + rect.setAttributeNS(null, "x", "0"); + rect.setAttributeNS(null, "y", "0"); + rect.setAttributeNS(null, "width", pf(width)); + rect.setAttributeNS(null, "height", pf(height)); + rect.setAttributeNS(null, "fill", fillColor); + rect.setAttributeNS(null, "mask", "url(#".concat(current.maskId, ")")); + this.defs.appendChild(mask); - var capability = (0, _util.createPromiseCapability)(); - var styleCache = Object.create(null); - var canvas = document.createElement('canvas'); - canvas.mozOpaque = true; - this._layoutTextCtx = canvas.getContext('2d', { alpha: false }); - if (this._textContent) { - var textItems = this._textContent.items; - var textStyles = this._textContent.styles; - this._processItems(textItems, textStyles); - capability.resolve(); - } else if (this._textContentStream) { - var pump = function pump() { - _this._reader.read().then(function (_ref2) { - var value = _ref2.value, - done = _ref2.done; + this._ensureTransformGroup().appendChild(rect); - if (done) { - capability.resolve(); - return; - } - Object.assign(styleCache, value.styles); - _this._processItems(value.items, styleCache); - pump(); - }, capability.reject); - }; - this._reader = this._textContentStream.getReader(); - pump(); - } else { - throw new Error('Neither "textContent" nor "textContentStream"' + ' parameters specified.'); + this.paintInlineImageXObject(imgData, mask); } - capability.promise.then(function () { - styleCache = null; - if (!timeout) { - render(_this); - } else { - _this._renderTimer = setTimeout(function () { - render(_this); - _this._renderTimer = null; - }, timeout); + }, { + key: "paintFormXObjectBegin", + value: function paintFormXObjectBegin(matrix, bbox) { + if (Array.isArray(matrix) && matrix.length === 6) { + this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); + } + + if (bbox) { + var width = bbox[2] - bbox[0]; + var height = bbox[3] - bbox[1]; + var cliprect = this.svgFactory.createElement("svg:rect"); + cliprect.setAttributeNS(null, "x", bbox[0]); + cliprect.setAttributeNS(null, "y", bbox[1]); + cliprect.setAttributeNS(null, "width", pf(width)); + cliprect.setAttributeNS(null, "height", pf(height)); + this.current.element = cliprect; + this.clip("nonzero"); + this.endPath(); } - }, this._capability.reject); - }, - expandTextDivs: function TextLayer_expandTextDivs(expandDivs) { - if (!this._enhanceTextSelection || !this._renderingDone) { - return; } - if (this._bounds !== null) { - expand(this); - this._bounds = null; + }, { + key: "paintFormXObjectEnd", + value: function paintFormXObjectEnd() {} + }, { + key: "_initialize", + value: function _initialize(viewport) { + var svg = this.svgFactory.create(viewport.width, viewport.height); + var definitions = this.svgFactory.createElement("svg:defs"); + svg.appendChild(definitions); + this.defs = definitions; + var rootGroup = this.svgFactory.createElement("svg:g"); + rootGroup.setAttributeNS(null, "transform", pm(viewport.transform)); + svg.appendChild(rootGroup); + this.svg = rootGroup; + return svg; } - for (var i = 0, ii = this._textDivs.length; i < ii; i++) { - var div = this._textDivs[i]; - var divProperties = this._textDivProperties.get(div); - if (divProperties.isWhitespace) { - continue; + }, { + key: "_ensureClipGroup", + value: function _ensureClipGroup() { + if (!this.current.clipGroup) { + var clipGroup = this.svgFactory.createElement("svg:g"); + clipGroup.setAttributeNS(null, "clip-path", this.current.activeClipUrl); + this.svg.appendChild(clipGroup); + this.current.clipGroup = clipGroup; } - if (expandDivs) { - var transform = '', - padding = ''; - if (divProperties.scale !== 1) { - transform = 'scaleX(' + divProperties.scale + ')'; - } - if (divProperties.angle !== 0) { - transform = 'rotate(' + divProperties.angle + 'deg) ' + transform; - } - if (divProperties.paddingLeft !== 0) { - padding += ' padding-left: ' + divProperties.paddingLeft / divProperties.scale + 'px;'; - transform += ' translateX(' + -divProperties.paddingLeft / divProperties.scale + 'px)'; - } - if (divProperties.paddingTop !== 0) { - padding += ' padding-top: ' + divProperties.paddingTop + 'px;'; - transform += ' translateY(' + -divProperties.paddingTop + 'px)'; - } - if (divProperties.paddingRight !== 0) { - padding += ' padding-right: ' + divProperties.paddingRight / divProperties.scale + 'px;'; - } - if (divProperties.paddingBottom !== 0) { - padding += ' padding-bottom: ' + divProperties.paddingBottom + 'px;'; - } - if (padding !== '') { - div.setAttribute('style', divProperties.style + padding); - } - if (transform !== '') { - div.style.transform = transform; + + return this.current.clipGroup; + } + }, { + key: "_ensureTransformGroup", + value: function _ensureTransformGroup() { + if (!this.tgrp) { + this.tgrp = this.svgFactory.createElement("svg:g"); + this.tgrp.setAttributeNS(null, "transform", pm(this.transformMatrix)); + + if (this.current.activeClipUrl) { + this._ensureClipGroup().appendChild(this.tgrp); + } else { + this.svg.appendChild(this.tgrp); } - } else { - div.style.padding = 0; - div.style.transform = divProperties.originalTransform || ''; } + + return this.tgrp; } - } - }; - function renderTextLayer(renderParameters) { - var task = new TextLayerRenderTask({ - textContent: renderParameters.textContent, - textContentStream: renderParameters.textContentStream, - container: renderParameters.container, - viewport: renderParameters.viewport, - textDivs: renderParameters.textDivs, - textContentItemsStr: renderParameters.textContentItemsStr, - enhanceTextSelection: renderParameters.enhanceTextSelection - }); - task._render(renderParameters.timeout); - return task; - } - return renderTextLayer; -}(); -exports.renderTextLayer = renderTextLayer; + }]); + + return SVGGraphics; + }(); +} /***/ }), -/* 146 */ +/* 212 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -15501,2947 +23666,1627 @@ exports.renderTextLayer = renderTextLayer; Object.defineProperty(exports, "__esModule", { value: true }); -exports.AnnotationLayer = undefined; +exports.PDFNodeStream = void 0; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); + +var _util = __w_pdfjs_require__(5); + +var _network_utils = __w_pdfjs_require__(213); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -var _dom_utils = __w_pdfjs_require__(130); +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } -var _util = __w_pdfjs_require__(1); +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var AnnotationElementFactory = function () { - function AnnotationElementFactory() { - _classCallCheck(this, AnnotationElementFactory); - } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - _createClass(AnnotationElementFactory, null, [{ - key: 'create', - value: function create(parameters) { - var subtype = parameters.data.annotationType; - switch (subtype) { - case _util.AnnotationType.LINK: - return new LinkAnnotationElement(parameters); - case _util.AnnotationType.TEXT: - return new TextAnnotationElement(parameters); - case _util.AnnotationType.WIDGET: - var fieldType = parameters.data.fieldType; - switch (fieldType) { - case 'Tx': - return new TextWidgetAnnotationElement(parameters); - case 'Btn': - if (parameters.data.radioButton) { - return new RadioButtonWidgetAnnotationElement(parameters); - } else if (parameters.data.checkBox) { - return new CheckboxWidgetAnnotationElement(parameters); - } - return new PushButtonWidgetAnnotationElement(parameters); - case 'Ch': - return new ChoiceWidgetAnnotationElement(parameters); - } - return new WidgetAnnotationElement(parameters); - case _util.AnnotationType.POPUP: - return new PopupAnnotationElement(parameters); - case _util.AnnotationType.LINE: - return new LineAnnotationElement(parameters); - case _util.AnnotationType.SQUARE: - return new SquareAnnotationElement(parameters); - case _util.AnnotationType.CIRCLE: - return new CircleAnnotationElement(parameters); - case _util.AnnotationType.POLYLINE: - return new PolylineAnnotationElement(parameters); - case _util.AnnotationType.INK: - return new InkAnnotationElement(parameters); - case _util.AnnotationType.POLYGON: - return new PolygonAnnotationElement(parameters); - case _util.AnnotationType.HIGHLIGHT: - return new HighlightAnnotationElement(parameters); - case _util.AnnotationType.UNDERLINE: - return new UnderlineAnnotationElement(parameters); - case _util.AnnotationType.SQUIGGLY: - return new SquigglyAnnotationElement(parameters); - case _util.AnnotationType.STRIKEOUT: - return new StrikeOutAnnotationElement(parameters); - case _util.AnnotationType.STAMP: - return new StampAnnotationElement(parameters); - case _util.AnnotationType.FILEATTACHMENT: - return new FileAttachmentAnnotationElement(parameters); - default: - return new AnnotationElement(parameters); - } - } - }]); +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - return AnnotationElementFactory; -}(); +; -var AnnotationElement = function () { - function AnnotationElement(parameters) { - var isRenderable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var ignoreBorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; +var fs = require("fs"); - _classCallCheck(this, AnnotationElement); +var http = require("http"); - this.isRenderable = isRenderable; - this.data = parameters.data; - this.layer = parameters.layer; - this.page = parameters.page; - this.viewport = parameters.viewport; - this.linkService = parameters.linkService; - this.downloadManager = parameters.downloadManager; - this.imageResourcesPath = parameters.imageResourcesPath; - this.renderInteractiveForms = parameters.renderInteractiveForms; - this.svgFactory = parameters.svgFactory; - if (isRenderable) { - this.container = this._createContainer(ignoreBorder); - } - } +var https = require("https"); - _createClass(AnnotationElement, [{ - key: '_createContainer', - value: function _createContainer() { - var ignoreBorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; +var url = require("url"); - var data = this.data, - page = this.page, - viewport = this.viewport; - var container = document.createElement('section'); - var width = data.rect[2] - data.rect[0]; - var height = data.rect[3] - data.rect[1]; - container.setAttribute('data-annotation-id', data.id); - var 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(',') + ')'; - container.style.transformOrigin = -rect[0] + 'px ' + -rect[1] + 'px'; - if (!ignoreBorder && data.borderStyle.width > 0) { - container.style.borderWidth = data.borderStyle.width + 'px'; - if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) { - width = width - 2 * data.borderStyle.width; - height = height - 2 * data.borderStyle.width; - } - var horizontalRadius = data.borderStyle.horizontalCornerRadius; - var verticalRadius = data.borderStyle.verticalCornerRadius; - if (horizontalRadius > 0 || verticalRadius > 0) { - var radius = horizontalRadius + 'px / ' + verticalRadius + 'px'; - container.style.borderRadius = radius; - } - switch (data.borderStyle.style) { - case _util.AnnotationBorderStyleType.SOLID: - container.style.borderStyle = 'solid'; - break; - case _util.AnnotationBorderStyleType.DASHED: - container.style.borderStyle = 'dashed'; - break; - case _util.AnnotationBorderStyleType.BEVELED: - (0, _util.warn)('Unimplemented border style: beveled'); - break; - case _util.AnnotationBorderStyleType.INSET: - (0, _util.warn)('Unimplemented border style: inset'); - break; - case _util.AnnotationBorderStyleType.UNDERLINE: - container.style.borderBottomStyle = 'solid'; - break; - default: - break; - } - if (data.color) { - container.style.borderColor = _util.Util.makeCssRgb(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0); - } else { - container.style.borderWidth = 0; - } - } - container.style.left = rect[0] + 'px'; - container.style.top = rect[1] + 'px'; - container.style.width = width + 'px'; - container.style.height = height + 'px'; - return container; - } - }, { - key: '_createPopup', - value: function _createPopup(container, trigger, data) { - if (!trigger) { - trigger = document.createElement('div'); - trigger.style.height = container.style.height; - trigger.style.width = container.style.width; - container.appendChild(trigger); - } - var popupElement = new PopupElement({ - container: container, - trigger: trigger, - color: data.color, - title: data.title, - contents: data.contents, - hideWrapper: true - }); - var popup = popupElement.render(); - popup.style.left = container.style.width; - container.appendChild(popup); - } - }, { - key: 'render', - value: function render() { - (0, _util.unreachable)('Abstract method `AnnotationElement.render` called'); - } - }]); +var fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//; - return AnnotationElement; -}(); +function parseUrl(sourceUrl) { + var parsedUrl = url.parse(sourceUrl); -var LinkAnnotationElement = function (_AnnotationElement) { - _inherits(LinkAnnotationElement, _AnnotationElement); + if (parsedUrl.protocol === "file:" || parsedUrl.host) { + return parsedUrl; + } - function LinkAnnotationElement(parameters) { - _classCallCheck(this, LinkAnnotationElement); + if (/^[a-z]:[/\\]/i.test(sourceUrl)) { + return url.parse("file:///".concat(sourceUrl)); + } - var isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action); - return _possibleConstructorReturn(this, (LinkAnnotationElement.__proto__ || Object.getPrototypeOf(LinkAnnotationElement)).call(this, parameters, isRenderable)); + if (!parsedUrl.host) { + parsedUrl.protocol = "file:"; } - _createClass(LinkAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'linkAnnotation'; - var data = this.data, - linkService = this.linkService; + return parsedUrl; +} - var link = document.createElement('a'); - (0, _dom_utils.addLinkAttributes)(link, { - url: data.url, - target: data.newWindow ? _dom_utils.LinkTarget.BLANK : linkService.externalLinkTarget, - rel: linkService.externalLinkRel - }); - if (!data.url) { - if (data.action) { - this._bindNamedAction(link, data.action); - } else { - this._bindLink(link, data.dest); - } - } - this.container.appendChild(link); - return this.container; +var PDFNodeStream = /*#__PURE__*/function () { + function PDFNodeStream(source) { + _classCallCheck(this, PDFNodeStream); + + this.source = source; + this.url = parseUrl(source.url); + this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:"; + this.isFsUrl = this.url.protocol === "file:"; + this.httpHeaders = this.isHttp && source.httpHeaders || {}; + this._fullRequestReader = null; + this._rangeRequestReaders = []; + } + + _createClass(PDFNodeStream, [{ + key: "getFullReader", + value: function getFullReader() { + (0, _util.assert)(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."); + this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this); + return this._fullRequestReader; } }, { - key: '_bindLink', - value: function _bindLink(link, destination) { - var _this2 = this; - - link.href = this.linkService.getDestinationHash(destination); - link.onclick = function () { - if (destination) { - _this2.linkService.navigateTo(destination); - } - return false; - }; - if (destination) { - link.className = 'internalLink'; + key: "getRangeReader", + value: function getRangeReader(start, end) { + if (end <= this._progressiveDataLength) { + return null; } + + var rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end); + + this._rangeRequestReaders.push(rangeReader); + + return rangeReader; } }, { - key: '_bindNamedAction', - value: function _bindNamedAction(link, action) { - var _this3 = this; + key: "cancelAllRequests", + value: function cancelAllRequests(reason) { + if (this._fullRequestReader) { + this._fullRequestReader.cancel(reason); + } - link.href = this.linkService.getAnchorUrl(''); - link.onclick = function () { - _this3.linkService.executeNamedAction(action); - return false; - }; - link.className = 'internalLink'; + var readers = this._rangeRequestReaders.slice(0); + + readers.forEach(function (reader) { + reader.cancel(reason); + }); + } + }, { + key: "_progressiveDataLength", + get: function get() { + return this._fullRequestReader ? this._fullRequestReader._loaded : 0; } }]); - return LinkAnnotationElement; -}(AnnotationElement); + return PDFNodeStream; +}(); -var TextAnnotationElement = function (_AnnotationElement2) { - _inherits(TextAnnotationElement, _AnnotationElement2); +exports.PDFNodeStream = PDFNodeStream; - function TextAnnotationElement(parameters) { - _classCallCheck(this, TextAnnotationElement); +var BaseFullReader = /*#__PURE__*/function () { + function BaseFullReader(stream) { + _classCallCheck(this, BaseFullReader); - var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - return _possibleConstructorReturn(this, (TextAnnotationElement.__proto__ || Object.getPrototypeOf(TextAnnotationElement)).call(this, parameters, isRenderable)); - } + this._url = stream.url; + this._done = false; + this._storedError = null; + this.onProgress = null; + var source = stream.source; + this._contentLength = source.length; + this._loaded = 0; + this._filename = null; + this._disableRange = source.disableRange || false; + this._rangeChunkSize = source.rangeChunkSize; - _createClass(TextAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'textAnnotation'; - var image = document.createElement('img'); - image.style.height = this.container.style.height; - image.style.width = this.container.style.width; - image.src = this.imageResourcesPath + 'annotation-' + this.data.name.toLowerCase() + '.svg'; - image.alt = '[{{type}} Annotation]'; - image.dataset.l10nId = 'text_annotation_type'; - image.dataset.l10nArgs = JSON.stringify({ type: this.data.name }); - if (!this.data.hasPopup) { - this._createPopup(this.container, image, this.data); - } - this.container.appendChild(image); - return this.container; + if (!this._rangeChunkSize && !this._disableRange) { + this._disableRange = true; } - }]); - return TextAnnotationElement; -}(AnnotationElement); + this._isStreamingSupported = !source.disableStream; + this._isRangeSupported = !source.disableRange; + this._readableStream = null; + this._readCapability = (0, _util.createPromiseCapability)(); + this._headersCapability = (0, _util.createPromiseCapability)(); + } -var WidgetAnnotationElement = function (_AnnotationElement3) { - _inherits(WidgetAnnotationElement, _AnnotationElement3); + _createClass(BaseFullReader, [{ + key: "read", + value: function () { + var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() { + var chunk, buffer; + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return this._readCapability.promise; - function WidgetAnnotationElement() { - _classCallCheck(this, WidgetAnnotationElement); + case 2: + if (!this._done) { + _context.next = 4; + break; + } - return _possibleConstructorReturn(this, (WidgetAnnotationElement.__proto__ || Object.getPrototypeOf(WidgetAnnotationElement)).apply(this, arguments)); - } + return _context.abrupt("return", { + value: undefined, + done: true + }); - _createClass(WidgetAnnotationElement, [{ - key: 'render', - value: function render() { - return this.container; - } - }]); + case 4: + if (!this._storedError) { + _context.next = 6; + break; + } - return WidgetAnnotationElement; -}(AnnotationElement); + throw this._storedError; -var TextWidgetAnnotationElement = function (_WidgetAnnotationElem) { - _inherits(TextWidgetAnnotationElement, _WidgetAnnotationElem); + case 6: + chunk = this._readableStream.read(); - function TextWidgetAnnotationElement(parameters) { - _classCallCheck(this, TextWidgetAnnotationElement); + if (!(chunk === null)) { + _context.next = 10; + break; + } - var isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue; - return _possibleConstructorReturn(this, (TextWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(TextWidgetAnnotationElement)).call(this, parameters, isRenderable)); - } + this._readCapability = (0, _util.createPromiseCapability)(); + return _context.abrupt("return", this.read()); - _createClass(TextWidgetAnnotationElement, [{ - key: 'render', - value: function render() { - var TEXT_ALIGNMENT = ['left', 'center', 'right']; - this.container.className = 'textWidgetAnnotation'; - var element = null; - if (this.renderInteractiveForms) { - if (this.data.multiLine) { - element = document.createElement('textarea'); - element.textContent = this.data.fieldValue; - } else { - element = document.createElement('input'); - element.type = 'text'; - element.setAttribute('value', this.data.fieldValue); - } - element.disabled = this.data.readOnly; - if (this.data.maxLen !== null) { - element.maxLength = this.data.maxLen; - } - if (this.data.comb) { - var fieldWidth = this.data.rect[2] - this.data.rect[0]; - var combWidth = fieldWidth / this.data.maxLen; - element.classList.add('comb'); - element.style.letterSpacing = 'calc(' + combWidth + 'px - 1ch)'; - } - } else { - element = document.createElement('div'); - element.textContent = this.data.fieldValue; - element.style.verticalAlign = 'middle'; - element.style.display = 'table-cell'; - var font = null; - if (this.data.fontRefName) { - font = this.page.commonObjs.getData(this.data.fontRefName); - } - this._setTextStyle(element, font); - } - if (this.data.textAlignment !== null) { - element.style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment]; - } - this.container.appendChild(element); - return this.container; - } - }, { - key: '_setTextStyle', - value: function _setTextStyle(element, font) { - var style = element.style; - style.fontSize = this.data.fontSize + 'px'; - style.direction = this.data.fontDirection < 0 ? 'rtl' : 'ltr'; - if (!font) { - return; - } - style.fontWeight = font.black ? font.bold ? '900' : 'bold' : font.bold ? 'bold' : 'normal'; - style.fontStyle = font.italic ? 'italic' : 'normal'; - var fontFamily = font.loadedName ? '"' + font.loadedName + '", ' : ''; - var fallbackName = font.fallbackName || 'Helvetica, sans-serif'; - style.fontFamily = fontFamily + fallbackName; - } - }]); + case 10: + this._loaded += chunk.length; - return TextWidgetAnnotationElement; -}(WidgetAnnotationElement); + if (this.onProgress) { + this.onProgress({ + loaded: this._loaded, + total: this._contentLength + }); + } -var CheckboxWidgetAnnotationElement = function (_WidgetAnnotationElem2) { - _inherits(CheckboxWidgetAnnotationElement, _WidgetAnnotationElem2); + buffer = new Uint8Array(chunk).buffer; + return _context.abrupt("return", { + value: buffer, + done: false + }); - function CheckboxWidgetAnnotationElement(parameters) { - _classCallCheck(this, CheckboxWidgetAnnotationElement); + case 14: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); - return _possibleConstructorReturn(this, (CheckboxWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(CheckboxWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms)); - } + function read() { + return _read.apply(this, arguments); + } - _createClass(CheckboxWidgetAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'buttonWidgetAnnotation checkBox'; - var element = document.createElement('input'); - element.disabled = this.data.readOnly; - element.type = 'checkbox'; - if (this.data.fieldValue && this.data.fieldValue !== 'Off') { - element.setAttribute('checked', true); + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + if (!this._readableStream) { + this._error(reason); + + return; } - this.container.appendChild(element); - return this.container; + + this._readableStream.destroy(reason); } - }]); + }, { + key: "_error", + value: function _error(reason) { + this._storedError = reason; - return CheckboxWidgetAnnotationElement; -}(WidgetAnnotationElement); + this._readCapability.resolve(); + } + }, { + key: "_setReadableStream", + value: function _setReadableStream(readableStream) { + var _this = this; -var RadioButtonWidgetAnnotationElement = function (_WidgetAnnotationElem3) { - _inherits(RadioButtonWidgetAnnotationElement, _WidgetAnnotationElem3); + this._readableStream = readableStream; + readableStream.on("readable", function () { + _this._readCapability.resolve(); + }); + readableStream.on("end", function () { + readableStream.destroy(); + _this._done = true; - function RadioButtonWidgetAnnotationElement(parameters) { - _classCallCheck(this, RadioButtonWidgetAnnotationElement); + _this._readCapability.resolve(); + }); + readableStream.on("error", function (reason) { + _this._error(reason); + }); - return _possibleConstructorReturn(this, (RadioButtonWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(RadioButtonWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms)); - } + if (!this._isStreamingSupported && this._isRangeSupported) { + this._error(new _util.AbortException("streaming is disabled")); + } - _createClass(RadioButtonWidgetAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'buttonWidgetAnnotation radioButton'; - var element = document.createElement('input'); - element.disabled = this.data.readOnly; - element.type = 'radio'; - element.name = this.data.fieldName; - if (this.data.fieldValue === this.data.buttonValue) { - element.setAttribute('checked', true); + if (this._storedError) { + this._readableStream.destroy(this._storedError); } - this.container.appendChild(element); - return this.container; + } + }, { + key: "headersReady", + get: function get() { + return this._headersCapability.promise; + } + }, { + key: "filename", + get: function get() { + return this._filename; + } + }, { + key: "contentLength", + get: function get() { + return this._contentLength; + } + }, { + key: "isRangeSupported", + get: function get() { + return this._isRangeSupported; + } + }, { + key: "isStreamingSupported", + get: function get() { + return this._isStreamingSupported; } }]); - return RadioButtonWidgetAnnotationElement; -}(WidgetAnnotationElement); - -var PushButtonWidgetAnnotationElement = function (_LinkAnnotationElemen) { - _inherits(PushButtonWidgetAnnotationElement, _LinkAnnotationElemen); + return BaseFullReader; +}(); - function PushButtonWidgetAnnotationElement() { - _classCallCheck(this, PushButtonWidgetAnnotationElement); +var BaseRangeReader = /*#__PURE__*/function () { + function BaseRangeReader(stream) { + _classCallCheck(this, BaseRangeReader); - return _possibleConstructorReturn(this, (PushButtonWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(PushButtonWidgetAnnotationElement)).apply(this, arguments)); + this._url = stream.url; + this._done = false; + this._storedError = null; + this.onProgress = null; + this._loaded = 0; + this._readableStream = null; + this._readCapability = (0, _util.createPromiseCapability)(); + var source = stream.source; + this._isStreamingSupported = !source.disableStream; } - _createClass(PushButtonWidgetAnnotationElement, [{ - key: 'render', - value: function render() { - var container = _get(PushButtonWidgetAnnotationElement.prototype.__proto__ || Object.getPrototypeOf(PushButtonWidgetAnnotationElement.prototype), 'render', this).call(this); - container.className = 'buttonWidgetAnnotation pushButton'; - return container; - } - }]); - - return PushButtonWidgetAnnotationElement; -}(LinkAnnotationElement); - -var ChoiceWidgetAnnotationElement = function (_WidgetAnnotationElem4) { - _inherits(ChoiceWidgetAnnotationElement, _WidgetAnnotationElem4); + _createClass(BaseRangeReader, [{ + key: "read", + value: function () { + var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() { + var chunk, buffer; + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return this._readCapability.promise; - function ChoiceWidgetAnnotationElement(parameters) { - _classCallCheck(this, ChoiceWidgetAnnotationElement); + case 2: + if (!this._done) { + _context2.next = 4; + break; + } - return _possibleConstructorReturn(this, (ChoiceWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(ChoiceWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms)); - } + return _context2.abrupt("return", { + value: undefined, + done: true + }); - _createClass(ChoiceWidgetAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'choiceWidgetAnnotation'; - var selectElement = document.createElement('select'); - selectElement.disabled = this.data.readOnly; - if (!this.data.combo) { - selectElement.size = this.data.options.length; - if (this.data.multiSelect) { - selectElement.multiple = true; - } - } - for (var i = 0, ii = this.data.options.length; i < ii; i++) { - var option = this.data.options[i]; - var optionElement = document.createElement('option'); - optionElement.textContent = option.displayValue; - optionElement.value = option.exportValue; - if (this.data.fieldValue.includes(option.displayValue)) { - optionElement.setAttribute('selected', true); - } - selectElement.appendChild(optionElement); - } - this.container.appendChild(selectElement); - return this.container; - } - }]); + case 4: + if (!this._storedError) { + _context2.next = 6; + break; + } - return ChoiceWidgetAnnotationElement; -}(WidgetAnnotationElement); + throw this._storedError; -var PopupAnnotationElement = function (_AnnotationElement4) { - _inherits(PopupAnnotationElement, _AnnotationElement4); + case 6: + chunk = this._readableStream.read(); - function PopupAnnotationElement(parameters) { - _classCallCheck(this, PopupAnnotationElement); + if (!(chunk === null)) { + _context2.next = 10; + break; + } - var isRenderable = !!(parameters.data.title || parameters.data.contents); - return _possibleConstructorReturn(this, (PopupAnnotationElement.__proto__ || Object.getPrototypeOf(PopupAnnotationElement)).call(this, parameters, isRenderable)); - } + this._readCapability = (0, _util.createPromiseCapability)(); + return _context2.abrupt("return", this.read()); - _createClass(PopupAnnotationElement, [{ - key: 'render', - value: function render() { - var IGNORE_TYPES = ['Line', 'Square', 'Circle', 'PolyLine', 'Polygon', 'Ink']; - this.container.className = 'popupAnnotation'; - if (IGNORE_TYPES.includes(this.data.parentType)) { - return this.container; - } - var selector = '[data-annotation-id="' + this.data.parentId + '"]'; - var parentElement = this.layer.querySelector(selector); - if (!parentElement) { - return this.container; - } - var popup = new PopupElement({ - container: this.container, - trigger: parentElement, - color: this.data.color, - title: this.data.title, - contents: this.data.contents - }); - var parentLeft = parseFloat(parentElement.style.left); - var parentWidth = parseFloat(parentElement.style.width); - this.container.style.transformOrigin = -(parentLeft + parentWidth) + 'px -' + parentElement.style.top; - this.container.style.left = parentLeft + parentWidth + 'px'; - this.container.appendChild(popup.render()); - return this.container; - } - }]); + case 10: + this._loaded += chunk.length; - return PopupAnnotationElement; -}(AnnotationElement); + if (this.onProgress) { + this.onProgress({ + loaded: this._loaded + }); + } -var PopupElement = function () { - function PopupElement(parameters) { - _classCallCheck(this, PopupElement); + buffer = new Uint8Array(chunk).buffer; + return _context2.abrupt("return", { + value: buffer, + done: false + }); - this.container = parameters.container; - this.trigger = parameters.trigger; - this.color = parameters.color; - this.title = parameters.title; - this.contents = parameters.contents; - this.hideWrapper = parameters.hideWrapper || false; - this.pinned = false; - } + case 14: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); - _createClass(PopupElement, [{ - key: 'render', - value: function render() { - var BACKGROUND_ENLIGHT = 0.7; - var wrapper = document.createElement('div'); - wrapper.className = 'popupWrapper'; - this.hideElement = this.hideWrapper ? wrapper : this.container; - this.hideElement.setAttribute('hidden', true); - var popup = document.createElement('div'); - popup.className = 'popup'; - var color = this.color; - if (color) { - var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0]; - var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1]; - var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2]; - popup.style.backgroundColor = _util.Util.makeCssRgb(r | 0, g | 0, b | 0); + function read() { + return _read2.apply(this, arguments); } - var contents = this._formatContents(this.contents); - var title = document.createElement('h1'); - title.textContent = this.title; - this.trigger.addEventListener('click', this._toggle.bind(this)); - this.trigger.addEventListener('mouseover', this._show.bind(this, false)); - this.trigger.addEventListener('mouseout', this._hide.bind(this, false)); - popup.addEventListener('click', this._hide.bind(this, true)); - popup.appendChild(title); - popup.appendChild(contents); - wrapper.appendChild(popup); - return wrapper; - } + + return read; + }() }, { - key: '_formatContents', - value: function _formatContents(contents) { - var p = document.createElement('p'); - var lines = contents.split(/(?:\r\n?|\n)/); - for (var i = 0, ii = lines.length; i < ii; ++i) { - var line = lines[i]; - p.appendChild(document.createTextNode(line)); - if (i < ii - 1) { - p.appendChild(document.createElement('br')); - } + key: "cancel", + value: function cancel(reason) { + if (!this._readableStream) { + this._error(reason); + + return; } - return p; + + this._readableStream.destroy(reason); } }, { - key: '_toggle', - value: function _toggle() { - if (this.pinned) { - this._hide(true); - } else { - this._show(true); - } + key: "_error", + value: function _error(reason) { + this._storedError = reason; + + this._readCapability.resolve(); } }, { - key: '_show', - value: function _show() { - var pin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + key: "_setReadableStream", + value: function _setReadableStream(readableStream) { + var _this2 = this; - if (pin) { - this.pinned = true; - } - if (this.hideElement.hasAttribute('hidden')) { - this.hideElement.removeAttribute('hidden'); - this.container.style.zIndex += 1; + this._readableStream = readableStream; + readableStream.on("readable", function () { + _this2._readCapability.resolve(); + }); + readableStream.on("end", function () { + readableStream.destroy(); + _this2._done = true; + + _this2._readCapability.resolve(); + }); + readableStream.on("error", function (reason) { + _this2._error(reason); + }); + + if (this._storedError) { + this._readableStream.destroy(this._storedError); } } }, { - key: '_hide', - value: function _hide() { - var unpin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - - if (unpin) { - this.pinned = false; - } - if (!this.hideElement.hasAttribute('hidden') && !this.pinned) { - this.hideElement.setAttribute('hidden', true); - this.container.style.zIndex -= 1; - } + key: "isStreamingSupported", + get: function get() { + return this._isStreamingSupported; } }]); - return PopupElement; + return BaseRangeReader; }(); -var LineAnnotationElement = function (_AnnotationElement5) { - _inherits(LineAnnotationElement, _AnnotationElement5); - - function LineAnnotationElement(parameters) { - _classCallCheck(this, LineAnnotationElement); - - var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - return _possibleConstructorReturn(this, (LineAnnotationElement.__proto__ || Object.getPrototypeOf(LineAnnotationElement)).call(this, parameters, isRenderable, true)); - } - - _createClass(LineAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'lineAnnotation'; - var data = this.data; - var width = data.rect[2] - data.rect[0]; - var height = data.rect[3] - data.rect[1]; - var svg = this.svgFactory.create(width, height); - var line = this.svgFactory.createElement('svg:line'); - line.setAttribute('x1', data.rect[2] - data.lineCoordinates[0]); - line.setAttribute('y1', data.rect[3] - data.lineCoordinates[1]); - line.setAttribute('x2', data.rect[2] - data.lineCoordinates[2]); - line.setAttribute('y2', data.rect[3] - data.lineCoordinates[3]); - line.setAttribute('stroke-width', data.borderStyle.width); - line.setAttribute('stroke', 'transparent'); - svg.appendChild(line); - this.container.append(svg); - this._createPopup(this.container, line, data); - return this.container; - } - }]); - - return LineAnnotationElement; -}(AnnotationElement); - -var SquareAnnotationElement = function (_AnnotationElement6) { - _inherits(SquareAnnotationElement, _AnnotationElement6); - - function SquareAnnotationElement(parameters) { - _classCallCheck(this, SquareAnnotationElement); - - var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - return _possibleConstructorReturn(this, (SquareAnnotationElement.__proto__ || Object.getPrototypeOf(SquareAnnotationElement)).call(this, parameters, isRenderable, true)); - } +function createRequestOptions(parsedUrl, headers) { + return { + protocol: parsedUrl.protocol, + auth: parsedUrl.auth, + host: parsedUrl.hostname, + port: parsedUrl.port, + path: parsedUrl.path, + method: "GET", + headers: headers + }; +} - _createClass(SquareAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'squareAnnotation'; - var data = this.data; - var width = data.rect[2] - data.rect[0]; - var height = data.rect[3] - data.rect[1]; - var svg = this.svgFactory.create(width, height); - var borderWidth = data.borderStyle.width; - var square = this.svgFactory.createElement('svg:rect'); - square.setAttribute('x', borderWidth / 2); - square.setAttribute('y', borderWidth / 2); - square.setAttribute('width', width - borderWidth); - square.setAttribute('height', height - borderWidth); - square.setAttribute('stroke-width', borderWidth); - square.setAttribute('stroke', 'transparent'); - square.setAttribute('fill', 'none'); - svg.appendChild(square); - this.container.append(svg); - this._createPopup(this.container, square, data); - return this.container; - } - }]); +var PDFNodeStreamFullReader = /*#__PURE__*/function (_BaseFullReader) { + _inherits(PDFNodeStreamFullReader, _BaseFullReader); - return SquareAnnotationElement; -}(AnnotationElement); + var _super = _createSuper(PDFNodeStreamFullReader); -var CircleAnnotationElement = function (_AnnotationElement7) { - _inherits(CircleAnnotationElement, _AnnotationElement7); + function PDFNodeStreamFullReader(stream) { + var _this3; - function CircleAnnotationElement(parameters) { - _classCallCheck(this, CircleAnnotationElement); + _classCallCheck(this, PDFNodeStreamFullReader); - var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - return _possibleConstructorReturn(this, (CircleAnnotationElement.__proto__ || Object.getPrototypeOf(CircleAnnotationElement)).call(this, parameters, isRenderable, true)); - } + _this3 = _super.call(this, stream); - _createClass(CircleAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'circleAnnotation'; - var data = this.data; - var width = data.rect[2] - data.rect[0]; - var height = data.rect[3] - data.rect[1]; - var svg = this.svgFactory.create(width, height); - var borderWidth = data.borderStyle.width; - var circle = this.svgFactory.createElement('svg:ellipse'); - circle.setAttribute('cx', width / 2); - circle.setAttribute('cy', height / 2); - circle.setAttribute('rx', width / 2 - borderWidth / 2); - circle.setAttribute('ry', height / 2 - borderWidth / 2); - circle.setAttribute('stroke-width', borderWidth); - circle.setAttribute('stroke', 'transparent'); - circle.setAttribute('fill', 'none'); - svg.appendChild(circle); - this.container.append(svg); - this._createPopup(this.container, circle, data); - return this.container; - } - }]); + var handleResponse = function handleResponse(response) { + if (response.statusCode === 404) { + var error = new _util.MissingPDFException("Missing PDF \"".concat(_this3._url, "\".")); + _this3._storedError = error; - return CircleAnnotationElement; -}(AnnotationElement); + _this3._headersCapability.reject(error); -var PolylineAnnotationElement = function (_AnnotationElement8) { - _inherits(PolylineAnnotationElement, _AnnotationElement8); + return; + } - function PolylineAnnotationElement(parameters) { - _classCallCheck(this, PolylineAnnotationElement); + _this3._headersCapability.resolve(); - var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + _this3._setReadableStream(response); - var _this15 = _possibleConstructorReturn(this, (PolylineAnnotationElement.__proto__ || Object.getPrototypeOf(PolylineAnnotationElement)).call(this, parameters, isRenderable, true)); + var getResponseHeader = function getResponseHeader(name) { + return _this3._readableStream.headers[name.toLowerCase()]; + }; - _this15.containerClassName = 'polylineAnnotation'; - _this15.svgElementName = 'svg:polyline'; - return _this15; - } + var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({ + getResponseHeader: getResponseHeader, + isHttp: stream.isHttp, + rangeChunkSize: _this3._rangeChunkSize, + disableRange: _this3._disableRange + }), + allowRangeRequests = _validateRangeRequest.allowRangeRequests, + suggestedLength = _validateRangeRequest.suggestedLength; - _createClass(PolylineAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = this.containerClassName; - var data = this.data; - var width = data.rect[2] - data.rect[0]; - var height = data.rect[3] - data.rect[1]; - var svg = this.svgFactory.create(width, height); - var vertices = data.vertices; - var points = []; - for (var i = 0, ii = vertices.length; i < ii; i++) { - var x = vertices[i].x - data.rect[0]; - var y = data.rect[3] - vertices[i].y; - points.push(x + ',' + y); - } - points = points.join(' '); - var borderWidth = data.borderStyle.width; - var polyline = this.svgFactory.createElement(this.svgElementName); - polyline.setAttribute('points', points); - polyline.setAttribute('stroke-width', borderWidth); - polyline.setAttribute('stroke', 'transparent'); - polyline.setAttribute('fill', 'none'); - svg.appendChild(polyline); - this.container.append(svg); - this._createPopup(this.container, polyline, data); - return this.container; - } - }]); + _this3._isRangeSupported = allowRangeRequests; + _this3._contentLength = suggestedLength || _this3._contentLength; + _this3._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); + }; - return PolylineAnnotationElement; -}(AnnotationElement); + _this3._request = null; -var PolygonAnnotationElement = function (_PolylineAnnotationEl) { - _inherits(PolygonAnnotationElement, _PolylineAnnotationEl); + if (_this3._url.protocol === "http:") { + _this3._request = http.request(createRequestOptions(_this3._url, stream.httpHeaders), handleResponse); + } else { + _this3._request = https.request(createRequestOptions(_this3._url, stream.httpHeaders), handleResponse); + } - function PolygonAnnotationElement(parameters) { - _classCallCheck(this, PolygonAnnotationElement); + _this3._request.on("error", function (reason) { + _this3._storedError = reason; + + _this3._headersCapability.reject(reason); + }); - var _this16 = _possibleConstructorReturn(this, (PolygonAnnotationElement.__proto__ || Object.getPrototypeOf(PolygonAnnotationElement)).call(this, parameters)); + _this3._request.end(); - _this16.containerClassName = 'polygonAnnotation'; - _this16.svgElementName = 'svg:polygon'; - return _this16; + return _this3; } - return PolygonAnnotationElement; -}(PolylineAnnotationElement); + return PDFNodeStreamFullReader; +}(BaseFullReader); -var InkAnnotationElement = function (_AnnotationElement9) { - _inherits(InkAnnotationElement, _AnnotationElement9); +var PDFNodeStreamRangeReader = /*#__PURE__*/function (_BaseRangeReader) { + _inherits(PDFNodeStreamRangeReader, _BaseRangeReader); - function InkAnnotationElement(parameters) { - _classCallCheck(this, InkAnnotationElement); + var _super2 = _createSuper(PDFNodeStreamRangeReader); - var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + function PDFNodeStreamRangeReader(stream, start, end) { + var _this4; - var _this17 = _possibleConstructorReturn(this, (InkAnnotationElement.__proto__ || Object.getPrototypeOf(InkAnnotationElement)).call(this, parameters, isRenderable, true)); + _classCallCheck(this, PDFNodeStreamRangeReader); - _this17.containerClassName = 'inkAnnotation'; - _this17.svgElementName = 'svg:polyline'; - return _this17; - } + _this4 = _super2.call(this, stream); + _this4._httpHeaders = {}; - _createClass(InkAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = this.containerClassName; - var data = this.data; - var width = data.rect[2] - data.rect[0]; - var height = data.rect[3] - data.rect[1]; - var svg = this.svgFactory.create(width, height); - var inkLists = data.inkLists; - for (var i = 0, ii = inkLists.length; i < ii; i++) { - var inkList = inkLists[i]; - var points = []; - for (var j = 0, jj = inkList.length; j < jj; j++) { - var x = inkList[j].x - data.rect[0]; - var y = data.rect[3] - inkList[j].y; - points.push(x + ',' + y); - } - points = points.join(' '); - var borderWidth = data.borderStyle.width; - var polyline = this.svgFactory.createElement(this.svgElementName); - polyline.setAttribute('points', points); - polyline.setAttribute('stroke-width', borderWidth); - polyline.setAttribute('stroke', 'transparent'); - polyline.setAttribute('fill', 'none'); - this._createPopup(this.container, polyline, data); - svg.appendChild(polyline); + for (var property in stream.httpHeaders) { + var value = stream.httpHeaders[property]; + + if (typeof value === "undefined") { + continue; } - this.container.append(svg); - return this.container; + + _this4._httpHeaders[property] = value; } - }]); - return InkAnnotationElement; -}(AnnotationElement); + _this4._httpHeaders.Range = "bytes=".concat(start, "-").concat(end - 1); -var HighlightAnnotationElement = function (_AnnotationElement10) { - _inherits(HighlightAnnotationElement, _AnnotationElement10); + var handleResponse = function handleResponse(response) { + if (response.statusCode === 404) { + var error = new _util.MissingPDFException("Missing PDF \"".concat(_this4._url, "\".")); + _this4._storedError = error; + return; + } - function HighlightAnnotationElement(parameters) { - _classCallCheck(this, HighlightAnnotationElement); + _this4._setReadableStream(response); + }; - var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - return _possibleConstructorReturn(this, (HighlightAnnotationElement.__proto__ || Object.getPrototypeOf(HighlightAnnotationElement)).call(this, parameters, isRenderable, true)); - } + _this4._request = null; - _createClass(HighlightAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'highlightAnnotation'; - if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); - } - return this.container; + if (_this4._url.protocol === "http:") { + _this4._request = http.request(createRequestOptions(_this4._url, _this4._httpHeaders), handleResponse); + } else { + _this4._request = https.request(createRequestOptions(_this4._url, _this4._httpHeaders), handleResponse); } - }]); - - return HighlightAnnotationElement; -}(AnnotationElement); -var UnderlineAnnotationElement = function (_AnnotationElement11) { - _inherits(UnderlineAnnotationElement, _AnnotationElement11); + _this4._request.on("error", function (reason) { + _this4._storedError = reason; + }); - function UnderlineAnnotationElement(parameters) { - _classCallCheck(this, UnderlineAnnotationElement); + _this4._request.end(); - var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - return _possibleConstructorReturn(this, (UnderlineAnnotationElement.__proto__ || Object.getPrototypeOf(UnderlineAnnotationElement)).call(this, parameters, isRenderable, true)); + return _this4; } - _createClass(UnderlineAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'underlineAnnotation'; - if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); - } - return this.container; - } - }]); + return PDFNodeStreamRangeReader; +}(BaseRangeReader); - return UnderlineAnnotationElement; -}(AnnotationElement); +var PDFNodeStreamFsFullReader = /*#__PURE__*/function (_BaseFullReader2) { + _inherits(PDFNodeStreamFsFullReader, _BaseFullReader2); -var SquigglyAnnotationElement = function (_AnnotationElement12) { - _inherits(SquigglyAnnotationElement, _AnnotationElement12); + var _super3 = _createSuper(PDFNodeStreamFsFullReader); - function SquigglyAnnotationElement(parameters) { - _classCallCheck(this, SquigglyAnnotationElement); + function PDFNodeStreamFsFullReader(stream) { + var _this5; - var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - return _possibleConstructorReturn(this, (SquigglyAnnotationElement.__proto__ || Object.getPrototypeOf(SquigglyAnnotationElement)).call(this, parameters, isRenderable, true)); - } + _classCallCheck(this, PDFNodeStreamFsFullReader); - _createClass(SquigglyAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'squigglyAnnotation'; - if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); - } - return this.container; - } - }]); + _this5 = _super3.call(this, stream); + var path = decodeURIComponent(_this5._url.path); - return SquigglyAnnotationElement; -}(AnnotationElement); + if (fileUriRegex.test(_this5._url.href)) { + path = path.replace(/^\//, ""); + } -var StrikeOutAnnotationElement = function (_AnnotationElement13) { - _inherits(StrikeOutAnnotationElement, _AnnotationElement13); + fs.lstat(path, function (error, stat) { + if (error) { + if (error.code === "ENOENT") { + error = new _util.MissingPDFException("Missing PDF \"".concat(path, "\".")); + } - function StrikeOutAnnotationElement(parameters) { - _classCallCheck(this, StrikeOutAnnotationElement); + _this5._storedError = error; - var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - return _possibleConstructorReturn(this, (StrikeOutAnnotationElement.__proto__ || Object.getPrototypeOf(StrikeOutAnnotationElement)).call(this, parameters, isRenderable, true)); - } + _this5._headersCapability.reject(error); - _createClass(StrikeOutAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'strikeoutAnnotation'; - if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); + return; } - return this.container; - } - }]); - - return StrikeOutAnnotationElement; -}(AnnotationElement); -var StampAnnotationElement = function (_AnnotationElement14) { - _inherits(StampAnnotationElement, _AnnotationElement14); + _this5._contentLength = stat.size; - function StampAnnotationElement(parameters) { - _classCallCheck(this, StampAnnotationElement); + _this5._setReadableStream(fs.createReadStream(path)); - var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - return _possibleConstructorReturn(this, (StampAnnotationElement.__proto__ || Object.getPrototypeOf(StampAnnotationElement)).call(this, parameters, isRenderable, true)); + _this5._headersCapability.resolve(); + }); + return _this5; } - _createClass(StampAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'stampAnnotation'; - if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); - } - return this.container; - } - }]); - - return StampAnnotationElement; -}(AnnotationElement); + return PDFNodeStreamFsFullReader; +}(BaseFullReader); -var FileAttachmentAnnotationElement = function (_AnnotationElement15) { - _inherits(FileAttachmentAnnotationElement, _AnnotationElement15); +var PDFNodeStreamFsRangeReader = /*#__PURE__*/function (_BaseRangeReader2) { + _inherits(PDFNodeStreamFsRangeReader, _BaseRangeReader2); - function FileAttachmentAnnotationElement(parameters) { - _classCallCheck(this, FileAttachmentAnnotationElement); + var _super4 = _createSuper(PDFNodeStreamFsRangeReader); - var _this23 = _possibleConstructorReturn(this, (FileAttachmentAnnotationElement.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotationElement)).call(this, parameters, true)); + function PDFNodeStreamFsRangeReader(stream, start, end) { + var _this6; - var _this23$data$file = _this23.data.file, - filename = _this23$data$file.filename, - content = _this23$data$file.content; + _classCallCheck(this, PDFNodeStreamFsRangeReader); - _this23.filename = (0, _dom_utils.getFilenameFromUrl)(filename); - _this23.content = content; - if (_this23.linkService.eventBus) { - _this23.linkService.eventBus.dispatch('fileattachmentannotation', { - source: _this23, - id: (0, _util.stringToPDFString)(filename), - filename: filename, - content: content - }); - } - return _this23; - } + _this6 = _super4.call(this, stream); + var path = decodeURIComponent(_this6._url.path); - _createClass(FileAttachmentAnnotationElement, [{ - key: 'render', - value: function render() { - this.container.className = 'fileAttachmentAnnotation'; - var trigger = document.createElement('div'); - trigger.style.height = this.container.style.height; - trigger.style.width = this.container.style.width; - trigger.addEventListener('dblclick', this._download.bind(this)); - if (!this.data.hasPopup && (this.data.title || this.data.contents)) { - this._createPopup(this.container, trigger, this.data); - } - this.container.appendChild(trigger); - return this.container; - } - }, { - key: '_download', - value: function _download() { - if (!this.downloadManager) { - (0, _util.warn)('Download cannot be started due to unavailable download manager'); - return; - } - this.downloadManager.downloadData(this.content, this.filename, ''); + if (fileUriRegex.test(_this6._url.href)) { + path = path.replace(/^\//, ""); } - }]); - return FileAttachmentAnnotationElement; -}(AnnotationElement); + _this6._setReadableStream(fs.createReadStream(path, { + start: start, + end: end - 1 + })); -var AnnotationLayer = function () { - function AnnotationLayer() { - _classCallCheck(this, AnnotationLayer); + return _this6; } - _createClass(AnnotationLayer, null, [{ - key: 'render', - value: function render(parameters) { - for (var i = 0, ii = parameters.annotations.length; i < ii; i++) { - var data = parameters.annotations[i]; - if (!data) { - continue; - } - var element = AnnotationElementFactory.create({ - data: data, - layer: parameters.div, - page: parameters.page, - viewport: parameters.viewport, - linkService: parameters.linkService, - downloadManager: parameters.downloadManager, - imageResourcesPath: parameters.imageResourcesPath || '', - renderInteractiveForms: parameters.renderInteractiveForms || false, - svgFactory: new _dom_utils.DOMSVGFactory() - }); - if (element.isRenderable) { - parameters.div.appendChild(element.render()); - } - } - } - }, { - key: 'update', - value: function update(parameters) { - for (var i = 0, ii = parameters.annotations.length; i < ii; i++) { - var data = parameters.annotations[i]; - var element = parameters.div.querySelector('[data-annotation-id="' + data.id + '"]'); - if (element) { - element.style.transform = 'matrix(' + parameters.viewport.transform.join(',') + ')'; - } - } - parameters.div.removeAttribute('hidden'); - } - }]); - - return AnnotationLayer; -}(); - -exports.AnnotationLayer = AnnotationLayer; + return PDFNodeStreamFsRangeReader; +}(BaseRangeReader); /***/ }), -/* 147 */ +/* 213 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.SVGGraphics = undefined; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createResponseStatusError = createResponseStatusError; +exports.extractFilenameFromHeader = extractFilenameFromHeader; +exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities; +exports.validateResponseStatus = validateResponseStatus; + +var _util = __w_pdfjs_require__(5); + +var _content_disposition = __w_pdfjs_require__(214); + +function validateRangeRequestCapabilities(_ref) { + var getResponseHeader = _ref.getResponseHeader, + isHttp = _ref.isHttp, + rangeChunkSize = _ref.rangeChunkSize, + disableRange = _ref.disableRange; + (0, _util.assert)(rangeChunkSize > 0, "Range chunk size must be larger than zero"); + var returnValues = { + allowRangeRequests: false, + suggestedLength: undefined + }; + var length = parseInt(getResponseHeader("Content-Length"), 10); + + if (!Number.isInteger(length)) { + return returnValues; + } + + returnValues.suggestedLength = length; + + if (length <= 2 * rangeChunkSize) { + return returnValues; + } + + if (disableRange || !isHttp) { + return returnValues; + } + + if (getResponseHeader("Accept-Ranges") !== "bytes") { + return returnValues; + } -var _util = __w_pdfjs_require__(1); + var contentEncoding = getResponseHeader("Content-Encoding") || "identity"; -var _dom_utils = __w_pdfjs_require__(130); + if (contentEncoding !== "identity") { + return returnValues; + } -var _is_node = __w_pdfjs_require__(4); + returnValues.allowRangeRequests = true; + return returnValues; +} -var _is_node2 = _interopRequireDefault(_is_node); +function extractFilenameFromHeader(getResponseHeader) { + var contentDisposition = getResponseHeader("Content-Disposition"); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (contentDisposition) { + var filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition); -var SVGGraphics = function SVGGraphics() { - throw new Error('Not implemented: SVGGraphics'); -}; -{ - var SVG_DEFAULTS = { - fontStyle: 'normal', - fontWeight: 'normal', - fillColor: '#000000' - }; - var convertImgDataToPng = function convertImgDataToPngClosure() { - var PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]); - var CHUNK_WRAPPER_SIZE = 12; - var crcTable = new Int32Array(256); - for (var i = 0; i < 256; i++) { - var c = i; - for (var h = 0; h < 8; h++) { - if (c & 1) { - c = 0xedB88320 ^ c >> 1 & 0x7fffffff; - } else { - c = c >> 1 & 0x7fffffff; - } - } - crcTable[i] = c; - } - function crc32(data, start, end) { - var crc = -1; - for (var i = start; i < end; i++) { - var a = (crc ^ data[i]) & 0xff; - var b = crcTable[a]; - crc = crc >>> 8 ^ b; - } - return crc ^ -1; - } - function writePngChunk(type, body, data, offset) { - var p = offset; - var len = body.length; - data[p] = len >> 24 & 0xff; - data[p + 1] = len >> 16 & 0xff; - data[p + 2] = len >> 8 & 0xff; - data[p + 3] = len & 0xff; - p += 4; - data[p] = type.charCodeAt(0) & 0xff; - data[p + 1] = type.charCodeAt(1) & 0xff; - data[p + 2] = type.charCodeAt(2) & 0xff; - data[p + 3] = type.charCodeAt(3) & 0xff; - p += 4; - data.set(body, p); - p += body.length; - var crc = crc32(data, offset + 4, p); - data[p] = crc >> 24 & 0xff; - data[p + 1] = crc >> 16 & 0xff; - data[p + 2] = crc >> 8 & 0xff; - data[p + 3] = crc & 0xff; - } - function adler32(data, start, end) { - var a = 1; - var b = 0; - for (var i = start; i < end; ++i) { - a = (a + (data[i] & 0xff)) % 65521; - b = (b + a) % 65521; - } - return b << 16 | a; - } - function deflateSync(literals) { - if (!(0, _is_node2.default)()) { - return deflateSyncUncompressed(literals); - } + if (filename.includes("%")) { try { - var input; - if (parseInt(process.versions.node) >= 8) { - input = literals; - } else { - input = new Buffer(literals); - } - var output = require('zlib').deflateSync(input, { level: 9 }); - return output instanceof Uint8Array ? output : new Uint8Array(output); - } catch (e) { - (0, _util.warn)('Not compressing PNG because zlib.deflateSync is unavailable: ' + e); - } - return deflateSyncUncompressed(literals); - } - function deflateSyncUncompressed(literals) { - var len = literals.length; - var maxBlockLength = 0xFFFF; - var deflateBlocks = Math.ceil(len / maxBlockLength); - var idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4); - var pi = 0; - idat[pi++] = 0x78; - idat[pi++] = 0x9c; - var pos = 0; - while (len > maxBlockLength) { - idat[pi++] = 0x00; - idat[pi++] = 0xff; - idat[pi++] = 0xff; - idat[pi++] = 0x00; - idat[pi++] = 0x00; - idat.set(literals.subarray(pos, pos + maxBlockLength), pi); - pi += maxBlockLength; - pos += maxBlockLength; - len -= maxBlockLength; - } - idat[pi++] = 0x01; - idat[pi++] = len & 0xff; - idat[pi++] = len >> 8 & 0xff; - idat[pi++] = ~len & 0xffff & 0xff; - idat[pi++] = (~len & 0xffff) >> 8 & 0xff; - idat.set(literals.subarray(pos), pi); - pi += literals.length - pos; - var adler = adler32(literals, 0, literals.length); - idat[pi++] = adler >> 24 & 0xff; - idat[pi++] = adler >> 16 & 0xff; - idat[pi++] = adler >> 8 & 0xff; - idat[pi++] = adler & 0xff; - return idat; - } - function encode(imgData, kind, forceDataSchema, isMask) { - var width = imgData.width; - var height = imgData.height; - var bitDepth, colorType, lineSize; - var bytes = imgData.data; - switch (kind) { - case _util.ImageKind.GRAYSCALE_1BPP: - colorType = 0; - bitDepth = 1; - lineSize = width + 7 >> 3; - break; - case _util.ImageKind.RGB_24BPP: - colorType = 2; - bitDepth = 8; - lineSize = width * 3; - break; - case _util.ImageKind.RGBA_32BPP: - colorType = 6; - bitDepth = 8; - lineSize = width * 4; - break; - default: - throw new Error('invalid format'); - } - var literals = new Uint8Array((1 + lineSize) * height); - var offsetLiterals = 0, - offsetBytes = 0; - var y, i; - for (y = 0; y < height; ++y) { - literals[offsetLiterals++] = 0; - literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals); - offsetBytes += lineSize; - offsetLiterals += lineSize; - } - if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) { - offsetLiterals = 0; - for (y = 0; y < height; y++) { - offsetLiterals++; - for (i = 0; i < lineSize; i++) { - literals[offsetLiterals++] ^= 0xFF; - } - } - } - var ihdr = new Uint8Array([width >> 24 & 0xff, width >> 16 & 0xff, width >> 8 & 0xff, width & 0xff, height >> 24 & 0xff, height >> 16 & 0xff, height >> 8 & 0xff, height & 0xff, bitDepth, colorType, 0x00, 0x00, 0x00]); - var idat = deflateSync(literals); - var pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length; - var data = new Uint8Array(pngLength); - var offset = 0; - data.set(PNG_HEADER, offset); - offset += PNG_HEADER.length; - writePngChunk('IHDR', ihdr, data, offset); - offset += CHUNK_WRAPPER_SIZE + ihdr.length; - writePngChunk('IDATA', idat, data, offset); - offset += CHUNK_WRAPPER_SIZE + idat.length; - writePngChunk('IEND', new Uint8Array(0), data, offset); - return (0, _util.createObjectURL)(data, 'image/png', forceDataSchema); - } - return function convertImgDataToPng(imgData, forceDataSchema, isMask) { - var kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind; - return encode(imgData, kind, forceDataSchema, isMask); - }; - }(); - var SVGExtraState = function SVGExtraStateClosure() { - function SVGExtraState() { - this.fontSizeScale = 1; - this.fontWeight = SVG_DEFAULTS.fontWeight; - this.fontSize = 0; - this.textMatrix = _util.IDENTITY_MATRIX; - this.fontMatrix = _util.FONT_IDENTITY_MATRIX; - this.leading = 0; - this.textRenderingMode = _util.TextRenderingMode.FILL; - this.x = 0; - this.y = 0; - this.lineX = 0; - this.lineY = 0; - this.charSpacing = 0; - this.wordSpacing = 0; - this.textHScale = 1; - this.textRise = 0; - this.fillColor = SVG_DEFAULTS.fillColor; - this.strokeColor = '#000000'; - this.fillAlpha = 1; - this.strokeAlpha = 1; - this.lineWidth = 1; - this.lineJoin = ''; - this.lineCap = ''; - this.miterLimit = 0; - this.dashArray = []; - this.dashPhase = 0; - this.dependencies = []; - this.activeClipUrl = null; - this.clipGroup = null; - this.maskId = ''; - } - SVGExtraState.prototype = { - clone: function SVGExtraState_clone() { - return Object.create(this); - }, - setCurrentPoint: function SVGExtraState_setCurrentPoint(x, y) { - this.x = x; - this.y = y; - } - }; - return SVGExtraState; - }(); - exports.SVGGraphics = SVGGraphics = function SVGGraphicsClosure() { - function opListToTree(opList) { - var opTree = []; - var tmp = []; - var opListLen = opList.length; - for (var x = 0; x < opListLen; x++) { - if (opList[x].fn === 'save') { - opTree.push({ - 'fnId': 92, - 'fn': 'group', - 'items': [] - }); - tmp.push(opTree); - opTree = opTree[opTree.length - 1].items; - continue; - } - if (opList[x].fn === 'restore') { - opTree = tmp.pop(); - } else { - opTree.push(opList[x]); - } - } - return opTree; - } - function pf(value) { - if (Number.isInteger(value)) { - return value.toString(); - } - var s = value.toFixed(10); - var i = s.length - 1; - if (s[i] !== '0') { - return s; - } - do { - i--; - } while (s[i] === '0'); - return s.substring(0, s[i] === '.' ? i : i + 1); - } - function pm(m) { - if (m[4] === 0 && m[5] === 0) { - if (m[1] === 0 && m[2] === 0) { - if (m[0] === 1 && m[3] === 1) { - return ''; - } - return 'scale(' + pf(m[0]) + ' ' + pf(m[3]) + ')'; - } - if (m[0] === m[3] && m[1] === -m[2]) { - var a = Math.acos(m[0]) * 180 / Math.PI; - return 'rotate(' + pf(a) + ')'; - } - } else { - if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) { - return 'translate(' + pf(m[4]) + ' ' + pf(m[5]) + ')'; - } - } - return 'matrix(' + pf(m[0]) + ' ' + pf(m[1]) + ' ' + pf(m[2]) + ' ' + pf(m[3]) + ' ' + pf(m[4]) + ' ' + pf(m[5]) + ')'; + filename = decodeURIComponent(filename); + } catch (ex) {} } - function SVGGraphics(commonObjs, objs, forceDataSchema) { - this.svgFactory = new _dom_utils.DOMSVGFactory(); - this.current = new SVGExtraState(); - this.transformMatrix = _util.IDENTITY_MATRIX; - this.transformStack = []; - this.extraStack = []; - this.commonObjs = commonObjs; - this.objs = objs; - this.pendingClip = null; - this.pendingEOFill = false; - this.embedFonts = false; - this.embeddedFonts = Object.create(null); - this.cssStyle = null; - this.forceDataSchema = !!forceDataSchema; + + if (/\.pdf$/i.test(filename)) { + return filename; } - var XML_NS = 'http://www.w3.org/XML/1998/namespace'; - var XLINK_NS = 'http://www.w3.org/1999/xlink'; - var LINE_CAP_STYLES = ['butt', 'round', 'square']; - var LINE_JOIN_STYLES = ['miter', 'round', 'bevel']; - var clipCount = 0; - var maskCount = 0; - SVGGraphics.prototype = { - save: function SVGGraphics_save() { - this.transformStack.push(this.transformMatrix); - var old = this.current; - this.extraStack.push(old); - this.current = old.clone(); - }, - restore: function SVGGraphics_restore() { - this.transformMatrix = this.transformStack.pop(); - this.current = this.extraStack.pop(); - this.pendingClip = null; - this.tgrp = null; - }, - group: function SVGGraphics_group(items) { - this.save(); - this.executeOpTree(items); - this.restore(); - }, - loadDependencies: function SVGGraphics_loadDependencies(operatorList) { - var _this = this; + } + + return null; +} + +function createResponseStatusError(status, url) { + if (status === 404 || status === 0 && url.startsWith("file:")) { + return new _util.MissingPDFException('Missing PDF "' + url + '".'); + } - var fnArray = operatorList.fnArray; - var fnArrayLen = fnArray.length; - var argsArray = operatorList.argsArray; - for (var i = 0; i < fnArrayLen; i++) { - if (_util.OPS.dependency === fnArray[i]) { - var deps = argsArray[i]; - for (var n = 0, nn = deps.length; n < nn; n++) { - var obj = deps[n]; - var common = obj.substring(0, 2) === 'g_'; - var promise; - if (common) { - promise = new Promise(function (resolve) { - _this.commonObjs.get(obj, resolve); - }); - } else { - promise = new Promise(function (resolve) { - _this.objs.get(obj, resolve); - }); - } - this.current.dependencies.push(promise); - } - } - } - return Promise.all(this.current.dependencies); - }, - transform: function SVGGraphics_transform(a, b, c, d, e, f) { - var transformMatrix = [a, b, c, d, e, f]; - this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix); - this.tgrp = null; - }, - getSVG: function SVGGraphics_getSVG(operatorList, viewport) { - var _this2 = this; + return new _util.UnexpectedResponseException("Unexpected server response (" + status + ') while retrieving PDF "' + url + '".', status); +} - this.viewport = viewport; - var svgElement = this._initialize(viewport); - return this.loadDependencies(operatorList).then(function () { - _this2.transformMatrix = _util.IDENTITY_MATRIX; - var opTree = _this2.convertOpList(operatorList); - _this2.executeOpTree(opTree); - return svgElement; - }); - }, - convertOpList: function SVGGraphics_convertOpList(operatorList) { - var argsArray = operatorList.argsArray; - var fnArray = operatorList.fnArray; - var fnArrayLen = fnArray.length; - var REVOPS = []; - var opList = []; - for (var op in _util.OPS) { - REVOPS[_util.OPS[op]] = op; - } - for (var x = 0; x < fnArrayLen; x++) { - var fnId = fnArray[x]; - opList.push({ - 'fnId': fnId, - 'fn': REVOPS[fnId], - 'args': argsArray[x] - }); - } - return opListToTree(opList); - }, - executeOpTree: function SVGGraphics_executeOpTree(opTree) { - var opTreeLen = opTree.length; - for (var x = 0; x < opTreeLen; x++) { - var fn = opTree[x].fn; - var fnId = opTree[x].fnId; - var args = opTree[x].args; - switch (fnId | 0) { - case _util.OPS.beginText: - this.beginText(); - break; - case _util.OPS.dependency: - break; - case _util.OPS.setLeading: - this.setLeading(args); - break; - case _util.OPS.setLeadingMoveText: - this.setLeadingMoveText(args[0], args[1]); - break; - case _util.OPS.setFont: - this.setFont(args); - break; - case _util.OPS.showText: - this.showText(args[0]); - break; - case _util.OPS.showSpacedText: - this.showText(args[0]); - break; - case _util.OPS.endText: - this.endText(); - break; - case _util.OPS.moveText: - this.moveText(args[0], args[1]); - break; - case _util.OPS.setCharSpacing: - this.setCharSpacing(args[0]); - break; - case _util.OPS.setWordSpacing: - this.setWordSpacing(args[0]); - break; - case _util.OPS.setHScale: - this.setHScale(args[0]); - break; - case _util.OPS.setTextMatrix: - this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); - break; - case _util.OPS.setTextRise: - this.setTextRise(args[0]); - break; - case _util.OPS.setTextRenderingMode: - this.setTextRenderingMode(args[0]); - break; - case _util.OPS.setLineWidth: - this.setLineWidth(args[0]); - break; - case _util.OPS.setLineJoin: - this.setLineJoin(args[0]); - break; - case _util.OPS.setLineCap: - this.setLineCap(args[0]); - break; - case _util.OPS.setMiterLimit: - this.setMiterLimit(args[0]); - break; - case _util.OPS.setFillRGBColor: - this.setFillRGBColor(args[0], args[1], args[2]); - break; - case _util.OPS.setStrokeRGBColor: - this.setStrokeRGBColor(args[0], args[1], args[2]); - break; - case _util.OPS.setDash: - this.setDash(args[0], args[1]); - break; - case _util.OPS.setGState: - this.setGState(args[0]); - break; - case _util.OPS.fill: - this.fill(); - break; - case _util.OPS.eoFill: - this.eoFill(); - break; - case _util.OPS.stroke: - this.stroke(); - break; - case _util.OPS.fillStroke: - this.fillStroke(); - break; - case _util.OPS.eoFillStroke: - this.eoFillStroke(); - break; - case _util.OPS.clip: - this.clip('nonzero'); - break; - case _util.OPS.eoClip: - this.clip('evenodd'); - break; - case _util.OPS.paintSolidColorImageMask: - this.paintSolidColorImageMask(); - break; - case _util.OPS.paintJpegXObject: - this.paintJpegXObject(args[0], args[1], args[2]); - break; - case _util.OPS.paintImageXObject: - this.paintImageXObject(args[0]); - break; - case _util.OPS.paintInlineImageXObject: - this.paintInlineImageXObject(args[0]); - break; - case _util.OPS.paintImageMaskXObject: - this.paintImageMaskXObject(args[0]); - break; - case _util.OPS.paintFormXObjectBegin: - this.paintFormXObjectBegin(args[0], args[1]); - break; - case _util.OPS.paintFormXObjectEnd: - this.paintFormXObjectEnd(); - break; - case _util.OPS.closePath: - this.closePath(); - break; - case _util.OPS.closeStroke: - this.closeStroke(); - break; - case _util.OPS.closeFillStroke: - this.closeFillStroke(); - break; - case _util.OPS.closeEOFillStroke: - this.closeEOFillStroke(); - break; - case _util.OPS.nextLine: - this.nextLine(); - break; - case _util.OPS.transform: - this.transform(args[0], args[1], args[2], args[3], args[4], args[5]); - break; - case _util.OPS.constructPath: - this.constructPath(args[0], args[1]); - break; - case _util.OPS.endPath: - this.endPath(); - break; - case 92: - this.group(opTree[x].items); - break; - default: - (0, _util.warn)('Unimplemented operator ' + fn); - break; - } - } - }, - setWordSpacing: function SVGGraphics_setWordSpacing(wordSpacing) { - this.current.wordSpacing = wordSpacing; - }, - setCharSpacing: function SVGGraphics_setCharSpacing(charSpacing) { - this.current.charSpacing = charSpacing; - }, - nextLine: function SVGGraphics_nextLine() { - this.moveText(0, this.current.leading); - }, - setTextMatrix: function SVGGraphics_setTextMatrix(a, b, c, d, e, f) { - var current = this.current; - this.current.textMatrix = this.current.lineMatrix = [a, b, c, d, e, f]; - this.current.x = this.current.lineX = 0; - this.current.y = this.current.lineY = 0; - current.xcoords = []; - current.tspan = this.svgFactory.createElement('svg:tspan'); - current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); - current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); - current.tspan.setAttributeNS(null, 'y', pf(-current.y)); - current.txtElement = this.svgFactory.createElement('svg:text'); - current.txtElement.appendChild(current.tspan); - }, - beginText: function SVGGraphics_beginText() { - this.current.x = this.current.lineX = 0; - this.current.y = this.current.lineY = 0; - this.current.textMatrix = _util.IDENTITY_MATRIX; - this.current.lineMatrix = _util.IDENTITY_MATRIX; - this.current.tspan = this.svgFactory.createElement('svg:tspan'); - this.current.txtElement = this.svgFactory.createElement('svg:text'); - this.current.txtgrp = this.svgFactory.createElement('svg:g'); - this.current.xcoords = []; - }, - moveText: function SVGGraphics_moveText(x, y) { - var current = this.current; - this.current.x = this.current.lineX += x; - this.current.y = this.current.lineY += y; - current.xcoords = []; - current.tspan = this.svgFactory.createElement('svg:tspan'); - current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); - current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); - current.tspan.setAttributeNS(null, 'y', pf(-current.y)); - }, - showText: function SVGGraphics_showText(glyphs) { - var current = this.current; - var font = current.font; - var fontSize = current.fontSize; - if (fontSize === 0) { - return; - } - var charSpacing = current.charSpacing; - var wordSpacing = current.wordSpacing; - var fontDirection = current.fontDirection; - var textHScale = current.textHScale * fontDirection; - var glyphsLength = glyphs.length; - var vertical = font.vertical; - var widthAdvanceScale = fontSize * current.fontMatrix[0]; - var x = 0, - i; - for (i = 0; i < glyphsLength; ++i) { - var glyph = glyphs[i]; - if (glyph === null) { - x += fontDirection * wordSpacing; - continue; - } else if ((0, _util.isNum)(glyph)) { - x += -glyph * fontSize * 0.001; - continue; - } - var width = glyph.width; - var character = glyph.fontChar; - var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; - var charWidth = width * widthAdvanceScale + spacing * fontDirection; - if (!glyph.isInFont && !font.missingFile) { - x += charWidth; - continue; - } - current.xcoords.push(current.x + x * textHScale); - current.tspan.textContent += character; - x += charWidth; - } - if (vertical) { - current.y -= x * textHScale; - } else { - current.x += x * textHScale; - } - current.tspan.setAttributeNS(null, 'x', current.xcoords.map(pf).join(' ')); - current.tspan.setAttributeNS(null, 'y', pf(-current.y)); - current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); - current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); - if (current.fontStyle !== SVG_DEFAULTS.fontStyle) { - current.tspan.setAttributeNS(null, 'font-style', current.fontStyle); - } - if (current.fontWeight !== SVG_DEFAULTS.fontWeight) { - current.tspan.setAttributeNS(null, 'font-weight', current.fontWeight); - } - var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; - if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { - if (current.fillColor !== SVG_DEFAULTS.fillColor) { - current.tspan.setAttributeNS(null, 'fill', current.fillColor); - } - if (current.fillAlpha < 1) { - current.tspan.setAttributeNS(null, 'fill-opacity', current.fillAlpha); - } - } else if (current.textRenderingMode === _util.TextRenderingMode.ADD_TO_PATH) { - current.tspan.setAttributeNS(null, 'fill', 'transparent'); - } else { - current.tspan.setAttributeNS(null, 'fill', 'none'); - } - if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { - this._setStrokeAttributes(current.tspan); - } - var textMatrix = current.textMatrix; - if (current.textRise !== 0) { - textMatrix = textMatrix.slice(); - textMatrix[5] += current.textRise; - } - current.txtElement.setAttributeNS(null, 'transform', pm(textMatrix) + ' scale(1, -1)'); - current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve'); - current.txtElement.appendChild(current.tspan); - current.txtgrp.appendChild(current.txtElement); - this._ensureTransformGroup().appendChild(current.txtElement); - }, - setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) { - this.setLeading(-y); - this.moveText(x, y); - }, - addFontStyle: function SVGGraphics_addFontStyle(fontObj) { - if (!this.cssStyle) { - this.cssStyle = this.svgFactory.createElement('svg:style'); - this.cssStyle.setAttributeNS(null, 'type', 'text/css'); - this.defs.appendChild(this.cssStyle); - } - var url = (0, _util.createObjectURL)(fontObj.data, fontObj.mimetype, this.forceDataSchema); - this.cssStyle.textContent += '@font-face { font-family: "' + fontObj.loadedName + '";' + ' src: url(' + url + '); }\n'; - }, - setFont: function SVGGraphics_setFont(details) { - var current = this.current; - var fontObj = this.commonObjs.get(details[0]); - var size = details[1]; - this.current.font = fontObj; - if (this.embedFonts && fontObj.data && !this.embeddedFonts[fontObj.loadedName]) { - this.addFontStyle(fontObj); - this.embeddedFonts[fontObj.loadedName] = fontObj; - } - current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; - var bold = fontObj.black ? fontObj.bold ? 'bolder' : 'bold' : fontObj.bold ? 'bold' : 'normal'; - var italic = fontObj.italic ? 'italic' : 'normal'; - if (size < 0) { - size = -size; - current.fontDirection = -1; - } else { - current.fontDirection = 1; - } - current.fontSize = size; - current.fontFamily = fontObj.loadedName; - current.fontWeight = bold; - current.fontStyle = italic; - current.tspan = this.svgFactory.createElement('svg:tspan'); - current.tspan.setAttributeNS(null, 'y', pf(-current.y)); - current.xcoords = []; - }, - endText: function endText() { - var current = this.current; - if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement && current.txtElement.hasChildNodes()) { - current.element = current.txtElement; - this.clip('nonzero'); - this.endPath(); - } - }, +function validateResponseStatus(status) { + return status === 200 || status === 206; +} - setLineWidth: function SVGGraphics_setLineWidth(width) { - this.current.lineWidth = width; - }, - setLineCap: function SVGGraphics_setLineCap(style) { - this.current.lineCap = LINE_CAP_STYLES[style]; - }, - setLineJoin: function SVGGraphics_setLineJoin(style) { - this.current.lineJoin = LINE_JOIN_STYLES[style]; - }, - setMiterLimit: function SVGGraphics_setMiterLimit(limit) { - this.current.miterLimit = limit; - }, - setStrokeAlpha: function SVGGraphics_setStrokeAlpha(strokeAlpha) { - this.current.strokeAlpha = strokeAlpha; - }, - setStrokeRGBColor: function SVGGraphics_setStrokeRGBColor(r, g, b) { - var color = _util.Util.makeCssRgb(r, g, b); - this.current.strokeColor = color; - }, - setFillAlpha: function SVGGraphics_setFillAlpha(fillAlpha) { - this.current.fillAlpha = fillAlpha; - }, - setFillRGBColor: function SVGGraphics_setFillRGBColor(r, g, b) { - var color = _util.Util.makeCssRgb(r, g, b); - this.current.fillColor = color; - this.current.tspan = this.svgFactory.createElement('svg:tspan'); - this.current.xcoords = []; - }, - setDash: function SVGGraphics_setDash(dashArray, dashPhase) { - this.current.dashArray = dashArray; - this.current.dashPhase = dashPhase; - }, - constructPath: function SVGGraphics_constructPath(ops, args) { - var current = this.current; - var x = current.x, - y = current.y; - current.path = this.svgFactory.createElement('svg:path'); - var d = []; - var opLength = ops.length; - for (var i = 0, j = 0; i < opLength; i++) { - switch (ops[i] | 0) { - case _util.OPS.rectangle: - x = args[j++]; - y = args[j++]; - var width = args[j++]; - var height = args[j++]; - var xw = x + width; - var yh = y + height; - d.push('M', pf(x), pf(y), 'L', pf(xw), pf(y), 'L', pf(xw), pf(yh), 'L', pf(x), pf(yh), 'Z'); - break; - case _util.OPS.moveTo: - x = args[j++]; - y = args[j++]; - d.push('M', pf(x), pf(y)); - break; - case _util.OPS.lineTo: - x = args[j++]; - y = args[j++]; - d.push('L', pf(x), pf(y)); - break; - case _util.OPS.curveTo: - x = args[j + 4]; - y = args[j + 5]; - d.push('C', pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y)); - j += 6; - break; - case _util.OPS.curveTo2: - x = args[j + 2]; - y = args[j + 3]; - d.push('C', pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3])); - j += 4; - break; - case _util.OPS.curveTo3: - x = args[j + 2]; - y = args[j + 3]; - d.push('C', pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y)); - j += 4; - break; - case _util.OPS.closePath: - d.push('Z'); - break; - } - } - current.path.setAttributeNS(null, 'd', d.join(' ')); - current.path.setAttributeNS(null, 'fill', 'none'); - this._ensureTransformGroup().appendChild(current.path); - current.element = current.path; - current.setCurrentPoint(x, y); - }, - endPath: function SVGGraphics_endPath() { - if (!this.pendingClip) { - return; - } - var current = this.current; - var clipId = 'clippath' + clipCount; - clipCount++; - var clipPath = this.svgFactory.createElement('svg:clipPath'); - clipPath.setAttributeNS(null, 'id', clipId); - clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - var clipElement = current.element.cloneNode(true); - if (this.pendingClip === 'evenodd') { - clipElement.setAttributeNS(null, 'clip-rule', 'evenodd'); - } else { - clipElement.setAttributeNS(null, 'clip-rule', 'nonzero'); - } - this.pendingClip = null; - clipPath.appendChild(clipElement); - this.defs.appendChild(clipPath); - if (current.activeClipUrl) { - current.clipGroup = null; - this.extraStack.forEach(function (prev) { - prev.clipGroup = null; - }); - clipPath.setAttributeNS(null, 'clip-path', current.activeClipUrl); - } - current.activeClipUrl = 'url(#' + clipId + ')'; - this.tgrp = null; - }, - clip: function SVGGraphics_clip(type) { - this.pendingClip = type; - }, - closePath: function SVGGraphics_closePath() { - var current = this.current; - if (current.path) { - var d = current.path.getAttributeNS(null, 'd'); - d += 'Z'; - current.path.setAttributeNS(null, 'd', d); - } - }, - setLeading: function SVGGraphics_setLeading(leading) { - this.current.leading = -leading; - }, - setTextRise: function SVGGraphics_setTextRise(textRise) { - this.current.textRise = textRise; - }, - setTextRenderingMode: function setTextRenderingMode(textRenderingMode) { - this.current.textRenderingMode = textRenderingMode; - }, +/***/ }), +/* 214 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader; + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function getFilenameFromContentDispositionHeader(contentDisposition) { + var needsEncodingFixup = true; + var tmp = toParamRegExp("filename\\*", "i").exec(contentDisposition); + + if (tmp) { + tmp = tmp[1]; + var filename = rfc2616unquote(tmp); + filename = unescape(filename); + filename = rfc5987decode(filename); + filename = rfc2047decode(filename); + return fixupEncoding(filename); + } + + tmp = rfc2231getparam(contentDisposition); + + if (tmp) { + var _filename = rfc2047decode(tmp); + + return fixupEncoding(_filename); + } + + tmp = toParamRegExp("filename", "i").exec(contentDisposition); + + if (tmp) { + tmp = tmp[1]; + + var _filename2 = rfc2616unquote(tmp); - setHScale: function SVGGraphics_setHScale(scale) { - this.current.textHScale = scale / 100; - }, - setGState: function SVGGraphics_setGState(states) { - for (var i = 0, ii = states.length; i < ii; i++) { - var state = states[i]; - var key = state[0]; - var value = state[1]; - switch (key) { - case 'LW': - this.setLineWidth(value); - break; - case 'LC': - this.setLineCap(value); - break; - case 'LJ': - this.setLineJoin(value); - break; - case 'ML': - this.setMiterLimit(value); - break; - case 'D': - this.setDash(value[0], value[1]); - break; - case 'Font': - this.setFont(value); - break; - case 'CA': - this.setStrokeAlpha(value); - break; - case 'ca': - this.setFillAlpha(value); - break; - default: - (0, _util.warn)('Unimplemented graphic state ' + key); - break; - } - } - }, - fill: function SVGGraphics_fill() { - var current = this.current; - if (current.element) { - current.element.setAttributeNS(null, 'fill', current.fillColor); - current.element.setAttributeNS(null, 'fill-opacity', current.fillAlpha); - this.endPath(); - } - }, - stroke: function SVGGraphics_stroke() { - var current = this.current; - if (current.element) { - this._setStrokeAttributes(current.element); - current.element.setAttributeNS(null, 'fill', 'none'); - this.endPath(); - } - }, - _setStrokeAttributes: function _setStrokeAttributes(element) { - var current = this.current; - element.setAttributeNS(null, 'stroke', current.strokeColor); - element.setAttributeNS(null, 'stroke-opacity', current.strokeAlpha); - element.setAttributeNS(null, 'stroke-miterlimit', pf(current.miterLimit)); - element.setAttributeNS(null, 'stroke-linecap', current.lineCap); - element.setAttributeNS(null, 'stroke-linejoin', current.lineJoin); - element.setAttributeNS(null, 'stroke-width', pf(current.lineWidth) + 'px'); - element.setAttributeNS(null, 'stroke-dasharray', current.dashArray.map(pf).join(' ')); - element.setAttributeNS(null, 'stroke-dashoffset', pf(current.dashPhase) + 'px'); - }, - - eoFill: function SVGGraphics_eoFill() { - if (this.current.element) { - this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); - } - this.fill(); - }, - fillStroke: function SVGGraphics_fillStroke() { - this.stroke(); - this.fill(); - }, - eoFillStroke: function SVGGraphics_eoFillStroke() { - if (this.current.element) { - this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); - } - this.fillStroke(); - }, - closeStroke: function SVGGraphics_closeStroke() { - this.closePath(); - this.stroke(); - }, - closeFillStroke: function SVGGraphics_closeFillStroke() { - this.closePath(); - this.fillStroke(); - }, - closeEOFillStroke: function closeEOFillStroke() { - this.closePath(); - this.eoFillStroke(); - }, + _filename2 = rfc2047decode(_filename2); + return fixupEncoding(_filename2); + } - paintSolidColorImageMask: function SVGGraphics_paintSolidColorImageMask() { - var current = this.current; - var rect = this.svgFactory.createElement('svg:rect'); - rect.setAttributeNS(null, 'x', '0'); - rect.setAttributeNS(null, 'y', '0'); - rect.setAttributeNS(null, 'width', '1px'); - rect.setAttributeNS(null, 'height', '1px'); - rect.setAttributeNS(null, 'fill', current.fillColor); - this._ensureTransformGroup().appendChild(rect); - }, - paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) { - var imgObj = this.objs.get(objId); - var imgEl = this.svgFactory.createElement('svg:image'); - imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src); - imgEl.setAttributeNS(null, 'width', pf(w)); - imgEl.setAttributeNS(null, 'height', pf(h)); - imgEl.setAttributeNS(null, 'x', '0'); - imgEl.setAttributeNS(null, 'y', pf(-h)); - imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / w) + ' ' + pf(-1 / h) + ')'); - this._ensureTransformGroup().appendChild(imgEl); - }, - paintImageXObject: function SVGGraphics_paintImageXObject(objId) { - var imgData = this.objs.get(objId); - if (!imgData) { - (0, _util.warn)('Dependent image isn\'t ready yet'); - return; - } - this.paintInlineImageXObject(imgData); - }, - paintInlineImageXObject: function SVGGraphics_paintInlineImageXObject(imgData, mask) { - var width = imgData.width; - var height = imgData.height; - var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask); - var cliprect = this.svgFactory.createElement('svg:rect'); - cliprect.setAttributeNS(null, 'x', '0'); - cliprect.setAttributeNS(null, 'y', '0'); - cliprect.setAttributeNS(null, 'width', pf(width)); - cliprect.setAttributeNS(null, 'height', pf(height)); - this.current.element = cliprect; - this.clip('nonzero'); - var imgEl = this.svgFactory.createElement('svg:image'); - imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc); - imgEl.setAttributeNS(null, 'x', '0'); - imgEl.setAttributeNS(null, 'y', pf(-height)); - imgEl.setAttributeNS(null, 'width', pf(width) + 'px'); - imgEl.setAttributeNS(null, 'height', pf(height) + 'px'); - imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / width) + ' ' + pf(-1 / height) + ')'); - if (mask) { - mask.appendChild(imgEl); - } else { - this._ensureTransformGroup().appendChild(imgEl); + function toParamRegExp(attributePattern, flags) { + return new RegExp("(?:^|;)\\s*" + attributePattern + "\\s*=\\s*" + "(" + '[^";\\s][^;\\s]*' + "|" + '"(?:[^"\\\\]|\\\\"?)+"?' + ")", flags); + } + + function textdecode(encoding, value) { + if (encoding) { + if (!/^[\x00-\xFF]+$/.test(value)) { + return value; + } + + try { + var decoder = new TextDecoder(encoding, { + fatal: true + }); + var bytes = Array.from(value, function (ch) { + return ch.charCodeAt(0) & 0xff; + }); + value = decoder.decode(new Uint8Array(bytes)); + needsEncodingFixup = false; + } catch (e) { + if (/^utf-?8$/i.test(encoding)) { + try { + value = decodeURIComponent(escape(value)); + needsEncodingFixup = false; + } catch (err) {} } - }, - paintImageMaskXObject: function SVGGraphics_paintImageMaskXObject(imgData) { - var current = this.current; - var width = imgData.width; - var height = imgData.height; - var fillColor = current.fillColor; - current.maskId = 'mask' + maskCount++; - var mask = this.svgFactory.createElement('svg:mask'); - mask.setAttributeNS(null, 'id', current.maskId); - var rect = this.svgFactory.createElement('svg:rect'); - rect.setAttributeNS(null, 'x', '0'); - rect.setAttributeNS(null, 'y', '0'); - rect.setAttributeNS(null, 'width', pf(width)); - rect.setAttributeNS(null, 'height', pf(height)); - rect.setAttributeNS(null, 'fill', fillColor); - rect.setAttributeNS(null, 'mask', 'url(#' + current.maskId + ')'); - this.defs.appendChild(mask); - this._ensureTransformGroup().appendChild(rect); - this.paintInlineImageXObject(imgData, mask); - }, - paintFormXObjectBegin: function SVGGraphics_paintFormXObjectBegin(matrix, bbox) { - if (Array.isArray(matrix) && matrix.length === 6) { - this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); + } + } + + return value; + } + + function fixupEncoding(value) { + if (needsEncodingFixup && /[\x80-\xff]/.test(value)) { + value = textdecode("utf-8", value); + + if (needsEncodingFixup) { + value = textdecode("iso-8859-1", value); + } + } + + return value; + } + + function rfc2231getparam(contentDispositionStr) { + var matches = []; + var match; + var iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig"); + + while ((match = iter.exec(contentDispositionStr)) !== null) { + var _match = match, + _match2 = _slicedToArray(_match, 4), + n = _match2[1], + quot = _match2[2], + part = _match2[3]; + + n = parseInt(n, 10); + + if (n in matches) { + if (n === 0) { + break; } - if (Array.isArray(bbox) && bbox.length === 4) { - var width = bbox[2] - bbox[0]; - var height = bbox[3] - bbox[1]; - var cliprect = this.svgFactory.createElement('svg:rect'); - cliprect.setAttributeNS(null, 'x', bbox[0]); - cliprect.setAttributeNS(null, 'y', bbox[1]); - cliprect.setAttributeNS(null, 'width', pf(width)); - cliprect.setAttributeNS(null, 'height', pf(height)); - this.current.element = cliprect; - this.clip('nonzero'); - this.endPath(); + + continue; + } + + matches[n] = [quot, part]; + } + + var parts = []; + + for (var _n2 = 0; _n2 < matches.length; ++_n2) { + if (!(_n2 in matches)) { + break; + } + + var _matches$_n = _slicedToArray(matches[_n2], 2), + _quot = _matches$_n[0], + _part = _matches$_n[1]; + + _part = rfc2616unquote(_part); + + if (_quot) { + _part = unescape(_part); + + if (_n2 === 0) { + _part = rfc5987decode(_part); } - }, - paintFormXObjectEnd: function SVGGraphics_paintFormXObjectEnd() {}, - _initialize: function _initialize(viewport) { - var svg = this.svgFactory.create(viewport.width, viewport.height); - var definitions = this.svgFactory.createElement('svg:defs'); - svg.appendChild(definitions); - this.defs = definitions; - var rootGroup = this.svgFactory.createElement('svg:g'); - rootGroup.setAttributeNS(null, 'transform', pm(viewport.transform)); - svg.appendChild(rootGroup); - this.svg = rootGroup; - return svg; - }, + } - _ensureClipGroup: function SVGGraphics_ensureClipGroup() { - if (!this.current.clipGroup) { - var clipGroup = this.svgFactory.createElement('svg:g'); - clipGroup.setAttributeNS(null, 'clip-path', this.current.activeClipUrl); - this.svg.appendChild(clipGroup); - this.current.clipGroup = clipGroup; + parts.push(_part); + } + + return parts.join(""); + } + + function rfc2616unquote(value) { + if (value.startsWith('"')) { + var parts = value.slice(1).split('\\"'); + + for (var i = 0; i < parts.length; ++i) { + var quotindex = parts[i].indexOf('"'); + + if (quotindex !== -1) { + parts[i] = parts[i].slice(0, quotindex); + parts.length = i + 1; } - return this.current.clipGroup; - }, - _ensureTransformGroup: function SVGGraphics_ensureTransformGroup() { - if (!this.tgrp) { - this.tgrp = this.svgFactory.createElement('svg:g'); - this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - if (this.current.activeClipUrl) { - this._ensureClipGroup().appendChild(this.tgrp); - } else { - this.svg.appendChild(this.tgrp); - } + + parts[i] = parts[i].replace(/\\(.)/g, "$1"); + } + + value = parts.join('"'); + } + + return value; + } + + function rfc5987decode(extvalue) { + var encodingend = extvalue.indexOf("'"); + + if (encodingend === -1) { + return extvalue; + } + + var encoding = extvalue.slice(0, encodingend); + var langvalue = extvalue.slice(encodingend + 1); + var value = langvalue.replace(/^[^']*'/, ""); + return textdecode(encoding, value); + } + + function rfc2047decode(value) { + if (!value.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(value)) { + return value; + } + + return value.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (matches, charset, encoding, text) { + if (encoding === "q" || encoding === "Q") { + text = text.replace(/_/g, " "); + text = text.replace(/=([0-9a-fA-F]{2})/g, function (match, hex) { + return String.fromCharCode(parseInt(hex, 16)); + }); + return textdecode(charset, text); + } + + try { + text = atob(text); + } catch (e) {} + + return textdecode(charset, text); + }); + } + + return ""; +} + +/***/ }), +/* 215 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFNetworkStream = void 0; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); + +var _util = __w_pdfjs_require__(5); + +var _network_utils = __w_pdfjs_require__(213); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +; +var OK_RESPONSE = 200; +var PARTIAL_CONTENT_RESPONSE = 206; + +function getArrayBuffer(xhr) { + var data = xhr.response; + + if (typeof data !== "string") { + return data; + } + + var array = (0, _util.stringToBytes)(data); + return array.buffer; +} + +var NetworkManager = /*#__PURE__*/function () { + function NetworkManager(url, args) { + _classCallCheck(this, NetworkManager); + + this.url = url; + args = args || {}; + this.isHttp = /^https?:/i.test(url); + this.httpHeaders = this.isHttp && args.httpHeaders || {}; + this.withCredentials = args.withCredentials || false; + + this.getXhr = args.getXhr || function NetworkManager_getXhr() { + return new XMLHttpRequest(); + }; + + this.currXhrId = 0; + this.pendingRequests = Object.create(null); + } + + _createClass(NetworkManager, [{ + key: "requestRange", + value: function requestRange(begin, end, listeners) { + var args = { + begin: begin, + end: end + }; + + for (var prop in listeners) { + args[prop] = listeners[prop]; + } + + return this.request(args); + } + }, { + key: "requestFull", + value: function requestFull(listeners) { + return this.request(listeners); + } + }, { + key: "request", + value: function request(args) { + var xhr = this.getXhr(); + var xhrId = this.currXhrId++; + var pendingRequest = this.pendingRequests[xhrId] = { + xhr: xhr + }; + xhr.open("GET", this.url); + xhr.withCredentials = this.withCredentials; + + for (var property in this.httpHeaders) { + var value = this.httpHeaders[property]; + + if (typeof value === "undefined") { + continue; } - return this.tgrp; + + xhr.setRequestHeader(property, value); } - }; - return SVGGraphics; - }(); -} -exports.SVGGraphics = SVGGraphics; -/***/ }), -/* 148 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + if (this.isHttp && "begin" in args && "end" in args) { + xhr.setRequestHeader("Range", "bytes=".concat(args.begin, "-").concat(args.end - 1)); + pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE; + } else { + pendingRequest.expectedStatus = OK_RESPONSE; + } -"use strict"; + xhr.responseType = "arraybuffer"; + if (args.onError) { + xhr.onerror = function (evt) { + args.onError(xhr.status); + }; + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.PDFNodeStream = undefined; + xhr.onreadystatechange = this.onStateChange.bind(this, xhrId); + xhr.onprogress = this.onProgress.bind(this, xhrId); + pendingRequest.onHeadersReceived = args.onHeadersReceived; + pendingRequest.onDone = args.onDone; + pendingRequest.onError = args.onError; + pendingRequest.onProgress = args.onProgress; + xhr.send(null); + return xhrId; + } + }, { + key: "onProgress", + value: function onProgress(xhrId, evt) { + var pendingRequest = this.pendingRequests[xhrId]; + + if (!pendingRequest) { + return; + } -var _regenerator = __w_pdfjs_require__(137); + if (pendingRequest.onProgress) { + pendingRequest.onProgress(evt); + } + } + }, { + key: "onStateChange", + value: function onStateChange(xhrId, evt) { + var pendingRequest = this.pendingRequests[xhrId]; -var _regenerator2 = _interopRequireDefault(_regenerator); + if (!pendingRequest) { + return; + } -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + var xhr = pendingRequest.xhr; -var _util = __w_pdfjs_require__(1); + if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) { + pendingRequest.onHeadersReceived(); + delete pendingRequest.onHeadersReceived; + } -var _network_utils = __w_pdfjs_require__(149); + if (xhr.readyState !== 4) { + return; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (!(xhrId in this.pendingRequests)) { + return; + } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + delete this.pendingRequests[xhrId]; -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + if (xhr.status === 0 && this.isHttp) { + if (pendingRequest.onError) { + pendingRequest.onError(xhr.status); + } -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + return; + } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + var xhrStatus = xhr.status || OK_RESPONSE; + var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE; -var fs = require('fs'); -var http = require('http'); -var https = require('https'); -var url = require('url'); + if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) { + if (pendingRequest.onError) { + pendingRequest.onError(xhr.status); + } -var fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//; -function parseUrl(sourceUrl) { - var parsedUrl = url.parse(sourceUrl); - if (parsedUrl.protocol === 'file:' || parsedUrl.host) { - return parsedUrl; - } - if (/^[a-z]:[/\\]/i.test(sourceUrl)) { - return url.parse('file:///' + sourceUrl); - } - if (!parsedUrl.host) { - parsedUrl.protocol = 'file:'; - } - return parsedUrl; -} + return; + } -var PDFNodeStream = function () { - function PDFNodeStream(source) { - _classCallCheck(this, PDFNodeStream); + var chunk = getArrayBuffer(xhr); - this.source = source; - this.url = parseUrl(source.url); - this.isHttp = this.url.protocol === 'http:' || this.url.protocol === 'https:'; - this.isFsUrl = this.url.protocol === 'file:'; - this.httpHeaders = this.isHttp && source.httpHeaders || {}; - this._fullRequest = null; + if (xhrStatus === PARTIAL_CONTENT_RESPONSE) { + var rangeHeader = xhr.getResponseHeader("Content-Range"); + var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader); + pendingRequest.onDone({ + begin: parseInt(matches[1], 10), + chunk: chunk + }); + } else if (chunk) { + pendingRequest.onDone({ + begin: 0, + chunk: chunk + }); + } else if (pendingRequest.onError) { + pendingRequest.onError(xhr.status); + } + } + }, { + key: "hasPendingRequests", + value: function hasPendingRequests() { + for (var xhrId in this.pendingRequests) { + return true; + } + + return false; + } + }, { + key: "getRequestXhr", + value: function getRequestXhr(xhrId) { + return this.pendingRequests[xhrId].xhr; + } + }, { + key: "isPendingRequest", + value: function isPendingRequest(xhrId) { + return xhrId in this.pendingRequests; + } + }, { + key: "abortAllRequests", + value: function abortAllRequests() { + for (var xhrId in this.pendingRequests) { + this.abortRequest(xhrId | 0); + } + } + }, { + key: "abortRequest", + value: function abortRequest(xhrId) { + var xhr = this.pendingRequests[xhrId].xhr; + delete this.pendingRequests[xhrId]; + xhr.abort(); + } + }]); + + return NetworkManager; +}(); + +var PDFNetworkStream = /*#__PURE__*/function () { + function PDFNetworkStream(source) { + _classCallCheck(this, PDFNetworkStream); + + this._source = source; + this._manager = new NetworkManager(source.url, { + httpHeaders: source.httpHeaders, + withCredentials: source.withCredentials + }); + this._rangeChunkSize = source.rangeChunkSize; + this._fullRequestReader = null; this._rangeRequestReaders = []; } - _createClass(PDFNodeStream, [{ - key: 'getFullReader', + _createClass(PDFNetworkStream, [{ + key: "_onRangeRequestReaderClosed", + value: function _onRangeRequestReaderClosed(reader) { + var i = this._rangeRequestReaders.indexOf(reader); + + if (i >= 0) { + this._rangeRequestReaders.splice(i, 1); + } + } + }, { + key: "getFullReader", value: function getFullReader() { - (0, _util.assert)(!this._fullRequest); - this._fullRequest = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this); - return this._fullRequest; + (0, _util.assert)(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."); + this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source); + return this._fullRequestReader; } }, { - key: 'getRangeReader', - value: function getRangeReader(start, end) { - var rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end); - this._rangeRequestReaders.push(rangeReader); - return rangeReader; + key: "getRangeReader", + value: function getRangeReader(begin, end) { + var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end); + reader.onClosed = this._onRangeRequestReaderClosed.bind(this); + + this._rangeRequestReaders.push(reader); + + return reader; } }, { - key: 'cancelAllRequests', + key: "cancelAllRequests", value: function cancelAllRequests(reason) { - if (this._fullRequest) { - this._fullRequest.cancel(reason); + if (this._fullRequestReader) { + this._fullRequestReader.cancel(reason); } + var readers = this._rangeRequestReaders.slice(0); + readers.forEach(function (reader) { reader.cancel(reason); }); } }]); - return PDFNodeStream; + return PDFNetworkStream; }(); -var BaseFullReader = function () { - function BaseFullReader(stream) { - _classCallCheck(this, BaseFullReader); +exports.PDFNetworkStream = PDFNetworkStream; - this._url = stream.url; - this._done = false; - this._storedError = null; - this.onProgress = null; - var source = stream.source; - this._contentLength = source.length; - this._loaded = 0; - this._filename = null; +var PDFNetworkStreamFullRequestReader = /*#__PURE__*/function () { + function PDFNetworkStreamFullRequestReader(manager, source) { + _classCallCheck(this, PDFNetworkStreamFullRequestReader); + + this._manager = manager; + var args = { + onHeadersReceived: this._onHeadersReceived.bind(this), + onDone: this._onDone.bind(this), + onError: this._onError.bind(this), + onProgress: this._onProgress.bind(this) + }; + this._url = source.url; + this._fullRequestId = manager.requestFull(args); + this._headersReceivedCapability = (0, _util.createPromiseCapability)(); this._disableRange = source.disableRange || false; + this._contentLength = source.length; this._rangeChunkSize = source.rangeChunkSize; + if (!this._rangeChunkSize && !this._disableRange) { this._disableRange = true; } - this._isStreamingSupported = !source.disableStream; - this._isRangeSupported = !source.disableRange; - this._readableStream = null; - this._readCapability = (0, _util.createPromiseCapability)(); - this._headersCapability = (0, _util.createPromiseCapability)(); - } - - _createClass(BaseFullReader, [{ - key: 'read', - value: function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { - var chunk, buffer; - return _regenerator2.default.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _context.next = 2; - return this._readCapability.promise; - case 2: - if (!this._done) { - _context.next = 4; - break; - } + this._isStreamingSupported = false; + this._isRangeSupported = false; + this._cachedChunks = []; + this._requests = []; + this._done = false; + this._storedError = undefined; + this._filename = null; + this.onProgress = null; + } - return _context.abrupt('return', { - value: undefined, - done: true - }); + _createClass(PDFNetworkStreamFullRequestReader, [{ + key: "_onHeadersReceived", + value: function _onHeadersReceived() { + var fullRequestXhrId = this._fullRequestId; - case 4: - if (!this._storedError) { - _context.next = 6; - break; - } + var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId); - throw this._storedError; + var getResponseHeader = function getResponseHeader(name) { + return fullRequestXhr.getResponseHeader(name); + }; - case 6: - chunk = this._readableStream.read(); + var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({ + getResponseHeader: getResponseHeader, + isHttp: this._manager.isHttp, + rangeChunkSize: this._rangeChunkSize, + disableRange: this._disableRange + }), + allowRangeRequests = _validateRangeRequest.allowRangeRequests, + suggestedLength = _validateRangeRequest.suggestedLength; - if (!(chunk === null)) { - _context.next = 10; - break; - } + if (allowRangeRequests) { + this._isRangeSupported = true; + } - this._readCapability = (0, _util.createPromiseCapability)(); - return _context.abrupt('return', this.read()); + this._contentLength = suggestedLength || this._contentLength; + this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); - case 10: - this._loaded += chunk.length; - if (this.onProgress) { - this.onProgress({ - loaded: this._loaded, - total: this._contentLength - }); - } - buffer = new Uint8Array(chunk).buffer; - return _context.abrupt('return', { - value: buffer, - done: false - }); + if (this._isRangeSupported) { + this._manager.abortRequest(fullRequestXhrId); + } - case 14: - case 'end': - return _context.stop(); - } - } - }, _callee, this); - })); + this._headersReceivedCapability.resolve(); + } + }, { + key: "_onDone", + value: function _onDone(args) { + if (args) { + if (this._requests.length > 0) { + var requestCapability = this._requests.shift(); - function read() { - return _ref.apply(this, arguments); + requestCapability.resolve({ + value: args.chunk, + done: false + }); + } else { + this._cachedChunks.push(args.chunk); + } } - return read; - }() - }, { - key: 'cancel', - value: function cancel(reason) { - if (!this._readableStream) { - this._error(reason); + this._done = true; + + if (this._cachedChunks.length > 0) { return; } - this._readableStream.destroy(reason); - } - }, { - key: '_error', - value: function _error(reason) { - this._storedError = reason; - this._readCapability.resolve(); - } - }, { - key: '_setReadableStream', - value: function _setReadableStream(readableStream) { - var _this = this; - this._readableStream = readableStream; - readableStream.on('readable', function () { - _this._readCapability.resolve(); - }); - readableStream.on('end', function () { - readableStream.destroy(); - _this._done = true; - _this._readCapability.resolve(); - }); - readableStream.on('error', function (reason) { - _this._error(reason); + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); }); - if (!this._isStreamingSupported && this._isRangeSupported) { - this._error(new _util.AbortException('streaming is disabled')); - } - if (this._storedError) { - this._readableStream.destroy(this._storedError); - } - } - }, { - key: 'headersReady', - get: function get() { - return this._headersCapability.promise; - } - }, { - key: 'filename', - get: function get() { - return this._filename; - } - }, { - key: 'contentLength', - get: function get() { - return this._contentLength; - } - }, { - key: 'isRangeSupported', - get: function get() { - return this._isRangeSupported; + + this._requests = []; } }, { - key: 'isStreamingSupported', - get: function get() { - return this._isStreamingSupported; - } - }]); + key: "_onError", + value: function _onError(status) { + var url = this._url; + var exception = (0, _network_utils.createResponseStatusError)(status, url); + this._storedError = exception; - return BaseFullReader; -}(); - -var BaseRangeReader = function () { - function BaseRangeReader(stream) { - _classCallCheck(this, BaseRangeReader); + this._headersReceivedCapability.reject(exception); - this._url = stream.url; - this._done = false; - this._storedError = null; - this.onProgress = null; - this._loaded = 0; - this._readableStream = null; - this._readCapability = (0, _util.createPromiseCapability)(); - var source = stream.source; - this._isStreamingSupported = !source.disableStream; - } + this._requests.forEach(function (requestCapability) { + requestCapability.reject(exception); + }); - _createClass(BaseRangeReader, [{ - key: 'read', + this._requests = []; + this._cachedChunks = []; + } + }, { + key: "_onProgress", + value: function _onProgress(data) { + if (this.onProgress) { + this.onProgress({ + loaded: data.loaded, + total: data.lengthComputable ? data.total : this._contentLength + }); + } + } + }, { + key: "read", value: function () { - var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() { - var chunk, buffer; - return _regenerator2.default.wrap(function _callee2$(_context2) { + var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() { + var chunk, requestCapability; + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { - switch (_context2.prev = _context2.next) { + switch (_context.prev = _context.next) { case 0: - _context2.next = 2; - return this._readCapability.promise; + if (!this._storedError) { + _context.next = 2; + break; + } + + throw this._storedError; case 2: - if (!this._done) { - _context2.next = 4; + if (!(this._cachedChunks.length > 0)) { + _context.next = 5; break; } - return _context2.abrupt('return', { - value: undefined, - done: true + chunk = this._cachedChunks.shift(); + return _context.abrupt("return", { + value: chunk, + done: false }); - case 4: - if (!this._storedError) { - _context2.next = 6; + case 5: + if (!this._done) { + _context.next = 7; break; } - throw this._storedError; + return _context.abrupt("return", { + value: undefined, + done: true + }); - case 6: - chunk = this._readableStream.read(); + case 7: + requestCapability = (0, _util.createPromiseCapability)(); - if (!(chunk === null)) { - _context2.next = 10; - break; - } + this._requests.push(requestCapability); - this._readCapability = (0, _util.createPromiseCapability)(); - return _context2.abrupt('return', this.read()); + return _context.abrupt("return", requestCapability.promise); case 10: - this._loaded += chunk.length; - if (this.onProgress) { - this.onProgress({ loaded: this._loaded }); - } - buffer = new Uint8Array(chunk).buffer; - return _context2.abrupt('return', { - value: buffer, - done: false - }); - - case 14: - case 'end': - return _context2.stop(); + case "end": + return _context.stop(); } } - }, _callee2, this); + }, _callee, this); })); function read() { - return _ref2.apply(this, arguments); + return _read.apply(this, arguments); } return read; }() }, { - key: 'cancel', + key: "cancel", value: function cancel(reason) { - if (!this._readableStream) { - this._error(reason); - return; + this._done = true; + + this._headersReceivedCapability.reject(reason); + + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); + }); + + this._requests = []; + + if (this._manager.isPendingRequest(this._fullRequestId)) { + this._manager.abortRequest(this._fullRequestId); } - this._readableStream.destroy(reason); + + this._fullRequestReader = null; } }, { - key: '_error', - value: function _error(reason) { - this._storedError = reason; - this._readCapability.resolve(); + key: "filename", + get: function get() { + return this._filename; } }, { - key: '_setReadableStream', - value: function _setReadableStream(readableStream) { - var _this2 = this; - - this._readableStream = readableStream; - readableStream.on('readable', function () { - _this2._readCapability.resolve(); - }); - readableStream.on('end', function () { - readableStream.destroy(); - _this2._done = true; - _this2._readCapability.resolve(); - }); - readableStream.on('error', function (reason) { - _this2._error(reason); - }); - if (this._storedError) { - this._readableStream.destroy(this._storedError); - } + key: "isRangeSupported", + get: function get() { + return this._isRangeSupported; } }, { - key: 'isStreamingSupported', + key: "isStreamingSupported", get: function get() { return this._isStreamingSupported; } + }, { + key: "contentLength", + get: function get() { + return this._contentLength; + } + }, { + key: "headersReady", + get: function get() { + return this._headersReceivedCapability.promise; + } }]); - return BaseRangeReader; + return PDFNetworkStreamFullRequestReader; }(); -function createRequestOptions(url, headers) { - return { - protocol: url.protocol, - auth: url.auth, - host: url.hostname, - port: url.port, - path: url.path, - method: 'GET', - headers: headers - }; -} - -var PDFNodeStreamFullReader = function (_BaseFullReader) { - _inherits(PDFNodeStreamFullReader, _BaseFullReader); - - function PDFNodeStreamFullReader(stream) { - _classCallCheck(this, PDFNodeStreamFullReader); - - var _this3 = _possibleConstructorReturn(this, (PDFNodeStreamFullReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamFullReader)).call(this, stream)); - - var handleResponse = function handleResponse(response) { - if (response.statusCode === 404) { - var error = new _util.MissingPDFException('Missing PDF "' + _this3._url + '".'); - _this3._storedError = error; - _this3._headersCapability.reject(error); - return; - } - _this3._headersCapability.resolve(); - _this3._setReadableStream(response); - var getResponseHeader = function getResponseHeader(name) { - return _this3._readableStream.headers[name.toLowerCase()]; - }; - - var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({ - getResponseHeader: getResponseHeader, - isHttp: stream.isHttp, - rangeChunkSize: _this3._rangeChunkSize, - disableRange: _this3._disableRange - }), - allowRangeRequests = _validateRangeRequest.allowRangeRequests, - suggestedLength = _validateRangeRequest.suggestedLength; - - _this3._isRangeSupported = allowRangeRequests; - _this3._contentLength = suggestedLength || _this3._contentLength; - _this3._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); - }; - _this3._request = null; - if (_this3._url.protocol === 'http:') { - _this3._request = http.request(createRequestOptions(_this3._url, stream.httpHeaders), handleResponse); - } else { - _this3._request = https.request(createRequestOptions(_this3._url, stream.httpHeaders), handleResponse); - } - _this3._request.on('error', function (reason) { - _this3._storedError = reason; - _this3._headersCapability.reject(reason); - }); - _this3._request.end(); - return _this3; - } - - return PDFNodeStreamFullReader; -}(BaseFullReader); - -var PDFNodeStreamRangeReader = function (_BaseRangeReader) { - _inherits(PDFNodeStreamRangeReader, _BaseRangeReader); - - function PDFNodeStreamRangeReader(stream, start, end) { - _classCallCheck(this, PDFNodeStreamRangeReader); +var PDFNetworkStreamRangeRequestReader = /*#__PURE__*/function () { + function PDFNetworkStreamRangeRequestReader(manager, begin, end) { + _classCallCheck(this, PDFNetworkStreamRangeRequestReader); - var _this4 = _possibleConstructorReturn(this, (PDFNodeStreamRangeReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamRangeReader)).call(this, stream)); - - _this4._httpHeaders = {}; - for (var property in stream.httpHeaders) { - var value = stream.httpHeaders[property]; - if (typeof value === 'undefined') { - continue; - } - _this4._httpHeaders[property] = value; - } - _this4._httpHeaders['Range'] = 'bytes=' + start + '-' + (end - 1); - var handleResponse = function handleResponse(response) { - if (response.statusCode === 404) { - var error = new _util.MissingPDFException('Missing PDF "' + _this4._url + '".'); - _this4._storedError = error; - return; - } - _this4._setReadableStream(response); + this._manager = manager; + var args = { + onDone: this._onDone.bind(this), + onProgress: this._onProgress.bind(this) }; - _this4._request = null; - if (_this4._url.protocol === 'http:') { - _this4._request = http.request(createRequestOptions(_this4._url, _this4._httpHeaders), handleResponse); - } else { - _this4._request = https.request(createRequestOptions(_this4._url, _this4._httpHeaders), handleResponse); - } - _this4._request.on('error', function (reason) { - _this4._storedError = reason; - }); - _this4._request.end(); - return _this4; - } - - return PDFNodeStreamRangeReader; -}(BaseRangeReader); - -var PDFNodeStreamFsFullReader = function (_BaseFullReader2) { - _inherits(PDFNodeStreamFsFullReader, _BaseFullReader2); - - function PDFNodeStreamFsFullReader(stream) { - _classCallCheck(this, PDFNodeStreamFsFullReader); - - var _this5 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader)).call(this, stream)); - - var path = decodeURIComponent(_this5._url.path); - if (fileUriRegex.test(_this5._url.href)) { - path = path.replace(/^\//, ''); - } - fs.lstat(path, function (error, stat) { - if (error) { - if (error.code === 'ENOENT') { - error = new _util.MissingPDFException('Missing PDF "' + path + '".'); - } - _this5._storedError = error; - _this5._headersCapability.reject(error); - return; - } - _this5._contentLength = stat.size; - _this5._setReadableStream(fs.createReadStream(path)); - _this5._headersCapability.resolve(); - }); - return _this5; - } - - return PDFNodeStreamFsFullReader; -}(BaseFullReader); - -var PDFNodeStreamFsRangeReader = function (_BaseRangeReader2) { - _inherits(PDFNodeStreamFsRangeReader, _BaseRangeReader2); - - function PDFNodeStreamFsRangeReader(stream, start, end) { - _classCallCheck(this, PDFNodeStreamFsRangeReader); - - var _this6 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader)).call(this, stream)); - - var path = decodeURIComponent(_this6._url.path); - if (fileUriRegex.test(_this6._url.href)) { - path = path.replace(/^\//, ''); - } - _this6._setReadableStream(fs.createReadStream(path, { - start: start, - end: end - 1 - })); - return _this6; + this._requestId = manager.requestRange(begin, end, args); + this._requests = []; + this._queuedChunk = null; + this._done = false; + this.onProgress = null; + this.onClosed = null; } - return PDFNodeStreamFsRangeReader; -}(BaseRangeReader); - -exports.PDFNodeStream = PDFNodeStream; + _createClass(PDFNetworkStreamRangeRequestReader, [{ + key: "_close", + value: function _close() { + if (this.onClosed) { + this.onClosed(this); + } + } + }, { + key: "_onDone", + value: function _onDone(data) { + var chunk = data.chunk; -/***/ }), -/* 149 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + if (this._requests.length > 0) { + var requestCapability = this._requests.shift(); -"use strict"; + requestCapability.resolve({ + value: chunk, + done: false + }); + } else { + this._queuedChunk = chunk; + } + this._done = true; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.validateResponseStatus = exports.validateRangeRequestCapabilities = exports.extractFilenameFromHeader = exports.createResponseStatusError = undefined; + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); + }); -var _util = __w_pdfjs_require__(1); + this._requests = []; -var _content_disposition = __w_pdfjs_require__(150); + this._close(); + } + }, { + key: "_onProgress", + value: function _onProgress(evt) { + if (!this.isStreamingSupported && this.onProgress) { + this.onProgress({ + loaded: evt.loaded + }); + } + } + }, { + key: "read", + value: function () { + var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() { + var chunk, requestCapability; + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (!(this._queuedChunk !== null)) { + _context2.next = 4; + break; + } -function validateRangeRequestCapabilities(_ref) { - var getResponseHeader = _ref.getResponseHeader, - isHttp = _ref.isHttp, - rangeChunkSize = _ref.rangeChunkSize, - disableRange = _ref.disableRange; + chunk = this._queuedChunk; + this._queuedChunk = null; + return _context2.abrupt("return", { + value: chunk, + done: false + }); - (0, _util.assert)(rangeChunkSize > 0, 'Range chunk size must be larger than zero'); - var returnValues = { - allowRangeRequests: false, - suggestedLength: undefined - }; - var length = parseInt(getResponseHeader('Content-Length'), 10); - if (!Number.isInteger(length)) { - return returnValues; - } - returnValues.suggestedLength = length; - if (length <= 2 * rangeChunkSize) { - return returnValues; - } - if (disableRange || !isHttp) { - return returnValues; - } - if (getResponseHeader('Accept-Ranges') !== 'bytes') { - return returnValues; - } - var contentEncoding = getResponseHeader('Content-Encoding') || 'identity'; - if (contentEncoding !== 'identity') { - return returnValues; - } - returnValues.allowRangeRequests = true; - return returnValues; -} -function extractFilenameFromHeader(getResponseHeader) { - var contentDisposition = getResponseHeader('Content-Disposition'); - if (contentDisposition) { - var filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition); - if (/\.pdf$/i.test(filename)) { - return filename; - } - } - return null; -} -function createResponseStatusError(status, url) { - if (status === 404 || status === 0 && /^file:/.test(url)) { - return new _util.MissingPDFException('Missing PDF "' + url + '".'); - } - return new _util.UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status); -} -function validateResponseStatus(status) { - return status === 200 || status === 206; -} -exports.createResponseStatusError = createResponseStatusError; -exports.extractFilenameFromHeader = extractFilenameFromHeader; -exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities; -exports.validateResponseStatus = validateResponseStatus; + case 4: + if (!this._done) { + _context2.next = 6; + break; + } -/***/ }), -/* 150 */ -/***/ (function(module, exports, __w_pdfjs_require__) { + return _context2.abrupt("return", { + value: undefined, + done: true + }); -"use strict"; + case 6: + requestCapability = (0, _util.createPromiseCapability)(); + this._requests.push(requestCapability); -Object.defineProperty(exports, "__esModule", { - value: true -}); + return _context2.abrupt("return", requestCapability.promise); -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + case 9: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); -function getFilenameFromContentDispositionHeader(contentDisposition) { - var needsEncodingFixup = true; - var tmp = toParamRegExp('filename\\*', 'i').exec(contentDisposition); - if (tmp) { - tmp = tmp[1]; - var filename = rfc2616unquote(tmp); - filename = unescape(filename); - filename = rfc5987decode(filename); - filename = rfc2047decode(filename); - return fixupEncoding(filename); - } - tmp = rfc2231getparam(contentDisposition); - if (tmp) { - var _filename = rfc2047decode(tmp); - return fixupEncoding(_filename); - } - tmp = toParamRegExp('filename', 'i').exec(contentDisposition); - if (tmp) { - tmp = tmp[1]; - var _filename2 = rfc2616unquote(tmp); - _filename2 = rfc2047decode(_filename2); - return fixupEncoding(_filename2); - } - function toParamRegExp(attributePattern, flags) { - return new RegExp('(?:^|;)\\s*' + attributePattern + '\\s*=\\s*' + '(' + '[^";\\s][^;\\s]*' + '|' + '"(?:[^"\\\\]|\\\\"?)+"?' + ')', flags); - } - function textdecode(encoding, value) { - if (encoding) { - if (!/^[\x00-\xFF]+$/.test(value)) { - return value; - } - try { - var decoder = new TextDecoder(encoding, { fatal: true }); - var bytes = new Array(value.length); - for (var i = 0; i < value.length; ++i) { - bytes[i] = value.charCodeAt(i); - } - value = decoder.decode(new Uint8Array(bytes)); - needsEncodingFixup = false; - } catch (e) { - if (/^utf-?8$/i.test(encoding)) { - try { - value = decodeURIComponent(escape(value)); - needsEncodingFixup = false; - } catch (err) {} - } - } - } - return value; - } - function fixupEncoding(value) { - if (needsEncodingFixup && /[\x80-\xff]/.test(value)) { - value = textdecode('utf-8', value); - if (needsEncodingFixup) { - value = textdecode('iso-8859-1', value); + function read() { + return _read2.apply(this, arguments); } - } - return value; - } - function rfc2231getparam(contentDisposition) { - var matches = [], - match = void 0; - var iter = toParamRegExp('filename\\*((?!0\\d)\\d+)(\\*?)', 'ig'); - while ((match = iter.exec(contentDisposition)) !== null) { - var _match = match, - _match2 = _slicedToArray(_match, 4), - n = _match2[1], - quot = _match2[2], - part = _match2[3]; - n = parseInt(n, 10); - if (n in matches) { - if (n === 0) { - break; - } - continue; - } - matches[n] = [quot, part]; - } - var parts = []; - for (var _n = 0; _n < matches.length; ++_n) { - if (!(_n in matches)) { - break; - } + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + this._done = true; - var _matches$_n = _slicedToArray(matches[_n], 2), - _quot = _matches$_n[0], - _part = _matches$_n[1]; + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); + }); - _part = rfc2616unquote(_part); - if (_quot) { - _part = unescape(_part); - if (_n === 0) { - _part = rfc5987decode(_part); - } - } - parts.push(_part); - } - return parts.join(''); - } - function rfc2616unquote(value) { - if (value.charAt(0) === '"') { - var parts = value.slice(1).split('\\"'); - for (var i = 0; i < parts.length; ++i) { - var quotindex = parts[i].indexOf('"'); - if (quotindex !== -1) { - parts[i] = parts[i].slice(0, quotindex); - parts.length = i + 1; - } - parts[i] = parts[i].replace(/\\(.)/g, '$1'); + this._requests = []; + + if (this._manager.isPendingRequest(this._requestId)) { + this._manager.abortRequest(this._requestId); } - value = parts.join('"'); - } - return value; - } - function rfc5987decode(extvalue) { - var encodingend = extvalue.indexOf('\''); - if (encodingend === -1) { - return extvalue; + + this._close(); } - var encoding = extvalue.slice(0, encodingend); - var langvalue = extvalue.slice(encodingend + 1); - var value = langvalue.replace(/^[^']*'/, ''); - return textdecode(encoding, value); - } - function rfc2047decode(value) { - if (value.slice(0, 2) !== '=?' || /[\x00-\x19\x80-\xff]/.test(value)) { - return value; + }, { + key: "isStreamingSupported", + get: function get() { + return false; } - return value.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (_, charset, encoding, text) { - if (encoding === 'q' || encoding === 'Q') { - text = text.replace(/_/g, ' '); - text = text.replace(/=([0-9a-fA-F]{2})/g, function (_, hex) { - return String.fromCharCode(parseInt(hex, 16)); - }); - return textdecode(charset, text); - } - try { - text = atob(text); - } catch (e) {} - return textdecode(charset, text); - }); - } - return ''; -} -exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader; + }]); + + return PDFNetworkStreamRangeRequestReader; +}(); /***/ }), -/* 151 */ +/* 216 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -18450,36 +25295,56 @@ exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDisposit Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFFetchStream = undefined; - -var _regenerator = __w_pdfjs_require__(137); +exports.PDFFetchStream = void 0; -var _regenerator2 = _interopRequireDefault(_regenerator); +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _util = __w_pdfjs_require__(5); -var _util = __w_pdfjs_require__(1); - -var _network_utils = __w_pdfjs_require__(149); +var _network_utils = __w_pdfjs_require__(213); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +; + function createFetchOptions(headers, withCredentials, abortController) { return { - method: 'GET', + method: "GET", headers: headers, signal: abortController && abortController.signal, - mode: 'cors', - credentials: withCredentials ? 'include' : 'same-origin', - redirect: 'follow' + mode: "cors", + credentials: withCredentials ? "include" : "same-origin", + redirect: "follow" }; } -var PDFFetchStream = function () { +function createHeaders(httpHeaders) { + var headers = new Headers(); + + for (var property in httpHeaders) { + var value = httpHeaders[property]; + + if (typeof value === "undefined") { + continue; + } + + headers.append(property, value); + } + + return headers; +} + +var PDFFetchStream = /*#__PURE__*/function () { function PDFFetchStream(source) { _classCallCheck(this, PDFFetchStream); @@ -18491,36 +25356,51 @@ var PDFFetchStream = function () { } _createClass(PDFFetchStream, [{ - key: 'getFullReader', + key: "getFullReader", value: function getFullReader() { - (0, _util.assert)(!this._fullRequestReader); + (0, _util.assert)(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."); this._fullRequestReader = new PDFFetchStreamReader(this); return this._fullRequestReader; } }, { - key: 'getRangeReader', + key: "getRangeReader", value: function getRangeReader(begin, end) { + if (end <= this._progressiveDataLength) { + return null; + } + var reader = new PDFFetchStreamRangeReader(this, begin, end); + this._rangeRequestReaders.push(reader); + return reader; } }, { - key: 'cancelAllRequests', + key: "cancelAllRequests", value: function cancelAllRequests(reason) { if (this._fullRequestReader) { this._fullRequestReader.cancel(reason); } + var readers = this._rangeRequestReaders.slice(0); + readers.forEach(function (reader) { reader.cancel(reason); }); } + }, { + key: "_progressiveDataLength", + get: function get() { + return this._fullRequestReader ? this._fullRequestReader._loaded : 0; + } }]); return PDFFetchStream; }(); -var PDFFetchStreamReader = function () { +exports.PDFFetchStream = PDFFetchStream; + +var PDFFetchStreamReader = /*#__PURE__*/function () { function PDFFetchStreamReader(stream) { var _this = this; @@ -18531,34 +25411,33 @@ var PDFFetchStreamReader = function () { this._loaded = 0; this._filename = null; var source = stream.source; - this._withCredentials = source.withCredentials; + this._withCredentials = source.withCredentials || false; this._contentLength = source.length; this._headersCapability = (0, _util.createPromiseCapability)(); this._disableRange = source.disableRange || false; this._rangeChunkSize = source.rangeChunkSize; + if (!this._rangeChunkSize && !this._disableRange) { this._disableRange = true; } - if (typeof AbortController !== 'undefined') { + + if (typeof AbortController !== "undefined") { this._abortController = new AbortController(); } + this._isStreamingSupported = !source.disableStream; this._isRangeSupported = !source.disableRange; - this._headers = new Headers(); - for (var property in this._stream.httpHeaders) { - var value = this._stream.httpHeaders[property]; - if (typeof value === 'undefined') { - continue; - } - this._headers.append(property, value); - } + this._headers = createHeaders(this._stream.httpHeaders); var url = source.url; fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) { if (!(0, _network_utils.validateResponseStatus)(response.status)) { throw (0, _network_utils.createResponseStatusError)(response.status, url); } + _this._reader = response.body.getReader(); + _this._headersCapability.resolve(); + var getResponseHeader = function getResponseHeader(name) { return response.headers.get(name); }; @@ -18575,20 +25454,21 @@ var PDFFetchStreamReader = function () { _this._isRangeSupported = allowRangeRequests; _this._contentLength = suggestedLength || _this._contentLength; _this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); + if (!_this._isStreamingSupported && _this._isRangeSupported) { - _this.cancel(new _util.AbortException('streaming is disabled')); + _this.cancel(new _util.AbortException("Streaming is disabled.")); } - }).catch(this._headersCapability.reject); + })["catch"](this._headersCapability.reject); this.onProgress = null; } _createClass(PDFFetchStreamReader, [{ - key: 'read', + key: "read", value: function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { - var _ref2, value, done, buffer; + var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() { + var _yield$this$_reader$r, value, done, buffer; - return _regenerator2.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -18600,36 +25480,38 @@ var PDFFetchStreamReader = function () { return this._reader.read(); case 4: - _ref2 = _context.sent; - value = _ref2.value; - done = _ref2.done; + _yield$this$_reader$r = _context.sent; + value = _yield$this$_reader$r.value; + done = _yield$this$_reader$r.done; if (!done) { _context.next = 9; break; } - return _context.abrupt('return', { + return _context.abrupt("return", { value: value, done: done }); case 9: this._loaded += value.byteLength; + if (this.onProgress) { this.onProgress({ loaded: this._loaded, total: this._contentLength }); } + buffer = new Uint8Array(value).buffer; - return _context.abrupt('return', { + return _context.abrupt("return", { value: buffer, done: false }); case 13: - case 'end': + case "end": return _context.stop(); } } @@ -18637,43 +25519,44 @@ var PDFFetchStreamReader = function () { })); function read() { - return _ref.apply(this, arguments); + return _read.apply(this, arguments); } return read; }() }, { - key: 'cancel', + key: "cancel", value: function cancel(reason) { if (this._reader) { this._reader.cancel(reason); } + if (this._abortController) { this._abortController.abort(); } } }, { - key: 'headersReady', + key: "headersReady", get: function get() { return this._headersCapability.promise; } }, { - key: 'filename', + key: "filename", get: function get() { return this._filename; } }, { - key: 'contentLength', + key: "contentLength", get: function get() { return this._contentLength; } }, { - key: 'isRangeSupported', + key: "isRangeSupported", get: function get() { return this._isRangeSupported; } }, { - key: 'isStreamingSupported', + key: "isStreamingSupported", get: function get() { return this._isStreamingSupported; } @@ -18682,7 +25565,7 @@ var PDFFetchStreamReader = function () { return PDFFetchStreamReader; }(); -var PDFFetchStreamRangeReader = function () { +var PDFFetchStreamRangeReader = /*#__PURE__*/function () { function PDFFetchStreamRangeReader(stream, begin, end) { var _this2 = this; @@ -18692,40 +25575,38 @@ var PDFFetchStreamRangeReader = function () { this._reader = null; this._loaded = 0; var source = stream.source; - this._withCredentials = source.withCredentials; + this._withCredentials = source.withCredentials || false; this._readCapability = (0, _util.createPromiseCapability)(); this._isStreamingSupported = !source.disableStream; - if (typeof AbortController !== 'undefined') { + + if (typeof AbortController !== "undefined") { this._abortController = new AbortController(); } - this._headers = new Headers(); - for (var property in this._stream.httpHeaders) { - var value = this._stream.httpHeaders[property]; - if (typeof value === 'undefined') { - continue; - } - this._headers.append(property, value); - } - var rangeStr = begin + '-' + (end - 1); - this._headers.append('Range', 'bytes=' + rangeStr); + + this._headers = createHeaders(this._stream.httpHeaders); + + this._headers.append("Range", "bytes=".concat(begin, "-").concat(end - 1)); + var url = source.url; fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) { if (!(0, _network_utils.validateResponseStatus)(response.status)) { throw (0, _network_utils.createResponseStatusError)(response.status, url); } + _this2._readCapability.resolve(); + _this2._reader = response.body.getReader(); }); this.onProgress = null; } _createClass(PDFFetchStreamRangeReader, [{ - key: 'read', + key: "read", value: function () { - var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() { - var _ref4, value, done, buffer; + var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() { + var _yield$this$_reader$r2, value, done, buffer; - return _regenerator2.default.wrap(function _callee2$(_context2) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -18737,33 +25618,37 @@ var PDFFetchStreamRangeReader = function () { return this._reader.read(); case 4: - _ref4 = _context2.sent; - value = _ref4.value; - done = _ref4.done; + _yield$this$_reader$r2 = _context2.sent; + value = _yield$this$_reader$r2.value; + done = _yield$this$_reader$r2.done; if (!done) { _context2.next = 9; break; } - return _context2.abrupt('return', { + return _context2.abrupt("return", { value: value, done: done }); case 9: this._loaded += value.byteLength; + if (this.onProgress) { - this.onProgress({ loaded: this._loaded }); + this.onProgress({ + loaded: this._loaded + }); } + buffer = new Uint8Array(value).buffer; - return _context2.abrupt('return', { + return _context2.abrupt("return", { value: buffer, done: false }); case 13: - case 'end': + case "end": return _context2.stop(); } } @@ -18771,23 +25656,24 @@ var PDFFetchStreamRangeReader = function () { })); function read() { - return _ref3.apply(this, arguments); + return _read2.apply(this, arguments); } return read; }() }, { - key: 'cancel', + key: "cancel", value: function cancel(reason) { if (this._reader) { this._reader.cancel(reason); } + if (this._abortController) { this._abortController.abort(); } } }, { - key: 'isStreamingSupported', + key: "isStreamingSupported", get: function get() { return this._isStreamingSupported; } @@ -18796,569 +25682,6 @@ var PDFFetchStreamRangeReader = function () { return PDFFetchStreamRangeReader; }(); -exports.PDFFetchStream = PDFFetchStream; - -/***/ }), -/* 152 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NetworkManager = exports.PDFNetworkStream = undefined; - -var _regenerator = __w_pdfjs_require__(137); - -var _regenerator2 = _interopRequireDefault(_regenerator); - -var _util = __w_pdfjs_require__(1); - -var _network_utils = __w_pdfjs_require__(149); - -var _global_scope = __w_pdfjs_require__(3); - -var _global_scope2 = _interopRequireDefault(_global_scope); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - -; -var OK_RESPONSE = 200; -var PARTIAL_CONTENT_RESPONSE = 206; -function NetworkManager(url, args) { - this.url = url; - args = args || {}; - this.isHttp = /^https?:/i.test(url); - this.httpHeaders = this.isHttp && args.httpHeaders || {}; - this.withCredentials = args.withCredentials || false; - this.getXhr = args.getXhr || function NetworkManager_getXhr() { - return new XMLHttpRequest(); - }; - this.currXhrId = 0; - this.pendingRequests = Object.create(null); - this.loadedRequests = Object.create(null); -} -function getArrayBuffer(xhr) { - var data = xhr.response; - if (typeof data !== 'string') { - return data; - } - var array = (0, _util.stringToBytes)(data); - return array.buffer; -} -var supportsMozChunked = function supportsMozChunkedClosure() { - try { - var x = new XMLHttpRequest(); - x.open('GET', _global_scope2.default.location.href); - x.responseType = 'moz-chunked-arraybuffer'; - return x.responseType === 'moz-chunked-arraybuffer'; - } catch (e) { - return false; - } -}(); -NetworkManager.prototype = { - requestRange: function NetworkManager_requestRange(begin, end, listeners) { - var args = { - begin: begin, - end: end - }; - for (var prop in listeners) { - args[prop] = listeners[prop]; - } - return this.request(args); - }, - requestFull: function NetworkManager_requestFull(listeners) { - return this.request(listeners); - }, - request: function NetworkManager_request(args) { - var xhr = this.getXhr(); - var xhrId = this.currXhrId++; - var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr }; - xhr.open('GET', this.url); - xhr.withCredentials = this.withCredentials; - for (var property in this.httpHeaders) { - var value = this.httpHeaders[property]; - if (typeof value === 'undefined') { - continue; - } - xhr.setRequestHeader(property, value); - } - if (this.isHttp && 'begin' in args && 'end' in args) { - var rangeStr = args.begin + '-' + (args.end - 1); - xhr.setRequestHeader('Range', 'bytes=' + rangeStr); - pendingRequest.expectedStatus = 206; - } else { - pendingRequest.expectedStatus = 200; - } - var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData; - if (useMozChunkedLoading) { - xhr.responseType = 'moz-chunked-arraybuffer'; - pendingRequest.onProgressiveData = args.onProgressiveData; - pendingRequest.mozChunked = true; - } else { - xhr.responseType = 'arraybuffer'; - } - if (args.onError) { - xhr.onerror = function (evt) { - args.onError(xhr.status); - }; - } - xhr.onreadystatechange = this.onStateChange.bind(this, xhrId); - xhr.onprogress = this.onProgress.bind(this, xhrId); - pendingRequest.onHeadersReceived = args.onHeadersReceived; - pendingRequest.onDone = args.onDone; - pendingRequest.onError = args.onError; - pendingRequest.onProgress = args.onProgress; - xhr.send(null); - return xhrId; - }, - onProgress: function NetworkManager_onProgress(xhrId, evt) { - var pendingRequest = this.pendingRequests[xhrId]; - if (!pendingRequest) { - return; - } - if (pendingRequest.mozChunked) { - var chunk = getArrayBuffer(pendingRequest.xhr); - pendingRequest.onProgressiveData(chunk); - } - var onProgress = pendingRequest.onProgress; - if (onProgress) { - onProgress(evt); - } - }, - onStateChange: function NetworkManager_onStateChange(xhrId, evt) { - var pendingRequest = this.pendingRequests[xhrId]; - if (!pendingRequest) { - return; - } - var xhr = pendingRequest.xhr; - if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) { - pendingRequest.onHeadersReceived(); - delete pendingRequest.onHeadersReceived; - } - if (xhr.readyState !== 4) { - return; - } - if (!(xhrId in this.pendingRequests)) { - return; - } - delete this.pendingRequests[xhrId]; - if (xhr.status === 0 && this.isHttp) { - if (pendingRequest.onError) { - pendingRequest.onError(xhr.status); - } - return; - } - var xhrStatus = xhr.status || OK_RESPONSE; - var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE; - if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) { - if (pendingRequest.onError) { - pendingRequest.onError(xhr.status); - } - return; - } - this.loadedRequests[xhrId] = true; - var chunk = getArrayBuffer(xhr); - if (xhrStatus === PARTIAL_CONTENT_RESPONSE) { - var rangeHeader = xhr.getResponseHeader('Content-Range'); - var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader); - var begin = parseInt(matches[1], 10); - pendingRequest.onDone({ - begin: begin, - chunk: chunk - }); - } else if (pendingRequest.onProgressiveData) { - pendingRequest.onDone(null); - } else if (chunk) { - pendingRequest.onDone({ - begin: 0, - chunk: chunk - }); - } else if (pendingRequest.onError) { - pendingRequest.onError(xhr.status); - } - }, - hasPendingRequests: function NetworkManager_hasPendingRequests() { - for (var xhrId in this.pendingRequests) { - return true; - } - return false; - }, - getRequestXhr: function NetworkManager_getXhr(xhrId) { - return this.pendingRequests[xhrId].xhr; - }, - isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) { - return !!this.pendingRequests[xhrId].onProgressiveData; - }, - isPendingRequest: function NetworkManager_isPendingRequest(xhrId) { - return xhrId in this.pendingRequests; - }, - isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) { - return xhrId in this.loadedRequests; - }, - abortAllRequests: function NetworkManager_abortAllRequests() { - for (var xhrId in this.pendingRequests) { - this.abortRequest(xhrId | 0); - } - }, - abortRequest: function NetworkManager_abortRequest(xhrId) { - var xhr = this.pendingRequests[xhrId].xhr; - delete this.pendingRequests[xhrId]; - xhr.abort(); - } -}; -function PDFNetworkStream(source) { - this._source = source; - this._manager = new NetworkManager(source.url, { - httpHeaders: source.httpHeaders, - withCredentials: source.withCredentials - }); - this._rangeChunkSize = source.rangeChunkSize; - this._fullRequestReader = null; - this._rangeRequestReaders = []; -} -PDFNetworkStream.prototype = { - _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) { - var i = this._rangeRequestReaders.indexOf(reader); - if (i >= 0) { - this._rangeRequestReaders.splice(i, 1); - } - }, - getFullReader: function PDFNetworkStream_getFullReader() { - (0, _util.assert)(!this._fullRequestReader); - this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source); - return this._fullRequestReader; - }, - getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) { - var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end); - reader.onClosed = this._onRangeRequestReaderClosed.bind(this); - this._rangeRequestReaders.push(reader); - return reader; - }, - cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) { - if (this._fullRequestReader) { - this._fullRequestReader.cancel(reason); - } - var readers = this._rangeRequestReaders.slice(0); - readers.forEach(function (reader) { - reader.cancel(reason); - }); - } -}; -function PDFNetworkStreamFullRequestReader(manager, source) { - this._manager = manager; - var args = { - onHeadersReceived: this._onHeadersReceived.bind(this), - onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this), - onDone: this._onDone.bind(this), - onError: this._onError.bind(this), - onProgress: this._onProgress.bind(this) - }; - this._url = source.url; - this._fullRequestId = manager.requestFull(args); - this._headersReceivedCapability = (0, _util.createPromiseCapability)(); - this._disableRange = source.disableRange || false; - this._contentLength = source.length; - this._rangeChunkSize = source.rangeChunkSize; - if (!this._rangeChunkSize && !this._disableRange) { - this._disableRange = true; - } - this._isStreamingSupported = false; - this._isRangeSupported = false; - this._cachedChunks = []; - this._requests = []; - this._done = false; - this._storedError = undefined; - this._filename = null; - this.onProgress = null; -} -PDFNetworkStreamFullRequestReader.prototype = { - _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() { - var fullRequestXhrId = this._fullRequestId; - var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId); - var getResponseHeader = function getResponseHeader(name) { - return fullRequestXhr.getResponseHeader(name); - }; - - var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({ - getResponseHeader: getResponseHeader, - isHttp: this._manager.isHttp, - rangeChunkSize: this._rangeChunkSize, - disableRange: this._disableRange - }), - allowRangeRequests = _validateRangeRequest.allowRangeRequests, - suggestedLength = _validateRangeRequest.suggestedLength; - - if (allowRangeRequests) { - this._isRangeSupported = true; - } - this._contentLength = suggestedLength || this._contentLength; - this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); - var networkManager = this._manager; - if (networkManager.isStreamingRequest(fullRequestXhrId)) { - this._isStreamingSupported = true; - } else if (this._isRangeSupported) { - networkManager.abortRequest(fullRequestXhrId); - } - this._headersReceivedCapability.resolve(); - }, - _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) { - if (this._requests.length > 0) { - var requestCapability = this._requests.shift(); - requestCapability.resolve({ - value: chunk, - done: false - }); - } else { - this._cachedChunks.push(chunk); - } - }, - _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) { - if (args) { - this._onProgressiveData(args.chunk); - } - this._done = true; - if (this._cachedChunks.length > 0) { - return; - } - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); - }); - this._requests = []; - }, - _onError: function PDFNetworkStreamFullRequestReader_onError(status) { - var url = this._url; - var exception = (0, _network_utils.createResponseStatusError)(status, url); - this._storedError = exception; - this._headersReceivedCapability.reject(exception); - this._requests.forEach(function (requestCapability) { - requestCapability.reject(exception); - }); - this._requests = []; - this._cachedChunks = []; - }, - _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) { - if (this.onProgress) { - this.onProgress({ - loaded: data.loaded, - total: data.lengthComputable ? data.total : this._contentLength - }); - } - }, - get filename() { - return this._filename; - }, - get isRangeSupported() { - return this._isRangeSupported; - }, - get isStreamingSupported() { - return this._isStreamingSupported; - }, - get contentLength() { - return this._contentLength; - }, - get headersReady() { - return this._headersReceivedCapability.promise; - }, - read: function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { - var chunk, requestCapability; - return _regenerator2.default.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (!this._storedError) { - _context.next = 2; - break; - } - - throw this._storedError; - - case 2: - if (!(this._cachedChunks.length > 0)) { - _context.next = 5; - break; - } - - chunk = this._cachedChunks.shift(); - return _context.abrupt('return', { - value: chunk, - done: false - }); - - case 5: - if (!this._done) { - _context.next = 7; - break; - } - - return _context.abrupt('return', { - value: undefined, - done: true - }); - - case 7: - requestCapability = (0, _util.createPromiseCapability)(); - - this._requests.push(requestCapability); - return _context.abrupt('return', requestCapability.promise); - - case 10: - case 'end': - return _context.stop(); - } - } - }, _callee, this); - })); - - function read() { - return _ref.apply(this, arguments); - } - - return read; - }(), - - cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) { - this._done = true; - this._headersReceivedCapability.reject(reason); - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); - }); - this._requests = []; - if (this._manager.isPendingRequest(this._fullRequestId)) { - this._manager.abortRequest(this._fullRequestId); - } - this._fullRequestReader = null; - } -}; -function PDFNetworkStreamRangeRequestReader(manager, begin, end) { - this._manager = manager; - var args = { - onDone: this._onDone.bind(this), - onProgress: this._onProgress.bind(this) - }; - this._requestId = manager.requestRange(begin, end, args); - this._requests = []; - this._queuedChunk = null; - this._done = false; - this.onProgress = null; - this.onClosed = null; -} -PDFNetworkStreamRangeRequestReader.prototype = { - _close: function PDFNetworkStreamRangeRequestReader_close() { - if (this.onClosed) { - this.onClosed(this); - } - }, - _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) { - var chunk = data.chunk; - if (this._requests.length > 0) { - var requestCapability = this._requests.shift(); - requestCapability.resolve({ - value: chunk, - done: false - }); - } else { - this._queuedChunk = chunk; - } - this._done = true; - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); - }); - this._requests = []; - this._close(); - }, - _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) { - if (!this.isStreamingSupported && this.onProgress) { - this.onProgress({ loaded: evt.loaded }); - } - }, - get isStreamingSupported() { - return false; - }, - read: function () { - var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() { - var chunk, requestCapability; - return _regenerator2.default.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - if (!(this._queuedChunk !== null)) { - _context2.next = 4; - break; - } - - chunk = this._queuedChunk; - - this._queuedChunk = null; - return _context2.abrupt('return', { - value: chunk, - done: false - }); - - case 4: - if (!this._done) { - _context2.next = 6; - break; - } - - return _context2.abrupt('return', { - value: undefined, - done: true - }); - - case 6: - requestCapability = (0, _util.createPromiseCapability)(); - - this._requests.push(requestCapability); - return _context2.abrupt('return', requestCapability.promise); - - case 9: - case 'end': - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function read() { - return _ref2.apply(this, arguments); - } - - return read; - }(), - - cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) { - this._done = true; - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); - }); - this._requests = []; - if (this._manager.isPendingRequest(this._requestId)) { - this._manager.abortRequest(this._requestId); - } - this._close(); - } -}; -exports.PDFNetworkStream = PDFNetworkStream; -exports.NetworkManager = NetworkManager; - /***/ }) /******/ ]); }); diff --git a/docs/_static/build/pdf.js.map b/docs/_static/build/pdf.js.map index 57e89d88..5a8d18e9 100644 --- a/docs/_static/build/pdf.js.map +++ b/docs/_static/build/pdf.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://pdfjs-dist/build/pdf/webpack/universalModuleDefinition","webpack://pdfjs-dist/build/pdf/webpack/bootstrap","webpack://pdfjs-dist/build/pdf/src/pdf.js","webpack://pdfjs-dist/build/pdf/src/shared/util.js","webpack://pdfjs-dist/build/pdf/src/shared/compatibility.js","webpack://pdfjs-dist/build/pdf/src/shared/global_scope.js","webpack://pdfjs-dist/build/pdf/src/shared/is_node.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/string/includes.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.string.includes.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_export.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_global.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_core.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_hide.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-dp.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_an-object.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_is-object.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_ie8-dom-define.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_descriptors.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_fails.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_dom-create.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_to-primitive.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_property-desc.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_redefine.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_has.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_uid.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_ctx.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_a-function.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_string-context.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_is-regexp.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_cof.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_wks.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_shared.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_library.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_defined.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_fails-is-regexp.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/array/includes.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es7.array.includes.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_array-includes.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_to-iobject.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_iobject.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_to-length.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_to-integer.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_to-absolute-index.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_add-to-unscopables.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/object/assign.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.object.assign.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-assign.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-keys.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-keys-internal.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_shared-key.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_enum-bug-keys.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-gops.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-pie.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_to-object.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/math/log2.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.math.log2.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/number/is-nan.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.number.is-nan.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/number/is-integer.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.number.is-integer.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_is-integer.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/promise.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.object.to-string.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_classof.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.string.iterator.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_string-at.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_iter-define.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_iterators.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_iter-create.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-create.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-dps.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_html.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_set-to-string-tag.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-gpo.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/web.dom.iterable.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.array.iterator.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_iter-step.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.promise.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_an-instance.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_for-of.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_iter-call.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_is-array-iter.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/core.get-iterator-method.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_species-constructor.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_task.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_invoke.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_microtask.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_new-promise-capability.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_perform.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_user-agent.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_promise-resolve.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_redefine-all.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_set-species.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_iter-detect.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es7.promise.finally.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es7.promise.try.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/weak-map.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.weak-map.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_array-methods.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_array-species-create.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_array-species-constructor.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_is-array.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_meta.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_collection-weak.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_validate-collection.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_collection.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_inherit-if-required.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_set-proto.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-gopd.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es7.weak-map.of.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_set-collection-of.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es7.weak-map.from.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_set-collection-from.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/string/code-point-at.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.string.code-point-at.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/string/from-code-point.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.string.from-code-point.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/es6/symbol.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.symbol.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_wks-ext.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_wks-define.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_enum-keys.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-gopn-ext.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-gopn.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/object/values.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es7.object.values.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-to-array.js","webpack://pdfjs-dist/build/pdf/src/shared/streams_polyfill.js","webpack://pdfjs-dist/build/pdf/external/streams/streams-lib.js","webpack://pdfjs-dist/build/pdf/src/shared/url_polyfill.js","webpack://pdfjs-dist/build/pdf/external/url/url-lib.js","webpack://pdfjs-dist/build/pdf/src/display/api.js","webpack://pdfjs-dist/build/pdf/src/display/dom_utils.js","webpack://pdfjs-dist/build/pdf/src/display/font_loader.js","webpack://pdfjs-dist/build/pdf/src/display/api_compatibility.js","webpack://pdfjs-dist/build/pdf/src/display/canvas.js","webpack://pdfjs-dist/build/pdf/src/display/pattern_helper.js","webpack://pdfjs-dist/build/pdf/src/display/worker_options.js","webpack://pdfjs-dist/build/pdf/src/shared/message_handler.js","webpack://pdfjs-dist/build/pdf/node_modules/babel-runtime/regenerator/index.js","webpack://pdfjs-dist/build/pdf/node_modules/regenerator-runtime/runtime-module.js","webpack://pdfjs-dist/build/pdf/node_modules/regenerator-runtime/runtime.js","webpack://pdfjs-dist/build/pdf/node_modules/webpack/buildin/module.js","webpack://pdfjs-dist/build/pdf/src/display/metadata.js","webpack://pdfjs-dist/build/pdf/src/display/xml_parser.js","webpack://pdfjs-dist/build/pdf/src/display/transport_stream.js","webpack://pdfjs-dist/build/pdf/src/display/webgl.js","webpack://pdfjs-dist/build/pdf/src/display/text_layer.js","webpack://pdfjs-dist/build/pdf/src/display/annotation_layer.js","webpack://pdfjs-dist/build/pdf/src/display/svg.js","webpack://pdfjs-dist/build/pdf/src/display/node_stream.js","webpack://pdfjs-dist/build/pdf/src/display/network_utils.js","webpack://pdfjs-dist/build/pdf/src/display/content_disposition.js","webpack://pdfjs-dist/build/pdf/src/display/fetch_stream.js","webpack://pdfjs-dist/build/pdf/src/display/network.js"],"names":["pdfjsVersion","pdfjsBuild","pdfjsSharedUtil","require","pdfjsDisplayAPI","pdfjsDisplayTextLayer","pdfjsDisplayAnnotationLayer","pdfjsDisplayDOMUtils","pdfjsDisplaySVG","pdfjsDisplayWorkerOptions","pdfjsDisplayAPICompatibility","isNodeJS","PDFNodeStream","Response","PDFFetchStream","PDFNetworkStream","exports","IDENTITY_MATRIX","FONT_IDENTITY_MATRIX","NativeImageDecoding","NONE","DECODE","DISPLAY","PermissionFlag","PRINT","MODIFY_CONTENTS","COPY","MODIFY_ANNOTATIONS","FILL_INTERACTIVE_FORMS","COPY_FOR_ACCESSIBILITY","ASSEMBLE","PRINT_HIGH_QUALITY","TextRenderingMode","FILL","STROKE","FILL_STROKE","INVISIBLE","FILL_ADD_TO_PATH","STROKE_ADD_TO_PATH","FILL_STROKE_ADD_TO_PATH","ADD_TO_PATH","FILL_STROKE_MASK","ADD_TO_PATH_FLAG","ImageKind","GRAYSCALE_1BPP","RGB_24BPP","RGBA_32BPP","AnnotationType","TEXT","LINK","FREETEXT","LINE","SQUARE","CIRCLE","POLYGON","POLYLINE","HIGHLIGHT","UNDERLINE","SQUIGGLY","STRIKEOUT","STAMP","CARET","INK","POPUP","FILEATTACHMENT","SOUND","MOVIE","WIDGET","SCREEN","PRINTERMARK","TRAPNET","WATERMARK","THREED","REDACT","AnnotationFlag","HIDDEN","NOZOOM","NOROTATE","NOVIEW","READONLY","LOCKED","TOGGLENOVIEW","LOCKEDCONTENTS","AnnotationFieldFlag","REQUIRED","NOEXPORT","MULTILINE","PASSWORD","NOTOGGLETOOFF","RADIO","PUSHBUTTON","COMBO","EDIT","SORT","FILESELECT","MULTISELECT","DONOTSPELLCHECK","DONOTSCROLL","COMB","RICHTEXT","RADIOSINUNISON","COMMITONSELCHANGE","AnnotationBorderStyleType","SOLID","DASHED","BEVELED","INSET","StreamType","UNKNOWN","FLATE","LZW","DCT","JPX","JBIG","A85","AHX","CCF","RL","FontType","TYPE1","TYPE1C","CIDFONTTYPE0","CIDFONTTYPE0C","TRUETYPE","CIDFONTTYPE2","TYPE3","OPENTYPE","TYPE0","MMTYPE1","VerbosityLevel","ERRORS","WARNINGS","INFOS","CMapCompressionType","BINARY","STREAM","OPS","dependency","setLineWidth","setLineCap","setLineJoin","setMiterLimit","setDash","setRenderingIntent","setFlatness","setGState","save","restore","transform","moveTo","lineTo","curveTo","curveTo2","curveTo3","closePath","rectangle","stroke","closeStroke","fill","eoFill","fillStroke","eoFillStroke","closeFillStroke","closeEOFillStroke","endPath","clip","eoClip","beginText","endText","setCharSpacing","setWordSpacing","setHScale","setLeading","setFont","setTextRenderingMode","setTextRise","moveText","setLeadingMoveText","setTextMatrix","nextLine","showText","showSpacedText","nextLineShowText","nextLineSetSpacingShowText","setCharWidth","setCharWidthAndBounds","setStrokeColorSpace","setFillColorSpace","setStrokeColor","setStrokeColorN","setFillColor","setFillColorN","setStrokeGray","setFillGray","setStrokeRGBColor","setFillRGBColor","setStrokeCMYKColor","setFillCMYKColor","shadingFill","beginInlineImage","beginImageData","endInlineImage","paintXObject","markPoint","markPointProps","beginMarkedContent","beginMarkedContentProps","endMarkedContent","beginCompat","endCompat","paintFormXObjectBegin","paintFormXObjectEnd","beginGroup","endGroup","beginAnnotations","endAnnotations","beginAnnotation","endAnnotation","paintJpegXObject","paintImageMaskXObject","paintImageMaskXObjectGroup","paintImageXObject","paintInlineImageXObject","paintInlineImageXObjectGroup","paintImageXObjectRepeat","paintImageMaskXObjectRepeat","paintSolidColorImageMask","constructPath","UNSUPPORTED_FEATURES","unknown","forms","javaScript","smask","shadingPattern","font","PasswordResponses","NEED_PASSWORD","INCORRECT_PASSWORD","verbosity","Number","console","unreachable","base","other","url","absoluteUrl","baseUrl","_isValidProtocol","Object","enumerable","configurable","writable","lookup","initializer","PasswordException","UnknownErrorException","InvalidPDFException","MissingPDFException","UnexpectedResponseException","MissingDataException","XRefParseException","FormatError","AbortException","NullCharactersRegExp","warn","str","assert","bytes","length","MAX_ARGUMENT_COUNT","String","strBuf","i","chunkEnd","Math","chunk","arr","resultLength","ii","item","itemLength","arrayByteLength","pos","data","stringToBytes","value","x","offset","buffer8","view32","getArray","stopWhenFound","LOOP_LIMIT","loopCount","dict","values","Util","rgbBuf","m1","m2","xt","p","m","yt","d","p1","p2","r","p3","p4","v","transpose","a","b","c","first","second","sx","sy","rect","orderedX","rect1","rect2","orderedY","result","ROMAN_NUMBER_MAP","lowerCase","number","romanBuf","romanStr","PDFStringTranslateTable","n","code","decodeURIComponent","escape","unescape","encodeURIComponent","ch","capability","createObjectURL","digits","forceDataSchema","URL","blob","type","buffer","b1","b2","b3","d1","d2","d3","d4","globalScope","hasDOM","Buffer","get","scripts","document","Element","div","originalDOMTokenListToggle","DOMTokenList","arguments","force","Array","module","window","global","self","process","$export","context","INCLUDES","includes","core","hide","redefine","ctx","PROTOTYPE","IS_FORCED","IS_GLOBAL","IS_STATIC","IS_PROTO","IS_BIND","target","expProto","source","own","out","exp","Function","__g","version","__e","dP","createDesc","object","anObject","IE8_DOM_DEFINE","toPrimitive","P","TypeError","O","Attributes","isObject","it","is","S","val","fn","has","SRC","TO_STRING","$toString","TPL","isFunction","hasOwnProperty","id","px","key","aFunction","that","isRegExp","defined","cof","MATCH","toString","store","uid","Symbol","USE_SYMBOL","$exports","SHARED","mode","copyright","re","$includes","toIObject","toLength","toAbsoluteIndex","index","IS_INCLUDES","el","IObject","toInteger","min","ceil","floor","isNaN","max","UNSCOPABLES","ArrayProto","assign","getKeys","gOPS","pIE","toObject","$assign","A","B","K","T","aLen","getSymbols","isEnum","keys","j","$keys","enumBugKeys","arrayIndexOf","IE_PROTO","names","shared","log2","isInteger","isFinite","classof","test","TAG","ARG","tryGet","$at","done","point","s","l","LIBRARY","Iterators","$iterCreate","setToStringTag","getPrototypeOf","ITERATOR","BUGGY","FF_ITERATOR","KEYS","VALUES","returnThis","getMethod","kind","proto","NAME","DEF_VALUES","DEFAULT","VALUES_BUG","Base","$native","$default","$entries","$anyNative","IteratorPrototype","methods","IS_SET","entries","create","descriptor","Constructor","next","dPs","Empty","createDict","iframe","lt","gt","iframeDocument","Properties","def","stat","ObjectProto","$iterators","wks","TO_STRING_TAG","ArrayValues","DOMIterables","CSSRuleList","CSSStyleDeclaration","CSSValueList","ClientRectList","DOMRectList","DOMStringList","DataTransferItemList","FileList","HTMLAllCollection","HTMLCollection","HTMLFormElement","HTMLSelectElement","MediaList","MimeTypeArray","NamedNodeMap","NodeList","PaintRequestList","Plugin","PluginArray","SVGLengthList","SVGNumberList","SVGPathSegList","SVGPointList","SVGStringList","SVGTransformList","SourceBufferList","StyleSheetList","TextTrackCueList","TextTrackList","TouchList","collections","explicit","Collection","addToUnscopables","step","anInstance","forOf","speciesConstructor","task","microtask","newPromiseCapabilityModule","perform","userAgent","promiseResolve","PROMISE","versions","v8","$Promise","isNode","empty","newPromiseCapability","newGenericPromiseCapability","USE_NATIVE","promise","FakePromise","exec","isThenable","notify","chain","ok","run","handler","reaction","resolve","reject","domain","onHandleUnhandled","exited","then","isReject","onUnhandled","unhandled","isUnhandled","reason","$reject","$resolve","wrapper","_w","_d","Internal","executor","OwnPromiseCapability","C","Promise","Wrapper","$$reject","all","remaining","$index","alreadyCalled","race","forbiddenField","name","call","isArrayIter","getIterFn","BREAK","RETURN","iterFn","f","iterable","iterator","ret","SPECIES","invoke","html","cel","setTask","clearTask","MessageChannel","Dispatch","counter","queue","ONREADYSTATECHANGE","listener","event","args","defer","channel","port","setTimeout","set","clear","un","macrotask","Observer","flush","parent","head","last","toggle","node","characterData","e","navigator","promiseCapability","src","DESCRIPTORS","SAFE_CLOSING","riter","safe","iter","each","meta","weak","fails","validate","WEAK_MAP","getWeak","isExtensible","uncaughtFrozenStore","tmp","$WeakMap","InternalMap","method","asc","IS_MAP","TYPE","IS_FILTER","IS_SOME","IS_EVERY","IS_FIND_INDEX","NO_HOLES","$create","res","isArray","original","META","setDesc","FREEZE","setMeta","w","fastKey","onFreeze","KEY","NEED","redefineAll","createArrayMethod","$has","arrayFind","arrayFindIndex","UncaughtFrozenStore","findUncaughtFrozen","entry","getConstructor","ufstore","$iterDetect","inheritIfRequired","ADDER","fixMethod","IS_WEAK","common","instance","HASNT_CHAINING","THROWS_ON_PRIMITIVES","ACCEPT_ITERABLES","BUGGY_ZERO","$instance","setPrototypeOf","check","buggy","gOPD","of","from","mapFn","mapping","cb","codePointAt","fromCharCode","$fromCodePoint","fromCodePoint","RangeError","$fails","wksExt","wksDefine","enumKeys","_create","gOPNExt","$GOPD","$DP","gOPN","$Symbol","$JSON","_stringify","TO_PRIMITIVE","SymbolRegistry","AllSymbols","OPSymbols","QObject","setter","setSymbolDesc","protoDesc","wrap","sym","isSymbol","$defineProperty","D","$defineProperties","$propertyIsEnumerable","E","$getOwnPropertyDescriptor","$getOwnPropertyNames","$getOwnPropertySymbols","IS_OP","tag","$set","es6Symbols","wellKnownSymbols","k","keyFor","useSetter","useSimple","defineProperty","defineProperties","getOwnPropertyDescriptor","getOwnPropertyNames","getOwnPropertySymbols","stringify","$replacer","replacer","symbols","windowNames","getWindowNames","hiddenKeys","$values","isReadableStreamSupported","start","controller","installedModules","modules","__w_pdfjs_require__","getter","_typeof","obj","_require","elements","IsPropertyKey","Call","F","highWaterMark","size","message","AssertionError","Error","rethrowAssertionErrorRejection","_createClass","props","InvokeOrNoop","PromiseInvokeOrNoop","ValidateAndNormalizeQueuingStrategy","typeIsObject","_require2","_require3","DequeueValue","EnqueueValueWithSize","PeekQueueValue","ResetQueue","WritableStream","underlyingSink","_ref","_ref$highWaterMark","_classCallCheck","IsWritableStream","streamBrandCheckException","IsWritableStreamLocked","WritableStreamAbort","AcquireWritableStreamDefaultWriter","WritableStreamDefaultControllerError","WritableStreamDefaultWriterCloseWithErrorPropagation","WritableStreamDefaultWriterRelease","WritableStreamDefaultWriterWrite","WritableStreamCloseQueuedOrInFlight","stream","state","error","wasAlreadyErroring","_resolve","_reject","_reason","_wasAlreadyErroring","WritableStreamStartErroring","writeRequest","WritableStreamFinishErroring","writer","WritableStreamDefaultWriterEnsureReadyPromiseRejected","WritableStreamHasOperationMarkedInFlight","storedError","WritableStreamRejectCloseAndClosedPromiseIfNeeded","abortRequest","WritableStreamDealWithRejection","defaultWriterClosedPromiseResolve","defaultWriterClosedPromiseReject","backpressure","defaultWriterReadyPromiseReset","defaultWriterReadyPromiseResolve","WritableStreamDefaultWriter","defaultWriterReadyPromiseInitialize","defaultWriterReadyPromiseInitializeAsResolved","defaultWriterClosedPromiseInitialize","defaultWriterReadyPromiseInitializeAsRejected","defaultWriterClosedPromiseInitializeAsResolved","defaultWriterClosedPromiseInitializeAsRejected","IsWritableStreamDefaultWriter","defaultWriterBrandCheckException","defaultWriterLockException","WritableStreamDefaultWriterAbort","WritableStreamDefaultWriterClose","WritableStreamDefaultWriterGetDesiredSize","closeRequest","WritableStreamDefaultControllerClose","defaultWriterClosedPromiseResetToRejected","defaultWriterReadyPromiseReject","defaultWriterReadyPromiseResetToRejected","WritableStreamDefaultControllerGetDesiredSize","releasedError","WritableStreamDefaultWriterEnsureClosedPromiseRejected","chunkSize","WritableStreamDefaultControllerGetChunkSize","WritableStreamAddWriteRequest","WritableStreamDefaultControllerWrite","WritableStreamDefaultController","normalizedStrategy","WritableStreamDefaultControllerGetBackpressure","WritableStreamUpdateBackpressure","IsWritableStreamDefaultController","_this","startResult","WritableStreamDefaultControllerAdvanceQueueIfNeeded","strategySize","WritableStreamDefaultControllerErrorIfNeeded","writeRecord","WritableStreamDefaultControllerProcessClose","WritableStreamDefaultControllerProcessWrite","WritableStreamMarkCloseRequestInFlight","sinkClosePromise","WritableStreamFinishInFlightClose","WritableStreamFinishInFlightCloseWithError","WritableStreamMarkFirstWriteRequestInFlight","sinkWritePromise","WritableStreamFinishInFlightWrite","WritableStreamFinishInFlightWriteWithError","desiredSize","IsFiniteNonNegativeNumber","container","pair","ArrayBufferCopy","CreateIterResultObject","TransferArrayBuffer","ValidateAndNormalizeHighWaterMark","createArrayFromList","createDataProperty","_require4","_require5","ReadableStream","underlyingSource","typeString","IsReadableStream","IsReadableStreamLocked","ReadableStreamCancel","_ref2","AcquireReadableStreamDefaultReader","AcquireReadableStreamBYOBReader","_ref3","readable","ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue","_ref4","preventClose","preventAbort","preventCancel","Boolean","reader","shuttingDown","currentWrite","_ref5","isOrBecomesErrored","shutdownWithAction","shutdown","isOrBecomesClosed","dest","destClosed","pipeLoop","oldCurrentWrite","action","waitForWritesToFinish","finalize","ReadableStreamReaderGenericRelease","branches","ReadableStreamTee","IsReadableStreamDisturbed","ReadableStreamDefaultControllerClose","ReadableStreamDefaultControllerEnqueue","ReadableStreamDefaultControllerError","ReadableStreamDefaultControllerGetDesiredSize","teeState","closedOrErrored","canceled1","canceled2","reason1","reason2","pull","cancel1","cancel2","underlyingSource1","branch1Stream","underlyingSource2","branch2Stream","branch1","branch2","value1","value2","compositeReason","cancelResult","IsReadableStreamBYOBReader","readIntoRequest","IsReadableStreamDefaultReader","readRequest","ReadableStreamClose","sourceCancelPromise","defaultReaderClosedPromiseResolve","_i","defaultReaderClosedPromiseReject","ReadableStreamDefaultReader","ReadableStreamReaderGenericInitialize","defaultReaderBrandCheckException","readerLockException","ReadableStreamReaderGenericCancel","ReadableStreamDefaultReaderRead","ReadableStreamBYOBReader","IsReadableByteStreamController","byobReaderBrandCheckException","ArrayBuffer","view","ReadableStreamBYOBReaderRead","defaultReaderClosedPromiseInitialize","defaultReaderClosedPromiseInitializeAsResolved","defaultReaderClosedPromiseInitializeAsRejected","defaultReaderClosedPromiseResetToRejected","ReadableByteStreamControllerPullInto","ReadableStreamDefaultController","ReadableStreamDefaultControllerCallPullIfNeeded","ReadableStreamDefaultControllerErrorIfNeeded","IsReadableStreamDefaultController","defaultControllerBrandCheckException","pendingPromise","ReadableStreamAddReadRequest","shouldPull","ReadableStreamDefaultControllerShouldCallPull","pullPromise","ReadableStreamGetNumReadRequests","ReadableStreamFulfillReadRequest","ReadableStreamError","ReadableStreamBYOBRequest","IsReadableStreamBYOBRequest","byobRequestBrandCheckException","ReadableByteStreamControllerRespond","ReadableByteStreamControllerRespondWithNewView","ReadableByteStreamController","ReadableByteStreamControllerClearPendingPullIntos","autoAllocateChunkSize","underlyingByteSource","ReadableByteStreamControllerCallPullIfNeeded","ReadableByteStreamControllerError","byteStreamControllerBrandCheckException","ReadableByteStreamControllerClose","ReadableByteStreamControllerEnqueue","firstDescriptor","ReadableStreamHasDefaultReader","ReadableByteStreamControllerHandleQueueDrain","pullIntoDescriptor","byteOffset","byteLength","bytesFilled","elementSize","ctor","readerType","ReadableByteStreamControllerGetDesiredSize","ReadableByteStreamControllerShouldCallPull","ReadableByteStreamControllerInvalidateBYOBRequest","filledView","ReadableByteStreamControllerConvertPullIntoDescriptor","ReadableStreamFulfillReadIntoRequest","currentAlignedBytes","maxBytesToCopy","maxBytesFilled","maxAlignedBytes","totalBytesToCopyRemaining","ready","headOfQueue","bytesToCopy","destStart","ReadableByteStreamControllerFillHeadPullIntoDescriptor","ReadableByteStreamControllerFillPullIntoDescriptorFromQueue","ReadableByteStreamControllerShiftPendingPullInto","ReadableByteStreamControllerCommitPullIntoDescriptor","ReadableStreamAddReadIntoRequest","emptyView","ReadableStreamHasBYOBReader","ReadableStreamGetNumReadIntoRequests","remainderSize","end","remainder","ReadableByteStreamControllerEnqueueChunkToQueue","ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue","bytesWritten","ReadableByteStreamControllerRespondInClosedState","ReadableByteStreamControllerRespondInReadableState","firstPendingPullInto","transferredBuffer","transferredView","ReadableByteStreamControllerRespondInternal","transformStream","readableStream","writableStream","PromiseInvokeOrPerformFallback","TransformStreamCloseReadableInternal","TransformStreamErrorIfNeeded","maybeBackpressure","TransformStreamSetBackpressure","TransformStreamErrorInternal","resolution","transformStreamController","TransformStreamEnqueueToReadable","transformer","transformPromise","TransformStreamReadableReadyPromise","TransformStreamSink","TransformStreamTransform","flushPromise","TransformStreamSource","TransformStreamDefaultController","IsTransformStream","IsTransformStreamDefaultController","TransformStreamCloseReadable","TransformStreamError","readableController","TransformStream","readableStrategy","writableStrategy","startPromise_resolve","startPromise","sink","isURLSupported","u","PolyfillURL","OriginalURL","relative","relativePathDotMapping","h","invalid","unicode","ALPHA","ALPHANUMERIC","errors","stateOverride","cursor","seenAt","seenBracket","input","err","isRelativeScheme","percentEscape","nextC","nextNextC","cp","tempC","IDNAToASCII","temp","parseInt","percentEscapeQuery","parse","JURL","authority","host","DEFAULT_RANGE_CHUNK_SIZE","isWorkerDisabled","fakeWorkerFilesLoader","useRequireEnsure","__non_webpack_require__","requirejs","fallbackWorkerSrc","dynamicLoaderSupported","worker","pdfjsFilePath","createPDFNetworkStream","isArrayBuffer","range","params","rangeTransport","pdfBytes","NativeImageDecoderValues","apiCompatibilityParams","setVerbosityLevel","workerParams","postMessageTransfers","workerPort","GlobalWorkerOptions","PDFWorker","docId","networkStream","initialData","disableRange","disableStream","httpHeaders","withCredentials","rangeChunkSize","messageHandler","transport","pdfDataRangeTransport","apiVersion","password","disableAutoFetch","maxImageSize","disableFontFace","disableCreateObjectURL","docBaseUrl","nativeImageDecoderSupport","ignoreErrors","isEvalSupported","PDFDocumentLoadingTask","nextDocumentId","destroy","transportDestroyed","constructor","addRangeListener","addProgressListener","addProgressiveReadListener","onDataRange","onDataProgress","onDataProgressiveRead","requestDataRange","getPage","getPageIndex","getDestination","PDFPageProxy","pdfBug","getViewport","rotate","dontFlip","viewBox","rotation","getAnnotations","intent","render","stats","renderingIntent","canvasFactory","webGLContext","enable","intentState","fnArray","argsArray","lastChunk","pageIndex","renderInteractiveForms","complete","internalRenderTask","renderTask","getOperatorList","opListTask","streamTextContent","TEXT_CONTENT_CHUNK_SIZE","normalizeWhitespace","combineTextItems","textContent","getTextContent","items","styles","_destroy","waitOn","renderCompleted","cleanup","resetStats","_tryCleanup","_startRenderPage","_renderPageChunk","operatorListChunk","postMessage","cloned","transferable","transfers","desc","cloneValue","addEventListener","removeEventListener","nextFakeWorkerId","fakeWorkerFilesLoadedCapability","mainWorkerMessageHandler","loader","pdfWorkerPorts","_initializeFromPort","_initialize","workerSrc","isSameOrigin","createCDNWrapper","terminateEarly","onWorkerError","sendTest","testObj","info","_setupFakeWorker","setupFakeWorkerGlobal","workerHandler","WorkerMessageHandler","loadingTask","isCompressed","page","terminated","loaded","evt","total","headersCapability","fullReader","isStreamingSupported","isRangeSupported","contentLength","rangeReader","pdfInfo","updatePassword","exception","exportedError","exportedData","fontRegistry","registerFont","onUnsupportedFeature","fontReady","pageProxy","img","MAX_IMAGE_SIZE_TO_STORE","imageData","components","width","height","rgbaLength","buf","tmpCanvas","tmpCtx","_onUnsupportedFeature","pageNumber","results","metadata","contentDispositionFilename","PDFObjects","ensureObj","resolved","isResolved","objs","hasData","getData","RenderTask","cancel","InternalRenderTask","canvasInRendering","initializeGraphics","viewport","background","operatorListChanged","_continue","_scheduleNext","_next","build","DEFAULT_LINK_REL","SVG_NS","canvas","reset","canvasAndContext","fetch","request","XMLHttpRequest","cMapData","compressionType","svg","createElement","offsetX","offsetY","centerX","centerY","rotateA","rotateB","rotateC","rotateD","offsetCanvasX","offsetCanvasY","clone","scale","convertToViewportPoint","convertToViewportRectangle","tl","br","convertToPdfPoint","RenderingCancelledException","LinkTarget","SELF","BLANK","PARENT","TOP","LinkTargetStringMap","link","removeNullCharacters","LinkTargetValues","targetIndex","anchor","query","time","Date","timeEnd","times","longest","span","duration","script","requests","nextRequestId","addNativeFontFace","insertRule","styleElement","styleSheet","bind","rules","fontsToLoad","fontLoadPromises","getNativeFontPromise","nativeFontFace","rule","_queueLoadingCallback","otherRequest","_prepareFontLoadEvent","FontLoader","chunk1","chunk2","called","isFontReady","loadTestFontId","COMMENT_OFFSET","spliceString","CFF_CHECKSUM_OFFSET","XXXX_VALUE","checksum","int32","string32","btoa","fonts","supported","shadow","getLoadTestFont","atob","IsEvalSupportedCached","translatedData","bytesToString","getPathGenerator","cmds","featureId","js","current","compatibilityParams","isIE","isIOSChrome","MIN_FONT_SIZE","MAX_FONT_SIZE","MAX_GROUP_SIZE","MIN_WIDTH_FACTOR","COMPILE_TYPE3_GLYPHS","MAX_SIZE_TO_COMPILE","FULL_CHUNK_HEIGHT","IsLittleEndianCached","ad_bc","bc_ad","old","prev","cosValue","sinValue","CachedCanvases","getCanvas","canvasEntry","addContextCurrentTransform","POINT_TO_PROCESS_LIMIT","imgData","width1","points","POINT_TYPES","lineSize","data0","mask","elem","count","j0","sum","steps","outlines","coords","p0","pp","drawOutline","o","jj","CanvasExtraState","setCurrentPoint","CanvasGraphics","EXECUTION_TIME","EXECUTION_STEPS","partialChunkHeight","fullChunks","totalChunks","chunkImgData","srcPos","srcLength","dest32","dest32DataLength","fullSrcDiff","white","black","thisChunkHeight","destPos","srcDiff","kEnd","kEndUnrolled","srcByte","elemsInThisChunk","properties","property","sourceCtx","destCtx","alpha","alpha_","r0","g0","b0","maskData","transferMap","layerData","y","hasBackdrop","backdrop","subtype","composeFn","PIXELS_TO_PROCESS","row","chunkHeight","maskCtx","layerCtx","composeSMaskBackdrop","composed","layer","genericComposeSMask","LINE_CAP_STYLES","LINE_JOIN_STYLES","NORMAL_CLIP","EO_CLIP","beginDrawing","transparentCanvas","resetCtxToDefault","executeOperatorList","operatorList","executionStartIdx","argsArrayLen","chunkOperations","endTime","commonObjs","stepper","fnId","deps","nn","depObjId","objsPool","endDrawing","states","beginSMaskGroup","activeSMask","drawnWidth","drawnHeight","cacheId","scratchCanvas","currentCtx","currentTransform","groupCtx","copyCtxState","suspendSMaskGroup","composeSMask","deltaTransform","resumeSMaskGroup","endSMaskGroup","ops","xw","yh","consumePath","strokeColor","fillColor","isPatternFill","needRestore","paths","path","fontObj","bold","italic","typeface","browserFontSize","paintChar","textRenderingMode","fontSize","fillStrokeMode","isAddToPathSet","patternFill","addToPath","enabled","fontSizeScale","charSpacing","wordSpacing","fontDirection","textHScale","glyphsLength","glyphs","vertical","spacingDir","defaultVMetrics","widthAdvanceScale","simpleFillText","pattern","patternTransform","lineWidth","glyph","isNum","restoreNeeded","spacing","character","accent","vmetric","vx","vy","scaledX","scaledY","measuredWidth","characterScaleX","scaledAccentX","scaledAccentY","charWidth","showType3Text","fontMatrix","isTextInvisible","spacingLength","transformed","urx","ury","getColorN_Pattern","IR","color","baseTransform","canvasGraphicsFactory","createCanvasGraphics","getShadingPatternFromIR","inv","bl","ul","ur","x0","y0","x1","y1","matrix","bbox","group","bounds","canvasBounds","scaleX","scaleY","startTransformInverse","domImage","position","left","top","maskCanvas","putBinaryImageMask","positions","images","image","map","widthScale","heightScale","imgToPaint","putBinaryImageData","paintWidth","paintHeight","tmpCanvasId","newWidth","newHeight","getSinglePixelWidth","inverse","getCanvasPosition","ShadingIRs","fromIR","raw","colorStops","r1","getPattern","grad","createMeshCanvas","colors","rowSize","c1","c2","c3","x2","y2","x3","y3","c1r","c1g","c1b","c2r","c2g","c2b","c3r","c3g","c3b","minY","maxY","xa","car","cag","cab","xb","cbr","cbg","cbb","x1_","x2_","ps","figure","cs","verticesPerRow","rows","cols","q","drawTriangle","EXPECTED_SCALE","MAX_PATTERN_SIZE","BORDER_SIZE","boundsWidth","boundsHeight","combinesScale","paddedWidth","paddedHeight","cachedCanvases","backgroundColor","figures","drawFigure","owner","matrixScale","temporaryPatternCanvas","shadingIR","TilingPattern","PaintType","COLORED","UNCOLORED","createPatternCanvas","xstep","ystep","paintType","tilingType","topLeft","botRight","curMatrixScale","combinedScale","graphics","tmpTranslate","setScale","transformToScale","tmpScale","scaleToContext","clipBbox","bboxWidth","bboxHeight","setFillAndStrokeStyleToContext","cssColor","thisArg","callbacksCapabilities","ah","callbackId","callback","wrapReason","sourceName","targetName","comObj","isReply","makeReasonSerializable","MessageHandler","on","send","sendWithPromise","sendWithStream","streamId","startCapability","startCall","isClosed","pullCapability","cancelCapability","_createStreamSink","sendStreamRequest","streamSink","enqueue","lastDesiredSize","close","sinkCapability","onPull","onCancel","isCancelled","resolveCall","success","_processStreamMessage","sendStreamResponse","deleteStreamController","resolveOrReject","g","hadRuntime","oldRuntime","Op","hasOwn","iteratorSymbol","asyncIteratorSymbol","toStringTagSymbol","inModule","runtime","protoGenerator","outerFn","generator","tryLocsList","makeInvokeMethod","arg","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","getProto","NativeIteratorPrototype","Gp","GeneratorFunctionPrototype","Generator","GeneratorFunction","prototype","genFun","__await","record","tryCatch","previousPromise","defineIteratorMethods","AsyncIterator","delegate","delegateResult","maybeInvokeDelegate","tryLoc","locs","iteratorMethod","Context","stop","rootEntry","rootRecord","dispatchException","handle","hasCatch","hasFinally","abrupt","finallyEntry","finish","resetTryEntry","thrown","delegateYield","resultName","nextLoc","parser","xmlDocument","_repair","chars","_parse","rdf","nodeName","children","XMLParserErrorCode","NoError","EndOfDocument","UnterminatedCdat","UnterminatedXmlDeclaration","UnterminatedDoctypeDeclaration","UnterminatedComment","MalformedElement","OutOfMemory","UnterminatedAttributeValue","UnterminatedElement","ElementNeverBegun","isWhitespace","_resolveEntities","entity","_parseContent","attributes","attrName","attrValue","attrEndChar","attrEndIndex","parsed","_parseProcessingInstruction","attrStart","parseXml","ch2","pi","q2","complexDoctype","doctypeContent","content","text","onResolveEntity","onPi","onComment","onCdata","onDoctype","onText","onBeginElement","onEndElement","onError","child","parseFromString","isWhitespaceString","lastElement","PDFDataTransportStream","_onReceiveData","found","_onProgress","firstReader","_removeRangeReader","getFullReader","queuedChunks","getRangeReader","cancelAllRequests","readers","PDFDataTransportStreamReader","_enqueue","requestCapability","PDFDataTransportStreamRangeReader","requestsCapability","WebGLUtils","drawFigures","shader","gl","compiled","errorMsg","loadShader","program","shaders","linked","texture","currentCanvas","currentGL","premultipliedalpha","smaskVertexShaderCode","smaskFragmentShaderCode","smaskCache","vertexShader","createVertexShader","fragmentShader","createFragmentShader","cache","texCoordLocation","texLayerLocation","texMaskLocation","texCoordBuffer","createTexture","maskTexture","figuresVertexShaderCode","figuresFragmentShaderCode","figuresCache","coordsMap","colorsMap","pIndex","cIndex","col","coordsBuffer","colorsBuffer","tryInitGL","renderTextLayer","MAX_TEXT_DIVS_TO_RENDER","NonWhitespaceRegexp","styleBuf","textDiv","textDivProperties","style","angle","canvasWidth","originalTransform","paddingBottom","paddingLeft","paddingRight","paddingTop","isAllWhitespace","geom","tx","fontHeight","fontAscent","angleCos","angleSin","divWidth","divHeight","right","bottom","textDivs","textDivsLength","expanded","expandBounds","divProperties","ts","t","findPositiveMin","boxScale","box","x1New","x2New","expandBoundsLTR","boxes","fakeBoundary","horizon","boundary","maxXNew","horizonPart","affectedBoundary","xNew","changedHorizon","lastBoundary","useBoundary","used","textContentItemsStr","TextLayerRenderTask","clearTimeout","_processItems","len","appendText","_layoutText","textLayerFrag","fontFamily","_render","styleCache","textItems","textStyles","pump","expandTextDivs","expand","padding","renderParameters","textContentStream","enhanceTextSelection","parameters","fieldType","isRenderable","ignoreBorder","_createContainer","horizontalRadius","verticalRadius","radius","_createPopup","trigger","popupElement","title","contents","hideWrapper","popup","addLinkAttributes","linkService","rel","_bindLink","_bindNamedAction","JSON","TEXT_ALIGNMENT","element","fieldWidth","combWidth","_setTextStyle","fallbackName","selectElement","option","optionElement","IGNORE_TYPES","selector","parentElement","parentLeft","parseFloat","parentWidth","BACKGROUND_ENLIGHT","_formatContents","lines","line","pin","_show","unpin","_hide","borderWidth","square","circle","vertices","polyline","inkLists","inkList","getFilenameFromUrl","stringToPDFString","downloadManager","imageResourcesPath","svgFactory","SVGGraphics","SVG_DEFAULTS","fontStyle","fontWeight","convertImgDataToPng","PNG_HEADER","CHUNK_WRAPPER_SIZE","crcTable","crc","body","crc32","deflateSyncUncompressed","output","level","literals","maxBlockLength","deflateBlocks","idat","adler","adler32","colorType","bitDepth","offsetLiterals","offsetBytes","ihdr","deflateSync","pngLength","writePngChunk","encode","SVGExtraState","opTree","opListLen","opList","pf","XML_NS","XLINK_NS","clipCount","maskCount","loadDependencies","fnArrayLen","transformMatrix","getSVG","svgElement","convertOpList","REVOPS","opListToTree","executeOpTree","opTreeLen","textMatrix","pm","addFontStyle","details","setStrokeAlpha","setFillAlpha","opLength","clipId","clipPath","clipElement","_setStrokeAttributes","imgObj","imgEl","imgSrc","cliprect","definitions","rootGroup","_ensureClipGroup","clipGroup","_ensureTransformGroup","fs","http","https","fileUriRegex","parsedUrl","parseUrl","_error","_setReadableStream","protocol","auth","handleResponse","response","getResponseHeader","isHttp","suggestedLength","extractFilenameFromHeader","createRequestOptions","returnValues","allowRangeRequests","contentEncoding","contentDisposition","filename","getFilenameFromContentDispositionHeader","status","needsEncodingFixup","toParamRegExp","rfc2616unquote","rfc5987decode","rfc2047decode","fixupEncoding","rfc2231getparam","decoder","fatal","textdecode","matches","parts","part","quotindex","encodingend","extvalue","encoding","langvalue","signal","abortController","credentials","redirect","createFetchOptions","validateResponseStatus","createResponseStatusError","rangeStr","begin","OK_RESPONSE","PARTIAL_CONTENT_RESPONSE","xhr","array","supportsMozChunked","NetworkManager","requestRange","listeners","requestFull","xhrId","pendingRequest","useMozChunkedLoading","onProgress","getArrayBuffer","onStateChange","xhrStatus","ok_response_on_range_request","rangeHeader","hasPendingRequests","getRequestXhr","isStreamingRequest","isPendingRequest","isLoadedRequest","abortAllRequests","_onRangeRequestReaderClosed","onHeadersReceived","onProgressiveData","onDone","manager","PDFNetworkStreamFullRequestReader","_onHeadersReceived","fullRequestXhrId","fullRequestXhr","networkManager","_onProgressiveData","_onDone","_onError","PDFNetworkStreamRangeRequestReader","_close"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;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BsM,sBAAhB;AAAA,eAvCkC;;AAAA;AAAA,mBAyCvC,KAAJ,KAzC2C;AAAA;AAAA;AAAA;;AAAA,gDA0ClC;AAAEtM,uBAAF;AAAoBsM,sBAApB;AAAA,eA1CkC;;AAAA;AA4CvCg5C,+BA5CuC,GAmChC,oCAnCgC;;AA6C3C,kCAVW,iBAUX;AA7C2C,gDA8CpCA,kBAXI,OAnCgC;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAiD7CxkB,UAAQ,2DAA2D;AACjE,iBADiE,IACjE;AACA,2BAAuB,6BAA6B;AAClDwkB,gCAA0B;AAAEtlD,eAAF;AAAoBsM,cAApB;AAAA,OAA1Bg5C;AAH+D,KAEjE;AAGA,qBALiE,EAKjE;AACA,QAAI,+BAA+B,KAAnC,UAAI,CAAJ,EAAqD;AACnD,iCAA2B,KADwB,UACnD;AAP+D;AASjE,SATiE,MASjE;AA1D2C;AAAA,CAA/CoU;QA8DA,gB,GAAA,gB;QAAA,c,GAAA,c","file":"pdf.js","sourcesContent":["(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\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"pdfjs-dist/build/pdf\"] = factory();\n\telse\n\t\troot[\"pdfjs-dist/build/pdf\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __w_pdfjs_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__w_pdfjs_require__.m = modules;\n\n \t// expose the module cache\n \t__w_pdfjs_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__w_pdfjs_require__.d = function(exports, name, getter) {\n \t\tif(!__w_pdfjs_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__w_pdfjs_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__w_pdfjs_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __w_pdfjs_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__w_pdfjs_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__w_pdfjs_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__w_pdfjs_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__w_pdfjs_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __w_pdfjs_require__(__w_pdfjs_require__.s = 0);\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint-disable no-unused-vars, no-restricted-globals */\n\n'use strict';\n\nvar pdfjsVersion =\n typeof PDFJSDev !== 'undefined' ? PDFJSDev.eval('BUNDLE_VERSION') : void 0;\nvar pdfjsBuild =\n typeof PDFJSDev !== 'undefined' ? PDFJSDev.eval('BUNDLE_BUILD') : void 0;\n\nvar pdfjsSharedUtil = require('./shared/util.js');\nvar pdfjsDisplayAPI = require('./display/api.js');\nvar pdfjsDisplayTextLayer = require('./display/text_layer.js');\nvar pdfjsDisplayAnnotationLayer = require('./display/annotation_layer.js');\nvar pdfjsDisplayDOMUtils = require('./display/dom_utils.js');\nvar pdfjsDisplaySVG = require('./display/svg.js');\nlet pdfjsDisplayWorkerOptions = require('./display/worker_options.js');\nlet pdfjsDisplayAPICompatibility = require('./display/api_compatibility.js');\n\nif (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n const isNodeJS = require('./shared/is_node.js');\n if (isNodeJS()) {\n let PDFNodeStream = require('./display/node_stream.js').PDFNodeStream;\n pdfjsDisplayAPI.setPDFNetworkStreamFactory((params) => {\n return new PDFNodeStream(params);\n });\n } else if (typeof Response !== 'undefined' && 'body' in Response.prototype &&\n typeof ReadableStream !== 'undefined') {\n let PDFFetchStream = require('./display/fetch_stream.js').PDFFetchStream;\n pdfjsDisplayAPI.setPDFNetworkStreamFactory((params) => {\n return new PDFFetchStream(params);\n });\n } else {\n let PDFNetworkStream = require('./display/network.js').PDFNetworkStream;\n pdfjsDisplayAPI.setPDFNetworkStreamFactory((params) => {\n return new PDFNetworkStream(params);\n });\n }\n} else if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {\n let PDFNetworkStream = require('./display/network.js').PDFNetworkStream;\n let PDFFetchStream;\n let isChromeWithFetchCredentials = function() {\n // fetch does not include credentials until Chrome 61.0.3138.0 and later.\n // https://chromium.googlesource.com/chromium/src/+/2e231cf052ca5e68e22baf0008ac9e5e29121707\n try {\n // Indexed properties on window are read-only in Chrome 61.0.3151.0+\n // https://chromium.googlesource.com/chromium/src.git/+/58ab4a971b06dec13e4edf9de8382ca6847f6190\n window[999] = 123; // should throw. Note: JS strict mode MUST be enabled.\n delete window[999];\n return false;\n } catch (e) {\n return true;\n }\n };\n if (typeof Response !== 'undefined' && 'body' in Response.prototype &&\n typeof ReadableStream !== 'undefined' && isChromeWithFetchCredentials()) {\n PDFFetchStream = require('./display/fetch_stream.js').PDFFetchStream;\n }\n pdfjsDisplayAPI.setPDFNetworkStreamFactory((params) => {\n if (PDFFetchStream && /^https?:/i.test(params.url)) {\n // \"fetch\" is only supported for http(s), not file/ftp.\n return new PDFFetchStream(params);\n }\n return new PDFNetworkStream(params);\n });\n}\n\nexports.build = pdfjsDisplayAPI.build;\nexports.version = pdfjsDisplayAPI.version;\nexports.getDocument = pdfjsDisplayAPI.getDocument;\nexports.LoopbackPort = pdfjsDisplayAPI.LoopbackPort;\nexports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport;\nexports.PDFWorker = pdfjsDisplayAPI.PDFWorker;\nexports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer;\nexports.AnnotationLayer = pdfjsDisplayAnnotationLayer.AnnotationLayer;\nexports.createPromiseCapability = pdfjsSharedUtil.createPromiseCapability;\nexports.PasswordResponses = pdfjsSharedUtil.PasswordResponses;\nexports.InvalidPDFException = pdfjsSharedUtil.InvalidPDFException;\nexports.MissingPDFException = pdfjsSharedUtil.MissingPDFException;\nexports.SVGGraphics = pdfjsDisplaySVG.SVGGraphics;\nexports.NativeImageDecoding = pdfjsSharedUtil.NativeImageDecoding;\nexports.CMapCompressionType = pdfjsSharedUtil.CMapCompressionType;\nexports.PermissionFlag = pdfjsSharedUtil.PermissionFlag;\nexports.UnexpectedResponseException =\n pdfjsSharedUtil.UnexpectedResponseException;\nexports.OPS = pdfjsSharedUtil.OPS;\nexports.VerbosityLevel = pdfjsSharedUtil.VerbosityLevel;\nexports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES;\nexports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl;\nexports.createObjectURL = pdfjsSharedUtil.createObjectURL;\nexports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters;\nexports.shadow = pdfjsSharedUtil.shadow;\nexports.Util = pdfjsSharedUtil.Util;\nexports.ReadableStream = pdfjsSharedUtil.ReadableStream;\nexports.URL = pdfjsSharedUtil.URL;\nexports.RenderingCancelledException =\n pdfjsDisplayDOMUtils.RenderingCancelledException;\nexports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl;\nexports.LinkTarget = pdfjsDisplayDOMUtils.LinkTarget;\nexports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes;\nexports.loadScript = pdfjsDisplayDOMUtils.loadScript;\nexports.GlobalWorkerOptions = pdfjsDisplayWorkerOptions.GlobalWorkerOptions;\nexports.apiCompatibilityParams =\n pdfjsDisplayAPICompatibility.apiCompatibilityParams;\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport './compatibility';\nimport { ReadableStream } from './streams_polyfill';\nimport { URL } from './url_polyfill';\n\nconst IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];\nconst FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];\n\nconst NativeImageDecoding = {\n NONE: 'none',\n DECODE: 'decode',\n DISPLAY: 'display',\n};\n\n// Permission flags from Table 22, Section 7.6.3.2 of the PDF specification.\nconst PermissionFlag = {\n PRINT: 0x04,\n MODIFY_CONTENTS: 0x08,\n COPY: 0x10,\n MODIFY_ANNOTATIONS: 0x20,\n FILL_INTERACTIVE_FORMS: 0x100,\n COPY_FOR_ACCESSIBILITY: 0x200,\n ASSEMBLE: 0x400,\n PRINT_HIGH_QUALITY: 0x800,\n};\n\nconst TextRenderingMode = {\n FILL: 0,\n STROKE: 1,\n FILL_STROKE: 2,\n INVISIBLE: 3,\n FILL_ADD_TO_PATH: 4,\n STROKE_ADD_TO_PATH: 5,\n FILL_STROKE_ADD_TO_PATH: 6,\n ADD_TO_PATH: 7,\n FILL_STROKE_MASK: 3,\n ADD_TO_PATH_FLAG: 4,\n};\n\nconst ImageKind = {\n GRAYSCALE_1BPP: 1,\n RGB_24BPP: 2,\n RGBA_32BPP: 3,\n};\n\nconst AnnotationType = {\n TEXT: 1,\n LINK: 2,\n FREETEXT: 3,\n LINE: 4,\n SQUARE: 5,\n CIRCLE: 6,\n POLYGON: 7,\n POLYLINE: 8,\n HIGHLIGHT: 9,\n UNDERLINE: 10,\n SQUIGGLY: 11,\n STRIKEOUT: 12,\n STAMP: 13,\n CARET: 14,\n INK: 15,\n POPUP: 16,\n FILEATTACHMENT: 17,\n SOUND: 18,\n MOVIE: 19,\n WIDGET: 20,\n SCREEN: 21,\n PRINTERMARK: 22,\n TRAPNET: 23,\n WATERMARK: 24,\n THREED: 25,\n REDACT: 26,\n};\n\nconst AnnotationFlag = {\n INVISIBLE: 0x01,\n HIDDEN: 0x02,\n PRINT: 0x04,\n NOZOOM: 0x08,\n NOROTATE: 0x10,\n NOVIEW: 0x20,\n READONLY: 0x40,\n LOCKED: 0x80,\n TOGGLENOVIEW: 0x100,\n LOCKEDCONTENTS: 0x200,\n};\n\nconst AnnotationFieldFlag = {\n READONLY: 0x0000001,\n REQUIRED: 0x0000002,\n NOEXPORT: 0x0000004,\n MULTILINE: 0x0001000,\n PASSWORD: 0x0002000,\n NOTOGGLETOOFF: 0x0004000,\n RADIO: 0x0008000,\n PUSHBUTTON: 0x0010000,\n COMBO: 0x0020000,\n EDIT: 0x0040000,\n SORT: 0x0080000,\n FILESELECT: 0x0100000,\n MULTISELECT: 0x0200000,\n DONOTSPELLCHECK: 0x0400000,\n DONOTSCROLL: 0x0800000,\n COMB: 0x1000000,\n RICHTEXT: 0x2000000,\n RADIOSINUNISON: 0x2000000,\n COMMITONSELCHANGE: 0x4000000,\n};\n\nconst AnnotationBorderStyleType = {\n SOLID: 1,\n DASHED: 2,\n BEVELED: 3,\n INSET: 4,\n UNDERLINE: 5,\n};\n\nconst StreamType = {\n UNKNOWN: 0,\n FLATE: 1,\n LZW: 2,\n DCT: 3,\n JPX: 4,\n JBIG: 5,\n A85: 6,\n AHX: 7,\n CCF: 8,\n RL: 9,\n};\n\nconst FontType = {\n UNKNOWN: 0,\n TYPE1: 1,\n TYPE1C: 2,\n CIDFONTTYPE0: 3,\n CIDFONTTYPE0C: 4,\n TRUETYPE: 5,\n CIDFONTTYPE2: 6,\n TYPE3: 7,\n OPENTYPE: 8,\n TYPE0: 9,\n MMTYPE1: 10,\n};\n\nconst VerbosityLevel = {\n ERRORS: 0,\n WARNINGS: 1,\n INFOS: 5,\n};\n\nconst CMapCompressionType = {\n NONE: 0,\n BINARY: 1,\n STREAM: 2,\n};\n\n// All the possible operations for an operator list.\nconst OPS = {\n // Intentionally start from 1 so it is easy to spot bad operators that will be\n // 0's.\n dependency: 1,\n setLineWidth: 2,\n setLineCap: 3,\n setLineJoin: 4,\n setMiterLimit: 5,\n setDash: 6,\n setRenderingIntent: 7,\n setFlatness: 8,\n setGState: 9,\n save: 10,\n restore: 11,\n transform: 12,\n moveTo: 13,\n lineTo: 14,\n curveTo: 15,\n curveTo2: 16,\n curveTo3: 17,\n closePath: 18,\n rectangle: 19,\n stroke: 20,\n closeStroke: 21,\n fill: 22,\n eoFill: 23,\n fillStroke: 24,\n eoFillStroke: 25,\n closeFillStroke: 26,\n closeEOFillStroke: 27,\n endPath: 28,\n clip: 29,\n eoClip: 30,\n beginText: 31,\n endText: 32,\n setCharSpacing: 33,\n setWordSpacing: 34,\n setHScale: 35,\n setLeading: 36,\n setFont: 37,\n setTextRenderingMode: 38,\n setTextRise: 39,\n moveText: 40,\n setLeadingMoveText: 41,\n setTextMatrix: 42,\n nextLine: 43,\n showText: 44,\n showSpacedText: 45,\n nextLineShowText: 46,\n nextLineSetSpacingShowText: 47,\n setCharWidth: 48,\n setCharWidthAndBounds: 49,\n setStrokeColorSpace: 50,\n setFillColorSpace: 51,\n setStrokeColor: 52,\n setStrokeColorN: 53,\n setFillColor: 54,\n setFillColorN: 55,\n setStrokeGray: 56,\n setFillGray: 57,\n setStrokeRGBColor: 58,\n setFillRGBColor: 59,\n setStrokeCMYKColor: 60,\n setFillCMYKColor: 61,\n shadingFill: 62,\n beginInlineImage: 63,\n beginImageData: 64,\n endInlineImage: 65,\n paintXObject: 66,\n markPoint: 67,\n markPointProps: 68,\n beginMarkedContent: 69,\n beginMarkedContentProps: 70,\n endMarkedContent: 71,\n beginCompat: 72,\n endCompat: 73,\n paintFormXObjectBegin: 74,\n paintFormXObjectEnd: 75,\n beginGroup: 76,\n endGroup: 77,\n beginAnnotations: 78,\n endAnnotations: 79,\n beginAnnotation: 80,\n endAnnotation: 81,\n paintJpegXObject: 82,\n paintImageMaskXObject: 83,\n paintImageMaskXObjectGroup: 84,\n paintImageXObject: 85,\n paintInlineImageXObject: 86,\n paintInlineImageXObjectGroup: 87,\n paintImageXObjectRepeat: 88,\n paintImageMaskXObjectRepeat: 89,\n paintSolidColorImageMask: 90,\n constructPath: 91,\n};\n\nconst UNSUPPORTED_FEATURES = {\n unknown: 'unknown',\n forms: 'forms',\n javaScript: 'javaScript',\n smask: 'smask',\n shadingPattern: 'shadingPattern',\n font: 'font',\n};\n\nconst PasswordResponses = {\n NEED_PASSWORD: 1,\n INCORRECT_PASSWORD: 2,\n};\n\nlet verbosity = VerbosityLevel.WARNINGS;\n\nfunction setVerbosityLevel(level) {\n if (Number.isInteger(level)) {\n verbosity = level;\n }\n}\n\nfunction getVerbosityLevel() {\n return verbosity;\n}\n\n// A notice for devs. These are good for things that are helpful to devs, such\n// as warning that Workers were disabled, which is important to devs but not\n// end users.\nfunction info(msg) {\n if (verbosity >= VerbosityLevel.INFOS) {\n console.log('Info: ' + msg);\n }\n}\n\n// Non-fatal warnings.\nfunction warn(msg) {\n if (verbosity >= VerbosityLevel.WARNINGS) {\n console.log('Warning: ' + msg);\n }\n}\n\n// Deprecated API function -- display regardless of the `verbosity` setting.\nfunction deprecated(details) {\n console.log('Deprecated API usage: ' + details);\n}\n\nfunction unreachable(msg) {\n throw new Error(msg);\n}\n\nfunction assert(cond, msg) {\n if (!cond) {\n unreachable(msg);\n }\n}\n\n// Checks if URLs have the same origin. For non-HTTP based URLs, returns false.\nfunction isSameOrigin(baseUrl, otherUrl) {\n try {\n var base = new URL(baseUrl);\n if (!base.origin || base.origin === 'null') {\n return false; // non-HTTP url\n }\n } catch (e) {\n return false;\n }\n\n var other = new URL(otherUrl, base);\n return base.origin === other.origin;\n}\n\n// Checks if URLs use one of the whitelisted protocols, e.g. to avoid XSS.\nfunction _isValidProtocol(url) {\n if (!url) {\n return false;\n }\n switch (url.protocol) {\n case 'http:':\n case 'https:':\n case 'ftp:':\n case 'mailto:':\n case 'tel:':\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Attempts to create a valid absolute URL.\n *\n * @param {URL|string} url - An absolute, or relative, URL.\n * @param {URL|string} baseUrl - An absolute URL.\n * @returns Either a valid {URL}, or `null` otherwise.\n */\nfunction createValidAbsoluteUrl(url, baseUrl) {\n if (!url) {\n return null;\n }\n try {\n var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);\n if (_isValidProtocol(absoluteUrl)) {\n return absoluteUrl;\n }\n } catch (ex) { /* `new URL()` will throw on incorrect data. */ }\n return null;\n}\n\nfunction shadow(obj, prop, value) {\n Object.defineProperty(obj, prop, { value,\n enumerable: true,\n configurable: true,\n writable: false, });\n return value;\n}\n\nfunction getLookupTableFactory(initializer) {\n var lookup;\n return function () {\n if (initializer) {\n lookup = Object.create(null);\n initializer(lookup);\n initializer = null;\n }\n return lookup;\n };\n}\n\nvar PasswordException = (function PasswordExceptionClosure() {\n function PasswordException(msg, code) {\n this.name = 'PasswordException';\n this.message = msg;\n this.code = code;\n }\n\n PasswordException.prototype = new Error();\n PasswordException.constructor = PasswordException;\n\n return PasswordException;\n})();\n\nvar UnknownErrorException = (function UnknownErrorExceptionClosure() {\n function UnknownErrorException(msg, details) {\n this.name = 'UnknownErrorException';\n this.message = msg;\n this.details = details;\n }\n\n UnknownErrorException.prototype = new Error();\n UnknownErrorException.constructor = UnknownErrorException;\n\n return UnknownErrorException;\n})();\n\nvar InvalidPDFException = (function InvalidPDFExceptionClosure() {\n function InvalidPDFException(msg) {\n this.name = 'InvalidPDFException';\n this.message = msg;\n }\n\n InvalidPDFException.prototype = new Error();\n InvalidPDFException.constructor = InvalidPDFException;\n\n return InvalidPDFException;\n})();\n\nvar MissingPDFException = (function MissingPDFExceptionClosure() {\n function MissingPDFException(msg) {\n this.name = 'MissingPDFException';\n this.message = msg;\n }\n\n MissingPDFException.prototype = new Error();\n MissingPDFException.constructor = MissingPDFException;\n\n return MissingPDFException;\n})();\n\nvar UnexpectedResponseException =\n (function UnexpectedResponseExceptionClosure() {\n function UnexpectedResponseException(msg, status) {\n this.name = 'UnexpectedResponseException';\n this.message = msg;\n this.status = status;\n }\n\n UnexpectedResponseException.prototype = new Error();\n UnexpectedResponseException.constructor = UnexpectedResponseException;\n\n return UnexpectedResponseException;\n})();\n\nvar MissingDataException = (function MissingDataExceptionClosure() {\n function MissingDataException(begin, end) {\n this.begin = begin;\n this.end = end;\n this.message = 'Missing data [' + begin + ', ' + end + ')';\n }\n\n MissingDataException.prototype = new Error();\n MissingDataException.prototype.name = 'MissingDataException';\n MissingDataException.constructor = MissingDataException;\n\n return MissingDataException;\n})();\n\nvar XRefParseException = (function XRefParseExceptionClosure() {\n function XRefParseException(msg) {\n this.message = msg;\n }\n\n XRefParseException.prototype = new Error();\n XRefParseException.prototype.name = 'XRefParseException';\n XRefParseException.constructor = XRefParseException;\n\n return XRefParseException;\n})();\n\n/**\n * Error caused during parsing PDF data.\n */\nlet FormatError = (function FormatErrorClosure() {\n function FormatError(msg) {\n this.message = msg;\n }\n\n FormatError.prototype = new Error();\n FormatError.prototype.name = 'FormatError';\n FormatError.constructor = FormatError;\n\n return FormatError;\n})();\n\n/**\n * Error used to indicate task cancellation.\n */\nlet AbortException = (function AbortExceptionClosure() {\n function AbortException(msg) {\n this.name = 'AbortException';\n this.message = msg;\n }\n\n AbortException.prototype = new Error();\n AbortException.constructor = AbortException;\n\n return AbortException;\n})();\n\nvar NullCharactersRegExp = /\\x00/g;\n\nfunction removeNullCharacters(str) {\n if (typeof str !== 'string') {\n warn('The argument for removeNullCharacters must be a string.');\n return str;\n }\n return str.replace(NullCharactersRegExp, '');\n}\n\nfunction bytesToString(bytes) {\n assert(bytes !== null && typeof bytes === 'object' &&\n bytes.length !== undefined, 'Invalid argument for bytesToString');\n var length = bytes.length;\n var MAX_ARGUMENT_COUNT = 8192;\n if (length < MAX_ARGUMENT_COUNT) {\n return String.fromCharCode.apply(null, bytes);\n }\n var strBuf = [];\n for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {\n var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);\n var chunk = bytes.subarray(i, chunkEnd);\n strBuf.push(String.fromCharCode.apply(null, chunk));\n }\n return strBuf.join('');\n}\n\nfunction stringToBytes(str) {\n assert(typeof str === 'string', 'Invalid argument for stringToBytes');\n var length = str.length;\n var bytes = new Uint8Array(length);\n for (var i = 0; i < length; ++i) {\n bytes[i] = str.charCodeAt(i) & 0xFF;\n }\n return bytes;\n}\n\n/**\n * Gets length of the array (Array, Uint8Array, or string) in bytes.\n * @param {Array|Uint8Array|string} arr\n * @returns {number}\n */\nfunction arrayByteLength(arr) {\n if (arr.length !== undefined) {\n return arr.length;\n }\n assert(arr.byteLength !== undefined);\n return arr.byteLength;\n}\n\n/**\n * Combines array items (arrays) into single Uint8Array object.\n * @param {Array} arr - the array of the arrays (Array, Uint8Array, or string).\n * @returns {Uint8Array}\n */\nfunction arraysToBytes(arr) {\n // Shortcut: if first and only item is Uint8Array, return it.\n if (arr.length === 1 && (arr[0] instanceof Uint8Array)) {\n return arr[0];\n }\n var resultLength = 0;\n var i, ii = arr.length;\n var item, itemLength;\n for (i = 0; i < ii; i++) {\n item = arr[i];\n itemLength = arrayByteLength(item);\n resultLength += itemLength;\n }\n var pos = 0;\n var data = new Uint8Array(resultLength);\n for (i = 0; i < ii; i++) {\n item = arr[i];\n if (!(item instanceof Uint8Array)) {\n if (typeof item === 'string') {\n item = stringToBytes(item);\n } else {\n item = new Uint8Array(item);\n }\n }\n itemLength = item.byteLength;\n data.set(item, pos);\n pos += itemLength;\n }\n return data;\n}\n\nfunction string32(value) {\n return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff,\n (value >> 8) & 0xff, value & 0xff);\n}\n\n// Calculate the base 2 logarithm of the number `x`. This differs from the\n// native function in the sense that it returns the ceiling value and that it\n// returns 0 instead of `Infinity`/`NaN` for `x` values smaller than/equal to 0.\nfunction log2(x) {\n if (x <= 0) {\n return 0;\n }\n return Math.ceil(Math.log2(x));\n}\n\nfunction readInt8(data, start) {\n return (data[start] << 24) >> 24;\n}\n\nfunction readUint16(data, offset) {\n return (data[offset] << 8) | data[offset + 1];\n}\n\nfunction readUint32(data, offset) {\n return ((data[offset] << 24) | (data[offset + 1] << 16) |\n (data[offset + 2] << 8) | data[offset + 3]) >>> 0;\n}\n\n// Lazy test the endianness of the platform\n// NOTE: This will be 'true' for simulated TypedArrays\nfunction isLittleEndian() {\n var buffer8 = new Uint8Array(4);\n buffer8[0] = 1;\n var view32 = new Uint32Array(buffer8.buffer, 0, 1);\n return (view32[0] === 1);\n}\n\n// Checks if it's possible to eval JS expressions.\nfunction isEvalSupported() {\n try {\n new Function(''); // eslint-disable-line no-new, no-new-func\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Get the value of an inheritable property.\n *\n * If the PDF specification explicitly lists a property in a dictionary as\n * inheritable, then the value of the property may be present in the dictionary\n * itself or in one or more parents of the dictionary.\n *\n * If the key is not found in the tree, `undefined` is returned. Otherwise,\n * the value for the key is returned or, if `stopWhenFound` is `false`, a list\n * of values is returned. To avoid infinite loops, the traversal is stopped when\n * the loop limit is reached.\n *\n * @param {Dict} dict - Dictionary from where to start the traversal.\n * @param {string} key - The key of the property to find the value for.\n * @param {boolean} getArray - Whether or not the value should be fetched as an\n * array. The default value is `false`.\n * @param {boolean} stopWhenFound - Whether or not to stop the traversal when\n * the key is found. If set to `false`, we always walk up the entire parent\n * chain, for example to be able to find `\\Resources` placed on multiple\n * levels of the tree. The default value is `true`.\n */\nfunction getInheritableProperty({ dict, key, getArray = false,\n stopWhenFound = true, }) {\n const LOOP_LIMIT = 100;\n let loopCount = 0;\n let values;\n\n while (dict) {\n const value = getArray ? dict.getArray(key) : dict.get(key);\n if (value !== undefined) {\n if (stopWhenFound) {\n return value;\n }\n if (!values) {\n values = [];\n }\n values.push(value);\n }\n if (++loopCount > LOOP_LIMIT) {\n warn(`getInheritableProperty: maximum loop count exceeded for \"${key}\"`);\n break;\n }\n dict = dict.get('Parent');\n }\n return values;\n}\n\nvar Util = (function UtilClosure() {\n function Util() {}\n\n var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];\n\n // makeCssRgb() can be called thousands of times. Using |rgbBuf| avoids\n // creating many intermediate strings.\n Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {\n rgbBuf[1] = r;\n rgbBuf[3] = g;\n rgbBuf[5] = b;\n return rgbBuf.join('');\n };\n\n // Concatenates two transformation matrices together and returns the result.\n Util.transform = function Util_transform(m1, m2) {\n return [\n m1[0] * m2[0] + m1[2] * m2[1],\n m1[1] * m2[0] + m1[3] * m2[1],\n m1[0] * m2[2] + m1[2] * m2[3],\n m1[1] * m2[2] + m1[3] * m2[3],\n m1[0] * m2[4] + m1[2] * m2[5] + m1[4],\n m1[1] * m2[4] + m1[3] * m2[5] + m1[5]\n ];\n };\n\n // For 2d affine transforms\n Util.applyTransform = function Util_applyTransform(p, m) {\n var xt = p[0] * m[0] + p[1] * m[2] + m[4];\n var yt = p[0] * m[1] + p[1] * m[3] + m[5];\n return [xt, yt];\n };\n\n Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {\n var d = m[0] * m[3] - m[1] * m[2];\n var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;\n var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;\n return [xt, yt];\n };\n\n // Applies the transform to the rectangle and finds the minimum axially\n // aligned bounding box.\n Util.getAxialAlignedBoundingBox =\n function Util_getAxialAlignedBoundingBox(r, m) {\n\n var p1 = Util.applyTransform(r, m);\n var p2 = Util.applyTransform(r.slice(2, 4), m);\n var p3 = Util.applyTransform([r[0], r[3]], m);\n var p4 = Util.applyTransform([r[2], r[1]], m);\n return [\n Math.min(p1[0], p2[0], p3[0], p4[0]),\n Math.min(p1[1], p2[1], p3[1], p4[1]),\n Math.max(p1[0], p2[0], p3[0], p4[0]),\n Math.max(p1[1], p2[1], p3[1], p4[1])\n ];\n };\n\n Util.inverseTransform = function Util_inverseTransform(m) {\n var d = m[0] * m[3] - m[1] * m[2];\n return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d,\n (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];\n };\n\n // Apply a generic 3d matrix M on a 3-vector v:\n // | a b c | | X |\n // | d e f | x | Y |\n // | g h i | | Z |\n // M is assumed to be serialized as [a,b,c,d,e,f,g,h,i],\n // with v as [X,Y,Z]\n Util.apply3dTransform = function Util_apply3dTransform(m, v) {\n return [\n m[0] * v[0] + m[1] * v[1] + m[2] * v[2],\n m[3] * v[0] + m[4] * v[1] + m[5] * v[2],\n m[6] * v[0] + m[7] * v[1] + m[8] * v[2]\n ];\n };\n\n // This calculation uses Singular Value Decomposition.\n // The SVD can be represented with formula A = USV. We are interested in the\n // matrix S here because it represents the scale values.\n Util.singularValueDecompose2dScale =\n function Util_singularValueDecompose2dScale(m) {\n\n var transpose = [m[0], m[2], m[1], m[3]];\n\n // Multiply matrix m with its transpose.\n var a = m[0] * transpose[0] + m[1] * transpose[2];\n var b = m[0] * transpose[1] + m[1] * transpose[3];\n var c = m[2] * transpose[0] + m[3] * transpose[2];\n var d = m[2] * transpose[1] + m[3] * transpose[3];\n\n // Solve the second degree polynomial to get roots.\n var first = (a + d) / 2;\n var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;\n var sx = first + second || 1;\n var sy = first - second || 1;\n\n // Scale values are the square roots of the eigenvalues.\n return [Math.sqrt(sx), Math.sqrt(sy)];\n };\n\n // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)\n // For coordinate systems whose origin lies in the bottom-left, this\n // means normalization to (BL,TR) ordering. For systems with origin in the\n // top-left, this means (TL,BR) ordering.\n Util.normalizeRect = function Util_normalizeRect(rect) {\n var r = rect.slice(0); // clone rect\n if (rect[0] > rect[2]) {\n r[0] = rect[2];\n r[2] = rect[0];\n }\n if (rect[1] > rect[3]) {\n r[1] = rect[3];\n r[3] = rect[1];\n }\n return r;\n };\n\n // Returns a rectangle [x1, y1, x2, y2] corresponding to the\n // intersection of rect1 and rect2. If no intersection, returns 'false'\n // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]\n Util.intersect = function Util_intersect(rect1, rect2) {\n function compare(a, b) {\n return a - b;\n }\n\n // Order points along the axes\n var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare),\n orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare),\n result = [];\n\n rect1 = Util.normalizeRect(rect1);\n rect2 = Util.normalizeRect(rect2);\n\n // X: first and second points belong to different rectangles?\n if ((orderedX[0] === rect1[0] && orderedX[1] === rect2[0]) ||\n (orderedX[0] === rect2[0] && orderedX[1] === rect1[0])) {\n // Intersection must be between second and third points\n result[0] = orderedX[1];\n result[2] = orderedX[2];\n } else {\n return false;\n }\n\n // Y: first and second points belong to different rectangles?\n if ((orderedY[0] === rect1[1] && orderedY[1] === rect2[1]) ||\n (orderedY[0] === rect2[1] && orderedY[1] === rect1[1])) {\n // Intersection must be between second and third points\n result[1] = orderedY[1];\n result[3] = orderedY[2];\n } else {\n return false;\n }\n\n return result;\n };\n\n return Util;\n})();\n\nconst ROMAN_NUMBER_MAP = [\n '', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM',\n '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC',\n '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'\n];\n\n/**\n * Converts positive integers to (upper case) Roman numerals.\n * @param {integer} number - The number that should be converted.\n * @param {boolean} lowerCase - Indicates if the result should be converted\n * to lower case letters. The default value is `false`.\n * @return {string} The resulting Roman number.\n */\nfunction toRomanNumerals(number, lowerCase = false) {\n assert(Number.isInteger(number) && number > 0,\n 'The number should be a positive integer.');\n let pos, romanBuf = [];\n // Thousands\n while (number >= 1000) {\n number -= 1000;\n romanBuf.push('M');\n }\n // Hundreds\n pos = (number / 100) | 0;\n number %= 100;\n romanBuf.push(ROMAN_NUMBER_MAP[pos]);\n // Tens\n pos = (number / 10) | 0;\n number %= 10;\n romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);\n // Ones\n romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);\n\n const romanStr = romanBuf.join('');\n return (lowerCase ? romanStr.toLowerCase() : romanStr);\n}\n\nconst PDFStringTranslateTable = [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014,\n 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C,\n 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160,\n 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC\n];\n\nfunction stringToPDFString(str) {\n var i, n = str.length, strBuf = [];\n if (str[0] === '\\xFE' && str[1] === '\\xFF') {\n // UTF16BE BOM\n for (i = 2; i < n; i += 2) {\n strBuf.push(String.fromCharCode(\n (str.charCodeAt(i) << 8) | str.charCodeAt(i + 1)));\n }\n } else {\n for (i = 0; i < n; ++i) {\n var code = PDFStringTranslateTable[str.charCodeAt(i)];\n strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));\n }\n }\n return strBuf.join('');\n}\n\nfunction stringToUTF8String(str) {\n return decodeURIComponent(escape(str));\n}\n\nfunction utf8StringToString(str) {\n return unescape(encodeURIComponent(str));\n}\n\nfunction isEmptyObj(obj) {\n for (var key in obj) {\n return false;\n }\n return true;\n}\n\nfunction isBool(v) {\n return typeof v === 'boolean';\n}\n\nfunction isNum(v) {\n return typeof v === 'number';\n}\n\nfunction isString(v) {\n return typeof v === 'string';\n}\n\nfunction isArrayBuffer(v) {\n return typeof v === 'object' && v !== null && v.byteLength !== undefined;\n}\n\n// Checks if ch is one of the following characters: SPACE, TAB, CR or LF.\nfunction isSpace(ch) {\n return (ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A);\n}\n\n/**\n * Promise Capability object.\n *\n * @typedef {Object} PromiseCapability\n * @property {Promise} promise - A promise object.\n * @property {function} resolve - Fulfills the promise.\n * @property {function} reject - Rejects the promise.\n */\n\n/**\n * Creates a promise capability object.\n * @alias createPromiseCapability\n *\n * @return {PromiseCapability} A capability object contains:\n * - a Promise, resolve and reject methods.\n */\nfunction createPromiseCapability() {\n var capability = {};\n capability.promise = new Promise(function (resolve, reject) {\n capability.resolve = resolve;\n capability.reject = reject;\n });\n return capability;\n}\n\nvar createObjectURL = (function createObjectURLClosure() {\n // Blob/createObjectURL is not available, falling back to data schema.\n var digits =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n return function createObjectURL(data, contentType, forceDataSchema = false) {\n if (!forceDataSchema && URL.createObjectURL) {\n const blob = new Blob([data], { type: contentType, });\n return URL.createObjectURL(blob);\n }\n\n var buffer = 'data:' + contentType + ';base64,';\n for (var i = 0, ii = data.length; i < ii; i += 3) {\n var b1 = data[i] & 0xFF;\n var b2 = data[i + 1] & 0xFF;\n var b3 = data[i + 2] & 0xFF;\n var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4);\n var d3 = i + 1 < ii ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64;\n var d4 = i + 2 < ii ? (b3 & 0x3F) : 64;\n buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];\n }\n return buffer;\n };\n})();\n\nexport {\n FONT_IDENTITY_MATRIX,\n IDENTITY_MATRIX,\n OPS,\n VerbosityLevel,\n UNSUPPORTED_FEATURES,\n AnnotationBorderStyleType,\n AnnotationFieldFlag,\n AnnotationFlag,\n AnnotationType,\n FontType,\n ImageKind,\n CMapCompressionType,\n AbortException,\n InvalidPDFException,\n MissingDataException,\n MissingPDFException,\n NativeImageDecoding,\n PasswordException,\n PasswordResponses,\n PermissionFlag,\n StreamType,\n TextRenderingMode,\n UnexpectedResponseException,\n UnknownErrorException,\n Util,\n toRomanNumerals,\n XRefParseException,\n FormatError,\n arrayByteLength,\n arraysToBytes,\n assert,\n bytesToString,\n createPromiseCapability,\n createObjectURL,\n deprecated,\n getInheritableProperty,\n getLookupTableFactory,\n getVerbosityLevel,\n info,\n isArrayBuffer,\n isBool,\n isEmptyObj,\n isNum,\n isString,\n isSpace,\n isSameOrigin,\n createValidAbsoluteUrl,\n isLittleEndian,\n isEvalSupported,\n log2,\n readInt8,\n readUint16,\n readUint32,\n removeNullCharacters,\n ReadableStream,\n URL,\n setVerbosityLevel,\n shadow,\n string32,\n stringToBytes,\n stringToPDFString,\n stringToUTF8String,\n utf8StringToString,\n warn,\n unreachable,\n};\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst globalScope = require('./global_scope');\n\n// Skip compatibility checks for the extensions and if we already ran\n// this module.\nif ((typeof PDFJSDev === 'undefined' ||\n !PDFJSDev.test('FIREFOX || MOZCENTRAL')) &&\n !globalScope._pdfjsCompatibilityChecked) {\n\nglobalScope._pdfjsCompatibilityChecked = true;\n\n// In the Chrome extension, most of the polyfills are unnecessary.\n// We support down to Chrome 49, because it's still commonly used by Windows XP\n// users - https://github.com/mozilla/pdf.js/issues/9397\nif (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('CHROME')) {\n\nconst isNodeJS = require('./is_node');\n\nconst hasDOM = typeof window === 'object' && typeof document === 'object';\n\n// Support: Node.js\n(function checkNodeBtoa() {\n if (globalScope.btoa || !isNodeJS()) {\n return;\n }\n globalScope.btoa = function(chars) {\n // eslint-disable-next-line no-undef\n return Buffer.from(chars, 'binary').toString('base64');\n };\n})();\n\n// Support: Node.js\n(function checkNodeAtob() {\n if (globalScope.atob || !isNodeJS()) {\n return;\n }\n globalScope.atob = function(input) {\n // eslint-disable-next-line no-undef\n return Buffer.from(input, 'base64').toString('binary');\n };\n})();\n\n// Provides document.currentScript support\n// Support: IE, Chrome<29.\n(function checkCurrentScript() {\n if (!hasDOM) {\n return;\n }\n if ('currentScript' in document) {\n return;\n }\n Object.defineProperty(document, 'currentScript', {\n get() {\n var scripts = document.getElementsByTagName('script');\n return scripts[scripts.length - 1];\n },\n enumerable: true,\n configurable: true,\n });\n})();\n\n// Provides support for ChildNode.remove in legacy browsers.\n// Support: IE.\n(function checkChildNodeRemove() {\n if (!hasDOM) {\n return;\n }\n if (typeof Element.prototype.remove !== 'undefined') {\n return;\n }\n Element.prototype.remove = function () {\n if (this.parentNode) {\n // eslint-disable-next-line mozilla/avoid-removeChild\n this.parentNode.removeChild(this);\n }\n };\n})();\n\n// Provides support for DOMTokenList.prototype.toggle, with the optional\n// \"force\" parameter, in legacy browsers.\n// Support: IE\n(function checkDOMTokenListToggle() {\n if (!hasDOM || isNodeJS()) {\n return;\n }\n const div = document.createElement('div');\n if (div.classList.toggle('test', 0) === false) {\n return;\n }\n const originalDOMTokenListToggle = DOMTokenList.prototype.toggle;\n\n DOMTokenList.prototype.toggle = function(token) {\n if (arguments.length > 1) {\n const force = !!arguments[1];\n return (this[force ? 'add' : 'remove'](token), force);\n }\n return originalDOMTokenListToggle(token);\n };\n})();\n\n// Provides support for String.prototype.includes in legacy browsers.\n// Support: IE, Chrome<41\n(function checkStringIncludes() {\n if (String.prototype.includes) {\n return;\n }\n require('core-js/fn/string/includes');\n})();\n\n// Provides support for Array.prototype.includes in legacy browsers.\n// Support: IE, Chrome<47\n(function checkArrayIncludes() {\n if (Array.prototype.includes) {\n return;\n }\n require('core-js/fn/array/includes');\n})();\n\n// Provides support for Object.assign in legacy browsers.\n// Support: IE\n(function checkObjectAssign() {\n if (Object.assign) {\n return;\n }\n require('core-js/fn/object/assign');\n})();\n\n// Provides support for Math.log2 in legacy browsers.\n// Support: IE, Chrome<38\n(function checkMathLog2() {\n if (Math.log2) {\n return;\n }\n Math.log2 = require('core-js/fn/math/log2');\n})();\n\n// Provides support for Number.isNaN in legacy browsers.\n// Support: IE.\n(function checkNumberIsNaN() {\n if (Number.isNaN) {\n return;\n }\n Number.isNaN = require('core-js/fn/number/is-nan');\n})();\n\n// Provides support for Number.isInteger in legacy browsers.\n// Support: IE, Chrome<34\n(function checkNumberIsInteger() {\n if (Number.isInteger) {\n return;\n }\n Number.isInteger = require('core-js/fn/number/is-integer');\n})();\n\n// Support: IE, Safari<8, Chrome<32\n(function checkPromise() {\n if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('IMAGE_DECODERS')) {\n // The current image decoders are synchronous, hence `Promise` shouldn't\n // need to be polyfilled for the IMAGE_DECODERS build target.\n return;\n }\n if (globalScope.Promise) {\n return;\n }\n globalScope.Promise = require('core-js/fn/promise');\n})();\n\n// Support: IE<11, Safari<8, Chrome<36\n(function checkWeakMap() {\n if (globalScope.WeakMap) {\n return;\n }\n globalScope.WeakMap = require('core-js/fn/weak-map');\n})();\n\n// Provides support for String.codePointAt in legacy browsers.\n// Support: IE11.\n(function checkStringCodePointAt() {\n if (String.codePointAt) {\n return;\n }\n String.codePointAt = require('core-js/fn/string/code-point-at');\n})();\n\n// Provides support for String.fromCodePoint in legacy browsers.\n// Support: IE11.\n(function checkStringFromCodePoint() {\n if (String.fromCodePoint) {\n return;\n }\n String.fromCodePoint = require('core-js/fn/string/from-code-point');\n})();\n\n// Support: IE\n(function checkSymbol() {\n if (globalScope.Symbol) {\n return;\n }\n require('core-js/es6/symbol');\n})();\n\n} // End of !PDFJSDev.test('CHROME')\n\n// Provides support for Object.values in legacy browsers.\n// Support: IE, Chrome<54\n(function checkObjectValues() {\n if (Object.values) {\n return;\n }\n Object.values = require('core-js/fn/object/values');\n})();\n\n}\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals module */\n\nmodule.exports =\n (typeof window !== 'undefined' && window.Math === Math) ? window :\n // eslint-disable-next-line no-undef\n (typeof global !== 'undefined' && global.Math === Math) ? global :\n (typeof self !== 'undefined' && self.Math === Math) ? self : {};\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals module, process */\n\nmodule.exports = function isNodeJS() {\n return typeof process === 'object' && process + '' === '[object process]';\n};\n","require('../../modules/es6.string.includes');\nmodule.exports = require('../../modules/_core').String.includes;\n","// 21.1.3.7 String.prototype.includes(searchString, position = 0)\n'use strict';\nvar $export = require('./_export');\nvar context = require('./_string-context');\nvar INCLUDES = 'includes';\n\n$export($export.P + $export.F * require('./_fails-is-regexp')(INCLUDES), 'String', {\n includes: function includes(searchString /* , position = 0 */) {\n return !!~context(this, searchString, INCLUDES)\n .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var global = require('./_global');\nvar core = require('./_core');\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar ctx = require('./_ctx');\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n var key, own, out, exp;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n // export native or passed\n out = (own ? target : source)[key];\n // bind timers to global for call from export context\n exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // extend global\n if (target) redefine(target, key, out, type & $export.U);\n // export\n if (exports[key] != out) hide(exports, key, exp);\n if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n }\n};\nglobal.core = core;\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n","var core = module.exports = { version: '2.5.7' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n","var dP = require('./_object-dp');\nvar createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var global = require('./_global');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar SRC = require('./_uid')('src');\nvar TO_STRING = 'toString';\nvar $toString = Function[TO_STRING];\nvar TPL = ('' + $toString).split(TO_STRING);\n\nrequire('./_core').inspectSource = function (it) {\n return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) has(val, 'name') || hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n","// helper for String#{startsWith, endsWith, includes}\nvar isRegExp = require('./_is-regexp');\nvar defined = require('./_defined');\n\nmodule.exports = function (that, searchString, NAME) {\n if (isRegExp(searchString)) throw TypeError('String#' + NAME + \" doesn't accept regex!\");\n return String(defined(that));\n};\n","// 7.2.8 IsRegExp(argument)\nvar isObject = require('./_is-object');\nvar cof = require('./_cof');\nvar MATCH = require('./_wks')('match');\nmodule.exports = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');\n};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","var store = require('./_shared')('wks');\nvar uid = require('./_uid');\nvar Symbol = require('./_global').Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n","var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: require('./_library') ? 'pure' : 'global',\n copyright: '© 2018 Denis Pushkarev (zloirock.ru)'\n});\n","module.exports = false;\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","var MATCH = require('./_wks')('match');\nmodule.exports = function (KEY) {\n var re = /./;\n try {\n '/./'[KEY](re);\n } catch (e) {\n try {\n re[MATCH] = false;\n return !'/./'[KEY](re);\n } catch (f) { /* empty */ }\n } return true;\n};\n","require('../../modules/es7.array.includes');\nmodule.exports = require('../../modules/_core').Array.includes;\n","'use strict';\n// https://github.com/tc39/Array.prototype.includes\nvar $export = require('./_export');\nvar $includes = require('./_array-includes')(true);\n\n$export($export.P, 'Array', {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\nrequire('./_add-to-unscopables')('includes');\n","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject');\nvar toLength = require('./_to-length');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject');\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return IObject(defined(it));\n};\n","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n","// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n","var toInteger = require('./_to-integer');\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n","// 22.1.3.31 Array.prototype[@@unscopables]\nvar UNSCOPABLES = require('./_wks')('unscopables');\nvar ArrayProto = Array.prototype;\nif (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {});\nmodule.exports = function (key) {\n ArrayProto[UNSCOPABLES][key] = true;\n};\n","require('../../modules/es6.object.assign');\nmodule.exports = require('../../modules/_core').Object.assign;\n","// 19.1.3.1 Object.assign(target, source)\nvar $export = require('./_export');\n\n$export($export.S + $export.F, 'Object', { assign: require('./_object-assign') });\n","'use strict';\n// 19.1.2.1 Object.assign(target, source, ...)\nvar getKeys = require('./_object-keys');\nvar gOPS = require('./_object-gops');\nvar pIE = require('./_object-pie');\nvar toObject = require('./_to-object');\nvar IObject = require('./_iobject');\nvar $assign = Object.assign;\n\n// should work with symbols and should have deterministic property order (V8 bug)\nmodule.exports = !$assign || require('./_fails')(function () {\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var S = Symbol();\n var K = 'abcdefghijklmnopqrst';\n A[S] = 7;\n K.split('').forEach(function (k) { B[k] = k; });\n return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var aLen = arguments.length;\n var index = 1;\n var getSymbols = gOPS.f;\n var isEnum = pIE.f;\n while (aLen > index) {\n var S = IObject(arguments[index++]);\n var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];\n } return T;\n} : $assign;\n","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal');\nvar enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n","var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n","exports.f = Object.getOwnPropertySymbols;\n","exports.f = {}.propertyIsEnumerable;\n","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n","require('../../modules/es6.math.log2');\nmodule.exports = require('../../modules/_core').Math.log2;\n","// 20.2.2.22 Math.log2(x)\nvar $export = require('./_export');\n\n$export($export.S, 'Math', {\n log2: function log2(x) {\n return Math.log(x) / Math.LN2;\n }\n});\n","require('../../modules/es6.number.is-nan');\nmodule.exports = require('../../modules/_core').Number.isNaN;\n","// 20.1.2.4 Number.isNaN(number)\nvar $export = require('./_export');\n\n$export($export.S, 'Number', {\n isNaN: function isNaN(number) {\n // eslint-disable-next-line no-self-compare\n return number != number;\n }\n});\n","require('../../modules/es6.number.is-integer');\nmodule.exports = require('../../modules/_core').Number.isInteger;\n","// 20.1.2.3 Number.isInteger(number)\nvar $export = require('./_export');\n\n$export($export.S, 'Number', { isInteger: require('./_is-integer') });\n","// 20.1.2.3 Number.isInteger(number)\nvar isObject = require('./_is-object');\nvar floor = Math.floor;\nmodule.exports = function isInteger(it) {\n return !isObject(it) && isFinite(it) && floor(it) === it;\n};\n","require('../modules/es6.object.to-string');\nrequire('../modules/es6.string.iterator');\nrequire('../modules/web.dom.iterable');\nrequire('../modules/es6.promise');\nrequire('../modules/es7.promise.finally');\nrequire('../modules/es7.promise.try');\nmodule.exports = require('../modules/_core').Promise;\n","'use strict';\n// 19.1.3.6 Object.prototype.toString()\nvar classof = require('./_classof');\nvar test = {};\ntest[require('./_wks')('toStringTag')] = 'z';\nif (test + '' != '[object z]') {\n require('./_redefine')(Object.prototype, 'toString', function toString() {\n return '[object ' + classof(this) + ']';\n }, true);\n}\n","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof');\nvar TAG = require('./_wks')('toStringTag');\n// ES3 wrong here\nvar ARG = cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (e) { /* empty */ }\n};\n\nmodule.exports = function (it) {\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n","'use strict';\nvar $at = require('./_string-at')(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./_iter-define')(String, 'String', function (iterated) {\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var index = this._i;\n var point;\n if (index >= O.length) return { value: undefined, done: true };\n point = $at(O, index);\n this._i += point.length;\n return { value: point, done: false };\n});\n","var toInteger = require('./_to-integer');\nvar defined = require('./_defined');\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function (TO_STRING) {\n return function (that, pos) {\n var s = String(defined(that));\n var i = toInteger(pos);\n var l = s.length;\n var a, b;\n if (i < 0 || i >= l) return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n","module.exports = {};\n","'use strict';\nvar create = require('./_object-create');\nvar descriptor = require('./_property-desc');\nvar setToStringTag = require('./_set-to-string-tag');\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n","var dP = require('./_object-dp');\nvar anObject = require('./_an-object');\nvar getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n","var document = require('./_global').document;\nmodule.exports = document && document.documentElement;\n","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has');\nvar toObject = require('./_to-object');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n","var $iterators = require('./es6.array.iterator');\nvar getKeys = require('./_object-keys');\nvar redefine = require('./_redefine');\nvar global = require('./_global');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar wks = require('./_wks');\nvar ITERATOR = wks('iterator');\nvar TO_STRING_TAG = wks('toStringTag');\nvar ArrayValues = Iterators.Array;\n\nvar DOMIterables = {\n CSSRuleList: true, // TODO: Not spec compliant, should be false.\n CSSStyleDeclaration: false,\n CSSValueList: false,\n ClientRectList: false,\n DOMRectList: false,\n DOMStringList: false,\n DOMTokenList: true,\n DataTransferItemList: false,\n FileList: false,\n HTMLAllCollection: false,\n HTMLCollection: false,\n HTMLFormElement: false,\n HTMLSelectElement: false,\n MediaList: true, // TODO: Not spec compliant, should be false.\n MimeTypeArray: false,\n NamedNodeMap: false,\n NodeList: true,\n PaintRequestList: false,\n Plugin: false,\n PluginArray: false,\n SVGLengthList: false,\n SVGNumberList: false,\n SVGPathSegList: false,\n SVGPointList: false,\n SVGStringList: false,\n SVGTransformList: false,\n SourceBufferList: false,\n StyleSheetList: true, // TODO: Not spec compliant, should be false.\n TextTrackCueList: false,\n TextTrackList: false,\n TouchList: false\n};\n\nfor (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {\n var NAME = collections[i];\n var explicit = DOMIterables[NAME];\n var Collection = global[NAME];\n var proto = Collection && Collection.prototype;\n var key;\n if (proto) {\n if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);\n if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = ArrayValues;\n if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);\n }\n}\n","'use strict';\nvar addToUnscopables = require('./_add-to-unscopables');\nvar step = require('./_iter-step');\nvar Iterators = require('./_iterators');\nvar toIObject = require('./_to-iobject');\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var kind = this._k;\n var index = this._i++;\n if (!O || index >= O.length) {\n this._t = undefined;\n return step(1);\n }\n if (kind == 'keys') return step(0, index);\n if (kind == 'values') return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n","module.exports = function (done, value) {\n return { value: value, done: !!done };\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar global = require('./_global');\nvar ctx = require('./_ctx');\nvar classof = require('./_classof');\nvar $export = require('./_export');\nvar isObject = require('./_is-object');\nvar aFunction = require('./_a-function');\nvar anInstance = require('./_an-instance');\nvar forOf = require('./_for-of');\nvar speciesConstructor = require('./_species-constructor');\nvar task = require('./_task').set;\nvar microtask = require('./_microtask')();\nvar newPromiseCapabilityModule = require('./_new-promise-capability');\nvar perform = require('./_perform');\nvar userAgent = require('./_user-agent');\nvar promiseResolve = require('./_promise-resolve');\nvar PROMISE = 'Promise';\nvar TypeError = global.TypeError;\nvar process = global.process;\nvar versions = process && process.versions;\nvar v8 = versions && versions.v8 || '';\nvar $Promise = global[PROMISE];\nvar isNode = classof(process) == 'process';\nvar empty = function () { /* empty */ };\nvar Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;\nvar newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;\n\nvar USE_NATIVE = !!function () {\n try {\n // correct subclassing with @@species support\n var promise = $Promise.resolve(1);\n var FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) {\n exec(empty, empty);\n };\n // unhandled rejections tracking support, NodeJS Promise without it fails @@species test\n return (isNode || typeof PromiseRejectionEvent == 'function')\n && promise.then(empty) instanceof FakePromise\n // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables\n // https://bugs.chromium.org/p/chromium/issues/detail?id=830565\n // we can't detect it synchronously, so just check versions\n && v8.indexOf('6.6') !== 0\n && userAgent.indexOf('Chrome/66') === -1;\n } catch (e) { /* empty */ }\n}();\n\n// helpers\nvar isThenable = function (it) {\n var then;\n return isObject(it) && typeof (then = it.then) == 'function' ? then : false;\n};\nvar notify = function (promise, isReject) {\n if (promise._n) return;\n promise._n = true;\n var chain = promise._c;\n microtask(function () {\n var value = promise._v;\n var ok = promise._s == 1;\n var i = 0;\n var run = function (reaction) {\n var handler = ok ? reaction.ok : reaction.fail;\n var resolve = reaction.resolve;\n var reject = reaction.reject;\n var domain = reaction.domain;\n var result, then, exited;\n try {\n if (handler) {\n if (!ok) {\n if (promise._h == 2) onHandleUnhandled(promise);\n promise._h = 1;\n }\n if (handler === true) result = value;\n else {\n if (domain) domain.enter();\n result = handler(value); // may throw\n if (domain) {\n domain.exit();\n exited = true;\n }\n }\n if (result === reaction.promise) {\n reject(TypeError('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n then.call(result, resolve, reject);\n } else resolve(result);\n } else reject(value);\n } catch (e) {\n if (domain && !exited) domain.exit();\n reject(e);\n }\n };\n while (chain.length > i) run(chain[i++]); // variable length - can't use forEach\n promise._c = [];\n promise._n = false;\n if (isReject && !promise._h) onUnhandled(promise);\n });\n};\nvar onUnhandled = function (promise) {\n task.call(global, function () {\n var value = promise._v;\n var unhandled = isUnhandled(promise);\n var result, handler, console;\n if (unhandled) {\n result = perform(function () {\n if (isNode) {\n process.emit('unhandledRejection', value, promise);\n } else if (handler = global.onunhandledrejection) {\n handler({ promise: promise, reason: value });\n } else if ((console = global.console) && console.error) {\n console.error('Unhandled promise rejection', value);\n }\n });\n // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should\n promise._h = isNode || isUnhandled(promise) ? 2 : 1;\n } promise._a = undefined;\n if (unhandled && result.e) throw result.v;\n });\n};\nvar isUnhandled = function (promise) {\n return promise._h !== 1 && (promise._a || promise._c).length === 0;\n};\nvar onHandleUnhandled = function (promise) {\n task.call(global, function () {\n var handler;\n if (isNode) {\n process.emit('rejectionHandled', promise);\n } else if (handler = global.onrejectionhandled) {\n handler({ promise: promise, reason: promise._v });\n }\n });\n};\nvar $reject = function (value) {\n var promise = this;\n if (promise._d) return;\n promise._d = true;\n promise = promise._w || promise; // unwrap\n promise._v = value;\n promise._s = 2;\n if (!promise._a) promise._a = promise._c.slice();\n notify(promise, true);\n};\nvar $resolve = function (value) {\n var promise = this;\n var then;\n if (promise._d) return;\n promise._d = true;\n promise = promise._w || promise; // unwrap\n try {\n if (promise === value) throw TypeError(\"Promise can't be resolved itself\");\n if (then = isThenable(value)) {\n microtask(function () {\n var wrapper = { _w: promise, _d: false }; // wrap\n try {\n then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));\n } catch (e) {\n $reject.call(wrapper, e);\n }\n });\n } else {\n promise._v = value;\n promise._s = 1;\n notify(promise, false);\n }\n } catch (e) {\n $reject.call({ _w: promise, _d: false }, e); // wrap\n }\n};\n\n// constructor polyfill\nif (!USE_NATIVE) {\n // 25.4.3.1 Promise(executor)\n $Promise = function Promise(executor) {\n anInstance(this, $Promise, PROMISE, '_h');\n aFunction(executor);\n Internal.call(this);\n try {\n executor(ctx($resolve, this, 1), ctx($reject, this, 1));\n } catch (err) {\n $reject.call(this, err);\n }\n };\n // eslint-disable-next-line no-unused-vars\n Internal = function Promise(executor) {\n this._c = []; // <- awaiting reactions\n this._a = undefined; // <- checked in isUnhandled reactions\n this._s = 0; // <- state\n this._d = false; // <- done\n this._v = undefined; // <- value\n this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled\n this._n = false; // <- notify\n };\n Internal.prototype = require('./_redefine-all')($Promise.prototype, {\n // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)\n then: function then(onFulfilled, onRejected) {\n var reaction = newPromiseCapability(speciesConstructor(this, $Promise));\n reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;\n reaction.fail = typeof onRejected == 'function' && onRejected;\n reaction.domain = isNode ? process.domain : undefined;\n this._c.push(reaction);\n if (this._a) this._a.push(reaction);\n if (this._s) notify(this, false);\n return reaction.promise;\n },\n // 25.4.5.1 Promise.prototype.catch(onRejected)\n 'catch': function (onRejected) {\n return this.then(undefined, onRejected);\n }\n });\n OwnPromiseCapability = function () {\n var promise = new Internal();\n this.promise = promise;\n this.resolve = ctx($resolve, promise, 1);\n this.reject = ctx($reject, promise, 1);\n };\n newPromiseCapabilityModule.f = newPromiseCapability = function (C) {\n return C === $Promise || C === Wrapper\n ? new OwnPromiseCapability(C)\n : newGenericPromiseCapability(C);\n };\n}\n\n$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });\nrequire('./_set-to-string-tag')($Promise, PROMISE);\nrequire('./_set-species')(PROMISE);\nWrapper = require('./_core')[PROMISE];\n\n// statics\n$export($export.S + $export.F * !USE_NATIVE, PROMISE, {\n // 25.4.4.5 Promise.reject(r)\n reject: function reject(r) {\n var capability = newPromiseCapability(this);\n var $$reject = capability.reject;\n $$reject(r);\n return capability.promise;\n }\n});\n$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {\n // 25.4.4.6 Promise.resolve(x)\n resolve: function resolve(x) {\n return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);\n }\n});\n$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) {\n $Promise.all(iter)['catch'](empty);\n})), PROMISE, {\n // 25.4.4.1 Promise.all(iterable)\n all: function all(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var values = [];\n var index = 0;\n var remaining = 1;\n forOf(iterable, false, function (promise) {\n var $index = index++;\n var alreadyCalled = false;\n values.push(undefined);\n remaining++;\n C.resolve(promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[$index] = value;\n --remaining || resolve(values);\n }, reject);\n });\n --remaining || resolve(values);\n });\n if (result.e) reject(result.v);\n return capability.promise;\n },\n // 25.4.4.4 Promise.race(iterable)\n race: function race(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var reject = capability.reject;\n var result = perform(function () {\n forOf(iterable, false, function (promise) {\n C.resolve(promise).then(capability.resolve, reject);\n });\n });\n if (result.e) reject(result.v);\n return capability.promise;\n }\n});\n","module.exports = function (it, Constructor, name, forbiddenField) {\n if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {\n throw TypeError(name + ': incorrect invocation!');\n } return it;\n};\n","var ctx = require('./_ctx');\nvar call = require('./_iter-call');\nvar isArrayIter = require('./_is-array-iter');\nvar anObject = require('./_an-object');\nvar toLength = require('./_to-length');\nvar getIterFn = require('./core.get-iterator-method');\nvar BREAK = {};\nvar RETURN = {};\nvar exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {\n var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);\n var f = ctx(fn, that, entries ? 2 : 1);\n var index = 0;\n var length, step, iterator, result;\n if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');\n // fast case for arrays with default iterator\n if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {\n result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);\n if (result === BREAK || result === RETURN) return result;\n } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {\n result = call(iterator, f, step.value, entries);\n if (result === BREAK || result === RETURN) return result;\n }\n};\nexports.BREAK = BREAK;\nexports.RETURN = RETURN;\n","// call something on iterator step with safe closing on error\nvar anObject = require('./_an-object');\nmodule.exports = function (iterator, fn, value, entries) {\n try {\n return entries ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (e) {\n var ret = iterator['return'];\n if (ret !== undefined) anObject(ret.call(iterator));\n throw e;\n }\n};\n","// check on default Array iterator\nvar Iterators = require('./_iterators');\nvar ITERATOR = require('./_wks')('iterator');\nvar ArrayProto = Array.prototype;\n\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);\n};\n","var classof = require('./_classof');\nvar ITERATOR = require('./_wks')('iterator');\nvar Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n","// 7.3.20 SpeciesConstructor(O, defaultConstructor)\nvar anObject = require('./_an-object');\nvar aFunction = require('./_a-function');\nvar SPECIES = require('./_wks')('species');\nmodule.exports = function (O, D) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);\n};\n","var ctx = require('./_ctx');\nvar invoke = require('./_invoke');\nvar html = require('./_html');\nvar cel = require('./_dom-create');\nvar global = require('./_global');\nvar process = global.process;\nvar setTask = global.setImmediate;\nvar clearTask = global.clearImmediate;\nvar MessageChannel = global.MessageChannel;\nvar Dispatch = global.Dispatch;\nvar counter = 0;\nvar queue = {};\nvar ONREADYSTATECHANGE = 'onreadystatechange';\nvar defer, channel, port;\nvar run = function () {\n var id = +this;\n // eslint-disable-next-line no-prototype-builtins\n if (queue.hasOwnProperty(id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\nvar listener = function (event) {\n run.call(event.data);\n};\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif (!setTask || !clearTask) {\n setTask = function setImmediate(fn) {\n var args = [];\n var i = 1;\n while (arguments.length > i) args.push(arguments[i++]);\n queue[++counter] = function () {\n // eslint-disable-next-line no-new-func\n invoke(typeof fn == 'function' ? fn : Function(fn), args);\n };\n defer(counter);\n return counter;\n };\n clearTask = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (require('./_cof')(process) == 'process') {\n defer = function (id) {\n process.nextTick(ctx(run, id, 1));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(ctx(run, id, 1));\n };\n // Browsers with MessageChannel, includes WebWorkers\n } else if (MessageChannel) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = listener;\n defer = ctx(port.postMessage, port, 1);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {\n defer = function (id) {\n global.postMessage(id + '', '*');\n };\n global.addEventListener('message', listener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in cel('script')) {\n defer = function (id) {\n html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {\n html.removeChild(this);\n run.call(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(ctx(run, id, 1), 0);\n };\n }\n}\nmodule.exports = {\n set: setTask,\n clear: clearTask\n};\n","// fast apply, http://jsperf.lnkit.com/fast-apply/5\nmodule.exports = function (fn, args, that) {\n var un = that === undefined;\n switch (args.length) {\n case 0: return un ? fn()\n : fn.call(that);\n case 1: return un ? fn(args[0])\n : fn.call(that, args[0]);\n case 2: return un ? fn(args[0], args[1])\n : fn.call(that, args[0], args[1]);\n case 3: return un ? fn(args[0], args[1], args[2])\n : fn.call(that, args[0], args[1], args[2]);\n case 4: return un ? fn(args[0], args[1], args[2], args[3])\n : fn.call(that, args[0], args[1], args[2], args[3]);\n } return fn.apply(that, args);\n};\n","var global = require('./_global');\nvar macrotask = require('./_task').set;\nvar Observer = global.MutationObserver || global.WebKitMutationObserver;\nvar process = global.process;\nvar Promise = global.Promise;\nvar isNode = require('./_cof')(process) == 'process';\n\nmodule.exports = function () {\n var head, last, notify;\n\n var flush = function () {\n var parent, fn;\n if (isNode && (parent = process.domain)) parent.exit();\n while (head) {\n fn = head.fn;\n head = head.next;\n try {\n fn();\n } catch (e) {\n if (head) notify();\n else last = undefined;\n throw e;\n }\n } last = undefined;\n if (parent) parent.enter();\n };\n\n // Node.js\n if (isNode) {\n notify = function () {\n process.nextTick(flush);\n };\n // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339\n } else if (Observer && !(global.navigator && global.navigator.standalone)) {\n var toggle = true;\n var node = document.createTextNode('');\n new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new\n notify = function () {\n node.data = toggle = !toggle;\n };\n // environments with maybe non-completely correct, but existent Promise\n } else if (Promise && Promise.resolve) {\n // Promise.resolve without an argument throws an error in LG WebOS 2\n var promise = Promise.resolve(undefined);\n notify = function () {\n promise.then(flush);\n };\n // for other environments - macrotask based on:\n // - setImmediate\n // - MessageChannel\n // - window.postMessag\n // - onreadystatechange\n // - setTimeout\n } else {\n notify = function () {\n // strange IE + webpack dev server bug - use .call(global)\n macrotask.call(global, flush);\n };\n }\n\n return function (fn) {\n var task = { fn: fn, next: undefined };\n if (last) last.next = task;\n if (!head) {\n head = task;\n notify();\n } last = task;\n };\n};\n","'use strict';\n// 25.4.1.5 NewPromiseCapability(C)\nvar aFunction = require('./_a-function');\n\nfunction PromiseCapability(C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aFunction(resolve);\n this.reject = aFunction(reject);\n}\n\nmodule.exports.f = function (C) {\n return new PromiseCapability(C);\n};\n","module.exports = function (exec) {\n try {\n return { e: false, v: exec() };\n } catch (e) {\n return { e: true, v: e };\n }\n};\n","var global = require('./_global');\nvar navigator = global.navigator;\n\nmodule.exports = navigator && navigator.userAgent || '';\n","var anObject = require('./_an-object');\nvar isObject = require('./_is-object');\nvar newPromiseCapability = require('./_new-promise-capability');\n\nmodule.exports = function (C, x) {\n anObject(C);\n if (isObject(x) && x.constructor === C) return x;\n var promiseCapability = newPromiseCapability.f(C);\n var resolve = promiseCapability.resolve;\n resolve(x);\n return promiseCapability.promise;\n};\n","var redefine = require('./_redefine');\nmodule.exports = function (target, src, safe) {\n for (var key in src) redefine(target, key, src[key], safe);\n return target;\n};\n","'use strict';\nvar global = require('./_global');\nvar dP = require('./_object-dp');\nvar DESCRIPTORS = require('./_descriptors');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (KEY) {\n var C = global[KEY];\n if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n};\n","var ITERATOR = require('./_wks')('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var riter = [7][ITERATOR]();\n riter['return'] = function () { SAFE_CLOSING = true; };\n // eslint-disable-next-line no-throw-literal\n Array.from(riter, function () { throw 2; });\n} catch (e) { /* empty */ }\n\nmodule.exports = function (exec, skipClosing) {\n if (!skipClosing && !SAFE_CLOSING) return false;\n var safe = false;\n try {\n var arr = [7];\n var iter = arr[ITERATOR]();\n iter.next = function () { return { done: safe = true }; };\n arr[ITERATOR] = function () { return iter; };\n exec(arr);\n } catch (e) { /* empty */ }\n return safe;\n};\n","// https://github.com/tc39/proposal-promise-finally\n'use strict';\nvar $export = require('./_export');\nvar core = require('./_core');\nvar global = require('./_global');\nvar speciesConstructor = require('./_species-constructor');\nvar promiseResolve = require('./_promise-resolve');\n\n$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {\n var C = speciesConstructor(this, core.Promise || global.Promise);\n var isFunction = typeof onFinally == 'function';\n return this.then(\n isFunction ? function (x) {\n return promiseResolve(C, onFinally()).then(function () { return x; });\n } : onFinally,\n isFunction ? function (e) {\n return promiseResolve(C, onFinally()).then(function () { throw e; });\n } : onFinally\n );\n} });\n","'use strict';\n// https://github.com/tc39/proposal-promise-try\nvar $export = require('./_export');\nvar newPromiseCapability = require('./_new-promise-capability');\nvar perform = require('./_perform');\n\n$export($export.S, 'Promise', { 'try': function (callbackfn) {\n var promiseCapability = newPromiseCapability.f(this);\n var result = perform(callbackfn);\n (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);\n return promiseCapability.promise;\n} });\n","require('../modules/es6.object.to-string');\nrequire('../modules/web.dom.iterable');\nrequire('../modules/es6.weak-map');\nrequire('../modules/es7.weak-map.of');\nrequire('../modules/es7.weak-map.from');\nmodule.exports = require('../modules/_core').WeakMap;\n","'use strict';\nvar each = require('./_array-methods')(0);\nvar redefine = require('./_redefine');\nvar meta = require('./_meta');\nvar assign = require('./_object-assign');\nvar weak = require('./_collection-weak');\nvar isObject = require('./_is-object');\nvar fails = require('./_fails');\nvar validate = require('./_validate-collection');\nvar WEAK_MAP = 'WeakMap';\nvar getWeak = meta.getWeak;\nvar isExtensible = Object.isExtensible;\nvar uncaughtFrozenStore = weak.ufstore;\nvar tmp = {};\nvar InternalMap;\n\nvar wrapper = function (get) {\n return function WeakMap() {\n return get(this, arguments.length > 0 ? arguments[0] : undefined);\n };\n};\n\nvar methods = {\n // 23.3.3.3 WeakMap.prototype.get(key)\n get: function get(key) {\n if (isObject(key)) {\n var data = getWeak(key);\n if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);\n return data ? data[this._i] : undefined;\n }\n },\n // 23.3.3.5 WeakMap.prototype.set(key, value)\n set: function set(key, value) {\n return weak.def(validate(this, WEAK_MAP), key, value);\n }\n};\n\n// 23.3 WeakMap Objects\nvar $WeakMap = module.exports = require('./_collection')(WEAK_MAP, wrapper, methods, weak, true, true);\n\n// IE11 WeakMap frozen keys fix\nif (fails(function () { return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; })) {\n InternalMap = weak.getConstructor(wrapper, WEAK_MAP);\n assign(InternalMap.prototype, methods);\n meta.NEED = true;\n each(['delete', 'has', 'get', 'set'], function (key) {\n var proto = $WeakMap.prototype;\n var method = proto[key];\n redefine(proto, key, function (a, b) {\n // store frozen objects on internal weakmap shim\n if (isObject(a) && !isExtensible(a)) {\n if (!this._f) this._f = new InternalMap();\n var result = this._f[key](a, b);\n return key == 'set' ? this : result;\n // store all the rest on native weakmap\n } return method.call(this, a, b);\n });\n });\n}\n","// 0 -> Array#forEach\n// 1 -> Array#map\n// 2 -> Array#filter\n// 3 -> Array#some\n// 4 -> Array#every\n// 5 -> Array#find\n// 6 -> Array#findIndex\nvar ctx = require('./_ctx');\nvar IObject = require('./_iobject');\nvar toObject = require('./_to-object');\nvar toLength = require('./_to-length');\nvar asc = require('./_array-species-create');\nmodule.exports = function (TYPE, $create) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n var create = $create || asc;\n return function ($this, callbackfn, that) {\n var O = toObject($this);\n var self = IObject(O);\n var f = ctx(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n var val, res;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n val = self[index];\n res = f(val, index, O);\n if (TYPE) {\n if (IS_MAP) result[index] = res; // map\n else if (res) switch (TYPE) {\n case 3: return true; // some\n case 5: return val; // find\n case 6: return index; // findIndex\n case 2: result.push(val); // filter\n } else if (IS_EVERY) return false; // every\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;\n };\n};\n","// 9.4.2.3 ArraySpeciesCreate(originalArray, length)\nvar speciesConstructor = require('./_array-species-constructor');\n\nmodule.exports = function (original, length) {\n return new (speciesConstructor(original))(length);\n};\n","var isObject = require('./_is-object');\nvar isArray = require('./_is-array');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (original) {\n var C;\n if (isArray(original)) {\n C = original.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return C === undefined ? Array : C;\n};\n","// 7.2.2 IsArray(argument)\nvar cof = require('./_cof');\nmodule.exports = Array.isArray || function isArray(arg) {\n return cof(arg) == 'Array';\n};\n","var META = require('./_uid')('meta');\nvar isObject = require('./_is-object');\nvar has = require('./_has');\nvar setDesc = require('./_object-dp').f;\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\nvar FREEZE = !require('./_fails')(function () {\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n setDesc(it, META, { value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n } });\n};\nvar fastKey = function (it, create) {\n // return primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function (it, create) {\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n","'use strict';\nvar redefineAll = require('./_redefine-all');\nvar getWeak = require('./_meta').getWeak;\nvar anObject = require('./_an-object');\nvar isObject = require('./_is-object');\nvar anInstance = require('./_an-instance');\nvar forOf = require('./_for-of');\nvar createArrayMethod = require('./_array-methods');\nvar $has = require('./_has');\nvar validate = require('./_validate-collection');\nvar arrayFind = createArrayMethod(5);\nvar arrayFindIndex = createArrayMethod(6);\nvar id = 0;\n\n// fallback for uncaught frozen keys\nvar uncaughtFrozenStore = function (that) {\n return that._l || (that._l = new UncaughtFrozenStore());\n};\nvar UncaughtFrozenStore = function () {\n this.a = [];\n};\nvar findUncaughtFrozen = function (store, key) {\n return arrayFind(store.a, function (it) {\n return it[0] === key;\n });\n};\nUncaughtFrozenStore.prototype = {\n get: function (key) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) return entry[1];\n },\n has: function (key) {\n return !!findUncaughtFrozen(this, key);\n },\n set: function (key, value) {\n var entry = findUncaughtFrozen(this, key);\n if (entry) entry[1] = value;\n else this.a.push([key, value]);\n },\n 'delete': function (key) {\n var index = arrayFindIndex(this.a, function (it) {\n return it[0] === key;\n });\n if (~index) this.a.splice(index, 1);\n return !!~index;\n }\n};\n\nmodule.exports = {\n getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {\n var C = wrapper(function (that, iterable) {\n anInstance(that, C, NAME, '_i');\n that._t = NAME; // collection type\n that._i = id++; // collection id\n that._l = undefined; // leak store for uncaught frozen objects\n if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);\n });\n redefineAll(C.prototype, {\n // 23.3.3.2 WeakMap.prototype.delete(key)\n // 23.4.3.3 WeakSet.prototype.delete(value)\n 'delete': function (key) {\n if (!isObject(key)) return false;\n var data = getWeak(key);\n if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);\n return data && $has(data, this._i) && delete data[this._i];\n },\n // 23.3.3.4 WeakMap.prototype.has(key)\n // 23.4.3.4 WeakSet.prototype.has(value)\n has: function has(key) {\n if (!isObject(key)) return false;\n var data = getWeak(key);\n if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);\n return data && $has(data, this._i);\n }\n });\n return C;\n },\n def: function (that, key, value) {\n var data = getWeak(anObject(key), true);\n if (data === true) uncaughtFrozenStore(that).set(key, value);\n else data[that._i] = value;\n return that;\n },\n ufstore: uncaughtFrozenStore\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it, TYPE) {\n if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');\n return it;\n};\n","'use strict';\nvar global = require('./_global');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar redefineAll = require('./_redefine-all');\nvar meta = require('./_meta');\nvar forOf = require('./_for-of');\nvar anInstance = require('./_an-instance');\nvar isObject = require('./_is-object');\nvar fails = require('./_fails');\nvar $iterDetect = require('./_iter-detect');\nvar setToStringTag = require('./_set-to-string-tag');\nvar inheritIfRequired = require('./_inherit-if-required');\n\nmodule.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {\n var Base = global[NAME];\n var C = Base;\n var ADDER = IS_MAP ? 'set' : 'add';\n var proto = C && C.prototype;\n var O = {};\n var fixMethod = function (KEY) {\n var fn = proto[KEY];\n redefine(proto, KEY,\n KEY == 'delete' ? function (a) {\n return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);\n } : KEY == 'has' ? function has(a) {\n return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);\n } : KEY == 'get' ? function get(a) {\n return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);\n } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; }\n : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; }\n );\n };\n if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {\n new C().entries().next();\n }))) {\n // create collection constructor\n C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);\n redefineAll(C.prototype, methods);\n meta.NEED = true;\n } else {\n var instance = new C();\n // early implementations not supports chaining\n var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;\n // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false\n var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });\n // most early implementations doesn't supports iterables, most modern - not close it correctly\n var ACCEPT_ITERABLES = $iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new\n // for early implementations -0 and +0 not the same\n var BUGGY_ZERO = !IS_WEAK && fails(function () {\n // V8 ~ Chromium 42- fails only with 5+ elements\n var $instance = new C();\n var index = 5;\n while (index--) $instance[ADDER](index, index);\n return !$instance.has(-0);\n });\n if (!ACCEPT_ITERABLES) {\n C = wrapper(function (target, iterable) {\n anInstance(target, C, NAME);\n var that = inheritIfRequired(new Base(), target, C);\n if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);\n return that;\n });\n C.prototype = proto;\n proto.constructor = C;\n }\n if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {\n fixMethod('delete');\n fixMethod('has');\n IS_MAP && fixMethod('get');\n }\n if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);\n // weak collections should not contains .clear method\n if (IS_WEAK && proto.clear) delete proto.clear;\n }\n\n setToStringTag(C, NAME);\n\n O[NAME] = C;\n $export($export.G + $export.W + $export.F * (C != Base), O);\n\n if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);\n\n return C;\n};\n","var isObject = require('./_is-object');\nvar setPrototypeOf = require('./_set-proto').set;\nmodule.exports = function (that, target, C) {\n var S = target.constructor;\n var P;\n if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {\n setPrototypeOf(that, P);\n } return that;\n};\n","// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nvar isObject = require('./_is-object');\nvar anObject = require('./_an-object');\nvar check = function (O, proto) {\n anObject(O);\n if (!isObject(proto) && proto !== null) throw TypeError(proto + \": can't set as prototype!\");\n};\nmodule.exports = {\n set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line\n function (test, buggy, set) {\n try {\n set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2);\n set(test, []);\n buggy = !(test instanceof Array);\n } catch (e) { buggy = true; }\n return function setPrototypeOf(O, proto) {\n check(O, proto);\n if (buggy) O.__proto__ = proto;\n else set(O, proto);\n return O;\n };\n }({}, false) : undefined),\n check: check\n};\n","var pIE = require('./_object-pie');\nvar createDesc = require('./_property-desc');\nvar toIObject = require('./_to-iobject');\nvar toPrimitive = require('./_to-primitive');\nvar has = require('./_has');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {\n O = toIObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return gOPD(O, P);\n } catch (e) { /* empty */ }\n if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);\n};\n","// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of\nrequire('./_set-collection-of')('WeakMap');\n","'use strict';\n// https://tc39.github.io/proposal-setmap-offrom/\nvar $export = require('./_export');\n\nmodule.exports = function (COLLECTION) {\n $export($export.S, COLLECTION, { of: function of() {\n var length = arguments.length;\n var A = new Array(length);\n while (length--) A[length] = arguments[length];\n return new this(A);\n } });\n};\n","// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from\nrequire('./_set-collection-from')('WeakMap');\n","'use strict';\n// https://tc39.github.io/proposal-setmap-offrom/\nvar $export = require('./_export');\nvar aFunction = require('./_a-function');\nvar ctx = require('./_ctx');\nvar forOf = require('./_for-of');\n\nmodule.exports = function (COLLECTION) {\n $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {\n var mapFn = arguments[1];\n var mapping, A, n, cb;\n aFunction(this);\n mapping = mapFn !== undefined;\n if (mapping) aFunction(mapFn);\n if (source == undefined) return new this();\n A = [];\n if (mapping) {\n n = 0;\n cb = ctx(mapFn, arguments[2], 2);\n forOf(source, false, function (nextItem) {\n A.push(cb(nextItem, n++));\n });\n } else {\n forOf(source, false, A.push, A);\n }\n return new this(A);\n } });\n};\n","require('../../modules/es6.string.code-point-at');\nmodule.exports = require('../../modules/_core').String.codePointAt;\n","'use strict';\nvar $export = require('./_export');\nvar $at = require('./_string-at')(false);\n$export($export.P, 'String', {\n // 21.1.3.3 String.prototype.codePointAt(pos)\n codePointAt: function codePointAt(pos) {\n return $at(this, pos);\n }\n});\n","require('../../modules/es6.string.from-code-point');\nmodule.exports = require('../../modules/_core').String.fromCodePoint;\n","var $export = require('./_export');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nvar fromCharCode = String.fromCharCode;\nvar $fromCodePoint = String.fromCodePoint;\n\n// length should be 1, old FF problem\n$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {\n // 21.1.2.2 String.fromCodePoint(...codePoints)\n fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars\n var res = [];\n var aLen = arguments.length;\n var i = 0;\n var code;\n while (aLen > i) {\n code = +arguments[i++];\n if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point');\n res.push(code < 0x10000\n ? fromCharCode(code)\n : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)\n );\n } return res.join('');\n }\n});\n","require('../modules/es6.symbol');\nrequire('../modules/es6.object.to-string');\nmodule.exports = require('../modules/_core').Symbol;\n","'use strict';\n// ECMAScript 6 symbols shim\nvar global = require('./_global');\nvar has = require('./_has');\nvar DESCRIPTORS = require('./_descriptors');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar META = require('./_meta').KEY;\nvar $fails = require('./_fails');\nvar shared = require('./_shared');\nvar setToStringTag = require('./_set-to-string-tag');\nvar uid = require('./_uid');\nvar wks = require('./_wks');\nvar wksExt = require('./_wks-ext');\nvar wksDefine = require('./_wks-define');\nvar enumKeys = require('./_enum-keys');\nvar isArray = require('./_is-array');\nvar anObject = require('./_an-object');\nvar isObject = require('./_is-object');\nvar toIObject = require('./_to-iobject');\nvar toPrimitive = require('./_to-primitive');\nvar createDesc = require('./_property-desc');\nvar _create = require('./_object-create');\nvar gOPNExt = require('./_object-gopn-ext');\nvar $GOPD = require('./_object-gopd');\nvar $DP = require('./_object-dp');\nvar $keys = require('./_object-keys');\nvar gOPD = $GOPD.f;\nvar dP = $DP.f;\nvar gOPN = gOPNExt.f;\nvar $Symbol = global.Symbol;\nvar $JSON = global.JSON;\nvar _stringify = $JSON && $JSON.stringify;\nvar PROTOTYPE = 'prototype';\nvar HIDDEN = wks('_hidden');\nvar TO_PRIMITIVE = wks('toPrimitive');\nvar isEnum = {}.propertyIsEnumerable;\nvar SymbolRegistry = shared('symbol-registry');\nvar AllSymbols = shared('symbols');\nvar OPSymbols = shared('op-symbols');\nvar ObjectProto = Object[PROTOTYPE];\nvar USE_NATIVE = typeof $Symbol == 'function';\nvar QObject = global.QObject;\n// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar setSymbolDesc = DESCRIPTORS && $fails(function () {\n return _create(dP({}, 'a', {\n get: function () { return dP(this, 'a', { value: 7 }).a; }\n })).a != 7;\n}) ? function (it, key, D) {\n var protoDesc = gOPD(ObjectProto, key);\n if (protoDesc) delete ObjectProto[key];\n dP(it, key, D);\n if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);\n} : dP;\n\nvar wrap = function (tag) {\n var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);\n sym._k = tag;\n return sym;\n};\n\nvar isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n return it instanceof $Symbol;\n};\n\nvar $defineProperty = function defineProperty(it, key, D) {\n if (it === ObjectProto) $defineProperty(OPSymbols, key, D);\n anObject(it);\n key = toPrimitive(key, true);\n anObject(D);\n if (has(AllSymbols, key)) {\n if (!D.enumerable) {\n if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));\n it[HIDDEN][key] = true;\n } else {\n if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;\n D = _create(D, { enumerable: createDesc(0, false) });\n } return setSymbolDesc(it, key, D);\n } return dP(it, key, D);\n};\nvar $defineProperties = function defineProperties(it, P) {\n anObject(it);\n var keys = enumKeys(P = toIObject(P));\n var i = 0;\n var l = keys.length;\n var key;\n while (l > i) $defineProperty(it, key = keys[i++], P[key]);\n return it;\n};\nvar $create = function create(it, P) {\n return P === undefined ? _create(it) : $defineProperties(_create(it), P);\n};\nvar $propertyIsEnumerable = function propertyIsEnumerable(key) {\n var E = isEnum.call(this, key = toPrimitive(key, true));\n if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;\n return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;\n};\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {\n it = toIObject(it);\n key = toPrimitive(key, true);\n if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;\n var D = gOPD(it, key);\n if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;\n return D;\n};\nvar $getOwnPropertyNames = function getOwnPropertyNames(it) {\n var names = gOPN(toIObject(it));\n var result = [];\n var i = 0;\n var key;\n while (names.length > i) {\n if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);\n } return result;\n};\nvar $getOwnPropertySymbols = function getOwnPropertySymbols(it) {\n var IS_OP = it === ObjectProto;\n var names = gOPN(IS_OP ? OPSymbols : toIObject(it));\n var result = [];\n var i = 0;\n var key;\n while (names.length > i) {\n if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);\n } return result;\n};\n\n// 19.4.1.1 Symbol([description])\nif (!USE_NATIVE) {\n $Symbol = function Symbol() {\n if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');\n var tag = uid(arguments.length > 0 ? arguments[0] : undefined);\n var $set = function (value) {\n if (this === ObjectProto) $set.call(OPSymbols, value);\n if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDesc(this, tag, createDesc(1, value));\n };\n if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });\n return wrap(tag);\n };\n redefine($Symbol[PROTOTYPE], 'toString', function toString() {\n return this._k;\n });\n\n $GOPD.f = $getOwnPropertyDescriptor;\n $DP.f = $defineProperty;\n require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames;\n require('./_object-pie').f = $propertyIsEnumerable;\n require('./_object-gops').f = $getOwnPropertySymbols;\n\n if (DESCRIPTORS && !require('./_library')) {\n redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);\n }\n\n wksExt.f = function (name) {\n return wrap(wks(name));\n };\n}\n\n$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });\n\nfor (var es6Symbols = (\n // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14\n 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'\n).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);\n\nfor (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);\n\n$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {\n // 19.4.2.1 Symbol.for(key)\n 'for': function (key) {\n return has(SymbolRegistry, key += '')\n ? SymbolRegistry[key]\n : SymbolRegistry[key] = $Symbol(key);\n },\n // 19.4.2.5 Symbol.keyFor(sym)\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');\n for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;\n },\n useSetter: function () { setter = true; },\n useSimple: function () { setter = false; }\n});\n\n$export($export.S + $export.F * !USE_NATIVE, 'Object', {\n // 19.1.2.2 Object.create(O [, Properties])\n create: $create,\n // 19.1.2.4 Object.defineProperty(O, P, Attributes)\n defineProperty: $defineProperty,\n // 19.1.2.3 Object.defineProperties(O, Properties)\n defineProperties: $defineProperties,\n // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor,\n // 19.1.2.7 Object.getOwnPropertyNames(O)\n getOwnPropertyNames: $getOwnPropertyNames,\n // 19.1.2.8 Object.getOwnPropertySymbols(O)\n getOwnPropertySymbols: $getOwnPropertySymbols\n});\n\n// 24.3.2 JSON.stringify(value [, replacer [, space]])\n$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {\n var S = $Symbol();\n // MS Edge converts symbol values to JSON as {}\n // WebKit converts symbol values to JSON as null\n // V8 throws on boxed symbols\n return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';\n})), 'JSON', {\n stringify: function stringify(it) {\n var args = [it];\n var i = 1;\n var replacer, $replacer;\n while (arguments.length > i) args.push(arguments[i++]);\n $replacer = replacer = args[1];\n if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n if (!isArray(replacer)) replacer = function (key, value) {\n if (typeof $replacer == 'function') value = $replacer.call(this, key, value);\n if (!isSymbol(value)) return value;\n };\n args[1] = replacer;\n return _stringify.apply($JSON, args);\n }\n});\n\n// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)\n$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);\n// 19.4.3.5 Symbol.prototype[@@toStringTag]\nsetToStringTag($Symbol, 'Symbol');\n// 20.2.1.9 Math[@@toStringTag]\nsetToStringTag(Math, 'Math', true);\n// 24.3.3 JSON[@@toStringTag]\nsetToStringTag(global.JSON, 'JSON', true);\n","exports.f = require('./_wks');\n","var global = require('./_global');\nvar core = require('./_core');\nvar LIBRARY = require('./_library');\nvar wksExt = require('./_wks-ext');\nvar defineProperty = require('./_object-dp').f;\nmodule.exports = function (name) {\n var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});\n if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });\n};\n","// all enumerable object keys, includes symbols\nvar getKeys = require('./_object-keys');\nvar gOPS = require('./_object-gops');\nvar pIE = require('./_object-pie');\nmodule.exports = function (it) {\n var result = getKeys(it);\n var getSymbols = gOPS.f;\n if (getSymbols) {\n var symbols = getSymbols(it);\n var isEnum = pIE.f;\n var i = 0;\n var key;\n while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);\n } return result;\n};\n","// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nvar toIObject = require('./_to-iobject');\nvar gOPN = require('./_object-gopn').f;\nvar toString = {}.toString;\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function (it) {\n try {\n return gOPN(it);\n } catch (e) {\n return windowNames.slice();\n }\n};\n\nmodule.exports.f = function getOwnPropertyNames(it) {\n return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));\n};\n","// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)\nvar $keys = require('./_object-keys-internal');\nvar hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');\n\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return $keys(O, hiddenKeys);\n};\n","require('../../modules/es7.object.values');\nmodule.exports = require('../../modules/_core').Object.values;\n","// https://github.com/tc39/proposal-object-values-entries\nvar $export = require('./_export');\nvar $values = require('./_object-to-array')(false);\n\n$export($export.S, 'Object', {\n values: function values(it) {\n return $values(it);\n }\n});\n","var getKeys = require('./_object-keys');\nvar toIObject = require('./_to-iobject');\nvar isEnum = require('./_object-pie').f;\nmodule.exports = function (isEntries) {\n return function (it) {\n var O = toIObject(it);\n var keys = getKeys(O);\n var length = keys.length;\n var i = 0;\n var result = [];\n var key;\n while (length > i) if (isEnum.call(O, key = keys[i++])) {\n result.push(isEntries ? [key, O[key]] : O[key]);\n } return result;\n };\n};\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint-disable no-restricted-globals */\n\nlet isReadableStreamSupported = false;\nif (typeof ReadableStream !== 'undefined') {\n // MS Edge may say it has ReadableStream but they are not up to spec yet.\n try {\n // eslint-disable-next-line no-new\n new ReadableStream({\n start(controller) {\n controller.close();\n },\n });\n isReadableStreamSupported = true;\n } catch (e) {\n // The ReadableStream constructor cannot be used.\n }\n}\nif (isReadableStreamSupported) {\n exports.ReadableStream = ReadableStream;\n} else {\n if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('IMAGE_DECODERS')) {\n class DummyReadableStream {\n constructor() {\n throw new Error('The current image decoders are synchronous, ' +\n 'hence `ReadableStream` shouldn\\'t need to be ' +\n 'polyfilled for the IMAGE_DECODERS build target.');\n }\n }\n exports.ReadableStream = DummyReadableStream;\n } else {\n exports.ReadableStream =\n require('../../external/streams/streams-lib').ReadableStream;\n }\n}\n","/*\n * To the extent possible under law, the authors have dedicated all copyright\n * and related and neighboring rights to this software to the public\n * domain worldwide. This software is distributed without any warranty.\n *\n * You should have received a copy of the CC0 Public Domain Dedication along\n * with this software. If not, see https://creativecommons.org/publicdomain/zero/1.0/.\n */\n\n(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap\n/******/ // The module cache\n/******/ var installedModules = {};\n/******/\n/******/ // The require function\n/******/ function __w_pdfjs_require__(moduleId) {\n/******/\n/******/ // Check if module is in cache\n/******/ if(installedModules[moduleId])\n/******/ return installedModules[moduleId].exports;\n/******/\n/******/ // Create a new module (and put it into the cache)\n/******/ var module = installedModules[moduleId] = {\n/******/ i: moduleId,\n/******/ l: false,\n/******/ exports: {}\n/******/ };\n/******/\n/******/ // Execute the module function\n/******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);\n/******/\n/******/ // Flag the module as loaded\n/******/ module.l = true;\n/******/\n/******/ // Return the exports of the module\n/******/ return module.exports;\n/******/ }\n/******/\n/******/\n/******/ // expose the modules object (__webpack_modules__)\n/******/ __w_pdfjs_require__.m = modules;\n/******/\n/******/ // expose the module cache\n/******/ __w_pdfjs_require__.c = installedModules;\n/******/\n/******/ // identity function for calling harmony imports with the correct context\n/******/ __w_pdfjs_require__.i = function(value) { return value; };\n/******/\n/******/ // define getter function for harmony exports\n/******/ __w_pdfjs_require__.d = function(exports, name, getter) {\n/******/ if(!__w_pdfjs_require__.o(exports, name)) {\n/******/ Object.defineProperty(exports, name, {\n/******/ configurable: false,\n/******/ enumerable: true,\n/******/ get: getter\n/******/ });\n/******/ }\n/******/ };\n/******/\n/******/ // getDefaultExport function for compatibility with non-harmony modules\n/******/ __w_pdfjs_require__.n = function(module) {\n/******/ var getter = module && module.__esModule ?\n/******/ function getDefault() { return module['default']; } :\n/******/ function getModuleExports() { return module; };\n/******/ __w_pdfjs_require__.d(getter, 'a', getter);\n/******/ return getter;\n/******/ };\n/******/\n/******/ // Object.prototype.hasOwnProperty.call\n/******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ // __webpack_public_path__\n/******/ __w_pdfjs_require__.p = \"\";\n/******/\n/******/ // Load entry module and return exports\n/******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 7);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _require = __w_pdfjs_require__(1),\n assert = _require.assert;\n\nfunction IsPropertyKey(argument) {\n return typeof argument === 'string' || (typeof argument === 'undefined' ? 'undefined' : _typeof(argument)) === 'symbol';\n}\n\nexports.typeIsObject = function (x) {\n return (typeof x === 'undefined' ? 'undefined' : _typeof(x)) === 'object' && x !== null || typeof x === 'function';\n};\n\nexports.createDataProperty = function (o, p, v) {\n assert(exports.typeIsObject(o));\n Object.defineProperty(o, p, { value: v, writable: true, enumerable: true, configurable: true });\n};\n\nexports.createArrayFromList = function (elements) {\n // We use arrays to represent lists, so this is basically a no-op.\n // Do a slice though just in case we happen to depend on the unique-ness.\n return elements.slice();\n};\n\nexports.ArrayBufferCopy = function (dest, destOffset, src, srcOffset, n) {\n new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);\n};\n\nexports.CreateIterResultObject = function (value, done) {\n assert(typeof done === 'boolean');\n var obj = {};\n Object.defineProperty(obj, 'value', { value: value, enumerable: true, writable: true, configurable: true });\n Object.defineProperty(obj, 'done', { value: done, enumerable: true, writable: true, configurable: true });\n return obj;\n};\n\nexports.IsFiniteNonNegativeNumber = function (v) {\n if (Number.isNaN(v)) {\n return false;\n }\n if (v === Infinity) {\n return false;\n }\n if (v < 0) {\n return false;\n }\n\n return true;\n};\n\nfunction Call(F, V, args) {\n if (typeof F !== 'function') {\n throw new TypeError('Argument is not a function');\n }\n\n return Function.prototype.apply.call(F, V, args);\n}\n\nexports.InvokeOrNoop = function (O, P, args) {\n assert(O !== undefined);\n assert(IsPropertyKey(P));\n assert(Array.isArray(args));\n\n var method = O[P];\n if (method === undefined) {\n return undefined;\n }\n\n return Call(method, O, args);\n};\n\nexports.PromiseInvokeOrNoop = function (O, P, args) {\n assert(O !== undefined);\n assert(IsPropertyKey(P));\n assert(Array.isArray(args));\n try {\n return Promise.resolve(exports.InvokeOrNoop(O, P, args));\n } catch (returnValueE) {\n return Promise.reject(returnValueE);\n }\n};\n\nexports.PromiseInvokeOrPerformFallback = function (O, P, args, F, argsF) {\n assert(O !== undefined);\n assert(IsPropertyKey(P));\n assert(Array.isArray(args));\n assert(Array.isArray(argsF));\n\n var method = void 0;\n try {\n method = O[P];\n } catch (methodE) {\n return Promise.reject(methodE);\n }\n\n if (method === undefined) {\n return F.apply(null, argsF);\n }\n\n try {\n return Promise.resolve(Call(method, O, args));\n } catch (e) {\n return Promise.reject(e);\n }\n};\n\n// Not implemented correctly\nexports.TransferArrayBuffer = function (O) {\n return O.slice();\n};\n\nexports.ValidateAndNormalizeHighWaterMark = function (highWaterMark) {\n highWaterMark = Number(highWaterMark);\n if (Number.isNaN(highWaterMark) || highWaterMark < 0) {\n throw new RangeError('highWaterMark property of a queuing strategy must be non-negative and non-NaN');\n }\n\n return highWaterMark;\n};\n\nexports.ValidateAndNormalizeQueuingStrategy = function (size, highWaterMark) {\n if (size !== undefined && typeof size !== 'function') {\n throw new TypeError('size property of a queuing strategy must be a function');\n }\n\n highWaterMark = exports.ValidateAndNormalizeHighWaterMark(highWaterMark);\n\n return { size: size, highWaterMark: highWaterMark };\n};\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nfunction rethrowAssertionErrorRejection(e) {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e.constructor === AssertionError) {\n setTimeout(function () {\n throw e;\n }, 0);\n }\n};\n\nfunction AssertionError(message) {\n this.name = 'AssertionError';\n this.message = message || '';\n this.stack = new Error().stack;\n}\nAssertionError.prototype = Object.create(Error.prototype);\nAssertionError.prototype.constructor = AssertionError;\n\nfunction assert(value, message) {\n if (!value) {\n throw new AssertionError(message);\n }\n}\n\nmodule.exports = {\n rethrowAssertionErrorRejection: rethrowAssertionErrorRejection,\n AssertionError: AssertionError,\n assert: assert\n};\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar _require = __w_pdfjs_require__(0),\n InvokeOrNoop = _require.InvokeOrNoop,\n PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop,\n ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy,\n typeIsObject = _require.typeIsObject;\n\nvar _require2 = __w_pdfjs_require__(1),\n assert = _require2.assert,\n rethrowAssertionErrorRejection = _require2.rethrowAssertionErrorRejection;\n\nvar _require3 = __w_pdfjs_require__(3),\n DequeueValue = _require3.DequeueValue,\n EnqueueValueWithSize = _require3.EnqueueValueWithSize,\n PeekQueueValue = _require3.PeekQueueValue,\n ResetQueue = _require3.ResetQueue;\n\nvar WritableStream = function () {\n function WritableStream() {\n var underlyingSink = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n size = _ref.size,\n _ref$highWaterMark = _ref.highWaterMark,\n highWaterMark = _ref$highWaterMark === undefined ? 1 : _ref$highWaterMark;\n\n _classCallCheck(this, WritableStream);\n\n this._state = 'writable';\n\n // The error that will be reported by new method calls once the state becomes errored. Only set when [[state]] is\n // 'erroring' or 'errored'. May be set to an undefined value.\n this._storedError = undefined;\n\n this._writer = undefined;\n\n // Initialize to undefined first because the constructor of the controller checks this\n // variable to validate the caller.\n this._writableStreamController = undefined;\n\n // This queue is placed here instead of the writer class in order to allow for passing a writer to the next data\n // producer without waiting for the queued writes to finish.\n this._writeRequests = [];\n\n // Write requests are removed from _writeRequests when write() is called on the underlying sink. This prevents\n // them from being erroneously rejected on error. If a write() call is in-flight, the request is stored here.\n this._inFlightWriteRequest = undefined;\n\n // The promise that was returned from writer.close(). Stored here because it may be fulfilled after the writer\n // has been detached.\n this._closeRequest = undefined;\n\n // Close request is removed from _closeRequest when close() is called on the underlying sink. This prevents it\n // from being erroneously rejected on error. If a close() call is in-flight, the request is stored here.\n this._inFlightCloseRequest = undefined;\n\n // The promise that was returned from writer.abort(). This may also be fulfilled after the writer has detached.\n this._pendingAbortRequest = undefined;\n\n // The backpressure signal set by the controller.\n this._backpressure = false;\n\n var type = underlyingSink.type;\n\n if (type !== undefined) {\n throw new RangeError('Invalid type is specified');\n }\n\n this._writableStreamController = new WritableStreamDefaultController(this, underlyingSink, size, highWaterMark);\n this._writableStreamController.__startSteps();\n }\n\n _createClass(WritableStream, [{\n key: 'abort',\n value: function abort(reason) {\n if (IsWritableStream(this) === false) {\n return Promise.reject(streamBrandCheckException('abort'));\n }\n\n if (IsWritableStreamLocked(this) === true) {\n return Promise.reject(new TypeError('Cannot abort a stream that already has a writer'));\n }\n\n return WritableStreamAbort(this, reason);\n }\n }, {\n key: 'getWriter',\n value: function getWriter() {\n if (IsWritableStream(this) === false) {\n throw streamBrandCheckException('getWriter');\n }\n\n return AcquireWritableStreamDefaultWriter(this);\n }\n }, {\n key: 'locked',\n get: function get() {\n if (IsWritableStream(this) === false) {\n throw streamBrandCheckException('locked');\n }\n\n return IsWritableStreamLocked(this);\n }\n }]);\n\n return WritableStream;\n}();\n\nmodule.exports = {\n AcquireWritableStreamDefaultWriter: AcquireWritableStreamDefaultWriter,\n IsWritableStream: IsWritableStream,\n IsWritableStreamLocked: IsWritableStreamLocked,\n WritableStream: WritableStream,\n WritableStreamAbort: WritableStreamAbort,\n WritableStreamDefaultControllerError: WritableStreamDefaultControllerError,\n WritableStreamDefaultWriterCloseWithErrorPropagation: WritableStreamDefaultWriterCloseWithErrorPropagation,\n WritableStreamDefaultWriterRelease: WritableStreamDefaultWriterRelease,\n WritableStreamDefaultWriterWrite: WritableStreamDefaultWriterWrite,\n WritableStreamCloseQueuedOrInFlight: WritableStreamCloseQueuedOrInFlight\n};\n\n// Abstract operations for the WritableStream.\n\nfunction AcquireWritableStreamDefaultWriter(stream) {\n return new WritableStreamDefaultWriter(stream);\n}\n\nfunction IsWritableStream(x) {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {\n return false;\n }\n\n return true;\n}\n\nfunction IsWritableStreamLocked(stream) {\n assert(IsWritableStream(stream) === true, 'IsWritableStreamLocked should only be used on known writable streams');\n\n if (stream._writer === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamAbort(stream, reason) {\n var state = stream._state;\n if (state === 'closed') {\n return Promise.resolve(undefined);\n }\n if (state === 'errored') {\n return Promise.reject(stream._storedError);\n }\n var error = new TypeError('Requested to abort');\n if (stream._pendingAbortRequest !== undefined) {\n return Promise.reject(error);\n }\n\n assert(state === 'writable' || state === 'erroring', 'state must be writable or erroring');\n\n var wasAlreadyErroring = false;\n if (state === 'erroring') {\n wasAlreadyErroring = true;\n // reason will not be used, so don't keep a reference to it.\n reason = undefined;\n }\n\n var promise = new Promise(function (resolve, reject) {\n stream._pendingAbortRequest = {\n _resolve: resolve,\n _reject: reject,\n _reason: reason,\n _wasAlreadyErroring: wasAlreadyErroring\n };\n });\n\n if (wasAlreadyErroring === false) {\n WritableStreamStartErroring(stream, error);\n }\n\n return promise;\n}\n\n// WritableStream API exposed for controllers.\n\nfunction WritableStreamAddWriteRequest(stream) {\n assert(IsWritableStreamLocked(stream) === true);\n assert(stream._state === 'writable');\n\n var promise = new Promise(function (resolve, reject) {\n var writeRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._writeRequests.push(writeRequest);\n });\n\n return promise;\n}\n\nfunction WritableStreamDealWithRejection(stream, error) {\n var state = stream._state;\n\n if (state === 'writable') {\n WritableStreamStartErroring(stream, error);\n return;\n }\n\n assert(state === 'erroring');\n WritableStreamFinishErroring(stream);\n}\n\nfunction WritableStreamStartErroring(stream, reason) {\n assert(stream._storedError === undefined, 'stream._storedError === undefined');\n assert(stream._state === 'writable', 'state must be writable');\n\n var controller = stream._writableStreamController;\n assert(controller !== undefined, 'controller must not be undefined');\n\n stream._state = 'erroring';\n stream._storedError = reason;\n var writer = stream._writer;\n if (writer !== undefined) {\n WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);\n }\n\n if (WritableStreamHasOperationMarkedInFlight(stream) === false && controller._started === true) {\n WritableStreamFinishErroring(stream);\n }\n}\n\nfunction WritableStreamFinishErroring(stream) {\n assert(stream._state === 'erroring', 'stream._state === erroring');\n assert(WritableStreamHasOperationMarkedInFlight(stream) === false, 'WritableStreamHasOperationMarkedInFlight(stream) === false');\n stream._state = 'errored';\n stream._writableStreamController.__errorSteps();\n\n var storedError = stream._storedError;\n for (var i = 0; i < stream._writeRequests.length; i++) {\n var writeRequest = stream._writeRequests[i];\n writeRequest._reject(storedError);\n }\n stream._writeRequests = [];\n\n if (stream._pendingAbortRequest === undefined) {\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n\n var abortRequest = stream._pendingAbortRequest;\n stream._pendingAbortRequest = undefined;\n\n if (abortRequest._wasAlreadyErroring === true) {\n abortRequest._reject(storedError);\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n\n var promise = stream._writableStreamController.__abortSteps(abortRequest._reason);\n promise.then(function () {\n abortRequest._resolve();\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n }, function (reason) {\n abortRequest._reject(reason);\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n });\n}\n\nfunction WritableStreamFinishInFlightWrite(stream) {\n assert(stream._inFlightWriteRequest !== undefined);\n stream._inFlightWriteRequest._resolve(undefined);\n stream._inFlightWriteRequest = undefined;\n}\n\nfunction WritableStreamFinishInFlightWriteWithError(stream, error) {\n assert(stream._inFlightWriteRequest !== undefined);\n stream._inFlightWriteRequest._reject(error);\n stream._inFlightWriteRequest = undefined;\n\n assert(stream._state === 'writable' || stream._state === 'erroring');\n\n WritableStreamDealWithRejection(stream, error);\n}\n\nfunction WritableStreamFinishInFlightClose(stream) {\n assert(stream._inFlightCloseRequest !== undefined);\n stream._inFlightCloseRequest._resolve(undefined);\n stream._inFlightCloseRequest = undefined;\n\n var state = stream._state;\n\n assert(state === 'writable' || state === 'erroring');\n\n if (state === 'erroring') {\n // The error was too late to do anything, so it is ignored.\n stream._storedError = undefined;\n if (stream._pendingAbortRequest !== undefined) {\n stream._pendingAbortRequest._resolve();\n stream._pendingAbortRequest = undefined;\n }\n }\n\n stream._state = 'closed';\n\n var writer = stream._writer;\n if (writer !== undefined) {\n defaultWriterClosedPromiseResolve(writer);\n }\n\n assert(stream._pendingAbortRequest === undefined, 'stream._pendingAbortRequest === undefined');\n assert(stream._storedError === undefined, 'stream._storedError === undefined');\n}\n\nfunction WritableStreamFinishInFlightCloseWithError(stream, error) {\n assert(stream._inFlightCloseRequest !== undefined);\n stream._inFlightCloseRequest._reject(error);\n stream._inFlightCloseRequest = undefined;\n\n assert(stream._state === 'writable' || stream._state === 'erroring');\n\n // Never execute sink abort() after sink close().\n if (stream._pendingAbortRequest !== undefined) {\n stream._pendingAbortRequest._reject(error);\n stream._pendingAbortRequest = undefined;\n }\n WritableStreamDealWithRejection(stream, error);\n}\n\n// TODO(ricea): Fix alphabetical order.\nfunction WritableStreamCloseQueuedOrInFlight(stream) {\n if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamHasOperationMarkedInFlight(stream) {\n if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamMarkCloseRequestInFlight(stream) {\n assert(stream._inFlightCloseRequest === undefined);\n assert(stream._closeRequest !== undefined);\n stream._inFlightCloseRequest = stream._closeRequest;\n stream._closeRequest = undefined;\n}\n\nfunction WritableStreamMarkFirstWriteRequestInFlight(stream) {\n assert(stream._inFlightWriteRequest === undefined, 'there must be no pending write request');\n assert(stream._writeRequests.length !== 0, 'writeRequests must not be empty');\n stream._inFlightWriteRequest = stream._writeRequests.shift();\n}\n\nfunction WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream) {\n assert(stream._state === 'errored', '_stream_.[[state]] is `\"errored\"`');\n if (stream._closeRequest !== undefined) {\n assert(stream._inFlightCloseRequest === undefined);\n\n stream._closeRequest._reject(stream._storedError);\n stream._closeRequest = undefined;\n }\n var writer = stream._writer;\n if (writer !== undefined) {\n defaultWriterClosedPromiseReject(writer, stream._storedError);\n writer._closedPromise.catch(function () {});\n }\n}\n\nfunction WritableStreamUpdateBackpressure(stream, backpressure) {\n assert(stream._state === 'writable');\n assert(WritableStreamCloseQueuedOrInFlight(stream) === false);\n\n var writer = stream._writer;\n if (writer !== undefined && backpressure !== stream._backpressure) {\n if (backpressure === true) {\n defaultWriterReadyPromiseReset(writer);\n } else {\n assert(backpressure === false);\n\n defaultWriterReadyPromiseResolve(writer);\n }\n }\n\n stream._backpressure = backpressure;\n}\n\nvar WritableStreamDefaultWriter = function () {\n function WritableStreamDefaultWriter(stream) {\n _classCallCheck(this, WritableStreamDefaultWriter);\n\n if (IsWritableStream(stream) === false) {\n throw new TypeError('WritableStreamDefaultWriter can only be constructed with a WritableStream instance');\n }\n if (IsWritableStreamLocked(stream) === true) {\n throw new TypeError('This stream has already been locked for exclusive writing by another writer');\n }\n\n this._ownerWritableStream = stream;\n stream._writer = this;\n\n var state = stream._state;\n\n if (state === 'writable') {\n if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._backpressure === true) {\n defaultWriterReadyPromiseInitialize(this);\n } else {\n defaultWriterReadyPromiseInitializeAsResolved(this);\n }\n\n defaultWriterClosedPromiseInitialize(this);\n } else if (state === 'erroring') {\n defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError);\n this._readyPromise.catch(function () {});\n defaultWriterClosedPromiseInitialize(this);\n } else if (state === 'closed') {\n defaultWriterReadyPromiseInitializeAsResolved(this);\n defaultWriterClosedPromiseInitializeAsResolved(this);\n } else {\n assert(state === 'errored', 'state must be errored');\n\n var storedError = stream._storedError;\n defaultWriterReadyPromiseInitializeAsRejected(this, storedError);\n this._readyPromise.catch(function () {});\n defaultWriterClosedPromiseInitializeAsRejected(this, storedError);\n this._closedPromise.catch(function () {});\n }\n }\n\n _createClass(WritableStreamDefaultWriter, [{\n key: 'abort',\n value: function abort(reason) {\n if (IsWritableStreamDefaultWriter(this) === false) {\n return Promise.reject(defaultWriterBrandCheckException('abort'));\n }\n\n if (this._ownerWritableStream === undefined) {\n return Promise.reject(defaultWriterLockException('abort'));\n }\n\n return WritableStreamDefaultWriterAbort(this, reason);\n }\n }, {\n key: 'close',\n value: function close() {\n if (IsWritableStreamDefaultWriter(this) === false) {\n return Promise.reject(defaultWriterBrandCheckException('close'));\n }\n\n var stream = this._ownerWritableStream;\n\n if (stream === undefined) {\n return Promise.reject(defaultWriterLockException('close'));\n }\n\n if (WritableStreamCloseQueuedOrInFlight(stream) === true) {\n return Promise.reject(new TypeError('cannot close an already-closing stream'));\n }\n\n return WritableStreamDefaultWriterClose(this);\n }\n }, {\n key: 'releaseLock',\n value: function releaseLock() {\n if (IsWritableStreamDefaultWriter(this) === false) {\n throw defaultWriterBrandCheckException('releaseLock');\n }\n\n var stream = this._ownerWritableStream;\n\n if (stream === undefined) {\n return;\n }\n\n assert(stream._writer !== undefined);\n\n WritableStreamDefaultWriterRelease(this);\n }\n }, {\n key: 'write',\n value: function write(chunk) {\n if (IsWritableStreamDefaultWriter(this) === false) {\n return Promise.reject(defaultWriterBrandCheckException('write'));\n }\n\n if (this._ownerWritableStream === undefined) {\n return Promise.reject(defaultWriterLockException('write to'));\n }\n\n return WritableStreamDefaultWriterWrite(this, chunk);\n }\n }, {\n key: 'closed',\n get: function get() {\n if (IsWritableStreamDefaultWriter(this) === false) {\n return Promise.reject(defaultWriterBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n }, {\n key: 'desiredSize',\n get: function get() {\n if (IsWritableStreamDefaultWriter(this) === false) {\n throw defaultWriterBrandCheckException('desiredSize');\n }\n\n if (this._ownerWritableStream === undefined) {\n throw defaultWriterLockException('desiredSize');\n }\n\n return WritableStreamDefaultWriterGetDesiredSize(this);\n }\n }, {\n key: 'ready',\n get: function get() {\n if (IsWritableStreamDefaultWriter(this) === false) {\n return Promise.reject(defaultWriterBrandCheckException('ready'));\n }\n\n return this._readyPromise;\n }\n }]);\n\n return WritableStreamDefaultWriter;\n}();\n\n// Abstract operations for the WritableStreamDefaultWriter.\n\nfunction IsWritableStreamDefaultWriter(x) {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {\n return false;\n }\n\n return true;\n}\n\n// A client of WritableStreamDefaultWriter may use these functions directly to bypass state check.\n\nfunction WritableStreamDefaultWriterAbort(writer, reason) {\n var stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n return WritableStreamAbort(stream, reason);\n}\n\nfunction WritableStreamDefaultWriterClose(writer) {\n var stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n var state = stream._state;\n if (state === 'closed' || state === 'errored') {\n return Promise.reject(new TypeError('The stream (in ' + state + ' state) is not in the writable state and cannot be closed'));\n }\n\n assert(state === 'writable' || state === 'erroring');\n assert(WritableStreamCloseQueuedOrInFlight(stream) === false);\n\n var promise = new Promise(function (resolve, reject) {\n var closeRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._closeRequest = closeRequest;\n });\n\n if (stream._backpressure === true && state === 'writable') {\n defaultWriterReadyPromiseResolve(writer);\n }\n\n WritableStreamDefaultControllerClose(stream._writableStreamController);\n\n return promise;\n}\n\nfunction WritableStreamDefaultWriterCloseWithErrorPropagation(writer) {\n var stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n var state = stream._state;\n if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {\n return Promise.resolve();\n }\n\n if (state === 'errored') {\n return Promise.reject(stream._storedError);\n }\n\n assert(state === 'writable' || state === 'erroring');\n\n return WritableStreamDefaultWriterClose(writer);\n}\n\nfunction WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error) {\n if (writer._closedPromiseState === 'pending') {\n defaultWriterClosedPromiseReject(writer, error);\n } else {\n defaultWriterClosedPromiseResetToRejected(writer, error);\n }\n writer._closedPromise.catch(function () {});\n}\n\nfunction WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) {\n if (writer._readyPromiseState === 'pending') {\n defaultWriterReadyPromiseReject(writer, error);\n } else {\n defaultWriterReadyPromiseResetToRejected(writer, error);\n }\n writer._readyPromise.catch(function () {});\n}\n\nfunction WritableStreamDefaultWriterGetDesiredSize(writer) {\n var stream = writer._ownerWritableStream;\n var state = stream._state;\n\n if (state === 'errored' || state === 'erroring') {\n return null;\n }\n\n if (state === 'closed') {\n return 0;\n }\n\n return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController);\n}\n\nfunction WritableStreamDefaultWriterRelease(writer) {\n var stream = writer._ownerWritableStream;\n assert(stream !== undefined);\n assert(stream._writer === writer);\n\n var releasedError = new TypeError('Writer was released and can no longer be used to monitor the stream\\'s closedness');\n\n WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);\n\n // The state transitions to \"errored\" before the sink abort() method runs, but the writer.closed promise is not\n // rejected until afterwards. This means that simply testing state will not work.\n WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);\n\n stream._writer = undefined;\n writer._ownerWritableStream = undefined;\n}\n\nfunction WritableStreamDefaultWriterWrite(writer, chunk) {\n var stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n var controller = stream._writableStreamController;\n\n var chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk);\n\n if (stream !== writer._ownerWritableStream) {\n return Promise.reject(defaultWriterLockException('write to'));\n }\n\n var state = stream._state;\n if (state === 'errored') {\n return Promise.reject(stream._storedError);\n }\n if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {\n return Promise.reject(new TypeError('The stream is closing or closed and cannot be written to'));\n }\n if (state === 'erroring') {\n return Promise.reject(stream._storedError);\n }\n\n assert(state === 'writable');\n\n var promise = WritableStreamAddWriteRequest(stream);\n\n WritableStreamDefaultControllerWrite(controller, chunk, chunkSize);\n\n return promise;\n}\n\nvar WritableStreamDefaultController = function () {\n function WritableStreamDefaultController(stream, underlyingSink, size, highWaterMark) {\n _classCallCheck(this, WritableStreamDefaultController);\n\n if (IsWritableStream(stream) === false) {\n throw new TypeError('WritableStreamDefaultController can only be constructed with a WritableStream instance');\n }\n\n if (stream._writableStreamController !== undefined) {\n throw new TypeError('WritableStreamDefaultController instances can only be created by the WritableStream constructor');\n }\n\n this._controlledWritableStream = stream;\n\n this._underlyingSink = underlyingSink;\n\n // Need to set the slots so that the assert doesn't fire. In the spec the slots already exist implicitly.\n this._queue = undefined;\n this._queueTotalSize = undefined;\n ResetQueue(this);\n\n this._started = false;\n\n var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark);\n this._strategySize = normalizedStrategy.size;\n this._strategyHWM = normalizedStrategy.highWaterMark;\n\n var backpressure = WritableStreamDefaultControllerGetBackpressure(this);\n WritableStreamUpdateBackpressure(stream, backpressure);\n }\n\n _createClass(WritableStreamDefaultController, [{\n key: 'error',\n value: function error(e) {\n if (IsWritableStreamDefaultController(this) === false) {\n throw new TypeError('WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController');\n }\n var state = this._controlledWritableStream._state;\n if (state !== 'writable') {\n // The stream is closed, errored or will be soon. The sink can't do anything useful if it gets an error here, so\n // just treat it as a no-op.\n return;\n }\n\n WritableStreamDefaultControllerError(this, e);\n }\n }, {\n key: '__abortSteps',\n value: function __abortSteps(reason) {\n return PromiseInvokeOrNoop(this._underlyingSink, 'abort', [reason]);\n }\n }, {\n key: '__errorSteps',\n value: function __errorSteps() {\n ResetQueue(this);\n }\n }, {\n key: '__startSteps',\n value: function __startSteps() {\n var _this = this;\n\n var startResult = InvokeOrNoop(this._underlyingSink, 'start', [this]);\n var stream = this._controlledWritableStream;\n\n Promise.resolve(startResult).then(function () {\n assert(stream._state === 'writable' || stream._state === 'erroring');\n _this._started = true;\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(_this);\n }, function (r) {\n assert(stream._state === 'writable' || stream._state === 'erroring');\n _this._started = true;\n WritableStreamDealWithRejection(stream, r);\n }).catch(rethrowAssertionErrorRejection);\n }\n }]);\n\n return WritableStreamDefaultController;\n}();\n\n// Abstract operations implementing interface required by the WritableStream.\n\nfunction WritableStreamDefaultControllerClose(controller) {\n EnqueueValueWithSize(controller, 'close', 0);\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n}\n\nfunction WritableStreamDefaultControllerGetChunkSize(controller, chunk) {\n var strategySize = controller._strategySize;\n\n if (strategySize === undefined) {\n return 1;\n }\n\n try {\n return strategySize(chunk);\n } catch (chunkSizeE) {\n WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);\n return 1;\n }\n}\n\nfunction WritableStreamDefaultControllerGetDesiredSize(controller) {\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\nfunction WritableStreamDefaultControllerWrite(controller, chunk, chunkSize) {\n var writeRecord = { chunk: chunk };\n\n try {\n EnqueueValueWithSize(controller, writeRecord, chunkSize);\n } catch (enqueueE) {\n WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);\n return;\n }\n\n var stream = controller._controlledWritableStream;\n if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._state === 'writable') {\n var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n }\n\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n}\n\n// Abstract operations for the WritableStreamDefaultController.\n\nfunction IsWritableStreamDefaultController(x) {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSink')) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller) {\n var stream = controller._controlledWritableStream;\n\n if (controller._started === false) {\n return;\n }\n\n if (stream._inFlightWriteRequest !== undefined) {\n return;\n }\n\n var state = stream._state;\n if (state === 'closed' || state === 'errored') {\n return;\n }\n if (state === 'erroring') {\n WritableStreamFinishErroring(stream);\n return;\n }\n\n if (controller._queue.length === 0) {\n return;\n }\n\n var writeRecord = PeekQueueValue(controller);\n if (writeRecord === 'close') {\n WritableStreamDefaultControllerProcessClose(controller);\n } else {\n WritableStreamDefaultControllerProcessWrite(controller, writeRecord.chunk);\n }\n}\n\nfunction WritableStreamDefaultControllerErrorIfNeeded(controller, error) {\n if (controller._controlledWritableStream._state === 'writable') {\n WritableStreamDefaultControllerError(controller, error);\n }\n}\n\nfunction WritableStreamDefaultControllerProcessClose(controller) {\n var stream = controller._controlledWritableStream;\n\n WritableStreamMarkCloseRequestInFlight(stream);\n\n DequeueValue(controller);\n assert(controller._queue.length === 0, 'queue must be empty once the final write record is dequeued');\n\n var sinkClosePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'close', []);\n sinkClosePromise.then(function () {\n WritableStreamFinishInFlightClose(stream);\n }, function (reason) {\n WritableStreamFinishInFlightCloseWithError(stream, reason);\n }).catch(rethrowAssertionErrorRejection);\n}\n\nfunction WritableStreamDefaultControllerProcessWrite(controller, chunk) {\n var stream = controller._controlledWritableStream;\n\n WritableStreamMarkFirstWriteRequestInFlight(stream);\n\n var sinkWritePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'write', [chunk, controller]);\n sinkWritePromise.then(function () {\n WritableStreamFinishInFlightWrite(stream);\n\n var state = stream._state;\n assert(state === 'writable' || state === 'erroring');\n\n DequeueValue(controller);\n\n if (WritableStreamCloseQueuedOrInFlight(stream) === false && state === 'writable') {\n var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n }\n\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n }, function (reason) {\n WritableStreamFinishInFlightWriteWithError(stream, reason);\n }).catch(rethrowAssertionErrorRejection);\n}\n\nfunction WritableStreamDefaultControllerGetBackpressure(controller) {\n var desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);\n return desiredSize <= 0;\n}\n\n// A client of WritableStreamDefaultController may use these functions directly to bypass state check.\n\nfunction WritableStreamDefaultControllerError(controller, error) {\n var stream = controller._controlledWritableStream;\n\n assert(stream._state === 'writable');\n\n WritableStreamStartErroring(stream, error);\n}\n\n// Helper functions for the WritableStream.\n\nfunction streamBrandCheckException(name) {\n return new TypeError('WritableStream.prototype.' + name + ' can only be used on a WritableStream');\n}\n\n// Helper functions for the WritableStreamDefaultWriter.\n\nfunction defaultWriterBrandCheckException(name) {\n return new TypeError('WritableStreamDefaultWriter.prototype.' + name + ' can only be used on a WritableStreamDefaultWriter');\n}\n\nfunction defaultWriterLockException(name) {\n return new TypeError('Cannot ' + name + ' a stream using a released writer');\n}\n\nfunction defaultWriterClosedPromiseInitialize(writer) {\n writer._closedPromise = new Promise(function (resolve, reject) {\n writer._closedPromise_resolve = resolve;\n writer._closedPromise_reject = reject;\n writer._closedPromiseState = 'pending';\n });\n}\n\nfunction defaultWriterClosedPromiseInitializeAsRejected(writer, reason) {\n writer._closedPromise = Promise.reject(reason);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'rejected';\n}\n\nfunction defaultWriterClosedPromiseInitializeAsResolved(writer) {\n writer._closedPromise = Promise.resolve(undefined);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'resolved';\n}\n\nfunction defaultWriterClosedPromiseReject(writer, reason) {\n assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined');\n assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined');\n assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending');\n\n writer._closedPromise_reject(reason);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'rejected';\n}\n\nfunction defaultWriterClosedPromiseResetToRejected(writer, reason) {\n assert(writer._closedPromise_resolve === undefined, 'writer._closedPromise_resolve === undefined');\n assert(writer._closedPromise_reject === undefined, 'writer._closedPromise_reject === undefined');\n assert(writer._closedPromiseState !== 'pending', 'writer._closedPromiseState is not pending');\n\n writer._closedPromise = Promise.reject(reason);\n writer._closedPromiseState = 'rejected';\n}\n\nfunction defaultWriterClosedPromiseResolve(writer) {\n assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined');\n assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined');\n assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending');\n\n writer._closedPromise_resolve(undefined);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'resolved';\n}\n\nfunction defaultWriterReadyPromiseInitialize(writer) {\n writer._readyPromise = new Promise(function (resolve, reject) {\n writer._readyPromise_resolve = resolve;\n writer._readyPromise_reject = reject;\n });\n writer._readyPromiseState = 'pending';\n}\n\nfunction defaultWriterReadyPromiseInitializeAsRejected(writer, reason) {\n writer._readyPromise = Promise.reject(reason);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'rejected';\n}\n\nfunction defaultWriterReadyPromiseInitializeAsResolved(writer) {\n writer._readyPromise = Promise.resolve(undefined);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'fulfilled';\n}\n\nfunction defaultWriterReadyPromiseReject(writer, reason) {\n assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined');\n assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined');\n\n writer._readyPromise_reject(reason);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'rejected';\n}\n\nfunction defaultWriterReadyPromiseReset(writer) {\n assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined');\n assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined');\n\n writer._readyPromise = new Promise(function (resolve, reject) {\n writer._readyPromise_resolve = resolve;\n writer._readyPromise_reject = reject;\n });\n writer._readyPromiseState = 'pending';\n}\n\nfunction defaultWriterReadyPromiseResetToRejected(writer, reason) {\n assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined');\n assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined');\n\n writer._readyPromise = Promise.reject(reason);\n writer._readyPromiseState = 'rejected';\n}\n\nfunction defaultWriterReadyPromiseResolve(writer) {\n assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined');\n assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined');\n\n writer._readyPromise_resolve(undefined);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'fulfilled';\n}\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nvar _require = __w_pdfjs_require__(0),\n IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber;\n\nvar _require2 = __w_pdfjs_require__(1),\n assert = _require2.assert;\n\nexports.DequeueValue = function (container) {\n assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: DequeueValue should only be used on containers with [[queue]] and [[queueTotalSize]].');\n assert(container._queue.length > 0, 'Spec-level failure: should never dequeue from an empty queue.');\n\n var pair = container._queue.shift();\n container._queueTotalSize -= pair.size;\n if (container._queueTotalSize < 0) {\n container._queueTotalSize = 0;\n }\n\n return pair.value;\n};\n\nexports.EnqueueValueWithSize = function (container, value, size) {\n assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: EnqueueValueWithSize should only be used on containers with [[queue]] and ' + '[[queueTotalSize]].');\n\n size = Number(size);\n if (!IsFiniteNonNegativeNumber(size)) {\n throw new RangeError('Size must be a finite, non-NaN, non-negative number.');\n }\n\n container._queue.push({ value: value, size: size });\n container._queueTotalSize += size;\n};\n\nexports.PeekQueueValue = function (container) {\n assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: PeekQueueValue should only be used on containers with [[queue]] and [[queueTotalSize]].');\n assert(container._queue.length > 0, 'Spec-level failure: should never peek at an empty queue.');\n\n var pair = container._queue[0];\n return pair.value;\n};\n\nexports.ResetQueue = function (container) {\n assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]].');\n\n container._queue = [];\n container._queueTotalSize = 0;\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar _require = __w_pdfjs_require__(0),\n ArrayBufferCopy = _require.ArrayBufferCopy,\n CreateIterResultObject = _require.CreateIterResultObject,\n IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber,\n InvokeOrNoop = _require.InvokeOrNoop,\n PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop,\n TransferArrayBuffer = _require.TransferArrayBuffer,\n ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy,\n ValidateAndNormalizeHighWaterMark = _require.ValidateAndNormalizeHighWaterMark;\n\nvar _require2 = __w_pdfjs_require__(0),\n createArrayFromList = _require2.createArrayFromList,\n createDataProperty = _require2.createDataProperty,\n typeIsObject = _require2.typeIsObject;\n\nvar _require3 = __w_pdfjs_require__(1),\n assert = _require3.assert,\n rethrowAssertionErrorRejection = _require3.rethrowAssertionErrorRejection;\n\nvar _require4 = __w_pdfjs_require__(3),\n DequeueValue = _require4.DequeueValue,\n EnqueueValueWithSize = _require4.EnqueueValueWithSize,\n ResetQueue = _require4.ResetQueue;\n\nvar _require5 = __w_pdfjs_require__(2),\n AcquireWritableStreamDefaultWriter = _require5.AcquireWritableStreamDefaultWriter,\n IsWritableStream = _require5.IsWritableStream,\n IsWritableStreamLocked = _require5.IsWritableStreamLocked,\n WritableStreamAbort = _require5.WritableStreamAbort,\n WritableStreamDefaultWriterCloseWithErrorPropagation = _require5.WritableStreamDefaultWriterCloseWithErrorPropagation,\n WritableStreamDefaultWriterRelease = _require5.WritableStreamDefaultWriterRelease,\n WritableStreamDefaultWriterWrite = _require5.WritableStreamDefaultWriterWrite,\n WritableStreamCloseQueuedOrInFlight = _require5.WritableStreamCloseQueuedOrInFlight;\n\nvar ReadableStream = function () {\n function ReadableStream() {\n var underlyingSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n size = _ref.size,\n highWaterMark = _ref.highWaterMark;\n\n _classCallCheck(this, ReadableStream);\n\n // Exposed to controllers.\n this._state = 'readable';\n\n this._reader = undefined;\n this._storedError = undefined;\n\n this._disturbed = false;\n\n // Initialize to undefined first because the constructor of the controller checks this\n // variable to validate the caller.\n this._readableStreamController = undefined;\n var type = underlyingSource.type;\n var typeString = String(type);\n if (typeString === 'bytes') {\n if (highWaterMark === undefined) {\n highWaterMark = 0;\n }\n this._readableStreamController = new ReadableByteStreamController(this, underlyingSource, highWaterMark);\n } else if (type === undefined) {\n if (highWaterMark === undefined) {\n highWaterMark = 1;\n }\n this._readableStreamController = new ReadableStreamDefaultController(this, underlyingSource, size, highWaterMark);\n } else {\n throw new RangeError('Invalid type is specified');\n }\n }\n\n _createClass(ReadableStream, [{\n key: 'cancel',\n value: function cancel(reason) {\n if (IsReadableStream(this) === false) {\n return Promise.reject(streamBrandCheckException('cancel'));\n }\n\n if (IsReadableStreamLocked(this) === true) {\n return Promise.reject(new TypeError('Cannot cancel a stream that already has a reader'));\n }\n\n return ReadableStreamCancel(this, reason);\n }\n }, {\n key: 'getReader',\n value: function getReader() {\n var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n mode = _ref2.mode;\n\n if (IsReadableStream(this) === false) {\n throw streamBrandCheckException('getReader');\n }\n\n if (mode === undefined) {\n return AcquireReadableStreamDefaultReader(this);\n }\n\n mode = String(mode);\n\n if (mode === 'byob') {\n return AcquireReadableStreamBYOBReader(this);\n }\n\n throw new RangeError('Invalid mode is specified');\n }\n }, {\n key: 'pipeThrough',\n value: function pipeThrough(_ref3, options) {\n var writable = _ref3.writable,\n readable = _ref3.readable;\n\n var promise = this.pipeTo(writable, options);\n\n ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise);\n\n return readable;\n }\n }, {\n key: 'pipeTo',\n value: function pipeTo(dest) {\n var _this = this;\n\n var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n preventClose = _ref4.preventClose,\n preventAbort = _ref4.preventAbort,\n preventCancel = _ref4.preventCancel;\n\n if (IsReadableStream(this) === false) {\n return Promise.reject(streamBrandCheckException('pipeTo'));\n }\n if (IsWritableStream(dest) === false) {\n return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo\\'s first argument must be a WritableStream'));\n }\n\n preventClose = Boolean(preventClose);\n preventAbort = Boolean(preventAbort);\n preventCancel = Boolean(preventCancel);\n\n if (IsReadableStreamLocked(this) === true) {\n return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream'));\n }\n if (IsWritableStreamLocked(dest) === true) {\n return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream'));\n }\n\n var reader = AcquireReadableStreamDefaultReader(this);\n var writer = AcquireWritableStreamDefaultWriter(dest);\n\n var shuttingDown = false;\n\n // This is used to keep track of the spec's requirement that we wait for ongoing writes during shutdown.\n var currentWrite = Promise.resolve();\n\n return new Promise(function (resolve, reject) {\n // Using reader and writer, read all chunks from this and write them to dest\n // - Backpressure must be enforced\n // - Shutdown must stop all activity\n function pipeLoop() {\n currentWrite = Promise.resolve();\n\n if (shuttingDown === true) {\n return Promise.resolve();\n }\n\n return writer._readyPromise.then(function () {\n return ReadableStreamDefaultReaderRead(reader).then(function (_ref5) {\n var value = _ref5.value,\n done = _ref5.done;\n\n if (done === true) {\n return;\n }\n\n currentWrite = WritableStreamDefaultWriterWrite(writer, value).catch(function () {});\n });\n }).then(pipeLoop);\n }\n\n // Errors must be propagated forward\n isOrBecomesErrored(_this, reader._closedPromise, function (storedError) {\n if (preventAbort === false) {\n shutdownWithAction(function () {\n return WritableStreamAbort(dest, storedError);\n }, true, storedError);\n } else {\n shutdown(true, storedError);\n }\n });\n\n // Errors must be propagated backward\n isOrBecomesErrored(dest, writer._closedPromise, function (storedError) {\n if (preventCancel === false) {\n shutdownWithAction(function () {\n return ReadableStreamCancel(_this, storedError);\n }, true, storedError);\n } else {\n shutdown(true, storedError);\n }\n });\n\n // Closing must be propagated forward\n isOrBecomesClosed(_this, reader._closedPromise, function () {\n if (preventClose === false) {\n shutdownWithAction(function () {\n return WritableStreamDefaultWriterCloseWithErrorPropagation(writer);\n });\n } else {\n shutdown();\n }\n });\n\n // Closing must be propagated backward\n if (WritableStreamCloseQueuedOrInFlight(dest) === true || dest._state === 'closed') {\n var destClosed = new TypeError('the destination writable stream closed before all data could be piped to it');\n\n if (preventCancel === false) {\n shutdownWithAction(function () {\n return ReadableStreamCancel(_this, destClosed);\n }, true, destClosed);\n } else {\n shutdown(true, destClosed);\n }\n }\n\n pipeLoop().catch(function (err) {\n currentWrite = Promise.resolve();\n rethrowAssertionErrorRejection(err);\n });\n\n function waitForWritesToFinish() {\n // Another write may have started while we were waiting on this currentWrite, so we have to be sure to wait\n // for that too.\n var oldCurrentWrite = currentWrite;\n return currentWrite.then(function () {\n return oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined;\n });\n }\n\n function isOrBecomesErrored(stream, promise, action) {\n if (stream._state === 'errored') {\n action(stream._storedError);\n } else {\n promise.catch(action).catch(rethrowAssertionErrorRejection);\n }\n }\n\n function isOrBecomesClosed(stream, promise, action) {\n if (stream._state === 'closed') {\n action();\n } else {\n promise.then(action).catch(rethrowAssertionErrorRejection);\n }\n }\n\n function shutdownWithAction(action, originalIsError, originalError) {\n if (shuttingDown === true) {\n return;\n }\n shuttingDown = true;\n\n if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {\n waitForWritesToFinish().then(doTheRest);\n } else {\n doTheRest();\n }\n\n function doTheRest() {\n action().then(function () {\n return finalize(originalIsError, originalError);\n }, function (newError) {\n return finalize(true, newError);\n }).catch(rethrowAssertionErrorRejection);\n }\n }\n\n function shutdown(isError, error) {\n if (shuttingDown === true) {\n return;\n }\n shuttingDown = true;\n\n if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {\n waitForWritesToFinish().then(function () {\n return finalize(isError, error);\n }).catch(rethrowAssertionErrorRejection);\n } else {\n finalize(isError, error);\n }\n }\n\n function finalize(isError, error) {\n WritableStreamDefaultWriterRelease(writer);\n ReadableStreamReaderGenericRelease(reader);\n\n if (isError) {\n reject(error);\n } else {\n resolve(undefined);\n }\n }\n });\n }\n }, {\n key: 'tee',\n value: function tee() {\n if (IsReadableStream(this) === false) {\n throw streamBrandCheckException('tee');\n }\n\n var branches = ReadableStreamTee(this, false);\n return createArrayFromList(branches);\n }\n }, {\n key: 'locked',\n get: function get() {\n if (IsReadableStream(this) === false) {\n throw streamBrandCheckException('locked');\n }\n\n return IsReadableStreamLocked(this);\n }\n }]);\n\n return ReadableStream;\n}();\n\nmodule.exports = {\n ReadableStream: ReadableStream,\n IsReadableStreamDisturbed: IsReadableStreamDisturbed,\n ReadableStreamDefaultControllerClose: ReadableStreamDefaultControllerClose,\n ReadableStreamDefaultControllerEnqueue: ReadableStreamDefaultControllerEnqueue,\n ReadableStreamDefaultControllerError: ReadableStreamDefaultControllerError,\n ReadableStreamDefaultControllerGetDesiredSize: ReadableStreamDefaultControllerGetDesiredSize\n};\n\n// Abstract operations for the ReadableStream.\n\nfunction AcquireReadableStreamBYOBReader(stream) {\n return new ReadableStreamBYOBReader(stream);\n}\n\nfunction AcquireReadableStreamDefaultReader(stream) {\n return new ReadableStreamDefaultReader(stream);\n}\n\nfunction IsReadableStream(x) {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {\n return false;\n }\n\n return true;\n}\n\nfunction IsReadableStreamDisturbed(stream) {\n assert(IsReadableStream(stream) === true, 'IsReadableStreamDisturbed should only be used on known readable streams');\n\n return stream._disturbed;\n}\n\nfunction IsReadableStreamLocked(stream) {\n assert(IsReadableStream(stream) === true, 'IsReadableStreamLocked should only be used on known readable streams');\n\n if (stream._reader === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction ReadableStreamTee(stream, cloneForBranch2) {\n assert(IsReadableStream(stream) === true);\n assert(typeof cloneForBranch2 === 'boolean');\n\n var reader = AcquireReadableStreamDefaultReader(stream);\n\n var teeState = {\n closedOrErrored: false,\n canceled1: false,\n canceled2: false,\n reason1: undefined,\n reason2: undefined\n };\n teeState.promise = new Promise(function (resolve) {\n teeState._resolve = resolve;\n });\n\n var pull = create_ReadableStreamTeePullFunction();\n pull._reader = reader;\n pull._teeState = teeState;\n pull._cloneForBranch2 = cloneForBranch2;\n\n var cancel1 = create_ReadableStreamTeeBranch1CancelFunction();\n cancel1._stream = stream;\n cancel1._teeState = teeState;\n\n var cancel2 = create_ReadableStreamTeeBranch2CancelFunction();\n cancel2._stream = stream;\n cancel2._teeState = teeState;\n\n var underlyingSource1 = Object.create(Object.prototype);\n createDataProperty(underlyingSource1, 'pull', pull);\n createDataProperty(underlyingSource1, 'cancel', cancel1);\n var branch1Stream = new ReadableStream(underlyingSource1);\n\n var underlyingSource2 = Object.create(Object.prototype);\n createDataProperty(underlyingSource2, 'pull', pull);\n createDataProperty(underlyingSource2, 'cancel', cancel2);\n var branch2Stream = new ReadableStream(underlyingSource2);\n\n pull._branch1 = branch1Stream._readableStreamController;\n pull._branch2 = branch2Stream._readableStreamController;\n\n reader._closedPromise.catch(function (r) {\n if (teeState.closedOrErrored === true) {\n return;\n }\n\n ReadableStreamDefaultControllerError(pull._branch1, r);\n ReadableStreamDefaultControllerError(pull._branch2, r);\n teeState.closedOrErrored = true;\n });\n\n return [branch1Stream, branch2Stream];\n}\n\nfunction create_ReadableStreamTeePullFunction() {\n function f() {\n var reader = f._reader,\n branch1 = f._branch1,\n branch2 = f._branch2,\n teeState = f._teeState;\n\n\n return ReadableStreamDefaultReaderRead(reader).then(function (result) {\n assert(typeIsObject(result));\n var value = result.value;\n var done = result.done;\n assert(typeof done === 'boolean');\n\n if (done === true && teeState.closedOrErrored === false) {\n if (teeState.canceled1 === false) {\n ReadableStreamDefaultControllerClose(branch1);\n }\n if (teeState.canceled2 === false) {\n ReadableStreamDefaultControllerClose(branch2);\n }\n teeState.closedOrErrored = true;\n }\n\n if (teeState.closedOrErrored === true) {\n return;\n }\n\n var value1 = value;\n var value2 = value;\n\n // There is no way to access the cloning code right now in the reference implementation.\n // If we add one then we'll need an implementation for serializable objects.\n // if (teeState.canceled2 === false && cloneForBranch2 === true) {\n // value2 = StructuredDeserialize(StructuredSerialize(value2));\n // }\n\n if (teeState.canceled1 === false) {\n ReadableStreamDefaultControllerEnqueue(branch1, value1);\n }\n\n if (teeState.canceled2 === false) {\n ReadableStreamDefaultControllerEnqueue(branch2, value2);\n }\n });\n }\n return f;\n}\n\nfunction create_ReadableStreamTeeBranch1CancelFunction() {\n function f(reason) {\n var stream = f._stream,\n teeState = f._teeState;\n\n\n teeState.canceled1 = true;\n teeState.reason1 = reason;\n if (teeState.canceled2 === true) {\n var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]);\n var cancelResult = ReadableStreamCancel(stream, compositeReason);\n teeState._resolve(cancelResult);\n }\n return teeState.promise;\n }\n return f;\n}\n\nfunction create_ReadableStreamTeeBranch2CancelFunction() {\n function f(reason) {\n var stream = f._stream,\n teeState = f._teeState;\n\n\n teeState.canceled2 = true;\n teeState.reason2 = reason;\n if (teeState.canceled1 === true) {\n var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]);\n var cancelResult = ReadableStreamCancel(stream, compositeReason);\n teeState._resolve(cancelResult);\n }\n return teeState.promise;\n }\n return f;\n}\n\n// ReadableStream API exposed for controllers.\n\nfunction ReadableStreamAddReadIntoRequest(stream) {\n assert(IsReadableStreamBYOBReader(stream._reader) === true);\n assert(stream._state === 'readable' || stream._state === 'closed');\n\n var promise = new Promise(function (resolve, reject) {\n var readIntoRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._reader._readIntoRequests.push(readIntoRequest);\n });\n\n return promise;\n}\n\nfunction ReadableStreamAddReadRequest(stream) {\n assert(IsReadableStreamDefaultReader(stream._reader) === true);\n assert(stream._state === 'readable');\n\n var promise = new Promise(function (resolve, reject) {\n var readRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._reader._readRequests.push(readRequest);\n });\n\n return promise;\n}\n\nfunction ReadableStreamCancel(stream, reason) {\n stream._disturbed = true;\n\n if (stream._state === 'closed') {\n return Promise.resolve(undefined);\n }\n if (stream._state === 'errored') {\n return Promise.reject(stream._storedError);\n }\n\n ReadableStreamClose(stream);\n\n var sourceCancelPromise = stream._readableStreamController.__cancelSteps(reason);\n return sourceCancelPromise.then(function () {\n return undefined;\n });\n}\n\nfunction ReadableStreamClose(stream) {\n assert(stream._state === 'readable');\n\n stream._state = 'closed';\n\n var reader = stream._reader;\n\n if (reader === undefined) {\n return undefined;\n }\n\n if (IsReadableStreamDefaultReader(reader) === true) {\n for (var i = 0; i < reader._readRequests.length; i++) {\n var _resolve = reader._readRequests[i]._resolve;\n\n _resolve(CreateIterResultObject(undefined, true));\n }\n reader._readRequests = [];\n }\n\n defaultReaderClosedPromiseResolve(reader);\n\n return undefined;\n}\n\nfunction ReadableStreamError(stream, e) {\n assert(IsReadableStream(stream) === true, 'stream must be ReadableStream');\n assert(stream._state === 'readable', 'state must be readable');\n\n stream._state = 'errored';\n stream._storedError = e;\n\n var reader = stream._reader;\n\n if (reader === undefined) {\n return undefined;\n }\n\n if (IsReadableStreamDefaultReader(reader) === true) {\n for (var i = 0; i < reader._readRequests.length; i++) {\n var readRequest = reader._readRequests[i];\n readRequest._reject(e);\n }\n\n reader._readRequests = [];\n } else {\n assert(IsReadableStreamBYOBReader(reader), 'reader must be ReadableStreamBYOBReader');\n\n for (var _i = 0; _i < reader._readIntoRequests.length; _i++) {\n var readIntoRequest = reader._readIntoRequests[_i];\n readIntoRequest._reject(e);\n }\n\n reader._readIntoRequests = [];\n }\n\n defaultReaderClosedPromiseReject(reader, e);\n reader._closedPromise.catch(function () {});\n}\n\nfunction ReadableStreamFulfillReadIntoRequest(stream, chunk, done) {\n var reader = stream._reader;\n\n assert(reader._readIntoRequests.length > 0);\n\n var readIntoRequest = reader._readIntoRequests.shift();\n readIntoRequest._resolve(CreateIterResultObject(chunk, done));\n}\n\nfunction ReadableStreamFulfillReadRequest(stream, chunk, done) {\n var reader = stream._reader;\n\n assert(reader._readRequests.length > 0);\n\n var readRequest = reader._readRequests.shift();\n readRequest._resolve(CreateIterResultObject(chunk, done));\n}\n\nfunction ReadableStreamGetNumReadIntoRequests(stream) {\n return stream._reader._readIntoRequests.length;\n}\n\nfunction ReadableStreamGetNumReadRequests(stream) {\n return stream._reader._readRequests.length;\n}\n\nfunction ReadableStreamHasBYOBReader(stream) {\n var reader = stream._reader;\n\n if (reader === undefined) {\n return false;\n }\n\n if (IsReadableStreamBYOBReader(reader) === false) {\n return false;\n }\n\n return true;\n}\n\nfunction ReadableStreamHasDefaultReader(stream) {\n var reader = stream._reader;\n\n if (reader === undefined) {\n return false;\n }\n\n if (IsReadableStreamDefaultReader(reader) === false) {\n return false;\n }\n\n return true;\n}\n\n// Readers\n\nvar ReadableStreamDefaultReader = function () {\n function ReadableStreamDefaultReader(stream) {\n _classCallCheck(this, ReadableStreamDefaultReader);\n\n if (IsReadableStream(stream) === false) {\n throw new TypeError('ReadableStreamDefaultReader can only be constructed with a ReadableStream instance');\n }\n if (IsReadableStreamLocked(stream) === true) {\n throw new TypeError('This stream has already been locked for exclusive reading by another reader');\n }\n\n ReadableStreamReaderGenericInitialize(this, stream);\n\n this._readRequests = [];\n }\n\n _createClass(ReadableStreamDefaultReader, [{\n key: 'cancel',\n value: function cancel(reason) {\n if (IsReadableStreamDefaultReader(this) === false) {\n return Promise.reject(defaultReaderBrandCheckException('cancel'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return Promise.reject(readerLockException('cancel'));\n }\n\n return ReadableStreamReaderGenericCancel(this, reason);\n }\n }, {\n key: 'read',\n value: function read() {\n if (IsReadableStreamDefaultReader(this) === false) {\n return Promise.reject(defaultReaderBrandCheckException('read'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return Promise.reject(readerLockException('read from'));\n }\n\n return ReadableStreamDefaultReaderRead(this);\n }\n }, {\n key: 'releaseLock',\n value: function releaseLock() {\n if (IsReadableStreamDefaultReader(this) === false) {\n throw defaultReaderBrandCheckException('releaseLock');\n }\n\n if (this._ownerReadableStream === undefined) {\n return;\n }\n\n if (this._readRequests.length > 0) {\n throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');\n }\n\n ReadableStreamReaderGenericRelease(this);\n }\n }, {\n key: 'closed',\n get: function get() {\n if (IsReadableStreamDefaultReader(this) === false) {\n return Promise.reject(defaultReaderBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n }]);\n\n return ReadableStreamDefaultReader;\n}();\n\nvar ReadableStreamBYOBReader = function () {\n function ReadableStreamBYOBReader(stream) {\n _classCallCheck(this, ReadableStreamBYOBReader);\n\n if (!IsReadableStream(stream)) {\n throw new TypeError('ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a ' + 'byte source');\n }\n if (IsReadableByteStreamController(stream._readableStreamController) === false) {\n throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' + 'source');\n }\n if (IsReadableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive reading by another reader');\n }\n\n ReadableStreamReaderGenericInitialize(this, stream);\n\n this._readIntoRequests = [];\n }\n\n _createClass(ReadableStreamBYOBReader, [{\n key: 'cancel',\n value: function cancel(reason) {\n if (!IsReadableStreamBYOBReader(this)) {\n return Promise.reject(byobReaderBrandCheckException('cancel'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return Promise.reject(readerLockException('cancel'));\n }\n\n return ReadableStreamReaderGenericCancel(this, reason);\n }\n }, {\n key: 'read',\n value: function read(view) {\n if (!IsReadableStreamBYOBReader(this)) {\n return Promise.reject(byobReaderBrandCheckException('read'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return Promise.reject(readerLockException('read from'));\n }\n\n if (!ArrayBuffer.isView(view)) {\n return Promise.reject(new TypeError('view must be an array buffer view'));\n }\n\n if (view.byteLength === 0) {\n return Promise.reject(new TypeError('view must have non-zero byteLength'));\n }\n\n return ReadableStreamBYOBReaderRead(this, view);\n }\n }, {\n key: 'releaseLock',\n value: function releaseLock() {\n if (!IsReadableStreamBYOBReader(this)) {\n throw byobReaderBrandCheckException('releaseLock');\n }\n\n if (this._ownerReadableStream === undefined) {\n return;\n }\n\n if (this._readIntoRequests.length > 0) {\n throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');\n }\n\n ReadableStreamReaderGenericRelease(this);\n }\n }, {\n key: 'closed',\n get: function get() {\n if (!IsReadableStreamBYOBReader(this)) {\n return Promise.reject(byobReaderBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n }]);\n\n return ReadableStreamBYOBReader;\n}();\n\n// Abstract operations for the readers.\n\nfunction IsReadableStreamBYOBReader(x) {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {\n return false;\n }\n\n return true;\n}\n\nfunction IsReadableStreamDefaultReader(x) {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) {\n return false;\n }\n\n return true;\n}\n\nfunction ReadableStreamReaderGenericInitialize(reader, stream) {\n reader._ownerReadableStream = stream;\n stream._reader = reader;\n\n if (stream._state === 'readable') {\n defaultReaderClosedPromiseInitialize(reader);\n } else if (stream._state === 'closed') {\n defaultReaderClosedPromiseInitializeAsResolved(reader);\n } else {\n assert(stream._state === 'errored', 'state must be errored');\n\n defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError);\n reader._closedPromise.catch(function () {});\n }\n}\n\n// A client of ReadableStreamDefaultReader and ReadableStreamBYOBReader may use these functions directly to bypass state\n// check.\n\nfunction ReadableStreamReaderGenericCancel(reader, reason) {\n var stream = reader._ownerReadableStream;\n assert(stream !== undefined);\n return ReadableStreamCancel(stream, reason);\n}\n\nfunction ReadableStreamReaderGenericRelease(reader) {\n assert(reader._ownerReadableStream !== undefined);\n assert(reader._ownerReadableStream._reader === reader);\n\n if (reader._ownerReadableStream._state === 'readable') {\n defaultReaderClosedPromiseReject(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\\'s closedness'));\n } else {\n defaultReaderClosedPromiseResetToRejected(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\\'s closedness'));\n }\n reader._closedPromise.catch(function () {});\n\n reader._ownerReadableStream._reader = undefined;\n reader._ownerReadableStream = undefined;\n}\n\nfunction ReadableStreamBYOBReaderRead(reader, view) {\n var stream = reader._ownerReadableStream;\n\n assert(stream !== undefined);\n\n stream._disturbed = true;\n\n if (stream._state === 'errored') {\n return Promise.reject(stream._storedError);\n }\n\n // Controllers must implement this.\n return ReadableByteStreamControllerPullInto(stream._readableStreamController, view);\n}\n\nfunction ReadableStreamDefaultReaderRead(reader) {\n var stream = reader._ownerReadableStream;\n\n assert(stream !== undefined);\n\n stream._disturbed = true;\n\n if (stream._state === 'closed') {\n return Promise.resolve(CreateIterResultObject(undefined, true));\n }\n\n if (stream._state === 'errored') {\n return Promise.reject(stream._storedError);\n }\n\n assert(stream._state === 'readable');\n\n return stream._readableStreamController.__pullSteps();\n}\n\n// Controllers\n\nvar ReadableStreamDefaultController = function () {\n function ReadableStreamDefaultController(stream, underlyingSource, size, highWaterMark) {\n _classCallCheck(this, ReadableStreamDefaultController);\n\n if (IsReadableStream(stream) === false) {\n throw new TypeError('ReadableStreamDefaultController can only be constructed with a ReadableStream instance');\n }\n\n if (stream._readableStreamController !== undefined) {\n throw new TypeError('ReadableStreamDefaultController instances can only be created by the ReadableStream constructor');\n }\n\n this._controlledReadableStream = stream;\n\n this._underlyingSource = underlyingSource;\n\n // Need to set the slots so that the assert doesn't fire. In the spec the slots already exist implicitly.\n this._queue = undefined;\n this._queueTotalSize = undefined;\n ResetQueue(this);\n\n this._started = false;\n this._closeRequested = false;\n this._pullAgain = false;\n this._pulling = false;\n\n var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark);\n this._strategySize = normalizedStrategy.size;\n this._strategyHWM = normalizedStrategy.highWaterMark;\n\n var controller = this;\n\n var startResult = InvokeOrNoop(underlyingSource, 'start', [this]);\n Promise.resolve(startResult).then(function () {\n controller._started = true;\n\n assert(controller._pulling === false);\n assert(controller._pullAgain === false);\n\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n }, function (r) {\n ReadableStreamDefaultControllerErrorIfNeeded(controller, r);\n }).catch(rethrowAssertionErrorRejection);\n }\n\n _createClass(ReadableStreamDefaultController, [{\n key: 'close',\n value: function close() {\n if (IsReadableStreamDefaultController(this) === false) {\n throw defaultControllerBrandCheckException('close');\n }\n\n if (this._closeRequested === true) {\n throw new TypeError('The stream has already been closed; do not close it again!');\n }\n\n var state = this._controlledReadableStream._state;\n if (state !== 'readable') {\n throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed');\n }\n\n ReadableStreamDefaultControllerClose(this);\n }\n }, {\n key: 'enqueue',\n value: function enqueue(chunk) {\n if (IsReadableStreamDefaultController(this) === false) {\n throw defaultControllerBrandCheckException('enqueue');\n }\n\n if (this._closeRequested === true) {\n throw new TypeError('stream is closed or draining');\n }\n\n var state = this._controlledReadableStream._state;\n if (state !== 'readable') {\n throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to');\n }\n\n return ReadableStreamDefaultControllerEnqueue(this, chunk);\n }\n }, {\n key: 'error',\n value: function error(e) {\n if (IsReadableStreamDefaultController(this) === false) {\n throw defaultControllerBrandCheckException('error');\n }\n\n var stream = this._controlledReadableStream;\n if (stream._state !== 'readable') {\n throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored');\n }\n\n ReadableStreamDefaultControllerError(this, e);\n }\n }, {\n key: '__cancelSteps',\n value: function __cancelSteps(reason) {\n ResetQueue(this);\n return PromiseInvokeOrNoop(this._underlyingSource, 'cancel', [reason]);\n }\n }, {\n key: '__pullSteps',\n value: function __pullSteps() {\n var stream = this._controlledReadableStream;\n\n if (this._queue.length > 0) {\n var chunk = DequeueValue(this);\n\n if (this._closeRequested === true && this._queue.length === 0) {\n ReadableStreamClose(stream);\n } else {\n ReadableStreamDefaultControllerCallPullIfNeeded(this);\n }\n\n return Promise.resolve(CreateIterResultObject(chunk, false));\n }\n\n var pendingPromise = ReadableStreamAddReadRequest(stream);\n ReadableStreamDefaultControllerCallPullIfNeeded(this);\n return pendingPromise;\n }\n }, {\n key: 'desiredSize',\n get: function get() {\n if (IsReadableStreamDefaultController(this) === false) {\n throw defaultControllerBrandCheckException('desiredSize');\n }\n\n return ReadableStreamDefaultControllerGetDesiredSize(this);\n }\n }]);\n\n return ReadableStreamDefaultController;\n}();\n\n// Abstract operations for the ReadableStreamDefaultController.\n\nfunction IsReadableStreamDefaultController(x) {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSource')) {\n return false;\n }\n\n return true;\n}\n\nfunction ReadableStreamDefaultControllerCallPullIfNeeded(controller) {\n var shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);\n if (shouldPull === false) {\n return undefined;\n }\n\n if (controller._pulling === true) {\n controller._pullAgain = true;\n return undefined;\n }\n\n assert(controller._pullAgain === false);\n\n controller._pulling = true;\n\n var pullPromise = PromiseInvokeOrNoop(controller._underlyingSource, 'pull', [controller]);\n pullPromise.then(function () {\n controller._pulling = false;\n\n if (controller._pullAgain === true) {\n controller._pullAgain = false;\n return ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n }\n return undefined;\n }, function (e) {\n ReadableStreamDefaultControllerErrorIfNeeded(controller, e);\n }).catch(rethrowAssertionErrorRejection);\n\n return undefined;\n}\n\nfunction ReadableStreamDefaultControllerShouldCallPull(controller) {\n var stream = controller._controlledReadableStream;\n\n if (stream._state === 'closed' || stream._state === 'errored') {\n return false;\n }\n\n if (controller._closeRequested === true) {\n return false;\n }\n\n if (controller._started === false) {\n return false;\n }\n\n if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {\n return true;\n }\n\n var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);\n if (desiredSize > 0) {\n return true;\n }\n\n return false;\n}\n\n// A client of ReadableStreamDefaultController may use these functions directly to bypass state check.\n\nfunction ReadableStreamDefaultControllerClose(controller) {\n var stream = controller._controlledReadableStream;\n\n assert(controller._closeRequested === false);\n assert(stream._state === 'readable');\n\n controller._closeRequested = true;\n\n if (controller._queue.length === 0) {\n ReadableStreamClose(stream);\n }\n}\n\nfunction ReadableStreamDefaultControllerEnqueue(controller, chunk) {\n var stream = controller._controlledReadableStream;\n\n assert(controller._closeRequested === false);\n assert(stream._state === 'readable');\n\n if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {\n ReadableStreamFulfillReadRequest(stream, chunk, false);\n } else {\n var chunkSize = 1;\n\n if (controller._strategySize !== undefined) {\n var strategySize = controller._strategySize;\n try {\n chunkSize = strategySize(chunk);\n } catch (chunkSizeE) {\n ReadableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);\n throw chunkSizeE;\n }\n }\n\n try {\n EnqueueValueWithSize(controller, chunk, chunkSize);\n } catch (enqueueE) {\n ReadableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);\n throw enqueueE;\n }\n }\n\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n\n return undefined;\n}\n\nfunction ReadableStreamDefaultControllerError(controller, e) {\n var stream = controller._controlledReadableStream;\n\n assert(stream._state === 'readable');\n\n ResetQueue(controller);\n\n ReadableStreamError(stream, e);\n}\n\nfunction ReadableStreamDefaultControllerErrorIfNeeded(controller, e) {\n if (controller._controlledReadableStream._state === 'readable') {\n ReadableStreamDefaultControllerError(controller, e);\n }\n}\n\nfunction ReadableStreamDefaultControllerGetDesiredSize(controller) {\n var stream = controller._controlledReadableStream;\n var state = stream._state;\n\n if (state === 'errored') {\n return null;\n }\n if (state === 'closed') {\n return 0;\n }\n\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\nvar ReadableStreamBYOBRequest = function () {\n function ReadableStreamBYOBRequest(controller, view) {\n _classCallCheck(this, ReadableStreamBYOBRequest);\n\n this._associatedReadableByteStreamController = controller;\n this._view = view;\n }\n\n _createClass(ReadableStreamBYOBRequest, [{\n key: 'respond',\n value: function respond(bytesWritten) {\n if (IsReadableStreamBYOBRequest(this) === false) {\n throw byobRequestBrandCheckException('respond');\n }\n\n if (this._associatedReadableByteStreamController === undefined) {\n throw new TypeError('This BYOB request has been invalidated');\n }\n\n ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);\n }\n }, {\n key: 'respondWithNewView',\n value: function respondWithNewView(view) {\n if (IsReadableStreamBYOBRequest(this) === false) {\n throw byobRequestBrandCheckException('respond');\n }\n\n if (this._associatedReadableByteStreamController === undefined) {\n throw new TypeError('This BYOB request has been invalidated');\n }\n\n if (!ArrayBuffer.isView(view)) {\n throw new TypeError('You can only respond with array buffer views');\n }\n\n ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);\n }\n }, {\n key: 'view',\n get: function get() {\n return this._view;\n }\n }]);\n\n return ReadableStreamBYOBRequest;\n}();\n\nvar ReadableByteStreamController = function () {\n function ReadableByteStreamController(stream, underlyingByteSource, highWaterMark) {\n _classCallCheck(this, ReadableByteStreamController);\n\n if (IsReadableStream(stream) === false) {\n throw new TypeError('ReadableByteStreamController can only be constructed with a ReadableStream instance given ' + 'a byte source');\n }\n\n if (stream._readableStreamController !== undefined) {\n throw new TypeError('ReadableByteStreamController instances can only be created by the ReadableStream constructor given a byte ' + 'source');\n }\n\n this._controlledReadableStream = stream;\n\n this._underlyingByteSource = underlyingByteSource;\n\n this._pullAgain = false;\n this._pulling = false;\n\n ReadableByteStreamControllerClearPendingPullIntos(this);\n\n // Need to set the slots so that the assert doesn't fire. In the spec the slots already exist implicitly.\n this._queue = this._queueTotalSize = undefined;\n ResetQueue(this);\n\n this._closeRequested = false;\n this._started = false;\n\n this._strategyHWM = ValidateAndNormalizeHighWaterMark(highWaterMark);\n\n var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;\n if (autoAllocateChunkSize !== undefined) {\n if (Number.isInteger(autoAllocateChunkSize) === false || autoAllocateChunkSize <= 0) {\n throw new RangeError('autoAllocateChunkSize must be a positive integer');\n }\n }\n this._autoAllocateChunkSize = autoAllocateChunkSize;\n\n this._pendingPullIntos = [];\n\n var controller = this;\n\n var startResult = InvokeOrNoop(underlyingByteSource, 'start', [this]);\n Promise.resolve(startResult).then(function () {\n controller._started = true;\n\n assert(controller._pulling === false);\n assert(controller._pullAgain === false);\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n }, function (r) {\n if (stream._state === 'readable') {\n ReadableByteStreamControllerError(controller, r);\n }\n }).catch(rethrowAssertionErrorRejection);\n }\n\n _createClass(ReadableByteStreamController, [{\n key: 'close',\n value: function close() {\n if (IsReadableByteStreamController(this) === false) {\n throw byteStreamControllerBrandCheckException('close');\n }\n\n if (this._closeRequested === true) {\n throw new TypeError('The stream has already been closed; do not close it again!');\n }\n\n var state = this._controlledReadableStream._state;\n if (state !== 'readable') {\n throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed');\n }\n\n ReadableByteStreamControllerClose(this);\n }\n }, {\n key: 'enqueue',\n value: function enqueue(chunk) {\n if (IsReadableByteStreamController(this) === false) {\n throw byteStreamControllerBrandCheckException('enqueue');\n }\n\n if (this._closeRequested === true) {\n throw new TypeError('stream is closed or draining');\n }\n\n var state = this._controlledReadableStream._state;\n if (state !== 'readable') {\n throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to');\n }\n\n if (!ArrayBuffer.isView(chunk)) {\n throw new TypeError('You can only enqueue array buffer views when using a ReadableByteStreamController');\n }\n\n ReadableByteStreamControllerEnqueue(this, chunk);\n }\n }, {\n key: 'error',\n value: function error(e) {\n if (IsReadableByteStreamController(this) === false) {\n throw byteStreamControllerBrandCheckException('error');\n }\n\n var stream = this._controlledReadableStream;\n if (stream._state !== 'readable') {\n throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored');\n }\n\n ReadableByteStreamControllerError(this, e);\n }\n }, {\n key: '__cancelSteps',\n value: function __cancelSteps(reason) {\n if (this._pendingPullIntos.length > 0) {\n var firstDescriptor = this._pendingPullIntos[0];\n firstDescriptor.bytesFilled = 0;\n }\n\n ResetQueue(this);\n\n return PromiseInvokeOrNoop(this._underlyingByteSource, 'cancel', [reason]);\n }\n }, {\n key: '__pullSteps',\n value: function __pullSteps() {\n var stream = this._controlledReadableStream;\n assert(ReadableStreamHasDefaultReader(stream) === true);\n\n if (this._queueTotalSize > 0) {\n assert(ReadableStreamGetNumReadRequests(stream) === 0);\n\n var entry = this._queue.shift();\n this._queueTotalSize -= entry.byteLength;\n\n ReadableByteStreamControllerHandleQueueDrain(this);\n\n var view = void 0;\n try {\n view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);\n } catch (viewE) {\n return Promise.reject(viewE);\n }\n\n return Promise.resolve(CreateIterResultObject(view, false));\n }\n\n var autoAllocateChunkSize = this._autoAllocateChunkSize;\n if (autoAllocateChunkSize !== undefined) {\n var buffer = void 0;\n try {\n buffer = new ArrayBuffer(autoAllocateChunkSize);\n } catch (bufferE) {\n return Promise.reject(bufferE);\n }\n\n var pullIntoDescriptor = {\n buffer: buffer,\n byteOffset: 0,\n byteLength: autoAllocateChunkSize,\n bytesFilled: 0,\n elementSize: 1,\n ctor: Uint8Array,\n readerType: 'default'\n };\n\n this._pendingPullIntos.push(pullIntoDescriptor);\n }\n\n var promise = ReadableStreamAddReadRequest(stream);\n\n ReadableByteStreamControllerCallPullIfNeeded(this);\n\n return promise;\n }\n }, {\n key: 'byobRequest',\n get: function get() {\n if (IsReadableByteStreamController(this) === false) {\n throw byteStreamControllerBrandCheckException('byobRequest');\n }\n\n if (this._byobRequest === undefined && this._pendingPullIntos.length > 0) {\n var firstDescriptor = this._pendingPullIntos[0];\n var view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);\n\n this._byobRequest = new ReadableStreamBYOBRequest(this, view);\n }\n\n return this._byobRequest;\n }\n }, {\n key: 'desiredSize',\n get: function get() {\n if (IsReadableByteStreamController(this) === false) {\n throw byteStreamControllerBrandCheckException('desiredSize');\n }\n\n return ReadableByteStreamControllerGetDesiredSize(this);\n }\n }]);\n\n return ReadableByteStreamController;\n}();\n\n// Abstract operations for the ReadableByteStreamController.\n\nfunction IsReadableByteStreamController(x) {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_underlyingByteSource')) {\n return false;\n }\n\n return true;\n}\n\nfunction IsReadableStreamBYOBRequest(x) {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {\n return false;\n }\n\n return true;\n}\n\nfunction ReadableByteStreamControllerCallPullIfNeeded(controller) {\n var shouldPull = ReadableByteStreamControllerShouldCallPull(controller);\n if (shouldPull === false) {\n return undefined;\n }\n\n if (controller._pulling === true) {\n controller._pullAgain = true;\n return undefined;\n }\n\n assert(controller._pullAgain === false);\n\n controller._pulling = true;\n\n // TODO: Test controller argument\n var pullPromise = PromiseInvokeOrNoop(controller._underlyingByteSource, 'pull', [controller]);\n pullPromise.then(function () {\n controller._pulling = false;\n\n if (controller._pullAgain === true) {\n controller._pullAgain = false;\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n }\n }, function (e) {\n if (controller._controlledReadableStream._state === 'readable') {\n ReadableByteStreamControllerError(controller, e);\n }\n }).catch(rethrowAssertionErrorRejection);\n\n return undefined;\n}\n\nfunction ReadableByteStreamControllerClearPendingPullIntos(controller) {\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n controller._pendingPullIntos = [];\n}\n\nfunction ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor) {\n assert(stream._state !== 'errored', 'state must not be errored');\n\n var done = false;\n if (stream._state === 'closed') {\n assert(pullIntoDescriptor.bytesFilled === 0);\n done = true;\n }\n\n var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);\n if (pullIntoDescriptor.readerType === 'default') {\n ReadableStreamFulfillReadRequest(stream, filledView, done);\n } else {\n assert(pullIntoDescriptor.readerType === 'byob');\n ReadableStreamFulfillReadIntoRequest(stream, filledView, done);\n }\n}\n\nfunction ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor) {\n var bytesFilled = pullIntoDescriptor.bytesFilled;\n var elementSize = pullIntoDescriptor.elementSize;\n\n assert(bytesFilled <= pullIntoDescriptor.byteLength);\n assert(bytesFilled % elementSize === 0);\n\n return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize);\n}\n\nfunction ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byteOffset, byteLength) {\n controller._queue.push({ buffer: buffer, byteOffset: byteOffset, byteLength: byteLength });\n controller._queueTotalSize += byteLength;\n}\n\nfunction ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) {\n var elementSize = pullIntoDescriptor.elementSize;\n\n var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize;\n\n var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);\n var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;\n var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize;\n\n var totalBytesToCopyRemaining = maxBytesToCopy;\n var ready = false;\n if (maxAlignedBytes > currentAlignedBytes) {\n totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;\n ready = true;\n }\n\n var queue = controller._queue;\n\n while (totalBytesToCopyRemaining > 0) {\n var headOfQueue = queue[0];\n\n var bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength);\n\n var destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n ArrayBufferCopy(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy);\n\n if (headOfQueue.byteLength === bytesToCopy) {\n queue.shift();\n } else {\n headOfQueue.byteOffset += bytesToCopy;\n headOfQueue.byteLength -= bytesToCopy;\n }\n controller._queueTotalSize -= bytesToCopy;\n\n ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor);\n\n totalBytesToCopyRemaining -= bytesToCopy;\n }\n\n if (ready === false) {\n assert(controller._queueTotalSize === 0, 'queue must be empty');\n assert(pullIntoDescriptor.bytesFilled > 0);\n assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize);\n }\n\n return ready;\n}\n\nfunction ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) {\n assert(controller._pendingPullIntos.length === 0 || controller._pendingPullIntos[0] === pullIntoDescriptor);\n\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n pullIntoDescriptor.bytesFilled += size;\n}\n\nfunction ReadableByteStreamControllerHandleQueueDrain(controller) {\n assert(controller._controlledReadableStream._state === 'readable');\n\n if (controller._queueTotalSize === 0 && controller._closeRequested === true) {\n ReadableStreamClose(controller._controlledReadableStream);\n } else {\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n }\n}\n\nfunction ReadableByteStreamControllerInvalidateBYOBRequest(controller) {\n if (controller._byobRequest === undefined) {\n return;\n }\n\n controller._byobRequest._associatedReadableByteStreamController = undefined;\n controller._byobRequest._view = undefined;\n controller._byobRequest = undefined;\n}\n\nfunction ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller) {\n assert(controller._closeRequested === false);\n\n while (controller._pendingPullIntos.length > 0) {\n if (controller._queueTotalSize === 0) {\n return;\n }\n\n var pullIntoDescriptor = controller._pendingPullIntos[0];\n\n if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n\n ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor);\n }\n }\n}\n\nfunction ReadableByteStreamControllerPullInto(controller, view) {\n var stream = controller._controlledReadableStream;\n\n var elementSize = 1;\n if (view.constructor !== DataView) {\n elementSize = view.constructor.BYTES_PER_ELEMENT;\n }\n\n var ctor = view.constructor;\n\n var pullIntoDescriptor = {\n buffer: view.buffer,\n byteOffset: view.byteOffset,\n byteLength: view.byteLength,\n bytesFilled: 0,\n elementSize: elementSize,\n ctor: ctor,\n readerType: 'byob'\n };\n\n if (controller._pendingPullIntos.length > 0) {\n pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);\n controller._pendingPullIntos.push(pullIntoDescriptor);\n\n // No ReadableByteStreamControllerCallPullIfNeeded() call since:\n // - No change happens on desiredSize\n // - The source has already been notified of that there's at least 1 pending read(view)\n\n return ReadableStreamAddReadIntoRequest(stream);\n }\n\n if (stream._state === 'closed') {\n var emptyView = new view.constructor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);\n return Promise.resolve(CreateIterResultObject(emptyView, true));\n }\n\n if (controller._queueTotalSize > 0) {\n if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {\n var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);\n\n ReadableByteStreamControllerHandleQueueDrain(controller);\n\n return Promise.resolve(CreateIterResultObject(filledView, false));\n }\n\n if (controller._closeRequested === true) {\n var e = new TypeError('Insufficient bytes to fill elements in the given buffer');\n ReadableByteStreamControllerError(controller, e);\n\n return Promise.reject(e);\n }\n }\n\n pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);\n controller._pendingPullIntos.push(pullIntoDescriptor);\n\n var promise = ReadableStreamAddReadIntoRequest(stream);\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n\n return promise;\n}\n\nfunction ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {\n firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);\n\n assert(firstDescriptor.bytesFilled === 0, 'bytesFilled must be 0');\n\n var stream = controller._controlledReadableStream;\n if (ReadableStreamHasBYOBReader(stream) === true) {\n while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {\n var pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller);\n ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor);\n }\n }\n}\n\nfunction ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {\n if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) {\n throw new RangeError('bytesWritten out of range');\n }\n\n ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);\n\n if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {\n // TODO: Figure out whether we should detach the buffer or not here.\n return;\n }\n\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n\n var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;\n if (remainderSize > 0) {\n var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n var remainder = pullIntoDescriptor.buffer.slice(end - remainderSize, end);\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);\n }\n\n pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);\n pullIntoDescriptor.bytesFilled -= remainderSize;\n ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor);\n\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n}\n\nfunction ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {\n var firstDescriptor = controller._pendingPullIntos[0];\n\n var stream = controller._controlledReadableStream;\n\n if (stream._state === 'closed') {\n if (bytesWritten !== 0) {\n throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');\n }\n\n ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);\n } else {\n assert(stream._state === 'readable');\n\n ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);\n }\n}\n\nfunction ReadableByteStreamControllerShiftPendingPullInto(controller) {\n var descriptor = controller._pendingPullIntos.shift();\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n return descriptor;\n}\n\nfunction ReadableByteStreamControllerShouldCallPull(controller) {\n var stream = controller._controlledReadableStream;\n\n if (stream._state !== 'readable') {\n return false;\n }\n\n if (controller._closeRequested === true) {\n return false;\n }\n\n if (controller._started === false) {\n return false;\n }\n\n if (ReadableStreamHasDefaultReader(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {\n return true;\n }\n\n if (ReadableStreamHasBYOBReader(stream) === true && ReadableStreamGetNumReadIntoRequests(stream) > 0) {\n return true;\n }\n\n if (ReadableByteStreamControllerGetDesiredSize(controller) > 0) {\n return true;\n }\n\n return false;\n}\n\n// A client of ReadableByteStreamController may use these functions directly to bypass state check.\n\nfunction ReadableByteStreamControllerClose(controller) {\n var stream = controller._controlledReadableStream;\n\n assert(controller._closeRequested === false);\n assert(stream._state === 'readable');\n\n if (controller._queueTotalSize > 0) {\n controller._closeRequested = true;\n\n return;\n }\n\n if (controller._pendingPullIntos.length > 0) {\n var firstPendingPullInto = controller._pendingPullIntos[0];\n if (firstPendingPullInto.bytesFilled > 0) {\n var e = new TypeError('Insufficient bytes to fill elements in the given buffer');\n ReadableByteStreamControllerError(controller, e);\n\n throw e;\n }\n }\n\n ReadableStreamClose(stream);\n}\n\nfunction ReadableByteStreamControllerEnqueue(controller, chunk) {\n var stream = controller._controlledReadableStream;\n\n assert(controller._closeRequested === false);\n assert(stream._state === 'readable');\n\n var buffer = chunk.buffer;\n var byteOffset = chunk.byteOffset;\n var byteLength = chunk.byteLength;\n var transferredBuffer = TransferArrayBuffer(buffer);\n\n if (ReadableStreamHasDefaultReader(stream) === true) {\n if (ReadableStreamGetNumReadRequests(stream) === 0) {\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n } else {\n assert(controller._queue.length === 0);\n\n var transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);\n ReadableStreamFulfillReadRequest(stream, transferredView, false);\n }\n } else if (ReadableStreamHasBYOBReader(stream) === true) {\n // TODO: Ideally in this branch detaching should happen only if the buffer is not consumed fully.\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n } else {\n assert(IsReadableStreamLocked(stream) === false, 'stream must not be locked');\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n }\n}\n\nfunction ReadableByteStreamControllerError(controller, e) {\n var stream = controller._controlledReadableStream;\n\n assert(stream._state === 'readable');\n\n ReadableByteStreamControllerClearPendingPullIntos(controller);\n\n ResetQueue(controller);\n ReadableStreamError(stream, e);\n}\n\nfunction ReadableByteStreamControllerGetDesiredSize(controller) {\n var stream = controller._controlledReadableStream;\n var state = stream._state;\n\n if (state === 'errored') {\n return null;\n }\n if (state === 'closed') {\n return 0;\n }\n\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\nfunction ReadableByteStreamControllerRespond(controller, bytesWritten) {\n bytesWritten = Number(bytesWritten);\n if (IsFiniteNonNegativeNumber(bytesWritten) === false) {\n throw new RangeError('bytesWritten must be a finite');\n }\n\n assert(controller._pendingPullIntos.length > 0);\n\n ReadableByteStreamControllerRespondInternal(controller, bytesWritten);\n}\n\nfunction ReadableByteStreamControllerRespondWithNewView(controller, view) {\n assert(controller._pendingPullIntos.length > 0);\n\n var firstDescriptor = controller._pendingPullIntos[0];\n\n if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {\n throw new RangeError('The region specified by view does not match byobRequest');\n }\n if (firstDescriptor.byteLength !== view.byteLength) {\n throw new RangeError('The buffer of view has different capacity than byobRequest');\n }\n\n firstDescriptor.buffer = view.buffer;\n\n ReadableByteStreamControllerRespondInternal(controller, view.byteLength);\n}\n\n// Helper functions for the ReadableStream.\n\nfunction streamBrandCheckException(name) {\n return new TypeError('ReadableStream.prototype.' + name + ' can only be used on a ReadableStream');\n}\n\n// Helper functions for the readers.\n\nfunction readerLockException(name) {\n return new TypeError('Cannot ' + name + ' a stream using a released reader');\n}\n\n// Helper functions for the ReadableStreamDefaultReader.\n\nfunction defaultReaderBrandCheckException(name) {\n return new TypeError('ReadableStreamDefaultReader.prototype.' + name + ' can only be used on a ReadableStreamDefaultReader');\n}\n\nfunction defaultReaderClosedPromiseInitialize(reader) {\n reader._closedPromise = new Promise(function (resolve, reject) {\n reader._closedPromise_resolve = resolve;\n reader._closedPromise_reject = reject;\n });\n}\n\nfunction defaultReaderClosedPromiseInitializeAsRejected(reader, reason) {\n reader._closedPromise = Promise.reject(reason);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n\nfunction defaultReaderClosedPromiseInitializeAsResolved(reader) {\n reader._closedPromise = Promise.resolve(undefined);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n\nfunction defaultReaderClosedPromiseReject(reader, reason) {\n assert(reader._closedPromise_resolve !== undefined);\n assert(reader._closedPromise_reject !== undefined);\n\n reader._closedPromise_reject(reason);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n\nfunction defaultReaderClosedPromiseResetToRejected(reader, reason) {\n assert(reader._closedPromise_resolve === undefined);\n assert(reader._closedPromise_reject === undefined);\n\n reader._closedPromise = Promise.reject(reason);\n}\n\nfunction defaultReaderClosedPromiseResolve(reader) {\n assert(reader._closedPromise_resolve !== undefined);\n assert(reader._closedPromise_reject !== undefined);\n\n reader._closedPromise_resolve(undefined);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n\n// Helper functions for the ReadableStreamDefaultReader.\n\nfunction byobReaderBrandCheckException(name) {\n return new TypeError('ReadableStreamBYOBReader.prototype.' + name + ' can only be used on a ReadableStreamBYOBReader');\n}\n\n// Helper functions for the ReadableStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name) {\n return new TypeError('ReadableStreamDefaultController.prototype.' + name + ' can only be used on a ReadableStreamDefaultController');\n}\n\n// Helper functions for the ReadableStreamBYOBRequest.\n\nfunction byobRequestBrandCheckException(name) {\n return new TypeError('ReadableStreamBYOBRequest.prototype.' + name + ' can only be used on a ReadableStreamBYOBRequest');\n}\n\n// Helper functions for the ReadableByteStreamController.\n\nfunction byteStreamControllerBrandCheckException(name) {\n return new TypeError('ReadableByteStreamController.prototype.' + name + ' can only be used on a ReadableByteStreamController');\n}\n\n// Helper function for ReadableStream pipeThrough\n\nfunction ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise) {\n try {\n // This relies on the brand-check that is enforced by Promise.prototype.then(). As with the rest of the reference\n // implementation, it doesn't attempt to do the right thing if someone has modified the global environment.\n Promise.prototype.then.call(promise, undefined, function () {});\n } catch (e) {\n // The brand check failed, therefore the internal slot is not present and there's nothing further to do.\n }\n}\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nvar transformStream = __w_pdfjs_require__(6);\nvar readableStream = __w_pdfjs_require__(4);\nvar writableStream = __w_pdfjs_require__(2);\n\nexports.TransformStream = transformStream.TransformStream;\nexports.ReadableStream = readableStream.ReadableStream;\nexports.IsReadableStreamDisturbed = readableStream.IsReadableStreamDisturbed;\nexports.ReadableStreamDefaultControllerClose = readableStream.ReadableStreamDefaultControllerClose;\nexports.ReadableStreamDefaultControllerEnqueue = readableStream.ReadableStreamDefaultControllerEnqueue;\nexports.ReadableStreamDefaultControllerError = readableStream.ReadableStreamDefaultControllerError;\nexports.ReadableStreamDefaultControllerGetDesiredSize = readableStream.ReadableStreamDefaultControllerGetDesiredSize;\nexports.AcquireWritableStreamDefaultWriter = writableStream.AcquireWritableStreamDefaultWriter;\nexports.IsWritableStream = writableStream.IsWritableStream;\nexports.IsWritableStreamLocked = writableStream.IsWritableStreamLocked;\nexports.WritableStream = writableStream.WritableStream;\nexports.WritableStreamAbort = writableStream.WritableStreamAbort;\nexports.WritableStreamDefaultControllerError = writableStream.WritableStreamDefaultControllerError;\nexports.WritableStreamDefaultWriterCloseWithErrorPropagation = writableStream.WritableStreamDefaultWriterCloseWithErrorPropagation;\nexports.WritableStreamDefaultWriterRelease = writableStream.WritableStreamDefaultWriterRelease;\nexports.WritableStreamDefaultWriterWrite = writableStream.WritableStreamDefaultWriterWrite;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar _require = __w_pdfjs_require__(1),\n assert = _require.assert;\n\nvar _require2 = __w_pdfjs_require__(0),\n InvokeOrNoop = _require2.InvokeOrNoop,\n PromiseInvokeOrPerformFallback = _require2.PromiseInvokeOrPerformFallback,\n PromiseInvokeOrNoop = _require2.PromiseInvokeOrNoop,\n typeIsObject = _require2.typeIsObject;\n\nvar _require3 = __w_pdfjs_require__(4),\n ReadableStream = _require3.ReadableStream,\n ReadableStreamDefaultControllerClose = _require3.ReadableStreamDefaultControllerClose,\n ReadableStreamDefaultControllerEnqueue = _require3.ReadableStreamDefaultControllerEnqueue,\n ReadableStreamDefaultControllerError = _require3.ReadableStreamDefaultControllerError,\n ReadableStreamDefaultControllerGetDesiredSize = _require3.ReadableStreamDefaultControllerGetDesiredSize;\n\nvar _require4 = __w_pdfjs_require__(2),\n WritableStream = _require4.WritableStream,\n WritableStreamDefaultControllerError = _require4.WritableStreamDefaultControllerError;\n\n// Methods on the transform stream controller object\n\nfunction TransformStreamCloseReadable(transformStream) {\n // console.log('TransformStreamCloseReadable()');\n\n if (transformStream._errored === true) {\n throw new TypeError('TransformStream is already errored');\n }\n\n if (transformStream._readableClosed === true) {\n throw new TypeError('Readable side is already closed');\n }\n\n TransformStreamCloseReadableInternal(transformStream);\n}\n\nfunction TransformStreamEnqueueToReadable(transformStream, chunk) {\n // console.log('TransformStreamEnqueueToReadable()');\n\n if (transformStream._errored === true) {\n throw new TypeError('TransformStream is already errored');\n }\n\n if (transformStream._readableClosed === true) {\n throw new TypeError('Readable side is already closed');\n }\n\n // We throttle transformer.transform invocation based on the backpressure of the ReadableStream, but we still\n // accept TransformStreamEnqueueToReadable() calls.\n\n var controller = transformStream._readableController;\n\n try {\n ReadableStreamDefaultControllerEnqueue(controller, chunk);\n } catch (e) {\n // This happens when readableStrategy.size() throws.\n // The ReadableStream has already errored itself.\n transformStream._readableClosed = true;\n TransformStreamErrorIfNeeded(transformStream, e);\n\n throw transformStream._storedError;\n }\n\n var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);\n var maybeBackpressure = desiredSize <= 0;\n\n if (maybeBackpressure === true && transformStream._backpressure === false) {\n // This allows pull() again. When desiredSize is 0, it's possible that a pull() will happen immediately (but\n // asynchronously) after this because of pending read()s and set _backpressure back to false.\n //\n // If pull() could be called from inside enqueue(), then this logic would be wrong. This cannot happen\n // because there is always a promise pending from start() or pull() when _backpressure is false.\n TransformStreamSetBackpressure(transformStream, true);\n }\n}\n\nfunction TransformStreamError(transformStream, e) {\n if (transformStream._errored === true) {\n throw new TypeError('TransformStream is already errored');\n }\n\n TransformStreamErrorInternal(transformStream, e);\n}\n\n// Abstract operations.\n\nfunction TransformStreamCloseReadableInternal(transformStream) {\n assert(transformStream._errored === false);\n assert(transformStream._readableClosed === false);\n\n try {\n ReadableStreamDefaultControllerClose(transformStream._readableController);\n } catch (e) {\n assert(false);\n }\n\n transformStream._readableClosed = true;\n}\n\nfunction TransformStreamErrorIfNeeded(transformStream, e) {\n if (transformStream._errored === false) {\n TransformStreamErrorInternal(transformStream, e);\n }\n}\n\nfunction TransformStreamErrorInternal(transformStream, e) {\n // console.log('TransformStreamErrorInternal()');\n\n assert(transformStream._errored === false);\n\n transformStream._errored = true;\n transformStream._storedError = e;\n\n if (transformStream._writableDone === false) {\n WritableStreamDefaultControllerError(transformStream._writableController, e);\n }\n if (transformStream._readableClosed === false) {\n ReadableStreamDefaultControllerError(transformStream._readableController, e);\n }\n}\n\n// Used for preventing the next write() call on TransformStreamSink until there\n// is no longer backpressure.\nfunction TransformStreamReadableReadyPromise(transformStream) {\n assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');\n\n if (transformStream._backpressure === false) {\n return Promise.resolve();\n }\n\n assert(transformStream._backpressure === true, '_backpressure should have been initialized');\n\n return transformStream._backpressureChangePromise;\n}\n\nfunction TransformStreamSetBackpressure(transformStream, backpressure) {\n // console.log(`TransformStreamSetBackpressure(${backpressure})`);\n\n // Passes also when called during construction.\n assert(transformStream._backpressure !== backpressure, 'TransformStreamSetBackpressure() should be called only when backpressure is changed');\n\n if (transformStream._backpressureChangePromise !== undefined) {\n // The fulfillment value is just for a sanity check.\n transformStream._backpressureChangePromise_resolve(backpressure);\n }\n\n transformStream._backpressureChangePromise = new Promise(function (resolve) {\n transformStream._backpressureChangePromise_resolve = resolve;\n });\n\n transformStream._backpressureChangePromise.then(function (resolution) {\n assert(resolution !== backpressure, '_backpressureChangePromise should be fulfilled only when backpressure is changed');\n });\n\n transformStream._backpressure = backpressure;\n}\n\nfunction TransformStreamDefaultTransform(chunk, transformStreamController) {\n var transformStream = transformStreamController._controlledTransformStream;\n TransformStreamEnqueueToReadable(transformStream, chunk);\n return Promise.resolve();\n}\n\nfunction TransformStreamTransform(transformStream, chunk) {\n // console.log('TransformStreamTransform()');\n\n assert(transformStream._errored === false);\n assert(transformStream._transforming === false);\n assert(transformStream._backpressure === false);\n\n transformStream._transforming = true;\n\n var transformer = transformStream._transformer;\n var controller = transformStream._transformStreamController;\n\n var transformPromise = PromiseInvokeOrPerformFallback(transformer, 'transform', [chunk, controller], TransformStreamDefaultTransform, [chunk, controller]);\n\n return transformPromise.then(function () {\n transformStream._transforming = false;\n\n return TransformStreamReadableReadyPromise(transformStream);\n }, function (e) {\n TransformStreamErrorIfNeeded(transformStream, e);\n return Promise.reject(e);\n });\n}\n\nfunction IsTransformStreamDefaultController(x) {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {\n return false;\n }\n\n return true;\n}\n\nfunction IsTransformStream(x) {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {\n return false;\n }\n\n return true;\n}\n\nvar TransformStreamSink = function () {\n function TransformStreamSink(transformStream, startPromise) {\n _classCallCheck(this, TransformStreamSink);\n\n this._transformStream = transformStream;\n this._startPromise = startPromise;\n }\n\n _createClass(TransformStreamSink, [{\n key: 'start',\n value: function start(c) {\n var transformStream = this._transformStream;\n\n transformStream._writableController = c;\n\n return this._startPromise.then(function () {\n return TransformStreamReadableReadyPromise(transformStream);\n });\n }\n }, {\n key: 'write',\n value: function write(chunk) {\n // console.log('TransformStreamSink.write()');\n\n var transformStream = this._transformStream;\n\n return TransformStreamTransform(transformStream, chunk);\n }\n }, {\n key: 'abort',\n value: function abort() {\n var transformStream = this._transformStream;\n transformStream._writableDone = true;\n TransformStreamErrorInternal(transformStream, new TypeError('Writable side aborted'));\n }\n }, {\n key: 'close',\n value: function close() {\n // console.log('TransformStreamSink.close()');\n\n var transformStream = this._transformStream;\n\n assert(transformStream._transforming === false);\n\n transformStream._writableDone = true;\n\n var flushPromise = PromiseInvokeOrNoop(transformStream._transformer, 'flush', [transformStream._transformStreamController]);\n // Return a promise that is fulfilled with undefined on success.\n return flushPromise.then(function () {\n if (transformStream._errored === true) {\n return Promise.reject(transformStream._storedError);\n }\n if (transformStream._readableClosed === false) {\n TransformStreamCloseReadableInternal(transformStream);\n }\n return Promise.resolve();\n }).catch(function (r) {\n TransformStreamErrorIfNeeded(transformStream, r);\n return Promise.reject(transformStream._storedError);\n });\n }\n }]);\n\n return TransformStreamSink;\n}();\n\nvar TransformStreamSource = function () {\n function TransformStreamSource(transformStream, startPromise) {\n _classCallCheck(this, TransformStreamSource);\n\n this._transformStream = transformStream;\n this._startPromise = startPromise;\n }\n\n _createClass(TransformStreamSource, [{\n key: 'start',\n value: function start(c) {\n var transformStream = this._transformStream;\n\n transformStream._readableController = c;\n\n return this._startPromise.then(function () {\n // Prevent the first pull() call until there is backpressure.\n\n assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');\n\n if (transformStream._backpressure === true) {\n return Promise.resolve();\n }\n\n assert(transformStream._backpressure === false, '_backpressure should have been initialized');\n\n return transformStream._backpressureChangePromise;\n });\n }\n }, {\n key: 'pull',\n value: function pull() {\n // console.log('TransformStreamSource.pull()');\n\n var transformStream = this._transformStream;\n\n // Invariant. Enforced by the promises returned by start() and pull().\n assert(transformStream._backpressure === true, 'pull() should be never called while _backpressure is false');\n\n assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');\n\n TransformStreamSetBackpressure(transformStream, false);\n\n // Prevent the next pull() call until there is backpressure.\n return transformStream._backpressureChangePromise;\n }\n }, {\n key: 'cancel',\n value: function cancel() {\n var transformStream = this._transformStream;\n transformStream._readableClosed = true;\n TransformStreamErrorInternal(transformStream, new TypeError('Readable side canceled'));\n }\n }]);\n\n return TransformStreamSource;\n}();\n\nvar TransformStreamDefaultController = function () {\n function TransformStreamDefaultController(transformStream) {\n _classCallCheck(this, TransformStreamDefaultController);\n\n if (IsTransformStream(transformStream) === false) {\n throw new TypeError('TransformStreamDefaultController can only be ' + 'constructed with a TransformStream instance');\n }\n\n if (transformStream._transformStreamController !== undefined) {\n throw new TypeError('TransformStreamDefaultController instances can ' + 'only be created by the TransformStream constructor');\n }\n\n this._controlledTransformStream = transformStream;\n }\n\n _createClass(TransformStreamDefaultController, [{\n key: 'enqueue',\n value: function enqueue(chunk) {\n if (IsTransformStreamDefaultController(this) === false) {\n throw defaultControllerBrandCheckException('enqueue');\n }\n\n TransformStreamEnqueueToReadable(this._controlledTransformStream, chunk);\n }\n }, {\n key: 'close',\n value: function close() {\n if (IsTransformStreamDefaultController(this) === false) {\n throw defaultControllerBrandCheckException('close');\n }\n\n TransformStreamCloseReadable(this._controlledTransformStream);\n }\n }, {\n key: 'error',\n value: function error(reason) {\n if (IsTransformStreamDefaultController(this) === false) {\n throw defaultControllerBrandCheckException('error');\n }\n\n TransformStreamError(this._controlledTransformStream, reason);\n }\n }, {\n key: 'desiredSize',\n get: function get() {\n if (IsTransformStreamDefaultController(this) === false) {\n throw defaultControllerBrandCheckException('desiredSize');\n }\n\n var transformStream = this._controlledTransformStream;\n var readableController = transformStream._readableController;\n\n return ReadableStreamDefaultControllerGetDesiredSize(readableController);\n }\n }]);\n\n return TransformStreamDefaultController;\n}();\n\nvar TransformStream = function () {\n function TransformStream() {\n var transformer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, TransformStream);\n\n this._transformer = transformer;\n var readableStrategy = transformer.readableStrategy,\n writableStrategy = transformer.writableStrategy;\n\n\n this._transforming = false;\n this._errored = false;\n this._storedError = undefined;\n\n this._writableController = undefined;\n this._readableController = undefined;\n this._transformStreamController = undefined;\n\n this._writableDone = false;\n this._readableClosed = false;\n\n this._backpressure = undefined;\n this._backpressureChangePromise = undefined;\n this._backpressureChangePromise_resolve = undefined;\n\n this._transformStreamController = new TransformStreamDefaultController(this);\n\n var startPromise_resolve = void 0;\n var startPromise = new Promise(function (resolve) {\n startPromise_resolve = resolve;\n });\n\n var source = new TransformStreamSource(this, startPromise);\n\n this._readable = new ReadableStream(source, readableStrategy);\n\n var sink = new TransformStreamSink(this, startPromise);\n\n this._writable = new WritableStream(sink, writableStrategy);\n\n assert(this._writableController !== undefined);\n assert(this._readableController !== undefined);\n\n var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(this._readableController);\n // Set _backpressure based on desiredSize. As there is no read() at this point, we can just interpret\n // desiredSize being non-positive as backpressure.\n TransformStreamSetBackpressure(this, desiredSize <= 0);\n\n var transformStream = this;\n var startResult = InvokeOrNoop(transformer, 'start', [transformStream._transformStreamController]);\n startPromise_resolve(startResult);\n startPromise.catch(function (e) {\n // The underlyingSink and underlyingSource will error the readable and writable ends on their own.\n if (transformStream._errored === false) {\n transformStream._errored = true;\n transformStream._storedError = e;\n }\n });\n }\n\n _createClass(TransformStream, [{\n key: 'readable',\n get: function get() {\n if (IsTransformStream(this) === false) {\n throw streamBrandCheckException('readable');\n }\n\n return this._readable;\n }\n }, {\n key: 'writable',\n get: function get() {\n if (IsTransformStream(this) === false) {\n throw streamBrandCheckException('writable');\n }\n\n return this._writable;\n }\n }]);\n\n return TransformStream;\n}();\n\nmodule.exports = { TransformStream: TransformStream };\n\n// Helper functions for the TransformStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name) {\n return new TypeError('TransformStreamDefaultController.prototype.' + name + ' can only be used on a TransformStreamDefaultController');\n}\n\n// Helper functions for the TransformStream.\n\nfunction streamBrandCheckException(name) {\n return new TypeError('TransformStream.prototype.' + name + ' can only be used on a TransformStream');\n}\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\nmodule.exports = __w_pdfjs_require__(5);\n\n\n/***/ })\n/******/ ])));","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint-disable no-restricted-globals */\n\nif (typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('GENERIC')) {\n // The `URL` constructor is assumed to be available in the extension builds.\n exports.URL = URL;\n} else {\n let isURLSupported = false;\n try {\n if (typeof URL === 'function' && typeof URL.prototype === 'object' &&\n ('origin' in URL.prototype)) {\n const u = new URL('b', 'http://a');\n u.pathname = 'c%20d';\n isURLSupported = (u.href === 'http://a/c%20d');\n }\n } catch (ex) {\n // The `URL` constructor cannot be used.\n }\n\n if (isURLSupported) {\n exports.URL = URL;\n } else {\n if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('IMAGE_DECODERS')) {\n class DummyURL {\n constructor() {\n throw new Error('The current image decoders doesn\\'t utilize the ' +\n '`URL` constructor, hence it shouldn\\'t need to be ' +\n 'polyfilled for the IMAGE_DECODERS build target.');\n }\n }\n exports.URL = DummyURL;\n } else {\n const PolyfillURL = require('../../external/url/url-lib').URL;\n\n // Attempt to copy over the static methods.\n const OriginalURL = require('./global_scope').URL;\n if (OriginalURL) {\n PolyfillURL.createObjectURL = function(blob) {\n // IE extension allows a second optional options argument, see\n // http://msdn.microsoft.com/en-us/library/ie/hh772302(v=vs.85).aspx\n return OriginalURL.createObjectURL.apply(OriginalURL, arguments);\n };\n PolyfillURL.revokeObjectURL = function(url) {\n OriginalURL.revokeObjectURL(url);\n };\n }\n exports.URL = PolyfillURL;\n }\n }\n}\n","/* Any copyright is dedicated to the Public Domain.\n * http://creativecommons.org/publicdomain/zero/1.0/\n */\n\n// Polyfill obtained from: https://github.com/Polymer/URL\n\n(function URLConstructorClosure() {\n 'use strict';\n\n var relative = Object.create(null);\n relative['ftp'] = 21;\n relative['file'] = 0;\n relative['gopher'] = 70;\n relative['http'] = 80;\n relative['https'] = 443;\n relative['ws'] = 80;\n relative['wss'] = 443;\n\n var relativePathDotMapping = Object.create(null);\n relativePathDotMapping['%2e'] = '.';\n relativePathDotMapping['.%2e'] = '..';\n relativePathDotMapping['%2e.'] = '..';\n relativePathDotMapping['%2e%2e'] = '..';\n\n function isRelativeScheme(scheme) {\n return relative[scheme] !== undefined;\n }\n\n function invalid() {\n clear.call(this);\n this._isInvalid = true;\n }\n\n function IDNAToASCII(h) {\n if (h === '') {\n invalid.call(this);\n }\n // XXX\n return h.toLowerCase();\n }\n\n function percentEscape(c) {\n var unicode = c.charCodeAt(0);\n if (unicode > 0x20 &&\n unicode < 0x7F &&\n // \" # < > ? `\n [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1\n ) {\n return c;\n }\n return encodeURIComponent(c);\n }\n\n function percentEscapeQuery(c) {\n // XXX This actually needs to encode c using encoding and then\n // convert the bytes one-by-one.\n\n var unicode = c.charCodeAt(0);\n if (unicode > 0x20 &&\n unicode < 0x7F &&\n // \" # < > ` (do not escape '?')\n [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1\n ) {\n return c;\n }\n return encodeURIComponent(c);\n }\n\n var EOF, ALPHA = /[a-zA-Z]/,\n ALPHANUMERIC = /[a-zA-Z0-9\\+\\-\\.]/;\n\n function parse(input, stateOverride, base) {\n function err(message) {\n errors.push(message);\n }\n\n var state = stateOverride || 'scheme start',\n cursor = 0,\n buffer = '',\n seenAt = false,\n seenBracket = false,\n errors = [];\n\n loop: while ((input[cursor - 1] !== EOF || cursor === 0) &&\n !this._isInvalid) {\n var c = input[cursor];\n switch (state) {\n case 'scheme start':\n if (c && ALPHA.test(c)) {\n buffer += c.toLowerCase(); // ASCII-safe\n state = 'scheme';\n } else if (!stateOverride) {\n buffer = '';\n state = 'no scheme';\n continue;\n } else {\n err('Invalid scheme.');\n break loop;\n }\n break;\n\n case 'scheme':\n if (c && ALPHANUMERIC.test(c)) {\n buffer += c.toLowerCase(); // ASCII-safe\n } else if (c === ':') {\n this._scheme = buffer;\n buffer = '';\n if (stateOverride) {\n break loop;\n }\n if (isRelativeScheme(this._scheme)) {\n this._isRelative = true;\n }\n if (this._scheme === 'file') {\n state = 'relative';\n } else if (this._isRelative && base &&\n base._scheme === this._scheme) {\n state = 'relative or authority';\n } else if (this._isRelative) {\n state = 'authority first slash';\n } else {\n state = 'scheme data';\n }\n } else if (!stateOverride) {\n buffer = '';\n cursor = 0;\n state = 'no scheme';\n continue;\n } else if (c === EOF) {\n break loop;\n } else {\n err('Code point not allowed in scheme: ' + c);\n break loop;\n }\n break;\n\n case 'scheme data':\n if (c === '?') {\n this._query = '?';\n state = 'query';\n } else if (c === '#') {\n this._fragment = '#';\n state = 'fragment';\n } else {\n // XXX error handling\n if (c !== EOF && c !== '\\t' && c !== '\\n' && c !== '\\r') {\n this._schemeData += percentEscape(c);\n }\n }\n break;\n\n case 'no scheme':\n if (!base || !(isRelativeScheme(base._scheme))) {\n err('Missing scheme.');\n invalid.call(this);\n } else {\n state = 'relative';\n continue;\n }\n break;\n\n case 'relative or authority':\n if (c === '/' && input[cursor + 1] === '/') {\n state = 'authority ignore slashes';\n } else {\n err('Expected /, got: ' + c);\n state = 'relative';\n continue;\n }\n break;\n\n case 'relative':\n this._isRelative = true;\n if (this._scheme !== 'file') {\n this._scheme = base._scheme;\n }\n if (c === EOF) {\n this._host = base._host;\n this._port = base._port;\n this._path = base._path.slice();\n this._query = base._query;\n this._username = base._username;\n this._password = base._password;\n break loop;\n } else if (c === '/' || c === '\\\\') {\n if (c === '\\\\') {\n err('\\\\ is an invalid code point.');\n }\n state = 'relative slash';\n } else if (c === '?') {\n this._host = base._host;\n this._port = base._port;\n this._path = base._path.slice();\n this._query = '?';\n this._username = base._username;\n this._password = base._password;\n state = 'query';\n } else if (c === '#') {\n this._host = base._host;\n this._port = base._port;\n this._path = base._path.slice();\n this._query = base._query;\n this._fragment = '#';\n this._username = base._username;\n this._password = base._password;\n state = 'fragment';\n } else {\n var nextC = input[cursor + 1];\n var nextNextC = input[cursor + 2];\n if (this._scheme !== 'file' || !ALPHA.test(c) ||\n (nextC !== ':' && nextC !== '|') ||\n (nextNextC !== EOF && nextNextC !== '/' && nextNextC !== '\\\\' &&\n nextNextC !== '?' && nextNextC !== '#')) {\n this._host = base._host;\n this._port = base._port;\n this._username = base._username;\n this._password = base._password;\n this._path = base._path.slice();\n this._path.pop();\n }\n state = 'relative path';\n continue;\n }\n break;\n\n case 'relative slash':\n if (c === '/' || c === '\\\\') {\n if (c === '\\\\') {\n err('\\\\ is an invalid code point.');\n }\n if (this._scheme === 'file') {\n state = 'file host';\n } else {\n state = 'authority ignore slashes';\n }\n } else {\n if (this._scheme !== 'file') {\n this._host = base._host;\n this._port = base._port;\n this._username = base._username;\n this._password = base._password;\n }\n state = 'relative path';\n continue;\n }\n break;\n\n case 'authority first slash':\n if (c === '/') {\n state = 'authority second slash';\n } else {\n err('Expected \\'/\\', got: ' + c);\n state = 'authority ignore slashes';\n continue;\n }\n break;\n\n case 'authority second slash':\n state = 'authority ignore slashes';\n if (c !== '/') {\n err('Expected \\'/\\', got: ' + c);\n continue;\n }\n break;\n\n case 'authority ignore slashes':\n if (c !== '/' && c !== '\\\\') {\n state = 'authority';\n continue;\n } else {\n err('Expected authority, got: ' + c);\n }\n break;\n\n case 'authority':\n if (c === '@') {\n if (seenAt) {\n err('@ already seen.');\n buffer += '%40';\n }\n seenAt = true;\n for (var i = 0; i < buffer.length; i++) {\n var cp = buffer[i];\n if (cp === '\\t' || cp === '\\n' || cp === '\\r') {\n err('Invalid whitespace in authority.');\n continue;\n }\n // XXX check URL code points\n if (cp === ':' && this._password === null) {\n this._password = '';\n continue;\n }\n var tempC = percentEscape(cp);\n if (this._password !== null) {\n this._password += tempC;\n } else {\n this._username += tempC;\n }\n }\n buffer = '';\n } else if (c === EOF || c === '/' || c === '\\\\' ||\n c === '?' || c === '#') {\n cursor -= buffer.length;\n buffer = '';\n state = 'host';\n continue;\n } else {\n buffer += c;\n }\n break;\n\n case 'file host':\n if (c === EOF || c === '/' || c === '\\\\' || c === '?' || c === '#') {\n if (buffer.length === 2 && ALPHA.test(buffer[0]) &&\n (buffer[1] === ':' || buffer[1] === '|')) {\n state = 'relative path';\n } else if (buffer.length === 0) {\n state = 'relative path start';\n } else {\n this._host = IDNAToASCII.call(this, buffer);\n buffer = '';\n state = 'relative path start';\n }\n continue;\n } else if (c === '\\t' || c === '\\n' || c === '\\r') {\n err('Invalid whitespace in file host.');\n } else {\n buffer += c;\n }\n break;\n\n case 'host':\n case 'hostname':\n if (c === ':' && !seenBracket) {\n // XXX host parsing\n this._host = IDNAToASCII.call(this, buffer);\n buffer = '';\n state = 'port';\n if (stateOverride === 'hostname') {\n break loop;\n }\n } else if (c === EOF || c === '/' ||\n c === '\\\\' || c === '?' || c === '#') {\n this._host = IDNAToASCII.call(this, buffer);\n buffer = '';\n state = 'relative path start';\n if (stateOverride) {\n break loop;\n }\n continue;\n } else if (c !== '\\t' && c !== '\\n' && c !== '\\r') {\n if (c === '[') {\n seenBracket = true;\n } else if (c === ']') {\n seenBracket = false;\n }\n buffer += c;\n } else {\n err('Invalid code point in host/hostname: ' + c);\n }\n break;\n\n case 'port':\n if (/[0-9]/.test(c)) {\n buffer += c;\n } else if (c === EOF || c === '/' || c === '\\\\' ||\n c === '?' || c === '#' || stateOverride) {\n if (buffer !== '') {\n var temp = parseInt(buffer, 10);\n if (temp !== relative[this._scheme]) {\n this._port = temp + '';\n }\n buffer = '';\n }\n if (stateOverride) {\n break loop;\n }\n state = 'relative path start';\n continue;\n } else if (c === '\\t' || c === '\\n' || c === '\\r') {\n err('Invalid code point in port: ' + c);\n } else {\n invalid.call(this);\n }\n break;\n\n case 'relative path start':\n if (c === '\\\\') {\n err('\\'\\\\\\' not allowed in path.');\n }\n state = 'relative path';\n if (c !== '/' && c !== '\\\\') {\n continue;\n }\n break;\n\n case 'relative path':\n if (c === EOF || c === '/' || c === '\\\\' ||\n (!stateOverride && (c === '?' || c === '#'))) {\n if (c === '\\\\') {\n err('\\\\ not allowed in relative path.');\n }\n var tmp;\n if ((tmp = relativePathDotMapping[buffer.toLowerCase()])) {\n buffer = tmp;\n }\n if (buffer === '..') {\n this._path.pop();\n if (c !== '/' && c !== '\\\\') {\n this._path.push('');\n }\n } else if (buffer === '.' && c !== '/' && c !== '\\\\') {\n this._path.push('');\n } else if (buffer !== '.') {\n if (this._scheme === 'file' && this._path.length === 0 &&\n buffer.length === 2 && ALPHA.test(buffer[0]) &&\n buffer[1] === '|') {\n buffer = buffer[0] + ':';\n }\n this._path.push(buffer);\n }\n buffer = '';\n if (c === '?') {\n this._query = '?';\n state = 'query';\n } else if (c === '#') {\n this._fragment = '#';\n state = 'fragment';\n }\n } else if (c !== '\\t' && c !== '\\n' && c !== '\\r') {\n buffer += percentEscape(c);\n }\n break;\n\n case 'query':\n if (!stateOverride && c === '#') {\n this._fragment = '#';\n state = 'fragment';\n } else if (c !== EOF && c !== '\\t' && c !== '\\n' && c !== '\\r') {\n this._query += percentEscapeQuery(c);\n }\n break;\n\n case 'fragment':\n if (c !== EOF && c !== '\\t' && c !== '\\n' && c !== '\\r') {\n this._fragment += c;\n }\n break;\n }\n\n cursor++;\n }\n }\n\n function clear() {\n this._scheme = '';\n this._schemeData = '';\n this._username = '';\n this._password = null;\n this._host = '';\n this._port = '';\n this._path = [];\n this._query = '';\n this._fragment = '';\n this._isInvalid = false;\n this._isRelative = false;\n }\n\n // Does not process domain names or IP addresses.\n // Does not handle encoding for the query parameter.\n function JURL(url, base /* , encoding */) {\n if (base !== undefined && !(base instanceof JURL)) {\n base = new JURL(String(base));\n }\n\n this._url = url;\n clear.call(this);\n\n var input = url.replace(/^[ \\t\\r\\n\\f]+|[ \\t\\r\\n\\f]+$/g, '');\n // encoding = encoding || 'utf-8'\n\n parse.call(this, input, null, base);\n }\n\n JURL.prototype = {\n toString() {\n return this.href;\n },\n get href() {\n if (this._isInvalid) {\n return this._url;\n }\n var authority = '';\n if (this._username !== '' || this._password !== null) {\n authority = this._username +\n (this._password !== null ? ':' + this._password : '') + '@';\n }\n\n return this.protocol +\n (this._isRelative ? '//' + authority + this.host : '') +\n this.pathname + this._query + this._fragment;\n },\n // The named parameter should be different from the setter's function name.\n // Otherwise Safari 5 will throw an error (see issue 8541)\n set href(value) {\n clear.call(this);\n parse.call(this, value);\n },\n\n get protocol() {\n return this._scheme + ':';\n },\n set protocol(value) {\n if (this._isInvalid) {\n return;\n }\n parse.call(this, value + ':', 'scheme start');\n },\n\n get host() {\n return this._isInvalid ? '' : this._port ?\n this._host + ':' + this._port : this._host;\n },\n set host(value) {\n if (this._isInvalid || !this._isRelative) {\n return;\n }\n parse.call(this, value, 'host');\n },\n\n get hostname() {\n return this._host;\n },\n set hostname(value) {\n if (this._isInvalid || !this._isRelative) {\n return;\n }\n parse.call(this, value, 'hostname');\n },\n\n get port() {\n return this._port;\n },\n set port(value) {\n if (this._isInvalid || !this._isRelative) {\n return;\n }\n parse.call(this, value, 'port');\n },\n\n get pathname() {\n return this._isInvalid ? '' : this._isRelative ?\n '/' + this._path.join('/') : this._schemeData;\n },\n set pathname(value) {\n if (this._isInvalid || !this._isRelative) {\n return;\n }\n this._path = [];\n parse.call(this, value, 'relative path start');\n },\n\n get search() {\n return this._isInvalid || !this._query || this._query === '?' ?\n '' : this._query;\n },\n set search(value) {\n if (this._isInvalid || !this._isRelative) {\n return;\n }\n this._query = '?';\n if (value[0] === '?') {\n value = value.slice(1);\n }\n parse.call(this, value, 'query');\n },\n\n get hash() {\n return this._isInvalid || !this._fragment || this._fragment === '#' ?\n '' : this._fragment;\n },\n set hash(value) {\n if (this._isInvalid) {\n return;\n }\n this._fragment = '#';\n if (value[0] === '#') {\n value = value.slice(1);\n }\n parse.call(this, value, 'fragment');\n },\n\n get origin() {\n var host;\n if (this._isInvalid || !this._scheme) {\n return '';\n }\n // javascript: Gecko returns String(\"\"), WebKit/Blink String(\"null\")\n // Gecko throws error for \"data://\"\n // data: Gecko returns \"\", Blink returns \"data://\", WebKit returns \"null\"\n // Gecko returns String(\"\") for file: mailto:\n // WebKit/Blink returns String(\"SCHEME://\") for file: mailto:\n switch (this._scheme) {\n case 'data':\n case 'file':\n case 'javascript':\n case 'mailto':\n return 'null';\n case 'blob':\n // Special case of blob: -- returns valid origin of _schemeData.\n try {\n return new JURL(this._schemeData).origin || 'null';\n } catch (_) {\n // Invalid _schemeData origin -- ignoring errors.\n }\n return 'null';\n }\n host = this.host;\n if (!host) {\n return '';\n }\n return this._scheme + '://' + host;\n },\n };\n\n exports.URL = JURL;\n})();\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals requirejs, __non_webpack_require__ */\n\nimport {\n assert, createPromiseCapability, getVerbosityLevel, info, InvalidPDFException,\n isArrayBuffer, isSameOrigin, MissingPDFException, NativeImageDecoding,\n PasswordException, setVerbosityLevel, shadow, stringToBytes,\n UnexpectedResponseException, UnknownErrorException, unreachable, URL, warn\n} from '../shared/util';\nimport {\n DOMCanvasFactory, DOMCMapReaderFactory, DummyStatTimer, loadScript,\n PageViewport, RenderingCancelledException, StatTimer\n} from './dom_utils';\nimport { FontFaceObject, FontLoader } from './font_loader';\nimport { apiCompatibilityParams } from './api_compatibility';\nimport { CanvasGraphics } from './canvas';\nimport globalScope from '../shared/global_scope';\nimport { GlobalWorkerOptions } from './worker_options';\nimport { MessageHandler } from '../shared/message_handler';\nimport { Metadata } from './metadata';\nimport { PDFDataTransportStream } from './transport_stream';\nimport { WebGLContext } from './webgl';\n\nconst DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536\n\nlet isWorkerDisabled = false;\nlet fallbackWorkerSrc;\n\nlet fakeWorkerFilesLoader = null;\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('GENERIC')) {\n let useRequireEnsure = false;\n // For GENERIC build we need to add support for different fake file loaders\n // for different frameworks.\n if (typeof window === 'undefined') {\n // node.js - disable worker and set require.ensure.\n isWorkerDisabled = true;\n if (typeof __non_webpack_require__.ensure === 'undefined') {\n __non_webpack_require__.ensure = __non_webpack_require__('node-ensure');\n }\n useRequireEnsure = true;\n } else if (typeof __non_webpack_require__ !== 'undefined' &&\n typeof __non_webpack_require__.ensure === 'function') {\n useRequireEnsure = true;\n }\n if (typeof requirejs !== 'undefined' && requirejs.toUrl) {\n fallbackWorkerSrc = requirejs.toUrl('pdfjs-dist/build/pdf.worker.js');\n }\n const dynamicLoaderSupported =\n typeof requirejs !== 'undefined' && requirejs.load;\n fakeWorkerFilesLoader = useRequireEnsure ? (function() {\n return new Promise(function(resolve, reject) {\n __non_webpack_require__.ensure([], function() {\n try {\n let worker;\n if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('LIB')) {\n worker = __non_webpack_require__('../pdf.worker.js');\n } else {\n worker = __non_webpack_require__('./pdf.worker.js');\n }\n resolve(worker.WorkerMessageHandler);\n } catch (ex) {\n reject(ex);\n }\n }, reject, 'pdfjsWorker');\n });\n }) : dynamicLoaderSupported ? (function() {\n return new Promise(function(resolve, reject) {\n requirejs(['pdfjs-dist/build/pdf.worker'], function(worker) {\n try {\n resolve(worker.WorkerMessageHandler);\n } catch (ex) {\n reject(ex);\n }\n }, reject);\n });\n }) : null;\n\n if (!fallbackWorkerSrc && typeof document !== 'undefined') {\n const pdfjsFilePath = document.currentScript && document.currentScript.src;\n if (pdfjsFilePath) {\n fallbackWorkerSrc =\n pdfjsFilePath.replace(/(\\.(?:min\\.)?js)(\\?.*)?$/i, '.worker$1$2');\n }\n }\n}\n\n/**\n * @typedef {function} IPDFStreamFactory\n * @param {DocumentInitParameters} params The document initialization\n * parameters. The \"url\" key is always present.\n * @return {IPDFStream}\n */\n\n/** @type IPDFStreamFactory */\nvar createPDFNetworkStream;\n\n/**\n * Sets the function that instantiates a IPDFStream as an alternative PDF data\n * transport.\n * @param {IPDFStreamFactory} pdfNetworkStreamFactory - the factory function\n * that takes document initialization parameters (including a \"url\") and returns\n * an instance of IPDFStream.\n */\nfunction setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {\n createPDFNetworkStream = pdfNetworkStreamFactory;\n}\n\n/**\n * Document initialization / loading parameters object.\n *\n * @typedef {Object} DocumentInitParameters\n * @property {string} url - The URL of the PDF.\n * @property {TypedArray|Array|string} data - Binary PDF data. Use typed arrays\n * (Uint8Array) to improve the memory usage. If PDF data is BASE64-encoded,\n * use atob() to convert it to a binary string first.\n * @property {Object} httpHeaders - Basic authentication headers.\n * @property {boolean} withCredentials - Indicates whether or not cross-site\n * Access-Control requests should be made using credentials such as cookies\n * or authorization headers. The default is false.\n * @property {string} password - For decrypting password-protected PDFs.\n * @property {TypedArray} initialData - A typed array with the first portion or\n * all of the pdf data. Used by the extension since some data is already\n * loaded before the switch to range requests.\n * @property {number} length - The PDF file length. It's used for progress\n * reports and range requests operations.\n * @property {PDFDataRangeTransport} range\n * @property {number} rangeChunkSize - Optional parameter to specify\n * maximum number of bytes fetched per range request. The default value is\n * 2^16 = 65536.\n * @property {PDFWorker} worker - (optional) The worker that will be used for\n * the loading and parsing of the PDF data.\n * @property {boolean} postMessageTransfers - (optional) Enables transfer usage\n * in postMessage for ArrayBuffers. The default value is `true`.\n * @property {number} verbosity - (optional) Controls the logging level; the\n * constants from {VerbosityLevel} should be used.\n * @property {string} docBaseUrl - (optional) The base URL of the document,\n * used when attempting to recover valid absolute URLs for annotations, and\n * outline items, that (incorrectly) only specify relative URLs.\n * @property {string} nativeImageDecoderSupport - (optional) Strategy for\n * decoding certain (simple) JPEG images in the browser. This is useful for\n * environments without DOM image and canvas support, such as e.g. Node.js.\n * Valid values are 'decode', 'display' or 'none'; where 'decode' is intended\n * for browsers with full image/canvas support, 'display' for environments\n * with limited image support through stubs (useful for SVG conversion),\n * and 'none' where JPEG images will be decoded entirely by PDF.js.\n * The default value is 'decode'.\n * @property {string} cMapUrl - (optional) The URL where the predefined\n * Adobe CMaps are located. Include trailing slash.\n * @property {boolean} cMapPacked - (optional) Specifies if the Adobe CMaps are\n * binary packed.\n * @property {Object} CMapReaderFactory - (optional) The factory that will be\n * used when reading built-in CMap files. Providing a custom factory is useful\n * for environments without `XMLHttpRequest` support, such as e.g. Node.js.\n * The default value is {DOMCMapReaderFactory}.\n * @property {boolean} stopAtErrors - (optional) Reject certain promises, e.g.\n * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated\n * PDF data cannot be successfully parsed, instead of attempting to recover\n * whatever possible of the data. The default value is `false`.\n * @property {number} maxImageSize - (optional) The maximum allowed image size\n * in total pixels, i.e. width * height. Images above this value will not be\n * rendered. Use -1 for no limit, which is also the default value.\n * @property {boolean} isEvalSupported - (optional) Determines if we can eval\n * strings as JS. Primarily used to improve performance of font rendering,\n * and when parsing PDF functions. The default value is `true`.\n * @property {boolean} disableFontFace - (optional) By default fonts are\n * converted to OpenType fonts and loaded via font face rules. If disabled,\n * fonts will be rendered using a built-in font renderer that constructs the\n * glyphs with primitive path commands. The default value is `false`.\n * @property {boolean} disableRange - (optional) Disable range request loading\n * of PDF files. When enabled, and if the server supports partial content\n * requests, then the PDF will be fetched in chunks.\n * The default value is `false`.\n * @property {boolean} disableStream - (optional) Disable streaming of PDF file\n * data. By default PDF.js attempts to load PDFs in chunks.\n * The default value is `false`.\n * @property {boolean} disableAutoFetch - (optional) Disable pre-fetching of PDF\n * file data. When range requests are enabled PDF.js will automatically keep\n * fetching more data even if it isn't needed to display the current page.\n * The default value is `false`.\n * NOTE: It is also necessary to disable streaming, see above,\n * in order for disabling of pre-fetching to work correctly.\n * @property {boolean} disableCreateObjectURL - (optional) Disable the use of\n * `URL.createObjectURL`, for compatibility with older browsers.\n * The default value is `false`.\n * @property {boolean} pdfBug - (optional) Enables special hooks for debugging\n * PDF.js (see `web/debugger.js`). The default value is `false`.\n */\n\n/**\n * @typedef {Object} PDFDocumentStats\n * @property {Array} streamTypes - Used stream types in the document (an item\n * is set to true if specific stream ID was used in the document).\n * @property {Array} fontTypes - Used font type in the document (an item is set\n * to true if specific font ID was used in the document).\n */\n\n/**\n * This is the main entry point for loading a PDF and interacting with it.\n * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR)\n * is used, which means it must follow the same origin rules that any XHR does\n * e.g. No cross domain requests without CORS.\n *\n * @param {string|TypedArray|DocumentInitParameters|PDFDataRangeTransport} src\n * Can be a url to where a PDF is located, a typed array (Uint8Array)\n * already populated with data or parameter object.\n *\n * @return {PDFDocumentLoadingTask}\n */\nfunction getDocument(src) {\n var task = new PDFDocumentLoadingTask();\n\n var source;\n if (typeof src === 'string') {\n source = { url: src, };\n } else if (isArrayBuffer(src)) {\n source = { data: src, };\n } else if (src instanceof PDFDataRangeTransport) {\n source = { range: src, };\n } else {\n if (typeof src !== 'object') {\n throw new Error('Invalid parameter in getDocument, ' +\n 'need either Uint8Array, string or a parameter object');\n }\n if (!src.url && !src.data && !src.range) {\n throw new Error(\n 'Invalid parameter object: need either .data, .range or .url');\n }\n\n source = src;\n }\n\n let params = Object.create(null);\n var rangeTransport = null;\n let worker = null;\n\n for (var key in source) {\n if (key === 'url' && typeof window !== 'undefined') {\n // The full path is required in the 'url' field.\n params[key] = new URL(source[key], window.location).href;\n continue;\n } else if (key === 'range') {\n rangeTransport = source[key];\n continue;\n } else if (key === 'worker') {\n worker = source[key];\n continue;\n } else if (key === 'data' && !(source[key] instanceof Uint8Array)) {\n // Converting string or array-like data to Uint8Array.\n var pdfBytes = source[key];\n if (typeof pdfBytes === 'string') {\n params[key] = stringToBytes(pdfBytes);\n } else if (typeof pdfBytes === 'object' && pdfBytes !== null &&\n !isNaN(pdfBytes.length)) {\n params[key] = new Uint8Array(pdfBytes);\n } else if (isArrayBuffer(pdfBytes)) {\n params[key] = new Uint8Array(pdfBytes);\n } else {\n throw new Error('Invalid PDF binary data: either typed array, ' +\n 'string or array-like object is expected in the ' +\n 'data property.');\n }\n continue;\n }\n params[key] = source[key];\n }\n\n params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE;\n params.CMapReaderFactory = params.CMapReaderFactory || DOMCMapReaderFactory;\n params.ignoreErrors = params.stopAtErrors !== true;\n params.pdfBug = params.pdfBug === true;\n\n const NativeImageDecoderValues = Object.values(NativeImageDecoding);\n if (params.nativeImageDecoderSupport === undefined ||\n !NativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) {\n params.nativeImageDecoderSupport =\n (apiCompatibilityParams.nativeImageDecoderSupport ||\n NativeImageDecoding.DECODE);\n }\n if (!Number.isInteger(params.maxImageSize)) {\n params.maxImageSize = -1;\n }\n if (typeof params.isEvalSupported !== 'boolean') {\n params.isEvalSupported = true;\n }\n if (typeof params.disableFontFace !== 'boolean') {\n params.disableFontFace = apiCompatibilityParams.disableFontFace || false;\n }\n\n if (typeof params.disableRange !== 'boolean') {\n params.disableRange = false;\n }\n if (typeof params.disableStream !== 'boolean') {\n params.disableStream = false;\n }\n if (typeof params.disableAutoFetch !== 'boolean') {\n params.disableAutoFetch = false;\n }\n if (typeof params.disableCreateObjectURL !== 'boolean') {\n params.disableCreateObjectURL =\n apiCompatibilityParams.disableCreateObjectURL || false;\n }\n\n // Set the main-thread verbosity level.\n setVerbosityLevel(params.verbosity);\n\n if (!worker) {\n const workerParams = {\n postMessageTransfers: params.postMessageTransfers,\n verbosity: params.verbosity,\n };\n // Worker was not provided -- creating and owning our own. If message port\n // is specified in global worker options, using it.\n let workerPort = GlobalWorkerOptions.workerPort;\n if (workerPort) {\n workerParams.port = workerPort;\n worker = PDFWorker.fromPort(workerParams);\n } else {\n worker = new PDFWorker(workerParams);\n }\n task._worker = worker;\n }\n var docId = task.docId;\n worker.promise.then(function () {\n if (task.destroyed) {\n throw new Error('Loading aborted');\n }\n return _fetchDocument(worker, params, rangeTransport, docId).then(\n function (workerId) {\n if (task.destroyed) {\n throw new Error('Loading aborted');\n }\n\n let networkStream;\n if (rangeTransport) {\n networkStream = new PDFDataTransportStream({\n length: params.length,\n initialData: params.initialData,\n disableRange: params.disableRange,\n disableStream: params.disableStream,\n }, rangeTransport);\n } else if (!params.data) {\n networkStream = createPDFNetworkStream({\n url: params.url,\n length: params.length,\n httpHeaders: params.httpHeaders,\n withCredentials: params.withCredentials,\n rangeChunkSize: params.rangeChunkSize,\n disableRange: params.disableRange,\n disableStream: params.disableStream,\n });\n }\n\n var messageHandler = new MessageHandler(docId, workerId, worker.port);\n messageHandler.postMessageTransfers = worker.postMessageTransfers;\n var transport = new WorkerTransport(messageHandler, task, networkStream,\n params);\n task._transport = transport;\n messageHandler.send('Ready', null);\n });\n }).catch(task._capability.reject);\n\n return task;\n}\n\n/**\n * Starts fetching of specified PDF document/data.\n * @param {PDFWorker} worker\n * @param {Object} source\n * @param {PDFDataRangeTransport} pdfDataRangeTransport\n * @param {string} docId Unique document id, used as MessageHandler id.\n * @returns {Promise} The promise, which is resolved when worker id of\n * MessageHandler is known.\n * @private\n */\nfunction _fetchDocument(worker, source, pdfDataRangeTransport, docId) {\n if (worker.destroyed) {\n return Promise.reject(new Error('Worker was destroyed'));\n }\n\n if (pdfDataRangeTransport) {\n source.length = pdfDataRangeTransport.length;\n source.initialData = pdfDataRangeTransport.initialData;\n }\n return worker.messageHandler.sendWithPromise('GetDocRequest', {\n docId,\n apiVersion: (typeof PDFJSDev !== 'undefined' ?\n PDFJSDev.eval('BUNDLE_VERSION') : null),\n source: { // Only send the required properties, and *not* the entire object.\n data: source.data,\n url: source.url,\n password: source.password,\n disableAutoFetch: source.disableAutoFetch,\n rangeChunkSize: source.rangeChunkSize,\n length: source.length,\n },\n maxImageSize: source.maxImageSize,\n disableFontFace: source.disableFontFace,\n disableCreateObjectURL: source.disableCreateObjectURL,\n postMessageTransfers: worker.postMessageTransfers,\n docBaseUrl: source.docBaseUrl,\n nativeImageDecoderSupport: source.nativeImageDecoderSupport,\n ignoreErrors: source.ignoreErrors,\n isEvalSupported: source.isEvalSupported,\n }).then(function (workerId) {\n if (worker.destroyed) {\n throw new Error('Worker was destroyed');\n }\n return workerId;\n });\n}\n\n/**\n * PDF document loading operation.\n * @class\n * @alias PDFDocumentLoadingTask\n */\nvar PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {\n var nextDocumentId = 0;\n\n /** @constructs PDFDocumentLoadingTask */\n function PDFDocumentLoadingTask() {\n this._capability = createPromiseCapability();\n this._transport = null;\n this._worker = null;\n\n /**\n * Unique document loading task id -- used in MessageHandlers.\n * @type {string}\n */\n this.docId = 'd' + (nextDocumentId++);\n\n /**\n * Shows if loading task is destroyed.\n * @type {boolean}\n */\n this.destroyed = false;\n\n /**\n * Callback to request a password if wrong or no password was provided.\n * The callback receives two parameters: function that needs to be called\n * with new password and reason (see {PasswordResponses}).\n */\n this.onPassword = null;\n\n /**\n * Callback to be able to monitor the loading progress of the PDF file\n * (necessary to implement e.g. a loading bar). The callback receives\n * an {Object} with the properties: {number} loaded and {number} total.\n */\n this.onProgress = null;\n\n /**\n * Callback to when unsupported feature is used. The callback receives\n * an {UNSUPPORTED_FEATURES} argument.\n */\n this.onUnsupportedFeature = null;\n }\n\n PDFDocumentLoadingTask.prototype =\n /** @lends PDFDocumentLoadingTask.prototype */ {\n /**\n * @return {Promise}\n */\n get promise() {\n return this._capability.promise;\n },\n\n /**\n * Aborts all network requests and destroys worker.\n * @return {Promise} A promise that is resolved after destruction activity\n * is completed.\n */\n destroy() {\n this.destroyed = true;\n\n var transportDestroyed = !this._transport ? Promise.resolve() :\n this._transport.destroy();\n return transportDestroyed.then(() => {\n this._transport = null;\n if (this._worker) {\n this._worker.destroy();\n this._worker = null;\n }\n });\n },\n\n /**\n * Registers callbacks to indicate the document loading completion.\n *\n * @param {function} onFulfilled The callback for the loading completion.\n * @param {function} onRejected The callback for the loading failure.\n * @return {Promise} A promise that is resolved after the onFulfilled or\n * onRejected callback.\n */\n then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) {\n return this.promise.then.apply(this.promise, arguments);\n },\n };\n\n return PDFDocumentLoadingTask;\n})();\n\n/**\n * Abstract class to support range requests file loading.\n * @param {number} length\n * @param {Uint8Array} initialData\n */\nclass PDFDataRangeTransport {\n constructor(length, initialData) {\n this.length = length;\n this.initialData = initialData;\n\n this._rangeListeners = [];\n this._progressListeners = [];\n this._progressiveReadListeners = [];\n this._readyCapability = createPromiseCapability();\n }\n\n addRangeListener(listener) {\n this._rangeListeners.push(listener);\n }\n\n addProgressListener(listener) {\n this._progressListeners.push(listener);\n }\n\n addProgressiveReadListener(listener) {\n this._progressiveReadListeners.push(listener);\n }\n\n onDataRange(begin, chunk) {\n for (const listener of this._rangeListeners) {\n listener(begin, chunk);\n }\n }\n\n onDataProgress(loaded) {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressListeners) {\n listener(loaded);\n }\n });\n }\n\n onDataProgressiveRead(chunk) {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressiveReadListeners) {\n listener(chunk);\n }\n });\n }\n\n transportReady() {\n this._readyCapability.resolve();\n }\n\n requestDataRange(begin, end) {\n unreachable('Abstract method PDFDataRangeTransport.requestDataRange');\n }\n\n abort() {}\n}\n\n/**\n * Proxy to a PDFDocument in the worker thread. Also, contains commonly used\n * properties that can be read synchronously.\n */\nclass PDFDocumentProxy {\n constructor(pdfInfo, transport, loadingTask) {\n this.loadingTask = loadingTask;\n\n this._pdfInfo = pdfInfo;\n this._transport = transport;\n }\n\n /**\n * @return {number} Total number of pages the PDF contains.\n */\n get numPages() {\n return this._pdfInfo.numPages;\n }\n\n /**\n * @return {string} A (not guaranteed to be) unique ID to identify a PDF.\n */\n get fingerprint() {\n return this._pdfInfo.fingerprint;\n }\n\n /**\n * @param {number} pageNumber - The page number to get. The first page is 1.\n * @return {Promise} A promise that is resolved with a {@link PDFPageProxy}\n * object.\n */\n getPage(pageNumber) {\n return this._transport.getPage(pageNumber);\n }\n\n /**\n * @param {{num: number, gen: number}} ref - The page reference. Must have\n * the `num` and `gen` properties.\n * @return {Promise} A promise that is resolved with the page index that is\n * associated with the reference.\n */\n getPageIndex(ref) {\n return this._transport.getPageIndex(ref);\n }\n\n /**\n * @return {Promise} A promise that is resolved with a lookup table for\n * mapping named destinations to reference numbers.\n *\n * This can be slow for large documents. Use `getDestination` instead.\n */\n getDestinations() {\n return this._transport.getDestinations();\n }\n\n /**\n * @param {string} id - The named destination to get.\n * @return {Promise} A promise that is resolved with all information\n * of the given named destination.\n */\n getDestination(id) {\n return this._transport.getDestination(id);\n }\n\n /**\n * @return {Promise} A promise that is resolved with an {Array} containing\n * the page labels that correspond to the page indexes, or `null` when\n * no page labels are present in the PDF file.\n */\n getPageLabels() {\n return this._transport.getPageLabels();\n }\n\n /**\n * @return {Promise} A promise that is resolved with a {string} containing\n * the page mode name.\n */\n getPageMode() {\n return this._transport.getPageMode();\n }\n\n /**\n * @return {Promise} A promise that is resolved with a lookup table for\n * mapping named attachments to their content.\n */\n getAttachments() {\n return this._transport.getAttachments();\n }\n\n /**\n * @return {Promise} A promise that is resolved with an {Array} of all the\n * JavaScript strings in the name tree, or `null` if no JavaScript exists.\n */\n getJavaScript() {\n return this._transport.getJavaScript();\n }\n\n /**\n * @return {Promise} A promise that is resolved with an {Array} that is a\n * tree outline (if it has one) of the PDF. The tree is in the format of:\n * [\n * {\n * title: string,\n * bold: boolean,\n * italic: boolean,\n * color: rgb Uint8ClampedArray,\n * dest: dest obj,\n * url: string,\n * items: array of more items like this\n * },\n * ...\n * ]\n */\n getOutline() {\n return this._transport.getOutline();\n }\n\n /**\n * @return {Promise} A promise that is resolved with an {Array} that contains\n * the permission flags for the PDF document, or `null` when\n * no permissions are present in the PDF file.\n */\n getPermissions() {\n return this._transport.getPermissions();\n }\n\n /**\n * @return {Promise} A promise that is resolved with an {Object} that has\n * `info` and `metadata` properties. `info` is an {Object} filled with\n * anything available in the information dictionary and similarly\n * `metadata` is a {Metadata} object with information from the metadata\n * section of the PDF.\n */\n getMetadata() {\n return this._transport.getMetadata();\n }\n\n /**\n * @return {Promise} A promise that is resolved with a {TypedArray} that has\n * the raw data from the PDF.\n */\n getData() {\n return this._transport.getData();\n }\n\n /**\n * @return {Promise} A promise that is resolved when the document's data\n * is loaded. It is resolved with an {Object} that contains the `length`\n * property that indicates size of the PDF data in bytes.\n */\n getDownloadInfo() {\n return this._transport.downloadInfoCapability.promise;\n }\n\n /**\n * @return {Promise} A promise this is resolved with current statistics about\n * document structures (see {@link PDFDocumentStats}).\n */\n getStats() {\n return this._transport.getStats();\n }\n\n /**\n * Cleans up resources allocated by the document, e.g. created `@font-face`.\n */\n cleanup() {\n this._transport.startCleanup();\n }\n\n /**\n * Destroys the current document instance and terminates the worker.\n */\n destroy() {\n return this.loadingTask.destroy();\n }\n\n /**\n * @return {Object} A subset of the current {DocumentInitParameters},\n * which are either needed in the viewer and/or whose default values\n * may be affected by the `apiCompatibilityParams`.\n */\n get loadingParams() {\n return this._transport.loadingParams;\n }\n}\n\n/**\n * Page getTextContent parameters.\n *\n * @typedef {Object} getTextContentParameters\n * @property {boolean} normalizeWhitespace - replaces all occurrences of\n * whitespace with standard spaces (0x20). The default value is `false`.\n * @property {boolean} disableCombineTextItems - do not attempt to combine\n * same line {@link TextItem}'s. The default value is `false`.\n */\n\n/**\n * Page text content.\n *\n * @typedef {Object} TextContent\n * @property {array} items - array of {@link TextItem}\n * @property {Object} styles - {@link TextStyles} objects, indexed by font name.\n */\n\n/**\n * Page text content part.\n *\n * @typedef {Object} TextItem\n * @property {string} str - text content.\n * @property {string} dir - text direction: 'ttb', 'ltr' or 'rtl'.\n * @property {array} transform - transformation matrix.\n * @property {number} width - width in device space.\n * @property {number} height - height in device space.\n * @property {string} fontName - font name used by pdf.js for converted font.\n */\n\n/**\n * Text style.\n *\n * @typedef {Object} TextStyle\n * @property {number} ascent - font ascent.\n * @property {number} descent - font descent.\n * @property {boolean} vertical - text is in vertical mode.\n * @property {string} fontFamily - possible font family\n */\n\n/**\n * Page annotation parameters.\n *\n * @typedef {Object} GetAnnotationsParameters\n * @property {string} intent - Determines the annotations that will be fetched,\n * can be either 'display' (viewable annotations) or 'print'\n * (printable annotations).\n * If the parameter is omitted, all annotations are fetched.\n */\n\n/**\n * Page render parameters.\n *\n * @typedef {Object} RenderParameters\n * @property {Object} canvasContext - A 2D context of a DOM Canvas object.\n * @property {PageViewport} viewport - Rendering viewport obtained by\n * calling of PDFPage.getViewport method.\n * @property {string} intent - Rendering intent, can be 'display' or 'print'\n * (default value is 'display').\n * @property {boolean} enableWebGL - (optional) Enables WebGL accelerated\n * rendering for some operations. The default value is `false`.\n * @property {boolean} renderInteractiveForms - (optional) Whether or not\n * interactive form elements are rendered in the display\n * layer. If so, we do not render them on canvas as well.\n * @property {Array} transform - (optional) Additional transform, applied\n * just before viewport transform.\n * @property {Object} imageLayer - (optional) An object that has beginLayout,\n * endLayout and appendImage functions.\n * @property {Object} canvasFactory - (optional) The factory that will be used\n * when creating canvases. The default value is\n * {DOMCanvasFactory}.\n * @property {Object} background - (optional) Background to use for the canvas.\n * Can use any valid canvas.fillStyle: A DOMString parsed as\n * CSS value, a CanvasGradient object (a linear or\n * radial gradient) or a CanvasPattern object (a repetitive\n * image). The default value is 'rgb(255,255,255)'.\n */\n\n/**\n * PDF page operator list.\n *\n * @typedef {Object} PDFOperatorList\n * @property {Array} fnArray - Array containing the operator functions.\n * @property {Array} argsArray - Array containing the arguments of the\n * functions.\n */\n\n/**\n * Proxy to a PDFPage in the worker thread.\n * @class\n * @alias PDFPageProxy\n */\nvar PDFPageProxy = (function PDFPageProxyClosure() {\n function PDFPageProxy(pageIndex, pageInfo, transport, pdfBug = false) {\n this.pageIndex = pageIndex;\n this._pageInfo = pageInfo;\n this.transport = transport;\n this._stats = (pdfBug ? new StatTimer() : DummyStatTimer);\n this._pdfBug = pdfBug;\n this.commonObjs = transport.commonObjs;\n this.objs = new PDFObjects();\n this.cleanupAfterRender = false;\n this.pendingCleanup = false;\n this.intentStates = Object.create(null);\n this.destroyed = false;\n }\n PDFPageProxy.prototype = /** @lends PDFPageProxy.prototype */ {\n /**\n * @return {number} Page number of the page. First page is 1.\n */\n get pageNumber() {\n return this.pageIndex + 1;\n },\n /**\n * @return {number} The number of degrees the page is rotated clockwise.\n */\n get rotate() {\n return this._pageInfo.rotate;\n },\n /**\n * @return {Object} The reference that points to this page. It has 'num' and\n * 'gen' properties.\n */\n get ref() {\n return this._pageInfo.ref;\n },\n /**\n * @return {number} The default size of units in 1/72nds of an inch.\n */\n get userUnit() {\n return this._pageInfo.userUnit;\n },\n /**\n * @return {Array} An array of the visible portion of the PDF page in the\n * user space units - [x1, y1, x2, y2].\n */\n get view() {\n return this._pageInfo.view;\n },\n\n /**\n * @param {number} scale The desired scale of the viewport.\n * @param {number} rotate Degrees to rotate the viewport. If omitted this\n * defaults to the page rotation.\n * @param {boolean} dontFlip (optional) If true, axis Y will not be flipped.\n * @return {PageViewport} Contains 'width' and 'height' properties\n * along with transforms required for rendering.\n */\n getViewport(scale, rotate = this.rotate, dontFlip = false) {\n return new PageViewport({\n viewBox: this.view,\n scale,\n rotation: rotate,\n dontFlip,\n });\n },\n /**\n * @param {GetAnnotationsParameters} params - Annotation parameters.\n * @return {Promise} A promise that is resolved with an {Array} of the\n * annotation objects.\n */\n getAnnotations: function PDFPageProxy_getAnnotations(params) {\n var intent = (params && params.intent) || null;\n\n if (!this.annotationsPromise || this.annotationsIntent !== intent) {\n this.annotationsPromise = this.transport.getAnnotations(this.pageIndex,\n intent);\n this.annotationsIntent = intent;\n }\n return this.annotationsPromise;\n },\n /**\n * Begins the process of rendering a page to the desired context.\n * @param {RenderParameters} params Page render parameters.\n * @return {RenderTask} An object that contains the promise, which\n * is resolved when the page finishes rendering.\n */\n render: function PDFPageProxy_render(params) {\n let stats = this._stats;\n stats.time('Overall');\n\n // If there was a pending destroy cancel it so no cleanup happens during\n // this call to render.\n this.pendingCleanup = false;\n\n var renderingIntent = (params.intent === 'print' ? 'print' : 'display');\n var canvasFactory = params.canvasFactory || new DOMCanvasFactory();\n let webGLContext = new WebGLContext({\n enable: params.enableWebGL,\n });\n\n if (!this.intentStates[renderingIntent]) {\n this.intentStates[renderingIntent] = Object.create(null);\n }\n var intentState = this.intentStates[renderingIntent];\n\n // If there's no displayReadyCapability yet, then the operatorList\n // was never requested before. Make the request and create the promise.\n if (!intentState.displayReadyCapability) {\n intentState.receivingOperatorList = true;\n intentState.displayReadyCapability = createPromiseCapability();\n intentState.operatorList = {\n fnArray: [],\n argsArray: [],\n lastChunk: false,\n };\n\n stats.time('Page Request');\n this.transport.messageHandler.send('RenderPageRequest', {\n pageIndex: this.pageNumber - 1,\n intent: renderingIntent,\n renderInteractiveForms: (params.renderInteractiveForms === true),\n });\n }\n\n var complete = (error) => {\n var i = intentState.renderTasks.indexOf(internalRenderTask);\n if (i >= 0) {\n intentState.renderTasks.splice(i, 1);\n }\n\n if (this.cleanupAfterRender) {\n this.pendingCleanup = true;\n }\n this._tryCleanup();\n\n if (error) {\n internalRenderTask.capability.reject(error);\n } else {\n internalRenderTask.capability.resolve();\n }\n stats.timeEnd('Rendering');\n stats.timeEnd('Overall');\n };\n\n var internalRenderTask = new InternalRenderTask(complete, params,\n this.objs,\n this.commonObjs,\n intentState.operatorList,\n this.pageNumber,\n canvasFactory,\n webGLContext,\n this._pdfBug);\n internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print';\n if (!intentState.renderTasks) {\n intentState.renderTasks = [];\n }\n intentState.renderTasks.push(internalRenderTask);\n var renderTask = internalRenderTask.task;\n\n intentState.displayReadyCapability.promise.then((transparency) => {\n if (this.pendingCleanup) {\n complete();\n return;\n }\n stats.time('Rendering');\n internalRenderTask.initializeGraphics(transparency);\n internalRenderTask.operatorListChanged();\n }).catch(complete);\n\n return renderTask;\n },\n\n /**\n * @return {Promise} A promise resolved with an {@link PDFOperatorList}\n * object that represents page's operator list.\n */\n getOperatorList: function PDFPageProxy_getOperatorList() {\n function operatorListChanged() {\n if (intentState.operatorList.lastChunk) {\n intentState.opListReadCapability.resolve(intentState.operatorList);\n\n var i = intentState.renderTasks.indexOf(opListTask);\n if (i >= 0) {\n intentState.renderTasks.splice(i, 1);\n }\n }\n }\n\n var renderingIntent = 'oplist';\n if (!this.intentStates[renderingIntent]) {\n this.intentStates[renderingIntent] = Object.create(null);\n }\n var intentState = this.intentStates[renderingIntent];\n var opListTask;\n\n if (!intentState.opListReadCapability) {\n opListTask = {};\n opListTask.operatorListChanged = operatorListChanged;\n intentState.receivingOperatorList = true;\n intentState.opListReadCapability = createPromiseCapability();\n intentState.renderTasks = [];\n intentState.renderTasks.push(opListTask);\n intentState.operatorList = {\n fnArray: [],\n argsArray: [],\n lastChunk: false,\n };\n\n this._stats.time('Page Request');\n this.transport.messageHandler.send('RenderPageRequest', {\n pageIndex: this.pageIndex,\n intent: renderingIntent,\n });\n }\n return intentState.opListReadCapability.promise;\n },\n\n /**\n * @param {getTextContentParameters} params - getTextContent parameters.\n * @return {ReadableStream} ReadableStream to read textContent chunks.\n */\n streamTextContent(params = {}) {\n const TEXT_CONTENT_CHUNK_SIZE = 100;\n return this.transport.messageHandler.sendWithStream('GetTextContent', {\n pageIndex: this.pageNumber - 1,\n normalizeWhitespace: (params.normalizeWhitespace === true),\n combineTextItems: (params.disableCombineTextItems !== true),\n }, {\n highWaterMark: TEXT_CONTENT_CHUNK_SIZE,\n size(textContent) {\n return textContent.items.length;\n },\n });\n },\n\n /**\n * @param {getTextContentParameters} params - getTextContent parameters.\n * @return {Promise} That is resolved a {@link TextContent}\n * object that represent the page text content.\n */\n getTextContent: function PDFPageProxy_getTextContent(params) {\n params = params || {};\n let readableStream = this.streamTextContent(params);\n\n return new Promise(function(resolve, reject) {\n function pump() {\n reader.read().then(function({ value, done, }) {\n if (done) {\n resolve(textContent);\n return;\n }\n Object.assign(textContent.styles, value.styles);\n textContent.items.push(...value.items);\n pump();\n }, reject);\n }\n\n let reader = readableStream.getReader();\n let textContent = {\n items: [],\n styles: Object.create(null),\n };\n\n pump();\n });\n },\n\n /**\n * Destroys page object.\n */\n _destroy: function PDFPageProxy_destroy() {\n this.destroyed = true;\n this.transport.pageCache[this.pageIndex] = null;\n\n var waitOn = [];\n Object.keys(this.intentStates).forEach(function(intent) {\n if (intent === 'oplist') {\n // Avoid errors below, since the renderTasks are just stubs.\n return;\n }\n var intentState = this.intentStates[intent];\n intentState.renderTasks.forEach(function(renderTask) {\n var renderCompleted = renderTask.capability.promise.\n catch(function () {}); // ignoring failures\n waitOn.push(renderCompleted);\n renderTask.cancel();\n });\n }, this);\n this.objs.clear();\n this.annotationsPromise = null;\n this.pendingCleanup = false;\n return Promise.all(waitOn);\n },\n\n /**\n * Cleans up resources allocated by the page.\n * @param {boolean} resetStats - (optional) Reset page stats, if enabled.\n * The default value is `false`.\n */\n cleanup(resetStats = false) {\n this.pendingCleanup = true;\n this._tryCleanup(resetStats);\n },\n /**\n * For internal use only. Attempts to clean up if rendering is in a state\n * where that's possible.\n * @ignore\n */\n _tryCleanup(resetStats = false) {\n if (!this.pendingCleanup ||\n Object.keys(this.intentStates).some(function(intent) {\n var intentState = this.intentStates[intent];\n return (intentState.renderTasks.length !== 0 ||\n intentState.receivingOperatorList);\n }, this)) {\n return;\n }\n\n Object.keys(this.intentStates).forEach(function(intent) {\n delete this.intentStates[intent];\n }, this);\n this.objs.clear();\n this.annotationsPromise = null;\n if (resetStats && this._stats instanceof StatTimer) {\n this._stats = new StatTimer();\n }\n this.pendingCleanup = false;\n },\n /**\n * For internal use only.\n * @ignore\n */\n _startRenderPage: function PDFPageProxy_startRenderPage(transparency,\n intent) {\n var intentState = this.intentStates[intent];\n // TODO Refactor RenderPageRequest to separate rendering\n // and operator list logic\n if (intentState.displayReadyCapability) {\n intentState.displayReadyCapability.resolve(transparency);\n }\n },\n /**\n * For internal use only.\n * @ignore\n */\n _renderPageChunk: function PDFPageProxy_renderPageChunk(operatorListChunk,\n intent) {\n var intentState = this.intentStates[intent];\n var i, ii;\n // Add the new chunk to the current operator list.\n for (i = 0, ii = operatorListChunk.length; i < ii; i++) {\n intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);\n intentState.operatorList.argsArray.push(\n operatorListChunk.argsArray[i]);\n }\n intentState.operatorList.lastChunk = operatorListChunk.lastChunk;\n\n // Notify all the rendering tasks there are more operators to be consumed.\n for (i = 0; i < intentState.renderTasks.length; i++) {\n intentState.renderTasks[i].operatorListChanged();\n }\n\n if (operatorListChunk.lastChunk) {\n intentState.receivingOperatorList = false;\n this._tryCleanup();\n }\n },\n\n /**\n * @return {Object} Returns page stats, if enabled.\n */\n get stats() {\n return (this._stats instanceof StatTimer ? this._stats : null);\n },\n };\n return PDFPageProxy;\n})();\n\nclass LoopbackPort {\n constructor(defer = true) {\n this._listeners = [];\n this._defer = defer;\n this._deferred = Promise.resolve(undefined);\n }\n\n postMessage(obj, transfers) {\n function cloneValue(value) {\n // Trying to perform a structured clone close to the spec, including\n // transfers.\n if (typeof value !== 'object' || value === null) {\n return value;\n }\n if (cloned.has(value)) { // already cloned the object\n return cloned.get(value);\n }\n var result;\n var buffer;\n if ((buffer = value.buffer) && isArrayBuffer(buffer)) {\n // We found object with ArrayBuffer (typed array).\n var transferable = transfers && transfers.includes(buffer);\n if (value === buffer) {\n // Special case when we are faking typed arrays in compatibility.js.\n result = value;\n } else if (transferable) {\n result = new value.constructor(buffer, value.byteOffset,\n value.byteLength);\n } else {\n result = new value.constructor(value);\n }\n cloned.set(value, result);\n return result;\n }\n result = Array.isArray(value) ? [] : {};\n cloned.set(value, result); // adding to cache now for cyclic references\n // Cloning all value and object properties, however ignoring properties\n // defined via getter.\n for (var i in value) {\n var desc, p = value;\n while (!(desc = Object.getOwnPropertyDescriptor(p, i))) {\n p = Object.getPrototypeOf(p);\n }\n if (typeof desc.value === 'undefined' ||\n typeof desc.value === 'function') {\n continue;\n }\n result[i] = cloneValue(desc.value);\n }\n return result;\n }\n\n if (!this._defer) {\n this._listeners.forEach(function (listener) {\n listener.call(this, { data: obj, });\n }, this);\n return;\n }\n\n var cloned = new WeakMap();\n var e = { data: cloneValue(obj), };\n this._deferred.then(() => {\n this._listeners.forEach(function (listener) {\n listener.call(this, e);\n }, this);\n });\n }\n\n addEventListener(name, listener) {\n this._listeners.push(listener);\n }\n\n removeEventListener(name, listener) {\n var i = this._listeners.indexOf(listener);\n this._listeners.splice(i, 1);\n }\n\n terminate() {\n this._listeners = [];\n }\n}\n\n/**\n * @typedef {Object} PDFWorkerParameters\n * @property {string} name - (optional) The name of the worker.\n * @property {Object} port - (optional) The `workerPort`.\n * @property {boolean} postMessageTransfers - (optional) Enables transfer usage\n * in postMessage for ArrayBuffers. The default value is `true`.\n * @property {number} verbosity - (optional) Controls the logging level; the\n * constants from {VerbosityLevel} should be used.\n */\n\n/**\n * PDF.js web worker abstraction, it controls instantiation of PDF documents and\n * WorkerTransport for them. If creation of a web worker is not possible,\n * a \"fake\" worker will be used instead.\n * @class\n */\nvar PDFWorker = (function PDFWorkerClosure() {\n let nextFakeWorkerId = 0;\n\n function getWorkerSrc() {\n if (GlobalWorkerOptions.workerSrc) {\n return GlobalWorkerOptions.workerSrc;\n }\n if (typeof fallbackWorkerSrc !== 'undefined') {\n return fallbackWorkerSrc;\n }\n throw new Error('No \"GlobalWorkerOptions.workerSrc\" specified.');\n }\n\n function getMainThreadWorkerMessageHandler() {\n try {\n if (typeof window !== 'undefined') {\n return (window.pdfjsWorker && window.pdfjsWorker.WorkerMessageHandler);\n }\n } catch (ex) { }\n return null;\n }\n\n let fakeWorkerFilesLoadedCapability;\n\n // Loads worker code into main thread.\n function setupFakeWorkerGlobal() {\n if (fakeWorkerFilesLoadedCapability) {\n return fakeWorkerFilesLoadedCapability.promise;\n }\n fakeWorkerFilesLoadedCapability = createPromiseCapability();\n\n let mainWorkerMessageHandler = getMainThreadWorkerMessageHandler();\n if (mainWorkerMessageHandler) {\n // The worker was already loaded using a ` - + @@ -202,7 +202,7 @@ Next - +
diff --git a/docs/_static/pdfview/viewer.js b/docs/_static/pdfview/viewer.js index 4c65e336..5e17fe50 100644 --- a/docs/_static/pdfview/viewer.js +++ b/docs/_static/pdfview/viewer.js @@ -2,7 +2,7 @@ * @licstart The following is the entire license notice for the * Javascript code in this page * - * Copyright 2018 Mozilla Foundation + * Copyright 2020 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -114,152 +114,166 @@ ; -var pdfjsWebApp = void 0, - pdfjsWebAppOptions = void 0; +var pdfjsWebApp, pdfjsWebAppOptions; { pdfjsWebApp = __webpack_require__(1); - pdfjsWebAppOptions = __webpack_require__(12); + pdfjsWebAppOptions = __webpack_require__(6); } ; { - __webpack_require__(38); + __webpack_require__(36); } ; { - __webpack_require__(43); + __webpack_require__(41); } + function getViewerConfiguration() { return { appContainer: document.body, - mainContainer: document.getElementById('viewerContainer'), - viewerContainer: document.getElementById('viewer'), + mainContainer: document.getElementById("viewerContainer"), + viewerContainer: document.getElementById("viewer"), eventBus: null, toolbar: { - container: document.getElementById('toolbarViewer'), - numPages: document.getElementById('numPages'), - pageNumber: document.getElementById('pageNumber'), - scaleSelectContainer: document.getElementById('scaleSelectContainer'), - scaleSelect: document.getElementById('scaleSelect'), - customScaleOption: document.getElementById('customScaleOption'), - previous: document.getElementById('previous'), - next: document.getElementById('next'), - zoomIn: document.getElementById('zoomIn'), - zoomOut: document.getElementById('zoomOut'), - viewFind: document.getElementById('viewFind'), - openFile: document.getElementById('openFile'), - print: document.getElementById('print'), - presentationModeButton: document.getElementById('presentationMode'), - download: document.getElementById('download'), - viewBookmark: document.getElementById('viewBookmark') + container: document.getElementById("toolbarViewer"), + numPages: document.getElementById("numPages"), + pageNumber: document.getElementById("pageNumber"), + scaleSelectContainer: document.getElementById("scaleSelectContainer"), + scaleSelect: document.getElementById("scaleSelect"), + customScaleOption: document.getElementById("customScaleOption"), + previous: document.getElementById("previous"), + next: document.getElementById("next"), + zoomIn: document.getElementById("zoomIn"), + zoomOut: document.getElementById("zoomOut"), + viewFind: document.getElementById("viewFind"), + openFile: document.getElementById("openFile"), + print: document.getElementById("print"), + presentationModeButton: document.getElementById("presentationMode"), + download: document.getElementById("download"), + viewBookmark: document.getElementById("viewBookmark") }, secondaryToolbar: { - toolbar: document.getElementById('secondaryToolbar'), - toggleButton: document.getElementById('secondaryToolbarToggle'), - toolbarButtonContainer: document.getElementById('secondaryToolbarButtonContainer'), - presentationModeButton: document.getElementById('secondaryPresentationMode'), - openFileButton: document.getElementById('secondaryOpenFile'), - printButton: document.getElementById('secondaryPrint'), - downloadButton: document.getElementById('secondaryDownload'), - viewBookmarkButton: document.getElementById('secondaryViewBookmark'), - firstPageButton: document.getElementById('firstPage'), - lastPageButton: document.getElementById('lastPage'), - pageRotateCwButton: document.getElementById('pageRotateCw'), - pageRotateCcwButton: document.getElementById('pageRotateCcw'), - cursorSelectToolButton: document.getElementById('cursorSelectTool'), - cursorHandToolButton: document.getElementById('cursorHandTool'), - scrollVerticalButton: document.getElementById('scrollVertical'), - scrollHorizontalButton: document.getElementById('scrollHorizontal'), - scrollWrappedButton: document.getElementById('scrollWrapped'), - spreadNoneButton: document.getElementById('spreadNone'), - spreadOddButton: document.getElementById('spreadOdd'), - spreadEvenButton: document.getElementById('spreadEven'), - documentPropertiesButton: document.getElementById('documentProperties') + toolbar: document.getElementById("secondaryToolbar"), + toggleButton: document.getElementById("secondaryToolbarToggle"), + toolbarButtonContainer: document.getElementById("secondaryToolbarButtonContainer"), + presentationModeButton: document.getElementById("secondaryPresentationMode"), + openFileButton: document.getElementById("secondaryOpenFile"), + printButton: document.getElementById("secondaryPrint"), + downloadButton: document.getElementById("secondaryDownload"), + viewBookmarkButton: document.getElementById("secondaryViewBookmark"), + firstPageButton: document.getElementById("firstPage"), + lastPageButton: document.getElementById("lastPage"), + pageRotateCwButton: document.getElementById("pageRotateCw"), + pageRotateCcwButton: document.getElementById("pageRotateCcw"), + cursorSelectToolButton: document.getElementById("cursorSelectTool"), + cursorHandToolButton: document.getElementById("cursorHandTool"), + scrollVerticalButton: document.getElementById("scrollVertical"), + scrollHorizontalButton: document.getElementById("scrollHorizontal"), + scrollWrappedButton: document.getElementById("scrollWrapped"), + spreadNoneButton: document.getElementById("spreadNone"), + spreadOddButton: document.getElementById("spreadOdd"), + spreadEvenButton: document.getElementById("spreadEven"), + documentPropertiesButton: document.getElementById("documentProperties") }, fullscreen: { - contextFirstPage: document.getElementById('contextFirstPage'), - contextLastPage: document.getElementById('contextLastPage'), - contextPageRotateCw: document.getElementById('contextPageRotateCw'), - contextPageRotateCcw: document.getElementById('contextPageRotateCcw') + contextFirstPage: document.getElementById("contextFirstPage"), + contextLastPage: document.getElementById("contextLastPage"), + contextPageRotateCw: document.getElementById("contextPageRotateCw"), + contextPageRotateCcw: document.getElementById("contextPageRotateCcw") }, sidebar: { - outerContainer: document.getElementById('outerContainer'), - viewerContainer: document.getElementById('viewerContainer'), - toggleButton: document.getElementById('sidebarToggle'), - thumbnailButton: document.getElementById('viewThumbnail'), - outlineButton: document.getElementById('viewOutline'), - attachmentsButton: document.getElementById('viewAttachments'), - thumbnailView: document.getElementById('thumbnailView'), - outlineView: document.getElementById('outlineView'), - attachmentsView: document.getElementById('attachmentsView') + outerContainer: document.getElementById("outerContainer"), + viewerContainer: document.getElementById("viewerContainer"), + toggleButton: document.getElementById("sidebarToggle"), + thumbnailButton: document.getElementById("viewThumbnail"), + outlineButton: document.getElementById("viewOutline"), + attachmentsButton: document.getElementById("viewAttachments"), + thumbnailView: document.getElementById("thumbnailView"), + outlineView: document.getElementById("outlineView"), + attachmentsView: document.getElementById("attachmentsView") }, sidebarResizer: { - outerContainer: document.getElementById('outerContainer'), - resizer: document.getElementById('sidebarResizer') + outerContainer: document.getElementById("outerContainer"), + resizer: document.getElementById("sidebarResizer") }, findBar: { - bar: document.getElementById('findbar'), - toggleButton: document.getElementById('viewFind'), - findField: document.getElementById('findInput'), - highlightAllCheckbox: document.getElementById('findHighlightAll'), - caseSensitiveCheckbox: document.getElementById('findMatchCase'), - entireWordCheckbox: document.getElementById('findEntireWord'), - findMsg: document.getElementById('findMsg'), - findResultsCount: document.getElementById('findResultsCount'), - findPreviousButton: document.getElementById('findPrevious'), - findNextButton: document.getElementById('findNext') + bar: document.getElementById("findbar"), + toggleButton: document.getElementById("viewFind"), + findField: document.getElementById("findInput"), + highlightAllCheckbox: document.getElementById("findHighlightAll"), + caseSensitiveCheckbox: document.getElementById("findMatchCase"), + entireWordCheckbox: document.getElementById("findEntireWord"), + findMsg: document.getElementById("findMsg"), + findResultsCount: document.getElementById("findResultsCount"), + findPreviousButton: document.getElementById("findPrevious"), + findNextButton: document.getElementById("findNext") }, passwordOverlay: { - overlayName: 'passwordOverlay', - container: document.getElementById('passwordOverlay'), - label: document.getElementById('passwordText'), - input: document.getElementById('password'), - submitButton: document.getElementById('passwordSubmit'), - cancelButton: document.getElementById('passwordCancel') + overlayName: "passwordOverlay", + container: document.getElementById("passwordOverlay"), + label: document.getElementById("passwordText"), + input: document.getElementById("password"), + submitButton: document.getElementById("passwordSubmit"), + cancelButton: document.getElementById("passwordCancel") }, documentProperties: { - overlayName: 'documentPropertiesOverlay', - container: document.getElementById('documentPropertiesOverlay'), - closeButton: document.getElementById('documentPropertiesClose'), + overlayName: "documentPropertiesOverlay", + container: document.getElementById("documentPropertiesOverlay"), + closeButton: document.getElementById("documentPropertiesClose"), fields: { - 'fileName': document.getElementById('fileNameField'), - 'fileSize': document.getElementById('fileSizeField'), - 'title': document.getElementById('titleField'), - 'author': document.getElementById('authorField'), - 'subject': document.getElementById('subjectField'), - 'keywords': document.getElementById('keywordsField'), - 'creationDate': document.getElementById('creationDateField'), - 'modificationDate': document.getElementById('modificationDateField'), - 'creator': document.getElementById('creatorField'), - 'producer': document.getElementById('producerField'), - 'version': document.getElementById('versionField'), - 'pageCount': document.getElementById('pageCountField'), - 'pageSize': document.getElementById('pageSizeField'), - 'linearized': document.getElementById('linearizedField') + fileName: document.getElementById("fileNameField"), + fileSize: document.getElementById("fileSizeField"), + title: document.getElementById("titleField"), + author: document.getElementById("authorField"), + subject: document.getElementById("subjectField"), + keywords: document.getElementById("keywordsField"), + creationDate: document.getElementById("creationDateField"), + modificationDate: document.getElementById("modificationDateField"), + creator: document.getElementById("creatorField"), + producer: document.getElementById("producerField"), + version: document.getElementById("versionField"), + pageCount: document.getElementById("pageCountField"), + pageSize: document.getElementById("pageSizeField"), + linearized: document.getElementById("linearizedField") } }, errorWrapper: { - container: document.getElementById('errorWrapper'), - errorMessage: document.getElementById('errorMessage'), - closeButton: document.getElementById('errorClose'), - errorMoreInfo: document.getElementById('errorMoreInfo'), - moreInfoButton: document.getElementById('errorShowMore'), - lessInfoButton: document.getElementById('errorShowLess') + container: document.getElementById("errorWrapper"), + errorMessage: document.getElementById("errorMessage"), + closeButton: document.getElementById("errorClose"), + errorMoreInfo: document.getElementById("errorMoreInfo"), + moreInfoButton: document.getElementById("errorShowMore"), + lessInfoButton: document.getElementById("errorShowLess") }, - printContainer: document.getElementById('printContainer'), - openFileInputName: 'fileInput', - debuggerScriptPath: './debugger.js' + printContainer: document.getElementById("printContainer"), + openFileInputName: "fileInput", + debuggerScriptPath: "./debugger.js" }; } + function webViewerLoad() { var config = getViewerConfiguration(); window.PDFViewerApplication = pdfjsWebApp.PDFViewerApplication; window.PDFViewerApplicationOptions = pdfjsWebAppOptions.AppOptions; + var event = document.createEvent("CustomEvent"); + event.initCustomEvent("webviewerloaded", true, true, { + source: window + }); + + try { + parent.document.dispatchEvent(event); + } catch (ex) { + console.error("webviewerloaded: ".concat(ex)); + document.dispatchEvent(event); + } + pdfjsWebApp.PDFViewerApplication.run(config); } -if (document.readyState === 'interactive' || document.readyState === 'complete') { + +if (document.readyState === "interactive" || document.readyState === "complete") { webViewerLoad(); } else { - document.addEventListener('DOMContentLoaded', webViewerLoad, true); + document.addEventListener("DOMContentLoaded", webViewerLoad, true); } /***/ }), @@ -272,94 +286,160 @@ if (document.readyState === 'interactive' || document.readyState === 'complete') Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFPrintServiceFactory = exports.DefaultExternalServices = exports.PDFViewerApplication = undefined; +exports.PDFPrintServiceFactory = exports.DefaultExternalServices = exports.PDFViewerApplication = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +var _ui_utils = __webpack_require__(5); + +var _app_options = __webpack_require__(6); + +var _pdfjsLib = __webpack_require__(8); + +var _pdf_cursor_tools = __webpack_require__(9); + +var _pdf_rendering_queue = __webpack_require__(11); + +var _pdf_sidebar = __webpack_require__(12); + +var _overlay_manager = __webpack_require__(13); -var _regenerator = __webpack_require__(2); +var _password_prompt = __webpack_require__(14); -var _regenerator2 = _interopRequireDefault(_regenerator); +var _pdf_attachment_viewer = __webpack_require__(15); -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); +var _pdf_document_properties = __webpack_require__(16); -var _ui_utils = __webpack_require__(6); +var _pdf_find_bar = __webpack_require__(17); -var _pdfjsLib = __webpack_require__(7); +var _pdf_find_controller = __webpack_require__(18); -var _pdf_cursor_tools = __webpack_require__(8); +var _pdf_history = __webpack_require__(20); -var _pdf_rendering_queue = __webpack_require__(10); +var _pdf_link_service = __webpack_require__(21); -var _pdf_sidebar = __webpack_require__(11); +var _pdf_outline_viewer = __webpack_require__(22); -var _app_options = __webpack_require__(12); +var _pdf_presentation_mode = __webpack_require__(23); -var _dom_events = __webpack_require__(14); +var _pdf_sidebar_resizer = __webpack_require__(24); -var _overlay_manager = __webpack_require__(15); +var _pdf_thumbnail_viewer = __webpack_require__(25); -var _password_prompt = __webpack_require__(16); +var _pdf_viewer = __webpack_require__(27); -var _pdf_attachment_viewer = __webpack_require__(17); +var _secondary_toolbar = __webpack_require__(32); -var _pdf_document_properties = __webpack_require__(18); +var _toolbar = __webpack_require__(34); -var _pdf_find_bar = __webpack_require__(19); +var _view_history = __webpack_require__(35); -var _pdf_find_controller = __webpack_require__(20); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _pdf_history = __webpack_require__(22); +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } -var _pdf_link_service = __webpack_require__(23); +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -var _pdf_outline_viewer = __webpack_require__(24); +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -var _pdf_presentation_mode = __webpack_require__(25); +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -var _pdf_sidebar_resizer = __webpack_require__(26); +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } -var _pdf_thumbnail_viewer = __webpack_require__(27); +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } -var _pdf_viewer = __webpack_require__(29); +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -var _secondary_toolbar = __webpack_require__(34); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -var _toolbar = __webpack_require__(36); +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -var _view_history = __webpack_require__(37); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var DEFAULT_SCALE_DELTA = 1.1; var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; var FORCE_PAGES_LOADED_TIMEOUT = 10000; -var DefaultExternalServices = { - updateFindControlState: function updateFindControlState(data) {}, - updateFindMatchesCount: function updateFindMatchesCount(data) {}, - initPassiveLoading: function initPassiveLoading(callbacks) {}, - fallback: function fallback(data, callback) {}, - reportTelemetry: function reportTelemetry(data) {}, - createDownloadManager: function createDownloadManager(options) { - throw new Error('Not implemented: createDownloadManager'); - }, - createPreferences: function createPreferences() { - throw new Error('Not implemented: createPreferences'); - }, - createL10n: function createL10n(options) { - throw new Error('Not implemented: createL10n'); - }, +var WHEEL_ZOOM_DISABLED_TIMEOUT = 1000; +var ENABLE_PERMISSIONS_CLASS = "enablePermissions"; +var ViewOnLoad = { + UNKNOWN: -1, + PREVIOUS: 0, + INITIAL: 1 +}; + +var DefaultExternalServices = /*#__PURE__*/function () { + function DefaultExternalServices() { + _classCallCheck(this, DefaultExternalServices); - supportsIntegratedFind: false, - supportsDocumentFonts: true, - supportsDocumentColors: true, - supportedMouseWheelZoomModifierKeys: { - ctrlKey: true, - metaKey: true + throw new Error("Cannot initialize DefaultExternalServices."); } -}; + + _createClass(DefaultExternalServices, null, [{ + key: "updateFindControlState", + value: function updateFindControlState(data) {} + }, { + key: "updateFindMatchesCount", + value: function updateFindMatchesCount(data) {} + }, { + key: "initPassiveLoading", + value: function initPassiveLoading(callbacks) {} + }, { + key: "fallback", + value: function fallback(data, callback) {} + }, { + key: "reportTelemetry", + value: function reportTelemetry(data) {} + }, { + key: "createDownloadManager", + value: function createDownloadManager(options) { + throw new Error("Not implemented: createDownloadManager"); + } + }, { + key: "createPreferences", + value: function createPreferences() { + throw new Error("Not implemented: createPreferences"); + } + }, { + key: "createL10n", + value: function createL10n(options) { + throw new Error("Not implemented: createL10n"); + } + }, { + key: "supportsIntegratedFind", + get: function get() { + return (0, _pdfjsLib.shadow)(this, "supportsIntegratedFind", false); + } + }, { + key: "supportsDocumentFonts", + get: function get() { + return (0, _pdfjsLib.shadow)(this, "supportsDocumentFonts", true); + } + }, { + key: "supportedMouseWheelZoomModifierKeys", + get: function get() { + return (0, _pdfjsLib.shadow)(this, "supportedMouseWheelZoomModifierKeys", { + ctrlKey: true, + metaKey: true + }); + } + }, { + key: "isInAutomation", + get: function get() { + return (0, _pdfjsLib.shadow)(this, "isInAutomation", false); + } + }]); + + return DefaultExternalServices; +}(); + +exports.DefaultExternalServices = DefaultExternalServices; var PDFViewerApplication = { initialBookmark: document.location.hash.substring(1), - initialized: false, + _initializedCapability: (0, _pdfjsLib.createPromiseCapability)(), fellback: false, appConfig: null, pdfDocument: null, @@ -388,289 +468,278 @@ var PDFViewerApplication = { isInitialViewSet: false, downloadComplete: false, isViewerEmbedded: window.parent !== window, - url: '', - baseUrl: '', + url: "", + baseUrl: "", externalServices: DefaultExternalServices, _boundEvents: {}, contentDispositionFilename: null, - initialize: function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(appConfig) { - var _this = this; + initialize: function initialize(appConfig) { + var _this = this; + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() { var appContainer; - return _regenerator2.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: - this.preferences = this.externalServices.createPreferences(); - this.appConfig = appConfig; + _this.preferences = _this.externalServices.createPreferences(); + _this.appConfig = appConfig; _context.next = 4; - return this._readPreferences(); + return _this._readPreferences(); case 4: _context.next = 6; - return this._parseHashParameters(); + return _this._parseHashParameters(); case 6: _context.next = 8; - return this._initializeL10n(); + return _this._initializeL10n(); case 8: - if (this.isViewerEmbedded && _app_options.AppOptions.get('externalLinkTarget') === _pdfjsLib.LinkTarget.NONE) { - _app_options.AppOptions.set('externalLinkTarget', _pdfjsLib.LinkTarget.TOP); + if (_this.isViewerEmbedded && _app_options.AppOptions.get("externalLinkTarget") === _pdfjsLib.LinkTarget.NONE) { + _app_options.AppOptions.set("externalLinkTarget", _pdfjsLib.LinkTarget.TOP); } + _context.next = 11; - return this._initializeViewerComponents(); + return _this._initializeViewerComponents(); case 11: - this.bindEvents(); - this.bindWindowEvents(); + _this.bindEvents(); + + _this.bindWindowEvents(); + appContainer = appConfig.appContainer || document.documentElement; - this.l10n.translate(appContainer).then(function () { - _this.eventBus.dispatch('localized', { source: _this }); + _this.l10n.translate(appContainer).then(function () { + _this.eventBus.dispatch("localized", { + source: _this + }); }); - this.initialized = true; + + _this._initializedCapability.resolve(); case 16: - case 'end': + case "end": return _context.stop(); } } - }, _callee, this); - })); - - function initialize(_x) { - return _ref.apply(this, arguments); - } + }, _callee); + }))(); + }, + _readPreferences: function _readPreferences() { + var _this2 = this; - return initialize; - }(), - _readPreferences: function () { - var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() { - var OVERRIDES, prefs, name; - return _regenerator2.default.wrap(function _callee2$(_context2) { + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() { + var prefs, name; + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: - OVERRIDES = { - disableFontFace: true, - disableRange: true, - disableStream: true, - textLayerMode: _ui_utils.TextLayerMode.DISABLE - }; - _context2.prev = 1; - _context2.next = 4; - return this.preferences.getAll(); - - case 4: - prefs = _context2.sent; - _context2.t0 = _regenerator2.default.keys(prefs); - - case 6: - if ((_context2.t1 = _context2.t0()).done) { - _context2.next = 13; + if (!_app_options.AppOptions.get("disablePreferences")) { + _context2.next = 2; break; } - name = _context2.t1.value; + return _context2.abrupt("return"); - if (!(name in OVERRIDES && _app_options.AppOptions.get(name) === OVERRIDES[name])) { - _context2.next = 10; - break; - } + case 2: + _context2.prev = 2; + _context2.next = 5; + return _this2.preferences.getAll(); - return _context2.abrupt('continue', 6); + case 5: + prefs = _context2.sent; - case 10: - _app_options.AppOptions.set(name, prefs[name]); - _context2.next = 6; - break; + for (name in prefs) { + _app_options.AppOptions.set(name, prefs[name]); + } - case 13: - _context2.next = 17; + _context2.next = 12; break; - case 15: - _context2.prev = 15; - _context2.t2 = _context2['catch'](1); + case 9: + _context2.prev = 9; + _context2.t0 = _context2["catch"](2); + console.error("_readPreferences: \"".concat(_context2.t0.message, "\".")); - case 17: - case 'end': + case 12: + case "end": return _context2.stop(); } } - }, _callee2, this, [[1, 15]]); - })); - - function _readPreferences() { - return _ref2.apply(this, arguments); - } + }, _callee2, null, [[2, 9]]); + }))(); + }, + _parseHashParameters: function _parseHashParameters() { + var _this3 = this; - return _readPreferences; - }(), - _parseHashParameters: function () { - var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee3() { - var waitOn, hash, hashParams, viewer, enabled; - return _regenerator2.default.wrap(function _callee3$(_context3) { + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() { + var hash, hashParams, waitOn, viewer, enabled; + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: - if (_app_options.AppOptions.get('pdfBugEnabled')) { + if (_app_options.AppOptions.get("pdfBugEnabled")) { _context3.next = 2; break; } - return _context3.abrupt('return'); + return _context3.abrupt("return", undefined); case 2: - waitOn = []; hash = document.location.hash.substring(1); - hashParams = (0, _ui_utils.parseQueryString)(hash); - if ('disableworker' in hashParams && hashParams['disableworker'] === 'true') { - waitOn.push(loadFakeWorker()); + if (hash) { + _context3.next = 5; + break; } - if ('disablerange' in hashParams) { - _app_options.AppOptions.set('disableRange', hashParams['disablerange'] === 'true'); + + return _context3.abrupt("return", undefined); + + case 5: + hashParams = (0, _ui_utils.parseQueryString)(hash), waitOn = []; + + if ("disableworker" in hashParams && hashParams.disableworker === "true") { + waitOn.push(loadFakeWorker()); } - if ('disablestream' in hashParams) { - _app_options.AppOptions.set('disableStream', hashParams['disablestream'] === 'true'); + + if ("disablerange" in hashParams) { + _app_options.AppOptions.set("disableRange", hashParams.disablerange === "true"); } - if ('disableautofetch' in hashParams) { - _app_options.AppOptions.set('disableAutoFetch', hashParams['disableautofetch'] === 'true'); + + if ("disablestream" in hashParams) { + _app_options.AppOptions.set("disableStream", hashParams.disablestream === "true"); } - if ('disablefontface' in hashParams) { - _app_options.AppOptions.set('disableFontFace', hashParams['disablefontface'] === 'true'); + + if ("disableautofetch" in hashParams) { + _app_options.AppOptions.set("disableAutoFetch", hashParams.disableautofetch === "true"); } - if ('disablehistory' in hashParams) { - _app_options.AppOptions.set('disableHistory', hashParams['disablehistory'] === 'true'); + + if ("disablefontface" in hashParams) { + _app_options.AppOptions.set("disableFontFace", hashParams.disablefontface === "true"); } - if ('webgl' in hashParams) { - _app_options.AppOptions.set('enableWebGL', hashParams['webgl'] === 'true'); + + if ("disablehistory" in hashParams) { + _app_options.AppOptions.set("disableHistory", hashParams.disablehistory === "true"); } - if ('useonlycsszoom' in hashParams) { - _app_options.AppOptions.set('useOnlyCssZoom', hashParams['useonlycsszoom'] === 'true'); + + if ("webgl" in hashParams) { + _app_options.AppOptions.set("enableWebGL", hashParams.webgl === "true"); } - if ('verbosity' in hashParams) { - _app_options.AppOptions.set('verbosity', hashParams['verbosity'] | 0); + + if ("verbosity" in hashParams) { + _app_options.AppOptions.set("verbosity", hashParams.verbosity | 0); } - if (!('textlayer' in hashParams)) { + if (!("textlayer" in hashParams)) { _context3.next = 23; break; } - _context3.t0 = hashParams['textlayer']; - _context3.next = _context3.t0 === 'off' ? 18 : _context3.t0 === 'visible' ? 20 : _context3.t0 === 'shadow' ? 20 : _context3.t0 === 'hover' ? 20 : 23; + _context3.t0 = hashParams.textlayer; + _context3.next = _context3.t0 === "off" ? 18 : _context3.t0 === "visible" ? 20 : _context3.t0 === "shadow" ? 20 : _context3.t0 === "hover" ? 20 : 23; break; case 18: - _app_options.AppOptions.set('textLayerMode', _ui_utils.TextLayerMode.DISABLE); - return _context3.abrupt('break', 23); + _app_options.AppOptions.set("textLayerMode", _ui_utils.TextLayerMode.DISABLE); - case 20: - viewer = this.appConfig.viewerContainer; + return _context3.abrupt("break", 23); - viewer.classList.add('textLayer-' + hashParams['textlayer']); - return _context3.abrupt('break', 23); + case 20: + viewer = _this3.appConfig.viewerContainer; + viewer.classList.add("textLayer-" + hashParams.textlayer); + return _context3.abrupt("break", 23); case 23: - if ('pdfbug' in hashParams) { - _app_options.AppOptions.set('pdfBug', true); - enabled = hashParams['pdfbug'].split(','); + if ("pdfbug" in hashParams) { + _app_options.AppOptions.set("pdfBug", true); + _app_options.AppOptions.set("fontExtraProperties", true); + + enabled = hashParams.pdfbug.split(","); waitOn.push(loadAndEnablePDFBug(enabled)); } - if ('locale' in hashParams) { - _app_options.AppOptions.set('locale', hashParams['locale']); + + if ("locale" in hashParams) { + _app_options.AppOptions.set("locale", hashParams.locale); } - return _context3.abrupt('return', Promise.all(waitOn).catch(function (reason) { - console.error('_parseHashParameters: "' + reason.message + '".'); + + return _context3.abrupt("return", Promise.all(waitOn)["catch"](function (reason) { + console.error("_parseHashParameters: \"".concat(reason.message, "\".")); })); case 26: - case 'end': + case "end": return _context3.stop(); } } - }, _callee3, this); - })); - - function _parseHashParameters() { - return _ref3.apply(this, arguments); - } + }, _callee3); + }))(); + }, + _initializeL10n: function _initializeL10n() { + var _this4 = this; - return _parseHashParameters; - }(), - _initializeL10n: function () { - var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee4() { + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() { var dir; - return _regenerator2.default.wrap(function _callee4$(_context4) { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: - this.l10n = this.externalServices.createL10n({ locale: _app_options.AppOptions.get('locale') }); + _this4.l10n = _this4.externalServices.createL10n({ + locale: _app_options.AppOptions.get("locale") + }); _context4.next = 3; - return this.l10n.getDirection(); + return _this4.l10n.getDirection(); case 3: dir = _context4.sent; - - document.getElementsByTagName('html')[0].dir = dir; + document.getElementsByTagName("html")[0].dir = dir; case 5: - case 'end': + case "end": return _context4.stop(); } } - }, _callee4, this); - })); - - function _initializeL10n() { - return _ref4.apply(this, arguments); - } + }, _callee4); + }))(); + }, + _initializeViewerComponents: function _initializeViewerComponents() { + var _this5 = this; - return _initializeL10n; - }(), - _initializeViewerComponents: function () { - var _ref5 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee5() { - var appConfig, dispatchToDOM, eventBus, pdfRenderingQueue, pdfLinkService, downloadManager, findController, container, viewer, thumbnailContainer, sidebarConfig; - return _regenerator2.default.wrap(function _callee5$(_context5) { + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee5() { + var appConfig, eventBus, pdfRenderingQueue, pdfLinkService, downloadManager, findController, container, viewer; + return _regenerator["default"].wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: - appConfig = this.appConfig; - - this.overlayManager = new _overlay_manager.OverlayManager(); - dispatchToDOM = _app_options.AppOptions.get('eventBusDispatchToDOM'); - eventBus = appConfig.eventBus || (0, _dom_events.getGlobalEventBus)(dispatchToDOM); - - this.eventBus = eventBus; + appConfig = _this5.appConfig; + eventBus = appConfig.eventBus || new _ui_utils.EventBus({ + isInAutomation: _this5.externalServices.isInAutomation + }); + _this5.eventBus = eventBus; + _this5.overlayManager = new _overlay_manager.OverlayManager(); pdfRenderingQueue = new _pdf_rendering_queue.PDFRenderingQueue(); - - pdfRenderingQueue.onIdle = this.cleanup.bind(this); - this.pdfRenderingQueue = pdfRenderingQueue; + pdfRenderingQueue.onIdle = _this5.cleanup.bind(_this5); + _this5.pdfRenderingQueue = pdfRenderingQueue; pdfLinkService = new _pdf_link_service.PDFLinkService({ eventBus: eventBus, - externalLinkTarget: _app_options.AppOptions.get('externalLinkTarget'), - externalLinkRel: _app_options.AppOptions.get('externalLinkRel') + externalLinkTarget: _app_options.AppOptions.get("externalLinkTarget"), + externalLinkRel: _app_options.AppOptions.get("externalLinkRel"), + ignoreDestinationZoom: _app_options.AppOptions.get("ignoreDestinationZoom") }); - - this.pdfLinkService = pdfLinkService; - downloadManager = this.externalServices.createDownloadManager({ disableCreateObjectURL: _app_options.AppOptions.get('disableCreateObjectURL') }); - - this.downloadManager = downloadManager; + _this5.pdfLinkService = pdfLinkService; + downloadManager = _this5.externalServices.createDownloadManager({ + disableCreateObjectURL: _app_options.AppOptions.get("disableCreateObjectURL") + }); + _this5.downloadManager = downloadManager; findController = new _pdf_find_controller.PDFFindController({ linkService: pdfLinkService, eventBus: eventBus }); - - this.findController = findController; + _this5.findController = findController; container = appConfig.mainContainer; viewer = appConfig.viewerContainer; - - this.pdfViewer = new _pdf_viewer.PDFViewer({ + _this5.pdfViewer = new _pdf_viewer.PDFViewer({ container: container, viewer: viewer, eventBus: eventBus, @@ -678,154 +747,190 @@ var PDFViewerApplication = { linkService: pdfLinkService, downloadManager: downloadManager, findController: findController, - renderer: _app_options.AppOptions.get('renderer'), - enableWebGL: _app_options.AppOptions.get('enableWebGL'), - l10n: this.l10n, - textLayerMode: _app_options.AppOptions.get('textLayerMode'), - imageResourcesPath: _app_options.AppOptions.get('imageResourcesPath'), - renderInteractiveForms: _app_options.AppOptions.get('renderInteractiveForms'), - enablePrintAutoRotate: _app_options.AppOptions.get('enablePrintAutoRotate'), - useOnlyCssZoom: _app_options.AppOptions.get('useOnlyCssZoom'), - maxCanvasPixels: _app_options.AppOptions.get('maxCanvasPixels') + renderer: _app_options.AppOptions.get("renderer"), + enableWebGL: _app_options.AppOptions.get("enableWebGL"), + l10n: _this5.l10n, + textLayerMode: _app_options.AppOptions.get("textLayerMode"), + imageResourcesPath: _app_options.AppOptions.get("imageResourcesPath"), + renderInteractiveForms: _app_options.AppOptions.get("renderInteractiveForms"), + enablePrintAutoRotate: _app_options.AppOptions.get("enablePrintAutoRotate"), + useOnlyCssZoom: _app_options.AppOptions.get("useOnlyCssZoom"), + maxCanvasPixels: _app_options.AppOptions.get("maxCanvasPixels") }); - pdfRenderingQueue.setViewer(this.pdfViewer); - pdfLinkService.setViewer(this.pdfViewer); - thumbnailContainer = appConfig.sidebar.thumbnailView; - - this.pdfThumbnailViewer = new _pdf_thumbnail_viewer.PDFThumbnailViewer({ - container: thumbnailContainer, + pdfRenderingQueue.setViewer(_this5.pdfViewer); + pdfLinkService.setViewer(_this5.pdfViewer); + _this5.pdfThumbnailViewer = new _pdf_thumbnail_viewer.PDFThumbnailViewer({ + container: appConfig.sidebar.thumbnailView, renderingQueue: pdfRenderingQueue, linkService: pdfLinkService, - l10n: this.l10n + l10n: _this5.l10n }); - pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer); - this.pdfHistory = new _pdf_history.PDFHistory({ + pdfRenderingQueue.setThumbnailViewer(_this5.pdfThumbnailViewer); + _this5.pdfHistory = new _pdf_history.PDFHistory({ linkService: pdfLinkService, eventBus: eventBus }); - pdfLinkService.setHistory(this.pdfHistory); - this.findBar = new _pdf_find_bar.PDFFindBar(appConfig.findBar, eventBus, this.l10n); - this.pdfDocumentProperties = new _pdf_document_properties.PDFDocumentProperties(appConfig.documentProperties, this.overlayManager, eventBus, this.l10n); - this.pdfCursorTools = new _pdf_cursor_tools.PDFCursorTools({ + pdfLinkService.setHistory(_this5.pdfHistory); + + if (!_this5.supportsIntegratedFind) { + _this5.findBar = new _pdf_find_bar.PDFFindBar(appConfig.findBar, eventBus, _this5.l10n); + } + + _this5.pdfDocumentProperties = new _pdf_document_properties.PDFDocumentProperties(appConfig.documentProperties, _this5.overlayManager, eventBus, _this5.l10n); + _this5.pdfCursorTools = new _pdf_cursor_tools.PDFCursorTools({ container: container, eventBus: eventBus, - cursorToolOnLoad: _app_options.AppOptions.get('cursorToolOnLoad') + cursorToolOnLoad: _app_options.AppOptions.get("cursorToolOnLoad") }); - this.toolbar = new _toolbar.Toolbar(appConfig.toolbar, eventBus, this.l10n); - this.secondaryToolbar = new _secondary_toolbar.SecondaryToolbar(appConfig.secondaryToolbar, container, eventBus); - if (this.supportsFullscreen) { - this.pdfPresentationMode = new _pdf_presentation_mode.PDFPresentationMode({ + _this5.toolbar = new _toolbar.Toolbar(appConfig.toolbar, eventBus, _this5.l10n); + _this5.secondaryToolbar = new _secondary_toolbar.SecondaryToolbar(appConfig.secondaryToolbar, container, eventBus); + + if (_this5.supportsFullscreen) { + _this5.pdfPresentationMode = new _pdf_presentation_mode.PDFPresentationMode({ container: container, - viewer: viewer, - pdfViewer: this.pdfViewer, + pdfViewer: _this5.pdfViewer, eventBus: eventBus, contextMenuItems: appConfig.fullscreen }); } - this.passwordPrompt = new _password_prompt.PasswordPrompt(appConfig.passwordOverlay, this.overlayManager, this.l10n); - this.pdfOutlineViewer = new _pdf_outline_viewer.PDFOutlineViewer({ + + _this5.passwordPrompt = new _password_prompt.PasswordPrompt(appConfig.passwordOverlay, _this5.overlayManager, _this5.l10n); + _this5.pdfOutlineViewer = new _pdf_outline_viewer.PDFOutlineViewer({ container: appConfig.sidebar.outlineView, eventBus: eventBus, linkService: pdfLinkService }); - this.pdfAttachmentViewer = new _pdf_attachment_viewer.PDFAttachmentViewer({ + _this5.pdfAttachmentViewer = new _pdf_attachment_viewer.PDFAttachmentViewer({ container: appConfig.sidebar.attachmentsView, eventBus: eventBus, downloadManager: downloadManager }); - sidebarConfig = Object.create(appConfig.sidebar); - - sidebarConfig.pdfViewer = this.pdfViewer; - sidebarConfig.pdfThumbnailViewer = this.pdfThumbnailViewer; - this.pdfSidebar = new _pdf_sidebar.PDFSidebar(sidebarConfig, eventBus, this.l10n); - this.pdfSidebar.onToggled = this.forceRendering.bind(this); - this.pdfSidebarResizer = new _pdf_sidebar_resizer.PDFSidebarResizer(appConfig.sidebarResizer, eventBus, this.l10n); + _this5.pdfSidebar = new _pdf_sidebar.PDFSidebar({ + elements: appConfig.sidebar, + pdfViewer: _this5.pdfViewer, + pdfThumbnailViewer: _this5.pdfThumbnailViewer, + eventBus: eventBus, + l10n: _this5.l10n + }); + _this5.pdfSidebar.onToggled = _this5.forceRendering.bind(_this5); + _this5.pdfSidebarResizer = new _pdf_sidebar_resizer.PDFSidebarResizer(appConfig.sidebarResizer, eventBus, _this5.l10n); - case 39: - case 'end': + case 34: + case "end": return _context5.stop(); } } - }, _callee5, this); - })); - - function _initializeViewerComponents() { - return _ref5.apply(this, arguments); - } - - return _initializeViewerComponents; - }(), + }, _callee5); + }))(); + }, run: function run(config) { this.initialize(config).then(webViewerInitialized); }, + + get initialized() { + return this._initializedCapability.settled; + }, + + get initializedPromise() { + return this._initializedCapability.promise; + }, + zoomIn: function zoomIn(ticks) { + if (this.pdfViewer.isInPresentationMode) { + return; + } + var newScale = this.pdfViewer.currentScale; + do { newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2); newScale = Math.ceil(newScale * 10) / 10; newScale = Math.min(_ui_utils.MAX_SCALE, newScale); } while (--ticks > 0 && newScale < _ui_utils.MAX_SCALE); + this.pdfViewer.currentScaleValue = newScale; }, zoomOut: function zoomOut(ticks) { + if (this.pdfViewer.isInPresentationMode) { + return; + } + var newScale = this.pdfViewer.currentScale; + do { newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2); newScale = Math.floor(newScale * 10) / 10; newScale = Math.max(_ui_utils.MIN_SCALE, newScale); } while (--ticks > 0 && newScale > _ui_utils.MIN_SCALE); + this.pdfViewer.currentScaleValue = newScale; }, + zoomReset: function zoomReset() { + if (this.pdfViewer.isInPresentationMode) { + return; + } + + this.pdfViewer.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE; + }, get pagesCount() { return this.pdfDocument ? this.pdfDocument.numPages : 0; }, - set page(val) { - this.pdfViewer.currentPageNumber = val; - }, + get page() { return this.pdfViewer.currentPageNumber; }, + + set page(val) { + this.pdfViewer.currentPageNumber = val; + }, + get printing() { return !!this.printService; }, + get supportsPrinting() { return PDFPrintServiceFactory.instance.supportsPrinting; }, + get supportsFullscreen() { - var support = void 0; + var support; var doc = document.documentElement; support = !!(doc.requestFullscreen || doc.mozRequestFullScreen || doc.webkitRequestFullScreen || doc.msRequestFullscreen); + if (document.fullscreenEnabled === false || document.mozFullScreenEnabled === false || document.webkitFullscreenEnabled === false || document.msFullscreenEnabled === false) { support = false; } - return (0, _pdfjsLib.shadow)(this, 'supportsFullscreen', support); + + return (0, _pdfjsLib.shadow)(this, "supportsFullscreen", support); }, + get supportsIntegratedFind() { return this.externalServices.supportsIntegratedFind; }, + get supportsDocumentFonts() { return this.externalServices.supportsDocumentFonts; }, - get supportsDocumentColors() { - return this.externalServices.supportsDocumentColors; - }, + get loadingBar() { - var bar = new _ui_utils.ProgressBar('#loadingBar'); - return (0, _pdfjsLib.shadow)(this, 'loadingBar', bar); + var bar = new _ui_utils.ProgressBar("#loadingBar"); + return (0, _pdfjsLib.shadow)(this, "loadingBar", bar); }, + get supportedMouseWheelZoomModifierKeys() { return this.externalServices.supportedMouseWheelZoomModifierKeys; }, + initPassiveLoading: function initPassiveLoading() { - throw new Error('Not implemented: initPassiveLoading'); + throw new Error("Not implemented: initPassiveLoading"); }, setTitleUsingUrl: function setTitleUsingUrl() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - + var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; this.url = url; - this.baseUrl = url.split('#')[0]; - var title = (0, _ui_utils.getPDFFileNameFromURL)(url, ''); + this.baseUrl = url.split("#")[0]; + var title = (0, _ui_utils.getPDFFileNameFromURL)(url, ""); + if (!title) { try { title = decodeURIComponent((0, _pdfjsLib.getFilenameFromUrl)(url)) || url; @@ -833,508 +938,915 @@ var PDFViewerApplication = { title = url; } } + this.setTitle(title); }, setTitle: function setTitle(title) { if (this.isViewerEmbedded) { return; } + document.title = title; }, - close: function () { - var _ref6 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee6() { + close: function close() { + var _this6 = this; + + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee6() { var errorWrapper, promise; - return _regenerator2.default.wrap(function _callee6$(_context6) { + return _regenerator["default"].wrap(function _callee6$(_context6) { while (1) { switch (_context6.prev = _context6.next) { case 0: - errorWrapper = this.appConfig.errorWrapper.container; - - errorWrapper.setAttribute('hidden', 'true'); + errorWrapper = _this6.appConfig.errorWrapper.container; + errorWrapper.setAttribute("hidden", "true"); - if (this.pdfLoadingTask) { + if (_this6.pdfLoadingTask) { _context6.next = 4; break; } - return _context6.abrupt('return'); + return _context6.abrupt("return", undefined); case 4: - promise = this.pdfLoadingTask.destroy(); - - this.pdfLoadingTask = null; - if (this.pdfDocument) { - this.pdfDocument = null; - this.pdfThumbnailViewer.setDocument(null); - this.pdfViewer.setDocument(null); - this.pdfLinkService.setDocument(null); - this.pdfDocumentProperties.setDocument(null); + promise = _this6.pdfLoadingTask.destroy(); + _this6.pdfLoadingTask = null; + + if (_this6.pdfDocument) { + _this6.pdfDocument = null; + + _this6.pdfThumbnailViewer.setDocument(null); + + _this6.pdfViewer.setDocument(null); + + _this6.pdfLinkService.setDocument(null); + + _this6.pdfDocumentProperties.setDocument(null); + } + + webViewerResetPermissions(); + _this6.store = null; + _this6.isInitialViewSet = false; + _this6.downloadComplete = false; + _this6.url = ""; + _this6.baseUrl = ""; + _this6.contentDispositionFilename = null; + + _this6.pdfSidebar.reset(); + + _this6.pdfOutlineViewer.reset(); + + _this6.pdfAttachmentViewer.reset(); + + if (_this6.pdfHistory) { + _this6.pdfHistory.reset(); + } + + if (_this6.findBar) { + _this6.findBar.reset(); } - this.store = null; - this.isInitialViewSet = false; - this.downloadComplete = false; - this.url = ''; - this.baseUrl = ''; - this.contentDispositionFilename = null; - this.pdfSidebar.reset(); - this.pdfOutlineViewer.reset(); - this.pdfAttachmentViewer.reset(); - this.findBar.reset(); - this.toolbar.reset(); - this.secondaryToolbar.reset(); - if (typeof PDFBug !== 'undefined') { + + _this6.toolbar.reset(); + + _this6.secondaryToolbar.reset(); + + if (typeof PDFBug !== "undefined") { PDFBug.cleanup(); } - return _context6.abrupt('return', promise); - case 21: - case 'end': + return _context6.abrupt("return", promise); + + case 23: + case "end": return _context6.stop(); } } - }, _callee6, this); - })); - - function close() { - return _ref6.apply(this, arguments); - } - - return close; - }(), - open: function () { - var _ref7 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee7(file, args) { - var _this2 = this; + }, _callee6); + }))(); + }, + open: function open(file, args) { + var _this7 = this; - var workerParameters, key, parameters, apiParameters, _key, prop, loadingTask; + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee7() { + var workerParameters, key, parameters, apiParameters, _key, value, _key2, _value, loadingTask; - return _regenerator2.default.wrap(function _callee7$(_context7) { + return _regenerator["default"].wrap(function _callee7$(_context7) { while (1) { switch (_context7.prev = _context7.next) { case 0: - if (!this.pdfLoadingTask) { + if (!_this7.pdfLoadingTask) { _context7.next = 3; break; } _context7.next = 3; - return this.close(); + return _this7.close(); case 3: - workerParameters = _app_options.AppOptions.getAll('worker'); + workerParameters = _app_options.AppOptions.getAll(_app_options.OptionKind.WORKER); for (key in workerParameters) { _pdfjsLib.GlobalWorkerOptions[key] = workerParameters[key]; } + parameters = Object.create(null); - if (typeof file === 'string') { - this.setTitleUsingUrl(file); + if (typeof file === "string") { + _this7.setTitleUsingUrl(file); + parameters.url = file; - } else if (file && 'byteLength' in file) { + } else if (file && "byteLength" in file) { parameters.data = file; } else if (file.url && file.originalUrl) { - this.setTitleUsingUrl(file.originalUrl); + _this7.setTitleUsingUrl(file.originalUrl); + parameters.url = file.url; } - apiParameters = _app_options.AppOptions.getAll('api'); + + apiParameters = _app_options.AppOptions.getAll(_app_options.OptionKind.API); for (_key in apiParameters) { - parameters[_key] = apiParameters[_key]; + value = apiParameters[_key]; + + if (_key === "docBaseUrl" && !value) {} + + parameters[_key] = value; } + if (args) { - for (prop in args) { - if (prop === 'length') { - this.pdfDocumentProperties.setFileSize(args[prop]); + for (_key2 in args) { + _value = args[_key2]; + + if (_key2 === "length") { + _this7.pdfDocumentProperties.setFileSize(_value); } - parameters[prop] = args[prop]; + + parameters[_key2] = _value; } } + loadingTask = (0, _pdfjsLib.getDocument)(parameters); + _this7.pdfLoadingTask = loadingTask; - this.pdfLoadingTask = loadingTask; loadingTask.onPassword = function (updateCallback, reason) { - _this2.passwordPrompt.setUpdateCallback(updateCallback, reason); - _this2.passwordPrompt.open(); + _this7.pdfLinkService.externalLinkEnabled = false; + + _this7.passwordPrompt.setUpdateCallback(updateCallback, reason); + + _this7.passwordPrompt.open(); }; - loadingTask.onProgress = function (_ref8) { - var loaded = _ref8.loaded, - total = _ref8.total; - _this2.progress(loaded / total); + loadingTask.onProgress = function (_ref) { + var loaded = _ref.loaded, + total = _ref.total; + + _this7.progress(loaded / total); }; - loadingTask.onUnsupportedFeature = this.fallback.bind(this); - return _context7.abrupt('return', loadingTask.promise.then(function (pdfDocument) { - _this2.load(pdfDocument); + + loadingTask.onUnsupportedFeature = _this7.fallback.bind(_this7); + return _context7.abrupt("return", loadingTask.promise.then(function (pdfDocument) { + _this7.load(pdfDocument); }, function (exception) { - if (loadingTask !== _this2.pdfLoadingTask) { - return; + if (loadingTask !== _this7.pdfLoadingTask) { + return undefined; } + var message = exception && exception.message; - var loadingErrorMessage = void 0; + var loadingErrorMessage; + if (exception instanceof _pdfjsLib.InvalidPDFException) { - loadingErrorMessage = _this2.l10n.get('invalid_file_error', null, 'Invalid or corrupted PDF file.'); + loadingErrorMessage = _this7.l10n.get("invalid_file_error", null, "Invalid or corrupted PDF file."); } else if (exception instanceof _pdfjsLib.MissingPDFException) { - loadingErrorMessage = _this2.l10n.get('missing_file_error', null, 'Missing PDF file.'); + loadingErrorMessage = _this7.l10n.get("missing_file_error", null, "Missing PDF file."); } else if (exception instanceof _pdfjsLib.UnexpectedResponseException) { - loadingErrorMessage = _this2.l10n.get('unexpected_response_error', null, 'Unexpected server response.'); + loadingErrorMessage = _this7.l10n.get("unexpected_response_error", null, "Unexpected server response."); } else { - loadingErrorMessage = _this2.l10n.get('loading_error', null, 'An error occurred while loading the PDF.'); + loadingErrorMessage = _this7.l10n.get("loading_error", null, "An error occurred while loading the PDF."); } + return loadingErrorMessage.then(function (msg) { - _this2.error(msg, { message: message }); - throw new Error(msg); + _this7.error(msg, { + message: message + }); + + throw exception; }); })); case 16: - case 'end': + case "end": return _context7.stop(); } } - }, _callee7, this); - })); - - function open(_x3, _x4) { - return _ref7.apply(this, arguments); - } - - return open; - }(), + }, _callee7); + }))(); + }, download: function download() { - var _this3 = this; + var _this8 = this; function downloadByUrl() { downloadManager.downloadUrl(url, filename); } + var url = this.baseUrl; var filename = this.contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(this.url); var downloadManager = this.downloadManager; + downloadManager.onerror = function (err) { - _this3.error('PDF failed to download: ' + err); + _this8.error("PDF failed to download: ".concat(err)); }; + if (!this.pdfDocument || !this.downloadComplete) { downloadByUrl(); return; } + this.pdfDocument.getData().then(function (data) { - var blob = new Blob([data], { type: 'application/pdf' }); + var blob = new Blob([data], { + type: "application/pdf" + }); downloadManager.download(blob, url, filename); - }).catch(downloadByUrl); + })["catch"](downloadByUrl); + }, + fallback: function fallback(featureId) { + if (this.fellback) { + return; + } + + this.fellback = true; + this.externalServices.fallback({ + featureId: featureId, + url: this.baseUrl + }, function response(download) { + if (!download) { + return; + } + + PDFViewerApplication.download(); + }); }, - fallback: function fallback(featureId) {}, error: function error(message, moreInfo) { - var moreInfoText = [this.l10n.get('error_version_info', { - version: _pdfjsLib.version || '?', - build: _pdfjsLib.build || '?' - }, 'PDF.js v{{version}} (build: {{build}})')]; + var moreInfoText = [this.l10n.get("error_version_info", { + version: _pdfjsLib.version || "?", + build: _pdfjsLib.build || "?" + }, "PDF.js v{{version}} (build: {{build}})")]; + if (moreInfo) { - moreInfoText.push(this.l10n.get('error_message', { message: moreInfo.message }, 'Message: {{message}}')); + moreInfoText.push(this.l10n.get("error_message", { + message: moreInfo.message + }, "Message: {{message}}")); + if (moreInfo.stack) { - moreInfoText.push(this.l10n.get('error_stack', { stack: moreInfo.stack }, 'Stack: {{stack}}')); + moreInfoText.push(this.l10n.get("error_stack", { + stack: moreInfo.stack + }, "Stack: {{stack}}")); } else { if (moreInfo.filename) { - moreInfoText.push(this.l10n.get('error_file', { file: moreInfo.filename }, 'File: {{file}}')); + moreInfoText.push(this.l10n.get("error_file", { + file: moreInfo.filename + }, "File: {{file}}")); } + if (moreInfo.lineNumber) { - moreInfoText.push(this.l10n.get('error_line', { line: moreInfo.lineNumber }, 'Line: {{line}}')); + moreInfoText.push(this.l10n.get("error_line", { + line: moreInfo.lineNumber + }, "Line: {{line}}")); } } } + var errorWrapperConfig = this.appConfig.errorWrapper; var errorWrapper = errorWrapperConfig.container; - errorWrapper.removeAttribute('hidden'); + errorWrapper.removeAttribute("hidden"); var errorMessage = errorWrapperConfig.errorMessage; errorMessage.textContent = message; var closeButton = errorWrapperConfig.closeButton; + closeButton.onclick = function () { - errorWrapper.setAttribute('hidden', 'true'); + errorWrapper.setAttribute("hidden", "true"); }; + var errorMoreInfo = errorWrapperConfig.errorMoreInfo; var moreInfoButton = errorWrapperConfig.moreInfoButton; var lessInfoButton = errorWrapperConfig.lessInfoButton; + moreInfoButton.onclick = function () { - errorMoreInfo.removeAttribute('hidden'); - moreInfoButton.setAttribute('hidden', 'true'); - lessInfoButton.removeAttribute('hidden'); - errorMoreInfo.style.height = errorMoreInfo.scrollHeight + 'px'; + errorMoreInfo.removeAttribute("hidden"); + moreInfoButton.setAttribute("hidden", "true"); + lessInfoButton.removeAttribute("hidden"); + errorMoreInfo.style.height = errorMoreInfo.scrollHeight + "px"; }; + lessInfoButton.onclick = function () { - errorMoreInfo.setAttribute('hidden', 'true'); - moreInfoButton.removeAttribute('hidden'); - lessInfoButton.setAttribute('hidden', 'true'); + errorMoreInfo.setAttribute("hidden", "true"); + moreInfoButton.removeAttribute("hidden"); + lessInfoButton.setAttribute("hidden", "true"); }; + moreInfoButton.oncontextmenu = _ui_utils.noContextMenuHandler; lessInfoButton.oncontextmenu = _ui_utils.noContextMenuHandler; closeButton.oncontextmenu = _ui_utils.noContextMenuHandler; - moreInfoButton.removeAttribute('hidden'); - lessInfoButton.setAttribute('hidden', 'true'); + moreInfoButton.removeAttribute("hidden"); + lessInfoButton.setAttribute("hidden", "true"); Promise.all(moreInfoText).then(function (parts) { - errorMoreInfo.value = parts.join('\n'); + errorMoreInfo.value = parts.join("\n"); }); }, progress: function progress(level) { - var _this4 = this; + var _this9 = this; if (this.downloadComplete) { return; } + var percent = Math.round(level * 100); + if (percent > this.loadingBar.percent || isNaN(percent)) { this.loadingBar.percent = percent; - var disableAutoFetch = this.pdfDocument ? this.pdfDocument.loadingParams['disableAutoFetch'] : _app_options.AppOptions.get('disableAutoFetch'); + var disableAutoFetch = this.pdfDocument ? this.pdfDocument.loadingParams.disableAutoFetch : _app_options.AppOptions.get("disableAutoFetch"); + if (disableAutoFetch && percent) { if (this.disableAutoFetchLoadingBarTimeout) { clearTimeout(this.disableAutoFetchLoadingBarTimeout); this.disableAutoFetchLoadingBarTimeout = null; } + this.loadingBar.show(); this.disableAutoFetchLoadingBarTimeout = setTimeout(function () { - _this4.loadingBar.hide(); - _this4.disableAutoFetchLoadingBarTimeout = null; + _this9.loadingBar.hide(); + + _this9.disableAutoFetchLoadingBarTimeout = null; }, DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT); } } }, load: function load(pdfDocument) { - var _this5 = this; + var _this10 = this; this.pdfDocument = pdfDocument; pdfDocument.getDownloadInfo().then(function () { - _this5.downloadComplete = true; - _this5.loadingBar.hide(); + _this10.downloadComplete = true; + + _this10.loadingBar.hide(); + firstPagePromise.then(function () { - _this5.eventBus.dispatch('documentloaded', { source: _this5 }); - _this5.eventBus.dispatch('documentload', { source: _this5 }); + _this10.eventBus.dispatch("documentloaded", { + source: _this10 + }); }); }); - var pageModePromise = pdfDocument.getPageMode().catch(function () {}); + var pageLayoutPromise = pdfDocument.getPageLayout()["catch"](function () {}); + var pageModePromise = pdfDocument.getPageMode()["catch"](function () {}); + var openActionPromise = pdfDocument.getOpenAction()["catch"](function () {}); this.toolbar.setPagesCount(pdfDocument.numPages, false); this.secondaryToolbar.setPagesCount(pdfDocument.numPages); - var store = this.store = new _view_history.ViewHistory(pdfDocument.fingerprint); - var baseDocumentUrl = void 0; + var baseDocumentUrl; baseDocumentUrl = null; this.pdfLinkService.setDocument(pdfDocument, baseDocumentUrl); this.pdfDocumentProperties.setDocument(pdfDocument, this.url); var pdfViewer = this.pdfViewer; pdfViewer.setDocument(pdfDocument); - var firstPagePromise = pdfViewer.firstPagePromise; - var pagesPromise = pdfViewer.pagesPromise; - var onePageRendered = pdfViewer.onePageRendered; + var firstPagePromise = pdfViewer.firstPagePromise, + onePageRendered = pdfViewer.onePageRendered, + pagesPromise = pdfViewer.pagesPromise; var pdfThumbnailViewer = this.pdfThumbnailViewer; pdfThumbnailViewer.setDocument(pdfDocument); + var storedPromise = (this.store = new _view_history.ViewHistory(pdfDocument.fingerprint)).getMultiple({ + page: null, + zoom: _ui_utils.DEFAULT_SCALE_VALUE, + scrollLeft: "0", + scrollTop: "0", + rotation: null, + sidebarView: _pdf_sidebar.SidebarView.UNKNOWN, + scrollMode: _ui_utils.ScrollMode.UNKNOWN, + spreadMode: _ui_utils.SpreadMode.UNKNOWN + })["catch"](function () { + return Object.create(null); + }); firstPagePromise.then(function (pdfPage) { - _this5.loadingBar.setWidth(_this5.appConfig.viewerContainer); - if (!_app_options.AppOptions.get('disableHistory') && !_this5.isViewerEmbedded) { - var resetHistory = !_app_options.AppOptions.get('showPreviousViewOnLoad'); - _this5.pdfHistory.initialize(pdfDocument.fingerprint, resetHistory); - if (_this5.pdfHistory.initialBookmark) { - _this5.initialBookmark = _this5.pdfHistory.initialBookmark; - _this5.initialRotation = _this5.pdfHistory.initialRotation; - } - } - var storePromise = store.getMultiple({ - page: null, - zoom: _ui_utils.DEFAULT_SCALE_VALUE, - scrollLeft: '0', - scrollTop: '0', - rotation: null, - sidebarView: _pdf_sidebar.SidebarView.NONE, - scrollMode: null, - spreadMode: null - }).catch(function () {}); - Promise.all([storePromise, pageModePromise]).then(function () { - var _ref10 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee8(_ref9) { - var _ref11 = _slicedToArray(_ref9, 2), - _ref11$ = _ref11[0], - values = _ref11$ === undefined ? {} : _ref11$, - pageMode = _ref11[1]; - - var initialBookmark, zoom, hash, rotation, sidebarView, scrollMode, spreadMode; - return _regenerator2.default.wrap(function _callee8$(_context8) { + _this10.loadingBar.setWidth(_this10.appConfig.viewerContainer); + + Promise.all([_ui_utils.animationStarted, storedPromise, pageLayoutPromise, pageModePromise, openActionPromise]).then( /*#__PURE__*/function () { + var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_ref2) { + var _ref4, timeStamp, stored, pageLayout, pageMode, openAction, viewOnLoad, initialBookmark, zoom, hash, rotation, sidebarView, scrollMode, spreadMode; + + return _regenerator["default"].wrap(function _callee8$(_context8) { while (1) { switch (_context8.prev = _context8.next) { case 0: - initialBookmark = _this5.initialBookmark; - zoom = _app_options.AppOptions.get('defaultZoomValue'); - hash = zoom ? 'zoom=' + zoom : null; + _ref4 = _slicedToArray(_ref2, 5), timeStamp = _ref4[0], stored = _ref4[1], pageLayout = _ref4[2], pageMode = _ref4[3], openAction = _ref4[4]; + viewOnLoad = _app_options.AppOptions.get("viewOnLoad"); + + _this10._initializePdfHistory({ + fingerprint: pdfDocument.fingerprint, + viewOnLoad: viewOnLoad, + initialDest: openAction && openAction.dest + }); + + initialBookmark = _this10.initialBookmark; + zoom = _app_options.AppOptions.get("defaultZoomValue"); + hash = zoom ? "zoom=".concat(zoom) : null; rotation = null; - sidebarView = _app_options.AppOptions.get('sidebarViewOnLoad'); - scrollMode = _app_options.AppOptions.get('scrollModeOnLoad'); - spreadMode = _app_options.AppOptions.get('spreadModeOnLoad'); - - if (values.page && _app_options.AppOptions.get('showPreviousViewOnLoad')) { - hash = 'page=' + values.page + '&zoom=' + (zoom || values.zoom) + ',' + values.scrollLeft + ',' + values.scrollTop; - rotation = parseInt(values.rotation, 10); - sidebarView = sidebarView || values.sidebarView | 0; - scrollMode = scrollMode || values.scrollMode | 0; - spreadMode = spreadMode || values.spreadMode | 0; + sidebarView = _app_options.AppOptions.get("sidebarViewOnLoad"); + scrollMode = _app_options.AppOptions.get("scrollModeOnLoad"); + spreadMode = _app_options.AppOptions.get("spreadModeOnLoad"); + + if (stored.page && viewOnLoad !== ViewOnLoad.INITIAL) { + hash = "page=".concat(stored.page, "&zoom=").concat(zoom || stored.zoom, ",") + "".concat(stored.scrollLeft, ",").concat(stored.scrollTop); + rotation = parseInt(stored.rotation, 10); + + if (sidebarView === _pdf_sidebar.SidebarView.UNKNOWN) { + sidebarView = stored.sidebarView | 0; + } + + if (scrollMode === _ui_utils.ScrollMode.UNKNOWN) { + scrollMode = stored.scrollMode | 0; + } + + if (spreadMode === _ui_utils.SpreadMode.UNKNOWN) { + spreadMode = stored.spreadMode | 0; + } + } + + if (pageMode && sidebarView === _pdf_sidebar.SidebarView.UNKNOWN) { + sidebarView = apiPageModeToSidebarView(pageMode); } - if (pageMode && !_app_options.AppOptions.get('disablePageMode')) { - sidebarView = sidebarView || apiPageModeToSidebarView(pageMode); + + if (pageLayout && spreadMode === _ui_utils.SpreadMode.UNKNOWN) { + spreadMode = apiPageLayoutToSpreadMode(pageLayout); } - _this5.setInitialView(hash, { + + _this10.setInitialView(hash, { rotation: rotation, sidebarView: sidebarView, scrollMode: scrollMode, spreadMode: spreadMode }); - _this5.eventBus.dispatch('documentinit', { source: _this5 }); - if (!_this5.isViewerEmbedded) { + + _this10.eventBus.dispatch("documentinit", { + source: _this10 + }); + + if (!_this10.isViewerEmbedded) { pdfViewer.focus(); } - _context8.next = 14; + + _this10._initializePermissions(pdfDocument); + + _context8.next = 19; return Promise.race([pagesPromise, new Promise(function (resolve) { setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT); })]); - case 14: + case 19: if (!(!initialBookmark && !hash)) { - _context8.next = 16; + _context8.next = 21; break; } - return _context8.abrupt('return'); + return _context8.abrupt("return"); - case 16: + case 21: if (!pdfViewer.hasEqualPageSizes) { - _context8.next = 18; + _context8.next = 23; break; } - return _context8.abrupt('return'); + return _context8.abrupt("return"); - case 18: - _this5.initialBookmark = initialBookmark; + case 23: + _this10.initialBookmark = initialBookmark; pdfViewer.currentScaleValue = pdfViewer.currentScaleValue; - _this5.setInitialView(hash); - case 21: - case 'end': + _this10.setInitialView(hash); + + case 26: + case "end": return _context8.stop(); } } - }, _callee8, _this5); + }, _callee8); })); - return function (_x5) { - return _ref10.apply(this, arguments); + return function (_x) { + return _ref3.apply(this, arguments); }; - }()).then(function () { + }())["catch"](function () { + _this10.setInitialView(); + }).then(function () { pdfViewer.update(); }); }); - pdfDocument.getPageLabels().then(function (labels) { - if (!labels || _app_options.AppOptions.get('disablePageLabels')) { - return; - } - var i = 0, - numLabels = labels.length; - if (numLabels !== _this5.pagesCount) { - console.error('The number of Page Labels does not match ' + 'the number of pages in the document.'); - return; - } - while (i < numLabels && labels[i] === (i + 1).toString()) { - i++; - } - if (i === numLabels) { - return; - } - pdfViewer.setPageLabels(labels); - pdfThumbnailViewer.setPageLabels(labels); - _this5.toolbar.setPagesCount(pdfDocument.numPages, true); - _this5.toolbar.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel); - }); pagesPromise.then(function () { - if (!_this5.supportsPrinting) { - return; - } - pdfDocument.getJavaScript().then(function (javaScript) { - if (!javaScript) { - return; - } - javaScript.some(function (js) { - if (!js) { - return false; - } - console.warn('Warning: JavaScript is not supported'); - _this5.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.javaScript); - return true; - }); - var regex = /\bprint\s*\(/; - for (var i = 0, ii = javaScript.length; i < ii; i++) { - var js = javaScript[i]; - if (js && regex.test(js)) { - setTimeout(function () { - window.print(); - }); - return; - } - } - }); + _this10._initializeAutoPrint(pdfDocument, openActionPromise); }); - Promise.all([onePageRendered, _ui_utils.animationStarted]).then(function () { + onePageRendered.then(function () { pdfDocument.getOutline().then(function (outline) { - _this5.pdfOutlineViewer.render({ outline: outline }); + _this10.pdfOutlineViewer.render({ + outline: outline + }); }); pdfDocument.getAttachments().then(function (attachments) { - _this5.pdfAttachmentViewer.render({ attachments: attachments }); + _this10.pdfAttachmentViewer.render({ + attachments: attachments + }); }); }); - pdfDocument.getMetadata().then(function (_ref12) { - var info = _ref12.info, - metadata = _ref12.metadata, - contentDispositionFilename = _ref12.contentDispositionFilename; - - _this5.documentInfo = info; - _this5.metadata = metadata; - _this5.contentDispositionFilename = contentDispositionFilename; - console.log('PDF ' + pdfDocument.fingerprint + ' [' + info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() + ' / ' + (info.Creator || '-').trim() + ']' + ' (PDF.js: ' + (_pdfjsLib.version || '-') + (_app_options.AppOptions.get('enableWebGL') ? ' [WebGL]' : '') + ')'); - var pdfTitle = void 0; - if (metadata && metadata.has('dc:title')) { - var title = metadata.get('dc:title'); - if (title !== 'Untitled') { - pdfTitle = title; - } - } - if (!pdfTitle && info && info['Title']) { - pdfTitle = info['Title']; - } - if (pdfTitle) { - _this5.setTitle(pdfTitle + ' - ' + (contentDispositionFilename || document.title)); - } else if (contentDispositionFilename) { - _this5.setTitle(contentDispositionFilename); - } - if (info.IsAcroFormPresent) { - console.warn('Warning: AcroForm/XFA is not supported'); - _this5.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.forms); - } + + this._initializePageLabels(pdfDocument); + + this._initializeMetadata(pdfDocument); + }, + _initializeAutoPrint: function _initializeAutoPrint(pdfDocument, openActionPromise) { + var _this11 = this; + + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee9() { + var _yield$Promise$all, _yield$Promise$all2, openAction, javaScript, triggerAutoPrint, _iterator, _step, js; + + return _regenerator["default"].wrap(function _callee9$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + _context9.next = 2; + return Promise.all([openActionPromise, pdfDocument.getJavaScript()]); + + case 2: + _yield$Promise$all = _context9.sent; + _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2); + openAction = _yield$Promise$all2[0]; + javaScript = _yield$Promise$all2[1]; + + if (!(pdfDocument !== _this11.pdfDocument)) { + _context9.next = 8; + break; + } + + return _context9.abrupt("return"); + + case 8: + triggerAutoPrint = false; + + if (openAction && openAction.action === "Print") { + triggerAutoPrint = true; + } + + if (!javaScript) { + _context9.next = 31; + break; + } + + javaScript.some(function (js) { + if (!js) { + return false; + } + + console.warn("Warning: JavaScript is not supported"); + + _this11.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.javaScript); + + return true; + }); + + if (triggerAutoPrint) { + _context9.next = 31; + break; + } + + _iterator = _createForOfIteratorHelper(javaScript); + _context9.prev = 14; + + _iterator.s(); + + case 16: + if ((_step = _iterator.n()).done) { + _context9.next = 23; + break; + } + + js = _step.value; + + if (!(js && _ui_utils.AutoPrintRegExp.test(js))) { + _context9.next = 21; + break; + } + + triggerAutoPrint = true; + return _context9.abrupt("break", 23); + + case 21: + _context9.next = 16; + break; + + case 23: + _context9.next = 28; + break; + + case 25: + _context9.prev = 25; + _context9.t0 = _context9["catch"](14); + + _iterator.e(_context9.t0); + + case 28: + _context9.prev = 28; + + _iterator.f(); + + return _context9.finish(28); + + case 31: + if (_this11.supportsPrinting) { + _context9.next = 33; + break; + } + + return _context9.abrupt("return"); + + case 33: + if (triggerAutoPrint) { + setTimeout(function () { + window.print(); + }); + } + + case 34: + case "end": + return _context9.stop(); + } + } + }, _callee9, null, [[14, 25, 28, 31]]); + }))(); + }, + _initializeMetadata: function _initializeMetadata(pdfDocument) { + var _this12 = this; + + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee10() { + var _yield$pdfDocument$ge, info, metadata, contentDispositionFilename, pdfTitle, infoTitle, metadataTitle, versionId, KNOWN_VERSIONS, generatorId, KNOWN_GENERATORS, producer, formType; + + return _regenerator["default"].wrap(function _callee10$(_context10) { + while (1) { + switch (_context10.prev = _context10.next) { + case 0: + _context10.next = 2; + return pdfDocument.getMetadata(); + + case 2: + _yield$pdfDocument$ge = _context10.sent; + info = _yield$pdfDocument$ge.info; + metadata = _yield$pdfDocument$ge.metadata; + contentDispositionFilename = _yield$pdfDocument$ge.contentDispositionFilename; + + if (!(pdfDocument !== _this12.pdfDocument)) { + _context10.next = 8; + break; + } + + return _context10.abrupt("return"); + + case 8: + _this12.documentInfo = info; + _this12.metadata = metadata; + _this12.contentDispositionFilename = contentDispositionFilename; + console.log("PDF ".concat(pdfDocument.fingerprint, " [").concat(info.PDFFormatVersion, " ") + "".concat((info.Producer || "-").trim(), " / ").concat((info.Creator || "-").trim(), "] ") + "(PDF.js: ".concat(_pdfjsLib.version || "-") + "".concat(_this12.pdfViewer.enableWebGL ? " [WebGL]" : "", ")")); + infoTitle = info && info.Title; + + if (infoTitle) { + pdfTitle = infoTitle; + } + + metadataTitle = metadata && metadata.get("dc:title"); + + if (metadataTitle) { + if (metadataTitle !== "Untitled" && !/[\uFFF0-\uFFFF]/g.test(metadataTitle)) { + pdfTitle = metadataTitle; + } + } + + if (pdfTitle) { + _this12.setTitle("".concat(pdfTitle, " - ").concat(contentDispositionFilename || document.title)); + } else if (contentDispositionFilename) { + _this12.setTitle(contentDispositionFilename); + } + + if (info.IsAcroFormPresent) { + console.warn("Warning: AcroForm/XFA is not supported"); + + _this12.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.forms); + } + + versionId = "other"; + KNOWN_VERSIONS = ["1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "2.0", "2.1", "2.2", "2.3"]; + + if (KNOWN_VERSIONS.includes(info.PDFFormatVersion)) { + versionId = "v".concat(info.PDFFormatVersion.replace(".", "_")); + } + + generatorId = "other"; + KNOWN_GENERATORS = ["acrobat distiller", "acrobat pdfwriter", "adobe livecycle", "adobe pdf library", "adobe photoshop", "ghostscript", "tcpdf", "cairo", "dvipdfm", "dvips", "pdftex", "pdfkit", "itext", "prince", "quarkxpress", "mac os x", "microsoft", "openoffice", "oracle", "luradocument", "pdf-xchange", "antenna house", "aspose.cells", "fpdf"]; + + if (info.Producer) { + producer = info.Producer.toLowerCase(); + KNOWN_GENERATORS.some(function (generator) { + if (!producer.includes(generator)) { + return false; + } + + generatorId = generator.replace(/[ .\-]/g, "_"); + return true; + }); + } + + formType = null; + + if (info.IsAcroFormPresent) { + formType = info.IsXFAPresent ? "xfa" : "acroform"; + } + + _this12.externalServices.reportTelemetry({ + type: "documentInfo", + version: versionId, + generator: generatorId, + formType: formType + }); + + case 27: + case "end": + return _context10.stop(); + } + } + }, _callee10); + }))(); + }, + _initializePageLabels: function _initializePageLabels(pdfDocument) { + var _this13 = this; + + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee11() { + var labels, numLabels, i, pdfViewer, pdfThumbnailViewer, toolbar; + return _regenerator["default"].wrap(function _callee11$(_context11) { + while (1) { + switch (_context11.prev = _context11.next) { + case 0: + _context11.next = 2; + return pdfDocument.getPageLabels(); + + case 2: + labels = _context11.sent; + + if (!(pdfDocument !== _this13.pdfDocument)) { + _context11.next = 5; + break; + } + + return _context11.abrupt("return"); + + case 5: + if (!(!labels || _app_options.AppOptions.get("disablePageLabels"))) { + _context11.next = 7; + break; + } + + return _context11.abrupt("return"); + + case 7: + numLabels = labels.length; + + if (!(numLabels !== _this13.pagesCount)) { + _context11.next = 11; + break; + } + + console.error("The number of Page Labels does not match the number of pages in the document."); + return _context11.abrupt("return"); + + case 11: + i = 0; + + while (i < numLabels && labels[i] === (i + 1).toString()) { + i++; + } + + if (!(i === numLabels)) { + _context11.next = 15; + break; + } + + return _context11.abrupt("return"); + + case 15: + pdfViewer = _this13.pdfViewer, pdfThumbnailViewer = _this13.pdfThumbnailViewer, toolbar = _this13.toolbar; + pdfViewer.setPageLabels(labels); + pdfThumbnailViewer.setPageLabels(labels); + toolbar.setPagesCount(numLabels, true); + toolbar.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel); + + case 20: + case "end": + return _context11.stop(); + } + } + }, _callee11); + }))(); + }, + _initializePdfHistory: function _initializePdfHistory(_ref5) { + var fingerprint = _ref5.fingerprint, + viewOnLoad = _ref5.viewOnLoad, + _ref5$initialDest = _ref5.initialDest, + initialDest = _ref5$initialDest === void 0 ? null : _ref5$initialDest; + + if (this.isViewerEmbedded || _app_options.AppOptions.get("disableHistory")) { + return; + } + + this.pdfHistory.initialize({ + fingerprint: fingerprint, + resetHistory: viewOnLoad === ViewOnLoad.INITIAL, + updateUrl: _app_options.AppOptions.get("historyUpdateUrl") }); + + if (this.pdfHistory.initialBookmark) { + this.initialBookmark = this.pdfHistory.initialBookmark; + this.initialRotation = this.pdfHistory.initialRotation; + } + + if (initialDest && !this.initialBookmark && viewOnLoad === ViewOnLoad.UNKNOWN) { + this.initialBookmark = JSON.stringify(initialDest); + this.pdfHistory.push({ + explicitDest: initialDest, + pageNumber: null + }); + } + }, + _initializePermissions: function _initializePermissions(pdfDocument) { + var _this14 = this; + + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee12() { + var permissions; + return _regenerator["default"].wrap(function _callee12$(_context12) { + while (1) { + switch (_context12.prev = _context12.next) { + case 0: + _context12.next = 2; + return pdfDocument.getPermissions(); + + case 2: + permissions = _context12.sent; + + if (!(pdfDocument !== _this14.pdfDocument)) { + _context12.next = 5; + break; + } + + return _context12.abrupt("return"); + + case 5: + if (!(!permissions || !_app_options.AppOptions.get("enablePermissions"))) { + _context12.next = 7; + break; + } + + return _context12.abrupt("return"); + + case 7: + if (!permissions.includes(_pdfjsLib.PermissionFlag.COPY)) { + _this14.appConfig.viewerContainer.classList.add(ENABLE_PERMISSIONS_CLASS); + } + + case 8: + case "end": + return _context12.stop(); + } + } + }, _callee12); + }))(); }, setInitialView: function setInitialView(storedHash) { - var _this6 = this; + var _this15 = this; - var _ref13 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - rotation = _ref13.rotation, - sidebarView = _ref13.sidebarView, - scrollMode = _ref13.scrollMode, - spreadMode = _ref13.spreadMode; + var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + rotation = _ref6.rotation, + sidebarView = _ref6.sidebarView, + scrollMode = _ref6.scrollMode, + spreadMode = _ref6.spreadMode; var setRotation = function setRotation(angle) { if ((0, _ui_utils.isValidRotation)(angle)) { - _this6.pdfViewer.pagesRotation = angle; + _this15.pdfViewer.pagesRotation = angle; } }; + var setViewerModes = function setViewerModes(scroll, spread) { - if (Number.isInteger(scroll)) { - _this6.pdfViewer.scrollMode = scroll; + if ((0, _ui_utils.isValidScrollMode)(scroll)) { + _this15.pdfViewer.scrollMode = scroll; } - if (Number.isInteger(spread)) { - _this6.pdfViewer.spreadMode = spread; + + if ((0, _ui_utils.isValidSpreadMode)(spread)) { + _this15.pdfViewer.spreadMode = spread; } }; - setViewerModes(scrollMode, spreadMode); + this.isInitialViewSet = true; this.pdfSidebar.setInitialView(sidebarView); + setViewerModes(scrollMode, spreadMode); + if (this.initialBookmark) { setRotation(this.initialRotation); delete this.initialRotation; @@ -1344,8 +1856,10 @@ var PDFViewerApplication = { setRotation(rotation); this.pdfLinkService.setHash(storedHash); } + this.toolbar.setPageNumber(this.pdfViewer.currentPageNumber, this.pdfViewer.currentPageLabel); this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber); + if (!this.pdfViewer.currentScaleValue) { this.pdfViewer.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE; } @@ -1354,8 +1868,10 @@ var PDFViewerApplication = { if (!this.pdfDocument) { return; } + this.pdfViewer.cleanup(); this.pdfThumbnailViewer.cleanup(); + if (this.pdfViewer.renderer !== _ui_utils.RendererType.SVG) { this.pdfDocument.cleanup(); } @@ -1366,42 +1882,49 @@ var PDFViewerApplication = { this.pdfRenderingQueue.renderHighestPriority(); }, beforePrint: function beforePrint() { - var _this7 = this; + var _this16 = this; if (this.printService) { return; } + if (!this.supportsPrinting) { - this.l10n.get('printing_not_supported', null, 'Warning: Printing is not fully supported by ' + 'this browser.').then(function (printMessage) { - _this7.error(printMessage); + this.l10n.get("printing_not_supported", null, "Warning: Printing is not fully supported by this browser.").then(function (printMessage) { + _this16.error(printMessage); }); return; } + if (!this.pdfViewer.pageViewsReady) { - this.l10n.get('printing_not_ready', null, 'Warning: The PDF is not fully loaded for printing.').then(function (notReadyMessage) { + this.l10n.get("printing_not_ready", null, "Warning: The PDF is not fully loaded for printing.").then(function (notReadyMessage) { window.alert(notReadyMessage); }); return; } + var pagesOverview = this.pdfViewer.getPagesOverview(); var printContainer = this.appConfig.printContainer; var printService = PDFPrintServiceFactory.instance.createPrintService(this.pdfDocument, pagesOverview, printContainer, this.l10n); this.printService = printService; this.forceRendering(); printService.layout(); + this.externalServices.reportTelemetry({ + type: "print" + }); }, - - afterPrint: function pdfViewSetupAfterPrint() { + afterPrint: function afterPrint() { if (this.printService) { this.printService.destroy(); this.printService = null; } + this.forceRendering(); }, rotatePages: function rotatePages(delta) { if (!this.pdfDocument) { return; } + var newRotation = (this.pdfViewer.pagesRotation + 360 + delta) % 360; this.pdfViewer.pagesRotation = newRotation; }, @@ -1409,365 +1932,551 @@ var PDFViewerApplication = { if (!this.pdfPresentationMode) { return; } + this.pdfPresentationMode.request(); }, bindEvents: function bindEvents() { var eventBus = this.eventBus, _boundEvents = this._boundEvents; - _boundEvents.beforePrint = this.beforePrint.bind(this); _boundEvents.afterPrint = this.afterPrint.bind(this); - eventBus.on('resize', webViewerResize); - eventBus.on('hashchange', webViewerHashchange); - eventBus.on('beforeprint', _boundEvents.beforePrint); - eventBus.on('afterprint', _boundEvents.afterPrint); - eventBus.on('pagerendered', webViewerPageRendered); - eventBus.on('textlayerrendered', webViewerTextLayerRendered); - eventBus.on('updateviewarea', webViewerUpdateViewarea); - eventBus.on('pagechanging', webViewerPageChanging); - eventBus.on('scalechanging', webViewerScaleChanging); - eventBus.on('rotationchanging', webViewerRotationChanging); - eventBus.on('sidebarviewchanged', webViewerSidebarViewChanged); - eventBus.on('pagemode', webViewerPageMode); - eventBus.on('namedaction', webViewerNamedAction); - eventBus.on('presentationmodechanged', webViewerPresentationModeChanged); - eventBus.on('presentationmode', webViewerPresentationMode); - eventBus.on('openfile', webViewerOpenFile); - eventBus.on('print', webViewerPrint); - eventBus.on('download', webViewerDownload); - eventBus.on('firstpage', webViewerFirstPage); - eventBus.on('lastpage', webViewerLastPage); - eventBus.on('nextpage', webViewerNextPage); - eventBus.on('previouspage', webViewerPreviousPage); - eventBus.on('zoomin', webViewerZoomIn); - eventBus.on('zoomout', webViewerZoomOut); - eventBus.on('pagenumberchanged', webViewerPageNumberChanged); - eventBus.on('scalechanged', webViewerScaleChanged); - eventBus.on('rotatecw', webViewerRotateCw); - eventBus.on('rotateccw', webViewerRotateCcw); - eventBus.on('switchscrollmode', webViewerSwitchScrollMode); - eventBus.on('scrollmodechanged', webViewerScrollModeChanged); - eventBus.on('switchspreadmode', webViewerSwitchSpreadMode); - eventBus.on('spreadmodechanged', webViewerSpreadModeChanged); - eventBus.on('documentproperties', webViewerDocumentProperties); - eventBus.on('find', webViewerFind); - eventBus.on('findfromurlhash', webViewerFindFromUrlHash); - eventBus.on('updatefindmatchescount', webViewerUpdateFindMatchesCount); - eventBus.on('updatefindcontrolstate', webViewerUpdateFindControlState); - eventBus.on('fileinputchange', webViewerFileInputChange); - }, - bindWindowEvents: function bindWindowEvents() { - var eventBus = this.eventBus, - _boundEvents = this._boundEvents; - _boundEvents.windowResize = function () { - eventBus.dispatch('resize', { source: window }); - }; - _boundEvents.windowHashChange = function () { - eventBus.dispatch('hashchange', { - source: window, - hash: document.location.hash.substring(1) - }); - }; - _boundEvents.windowBeforePrint = function () { - eventBus.dispatch('beforeprint', { source: window }); - }; - _boundEvents.windowAfterPrint = function () { - eventBus.dispatch('afterprint', { source: window }); - }; - window.addEventListener('wheel', webViewerWheel); - window.addEventListener('click', webViewerClick); - window.addEventListener('keydown', webViewerKeyDown); - window.addEventListener('resize', _boundEvents.windowResize); - window.addEventListener('hashchange', _boundEvents.windowHashChange); - window.addEventListener('beforeprint', _boundEvents.windowBeforePrint); - window.addEventListener('afterprint', _boundEvents.windowAfterPrint); - }, - unbindEvents: function unbindEvents() { - var eventBus = this.eventBus, - _boundEvents = this._boundEvents; + eventBus._on("resize", webViewerResize); + + eventBus._on("hashchange", webViewerHashchange); + + eventBus._on("beforeprint", _boundEvents.beforePrint); + + eventBus._on("afterprint", _boundEvents.afterPrint); + + eventBus._on("pagerendered", webViewerPageRendered); + + eventBus._on("updateviewarea", webViewerUpdateViewarea); + + eventBus._on("pagechanging", webViewerPageChanging); + + eventBus._on("scalechanging", webViewerScaleChanging); + + eventBus._on("rotationchanging", webViewerRotationChanging); + + eventBus._on("sidebarviewchanged", webViewerSidebarViewChanged); + + eventBus._on("pagemode", webViewerPageMode); + + eventBus._on("namedaction", webViewerNamedAction); + + eventBus._on("presentationmodechanged", webViewerPresentationModeChanged); + + eventBus._on("presentationmode", webViewerPresentationMode); + + eventBus._on("print", webViewerPrint); + + eventBus._on("download", webViewerDownload); + + eventBus._on("firstpage", webViewerFirstPage); + + eventBus._on("lastpage", webViewerLastPage); + + eventBus._on("nextpage", webViewerNextPage); + + eventBus._on("previouspage", webViewerPreviousPage); + + eventBus._on("zoomin", webViewerZoomIn); + + eventBus._on("zoomout", webViewerZoomOut); + + eventBus._on("zoomreset", webViewerZoomReset); + + eventBus._on("pagenumberchanged", webViewerPageNumberChanged); + + eventBus._on("scalechanged", webViewerScaleChanged); + + eventBus._on("rotatecw", webViewerRotateCw); + + eventBus._on("rotateccw", webViewerRotateCcw); + + eventBus._on("switchscrollmode", webViewerSwitchScrollMode); + + eventBus._on("scrollmodechanged", webViewerScrollModeChanged); + + eventBus._on("switchspreadmode", webViewerSwitchSpreadMode); + + eventBus._on("spreadmodechanged", webViewerSpreadModeChanged); + + eventBus._on("documentproperties", webViewerDocumentProperties); + + eventBus._on("find", webViewerFind); + + eventBus._on("findfromurlhash", webViewerFindFromUrlHash); + + eventBus._on("updatefindmatchescount", webViewerUpdateFindMatchesCount); + + eventBus._on("updatefindcontrolstate", webViewerUpdateFindControlState); + + eventBus._on("fileinputchange", webViewerFileInputChange); + + eventBus._on("openfile", webViewerOpenFile); + }, + bindWindowEvents: function bindWindowEvents() { + var eventBus = this.eventBus, + _boundEvents = this._boundEvents; + + _boundEvents.windowResize = function () { + eventBus.dispatch("resize", { + source: window + }); + }; + + _boundEvents.windowHashChange = function () { + eventBus.dispatch("hashchange", { + source: window, + hash: document.location.hash.substring(1) + }); + }; + + _boundEvents.windowBeforePrint = function () { + eventBus.dispatch("beforeprint", { + source: window + }); + }; + + _boundEvents.windowAfterPrint = function () { + eventBus.dispatch("afterprint", { + source: window + }); + }; + + window.addEventListener("visibilitychange", webViewerVisibilityChange); + window.addEventListener("wheel", webViewerWheel, { + passive: false + }); + window.addEventListener("click", webViewerClick); + window.addEventListener("keydown", webViewerKeyDown); + window.addEventListener("resize", _boundEvents.windowResize); + window.addEventListener("hashchange", _boundEvents.windowHashChange); + window.addEventListener("beforeprint", _boundEvents.windowBeforePrint); + window.addEventListener("afterprint", _boundEvents.windowAfterPrint); + }, + unbindEvents: function unbindEvents() { + var eventBus = this.eventBus, + _boundEvents = this._boundEvents; + + eventBus._off("resize", webViewerResize); + + eventBus._off("hashchange", webViewerHashchange); + + eventBus._off("beforeprint", _boundEvents.beforePrint); + + eventBus._off("afterprint", _boundEvents.afterPrint); + + eventBus._off("pagerendered", webViewerPageRendered); + + eventBus._off("updateviewarea", webViewerUpdateViewarea); + + eventBus._off("pagechanging", webViewerPageChanging); + + eventBus._off("scalechanging", webViewerScaleChanging); + + eventBus._off("rotationchanging", webViewerRotationChanging); + + eventBus._off("sidebarviewchanged", webViewerSidebarViewChanged); + + eventBus._off("pagemode", webViewerPageMode); + + eventBus._off("namedaction", webViewerNamedAction); + + eventBus._off("presentationmodechanged", webViewerPresentationModeChanged); + + eventBus._off("presentationmode", webViewerPresentationMode); + + eventBus._off("print", webViewerPrint); + + eventBus._off("download", webViewerDownload); + + eventBus._off("firstpage", webViewerFirstPage); + + eventBus._off("lastpage", webViewerLastPage); + + eventBus._off("nextpage", webViewerNextPage); + + eventBus._off("previouspage", webViewerPreviousPage); + + eventBus._off("zoomin", webViewerZoomIn); + + eventBus._off("zoomout", webViewerZoomOut); + + eventBus._off("zoomreset", webViewerZoomReset); + + eventBus._off("pagenumberchanged", webViewerPageNumberChanged); + + eventBus._off("scalechanged", webViewerScaleChanged); + + eventBus._off("rotatecw", webViewerRotateCw); + + eventBus._off("rotateccw", webViewerRotateCcw); + + eventBus._off("switchscrollmode", webViewerSwitchScrollMode); + + eventBus._off("scrollmodechanged", webViewerScrollModeChanged); + + eventBus._off("switchspreadmode", webViewerSwitchSpreadMode); + + eventBus._off("spreadmodechanged", webViewerSpreadModeChanged); + + eventBus._off("documentproperties", webViewerDocumentProperties); + + eventBus._off("find", webViewerFind); + + eventBus._off("findfromurlhash", webViewerFindFromUrlHash); + + eventBus._off("updatefindmatchescount", webViewerUpdateFindMatchesCount); + + eventBus._off("updatefindcontrolstate", webViewerUpdateFindControlState); + + eventBus._off("fileinputchange", webViewerFileInputChange); + + eventBus._off("openfile", webViewerOpenFile); - eventBus.off('resize', webViewerResize); - eventBus.off('hashchange', webViewerHashchange); - eventBus.off('beforeprint', _boundEvents.beforePrint); - eventBus.off('afterprint', _boundEvents.afterPrint); - eventBus.off('pagerendered', webViewerPageRendered); - eventBus.off('textlayerrendered', webViewerTextLayerRendered); - eventBus.off('updateviewarea', webViewerUpdateViewarea); - eventBus.off('pagechanging', webViewerPageChanging); - eventBus.off('scalechanging', webViewerScaleChanging); - eventBus.off('rotationchanging', webViewerRotationChanging); - eventBus.off('sidebarviewchanged', webViewerSidebarViewChanged); - eventBus.off('pagemode', webViewerPageMode); - eventBus.off('namedaction', webViewerNamedAction); - eventBus.off('presentationmodechanged', webViewerPresentationModeChanged); - eventBus.off('presentationmode', webViewerPresentationMode); - eventBus.off('openfile', webViewerOpenFile); - eventBus.off('print', webViewerPrint); - eventBus.off('download', webViewerDownload); - eventBus.off('firstpage', webViewerFirstPage); - eventBus.off('lastpage', webViewerLastPage); - eventBus.off('nextpage', webViewerNextPage); - eventBus.off('previouspage', webViewerPreviousPage); - eventBus.off('zoomin', webViewerZoomIn); - eventBus.off('zoomout', webViewerZoomOut); - eventBus.off('pagenumberchanged', webViewerPageNumberChanged); - eventBus.off('scalechanged', webViewerScaleChanged); - eventBus.off('rotatecw', webViewerRotateCw); - eventBus.off('rotateccw', webViewerRotateCcw); - eventBus.off('switchscrollmode', webViewerSwitchScrollMode); - eventBus.off('scrollmodechanged', webViewerScrollModeChanged); - eventBus.off('switchspreadmode', webViewerSwitchSpreadMode); - eventBus.off('spreadmodechanged', webViewerSpreadModeChanged); - eventBus.off('documentproperties', webViewerDocumentProperties); - eventBus.off('find', webViewerFind); - eventBus.off('findfromurlhash', webViewerFindFromUrlHash); - eventBus.off('updatefindmatchescount', webViewerUpdateFindMatchesCount); - eventBus.off('updatefindcontrolstate', webViewerUpdateFindControlState); - eventBus.off('fileinputchange', webViewerFileInputChange); _boundEvents.beforePrint = null; _boundEvents.afterPrint = null; }, unbindWindowEvents: function unbindWindowEvents() { var _boundEvents = this._boundEvents; - - window.removeEventListener('wheel', webViewerWheel); - window.removeEventListener('click', webViewerClick); - window.removeEventListener('keydown', webViewerKeyDown); - window.removeEventListener('resize', _boundEvents.windowResize); - window.removeEventListener('hashchange', _boundEvents.windowHashChange); - window.removeEventListener('beforeprint', _boundEvents.windowBeforePrint); - window.removeEventListener('afterprint', _boundEvents.windowAfterPrint); + window.removeEventListener("visibilitychange", webViewerVisibilityChange); + window.removeEventListener("wheel", webViewerWheel, { + passive: false + }); + window.removeEventListener("click", webViewerClick); + window.removeEventListener("keydown", webViewerKeyDown); + window.removeEventListener("resize", _boundEvents.windowResize); + window.removeEventListener("hashchange", _boundEvents.windowHashChange); + window.removeEventListener("beforeprint", _boundEvents.windowBeforePrint); + window.removeEventListener("afterprint", _boundEvents.windowAfterPrint); _boundEvents.windowResize = null; _boundEvents.windowHashChange = null; _boundEvents.windowBeforePrint = null; _boundEvents.windowAfterPrint = null; } }; -var validateFileURL = void 0; +exports.PDFViewerApplication = PDFViewerApplication; +var validateFileURL; { - var HOSTED_VIEWER_ORIGINS = ['null', 'http://mozilla.github.io', 'https://mozilla.github.io']; + var HOSTED_VIEWER_ORIGINS = ["null", "http://mozilla.github.io", "https://mozilla.github.io"]; + validateFileURL = function validateFileURL(file) { if (file === undefined) { return; } + try { - var viewerOrigin = new _pdfjsLib.URL(window.location.href).origin || 'null'; + var viewerOrigin = new URL(window.location.href).origin || "null"; + if (HOSTED_VIEWER_ORIGINS.includes(viewerOrigin)) { return; } - var _ref14 = new _pdfjsLib.URL(file, window.location.href), - origin = _ref14.origin, - protocol = _ref14.protocol; + var _URL = new URL(file, window.location.href), + origin = _URL.origin, + protocol = _URL.protocol; - if (origin !== viewerOrigin && protocol !== 'blob:') { - throw new Error('file origin does not match viewer\'s'); + if (origin !== viewerOrigin && protocol !== "blob:") { + throw new Error("file origin does not match viewer's"); } } catch (ex) { var message = ex && ex.message; - PDFViewerApplication.l10n.get('loading_error', null, 'An error occurred while loading the PDF.').then(function (loadingErrorMessage) { - PDFViewerApplication.error(loadingErrorMessage, { message: message }); + PDFViewerApplication.l10n.get("loading_error", null, "An error occurred while loading the PDF.").then(function (loadingErrorMessage) { + PDFViewerApplication.error(loadingErrorMessage, { + message: message + }); }); throw ex; } }; } + function loadFakeWorker() { - if (!_pdfjsLib.GlobalWorkerOptions.workerSrc) { - _pdfjsLib.GlobalWorkerOptions.workerSrc = _app_options.AppOptions.get('workerSrc'); - } - return (0, _pdfjsLib.loadScript)(_pdfjsLib.PDFWorker.getWorkerSrc()); + return _loadFakeWorker.apply(this, arguments); } + +function _loadFakeWorker() { + _loadFakeWorker = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee13() { + return _regenerator["default"].wrap(function _callee13$(_context13) { + while (1) { + switch (_context13.prev = _context13.next) { + case 0: + if (!_pdfjsLib.GlobalWorkerOptions.workerSrc) { + _pdfjsLib.GlobalWorkerOptions.workerSrc = _app_options.AppOptions.get("workerSrc"); + } + + return _context13.abrupt("return", (0, _pdfjsLib.loadScript)(_pdfjsLib.PDFWorker.getWorkerSrc())); + + case 2: + case "end": + return _context13.stop(); + } + } + }, _callee13); + })); + return _loadFakeWorker.apply(this, arguments); +} + function loadAndEnablePDFBug(enabledTabs) { var appConfig = PDFViewerApplication.appConfig; return (0, _pdfjsLib.loadScript)(appConfig.debuggerScriptPath).then(function () { PDFBug.enable(enabledTabs); PDFBug.init({ - OPS: _pdfjsLib.OPS, - createObjectURL: _pdfjsLib.createObjectURL + OPS: _pdfjsLib.OPS }, appConfig.mainContainer); }); } + function webViewerInitialized() { var appConfig = PDFViewerApplication.appConfig; - var file = void 0; + var file; var queryString = document.location.search.substring(1); var params = (0, _ui_utils.parseQueryString)(queryString); - file = 'file' in params ? params.file : _app_options.AppOptions.get('defaultUrl'); + file = "file" in params ? params.file : _app_options.AppOptions.get("defaultUrl"); validateFileURL(file); - var fileInput = document.createElement('input'); + var fileInput = document.createElement("input"); fileInput.id = appConfig.openFileInputName; - fileInput.className = 'fileInput'; - fileInput.setAttribute('type', 'file'); + fileInput.className = "fileInput"; + fileInput.setAttribute("type", "file"); fileInput.oncontextmenu = _ui_utils.noContextMenuHandler; document.body.appendChild(fileInput); + if (!window.File || !window.FileReader || !window.FileList || !window.Blob) { - appConfig.toolbar.openFile.setAttribute('hidden', 'true'); - appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true'); + appConfig.toolbar.openFile.setAttribute("hidden", "true"); + appConfig.secondaryToolbar.openFileButton.setAttribute("hidden", "true"); } else { fileInput.value = null; } - fileInput.addEventListener('change', function (evt) { + + fileInput.addEventListener("change", function (evt) { var files = evt.target.files; + if (!files || files.length === 0) { return; } - PDFViewerApplication.eventBus.dispatch('fileinputchange', { + + PDFViewerApplication.eventBus.dispatch("fileinputchange", { source: this, fileInput: evt.target }); }); - appConfig.mainContainer.addEventListener('dragover', function (evt) { + appConfig.mainContainer.addEventListener("dragover", function (evt) { evt.preventDefault(); - evt.dataTransfer.dropEffect = 'move'; + evt.dataTransfer.dropEffect = "move"; }); - appConfig.mainContainer.addEventListener('drop', function (evt) { + appConfig.mainContainer.addEventListener("drop", function (evt) { evt.preventDefault(); var files = evt.dataTransfer.files; + if (!files || files.length === 0) { return; } - PDFViewerApplication.eventBus.dispatch('fileinputchange', { + + PDFViewerApplication.eventBus.dispatch("fileinputchange", { source: this, fileInput: evt.dataTransfer }); }); + + if (!PDFViewerApplication.supportsDocumentFonts) { + _app_options.AppOptions.set("disableFontFace", true); + + PDFViewerApplication.l10n.get("web_fonts_disabled", null, "Web fonts are disabled: unable to use embedded PDF fonts.").then(function (msg) { + console.warn(msg); + }); + } + if (!PDFViewerApplication.supportsPrinting) { - appConfig.toolbar.print.classList.add('hidden'); - appConfig.secondaryToolbar.printButton.classList.add('hidden'); + appConfig.toolbar.print.classList.add("hidden"); + appConfig.secondaryToolbar.printButton.classList.add("hidden"); } + if (!PDFViewerApplication.supportsFullscreen) { - appConfig.toolbar.presentationModeButton.classList.add('hidden'); - appConfig.secondaryToolbar.presentationModeButton.classList.add('hidden'); + appConfig.toolbar.presentationModeButton.classList.add("hidden"); + appConfig.secondaryToolbar.presentationModeButton.classList.add("hidden"); } + if (PDFViewerApplication.supportsIntegratedFind) { - appConfig.toolbar.viewFind.classList.add('hidden'); + appConfig.toolbar.viewFind.classList.add("hidden"); } - appConfig.mainContainer.addEventListener('transitionend', function (evt) { + + appConfig.mainContainer.addEventListener("transitionend", function (evt) { if (evt.target === this) { - PDFViewerApplication.eventBus.dispatch('resize', { source: this }); + PDFViewerApplication.eventBus.dispatch("resize", { + source: this + }); } }, true); - appConfig.sidebar.toggleButton.addEventListener('click', function () { - PDFViewerApplication.pdfSidebar.toggle(); - }); + try { webViewerOpenFileViaURL(file); } catch (reason) { - PDFViewerApplication.l10n.get('loading_error', null, 'An error occurred while loading the PDF.').then(function (msg) { + PDFViewerApplication.l10n.get("loading_error", null, "An error occurred while loading the PDF.").then(function (msg) { PDFViewerApplication.error(msg, reason); }); } } -var webViewerOpenFileViaURL = void 0; + +var webViewerOpenFileViaURL; { webViewerOpenFileViaURL = function webViewerOpenFileViaURL(file) { - if (file && file.lastIndexOf('file:', 0) === 0) { + if (file && file.lastIndexOf("file:", 0) === 0) { PDFViewerApplication.setTitleUsingUrl(file); var xhr = new XMLHttpRequest(); + xhr.onload = function () { PDFViewerApplication.open(new Uint8Array(xhr.response)); }; - try { - xhr.open('GET', file); - xhr.responseType = 'arraybuffer'; - xhr.send(); - } catch (ex) { - throw ex; - } + + xhr.open("GET", file); + xhr.responseType = "arraybuffer"; + xhr.send(); return; } + if (file) { PDFViewerApplication.open(file); } }; } + +function webViewerResetPermissions() { + var appConfig = PDFViewerApplication.appConfig; + + if (!appConfig) { + return; + } + + appConfig.viewerContainer.classList.remove(ENABLE_PERMISSIONS_CLASS); +} + function webViewerPageRendered(evt) { var pageNumber = evt.pageNumber; var pageIndex = pageNumber - 1; var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex); + if (pageNumber === PDFViewerApplication.page) { PDFViewerApplication.toolbar.updateLoadingIndicatorState(false); } + if (!pageView) { return; } + if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) { var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(pageIndex); thumbnailView.setImage(pageView); } - if (typeof Stats !== 'undefined' && Stats.enabled && pageView.stats) { + + if (typeof Stats !== "undefined" && Stats.enabled && pageView.stats) { Stats.add(pageNumber, pageView.stats); } + if (pageView.error) { - PDFViewerApplication.l10n.get('rendering_error', null, 'An error occurred while rendering the page.').then(function (msg) { + PDFViewerApplication.l10n.get("rendering_error", null, "An error occurred while rendering the page.").then(function (msg) { PDFViewerApplication.error(msg, pageView.error); }); } + + PDFViewerApplication.externalServices.reportTelemetry({ + type: "pageInfo", + timestamp: evt.timestamp + }); + PDFViewerApplication.pdfDocument.getStats().then(function (stats) { + PDFViewerApplication.externalServices.reportTelemetry({ + type: "documentStats", + stats: stats + }); + }); } -function webViewerTextLayerRendered(evt) {} -function webViewerPageMode(evt) { - var mode = evt.mode, - view = void 0; + +function webViewerPageMode(_ref7) { + var mode = _ref7.mode; + var view; + switch (mode) { - case 'thumbs': + case "thumbs": view = _pdf_sidebar.SidebarView.THUMBS; break; - case 'bookmarks': - case 'outline': + + case "bookmarks": + case "outline": view = _pdf_sidebar.SidebarView.OUTLINE; break; - case 'attachments': + + case "attachments": view = _pdf_sidebar.SidebarView.ATTACHMENTS; break; - case 'none': + + case "none": view = _pdf_sidebar.SidebarView.NONE; break; + default: console.error('Invalid "pagemode" hash parameter: ' + mode); return; } + PDFViewerApplication.pdfSidebar.switchView(view, true); } + function webViewerNamedAction(evt) { var action = evt.action; + switch (action) { - case 'GoToPage': + case "GoToPage": PDFViewerApplication.appConfig.toolbar.pageNumber.select(); break; - case 'Find': + + case "Find": if (!PDFViewerApplication.supportsIntegratedFind) { PDFViewerApplication.findBar.toggle(); } + break; } } -function webViewerPresentationModeChanged(evt) { - var active = evt.active, - switchInProgress = evt.switchInProgress; - PDFViewerApplication.pdfViewer.presentationModeState = switchInProgress ? _ui_utils.PresentationModeState.CHANGING : active ? _ui_utils.PresentationModeState.FULLSCREEN : _ui_utils.PresentationModeState.NORMAL; +function webViewerPresentationModeChanged(_ref8) { + var active = _ref8.active, + switchInProgress = _ref8.switchInProgress; + var state = _ui_utils.PresentationModeState.NORMAL; + + if (switchInProgress) { + state = _ui_utils.PresentationModeState.CHANGING; + } else if (active) { + state = _ui_utils.PresentationModeState.FULLSCREEN; + } + + PDFViewerApplication.pdfViewer.presentationModeState = state; } + function webViewerSidebarViewChanged(evt) { PDFViewerApplication.pdfRenderingQueue.isThumbnailViewEnabled = PDFViewerApplication.pdfSidebar.isThumbnailViewVisible; var store = PDFViewerApplication.store; + if (store && PDFViewerApplication.isInitialViewSet) { - store.set('sidebarView', evt.view).catch(function () {}); + store.set("sidebarView", evt.view)["catch"](function () {}); } } + function webViewerUpdateViewarea(evt) { var location = evt.location, store = PDFViewerApplication.store; + if (store && PDFViewerApplication.isInitialViewSet) { store.setMultiple({ - 'page': location.pageNumber, - 'zoom': location.scale, - 'scrollLeft': location.left, - 'scrollTop': location.top, - 'rotation': location.rotation - }).catch(function () {}); + page: location.pageNumber, + zoom: location.scale, + scrollLeft: location.left, + scrollTop: location.top, + rotation: location.rotation + })["catch"](function () {}); } + var href = PDFViewerApplication.pdfLinkService.getAnchorUrl(location.pdfOpenParams); PDFViewerApplication.appConfig.toolbar.viewBookmark.href = href; PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href = href; @@ -1775,18 +2484,23 @@ function webViewerUpdateViewarea(evt) { var loading = currentPage.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED; PDFViewerApplication.toolbar.updateLoadingIndicatorState(loading); } + function webViewerScrollModeChanged(evt) { var store = PDFViewerApplication.store; + if (store && PDFViewerApplication.isInitialViewSet) { - store.set('scrollMode', evt.mode).catch(function () {}); + store.set("scrollMode", evt.mode)["catch"](function () {}); } } + function webViewerSpreadModeChanged(evt) { var store = PDFViewerApplication.store; + if (store && PDFViewerApplication.isInitialViewSet) { - store.set('spreadMode', evt.mode).catch(function () {}); + store.set("spreadMode", evt.mode)["catch"](function () {}); } } + function webViewerResize() { var pdfDocument = PDFViewerApplication.pdfDocument, pdfViewer = PDFViewerApplication.pdfViewer; @@ -1794,117 +2508,157 @@ function webViewerResize() { if (!pdfDocument) { return; } + var currentScaleValue = pdfViewer.currentScaleValue; - if (currentScaleValue === 'auto' || currentScaleValue === 'page-fit' || currentScaleValue === 'page-width') { + + if (currentScaleValue === "auto" || currentScaleValue === "page-fit" || currentScaleValue === "page-width") { pdfViewer.currentScaleValue = currentScaleValue; } + pdfViewer.update(); } + function webViewerHashchange(evt) { var hash = evt.hash; + if (!hash) { return; } + if (!PDFViewerApplication.isInitialViewSet) { PDFViewerApplication.initialBookmark = hash; } else if (!PDFViewerApplication.pdfHistory.popStateInProgress) { PDFViewerApplication.pdfLinkService.setHash(hash); } } -var webViewerFileInputChange = void 0; + +var webViewerFileInputChange, webViewerOpenFile; { webViewerFileInputChange = function webViewerFileInputChange(evt) { if (PDFViewerApplication.pdfViewer && PDFViewerApplication.pdfViewer.isInPresentationMode) { return; } + var file = evt.fileInput.files[0]; - if (_pdfjsLib.URL.createObjectURL && !_app_options.AppOptions.get('disableCreateObjectURL')) { - var _url = _pdfjsLib.URL.createObjectURL(file); + + if (!_app_options.AppOptions.get("disableCreateObjectURL")) { + var url = URL.createObjectURL(file); + if (file.name) { - _url = { - url: _url, + url = { + url: url, originalUrl: file.name }; } - PDFViewerApplication.open(_url); + + PDFViewerApplication.open(url); } else { PDFViewerApplication.setTitleUsingUrl(file.name); var fileReader = new FileReader(); - fileReader.onload = function webViewerChangeFileReaderOnload(evt) { - var buffer = evt.target.result; + + fileReader.onload = function webViewerChangeFileReaderOnload(event) { + var buffer = event.target.result; PDFViewerApplication.open(new Uint8Array(buffer)); }; + fileReader.readAsArrayBuffer(file); } + var appConfig = PDFViewerApplication.appConfig; - appConfig.toolbar.viewBookmark.setAttribute('hidden', 'true'); - appConfig.secondaryToolbar.viewBookmarkButton.setAttribute('hidden', 'true'); - appConfig.toolbar.download.setAttribute('hidden', 'true'); - appConfig.secondaryToolbar.downloadButton.setAttribute('hidden', 'true'); + appConfig.toolbar.viewBookmark.setAttribute("hidden", "true"); + appConfig.secondaryToolbar.viewBookmarkButton.setAttribute("hidden", "true"); + appConfig.toolbar.download.setAttribute("hidden", "true"); + appConfig.secondaryToolbar.downloadButton.setAttribute("hidden", "true"); + }; + + webViewerOpenFile = function webViewerOpenFile(evt) { + var openFileInputName = PDFViewerApplication.appConfig.openFileInputName; + document.getElementById(openFileInputName).click(); }; } + function webViewerPresentationMode() { PDFViewerApplication.requestPresentationMode(); } -function webViewerOpenFile() { - var openFileInputName = PDFViewerApplication.appConfig.openFileInputName; - document.getElementById(openFileInputName).click(); -} + function webViewerPrint() { window.print(); } + function webViewerDownload() { PDFViewerApplication.download(); } + function webViewerFirstPage() { if (PDFViewerApplication.pdfDocument) { PDFViewerApplication.page = 1; } } + function webViewerLastPage() { if (PDFViewerApplication.pdfDocument) { PDFViewerApplication.page = PDFViewerApplication.pagesCount; } } + function webViewerNextPage() { PDFViewerApplication.page++; } + function webViewerPreviousPage() { PDFViewerApplication.page--; } + function webViewerZoomIn() { PDFViewerApplication.zoomIn(); } + function webViewerZoomOut() { PDFViewerApplication.zoomOut(); } + +function webViewerZoomReset() { + PDFViewerApplication.zoomReset(); +} + function webViewerPageNumberChanged(evt) { var pdfViewer = PDFViewerApplication.pdfViewer; - pdfViewer.currentPageLabel = evt.value; + + if (evt.value !== "") { + pdfViewer.currentPageLabel = evt.value; + } + if (evt.value !== pdfViewer.currentPageNumber.toString() && evt.value !== pdfViewer.currentPageLabel) { PDFViewerApplication.toolbar.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel); } } + function webViewerScaleChanged(evt) { PDFViewerApplication.pdfViewer.currentScaleValue = evt.value; } + function webViewerRotateCw() { PDFViewerApplication.rotatePages(90); } + function webViewerRotateCcw() { PDFViewerApplication.rotatePages(-90); } + function webViewerSwitchScrollMode(evt) { PDFViewerApplication.pdfViewer.scrollMode = evt.mode; } + function webViewerSwitchSpreadMode(evt) { PDFViewerApplication.pdfViewer.spreadMode = evt.mode; } + function webViewerDocumentProperties() { PDFViewerApplication.pdfDocumentProperties.open(); } + function webViewerFind(evt) { - PDFViewerApplication.findController.executeCommand('find' + evt.type, { + PDFViewerApplication.findController.executeCommand("find" + evt.type, { query: evt.query, phraseSearch: evt.phraseSearch, caseSensitive: evt.caseSensitive, @@ -1913,8 +2667,9 @@ function webViewerFind(evt) { findPrevious: evt.findPrevious }); } + function webViewerFindFromUrlHash(evt) { - PDFViewerApplication.findController.executeCommand('find', { + PDFViewerApplication.findController.executeCommand("find", { query: evt.query, phraseSearch: evt.phraseSearch, caseSensitive: false, @@ -1923,8 +2678,9 @@ function webViewerFindFromUrlHash(evt) { findPrevious: false }); } -function webViewerUpdateFindMatchesCount(_ref15) { - var matchesCount = _ref15.matchesCount; + +function webViewerUpdateFindMatchesCount(_ref9) { + var matchesCount = _ref9.matchesCount; if (PDFViewerApplication.supportsIntegratedFind) { PDFViewerApplication.externalServices.updateFindMatchesCount(matchesCount); @@ -1932,10 +2688,11 @@ function webViewerUpdateFindMatchesCount(_ref15) { PDFViewerApplication.findBar.updateResultsCount(matchesCount); } } -function webViewerUpdateFindControlState(_ref16) { - var state = _ref16.state, - previous = _ref16.previous, - matchesCount = _ref16.matchesCount; + +function webViewerUpdateFindControlState(_ref10) { + var state = _ref10.state, + previous = _ref10.previous, + matchesCount = _ref10.matchesCount; if (PDFViewerApplication.supportsIntegratedFind) { PDFViewerApplication.externalServices.updateFindControlState({ @@ -1947,55 +2704,82 @@ function webViewerUpdateFindControlState(_ref16) { PDFViewerApplication.findBar.updateUIState(state, previous, matchesCount); } } + function webViewerScaleChanging(evt) { PDFViewerApplication.toolbar.setPageScale(evt.presetValue, evt.scale); PDFViewerApplication.pdfViewer.update(); } + function webViewerRotationChanging(evt) { PDFViewerApplication.pdfThumbnailViewer.pagesRotation = evt.pagesRotation; PDFViewerApplication.forceRendering(); PDFViewerApplication.pdfViewer.currentPageNumber = evt.pageNumber; } + function webViewerPageChanging(evt) { var page = evt.pageNumber; PDFViewerApplication.toolbar.setPageNumber(page, evt.pageLabel || null); PDFViewerApplication.secondaryToolbar.setPageNumber(page); + if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) { PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page); } - if (typeof Stats !== 'undefined' && Stats.enabled) { + + if (typeof Stats !== "undefined" && Stats.enabled) { var pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1); + if (pageView && pageView.stats) { Stats.add(page, pageView.stats); } } } -var zoomDisabled = false, - zoomDisabledTimeout = void 0; + +function webViewerVisibilityChange(evt) { + if (document.visibilityState === "visible") { + setZoomDisabledTimeout(); + } +} + +var zoomDisabledTimeout = null; + +function setZoomDisabledTimeout() { + if (zoomDisabledTimeout) { + clearTimeout(zoomDisabledTimeout); + } + + zoomDisabledTimeout = setTimeout(function () { + zoomDisabledTimeout = null; + }, WHEEL_ZOOM_DISABLED_TIMEOUT); +} + function webViewerWheel(evt) { - var pdfViewer = PDFViewerApplication.pdfViewer; + var pdfViewer = PDFViewerApplication.pdfViewer, + supportedMouseWheelZoomModifierKeys = PDFViewerApplication.supportedMouseWheelZoomModifierKeys; + if (pdfViewer.isInPresentationMode) { return; } - if (evt.ctrlKey || evt.metaKey) { - var support = PDFViewerApplication.supportedMouseWheelZoomModifierKeys; - if (evt.ctrlKey && !support.ctrlKey || evt.metaKey && !support.metaKey) { - return; - } + + if (evt.ctrlKey && supportedMouseWheelZoomModifierKeys.ctrlKey || evt.metaKey && supportedMouseWheelZoomModifierKeys.metaKey) { evt.preventDefault(); - if (zoomDisabled) { + + if (zoomDisabledTimeout || document.visibilityState === "hidden") { return; } + var previousScale = pdfViewer.currentScale; var delta = (0, _ui_utils.normalizeWheelEventDelta)(evt); var MOUSE_WHEEL_DELTA_PER_PAGE_SCALE = 3.0; var ticks = delta * MOUSE_WHEEL_DELTA_PER_PAGE_SCALE; + if (ticks < 0) { PDFViewerApplication.zoomOut(-ticks); } else { PDFViewerApplication.zoomIn(ticks); } + var currentScale = pdfViewer.currentScale; + if (previousScale !== currentScale) { var scaleCorrectionFactor = currentScale / previousScale - 1; var rect = pdfViewer.container.getBoundingClientRect(); @@ -2005,31 +2789,33 @@ function webViewerWheel(evt) { pdfViewer.container.scrollTop += dy * scaleCorrectionFactor; } } else { - zoomDisabled = true; - clearTimeout(zoomDisabledTimeout); - zoomDisabledTimeout = setTimeout(function () { - zoomDisabled = false; - }, 1000); + setZoomDisabledTimeout(); } } + function webViewerClick(evt) { if (!PDFViewerApplication.secondaryToolbar.isOpen) { return; } + var appConfig = PDFViewerApplication.appConfig; + if (PDFViewerApplication.pdfViewer.containsElement(evt.target) || appConfig.toolbar.container.contains(evt.target) && evt.target !== appConfig.secondaryToolbar.toggleButton) { PDFViewerApplication.secondaryToolbar.close(); } } + function webViewerKeyDown(evt) { if (PDFViewerApplication.overlayManager.active) { return; } + var handled = false, ensureViewerFocused = false; var cmd = (evt.ctrlKey ? 1 : 0) | (evt.altKey ? 2 : 0) | (evt.shiftKey ? 4 : 0) | (evt.metaKey ? 8 : 0); var pdfViewer = PDFViewerApplication.pdfViewer; var isViewerInPresentationMode = pdfViewer && pdfViewer.isInPresentationMode; + if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) { switch (evt.keyCode) { case 70: @@ -2037,12 +2823,15 @@ function webViewerKeyDown(evt) { PDFViewerApplication.findBar.open(); handled = true; } + break; + case 71: if (!PDFViewerApplication.supportsIntegratedFind) { var findState = PDFViewerApplication.findController.state; + if (findState) { - PDFViewerApplication.findController.executeCommand('findagain', { + PDFViewerApplication.findController.executeCommand("findagain", { query: findState.query, phraseSearch: findState.phraseSearch, caseSensitive: findState.caseSensitive, @@ -2051,9 +2840,12 @@ function webViewerKeyDown(evt) { findPrevious: cmd === 5 || cmd === 12 }); } + handled = true; } + break; + case 61: case 107: case 187: @@ -2061,157 +2853,214 @@ function webViewerKeyDown(evt) { if (!isViewerInPresentationMode) { PDFViewerApplication.zoomIn(); } + handled = true; break; + case 173: case 109: case 189: if (!isViewerInPresentationMode) { PDFViewerApplication.zoomOut(); } + handled = true; break; + case 48: case 96: if (!isViewerInPresentationMode) { setTimeout(function () { - pdfViewer.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE; + PDFViewerApplication.zoomReset(); }); handled = false; } + break; + case 38: if (isViewerInPresentationMode || PDFViewerApplication.page > 1) { PDFViewerApplication.page = 1; handled = true; ensureViewerFocused = true; } + break; + case 40: if (isViewerInPresentationMode || PDFViewerApplication.page < PDFViewerApplication.pagesCount) { PDFViewerApplication.page = PDFViewerApplication.pagesCount; handled = true; ensureViewerFocused = true; } + break; } } + + var eventBus = PDFViewerApplication.eventBus; + if (cmd === 1 || cmd === 8) { switch (evt.keyCode) { case 83: - PDFViewerApplication.download(); + eventBus.dispatch("download", { + source: window + }); handled = true; break; + + case 79: + { + eventBus.dispatch("openfile", { + source: window + }); + handled = true; + } + break; } } + if (cmd === 3 || cmd === 10) { switch (evt.keyCode) { case 80: PDFViewerApplication.requestPresentationMode(); handled = true; break; + case 71: PDFViewerApplication.appConfig.toolbar.pageNumber.select(); handled = true; break; } } + if (handled) { if (ensureViewerFocused && !isViewerInPresentationMode) { pdfViewer.focus(); } + evt.preventDefault(); return; } - var curElement = document.activeElement || document.querySelector(':focus'); + + var curElement = document.activeElement || document.querySelector(":focus"); var curElementTagName = curElement && curElement.tagName.toUpperCase(); - if (curElementTagName === 'INPUT' || curElementTagName === 'TEXTAREA' || curElementTagName === 'SELECT') { + + if (curElementTagName === "INPUT" || curElementTagName === "TEXTAREA" || curElementTagName === "SELECT" || curElement && curElement.isContentEditable) { if (evt.keyCode !== 27) { return; } } + if (cmd === 0) { var turnPage = 0, turnOnlyIfPageFit = false; + switch (evt.keyCode) { case 38: case 33: if (pdfViewer.isVerticalScrollbarEnabled) { turnOnlyIfPageFit = true; } + turnPage = -1; break; + case 8: if (!isViewerInPresentationMode) { turnOnlyIfPageFit = true; } + turnPage = -1; break; + case 37: if (pdfViewer.isHorizontalScrollbarEnabled) { turnOnlyIfPageFit = true; } + case 75: case 80: turnPage = -1; break; + case 27: if (PDFViewerApplication.secondaryToolbar.isOpen) { PDFViewerApplication.secondaryToolbar.close(); handled = true; } + if (!PDFViewerApplication.supportsIntegratedFind && PDFViewerApplication.findBar.opened) { PDFViewerApplication.findBar.close(); handled = true; } + break; + case 40: case 34: if (pdfViewer.isVerticalScrollbarEnabled) { turnOnlyIfPageFit = true; } + turnPage = 1; break; + case 13: case 32: if (!isViewerInPresentationMode) { turnOnlyIfPageFit = true; } + turnPage = 1; break; + case 39: if (pdfViewer.isHorizontalScrollbarEnabled) { turnOnlyIfPageFit = true; } + case 74: case 78: turnPage = 1; break; + case 36: if (isViewerInPresentationMode || PDFViewerApplication.page > 1) { PDFViewerApplication.page = 1; handled = true; ensureViewerFocused = true; } + break; + case 35: if (isViewerInPresentationMode || PDFViewerApplication.page < PDFViewerApplication.pagesCount) { PDFViewerApplication.page = PDFViewerApplication.pagesCount; handled = true; ensureViewerFocused = true; } + break; + case 83: PDFViewerApplication.pdfCursorTools.switchTool(_pdf_cursor_tools.CursorTool.SELECT); break; + case 72: PDFViewerApplication.pdfCursorTools.switchTool(_pdf_cursor_tools.CursorTool.HAND); break; + case 82: PDFViewerApplication.rotatePages(90); break; + + case 115: + PDFViewerApplication.pdfSidebar.toggle(); + break; } - if (turnPage !== 0 && (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === 'page-fit')) { + + if (turnPage !== 0 && (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === "page-fit")) { if (turnPage > 0) { if (PDFViewerApplication.page < PDFViewerApplication.pagesCount) { PDFViewerApplication.page++; @@ -2221,62 +3070,93 @@ function webViewerKeyDown(evt) { PDFViewerApplication.page--; } } + handled = true; } } + if (cmd === 4) { switch (evt.keyCode) { case 13: case 32: - if (!isViewerInPresentationMode && pdfViewer.currentScaleValue !== 'page-fit') { + if (!isViewerInPresentationMode && pdfViewer.currentScaleValue !== "page-fit") { break; } + if (PDFViewerApplication.page > 1) { PDFViewerApplication.page--; } + handled = true; break; + case 82: PDFViewerApplication.rotatePages(-90); break; } } + if (!handled && !isViewerInPresentationMode) { - if (evt.keyCode >= 33 && evt.keyCode <= 40 || evt.keyCode === 32 && curElementTagName !== 'BUTTON') { + if (evt.keyCode >= 33 && evt.keyCode <= 40 || evt.keyCode === 32 && curElementTagName !== "BUTTON") { ensureViewerFocused = true; } } + if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) { pdfViewer.focus(); } + if (handled) { evt.preventDefault(); } } + +function apiPageLayoutToSpreadMode(layout) { + switch (layout) { + case "SinglePage": + case "OneColumn": + return _ui_utils.SpreadMode.NONE; + + case "TwoColumnLeft": + case "TwoPageLeft": + return _ui_utils.SpreadMode.ODD; + + case "TwoColumnRight": + case "TwoPageRight": + return _ui_utils.SpreadMode.EVEN; + } + + return _ui_utils.SpreadMode.NONE; +} + function apiPageModeToSidebarView(mode) { switch (mode) { - case 'UseNone': + case "UseNone": return _pdf_sidebar.SidebarView.NONE; - case 'UseThumbs': + + case "UseThumbs": return _pdf_sidebar.SidebarView.THUMBS; - case 'UseOutlines': + + case "UseOutlines": return _pdf_sidebar.SidebarView.OUTLINE; - case 'UseAttachments': + + case "UseAttachments": return _pdf_sidebar.SidebarView.ATTACHMENTS; - case 'UseOC': + + case "UseOC": } + return _pdf_sidebar.SidebarView.NONE; } + var PDFPrintServiceFactory = { instance: { supportsPrinting: false, createPrintService: function createPrintService() { - throw new Error('Not implemented: createPrintService'); + throw new Error("Not implemented: createPrintService"); } } }; -exports.PDFViewerApplication = PDFViewerApplication; -exports.DefaultExternalServices = DefaultExternalServices; exports.PDFPrintServiceFactory = PDFPrintServiceFactory; /***/ }), @@ -2292,36 +3172,12 @@ module.exports = __webpack_require__(3); /* 3 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - - -var g = function () { - return this; -}() || Function("return this")(); -var hadRuntime = g.regeneratorRuntime && Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; -var oldRuntime = hadRuntime && g.regeneratorRuntime; -g.regeneratorRuntime = undefined; -module.exports = __webpack_require__(4); -if (hadRuntime) { - g.regeneratorRuntime = oldRuntime; -} else { - try { - delete g.regeneratorRuntime; - } catch (e) { - g.regeneratorRuntime = undefined; - } -} - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - "use strict"; /* WEBPACK VAR INJECTION */(function(module) { -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -!function (global) { +var runtime = function (exports) { "use strict"; var Op = Object.prototype; @@ -2331,15 +3187,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - var inModule = ( false ? undefined : _typeof(module)) === "object"; - var runtime = global.regeneratorRuntime; - if (runtime) { - if (inModule) { - module.exports = runtime; - } - return; - } - runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); @@ -2347,7 +3195,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol generator._invoke = makeInvokeMethod(innerFn, self, context); return generator; } - runtime.wrap = wrap; + + exports.wrap = wrap; + function tryCatch(fn, obj, arg) { try { return { @@ -2361,27 +3211,37 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; } } + var GenStateSuspendedStart = "suspendedStart"; var GenStateSuspendedYield = "suspendedYield"; var GenStateExecuting = "executing"; var GenStateCompleted = "completed"; var ContinueSentinel = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { return this; }; + var getProto = Object.getPrototypeOf; var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { IteratorPrototype = NativeIteratorPrototype; } + var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; GeneratorFunctionPrototype.constructor = GeneratorFunction; GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; + function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { prototype[method] = function (arg) { @@ -2389,91 +3249,121 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; }); } - runtime.isGeneratorFunction = function (genFun) { + + exports.isGeneratorFunction = function (genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; - runtime.mark = function (genFun) { + + exports.mark = function (genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { genFun[toStringTagSymbol] = "GeneratorFunction"; } } + genFun.prototype = Object.create(Gp); return genFun; }; - runtime.awrap = function (arg) { - return { __await: arg }; + + exports.awrap = function (arg) { + return { + __await: arg + }; }; - function AsyncIterator(generator) { + + function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { reject(record.arg); } else { var result = record.arg; var value = result.value; - if (value && (typeof value === "undefined" ? "undefined" : _typeof(value)) === "object" && hasOwn.call(value, "__await")) { - return Promise.resolve(value.__await).then(function (value) { + + if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) { + return PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }); } - return Promise.resolve(value).then(function (unwrapped) { + + return PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped; resolve(result); - }, reject); + }, function (error) { + return invoke("throw", error, resolve, reject); + }); } } + var previousPromise; + function enqueue(method, arg) { function callInvokeWithMethodAndArg() { - return new Promise(function (resolve, reject) { + return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } + return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } + this._invoke = enqueue; } + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { return this; }; - runtime.AsyncIterator = AsyncIterator; - runtime.async = function (innerFn, outerFn, self, tryLocsList) { - var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList)); - return runtime.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { + + exports.AsyncIterator = AsyncIterator; + + exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { + if (PromiseImpl === void 0) PromiseImpl = Promise; + var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); + return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }; + function makeInvokeMethod(innerFn, self, context) { var state = GenStateSuspendedStart; return function invoke(method, arg) { if (state === GenStateExecuting) { throw new Error("Generator is already running"); } + if (state === GenStateCompleted) { if (method === "throw") { throw arg; } + return doneResult(); } + context.method = method; context.arg = arg; + while (true) { var delegate = context.delegate; + if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } + if (context.method === "next") { context.sent = context._sent = context.arg; } else if (context.method === "throw") { @@ -2481,17 +3371,22 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol state = GenStateCompleted; throw context.arg; } + context.dispatchException(context.arg); } else if (context.method === "return") { context.abrupt("return", context.arg); } + state = GenStateExecuting; var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { state = context.done ? GenStateCompleted : GenStateSuspendedYield; + if (record.arg === ContinueSentinel) { continue; } + return { value: record.arg, done: context.done @@ -2504,41 +3399,53 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } }; } + function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; + if (method === undefined) { context.delegate = null; + if (context.method === "throw") { - if (delegate.iterator.return) { + if (delegate.iterator["return"]) { context.method = "return"; context.arg = undefined; maybeInvokeDelegate(delegate, context); + if (context.method === "throw") { return ContinueSentinel; } } + context.method = "throw"; context.arg = new TypeError("The iterator does not provide a 'throw' method"); } + return ContinueSentinel; } + var record = tryCatch(method, delegate.iterator, context.arg); + if (record.type === "throw") { context.method = "throw"; context.arg = record.arg; context.delegate = null; return ContinueSentinel; } + var info = record.arg; + if (!info) { context.method = "throw"; context.arg = new TypeError("iterator result is not an object"); context.delegate = null; return ContinueSentinel; } + if (info.done) { context[delegate.resultName] = info.value; context.next = delegate.nextLoc; + if (context.method !== "return") { context.method = "next"; context.arg = undefined; @@ -2546,67 +3453,90 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } else { return info; } + context.delegate = null; return ContinueSentinel; } + defineIteratorMethods(Gp); Gp[toStringTagSymbol] = "Generator"; + Gp[iteratorSymbol] = function () { return this; }; + Gp.toString = function () { return "[object Generator]"; }; + function pushTryEntry(locs) { - var entry = { tryLoc: locs[0] }; + var entry = { + tryLoc: locs[0] + }; + if (1 in locs) { entry.catchLoc = locs[1]; } + if (2 in locs) { entry.finallyLoc = locs[2]; entry.afterLoc = locs[3]; } + this.tryEntries.push(entry); } + function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal"; delete record.arg; entry.completion = record; } + function Context(tryLocsList) { - this.tryEntries = [{ tryLoc: "root" }]; + this.tryEntries = [{ + tryLoc: "root" + }]; tryLocsList.forEach(pushTryEntry, this); this.reset(true); } - runtime.keys = function (object) { + + exports.keys = function (object) { var keys = []; + for (var key in object) { keys.push(key); } + keys.reverse(); return function next() { while (keys.length) { var key = keys.pop(); + if (key in object) { next.value = key; next.done = false; return next; } } + next.done = true; return next; }; }; + function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { return iteratorMethod.call(iterable); } + if (typeof iterable.next === "function") { return iterable; } + if (!isNaN(iterable.length)) { var i = -1, next = function next() { @@ -2617,22 +3547,30 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return next; } } + next.value = undefined; next.done = true; return next; }; + return next.next = next; } } - return { next: doneResult }; + + return { + next: doneResult + }; } - runtime.values = values; + + exports.values = values; + function doneResult() { return { value: undefined, done: true }; } + Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { @@ -2644,6 +3582,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol this.method = "next"; this.arg = undefined; this.tryEntries.forEach(resetTryEntry); + if (!skipTempReset) { for (var name in this) { if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { @@ -2656,35 +3595,45 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol this.done = true; var rootEntry = this.tryEntries[0]; var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { throw rootRecord.arg; } + return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) { throw exception; } + var context = this; + function handle(loc, caught) { record.type = "throw"; record.arg = exception; context.next = loc; + if (caught) { context.method = "next"; context.arg = undefined; } + return !!caught; } + for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; var record = entry.completion; + if (entry.tryLoc === "root") { return handle("end"); } + if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"); var hasFinally = hasOwn.call(entry, "finallyLoc"); + if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); @@ -2708,28 +3657,34 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } + if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { finallyEntry = null; } + var record = finallyEntry ? finallyEntry.completion : {}; record.type = type; record.arg = arg; + if (finallyEntry) { this.method = "next"; this.next = finallyEntry.finallyLoc; return ContinueSentinel; } + return this.complete(record); }, complete: function complete(record, afterLoc) { if (record.type === "throw") { throw record.arg; } + if (record.type === "break" || record.type === "continue") { this.next = record.arg; } else if (record.type === "return") { @@ -2739,11 +3694,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } else if (record.type === "normal" && afterLoc) { this.next = afterLoc; } + return ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { this.complete(entry.completion, entry.afterLoc); resetTryEntry(entry); @@ -2754,15 +3711,19 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { var record = entry.completion; + if (record.type === "throw") { var thrown = record.arg; resetTryEntry(entry); } + return thrown; } } + throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { @@ -2771,19 +3732,26 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol resultName: resultName, nextLoc: nextLoc }; + if (this.method === "next") { this.arg = undefined; } + return ContinueSentinel; } }; -}(function () { - return this; -}() || Function("return this")()); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5)(module))) + return exports; +}(( false ? undefined : _typeof(module)) === "object" ? module.exports : {}); + +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + Function("r", "regeneratorRuntime = r")(runtime); +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4)(module))) /***/ }), -/* 5 */ +/* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2792,6 +3760,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = function (module) { if (!module.webpackPolyfill) { module.deprecate = function () {}; + module.paths = []; if (!module.children) module.children = []; Object.defineProperty(module, "loaded", { @@ -2808,11 +3777,12 @@ module.exports = function (module) { }); module.webpackPolyfill = 1; } + return module; }; /***/ }), -/* 6 */ +/* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2821,143 +3791,184 @@ module.exports = function (module) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.moveToEndOfArray = exports.waitOnEventOrTimeout = exports.WaitOnType = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.getPageSizeInches = exports.roundToDivide = exports.getVisibleElements = exports.backtrackBeforeAllVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.TextLayerMode = exports.RendererType = exports.PresentationModeState = exports.isPortraitOrientation = exports.isValidRotation = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined; +exports.isValidRotation = isValidRotation; +exports.isValidScrollMode = isValidScrollMode; +exports.isValidSpreadMode = isValidSpreadMode; +exports.isPortraitOrientation = isPortraitOrientation; +exports.clamp = clamp; +exports.getPDFFileNameFromURL = getPDFFileNameFromURL; +exports.noContextMenuHandler = noContextMenuHandler; +exports.parseQueryString = parseQueryString; +exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements; +exports.getVisibleElements = getVisibleElements; +exports.roundToDivide = roundToDivide; +exports.getPageSizeInches = getPageSizeInches; +exports.approximateFraction = approximateFraction; +exports.getOutputScale = getOutputScale; +exports.scrollIntoView = scrollIntoView; +exports.watchScroll = watchScroll; +exports.binarySearchFirstItem = binarySearchFirstItem; +exports.normalizeWheelEventDelta = normalizeWheelEventDelta; +exports.waitOnEventOrTimeout = waitOnEventOrTimeout; +exports.moveToEndOfArray = moveToEndOfArray; +exports.WaitOnType = exports.animationStarted = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.SpreadMode = exports.ScrollMode = exports.TextLayerMode = exports.RendererType = exports.PresentationModeState = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = exports.AutoPrintRegExp = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); -var _regenerator = __webpack_require__(2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _regenerator2 = _interopRequireDefault(_regenerator); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } var CSS_UNITS = 96.0 / 72.0; -var DEFAULT_SCALE_VALUE = 'auto'; +exports.CSS_UNITS = CSS_UNITS; +var DEFAULT_SCALE_VALUE = "auto"; +exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE; var DEFAULT_SCALE = 1.0; -var MIN_SCALE = 0.10; +exports.DEFAULT_SCALE = DEFAULT_SCALE; +var MIN_SCALE = 0.1; +exports.MIN_SCALE = MIN_SCALE; var MAX_SCALE = 10.0; +exports.MAX_SCALE = MAX_SCALE; var UNKNOWN_SCALE = 0; +exports.UNKNOWN_SCALE = UNKNOWN_SCALE; var MAX_AUTO_SCALE = 1.25; +exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE; var SCROLLBAR_PADDING = 40; +exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING; var VERTICAL_PADDING = 5; +exports.VERTICAL_PADDING = VERTICAL_PADDING; var PresentationModeState = { UNKNOWN: 0, NORMAL: 1, CHANGING: 2, FULLSCREEN: 3 }; +exports.PresentationModeState = PresentationModeState; var RendererType = { - CANVAS: 'canvas', - SVG: 'svg' + CANVAS: "canvas", + SVG: "svg" }; +exports.RendererType = RendererType; var TextLayerMode = { DISABLE: 0, ENABLE: 1, ENABLE_ENHANCE: 2 }; +exports.TextLayerMode = TextLayerMode; +var ScrollMode = { + UNKNOWN: -1, + VERTICAL: 0, + HORIZONTAL: 1, + WRAPPED: 2 +}; +exports.ScrollMode = ScrollMode; +var SpreadMode = { + UNKNOWN: -1, + NONE: 0, + ODD: 1, + EVEN: 2 +}; +exports.SpreadMode = SpreadMode; +var AutoPrintRegExp = /\bprint\s*\(/; +exports.AutoPrintRegExp = AutoPrintRegExp; + function formatL10nValue(text, args) { if (!args) { return text; } + return text.replace(/\{\{\s*(\w+)\s*\}\}/g, function (all, name) { - return name in args ? args[name] : '{{' + name + '}}'; + return name in args ? args[name] : "{{" + name + "}}"; }); } + var NullL10n = { - getLanguage: function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { - return _regenerator2.default.wrap(function _callee$(_context) { + getLanguage: function getLanguage() { + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: - return _context.abrupt('return', 'en-us'); + return _context.abrupt("return", "en-us"); case 1: - case 'end': + case "end": return _context.stop(); } } - }, _callee, this); - })); - - function getLanguage() { - return _ref.apply(this, arguments); - } - - return getLanguage; - }(), - getDirection: function () { - var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() { - return _regenerator2.default.wrap(function _callee2$(_context2) { + }, _callee); + }))(); + }, + getDirection: function getDirection() { + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: - return _context2.abrupt('return', 'ltr'); + return _context2.abrupt("return", "ltr"); case 1: - case 'end': + case "end": return _context2.stop(); } } - }, _callee2, this); - })); - - function getDirection() { - return _ref2.apply(this, arguments); - } - - return getDirection; - }(), - get: function () { - var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee3(property, args, fallback) { - return _regenerator2.default.wrap(function _callee3$(_context3) { + }, _callee2); + }))(); + }, + get: function get(property, args, fallback) { + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: - return _context3.abrupt('return', formatL10nValue(fallback, args)); + return _context3.abrupt("return", formatL10nValue(fallback, args)); case 1: - case 'end': + case "end": return _context3.stop(); } } - }, _callee3, this); - })); - - function get(_x, _x2, _x3) { - return _ref3.apply(this, arguments); - } - - return get; - }(), - translate: function () { - var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee4(element) { - return _regenerator2.default.wrap(function _callee4$(_context4) { + }, _callee3); + }))(); + }, + translate: function translate(element) { + return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: - case 'end': + case "end": return _context4.stop(); } } - }, _callee4, this); - })); - - function translate(_x4) { - return _ref4.apply(this, arguments); - } - - return translate; - }() + }, _callee4); + }))(); + } }; +exports.NullL10n = NullL10n; + function getOutputScale(ctx) { var devicePixelRatio = window.devicePixelRatio || 1; var backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1; @@ -2968,61 +3979,76 @@ function getOutputScale(ctx) { scaled: pixelRatio !== 1 }; } + function scrollIntoView(element, spot) { var skipOverflowHiddenElements = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var parent = element.offsetParent; + if (!parent) { - console.error('offsetParent is not set -- cannot scroll'); + console.error("offsetParent is not set -- cannot scroll"); return; } + var offsetY = element.offsetTop + element.clientTop; var offsetX = element.offsetLeft + element.clientLeft; - while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || skipOverflowHiddenElements && getComputedStyle(parent).overflow === 'hidden') { + + while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || skipOverflowHiddenElements && getComputedStyle(parent).overflow === "hidden") { if (parent.dataset._scaleY) { offsetY /= parent.dataset._scaleY; offsetX /= parent.dataset._scaleX; } + offsetY += parent.offsetTop; offsetX += parent.offsetLeft; parent = parent.offsetParent; + if (!parent) { return; } } + if (spot) { if (spot.top !== undefined) { offsetY += spot.top; } + if (spot.left !== undefined) { offsetX += spot.left; parent.scrollLeft = offsetX; } } + parent.scrollTop = offsetY; } + function watchScroll(viewAreaElement, callback) { var debounceScroll = function debounceScroll(evt) { if (rAF) { return; } + rAF = window.requestAnimationFrame(function viewAreaElementScrolled() { rAF = null; var currentX = viewAreaElement.scrollLeft; var lastX = state.lastX; + if (currentX !== lastX) { state.right = currentX > lastX; } + state.lastX = currentX; var currentY = viewAreaElement.scrollTop; var lastY = state.lastY; + if (currentY !== lastY) { state.down = currentY > lastY; } + state.lastY = currentY; callback(state); }); }; + var state = { right: true, down: true, @@ -3031,62 +4057,78 @@ function watchScroll(viewAreaElement, callback) { _eventHandler: debounceScroll }; var rAF = null; - viewAreaElement.addEventListener('scroll', debounceScroll, true); + viewAreaElement.addEventListener("scroll", debounceScroll, true); return state; } + function parseQueryString(query) { - var parts = query.split('&'); + var parts = query.split("&"); var params = Object.create(null); + for (var i = 0, ii = parts.length; i < ii; ++i) { - var param = parts[i].split('='); + var param = parts[i].split("="); var key = param[0].toLowerCase(); var value = param.length > 1 ? param[1] : null; params[decodeURIComponent(key)] = decodeURIComponent(value); } + return params; } + function binarySearchFirstItem(items, condition) { var minIndex = 0; var maxIndex = items.length - 1; - if (items.length === 0 || !condition(items[maxIndex])) { + + if (maxIndex < 0 || !condition(items[maxIndex])) { return items.length; } + if (condition(items[minIndex])) { return minIndex; } + while (minIndex < maxIndex) { var currentIndex = minIndex + maxIndex >> 1; var currentItem = items[currentIndex]; + if (condition(currentItem)) { maxIndex = currentIndex; } else { minIndex = currentIndex + 1; } } + return minIndex; } + function approximateFraction(x) { if (Math.floor(x) === x) { return [x, 1]; } + var xinv = 1 / x; var limit = 8; + if (xinv > limit) { return [1, limit]; } else if (Math.floor(xinv) === xinv) { return [1, xinv]; } + var x_ = x > 1 ? xinv : x; var a = 0, b = 1, c = 1, d = 1; + while (true) { var p = a + c, q = b + d; + if (q > limit) { break; } + if (x_ <= p / q) { c = p; d = q; @@ -3095,22 +4137,27 @@ function approximateFraction(x) { b = q; } } - var result = void 0; + + var result; + if (x_ - a / b < c / d - x_) { result = x_ === x ? [a, b] : [b, a]; } else { result = x_ === x ? [c, d] : [d, c]; } + return result; } + function roundToDivide(x, div) { var r = x % div; return r === 0 ? x : Math.round(x - r + div); } -function getPageSizeInches(_ref5) { - var view = _ref5.view, - userUnit = _ref5.userUnit, - rotate = _ref5.rotate; + +function getPageSizeInches(_ref) { + var view = _ref.view, + userUnit = _ref.userUnit, + rotate = _ref.rotate; var _view = _slicedToArray(view, 4), x1 = _view[0], @@ -3126,69 +4173,73 @@ function getPageSizeInches(_ref5) { height: changeOrientation ? width : height }; } + function backtrackBeforeAllVisibleElements(index, views, top) { if (index < 2) { return index; } + var elt = views[index].div; var pageTop = elt.offsetTop + elt.clientTop; + if (pageTop >= top) { elt = views[index - 1].div; pageTop = elt.offsetTop + elt.clientTop; } + for (var i = index - 2; i >= 0; --i) { elt = views[i].div; + if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) { break; } + index = i; } + return index; } + function getVisibleElements(scrollEl, views) { var sortByVisibility = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var horizontal = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - var top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight; var left = scrollEl.scrollLeft, right = left + scrollEl.clientWidth; + function isElementBottomAfterViewTop(view) { var element = view.div; var elementBottom = element.offsetTop + element.clientTop + element.clientHeight; return elementBottom > top; } + function isElementRightAfterViewLeft(view) { var element = view.div; var elementRight = element.offsetLeft + element.clientLeft + element.clientWidth; return elementRight > left; } + var visible = [], - view = void 0, - element = void 0; - var currentHeight = void 0, - viewHeight = void 0, - viewBottom = void 0, - hiddenHeight = void 0; - var currentWidth = void 0, - viewWidth = void 0, - viewRight = void 0, - hiddenWidth = void 0; - var percentVisible = void 0; - var firstVisibleElementInd = views.length === 0 ? 0 : binarySearchFirstItem(views, horizontal ? isElementRightAfterViewLeft : isElementBottomAfterViewTop); - if (views.length > 0 && !horizontal) { + numViews = views.length; + var firstVisibleElementInd = numViews === 0 ? 0 : binarySearchFirstItem(views, horizontal ? isElementRightAfterViewLeft : isElementBottomAfterViewTop); + + if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) { firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top); } + var lastEdge = horizontal ? right : -1; - for (var i = firstVisibleElementInd, ii = views.length; i < ii; i++) { - view = views[i]; - element = view.div; - currentWidth = element.offsetLeft + element.clientLeft; - currentHeight = element.offsetTop + element.clientTop; - viewWidth = element.clientWidth; - viewHeight = element.clientHeight; - viewRight = currentWidth + viewWidth; - viewBottom = currentHeight + viewHeight; + + for (var i = firstVisibleElementInd; i < numViews; i++) { + var view = views[i], + element = view.div; + var currentWidth = element.offsetLeft + element.clientLeft; + var currentHeight = element.offsetTop + element.clientTop; + var viewWidth = element.clientWidth, + viewHeight = element.clientHeight; + var viewRight = currentWidth + viewWidth; + var viewBottom = currentHeight + viewHeight; + if (lastEdge === -1) { if (viewBottom >= bottom) { lastEdge = viewBottom; @@ -3196,291 +4247,356 @@ function getVisibleElements(scrollEl, views) { } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) { break; } + if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) { continue; } - hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom); - hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right); - percentVisible = (viewHeight - hiddenHeight) * (viewWidth - hiddenWidth) * 100 / viewHeight / viewWidth | 0; + + var hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom); + var hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right); + var percent = (viewHeight - hiddenHeight) * (viewWidth - hiddenWidth) * 100 / viewHeight / viewWidth | 0; visible.push({ id: view.id, x: currentWidth, y: currentHeight, view: view, - percent: percentVisible + percent: percent }); } - var first = visible[0]; - var last = visible[visible.length - 1]; + + var first = visible[0], + last = visible[visible.length - 1]; + if (sortByVisibility) { visible.sort(function (a, b) { var pc = a.percent - b.percent; + if (Math.abs(pc) > 0.001) { return -pc; } + return a.id - b.id; }); } + return { first: first, last: last, views: visible }; } + function noContextMenuHandler(evt) { evt.preventDefault(); } + function isDataSchema(url) { - var i = 0, - ii = url.length; - while (i < ii && url[i].trim() === '') { + var i = 0; + var ii = url.length; + + while (i < ii && url[i].trim() === "") { i++; } - return url.substring(i, i + 5).toLowerCase() === 'data:'; + + return url.substring(i, i + 5).toLowerCase() === "data:"; } + function getPDFFileNameFromURL(url) { - var defaultFilename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'document.pdf'; + var defaultFilename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "document.pdf"; - if (typeof url !== 'string') { + if (typeof url !== "string") { return defaultFilename; } + if (isDataSchema(url)) { - console.warn('getPDFFileNameFromURL: ' + 'ignoring "data:" URL for performance reasons.'); + console.warn("getPDFFileNameFromURL: " + 'ignoring "data:" URL for performance reasons.'); return defaultFilename; } + var reURI = /^(?:(?:[^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/; var reFilename = /[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i; var splitURI = reURI.exec(url); var suggestedFilename = reFilename.exec(splitURI[1]) || reFilename.exec(splitURI[2]) || reFilename.exec(splitURI[3]); + if (suggestedFilename) { suggestedFilename = suggestedFilename[0]; - if (suggestedFilename.includes('%')) { + + if (suggestedFilename.includes("%")) { try { suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0]; } catch (ex) {} } } + return suggestedFilename || defaultFilename; } + function normalizeWheelEventDelta(evt) { var delta = Math.sqrt(evt.deltaX * evt.deltaX + evt.deltaY * evt.deltaY); var angle = Math.atan2(evt.deltaY, evt.deltaX); + if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) { delta = -delta; } + var MOUSE_DOM_DELTA_PIXEL_MODE = 0; var MOUSE_DOM_DELTA_LINE_MODE = 1; var MOUSE_PIXELS_PER_LINE = 30; var MOUSE_LINES_PER_PAGE = 30; + if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) { delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE; } else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) { delta /= MOUSE_LINES_PER_PAGE; } + return delta; } + function isValidRotation(angle) { return Number.isInteger(angle) && angle % 90 === 0; } + +function isValidScrollMode(mode) { + return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN; +} + +function isValidSpreadMode(mode) { + return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN; +} + function isPortraitOrientation(size) { return size.width <= size.height; } + var WaitOnType = { - EVENT: 'event', - TIMEOUT: 'timeout' + EVENT: "event", + TIMEOUT: "timeout" }; -function waitOnEventOrTimeout(_ref6) { - var target = _ref6.target, - name = _ref6.name, - _ref6$delay = _ref6.delay, - delay = _ref6$delay === undefined ? 0 : _ref6$delay; +exports.WaitOnType = WaitOnType; +function waitOnEventOrTimeout(_ref2) { + var target = _ref2.target, + name = _ref2.name, + _ref2$delay = _ref2.delay, + delay = _ref2$delay === void 0 ? 0 : _ref2$delay; return new Promise(function (resolve, reject) { - if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) !== 'object' || !(name && typeof name === 'string') || !(Number.isInteger(delay) && delay >= 0)) { - throw new Error('waitOnEventOrTimeout - invalid parameters.'); + 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); + target._off(name, eventHandler); } else { target.removeEventListener(name, eventHandler); } + if (timeout) { clearTimeout(timeout); } + resolve(type); } + var eventHandler = handler.bind(null, WaitOnType.EVENT); + if (target instanceof EventBus) { - target.on(name, eventHandler); + target._on(name, eventHandler); } else { target.addEventListener(name, eventHandler); } + var timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT); var timeout = setTimeout(timeoutHandler, delay); }); } + var animationStarted = new Promise(function (resolve) { window.requestAnimationFrame(resolve); }); +exports.animationStarted = animationStarted; -var EventBus = function () { - function EventBus() { - var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref7$dispatchToDOM = _ref7.dispatchToDOM, - dispatchToDOM = _ref7$dispatchToDOM === undefined ? false : _ref7$dispatchToDOM; +function dispatchDOMEvent(eventName) { + var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + throw new Error("Not implemented: dispatchDOMEvent"); +} +var EventBus = /*#__PURE__*/function () { + function EventBus(options) { _classCallCheck(this, EventBus); this._listeners = Object.create(null); - this._dispatchToDOM = dispatchToDOM === true; } _createClass(EventBus, [{ - key: 'on', + key: "on", value: function on(eventName, listener) { - var eventListeners = this._listeners[eventName]; - if (!eventListeners) { - eventListeners = []; - this._listeners[eventName] = eventListeners; - } - eventListeners.push(listener); + this._on(eventName, listener, { + external: true + }); } }, { - key: 'off', + key: "off", value: function off(eventName, listener) { - var eventListeners = this._listeners[eventName]; - var i = void 0; - if (!eventListeners || (i = eventListeners.indexOf(listener)) < 0) { - return; - } - eventListeners.splice(i, 1); + this._off(eventName, listener, { + external: true + }); } }, { - key: 'dispatch', + key: "dispatch", value: function dispatch(eventName) { var eventListeners = this._listeners[eventName]; + if (!eventListeners || eventListeners.length === 0) { - if (this._dispatchToDOM) { - var _args5 = Array.prototype.slice.call(arguments, 1); - this._dispatchDOMEvent(eventName, _args5); - } return; } + var args = Array.prototype.slice.call(arguments, 1); - eventListeners.slice(0).forEach(function (listener) { + var externalListeners; + eventListeners.slice(0).forEach(function (_ref3) { + var listener = _ref3.listener, + external = _ref3.external; + + if (external) { + if (!externalListeners) { + externalListeners = []; + } + + externalListeners.push(listener); + return; + } + listener.apply(null, args); }); - if (this._dispatchToDOM) { - this._dispatchDOMEvent(eventName, args); + + if (externalListeners) { + externalListeners.forEach(function (listener) { + listener.apply(null, args); + }); + externalListeners = null; + } + } + }, { + key: "_on", + value: function _on(eventName, listener) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + var eventListeners = this._listeners[eventName]; + + if (!eventListeners) { + this._listeners[eventName] = eventListeners = []; } + + eventListeners.push({ + listener: listener, + external: (options && options.external) === true + }); } }, { - key: '_dispatchDOMEvent', - value: function _dispatchDOMEvent(eventName) { - var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + key: "_off", + value: function _off(eventName, listener) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + var eventListeners = this._listeners[eventName]; - if (!this._dispatchToDOM) { + if (!eventListeners) { return; } - var details = Object.create(null); - if (args && args.length > 0) { - var obj = args[0]; - for (var key in obj) { - var value = obj[key]; - if (key === 'source') { - if (value === window || value === document) { - return; - } - continue; - } - details[key] = value; + + for (var i = 0, ii = eventListeners.length; i < ii; i++) { + if (eventListeners[i].listener === listener) { + eventListeners.splice(i, 1); + return; } } - var event = document.createEvent('CustomEvent'); - event.initCustomEvent(eventName, true, true, details); - document.dispatchEvent(event); } }]); return EventBus; }(); +exports.EventBus = EventBus; + function clamp(v, min, max) { return Math.min(Math.max(v, min), max); } -var ProgressBar = function () { +var ProgressBar = /*#__PURE__*/function () { function ProgressBar(id) { - var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - height = _ref8.height, - width = _ref8.width, - units = _ref8.units; + var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + height = _ref4.height, + width = _ref4.width, + units = _ref4.units; _classCallCheck(this, ProgressBar); this.visible = true; - this.div = document.querySelector(id + ' .progress'); + this.div = document.querySelector(id + " .progress"); this.bar = this.div.parentNode; this.height = height || 100; this.width = width || 100; - this.units = units || '%'; + this.units = units || "%"; this.div.style.height = this.height + this.units; this.percent = 0; } _createClass(ProgressBar, [{ - key: '_updateBar', + key: "_updateBar", value: function _updateBar() { if (this._indeterminate) { - this.div.classList.add('indeterminate'); + this.div.classList.add("indeterminate"); this.div.style.width = this.width + this.units; return; } - this.div.classList.remove('indeterminate'); + + this.div.classList.remove("indeterminate"); var progressSize = this.width * this._percent / 100; this.div.style.width = progressSize + this.units; } }, { - key: 'setWidth', + key: "setWidth", value: function setWidth(viewer) { if (!viewer) { return; } + var container = viewer.parentNode; var scrollbarWidth = container.offsetWidth - viewer.offsetWidth; + if (scrollbarWidth > 0) { - this.bar.setAttribute('style', 'width: calc(100% - ' + scrollbarWidth + 'px);'); + this.bar.style.width = "calc(100% - ".concat(scrollbarWidth, "px)"); } } }, { - key: 'hide', + key: "hide", value: function hide() { if (!this.visible) { return; } + this.visible = false; - this.bar.classList.add('hidden'); - document.body.classList.remove('loadingInProgress'); + this.bar.classList.add("hidden"); + document.body.classList.remove("loadingInProgress"); } }, { - key: 'show', + key: "show", value: function show() { if (this.visible) { return; } + this.visible = true; - document.body.classList.add('loadingInProgress'); - this.bar.classList.remove('hidden'); + document.body.classList.add("loadingInProgress"); + this.bar.classList.remove("hidden"); } }, { - key: 'percent', + key: "percent", get: function get() { return this._percent; }, set: function set(val) { this._indeterminate = isNaN(val); this._percent = clamp(val, 0, 100); + this._updateBar(); } }]); @@ -3488,10 +4604,13 @@ var ProgressBar = function () { return ProgressBar; }(); +exports.ProgressBar = ProgressBar; + function moveToEndOfArray(arr, condition) { var moved = [], len = arr.length; var write = 0; + for (var read = 0; read < len; ++read) { if (condition(arr[read])) { moved.push(arr[read]); @@ -3500,62 +4619,14 @@ function moveToEndOfArray(arr, condition) { ++write; } } + for (var _read = 0; write < len; ++_read, ++write) { arr[write] = moved[_read]; } } -exports.CSS_UNITS = CSS_UNITS; -exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE; -exports.DEFAULT_SCALE = DEFAULT_SCALE; -exports.MIN_SCALE = MIN_SCALE; -exports.MAX_SCALE = MAX_SCALE; -exports.UNKNOWN_SCALE = UNKNOWN_SCALE; -exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE; -exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING; -exports.VERTICAL_PADDING = VERTICAL_PADDING; -exports.isValidRotation = isValidRotation; -exports.isPortraitOrientation = isPortraitOrientation; -exports.PresentationModeState = PresentationModeState; -exports.RendererType = RendererType; -exports.TextLayerMode = TextLayerMode; -exports.NullL10n = NullL10n; -exports.EventBus = EventBus; -exports.ProgressBar = ProgressBar; -exports.getPDFFileNameFromURL = getPDFFileNameFromURL; -exports.noContextMenuHandler = noContextMenuHandler; -exports.parseQueryString = parseQueryString; -exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements; -exports.getVisibleElements = getVisibleElements; -exports.roundToDivide = roundToDivide; -exports.getPageSizeInches = getPageSizeInches; -exports.approximateFraction = approximateFraction; -exports.getOutputScale = getOutputScale; -exports.scrollIntoView = scrollIntoView; -exports.watchScroll = watchScroll; -exports.binarySearchFirstItem = binarySearchFirstItem; -exports.normalizeWheelEventDelta = normalizeWheelEventDelta; -exports.animationStarted = animationStarted; -exports.WaitOnType = WaitOnType; -exports.waitOnEventOrTimeout = waitOnEventOrTimeout; -exports.moveToEndOfArray = moveToEndOfArray; - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var pdfjsLib = void 0; -if (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) { - pdfjsLib = window['pdfjs-dist/build/pdf']; -} else { - pdfjsLib = require('../build/pdf.js'); -} -module.exports = pdfjsLib; /***/ }), -/* 8 */ +/* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3564,126 +4635,273 @@ module.exports = pdfjsLib; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFCursorTools = exports.CursorTool = undefined; +exports.OptionKind = exports.AppOptions = void 0; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _viewer_compatibility = __webpack_require__(7); -var _grab_to_pan = __webpack_require__(9); +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var CursorTool = { - SELECT: 0, - HAND: 1, - ZOOM: 2 -}; - -var PDFCursorTools = function () { - function PDFCursorTools(_ref) { - var _this = this; - - var container = _ref.container, - eventBus = _ref.eventBus, - _ref$cursorToolOnLoad = _ref.cursorToolOnLoad, - cursorToolOnLoad = _ref$cursorToolOnLoad === undefined ? CursorTool.SELECT : _ref$cursorToolOnLoad; - - _classCallCheck(this, PDFCursorTools); - - this.container = container; - this.eventBus = eventBus; - this.active = CursorTool.SELECT; - this.activeBeforePresentationMode = null; - this.handTool = new _grab_to_pan.GrabToPan({ element: this.container }); - this._addEventListeners(); - Promise.resolve().then(function () { - _this.switchTool(cursorToolOnLoad); - }); - } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - _createClass(PDFCursorTools, [{ - key: 'switchTool', - value: function switchTool(tool) { - var _this2 = this; +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - if (this.activeBeforePresentationMode !== null) { - return; - } - if (tool === this.active) { - return; - } - var disableActiveTool = function disableActiveTool() { - switch (_this2.active) { - case CursorTool.SELECT: - break; - case CursorTool.HAND: - _this2.handTool.deactivate(); - break; - case CursorTool.ZOOM: - } - }; - switch (tool) { - case CursorTool.SELECT: - disableActiveTool(); - break; - case CursorTool.HAND: - disableActiveTool(); - this.handTool.activate(); - break; - case CursorTool.ZOOM: - default: - console.error('switchTool: "' + tool + '" is an unsupported value.'); - return; +var OptionKind = { + VIEWER: 0x02, + API: 0x04, + WORKER: 0x08, + PREFERENCE: 0x80 +}; +exports.OptionKind = OptionKind; +var defaultOptions = { + cursorToolOnLoad: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + defaultUrl: { + value: "compressed.tracemonkey-pldi-09.pdf", + kind: OptionKind.VIEWER + }, + defaultZoomValue: { + value: "", + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + disableCreateObjectURL: { + value: false, + compatibility: _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL, + kind: OptionKind.VIEWER + }, + disableHistory: { + value: false, + kind: OptionKind.VIEWER + }, + disablePageLabels: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enablePermissions: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enablePrintAutoRotate: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableWebGL: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + externalLinkRel: { + value: "noopener noreferrer nofollow", + kind: OptionKind.VIEWER + }, + externalLinkTarget: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + historyUpdateUrl: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + ignoreDestinationZoom: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + imageResourcesPath: { + value: "./images/", + kind: OptionKind.VIEWER + }, + maxCanvasPixels: { + value: 16777216, + compatibility: _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels, + kind: OptionKind.VIEWER + }, + pdfBugEnabled: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + printResolution: { + value: 150, + kind: OptionKind.VIEWER + }, + renderer: { + value: "canvas", + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + renderInteractiveForms: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + sidebarViewOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + scrollModeOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + spreadModeOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + textLayerMode: { + value: 1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + useOnlyCssZoom: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + viewOnLoad: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + cMapPacked: { + value: true, + kind: OptionKind.API + }, + cMapUrl: { + value: "../web/cmaps/", + kind: OptionKind.API + }, + disableAutoFetch: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableFontFace: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableRange: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableStream: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + docBaseUrl: { + value: "", + kind: OptionKind.API + }, + fontExtraProperties: { + value: false, + kind: OptionKind.API + }, + isEvalSupported: { + value: true, + kind: OptionKind.API + }, + maxImageSize: { + value: -1, + kind: OptionKind.API + }, + pdfBug: { + value: false, + kind: OptionKind.API + }, + verbosity: { + value: 1, + kind: OptionKind.API + }, + workerPort: { + value: null, + kind: OptionKind.WORKER + }, + workerSrc: { + value: "../build/pdf.worker.js", + kind: OptionKind.WORKER + } +}; +{ + defaultOptions.disablePreferences = { + value: false, + kind: OptionKind.VIEWER + }; + defaultOptions.locale = { + value: typeof navigator !== "undefined" ? navigator.language : "en-US", + kind: OptionKind.VIEWER + }; +} +var userOptions = Object.create(null); + +var AppOptions = /*#__PURE__*/function () { + function AppOptions() { + _classCallCheck(this, AppOptions); + + throw new Error("Cannot initialize AppOptions."); + } + + _createClass(AppOptions, null, [{ + key: "get", + value: function get(name) { + var userOption = userOptions[name]; + + if (userOption !== undefined) { + return userOption; } - this.active = tool; - this._dispatchEvent(); - } - }, { - key: '_dispatchEvent', - value: function _dispatchEvent() { - this.eventBus.dispatch('cursortoolchanged', { - source: this, - tool: this.active - }); + + var defaultOption = defaultOptions[name]; + + if (defaultOption !== undefined) { + return defaultOption.compatibility || defaultOption.value; + } + + return undefined; } }, { - key: '_addEventListeners', - value: function _addEventListeners() { - var _this3 = this; + key: "getAll", + value: function getAll() { + var kind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var options = Object.create(null); - this.eventBus.on('switchcursortool', function (evt) { - _this3.switchTool(evt.tool); - }); - this.eventBus.on('presentationmodechanged', function (evt) { - if (evt.switchInProgress) { - return; - } - var previouslyActive = void 0; - if (evt.active) { - previouslyActive = _this3.active; - _this3.switchTool(CursorTool.SELECT); - _this3.activeBeforePresentationMode = previouslyActive; - } else { - previouslyActive = _this3.activeBeforePresentationMode; - _this3.activeBeforePresentationMode = null; - _this3.switchTool(previouslyActive); + for (var name in defaultOptions) { + var defaultOption = defaultOptions[name]; + + if (kind) { + if ((kind & defaultOption.kind) === 0) { + continue; + } + + if (kind === OptionKind.PREFERENCE) { + var value = defaultOption.value, + valueType = _typeof(value); + + if (valueType === "boolean" || valueType === "string" || valueType === "number" && Number.isInteger(value)) { + options[name] = value; + continue; + } + + throw new Error("Invalid type for preference: ".concat(name)); + } } - }); + + var userOption = userOptions[name]; + options[name] = userOption !== undefined ? userOption : defaultOption.compatibility || defaultOption.value; + } + + return options; } }, { - key: 'activeTool', - get: function get() { - return this.active; + key: "set", + value: function set(name, value) { + userOptions[name] = value; + } + }, { + key: "remove", + value: function remove(name) { + delete userOptions[name]; } }]); - return PDFCursorTools; + return AppOptions; }(); -exports.CursorTool = CursorTool; -exports.PDFCursorTools = PDFCursorTools; +exports.AppOptions = AppOptions; /***/ }), -/* 9 */ +/* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3692,43 +4910,255 @@ exports.PDFCursorTools = PDFCursorTools; Object.defineProperty(exports, "__esModule", { value: true }); -function GrabToPan(options) { - this.element = options.element; - this.document = options.element.ownerDocument; - 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); - var 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() { - 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); - } +exports.viewerCompatibilityParams = void 0; +var compatibilityParams = Object.create(null); +{ + var userAgent = typeof navigator !== "undefined" && navigator.userAgent || ""; + var platform = typeof navigator !== "undefined" && navigator.platform || ""; + var maxTouchPoints = typeof navigator !== "undefined" && navigator.maxTouchPoints || 1; + var isAndroid = /Android/.test(userAgent); + var isIE = /Trident/.test(userAgent); + var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1; + var isIOSChrome = /CriOS/.test(userAgent); + + (function checkOnBlobSupport() { + if (isIE || isIOSChrome) { + compatibilityParams.disableCreateObjectURL = true; } - }, - deactivate: function GrabToPan_deactivate() { - if (this.active) { - this.active = false; - this.element.removeEventListener('mousedown', this._onmousedown, true); - this._endPan(); - this.element.classList.remove(this.CSS_CLASS_GRAB); - if (this.onActiveChanged) { - this.onActiveChanged(false); - } + })(); + + (function checkCanvasSizeLimitation() { + if (isIOS || isAndroid) { + compatibilityParams.maxCanvasPixels = 5242880; + } + })(); +} +var viewerCompatibilityParams = Object.freeze(compatibilityParams); +exports.viewerCompatibilityParams = viewerCompatibilityParams; + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var 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; + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFCursorTools = exports.CursorTool = void 0; + +var _grab_to_pan = __webpack_require__(10); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var CursorTool = { + SELECT: 0, + HAND: 1, + ZOOM: 2 +}; +exports.CursorTool = CursorTool; + +var PDFCursorTools = /*#__PURE__*/function () { + function PDFCursorTools(_ref) { + var _this = this; + + var container = _ref.container, + eventBus = _ref.eventBus, + _ref$cursorToolOnLoad = _ref.cursorToolOnLoad, + cursorToolOnLoad = _ref$cursorToolOnLoad === void 0 ? CursorTool.SELECT : _ref$cursorToolOnLoad; + + _classCallCheck(this, PDFCursorTools); + + this.container = container; + this.eventBus = eventBus; + this.active = CursorTool.SELECT; + this.activeBeforePresentationMode = null; + this.handTool = new _grab_to_pan.GrabToPan({ + element: this.container + }); + + this._addEventListeners(); + + Promise.resolve().then(function () { + _this.switchTool(cursorToolOnLoad); + }); + } + + _createClass(PDFCursorTools, [{ + key: "switchTool", + value: function switchTool(tool) { + var _this2 = this; + + if (this.activeBeforePresentationMode !== null) { + return; + } + + if (tool === this.active) { + return; + } + + var disableActiveTool = function disableActiveTool() { + switch (_this2.active) { + case CursorTool.SELECT: + break; + + case CursorTool.HAND: + _this2.handTool.deactivate(); + + break; + + case CursorTool.ZOOM: + } + }; + + switch (tool) { + case CursorTool.SELECT: + disableActiveTool(); + break; + + case CursorTool.HAND: + disableActiveTool(); + this.handTool.activate(); + break; + + case CursorTool.ZOOM: + default: + console.error("switchTool: \"".concat(tool, "\" is an unsupported value.")); + return; + } + + this.active = tool; + + this._dispatchEvent(); + } + }, { + key: "_dispatchEvent", + value: function _dispatchEvent() { + this.eventBus.dispatch("cursortoolchanged", { + source: this, + tool: this.active + }); + } + }, { + key: "_addEventListeners", + value: function _addEventListeners() { + var _this3 = this; + + this.eventBus._on("switchcursortool", function (evt) { + _this3.switchTool(evt.tool); + }); + + this.eventBus._on("presentationmodechanged", function (evt) { + if (evt.switchInProgress) { + return; + } + + var previouslyActive; + + if (evt.active) { + previouslyActive = _this3.active; + + _this3.switchTool(CursorTool.SELECT); + + _this3.activeBeforePresentationMode = previouslyActive; + } else { + previouslyActive = _this3.activeBeforePresentationMode; + _this3.activeBeforePresentationMode = null; + + _this3.switchTool(previouslyActive); + } + }); + } + }, { + key: "activeTool", + get: function get() { + return this.active; + } + }]); + + return PDFCursorTools; +}(); + +exports.PDFCursorTools = PDFCursorTools; + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.GrabToPan = GrabToPan; + +function GrabToPan(options) { + this.element = options.element; + this.document = options.element.ownerDocument; + + 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); + var 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() { + 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); + } + } + }, + deactivate: function GrabToPan_deactivate() { + if (this.active) { + this.active = false; + this.element.removeEventListener("mousedown", this._onmousedown, true); + + this._endPan(); + + this.element.classList.remove(this.CSS_CLASS_GRAB); + + if (this.onActiveChanged) { + this.onActiveChanged(false); + } } }, toggle: function GrabToPan_toggle() { @@ -3739,12 +5169,13 @@ GrabToPan.prototype = { } }, ignoreTarget: function GrabToPan_ignoreTarget(node) { - return node[matchesSelector]('a[href], a[href] *, input, textarea, button, button *, select, option'); + return node[matchesSelector]("a[href], a[href] *, input, textarea, button, button *, select, option"); }, _onmousedown: function GrabToPan__onmousedown(event) { if (event.button !== 0 || this.ignoreTarget(event.target)) { return; } + if (event.originalTarget) { try { event.originalTarget.tagName; @@ -3752,79 +5183,93 @@ GrabToPan.prototype = { return; } } + this.scrollLeftStart = this.element.scrollLeft; this.scrollTopStart = this.element.scrollTop; this.clientXStart = event.clientX; this.clientYStart = event.clientY; - this.document.addEventListener('mousemove', this._onmousemove, true); - this.document.addEventListener('mouseup', this._endPan, true); - this.element.addEventListener('scroll', this._endPan, true); + this.document.addEventListener("mousemove", this._onmousemove, true); + this.document.addEventListener("mouseup", this._endPan, true); + this.element.addEventListener("scroll", this._endPan, true); event.preventDefault(); event.stopPropagation(); var focusedElement = document.activeElement; + if (focusedElement && !focusedElement.contains(event.target)) { focusedElement.blur(); } }, _onmousemove: function GrabToPan__onmousemove(event) { - this.element.removeEventListener('scroll', this._endPan, true); + this.element.removeEventListener("scroll", this._endPan, true); + if (isLeftMouseReleased(event)) { this._endPan(); + return; } + var xDiff = event.clientX - this.clientXStart; var yDiff = event.clientY - this.clientYStart; var scrollTop = this.scrollTopStart - yDiff; var scrollLeft = this.scrollLeftStart - xDiff; + if (this.element.scrollTo) { this.element.scrollTo({ top: scrollTop, left: scrollLeft, - behavior: 'instant' + behavior: "instant" }); } else { this.element.scrollTop = scrollTop; this.element.scrollLeft = scrollLeft; } + if (!this.overlay.parentNode) { document.body.appendChild(this.overlay); } }, _endPan: function GrabToPan__endPan() { - this.element.removeEventListener('scroll', this._endPan, true); - this.document.removeEventListener('mousemove', this._onmousemove, true); - this.document.removeEventListener('mouseup', this._endPan, true); + this.element.removeEventListener("scroll", this._endPan, true); + this.document.removeEventListener("mousemove", this._onmousemove, true); + this.document.removeEventListener("mouseup", this._endPan, true); this.overlay.remove(); } }; var matchesSelector; -['webkitM', 'mozM', 'msM', 'oM', 'm'].some(function (prefix) { - var name = prefix + 'atches'; +["webkitM", "mozM", "msM", "oM", "m"].some(function (prefix) { + var name = prefix + "atches"; + if (name in document.documentElement) { matchesSelector = name; } - name += 'Selector'; + + name += "Selector"; + if (name in document.documentElement) { matchesSelector = name; } + return matchesSelector; }); var isNotIEorIsIE10plus = !document.documentMode || document.documentMode > 9; var chrome = window.chrome; var isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app); var isSafari6plus = /Apple/.test(navigator.vendor) && /Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent); + function isLeftMouseReleased(event) { - if ('buttons' in event && isNotIEorIsIE10plus) { + if ("buttons" in event && isNotIEorIsIE10plus) { return !(event.buttons & 1); } + if (isChrome15OrOpera15plus || isSafari6plus) { return event.which === 0; } + + return false; } -exports.GrabToPan = GrabToPan; /***/ }), -/* 10 */ +/* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3833,11 +5278,14 @@ exports.GrabToPan = GrabToPan; Object.defineProperty(exports, "__esModule", { value: true }); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +exports.PDFRenderingQueue = exports.RenderingStates = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var CLEANUP_TIMEOUT = 30000; var RenderingStates = { INITIAL: 0, @@ -3845,8 +5293,9 @@ var RenderingStates = { PAUSED: 2, FINISHED: 3 }; +exports.RenderingStates = RenderingStates; -var PDFRenderingQueue = function () { +var PDFRenderingQueue = /*#__PURE__*/function () { function PDFRenderingQueue() { _classCallCheck(this, PDFRenderingQueue); @@ -3881,17 +5330,21 @@ var PDFRenderingQueue = function () { 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); } @@ -3901,26 +5354,33 @@ var PDFRenderingQueue = function () { value: function getHighestPriority(visible, views, scrolledDown) { var visibleViews = visible.views; var numVisible = visibleViews.length; + if (numVisible === 0) { - return false; + return null; } + for (var i = 0; i < numVisible; ++i) { var view = visibleViews[i].view; + if (!this.isViewFinished(view)) { return view; } } + if (scrolledDown) { var nextPageIndex = visible.last.id; + if (views[nextPageIndex] && !this.isViewFinished(views[nextPageIndex])) { return views[nextPageIndex]; } } else { var previousPageIndex = visible.first.id - 2; + if (views[previousPageIndex] && !this.isViewFinished(views[previousPageIndex])) { return views[previousPageIndex]; } } + return null; } }, { @@ -3936,21 +5396,26 @@ var PDFRenderingQueue = function () { 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; - var continueRendering = function continueRendering() { + view.draw()["finally"](function () { _this.renderHighestPriority(); - }; - view.draw().then(continueRendering, continueRendering); + })["catch"](function (reason) { + console.error("renderView: \"".concat(reason, "\"")); + }); break; } + return true; } }]); @@ -3958,11 +5423,10 @@ var PDFRenderingQueue = function () { return PDFRenderingQueue; }(); -exports.RenderingStates = RenderingStates; exports.PDFRenderingQueue = PDFRenderingQueue; /***/ }), -/* 11 */ +/* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3971,731 +5435,421 @@ exports.PDFRenderingQueue = PDFRenderingQueue; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFSidebar = exports.SidebarView = undefined; +exports.PDFSidebar = exports.SidebarView = void 0; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _ui_utils = __webpack_require__(5); -var _ui_utils = __webpack_require__(6); - -var _pdf_rendering_queue = __webpack_require__(10); +var _pdf_rendering_queue = __webpack_require__(11); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var UI_NOTIFICATION_CLASS = 'pdfSidebarNotification'; +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var UI_NOTIFICATION_CLASS = "pdfSidebarNotification"; var SidebarView = { + UNKNOWN: -1, NONE: 0, THUMBS: 1, OUTLINE: 2, - ATTACHMENTS: 3 + ATTACHMENTS: 3, + LAYERS: 4 }; +exports.SidebarView = SidebarView; + +var PDFSidebar = /*#__PURE__*/function () { + function PDFSidebar(_ref) { + var elements = _ref.elements, + pdfViewer = _ref.pdfViewer, + pdfThumbnailViewer = _ref.pdfThumbnailViewer, + eventBus = _ref.eventBus, + _ref$l10n = _ref.l10n, + l10n = _ref$l10n === void 0 ? _ui_utils.NullL10n : _ref$l10n, + _ref$disableNotificat = _ref.disableNotification, + disableNotification = _ref$disableNotificat === void 0 ? false : _ref$disableNotificat; -var PDFSidebar = function () { - function PDFSidebar(options, eventBus) { - var l10n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ui_utils.NullL10n; - _classCallCheck(this, PDFSidebar); this.isOpen = false; this.active = SidebarView.THUMBS; this.isInitialViewSet = false; this.onToggled = null; - this.pdfViewer = options.pdfViewer; - this.pdfThumbnailViewer = options.pdfThumbnailViewer; - this.outerContainer = options.outerContainer; - this.viewerContainer = options.viewerContainer; - this.toggleButton = options.toggleButton; - this.thumbnailButton = options.thumbnailButton; - this.outlineButton = options.outlineButton; - this.attachmentsButton = options.attachmentsButton; - this.thumbnailView = options.thumbnailView; - this.outlineView = options.outlineView; - this.attachmentsView = options.attachmentsView; - this.disableNotification = options.disableNotification || false; + this.pdfViewer = pdfViewer; + this.pdfThumbnailViewer = pdfThumbnailViewer; + this.outerContainer = elements.outerContainer; + this.viewerContainer = elements.viewerContainer; + this.toggleButton = elements.toggleButton; + this.thumbnailButton = elements.thumbnailButton; + this.outlineButton = elements.outlineButton; + this.attachmentsButton = elements.attachmentsButton; + this.thumbnailView = elements.thumbnailView; + this.outlineView = elements.outlineView; + this.attachmentsView = elements.attachmentsView; this.eventBus = eventBus; this.l10n = l10n; + this._disableNotification = disableNotification; + this._addEventListeners(); } _createClass(PDFSidebar, [{ - key: 'reset', + key: "reset", value: function reset() { this.isInitialViewSet = false; + this._hideUINotification(null); + this.switchView(SidebarView.THUMBS); this.outlineButton.disabled = false; this.attachmentsButton.disabled = false; } }, { - key: 'setInitialView', + key: "setInitialView", value: function setInitialView() { var view = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SidebarView.NONE; if (this.isInitialViewSet) { return; } + this.isInitialViewSet = true; - if (this.isOpen && view === SidebarView.NONE) { + + if (view === SidebarView.NONE || view === SidebarView.UNKNOWN) { this._dispatchEvent(); + return; } - var isViewPreserved = view === this.visibleView; - this.switchView(view, true); - if (isViewPreserved) { + + if (!this._switchView(view, true)) { this._dispatchEvent(); } } }, { - key: 'switchView', + key: "switchView", value: function switchView(view) { var forceOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - if (view === SidebarView.NONE) { - this.close(); - return; - } + this._switchView(view, forceOpen); + } + }, { + key: "_switchView", + value: function _switchView(view) { + var forceOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var isViewChanged = view !== this.active; var shouldForceRendering = false; + switch (view) { + case SidebarView.NONE: + if (this.isOpen) { + this.close(); + return true; + } + + return false; + case SidebarView.THUMBS: - this.thumbnailButton.classList.add('toggled'); - this.outlineButton.classList.remove('toggled'); - this.attachmentsButton.classList.remove('toggled'); - this.thumbnailView.classList.remove('hidden'); - this.outlineView.classList.add('hidden'); - this.attachmentsView.classList.add('hidden'); if (this.isOpen && isViewChanged) { - this._updateThumbnailViewer(); shouldForceRendering = true; } + break; + case SidebarView.OUTLINE: if (this.outlineButton.disabled) { - return; + return false; } - this.thumbnailButton.classList.remove('toggled'); - this.outlineButton.classList.add('toggled'); - this.attachmentsButton.classList.remove('toggled'); - this.thumbnailView.classList.add('hidden'); - this.outlineView.classList.remove('hidden'); - this.attachmentsView.classList.add('hidden'); + break; + case SidebarView.ATTACHMENTS: if (this.attachmentsButton.disabled) { - return; + return false; } - this.thumbnailButton.classList.remove('toggled'); - this.outlineButton.classList.remove('toggled'); - this.attachmentsButton.classList.add('toggled'); - this.thumbnailView.classList.add('hidden'); - this.outlineView.classList.add('hidden'); - this.attachmentsView.classList.remove('hidden'); + break; + default: - console.error('PDFSidebar_switchView: "' + view + '" is an unsupported value.'); - return; + console.error("PDFSidebar._switchView: \"".concat(view, "\" is not a valid view.")); + return false; } - this.active = view | 0; + + this.active = view; + this.thumbnailButton.classList.toggle("toggled", view === SidebarView.THUMBS); + this.outlineButton.classList.toggle("toggled", view === SidebarView.OUTLINE); + this.attachmentsButton.classList.toggle("toggled", view === SidebarView.ATTACHMENTS); + this.thumbnailView.classList.toggle("hidden", view !== SidebarView.THUMBS); + this.outlineView.classList.toggle("hidden", view !== SidebarView.OUTLINE); + this.attachmentsView.classList.toggle("hidden", view !== SidebarView.ATTACHMENTS); + if (forceOpen && !this.isOpen) { this.open(); - return; + return true; } + if (shouldForceRendering) { - this._forceRendering(); - } - if (isViewChanged) { - this._dispatchEvent(); - } - this._hideUINotification(this.active); - } - }, { - key: 'open', - value: function open() { - if (this.isOpen) { - return; - } - this.isOpen = true; - this.toggleButton.classList.add('toggled'); - this.outerContainer.classList.add('sidebarMoving'); - this.outerContainer.classList.add('sidebarOpen'); - if (this.active === SidebarView.THUMBS) { this._updateThumbnailViewer(); - } - this._forceRendering(); - this._dispatchEvent(); - this._hideUINotification(this.active); - } - }, { - key: 'close', - value: function close() { - if (!this.isOpen) { - return; - } - this.isOpen = false; - this.toggleButton.classList.remove('toggled'); - this.outerContainer.classList.add('sidebarMoving'); - this.outerContainer.classList.remove('sidebarOpen'); - this._forceRendering(); - this._dispatchEvent(); - } - }, { - key: 'toggle', - value: function toggle() { - if (this.isOpen) { - this.close(); - } else { - this.open(); - } - } - }, { - key: '_dispatchEvent', - value: function _dispatchEvent() { - this.eventBus.dispatch('sidebarviewchanged', { - source: this, - view: this.visibleView - }); - } - }, { - key: '_forceRendering', - value: function _forceRendering() { - if (this.onToggled) { - this.onToggled(); - } else { - this.pdfViewer.forceRendering(); - this.pdfThumbnailViewer.forceRendering(); - } - } - }, { - key: '_updateThumbnailViewer', - value: function _updateThumbnailViewer() { - var pdfViewer = this.pdfViewer, - pdfThumbnailViewer = this.pdfThumbnailViewer; - - var pagesCount = pdfViewer.pagesCount; - for (var pageIndex = 0; pageIndex < pagesCount; pageIndex++) { - var pageView = pdfViewer.getPageView(pageIndex); - if (pageView && pageView.renderingState === _pdf_rendering_queue.RenderingStates.FINISHED) { - var thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex); - thumbnailView.setImage(pageView); - } - } - pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber); - } - }, { - key: '_showUINotification', - value: function _showUINotification(view) { - var _this = this; - if (this.disableNotification) { - return; - } - this.l10n.get('toggle_sidebar_notification.title', null, 'Toggle Sidebar (document contains outline/attachments)').then(function (msg) { - _this.toggleButton.title = msg; - }); - if (!this.isOpen) { - this.toggleButton.classList.add(UI_NOTIFICATION_CLASS); - } else if (view === this.active) { - return; - } - switch (view) { - case SidebarView.OUTLINE: - this.outlineButton.classList.add(UI_NOTIFICATION_CLASS); - break; - case SidebarView.ATTACHMENTS: - this.attachmentsButton.classList.add(UI_NOTIFICATION_CLASS); - break; + this._forceRendering(); } - } - }, { - key: '_hideUINotification', - value: function _hideUINotification(view) { - var _this2 = this; - if (this.disableNotification) { - return; - } - var removeNotification = function removeNotification(view) { - switch (view) { - case SidebarView.OUTLINE: - _this2.outlineButton.classList.remove(UI_NOTIFICATION_CLASS); - break; - case SidebarView.ATTACHMENTS: - _this2.attachmentsButton.classList.remove(UI_NOTIFICATION_CLASS); - break; - } - }; - if (!this.isOpen && view !== null) { - return; - } - this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS); - if (view !== null) { - removeNotification(view); - return; - } - for (view in SidebarView) { - removeNotification(SidebarView[view]); + if (isViewChanged) { + this._dispatchEvent(); } - this.l10n.get('toggle_sidebar.title', null, 'Toggle Sidebar').then(function (msg) { - _this2.toggleButton.title = msg; - }); - } - }, { - key: '_addEventListeners', - value: function _addEventListeners() { - var _this3 = this; - this.viewerContainer.addEventListener('transitionend', function (evt) { - if (evt.target === _this3.viewerContainer) { - _this3.outerContainer.classList.remove('sidebarMoving'); - } - }); - this.thumbnailButton.addEventListener('click', function () { - _this3.switchView(SidebarView.THUMBS); - }); - this.outlineButton.addEventListener('click', function () { - _this3.switchView(SidebarView.OUTLINE); - }); - this.outlineButton.addEventListener('dblclick', function () { - _this3.eventBus.dispatch('toggleoutlinetree', { source: _this3 }); - }); - this.attachmentsButton.addEventListener('click', function () { - _this3.switchView(SidebarView.ATTACHMENTS); - }); - this.eventBus.on('outlineloaded', function (evt) { - var outlineCount = evt.outlineCount; - _this3.outlineButton.disabled = !outlineCount; - if (outlineCount) { - _this3._showUINotification(SidebarView.OUTLINE); - } else if (_this3.active === SidebarView.OUTLINE) { - _this3.switchView(SidebarView.THUMBS); - } - }); - this.eventBus.on('attachmentsloaded', function (evt) { - if (evt.attachmentsCount) { - _this3.attachmentsButton.disabled = false; - _this3._showUINotification(SidebarView.ATTACHMENTS); - return; - } - Promise.resolve().then(function () { - if (_this3.attachmentsView.hasChildNodes()) { - return; - } - _this3.attachmentsButton.disabled = true; - if (_this3.active === SidebarView.ATTACHMENTS) { - _this3.switchView(SidebarView.THUMBS); - } - }); - }); - this.eventBus.on('presentationmodechanged', function (evt) { - if (!evt.active && !evt.switchInProgress && _this3.isThumbnailViewVisible) { - _this3._updateThumbnailViewer(); - } - }); - } - }, { - key: 'visibleView', - get: function get() { - return this.isOpen ? this.active : SidebarView.NONE; - } - }, { - key: 'isThumbnailViewVisible', - get: function get() { - return this.isOpen && this.active === SidebarView.THUMBS; - } - }, { - key: 'isOutlineViewVisible', - get: function get() { - return this.isOpen && this.active === SidebarView.OUTLINE; - } - }, { - key: 'isAttachmentsViewVisible', - get: function get() { - return this.isOpen && this.active === SidebarView.ATTACHMENTS; - } - }]); - - return PDFSidebar; -}(); - -exports.SidebarView = SidebarView; -exports.PDFSidebar = PDFSidebar; - -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.OptionKind = exports.AppOptions = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _pdfjsLib = __webpack_require__(7); - -var _viewer_compatibility = __webpack_require__(13); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var OptionKind = { - VIEWER: 'viewer', - API: 'api', - WORKER: 'worker' -}; -var defaultOptions = { - cursorToolOnLoad: { - value: 0, - kind: OptionKind.VIEWER - }, - defaultUrl: { - value: 'compressed.tracemonkey-pldi-09.pdf', - kind: OptionKind.VIEWER - }, - defaultZoomValue: { - value: '', - kind: OptionKind.VIEWER - }, - disableHistory: { - value: false, - kind: OptionKind.VIEWER - }, - disablePageLabels: { - value: false, - kind: OptionKind.VIEWER - }, - disablePageMode: { - value: false, - kind: OptionKind.VIEWER - }, - enablePrintAutoRotate: { - value: false, - kind: OptionKind.VIEWER - }, - enableWebGL: { - value: false, - kind: OptionKind.VIEWER - }, - eventBusDispatchToDOM: { - value: false, - kind: OptionKind.VIEWER - }, - externalLinkRel: { - value: 'noopener noreferrer nofollow', - kind: OptionKind.VIEWER - }, - externalLinkTarget: { - value: 0, - kind: OptionKind.VIEWER - }, - imageResourcesPath: { - value: './images/', - kind: OptionKind.VIEWER - }, - maxCanvasPixels: { - value: _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels || 16777216, - kind: OptionKind.VIEWER - }, - pdfBugEnabled: { - value: false, - kind: OptionKind.VIEWER - }, - renderer: { - value: 'canvas', - kind: OptionKind.VIEWER - }, - renderInteractiveForms: { - value: false, - kind: OptionKind.VIEWER - }, - showPreviousViewOnLoad: { - value: true, - kind: OptionKind.VIEWER - }, - sidebarViewOnLoad: { - value: 0, - kind: OptionKind.VIEWER - }, - scrollModeOnLoad: { - value: 0, - kind: OptionKind.VIEWER - }, - spreadModeOnLoad: { - value: 0, - kind: OptionKind.VIEWER - }, - textLayerMode: { - value: 1, - kind: OptionKind.VIEWER - }, - useOnlyCssZoom: { - value: false, - kind: OptionKind.VIEWER - }, - cMapPacked: { - value: true, - kind: OptionKind.API - }, - cMapUrl: { - value: '../web/cmaps/', - kind: OptionKind.API - }, - disableAutoFetch: { - value: false, - kind: OptionKind.API - }, - disableCreateObjectURL: { - value: _pdfjsLib.apiCompatibilityParams.disableCreateObjectURL || false, - kind: OptionKind.API - }, - disableFontFace: { - value: false, - kind: OptionKind.API - }, - disableRange: { - value: false, - kind: OptionKind.API - }, - disableStream: { - value: false, - kind: OptionKind.API - }, - isEvalSupported: { - value: true, - kind: OptionKind.API - }, - maxImageSize: { - value: -1, - kind: OptionKind.API - }, - pdfBug: { - value: false, - kind: OptionKind.API - }, - postMessageTransfers: { - value: true, - kind: OptionKind.API - }, - verbosity: { - value: 1, - kind: OptionKind.API - }, - workerPort: { - value: null, - kind: OptionKind.WORKER - }, - workerSrc: { - value: '../build/pdf.worker.js', - kind: OptionKind.WORKER - } -}; -{ - defaultOptions.locale = { - value: typeof navigator !== 'undefined' ? navigator.language : 'en-US', - kind: OptionKind.VIEWER - }; -} -var userOptions = Object.create(null); - -var AppOptions = function () { - function AppOptions() { - _classCallCheck(this, AppOptions); + this._hideUINotification(this.active); - throw new Error('Cannot initialize AppOptions.'); - } + return isViewChanged; + } + }, { + key: "open", + value: function open() { + if (this.isOpen) { + return; + } - _createClass(AppOptions, null, [{ - key: 'get', - value: function get(name) { - var defaultOption = defaultOptions[name], - userOption = userOptions[name]; - if (userOption !== undefined) { - return userOption; + this.isOpen = true; + this.toggleButton.classList.add("toggled"); + this.outerContainer.classList.add("sidebarMoving", "sidebarOpen"); + + if (this.active === SidebarView.THUMBS) { + this._updateThumbnailViewer(); } - return defaultOption !== undefined ? defaultOption.value : undefined; + + this._forceRendering(); + + this._dispatchEvent(); + + this._hideUINotification(this.active); } }, { - key: 'getAll', - value: function getAll() { - var kind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + key: "close", + value: function close() { + if (!this.isOpen) { + return; + } - var options = Object.create(null); - for (var name in defaultOptions) { - var defaultOption = defaultOptions[name], - userOption = userOptions[name]; - if (kind && defaultOption.kind !== kind) { - continue; - } - options[name] = userOption !== undefined ? userOption : defaultOption.value; + this.isOpen = false; + this.toggleButton.classList.remove("toggled"); + this.outerContainer.classList.add("sidebarMoving"); + this.outerContainer.classList.remove("sidebarOpen"); + + this._forceRendering(); + + this._dispatchEvent(); + } + }, { + key: "toggle", + value: function toggle() { + if (this.isOpen) { + this.close(); + } else { + this.open(); } - return options; } }, { - key: 'set', - value: function set(name, value) { - userOptions[name] = value; + key: "_dispatchEvent", + value: function _dispatchEvent() { + this.eventBus.dispatch("sidebarviewchanged", { + source: this, + view: this.visibleView + }); } }, { - key: 'remove', - value: function remove(name) { - delete userOptions[name]; + key: "_forceRendering", + value: function _forceRendering() { + if (this.onToggled) { + this.onToggled(); + } else { + this.pdfViewer.forceRendering(); + this.pdfThumbnailViewer.forceRendering(); + } } - }]); + }, { + key: "_updateThumbnailViewer", + value: function _updateThumbnailViewer() { + var pdfViewer = this.pdfViewer, + pdfThumbnailViewer = this.pdfThumbnailViewer; + var pagesCount = pdfViewer.pagesCount; - return AppOptions; -}(); + for (var pageIndex = 0; pageIndex < pagesCount; pageIndex++) { + var pageView = pdfViewer.getPageView(pageIndex); -exports.AppOptions = AppOptions; -exports.OptionKind = OptionKind; + if (pageView && pageView.renderingState === _pdf_rendering_queue.RenderingStates.FINISHED) { + var thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex); + thumbnailView.setImage(pageView); + } + } -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { + pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber); + } + }, { + key: "_showUINotification", + value: function _showUINotification(view) { + var _this = this; -"use strict"; + if (this._disableNotification) { + return; + } + this.l10n.get("toggle_sidebar_notification.title", null, "Toggle Sidebar (document contains outline/attachments)").then(function (msg) { + _this.toggleButton.title = msg; + }); -var compatibilityParams = Object.create(null); -{ - var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || ''; - var isAndroid = /Android/.test(userAgent); - var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent); - (function checkCanvasSizeLimitation() { - if (isIOS || isAndroid) { - compatibilityParams.maxCanvasPixels = 5242880; + if (!this.isOpen) { + this.toggleButton.classList.add(UI_NOTIFICATION_CLASS); + } else if (view === this.active) { + return; + } + + switch (view) { + case SidebarView.OUTLINE: + this.outlineButton.classList.add(UI_NOTIFICATION_CLASS); + break; + + case SidebarView.ATTACHMENTS: + this.attachmentsButton.classList.add(UI_NOTIFICATION_CLASS); + break; + } } - })(); -} -exports.viewerCompatibilityParams = Object.freeze(compatibilityParams); + }, { + key: "_hideUINotification", + value: function _hideUINotification(view) { + var _this2 = this; -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { + if (this._disableNotification) { + return; + } -"use strict"; + var removeNotification = function removeNotification(sidebarView) { + switch (sidebarView) { + case SidebarView.OUTLINE: + _this2.outlineButton.classList.remove(UI_NOTIFICATION_CLASS); + break; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getGlobalEventBus = exports.attachDOMEventsToEventBus = undefined; + case SidebarView.ATTACHMENTS: + _this2.attachmentsButton.classList.remove(UI_NOTIFICATION_CLASS); -var _ui_utils = __webpack_require__(6); + break; + } + }; -function attachDOMEventsToEventBus(eventBus) { - eventBus.on('documentload', function () { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('documentload', true, true, {}); - window.dispatchEvent(event); - }); - eventBus.on('pagerendered', function (evt) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('pagerendered', true, true, { - pageNumber: evt.pageNumber, - cssTransform: evt.cssTransform - }); - evt.source.div.dispatchEvent(event); - }); - eventBus.on('textlayerrendered', function (evt) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('textlayerrendered', true, true, { pageNumber: evt.pageNumber }); - evt.source.textLayerDiv.dispatchEvent(event); - }); - eventBus.on('pagechange', function (evt) { - var event = document.createEvent('UIEvents'); - event.initUIEvent('pagechange', true, true, window, 0); - event.pageNumber = evt.pageNumber; - evt.source.container.dispatchEvent(event); - }); - eventBus.on('pagesinit', function (evt) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('pagesinit', true, true, null); - evt.source.container.dispatchEvent(event); - }); - eventBus.on('pagesloaded', function (evt) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('pagesloaded', true, true, { pagesCount: evt.pagesCount }); - evt.source.container.dispatchEvent(event); - }); - eventBus.on('scalechange', function (evt) { - var event = document.createEvent('UIEvents'); - event.initUIEvent('scalechange', true, true, window, 0); - event.scale = evt.scale; - event.presetValue = evt.presetValue; - evt.source.container.dispatchEvent(event); - }); - eventBus.on('updateviewarea', function (evt) { - var event = document.createEvent('UIEvents'); - event.initUIEvent('updateviewarea', true, true, window, 0); - event.location = evt.location; - evt.source.container.dispatchEvent(event); - }); - eventBus.on('find', function (evt) { - if (evt.source === window) { - return; + if (!this.isOpen && view !== null) { + return; + } + + this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS); + + if (view !== null) { + removeNotification(view); + return; + } + + for (view in SidebarView) { + removeNotification(SidebarView[view]); + } + + this.l10n.get("toggle_sidebar.title", null, "Toggle Sidebar").then(function (msg) { + _this2.toggleButton.title = msg; + }); } - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('find' + evt.type, true, true, { - query: evt.query, - phraseSearch: evt.phraseSearch, - caseSensitive: evt.caseSensitive, - highlightAll: evt.highlightAll, - findPrevious: evt.findPrevious - }); - window.dispatchEvent(event); - }); - eventBus.on('attachmentsloaded', function (evt) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('attachmentsloaded', true, true, { attachmentsCount: evt.attachmentsCount }); - evt.source.container.dispatchEvent(event); - }); - eventBus.on('sidebarviewchanged', function (evt) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('sidebarviewchanged', true, true, { view: evt.view }); - evt.source.outerContainer.dispatchEvent(event); - }); - eventBus.on('pagemode', function (evt) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('pagemode', true, true, { mode: evt.mode }); - evt.source.pdfViewer.container.dispatchEvent(event); - }); - eventBus.on('namedaction', function (evt) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('namedaction', true, true, { action: evt.action }); - evt.source.pdfViewer.container.dispatchEvent(event); - }); - eventBus.on('presentationmodechanged', function (evt) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('presentationmodechanged', true, true, { - active: evt.active, - switchInProgress: evt.switchInProgress - }); - window.dispatchEvent(event); - }); - eventBus.on('outlineloaded', function (evt) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('outlineloaded', true, true, { outlineCount: evt.outlineCount }); - evt.source.container.dispatchEvent(event); - }); -} -var globalEventBus = null; -function getGlobalEventBus() { - var dispatchToDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + }, { + key: "_addEventListeners", + value: function _addEventListeners() { + var _this3 = this; + + this.viewerContainer.addEventListener("transitionend", function (evt) { + if (evt.target === _this3.viewerContainer) { + _this3.outerContainer.classList.remove("sidebarMoving"); + } + }); + this.toggleButton.addEventListener("click", function () { + _this3.toggle(); + }); + this.thumbnailButton.addEventListener("click", function () { + _this3.switchView(SidebarView.THUMBS); + }); + this.outlineButton.addEventListener("click", function () { + _this3.switchView(SidebarView.OUTLINE); + }); + this.outlineButton.addEventListener("dblclick", function () { + _this3.eventBus.dispatch("toggleoutlinetree", { + source: _this3 + }); + }); + this.attachmentsButton.addEventListener("click", function () { + _this3.switchView(SidebarView.ATTACHMENTS); + }); + + this.eventBus._on("outlineloaded", function (evt) { + var outlineCount = evt.outlineCount; + _this3.outlineButton.disabled = !outlineCount; + + if (outlineCount) { + _this3._showUINotification(SidebarView.OUTLINE); + } else if (_this3.active === SidebarView.OUTLINE) { + _this3.switchView(SidebarView.THUMBS); + } + }); + + this.eventBus._on("attachmentsloaded", function (evt) { + if (evt.attachmentsCount) { + _this3.attachmentsButton.disabled = false; + + _this3._showUINotification(SidebarView.ATTACHMENTS); + + return; + } + + Promise.resolve().then(function () { + if (_this3.attachmentsView.hasChildNodes()) { + return; + } - if (!globalEventBus) { - globalEventBus = new _ui_utils.EventBus({ dispatchToDOM: dispatchToDOM }); - if (!dispatchToDOM) { - attachDOMEventsToEventBus(globalEventBus); + _this3.attachmentsButton.disabled = true; + + if (_this3.active === SidebarView.ATTACHMENTS) { + _this3.switchView(SidebarView.THUMBS); + } + }); + }); + + this.eventBus._on("presentationmodechanged", function (evt) { + if (!evt.active && !evt.switchInProgress && _this3.isThumbnailViewVisible) { + _this3._updateThumbnailViewer(); + } + }); } - } - return globalEventBus; -} -exports.attachDOMEventsToEventBus = attachDOMEventsToEventBus; -exports.getGlobalEventBus = getGlobalEventBus; + }, { + key: "visibleView", + get: function get() { + return this.isOpen ? this.active : SidebarView.NONE; + } + }, { + key: "isThumbnailViewVisible", + get: function get() { + return this.isOpen && this.active === SidebarView.THUMBS; + } + }, { + key: "isOutlineViewVisible", + get: function get() { + return this.isOpen && this.active === SidebarView.OUTLINE; + } + }, { + key: "isAttachmentsViewVisible", + get: function get() { + return this.isOpen && this.active === SidebarView.ATTACHMENTS; + } + }]); + + return PDFSidebar; +}(); + +exports.PDFSidebar = PDFSidebar; /***/ }), -/* 15 */ +/* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4704,21 +5858,23 @@ exports.getGlobalEventBus = getGlobalEventBus; Object.defineProperty(exports, "__esModule", { value: true }); -exports.OverlayManager = undefined; +exports.OverlayManager = void 0; -var _regenerator = __webpack_require__(2); +var _regenerator = _interopRequireDefault(__webpack_require__(2)); -var _regenerator2 = _interopRequireDefault(_regenerator); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var OverlayManager = function () { +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var OverlayManager = /*#__PURE__*/function () { function OverlayManager() { _classCallCheck(this, OverlayManager); @@ -4728,34 +5884,36 @@ var OverlayManager = function () { } _createClass(OverlayManager, [{ - key: 'register', + key: "register", value: function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(name, element) { - var callerCloseMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - var canForceClose = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - var container; - return _regenerator2.default.wrap(function _callee$(_context) { + var _register = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(name, element) { + var callerCloseMethod, + canForceClose, + container, + _args = arguments; + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: - container = void 0; + callerCloseMethod = _args.length > 2 && _args[2] !== undefined ? _args[2] : null; + canForceClose = _args.length > 3 && _args[3] !== undefined ? _args[3] : false; if (!(!name || !element || !(container = element.parentNode))) { - _context.next = 5; + _context.next = 6; break; } - throw new Error('Not enough parameters.'); + throw new Error("Not enough parameters."); - case 5: + case 6: if (!this._overlays[name]) { - _context.next = 7; + _context.next = 8; break; } - throw new Error('The overlay is already registered.'); + throw new Error("The overlay is already registered."); - case 7: + case 8: this._overlays[name] = { element: element, container: container, @@ -4763,25 +5921,25 @@ var OverlayManager = function () { canForceClose: canForceClose }; - case 8: - case 'end': + case 9: + case "end": return _context.stop(); } } }, _callee, this); })); - function register(_x3, _x4) { - return _ref.apply(this, arguments); + function register(_x, _x2) { + return _register.apply(this, arguments); } return register; }() }, { - key: 'unregister', + key: "unregister", value: function () { - var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2(name) { - return _regenerator2.default.wrap(function _callee2$(_context2) { + var _unregister = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(name) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -4790,7 +5948,7 @@ var OverlayManager = function () { break; } - throw new Error('The overlay does not exist.'); + throw new Error("The overlay does not exist."); case 4: if (!(this._active === name)) { @@ -4798,30 +5956,30 @@ var OverlayManager = function () { break; } - throw new Error('The overlay cannot be removed while it is active.'); + throw new Error("The overlay cannot be removed while it is active."); case 6: delete this._overlays[name]; case 7: - case 'end': + case "end": return _context2.stop(); } } }, _callee2, this); })); - function unregister(_x5) { - return _ref2.apply(this, arguments); + function unregister(_x3) { + return _unregister.apply(this, arguments); } return unregister; }() }, { - key: 'open', + key: "open", value: function () { - var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee3(name) { - return _regenerator2.default.wrap(function _callee3$(_context3) { + var _open = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(name) { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -4830,7 +5988,7 @@ var OverlayManager = function () { break; } - throw new Error('The overlay does not exist.'); + throw new Error("The overlay does not exist."); case 4: if (!this._active) { @@ -4844,6 +6002,7 @@ var OverlayManager = function () { } this._closeThroughCaller(); + _context3.next = 14; break; @@ -4853,36 +6012,39 @@ var OverlayManager = function () { break; } - throw new Error('The overlay is already active.'); + throw new Error("The overlay is already active."); case 13: - throw new Error('Another overlay is currently active.'); + throw new Error("Another overlay is currently active."); case 14: this._active = name; - this._overlays[this._active].element.classList.remove('hidden'); - this._overlays[this._active].container.classList.remove('hidden'); - window.addEventListener('keydown', this._keyDownBound); + + this._overlays[this._active].element.classList.remove("hidden"); + + this._overlays[this._active].container.classList.remove("hidden"); + + window.addEventListener("keydown", this._keyDownBound); case 18: - case 'end': + case "end": return _context3.stop(); } } }, _callee3, this); })); - function open(_x6) { - return _ref3.apply(this, arguments); + function open(_x4) { + return _open.apply(this, arguments); } return open; }() }, { - key: 'close', + key: "close", value: function () { - var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee4(name) { - return _regenerator2.default.wrap(function _callee4$(_context4) { + var _close = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(name) { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: @@ -4891,7 +6053,7 @@ var OverlayManager = function () { break; } - throw new Error('The overlay does not exist.'); + throw new Error("The overlay does not exist."); case 4: if (this._active) { @@ -4899,7 +6061,7 @@ var OverlayManager = function () { break; } - throw new Error('The overlay is currently not active.'); + throw new Error("The overlay is currently not active."); case 8: if (!(this._active !== name)) { @@ -4907,48 +6069,52 @@ var OverlayManager = function () { break; } - throw new Error('Another overlay is currently active.'); + throw new Error("Another overlay is currently active."); case 10: - this._overlays[this._active].container.classList.add('hidden'); - this._overlays[this._active].element.classList.add('hidden'); + this._overlays[this._active].container.classList.add("hidden"); + + this._overlays[this._active].element.classList.add("hidden"); + this._active = null; - window.removeEventListener('keydown', this._keyDownBound); + window.removeEventListener("keydown", this._keyDownBound); case 14: - case 'end': + case "end": return _context4.stop(); } } }, _callee4, this); })); - function close(_x7) { - return _ref4.apply(this, arguments); + function close(_x5) { + return _close.apply(this, arguments); } return close; }() }, { - key: '_keyDown', + key: "_keyDown", value: function _keyDown(evt) { if (this._active && evt.keyCode === 27) { this._closeThroughCaller(); + evt.preventDefault(); } } }, { - key: '_closeThroughCaller', + key: "_closeThroughCaller", value: function _closeThroughCaller() { if (this._overlays[this._active].callerCloseMethod) { this._overlays[this._active].callerCloseMethod(); } + if (this._active) { this.close(this._active); } } }, { - key: 'active', + key: "active", get: function get() { return this._active; } @@ -4960,7 +6126,7 @@ var OverlayManager = function () { exports.OverlayManager = OverlayManager; /***/ }), -/* 16 */ +/* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4969,17 +6135,19 @@ exports.OverlayManager = OverlayManager; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PasswordPrompt = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +exports.PasswordPrompt = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); -var _pdfjsLib = __webpack_require__(7); +var _pdfjsLib = __webpack_require__(8); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var PasswordPrompt = function () { +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var PasswordPrompt = /*#__PURE__*/function () { function PasswordPrompt(options, overlayManager) { var _this = this; @@ -4997,9 +6165,9 @@ var PasswordPrompt = function () { this.l10n = l10n; this.updateCallback = null; this.reason = null; - this.submitButton.addEventListener('click', this.verify.bind(this)); - this.cancelButton.addEventListener('click', this.close.bind(this)); - this.input.addEventListener('keydown', function (e) { + this.submitButton.addEventListener("click", this.verify.bind(this)); + this.cancelButton.addEventListener("click", this.close.bind(this)); + this.input.addEventListener("keydown", function (e) { if (e.keyCode === 13) { _this.verify(); } @@ -5008,43 +6176,47 @@ var PasswordPrompt = function () { } _createClass(PasswordPrompt, [{ - key: 'open', + key: "open", value: function open() { var _this2 = this; this.overlayManager.open(this.overlayName).then(function () { _this2.input.focus(); - var promptString = void 0; + + var promptString; + if (_this2.reason === _pdfjsLib.PasswordResponses.INCORRECT_PASSWORD) { - promptString = _this2.l10n.get('password_invalid', null, 'Invalid password. Please try again.'); + promptString = _this2.l10n.get("password_invalid", null, "Invalid password. Please try again."); } else { - promptString = _this2.l10n.get('password_label', null, 'Enter the password to open this PDF file.'); + promptString = _this2.l10n.get("password_label", null, "Enter the password to open this PDF file."); } + promptString.then(function (msg) { _this2.label.textContent = msg; }); }); } }, { - key: 'close', + key: "close", value: function close() { var _this3 = this; this.overlayManager.close(this.overlayName).then(function () { - _this3.input.value = ''; + _this3.input.value = ""; }); } }, { - key: 'verify', + key: "verify", value: function verify() { var password = this.input.value; + if (password && password.length > 0) { this.close(); - return this.updateCallback(password); + this.updateCallback(password); } } }, { - key: 'setUpdateCallback', + key: "setUpdateCallback", value: function setUpdateCallback(updateCallback, reason) { this.updateCallback = updateCallback; this.reason = reason; @@ -5057,7 +6229,7 @@ var PasswordPrompt = function () { exports.PasswordPrompt = PasswordPrompt; /***/ }), -/* 17 */ +/* 15 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5066,15 +6238,17 @@ exports.PasswordPrompt = PasswordPrompt; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFAttachmentViewer = undefined; +exports.PDFAttachmentViewer = void 0; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _pdfjsLib = __webpack_require__(7); +var _pdfjsLib = __webpack_require__(8); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var PDFAttachmentViewer = function () { +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var PDFAttachmentViewer = /*#__PURE__*/function () { function PDFAttachmentViewer(_ref) { var container = _ref.container, eventBus = _ref.eventBus, @@ -5086,104 +6260,129 @@ var PDFAttachmentViewer = function () { this.eventBus = eventBus; this.downloadManager = downloadManager; this.reset(); - this.eventBus.on('fileattachmentannotation', this._appendAttachment.bind(this)); + + this.eventBus._on("fileattachmentannotation", this._appendAttachment.bind(this)); } _createClass(PDFAttachmentViewer, [{ - key: 'reset', + key: "reset", value: function reset() { var keepRenderedCapability = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - this.attachments = null; - this.container.textContent = ''; + this.container.textContent = ""; + if (!keepRenderedCapability) { this._renderedCapability = (0, _pdfjsLib.createPromiseCapability)(); } } }, { - key: '_dispatchEvent', + key: "_dispatchEvent", value: function _dispatchEvent(attachmentsCount) { this._renderedCapability.resolve(); - this.eventBus.dispatch('attachmentsloaded', { + + this.eventBus.dispatch("attachmentsloaded", { source: this, attachmentsCount: attachmentsCount }); } }, { - key: '_bindPdfLink', + key: "_bindPdfLink", value: function _bindPdfLink(button, content, filename) { - if (this.downloadManager.disableCreateObjectURL) { - throw new Error('bindPdfLink: Unsupported "disableCreateObjectURL" value.'); - } - var blobUrl = void 0; + var _this = this; + + var blobUrl; + button.onclick = function () { if (!blobUrl) { - blobUrl = (0, _pdfjsLib.createObjectURL)(content, 'application/pdf'); + blobUrl = URL.createObjectURL(new Blob([content], { + type: "application/pdf" + })); + } + + var viewerUrl; + viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename); + + try { + window.open(viewerUrl); + } catch (ex) { + console.error("_bindPdfLink: ".concat(ex)); + URL.revokeObjectURL(blobUrl); + blobUrl = null; + + _this.downloadManager.downloadData(content, filename, "application/pdf"); } - var viewerUrl = void 0; - viewerUrl = '?file=' + encodeURIComponent(blobUrl + '#' + filename); - window.open(viewerUrl); + return false; }; } }, { - key: '_bindLink', + key: "_bindLink", value: function _bindLink(button, content, filename) { - var _this = this; + var _this2 = this; button.onclick = function () { - _this.downloadManager.downloadData(content, filename, ''); + _this2.downloadManager.downloadData(content, filename, ""); + return false; }; } }, { - key: 'render', + key: "render", value: function render(_ref2) { var attachments = _ref2.attachments, _ref2$keepRenderedCap = _ref2.keepRenderedCapability, - keepRenderedCapability = _ref2$keepRenderedCap === undefined ? false : _ref2$keepRenderedCap; - + keepRenderedCapability = _ref2$keepRenderedCap === void 0 ? false : _ref2$keepRenderedCap; var attachmentsCount = 0; + if (this.attachments) { this.reset(keepRenderedCapability === true); } + this.attachments = attachments || null; + if (!attachments) { this._dispatchEvent(attachmentsCount); + return; } + var names = Object.keys(attachments).sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); }); attachmentsCount = names.length; + for (var i = 0; i < attachmentsCount; i++) { var item = attachments[names[i]]; var filename = (0, _pdfjsLib.removeNullCharacters)((0, _pdfjsLib.getFilenameFromUrl)(item.filename)); - var div = document.createElement('div'); - div.className = 'attachmentsItem'; - var button = document.createElement('button'); + var div = document.createElement("div"); + div.className = "attachmentsItem"; + var button = document.createElement("button"); button.textContent = filename; + if (/\.pdf$/i.test(filename) && !this.downloadManager.disableCreateObjectURL) { this._bindPdfLink(button, item.content, filename); } else { this._bindLink(button, item.content, filename); } + div.appendChild(button); this.container.appendChild(div); } + this._dispatchEvent(attachmentsCount); } }, { - key: '_appendAttachment', + key: "_appendAttachment", value: function _appendAttachment(_ref3) { - var _this2 = this; + var _this3 = this; var id = _ref3.id, filename = _ref3.filename, content = _ref3.content; this._renderedCapability.promise.then(function () { - var attachments = _this2.attachments; + var attachments = _this3.attachments; + if (!attachments) { attachments = Object.create(null); } else { @@ -5193,11 +6392,13 @@ var PDFAttachmentViewer = function () { } } } + attachments[id] = { filename: filename, content: content }; - _this2.render({ + + _this3.render({ attachments: attachments, keepRenderedCapability: true }); @@ -5211,7 +6412,7 @@ var PDFAttachmentViewer = function () { exports.PDFAttachmentViewer = PDFAttachmentViewer; /***/ }), -/* 18 */ +/* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5220,43 +6421,63 @@ exports.PDFAttachmentViewer = PDFAttachmentViewer; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFDocumentProperties = undefined; +exports.PDFDocumentProperties = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +var _pdfjsLib = __webpack_require__(8); + +var _ui_utils = __webpack_require__(5); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -var _ui_utils = __webpack_require__(6); +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -var _pdfjsLib = __webpack_require__(7); +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var DEFAULT_FIELD_CONTENT = '-'; -var NON_METRIC_LOCALES = ['en-us', 'en-lr', 'my']; +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var DEFAULT_FIELD_CONTENT = "-"; +var NON_METRIC_LOCALES = ["en-us", "en-lr", "my"]; var US_PAGE_NAMES = { - '8.5x11': 'Letter', - '8.5x14': 'Legal' + "8.5x11": "Letter", + "8.5x14": "Legal" }; var METRIC_PAGE_NAMES = { - '297x420': 'A3', - '210x297': 'A4' + "297x420": "A3", + "210x297": "A4" }; + function getPageName(size, isPortrait, pageNames) { var width = isPortrait ? size.width : size.height; var height = isPortrait ? size.height : size.width; - return pageNames[width + 'x' + height]; + return pageNames["".concat(width, "x").concat(height)]; } -var PDFDocumentProperties = function () { +var PDFDocumentProperties = /*#__PURE__*/function () { function PDFDocumentProperties(_ref, overlayManager, eventBus) { + var _this = this; + var overlayName = _ref.overlayName, fields = _ref.fields, container = _ref.container, closeButton = _ref.closeButton; - - var _this = this; - var l10n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _ui_utils.NullL10n; _classCallCheck(this, PDFDocumentProperties); @@ -5266,19 +6487,20 @@ var PDFDocumentProperties = function () { this.container = container; this.overlayManager = overlayManager; this.l10n = l10n; + this._reset(); - if (closeButton) { - closeButton.addEventListener('click', this.close.bind(this)); - } + + closeButton.addEventListener("click", this.close.bind(this)); this.overlayManager.register(this.overlayName, this.container, this.close.bind(this)); - if (eventBus) { - eventBus.on('pagechanging', function (evt) { - _this._currentPageNumber = evt.pageNumber; - }); - eventBus.on('rotationchanging', function (evt) { - _this._pagesRotation = evt.pagesRotation; - }); - } + + eventBus._on("pagechanging", function (evt) { + _this._currentPageNumber = evt.pageNumber; + }); + + eventBus._on("rotationchanging", function (evt) { + _this._pagesRotation = evt.pagesRotation; + }); + this._isNonMetricLocale = true; l10n.getLanguage().then(function (locale) { _this._isNonMetricLocale = NON_METRIC_LOCALES.includes(locale); @@ -5286,31 +6508,34 @@ var PDFDocumentProperties = function () { } _createClass(PDFDocumentProperties, [{ - key: 'open', + key: "open", value: function open() { var _this2 = this; var freezeFieldData = function freezeFieldData(data) { - Object.defineProperty(_this2, 'fieldData', { + Object.defineProperty(_this2, "fieldData", { value: Object.freeze(data), writable: false, enumerable: true, configurable: true }); }; + Promise.all([this.overlayManager.open(this.overlayName), this._dataAvailableCapability.promise]).then(function () { var currentPageNumber = _this2._currentPageNumber; var pagesRotation = _this2._pagesRotation; - if (_this2.fieldData && currentPageNumber === _this2.fieldData['_currentPageNumber'] && pagesRotation === _this2.fieldData['_pagesRotation']) { + + if (_this2.fieldData && currentPageNumber === _this2.fieldData._currentPageNumber && pagesRotation === _this2.fieldData._pagesRotation) { _this2._updateUI(); + return; } + _this2.pdfDocument.getMetadata().then(function (_ref2) { var info = _ref2.info, metadata = _ref2.metadata, contentDispositionFilename = _ref2.contentDispositionFilename; - - return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(_this2.url || ''), _this2._parseFileSize(_this2.maybeFileSize), _this2._parseDate(info.CreationDate), _this2._parseDate(info.ModDate), _this2.pdfDocument.getPage(currentPageNumber).then(function (pdfPage) { + return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(_this2.url), _this2._parseFileSize(_this2.maybeFileSize), _this2._parseDate(info.CreationDate), _this2._parseDate(info.ModDate), _this2.pdfDocument.getPage(currentPageNumber).then(function (pdfPage) { return _this2._parsePageSize((0, _ui_utils.getPageSizeInches)(pdfPage), pagesRotation); }), _this2._parseLinearization(info.IsLinearized)]); }).then(function (_ref3) { @@ -5325,71 +6550,78 @@ var PDFDocumentProperties = function () { isLinearized = _ref4[7]; freezeFieldData({ - 'fileName': fileName, - 'fileSize': fileSize, - 'title': info.Title, - 'author': info.Author, - 'subject': info.Subject, - 'keywords': info.Keywords, - 'creationDate': creationDate, - 'modificationDate': modDate, - 'creator': info.Creator, - 'producer': info.Producer, - 'version': info.PDFFormatVersion, - 'pageCount': _this2.pdfDocument.numPages, - 'pageSize': pageSize, - 'linearized': isLinearized, - '_currentPageNumber': currentPageNumber, - '_pagesRotation': pagesRotation + fileName: fileName, + fileSize: fileSize, + title: info.Title, + author: info.Author, + subject: info.Subject, + keywords: info.Keywords, + creationDate: creationDate, + modificationDate: modDate, + creator: info.Creator, + producer: info.Producer, + version: info.PDFFormatVersion, + pageCount: _this2.pdfDocument.numPages, + pageSize: pageSize, + linearized: isLinearized, + _currentPageNumber: currentPageNumber, + _pagesRotation: pagesRotation }); + _this2._updateUI(); + return _this2.pdfDocument.getDownloadInfo(); }).then(function (_ref5) { var length = _ref5.length; - _this2.maybeFileSize = length; return _this2._parseFileSize(length); }).then(function (fileSize) { - if (fileSize === _this2.fieldData['fileSize']) { + if (fileSize === _this2.fieldData.fileSize) { return; } + var data = Object.assign(Object.create(null), _this2.fieldData); - data['fileSize'] = fileSize; + data.fileSize = fileSize; freezeFieldData(data); + _this2._updateUI(); }); }); } }, { - key: 'close', + key: "close", value: function close() { this.overlayManager.close(this.overlayName); } }, { - key: 'setDocument', + key: "setDocument", value: function setDocument(pdfDocument) { var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; if (this.pdfDocument) { this._reset(); + this._updateUI(true); } + if (!pdfDocument) { return; } + this.pdfDocument = pdfDocument; this.url = url; + this._dataAvailableCapability.resolve(); } }, { - key: 'setFileSize', + key: "setFileSize", value: function setFileSize(fileSize) { if (Number.isInteger(fileSize) && fileSize > 0) { this.maybeFileSize = fileSize; } } }, { - key: '_reset', + key: "_reset", value: function _reset() { this.pdfDocument = null; this.url = null; @@ -5400,7 +6632,7 @@ var PDFDocumentProperties = function () { this._pagesRotation = 0; } }, { - key: '_updateUI', + key: "_updateUI", value: function _updateUI() { var reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; @@ -5408,139 +6640,210 @@ var PDFDocumentProperties = function () { for (var id in this.fields) { this.fields[id].textContent = DEFAULT_FIELD_CONTENT; } + return; } + if (this.overlayManager.active !== this.overlayName) { return; } + for (var _id in this.fields) { var content = this.fieldData[_id]; this.fields[_id].textContent = content || content === 0 ? content : DEFAULT_FIELD_CONTENT; } } }, { - key: '_parseFileSize', - value: function _parseFileSize() { - var fileSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + key: "_parseFileSize", + value: function () { + var _parseFileSize2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() { + var fileSize, + kb, + _args = arguments; + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + fileSize = _args.length > 0 && _args[0] !== undefined ? _args[0] : 0; + kb = fileSize / 1024; - var kb = fileSize / 1024; - if (!kb) { - return Promise.resolve(undefined); - } else if (kb < 1024) { - return this.l10n.get('document_properties_kb', { - size_kb: (+kb.toPrecision(3)).toLocaleString(), - size_b: fileSize.toLocaleString() - }, '{{size_kb}} KB ({{size_b}} bytes)'); + if (kb) { + _context.next = 6; + break; + } + + return _context.abrupt("return", undefined); + + case 6: + if (!(kb < 1024)) { + _context.next = 8; + break; + } + + return _context.abrupt("return", this.l10n.get("document_properties_kb", { + size_kb: (+kb.toPrecision(3)).toLocaleString(), + size_b: fileSize.toLocaleString() + }, "{{size_kb}} KB ({{size_b}} bytes)")); + + case 8: + return _context.abrupt("return", this.l10n.get("document_properties_mb", { + size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(), + size_b: fileSize.toLocaleString() + }, "{{size_mb}} MB ({{size_b}} bytes)")); + + case 9: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function _parseFileSize() { + return _parseFileSize2.apply(this, arguments); } - return this.l10n.get('document_properties_mb', { - size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(), - size_b: fileSize.toLocaleString() - }, '{{size_mb}} MB ({{size_b}} bytes)'); - } + + return _parseFileSize; + }() }, { - key: '_parsePageSize', - value: function _parsePageSize(pageSizeInches, pagesRotation) { - var _this3 = this; + key: "_parsePageSize", + value: function () { + var _parsePageSize2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(pageSizeInches, pagesRotation) { + var _this3 = this; - if (!pageSizeInches) { - return Promise.resolve(undefined); - } - if (pagesRotation % 180 !== 0) { - pageSizeInches = { - width: pageSizeInches.height, - height: pageSizeInches.width - }; - } - var isPortrait = (0, _ui_utils.isPortraitOrientation)(pageSizeInches); - var sizeInches = { - width: Math.round(pageSizeInches.width * 100) / 100, - height: Math.round(pageSizeInches.height * 100) / 100 - }; - var sizeMillimeters = { - width: Math.round(pageSizeInches.width * 25.4 * 10) / 10, - height: Math.round(pageSizeInches.height * 25.4 * 10) / 10 - }; - var pageName = null; - var name = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES); - if (!name && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) { - var exactMillimeters = { - width: pageSizeInches.width * 25.4, - height: pageSizeInches.height * 25.4 - }; - var intMillimeters = { - width: Math.round(sizeMillimeters.width), - height: Math.round(sizeMillimeters.height) - }; - if (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) { - name = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES); - if (name) { - sizeInches = { - width: Math.round(intMillimeters.width / 25.4 * 100) / 100, - height: Math.round(intMillimeters.height / 25.4 * 100) / 100 - }; - sizeMillimeters = intMillimeters; + var isPortrait, sizeInches, sizeMillimeters, pageName, rawName, exactMillimeters, intMillimeters; + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (pageSizeInches) { + _context2.next = 2; + break; + } + + return _context2.abrupt("return", undefined); + + case 2: + if (pagesRotation % 180 !== 0) { + pageSizeInches = { + width: pageSizeInches.height, + height: pageSizeInches.width + }; + } + + isPortrait = (0, _ui_utils.isPortraitOrientation)(pageSizeInches); + sizeInches = { + width: Math.round(pageSizeInches.width * 100) / 100, + height: Math.round(pageSizeInches.height * 100) / 100 + }; + sizeMillimeters = { + width: Math.round(pageSizeInches.width * 25.4 * 10) / 10, + height: Math.round(pageSizeInches.height * 25.4 * 10) / 10 + }; + pageName = null; + rawName = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES); + + if (!rawName && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) { + exactMillimeters = { + width: pageSizeInches.width * 25.4, + height: pageSizeInches.height * 25.4 + }; + intMillimeters = { + width: Math.round(sizeMillimeters.width), + height: Math.round(sizeMillimeters.height) + }; + + if (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) { + rawName = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES); + + if (rawName) { + sizeInches = { + width: Math.round(intMillimeters.width / 25.4 * 100) / 100, + height: Math.round(intMillimeters.height / 25.4 * 100) / 100 + }; + sizeMillimeters = intMillimeters; + } + } + } + + if (rawName) { + pageName = this.l10n.get("document_properties_page_size_name_" + rawName.toLowerCase(), null, rawName); + } + + return _context2.abrupt("return", Promise.all([this._isNonMetricLocale ? sizeInches : sizeMillimeters, this.l10n.get("document_properties_page_size_unit_" + (this._isNonMetricLocale ? "inches" : "millimeters"), null, this._isNonMetricLocale ? "in" : "mm"), pageName, this.l10n.get("document_properties_page_size_orientation_" + (isPortrait ? "portrait" : "landscape"), null, isPortrait ? "portrait" : "landscape")]).then(function (_ref6) { + var _ref7 = _slicedToArray(_ref6, 4), + _ref7$ = _ref7[0], + width = _ref7$.width, + height = _ref7$.height, + unit = _ref7[1], + name = _ref7[2], + orientation = _ref7[3]; + + return _this3.l10n.get("document_properties_page_size_dimension_" + (name ? "name_" : "") + "string", { + width: width.toLocaleString(), + height: height.toLocaleString(), + unit: unit, + name: name, + orientation: orientation + }, "{{width}} × {{height}} {{unit}} (" + (name ? "{{name}}, " : "") + "{{orientation}})"); + })); + + case 11: + case "end": + return _context2.stop(); + } } - } - } - if (name) { - pageName = this.l10n.get('document_properties_page_size_name_' + name.toLowerCase(), null, name); + }, _callee2, this); + })); + + function _parsePageSize(_x, _x2) { + return _parsePageSize2.apply(this, arguments); } - return Promise.all([this._isNonMetricLocale ? sizeInches : sizeMillimeters, this.l10n.get('document_properties_page_size_unit_' + (this._isNonMetricLocale ? 'inches' : 'millimeters'), null, this._isNonMetricLocale ? 'in' : 'mm'), pageName, this.l10n.get('document_properties_page_size_orientation_' + (isPortrait ? 'portrait' : 'landscape'), null, isPortrait ? 'portrait' : 'landscape')]).then(function (_ref6) { - var _ref7 = _slicedToArray(_ref6, 4), - _ref7$ = _ref7[0], - width = _ref7$.width, - height = _ref7$.height, - unit = _ref7[1], - name = _ref7[2], - orientation = _ref7[3]; - return _this3.l10n.get('document_properties_page_size_dimension_' + (name ? 'name_' : '') + 'string', { - width: width.toLocaleString(), - height: height.toLocaleString(), - unit: unit, - name: name, - orientation: orientation - }, '{{width}} × {{height}} {{unit}} (' + (name ? '{{name}}, ' : '') + '{{orientation}})'); - }); - } + return _parsePageSize; + }() }, { - key: '_parseDate', - value: function _parseDate(inputDate) { - if (!inputDate) { - return; + key: "_parseDate", + value: function () { + var _parseDate2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(inputDate) { + var dateObject; + return _regenerator["default"].wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + dateObject = _pdfjsLib.PDFDateString.toDateObject(inputDate); + + if (dateObject) { + _context3.next = 3; + break; + } + + return _context3.abrupt("return", undefined); + + case 3: + return _context3.abrupt("return", this.l10n.get("document_properties_date_string", { + date: dateObject.toLocaleDateString(), + time: dateObject.toLocaleTimeString() + }, "{{date}}, {{time}}")); + + case 4: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function _parseDate(_x3) { + return _parseDate2.apply(this, arguments); } - var dateToParse = inputDate; - if (dateToParse.substring(0, 2) === 'D:') { - dateToParse = dateToParse.substring(2); - } - var year = parseInt(dateToParse.substring(0, 4), 10); - var month = parseInt(dateToParse.substring(4, 6), 10) - 1; - var day = parseInt(dateToParse.substring(6, 8), 10); - var hours = parseInt(dateToParse.substring(8, 10), 10); - var minutes = parseInt(dateToParse.substring(10, 12), 10); - var seconds = parseInt(dateToParse.substring(12, 14), 10); - var utRel = dateToParse.substring(14, 15); - var offsetHours = parseInt(dateToParse.substring(15, 17), 10); - var offsetMinutes = parseInt(dateToParse.substring(18, 20), 10); - if (utRel === '-') { - hours += offsetHours; - minutes += offsetMinutes; - } else if (utRel === '+') { - hours -= offsetHours; - minutes -= offsetMinutes; - } - var date = new Date(Date.UTC(year, month, day, hours, minutes, seconds)); - var dateString = date.toLocaleDateString(); - var timeString = date.toLocaleTimeString(); - return this.l10n.get('document_properties_date_string', { - date: dateString, - time: timeString - }, '{{date}}, {{time}}'); - } - }, { - key: '_parseLinearization', + + return _parseDate; + }() + }, { + key: "_parseLinearization", value: function _parseLinearization(isLinearized) { - return this.l10n.get('document_properties_linearized_' + (isLinearized ? 'yes' : 'no'), null, isLinearized ? 'Yes' : 'No'); + return this.l10n.get("document_properties_linearized_" + (isLinearized ? "yes" : "no"), null, isLinearized ? "Yes" : "No"); } }]); @@ -5550,7 +6853,7 @@ var PDFDocumentProperties = function () { exports.PDFDocumentProperties = PDFDocumentProperties; /***/ }), -/* 19 */ +/* 17 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5559,23 +6862,24 @@ exports.PDFDocumentProperties = PDFDocumentProperties; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFFindBar = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +exports.PDFFindBar = void 0; -var _ui_utils = __webpack_require__(6); +var _pdf_find_controller = __webpack_require__(18); -var _pdf_find_controller = __webpack_require__(20); +var _ui_utils = __webpack_require__(5); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var MATCHES_COUNT_LIMIT = 1000; -var PDFFindBar = function () { - function PDFFindBar(options) { +var PDFFindBar = /*#__PURE__*/function () { + function PDFFindBar(options, eventBus) { var _this = this; - var eventBus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _ui_utils.getGlobalEventBus)(); var l10n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ui_utils.NullL10n; _classCallCheck(this, PDFFindBar); @@ -5593,51 +6897,55 @@ var PDFFindBar = function () { this.findNextButton = options.findNextButton || null; this.eventBus = eventBus; this.l10n = l10n; - this.toggleButton.addEventListener('click', function () { + this.toggleButton.addEventListener("click", function () { _this.toggle(); }); - this.findField.addEventListener('input', function () { - _this.dispatchEvent(''); + this.findField.addEventListener("input", function () { + _this.dispatchEvent(""); }); - this.bar.addEventListener('keydown', function (e) { + this.bar.addEventListener("keydown", function (e) { switch (e.keyCode) { case 13: if (e.target === _this.findField) { - _this.dispatchEvent('again', e.shiftKey); + _this.dispatchEvent("again", e.shiftKey); } + break; + case 27: _this.close(); + break; } }); - this.findPreviousButton.addEventListener('click', function () { - _this.dispatchEvent('again', true); + this.findPreviousButton.addEventListener("click", function () { + _this.dispatchEvent("again", true); }); - this.findNextButton.addEventListener('click', function () { - _this.dispatchEvent('again', false); + this.findNextButton.addEventListener("click", function () { + _this.dispatchEvent("again", false); }); - this.highlightAll.addEventListener('click', function () { - _this.dispatchEvent('highlightallchange'); + this.highlightAll.addEventListener("click", function () { + _this.dispatchEvent("highlightallchange"); }); - this.caseSensitive.addEventListener('click', function () { - _this.dispatchEvent('casesensitivitychange'); + this.caseSensitive.addEventListener("click", function () { + _this.dispatchEvent("casesensitivitychange"); }); - this.entireWord.addEventListener('click', function () { - _this.dispatchEvent('entirewordchange'); + this.entireWord.addEventListener("click", function () { + _this.dispatchEvent("entirewordchange"); }); - this.eventBus.on('resize', this._adjustWidth.bind(this)); + + this.eventBus._on("resize", this._adjustWidth.bind(this)); } _createClass(PDFFindBar, [{ - key: 'reset', + key: "reset", value: function reset() { this.updateUIState(); } }, { - key: 'dispatchEvent', + key: "dispatchEvent", value: function dispatchEvent(type, findPrev) { - this.eventBus.dispatch('find', { + this.eventBus.dispatch("find", { source: this, type: type, query: this.findField.value, @@ -5649,96 +6957,115 @@ var PDFFindBar = function () { }); } }, { - key: 'updateUIState', + key: "updateUIState", value: function updateUIState(state, previous, matchesCount) { var _this2 = this; var notFound = false; - var findMsg = ''; - var status = ''; + var findMsg = ""; + var status = ""; + switch (state) { case _pdf_find_controller.FindState.FOUND: break; + case _pdf_find_controller.FindState.PENDING: - status = 'pending'; + status = "pending"; break; + case _pdf_find_controller.FindState.NOT_FOUND: - findMsg = this.l10n.get('find_not_found', null, 'Phrase not found'); + findMsg = this.l10n.get("find_not_found", null, "Phrase not found"); notFound = true; break; + case _pdf_find_controller.FindState.WRAPPED: if (previous) { - findMsg = this.l10n.get('find_reached_top', null, 'Reached top of document, continued from bottom'); + findMsg = this.l10n.get("find_reached_top", null, "Reached top of document, continued from bottom"); } else { - findMsg = this.l10n.get('find_reached_bottom', null, 'Reached end of document, continued from top'); + findMsg = this.l10n.get("find_reached_bottom", null, "Reached end of document, continued from top"); } + break; } - this.findField.classList.toggle('notFound', notFound); - this.findField.setAttribute('data-status', status); + + this.findField.classList.toggle("notFound", notFound); + this.findField.setAttribute("data-status", status); Promise.resolve(findMsg).then(function (msg) { _this2.findMsg.textContent = msg; + _this2._adjustWidth(); }); this.updateResultsCount(matchesCount); } }, { - key: 'updateResultsCount', + key: "updateResultsCount", value: function updateResultsCount() { var _this3 = this; var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$current = _ref.current, - current = _ref$current === undefined ? 0 : _ref$current, + current = _ref$current === void 0 ? 0 : _ref$current, _ref$total = _ref.total, - total = _ref$total === undefined ? 0 : _ref$total; + total = _ref$total === void 0 ? 0 : _ref$total; if (!this.findResultsCount) { return; } - var matchesCountMsg = '', - limit = MATCHES_COUNT_LIMIT; + + var limit = MATCHES_COUNT_LIMIT; + var matchesCountMsg = ""; + if (total > 0) { if (total > limit) { - matchesCountMsg = this.l10n.get('find_match_count_limit', { limit: limit }, 'More than {{limit}} match' + (limit !== 1 ? 'es' : '')); + matchesCountMsg = this.l10n.get("find_match_count_limit", { + limit: limit + }, "More than {{limit}} match" + (limit !== 1 ? "es" : "")); } else { - matchesCountMsg = this.l10n.get('find_match_count', { + matchesCountMsg = this.l10n.get("find_match_count", { current: current, total: total - }, '{{current}} of {{total}} match' + (total !== 1 ? 'es' : '')); + }, "{{current}} of {{total}} match" + (total !== 1 ? "es" : "")); } } + Promise.resolve(matchesCountMsg).then(function (msg) { _this3.findResultsCount.textContent = msg; - _this3.findResultsCount.classList[!total ? 'add' : 'remove']('hidden'); + + _this3.findResultsCount.classList.toggle("hidden", !total); + _this3._adjustWidth(); }); } }, { - key: 'open', + key: "open", value: function open() { if (!this.opened) { this.opened = true; - this.toggleButton.classList.add('toggled'); - this.bar.classList.remove('hidden'); + this.toggleButton.classList.add("toggled"); + this.bar.classList.remove("hidden"); } + this.findField.select(); this.findField.focus(); + this._adjustWidth(); } }, { - key: 'close', + key: "close", value: function close() { if (!this.opened) { return; } + this.opened = false; - this.toggleButton.classList.remove('toggled'); - this.bar.classList.add('hidden'); - this.eventBus.dispatch('findbarclose', { source: this }); + this.toggleButton.classList.remove("toggled"); + this.bar.classList.add("hidden"); + this.eventBus.dispatch("findbarclose", { + source: this + }); } }, { - key: 'toggle', + key: "toggle", value: function toggle() { if (this.opened) { this.close(); @@ -5747,16 +7074,18 @@ var PDFFindBar = function () { } } }, { - key: '_adjustWidth', + key: "_adjustWidth", value: function _adjustWidth() { if (!this.opened) { return; } - this.bar.classList.remove('wrapContainers'); + + this.bar.classList.remove("wrapContainers"); var findbarHeight = this.bar.clientHeight; var inputContainerHeight = this.bar.firstElementChild.clientHeight; + if (findbarHeight > inputContainerHeight) { - this.bar.classList.add('wrapContainers'); + this.bar.classList.add("wrapContainers"); } } }]); @@ -5767,7 +7096,7 @@ var PDFFindBar = function () { exports.PDFFindBar = PDFFindBar; /***/ }), -/* 20 */ +/* 18 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5776,104 +7105,182 @@ exports.PDFFindBar = PDFFindBar; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFFindController = exports.FindState = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +exports.PDFFindController = exports.FindState = void 0; -var _pdfjsLib = __webpack_require__(7); +var _pdfjsLib = __webpack_require__(8); -var _pdf_find_utils = __webpack_require__(21); +var _pdf_find_utils = __webpack_require__(19); -var _dom_events = __webpack_require__(14); +var _ui_utils = __webpack_require__(5); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var FindState = { FOUND: 0, NOT_FOUND: 1, WRAPPED: 2, PENDING: 3 }; +exports.FindState = FindState; var FIND_TIMEOUT = 250; +var MATCH_SCROLL_OFFSET_TOP = -50; +var MATCH_SCROLL_OFFSET_LEFT = -400; var CHARACTERS_TO_NORMALIZE = { - '\u2018': '\'', - '\u2019': '\'', - '\u201A': '\'', - '\u201B': '\'', - '\u201C': '"', - '\u201D': '"', - '\u201E': '"', - '\u201F': '"', - '\xBC': '1/4', - '\xBD': '1/2', - '\xBE': '3/4' + "\u2018": "'", + "\u2019": "'", + "\u201A": "'", + "\u201B": "'", + "\u201C": '"', + "\u201D": '"', + "\u201E": '"', + "\u201F": '"', + "\xBC": "1/4", + "\xBD": "1/2", + "\xBE": "3/4" }; +var normalizationRegex = null; + +function normalize(text) { + if (!normalizationRegex) { + var replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(""); + normalizationRegex = new RegExp("[".concat(replace, "]"), "g"); + } + + return text.replace(normalizationRegex, function (ch) { + return CHARACTERS_TO_NORMALIZE[ch]; + }); +} -var PDFFindController = function () { +var PDFFindController = /*#__PURE__*/function () { function PDFFindController(_ref) { var linkService = _ref.linkService, - _ref$eventBus = _ref.eventBus, - eventBus = _ref$eventBus === undefined ? (0, _dom_events.getGlobalEventBus)() : _ref$eventBus; + eventBus = _ref.eventBus; _classCallCheck(this, PDFFindController); this._linkService = linkService; this._eventBus = eventBus; + this._reset(); - eventBus.on('findbarclose', this._onFindBarClose.bind(this)); - var replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(''); - this._normalizationRegex = new RegExp('[' + replace + ']', 'g'); + + eventBus._on("findbarclose", this._onFindBarClose.bind(this)); } _createClass(PDFFindController, [{ - key: 'setDocument', + key: "setDocument", value: function setDocument(pdfDocument) { if (this._pdfDocument) { this._reset(); } + if (!pdfDocument) { return; } + this._pdfDocument = pdfDocument; + this._firstPageCapability.resolve(); } }, { - key: 'executeCommand', + key: "executeCommand", value: function executeCommand(cmd, state) { var _this = this; + if (!state) { + return; + } + var pdfDocument = this._pdfDocument; - if (this._state === null || cmd !== 'findagain') { + + if (this._state === null || this._shouldDirtyMatch(cmd, state)) { this._dirtyMatch = true; } + this._state = state; - this._updateUIState(FindState.PENDING); + + if (cmd !== "findhighlightallchange") { + this._updateUIState(FindState.PENDING); + } + this._firstPageCapability.promise.then(function () { if (!_this._pdfDocument || pdfDocument && _this._pdfDocument !== pdfDocument) { return; } + _this._extractText(); + + var findbarClosed = !_this._highlightMatches; + var pendingTimeout = !!_this._findTimeout; + if (_this._findTimeout) { clearTimeout(_this._findTimeout); _this._findTimeout = null; } - if (cmd === 'find') { + + if (cmd === "find") { _this._findTimeout = setTimeout(function () { _this._nextMatch(); + _this._findTimeout = null; }, FIND_TIMEOUT); + } else if (_this._dirtyMatch) { + _this._nextMatch(); + } else if (cmd === "findagain") { + _this._nextMatch(); + + if (findbarClosed && _this._state.highlightAll) { + _this._updateAllPages(); + } + } else if (cmd === "findhighlightallchange") { + if (pendingTimeout) { + _this._nextMatch(); + } else { + _this._highlightMatches = true; + } + + _this._updateAllPages(); } else { _this._nextMatch(); } }); } }, { - key: '_reset', + key: "scrollMatchIntoView", + value: function scrollMatchIntoView(_ref2) { + var _ref2$element = _ref2.element, + element = _ref2$element === void 0 ? null : _ref2$element, + _ref2$pageIndex = _ref2.pageIndex, + pageIndex = _ref2$pageIndex === void 0 ? -1 : _ref2$pageIndex, + _ref2$matchIndex = _ref2.matchIndex, + matchIndex = _ref2$matchIndex === void 0 ? -1 : _ref2$matchIndex; + + if (!this._scrollMatches || !element) { + return; + } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) { + return; + } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) { + return; + } + + this._scrollMatches = false; + var spot = { + top: MATCH_SCROLL_OFFSET_TOP, + left: MATCH_SCROLL_OFFSET_LEFT + }; + (0, _ui_utils.scrollIntoView)(element, spot, true); + } + }, { + key: "_reset", value: function _reset() { this._highlightMatches = false; + this._scrollMatches = false; this._pdfDocument = null; this._pageMatches = []; - this._pageMatchesLength = null; + this._pageMatchesLength = []; this._state = null; this._selected = { pageIdx: -1, @@ -5881,7 +7288,8 @@ var PDFFindController = function () { }; this._offset = { pageIdx: null, - matchIdx: null + matchIdx: null, + wrapped: false }; this._extractTextPromises = []; this._pageContents = []; @@ -5895,103 +7303,145 @@ var PDFFindController = function () { this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)(); } }, { - key: '_normalize', - value: function _normalize(text) { - return text.replace(this._normalizationRegex, function (ch) { - return CHARACTERS_TO_NORMALIZE[ch]; - }); + key: "_shouldDirtyMatch", + value: function _shouldDirtyMatch(cmd, state) { + if (state.query !== this._state.query) { + return true; + } + + switch (cmd) { + case "findagain": + var pageNumber = this._selected.pageIdx + 1; + var linkService = this._linkService; + + if (pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !linkService.isPageVisible(pageNumber)) { + return true; + } + + return false; + + case "findhighlightallchange": + return false; + } + + return true; } }, { - key: '_prepareMatches', + key: "_prepareMatches", value: function _prepareMatches(matchesWithLength, matches, matchesLength) { - function isSubTerm(matchesWithLength, currentIndex) { + function isSubTerm(currentIndex) { var currentElem = matchesWithLength[currentIndex]; var nextElem = matchesWithLength[currentIndex + 1]; + if (currentIndex < matchesWithLength.length - 1 && currentElem.match === nextElem.match) { currentElem.skipped = true; return true; } + for (var i = currentIndex - 1; i >= 0; i--) { var prevElem = matchesWithLength[i]; + if (prevElem.skipped) { continue; } + if (prevElem.match + prevElem.matchLength < currentElem.match) { break; } + if (prevElem.match + prevElem.matchLength >= currentElem.match + currentElem.matchLength) { currentElem.skipped = true; return true; } } + return false; } + matchesWithLength.sort(function (a, b) { return a.match === b.match ? a.matchLength - b.matchLength : a.match - b.match; }); + for (var i = 0, len = matchesWithLength.length; i < len; i++) { - if (isSubTerm(matchesWithLength, i)) { + if (isSubTerm(i)) { continue; } + matches.push(matchesWithLength[i].match); matchesLength.push(matchesWithLength[i].matchLength); } } }, { - key: '_isEntireWord', + key: "_isEntireWord", value: function _isEntireWord(content, startIdx, length) { if (startIdx > 0) { var first = content.charCodeAt(startIdx); var limit = content.charCodeAt(startIdx - 1); + if ((0, _pdf_find_utils.getCharacterType)(first) === (0, _pdf_find_utils.getCharacterType)(limit)) { return false; } } + var endIdx = startIdx + length - 1; + if (endIdx < content.length - 1) { var last = content.charCodeAt(endIdx); + var _limit = content.charCodeAt(endIdx + 1); + if ((0, _pdf_find_utils.getCharacterType)(last) === (0, _pdf_find_utils.getCharacterType)(_limit)) { return false; } } + return true; } }, { - key: '_calculatePhraseMatch', + key: "_calculatePhraseMatch", value: function _calculatePhraseMatch(query, pageIndex, pageContent, entireWord) { var matches = []; var queryLen = query.length; var matchIdx = -queryLen; + while (true) { matchIdx = pageContent.indexOf(query, matchIdx + queryLen); + if (matchIdx === -1) { break; } + if (entireWord && !this._isEntireWord(pageContent, matchIdx, queryLen)) { continue; } + matches.push(matchIdx); } + this._pageMatches[pageIndex] = matches; } }, { - key: '_calculateWordMatch', + key: "_calculateWordMatch", value: function _calculateWordMatch(query, pageIndex, pageContent, entireWord) { var matchesWithLength = []; var queryArray = query.match(/\S+/g); + for (var i = 0, len = queryArray.length; i < len; i++) { var subquery = queryArray[i]; var subqueryLen = subquery.length; var matchIdx = -subqueryLen; + while (true) { matchIdx = pageContent.indexOf(subquery, matchIdx + subqueryLen); + if (matchIdx === -1) { break; } + if (entireWord && !this._isEntireWord(pageContent, matchIdx, subqueryLen)) { continue; } + matchesWithLength.push({ match: matchIdx, matchLength: subqueryLen, @@ -5999,54 +7449,64 @@ var PDFFindController = function () { }); } } - if (!this._pageMatchesLength) { - this._pageMatchesLength = []; - } + this._pageMatchesLength[pageIndex] = []; this._pageMatches[pageIndex] = []; + this._prepareMatches(matchesWithLength, this._pageMatches[pageIndex], this._pageMatchesLength[pageIndex]); } }, { - key: '_calculateMatch', + key: "_calculateMatch", value: function _calculateMatch(pageIndex) { - var pageContent = this._normalize(this._pageContents[pageIndex]); - var query = this._normalize(this._state.query); - var _state = this._state, - caseSensitive = _state.caseSensitive, - entireWord = _state.entireWord, - phraseSearch = _state.phraseSearch; + var pageContent = this._pageContents[pageIndex]; + var query = this._query; + var _this$_state = this._state, + caseSensitive = _this$_state.caseSensitive, + entireWord = _this$_state.entireWord, + phraseSearch = _this$_state.phraseSearch; if (query.length === 0) { return; } + if (!caseSensitive) { pageContent = pageContent.toLowerCase(); query = query.toLowerCase(); } + if (phraseSearch) { this._calculatePhraseMatch(query, pageIndex, pageContent, entireWord); } else { this._calculateWordMatch(query, pageIndex, pageContent, entireWord); } - this._updatePage(pageIndex); + + if (this._state.highlightAll) { + this._updatePage(pageIndex); + } + if (this._resumePageIdx === pageIndex) { this._resumePageIdx = null; + this._nextPageMatch(); } + var pageMatchesCount = this._pageMatches[pageIndex].length; + if (pageMatchesCount > 0) { this._matchesCountTotal += pageMatchesCount; + this._updateUIResultsCount(); } } }, { - key: '_extractText', + key: "_extractText", value: function _extractText() { var _this2 = this; if (this._extractTextPromises.length > 0) { return; } + var promise = Promise.resolve(); var _loop = function _loop(i, ii) { @@ -6054,18 +7514,22 @@ var PDFFindController = function () { _this2._extractTextPromises[i] = extractTextCapability.promise; promise = promise.then(function () { return _this2._pdfDocument.getPage(i + 1).then(function (pdfPage) { - return pdfPage.getTextContent({ normalizeWhitespace: true }); + return pdfPage.getTextContent({ + normalizeWhitespace: true + }); }).then(function (textContent) { var textItems = textContent.items; var strBuf = []; + for (var j = 0, jj = textItems.length; j < jj; j++) { strBuf.push(textItems[j].str); } - _this2._pageContents[i] = strBuf.join(''); + + _this2._pageContents[i] = normalize(strBuf.join("")); extractTextCapability.resolve(i); }, function (reason) { - console.error('Unable to get text content for page ' + (i + 1), reason); - _this2._pageContents[i] = ''; + console.error("Unable to get text content for page ".concat(i + 1), reason); + _this2._pageContents[i] = ""; extractTextCapability.resolve(i); }); }); @@ -6076,18 +7540,27 @@ var PDFFindController = function () { } } }, { - key: '_updatePage', + key: "_updatePage", value: function _updatePage(index) { - if (this._selected.pageIdx === index) { + if (this._scrollMatches && this._selected.pageIdx === index) { this._linkService.page = index + 1; } - this._eventBus.dispatch('updatetextlayermatches', { + + this._eventBus.dispatch("updatetextlayermatches", { source: this, pageIndex: index }); } }, { - key: '_nextMatch', + key: "_updateAllPages", + value: function _updateAllPages() { + this._eventBus.dispatch("updatetextlayermatches", { + source: this, + pageIndex: -1 + }); + } + }, { + key: "_nextMatch", value: function _nextMatch() { var _this3 = this; @@ -6095,77 +7568,106 @@ var PDFFindController = function () { var currentPageIndex = this._linkService.page - 1; var numPages = this._linkService.pagesCount; this._highlightMatches = true; + if (this._dirtyMatch) { this._dirtyMatch = false; this._selected.pageIdx = this._selected.matchIdx = -1; this._offset.pageIdx = currentPageIndex; this._offset.matchIdx = null; + this._offset.wrapped = false; this._resumePageIdx = null; this._pageMatches.length = 0; - this._pageMatchesLength = null; + this._pageMatchesLength.length = 0; this._matchesCountTotal = 0; + + this._updateAllPages(); + for (var i = 0; i < numPages; i++) { - this._updatePage(i); - if (!(i in this._pendingFindMatches)) { - this._pendingFindMatches[i] = true; - this._extractTextPromises[i].then(function (pageIdx) { - delete _this3._pendingFindMatches[pageIdx]; - _this3._calculateMatch(pageIdx); - }); + if (this._pendingFindMatches[i] === true) { + continue; } + + this._pendingFindMatches[i] = true; + + this._extractTextPromises[i].then(function (pageIdx) { + delete _this3._pendingFindMatches[pageIdx]; + + _this3._calculateMatch(pageIdx); + }); } } - if (this._state.query === '') { + + if (this._query === "") { this._updateUIState(FindState.FOUND); + return; } + if (this._resumePageIdx) { return; } + var offset = this._offset; this._pagesToSearch = numPages; + if (offset.matchIdx !== null) { var numPageMatches = this._pageMatches[offset.pageIdx].length; + if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) { offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1; + this._updateMatch(true); + return; } + this._advanceOffsetPage(previous); } + this._nextPageMatch(); } }, { - key: '_matchesReady', + key: "_matchesReady", value: function _matchesReady(matches) { var offset = this._offset; var numMatches = matches.length; var previous = this._state.findPrevious; + if (numMatches) { offset.matchIdx = previous ? numMatches - 1 : 0; + this._updateMatch(true); + return true; } + this._advanceOffsetPage(previous); + if (offset.wrapped) { offset.matchIdx = null; + if (this._pagesToSearch < 0) { this._updateMatch(false); + return true; } } + return false; } }, { - key: '_nextPageMatch', + key: "_nextPageMatch", value: function _nextPageMatch() { if (this._resumePageIdx !== null) { - console.error('There can only be one pending page.'); + console.error("There can only be one pending page."); } + var matches = null; + do { var pageIdx = this._offset.pageIdx; matches = this._pageMatches[pageIdx]; + if (!matches) { this._resumePageIdx = pageIdx; break; @@ -6173,97 +7675,113 @@ var PDFFindController = function () { } while (!this._matchesReady(matches)); } }, { - key: '_advanceOffsetPage', + key: "_advanceOffsetPage", value: function _advanceOffsetPage(previous) { var offset = this._offset; var numPages = this._linkService.pagesCount; offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1; offset.matchIdx = null; this._pagesToSearch--; + if (offset.pageIdx >= numPages || offset.pageIdx < 0) { offset.pageIdx = previous ? numPages - 1 : 0; offset.wrapped = true; } } }, { - key: '_updateMatch', + key: "_updateMatch", value: function _updateMatch() { var found = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - var state = FindState.NOT_FOUND; var wrapped = this._offset.wrapped; this._offset.wrapped = false; + if (found) { var previousPage = this._selected.pageIdx; this._selected.pageIdx = this._offset.pageIdx; this._selected.matchIdx = this._offset.matchIdx; state = wrapped ? FindState.WRAPPED : FindState.FOUND; + if (previousPage !== -1 && previousPage !== this._selected.pageIdx) { this._updatePage(previousPage); } } + this._updateUIState(state, this._state.findPrevious); + if (this._selected.pageIdx !== -1) { + this._scrollMatches = true; + this._updatePage(this._selected.pageIdx); } } }, { - key: '_onFindBarClose', + key: "_onFindBarClose", value: function _onFindBarClose(evt) { var _this4 = this; var pdfDocument = this._pdfDocument; + this._firstPageCapability.promise.then(function () { if (!_this4._pdfDocument || pdfDocument && _this4._pdfDocument !== pdfDocument) { return; } + if (_this4._findTimeout) { clearTimeout(_this4._findTimeout); _this4._findTimeout = null; - _this4._updateUIState(FindState.FOUND); } + + if (_this4._resumePageIdx) { + _this4._resumePageIdx = null; + _this4._dirtyMatch = true; + } + + _this4._updateUIState(FindState.FOUND); + _this4._highlightMatches = false; - _this4._eventBus.dispatch('updatetextlayermatches', { - source: _this4, - pageIndex: -1 - }); + + _this4._updateAllPages(); }); } }, { - key: '_requestMatchesCount', + key: "_requestMatchesCount", value: function _requestMatchesCount() { - var _selected = this._selected, - pageIdx = _selected.pageIdx, - matchIdx = _selected.matchIdx; - + var _this$_selected = this._selected, + pageIdx = _this$_selected.pageIdx, + matchIdx = _this$_selected.matchIdx; var current = 0, total = this._matchesCountTotal; + if (matchIdx !== -1) { for (var i = 0; i < pageIdx; i++) { current += this._pageMatches[i] && this._pageMatches[i].length || 0; } + current += matchIdx + 1; } + if (current < 1 || current > total) { current = total = 0; } + return { current: current, total: total }; } }, { - key: '_updateUIResultsCount', + key: "_updateUIResultsCount", value: function _updateUIResultsCount() { - this._eventBus.dispatch('updatefindmatchescount', { + this._eventBus.dispatch("updatefindmatchescount", { source: this, matchesCount: this._requestMatchesCount() }); } }, { - key: '_updateUIState', + key: "_updateUIState", value: function _updateUIState(state, previous) { - this._eventBus.dispatch('updatefindcontrolstate', { + this._eventBus.dispatch("updatefindcontrolstate", { source: this, state: state, previous: previous, @@ -6271,40 +7789,49 @@ var PDFFindController = function () { }); } }, { - key: 'highlightMatches', + key: "highlightMatches", get: function get() { return this._highlightMatches; } }, { - key: 'pageMatches', + key: "pageMatches", get: function get() { return this._pageMatches; } }, { - key: 'pageMatchesLength', + key: "pageMatchesLength", get: function get() { return this._pageMatchesLength; } }, { - key: 'selected', + key: "selected", get: function get() { return this._selected; } }, { - key: 'state', + key: "state", get: function get() { return this._state; } + }, { + key: "_query", + get: function get() { + if (this._state.query !== this._rawQuery) { + this._rawQuery = this._state.query; + this._normalizedQuery = normalize(this._state.query); + } + + return this._normalizedQuery; + } }]); return PDFFindController; }(); -exports.FindState = FindState; exports.PDFFindController = PDFFindController; /***/ }), -/* 21 */ +/* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6313,6 +7840,8 @@ exports.PDFFindController = PDFFindController; Object.defineProperty(exports, "__esModule", { value: true }); +exports.getCharacterType = getCharacterType; +exports.CharacterType = void 0; var CharacterType = { SPACE: 0, ALPHA_LETTER: 1, @@ -6323,52 +7852,67 @@ var CharacterType = { HALFWIDTH_KATAKANA_LETTER: 6, THAI_LETTER: 7 }; +exports.CharacterType = CharacterType; + function isAlphabeticalScript(charCode) { - return charCode < 0x2E80; + return charCode < 0x2e80; } + function isAscii(charCode) { - return (charCode & 0xFF80) === 0; + return (charCode & 0xff80) === 0; } + function isAsciiAlpha(charCode) { - return charCode >= 0x61 && charCode <= 0x7A || charCode >= 0x41 && charCode <= 0x5A; + return charCode >= 0x61 && charCode <= 0x7a || charCode >= 0x41 && charCode <= 0x5a; } + function isAsciiDigit(charCode) { return charCode >= 0x30 && charCode <= 0x39; } + function isAsciiSpace(charCode) { - return charCode === 0x20 || charCode === 0x09 || charCode === 0x0D || charCode === 0x0A; + return charCode === 0x20 || charCode === 0x09 || charCode === 0x0d || charCode === 0x0a; } + function isHan(charCode) { - return charCode >= 0x3400 && charCode <= 0x9FFF || charCode >= 0xF900 && charCode <= 0xFAFF; + return charCode >= 0x3400 && charCode <= 0x9fff || charCode >= 0xf900 && charCode <= 0xfaff; } + function isKatakana(charCode) { - return charCode >= 0x30A0 && charCode <= 0x30FF; + return charCode >= 0x30a0 && charCode <= 0x30ff; } + function isHiragana(charCode) { - return charCode >= 0x3040 && charCode <= 0x309F; + return charCode >= 0x3040 && charCode <= 0x309f; } + function isHalfwidthKatakana(charCode) { - return charCode >= 0xFF60 && charCode <= 0xFF9F; + return charCode >= 0xff60 && charCode <= 0xff9f; } + function isThai(charCode) { - return (charCode & 0xFF80) === 0x0E00; + return (charCode & 0xff80) === 0x0e00; } + function getCharacterType(charCode) { if (isAlphabeticalScript(charCode)) { if (isAscii(charCode)) { if (isAsciiSpace(charCode)) { return CharacterType.SPACE; - } else if (isAsciiAlpha(charCode) || isAsciiDigit(charCode) || charCode === 0x5F) { + } else if (isAsciiAlpha(charCode) || isAsciiDigit(charCode) || charCode === 0x5f) { return CharacterType.ALPHA_LETTER; } + return CharacterType.PUNCT; } else if (isThai(charCode)) { return CharacterType.THAI_LETTER; - } else if (charCode === 0xA0) { + } else if (charCode === 0xa0) { return CharacterType.SPACE; } + return CharacterType.ALPHA_LETTER; } + if (isHan(charCode)) { return CharacterType.HAN_LETTER; } else if (isKatakana(charCode)) { @@ -6378,13 +7922,12 @@ function getCharacterType(charCode) { } else if (isHalfwidthKatakana(charCode)) { return CharacterType.HALFWIDTH_KATAKANA_LETTER; } + return CharacterType.ALPHA_LETTER; } -exports.CharacterType = CharacterType; -exports.getCharacterType = getCharacterType; /***/ }), -/* 22 */ +/* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6393,39 +7936,41 @@ exports.getCharacterType = getCharacterType; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isDestArraysEqual = exports.isDestHashesEqual = exports.PDFHistory = undefined; +exports.isDestHashesEqual = isDestHashesEqual; +exports.isDestArraysEqual = isDestArraysEqual; +exports.PDFHistory = void 0; + +var _ui_utils = __webpack_require__(5); + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -var _ui_utils = __webpack_require__(6); +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -var _dom_events = __webpack_require__(14); +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var HASH_CHANGE_TIMEOUT = 1000; var POSITION_UPDATED_THRESHOLD = 50; var UPDATE_VIEWAREA_TIMEOUT = 1000; + function getCurrentHash() { return document.location.hash; } -function parseCurrentHash(linkService) { - var hash = unescape(getCurrentHash()).substring(1); - var params = (0, _ui_utils.parseQueryString)(hash); - var page = params.page | 0; - if (!(Number.isInteger(page) && page > 0 && page <= linkService.pagesCount)) { - page = null; - } - return { - hash: hash, - page: page, - rotation: linkService.rotation - }; -} -var PDFHistory = function () { +var PDFHistory = /*#__PURE__*/function () { function PDFHistory(_ref) { var _this = this; @@ -6435,39 +7980,56 @@ var PDFHistory = function () { _classCallCheck(this, PDFHistory); this.linkService = linkService; - this.eventBus = eventBus || (0, _dom_events.getGlobalEventBus)(); - this.initialized = false; - this.initialBookmark = null; - this.initialRotation = null; - this._boundEvents = Object.create(null); + this.eventBus = eventBus; + this._initialized = false; + this._fingerprint = ""; + this.reset(); + this._boundEvents = null; this._isViewerInPresentationMode = false; - this._isPagesLoaded = false; - this.eventBus.on('presentationmodechanged', function (evt) { + + this.eventBus._on("presentationmodechanged", function (evt) { _this._isViewerInPresentationMode = evt.active || evt.switchInProgress; }); - this.eventBus.on('pagesloaded', function (evt) { - _this._isPagesLoaded = !!evt.pagesCount; + + this.eventBus._on("pagesinit", function () { + _this._isPagesLoaded = false; + + var onPagesLoaded = function onPagesLoaded(evt) { + _this.eventBus._off("pagesloaded", onPagesLoaded); + + _this._isPagesLoaded = !!evt.pagesCount; + }; + + _this.eventBus._on("pagesloaded", onPagesLoaded); }); } _createClass(PDFHistory, [{ - key: 'initialize', - value: function initialize(fingerprint) { - var resetHistory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - if (!fingerprint || typeof fingerprint !== 'string') { + key: "initialize", + value: function initialize(_ref2) { + var fingerprint = _ref2.fingerprint, + _ref2$resetHistory = _ref2.resetHistory, + resetHistory = _ref2$resetHistory === void 0 ? false : _ref2$resetHistory, + _ref2$updateUrl = _ref2.updateUrl, + updateUrl = _ref2$updateUrl === void 0 ? false : _ref2$updateUrl; + + if (!fingerprint || typeof fingerprint !== "string") { console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.'); return; } - var reInitialized = this.initialized && this.fingerprint !== fingerprint; - this.fingerprint = fingerprint; - if (!this.initialized) { - this._bindEvents(); + + if (this._initialized) { + this.reset(); } + + var reInitialized = this._fingerprint !== "" && this._fingerprint !== fingerprint; + this._fingerprint = fingerprint; + this._updateUrl = updateUrl === true; + this._initialized = true; + + this._bindEvents(); + var state = window.history.state; - this.initialized = true; - this.initialBookmark = null; - this.initialRotation = null; this._popStateInProgress = false; this._blockHashChange = 0; this._currentHash = getCurrentHash(); @@ -6475,76 +8037,122 @@ var PDFHistory = function () { this._uid = this._maxUid = 0; this._destination = null; this._position = null; - if (!this._isValidState(state) || resetHistory) { - var _parseCurrentHash = parseCurrentHash(this.linkService), - hash = _parseCurrentHash.hash, - page = _parseCurrentHash.page, - rotation = _parseCurrentHash.rotation; + + if (!this._isValidState(state, true) || resetHistory) { + var _this$_parseCurrentHa = this._parseCurrentHash(true), + hash = _this$_parseCurrentHa.hash, + page = _this$_parseCurrentHa.page, + rotation = _this$_parseCurrentHa.rotation; if (!hash || reInitialized || resetHistory) { this._pushOrReplaceState(null, true); + return; } + this._pushOrReplaceState({ hash: hash, page: page, rotation: rotation }, true); + return; } + var destination = state.destination; + this._updateInternalState(destination, state.uid, true); + if (this._uid > this._maxUid) { this._maxUid = this._uid; } + if (destination.rotation !== undefined) { - this.initialRotation = destination.rotation; + this._initialRotation = destination.rotation; } + if (destination.dest) { - this.initialBookmark = JSON.stringify(destination.dest); + this._initialBookmark = JSON.stringify(destination.dest); this._destination.page = null; } else if (destination.hash) { - this.initialBookmark = destination.hash; + this._initialBookmark = destination.hash; } else if (destination.page) { - this.initialBookmark = 'page=' + destination.page; + this._initialBookmark = "page=".concat(destination.page); + } + } + }, { + key: "reset", + value: function reset() { + if (this._initialized) { + this._pageHide(); + + this._initialized = false; + + this._unbindEvents(); + } + + if (this._updateViewareaTimeout) { + clearTimeout(this._updateViewareaTimeout); + this._updateViewareaTimeout = null; } + + this._initialBookmark = null; + this._initialRotation = null; } }, { - key: 'push', - value: function push(_ref2) { + key: "push", + value: function push(_ref3) { var _this2 = this; - var namedDest = _ref2.namedDest, - explicitDest = _ref2.explicitDest, - pageNumber = _ref2.pageNumber; + var _ref3$namedDest = _ref3.namedDest, + namedDest = _ref3$namedDest === void 0 ? null : _ref3$namedDest, + explicitDest = _ref3.explicitDest, + pageNumber = _ref3.pageNumber; - if (!this.initialized) { + if (!this._initialized) { return; } - if (namedDest && typeof namedDest !== 'string' || !Array.isArray(explicitDest) || !(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.linkService.pagesCount)) { - console.error('PDFHistory.push: Invalid parameters.'); + + if (namedDest && typeof namedDest !== "string") { + console.error("PDFHistory.push: " + "\"".concat(namedDest, "\" is not a valid namedDest parameter.")); return; + } else if (!Array.isArray(explicitDest)) { + console.error("PDFHistory.push: " + "\"".concat(explicitDest, "\" is not a valid explicitDest parameter.")); + return; + } else if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.linkService.pagesCount)) { + if (pageNumber !== null || this._destination) { + console.error("PDFHistory.push: " + "\"".concat(pageNumber, "\" is not a valid pageNumber parameter.")); + return; + } } + var hash = namedDest || JSON.stringify(explicitDest); + if (!hash) { return; } + var forceReplace = false; + if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) { if (this._destination.page) { return; } + forceReplace = true; } + if (this._popStateInProgress && !forceReplace) { return; } + this._pushOrReplaceState({ dest: explicitDest, hash: hash, page: pageNumber, rotation: this.linkService.rotation }, forceReplace); + if (!this._popStateInProgress) { this._popStateInProgress = true; Promise.resolve().then(function () { @@ -6553,109 +8161,157 @@ var PDFHistory = function () { } } }, { - key: 'pushCurrentPosition', + key: "pushCurrentPosition", value: function pushCurrentPosition() { - if (!this.initialized || this._popStateInProgress) { + if (!this._initialized || this._popStateInProgress) { return; } + this._tryPushCurrentPosition(); } }, { - key: 'back', + key: "back", value: function back() { - if (!this.initialized || this._popStateInProgress) { + if (!this._initialized || this._popStateInProgress) { return; } + var state = window.history.state; + if (this._isValidState(state) && state.uid > 0) { window.history.back(); } } }, { - key: 'forward', + key: "forward", value: function forward() { - if (!this.initialized || this._popStateInProgress) { + if (!this._initialized || this._popStateInProgress) { return; } + var state = window.history.state; + if (this._isValidState(state) && state.uid < this._maxUid) { window.history.forward(); } } }, { - key: '_pushOrReplaceState', + key: "_pushOrReplaceState", value: function _pushOrReplaceState(destination) { var forceReplace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var shouldReplace = forceReplace || !this._destination; var newState = { - fingerprint: this.fingerprint, + fingerprint: this._fingerprint, uid: shouldReplace ? this._uid : this._uid + 1, destination: destination }; + this._updateInternalState(destination, newState.uid); + + var newUrl; + + if (this._updateUrl && destination && destination.hash) { + var baseUrl = document.location.href.split("#")[0]; + + if (!baseUrl.startsWith("file://")) { + newUrl = "".concat(baseUrl, "#").concat(destination.hash); + } + } + if (shouldReplace) { - window.history.replaceState(newState, ''); + window.history.replaceState(newState, "", newUrl); } else { this._maxUid = this._uid; - window.history.pushState(newState, ''); + window.history.pushState(newState, "", newUrl); } } }, { - key: '_tryPushCurrentPosition', + key: "_tryPushCurrentPosition", value: function _tryPushCurrentPosition() { var temporary = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!this._position) { return; } + var position = this._position; + if (temporary) { position = Object.assign(Object.create(null), this._position); position.temporary = true; } + if (!this._destination) { this._pushOrReplaceState(position); + return; } + if (this._destination.temporary) { this._pushOrReplaceState(position, true); + return; } + if (this._destination.hash === position.hash) { return; } + if (!this._destination.page && (POSITION_UPDATED_THRESHOLD <= 0 || this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) { return; } + var forceReplace = false; - if (this._destination.page === position.first || this._destination.page === position.page) { + + if (this._destination.page >= position.first && this._destination.page <= position.page) { if (this._destination.dest || !this._destination.first) { return; } + forceReplace = true; } + this._pushOrReplaceState(position, forceReplace); } }, { - key: '_isValidState', + key: "_isValidState", value: function _isValidState(state) { + var checkReload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + if (!state) { return false; } - if (state.fingerprint !== this.fingerprint) { - return false; + + if (state.fingerprint !== this._fingerprint) { + if (checkReload) { + if (typeof state.fingerprint !== "string" || state.fingerprint.length !== this._fingerprint.length) { + return false; + } + + var _performance$getEntri = performance.getEntriesByType("navigation"), + _performance$getEntri2 = _slicedToArray(_performance$getEntri, 1), + perfEntry = _performance$getEntri2[0]; + + if (!perfEntry || perfEntry.type !== "reload") { + return false; + } + } else { + return false; + } } + if (!Number.isInteger(state.uid) || state.uid < 0) { return false; } - if (state.destination === null || _typeof(state.destination) !== 'object') { + + if (state.destination === null || _typeof(state.destination) !== "object") { return false; } + return true; } }, { - key: '_updateInternalState', + key: "_updateInternalState", value: function _updateInternalState(destination, uid) { var removeTemporary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; @@ -6663,92 +8319,127 @@ var PDFHistory = function () { clearTimeout(this._updateViewareaTimeout); this._updateViewareaTimeout = null; } + if (removeTemporary && destination && destination.temporary) { delete destination.temporary; } + this._destination = destination; this._uid = uid; this._numPositionUpdates = 0; } }, { - key: '_updateViewarea', - value: function _updateViewarea(_ref3) { + key: "_parseCurrentHash", + value: function _parseCurrentHash() { + var checkNameddest = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var hash = unescape(getCurrentHash()).substring(1); + var params = (0, _ui_utils.parseQueryString)(hash); + var nameddest = params.nameddest || ""; + var page = params.page | 0; + + if (!(Number.isInteger(page) && page > 0 && page <= this.linkService.pagesCount) || checkNameddest && nameddest.length > 0) { + page = null; + } + + return { + hash: hash, + page: page, + rotation: this.linkService.rotation + }; + } + }, { + key: "_updateViewarea", + value: function _updateViewarea(_ref4) { var _this3 = this; - var location = _ref3.location; + var location = _ref4.location; if (this._updateViewareaTimeout) { clearTimeout(this._updateViewareaTimeout); this._updateViewareaTimeout = null; } + this._position = { - hash: this._isViewerInPresentationMode ? 'page=' + location.pageNumber : location.pdfOpenParams.substring(1), + hash: this._isViewerInPresentationMode ? "page=".concat(location.pageNumber) : location.pdfOpenParams.substring(1), page: this.linkService.page, first: location.pageNumber, rotation: location.rotation }; + if (this._popStateInProgress) { return; } + if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded && this._destination && !this._destination.page) { this._numPositionUpdates++; } + if (UPDATE_VIEWAREA_TIMEOUT > 0) { this._updateViewareaTimeout = setTimeout(function () { if (!_this3._popStateInProgress) { _this3._tryPushCurrentPosition(true); } + _this3._updateViewareaTimeout = null; }, UPDATE_VIEWAREA_TIMEOUT); } } }, { - key: '_popState', - value: function _popState(_ref4) { + key: "_popState", + value: function _popState(_ref5) { var _this4 = this; - var state = _ref4.state; - + var state = _ref5.state; var newHash = getCurrentHash(), hashChanged = this._currentHash !== newHash; this._currentHash = newHash; - if (!state || false) { + + if (!state) { this._uid++; - var _parseCurrentHash2 = parseCurrentHash(this.linkService), - hash = _parseCurrentHash2.hash, - page = _parseCurrentHash2.page, - rotation = _parseCurrentHash2.rotation; + var _this$_parseCurrentHa2 = this._parseCurrentHash(), + hash = _this$_parseCurrentHa2.hash, + page = _this$_parseCurrentHa2.page, + rotation = _this$_parseCurrentHa2.rotation; this._pushOrReplaceState({ hash: hash, page: page, rotation: rotation }, true); + return; } + if (!this._isValidState(state)) { return; } + this._popStateInProgress = true; + if (hashChanged) { this._blockHashChange++; (0, _ui_utils.waitOnEventOrTimeout)({ target: window, - name: 'hashchange', + name: "hashchange", delay: HASH_CHANGE_TIMEOUT }).then(function () { _this4._blockHashChange--; }); } + var destination = state.destination; + this._updateInternalState(destination, state.uid, true); + if (this._uid > this._maxUid) { this._maxUid = this._uid; } + if ((0, _ui_utils.isValidRotation)(destination.rotation)) { this.linkService.rotation = destination.rotation; } + if (destination.dest) { this.linkService.navigateTo(destination.dest); } else if (destination.hash) { @@ -6756,43 +8447,76 @@ var PDFHistory = function () { } else if (destination.page) { this.linkService.page = destination.page; } + Promise.resolve().then(function () { _this4._popStateInProgress = false; }); } }, { - key: '_bindEvents', + key: "_pageHide", + value: function _pageHide() { + if (!this._destination || this._destination.temporary) { + this._tryPushCurrentPosition(); + } + } + }, { + key: "_bindEvents", value: function _bindEvents() { - var _this5 = this; - - var _boundEvents = this._boundEvents, - eventBus = this.eventBus; + if (this._boundEvents) { + return; + } - _boundEvents.updateViewarea = this._updateViewarea.bind(this); - _boundEvents.popState = this._popState.bind(this); - _boundEvents.pageHide = function (evt) { - if (!_this5._destination || _this5._destination.temporary) { - _this5._tryPushCurrentPosition(); - } + this._boundEvents = { + updateViewarea: this._updateViewarea.bind(this), + popState: this._popState.bind(this), + pageHide: this._pageHide.bind(this) }; - eventBus.on('updateviewarea', _boundEvents.updateViewarea); - window.addEventListener('popstate', _boundEvents.popState); - window.addEventListener('pagehide', _boundEvents.pageHide); + + this.eventBus._on("updateviewarea", this._boundEvents.updateViewarea); + + window.addEventListener("popstate", this._boundEvents.popState); + window.addEventListener("pagehide", this._boundEvents.pageHide); + } + }, { + key: "_unbindEvents", + value: function _unbindEvents() { + if (!this._boundEvents) { + return; + } + + this.eventBus._off("updateviewarea", this._boundEvents.updateViewarea); + + window.removeEventListener("popstate", this._boundEvents.popState); + window.removeEventListener("pagehide", this._boundEvents.pageHide); + this._boundEvents = null; } }, { - key: 'popStateInProgress', + key: "popStateInProgress", get: function get() { - return this.initialized && (this._popStateInProgress || this._blockHashChange > 0); + return this._initialized && (this._popStateInProgress || this._blockHashChange > 0); + } + }, { + key: "initialBookmark", + get: function get() { + return this._initialized ? this._initialBookmark : null; + } + }, { + key: "initialRotation", + get: function get() { + return this._initialized ? this._initialRotation : null; } }]); return PDFHistory; }(); +exports.PDFHistory = PDFHistory; + function isDestHashesEqual(destHash, pushHash) { - if (typeof destHash !== 'string' || typeof pushHash !== 'string') { + if (typeof destHash !== "string" || typeof pushHash !== "string") { return false; } + if (destHash === pushHash) { return true; } @@ -6803,48 +8527,56 @@ function isDestHashesEqual(destHash, pushHash) { if (nameddest === pushHash) { return true; } + return false; } + function isDestArraysEqual(firstDest, secondDest) { function isEntryEqual(first, second) { - if ((typeof first === 'undefined' ? 'undefined' : _typeof(first)) !== (typeof second === 'undefined' ? 'undefined' : _typeof(second))) { + if (_typeof(first) !== _typeof(second)) { return false; } + if (Array.isArray(first) || Array.isArray(second)) { return false; } - if (first !== null && (typeof first === 'undefined' ? 'undefined' : _typeof(first)) === 'object' && second !== null) { + + if (first !== null && _typeof(first) === "object" && second !== null) { if (Object.keys(first).length !== Object.keys(second).length) { return false; } + for (var key in first) { if (!isEntryEqual(first[key], second[key])) { return false; } } + return true; } + return first === second || Number.isNaN(first) && Number.isNaN(second); } + if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) { return false; } + if (firstDest.length !== secondDest.length) { return false; } + for (var i = 0, ii = firstDest.length; i < ii; i++) { if (!isEntryEqual(firstDest[i], secondDest[i])) { return false; } } + return true; } -exports.PDFHistory = PDFHistory; -exports.isDestHashesEqual = isDestHashesEqual; -exports.isDestArraysEqual = isDestArraysEqual; /***/ }), -/* 23 */ +/* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6853,32 +8585,38 @@ exports.isDestArraysEqual = isDestArraysEqual; Object.defineProperty(exports, "__esModule", { value: true }); -exports.SimpleLinkService = exports.PDFLinkService = undefined; +exports.SimpleLinkService = exports.PDFLinkService = void 0; -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +var _ui_utils = __webpack_require__(5); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var _dom_events = __webpack_require__(14); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var _ui_utils = __webpack_require__(6); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -var PDFLinkService = function () { +var PDFLinkService = /*#__PURE__*/function () { function PDFLinkService() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, eventBus = _ref.eventBus, _ref$externalLinkTarg = _ref.externalLinkTarget, - externalLinkTarget = _ref$externalLinkTarg === undefined ? null : _ref$externalLinkTarg, + externalLinkTarget = _ref$externalLinkTarg === void 0 ? null : _ref$externalLinkTarg, _ref$externalLinkRel = _ref.externalLinkRel, - externalLinkRel = _ref$externalLinkRel === undefined ? null : _ref$externalLinkRel; + externalLinkRel = _ref$externalLinkRel === void 0 ? null : _ref$externalLinkRel, + _ref$externalLinkEnab = _ref.externalLinkEnabled, + externalLinkEnabled = _ref$externalLinkEnab === void 0 ? true : _ref$externalLinkEnab, + _ref$ignoreDestinatio = _ref.ignoreDestinationZoom, + ignoreDestinationZoom = _ref$ignoreDestinatio === void 0 ? false : _ref$ignoreDestinatio; _classCallCheck(this, PDFLinkService); - this.eventBus = eventBus || (0, _dom_events.getGlobalEventBus)(); + this.eventBus = eventBus; this.externalLinkTarget = externalLinkTarget; this.externalLinkRel = externalLinkRel; + this.externalLinkEnabled = externalLinkEnabled; + this._ignoreDestinationZoom = ignoreDestinationZoom; this.baseUrl = null; this.pdfDocument = null; this.pdfViewer = null; @@ -6887,154 +8625,176 @@ var PDFLinkService = function () { } _createClass(PDFLinkService, [{ - key: 'setDocument', + key: "setDocument", value: function setDocument(pdfDocument) { var baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - this.baseUrl = baseUrl; this.pdfDocument = pdfDocument; this._pagesRefCache = Object.create(null); } }, { - key: 'setViewer', + key: "setViewer", value: function setViewer(pdfViewer) { this.pdfViewer = pdfViewer; } }, { - key: 'setHistory', + key: "setHistory", value: function setHistory(pdfHistory) { this.pdfHistory = pdfHistory; } }, { - key: 'navigateTo', + key: "navigateTo", value: function navigateTo(dest) { var _this = this; var goToDestination = function goToDestination(_ref2) { var namedDest = _ref2.namedDest, explicitDest = _ref2.explicitDest; + var destRef = explicitDest[0]; + var pageNumber; - var destRef = explicitDest[0], - pageNumber = void 0; if (destRef instanceof Object) { pageNumber = _this._cachedPageNumber(destRef); + if (pageNumber === null) { _this.pdfDocument.getPageIndex(destRef).then(function (pageIndex) { _this.cachePageRef(pageIndex + 1, destRef); + goToDestination({ namedDest: namedDest, explicitDest: explicitDest }); - }).catch(function () { - console.error('PDFLinkService.navigateTo: "' + destRef + '" is not ' + ('a valid page reference, for dest="' + dest + '".')); + })["catch"](function () { + console.error("PDFLinkService.navigateTo: \"".concat(destRef, "\" is not ") + "a valid page reference, for dest=\"".concat(dest, "\".")); }); + return; } } else if (Number.isInteger(destRef)) { pageNumber = destRef + 1; } else { - console.error('PDFLinkService.navigateTo: "' + destRef + '" is not ' + ('a valid destination reference, for dest="' + dest + '".')); + console.error("PDFLinkService.navigateTo: \"".concat(destRef, "\" is not ") + "a valid destination reference, for dest=\"".concat(dest, "\".")); return; } + if (!pageNumber || pageNumber < 1 || pageNumber > _this.pagesCount) { - console.error('PDFLinkService.navigateTo: "' + pageNumber + '" is not ' + ('a valid page number, for dest="' + dest + '".')); + console.error("PDFLinkService.navigateTo: \"".concat(pageNumber, "\" is not ") + "a valid page number, for dest=\"".concat(dest, "\".")); return; } + if (_this.pdfHistory) { _this.pdfHistory.pushCurrentPosition(); + _this.pdfHistory.push({ namedDest: namedDest, explicitDest: explicitDest, pageNumber: pageNumber }); } + _this.pdfViewer.scrollPageIntoView({ pageNumber: pageNumber, - destArray: explicitDest + destArray: explicitDest, + ignoreDestinationZoom: _this._ignoreDestinationZoom }); }; + new Promise(function (resolve, reject) { - if (typeof dest === 'string') { + if (typeof dest === "string") { _this.pdfDocument.getDestination(dest).then(function (destArray) { resolve({ namedDest: dest, explicitDest: destArray }); }); + return; } + resolve({ - namedDest: '', + namedDest: "", explicitDest: dest }); }).then(function (data) { if (!Array.isArray(data.explicitDest)) { - console.error('PDFLinkService.navigateTo: "' + data.explicitDest + '" is' + (' not a valid destination array, for dest="' + dest + '".')); + console.error("PDFLinkService.navigateTo: \"".concat(data.explicitDest, "\" is") + " not a valid destination array, for dest=\"".concat(dest, "\".")); return; } + goToDestination(data); }); } }, { - key: 'getDestinationHash', + key: "getDestinationHash", value: function getDestinationHash(dest) { - if (typeof dest === 'string') { - return this.getAnchorUrl('#' + escape(dest)); + if (typeof dest === "string") { + return this.getAnchorUrl("#" + escape(dest)); } + if (Array.isArray(dest)) { var str = JSON.stringify(dest); - return this.getAnchorUrl('#' + escape(str)); + return this.getAnchorUrl("#" + escape(str)); } - return this.getAnchorUrl(''); + + return this.getAnchorUrl(""); } }, { - key: 'getAnchorUrl', + key: "getAnchorUrl", value: function getAnchorUrl(anchor) { - return (this.baseUrl || '') + anchor; + return (this.baseUrl || "") + anchor; } }, { - key: 'setHash', + key: "setHash", value: function setHash(hash) { - var pageNumber = void 0, - dest = void 0; - if (hash.includes('=')) { + var pageNumber, dest; + + if (hash.includes("=")) { var params = (0, _ui_utils.parseQueryString)(hash); - if ('search' in params) { - this.eventBus.dispatch('findfromurlhash', { + + if ("search" in params) { + this.eventBus.dispatch("findfromurlhash", { source: this, - query: params['search'].replace(/"/g, ''), - phraseSearch: params['phrase'] === 'true' + query: params.search.replace(/"/g, ""), + phraseSearch: params.phrase === "true" }); } - if ('nameddest' in params) { - this.navigateTo(params.nameddest); - return; - } - if ('page' in params) { + + if ("page" in params) { pageNumber = params.page | 0 || 1; } - if ('zoom' in params) { - var zoomArgs = params.zoom.split(','); + + if ("zoom" in params) { + var zoomArgs = params.zoom.split(","); var zoomArg = zoomArgs[0]; var zoomArgNumber = parseFloat(zoomArg); - if (!zoomArg.includes('Fit')) { - dest = [null, { name: 'XYZ' }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg]; + + if (!zoomArg.includes("Fit")) { + dest = [null, { + name: "XYZ" + }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg]; } else { - if (zoomArg === 'Fit' || zoomArg === 'FitB') { - dest = [null, { name: zoomArg }]; - } else if (zoomArg === 'FitH' || zoomArg === 'FitBH' || zoomArg === 'FitV' || zoomArg === 'FitBV') { - dest = [null, { name: zoomArg }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null]; - } else if (zoomArg === 'FitR') { + if (zoomArg === "Fit" || zoomArg === "FitB") { + dest = [null, { + name: zoomArg + }]; + } else if (zoomArg === "FitH" || zoomArg === "FitBH" || zoomArg === "FitV" || zoomArg === "FitBV") { + dest = [null, { + name: zoomArg + }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null]; + } else if (zoomArg === "FitR") { if (zoomArgs.length !== 5) { console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'); } else { - dest = [null, { name: zoomArg }, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0]; + dest = [null, { + name: zoomArg + }, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0]; } } else { - console.error('PDFLinkService.setHash: "' + zoomArg + '" is not ' + 'a valid zoom value.'); + console.error("PDFLinkService.setHash: \"".concat(zoomArg, "\" is not ") + "a valid zoom value."); } } } + if (dest) { this.pdfViewer.scrollPageIntoView({ pageNumber: pageNumber || this.page, @@ -7044,87 +8804,113 @@ var PDFLinkService = function () { } else if (pageNumber) { this.page = pageNumber; } - if ('pagemode' in params) { - this.eventBus.dispatch('pagemode', { + + if ("pagemode" in params) { + this.eventBus.dispatch("pagemode", { source: this, mode: params.pagemode }); } + + if ("nameddest" in params) { + this.navigateTo(params.nameddest); + } } else { dest = unescape(hash); + try { dest = JSON.parse(dest); + if (!Array.isArray(dest)) { dest = dest.toString(); } } catch (ex) {} - if (typeof dest === 'string' || isValidExplicitDestination(dest)) { + + if (typeof dest === "string" || isValidExplicitDestination(dest)) { this.navigateTo(dest); return; } - console.error('PDFLinkService.setHash: "' + unescape(hash) + '" is not ' + 'a valid destination.'); + + console.error("PDFLinkService.setHash: \"".concat(unescape(hash), "\" is not ") + "a valid destination."); } } }, { - key: 'executeNamedAction', + key: "executeNamedAction", value: function executeNamedAction(action) { switch (action) { - case 'GoBack': + case "GoBack": if (this.pdfHistory) { this.pdfHistory.back(); } + break; - case 'GoForward': + + case "GoForward": if (this.pdfHistory) { this.pdfHistory.forward(); } + break; - case 'NextPage': + + case "NextPage": if (this.page < this.pagesCount) { this.page++; } + break; - case 'PrevPage': + + case "PrevPage": if (this.page > 1) { this.page--; } + break; - case 'LastPage': + + case "LastPage": this.page = this.pagesCount; break; - case 'FirstPage': + + case "FirstPage": this.page = 1; break; + default: break; } - this.eventBus.dispatch('namedaction', { + + this.eventBus.dispatch("namedaction", { source: this, action: action }); } }, { - key: 'cachePageRef', + key: "cachePageRef", value: function cachePageRef(pageNum, pageRef) { if (!pageRef) { return; } - var refStr = pageRef.num + ' ' + pageRef.gen + ' R'; + + var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen); this._pagesRefCache[refStr] = pageNum; } }, { - key: '_cachedPageNumber', + key: "_cachedPageNumber", value: function _cachedPageNumber(pageRef) { - var refStr = pageRef.num + ' ' + pageRef.gen + ' R'; + var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen); return this._pagesRefCache && this._pagesRefCache[refStr] || null; } }, { - key: 'pagesCount', + key: "isPageVisible", + value: function isPageVisible(pageNumber) { + return this.pdfViewer.isPageVisible(pageNumber); + } + }, { + key: "pagesCount", get: function get() { return this.pdfDocument ? this.pdfDocument.numPages : 0; } }, { - key: 'page', + key: "page", get: function get() { return this.pdfViewer.currentPageNumber; }, @@ -7132,7 +8918,7 @@ var PDFLinkService = function () { this.pdfViewer.currentPageNumber = value; } }, { - key: 'rotation', + key: "rotation", get: function get() { return this.pdfViewer.pagesRotation; }, @@ -7144,101 +8930,128 @@ var PDFLinkService = function () { return PDFLinkService; }(); +exports.PDFLinkService = PDFLinkService; + function isValidExplicitDestination(dest) { if (!Array.isArray(dest)) { return false; } - var destLength = dest.length, - allowNull = true; + + var destLength = dest.length; + if (destLength < 2) { return false; } + var page = dest[0]; - if (!((typeof page === 'undefined' ? 'undefined' : _typeof(page)) === 'object' && Number.isInteger(page.num) && Number.isInteger(page.gen)) && !(Number.isInteger(page) && page >= 0)) { + + if (!(_typeof(page) === "object" && Number.isInteger(page.num) && Number.isInteger(page.gen)) && !(Number.isInteger(page) && page >= 0)) { return false; } + var zoom = dest[1]; - if (!((typeof zoom === 'undefined' ? 'undefined' : _typeof(zoom)) === 'object' && typeof zoom.name === 'string')) { + + if (!(_typeof(zoom) === "object" && typeof zoom.name === "string")) { return false; } + + var allowNull = true; + switch (zoom.name) { - case 'XYZ': + case "XYZ": if (destLength !== 5) { return false; } + break; - case 'Fit': - case 'FitB': + + case "Fit": + case "FitB": return destLength === 2; - case 'FitH': - case 'FitBH': - case 'FitV': - case 'FitBV': + + case "FitH": + case "FitBH": + case "FitV": + case "FitBV": if (destLength !== 3) { return false; } + break; - case 'FitR': + + case "FitR": if (destLength !== 6) { return false; } + allowNull = false; break; + default: return false; } + for (var i = 2; i < destLength; i++) { var param = dest[i]; - if (!(typeof param === 'number' || allowNull && param === null)) { + + if (!(typeof param === "number" || allowNull && param === null)) { return false; } } + return true; } -var SimpleLinkService = function () { +var SimpleLinkService = /*#__PURE__*/function () { function SimpleLinkService() { _classCallCheck(this, SimpleLinkService); this.externalLinkTarget = null; this.externalLinkRel = null; + this.externalLinkEnabled = true; + this._ignoreDestinationZoom = false; } _createClass(SimpleLinkService, [{ - key: 'navigateTo', + key: "navigateTo", value: function navigateTo(dest) {} }, { - key: 'getDestinationHash', + key: "getDestinationHash", value: function getDestinationHash(dest) { - return '#'; + return "#"; } }, { - key: 'getAnchorUrl', + key: "getAnchorUrl", value: function getAnchorUrl(hash) { - return '#'; + return "#"; } }, { - key: 'setHash', + key: "setHash", value: function setHash(hash) {} }, { - key: 'executeNamedAction', + key: "executeNamedAction", value: function executeNamedAction(action) {} }, { - key: 'cachePageRef', + key: "cachePageRef", value: function cachePageRef(pageNum, pageRef) {} }, { - key: 'pagesCount', + key: "isPageVisible", + value: function isPageVisible(pageNumber) { + return true; + } + }, { + key: "pagesCount", get: function get() { return 0; } }, { - key: 'page', + key: "page", get: function get() { return 0; }, set: function set(value) {} }, { - key: 'rotation', + key: "rotation", get: function get() { return 0; }, @@ -7248,11 +9061,10 @@ var SimpleLinkService = function () { return SimpleLinkService; }(); -exports.PDFLinkService = PDFLinkService; exports.SimpleLinkService = SimpleLinkService; /***/ }), -/* 24 */ +/* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7261,17 +9073,25 @@ exports.SimpleLinkService = SimpleLinkService; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFOutlineViewer = undefined; +exports.PDFOutlineViewer = void 0; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _pdfjsLib = __webpack_require__(8); -var _pdfjsLib = __webpack_require__(7); +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var DEFAULT_TITLE = '\u2013'; +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var DEFAULT_TITLE = "\u2013"; -var PDFOutlineViewer = function () { +var PDFOutlineViewer = /*#__PURE__*/function () { function PDFOutlineViewer(_ref) { var container = _ref.container, linkService = _ref.linkService, @@ -7283,27 +9103,28 @@ var PDFOutlineViewer = function () { this.linkService = linkService; this.eventBus = eventBus; this.reset(); - eventBus.on('toggleoutlinetree', this.toggleOutlineTree.bind(this)); + + eventBus._on("toggleoutlinetree", this.toggleOutlineTree.bind(this)); } _createClass(PDFOutlineViewer, [{ - key: 'reset', + key: "reset", value: function reset() { this.outline = null; this.lastToggleIsShow = true; - this.container.textContent = ''; - this.container.classList.remove('outlineWithDeepNesting'); + this.container.textContent = ""; + this.container.classList.remove("outlineWithDeepNesting"); } }, { - key: '_dispatchEvent', + key: "_dispatchEvent", value: function _dispatchEvent(outlineCount) { - this.eventBus.dispatch('outlineloaded', { + this.eventBus.dispatch("outlineloaded", { source: this, outlineCount: outlineCount }); } }, { - key: '_bindLink', + key: "_bindLink", value: function _bindLink(element, _ref2) { var url = _ref2.url, newWindow = _ref2.newWindow, @@ -7314,119 +9135,168 @@ var PDFOutlineViewer = function () { (0, _pdfjsLib.addLinkAttributes)(element, { url: url, target: newWindow ? _pdfjsLib.LinkTarget.BLANK : linkService.externalLinkTarget, - rel: linkService.externalLinkRel + rel: linkService.externalLinkRel, + enabled: linkService.externalLinkEnabled }); return; } + element.href = linkService.getDestinationHash(dest); + element.onclick = function () { if (dest) { linkService.navigateTo(dest); } + return false; }; } }, { - key: '_setStyles', + key: "_setStyles", value: function _setStyles(element, _ref3) { var bold = _ref3.bold, italic = _ref3.italic; - var styleStr = ''; if (bold) { - styleStr += 'font-weight: bold;'; + element.style.fontWeight = "bold"; } + if (italic) { - styleStr += 'font-style: italic;'; - } - if (styleStr) { - element.setAttribute('style', styleStr); + element.style.fontStyle = "italic"; } } }, { - key: '_addToggleButton', - value: function _addToggleButton(div) { + key: "_addToggleButton", + value: function _addToggleButton(div, _ref4) { var _this = this; - var toggler = document.createElement('div'); - toggler.className = 'outlineItemToggler'; + var count = _ref4.count, + items = _ref4.items; + var toggler = document.createElement("div"); + toggler.className = "outlineItemToggler"; + + if (count < 0 && Math.abs(count) === items.length) { + toggler.classList.add("outlineItemsHidden"); + } + toggler.onclick = function (evt) { evt.stopPropagation(); - toggler.classList.toggle('outlineItemsHidden'); + toggler.classList.toggle("outlineItemsHidden"); + if (evt.shiftKey) { - var shouldShowAll = !toggler.classList.contains('outlineItemsHidden'); + var shouldShowAll = !toggler.classList.contains("outlineItemsHidden"); + _this._toggleOutlineItem(div, shouldShowAll); } }; + div.insertBefore(toggler, div.firstChild); } }, { - key: '_toggleOutlineItem', - value: function _toggleOutlineItem(root, show) { + key: "_toggleOutlineItem", + value: function _toggleOutlineItem(root) { + var show = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; this.lastToggleIsShow = show; - var togglers = root.querySelectorAll('.outlineItemToggler'); - for (var i = 0, ii = togglers.length; i < ii; ++i) { - togglers[i].classList[show ? 'remove' : 'add']('outlineItemsHidden'); + + var _iterator = _createForOfIteratorHelper(root.querySelectorAll(".outlineItemToggler")), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var toggler = _step.value; + toggler.classList.toggle("outlineItemsHidden", !show); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); } } }, { - key: 'toggleOutlineTree', + key: "toggleOutlineTree", value: function toggleOutlineTree() { if (!this.outline) { return; } + this._toggleOutlineItem(this.container, !this.lastToggleIsShow); } }, { - key: 'render', - value: function render(_ref4) { - var outline = _ref4.outline; - + key: "render", + value: function render(_ref5) { + var outline = _ref5.outline; var outlineCount = 0; + if (this.outline) { this.reset(); } + this.outline = outline || null; + if (!outline) { this._dispatchEvent(outlineCount); + return; } + var fragment = document.createDocumentFragment(); var queue = [{ parent: fragment, items: this.outline }]; var hasAnyNesting = false; + while (queue.length > 0) { var levelData = queue.shift(); - for (var i = 0, len = levelData.items.length; i < len; i++) { - var item = levelData.items[i]; - var div = document.createElement('div'); - div.className = 'outlineItem'; - var element = document.createElement('a'); - this._bindLink(element, item); - this._setStyles(element, item); - element.textContent = (0, _pdfjsLib.removeNullCharacters)(item.title) || DEFAULT_TITLE; - div.appendChild(element); - if (item.items.length > 0) { - hasAnyNesting = true; - this._addToggleButton(div); - var itemsDiv = document.createElement('div'); - itemsDiv.className = 'outlineItems'; - div.appendChild(itemsDiv); - queue.push({ - parent: itemsDiv, - items: item.items - }); + + var _iterator2 = _createForOfIteratorHelper(levelData.items), + _step2; + + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var item = _step2.value; + var div = document.createElement("div"); + div.className = "outlineItem"; + var element = document.createElement("a"); + + this._bindLink(element, item); + + this._setStyles(element, item); + + element.textContent = (0, _pdfjsLib.removeNullCharacters)(item.title) || DEFAULT_TITLE; + div.appendChild(element); + + if (item.items.length > 0) { + hasAnyNesting = true; + + this._addToggleButton(div, item); + + var itemsDiv = document.createElement("div"); + itemsDiv.className = "outlineItems"; + div.appendChild(itemsDiv); + queue.push({ + parent: itemsDiv, + items: item.items + }); + } + + levelData.parent.appendChild(div); + outlineCount++; } - levelData.parent.appendChild(div); - outlineCount++; + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); } } + if (hasAnyNesting) { - this.container.classList.add('outlineWithDeepNesting'); + this.container.classList.add("outlineWithDeepNesting"); + this.lastToggleIsShow = fragment.querySelectorAll(".outlineItemsHidden").length === 0; } + this.container.appendChild(fragment); + this._dispatchEvent(outlineCount); } }]); @@ -7437,7 +9307,7 @@ var PDFOutlineViewer = function () { exports.PDFOutlineViewer = PDFOutlineViewer; /***/ }), -/* 25 */ +/* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7446,39 +9316,38 @@ exports.PDFOutlineViewer = PDFOutlineViewer; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFPresentationMode = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +exports.PDFPresentationMode = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; var DELAY_BEFORE_HIDING_CONTROLS = 3000; -var ACTIVE_SELECTOR = 'pdfPresentationMode'; -var CONTROLS_SELECTOR = 'pdfPresentationModeControls'; +var ACTIVE_SELECTOR = "pdfPresentationMode"; +var CONTROLS_SELECTOR = "pdfPresentationModeControls"; var MOUSE_SCROLL_COOLDOWN_TIME = 50; var PAGE_SWITCH_THRESHOLD = 0.1; var SWIPE_MIN_DISTANCE_THRESHOLD = 50; var SWIPE_ANGLE_THRESHOLD = Math.PI / 6; -var PDFPresentationMode = function () { +var PDFPresentationMode = /*#__PURE__*/function () { function PDFPresentationMode(_ref) { var _this = this; var container = _ref.container, - _ref$viewer = _ref.viewer, - viewer = _ref$viewer === undefined ? null : _ref$viewer, pdfViewer = _ref.pdfViewer, eventBus = _ref.eventBus, _ref$contextMenuItems = _ref.contextMenuItems, - contextMenuItems = _ref$contextMenuItems === undefined ? null : _ref$contextMenuItems; + contextMenuItems = _ref$contextMenuItems === void 0 ? null : _ref$contextMenuItems; _classCallCheck(this, PDFPresentationMode); this.container = container; - this.viewer = viewer || container.firstElementChild; this.pdfViewer = pdfViewer; this.eventBus = eventBus; this.active = false; @@ -7487,35 +9356,52 @@ var PDFPresentationMode = function () { this.mouseScrollTimeStamp = 0; this.mouseScrollDelta = 0; this.touchSwipeState = null; + if (contextMenuItems) { - contextMenuItems.contextFirstPage.addEventListener('click', function () { + contextMenuItems.contextFirstPage.addEventListener("click", function () { _this.contextMenuOpen = false; - _this.eventBus.dispatch('firstpage', { source: _this }); + + _this.eventBus.dispatch("firstpage", { + source: _this + }); }); - contextMenuItems.contextLastPage.addEventListener('click', function () { + contextMenuItems.contextLastPage.addEventListener("click", function () { _this.contextMenuOpen = false; - _this.eventBus.dispatch('lastpage', { source: _this }); + + _this.eventBus.dispatch("lastpage", { + source: _this + }); }); - contextMenuItems.contextPageRotateCw.addEventListener('click', function () { + contextMenuItems.contextPageRotateCw.addEventListener("click", function () { _this.contextMenuOpen = false; - _this.eventBus.dispatch('rotatecw', { source: _this }); + + _this.eventBus.dispatch("rotatecw", { + source: _this + }); }); - contextMenuItems.contextPageRotateCcw.addEventListener('click', function () { + contextMenuItems.contextPageRotateCcw.addEventListener("click", function () { _this.contextMenuOpen = false; - _this.eventBus.dispatch('rotateccw', { source: _this }); + + _this.eventBus.dispatch("rotateccw", { + source: _this + }); }); } } _createClass(PDFPresentationMode, [{ - key: 'request', + key: "request", value: function request() { - if (this.switchInProgress || this.active || !this.viewer.hasChildNodes()) { + if (this.switchInProgress || this.active || !this.pdfViewer.pagesCount) { return false; } + this._addFullscreenChangeListeners(); + this._setSwitchInProgress(); + this._notifyStateChange(); + if (this.container.requestFullscreen) { this.container.requestFullscreen(); } else if (this.container.mozRequestFullScreen) { @@ -7527,6 +9413,7 @@ var PDFPresentationMode = function () { } else { return false; } + this.args = { page: this.pdfViewer.currentPageNumber, previousScale: this.pdfViewer.currentScaleValue @@ -7534,76 +9421,91 @@ var PDFPresentationMode = function () { return true; } }, { - key: '_mouseWheel', + key: "_mouseWheel", value: function _mouseWheel(evt) { if (!this.active) { return; } + evt.preventDefault(); var delta = (0, _ui_utils.normalizeWheelEventDelta)(evt); var currentTime = new Date().getTime(); var storedTime = this.mouseScrollTimeStamp; + if (currentTime > storedTime && currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) { return; } + if (this.mouseScrollDelta > 0 && delta < 0 || this.mouseScrollDelta < 0 && delta > 0) { this._resetMouseScrollState(); } + this.mouseScrollDelta += delta; + if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) { var totalDelta = this.mouseScrollDelta; + this._resetMouseScrollState(); + var success = totalDelta > 0 ? this._goToPreviousPage() : this._goToNextPage(); + if (success) { this.mouseScrollTimeStamp = currentTime; } } } }, { - key: '_goToPreviousPage', + key: "_goToPreviousPage", value: function _goToPreviousPage() { var page = this.pdfViewer.currentPageNumber; + if (page <= 1) { return false; } + this.pdfViewer.currentPageNumber = page - 1; return true; } }, { - key: '_goToNextPage', + key: "_goToNextPage", value: function _goToNextPage() { var page = this.pdfViewer.currentPageNumber; + if (page >= this.pdfViewer.pagesCount) { return false; } + this.pdfViewer.currentPageNumber = page + 1; return true; } }, { - key: '_notifyStateChange', + key: "_notifyStateChange", value: function _notifyStateChange() { - this.eventBus.dispatch('presentationmodechanged', { + this.eventBus.dispatch("presentationmodechanged", { source: this, active: this.active, switchInProgress: !!this.switchInProgress }); } }, { - key: '_setSwitchInProgress', + key: "_setSwitchInProgress", value: function _setSwitchInProgress() { var _this2 = this; if (this.switchInProgress) { clearTimeout(this.switchInProgress); } + this.switchInProgress = setTimeout(function () { _this2._removeFullscreenChangeListeners(); + delete _this2.switchInProgress; + _this2._notifyStateChange(); }, DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS); } }, { - key: '_resetSwitchInProgress', + key: "_resetSwitchInProgress", value: function _resetSwitchInProgress() { if (this.switchInProgress) { clearTimeout(this.switchInProgress); @@ -7611,26 +9513,32 @@ var PDFPresentationMode = function () { } } }, { - key: '_enter', + key: "_enter", value: function _enter() { var _this3 = this; this.active = true; + this._resetSwitchInProgress(); + this._notifyStateChange(); + this.container.classList.add(ACTIVE_SELECTOR); setTimeout(function () { _this3.pdfViewer.currentPageNumber = _this3.args.page; - _this3.pdfViewer.currentScaleValue = 'page-fit'; + _this3.pdfViewer.currentScaleValue = "page-fit"; }, 0); + this._addWindowListeners(); + this._showControls(); + this.contextMenuOpen = false; - this.container.setAttribute('contextmenu', 'viewerContextMenu'); + this.container.setAttribute("contextmenu", "viewerContextMenu"); window.getSelection().removeAllRanges(); } }, { - key: '_exit', + key: "_exit", value: function _exit() { var _this4 = this; @@ -7638,30 +9546,40 @@ var PDFPresentationMode = function () { this.container.classList.remove(ACTIVE_SELECTOR); setTimeout(function () { _this4.active = false; + _this4._removeFullscreenChangeListeners(); + _this4._notifyStateChange(); + _this4.pdfViewer.currentScaleValue = _this4.args.previousScale; _this4.pdfViewer.currentPageNumber = page; _this4.args = null; }, 0); + this._removeWindowListeners(); + this._hideControls(); + this._resetMouseScrollState(); - this.container.removeAttribute('contextmenu'); + + this.container.removeAttribute("contextmenu"); this.contextMenuOpen = false; } }, { - key: '_mouseDown', + key: "_mouseDown", value: function _mouseDown(evt) { if (this.contextMenuOpen) { this.contextMenuOpen = false; evt.preventDefault(); return; } + if (evt.button === 0) { - var isInternalLink = evt.target.href && evt.target.classList.contains('internalLink'); + var isInternalLink = evt.target.href && evt.target.classList.contains("internalLink"); + if (!isInternalLink) { evt.preventDefault(); + if (evt.shiftKey) { this._goToPreviousPage(); } else { @@ -7671,12 +9589,12 @@ var PDFPresentationMode = function () { } } }, { - key: '_contextMenu', + key: "_contextMenu", value: function _contextMenu() { this.contextMenuOpen = true; } }, { - key: '_showControls', + key: "_showControls", value: function _showControls() { var _this5 = this; @@ -7685,39 +9603,44 @@ var PDFPresentationMode = function () { } else { this.container.classList.add(CONTROLS_SELECTOR); } + this.controlsTimeout = setTimeout(function () { _this5.container.classList.remove(CONTROLS_SELECTOR); + delete _this5.controlsTimeout; }, DELAY_BEFORE_HIDING_CONTROLS); } }, { - key: '_hideControls', + key: "_hideControls", value: function _hideControls() { if (!this.controlsTimeout) { return; } + clearTimeout(this.controlsTimeout); this.container.classList.remove(CONTROLS_SELECTOR); delete this.controlsTimeout; } }, { - key: '_resetMouseScrollState', + key: "_resetMouseScrollState", value: function _resetMouseScrollState() { this.mouseScrollTimeStamp = 0; this.mouseScrollDelta = 0; } }, { - key: '_touchSwipe', + key: "_touchSwipe", value: function _touchSwipe(evt) { if (!this.active) { return; } + if (evt.touches.length > 1) { this.touchSwipeState = null; return; } + switch (evt.type) { - case 'touchstart': + case "touchstart": this.touchSwipeState = { startX: evt.touches[0].pageX, startY: evt.touches[0].pageY, @@ -7725,37 +9648,44 @@ var PDFPresentationMode = function () { endY: evt.touches[0].pageY }; break; - case 'touchmove': + + case "touchmove": if (this.touchSwipeState === null) { return; } + this.touchSwipeState.endX = evt.touches[0].pageX; this.touchSwipeState.endY = evt.touches[0].pageY; evt.preventDefault(); break; - case 'touchend': + + case "touchend": if (this.touchSwipeState === null) { return; } + var delta = 0; var dx = this.touchSwipeState.endX - this.touchSwipeState.startX; var dy = this.touchSwipeState.endY - this.touchSwipeState.startY; var absAngle = Math.abs(Math.atan2(dy, dx)); + if (Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD && (absAngle <= SWIPE_ANGLE_THRESHOLD || absAngle >= Math.PI - SWIPE_ANGLE_THRESHOLD)) { delta = dx; } else if (Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD && Math.abs(absAngle - Math.PI / 2) <= SWIPE_ANGLE_THRESHOLD) { delta = dy; } + if (delta > 0) { this._goToPreviousPage(); } else if (delta < 0) { this._goToNextPage(); } + break; } } }, { - key: '_addWindowListeners', + key: "_addWindowListeners", value: function _addWindowListeners() { this.showControlsBind = this._showControls.bind(this); this.mouseDownBind = this._mouseDown.bind(this); @@ -7763,26 +9693,30 @@ var PDFPresentationMode = function () { this.resetMouseScrollStateBind = this._resetMouseScrollState.bind(this); this.contextMenuBind = this._contextMenu.bind(this); this.touchSwipeBind = this._touchSwipe.bind(this); - window.addEventListener('mousemove', this.showControlsBind); - window.addEventListener('mousedown', this.mouseDownBind); - window.addEventListener('wheel', this.mouseWheelBind); - window.addEventListener('keydown', this.resetMouseScrollStateBind); - window.addEventListener('contextmenu', this.contextMenuBind); - window.addEventListener('touchstart', this.touchSwipeBind); - window.addEventListener('touchmove', this.touchSwipeBind); - window.addEventListener('touchend', this.touchSwipeBind); + window.addEventListener("mousemove", this.showControlsBind); + window.addEventListener("mousedown", this.mouseDownBind); + window.addEventListener("wheel", this.mouseWheelBind, { + passive: false + }); + window.addEventListener("keydown", this.resetMouseScrollStateBind); + window.addEventListener("contextmenu", this.contextMenuBind); + window.addEventListener("touchstart", this.touchSwipeBind); + window.addEventListener("touchmove", this.touchSwipeBind); + window.addEventListener("touchend", this.touchSwipeBind); } }, { - key: '_removeWindowListeners', + key: "_removeWindowListeners", value: function _removeWindowListeners() { - window.removeEventListener('mousemove', this.showControlsBind); - window.removeEventListener('mousedown', this.mouseDownBind); - window.removeEventListener('wheel', this.mouseWheelBind); - window.removeEventListener('keydown', this.resetMouseScrollStateBind); - window.removeEventListener('contextmenu', this.contextMenuBind); - window.removeEventListener('touchstart', this.touchSwipeBind); - window.removeEventListener('touchmove', this.touchSwipeBind); - window.removeEventListener('touchend', this.touchSwipeBind); + window.removeEventListener("mousemove", this.showControlsBind); + window.removeEventListener("mousedown", this.mouseDownBind); + window.removeEventListener("wheel", this.mouseWheelBind, { + passive: false + }); + window.removeEventListener("keydown", this.resetMouseScrollStateBind); + window.removeEventListener("contextmenu", this.contextMenuBind); + window.removeEventListener("touchstart", this.touchSwipeBind); + window.removeEventListener("touchmove", this.touchSwipeBind); + window.removeEventListener("touchend", this.touchSwipeBind); delete this.showControlsBind; delete this.mouseDownBind; delete this.mouseWheelBind; @@ -7791,7 +9725,7 @@ var PDFPresentationMode = function () { delete this.touchSwipeBind; } }, { - key: '_fullscreenChange', + key: "_fullscreenChange", value: function _fullscreenChange() { if (this.isFullscreen) { this._enter(); @@ -7800,25 +9734,25 @@ var PDFPresentationMode = function () { } } }, { - key: '_addFullscreenChangeListeners', + key: "_addFullscreenChangeListeners", value: function _addFullscreenChangeListeners() { this.fullscreenChangeBind = this._fullscreenChange.bind(this); - window.addEventListener('fullscreenchange', this.fullscreenChangeBind); - window.addEventListener('mozfullscreenchange', this.fullscreenChangeBind); - window.addEventListener('webkitfullscreenchange', this.fullscreenChangeBind); - window.addEventListener('MSFullscreenChange', this.fullscreenChangeBind); + window.addEventListener("fullscreenchange", this.fullscreenChangeBind); + window.addEventListener("mozfullscreenchange", this.fullscreenChangeBind); + window.addEventListener("webkitfullscreenchange", this.fullscreenChangeBind); + window.addEventListener("MSFullscreenChange", this.fullscreenChangeBind); } }, { - key: '_removeFullscreenChangeListeners', + key: "_removeFullscreenChangeListeners", value: function _removeFullscreenChangeListeners() { - window.removeEventListener('fullscreenchange', this.fullscreenChangeBind); - window.removeEventListener('mozfullscreenchange', this.fullscreenChangeBind); - window.removeEventListener('webkitfullscreenchange', this.fullscreenChangeBind); - window.removeEventListener('MSFullscreenChange', this.fullscreenChangeBind); + window.removeEventListener("fullscreenchange", this.fullscreenChangeBind); + window.removeEventListener("mozfullscreenchange", this.fullscreenChangeBind); + window.removeEventListener("webkitfullscreenchange", this.fullscreenChangeBind); + window.removeEventListener("MSFullscreenChange", this.fullscreenChangeBind); delete this.fullscreenChangeBind; } }, { - key: 'isFullscreen', + key: "isFullscreen", get: function get() { return !!(document.fullscreenElement || document.mozFullScreen || document.webkitIsFullScreen || document.msFullscreenElement); } @@ -7830,7 +9764,7 @@ var PDFPresentationMode = function () { exports.PDFPresentationMode = PDFPresentationMode; /***/ }), -/* 26 */ +/* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7839,19 +9773,21 @@ exports.PDFPresentationMode = PDFPresentationMode; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFSidebarResizer = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +exports.PDFSidebarResizer = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var SIDEBAR_WIDTH_VAR = '--sidebar-width'; +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var SIDEBAR_WIDTH_VAR = "--sidebar-width"; var SIDEBAR_MIN_WIDTH = 200; -var SIDEBAR_RESIZING_CLASS = 'sidebarResizing'; +var SIDEBAR_RESIZING_CLASS = "sidebarResizing"; -var PDFSidebarResizer = function () { +var PDFSidebarResizer = /*#__PURE__*/function () { function PDFSidebarResizer(options, eventBus) { var _this = this; @@ -7870,106 +9806,128 @@ var PDFSidebarResizer = function () { this.resizer = options.resizer; this.eventBus = eventBus; this.l10n = l10n; - if (typeof CSS === 'undefined' || typeof CSS.supports !== 'function' || !CSS.supports(SIDEBAR_WIDTH_VAR, 'calc(-1 * ' + SIDEBAR_MIN_WIDTH + 'px)')) { - console.warn('PDFSidebarResizer: ' + 'The browser does not support resizing of the sidebar.'); + + if (typeof CSS === "undefined" || typeof CSS.supports !== "function" || !CSS.supports(SIDEBAR_WIDTH_VAR, "calc(-1 * ".concat(SIDEBAR_MIN_WIDTH, "px)"))) { + console.warn("PDFSidebarResizer: " + "The browser does not support resizing of the sidebar."); return; } + this.enabled = true; - this.resizer.classList.remove('hidden'); + this.resizer.classList.remove("hidden"); this.l10n.getDirection().then(function (dir) { - _this.isRTL = dir === 'rtl'; + _this.isRTL = dir === "rtl"; }); + this._addEventListeners(); } _createClass(PDFSidebarResizer, [{ - key: '_updateWidth', + key: "_updateWidth", value: function _updateWidth() { var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; if (!this.enabled) { return false; } - var maxWidth = Math.floor(this.outerContainerWidth / 2); - if (width > maxWidth) { - width = maxWidth; - } - if (width < SIDEBAR_MIN_WIDTH) { - width = SIDEBAR_MIN_WIDTH; - } - if (width === this._width) { + + var newWidth = (0, _ui_utils.clamp)(width, SIDEBAR_MIN_WIDTH, Math.floor(this.outerContainerWidth / 2)); + + if (newWidth === this._width) { return false; } - this._width = width; - this.doc.style.setProperty(SIDEBAR_WIDTH_VAR, width + 'px'); + + this._width = newWidth; + this.doc.style.setProperty(SIDEBAR_WIDTH_VAR, "".concat(newWidth, "px")); return true; } }, { - key: '_mouseMove', + key: "_mouseMove", value: function _mouseMove(evt) { var width = evt.clientX; + if (this.isRTL) { width = this.outerContainerWidth - width; } + this._updateWidth(width); } }, { - key: '_mouseUp', + key: "_mouseUp", value: function _mouseUp(evt) { this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS); - this.eventBus.dispatch('resize', { source: this }); + this.eventBus.dispatch("resize", { + source: this + }); var _boundEvents = this._boundEvents; - window.removeEventListener('mousemove', _boundEvents.mouseMove); - window.removeEventListener('mouseup', _boundEvents.mouseUp); + window.removeEventListener("mousemove", _boundEvents.mouseMove); + window.removeEventListener("mouseup", _boundEvents.mouseUp); } }, { - key: '_addEventListeners', + key: "_addEventListeners", value: function _addEventListeners() { var _this2 = this; if (!this.enabled) { return; } + var _boundEvents = this._boundEvents; _boundEvents.mouseMove = this._mouseMove.bind(this); _boundEvents.mouseUp = this._mouseUp.bind(this); - this.resizer.addEventListener('mousedown', function (evt) { + this.resizer.addEventListener("mousedown", function (evt) { if (evt.button !== 0) { return; } + _this2.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS); - window.addEventListener('mousemove', _boundEvents.mouseMove); - window.addEventListener('mouseup', _boundEvents.mouseUp); + + window.addEventListener("mousemove", _boundEvents.mouseMove); + window.addEventListener("mouseup", _boundEvents.mouseUp); }); - this.eventBus.on('sidebarviewchanged', function (evt) { + + this.eventBus._on("sidebarviewchanged", function (evt) { _this2.sidebarOpen = !!(evt && evt.view); }); - this.eventBus.on('resize', function (evt) { - if (evt && evt.source === window) { - _this2._outerContainerWidth = null; - if (_this2._width) { - if (_this2.sidebarOpen) { - _this2.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS); - var updated = _this2._updateWidth(_this2._width); - Promise.resolve().then(function () { - _this2.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS); - if (updated) { - _this2.eventBus.dispatch('resize', { source: _this2 }); - } - }); - } else { - _this2._updateWidth(_this2._width); - } - } + + this.eventBus._on("resize", function (evt) { + if (!evt || evt.source !== window) { + return; + } + + _this2._outerContainerWidth = null; + + if (!_this2._width) { + return; } + + if (!_this2.sidebarOpen) { + _this2._updateWidth(_this2._width); + + return; + } + + _this2.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS); + + var updated = _this2._updateWidth(_this2._width); + + Promise.resolve().then(function () { + _this2.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS); + + if (updated) { + _this2.eventBus.dispatch("resize", { + source: _this2 + }); + } + }); }); } }, { - key: 'outerContainerWidth', + key: "outerContainerWidth", get: function get() { if (!this._outerContainerWidth) { this._outerContainerWidth = this.outerContainer.clientWidth; } + return this._outerContainerWidth; } }]); @@ -7980,7 +9938,7 @@ var PDFSidebarResizer = function () { exports.PDFSidebarResizer = PDFSidebarResizer; /***/ }), -/* 27 */ +/* 25 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7989,26 +9947,28 @@ exports.PDFSidebarResizer = PDFSidebarResizer; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFThumbnailViewer = undefined; +exports.PDFThumbnailViewer = void 0; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _ui_utils = __webpack_require__(5); -var _ui_utils = __webpack_require__(6); - -var _pdf_thumbnail_view = __webpack_require__(28); +var _pdf_thumbnail_view = __webpack_require__(26); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var THUMBNAIL_SCROLL_MARGIN = -19; -var THUMBNAIL_SELECTED_CLASS = 'selected'; +var THUMBNAIL_SELECTED_CLASS = "selected"; -var PDFThumbnailViewer = function () { +var PDFThumbnailViewer = /*#__PURE__*/function () { function PDFThumbnailViewer(_ref) { var container = _ref.container, linkService = _ref.linkService, renderingQueue = _ref.renderingQueue, _ref$l10n = _ref.l10n, - l10n = _ref$l10n === undefined ? _ui_utils.NullL10n : _ref$l10n; + l10n = _ref$l10n === void 0 ? _ui_utils.NullL10n : _ref$l10n; _classCallCheck(this, PDFThumbnailViewer); @@ -8017,46 +9977,54 @@ var PDFThumbnailViewer = function () { this.renderingQueue = renderingQueue; this.l10n = l10n; this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdated.bind(this)); + this._resetView(); } _createClass(PDFThumbnailViewer, [{ - key: '_scrollUpdated', + key: "_scrollUpdated", value: function _scrollUpdated() { this.renderingQueue.renderHighestPriority(); } }, { - key: 'getThumbnail', + key: "getThumbnail", value: function getThumbnail(index) { return this._thumbnails[index]; } }, { - key: '_getVisibleThumbs', + key: "_getVisibleThumbs", value: function _getVisibleThumbs() { return (0, _ui_utils.getVisibleElements)(this.container, this._thumbnails); } }, { - key: 'scrollThumbnailIntoView', + key: "scrollThumbnailIntoView", value: function scrollThumbnailIntoView(pageNumber) { if (!this.pdfDocument) { return; } + var thumbnailView = this._thumbnails[pageNumber - 1]; + if (!thumbnailView) { console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.'); return; } + if (pageNumber !== this._currentPageNumber) { var prevThumbnailView = this._thumbnails[this._currentPageNumber - 1]; prevThumbnailView.div.classList.remove(THUMBNAIL_SELECTED_CLASS); thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS); } + var visibleThumbs = this._getVisibleThumbs(); + var numVisibleThumbs = visibleThumbs.views.length; + if (numVisibleThumbs > 0) { var first = visibleThumbs.first.id; var last = numVisibleThumbs > 1 ? visibleThumbs.last.id : first; var shouldScroll = false; + if (pageNumber <= first || pageNumber >= last) { shouldScroll = true; } else { @@ -8064,47 +10032,59 @@ var PDFThumbnailViewer = function () { if (view.id !== pageNumber) { return false; } + shouldScroll = view.percent < 100; return true; }); } + if (shouldScroll) { - (0, _ui_utils.scrollIntoView)(thumbnailView.div, { top: THUMBNAIL_SCROLL_MARGIN }); + (0, _ui_utils.scrollIntoView)(thumbnailView.div, { + top: THUMBNAIL_SCROLL_MARGIN + }); } } + this._currentPageNumber = pageNumber; } }, { - key: 'cleanup', + key: "cleanup", value: function cleanup() { _pdf_thumbnail_view.PDFThumbnailView.cleanup(); } }, { - key: '_resetView', + key: "_resetView", value: function _resetView() { this._thumbnails = []; this._currentPageNumber = 1; this._pageLabels = null; this._pagesRotation = 0; - this._pagesRequests = []; - this.container.textContent = ''; + this._pagesRequests = new WeakMap(); + this.container.textContent = ""; } }, { - key: 'setDocument', + key: "setDocument", value: function setDocument(pdfDocument) { var _this = this; if (this.pdfDocument) { this._cancelRendering(); + this._resetView(); } + this.pdfDocument = pdfDocument; + if (!pdfDocument) { return; } - pdfDocument.getPage(1).then(function (firstPage) { + + pdfDocument.getPage(1).then(function (firstPdfPage) { var pagesCount = pdfDocument.numPages; - var viewport = firstPage.getViewport(1.0); + var viewport = firstPdfPage.getViewport({ + scale: 1 + }); + for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { var thumbnail = new _pdf_thumbnail_view.PDFThumbnailView({ container: _this.container, @@ -8115,16 +10095,24 @@ var PDFThumbnailViewer = function () { disableCanvasToImageConversion: false, l10n: _this.l10n }); + _this._thumbnails.push(thumbnail); } + + var firstThumbnailView = _this._thumbnails[0]; + + if (firstThumbnailView) { + firstThumbnailView.setPdfPage(firstPdfPage); + } + var thumbnailView = _this._thumbnails[_this._currentPageNumber - 1]; thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS); - }).catch(function (reason) { - console.error('Unable to initialize thumbnail viewer', reason); + })["catch"](function (reason) { + console.error("Unable to initialize thumbnail viewer", reason); }); } }, { - key: '_cancelRendering', + key: "_cancelRendering", value: function _cancelRendering() { for (var i = 0, ii = this._thumbnails.length; i < ii; i++) { if (this._thumbnails[i]) { @@ -8133,78 +10121,97 @@ var PDFThumbnailViewer = function () { } } }, { - key: 'setPageLabels', + key: "setPageLabels", value: function setPageLabels(labels) { if (!this.pdfDocument) { return; } + if (!labels) { this._pageLabels = null; } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) { this._pageLabels = null; - console.error('PDFThumbnailViewer_setPageLabels: Invalid page labels.'); + console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels."); } else { this._pageLabels = labels; } + for (var i = 0, ii = this._thumbnails.length; i < ii; i++) { var label = this._pageLabels && this._pageLabels[i]; + this._thumbnails[i].setPageLabel(label); } } }, { - key: '_ensurePdfPageLoaded', + key: "_ensurePdfPageLoaded", value: function _ensurePdfPageLoaded(thumbView) { var _this2 = this; if (thumbView.pdfPage) { return Promise.resolve(thumbView.pdfPage); } - var pageNumber = thumbView.id; - if (this._pagesRequests[pageNumber]) { - return this._pagesRequests[pageNumber]; + + if (this._pagesRequests.has(thumbView)) { + return this._pagesRequests.get(thumbView); } - var promise = this.pdfDocument.getPage(pageNumber).then(function (pdfPage) { - thumbView.setPdfPage(pdfPage); - _this2._pagesRequests[pageNumber] = null; + + var promise = this.pdfDocument.getPage(thumbView.id).then(function (pdfPage) { + if (!thumbView.pdfPage) { + thumbView.setPdfPage(pdfPage); + } + + _this2._pagesRequests["delete"](thumbView); + return pdfPage; - }).catch(function (reason) { - console.error('Unable to get page for thumb view', reason); - _this2._pagesRequests[pageNumber] = null; + })["catch"](function (reason) { + console.error("Unable to get page for thumb view", reason); + + _this2._pagesRequests["delete"](thumbView); }); - this._pagesRequests[pageNumber] = promise; + + this._pagesRequests.set(thumbView, promise); + return promise; } }, { - key: 'forceRendering', + key: "forceRendering", value: function forceRendering() { var _this3 = this; var visibleThumbs = this._getVisibleThumbs(); + var thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this._thumbnails, this.scroll.down); + if (thumbView) { this._ensurePdfPageLoaded(thumbView).then(function () { _this3.renderingQueue.renderView(thumbView); }); + return true; } + return false; } }, { - key: 'pagesRotation', + key: "pagesRotation", get: function get() { return this._pagesRotation; }, set: function set(rotation) { if (!(0, _ui_utils.isValidRotation)(rotation)) { - throw new Error('Invalid thumbnails rotation angle.'); + throw new Error("Invalid thumbnails rotation angle."); } + if (!this.pdfDocument) { return; } + if (this._pagesRotation === rotation) { return; } + this._pagesRotation = rotation; + for (var i = 0, ii = this._thumbnails.length; i < ii; i++) { this._thumbnails[i].update(rotation); } @@ -8217,7 +10224,7 @@ var PDFThumbnailViewer = function () { exports.PDFThumbnailViewer = PDFThumbnailViewer; /***/ }), -/* 28 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8226,52 +10233,61 @@ exports.PDFThumbnailViewer = PDFThumbnailViewer; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFThumbnailView = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +exports.PDFThumbnailView = void 0; -var _pdfjsLib = __webpack_require__(7); +var _pdfjsLib = __webpack_require__(8); -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); -var _pdf_rendering_queue = __webpack_require__(10); +var _pdf_rendering_queue = __webpack_require__(11); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var MAX_NUM_SCALING_STEPS = 3; var THUMBNAIL_CANVAS_BORDER_WIDTH = 1; var THUMBNAIL_WIDTH = 98; + var TempImageFactory = function TempImageFactoryClosure() { var tempCanvasCache = null; return { getCanvas: function getCanvas(width, height) { var tempCanvas = tempCanvasCache; + if (!tempCanvas) { - tempCanvas = document.createElement('canvas'); + tempCanvas = document.createElement("canvas"); tempCanvasCache = tempCanvas; } + tempCanvas.width = width; tempCanvas.height = height; tempCanvas.mozOpaque = true; - var ctx = tempCanvas.getContext('2d', { alpha: false }); + var ctx = tempCanvas.getContext("2d", { + alpha: false + }); ctx.save(); - ctx.fillStyle = 'rgb(255, 255, 255)'; + ctx.fillStyle = "rgb(255, 255, 255)"; ctx.fillRect(0, 0, width, height); ctx.restore(); return tempCanvas; }, destroyCanvas: function destroyCanvas() { var tempCanvas = tempCanvasCache; + if (tempCanvas) { tempCanvas.width = 0; tempCanvas.height = 0; } + tempCanvasCache = null; } }; }(); -var PDFThumbnailView = function () { +var PDFThumbnailView = /*#__PURE__*/function () { function PDFThumbnailView(_ref) { var container = _ref.container, id = _ref.id, @@ -8279,14 +10295,14 @@ var PDFThumbnailView = function () { linkService = _ref.linkService, renderingQueue = _ref.renderingQueue, _ref$disableCanvasToI = _ref.disableCanvasToImageConversion, - disableCanvasToImageConversion = _ref$disableCanvasToI === undefined ? false : _ref$disableCanvasToI, + disableCanvasToImageConversion = _ref$disableCanvasToI === void 0 ? false : _ref$disableCanvasToI, _ref$l10n = _ref.l10n, - l10n = _ref$l10n === undefined ? _ui_utils.NullL10n : _ref$l10n; + l10n = _ref$l10n === void 0 ? _ui_utils.NullL10n : _ref$l10n; _classCallCheck(this, PDFThumbnailView); this.id = id; - this.renderingId = 'thumbnail' + id; + this.renderingId = "thumbnail" + id; this.pageLabel = null; this.pdfPage = null; this.rotation = 0; @@ -8305,25 +10321,28 @@ var PDFThumbnailView = function () { this.canvasHeight = this.canvasWidth / this.pageRatio | 0; this.scale = this.canvasWidth / this.pageWidth; this.l10n = l10n; - var anchor = document.createElement('a'); - anchor.href = linkService.getAnchorUrl('#page=' + id); - this.l10n.get('thumb_page_title', { page: id }, 'Page {{page}}').then(function (msg) { + var anchor = document.createElement("a"); + anchor.href = linkService.getAnchorUrl("#page=" + id); + + this._thumbPageTitle.then(function (msg) { anchor.title = msg; }); + anchor.onclick = function () { linkService.page = id; return false; }; + this.anchor = anchor; - var div = document.createElement('div'); - div.className = 'thumbnail'; - div.setAttribute('data-page-number', this.id); + var div = document.createElement("div"); + div.className = "thumbnail"; + div.setAttribute("data-page-number", this.id); this.div = div; - var ring = document.createElement('div'); - ring.className = 'thumbnailSelectionRing'; + var ring = document.createElement("div"); + ring.className = "thumbnailSelectionRing"; var borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH; - ring.style.width = this.canvasWidth + borderAdjustment + 'px'; - ring.style.height = this.canvasHeight + borderAdjustment + 'px'; + ring.style.width = this.canvasWidth + borderAdjustment + "px"; + ring.style.height = this.canvasHeight + borderAdjustment + "px"; this.ring = ring; div.appendChild(ring); anchor.appendChild(div); @@ -8331,48 +10350,57 @@ var PDFThumbnailView = function () { } _createClass(PDFThumbnailView, [{ - key: 'setPdfPage', + key: "setPdfPage", value: function setPdfPage(pdfPage) { this.pdfPage = pdfPage; this.pdfPageRotate = pdfPage.rotate; var totalRotation = (this.rotation + this.pdfPageRotate) % 360; - this.viewport = pdfPage.getViewport(1, totalRotation); + this.viewport = pdfPage.getViewport({ + scale: 1, + rotation: totalRotation + }); this.reset(); } }, { - key: 'reset', + key: "reset", value: function reset() { this.cancelRendering(); + this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; this.pageWidth = this.viewport.width; this.pageHeight = this.viewport.height; this.pageRatio = this.pageWidth / this.pageHeight; this.canvasHeight = this.canvasWidth / this.pageRatio | 0; this.scale = this.canvasWidth / this.pageWidth; - this.div.removeAttribute('data-loaded'); + this.div.removeAttribute("data-loaded"); var ring = this.ring; var childNodes = ring.childNodes; + for (var i = childNodes.length - 1; i >= 0; i--) { ring.removeChild(childNodes[i]); } + var borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH; - ring.style.width = this.canvasWidth + borderAdjustment + 'px'; - ring.style.height = this.canvasHeight + borderAdjustment + 'px'; + ring.style.width = this.canvasWidth + borderAdjustment + "px"; + ring.style.height = this.canvasHeight + borderAdjustment + "px"; + if (this.canvas) { this.canvas.width = 0; this.canvas.height = 0; delete this.canvas; } + if (this.image) { - this.image.removeAttribute('src'); + this.image.removeAttribute("src"); delete this.image; } } }, { - key: 'update', + key: "update", value: function update(rotation) { - if (typeof rotation !== 'undefined') { + if (typeof rotation !== "undefined") { this.rotation = rotation; } + var totalRotation = (this.rotation + this.pdfPageRotate) % 360; this.viewport = this.viewport.clone({ scale: 1, @@ -8381,118 +10409,148 @@ var PDFThumbnailView = function () { this.reset(); } }, { - key: 'cancelRendering', + key: "cancelRendering", value: function cancelRendering() { if (this.renderTask) { this.renderTask.cancel(); this.renderTask = null; } - this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; + this.resume = null; } }, { - key: '_getPageDrawContext', + key: "_getPageDrawContext", value: function _getPageDrawContext() { var noCtxScale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - var canvas = document.createElement('canvas'); + var canvas = document.createElement("canvas"); this.canvas = canvas; canvas.mozOpaque = true; - var ctx = canvas.getContext('2d', { alpha: false }); + var ctx = canvas.getContext("2d", { + alpha: false + }); var outputScale = (0, _ui_utils.getOutputScale)(ctx); canvas.width = this.canvasWidth * outputScale.sx | 0; canvas.height = this.canvasHeight * outputScale.sy | 0; - canvas.style.width = this.canvasWidth + 'px'; - canvas.style.height = this.canvasHeight + 'px'; + canvas.style.width = this.canvasWidth + "px"; + canvas.style.height = this.canvasHeight + "px"; + if (!noCtxScale && outputScale.scaled) { ctx.scale(outputScale.sx, outputScale.sy); } + return ctx; } }, { - key: '_convertCanvasToImage', + key: "_convertCanvasToImage", value: function _convertCanvasToImage() { var _this = this; if (!this.canvas) { return; } + if (this.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) { return; } - var id = this.renderingId; - var className = 'thumbnailImage'; + + var className = "thumbnailImage"; + if (this.disableCanvasToImageConversion) { - this.canvas.id = id; this.canvas.className = className; - this.l10n.get('thumb_page_canvas', { page: this.pageId }, 'Thumbnail of Page {{page}}').then(function (msg) { - _this.canvas.setAttribute('aria-label', msg); + + this._thumbPageCanvas.then(function (msg) { + _this.canvas.setAttribute("aria-label", msg); }); - this.div.setAttribute('data-loaded', true); + + this.div.setAttribute("data-loaded", true); this.ring.appendChild(this.canvas); return; } - var image = document.createElement('img'); - image.id = id; + + var image = document.createElement("img"); image.className = className; - this.l10n.get('thumb_page_canvas', { page: this.pageId }, 'Thumbnail of Page {{page}}').then(function (msg) { - image.setAttribute('aria-label', msg); + + this._thumbPageCanvas.then(function (msg) { + image.setAttribute("aria-label", msg); }); - image.style.width = this.canvasWidth + 'px'; - image.style.height = this.canvasHeight + 'px'; + + image.style.width = this.canvasWidth + "px"; + image.style.height = this.canvasHeight + "px"; image.src = this.canvas.toDataURL(); this.image = image; - this.div.setAttribute('data-loaded', true); + this.div.setAttribute("data-loaded", true); this.ring.appendChild(image); this.canvas.width = 0; this.canvas.height = 0; delete this.canvas; } }, { - key: 'draw', + key: "draw", value: function draw() { var _this2 = this; if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) { - console.error('Must be in new state before drawing'); + console.error("Must be in new state before drawing"); return Promise.resolve(undefined); } + + var pdfPage = this.pdfPage; + + if (!pdfPage) { + this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; + return Promise.reject(new Error("pdfPage is not loaded")); + } + this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING; var renderCapability = (0, _pdfjsLib.createPromiseCapability)(); + var finishRenderTask = function finishRenderTask(error) { if (renderTask === _this2.renderTask) { _this2.renderTask = null; } + if (error instanceof _pdfjsLib.RenderingCancelledException) { renderCapability.resolve(undefined); return; } + _this2.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; + _this2._convertCanvasToImage(); + if (!error) { renderCapability.resolve(undefined); } else { renderCapability.reject(error); } }; + var ctx = this._getPageDrawContext(); - var drawViewport = this.viewport.clone({ scale: this.scale }); + + var drawViewport = this.viewport.clone({ + scale: this.scale + }); + var renderContinueCallback = function renderContinueCallback(cont) { if (!_this2.renderingQueue.isHighestPriority(_this2)) { _this2.renderingState = _pdf_rendering_queue.RenderingStates.PAUSED; + _this2.resume = function () { _this2.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING; cont(); }; + return; } + cont(); }; + var renderContext = { canvasContext: ctx, viewport: drawViewport }; - var renderTask = this.renderTask = this.pdfPage.render(renderContext); + var renderTask = this.renderTask = pdfPage.render(renderContext); renderTask.onContinue = renderContinueCallback; renderTask.promise.then(function () { finishRenderTask(null); @@ -8502,70 +10560,97 @@ var PDFThumbnailView = function () { return renderCapability.promise; } }, { - key: 'setImage', + key: "setImage", value: function setImage(pageView) { if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) { return; } + var img = pageView.canvas; + if (!img) { return; } + if (!this.pdfPage) { this.setPdfPage(pageView.pdfPage); } + this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; + var ctx = this._getPageDrawContext(true); + var canvas = ctx.canvas; + if (img.width <= 2 * canvas.width) { ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height); + this._convertCanvasToImage(); + return; } + var reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS; var reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS; var reducedImage = TempImageFactory.getCanvas(reducedWidth, reducedHeight); - var reducedImageCtx = reducedImage.getContext('2d'); + var reducedImageCtx = reducedImage.getContext("2d"); + while (reducedWidth > img.width || reducedHeight > img.height) { reducedWidth >>= 1; reducedHeight >>= 1; } + reducedImageCtx.drawImage(img, 0, 0, img.width, img.height, 0, 0, reducedWidth, reducedHeight); + while (reducedWidth > 2 * canvas.width) { reducedImageCtx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, reducedWidth >> 1, reducedHeight >> 1); reducedWidth >>= 1; reducedHeight >>= 1; } + ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, canvas.width, canvas.height); + this._convertCanvasToImage(); } }, { - key: 'setPageLabel', + key: "setPageLabel", value: function setPageLabel(label) { var _this3 = this; - this.pageLabel = typeof label === 'string' ? label : null; - this.l10n.get('thumb_page_title', { page: this.pageId }, 'Page {{page}}').then(function (msg) { + this.pageLabel = typeof label === "string" ? label : null; + + this._thumbPageTitle.then(function (msg) { _this3.anchor.title = msg; }); + if (this.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) { return; } - this.l10n.get('thumb_page_canvas', { page: this.pageId }, 'Thumbnail of Page {{page}}').then(function (ariaLabel) { + + this._thumbPageCanvas.then(function (msg) { if (_this3.image) { - _this3.image.setAttribute('aria-label', ariaLabel); + _this3.image.setAttribute("aria-label", msg); } else if (_this3.disableCanvasToImageConversion && _this3.canvas) { - _this3.canvas.setAttribute('aria-label', ariaLabel); + _this3.canvas.setAttribute("aria-label", msg); } }); } }, { - key: 'pageId', + key: "_thumbPageTitle", get: function get() { - return this.pageLabel !== null ? this.pageLabel : this.id; + return this.l10n.get("thumb_page_title", { + page: this.pageLabel !== null ? this.pageLabel : this.id + }, "Page {{page}}"); + } + }, { + key: "_thumbPageCanvas", + get: function get() { + return this.l10n.get("thumb_page_canvas", { + page: this.pageLabel !== null ? this.pageLabel : this.id + }, "Thumbnail of Page {{page}}"); } }], [{ - key: 'cleanup', + key: "cleanup", value: function cleanup() { TempImageFactory.destroyCanvas(); } @@ -8577,7 +10662,7 @@ var PDFThumbnailView = function () { exports.PDFThumbnailView = PDFThumbnailView; /***/ }), -/* 29 */ +/* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8586,115 +10671,136 @@ exports.PDFThumbnailView = PDFThumbnailView; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFViewer = undefined; +exports.PDFViewer = void 0; + +var _base_viewer = __webpack_require__(28); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _pdfjsLib = __webpack_require__(8); -var _base_viewer = __webpack_require__(30); +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var _ui_utils = __webpack_require__(6); +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } -var _pdfjsLib = __webpack_require__(7); +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } -var PDFViewer = function (_BaseViewer) { +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var PDFViewer = /*#__PURE__*/function (_BaseViewer) { _inherits(PDFViewer, _BaseViewer); + var _super = _createSuper(PDFViewer); + function PDFViewer() { _classCallCheck(this, PDFViewer); - return _possibleConstructorReturn(this, (PDFViewer.__proto__ || Object.getPrototypeOf(PDFViewer)).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(PDFViewer, [{ - key: '_scrollIntoView', + key: "_scrollIntoView", value: function _scrollIntoView(_ref) { var pageDiv = _ref.pageDiv, _ref$pageSpot = _ref.pageSpot, - pageSpot = _ref$pageSpot === undefined ? null : _ref$pageSpot; + pageSpot = _ref$pageSpot === void 0 ? null : _ref$pageSpot, + _ref$pageNumber = _ref.pageNumber, + pageNumber = _ref$pageNumber === void 0 ? null : _ref$pageNumber; if (!pageSpot && !this.isInPresentationMode) { var left = pageDiv.offsetLeft + pageDiv.clientLeft; var right = left + pageDiv.clientWidth; - var _container = this.container, - scrollLeft = _container.scrollLeft, - clientWidth = _container.clientWidth; + var _this$container = this.container, + scrollLeft = _this$container.scrollLeft, + clientWidth = _this$container.clientWidth; - if (this._scrollMode === _base_viewer.ScrollMode.HORIZONTAL || left < scrollLeft || right > scrollLeft + clientWidth) { + if (this._isScrollModeHorizontal || left < scrollLeft || right > scrollLeft + clientWidth) { pageSpot = { left: 0, top: 0 }; } } - (0, _ui_utils.scrollIntoView)(pageDiv, pageSpot); + + _get(_getPrototypeOf(PDFViewer.prototype), "_scrollIntoView", this).call(this, { + pageDiv: pageDiv, + pageSpot: pageSpot, + pageNumber: pageNumber + }); } }, { - key: '_getVisiblePages', + key: "_getVisiblePages", value: function _getVisiblePages() { - if (!this.isInPresentationMode) { - return (0, _ui_utils.getVisibleElements)(this.container, this._pages, true, this._scrollMode === _base_viewer.ScrollMode.HORIZONTAL); + if (this.isInPresentationMode) { + return this._getCurrentVisiblePage(); } - var currentPage = this._pages[this._currentPageNumber - 1]; - var visible = [{ - id: currentPage.id, - view: currentPage - }]; - return { - first: currentPage, - last: currentPage, - views: visible - }; + + return _get(_getPrototypeOf(PDFViewer.prototype), "_getVisiblePages", this).call(this); } }, { - key: 'update', - value: function update() { - var visible = this._getVisiblePages(); - var visiblePages = visible.views, - numVisiblePages = visiblePages.length; - if (numVisiblePages === 0) { + key: "_updateHelper", + value: function _updateHelper(visiblePages) { + if (this.isInPresentationMode) { return; } - this._resizeBuffer(numVisiblePages, visiblePages); - this.renderingQueue.renderHighestPriority(visible); + var currentId = this._currentPageNumber; var stillFullyVisible = false; - for (var i = 0; i < numVisiblePages; ++i) { - var page = visiblePages[i]; - if (page.percent < 100) { - break; - } - if (page.id === currentId) { - stillFullyVisible = true; - break; + + var _iterator = _createForOfIteratorHelper(visiblePages), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var page = _step.value; + + if (page.percent < 100) { + break; + } + + if (page.id === currentId) { + stillFullyVisible = true; + break; + } } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); } + if (!stillFullyVisible) { currentId = visiblePages[0].id; } - if (!this.isInPresentationMode) { - this._setCurrentPageNumber(currentId); - } - this._updateLocation(visible.first); - this.eventBus.dispatch('updateviewarea', { - source: this, - location: this._location - }); - } - }, { - key: '_setDocumentViewerElement', - get: function get() { - return (0, _pdfjsLib.shadow)(this, '_setDocumentViewerElement', this.viewer); + + this._setCurrentPageNumber(currentId); } }, { - key: '_isScrollModeHorizontal', + key: "_viewerElement", get: function get() { - return this.isInPresentationMode ? false : this._scrollMode === _base_viewer.ScrollMode.HORIZONTAL; + return (0, _pdfjsLib.shadow)(this, "_viewerElement", this.viewer); } }]); @@ -8704,7 +10810,7 @@ var PDFViewer = function (_BaseViewer) { exports.PDFViewer = PDFViewer; /***/ }), -/* 30 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8713,96 +10819,100 @@ exports.PDFViewer = PDFViewer; Object.defineProperty(exports, "__esModule", { value: true }); -exports.SpreadMode = exports.ScrollMode = exports.BaseViewer = undefined; +exports.BaseViewer = void 0; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _ui_utils = __webpack_require__(5); -var _ui_utils = __webpack_require__(6); +var _pdf_rendering_queue = __webpack_require__(11); -var _pdf_rendering_queue = __webpack_require__(10); +var _annotation_layer_builder = __webpack_require__(29); -var _annotation_layer_builder = __webpack_require__(31); +var _pdfjsLib = __webpack_require__(8); -var _pdfjsLib = __webpack_require__(7); +var _pdf_page_view = __webpack_require__(30); -var _dom_events = __webpack_require__(14); +var _pdf_link_service = __webpack_require__(21); -var _pdf_page_view = __webpack_require__(32); +var _text_layer_builder = __webpack_require__(31); -var _pdf_link_service = __webpack_require__(23); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var _text_layer_builder = __webpack_require__(33); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var DEFAULT_CACHE_SIZE = 10; -var ScrollMode = { - VERTICAL: 0, - HORIZONTAL: 1, - WRAPPED: 2 -}; -var SpreadMode = { - NONE: 0, - ODD: 1, - EVEN: 2 -}; + function PDFPageViewBuffer(size) { var data = []; + this.push = function (view) { var i = data.indexOf(view); + if (i >= 0) { data.splice(i, 1); } + data.push(view); + if (data.length > size) { data.shift().destroy(); } }; + this.resize = function (newSize, pagesToKeep) { size = newSize; + if (pagesToKeep) { var pageIdsToKeep = new Set(); + for (var i = 0, iMax = pagesToKeep.length; i < iMax; ++i) { pageIdsToKeep.add(pagesToKeep[i].id); } + (0, _ui_utils.moveToEndOfArray)(data, function (page) { return pageIdsToKeep.has(page.id); }); } + while (data.length > size) { data.shift().destroy(); } }; } + function isSameScale(oldScale, newScale) { if (newScale === oldScale) { return true; } + if (Math.abs(newScale - oldScale) < 1e-15) { return true; } + return false; } -var BaseViewer = function () { +var BaseViewer = /*#__PURE__*/function () { function BaseViewer(options) { var _this = this; _classCallCheck(this, BaseViewer); if (this.constructor === BaseViewer) { - throw new Error('Cannot initialize BaseViewer.'); + throw new Error("Cannot initialize BaseViewer."); } + this._name = this.constructor.name; this.container = options.container; this.viewer = options.viewer || options.container.firstElementChild; - this.eventBus = options.eventBus || (0, _dom_events.getGlobalEventBus)(); + this.eventBus = options.eventBus; this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService(); this.downloadManager = options.downloadManager || null; this.findController = options.findController || null; this.removePageBorders = options.removePageBorders || false; this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE; - this.imageResourcesPath = options.imageResourcesPath || ''; + this.imageResourcesPath = options.imageResourcesPath || ""; this.renderInteractiveForms = options.renderInteractiveForms || false; this.enablePrintAutoRotate = options.enablePrintAutoRotate || false; this.renderer = options.renderer || _ui_utils.RendererType.CANVAS; @@ -8811,30 +10921,38 @@ var BaseViewer = function () { this.maxCanvasPixels = options.maxCanvasPixels; this.l10n = options.l10n || _ui_utils.NullL10n; this.defaultRenderingQueue = !options.renderingQueue; + if (this.defaultRenderingQueue) { this.renderingQueue = new _pdf_rendering_queue.PDFRenderingQueue(); this.renderingQueue.setViewer(this); } else { this.renderingQueue = options.renderingQueue; } + this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdate.bind(this)); this.presentationModeState = _ui_utils.PresentationModeState.UNKNOWN; + this._onBeforeDraw = this._onAfterDraw = null; + this._resetView(); + if (this.removePageBorders) { - this.viewer.classList.add('removePageBorders'); + this.viewer.classList.add("removePageBorders"); } + Promise.resolve().then(function () { - _this.eventBus.dispatch('baseviewerinit', { source: _this }); + _this.eventBus.dispatch("baseviewerinit", { + source: _this + }); }); } _createClass(BaseViewer, [{ - key: 'getPageView', + key: "getPageView", value: function getPageView(index) { return this._pages[index]; } }, { - key: '_setCurrentPageNumber', + key: "_setCurrentPageNumber", value: function _setCurrentPageNumber(val) { var resetCurrentPageView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; @@ -8842,76 +10960,105 @@ var BaseViewer = function () { if (resetCurrentPageView) { this._resetCurrentPageView(); } - return; + + return true; } + if (!(0 < val && val <= this.pagesCount)) { - console.error(this._name + '._setCurrentPageNumber: "' + val + '" is out of bounds.'); - return; + return false; } - var arg = { + + this._currentPageNumber = val; + this.eventBus.dispatch("pagechanging", { source: this, pageNumber: val, pageLabel: this._pageLabels && this._pageLabels[val - 1] - }; - this._currentPageNumber = val; - this.eventBus.dispatch('pagechanging', arg); - this.eventBus.dispatch('pagechange', arg); + }); + if (resetCurrentPageView) { this._resetCurrentPageView(); } + + return true; + } + }, { + key: "_onePageRenderedOrForceFetch", + value: function _onePageRenderedOrForceFetch() { + if (!this.container.offsetParent || this._getVisiblePages().views.length === 0) { + return Promise.resolve(); + } + + return this._onePageRenderedCapability.promise; } }, { - key: 'setDocument', + key: "setDocument", value: function setDocument(pdfDocument) { var _this2 = this; if (this.pdfDocument) { this._cancelRendering(); + this._resetView(); + if (this.findController) { this.findController.setDocument(null); } } + this.pdfDocument = pdfDocument; + if (!pdfDocument) { return; } + var pagesCount = pdfDocument.numPages; - var pagesCapability = (0, _pdfjsLib.createPromiseCapability)(); - this.pagesPromise = pagesCapability.promise; - pagesCapability.promise.then(function () { - _this2._pageViewsReady = true; - _this2.eventBus.dispatch('pagesloaded', { + var firstPagePromise = pdfDocument.getPage(1); + + this._pagesCapability.promise.then(function () { + _this2.eventBus.dispatch("pagesloaded", { source: _this2, pagesCount: pagesCount }); }); - var isOnePageRenderedResolved = false; - var onePageRenderedCapability = (0, _pdfjsLib.createPromiseCapability)(); - this.onePageRendered = onePageRenderedCapability.promise; - var bindOnAfterAndBeforeDraw = function bindOnAfterAndBeforeDraw(pageView) { - pageView.onBeforeDraw = function () { - _this2._buffer.push(pageView); - }; - pageView.onAfterDraw = function () { - if (!isOnePageRenderedResolved) { - isOnePageRenderedResolved = true; - onePageRenderedCapability.resolve(); - } - }; + + this._onBeforeDraw = function (evt) { + var pageView = _this2._pages[evt.pageNumber - 1]; + + if (!pageView) { + return; + } + + _this2._buffer.push(pageView); }; - var firstPagePromise = pdfDocument.getPage(1); - this.firstPagePromise = firstPagePromise; - firstPagePromise.then(function (pdfPage) { + + this.eventBus._on("pagerender", this._onBeforeDraw); + + this._onAfterDraw = function (evt) { + if (evt.cssTransform || _this2._onePageRenderedCapability.settled) { + return; + } + + _this2._onePageRenderedCapability.resolve(); + + _this2.eventBus._off("pagerendered", _this2._onAfterDraw); + + _this2._onAfterDraw = null; + }; + + this.eventBus._on("pagerendered", this._onAfterDraw); + + firstPagePromise.then(function (firstPdfPage) { + _this2._firstPageCapability.resolve(firstPdfPage); + var scale = _this2.currentScale; - var viewport = pdfPage.getViewport(scale * _ui_utils.CSS_UNITS); + var viewport = firstPdfPage.getViewport({ + scale: scale * _ui_utils.CSS_UNITS + }); + var textLayerFactory = _this2.textLayerMode !== _ui_utils.TextLayerMode.DISABLE ? _this2 : null; + for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { - var textLayerFactory = null; - if (_this2.textLayerMode !== _ui_utils.TextLayerMode.DISABLE) { - textLayerFactory = _this2; - } var pageView = new _pdf_page_view.PDFPageView({ - container: _this2._setDocumentViewerElement, + container: _this2._viewerElement, eventBus: _this2.eventBus, id: pageNum, scale: scale, @@ -8928,66 +11075,95 @@ var BaseViewer = function () { maxCanvasPixels: _this2.maxCanvasPixels, l10n: _this2.l10n }); - bindOnAfterAndBeforeDraw(pageView); + _this2._pages.push(pageView); } - if (_this2._spreadMode !== SpreadMode.NONE) { + + var firstPageView = _this2._pages[0]; + + if (firstPageView) { + firstPageView.setPdfPage(firstPdfPage); + + _this2.linkService.cachePageRef(1, firstPdfPage.ref); + } + + if (_this2._spreadMode !== _ui_utils.SpreadMode.NONE) { _this2._updateSpreadMode(); } - onePageRenderedCapability.promise.then(function () { - if (pdfDocument.loadingParams['disableAutoFetch']) { - pagesCapability.resolve(); + + _this2._onePageRenderedOrForceFetch().then(function () { + if (_this2.findController) { + _this2.findController.setDocument(pdfDocument); + } + + if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > 7500) { + _this2._pagesCapability.resolve(); + + return; + } + + var getPagesLeft = pagesCount - 1; + + if (getPagesLeft <= 0) { + _this2._pagesCapability.resolve(); + return; } - var getPagesLeft = pagesCount; var _loop = function _loop(_pageNum) { pdfDocument.getPage(_pageNum).then(function (pdfPage) { var pageView = _this2._pages[_pageNum - 1]; + if (!pageView.pdfPage) { pageView.setPdfPage(pdfPage); } + _this2.linkService.cachePageRef(_pageNum, pdfPage.ref); + if (--getPagesLeft === 0) { - pagesCapability.resolve(); + _this2._pagesCapability.resolve(); } }, function (reason) { - console.error('Unable to get page ' + _pageNum + ' to initialize viewer', reason); + console.error("Unable to get page ".concat(_pageNum, " to initialize viewer"), reason); + if (--getPagesLeft === 0) { - pagesCapability.resolve(); + _this2._pagesCapability.resolve(); } }); }; - for (var _pageNum = 1; _pageNum <= pagesCount; ++_pageNum) { + for (var _pageNum = 2; _pageNum <= pagesCount; ++_pageNum) { _loop(_pageNum); } }); - _this2.eventBus.dispatch('pagesinit', { source: _this2 }); - if (_this2.findController) { - _this2.findController.setDocument(pdfDocument); - } + + _this2.eventBus.dispatch("pagesinit", { + source: _this2 + }); + if (_this2.defaultRenderingQueue) { _this2.update(); } - }).catch(function (reason) { - console.error('Unable to initialize viewer', reason); + })["catch"](function (reason) { + console.error("Unable to initialize viewer", reason); }); } }, { - key: 'setPageLabels', + key: "setPageLabels", value: function setPageLabels(labels) { if (!this.pdfDocument) { return; } + if (!labels) { this._pageLabels = null; } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) { this._pageLabels = null; - console.error(this._name + '.setPageLabels: Invalid page labels.'); + console.error("".concat(this._name, ".setPageLabels: Invalid page labels.")); } else { this._pageLabels = labels; } + for (var i = 0, ii = this._pages.length; i < ii; i++) { var pageView = this._pages[i]; var label = this._pageLabels && this._pageLabels[i]; @@ -8995,7 +11171,7 @@ var BaseViewer = function () { } } }, { - key: '_resetView', + key: "_resetView", value: function _resetView() { this._pages = []; this._currentPageNumber = 1; @@ -9005,226 +11181,288 @@ var BaseViewer = function () { this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE); this._location = null; this._pagesRotation = 0; - this._pagesRequests = []; - this._pageViewsReady = false; - this._scrollMode = ScrollMode.VERTICAL; - this._spreadMode = SpreadMode.NONE; - this.viewer.textContent = ''; + 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._spreadMode = _ui_utils.SpreadMode.NONE; + + if (this._onBeforeDraw) { + this.eventBus._off("pagerender", this._onBeforeDraw); + + this._onBeforeDraw = null; + } + + if (this._onAfterDraw) { + this.eventBus._off("pagerendered", this._onAfterDraw); + + this._onAfterDraw = null; + } + + this.viewer.textContent = ""; + this._updateScrollMode(); } }, { - key: '_scrollUpdate', + key: "_scrollUpdate", value: function _scrollUpdate() { if (this.pagesCount === 0) { return; } + this.update(); } }, { - key: '_scrollIntoView', + key: "_scrollIntoView", value: function _scrollIntoView(_ref) { var pageDiv = _ref.pageDiv, _ref$pageSpot = _ref.pageSpot, - pageSpot = _ref$pageSpot === undefined ? null : _ref$pageSpot, + pageSpot = _ref$pageSpot === void 0 ? null : _ref$pageSpot, _ref$pageNumber = _ref.pageNumber, - pageNumber = _ref$pageNumber === undefined ? null : _ref$pageNumber; - - throw new Error('Not implemented: _scrollIntoView'); - } - }, { - key: '_setScaleDispatchEvent', - value: function _setScaleDispatchEvent(newScale, newValue) { - var preset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - var arg = { - source: this, - scale: newScale, - presetValue: preset ? newValue : undefined - }; - this.eventBus.dispatch('scalechanging', arg); - this.eventBus.dispatch('scalechange', arg); + pageNumber = _ref$pageNumber === void 0 ? null : _ref$pageNumber; + (0, _ui_utils.scrollIntoView)(pageDiv, pageSpot); } }, { - key: '_setScaleUpdatePages', + key: "_setScaleUpdatePages", value: function _setScaleUpdatePages(newScale, newValue) { var noScroll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var preset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - this._currentScaleValue = newValue.toString(); + if (isSameScale(this._currentScale, newScale)) { if (preset) { - this._setScaleDispatchEvent(newScale, newValue, true); + this.eventBus.dispatch("scalechanging", { + source: this, + scale: newScale, + presetValue: newValue + }); } + return; } + for (var i = 0, ii = this._pages.length; i < ii; i++) { this._pages[i].update(newScale); } + this._currentScale = newScale; + if (!noScroll) { var page = this._currentPageNumber, - dest = void 0; + dest; + if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) { page = this._location.pageNumber; - dest = [null, { name: 'XYZ' }, this._location.left, this._location.top, null]; + dest = [null, { + name: "XYZ" + }, this._location.left, this._location.top, null]; } + this.scrollPageIntoView({ pageNumber: page, destArray: dest, allowNegativeOffset: true }); } - this._setScaleDispatchEvent(newScale, newValue, preset); + + this.eventBus.dispatch("scalechanging", { + source: this, + scale: newScale, + presetValue: preset ? newValue : undefined + }); + if (this.defaultRenderingQueue) { this.update(); } } }, { - key: '_setScale', + key: "_setScale", value: function _setScale(value) { var noScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var scale = parseFloat(value); + if (scale > 0) { this._setScaleUpdatePages(scale, value, noScroll, false); } else { var currentPage = this._pages[this._currentPageNumber - 1]; + if (!currentPage) { return; } + var noPadding = this.isInPresentationMode || this.removePageBorders; var hPadding = noPadding ? 0 : _ui_utils.SCROLLBAR_PADDING; var vPadding = noPadding ? 0 : _ui_utils.VERTICAL_PADDING; + if (!noPadding && this._isScrollModeHorizontal) { var _ref2 = [vPadding, hPadding]; hPadding = _ref2[0]; vPadding = _ref2[1]; } + var pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale; var pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale; + switch (value) { - case 'page-actual': + case "page-actual": scale = 1; break; - case 'page-width': + + case "page-width": scale = pageWidthScale; break; - case 'page-height': + + case "page-height": scale = pageHeightScale; break; - case 'page-fit': + + case "page-fit": scale = Math.min(pageWidthScale, pageHeightScale); break; - case 'auto': + + case "auto": var horizontalScale = (0, _ui_utils.isPortraitOrientation)(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale); scale = Math.min(_ui_utils.MAX_AUTO_SCALE, horizontalScale); break; + default: - console.error(this._name + '._setScale: "' + value + '" is an unknown zoom value.'); + console.error("".concat(this._name, "._setScale: \"").concat(value, "\" is an unknown zoom value.")); return; } + this._setScaleUpdatePages(scale, value, noScroll, true); } } }, { - key: '_resetCurrentPageView', + key: "_resetCurrentPageView", value: function _resetCurrentPageView() { if (this.isInPresentationMode) { this._setScale(this._currentScaleValue, true); } + var pageView = this._pages[this._currentPageNumber - 1]; - this._scrollIntoView({ pageDiv: pageView.div }); + + this._scrollIntoView({ + pageDiv: pageView.div + }); } }, { - key: 'scrollPageIntoView', - value: function scrollPageIntoView(params) { + key: "scrollPageIntoView", + value: function scrollPageIntoView(_ref3) { + var pageNumber = _ref3.pageNumber, + _ref3$destArray = _ref3.destArray, + destArray = _ref3$destArray === void 0 ? null : _ref3$destArray, + _ref3$allowNegativeOf = _ref3.allowNegativeOffset, + allowNegativeOffset = _ref3$allowNegativeOf === void 0 ? false : _ref3$allowNegativeOf, + _ref3$ignoreDestinati = _ref3.ignoreDestinationZoom, + ignoreDestinationZoom = _ref3$ignoreDestinati === void 0 ? false : _ref3$ignoreDestinati; + if (!this.pdfDocument) { return; } - var pageNumber = params.pageNumber || 0; - var dest = params.destArray || null; - var allowNegativeOffset = params.allowNegativeOffset || false; - if (this.isInPresentationMode || !dest) { - this._setCurrentPageNumber(pageNumber, true); + + var pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1]; + + if (!pageView) { + console.error("".concat(this._name, ".scrollPageIntoView: ") + "\"".concat(pageNumber, "\" is not a valid pageNumber parameter.")); return; } - var pageView = this._pages[pageNumber - 1]; - if (!pageView) { - console.error(this._name + '.scrollPageIntoView: Invalid "pageNumber" parameter.'); + + if (this.isInPresentationMode || !destArray) { + this._setCurrentPageNumber(pageNumber, true); + return; } + var x = 0, y = 0; var width = 0, height = 0, - widthScale = void 0, - heightScale = void 0; - var changeOrientation = pageView.rotation % 180 === 0 ? false : true; + widthScale, + heightScale; + var changeOrientation = pageView.rotation % 180 !== 0; var pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / _ui_utils.CSS_UNITS; var pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / _ui_utils.CSS_UNITS; var scale = 0; - switch (dest[1].name) { - case 'XYZ': - x = dest[2]; - y = dest[3]; - scale = dest[4]; + + switch (destArray[1].name) { + case "XYZ": + x = destArray[2]; + y = destArray[3]; + scale = destArray[4]; x = x !== null ? x : 0; y = y !== null ? y : pageHeight; break; - case 'Fit': - case 'FitB': - scale = 'page-fit'; + + case "Fit": + case "FitB": + scale = "page-fit"; break; - case 'FitH': - case 'FitBH': - y = dest[2]; - scale = 'page-width'; + + case "FitH": + case "FitBH": + y = destArray[2]; + scale = "page-width"; + if (y === null && this._location) { x = this._location.left; y = this._location.top; } + break; - case 'FitV': - case 'FitBV': - x = dest[2]; + + case "FitV": + case "FitBV": + x = destArray[2]; width = pageWidth; height = pageHeight; - scale = 'page-height'; + scale = "page-height"; break; - case 'FitR': - x = dest[2]; - y = dest[3]; - width = dest[4] - x; - height = dest[5] - y; + + case "FitR": + x = destArray[2]; + y = destArray[3]; + width = destArray[4] - x; + height = destArray[5] - y; var hPadding = this.removePageBorders ? 0 : _ui_utils.SCROLLBAR_PADDING; var vPadding = this.removePageBorders ? 0 : _ui_utils.VERTICAL_PADDING; widthScale = (this.container.clientWidth - hPadding) / width / _ui_utils.CSS_UNITS; heightScale = (this.container.clientHeight - vPadding) / height / _ui_utils.CSS_UNITS; scale = Math.min(Math.abs(widthScale), Math.abs(heightScale)); break; + default: - console.error(this._name + '.scrollPageIntoView: "' + dest[1].name + '" ' + 'is not a valid destination type.'); + console.error("".concat(this._name, ".scrollPageIntoView: ") + "\"".concat(destArray[1].name, "\" is not a valid destination type.")); return; } - if (scale && scale !== this._currentScale) { - this.currentScaleValue = scale; - } else if (this._currentScale === _ui_utils.UNKNOWN_SCALE) { - this.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE; + + if (!ignoreDestinationZoom) { + if (scale && scale !== this._currentScale) { + this.currentScaleValue = scale; + } else if (this._currentScale === _ui_utils.UNKNOWN_SCALE) { + this.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE; + } } - if (scale === 'page-fit' && !dest[4]) { + + if (scale === "page-fit" && !destArray[4]) { this._scrollIntoView({ pageDiv: pageView.div, pageNumber: pageNumber }); + return; } + var boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)]; var left = Math.min(boundingRect[0][0], boundingRect[1][0]); var top = Math.min(boundingRect[0][1], boundingRect[1][1]); + if (!allowNegativeOffset) { left = Math.max(left, 0); top = Math.max(top, 0); } + this._scrollIntoView({ pageDiv: pageView.div, pageSpot: { @@ -9235,26 +11473,20 @@ var BaseViewer = function () { }); } }, { - key: '_resizeBuffer', - value: function _resizeBuffer(numVisiblePages, visiblePages) { - var suggestedCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1); - this._buffer.resize(suggestedCacheSize, visiblePages); - } - }, { - key: '_updateLocation', + key: "_updateLocation", value: function _updateLocation(firstPage) { var currentScale = this._currentScale; var currentScaleValue = this._currentScaleValue; var normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue; var pageNumber = firstPage.id; - var pdfOpenParams = '#page=' + pageNumber; - pdfOpenParams += '&zoom=' + normalizedScaleValue; + var pdfOpenParams = "#page=" + pageNumber; + pdfOpenParams += "&zoom=" + normalizedScaleValue; var currentPageView = this._pages[pageNumber - 1]; var container = this.container; var topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y); var intLeft = Math.round(topLeft[0]); var intTop = Math.round(topLeft[1]); - pdfOpenParams += ',' + intLeft + ',' + intTop; + pdfOpenParams += "," + intLeft + "," + intTop; this._location = { pageNumber: pageNumber, scale: normalizedScaleValue, @@ -9265,27 +11497,93 @@ var BaseViewer = function () { }; } }, { - key: 'update', + key: "_updateHelper", + value: function _updateHelper(visiblePages) { + throw new Error("Not implemented: _updateHelper"); + } + }, { + key: "update", value: function update() { - throw new Error('Not implemented: update'); + var visible = this._getVisiblePages(); + + var visiblePages = visible.views, + numVisiblePages = visiblePages.length; + + if (numVisiblePages === 0) { + return; + } + + var newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1); + + this._buffer.resize(newCacheSize, visiblePages); + + this.renderingQueue.renderHighestPriority(visible); + + this._updateHelper(visiblePages); + + this._updateLocation(visible.first); + + this.eventBus.dispatch("updateviewarea", { + source: this, + location: this._location + }); } }, { - key: 'containsElement', + key: "containsElement", value: function containsElement(element) { return this.container.contains(element); } }, { - key: 'focus', + key: "focus", value: function focus() { this.container.focus(); } }, { - key: '_getVisiblePages', + key: "_getCurrentVisiblePage", + value: function _getCurrentVisiblePage() { + if (!this.pagesCount) { + return { + views: [] + }; + } + + var pageView = this._pages[this._currentPageNumber - 1]; + var element = pageView.div; + var view = { + id: pageView.id, + x: element.offsetLeft + element.clientLeft, + y: element.offsetTop + element.clientTop, + view: pageView + }; + return { + first: view, + last: view, + views: [view] + }; + } + }, { + key: "_getVisiblePages", value: function _getVisiblePages() { - throw new Error('Not implemented: _getVisiblePages'); + return (0, _ui_utils.getVisibleElements)(this.container, this._pages, true, this._isScrollModeHorizontal); + } + }, { + key: "isPageVisible", + value: function isPageVisible(pageNumber) { + if (!this.pdfDocument) { + return false; + } + + if (pageNumber < 1 || pageNumber > this.pagesCount) { + console.error("".concat(this._name, ".isPageVisible: \"").concat(pageNumber, "\" is out of bounds.")); + return false; + } + + return this._getVisiblePages().views.some(function (view) { + return view.id === pageNumber; + }); } }, { - key: 'cleanup', + key: "cleanup", value: function cleanup() { for (var i = 0, ii = this._pages.length; i < ii; i++) { if (this._pages[i] && this._pages[i].renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) { @@ -9294,7 +11592,7 @@ var BaseViewer = function () { } } }, { - key: '_cancelRendering', + key: "_cancelRendering", value: function _cancelRendering() { for (var i = 0, ii = this._pages.length; i < ii; i++) { if (this._pages[i]) { @@ -9303,54 +11601,64 @@ var BaseViewer = function () { } } }, { - key: '_ensurePdfPageLoaded', + key: "_ensurePdfPageLoaded", value: function _ensurePdfPageLoaded(pageView) { var _this3 = this; if (pageView.pdfPage) { return Promise.resolve(pageView.pdfPage); } - var pageNumber = pageView.id; - if (this._pagesRequests[pageNumber]) { - return this._pagesRequests[pageNumber]; + + if (this._pagesRequests.has(pageView)) { + return this._pagesRequests.get(pageView); } - var promise = this.pdfDocument.getPage(pageNumber).then(function (pdfPage) { + + var promise = this.pdfDocument.getPage(pageView.id).then(function (pdfPage) { if (!pageView.pdfPage) { pageView.setPdfPage(pdfPage); } - _this3._pagesRequests[pageNumber] = null; + + _this3._pagesRequests["delete"](pageView); + return pdfPage; - }).catch(function (reason) { - console.error('Unable to get page for page view', reason); - _this3._pagesRequests[pageNumber] = null; + })["catch"](function (reason) { + console.error("Unable to get page for page view", reason); + + _this3._pagesRequests["delete"](pageView); }); - this._pagesRequests[pageNumber] = promise; + + this._pagesRequests.set(pageView, promise); + return promise; } }, { - key: 'forceRendering', + key: "forceRendering", value: function forceRendering(currentlyVisiblePages) { var _this4 = this; var visiblePages = currentlyVisiblePages || this._getVisiblePages(); + var scrollAhead = this._isScrollModeHorizontal ? this.scroll.right : this.scroll.down; var pageView = this.renderingQueue.getHighestPriority(visiblePages, this._pages, scrollAhead); + if (pageView) { this._ensurePdfPageLoaded(pageView).then(function () { _this4.renderingQueue.renderView(pageView); }); + return true; } + return false; } }, { - key: 'createTextLayerBuilder', + key: "createTextLayerBuilder", value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) { var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - + var eventBus = arguments.length > 4 ? arguments[4] : undefined; return new _text_layer_builder.TextLayerBuilder({ textLayerDiv: textLayerDiv, - eventBus: this.eventBus, + eventBus: eventBus, pageIndex: pageIndex, viewport: viewport, findController: this.isInPresentationMode ? null : this.findController, @@ -9358,12 +11666,11 @@ var BaseViewer = function () { }); } }, { - key: 'createAnnotationLayerBuilder', + key: "createAnnotationLayerBuilder", value: function createAnnotationLayerBuilder(pageDiv, pdfPage) { - var imageResourcesPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; + var imageResourcesPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ""; var renderInteractiveForms = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; var l10n = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _ui_utils.NullL10n; - return new _annotation_layer_builder.AnnotationLayerBuilder({ pageDiv: pageDiv, pdfPage: pdfPage, @@ -9375,24 +11682,29 @@ var BaseViewer = function () { }); } }, { - key: 'getPagesOverview', + key: "getPagesOverview", value: function getPagesOverview() { var pagesOverview = this._pages.map(function (pageView) { - var viewport = pageView.pdfPage.getViewport(1); + var viewport = pageView.pdfPage.getViewport({ + scale: 1 + }); return { width: viewport.width, height: viewport.height, rotation: viewport.rotation }; }); + if (!this.enablePrintAutoRotate) { return pagesOverview; } + var isFirstPagePortrait = (0, _ui_utils.isPortraitOrientation)(pagesOverview[0]); return pagesOverview.map(function (size) { if (isFirstPagePortrait === (0, _ui_utils.isPortraitOrientation)(size)) { return size; } + return { width: size.height, height: size.width, @@ -9401,114 +11713,145 @@ var BaseViewer = function () { }); } }, { - key: '_updateScrollMode', + key: "_updateScrollMode", value: function _updateScrollMode() { var pageNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var scrollMode = this._scrollMode, viewer = this.viewer; - viewer.classList.toggle('scrollHorizontal', scrollMode === ScrollMode.HORIZONTAL); - viewer.classList.toggle('scrollWrapped', scrollMode === ScrollMode.WRAPPED); + viewer.classList.toggle("scrollHorizontal", scrollMode === _ui_utils.ScrollMode.HORIZONTAL); + viewer.classList.toggle("scrollWrapped", scrollMode === _ui_utils.ScrollMode.WRAPPED); + if (!this.pdfDocument || !pageNumber) { return; } + if (this._currentScaleValue && isNaN(this._currentScaleValue)) { this._setScale(this._currentScaleValue, true); } - this.scrollPageIntoView({ pageNumber: pageNumber }); + + this._setCurrentPageNumber(pageNumber, true); + this.update(); } }, { - key: '_updateSpreadMode', + key: "_updateSpreadMode", value: function _updateSpreadMode() { var pageNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; if (!this.pdfDocument) { return; } + var viewer = this.viewer, pages = this._pages; - viewer.textContent = ''; - if (this._spreadMode === SpreadMode.NONE) { + viewer.textContent = ""; + + if (this._spreadMode === _ui_utils.SpreadMode.NONE) { for (var i = 0, iMax = pages.length; i < iMax; ++i) { viewer.appendChild(pages[i].div); } } else { var parity = this._spreadMode - 1; var spread = null; + for (var _i = 0, _iMax = pages.length; _i < _iMax; ++_i) { if (spread === null) { - spread = document.createElement('div'); - spread.className = 'spread'; + 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); } } + if (!pageNumber) { return; } - this.scrollPageIntoView({ pageNumber: pageNumber }); + + this._setCurrentPageNumber(pageNumber, true); + this.update(); } }, { - key: 'pagesCount', + key: "pagesCount", get: function get() { return this._pages.length; } }, { - key: 'pageViewsReady', + key: "pageViewsReady", get: function get() { - return this._pageViewsReady; + if (!this._pagesCapability.settled) { + return false; + } + + return this._pages.every(function (pageView) { + return pageView && pageView.pdfPage; + }); } }, { - key: 'currentPageNumber', + key: "currentPageNumber", get: function get() { return this._currentPageNumber; }, set: function set(val) { if (!Number.isInteger(val)) { - throw new Error('Invalid page number.'); + throw new Error("Invalid page number."); } + if (!this.pdfDocument) { return; } - this._setCurrentPageNumber(val, true); + + if (!this._setCurrentPageNumber(val, true)) { + console.error("".concat(this._name, ".currentPageNumber: \"").concat(val, "\" is not a valid page.")); + } } }, { - key: 'currentPageLabel', + key: "currentPageLabel", get: function get() { return this._pageLabels && this._pageLabels[this._currentPageNumber - 1]; }, set: function set(val) { - var pageNumber = val | 0; + if (!this.pdfDocument) { + return; + } + + var page = val | 0; + if (this._pageLabels) { var i = this._pageLabels.indexOf(val); + if (i >= 0) { - pageNumber = i + 1; + page = i + 1; } } - this.currentPageNumber = pageNumber; + + if (!this._setCurrentPageNumber(page, true)) { + console.error("".concat(this._name, ".currentPageLabel: \"").concat(val, "\" is not a valid page.")); + } } }, { - key: 'currentScale', + key: "currentScale", get: function get() { return this._currentScale !== _ui_utils.UNKNOWN_SCALE ? this._currentScale : _ui_utils.DEFAULT_SCALE; }, set: function set(val) { if (isNaN(val)) { - throw new Error('Invalid numeric scale'); + throw new Error("Invalid numeric scale."); } + if (!this.pdfDocument) { return; } + this._setScale(val, false); } }, { - key: 'currentScaleValue', + key: "currentScaleValue", get: function get() { return this._currentScaleValue; }, @@ -9516,85 +11859,111 @@ var BaseViewer = function () { if (!this.pdfDocument) { return; } + this._setScale(val, false); } }, { - key: 'pagesRotation', + key: "pagesRotation", get: function get() { return this._pagesRotation; }, set: function set(rotation) { if (!(0, _ui_utils.isValidRotation)(rotation)) { - throw new Error('Invalid pages rotation angle.'); + throw new Error("Invalid pages rotation angle."); } + if (!this.pdfDocument) { return; } + if (this._pagesRotation === rotation) { return; } + this._pagesRotation = rotation; var pageNumber = this._currentPageNumber; + for (var i = 0, ii = this._pages.length; i < ii; i++) { var pageView = this._pages[i]; pageView.update(pageView.scale, rotation); } + if (this._currentScaleValue) { this._setScale(this._currentScaleValue, true); } - this.eventBus.dispatch('rotationchanging', { + + this.eventBus.dispatch("rotationchanging", { source: this, pagesRotation: rotation, pageNumber: pageNumber }); + if (this.defaultRenderingQueue) { this.update(); } } }, { - key: '_setDocumentViewerElement', + key: "firstPagePromise", + get: function get() { + return this.pdfDocument ? this._firstPageCapability.promise : null; + } + }, { + key: "onePageRendered", get: function get() { - throw new Error('Not implemented: _setDocumentViewerElement'); + return this.pdfDocument ? this._onePageRenderedCapability.promise : null; } }, { - key: '_isScrollModeHorizontal', + key: "pagesPromise", get: function get() { - throw new Error('Not implemented: _isScrollModeHorizontal'); + return this.pdfDocument ? this._pagesCapability.promise : null; } }, { - key: 'isInPresentationMode', + key: "_viewerElement", + get: function get() { + throw new Error("Not implemented: _viewerElement"); + } + }, { + key: "_isScrollModeHorizontal", + get: function get() { + return this.isInPresentationMode ? false : this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL; + } + }, { + key: "isInPresentationMode", get: function get() { return this.presentationModeState === _ui_utils.PresentationModeState.FULLSCREEN; } }, { - key: 'isChangingPresentationMode', + key: "isChangingPresentationMode", get: function get() { return this.presentationModeState === _ui_utils.PresentationModeState.CHANGING; } }, { - key: 'isHorizontalScrollbarEnabled', + key: "isHorizontalScrollbarEnabled", get: function get() { return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth; } }, { - key: 'isVerticalScrollbarEnabled', + key: "isVerticalScrollbarEnabled", get: function get() { return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight; } }, { - key: 'hasEqualPageSizes', + key: "hasEqualPageSizes", get: function get() { var firstPageView = this._pages[0]; + for (var i = 1, ii = this._pages.length; i < ii; ++i) { var pageView = this._pages[i]; + if (pageView.width !== firstPageView.width || pageView.height !== firstPageView.height) { return false; } } + return true; } }, { - key: 'scrollMode', + key: "scrollMode", get: function get() { return this._scrollMode; }, @@ -9602,18 +11971,21 @@ var BaseViewer = function () { if (this._scrollMode === mode) { return; } - if (!Number.isInteger(mode) || !Object.values(ScrollMode).includes(mode)) { - throw new Error('Invalid scroll mode: ' + mode); + + if (!(0, _ui_utils.isValidScrollMode)(mode)) { + throw new Error("Invalid scroll mode: ".concat(mode)); } + this._scrollMode = mode; - this.eventBus.dispatch('scrollmodechanged', { + this.eventBus.dispatch("scrollmodechanged", { source: this, mode: mode }); + this._updateScrollMode(this._currentPageNumber); } }, { - key: 'spreadMode', + key: "spreadMode", get: function get() { return this._spreadMode; }, @@ -9621,14 +11993,17 @@ var BaseViewer = function () { if (this._spreadMode === mode) { return; } - if (!Number.isInteger(mode) || !Object.values(SpreadMode).includes(mode)) { - throw new Error('Invalid spread mode: ' + mode); + + if (!(0, _ui_utils.isValidSpreadMode)(mode)) { + throw new Error("Invalid spread mode: ".concat(mode)); } + this._spreadMode = mode; - this.eventBus.dispatch('spreadmodechanged', { + this.eventBus.dispatch("spreadmodechanged", { source: this, mode: mode }); + this._updateSpreadMode(this._currentPageNumber); } }]); @@ -9637,11 +12012,9 @@ var BaseViewer = function () { }(); exports.BaseViewer = BaseViewer; -exports.ScrollMode = ScrollMode; -exports.SpreadMode = SpreadMode; /***/ }), -/* 31 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9650,30 +12023,32 @@ exports.SpreadMode = SpreadMode; Object.defineProperty(exports, "__esModule", { value: true }); -exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = void 0; -var _pdfjsLib = __webpack_require__(7); +var _pdfjsLib = __webpack_require__(8); -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); -var _pdf_link_service = __webpack_require__(23); +var _pdf_link_service = __webpack_require__(21); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var AnnotationLayerBuilder = function () { +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var AnnotationLayerBuilder = /*#__PURE__*/function () { function AnnotationLayerBuilder(_ref) { var pageDiv = _ref.pageDiv, pdfPage = _ref.pdfPage, linkService = _ref.linkService, downloadManager = _ref.downloadManager, _ref$imageResourcesPa = _ref.imageResourcesPath, - imageResourcesPath = _ref$imageResourcesPa === undefined ? '' : _ref$imageResourcesPa, + imageResourcesPath = _ref$imageResourcesPa === void 0 ? "" : _ref$imageResourcesPa, _ref$renderInteractiv = _ref.renderInteractiveForms, - renderInteractiveForms = _ref$renderInteractiv === undefined ? false : _ref$renderInteractiv, + renderInteractiveForms = _ref$renderInteractiv === void 0 ? false : _ref$renderInteractiv, _ref$l10n = _ref.l10n, - l10n = _ref$l10n === undefined ? _ui_utils.NullL10n : _ref$l10n; + l10n = _ref$l10n === void 0 ? _ui_utils.NullL10n : _ref$l10n; _classCallCheck(this, AnnotationLayerBuilder); @@ -9689,18 +12064,22 @@ var AnnotationLayerBuilder = function () { } _createClass(AnnotationLayerBuilder, [{ - key: 'render', + key: "render", value: function render(viewport) { var _this = this; - var intent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'display'; - - this.pdfPage.getAnnotations({ intent: intent }).then(function (annotations) { + var intent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "display"; + this.pdfPage.getAnnotations({ + intent: intent + }).then(function (annotations) { if (_this._cancelled) { return; } + var parameters = { - viewport: viewport.clone({ dontFlip: true }), + viewport: viewport.clone({ + dontFlip: true + }), div: _this.div, annotations: annotations, page: _this.pdfPage, @@ -9709,51 +12088,59 @@ var AnnotationLayerBuilder = function () { linkService: _this.linkService, downloadManager: _this.downloadManager }; + if (_this.div) { _pdfjsLib.AnnotationLayer.update(parameters); } else { if (annotations.length === 0) { return; } - _this.div = document.createElement('div'); - _this.div.className = 'annotationLayer'; + + _this.div = document.createElement("div"); + _this.div.className = "annotationLayer"; + _this.pageDiv.appendChild(_this.div); + parameters.div = _this.div; + _pdfjsLib.AnnotationLayer.render(parameters); + _this.l10n.translate(_this.div); } }); } }, { - key: 'cancel', + key: "cancel", value: function cancel() { this._cancelled = true; } }, { - key: 'hide', + key: "hide", value: function hide() { if (!this.div) { return; } - this.div.setAttribute('hidden', 'true'); + + this.div.setAttribute("hidden", "true"); } }]); return AnnotationLayerBuilder; }(); -var DefaultAnnotationLayerFactory = function () { +exports.AnnotationLayerBuilder = AnnotationLayerBuilder; + +var DefaultAnnotationLayerFactory = /*#__PURE__*/function () { function DefaultAnnotationLayerFactory() { _classCallCheck(this, DefaultAnnotationLayerFactory); } _createClass(DefaultAnnotationLayerFactory, [{ - key: 'createAnnotationLayerBuilder', + key: "createAnnotationLayerBuilder", value: function createAnnotationLayerBuilder(pageDiv, pdfPage) { - var imageResourcesPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; + var imageResourcesPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ""; var renderInteractiveForms = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; var l10n = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _ui_utils.NullL10n; - return new AnnotationLayerBuilder({ pageDiv: pageDiv, pdfPage: pdfPage, @@ -9768,11 +12155,10 @@ var DefaultAnnotationLayerFactory = function () { return DefaultAnnotationLayerFactory; }(); -exports.AnnotationLayerBuilder = AnnotationLayerBuilder; exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory; /***/ }), -/* 32 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9781,32 +12167,40 @@ exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFPageView = undefined; +exports.PDFPageView = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _ui_utils = __webpack_require__(5); -var _ui_utils = __webpack_require__(6); +var _pdfjsLib = __webpack_require__(8); -var _pdfjsLib = __webpack_require__(7); +var _pdf_rendering_queue = __webpack_require__(11); -var _dom_events = __webpack_require__(14); +var _viewer_compatibility = __webpack_require__(7); -var _pdf_rendering_queue = __webpack_require__(10); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _viewer_compatibility = __webpack_require__(13); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var MAX_CANVAS_PIXELS = _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels || 16777216; -var PDFPageView = function () { +var PDFPageView = /*#__PURE__*/function () { function PDFPageView(options) { _classCallCheck(this, PDFPageView); var container = options.container; var defaultViewport = options.defaultViewport; this.id = options.id; - this.renderingId = 'page' + this.id; + this.renderingId = "page" + this.id; this.pdfPage = null; this.pageLabel = null; this.rotation = 0; @@ -9815,11 +12209,11 @@ var PDFPageView = function () { this.pdfPageRotate = defaultViewport.rotation; this.hasRestrictedScaling = false; this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE; - this.imageResourcesPath = options.imageResourcesPath || ''; + this.imageResourcesPath = options.imageResourcesPath || ""; this.renderInteractiveForms = options.renderInteractiveForms || false; this.useOnlyCssZoom = options.useOnlyCssZoom || false; this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS; - this.eventBus = options.eventBus || (0, _dom_events.getGlobalEventBus)(); + this.eventBus = options.eventBus; this.renderingQueue = options.renderingQueue; this.textLayerFactory = options.textLayerFactory; this.annotationLayerFactory = options.annotationLayerFactory; @@ -9831,327 +12225,408 @@ var PDFPageView = function () { this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; this.resume = null; this.error = null; - this.onBeforeDraw = null; - this.onAfterDraw = null; this.annotationLayer = null; this.textLayer = null; this.zoomLayer = null; - var div = document.createElement('div'); - div.className = 'page'; - div.style.width = Math.floor(this.viewport.width) + 'px'; - div.style.height = Math.floor(this.viewport.height) + 'px'; - div.setAttribute('data-page-number', this.id); + var div = document.createElement("div"); + div.className = "page"; + div.style.width = Math.floor(this.viewport.width) + "px"; + div.style.height = Math.floor(this.viewport.height) + "px"; + div.setAttribute("data-page-number", this.id); this.div = div; container.appendChild(div); } _createClass(PDFPageView, [{ - key: 'setPdfPage', + key: "setPdfPage", value: function setPdfPage(pdfPage) { this.pdfPage = pdfPage; this.pdfPageRotate = pdfPage.rotate; var totalRotation = (this.rotation + this.pdfPageRotate) % 360; - this.viewport = pdfPage.getViewport(this.scale * _ui_utils.CSS_UNITS, totalRotation); + this.viewport = pdfPage.getViewport({ + scale: this.scale * _ui_utils.CSS_UNITS, + rotation: totalRotation + }); this.stats = pdfPage.stats; this.reset(); } }, { - key: 'destroy', + key: "destroy", value: function destroy() { this.reset(); + if (this.pdfPage) { this.pdfPage.cleanup(); } } }, { - key: '_resetZoomLayer', + key: "_resetZoomLayer", value: function _resetZoomLayer() { var removeFromDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!this.zoomLayer) { return; } + var zoomLayerCanvas = this.zoomLayer.firstChild; - this.paintedViewportMap.delete(zoomLayerCanvas); + this.paintedViewportMap["delete"](zoomLayerCanvas); zoomLayerCanvas.width = 0; zoomLayerCanvas.height = 0; + if (removeFromDOM) { this.zoomLayer.remove(); } + this.zoomLayer = null; } }, { - key: 'reset', + key: "reset", value: function reset() { var keepZoomLayer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var keepAnnotations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - this.cancelRendering(keepAnnotations); + this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; var div = this.div; - div.style.width = Math.floor(this.viewport.width) + 'px'; - div.style.height = Math.floor(this.viewport.height) + 'px'; + div.style.width = Math.floor(this.viewport.width) + "px"; + div.style.height = Math.floor(this.viewport.height) + "px"; var childNodes = div.childNodes; var currentZoomLayerNode = keepZoomLayer && this.zoomLayer || null; var currentAnnotationNode = keepAnnotations && this.annotationLayer && this.annotationLayer.div || null; + for (var i = childNodes.length - 1; i >= 0; i--) { var node = childNodes[i]; + if (currentZoomLayerNode === node || currentAnnotationNode === node) { continue; } + div.removeChild(node); } - div.removeAttribute('data-loaded'); + + div.removeAttribute("data-loaded"); + if (currentAnnotationNode) { this.annotationLayer.hide(); } else if (this.annotationLayer) { this.annotationLayer.cancel(); this.annotationLayer = null; } + if (!currentZoomLayerNode) { if (this.canvas) { - this.paintedViewportMap.delete(this.canvas); + this.paintedViewportMap["delete"](this.canvas); this.canvas.width = 0; this.canvas.height = 0; delete this.canvas; } + this._resetZoomLayer(); } + if (this.svg) { - this.paintedViewportMap.delete(this.svg); + this.paintedViewportMap["delete"](this.svg); delete this.svg; } - this.loadingIconDiv = document.createElement('div'); - this.loadingIconDiv.className = 'loadingIcon'; + + this.loadingIconDiv = document.createElement("div"); + this.loadingIconDiv.className = "loadingIcon"; div.appendChild(this.loadingIconDiv); } }, { - key: 'update', + key: "update", value: function update(scale, rotation) { this.scale = scale || this.scale; - if (typeof rotation !== 'undefined') { + + if (typeof rotation !== "undefined") { this.rotation = rotation; } + var totalRotation = (this.rotation + this.pdfPageRotate) % 360; this.viewport = this.viewport.clone({ scale: this.scale * _ui_utils.CSS_UNITS, rotation: totalRotation }); + if (this.svg) { this.cssTransform(this.svg, true); - this.eventBus.dispatch('pagerendered', { + this.eventBus.dispatch("pagerendered", { source: this, pageNumber: this.id, - cssTransform: true + cssTransform: true, + timestamp: performance.now() }); return; } + var isScalingRestricted = false; + if (this.canvas && this.maxCanvasPixels > 0) { var outputScale = this.outputScale; + if ((Math.floor(this.viewport.width) * outputScale.sx | 0) * (Math.floor(this.viewport.height) * outputScale.sy | 0) > this.maxCanvasPixels) { isScalingRestricted = true; } } + if (this.canvas) { if (this.useOnlyCssZoom || this.hasRestrictedScaling && isScalingRestricted) { this.cssTransform(this.canvas, true); - this.eventBus.dispatch('pagerendered', { + this.eventBus.dispatch("pagerendered", { source: this, pageNumber: this.id, - cssTransform: true + cssTransform: true, + timestamp: performance.now() }); return; } - if (!this.zoomLayer && !this.canvas.hasAttribute('hidden')) { + + if (!this.zoomLayer && !this.canvas.hasAttribute("hidden")) { this.zoomLayer = this.canvas.parentNode; - this.zoomLayer.style.position = 'absolute'; + this.zoomLayer.style.position = "absolute"; } } + if (this.zoomLayer) { this.cssTransform(this.zoomLayer.firstChild); } + this.reset(true, true); } }, { - key: 'cancelRendering', + key: "cancelRendering", value: function cancelRendering() { var keepAnnotations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - var renderingState = this.renderingState; if (this.paintTask) { this.paintTask.cancel(); this.paintTask = null; } - this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; + this.resume = null; + if (this.textLayer) { this.textLayer.cancel(); this.textLayer = null; } + if (!keepAnnotations && this.annotationLayer) { this.annotationLayer.cancel(); this.annotationLayer = null; } - if (renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) { - this.eventBus.dispatch('pagecancelled', { - source: this, - pageNumber: this.id, - renderingState: renderingState - }); - } } }, { - key: 'cssTransform', + key: "cssTransform", value: function cssTransform(target) { var redrawAnnotations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var width = this.viewport.width; var height = this.viewport.height; var div = this.div; - target.style.width = target.parentNode.style.width = div.style.width = Math.floor(width) + 'px'; - target.style.height = target.parentNode.style.height = div.style.height = Math.floor(height) + 'px'; + target.style.width = target.parentNode.style.width = div.style.width = Math.floor(width) + "px"; + target.style.height = target.parentNode.style.height = div.style.height = Math.floor(height) + "px"; var relativeRotation = this.viewport.rotation - this.paintedViewportMap.get(target).rotation; var absRotation = Math.abs(relativeRotation); var scaleX = 1, scaleY = 1; + if (absRotation === 90 || absRotation === 270) { scaleX = height / width; scaleY = width / height; } - var cssTransform = 'rotate(' + relativeRotation + 'deg) ' + 'scale(' + scaleX + ',' + scaleY + ')'; + + var cssTransform = "rotate(" + relativeRotation + "deg) " + "scale(" + scaleX + "," + scaleY + ")"; target.style.transform = cssTransform; + if (this.textLayer) { var textLayerViewport = this.textLayer.viewport; var textRelativeRotation = this.viewport.rotation - textLayerViewport.rotation; var textAbsRotation = Math.abs(textRelativeRotation); var scale = width / textLayerViewport.width; + if (textAbsRotation === 90 || textAbsRotation === 270) { scale = width / textLayerViewport.height; } + var textLayerDiv = this.textLayer.textLayerDiv; - var transX = void 0, - transY = void 0; + var transX, transY; + switch (textAbsRotation) { case 0: transX = transY = 0; break; + case 90: transX = 0; - transY = '-' + textLayerDiv.style.height; + transY = "-" + textLayerDiv.style.height; break; + case 180: - transX = '-' + textLayerDiv.style.width; - transY = '-' + textLayerDiv.style.height; + transX = "-" + textLayerDiv.style.width; + transY = "-" + textLayerDiv.style.height; break; + case 270: - transX = '-' + textLayerDiv.style.width; + transX = "-" + textLayerDiv.style.width; transY = 0; break; + default: - console.error('Bad rotation value.'); + console.error("Bad rotation value."); break; } - textLayerDiv.style.transform = 'rotate(' + textAbsRotation + 'deg) ' + 'scale(' + scale + ', ' + scale + ') ' + 'translate(' + transX + ', ' + transY + ')'; - textLayerDiv.style.transformOrigin = '0% 0%'; + + textLayerDiv.style.transform = "rotate(" + textAbsRotation + "deg) " + "scale(" + scale + ", " + scale + ") " + "translate(" + transX + ", " + transY + ")"; + textLayerDiv.style.transformOrigin = "0% 0%"; } + if (redrawAnnotations && this.annotationLayer) { - this.annotationLayer.render(this.viewport, 'display'); + this.annotationLayer.render(this.viewport, "display"); } } }, { - key: 'getPagePoint', + key: "getPagePoint", value: function getPagePoint(x, y) { return this.viewport.convertToPdfPoint(x, y); } }, { - key: 'draw', + key: "draw", value: function draw() { var _this = this; if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) { - console.error('Must be in new state before drawing'); + console.error("Must be in new state before drawing"); this.reset(); } - if (!this.pdfPage) { + + var div = this.div, + pdfPage = this.pdfPage; + + if (!pdfPage) { this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; - return Promise.reject(new Error('Page is not loaded')); + + if (this.loadingIconDiv) { + div.removeChild(this.loadingIconDiv); + delete this.loadingIconDiv; + } + + return Promise.reject(new Error("pdfPage is not loaded")); } + this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING; - var pdfPage = this.pdfPage; - var div = this.div; - var canvasWrapper = document.createElement('div'); + var canvasWrapper = document.createElement("div"); canvasWrapper.style.width = div.style.width; canvasWrapper.style.height = div.style.height; - canvasWrapper.classList.add('canvasWrapper'); + canvasWrapper.classList.add("canvasWrapper"); + if (this.annotationLayer && this.annotationLayer.div) { div.insertBefore(canvasWrapper, this.annotationLayer.div); } else { div.appendChild(canvasWrapper); } + var textLayer = null; + if (this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && this.textLayerFactory) { - var textLayerDiv = document.createElement('div'); - textLayerDiv.className = 'textLayer'; + var textLayerDiv = document.createElement("div"); + textLayerDiv.className = "textLayer"; textLayerDiv.style.width = canvasWrapper.style.width; textLayerDiv.style.height = canvasWrapper.style.height; + if (this.annotationLayer && this.annotationLayer.div) { div.insertBefore(textLayerDiv, this.annotationLayer.div); } else { div.appendChild(textLayerDiv); } - textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.textLayerMode === _ui_utils.TextLayerMode.ENABLE_ENHANCE); + + textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.textLayerMode === _ui_utils.TextLayerMode.ENABLE_ENHANCE, this.eventBus); } + this.textLayer = textLayer; var renderContinueCallback = null; + if (this.renderingQueue) { renderContinueCallback = function renderContinueCallback(cont) { if (!_this.renderingQueue.isHighestPriority(_this)) { _this.renderingState = _pdf_rendering_queue.RenderingStates.PAUSED; + _this.resume = function () { _this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING; cont(); }; + return; } + cont(); }; } - var finishPaintTask = function finishPaintTask(error) { - if (paintTask === _this.paintTask) { - _this.paintTask = null; - } - if (error instanceof _pdfjsLib.RenderingCancelledException) { - _this.error = null; - return Promise.resolve(undefined); - } - _this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; - if (_this.loadingIconDiv) { - div.removeChild(_this.loadingIconDiv); - delete _this.loadingIconDiv; - } - _this._resetZoomLayer(true); - _this.error = error; - _this.stats = pdfPage.stats; - if (_this.onAfterDraw) { - _this.onAfterDraw(); - } - _this.eventBus.dispatch('pagerendered', { - source: _this, - pageNumber: _this.id, - cssTransform: false - }); - if (error) { - return Promise.reject(error); - } - return Promise.resolve(undefined); - }; + + var finishPaintTask = /*#__PURE__*/function () { + var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(error) { + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (paintTask === _this.paintTask) { + _this.paintTask = null; + } + + if (!(error instanceof _pdfjsLib.RenderingCancelledException)) { + _context.next = 4; + break; + } + + _this.error = null; + return _context.abrupt("return"); + + case 4: + _this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; + + if (_this.loadingIconDiv) { + div.removeChild(_this.loadingIconDiv); + delete _this.loadingIconDiv; + } + + _this._resetZoomLayer(true); + + _this.error = error; + _this.stats = pdfPage.stats; + + _this.eventBus.dispatch("pagerendered", { + source: _this, + pageNumber: _this.id, + cssTransform: false, + timestamp: performance.now() + }); + + if (!error) { + _context.next = 12; + break; + } + + throw error; + + case 12: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + + return function finishPaintTask(_x) { + return _ref.apply(this, arguments); + }; + }(); + var paintTask = this.renderer === _ui_utils.RendererType.SVG ? this.paintOnSvg(canvasWrapper) : this.paintOnCanvas(canvasWrapper); paintTask.onRenderContinue = renderContinueCallback; this.paintTask = paintTask; var resultPromise = paintTask.promise.then(function () { return finishPaintTask(null).then(function () { if (textLayer) { - var readableStream = pdfPage.streamTextContent({ normalizeWhitespace: true }); + var readableStream = pdfPage.streamTextContent({ + normalizeWhitespace: true + }); textLayer.setTextContentStream(readableStream); textLayer.render(); } @@ -10159,20 +12634,24 @@ var PDFPageView = function () { }, function (reason) { return finishPaintTask(reason); }); + if (this.annotationLayerFactory) { if (!this.annotationLayer) { this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, this.imageResourcesPath, this.renderInteractiveForms, this.l10n); } - this.annotationLayer.render(this.viewport, 'display'); - } - div.setAttribute('data-loaded', true); - if (this.onBeforeDraw) { - this.onBeforeDraw(); + + this.annotationLayer.render(this.viewport, "display"); } + + div.setAttribute("data-loaded", true); + this.eventBus.dispatch("pagerender", { + source: this, + pageNumber: this.id + }); return resultPromise; } }, { - key: 'paintOnCanvas', + key: "paintOnCanvas", value: function paintOnCanvas(canvasWrapper) { var renderCapability = (0, _pdfjsLib.createPromiseCapability)(); var result = { @@ -10185,31 +12664,44 @@ var PDFPageView = function () { } }; var viewport = this.viewport; - var canvas = document.createElement('canvas'); - canvas.id = this.renderingId; - canvas.setAttribute('hidden', 'hidden'); + var canvas = document.createElement("canvas"); + this.l10n.get("page_canvas", { + page: this.id + }, "Page {{page}}").then(function (msg) { + canvas.setAttribute("aria-label", msg); + }); + canvas.setAttribute("hidden", "hidden"); var isCanvasHidden = true; + var showCanvas = function showCanvas() { if (isCanvasHidden) { - canvas.removeAttribute('hidden'); + canvas.removeAttribute("hidden"); isCanvasHidden = false; } }; + canvasWrapper.appendChild(canvas); this.canvas = canvas; canvas.mozOpaque = true; - var ctx = canvas.getContext('2d', { alpha: false }); + var ctx = canvas.getContext("2d", { + alpha: false + }); var outputScale = (0, _ui_utils.getOutputScale)(ctx); this.outputScale = outputScale; + if (this.useOnlyCssZoom) { - var actualSizeViewport = viewport.clone({ scale: _ui_utils.CSS_UNITS }); + var actualSizeViewport = viewport.clone({ + scale: _ui_utils.CSS_UNITS + }); outputScale.sx *= actualSizeViewport.width / viewport.width; outputScale.sy *= actualSizeViewport.height / viewport.height; outputScale.scaled = true; } + if (this.maxCanvasPixels > 0) { var pixelsInViewport = viewport.width * viewport.height; var maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport); + if (outputScale.sx > maxScale || outputScale.sy > maxScale) { outputScale.sx = maxScale; outputScale.sy = maxScale; @@ -10219,12 +12711,13 @@ var PDFPageView = function () { this.hasRestrictedScaling = false; } } + var sfx = (0, _ui_utils.approximateFraction)(outputScale.sx); var sfy = (0, _ui_utils.approximateFraction)(outputScale.sy); canvas.width = (0, _ui_utils.roundToDivide)(viewport.width * outputScale.sx, sfx[0]); canvas.height = (0, _ui_utils.roundToDivide)(viewport.height * outputScale.sy, sfy[0]); - canvas.style.width = (0, _ui_utils.roundToDivide)(viewport.width, sfx[1]) + 'px'; - canvas.style.height = (0, _ui_utils.roundToDivide)(viewport.height, sfy[1]) + 'px'; + canvas.style.width = (0, _ui_utils.roundToDivide)(viewport.width, sfx[1]) + "px"; + canvas.style.height = (0, _ui_utils.roundToDivide)(viewport.height, sfy[1]) + "px"; this.paintedViewportMap.set(canvas, viewport); var transform = !outputScale.scaled ? null : [outputScale.sx, 0, 0, outputScale.sy, 0, 0]; var renderContext = { @@ -10235,14 +12728,17 @@ var PDFPageView = function () { renderInteractiveForms: this.renderInteractiveForms }; var renderTask = this.pdfPage.render(renderContext); + renderTask.onContinue = function (cont) { showCanvas(); + if (result.onRenderContinue) { result.onRenderContinue(cont); } else { cont(); } }; + renderTask.promise.then(function () { showCanvas(); renderCapability.resolve(undefined); @@ -10253,25 +12749,31 @@ var PDFPageView = function () { return result; } }, { - key: 'paintOnSvg', + key: "paintOnSvg", value: function paintOnSvg(wrapper) { var _this2 = this; var cancelled = false; + var ensureNotCancelled = function ensureNotCancelled() { if (cancelled) { - throw new _pdfjsLib.RenderingCancelledException('Rendering cancelled, page ' + _this2.id, 'svg'); + throw new _pdfjsLib.RenderingCancelledException("Rendering cancelled, page ".concat(_this2.id), "svg"); } }; + var pdfPage = this.pdfPage; - var actualSizeViewport = this.viewport.clone({ scale: _ui_utils.CSS_UNITS }); + var actualSizeViewport = this.viewport.clone({ + scale: _ui_utils.CSS_UNITS + }); var promise = pdfPage.getOperatorList().then(function (opList) { ensureNotCancelled(); var svgGfx = new _pdfjsLib.SVGGraphics(pdfPage.commonObjs, pdfPage.objs); return svgGfx.getSVG(opList, actualSizeViewport).then(function (svg) { ensureNotCancelled(); _this2.svg = svg; + _this2.paintedViewportMap.set(svg, actualSizeViewport); + svg.style.width = wrapper.style.width; svg.style.height = wrapper.style.height; _this2.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; @@ -10289,22 +12791,23 @@ var PDFPageView = function () { }; } }, { - key: 'setPageLabel', + key: "setPageLabel", value: function setPageLabel(label) { - this.pageLabel = typeof label === 'string' ? label : null; + this.pageLabel = typeof label === "string" ? label : null; + if (this.pageLabel !== null) { - this.div.setAttribute('data-page-label', this.pageLabel); + this.div.setAttribute("data-page-label", this.pageLabel); } else { - this.div.removeAttribute('data-page-label'); + this.div.removeAttribute("data-page-label"); } } }, { - key: 'width', + key: "width", get: function get() { return this.viewport.width; } }, { - key: 'height', + key: "height", get: function get() { return this.viewport.height; } @@ -10316,7 +12819,7 @@ var PDFPageView = function () { exports.PDFPageView = PDFPageView; /***/ }), -/* 33 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10325,37 +12828,33 @@ exports.PDFPageView = PDFPageView; Object.defineProperty(exports, "__esModule", { value: true }); -exports.DefaultTextLayerFactory = exports.TextLayerBuilder = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +exports.DefaultTextLayerFactory = exports.TextLayerBuilder = void 0; -var _dom_events = __webpack_require__(14); +var _pdfjsLib = __webpack_require__(8); -var _pdfjsLib = __webpack_require__(7); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var _ui_utils = __webpack_require__(6); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var EXPAND_DIVS_TIMEOUT = 300; -var MATCH_SCROLL_OFFSET_TOP = -50; -var MATCH_SCROLL_OFFSET_LEFT = -400; -var TextLayerBuilder = function () { +var TextLayerBuilder = /*#__PURE__*/function () { function TextLayerBuilder(_ref) { var textLayerDiv = _ref.textLayerDiv, eventBus = _ref.eventBus, pageIndex = _ref.pageIndex, viewport = _ref.viewport, _ref$findController = _ref.findController, - findController = _ref$findController === undefined ? null : _ref$findController, + findController = _ref$findController === void 0 ? null : _ref$findController, _ref$enhanceTextSelec = _ref.enhanceTextSelection, - enhanceTextSelection = _ref$enhanceTextSelec === undefined ? false : _ref$enhanceTextSelec; + enhanceTextSelection = _ref$enhanceTextSelec === void 0 ? false : _ref$enhanceTextSelec; _classCallCheck(this, TextLayerBuilder); this.textLayerDiv = textLayerDiv; - this.eventBus = eventBus || (0, _dom_events.getGlobalEventBus)(); + this.eventBus = eventBus; this.textContent = null; this.textContentItemsStr = []; this.textContentStream = null; @@ -10368,28 +12867,30 @@ var TextLayerBuilder = function () { this.findController = findController; this.textLayerRenderTask = null; this.enhanceTextSelection = enhanceTextSelection; - this._boundEvents = Object.create(null); - this._bindEvents(); + this._onUpdateTextLayerMatches = null; + this._bindMouse(); } _createClass(TextLayerBuilder, [{ - key: '_finishRendering', + key: "_finishRendering", value: function _finishRendering() { this.renderingDone = true; + if (!this.enhanceTextSelection) { - var endOfContent = document.createElement('div'); - endOfContent.className = 'endOfContent'; + var endOfContent = document.createElement("div"); + endOfContent.className = "endOfContent"; this.textLayerDiv.appendChild(endOfContent); } - this.eventBus.dispatch('textlayerrendered', { + + this.eventBus.dispatch("textlayerrendered", { source: this, pageNumber: this.pageNumber, numTextDivs: this.textDivs.length }); } }, { - key: 'render', + key: "render", value: function render() { var _this = this; @@ -10398,6 +12899,7 @@ var TextLayerBuilder = function () { if (!(this.textContent || this.textContentStream) || this.renderingDone) { return; } + this.cancel(); this.textDivs = []; var textLayerFrag = document.createDocumentFragment(); @@ -10413,262 +12915,291 @@ var TextLayerBuilder = function () { }); this.textLayerRenderTask.promise.then(function () { _this.textLayerDiv.appendChild(textLayerFrag); + _this._finishRendering(); - _this.updateMatches(); + + _this._updateMatches(); }, function (reason) {}); + + if (!this._onUpdateTextLayerMatches) { + this._onUpdateTextLayerMatches = function (evt) { + if (evt.pageIndex === _this.pageIdx || evt.pageIndex === -1) { + _this._updateMatches(); + } + }; + + this.eventBus._on("updatetextlayermatches", this._onUpdateTextLayerMatches); + } } }, { - key: 'cancel', + key: "cancel", value: function cancel() { if (this.textLayerRenderTask) { this.textLayerRenderTask.cancel(); this.textLayerRenderTask = null; } + + if (this._onUpdateTextLayerMatches) { + this.eventBus._off("updatetextlayermatches", this._onUpdateTextLayerMatches); + + this._onUpdateTextLayerMatches = null; + } } }, { - key: 'setTextContentStream', + key: "setTextContentStream", value: function setTextContentStream(readableStream) { this.cancel(); this.textContentStream = readableStream; } }, { - key: 'setTextContent', + key: "setTextContent", value: function setTextContent(textContent) { this.cancel(); this.textContent = textContent; } }, { - key: 'convertMatches', - value: function convertMatches(matches, matchesLength) { - var i = 0; - var iIndex = 0; - var textContentItemsStr = this.textContentItemsStr; - var end = textContentItemsStr.length - 1; - var queryLen = this.findController === null ? 0 : this.findController.state.query.length; - var ret = []; + key: "_convertMatches", + value: function _convertMatches(matches, matchesLength) { if (!matches) { - return ret; + return []; } - for (var m = 0, len = matches.length; m < len; m++) { + + var findController = this.findController, + textContentItemsStr = this.textContentItemsStr; + var i = 0, + iIndex = 0; + var end = textContentItemsStr.length - 1; + var queryLen = findController.state.query.length; + var result = []; + + for (var m = 0, mm = matches.length; m < mm; m++) { var matchIdx = matches[m]; + while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) { iIndex += textContentItemsStr[i].length; i++; } + if (i === textContentItemsStr.length) { - console.error('Could not find a matching mapping'); + console.error("Could not find a matching mapping"); } + var match = { begin: { divIdx: i, offset: matchIdx - iIndex } }; + if (matchesLength) { matchIdx += matchesLength[m]; } else { matchIdx += queryLen; } + while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) { iIndex += textContentItemsStr[i].length; i++; } + match.end = { divIdx: i, offset: matchIdx - iIndex }; - ret.push(match); + result.push(match); } - return ret; + + return result; } }, { - key: 'renderMatches', - value: function renderMatches(matches) { + key: "_renderMatches", + value: function _renderMatches(matches) { if (matches.length === 0) { return; } - var textContentItemsStr = this.textContentItemsStr; - var textDivs = this.textDivs; + + var findController = this.findController, + pageIdx = this.pageIdx, + textContentItemsStr = this.textContentItemsStr, + textDivs = this.textDivs; + var isSelectedPage = pageIdx === findController.selected.pageIdx; + var selectedMatchIdx = findController.selected.matchIdx; + var highlightAll = findController.state.highlightAll; var prevEnd = null; - var pageIdx = this.pageIdx; - var isSelectedPage = this.findController === null ? false : pageIdx === this.findController.selected.pageIdx; - var selectedMatchIdx = this.findController === null ? -1 : this.findController.selected.matchIdx; - var highlightAll = this.findController === null ? false : this.findController.state.highlightAll; var infinity = { divIdx: -1, offset: undefined }; + function beginText(begin, className) { var divIdx = begin.divIdx; - textDivs[divIdx].textContent = ''; + textDivs[divIdx].textContent = ""; appendTextToDiv(divIdx, 0, begin.offset, className); } + function appendTextToDiv(divIdx, fromOffset, toOffset, className) { var div = textDivs[divIdx]; var content = textContentItemsStr[divIdx].substring(fromOffset, toOffset); var node = document.createTextNode(content); + if (className) { - var span = document.createElement('span'); + var span = document.createElement("span"); span.className = className; span.appendChild(node); div.appendChild(span); return; } + div.appendChild(node); } + var i0 = selectedMatchIdx, i1 = i0 + 1; + if (highlightAll) { i0 = 0; i1 = matches.length; } else if (!isSelectedPage) { return; } + for (var i = i0; i < i1; i++) { var match = matches[i]; var begin = match.begin; var end = match.end; var isSelected = isSelectedPage && i === selectedMatchIdx; - var highlightSuffix = isSelected ? ' selected' : ''; - if (this.findController) { - if (this.findController.selected.matchIdx === i && this.findController.selected.pageIdx === pageIdx) { - var spot = { - top: MATCH_SCROLL_OFFSET_TOP, - left: MATCH_SCROLL_OFFSET_LEFT - }; - (0, _ui_utils.scrollIntoView)(textDivs[begin.divIdx], spot, true); - } + var highlightSuffix = isSelected ? " selected" : ""; + + if (isSelected) { + findController.scrollMatchIntoView({ + element: textDivs[begin.divIdx], + pageIndex: pageIdx, + matchIndex: selectedMatchIdx + }); } + if (!prevEnd || begin.divIdx !== prevEnd.divIdx) { if (prevEnd !== null) { appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset); } + beginText(begin); } else { appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset); } + if (begin.divIdx === end.divIdx) { - appendTextToDiv(begin.divIdx, begin.offset, end.offset, 'highlight' + highlightSuffix); + appendTextToDiv(begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix); } else { - appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, 'highlight begin' + highlightSuffix); + appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix); + for (var n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) { - textDivs[n0].className = 'highlight middle' + highlightSuffix; + textDivs[n0].className = "highlight middle" + highlightSuffix; } - beginText(end, 'highlight end' + highlightSuffix); + + beginText(end, "highlight end" + highlightSuffix); } + prevEnd = end; } + if (prevEnd) { appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset); } } }, { - key: 'updateMatches', - value: function updateMatches() { + key: "_updateMatches", + value: function _updateMatches() { if (!this.renderingDone) { return; } - var matches = this.matches; - var textDivs = this.textDivs; - var textContentItemsStr = this.textContentItemsStr; + + var findController = this.findController, + matches = this.matches, + pageIdx = this.pageIdx, + textContentItemsStr = this.textContentItemsStr, + textDivs = this.textDivs; var clearedUntilDivIdx = -1; - for (var i = 0, len = matches.length; i < len; i++) { + + for (var i = 0, ii = matches.length; i < ii; i++) { var match = matches[i]; var begin = Math.max(clearedUntilDivIdx, match.begin.divIdx); + for (var n = begin, end = match.end.divIdx; n <= end; n++) { var div = textDivs[n]; div.textContent = textContentItemsStr[n]; - div.className = ''; + div.className = ""; } + clearedUntilDivIdx = match.end.divIdx + 1; } - if (!this.findController || !this.findController.highlightMatches) { + + if (!findController || !findController.highlightMatches) { return; } - var pageMatches = void 0, - pageMatchesLength = void 0; - if (this.findController !== null) { - pageMatches = this.findController.pageMatches[this.pageIdx] || null; - pageMatchesLength = this.findController.pageMatchesLength ? this.findController.pageMatchesLength[this.pageIdx] || null : null; - } - this.matches = this.convertMatches(pageMatches, pageMatchesLength); - this.renderMatches(this.matches); - } - }, { - key: '_bindEvents', - value: function _bindEvents() { - var _this2 = this; - var eventBus = this.eventBus, - _boundEvents = this._boundEvents; + var pageMatches = findController.pageMatches[pageIdx] || null; + var pageMatchesLength = findController.pageMatchesLength[pageIdx] || null; + this.matches = this._convertMatches(pageMatches, pageMatchesLength); - _boundEvents.pageCancelled = function (evt) { - if (evt.pageNumber !== _this2.pageNumber) { - return; - } - if (_this2.textLayerRenderTask) { - console.error('TextLayerBuilder._bindEvents: `this.cancel()` should ' + 'have been called when the page was reset, or rendering cancelled.'); - return; - } - for (var name in _boundEvents) { - eventBus.off(name.toLowerCase(), _boundEvents[name]); - delete _boundEvents[name]; - } - }; - _boundEvents.updateTextLayerMatches = function (evt) { - if (evt.pageIndex !== _this2.pageIdx && evt.pageIndex !== -1) { - return; - } - _this2.updateMatches(); - }; - eventBus.on('pagecancelled', _boundEvents.pageCancelled); - eventBus.on('updatetextlayermatches', _boundEvents.updateTextLayerMatches); + this._renderMatches(this.matches); } }, { - key: '_bindMouse', + key: "_bindMouse", value: function _bindMouse() { - var _this3 = this; + var _this2 = this; var div = this.textLayerDiv; var expandDivsTimer = null; - div.addEventListener('mousedown', function (evt) { - if (_this3.enhanceTextSelection && _this3.textLayerRenderTask) { - _this3.textLayerRenderTask.expandTextDivs(true); + div.addEventListener("mousedown", function (evt) { + if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) { + _this2.textLayerRenderTask.expandTextDivs(true); + if (expandDivsTimer) { clearTimeout(expandDivsTimer); expandDivsTimer = null; } + return; } - var end = div.querySelector('.endOfContent'); + + var end = div.querySelector(".endOfContent"); + if (!end) { return; } + var adjustTop = evt.target !== div; - adjustTop = adjustTop && window.getComputedStyle(end).getPropertyValue('-moz-user-select') !== 'none'; + adjustTop = adjustTop && window.getComputedStyle(end).getPropertyValue("-moz-user-select") !== "none"; + if (adjustTop) { var divBounds = div.getBoundingClientRect(); var r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height); - end.style.top = (r * 100).toFixed(2) + '%'; + end.style.top = (r * 100).toFixed(2) + "%"; } - end.classList.add('active'); + + end.classList.add("active"); }); - div.addEventListener('mouseup', function () { - if (_this3.enhanceTextSelection && _this3.textLayerRenderTask) { + div.addEventListener("mouseup", function () { + if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) { expandDivsTimer = setTimeout(function () { - if (_this3.textLayerRenderTask) { - _this3.textLayerRenderTask.expandTextDivs(false); + if (_this2.textLayerRenderTask) { + _this2.textLayerRenderTask.expandTextDivs(false); } + expandDivsTimer = null; }, EXPAND_DIVS_TIMEOUT); return; } - var end = div.querySelector('.endOfContent'); + + var end = div.querySelector(".endOfContent"); + if (!end) { return; } - end.style.top = ''; - end.classList.remove('active'); + + end.style.top = ""; + end.classList.remove("active"); }); } }]); @@ -10676,21 +13207,24 @@ var TextLayerBuilder = function () { return TextLayerBuilder; }(); -var DefaultTextLayerFactory = function () { +exports.TextLayerBuilder = TextLayerBuilder; + +var DefaultTextLayerFactory = /*#__PURE__*/function () { function DefaultTextLayerFactory() { _classCallCheck(this, DefaultTextLayerFactory); } _createClass(DefaultTextLayerFactory, [{ - key: 'createTextLayerBuilder', + key: "createTextLayerBuilder", value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) { var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - + var eventBus = arguments.length > 4 ? arguments[4] : undefined; return new TextLayerBuilder({ textLayerDiv: textLayerDiv, pageIndex: pageIndex, viewport: viewport, - enhanceTextSelection: enhanceTextSelection + enhanceTextSelection: enhanceTextSelection, + eventBus: eventBus }); } }]); @@ -10698,11 +13232,10 @@ var DefaultTextLayerFactory = function () { return DefaultTextLayerFactory; }(); -exports.TextLayerBuilder = TextLayerBuilder; exports.DefaultTextLayerFactory = DefaultTextLayerFactory; /***/ }), -/* 34 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10711,21 +13244,27 @@ exports.DefaultTextLayerFactory = DefaultTextLayerFactory; Object.defineProperty(exports, "__esModule", { value: true }); -exports.SecondaryToolbar = undefined; +exports.SecondaryToolbar = void 0; + +var _ui_utils = __webpack_require__(5); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _pdf_cursor_tools = __webpack_require__(9); -var _base_viewer = __webpack_require__(30); +var _pdf_single_page_viewer = __webpack_require__(33); -var _pdf_cursor_tools = __webpack_require__(8); +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } -var _pdf_single_page_viewer = __webpack_require__(35); +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -var _ui_utils = __webpack_require__(6); +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var SecondaryToolbar = function () { +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var SecondaryToolbar = /*#__PURE__*/function () { function SecondaryToolbar(options, mainContainer, eventBus) { var _this = this; @@ -10736,19 +13275,19 @@ var SecondaryToolbar = function () { this.toolbarButtonContainer = options.toolbarButtonContainer; this.buttons = [{ element: options.presentationModeButton, - eventName: 'presentationmode', + eventName: "presentationmode", close: true }, { element: options.openFileButton, - eventName: 'openfile', + eventName: "openfile", close: true }, { element: options.printButton, - eventName: 'print', + eventName: "print", close: true }, { element: options.downloadButton, - eventName: 'download', + eventName: "download", close: true }, { element: options.viewBookmarkButton, @@ -10756,63 +13295,79 @@ var SecondaryToolbar = function () { close: true }, { element: options.firstPageButton, - eventName: 'firstpage', + eventName: "firstpage", close: true }, { element: options.lastPageButton, - eventName: 'lastpage', + eventName: "lastpage", close: true }, { element: options.pageRotateCwButton, - eventName: 'rotatecw', + eventName: "rotatecw", close: false }, { element: options.pageRotateCcwButton, - eventName: 'rotateccw', + eventName: "rotateccw", close: false }, { element: options.cursorSelectToolButton, - eventName: 'switchcursortool', - eventDetails: { tool: _pdf_cursor_tools.CursorTool.SELECT }, + eventName: "switchcursortool", + eventDetails: { + tool: _pdf_cursor_tools.CursorTool.SELECT + }, close: true }, { element: options.cursorHandToolButton, - eventName: 'switchcursortool', - eventDetails: { tool: _pdf_cursor_tools.CursorTool.HAND }, + eventName: "switchcursortool", + eventDetails: { + tool: _pdf_cursor_tools.CursorTool.HAND + }, close: true }, { element: options.scrollVerticalButton, - eventName: 'switchscrollmode', - eventDetails: { mode: _base_viewer.ScrollMode.VERTICAL }, + eventName: "switchscrollmode", + eventDetails: { + mode: _ui_utils.ScrollMode.VERTICAL + }, close: true }, { element: options.scrollHorizontalButton, - eventName: 'switchscrollmode', - eventDetails: { mode: _base_viewer.ScrollMode.HORIZONTAL }, + eventName: "switchscrollmode", + eventDetails: { + mode: _ui_utils.ScrollMode.HORIZONTAL + }, close: true }, { element: options.scrollWrappedButton, - eventName: 'switchscrollmode', - eventDetails: { mode: _base_viewer.ScrollMode.WRAPPED }, + eventName: "switchscrollmode", + eventDetails: { + mode: _ui_utils.ScrollMode.WRAPPED + }, close: true }, { element: options.spreadNoneButton, - eventName: 'switchspreadmode', - eventDetails: { mode: _base_viewer.SpreadMode.NONE }, + eventName: "switchspreadmode", + eventDetails: { + mode: _ui_utils.SpreadMode.NONE + }, close: true }, { element: options.spreadOddButton, - eventName: 'switchspreadmode', - eventDetails: { mode: _base_viewer.SpreadMode.ODD }, + eventName: "switchspreadmode", + eventDetails: { + mode: _ui_utils.SpreadMode.ODD + }, close: true }, { element: options.spreadEvenButton, - eventName: 'switchspreadmode', - eventDetails: { mode: _base_viewer.SpreadMode.EVEN }, + eventName: "switchspreadmode", + eventDetails: { + mode: _ui_utils.SpreadMode.EVEN + }, close: true }, { element: options.documentPropertiesButton, - eventName: 'documentproperties', + eventName: "documentproperties", close: true }]; this.items = { @@ -10827,42 +13382,54 @@ var SecondaryToolbar = function () { this.containerHeight = null; this.previousContainerHeight = null; this.reset(); + this._bindClickListeners(); + this._bindCursorToolsListener(options); + this._bindScrollModeListener(options); + this._bindSpreadModeListener(options); - this.eventBus.on('resize', this._setMaxHeight.bind(this)); - this.eventBus.on('baseviewerinit', function (evt) { + + this.eventBus._on("resize", this._setMaxHeight.bind(this)); + + this.eventBus._on("baseviewerinit", function (evt) { if (evt.source instanceof _pdf_single_page_viewer.PDFSinglePageViewer) { - _this.toolbarButtonContainer.classList.add('hiddenScrollModeButtons', 'hiddenSpreadModeButtons'); + _this.toolbarButtonContainer.classList.add("hiddenScrollModeButtons", "hiddenSpreadModeButtons"); } else { - _this.toolbarButtonContainer.classList.remove('hiddenScrollModeButtons', 'hiddenSpreadModeButtons'); + _this.toolbarButtonContainer.classList.remove("hiddenScrollModeButtons", "hiddenSpreadModeButtons"); } }); } _createClass(SecondaryToolbar, [{ - key: 'setPageNumber', + key: "setPageNumber", value: function setPageNumber(pageNumber) { this.pageNumber = pageNumber; + this._updateUIState(); } }, { - key: 'setPagesCount', + key: "setPagesCount", value: function setPagesCount(pagesCount) { this.pagesCount = pagesCount; + this._updateUIState(); } }, { - key: 'reset', + key: "reset", value: function reset() { this.pageNumber = 0; this.pagesCount = 0; + this._updateUIState(); - this.eventBus.dispatch('secondarytoolbarreset', { source: this }); + + this.eventBus.dispatch("secondarytoolbarreset", { + source: this + }); } }, { - key: '_updateUIState', + key: "_updateUIState", value: function _updateUIState() { this.items.firstPage.disabled = this.pageNumber <= 1; this.items.lastPage.disabled = this.pageNumber >= this.pagesCount; @@ -10870,136 +13437,134 @@ var SecondaryToolbar = function () { this.items.pageRotateCcw.disabled = this.pagesCount === 0; } }, { - key: '_bindClickListeners', + key: "_bindClickListeners", value: function _bindClickListeners() { var _this2 = this; - this.toggleButton.addEventListener('click', this.toggle.bind(this)); + this.toggleButton.addEventListener("click", this.toggle.bind(this)); + + var _iterator = _createForOfIteratorHelper(this.buttons), + _step; + + try { + var _loop = function _loop() { + var _step$value = _step.value, + element = _step$value.element, + eventName = _step$value.eventName, + close = _step$value.close, + eventDetails = _step$value.eventDetails; + element.addEventListener("click", function (evt) { + if (eventName !== null) { + var details = { + source: _this2 + }; + + for (var property in eventDetails) { + details[property] = eventDetails[property]; + } - var _loop = function _loop(button) { - var _buttons$button = _this2.buttons[button], - element = _buttons$button.element, - eventName = _buttons$button.eventName, - close = _buttons$button.close, - eventDetails = _buttons$button.eventDetails; + _this2.eventBus.dispatch(eventName, details); + } - element.addEventListener('click', function (evt) { - if (eventName !== null) { - var details = { source: _this2 }; - for (var property in eventDetails) { - details[property] = eventDetails[property]; + if (close) { + _this2.close(); } - _this2.eventBus.dispatch(eventName, details); - } - if (close) { - _this2.close(); - } - }); - }; + }); + }; - for (var button in this.buttons) { - _loop(button); + for (_iterator.s(); !(_step = _iterator.n()).done;) { + _loop(); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); } } }, { - key: '_bindCursorToolsListener', + key: "_bindCursorToolsListener", value: function _bindCursorToolsListener(buttons) { - this.eventBus.on('cursortoolchanged', function (evt) { - buttons.cursorSelectToolButton.classList.remove('toggled'); - buttons.cursorHandToolButton.classList.remove('toggled'); - switch (evt.tool) { - case _pdf_cursor_tools.CursorTool.SELECT: - buttons.cursorSelectToolButton.classList.add('toggled'); - break; - case _pdf_cursor_tools.CursorTool.HAND: - buttons.cursorHandToolButton.classList.add('toggled'); - break; - } + this.eventBus._on("cursortoolchanged", function (_ref) { + var tool = _ref.tool; + buttons.cursorSelectToolButton.classList.toggle("toggled", tool === _pdf_cursor_tools.CursorTool.SELECT); + buttons.cursorHandToolButton.classList.toggle("toggled", tool === _pdf_cursor_tools.CursorTool.HAND); }); } }, { - key: '_bindScrollModeListener', + key: "_bindScrollModeListener", value: function _bindScrollModeListener(buttons) { var _this3 = this; - function scrollModeChanged(evt) { - buttons.scrollVerticalButton.classList.remove('toggled'); - buttons.scrollHorizontalButton.classList.remove('toggled'); - buttons.scrollWrappedButton.classList.remove('toggled'); - switch (evt.mode) { - case _base_viewer.ScrollMode.VERTICAL: - buttons.scrollVerticalButton.classList.add('toggled'); - break; - case _base_viewer.ScrollMode.HORIZONTAL: - buttons.scrollHorizontalButton.classList.add('toggled'); - break; - case _base_viewer.ScrollMode.WRAPPED: - buttons.scrollWrappedButton.classList.add('toggled'); - break; - } - var isScrollModeHorizontal = evt.mode === _base_viewer.ScrollMode.HORIZONTAL; + function scrollModeChanged(_ref2) { + var mode = _ref2.mode; + 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); + var isScrollModeHorizontal = mode === _ui_utils.ScrollMode.HORIZONTAL; buttons.spreadNoneButton.disabled = isScrollModeHorizontal; buttons.spreadOddButton.disabled = isScrollModeHorizontal; buttons.spreadEvenButton.disabled = isScrollModeHorizontal; } - this.eventBus.on('scrollmodechanged', scrollModeChanged); - this.eventBus.on('secondarytoolbarreset', function (evt) { + + this.eventBus._on("scrollmodechanged", scrollModeChanged); + + this.eventBus._on("secondarytoolbarreset", function (evt) { if (evt.source === _this3) { - scrollModeChanged({ mode: _base_viewer.ScrollMode.VERTICAL }); + scrollModeChanged({ + mode: _ui_utils.ScrollMode.VERTICAL + }); } }); } }, { - key: '_bindSpreadModeListener', + key: "_bindSpreadModeListener", value: function _bindSpreadModeListener(buttons) { var _this4 = this; - function spreadModeChanged(evt) { - buttons.spreadNoneButton.classList.remove('toggled'); - buttons.spreadOddButton.classList.remove('toggled'); - buttons.spreadEvenButton.classList.remove('toggled'); - switch (evt.mode) { - case _base_viewer.SpreadMode.NONE: - buttons.spreadNoneButton.classList.add('toggled'); - break; - case _base_viewer.SpreadMode.ODD: - buttons.spreadOddButton.classList.add('toggled'); - break; - case _base_viewer.SpreadMode.EVEN: - buttons.spreadEvenButton.classList.add('toggled'); - break; - } + function spreadModeChanged(_ref3) { + var mode = _ref3.mode; + buttons.spreadNoneButton.classList.toggle("toggled", mode === _ui_utils.SpreadMode.NONE); + buttons.spreadOddButton.classList.toggle("toggled", mode === _ui_utils.SpreadMode.ODD); + buttons.spreadEvenButton.classList.toggle("toggled", mode === _ui_utils.SpreadMode.EVEN); } - this.eventBus.on('spreadmodechanged', spreadModeChanged); - this.eventBus.on('secondarytoolbarreset', function (evt) { + + this.eventBus._on("spreadmodechanged", spreadModeChanged); + + this.eventBus._on("secondarytoolbarreset", function (evt) { if (evt.source === _this4) { - spreadModeChanged({ mode: _base_viewer.SpreadMode.NONE }); + spreadModeChanged({ + mode: _ui_utils.SpreadMode.NONE + }); } }); } }, { - key: 'open', + key: "open", value: function open() { if (this.opened) { return; } + this.opened = true; + this._setMaxHeight(); - this.toggleButton.classList.add('toggled'); - this.toolbar.classList.remove('hidden'); + + this.toggleButton.classList.add("toggled"); + this.toolbar.classList.remove("hidden"); } }, { - key: 'close', + key: "close", value: function close() { if (!this.opened) { return; } + this.opened = false; - this.toolbar.classList.add('hidden'); - this.toggleButton.classList.remove('toggled'); + this.toolbar.classList.add("hidden"); + this.toggleButton.classList.remove("toggled"); } }, { - key: 'toggle', + key: "toggle", value: function toggle() { if (this.opened) { this.close(); @@ -11008,20 +13573,23 @@ var SecondaryToolbar = function () { } } }, { - key: '_setMaxHeight', + key: "_setMaxHeight", value: function _setMaxHeight() { if (!this.opened) { return; } + this.containerHeight = this.mainContainer.clientHeight; + if (this.containerHeight === this.previousContainerHeight) { return; } - this.toolbarButtonContainer.setAttribute('style', 'max-height: ' + (this.containerHeight - _ui_utils.SCROLLBAR_PADDING) + 'px;'); + + this.toolbarButtonContainer.style.maxHeight = "".concat(this.containerHeight - _ui_utils.SCROLLBAR_PADDING, "px"); this.previousContainerHeight = this.containerHeight; } }, { - key: 'isOpen', + key: "isOpen", get: function get() { return this.opened; } @@ -11033,7 +13601,7 @@ var SecondaryToolbar = function () { exports.SecondaryToolbar = SecondaryToolbar; /***/ }), -/* 35 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11042,162 +13610,163 @@ exports.SecondaryToolbar = SecondaryToolbar; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFSinglePageViewer = undefined; +exports.PDFSinglePageViewer = void 0; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _base_viewer = __webpack_require__(28); -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; +var _pdfjsLib = __webpack_require__(8); -var _base_viewer = __webpack_require__(30); +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var _ui_utils = __webpack_require__(6); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var _pdfjsLib = __webpack_require__(7); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -var PDFSinglePageViewer = function (_BaseViewer) { +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var PDFSinglePageViewer = /*#__PURE__*/function (_BaseViewer) { _inherits(PDFSinglePageViewer, _BaseViewer); + var _super = _createSuper(PDFSinglePageViewer); + function PDFSinglePageViewer(options) { + var _this; + _classCallCheck(this, PDFSinglePageViewer); - var _this = _possibleConstructorReturn(this, (PDFSinglePageViewer.__proto__ || Object.getPrototypeOf(PDFSinglePageViewer)).call(this, options)); + _this = _super.call(this, options); - _this.eventBus.on('pagesinit', function (evt) { + _this.eventBus._on("pagesinit", function (evt) { _this._ensurePageViewVisible(); }); + return _this; } _createClass(PDFSinglePageViewer, [{ - key: '_resetView', + key: "_resetView", value: function _resetView() { - _get(PDFSinglePageViewer.prototype.__proto__ || Object.getPrototypeOf(PDFSinglePageViewer.prototype), '_resetView', this).call(this); + _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_resetView", this).call(this); + this._previousPageNumber = 1; this._shadowViewer = document.createDocumentFragment(); + this._updateScrollDown = null; } }, { - key: '_ensurePageViewVisible', + key: "_ensurePageViewVisible", value: function _ensurePageViewVisible() { var pageView = this._pages[this._currentPageNumber - 1]; var previousPageView = this._pages[this._previousPageNumber - 1]; var 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.'); + 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.'); + throw new Error("_ensurePageViewVisible: Only one page should be visible at a time."); } + this._previousPageNumber = this._currentPageNumber; } }, { - key: '_scrollUpdate', + key: "_scrollUpdate", value: function _scrollUpdate() { if (this._updateScrollDown) { this._updateScrollDown(); } - _get(PDFSinglePageViewer.prototype.__proto__ || Object.getPrototypeOf(PDFSinglePageViewer.prototype), '_scrollUpdate', this).call(this); + + _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_scrollUpdate", this).call(this); } }, { - key: '_scrollIntoView', + key: "_scrollIntoView", value: function _scrollIntoView(_ref) { var _this2 = this; var pageDiv = _ref.pageDiv, _ref$pageSpot = _ref.pageSpot, - pageSpot = _ref$pageSpot === undefined ? null : _ref$pageSpot, + pageSpot = _ref$pageSpot === void 0 ? null : _ref$pageSpot, _ref$pageNumber = _ref.pageNumber, - pageNumber = _ref$pageNumber === undefined ? null : _ref$pageNumber; + pageNumber = _ref$pageNumber === void 0 ? null : _ref$pageNumber; if (pageNumber) { this._setCurrentPageNumber(pageNumber); } + var scrolledDown = this._currentPageNumber >= this._previousPageNumber; - var previousLocation = this._location; + this._ensurePageViewVisible(); - (0, _ui_utils.scrollIntoView)(pageDiv, pageSpot); + + this.update(); + + _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_scrollIntoView", this).call(this, { + pageDiv: pageDiv, + pageSpot: pageSpot, + pageNumber: pageNumber + }); + this._updateScrollDown = function () { _this2.scroll.down = scrolledDown; - delete _this2._updateScrollDown; + _this2._updateScrollDown = null; }; - setTimeout(function () { - if (_this2._location === previousLocation) { - if (_this2._updateScrollDown) { - _this2._updateScrollDown(); - } - _this2.update(); - } - }, 0); } }, { - key: '_getVisiblePages', + key: "_getVisiblePages", value: function _getVisiblePages() { - if (!this.pagesCount) { - return { views: [] }; - } - var pageView = this._pages[this._currentPageNumber - 1]; - var element = pageView.div; - var view = { - id: pageView.id, - x: element.offsetLeft + element.clientLeft, - y: element.offsetTop + element.clientTop, - view: pageView - }; - return { - first: view, - last: view, - views: [view] - }; + return this._getCurrentVisiblePage(); } }, { - key: 'update', - value: function update() { - var visible = this._getVisiblePages(); - var visiblePages = visible.views, - numVisiblePages = visiblePages.length; - if (numVisiblePages === 0) { - return; - } - this._resizeBuffer(numVisiblePages); - this.renderingQueue.renderHighestPriority(visible); - this._updateLocation(visible.first); - this.eventBus.dispatch('updateviewarea', { - source: this, - location: this._location - }); - } + key: "_updateHelper", + value: function _updateHelper(visiblePages) {} }, { - key: '_updateScrollMode', + key: "_updateScrollMode", value: function _updateScrollMode() {} }, { - key: '_updateSpreadMode', + key: "_updateSpreadMode", value: function _updateSpreadMode() {} }, { - key: '_setDocumentViewerElement', + key: "_viewerElement", get: function get() { - return (0, _pdfjsLib.shadow)(this, '_setDocumentViewerElement', this._shadowViewer); + return (0, _pdfjsLib.shadow)(this, "_viewerElement", this._shadowViewer); } }, { - key: '_isScrollModeHorizontal', + key: "_isScrollModeHorizontal", get: function get() { - return (0, _pdfjsLib.shadow)(this, '_isScrollModeHorizontal', false); + return (0, _pdfjsLib.shadow)(this, "_isScrollModeHorizontal", false); } }]); @@ -11207,7 +13776,7 @@ var PDFSinglePageViewer = function (_BaseViewer) { exports.PDFSinglePageViewer = PDFSinglePageViewer; /***/ }), -/* 36 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11216,19 +13785,35 @@ exports.PDFSinglePageViewer = PDFSinglePageViewer; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Toolbar = undefined; +exports.Toolbar = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +var _ui_utils = __webpack_require__(5); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _ui_utils = __webpack_require__(6); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading'; -var SCALE_SELECT_CONTAINER_PADDING = 8; -var SCALE_SELECT_PADDING = 22; +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -var Toolbar = function () { +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading"; +var SCALE_SELECT_CONTAINER_WIDTH = 140; +var SCALE_SELECT_WIDTH = 162; + +var Toolbar = /*#__PURE__*/function () { function Toolbar(options, eventBus) { var l10n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ui_utils.NullL10n; @@ -11237,35 +13822,77 @@ var Toolbar = function () { this.toolbar = options.container; this.eventBus = eventBus; this.l10n = l10n; - this.items = options; + this.buttons = [{ + element: options.previous, + eventName: "previouspage" + }, { + element: options.next, + eventName: "nextpage" + }, { + element: options.zoomIn, + eventName: "zoomin" + }, { + element: options.zoomOut, + eventName: "zoomout" + }, { + element: options.openFile, + eventName: "openfile" + }, { + element: options.print, + eventName: "print" + }, { + element: options.presentationModeButton, + eventName: "presentationmode" + }, { + element: options.download, + eventName: "download" + }, { + element: options.viewBookmark, + eventName: null + }]; + this.items = { + numPages: options.numPages, + pageNumber: options.pageNumber, + scaleSelectContainer: options.scaleSelectContainer, + scaleSelect: options.scaleSelect, + customScaleOption: options.customScaleOption, + previous: options.previous, + next: options.next, + zoomIn: options.zoomIn, + zoomOut: options.zoomOut + }; this._wasLocalized = false; this.reset(); + this._bindListeners(); } _createClass(Toolbar, [{ - key: 'setPageNumber', + key: "setPageNumber", value: function setPageNumber(pageNumber, pageLabel) { this.pageNumber = pageNumber; this.pageLabel = pageLabel; + this._updateUIState(false); } }, { - key: 'setPagesCount', + key: "setPagesCount", value: function setPagesCount(pagesCount, hasPageLabels) { this.pagesCount = pagesCount; this.hasPageLabels = hasPageLabels; + this._updateUIState(true); } }, { - key: 'setPageScale', + key: "setPageScale", value: function setPageScale(pageScaleValue, pageScale) { this.pageScaleValue = (pageScaleValue || pageScale).toString(); this.pageScale = pageScale; + this._updateUIState(false); } }, { - key: 'reset', + key: "reset", value: function reset() { this.pageNumber = 0; this.pageLabel = null; @@ -11273,79 +13900,85 @@ var Toolbar = function () { this.pagesCount = 0; this.pageScaleValue = _ui_utils.DEFAULT_SCALE_VALUE; this.pageScale = _ui_utils.DEFAULT_SCALE; + this._updateUIState(true); + + this.updateLoadingIndicatorState(); } }, { - key: '_bindListeners', + key: "_bindListeners", value: function _bindListeners() { var _this = this; - var eventBus = this.eventBus, - items = this.items; - + var _this$items = this.items, + pageNumber = _this$items.pageNumber, + scaleSelect = _this$items.scaleSelect; var self = this; - items.previous.addEventListener('click', function () { - eventBus.dispatch('previouspage', { source: self }); - }); - items.next.addEventListener('click', function () { - eventBus.dispatch('nextpage', { source: self }); - }); - items.zoomIn.addEventListener('click', function () { - eventBus.dispatch('zoomin', { source: self }); - }); - items.zoomOut.addEventListener('click', function () { - eventBus.dispatch('zoomout', { source: self }); - }); - items.pageNumber.addEventListener('click', function () { + + var _iterator = _createForOfIteratorHelper(this.buttons), + _step; + + try { + var _loop = function _loop() { + var _step$value = _step.value, + element = _step$value.element, + eventName = _step$value.eventName; + element.addEventListener("click", function (evt) { + if (eventName !== null) { + _this.eventBus.dispatch(eventName, { + source: _this + }); + } + }); + }; + + for (_iterator.s(); !(_step = _iterator.n()).done;) { + _loop(); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + pageNumber.addEventListener("click", function () { this.select(); }); - items.pageNumber.addEventListener('change', function () { - eventBus.dispatch('pagenumberchanged', { + pageNumber.addEventListener("change", function () { + self.eventBus.dispatch("pagenumberchanged", { source: self, value: this.value }); }); - items.scaleSelect.addEventListener('change', function () { - if (this.value === 'custom') { + scaleSelect.addEventListener("change", function () { + if (this.value === "custom") { return; } - eventBus.dispatch('scalechanged', { + + self.eventBus.dispatch("scalechanged", { source: self, value: this.value }); }); - items.presentationModeButton.addEventListener('click', function () { - eventBus.dispatch('presentationmode', { source: self }); - }); - items.openFile.addEventListener('click', function () { - eventBus.dispatch('openfile', { source: self }); - }); - items.print.addEventListener('click', function () { - eventBus.dispatch('print', { source: self }); - }); - items.download.addEventListener('click', function () { - eventBus.dispatch('download', { source: self }); - }); - items.scaleSelect.oncontextmenu = _ui_utils.noContextMenuHandler; - eventBus.on('localized', function () { - _this._localized(); + scaleSelect.oncontextmenu = _ui_utils.noContextMenuHandler; + + this.eventBus._on("localized", function () { + _this._wasLocalized = true; + + _this._adjustScaleWidth(); + + _this._updateUIState(true); }); } }, { - key: '_localized', - value: function _localized() { - this._wasLocalized = true; - this._adjustScaleWidth(); - this._updateUIState(true); - } - }, { - key: '_updateUIState', + key: "_updateUIState", value: function _updateUIState() { var resetNumPages = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!this._wasLocalized) { return; } + var pageNumber = this.pageNumber, pagesCount = this.pagesCount, pageScaleValue = this.pageScaleValue, @@ -11354,43 +13987,62 @@ var Toolbar = function () { if (resetNumPages) { if (this.hasPageLabels) { - items.pageNumber.type = 'text'; + items.pageNumber.type = "text"; } else { - items.pageNumber.type = 'number'; - this.l10n.get('of_pages', { pagesCount: pagesCount }, 'of {{pagesCount}}').then(function (msg) { + items.pageNumber.type = "number"; + this.l10n.get("of_pages", { + pagesCount: pagesCount + }, "of {{pagesCount}}").then(function (msg) { items.numPages.textContent = msg; }); } + items.pageNumber.max = pagesCount; } + if (this.hasPageLabels) { items.pageNumber.value = this.pageLabel; - this.l10n.get('page_of_pages', { + this.l10n.get("page_of_pages", { pageNumber: pageNumber, pagesCount: pagesCount - }, '({{pageNumber}} of {{pagesCount}})').then(function (msg) { + }, "({{pageNumber}} of {{pagesCount}})").then(function (msg) { items.numPages.textContent = msg; }); } else { items.pageNumber.value = pageNumber; } + items.previous.disabled = pageNumber <= 1; items.next.disabled = pageNumber >= pagesCount; items.zoomOut.disabled = pageScale <= _ui_utils.MIN_SCALE; items.zoomIn.disabled = pageScale >= _ui_utils.MAX_SCALE; var customScale = Math.round(pageScale * 10000) / 100; - this.l10n.get('page_scale_percent', { scale: customScale }, '{{scale}}%').then(function (msg) { - var options = items.scaleSelect.options; + this.l10n.get("page_scale_percent", { + scale: customScale + }, "{{scale}}%").then(function (msg) { var predefinedValueFound = false; - for (var i = 0, ii = options.length; i < ii; i++) { - var option = options[i]; - if (option.value !== pageScaleValue) { - option.selected = false; - continue; + + var _iterator2 = _createForOfIteratorHelper(items.scaleSelect.options), + _step2; + + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var option = _step2.value; + + if (option.value !== pageScaleValue) { + option.selected = false; + continue; + } + + option.selected = true; + predefinedValueFound = true; } - option.selected = true; - predefinedValueFound = true; + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); } + if (!predefinedValueFound) { items.customScaleOption.textContent = msg; items.customScaleOption.selected = true; @@ -11398,30 +14050,85 @@ var Toolbar = function () { }); } }, { - key: 'updateLoadingIndicatorState', + key: "updateLoadingIndicatorState", value: function updateLoadingIndicatorState() { var loading = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - var pageNumberInput = this.items.pageNumber; pageNumberInput.classList.toggle(PAGE_NUMBER_LOADING_INDICATOR, loading); } }, { - key: '_adjustScaleWidth', - value: function _adjustScaleWidth() { - var container = this.items.scaleSelectContainer; - var select = this.items.scaleSelect; - _ui_utils.animationStarted.then(function () { - if (container.clientWidth === 0) { - container.setAttribute('style', 'display: inherit;'); - } - if (container.clientWidth > 0) { - select.setAttribute('style', 'min-width: inherit;'); - var width = select.clientWidth + SCALE_SELECT_CONTAINER_PADDING; - select.setAttribute('style', 'min-width: ' + (width + SCALE_SELECT_PADDING) + 'px;'); - container.setAttribute('style', 'min-width: ' + width + 'px; ' + 'max-width: ' + width + 'px;'); - } - }); - } + key: "_adjustScaleWidth", + value: function () { + var _adjustScaleWidth2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() { + var items, l10n, predefinedValuesPromise, canvas, ctx, _getComputedStyle, fontSize, fontFamily, maxWidth, _iterator3, _step3, predefinedValue, _ctx$measureText, width, overflow; + + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + items = this.items, l10n = this.l10n; + predefinedValuesPromise = Promise.all([l10n.get("page_scale_auto", null, "Automatic Zoom"), l10n.get("page_scale_actual", null, "Actual Size"), l10n.get("page_scale_fit", null, "Page Fit"), l10n.get("page_scale_width", null, "Page Width")]); + canvas = document.createElement("canvas"); + canvas.mozOpaque = true; + ctx = canvas.getContext("2d", { + alpha: false + }); + _context.next = 7; + return _ui_utils.animationStarted; + + case 7: + _getComputedStyle = getComputedStyle(items.scaleSelect), fontSize = _getComputedStyle.fontSize, fontFamily = _getComputedStyle.fontFamily; + ctx.font = "".concat(fontSize, " ").concat(fontFamily); + maxWidth = 0; + _context.t0 = _createForOfIteratorHelper; + _context.next = 13; + return predefinedValuesPromise; + + case 13: + _context.t1 = _context.sent; + _iterator3 = (0, _context.t0)(_context.t1); + + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + predefinedValue = _step3.value; + _ctx$measureText = ctx.measureText(predefinedValue), width = _ctx$measureText.width; + + if (width > maxWidth) { + maxWidth = width; + } + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + + overflow = SCALE_SELECT_WIDTH - SCALE_SELECT_CONTAINER_WIDTH; + maxWidth += 1.5 * overflow; + + if (maxWidth > SCALE_SELECT_CONTAINER_WIDTH) { + items.scaleSelect.style.width = "".concat(maxWidth + overflow, "px"); + items.scaleSelectContainer.style.width = "".concat(maxWidth, "px"); + } + + canvas.width = 0; + canvas.height = 0; + canvas = ctx = null; + + case 22: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function _adjustScaleWidth() { + return _adjustScaleWidth2.apply(this, arguments); + } + + return _adjustScaleWidth; + }() }]); return Toolbar; @@ -11430,7 +14137,7 @@ var Toolbar = function () { exports.Toolbar = Toolbar; /***/ }), -/* 37 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11439,23 +14146,25 @@ exports.Toolbar = Toolbar; Object.defineProperty(exports, "__esModule", { value: true }); -exports.ViewHistory = undefined; +exports.ViewHistory = void 0; -var _regenerator = __webpack_require__(2); +var _regenerator = _interopRequireDefault(__webpack_require__(2)); -var _regenerator2 = _interopRequireDefault(_regenerator); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20; -var ViewHistory = function () { +var ViewHistory = /*#__PURE__*/function () { function ViewHistory(fingerprint) { var _this = this; @@ -11466,45 +14175,51 @@ var ViewHistory = function () { this.fingerprint = fingerprint; this.cacheSize = cacheSize; this._initializedPromise = this._readFromStorage().then(function (databaseStr) { - var database = JSON.parse(databaseStr || '{}'); - if (!('files' in database)) { + var database = JSON.parse(databaseStr || "{}"); + var index = -1; + + if (!Array.isArray(database.files)) { database.files = []; } else { while (database.files.length >= _this.cacheSize) { database.files.shift(); } - } - var index = -1; - for (var i = 0, length = database.files.length; i < length; i++) { - var branch = database.files[i]; - if (branch.fingerprint === _this.fingerprint) { - index = i; - break; + + for (var i = 0, ii = database.files.length; i < ii; i++) { + var branch = database.files[i]; + + if (branch.fingerprint === _this.fingerprint) { + index = i; + break; + } } } + if (index === -1) { - index = database.files.push({ fingerprint: _this.fingerprint }) - 1; + index = database.files.push({ + fingerprint: _this.fingerprint + }) - 1; } + _this.file = database.files[index]; _this.database = database; }); } _createClass(ViewHistory, [{ - key: '_writeToStorage', + key: "_writeToStorage", value: function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { + var _writeToStorage2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() { var databaseStr; - return _regenerator2.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: databaseStr = JSON.stringify(this.database); - - localStorage.setItem('pdfjs.history', databaseStr); + localStorage.setItem("pdfjs.history", databaseStr); case 2: - case 'end': + case "end": return _context.stop(); } } @@ -11512,40 +14227,40 @@ var ViewHistory = function () { })); function _writeToStorage() { - return _ref.apply(this, arguments); + return _writeToStorage2.apply(this, arguments); } return _writeToStorage; }() }, { - key: '_readFromStorage', + key: "_readFromStorage", value: function () { - var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() { - return _regenerator2.default.wrap(function _callee2$(_context2) { + var _readFromStorage2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: - return _context2.abrupt('return', localStorage.getItem('pdfjs.history')); + return _context2.abrupt("return", localStorage.getItem("pdfjs.history")); case 1: - case 'end': + case "end": return _context2.stop(); } } - }, _callee2, this); + }, _callee2); })); function _readFromStorage() { - return _ref2.apply(this, arguments); + return _readFromStorage2.apply(this, arguments); } return _readFromStorage; }() }, { - key: 'set', + key: "set", value: function () { - var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee3(name, val) { - return _regenerator2.default.wrap(function _callee3$(_context3) { + var _set = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(name, val) { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -11554,28 +14269,28 @@ var ViewHistory = function () { case 2: this.file[name] = val; - return _context3.abrupt('return', this._writeToStorage()); + return _context3.abrupt("return", this._writeToStorage()); case 4: - case 'end': + case "end": return _context3.stop(); } } }, _callee3, this); })); - function set(_x2, _x3) { - return _ref3.apply(this, arguments); + function set(_x, _x2) { + return _set.apply(this, arguments); } return set; }() }, { - key: 'setMultiple', + key: "setMultiple", value: function () { - var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee4(properties) { + var _setMultiple = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(properties) { var name; - return _regenerator2.default.wrap(function _callee4$(_context4) { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: @@ -11586,28 +14301,29 @@ var ViewHistory = function () { for (name in properties) { this.file[name] = properties[name]; } - return _context4.abrupt('return', this._writeToStorage()); + + return _context4.abrupt("return", this._writeToStorage()); case 4: - case 'end': + case "end": return _context4.stop(); } } }, _callee4, this); })); - function setMultiple(_x4) { - return _ref4.apply(this, arguments); + function setMultiple(_x3) { + return _setMultiple.apply(this, arguments); } return setMultiple; }() }, { - key: 'get', + key: "get", value: function () { - var _ref5 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee5(name, defaultValue) { + var _get = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee5(name, defaultValue) { var val; - return _regenerator2.default.wrap(function _callee5$(_context5) { + return _regenerator["default"].wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: @@ -11616,28 +14332,28 @@ var ViewHistory = function () { case 2: val = this.file[name]; - return _context5.abrupt('return', val !== undefined ? val : defaultValue); + return _context5.abrupt("return", val !== undefined ? val : defaultValue); case 4: - case 'end': + case "end": return _context5.stop(); } } }, _callee5, this); })); - function get(_x5, _x6) { - return _ref5.apply(this, arguments); + function get(_x4, _x5) { + return _get.apply(this, arguments); } return get; }() }, { - key: 'getMultiple', + key: "getMultiple", value: function () { - var _ref6 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee6(properties) { + var _getMultiple = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee6(properties) { var values, name, val; - return _regenerator2.default.wrap(function _callee6$(_context6) { + return _regenerator["default"].wrap(function _callee6$(_context6) { while (1) { switch (_context6.prev = _context6.next) { case 0: @@ -11649,21 +14365,21 @@ var ViewHistory = function () { for (name in properties) { val = this.file[name]; - values[name] = val !== undefined ? val : properties[name]; } - return _context6.abrupt('return', values); + + return _context6.abrupt("return", values); case 5: - case 'end': + case "end": return _context6.stop(); } } }, _callee6, this); })); - function getMultiple(_x7) { - return _ref6.apply(this, arguments); + function getMultiple(_x6) { + return _getMultiple.apply(this, arguments); } return getMultiple; @@ -11676,7 +14392,7 @@ var ViewHistory = function () { exports.ViewHistory = ViewHistory; /***/ }), -/* 38 */ +/* 36 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11685,88 +14401,105 @@ exports.ViewHistory = ViewHistory; Object.defineProperty(exports, "__esModule", { value: true }); -exports.GenericCom = undefined; +exports.GenericCom = void 0; -var _regenerator = __webpack_require__(2); +var _regenerator = _interopRequireDefault(__webpack_require__(2)); -var _regenerator2 = _interopRequireDefault(_regenerator); +var _app = __webpack_require__(1); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _preferences = __webpack_require__(37); -var _app = __webpack_require__(1); +var _download_manager = __webpack_require__(38); -var _preferences = __webpack_require__(39); +var _genericl10n = __webpack_require__(39); -var _download_manager = __webpack_require__(40); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _genericl10n = __webpack_require__(41); +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } ; var GenericCom = {}; +exports.GenericCom = GenericCom; -var GenericPreferences = function (_BasePreferences) { +var GenericPreferences = /*#__PURE__*/function (_BasePreferences) { _inherits(GenericPreferences, _BasePreferences); + var _super = _createSuper(GenericPreferences); + function GenericPreferences() { _classCallCheck(this, GenericPreferences); - return _possibleConstructorReturn(this, (GenericPreferences.__proto__ || Object.getPrototypeOf(GenericPreferences)).apply(this, arguments)); + return _super.apply(this, arguments); } _createClass(GenericPreferences, [{ - key: '_writeToStorage', + key: "_writeToStorage", value: function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(prefObj) { - return _regenerator2.default.wrap(function _callee$(_context) { + var _writeToStorage2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(prefObj) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: - localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj)); + localStorage.setItem("pdfjs.preferences", JSON.stringify(prefObj)); case 1: - case 'end': + case "end": return _context.stop(); } } - }, _callee, this); + }, _callee); })); function _writeToStorage(_x) { - return _ref.apply(this, arguments); + return _writeToStorage2.apply(this, arguments); } return _writeToStorage; }() }, { - key: '_readFromStorage', + key: "_readFromStorage", value: function () { - var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2(prefObj) { - return _regenerator2.default.wrap(function _callee2$(_context2) { + var _readFromStorage2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(prefObj) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: - return _context2.abrupt('return', JSON.parse(localStorage.getItem('pdfjs.preferences'))); + return _context2.abrupt("return", JSON.parse(localStorage.getItem("pdfjs.preferences"))); case 1: - case 'end': + case "end": return _context2.stop(); } } - }, _callee2, this); + }, _callee2); })); function _readFromStorage(_x2) { - return _ref2.apply(this, arguments); + return _readFromStorage2.apply(this, arguments); } return _readFromStorage; @@ -11776,24 +14509,43 @@ var GenericPreferences = function (_BasePreferences) { return GenericPreferences; }(_preferences.BasePreferences); -var GenericExternalServices = Object.create(_app.DefaultExternalServices); -GenericExternalServices.createDownloadManager = function (options) { - return new _download_manager.DownloadManager(options); -}; -GenericExternalServices.createPreferences = function () { - return new GenericPreferences(); -}; -GenericExternalServices.createL10n = function (_ref3) { - var _ref3$locale = _ref3.locale, - locale = _ref3$locale === undefined ? 'en-US' : _ref3$locale; +var GenericExternalServices = /*#__PURE__*/function (_DefaultExternalServi) { + _inherits(GenericExternalServices, _DefaultExternalServi); + + var _super2 = _createSuper(GenericExternalServices); + + function GenericExternalServices() { + _classCallCheck(this, GenericExternalServices); + + return _super2.apply(this, arguments); + } + + _createClass(GenericExternalServices, null, [{ + key: "createDownloadManager", + value: function createDownloadManager(options) { + return new _download_manager.DownloadManager(options); + } + }, { + key: "createPreferences", + value: function createPreferences() { + return new GenericPreferences(); + } + }, { + key: "createL10n", + value: function createL10n(_ref) { + var _ref$locale = _ref.locale, + locale = _ref$locale === void 0 ? "en-US" : _ref$locale; + return new _genericl10n.GenericL10n(locale); + } + }]); + + return GenericExternalServices; +}(_app.DefaultExternalServices); - return new _genericl10n.GenericL10n(locale); -}; _app.PDFViewerApplication.externalServices = GenericExternalServices; -exports.GenericCom = GenericCom; /***/ }), -/* 39 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11802,64 +14554,72 @@ exports.GenericCom = GenericCom; Object.defineProperty(exports, "__esModule", { value: true }); -exports.BasePreferences = undefined; +exports.BasePreferences = void 0; -var _regenerator = __webpack_require__(2); +var _regenerator = _interopRequireDefault(__webpack_require__(2)); -var _regenerator2 = _interopRequireDefault(_regenerator); +var _app_options = __webpack_require__(6); -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var defaultPreferences = null; + function getDefaultPreferences() { if (!defaultPreferences) { defaultPreferences = Promise.resolve({ - "showPreviousViewOnLoad": true, - "defaultZoomValue": "", - "sidebarViewOnLoad": 0, "cursorToolOnLoad": 0, + "defaultZoomValue": "", + "disablePageLabels": false, + "enablePermissions": false, + "enablePrintAutoRotate": false, "enableWebGL": false, - "eventBusDispatchToDOM": false, - "pdfBugEnabled": false, - "disableRange": false, - "disableStream": false, - "disableAutoFetch": false, - "disableFontFace": false, - "textLayerMode": 1, - "useOnlyCssZoom": false, "externalLinkTarget": 0, + "historyUpdateUrl": false, + "ignoreDestinationZoom": false, + "pdfBugEnabled": false, "renderer": "canvas", "renderInteractiveForms": false, - "enablePrintAutoRotate": false, - "disablePageMode": false, - "disablePageLabels": false, - "scrollModeOnLoad": 0, - "spreadModeOnLoad": 0 + "sidebarViewOnLoad": -1, + "scrollModeOnLoad": -1, + "spreadModeOnLoad": -1, + "textLayerMode": 1, + "useOnlyCssZoom": false, + "viewOnLoad": 0, + "disableAutoFetch": false, + "disableFontFace": false, + "disableRange": false, + "disableStream": false }); } + return defaultPreferences; } -var BasePreferences = function () { +var BasePreferences = /*#__PURE__*/function () { function BasePreferences() { var _this = this; _classCallCheck(this, BasePreferences); if (this.constructor === BasePreferences) { - throw new Error('Cannot initialize BasePreferences.'); + throw new Error("Cannot initialize BasePreferences."); } + this.prefs = null; this._initializedPromise = getDefaultPreferences().then(function (defaults) { - Object.defineProperty(_this, 'defaults', { + Object.defineProperty(_this, "defaults", { value: Object.freeze(defaults), writable: false, enumerable: true, @@ -11871,12 +14631,15 @@ var BasePreferences = function () { if (!prefs) { return; } + for (var name in prefs) { var defaultValue = _this.defaults[name], prefValue = prefs[name]; - if (defaultValue === undefined || (typeof prefValue === "undefined" ? "undefined" : _typeof(prefValue)) !== (typeof defaultValue === "undefined" ? "undefined" : _typeof(defaultValue))) { + + if (defaultValue === undefined || _typeof(prefValue) !== _typeof(defaultValue)) { continue; } + _this.prefs[name] = prefValue; } }); @@ -11885,23 +14648,23 @@ var BasePreferences = function () { _createClass(BasePreferences, [{ key: "_writeToStorage", value: function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(prefObj) { - return _regenerator2.default.wrap(function _callee$(_context) { + var _writeToStorage2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(prefObj) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: - throw new Error('Not implemented: _writeToStorage'); + throw new Error("Not implemented: _writeToStorage"); case 1: case "end": return _context.stop(); } } - }, _callee, this); + }, _callee); })); function _writeToStorage(_x) { - return _ref.apply(this, arguments); + return _writeToStorage2.apply(this, arguments); } return _writeToStorage; @@ -11909,23 +14672,23 @@ var BasePreferences = function () { }, { key: "_readFromStorage", value: function () { - var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2(prefObj) { - return _regenerator2.default.wrap(function _callee2$(_context2) { + var _readFromStorage2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(prefObj) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: - throw new Error('Not implemented: _readFromStorage'); + throw new Error("Not implemented: _readFromStorage"); case 1: case "end": return _context2.stop(); } } - }, _callee2, this); + }, _callee2); })); function _readFromStorage(_x2) { - return _ref2.apply(this, arguments); + return _readFromStorage2.apply(this, arguments); } return _readFromStorage; @@ -11933,8 +14696,8 @@ var BasePreferences = function () { }, { key: "reset", value: function () { - var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee3() { - return _regenerator2.default.wrap(function _callee3$(_context3) { + var _reset = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -11954,7 +14717,7 @@ var BasePreferences = function () { })); function reset() { - return _ref3.apply(this, arguments); + return _reset.apply(this, arguments); } return reset; @@ -11962,9 +14725,9 @@ var BasePreferences = function () { }, { key: "set", value: function () { - var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee4(name, value) { + var _set = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(name, value) { var defaultValue, valueType, defaultType; - return _regenerator2.default.wrap(function _callee4$(_context4) { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: @@ -11979,7 +14742,7 @@ var BasePreferences = function () { break; } - throw new Error("Set preference: \"" + name + "\" is undefined."); + throw new Error("Set preference: \"".concat(name, "\" is undefined.")); case 7: if (!(value === undefined)) { @@ -11987,18 +14750,18 @@ var BasePreferences = function () { break; } - throw new Error('Set preference: no value is specified.'); + throw new Error("Set preference: no value is specified."); case 9: - valueType = typeof value === "undefined" ? "undefined" : _typeof(value); - defaultType = typeof defaultValue === "undefined" ? "undefined" : _typeof(defaultValue); + valueType = _typeof(value); + defaultType = _typeof(defaultValue); if (!(valueType !== defaultType)) { _context4.next = 19; break; } - if (!(valueType === 'number' && defaultType === 'string')) { + if (!(valueType === "number" && defaultType === "string")) { _context4.next = 16; break; } @@ -12008,19 +14771,19 @@ var BasePreferences = function () { break; case 16: - throw new Error("Set preference: \"" + value + "\" is a " + valueType + ", " + ("expected a " + defaultType + ".")); + throw new Error("Set preference: \"".concat(value, "\" is a ").concat(valueType, ", ") + "expected a ".concat(defaultType, ".")); case 17: _context4.next = 21; break; case 19: - if (!(valueType === 'number' && !Number.isInteger(value))) { + if (!(valueType === "number" && !Number.isInteger(value))) { _context4.next = 21; break; } - throw new Error("Set preference: \"" + value + "\" must be an integer."); + throw new Error("Set preference: \"".concat(value, "\" must be an integer.")); case 21: this.prefs[name] = value; @@ -12035,7 +14798,7 @@ var BasePreferences = function () { })); function set(_x3, _x4) { - return _ref4.apply(this, arguments); + return _set.apply(this, arguments); } return set; @@ -12043,9 +14806,9 @@ var BasePreferences = function () { }, { key: "get", value: function () { - var _ref5 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee5(name) { + var _get = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee5(name) { var defaultValue, prefValue; - return _regenerator2.default.wrap(function _callee5$(_context5) { + return _regenerator["default"].wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: @@ -12060,7 +14823,7 @@ var BasePreferences = function () { break; } - throw new Error("Get preference: \"" + name + "\" is undefined."); + throw new Error("Get preference: \"".concat(name, "\" is undefined.")); case 7: prefValue = this.prefs[name]; @@ -12084,7 +14847,7 @@ var BasePreferences = function () { })); function get(_x5) { - return _ref5.apply(this, arguments); + return _get.apply(this, arguments); } return get; @@ -12092,8 +14855,8 @@ var BasePreferences = function () { }, { key: "getAll", value: function () { - var _ref6 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee6() { - return _regenerator2.default.wrap(function _callee6$(_context6) { + var _getAll = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee6() { + return _regenerator["default"].wrap(function _callee6$(_context6) { while (1) { switch (_context6.prev = _context6.next) { case 0: @@ -12112,7 +14875,7 @@ var BasePreferences = function () { })); function getAll() { - return _ref6.apply(this, arguments); + return _getAll.apply(this, arguments); } return getAll; @@ -12125,7 +14888,7 @@ var BasePreferences = function () { exports.BasePreferences = BasePreferences; /***/ }), -/* 40 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12134,35 +14897,44 @@ exports.BasePreferences = BasePreferences; Object.defineProperty(exports, "__esModule", { value: true }); -exports.DownloadManager = undefined; +exports.DownloadManager = void 0; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _pdfjsLib = __webpack_require__(8); -var _pdfjsLib = __webpack_require__(7); +var _viewer_compatibility = __webpack_require__(7); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + ; -var DISABLE_CREATE_OBJECT_URL = _pdfjsLib.apiCompatibilityParams.disableCreateObjectURL || false; +var DISABLE_CREATE_OBJECT_URL = _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL || false; + function _download(blobUrl, filename) { - var a = document.createElement('a'); + var a = document.createElement("a"); + if (!a.click) { throw new Error('DownloadManager: "a.click()" is not supported.'); } + a.href = blobUrl; - a.target = '_parent'; - if ('download' in a) { + a.target = "_parent"; + + if ("download" in a) { a.download = filename; } + (document.body || document.documentElement).appendChild(a); a.click(); a.remove(); } -var DownloadManager = function () { +var DownloadManager = /*#__PURE__*/function () { function DownloadManager(_ref) { var _ref$disableCreateObj = _ref.disableCreateObjectURL, - disableCreateObjectURL = _ref$disableCreateObj === undefined ? DISABLE_CREATE_OBJECT_URL : _ref$disableCreateObj; + disableCreateObjectURL = _ref$disableCreateObj === void 0 ? DISABLE_CREATE_OBJECT_URL : _ref$disableCreateObj; _classCallCheck(this, DownloadManager); @@ -12170,36 +14942,46 @@ var DownloadManager = function () { } _createClass(DownloadManager, [{ - key: 'downloadUrl', + key: "downloadUrl", value: function downloadUrl(url, filename) { - if (!(0, _pdfjsLib.createValidAbsoluteUrl)(url, 'http://example.com')) { + if (!(0, _pdfjsLib.createValidAbsoluteUrl)(url, "http://example.com")) { return; } - _download(url + '#pdfjs.action=download', filename); + + _download(url + "#pdfjs.action=download", filename); } }, { - key: 'downloadData', + key: "downloadData", value: function downloadData(data, filename, contentType) { if (navigator.msSaveBlob) { - return navigator.msSaveBlob(new Blob([data], { type: contentType }), filename); + navigator.msSaveBlob(new Blob([data], { + type: contentType + }), filename); + return; } + var blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, this.disableCreateObjectURL); + _download(blobUrl, filename); } }, { - key: 'download', + key: "download", value: function download(blob, url, filename) { if (navigator.msSaveBlob) { if (!navigator.msSaveBlob(blob, filename)) { this.downloadUrl(url, filename); } + return; } + if (this.disableCreateObjectURL) { this.downloadUrl(url, filename); return; } - var blobUrl = _pdfjsLib.URL.createObjectURL(blob); + + var blobUrl = URL.createObjectURL(blob); + _download(blobUrl, filename); } }]); @@ -12210,7 +14992,7 @@ var DownloadManager = function () { exports.DownloadManager = DownloadManager; /***/ }), -/* 41 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12219,25 +15001,27 @@ exports.DownloadManager = DownloadManager; Object.defineProperty(exports, "__esModule", { value: true }); -exports.GenericL10n = undefined; - -var _regenerator = __webpack_require__(2); +exports.GenericL10n = void 0; -var _regenerator2 = _interopRequireDefault(_regenerator); +var _regenerator = _interopRequireDefault(__webpack_require__(2)); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +__webpack_require__(40); -__webpack_require__(42); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var webL10n = document.webL10n; -var GenericL10n = function () { +var GenericL10n = /*#__PURE__*/function () { function GenericL10n(lang) { _classCallCheck(this, GenericL10n); @@ -12250,11 +15034,11 @@ var GenericL10n = function () { } _createClass(GenericL10n, [{ - key: 'getLanguage', + key: "getLanguage", value: function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { + var _getLanguage = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() { var l10n; - return _regenerator2.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -12263,10 +15047,10 @@ var GenericL10n = function () { case 2: l10n = _context.sent; - return _context.abrupt('return', l10n.getLanguage()); + return _context.abrupt("return", l10n.getLanguage()); case 4: - case 'end': + case "end": return _context.stop(); } } @@ -12274,17 +15058,17 @@ var GenericL10n = function () { })); function getLanguage() { - return _ref.apply(this, arguments); + return _getLanguage.apply(this, arguments); } return getLanguage; }() }, { - key: 'getDirection', + key: "getDirection", value: function () { - var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() { + var _getDirection = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() { var l10n; - return _regenerator2.default.wrap(function _callee2$(_context2) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -12293,10 +15077,10 @@ var GenericL10n = function () { case 2: l10n = _context2.sent; - return _context2.abrupt('return', l10n.getDirection()); + return _context2.abrupt("return", l10n.getDirection()); case 4: - case 'end': + case "end": return _context2.stop(); } } @@ -12304,17 +15088,17 @@ var GenericL10n = function () { })); function getDirection() { - return _ref2.apply(this, arguments); + return _getDirection.apply(this, arguments); } return getDirection; }() }, { - key: 'get', + key: "get", value: function () { - var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee3(property, args, fallback) { + var _get = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(property, args, fallback) { var l10n; - return _regenerator2.default.wrap(function _callee3$(_context3) { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -12323,10 +15107,10 @@ var GenericL10n = function () { case 2: l10n = _context3.sent; - return _context3.abrupt('return', l10n.get(property, args, fallback)); + return _context3.abrupt("return", l10n.get(property, args, fallback)); case 4: - case 'end': + case "end": return _context3.stop(); } } @@ -12334,17 +15118,17 @@ var GenericL10n = function () { })); function get(_x, _x2, _x3) { - return _ref3.apply(this, arguments); + return _get.apply(this, arguments); } return get; }() }, { - key: 'translate', + key: "translate", value: function () { - var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee4(element) { + var _translate = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(element) { var l10n; - return _regenerator2.default.wrap(function _callee4$(_context4) { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: @@ -12353,10 +15137,10 @@ var GenericL10n = function () { case 2: l10n = _context4.sent; - return _context4.abrupt('return', l10n.translate(element)); + return _context4.abrupt("return", l10n.translate(element)); case 4: - case 'end': + case "end": return _context4.stop(); } } @@ -12364,7 +15148,7 @@ var GenericL10n = function () { })); function translate(_x4) { - return _ref4.apply(this, arguments); + return _translate.apply(this, arguments); } return translate; @@ -12377,7 +15161,7 @@ var GenericL10n = function () { exports.GenericL10n = GenericL10n; /***/ }), -/* 42 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12391,21 +15175,26 @@ document.webL10n = function (window, document, undefined) { var gMacros = {}; var gReadyState = 'loading'; var gAsyncResourceLoading = true; + function getL10nResourceLinks() { return document.querySelectorAll('link[type="application/l10n"]'); } + function getL10nDictionary() { var script = document.querySelector('script[type="application/l10n"]'); return script ? JSON.parse(script.innerHTML) : null; } + function getTranslatableChildren(element) { return element ? element.querySelectorAll('*[data-l10n-id]') : []; } + function getL10nAttributes(element) { if (!element) return {}; var l10nId = element.getAttribute('data-l10n-id'); var l10nArgs = element.getAttribute('data-l10n-args'); var args = {}; + if (l10nArgs) { try { args = JSON.parse(l10nArgs); @@ -12413,25 +15202,25 @@ document.webL10n = function (window, document, undefined) { console.warn('could not parse arguments for #' + l10nId); } } + return { id: l10nId, args: args }; } - function fireL10nReadyEvent(lang) { - var evtObject = document.createEvent('Event'); - evtObject.initEvent('localized', true, false); - evtObject.language = lang; - document.dispatchEvent(evtObject); - } + function xhrLoadText(url, onSuccess, onFailure) { onSuccess = onSuccess || function _onSuccess(data) {}; + onFailure = onFailure || function _onFailure() {}; + var xhr = new XMLHttpRequest(); xhr.open('GET', url, gAsyncResourceLoading); + if (xhr.overrideMimeType) { xhr.overrideMimeType('text/plain; charset=utf-8'); } + xhr.onreadystatechange = function () { if (xhr.readyState == 4) { if (xhr.status == 200 || xhr.status === 0) { @@ -12441,20 +15230,25 @@ document.webL10n = function (window, document, undefined) { } } }; + xhr.onerror = onFailure; xhr.ontimeout = onFailure; + try { xhr.send(null); } catch (e) { onFailure(); } } + function parseResource(href, lang, successCallback, failureCallback) { var baseURL = href.replace(/[^\/]*$/, '') || './'; + function evalString(text) { if (text.lastIndexOf('\\') < 0) return text; return text.replace(/\\\\/g, '\\').replace(/\\n/g, '\n').replace(/\\r/g, '\r').replace(/\\t/g, '\t').replace(/\\b/g, '\b').replace(/\\f/g, '\f').replace(/\\{/g, '{').replace(/\\}/g, '}').replace(/\\"/g, '"').replace(/\\'/g, "'"); } + function parseProperties(text, parsedPropertiesCallback) { var dictionary = {}; var reBlank = /^\s*|\s*$/; @@ -12462,22 +15256,27 @@ document.webL10n = function (window, document, undefined) { var reSection = /^\s*\[(.*)\]\s*$/; var reImport = /^\s*@import\s+url\((.*)\)\s*$/i; var reSplit = /^([^=\s]*)\s*=\s*(.+)$/; + function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) { var entries = rawText.replace(reBlank, '').split(/[\r\n]+/); var currentLang = '*'; var genericLang = lang.split('-', 1)[0]; var skipLang = false; var match = ''; + function nextEntry() { while (true) { if (!entries.length) { parsedRawLinesCallback(); return; } + var line = entries.shift(); if (reComment.test(line)) continue; + if (extendedSyntax) { match = reSection.exec(line); + if (match) { currentLang = match[1].toLowerCase(); skipLang = currentLang !== '*' && currentLang !== lang && currentLang !== genericLang; @@ -12485,20 +15284,26 @@ document.webL10n = function (window, document, undefined) { } else if (skipLang) { continue; } + match = reImport.exec(line); + if (match) { loadImport(baseURL + match[1], nextEntry); return; } } + var tmp = line.match(reSplit); + if (tmp && tmp.length == 3) { dictionary[tmp[1]] = evalString(tmp[2]); } } } + nextEntry(); } + function loadImport(url, callback) { xhrLoadText(url, function (content) { parseRawLines(content, false, callback); @@ -12507,10 +15312,12 @@ document.webL10n = function (window, document, undefined) { callback(); }); } + parseRawLines(text, true, function () { parsedPropertiesCallback(dictionary); }); } + xhrLoadText(href, function (response) { gTextData += response; parseProperties(response, function (data) { @@ -12518,6 +15325,7 @@ document.webL10n = function (window, document, undefined) { var id, prop, index = key.lastIndexOf('.'); + if (index > 0) { id = key.substring(0, index); prop = key.substring(index + 1); @@ -12525,35 +15333,46 @@ document.webL10n = function (window, document, undefined) { id = key; prop = gTextProp; } + if (!gL10nData[id]) { gL10nData[id] = {}; } + gL10nData[id][prop] = data[key]; } + if (successCallback) { successCallback(); } }); }, failureCallback); } + function loadLocale(lang, callback) { if (lang) { lang = lang.toLowerCase(); } + callback = callback || function _callback() {}; + clear(); gLanguage = lang; var langLinks = getL10nResourceLinks(); var langCount = langLinks.length; + if (langCount === 0) { var dict = getL10nDictionary(); + if (dict && dict.locales && dict.default_locale) { console.log('using the embedded JSON directory, early way out'); gL10nData = dict.locales[lang]; + if (!gL10nData) { var defaultLocale = dict.default_locale.toLowerCase(); + for (var anyCaseLang in dict.locales) { anyCaseLang = anyCaseLang.toLowerCase(); + if (anyCaseLang === lang) { gL10nData = dict.locales[lang]; break; @@ -12562,26 +15381,31 @@ document.webL10n = function (window, document, undefined) { } } } + callback(); } else { console.log('no resource to load, early way out'); } - fireL10nReadyEvent(lang); + gReadyState = 'complete'; return; } + var onResourceLoaded = null; var gResourceCount = 0; + onResourceLoaded = function onResourceLoaded() { gResourceCount++; + if (gResourceCount >= langCount) { callback(); - fireL10nReadyEvent(lang); gReadyState = 'complete'; } }; + function L10nResourceLink(link) { var href = link.href; + this.load = function (lang, callback) { parseResource(href, lang, callback, function () { console.warn(href + ' not found.'); @@ -12591,16 +15415,19 @@ document.webL10n = function (window, document, undefined) { }); }; } + for (var i = 0; i < langCount; i++) { var resource = new L10nResourceLink(langLinks[i]); resource.load(lang, onResourceLoaded); } } + function clear() { gL10nData = {}; gTextData = ''; gLanguage = ''; } + function getPluralRules(lang) { var locales2rules = { 'af': 3, @@ -12774,12 +15601,15 @@ document.webL10n = function (window, document, undefined) { 'zh': 0, 'zu': 3 }; + function isIn(n, list) { return list.indexOf(n) !== -1; } + function isBetween(n, start, end) { return start <= n && n <= end; } + var pluralRules = { '0': function _(n) { return 'other'; @@ -12916,22 +15746,28 @@ document.webL10n = function (window, document, undefined) { } }; var index = locales2rules[lang.replace(/-.*$/, '')]; + if (!(index in pluralRules)) { console.warn('plural form unknown for [' + lang + ']'); return function () { return 'other'; }; } + return pluralRules[index]; } + gMacros.plural = function (str, param, key, prop) { var n = parseFloat(param); if (isNaN(n)) return str; if (prop != gTextProp) return str; + if (!gMacros._pluralRules) { gMacros._pluralRules = getPluralRules(gLanguage); } + var index = '[' + gMacros._pluralRules(n) + ']'; + if (n === 0 && key + '[zero]' in gL10nData) { str = gL10nData[key + '[zero]'][prop]; } else if (n == 1 && key + '[one]' in gL10nData) { @@ -12943,26 +15779,35 @@ document.webL10n = function (window, document, undefined) { } else if (key + '[other]' in gL10nData) { str = gL10nData[key + '[other]'][prop]; } + return str; }; + function getL10nData(key, args, fallback) { var data = gL10nData[key]; + if (!data) { console.warn('#' + key + ' is undefined.'); + if (!fallback) { return null; } + data = fallback; } + var rv = {}; + for (var prop in data) { var str = data[prop]; str = substIndexes(str, args, key, prop); str = substArguments(str, args, key); rv[prop] = str; } + return rv; } + function substIndexes(str, args, key, prop) { var reIndex = /\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/; var reMatch = reIndex.exec(str); @@ -12970,44 +15815,54 @@ document.webL10n = function (window, document, undefined) { var macroName = reMatch[1]; var paramName = reMatch[2]; var param; + if (args && paramName in args) { param = args[paramName]; } else if (paramName in gL10nData) { param = gL10nData[paramName]; } + if (macroName in gMacros) { var macro = gMacros[macroName]; str = macro(str, param, key, prop); } + return str; } + function substArguments(str, args, key) { var reArgs = /\{\{\s*(.+?)\s*\}\}/g; return str.replace(reArgs, function (matched_text, arg) { if (args && arg in args) { return args[arg]; } + if (arg in gL10nData) { return gL10nData[arg]; } + console.log('argument {{' + arg + '}} for #' + key + ' is undefined.'); return matched_text; }); } + function translateElement(element) { var l10n = getL10nAttributes(element); if (!l10n.id) return; var data = getL10nData(l10n.id, l10n.args); + if (!data) { console.warn('#' + l10n.id + ' is undefined.'); return; } + if (data[gTextProp]) { if (getChildElementCount(element) === 0) { element[gTextProp] = data[gTextProp]; } else { var children = element.childNodes; var found = false; + for (var i = 0, l = children.length; i < l; i++) { if (children[i].nodeType === 3 && /\S/.test(children[i].nodeValue)) { if (found) { @@ -13018,56 +15873,74 @@ document.webL10n = function (window, document, undefined) { } } } + if (!found) { var textNode = document.createTextNode(data[gTextProp]); element.insertBefore(textNode, element.firstChild); } } + delete data[gTextProp]; } + for (var k in data) { element[k] = data[k]; } } + function getChildElementCount(element) { if (element.children) { return element.children.length; } + if (typeof element.childElementCount !== 'undefined') { return element.childElementCount; } + var count = 0; + for (var i = 0; i < element.childNodes.length; i++) { count += element.nodeType === 1 ? 1 : 0; } + return count; } + function translateFragment(element) { element = element || document.documentElement; var children = getTranslatableChildren(element); var elementCount = children.length; + for (var i = 0; i < elementCount; i++) { translateElement(children[i]); } + translateElement(element); } + return { get: function get(key, args, fallbackString) { var index = key.lastIndexOf('.'); var prop = gTextProp; + if (index > 0) { prop = key.substring(index + 1); key = key.substring(0, index); } + var fallback; + if (fallbackString) { fallback = {}; fallback[prop] = fallbackString; } + var data = getL10nData(key, args, fallback); + if (data && prop in data) { return data[prop]; } + return '{{' + key + '}}'; }, getData: function getData() { @@ -13111,7 +15984,7 @@ document.webL10n = function (window, document, undefined) { }(window, document); /***/ }), -/* 43 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13120,35 +15993,39 @@ document.webL10n = function (window, document, undefined) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFPrintService = undefined; +exports.PDFPrintService = PDFPrintService; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); var _app = __webpack_require__(1); -var _pdfjsLib = __webpack_require__(7); +var _app_options = __webpack_require__(6); var activeService = null; var overlayManager = null; + function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) { var scratchCanvas = activeService.scratchCanvas; - var PRINT_RESOLUTION = 150; + var PRINT_RESOLUTION = _app_options.AppOptions.get("printResolution") || 150; var PRINT_UNITS = PRINT_RESOLUTION / 72.0; scratchCanvas.width = Math.floor(size.width * PRINT_UNITS); scratchCanvas.height = Math.floor(size.height * PRINT_UNITS); - var width = Math.floor(size.width * _ui_utils.CSS_UNITS) + 'px'; - var height = Math.floor(size.height * _ui_utils.CSS_UNITS) + 'px'; - var ctx = scratchCanvas.getContext('2d'); + var width = Math.floor(size.width * _ui_utils.CSS_UNITS) + "px"; + var height = Math.floor(size.height * _ui_utils.CSS_UNITS) + "px"; + var ctx = scratchCanvas.getContext("2d"); ctx.save(); - ctx.fillStyle = 'rgb(255, 255, 255)'; + ctx.fillStyle = "rgb(255, 255, 255)"; ctx.fillRect(0, 0, scratchCanvas.width, scratchCanvas.height); ctx.restore(); return pdfDocument.getPage(pageNumber).then(function (pdfPage) { var renderContext = { canvasContext: ctx, transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0], - viewport: pdfPage.getViewport(1, size.rotation), - intent: 'print' + viewport: pdfPage.getViewport({ + scale: 1, + rotation: size.rotation + }), + intent: "print" }; return pdfPage.render(renderContext).promise; }).then(function () { @@ -13158,83 +16035,99 @@ function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) { }; }); } + function PDFPrintService(pdfDocument, pagesOverview, printContainer, l10n) { this.pdfDocument = pdfDocument; this.pagesOverview = pagesOverview; this.printContainer = printContainer; this.l10n = l10n || _ui_utils.NullL10n; - this.disableCreateObjectURL = pdfDocument.loadingParams['disableCreateObjectURL']; + this.disableCreateObjectURL = _app_options.AppOptions.get("disableCreateObjectURL"); this.currentPage = -1; - this.scratchCanvas = document.createElement('canvas'); + this.scratchCanvas = document.createElement("canvas"); } + PDFPrintService.prototype = { layout: function layout() { this.throwIfInactive(); - var body = document.querySelector('body'); - body.setAttribute('data-pdfjsprinting', true); + var body = document.querySelector("body"); + body.setAttribute("data-pdfjsprinting", true); var hasEqualPageSizes = this.pagesOverview.every(function (size) { return size.width === this.pagesOverview[0].width && size.height === this.pagesOverview[0].height; }, this); + if (!hasEqualPageSizes) { - console.warn('Not all pages have the same size. The printed ' + 'result may be incorrect!'); + console.warn("Not all pages have the same size. The printed " + "result may be incorrect!"); } - this.pageStyleSheet = document.createElement('style'); + + this.pageStyleSheet = document.createElement("style"); var pageSize = this.pagesOverview[0]; - this.pageStyleSheet.textContent = '@supports ((size:A4) and (size:1pt 1pt)) {' + '@page { size: ' + pageSize.width + 'pt ' + pageSize.height + 'pt;}' + '}'; + this.pageStyleSheet.textContent = "@supports ((size:A4) and (size:1pt 1pt)) {" + "@page { size: " + pageSize.width + "pt " + pageSize.height + "pt;}" + "}"; body.appendChild(this.pageStyleSheet); }, destroy: function destroy() { if (activeService !== this) { return; } - this.printContainer.textContent = ''; + + this.printContainer.textContent = ""; + var body = document.querySelector("body"); + body.removeAttribute("data-pdfjsprinting"); + if (this.pageStyleSheet) { this.pageStyleSheet.remove(); this.pageStyleSheet = null; } + this.scratchCanvas.width = this.scratchCanvas.height = 0; this.scratchCanvas = null; activeService = null; ensureOverlay().then(function () { - if (overlayManager.active !== 'printServiceOverlay') { + if (overlayManager.active !== "printServiceOverlay") { return; } - overlayManager.close('printServiceOverlay'); + + overlayManager.close("printServiceOverlay"); }); }, renderPages: function renderPages() { var _this = this; var pageCount = this.pagesOverview.length; + var renderNextPage = function renderNextPage(resolve, reject) { _this.throwIfInactive(); + if (++_this.currentPage >= pageCount) { renderProgress(pageCount, pageCount, _this.l10n); resolve(); return; } + var index = _this.currentPage; renderProgress(index, pageCount, _this.l10n); renderPage(_this, _this.pdfDocument, index + 1, _this.pagesOverview[index]).then(_this.useRenderedPage.bind(_this)).then(function () { renderNextPage(resolve, reject); }, reject); }; + return new Promise(renderNextPage); }, useRenderedPage: function useRenderedPage(printItem) { this.throwIfInactive(); - var img = document.createElement('img'); + var img = document.createElement("img"); img.style.width = printItem.width; img.style.height = printItem.height; var scratchCanvas = this.scratchCanvas; - if ('toBlob' in scratchCanvas && !this.disableCreateObjectURL) { + + if ("toBlob" in scratchCanvas && !this.disableCreateObjectURL) { scratchCanvas.toBlob(function (blob) { - img.src = _pdfjsLib.URL.createObjectURL(blob); + img.src = URL.createObjectURL(blob); }); } else { img.src = scratchCanvas.toDataURL(); } - var wrapper = document.createElement('div'); + + var wrapper = document.createElement("div"); wrapper.appendChild(img); this.printContainer.appendChild(wrapper); return new Promise(function (resolve, reject) { @@ -13252,6 +16145,7 @@ PDFPrintService.prototype = { resolve(); return; } + print.call(window); setTimeout(resolve, 20); }, 0); @@ -13261,123 +16155,129 @@ PDFPrintService.prototype = { get active() { return this === activeService; }, + throwIfInactive: function throwIfInactive() { if (!this.active) { - throw new Error('This print request was cancelled or completed.'); + throw new Error("This print request was cancelled or completed."); } } }; var print = window.print; -window.print = function print() { + +window.print = function () { if (activeService) { - console.warn('Ignored window.print() because of a pending print job.'); + console.warn("Ignored window.print() because of a pending print job."); return; } + ensureOverlay().then(function () { if (activeService) { - overlayManager.open('printServiceOverlay'); + overlayManager.open("printServiceOverlay"); } }); + try { - dispatchEvent('beforeprint'); + dispatchEvent("beforeprint"); } finally { if (!activeService) { - console.error('Expected print service to be initialized.'); + console.error("Expected print service to be initialized."); ensureOverlay().then(function () { - if (overlayManager.active === 'printServiceOverlay') { - overlayManager.close('printServiceOverlay'); + if (overlayManager.active === "printServiceOverlay") { + overlayManager.close("printServiceOverlay"); } }); return; } + var activeServiceOnEntry = activeService; activeService.renderPages().then(function () { return activeServiceOnEntry.performPrint(); - }).catch(function () {}).then(function () { + })["catch"](function () {}).then(function () { if (activeServiceOnEntry.active) { abort(); } }); } }; + function dispatchEvent(eventType) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent(eventType, false, false, 'custom'); + var event = document.createEvent("CustomEvent"); + event.initCustomEvent(eventType, false, false, "custom"); window.dispatchEvent(event); } + function abort() { if (activeService) { activeService.destroy(); - dispatchEvent('afterprint'); + dispatchEvent("afterprint"); } } + function renderProgress(index, total, l10n) { - var progressContainer = document.getElementById('printServiceOverlay'); + var progressContainer = document.getElementById("printServiceOverlay"); var progress = Math.round(100 * index / total); - var progressBar = progressContainer.querySelector('progress'); - var progressPerc = progressContainer.querySelector('.relative-progress'); + var progressBar = progressContainer.querySelector("progress"); + var progressPerc = progressContainer.querySelector(".relative-progress"); progressBar.value = progress; - l10n.get('print_progress_percent', { progress: progress }, progress + '%').then(function (msg) { + l10n.get("print_progress_percent", { + progress: progress + }, progress + "%").then(function (msg) { progressPerc.textContent = msg; }); } -var hasAttachEvent = !!document.attachEvent; -window.addEventListener('keydown', function (event) { + +window.addEventListener("keydown", function (event) { if (event.keyCode === 80 && (event.ctrlKey || event.metaKey) && !event.altKey && (!event.shiftKey || window.chrome || window.opera)) { window.print(); - if (hasAttachEvent) { - return; - } event.preventDefault(); + if (event.stopImmediatePropagation) { event.stopImmediatePropagation(); } else { event.stopPropagation(); } - return; } }, true); -if (hasAttachEvent) { - document.attachEvent('onkeydown', function (event) { - event = event || window.event; - if (event.keyCode === 80 && event.ctrlKey) { - event.keyCode = 0; - return false; - } - }); -} -if ('onbeforeprint' in window) { + +if ("onbeforeprint" in window) { var stopPropagationIfNeeded = function stopPropagationIfNeeded(event) { - if (event.detail !== 'custom' && event.stopImmediatePropagation) { + if (event.detail !== "custom" && event.stopImmediatePropagation) { event.stopImmediatePropagation(); } }; - window.addEventListener('beforeprint', stopPropagationIfNeeded); - window.addEventListener('afterprint', stopPropagationIfNeeded); + + window.addEventListener("beforeprint", stopPropagationIfNeeded); + window.addEventListener("afterprint", stopPropagationIfNeeded); } -var overlayPromise = void 0; + +var overlayPromise; + function ensureOverlay() { if (!overlayPromise) { overlayManager = _app.PDFViewerApplication.overlayManager; + if (!overlayManager) { - throw new Error('The overlay manager has not yet been initialized.'); + throw new Error("The overlay manager has not yet been initialized."); } - overlayPromise = overlayManager.register('printServiceOverlay', document.getElementById('printServiceOverlay'), abort, true); - document.getElementById('printCancel').onclick = abort; + + overlayPromise = overlayManager.register("printServiceOverlay", document.getElementById("printServiceOverlay"), abort, true); + document.getElementById("printCancel").onclick = abort; } + return overlayPromise; } + _app.PDFPrintServiceFactory.instance = { supportsPrinting: true, createPrintService: function createPrintService(pdfDocument, pagesOverview, printContainer, l10n) { if (activeService) { - throw new Error('The print service is created and active.'); + throw new Error("The print service is created and active."); } + activeService = new PDFPrintService(pdfDocument, pagesOverview, printContainer, l10n); return activeService; } }; -exports.PDFPrintService = PDFPrintService; /***/ }) /******/ ]); diff --git a/docs/_static/pdfview/viewer.js.map b/docs/_static/pdfview/viewer.js.map index 1a3fd208..79d8de24 100644 --- a/docs/_static/pdfview/viewer.js.map +++ b/docs/_static/pdfview/viewer.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///web/viewer.js","webpack:///web/app.js","webpack:///node_modules/babel-runtime/regenerator/index.js","webpack:///node_modules/regenerator-runtime/runtime-module.js","webpack:///node_modules/regenerator-runtime/runtime.js","webpack:///node_modules/webpack/buildin/module.js","webpack:///web/ui_utils.js","webpack:///web/pdfjs.js","webpack:///web/pdf_cursor_tools.js","webpack:///web/grab_to_pan.js","webpack:///web/pdf_rendering_queue.js","webpack:///web/pdf_sidebar.js","webpack:///web/app_options.js","webpack:///web/viewer_compatibility.js","webpack:///web/dom_events.js","webpack:///web/overlay_manager.js","webpack:///web/password_prompt.js","webpack:///web/pdf_attachment_viewer.js","webpack:///web/pdf_document_properties.js","webpack:///web/pdf_find_bar.js","webpack:///web/pdf_find_controller.js","webpack:///web/pdf_find_utils.js","webpack:///web/pdf_history.js","webpack:///web/pdf_link_service.js","webpack:///web/pdf_outline_viewer.js","webpack:///web/pdf_presentation_mode.js","webpack:///web/pdf_sidebar_resizer.js","webpack:///web/pdf_thumbnail_viewer.js","webpack:///web/pdf_thumbnail_view.js","webpack:///web/pdf_viewer.js","webpack:///web/base_viewer.js","webpack:///web/annotation_layer_builder.js","webpack:///web/pdf_page_view.js","webpack:///web/text_layer_builder.js","webpack:///web/secondary_toolbar.js","webpack:///web/pdf_single_page_viewer.js","webpack:///web/toolbar.js","webpack:///web/view_history.js","webpack:///web/genericcom.js","webpack:///web/preferences.js","webpack:///web/download_manager.js","webpack:///web/genericl10n.js","webpack:///external/webL10n/l10n.js","webpack:///web/pdf_print_service.js"],"names":["pdfjsWebApp","require","pdfjsWebAppOptions","appContainer","document","mainContainer","viewerContainer","eventBus","toolbar","container","numPages","pageNumber","scaleSelectContainer","scaleSelect","customScaleOption","previous","next","zoomIn","zoomOut","viewFind","openFile","print","presentationModeButton","download","viewBookmark","secondaryToolbar","toggleButton","toolbarButtonContainer","openFileButton","printButton","downloadButton","viewBookmarkButton","firstPageButton","lastPageButton","pageRotateCwButton","pageRotateCcwButton","cursorSelectToolButton","cursorHandToolButton","scrollVerticalButton","scrollHorizontalButton","scrollWrappedButton","spreadNoneButton","spreadOddButton","spreadEvenButton","documentPropertiesButton","fullscreen","contextFirstPage","contextLastPage","contextPageRotateCw","contextPageRotateCcw","sidebar","outerContainer","thumbnailButton","outlineButton","attachmentsButton","thumbnailView","outlineView","attachmentsView","sidebarResizer","resizer","findBar","bar","findField","highlightAllCheckbox","caseSensitiveCheckbox","entireWordCheckbox","findMsg","findResultsCount","findPreviousButton","findNextButton","passwordOverlay","overlayName","label","input","submitButton","cancelButton","documentProperties","closeButton","fields","errorWrapper","errorMessage","errorMoreInfo","moreInfoButton","lessInfoButton","printContainer","openFileInputName","debuggerScriptPath","config","window","DEFAULT_SCALE_DELTA","DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT","FORCE_PAGES_LOADED_TIMEOUT","DefaultExternalServices","updateFindControlState","updateFindMatchesCount","initPassiveLoading","fallback","reportTelemetry","createDownloadManager","createPreferences","createL10n","supportsIntegratedFind","supportsDocumentFonts","supportsDocumentColors","supportedMouseWheelZoomModifierKeys","ctrlKey","metaKey","PDFViewerApplication","initialBookmark","initialized","fellback","appConfig","pdfDocument","pdfLoadingTask","printService","pdfViewer","pdfThumbnailViewer","pdfRenderingQueue","pdfPresentationMode","pdfDocumentProperties","pdfLinkService","pdfHistory","pdfSidebar","pdfSidebarResizer","pdfOutlineViewer","pdfAttachmentViewer","pdfCursorTools","store","downloadManager","overlayManager","preferences","l10n","isInitialViewSet","downloadComplete","isViewerEmbedded","url","baseUrl","externalServices","_boundEvents","contentDispositionFilename","AppOptions","LinkTarget","source","OVERRIDES","disableFontFace","disableRange","disableStream","textLayerMode","TextLayerMode","prefs","name","waitOn","hash","hashParams","parseQueryString","viewer","enabled","loadAndEnablePDFBug","console","reason","locale","dir","dispatchToDOM","getGlobalEventBus","externalLinkTarget","externalLinkRel","disableCreateObjectURL","findController","linkService","renderingQueue","renderer","enableWebGL","imageResourcesPath","renderInteractiveForms","enablePrintAutoRotate","useOnlyCssZoom","maxCanvasPixels","thumbnailContainer","cursorToolOnLoad","contextMenuItems","sidebarConfig","Object","run","newScale","Math","PDFPrintServiceFactory","doc","support","shadow","setTitleUsingUrl","title","getPDFFileNameFromURL","decodeURIComponent","getFilenameFromUrl","setTitle","promise","PDFBug","workerParameters","GlobalWorkerOptions","parameters","file","apiParameters","prop","args","loadingTask","getDocument","loaded","message","exception","loadingErrorMessage","filename","blob","type","error","moreInfoText","version","build","moreInfo","stack","line","errorWrapperConfig","Promise","parts","progress","percent","level","isNaN","disableAutoFetch","clearTimeout","load","firstPagePromise","pageModePromise","baseDocumentUrl","pagesPromise","onePageRendered","resetHistory","storePromise","page","zoom","scrollLeft","scrollTop","rotation","sidebarView","SidebarView","scrollMode","spreadMode","values","parseInt","pageMode","apiPageModeToSidebarView","setTimeout","i","numLabels","labels","javaScript","UNSUPPORTED_FEATURES","regex","ii","js","info","metadata","pdfTitle","setInitialView","setRotation","isValidRotation","setViewerModes","Number","cleanup","RendererType","forceRendering","beforePrint","pagesOverview","afterPrint","rotatePages","newRotation","requestPresentationMode","bindEvents","bindWindowEvents","unbindEvents","unbindWindowEvents","HOSTED_VIEWER_ORIGINS","validateFileURL","viewerOrigin","origin","protocol","ex","loadScript","PDFWorker","queryString","params","fileInput","files","evt","webViewerOpenFileViaURL","xhr","pageIndex","pageView","Stats","mode","view","action","switchInProgress","PresentationModeState","active","location","href","currentPage","loading","RenderingStates","currentScaleValue","webViewerFileInputChange","URL","originalUrl","fileReader","buffer","query","phraseSearch","caseSensitive","entireWord","highlightAll","findPrevious","result","zoomDisabled","previousScale","delta","normalizeWheelEventDelta","MOUSE_WHEEL_DELTA_PER_PAGE_SCALE","ticks","currentScale","scaleCorrectionFactor","rect","dx","dy","zoomDisabledTimeout","handled","ensureViewerFocused","cmd","isViewerInPresentationMode","findState","curElement","curElementTagName","turnPage","turnOnlyIfPageFit","CursorTool","instance","supportsPrinting","createPrintService","module","g","Function","hadRuntime","oldRuntime","Op","hasOwn","$Symbol","iteratorSymbol","asyncIteratorSymbol","toStringTagSymbol","inModule","runtime","global","protoGenerator","outerFn","generator","context","tryLocsList","makeInvokeMethod","arg","fn","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","IteratorPrototype","getProto","NativeIteratorPrototype","Gp","GeneratorFunctionPrototype","Generator","GeneratorFunction","prototype","ctor","genFun","__await","record","tryCatch","reject","value","invoke","resolve","previousPromise","defineIteratorMethods","AsyncIterator","iter","wrap","state","method","delegate","delegateResult","maybeInvokeDelegate","done","entry","tryLoc","locs","keys","key","iteratorMethod","iterable","Context","constructor","reset","stop","rootEntry","rootRecord","dispatchException","handle","hasCatch","hasFinally","abrupt","finallyEntry","complete","finish","resetTryEntry","thrown","delegateYield","iterator","resultName","nextLoc","enumerable","get","CSS_UNITS","DEFAULT_SCALE_VALUE","DEFAULT_SCALE","MIN_SCALE","MAX_SCALE","UNKNOWN_SCALE","MAX_AUTO_SCALE","SCROLLBAR_PADDING","VERTICAL_PADDING","UNKNOWN","NORMAL","CHANGING","FULLSCREEN","CANVAS","SVG","DISABLE","ENABLE","ENABLE_ENHANCE","NullL10n","formatL10nValue","devicePixelRatio","backingStoreRatio","ctx","pixelRatio","sx","sy","scaled","skipOverflowHiddenElements","parent","element","offsetY","offsetX","getComputedStyle","spot","debounceScroll","rAF","currentX","viewAreaElement","lastX","currentY","lastY","callback","right","down","_eventHandler","param","minIndex","maxIndex","items","condition","currentIndex","currentItem","xinv","limit","x_","x","a","b","c","d","p","q","r","changeOrientation","rotate","width","height","index","elt","views","pageTop","sortByVisibility","horizontal","top","scrollEl","bottom","left","elementBottom","elementRight","visible","firstVisibleElementInd","binarySearchFirstItem","backtrackBeforeAllVisibleElements","lastEdge","currentWidth","currentHeight","viewWidth","viewHeight","viewRight","viewBottom","hiddenHeight","hiddenWidth","percentVisible","id","y","first","last","pc","defaultFilename","isDataSchema","reURI","reFilename","splitURI","suggestedFilename","angle","MOUSE_DOM_DELTA_PIXEL_MODE","MOUSE_DOM_DELTA_LINE_MODE","MOUSE_PIXELS_PER_LINE","MOUSE_LINES_PER_PAGE","size","WaitOnType","EVENT","TIMEOUT","delay","target","eventHandler","handler","timeoutHandler","timeout","animationStarted","on","eventListeners","off","dispatch","Array","listener","_dispatchDOMEvent","details","obj","event","units","progressSize","setWidth","scrollbarWidth","clamp","moved","len","arr","write","read","pdfjsLib","__non_webpack_require__","SELECT","HAND","ZOOM","switchTool","tool","disableActiveTool","previouslyActive","options","overlay","GrabToPan","CSS_CLASS_GRAB","activate","deactivate","toggle","ignoreTarget","node","_onmousedown","focusedElement","_onmousemove","isLeftMouseReleased","xDiff","yDiff","behavior","_endPan","prefix","matchesSelector","isNotIEorIsIE10plus","chrome","isChrome15OrOpera15plus","isSafari6plus","navigator","CLEANUP_TIMEOUT","INITIAL","RUNNING","PAUSED","FINISHED","setViewer","setThumbnailViewer","isHighestPriority","renderHighestPriority","getHighestPriority","visibleViews","numVisible","nextPageIndex","previousPageIndex","isViewFinished","renderView","continueRendering","UI_NOTIFICATION_CLASS","NONE","THUMBS","OUTLINE","ATTACHMENTS","isViewPreserved","switchView","forceOpen","isViewChanged","shouldForceRendering","pagesCount","_showUINotification","_hideUINotification","removeNotification","outlineCount","OptionKind","VIEWER","API","WORKER","defaultOptions","kind","defaultUrl","defaultZoomValue","disableHistory","disablePageLabels","disablePageMode","eventBusDispatchToDOM","viewerCompatibilityParams","pdfBugEnabled","showPreviousViewOnLoad","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","cMapPacked","cMapUrl","apiCompatibilityParams","isEvalSupported","maxImageSize","pdfBug","postMessageTransfers","verbosity","workerPort","workerSrc","userOptions","defaultOption","userOption","compatibilityParams","userAgent","isAndroid","isIOS","exports","cssTransform","attachmentsCount","globalEventBus","attachDOMEventsToEventBus","callerCloseMethod","canForceClose","_keyDown","e","PasswordResponses","promptString","password","setUpdateCallback","keepRenderedCapability","_dispatchEvent","_bindPdfLink","button","blobUrl","createObjectURL","viewerUrl","encodeURIComponent","_bindLink","render","attachments","names","item","removeNullCharacters","div","_appendAttachment","DEFAULT_FIELD_CONTENT","NON_METRIC_LOCALES","US_PAGE_NAMES","METRIC_PAGE_NAMES","isPortrait","pageNames","freezeFieldData","writable","configurable","currentPageNumber","pagesRotation","getPageSizeInches","fileSize","data","setDocument","setFileSize","_updateUI","content","_parseFileSize","kb","size_kb","size_b","size_mb","_parsePageSize","pageSizeInches","isPortraitOrientation","sizeInches","sizeMillimeters","pageName","getPageName","exactMillimeters","intMillimeters","_parseDate","dateToParse","year","month","day","hours","minutes","seconds","utRel","offsetHours","offsetMinutes","date","Date","dateString","timeString","time","_parseLinearization","isLinearized","MATCHES_COUNT_LIMIT","dispatchEvent","updateUIState","notFound","status","FindState","updateResultsCount","current","total","matchesCountMsg","findbarHeight","inputContainerHeight","FOUND","NOT_FOUND","WRAPPED","PENDING","FIND_TIMEOUT","CHARACTERS_TO_NORMALIZE","replace","executeCommand","pageIdx","matchIdx","_normalize","_prepareMatches","currentElem","matchesWithLength","nextElem","prevElem","isSubTerm","matches","matchesLength","_isEntireWord","startIdx","getCharacterType","endIdx","_calculatePhraseMatch","queryLen","pageContent","_calculateWordMatch","queryArray","subquery","subqueryLen","match","matchLength","skipped","_calculateMatch","pageMatchesCount","extractTextCapability","pdfPage","normalizeWhitespace","textItems","textContent","strBuf","j","jj","_updatePage","currentPageIndex","offset","numPageMatches","_matchesReady","numMatches","_advanceOffsetPage","found","_updateMatch","wrapped","previousPage","_onFindBarClose","matchesCount","_updateUIState","CharacterType","SPACE","ALPHA_LETTER","PUNCT","HAN_LETTER","KATAKANA_LETTER","HIRAGANA_LETTER","HALFWIDTH_KATAKANA_LETTER","THAI_LETTER","charCode","isAlphabeticalScript","isAscii","isAsciiSpace","isAsciiAlpha","isAsciiDigit","isThai","isHan","isKatakana","isHiragana","isHalfwidthKatakana","HASH_CHANGE_TIMEOUT","POSITION_UPDATED_THRESHOLD","UPDATE_VIEWAREA_TIMEOUT","unescape","initialize","reInitialized","parseCurrentHash","destination","JSON","push","namedDest","forceReplace","isDestArraysEqual","dest","_pushOrReplaceState","shouldReplace","newState","fingerprint","uid","temporary","_tryPushCurrentPosition","position","_isValidState","_updateInternalState","removeTemporary","_updateViewarea","_popState","newHash","hashChanged","waitOnEventOrTimeout","destHash","nameddest","second","isEntryEqual","firstDest","secondDest","setHistory","navigateTo","goToDestination","destRef","explicitDest","destArray","getDestinationHash","escape","str","getAnchorUrl","setHash","zoomArgs","zoomArg","zoomArgNumber","parseFloat","allowNegativeOffset","isValidExplicitDestination","executeNamedAction","cachePageRef","refStr","pageRef","_cachedPageNumber","destLength","allowNull","DEFAULT_TITLE","addLinkAttributes","newWindow","rel","_setStyles","styleStr","_addToggleButton","toggler","shouldShowAll","_toggleOutlineItem","togglers","root","show","outline","fragment","queue","hasAnyNesting","levelData","itemsDiv","DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS","DELAY_BEFORE_HIDING_CONTROLS","ACTIVE_SELECTOR","CONTROLS_SELECTOR","MOUSE_SCROLL_COOLDOWN_TIME","PAGE_SWITCH_THRESHOLD","SWIPE_MIN_DISTANCE_THRESHOLD","SWIPE_ANGLE_THRESHOLD","Element","_mouseWheel","currentTime","storedTime","totalDelta","success","_mouseDown","isInternalLink","_touchSwipe","startX","startY","endX","endY","absAngle","SIDEBAR_WIDTH_VAR","SIDEBAR_MIN_WIDTH","SIDEBAR_RESIZING_CLASS","CSS","_updateWidth","maxWidth","_mouseMove","_mouseUp","updated","THUMBNAIL_SCROLL_MARGIN","THUMBNAIL_SELECTED_CLASS","watchScroll","getThumbnail","getVisibleElements","scrollThumbnailIntoView","prevThumbnailView","visibleThumbs","numVisibleThumbs","shouldScroll","scrollIntoView","PDFThumbnailView","viewport","firstPage","pageNum","thumbnail","defaultViewport","disableCanvasToImageConversion","setPageLabels","_ensurePdfPageLoaded","thumbView","MAX_NUM_SCALING_STEPS","THUMBNAIL_CANVAS_BORDER_WIDTH","THUMBNAIL_WIDTH","TempImageFactory","tempCanvasCache","getCanvas","tempCanvas","alpha","destroyCanvas","anchor","ring","borderAdjustment","setPdfPage","totalRotation","childNodes","update","scale","noCtxScale","_getPageDrawContext","canvas","outputScale","getOutputScale","className","image","renderCapability","finishRenderTask","renderTask","drawViewport","renderContinueCallback","renderContext","canvasContext","setImage","img","reducedWidth","reducedHeight","reducedImage","reducedImageCtx","setPageLabel","pageSpot","_scrollIntoView","pageDiv","ScrollMode","visiblePages","numVisiblePages","currentId","stillFullyVisible","DEFAULT_CACHE_SIZE","VERTICAL","HORIZONTAL","SpreadMode","ODD","EVEN","pageIdsToKeep","iMax","pagesToKeep","moveToEndOfArray","getPageView","_setCurrentPageNumber","resetCurrentPageView","val","pageLabel","pagesCapability","isOnePageRenderedResolved","onePageRenderedCapability","bindOnAfterAndBeforeDraw","textLayerFactory","annotationLayerFactory","getPagesLeft","_setScaleDispatchEvent","preset","presetValue","_setScaleUpdatePages","noScroll","newValue","isSameScale","_setScale","noPadding","hPadding","vPadding","pageWidthScale","pageHeightScale","horizontalScale","scrollPageIntoView","pageWidth","pageHeight","widthScale","heightScale","boundingRect","_resizeBuffer","suggestedCacheSize","_updateLocation","normalizedScaleValue","pdfOpenParams","currentPageView","topLeft","intLeft","intTop","containsElement","currentlyVisiblePages","scrollAhead","createTextLayerBuilder","enhanceTextSelection","createAnnotationLayerBuilder","isFirstPagePortrait","_updateScrollMode","_updateSpreadMode","pages","parity","spread","firstPageView","intent","dontFlip","AnnotationLayer","annotations","MAX_CANVAS_PIXELS","removeFromDOM","_resetZoomLayer","zoomLayerCanvas","keepZoomLayer","keepAnnotations","currentZoomLayerNode","currentAnnotationNode","isScalingRestricted","cancelRendering","renderingState","redrawAnnotations","relativeRotation","absRotation","scaleX","scaleY","textLayerViewport","textRelativeRotation","textAbsRotation","textLayerDiv","transX","transY","getPagePoint","canvasWrapper","textLayer","finishPaintTask","paintTask","resultPromise","readableStream","paintOnCanvas","onRenderContinue","cancel","isCanvasHidden","showCanvas","actualSizeViewport","pixelsInViewport","maxScale","sfx","approximateFraction","sfy","roundToDivide","transform","paintOnSvg","cancelled","ensureNotCancelled","svgGfx","svg","wrapper","EXPAND_DIVS_TIMEOUT","MATCH_SCROLL_OFFSET_TOP","MATCH_SCROLL_OFFSET_LEFT","endOfContent","numTextDivs","textLayerFrag","textContentStream","textDivs","textContentItemsStr","setTextContentStream","setTextContent","convertMatches","iIndex","end","ret","m","begin","divIdx","renderMatches","prevEnd","isSelectedPage","selectedMatchIdx","infinity","appendTextToDiv","span","i0","i1","isSelected","highlightSuffix","beginText","n0","n1","clearedUntilDivIdx","n","pageMatches","pageMatchesLength","expandDivsTimer","adjustTop","divBounds","eventName","close","eventDetails","lastPage","pageRotateCw","pageRotateCcw","setPageNumber","setPagesCount","_bindCursorToolsListener","buttons","_bindScrollModeListener","isScrollModeHorizontal","scrollModeChanged","_bindSpreadModeListener","spreadModeChanged","previousPageView","viewerNodes","scrolledDown","previousLocation","PAGE_NUMBER_LOADING_INDICATOR","SCALE_SELECT_CONTAINER_PADDING","SCALE_SELECT_PADDING","setPageScale","self","resetNumPages","pageScale","customScale","predefinedValueFound","option","updateLoadingIndicatorState","pageNumberInput","select","DEFAULT_VIEW_HISTORY_CACHE_SIZE","cacheSize","database","databaseStr","length","branch","localStorage","properties","GenericCom","GenericExternalServices","defaultPreferences","defaultValue","prefValue","valueType","defaultType","DISABLE_CREATE_OBJECT_URL","downloadUrl","createValidAbsoluteUrl","downloadData","webL10n","gL10nData","gTextData","gTextProp","gLanguage","gMacros","gReadyState","gAsyncResourceLoading","script","l10nId","l10nArgs","evtObject","onSuccess","onFailure","baseURL","text","dictionary","reBlank","reComment","reSection","reImport","reSplit","entries","rawText","currentLang","genericLang","lang","skipLang","loadImport","tmp","evalString","xhrLoadText","parseRawLines","parsedPropertiesCallback","parseProperties","langLinks","langCount","dict","defaultLocale","anyCaseLang","fireL10nReadyEvent","onResourceLoaded","gResourceCount","link","parseResource","resource","locales2rules","list","start","pluralRules","isBetween","getPluralRules","rv","substIndexes","substArguments","reIndex","reMatch","macroName","paramName","macro","reArgs","getL10nAttributes","getL10nData","getChildElementCount","children","l","textNode","count","getTranslatableChildren","elementCount","translateElement","getData","getText","getLanguage","setLanguage","loadLocale","getDirection","rtlList","shortCode","translate","getReadyState","ready","activeService","scratchCanvas","PRINT_RESOLUTION","PRINT_UNITS","PDFPrintService","layout","body","hasEqualPageSizes","pageSize","destroy","ensureOverlay","renderPages","pageCount","renderNextPage","renderProgress","renderPage","useRenderedPage","printItem","performPrint","throwIfInactive","activeServiceOnEntry","progressContainer","progressBar","progressPerc","hasAttachEvent","stopPropagationIfNeeded","overlayPromise"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;AClFA;AAqCA;AAAA,IArCA,2BAqCA;AACoE;AAClEA,gBAAcC,mBAAOA,CAD6C,CACpDA,CAAdD;AACAE,uBAAqBD,mBAAOA,CAFsC,EAE7CA,CAArBC;AAxCF;AAAA;AA+CiE;AAC/DD,qBAAOA,CADwD,EAC/DA;AAhDF;AAAA;AAqD2E;AACzEA,qBAAOA,CADkE,EACzEA;AAtDF;AAyDA,kCAAkC;AAChC,SAAO;AACLE,kBAAcC,SADT;AAELC,mBAAeD,wBAFV,iBAEUA,CAFV;AAGLE,qBAAiBF,wBAHZ,QAGYA,CAHZ;AAILG,cAJK;AAKLC,aAAS;AACPC,iBAAWL,wBADJ,eACIA,CADJ;AAEPM,gBAAUN,wBAFH,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// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals chrome */\n\n'use strict';\n\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {\n var defaultUrl; // eslint-disable-line no-var\n\n (function rewriteUrlClosure() {\n // Run this code outside DOMContentLoaded to make sure that the URL\n // is rewritten as soon as possible.\n let queryString = document.location.search.slice(1);\n let m = /(^|&)file=([^&]*)/.exec(queryString);\n defaultUrl = m ? decodeURIComponent(m[2]) : '';\n\n // Example: chrome-extension://.../http://example.com/file.pdf\n let humanReadableUrl = '/' + defaultUrl + location.hash;\n history.replaceState(history.state, '', humanReadableUrl);\n if (top === window) {\n chrome.runtime.sendMessage('showPageAction');\n }\n })();\n}\n\nlet pdfjsWebApp, pdfjsWebAppOptions;\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) {\n pdfjsWebApp = require('./app.js');\n pdfjsWebAppOptions = require('./app_options.js');\n}\n\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n require('./firefoxcom.js');\n require('./firefox_print_service.js');\n}\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('GENERIC')) {\n require('./genericcom.js');\n}\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {\n require('./chromecom.js');\n}\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME || GENERIC')) {\n require('./pdf_print_service.js');\n}\n\nfunction getViewerConfiguration() {\n return {\n appContainer: document.body,\n mainContainer: document.getElementById('viewerContainer'),\n viewerContainer: document.getElementById('viewer'),\n eventBus: null, // using global event bus with DOM events\n toolbar: {\n container: document.getElementById('toolbarViewer'),\n numPages: document.getElementById('numPages'),\n pageNumber: document.getElementById('pageNumber'),\n scaleSelectContainer: document.getElementById('scaleSelectContainer'),\n scaleSelect: document.getElementById('scaleSelect'),\n customScaleOption: document.getElementById('customScaleOption'),\n previous: document.getElementById('previous'),\n next: document.getElementById('next'),\n zoomIn: document.getElementById('zoomIn'),\n zoomOut: document.getElementById('zoomOut'),\n viewFind: document.getElementById('viewFind'),\n openFile: document.getElementById('openFile'),\n print: document.getElementById('print'),\n presentationModeButton: document.getElementById('presentationMode'),\n download: document.getElementById('download'),\n viewBookmark: document.getElementById('viewBookmark'),\n },\n secondaryToolbar: {\n toolbar: document.getElementById('secondaryToolbar'),\n toggleButton: document.getElementById('secondaryToolbarToggle'),\n toolbarButtonContainer:\n document.getElementById('secondaryToolbarButtonContainer'),\n presentationModeButton:\n document.getElementById('secondaryPresentationMode'),\n openFileButton: document.getElementById('secondaryOpenFile'),\n printButton: document.getElementById('secondaryPrint'),\n downloadButton: document.getElementById('secondaryDownload'),\n viewBookmarkButton: document.getElementById('secondaryViewBookmark'),\n firstPageButton: document.getElementById('firstPage'),\n lastPageButton: document.getElementById('lastPage'),\n pageRotateCwButton: document.getElementById('pageRotateCw'),\n pageRotateCcwButton: document.getElementById('pageRotateCcw'),\n cursorSelectToolButton: document.getElementById('cursorSelectTool'),\n cursorHandToolButton: document.getElementById('cursorHandTool'),\n scrollVerticalButton: document.getElementById('scrollVertical'),\n scrollHorizontalButton: document.getElementById('scrollHorizontal'),\n scrollWrappedButton: document.getElementById('scrollWrapped'),\n spreadNoneButton: document.getElementById('spreadNone'),\n spreadOddButton: document.getElementById('spreadOdd'),\n spreadEvenButton: document.getElementById('spreadEven'),\n documentPropertiesButton: document.getElementById('documentProperties'),\n },\n fullscreen: {\n contextFirstPage: document.getElementById('contextFirstPage'),\n contextLastPage: document.getElementById('contextLastPage'),\n contextPageRotateCw: document.getElementById('contextPageRotateCw'),\n contextPageRotateCcw: document.getElementById('contextPageRotateCcw'),\n },\n sidebar: {\n // Divs (and sidebar button)\n outerContainer: document.getElementById('outerContainer'),\n viewerContainer: document.getElementById('viewerContainer'),\n toggleButton: document.getElementById('sidebarToggle'),\n // Buttons\n thumbnailButton: document.getElementById('viewThumbnail'),\n outlineButton: document.getElementById('viewOutline'),\n attachmentsButton: document.getElementById('viewAttachments'),\n // Views\n thumbnailView: document.getElementById('thumbnailView'),\n outlineView: document.getElementById('outlineView'),\n attachmentsView: document.getElementById('attachmentsView'),\n },\n sidebarResizer: {\n outerContainer: document.getElementById('outerContainer'),\n resizer: document.getElementById('sidebarResizer'),\n },\n findBar: {\n bar: document.getElementById('findbar'),\n toggleButton: document.getElementById('viewFind'),\n findField: document.getElementById('findInput'),\n highlightAllCheckbox: document.getElementById('findHighlightAll'),\n caseSensitiveCheckbox: document.getElementById('findMatchCase'),\n entireWordCheckbox: document.getElementById('findEntireWord'),\n findMsg: document.getElementById('findMsg'),\n findResultsCount: document.getElementById('findResultsCount'),\n findPreviousButton: document.getElementById('findPrevious'),\n findNextButton: document.getElementById('findNext'),\n },\n passwordOverlay: {\n overlayName: 'passwordOverlay',\n container: document.getElementById('passwordOverlay'),\n label: document.getElementById('passwordText'),\n input: document.getElementById('password'),\n submitButton: document.getElementById('passwordSubmit'),\n cancelButton: document.getElementById('passwordCancel'),\n },\n documentProperties: {\n overlayName: 'documentPropertiesOverlay',\n container: document.getElementById('documentPropertiesOverlay'),\n closeButton: document.getElementById('documentPropertiesClose'),\n fields: {\n 'fileName': document.getElementById('fileNameField'),\n 'fileSize': document.getElementById('fileSizeField'),\n 'title': document.getElementById('titleField'),\n 'author': document.getElementById('authorField'),\n 'subject': document.getElementById('subjectField'),\n 'keywords': document.getElementById('keywordsField'),\n 'creationDate': document.getElementById('creationDateField'),\n 'modificationDate': document.getElementById('modificationDateField'),\n 'creator': document.getElementById('creatorField'),\n 'producer': document.getElementById('producerField'),\n 'version': document.getElementById('versionField'),\n 'pageCount': document.getElementById('pageCountField'),\n 'pageSize': document.getElementById('pageSizeField'),\n 'linearized': document.getElementById('linearizedField'),\n },\n },\n errorWrapper: {\n container: document.getElementById('errorWrapper'),\n errorMessage: document.getElementById('errorMessage'),\n closeButton: document.getElementById('errorClose'),\n errorMoreInfo: document.getElementById('errorMoreInfo'),\n moreInfoButton: document.getElementById('errorShowMore'),\n lessInfoButton: document.getElementById('errorShowLess'),\n },\n printContainer: document.getElementById('printContainer'),\n openFileInputName: 'fileInput',\n debuggerScriptPath: './debugger.js',\n };\n}\n\nfunction webViewerLoad() {\n let config = getViewerConfiguration();\n if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {\n Promise.all([\n SystemJS.import('pdfjs-web/app'),\n SystemJS.import('pdfjs-web/app_options'),\n SystemJS.import('pdfjs-web/genericcom'),\n SystemJS.import('pdfjs-web/pdf_print_service'),\n ]).then(function([app, appOptions, ...otherModules]) {\n window.PDFViewerApplication = app.PDFViewerApplication;\n window.PDFViewerApplicationOptions = appOptions.AppOptions;\n app.PDFViewerApplication.run(config);\n });\n } else {\n if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {\n pdfjsWebAppOptions.AppOptions.set('defaultUrl', defaultUrl);\n }\n\n window.PDFViewerApplication = pdfjsWebApp.PDFViewerApplication;\n window.PDFViewerApplicationOptions = pdfjsWebAppOptions.AppOptions;\n pdfjsWebApp.PDFViewerApplication.run(config);\n }\n}\n\nif (document.readyState === 'interactive' ||\n document.readyState === 'complete') {\n webViewerLoad();\n} else {\n document.addEventListener('DOMContentLoaded', webViewerLoad, true);\n}\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals PDFBug, Stats */\n\nimport {\n animationStarted, DEFAULT_SCALE_VALUE, getPDFFileNameFromURL, isValidRotation,\n MAX_SCALE, MIN_SCALE, noContextMenuHandler, normalizeWheelEventDelta,\n parseQueryString, PresentationModeState, ProgressBar, RendererType,\n TextLayerMode\n} from './ui_utils';\nimport {\n build, createObjectURL, getDocument, getFilenameFromUrl, GlobalWorkerOptions,\n InvalidPDFException, LinkTarget, loadScript, MissingPDFException, OPS,\n PDFWorker, shadow, UnexpectedResponseException, UNSUPPORTED_FEATURES, URL,\n version\n} from 'pdfjs-lib';\nimport { CursorTool, PDFCursorTools } from './pdf_cursor_tools';\nimport { PDFRenderingQueue, RenderingStates } from './pdf_rendering_queue';\nimport { PDFSidebar, SidebarView } from './pdf_sidebar';\nimport { AppOptions } from './app_options';\nimport { getGlobalEventBus } from './dom_events';\nimport { OverlayManager } from './overlay_manager';\nimport { PasswordPrompt } from './password_prompt';\nimport { PDFAttachmentViewer } from './pdf_attachment_viewer';\nimport { PDFDocumentProperties } from './pdf_document_properties';\nimport { PDFFindBar } from './pdf_find_bar';\nimport { PDFFindController } from './pdf_find_controller';\nimport { PDFHistory } from './pdf_history';\nimport { PDFLinkService } from './pdf_link_service';\nimport { PDFOutlineViewer } from './pdf_outline_viewer';\nimport { PDFPresentationMode } from './pdf_presentation_mode';\nimport { PDFSidebarResizer } from './pdf_sidebar_resizer';\nimport { PDFThumbnailViewer } from './pdf_thumbnail_viewer';\nimport { PDFViewer } from './pdf_viewer';\nimport { SecondaryToolbar } from './secondary_toolbar';\nimport { Toolbar } from './toolbar';\nimport { ViewHistory } from './view_history';\n\nconst DEFAULT_SCALE_DELTA = 1.1;\nconst DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; // ms\nconst FORCE_PAGES_LOADED_TIMEOUT = 10000; // ms\n\nconst DefaultExternalServices = {\n updateFindControlState(data) {},\n updateFindMatchesCount(data) {},\n initPassiveLoading(callbacks) {},\n fallback(data, callback) {},\n reportTelemetry(data) {},\n createDownloadManager(options) {\n throw new Error('Not implemented: createDownloadManager');\n },\n createPreferences() {\n throw new Error('Not implemented: createPreferences');\n },\n createL10n(options) {\n throw new Error('Not implemented: createL10n');\n },\n supportsIntegratedFind: false,\n supportsDocumentFonts: true,\n supportsDocumentColors: true,\n supportedMouseWheelZoomModifierKeys: {\n ctrlKey: true,\n metaKey: true,\n },\n};\n\nlet PDFViewerApplication = {\n initialBookmark: document.location.hash.substring(1),\n initialized: false,\n fellback: false,\n appConfig: null,\n pdfDocument: null,\n pdfLoadingTask: null,\n printService: null,\n /** @type {PDFViewer} */\n pdfViewer: null,\n /** @type {PDFThumbnailViewer} */\n pdfThumbnailViewer: null,\n /** @type {PDFRenderingQueue} */\n pdfRenderingQueue: null,\n /** @type {PDFPresentationMode} */\n pdfPresentationMode: null,\n /** @type {PDFDocumentProperties} */\n pdfDocumentProperties: null,\n /** @type {PDFLinkService} */\n pdfLinkService: null,\n /** @type {PDFHistory} */\n pdfHistory: null,\n /** @type {PDFSidebar} */\n pdfSidebar: null,\n /** @type {PDFSidebarResizer} */\n pdfSidebarResizer: null,\n /** @type {PDFOutlineViewer} */\n pdfOutlineViewer: null,\n /** @type {PDFAttachmentViewer} */\n pdfAttachmentViewer: null,\n /** @type {PDFCursorTools} */\n pdfCursorTools: null,\n /** @type {ViewHistory} */\n store: null,\n /** @type {DownloadManager} */\n downloadManager: null,\n /** @type {OverlayManager} */\n overlayManager: null,\n /** @type {Preferences} */\n preferences: null,\n /** @type {Toolbar} */\n toolbar: null,\n /** @type {SecondaryToolbar} */\n secondaryToolbar: null,\n /** @type {EventBus} */\n eventBus: null,\n /** @type {IL10n} */\n l10n: null,\n isInitialViewSet: false,\n downloadComplete: false,\n isViewerEmbedded: (window.parent !== window),\n url: '',\n baseUrl: '',\n externalServices: DefaultExternalServices,\n _boundEvents: {},\n contentDispositionFilename: null,\n\n // Called once when the document is loaded.\n async initialize(appConfig) {\n this.preferences = this.externalServices.createPreferences();\n this.appConfig = appConfig;\n\n await this._readPreferences();\n await this._parseHashParameters();\n await this._initializeL10n();\n\n if (this.isViewerEmbedded &&\n AppOptions.get('externalLinkTarget') === LinkTarget.NONE) {\n // Prevent external links from \"replacing\" the viewer,\n // when it's embedded in e.g. an