diff --git a/public/vendor/VERSIONS b/public/vendor/VERSIONS index da0d78e48..6c5f10424 100644 --- a/public/vendor/VERSIONS +++ b/public/vendor/VERSIONS @@ -48,7 +48,7 @@ File(s): /vendor/plugins/simplemde/simplemde.min.js Version: 1.10.1 File(s): /vendor/plugins/pdfjs/ -Version: 1.4.20 +Version: 2.1.266 File(s): /vendor/plugins/u2f/ Version: 1.0.8 diff --git a/public/vendor/librejs.html b/public/vendor/librejs.html index 00e5ff1d7..c17c2f14e 100644 --- a/public/vendor/librejs.html +++ b/public/vendor/librejs.html @@ -108,7 +108,7 @@ pdf.js Apache-2.0-only - pdf.js-v1.4.20.tar.gz + pdf.js-v2.1.266.tar.gz u2f-api diff --git a/public/vendor/plugins/pdfjs/build/pdf.js b/public/vendor/plugins/pdfjs/build/pdf.js index c8877d510..42250bb70 100644 --- a/public/vendor/plugins/pdfjs/build/pdf.js +++ b/public/vendor/plugins/pdfjs/build/pdf.js @@ -1,4 +1,8 @@ -/* Copyright 2012 Mozilla Foundation +/** + * @licstart The following is the entire license notice for the + * Javascript code in this page + * + * Copyright 2018 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -11,149 +15,279 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * @licend The above is the entire license notice for the + * Javascript code in this page */ -/* jshint globalstrict: false */ -/* umdutils ignore */ -(function (root, factory) { - 'use strict'; - if (typeof define === 'function' && define.amd) { -define('pdfjs-dist/build/pdf', ['exports'], factory); - } else if (typeof exports !== 'undefined') { - factory(exports); +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define("pdfjs-dist/build/pdf", [], factory); + else if(typeof exports === 'object') + exports["pdfjs-dist/build/pdf"] = factory(); + else + root["pdfjs-dist/build/pdf"] = root.pdfjsLib = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __w_pdfjs_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __w_pdfjs_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __w_pdfjs_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __w_pdfjs_require__.d = function(exports, name, getter) { +/******/ if(!__w_pdfjs_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __w_pdfjs_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __w_pdfjs_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __w_pdfjs_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __w_pdfjs_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __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; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __w_pdfjs_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var pdfjsVersion = '2.1.266'; +var pdfjsBuild = '81f5835c'; + +var pdfjsSharedUtil = __w_pdfjs_require__(1); + +var pdfjsDisplayAPI = __w_pdfjs_require__(146); + +var pdfjsDisplayTextLayer = __w_pdfjs_require__(162); + +var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(163); + +var pdfjsDisplayDOMUtils = __w_pdfjs_require__(151); + +var pdfjsDisplaySVG = __w_pdfjs_require__(164); + +var pdfjsDisplayWorkerOptions = __w_pdfjs_require__(156); + +var pdfjsDisplayAPICompatibility = __w_pdfjs_require__(153); + +{ + var isNodeJS = __w_pdfjs_require__(4); + + if (isNodeJS()) { + var PDFNodeStream = __w_pdfjs_require__(165).PDFNodeStream; + + pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) { + return new PDFNodeStream(params); + }); + } else if (typeof Response !== 'undefined' && 'body' in Response.prototype && typeof ReadableStream !== 'undefined') { + var PDFFetchStream = __w_pdfjs_require__(168).PDFFetchStream; + + pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) { + return new PDFFetchStream(params); + }); } else { -factory((root.pdfjsDistBuildPdf = {})); + var PDFNetworkStream = __w_pdfjs_require__(169).PDFNetworkStream; + + pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) { + return new PDFNetworkStream(params); + }); } -}(this, function (exports) { - // Use strict in our context only - users might not want it - 'use strict'; +} +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; -var pdfjsVersion = '1.4.20'; -var pdfjsBuild = 'b15f335'; +/***/ }), +/* 1 */ +/***/ (function(module, exports, __w_pdfjs_require__) { - var pdfjsFilePath = - typeof document !== 'undefined' && document.currentScript ? - document.currentScript.src : null; - - var pdfjsLibs = {}; - - (function pdfjsWrapper() { +"use strict"; - -(function (root, factory) { - { - factory((root.pdfjsSharedGlobal = {})); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.toRomanNumerals = toRomanNumerals; +exports.arrayByteLength = arrayByteLength; +exports.arraysToBytes = arraysToBytes; +exports.assert = assert; +exports.bytesToString = bytesToString; +exports.createPromiseCapability = createPromiseCapability; +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.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; +Object.defineProperty(exports, "ReadableStream", { + enumerable: true, + get: function get() { + return _streams_polyfill.ReadableStream; } -}(this, function (exports) { - - var globalScope = (typeof window !== 'undefined') ? window : - (typeof global !== 'undefined') ? global : - (typeof self !== 'undefined') ? self : this; - - var isWorker = (typeof window === 'undefined'); - - // The global PDFJS object exposes the API - // In production, it will be declared outside a global wrapper - // In development, it will be declared here - if (!globalScope.PDFJS) { - globalScope.PDFJS = {}; +}); +Object.defineProperty(exports, "URL", { + enumerable: true, + get: function get() { + return _url_polyfill.URL; } +}); +exports.createObjectURL = exports.FormatError = exports.XRefParseException = exports.XRefEntryException = 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 = void 0; - if (typeof pdfjsVersion !== 'undefined') { - globalScope.PDFJS.version = pdfjsVersion; - } - if (typeof pdfjsVersion !== 'undefined') { - globalScope.PDFJS.build = pdfjsBuild; - } +__w_pdfjs_require__(2); - globalScope.PDFJS.pdfBug = false; +var _streams_polyfill = __w_pdfjs_require__(142); - exports.globalScope = globalScope; - exports.isWorker = isWorker; - exports.PDFJS = globalScope.PDFJS; -})); +var _url_polyfill = __w_pdfjs_require__(144); +function _typeof(obj) { 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 (root, factory) { - { - factory((root.pdfjsDisplayDOMUtils = {}), root.pdfjsSharedGlobal); - } -}(this, function (exports, sharedGlobal) { - -var PDFJS = sharedGlobal.PDFJS; - -/** - * Optimised CSS custom property getter/setter. - * @class - */ -var CustomStyle = (function CustomStyleClosure() { - - // As noted on: http://www.zachstronaut.com/posts/2009/02/17/ - // animate-css-transforms-firefox-webkit.html - // in some versions of IE9 it is critical that ms appear in this list - // before Moz - var prefixes = ['ms', 'Moz', 'Webkit', 'O']; - var _cache = {}; - - function CustomStyle() {} - - CustomStyle.getProp = function get(propName, element) { - // check cache only when no element is given - if (arguments.length === 1 && typeof _cache[propName] === 'string') { - return _cache[propName]; - } - - element = element || document.documentElement; - var style = element.style, prefixed, uPropName; - - // test standard property first - if (typeof style[propName] === 'string') { - return (_cache[propName] = propName); - } - - // capitalize - uPropName = propName.charAt(0).toUpperCase() + propName.slice(1); - - // test vendor specific properties - for (var i = 0, l = prefixes.length; i < l; i++) { - prefixed = prefixes[i] + uPropName; - if (typeof style[prefixed] === 'string') { - return (_cache[propName] = prefixed); - } - } - - //if all fails then set to undefined - return (_cache[propName] = 'undefined'); - }; - - CustomStyle.setProp = function set(propName, element, str) { - var prop = this.getProp(propName); - if (prop !== 'undefined') { - element.style[prop] = str; - } - }; - - return CustomStyle; -})(); - -PDFJS.CustomStyle = CustomStyle; - -exports.CustomStyle = CustomStyle; -})); - - -(function (root, factory) { - { - factory((root.pdfjsSharedUtil = {}), root.pdfjsSharedGlobal); - } -}(this, function (exports, sharedGlobal) { - -var PDFJS = sharedGlobal.PDFJS; -var globalScope = sharedGlobal.globalScope; - +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 NativeImageDecoding = { + NONE: 'none', + DECODE: 'decode', + DISPLAY: 'display' +}; +exports.NativeImageDecoding = NativeImageDecoding; +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 +}; +exports.PermissionFlag = PermissionFlag; var TextRenderingMode = { FILL: 0, STROKE: 1, @@ -166,13 +300,13 @@ var TextRenderingMode = { FILL_STROKE_MASK: 3, ADD_TO_PATH_FLAG: 4 }; - +exports.TextRenderingMode = TextRenderingMode; var ImageKind = { GRAYSCALE_1BPP: 1, RGB_24BPP: 2, RGBA_32BPP: 3 }; - +exports.ImageKind = ImageKind; var AnnotationType = { TEXT: 1, LINK: 2, @@ -201,7 +335,7 @@ var AnnotationType = { THREED: 25, REDACT: 26 }; - +exports.AnnotationType = AnnotationType; var AnnotationFlag = { INVISIBLE: 0x01, HIDDEN: 0x02, @@ -214,7 +348,29 @@ var AnnotationFlag = { 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, @@ -222,7 +378,7 @@ var AnnotationBorderStyleType = { INSET: 4, UNDERLINE: 5 }; - +exports.AnnotationBorderStyleType = AnnotationBorderStyleType; var StreamType = { UNKNOWN: 0, FLATE: 1, @@ -235,7 +391,7 @@ var StreamType = { CCF: 8, RL: 9 }; - +exports.StreamType = StreamType; var FontType = { UNKNOWN: 0, TYPE1: 1, @@ -249,17 +405,20 @@ var FontType = { TYPE0: 9, MMTYPE1: 10 }; - -PDFJS.VERBOSITY_LEVELS = { - errors: 0, - warnings: 1, - infos: 5 +exports.FontType = FontType; +var VerbosityLevel = { + ERRORS: 0, + WARNINGS: 1, + INFOS: 5 }; - -// All the possible operations for an operator list. -var OPS = PDFJS.OPS = { - // Intentionally start from 1 so it is easy to spot bad operators that will be - // 0's. +exports.VerbosityLevel = VerbosityLevel; +var CMapCompressionType = { + NONE: 0, + BINARY: 1, + STREAM: 2 +}; +exports.CMapCompressionType = CMapCompressionType; +var OPS = { dependency: 1, setLineWidth: 2, setLineCap: 3, @@ -352,53 +511,8 @@ var OPS = PDFJS.OPS = { paintSolidColorImageMask: 90, constructPath: 91 }; - -// A notice for devs. These are good for things that are helpful to devs, such -// as warning that Workers were disabled, which is important to devs but not -// end users. -function info(msg) { - if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.infos) { - console.log('Info: ' + msg); - } -} - -// Non-fatal warnings. -function warn(msg) { - if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.warnings) { - console.log('Warning: ' + msg); - } -} - -// Deprecated API function -- treated as warnings. -function deprecated(details) { - warn('Deprecated API usage: ' + details); -} - -// Fatal errors that should trigger the fallback UI and halt execution by -// throwing an exception. -function error(msg) { - if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.errors) { - console.log('Error: ' + msg); - console.log(backtrace()); - } - throw new Error(msg); -} - -function backtrace() { - try { - throw new Error(); - } catch (e) { - return e.stack ? e.stack.split('\n').slice(2).join('\n') : ''; - } -} - -function assert(cond, msg) { - if (!cond) { - error(msg); - } -} - -var UNSUPPORTED_FEATURES = PDFJS.UNSUPPORTED_FEATURES = { +exports.OPS = OPS; +var UNSUPPORTED_FEATURES = { unknown: 'unknown', forms: 'forms', javaScript: 'javaScript', @@ -406,117 +520,123 @@ var UNSUPPORTED_FEATURES = PDFJS.UNSUPPORTED_FEATURES = { shadingPattern: 'shadingPattern', font: 'font' }; +exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; +var PasswordResponses = { + NEED_PASSWORD: 1, + INCORRECT_PASSWORD: 2 +}; +exports.PasswordResponses = PasswordResponses; +var verbosity = VerbosityLevel.WARNINGS; -// Combines two URLs. The baseUrl shall be absolute URL. If the url is an -// absolute URL, it will be returned as is. -function combineUrl(baseUrl, url) { - if (!url) { - return baseUrl; +function setVerbosityLevel(level) { + if (Number.isInteger(level)) { + verbosity = level; } - return new URL(url, baseUrl).href; } -// Validates if URL is safe and allowed, e.g. to avoid XSS. -function isValidUrl(url, allowRelative) { +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 isSameOrigin(baseUrl, otherUrl) { + try { + var base = new _url_polyfill.URL(baseUrl); + + if (!base.origin || base.origin === 'null') { + return false; + } + } catch (e) { + return false; + } + + var other = new _url_polyfill.URL(otherUrl, base); + return base.origin === other.origin; +} + +function _isValidProtocol(url) { if (!url) { return false; } - // RFC 3986 (http://tools.ietf.org/html/rfc3986#section-3.1) - // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) - var protocol = /^[a-z][a-z0-9+\-.]*(?=:)/i.exec(url); - if (!protocol) { - return allowRelative; - } - protocol = protocol[0].toLowerCase(); - switch (protocol) { - case 'http': - case 'https': - case 'ftp': - case 'mailto': - case 'tel': + + switch (url.protocol) { + case 'http:': + case 'https:': + case 'ftp:': + case 'mailto:': + case 'tel:': return true; + default: return false; } } -PDFJS.isValidUrl = isValidUrl; -/** - * Adds various attributes (href, title, target, rel) to hyperlinks. - * @param {HTMLLinkElement} link - The link element. - * @param {Object} params - An object with the properties: - * @param {string} params.url - An absolute URL. - */ -function addLinkAttributes(link, params) { - var url = params && params.url; - link.href = link.title = (url ? removeNullCharacters(url) : ''); - - if (url) { - if (isExternalLinkTargetSet()) { - link.target = LinkTargetStringMap[PDFJS.externalLinkTarget]; - } - // Strip referrer from the URL. - link.rel = PDFJS.externalLinkRel; +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; + } + } catch (ex) {} + + return null; } -PDFJS.addLinkAttributes = addLinkAttributes; function shadow(obj, prop, value) { - Object.defineProperty(obj, prop, { value: value, - enumerable: true, - configurable: true, - writable: false }); + Object.defineProperty(obj, prop, { + value: value, + enumerable: true, + configurable: true, + writable: false + }); return value; } -PDFJS.shadow = shadow; -var LinkTarget = PDFJS.LinkTarget = { - NONE: 0, // Default value. - SELF: 1, - BLANK: 2, - PARENT: 3, - TOP: 4, -}; -var LinkTargetStringMap = [ - '', - '_self', - '_blank', - '_parent', - '_top' -]; - -function isExternalLinkTargetSet() { - if (PDFJS.openExternalLinksInNewWindow) { - deprecated('PDFJS.openExternalLinksInNewWindow, please use ' + - '"PDFJS.externalLinkTarget = PDFJS.LinkTarget.BLANK" instead.'); - if (PDFJS.externalLinkTarget === LinkTarget.NONE) { - PDFJS.externalLinkTarget = LinkTarget.BLANK; +function getLookupTableFactory(initializer) { + var lookup; + return function () { + if (initializer) { + lookup = Object.create(null); + initializer(lookup); + initializer = null; } - // Reset the deprecated parameter, to suppress further warnings. - PDFJS.openExternalLinksInNewWindow = false; - } - switch (PDFJS.externalLinkTarget) { - case LinkTarget.NONE: - return false; - case LinkTarget.SELF: - case LinkTarget.BLANK: - case LinkTarget.PARENT: - case LinkTarget.TOP: - return true; - } - warn('PDFJS.externalLinkTarget is invalid: ' + PDFJS.externalLinkTarget); - // Reset the external link target, to suppress further warnings. - PDFJS.externalLinkTarget = LinkTarget.NONE; - return false; + + return lookup; + }; } -PDFJS.isExternalLinkTargetSet = isExternalLinkTargetSet; -var PasswordResponses = PDFJS.PasswordResponses = { - NEED_PASSWORD: 1, - INCORRECT_PASSWORD: 2 -}; - -var PasswordException = (function PasswordExceptionClosure() { +var PasswordException = function PasswordExceptionClosure() { function PasswordException(msg, code) { this.name = 'PasswordException'; this.message = msg; @@ -525,12 +645,12 @@ var PasswordException = (function PasswordExceptionClosure() { PasswordException.prototype = new Error(); PasswordException.constructor = PasswordException; - return PasswordException; -})(); -PDFJS.PasswordException = PasswordException; +}(); -var UnknownErrorException = (function UnknownErrorExceptionClosure() { +exports.PasswordException = PasswordException; + +var UnknownErrorException = function UnknownErrorExceptionClosure() { function UnknownErrorException(msg, details) { this.name = 'UnknownErrorException'; this.message = msg; @@ -539,12 +659,12 @@ var UnknownErrorException = (function UnknownErrorExceptionClosure() { UnknownErrorException.prototype = new Error(); UnknownErrorException.constructor = UnknownErrorException; - return UnknownErrorException; -})(); -PDFJS.UnknownErrorException = UnknownErrorException; +}(); -var InvalidPDFException = (function InvalidPDFExceptionClosure() { +exports.UnknownErrorException = UnknownErrorException; + +var InvalidPDFException = function InvalidPDFExceptionClosure() { function InvalidPDFException(msg) { this.name = 'InvalidPDFException'; this.message = msg; @@ -552,12 +672,12 @@ var InvalidPDFException = (function InvalidPDFExceptionClosure() { InvalidPDFException.prototype = new Error(); InvalidPDFException.constructor = InvalidPDFException; - return InvalidPDFException; -})(); -PDFJS.InvalidPDFException = InvalidPDFException; +}(); -var MissingPDFException = (function MissingPDFExceptionClosure() { +exports.InvalidPDFException = InvalidPDFException; + +var MissingPDFException = function MissingPDFExceptionClosure() { function MissingPDFException(msg) { this.name = 'MissingPDFException'; this.message = msg; @@ -565,13 +685,12 @@ var MissingPDFException = (function MissingPDFExceptionClosure() { MissingPDFException.prototype = new Error(); MissingPDFException.constructor = MissingPDFException; - return MissingPDFException; -})(); -PDFJS.MissingPDFException = MissingPDFException; +}(); -var UnexpectedResponseException = - (function UnexpectedResponseExceptionClosure() { +exports.MissingPDFException = MissingPDFException; + +var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() { function UnexpectedResponseException(msg, status) { this.name = 'UnexpectedResponseException'; this.message = msg; @@ -580,24 +699,12 @@ var UnexpectedResponseException = UnexpectedResponseException.prototype = new Error(); UnexpectedResponseException.constructor = UnexpectedResponseException; - return UnexpectedResponseException; -})(); -PDFJS.UnexpectedResponseException = UnexpectedResponseException; +}(); -var NotImplementedException = (function NotImplementedExceptionClosure() { - function NotImplementedException(msg) { - this.message = msg; - } +exports.UnexpectedResponseException = UnexpectedResponseException; - NotImplementedException.prototype = new Error(); - NotImplementedException.prototype.name = 'NotImplementedException'; - NotImplementedException.constructor = NotImplementedException; - - return NotImplementedException; -})(); - -var MissingDataException = (function MissingDataExceptionClosure() { +var MissingDataException = function MissingDataExceptionClosure() { function MissingDataException(begin, end) { this.begin = begin; this.end = end; @@ -607,11 +714,25 @@ var MissingDataException = (function MissingDataExceptionClosure() { MissingDataException.prototype = new Error(); MissingDataException.prototype.name = 'MissingDataException'; MissingDataException.constructor = MissingDataException; - return MissingDataException; -})(); +}(); -var XRefParseException = (function XRefParseExceptionClosure() { +exports.MissingDataException = MissingDataException; + +var XRefEntryException = function XRefEntryExceptionClosure() { + function XRefEntryException(msg) { + this.message = msg; + } + + XRefEntryException.prototype = new Error(); + XRefEntryException.prototype.name = 'XRefEntryException'; + XRefEntryException.constructor = XRefEntryException; + return XRefEntryException; +}(); + +exports.XRefEntryException = XRefEntryException; + +var XRefParseException = function XRefParseExceptionClosure() { function XRefParseException(msg) { this.message = msg; } @@ -619,10 +740,36 @@ var XRefParseException = (function XRefParseExceptionClosure() { XRefParseException.prototype = new Error(); XRefParseException.prototype.name = 'XRefParseException'; XRefParseException.constructor = XRefParseException; - return XRefParseException; -})(); +}(); +exports.XRefParseException = XRefParseException; + +var FormatError = function FormatErrorClosure() { + function FormatError(msg) { + this.message = msg; + } + + FormatError.prototype = new Error(); + FormatError.prototype.name = 'FormatError'; + FormatError.constructor = FormatError; + return FormatError; +}(); + +exports.FormatError = FormatError; + +var AbortException = function AbortExceptionClosure() { + function AbortException(msg) { + this.name = 'AbortException'; + this.message = msg; + } + + AbortException.prototype = new Error(); + AbortException.constructor = AbortException; + return AbortException; +}(); + +exports.AbortException = AbortException; var NullCharactersRegExp = /\x00/g; function removeNullCharacters(str) { @@ -630,24 +777,27 @@ function removeNullCharacters(str) { warn('The argument for removeNullCharacters must be a string.'); return str; } + return str.replace(NullCharactersRegExp, ''); } -PDFJS.removeNullCharacters = removeNullCharacters; function bytesToString(bytes) { - assert(bytes !== null && typeof bytes === 'object' && - bytes.length !== undefined, 'Invalid argument for bytesToString'); + 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); } + 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 strBuf.join(''); } @@ -655,122 +805,143 @@ 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; } + return bytes; } +function arrayByteLength(arr) { + if (arr.length !== undefined) { + return arr.length; + } + + assert(arr.byteLength !== undefined); + return arr.byteLength; +} + +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 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); + } + } + + 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); + return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); } function log2(x) { - var n = 1, i = 0; - while (x > n) { - n <<= 1; - i++; + if (x <= 0) { + return 0; } - return i; + + return Math.ceil(Math.log2(x)); } function readInt8(data, start) { - return (data[start] << 24) >> 24; + return data[start] << 24 >> 24; } function readUint16(data, offset) { - return (data[offset] << 8) | data[offset + 1]; + 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; + return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; } -// Lazy test the endianness of the platform -// NOTE: This will be 'true' for simulated TypedArrays function isLittleEndian() { - var buffer8 = new Uint8Array(2); + var buffer8 = new Uint8Array(4); buffer8[0] = 1; - var buffer16 = new Uint16Array(buffer8.buffer); - return (buffer16[0] === 1); + var view32 = new Uint32Array(buffer8.buffer, 0, 1); + return view32[0] === 1; } -Object.defineProperty(PDFJS, 'isLittleEndian', { - configurable: true, - get: function PDFJS_isLittleEndian() { - return shadow(PDFJS, 'isLittleEndian', isLittleEndian()); +function isEvalSupported() { + try { + new Function(''); + return true; + } catch (e) { + return false; } -}); - - // Lazy test if the userAgent support CanvasTypedArrays -function hasCanvasTypedArrays() { - var canvas = document.createElement('canvas'); - canvas.width = canvas.height = 1; - var ctx = canvas.getContext('2d'); - var imageData = ctx.createImageData(1, 1); - return (typeof imageData.data.buffer !== 'undefined'); } -Object.defineProperty(PDFJS, 'hasCanvasTypedArrays', { - configurable: true, - get: function PDFJS_hasCanvasTypedArrays() { - return shadow(PDFJS, 'hasCanvasTypedArrays', hasCanvasTypedArrays()); - } -}); +function getInheritableProperty(_ref) { + var dict = _ref.dict, + key = _ref.key, + _ref$getArray = _ref.getArray, + getArray = _ref$getArray === void 0 ? false : _ref$getArray, + _ref$stopWhenFound = _ref.stopWhenFound, + stopWhenFound = _ref$stopWhenFound === void 0 ? true : _ref$stopWhenFound; + var LOOP_LIMIT = 100; + var loopCount = 0; + var values; -var Uint32ArrayView = (function Uint32ArrayViewClosure() { + while (dict) { + var value = getArray ? dict.getArray(key) : dict.get(key); - function Uint32ArrayView(buffer, length) { - this.buffer = buffer; - this.byteLength = buffer.length; - this.length = length === undefined ? (this.byteLength >> 2) : length; - ensureUint32ArrayViewProps(this.length); - } - Uint32ArrayView.prototype = Object.create(null); - - var uint32ArrayViewSetters = 0; - function createUint32ArrayProp(index) { - return { - get: function () { - var buffer = this.buffer, offset = index << 2; - return (buffer[offset] | (buffer[offset + 1] << 8) | - (buffer[offset + 2] << 16) | (buffer[offset + 3] << 24)) >>> 0; - }, - set: function (value) { - var buffer = this.buffer, offset = index << 2; - buffer[offset] = value & 255; - buffer[offset + 1] = (value >> 8) & 255; - buffer[offset + 2] = (value >> 16) & 255; - buffer[offset + 3] = (value >>> 24) & 255; + if (value !== undefined) { + if (stopWhenFound) { + return value; } - }; - } - function ensureUint32ArrayViewProps(length) { - while (uint32ArrayViewSetters < length) { - Object.defineProperty(Uint32ArrayView.prototype, - uint32ArrayViewSetters, - createUint32ArrayProp(uint32ArrayViewSetters)); - uint32ArrayViewSetters++; + if (!values) { + values = []; + } + + values.push(value); } + + if (++loopCount > LOOP_LIMIT) { + warn("getInheritableProperty: maximum loop count exceeded for \"".concat(key, "\"")); + break; + } + + dict = dict.get('Parent'); } - return Uint32ArrayView; -})(); + return values; +} -exports.Uint32ArrayView = Uint32ArrayView; - -var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; - -var Util = PDFJS.Util = (function UtilClosure() { +var Util = function UtilClosure() { function Util() {} var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')']; - // makeCssRgb() can be called thousands of times. Using |rgbBuf| avoids - // creating many intermediate strings. Util.makeCssRgb = function Util_makeCssRgb(r, g, b) { rgbBuf[1] = r; rgbBuf[3] = g; @@ -778,19 +949,10 @@ var Util = PDFJS.Util = (function UtilClosure() { return rgbBuf.join(''); }; - // Concatenates two transformation matrices together and returns the result. 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] - ]; + 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]]; }; - // For 2d affine transforms 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]; @@ -804,114 +966,71 @@ var Util = PDFJS.Util = (function UtilClosure() { return [xt, yt]; }; - // Applies the transform to the rectangle and finds the minimum axially - // aligned bounding box. - Util.getAxialAlignedBoundingBox = - function Util_getAxialAlignedBoundingBox(r, m) { - + 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]) - ]; + 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]; + 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]; }; - // Apply a generic 3d matrix M on a 3-vector v: - // | a b c | | X | - // | d e f | x | Y | - // | g h i | | Z | - // M is assumed to be serialized as [a,b,c,d,e,f,g,h,i], - // with v as [X,Y,Z] 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] - ]; + 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]]; }; - // This calculation uses Singular Value Decomposition. - // The SVD can be represented with formula A = USV. We are interested in the - // matrix S here because it represents the scale values. - Util.singularValueDecompose2dScale = - function Util_singularValueDecompose2dScale(m) { - + Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) { var transpose = [m[0], m[2], m[1], m[3]]; - - // Multiply matrix m with its transpose. 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]; - - // Solve the second degree polynomial to get roots. 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; - - // Scale values are the square roots of the eigenvalues. return [Math.sqrt(sx), Math.sqrt(sy)]; }; - // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2) - // For coordinate systems whose origin lies in the bottom-left, this - // means normalization to (BL,TR) ordering. For systems with origin in the - // top-left, this means (TL,BR) ordering. Util.normalizeRect = function Util_normalizeRect(rect) { - var r = rect.slice(0); // clone 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; }; - // Returns a rectangle [x1, y1, x2, y2] corresponding to the - // intersection of rect1 and rect2. If no intersection, returns 'false' - // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2] Util.intersect = function Util_intersect(rect1, rect2) { function compare(a, b) { return a - b; } - // Order points along the axes 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); - // X: first and second points belong to different rectangles? - if ((orderedX[0] === rect1[0] && orderedX[1] === rect2[0]) || - (orderedX[0] === rect2[0] && orderedX[1] === rect1[0])) { - // Intersection must be between second and third points + 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; } - // Y: first and second points belong to different rectangles? - if ((orderedY[0] === rect1[1] && orderedY[1] === rect2[1]) || - (orderedY[0] === rect2[1] && orderedY[1] === rect1[1])) { - // Intersection must be between second and third points + 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 { @@ -921,252 +1040,44 @@ var Util = PDFJS.Util = (function UtilClosure() { return result; }; - Util.sign = function Util_sign(num) { - return num < 0 ? -1 : 1; - }; - - 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' - ]; - /** - * Converts positive integers to (upper case) Roman numerals. - * @param {integer} number - The number that should be converted. - * @param {boolean} lowerCase - Indicates if the result should be converted - * to lower case letters. The default is false. - * @return {string} The resulting Roman number. - */ - Util.toRoman = function Util_toRoman(number, lowerCase) { - assert(isInt(number) && number > 0, - 'The number should be a positive integer.'); - var pos, romanBuf = []; - // Thousands - while (number >= 1000) { - number -= 1000; - romanBuf.push('M'); - } - // Hundreds - pos = (number / 100) | 0; - number %= 100; - romanBuf.push(ROMAN_NUMBER_MAP[pos]); - // Tens - pos = (number / 10) | 0; - number %= 10; - romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); - // Ones - romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); - - var romanStr = romanBuf.join(''); - return (lowerCase ? romanStr.toLowerCase() : romanStr); - }; - - Util.appendToArray = function Util_appendToArray(arr1, arr2) { - Array.prototype.push.apply(arr1, arr2); - }; - - Util.prependToArray = function Util_prependToArray(arr1, arr2) { - Array.prototype.unshift.apply(arr1, arr2); - }; - - Util.extendObj = function extendObj(obj1, obj2) { - for (var key in obj2) { - obj1[key] = obj2[key]; - } - }; - - Util.getInheritableProperty = function Util_getInheritableProperty(dict, - name) { - while (dict && !dict.has(name)) { - dict = dict.get('Parent'); - } - if (!dict) { - return null; - } - return dict.get(name); - }; - - Util.inherit = function Util_inherit(sub, base, prototype) { - sub.prototype = Object.create(base.prototype); - sub.prototype.constructor = sub; - for (var prop in prototype) { - sub.prototype[prop] = prototype[prop]; - } - }; - - Util.loadScript = function Util_loadScript(src, callback) { - var script = document.createElement('script'); - var loaded = false; - script.setAttribute('src', src); - if (callback) { - script.onload = function() { - if (!loaded) { - callback(); - } - loaded = true; - }; - } - document.getElementsByTagName('head')[0].appendChild(script); - }; - return Util; -})(); +}(); -/** - * PDF page viewport created based on scale, rotation and offset. - * @class - * @alias PDFJS.PageViewport - */ -var PageViewport = PDFJS.PageViewport = (function PageViewportClosure() { - /** - * @constructor - * @private - * @param viewBox {Array} xMin, yMin, xMax and yMax coordinates. - * @param scale {number} scale of the viewport. - * @param rotation {number} rotations of the viewport in degrees. - * @param offsetX {number} offset X - * @param offsetY {number} offset Y - * @param dontFlip {boolean} if true, axis Y will not be flipped. - */ - function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) { - this.viewBox = viewBox; - this.scale = scale; - this.rotation = rotation; - this.offsetX = offsetX; - this.offsetY = offsetY; +exports.Util = 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']; - // creating transform to convert pdf coordinate system to the normal - // canvas like coordinates taking in account scale and rotation - 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: - default: - rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1; - break; - } +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, + romanBuf = []; - 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; - } - // creating transform for the following operations: - // translate(-centerX, -centerY), rotate and flip vertically, - // scale, and translate(offsetCanvasX, offsetCanvasY) - 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; - this.fontScale = scale; + while (number >= 1000) { + number -= 1000; + romanBuf.push('M'); } - PageViewport.prototype = /** @lends PDFJS.PageViewport.prototype */ { - /** - * Clones viewport with additional properties. - * @param args {Object} (optional) If specified, may contain the 'scale' or - * 'rotation' properties to override the corresponding properties in - * the cloned viewport. - * @returns {PDFJS.PageViewport} Cloned viewport. - */ - clone: function PageViewPort_clone(args) { - args = args || {}; - var scale = 'scale' in args ? args.scale : this.scale; - var rotation = 'rotation' in args ? args.rotation : this.rotation; - return new PageViewport(this.viewBox.slice(), scale, rotation, - this.offsetX, this.offsetY, args.dontFlip); - }, - /** - * Converts PDF point to the viewport coordinates. For examples, useful for - * converting PDF location into canvas pixel coordinates. - * @param x {number} X coordinate. - * @param y {number} Y coordinate. - * @returns {Object} Object that contains 'x' and 'y' properties of the - * point in the viewport coordinate space. - * @see {@link convertToPdfPoint} - * @see {@link convertToViewportRectangle} - */ - convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) { - return Util.applyTransform([x, y], this.transform); - }, - /** - * Converts PDF rectangle to the viewport coordinates. - * @param rect {Array} xMin, yMin, xMax and yMax coordinates. - * @returns {Array} Contains corresponding coordinates of the rectangle - * in the viewport coordinate space. - * @see {@link convertToViewportPoint} - */ - convertToViewportRectangle: - function PageViewport_convertToViewportRectangle(rect) { - var tl = Util.applyTransform([rect[0], rect[1]], this.transform); - var br = Util.applyTransform([rect[2], rect[3]], this.transform); - return [tl[0], tl[1], br[0], br[1]]; - }, - /** - * Converts viewport coordinates to the PDF location. For examples, useful - * for converting canvas pixel location into PDF one. - * @param x {number} X coordinate. - * @param y {number} Y coordinate. - * @returns {Object} Object that contains 'x' and 'y' properties of the - * point in the PDF coordinate space. - * @see {@link convertToViewportPoint} - */ - convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) { - return Util.applyInverseTransform([x, y], this.transform); - } - }; - return PageViewport; -})(); -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 -]; + 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 = []; + var i, + n = str.length, + strBuf = []; + if (str[0] === '\xFE' && str[1] === '\xFF') { - // UTF16BE BOM for (i = 2; i < n; i += 2) { - strBuf.push(String.fromCharCode( - (str.charCodeAt(i) << 8) | str.charCodeAt(i + 1))); + strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1))); } } else { for (i = 0; i < n; ++i) { @@ -1174,6 +1085,7 @@ function stringToPDFString(str) { strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); } } + return strBuf.join(''); } @@ -1189,6 +1101,7 @@ function isEmptyObj(obj) { for (var key in obj) { return false; } + return true; } @@ -1196,10 +1109,6 @@ function isBool(v) { return typeof v === 'boolean'; } -function isInt(v) { - return typeof v === 'number' && ((v | 0) === v); -} - function isNum(v) { return typeof v === 'number'; } @@ -1208,619 +1117,8065 @@ function isString(v) { return typeof v === 'string'; } -function isArray(v) { - return v instanceof Array; -} - function isArrayBuffer(v) { - return typeof v === 'object' && v !== null && v.byteLength !== undefined; + return _typeof(v) === 'object' && v !== null && v.byteLength !== undefined; } -/** - * Promise Capability object. - * - * @typedef {Object} PromiseCapability - * @property {Promise} promise - A promise object. - * @property {function} resolve - Fullfills the promise. - * @property {function} reject - Rejects the promise. - */ +function isSpace(ch) { + return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A; +} -/** - * Creates a promise capability object. - * @alias PDFJS.createPromiseCapability - * - * @return {PromiseCapability} A capability object contains: - * - a Promise, resolve and reject methods. - */ function createPromiseCapability() { - var capability = {}; + var capability = Object.create(null); + var isSettled = false; + Object.defineProperty(capability, 'settled', { + get: function get() { + return isSettled; + } + }); capability.promise = new Promise(function (resolve, reject) { - capability.resolve = resolve; - capability.reject = reject; + capability.resolve = function (data) { + isSettled = true; + resolve(data); + }; + + capability.reject = function (reason) { + isSettled = true; + reject(reason); + }; }); return capability; } -PDFJS.createPromiseCapability = createPromiseCapability; - -/** - * Polyfill for Promises: - * The following promise implementation tries to generally implement the - * Promise/A+ spec. Some notable differences from other promise libaries are: - * - There currently isn't a seperate deferred and promise object. - * - Unhandled rejections eventually show an error if they aren't handled. - * - * Based off of the work in: - * https://bugzilla.mozilla.org/show_bug.cgi?id=810490 - */ -(function PromiseClosure() { - if (globalScope.Promise) { - // Promises existing in the DOM/Worker, checking presence of all/resolve - if (typeof globalScope.Promise.all !== 'function') { - globalScope.Promise.all = function (iterable) { - var count = 0, results = [], resolve, reject; - var promise = new globalScope.Promise(function (resolve_, reject_) { - resolve = resolve_; - reject = reject_; - }); - iterable.forEach(function (p, i) { - count++; - p.then(function (result) { - results[i] = result; - count--; - if (count === 0) { - resolve(results); - } - }, reject); - }); - if (count === 0) { - resolve(results); - } - return promise; - }; - } - if (typeof globalScope.Promise.resolve !== 'function') { - globalScope.Promise.resolve = function (value) { - return new globalScope.Promise(function (resolve) { resolve(value); }); - }; - } - if (typeof globalScope.Promise.reject !== 'function') { - globalScope.Promise.reject = function (reason) { - return new globalScope.Promise(function (resolve, reject) { - reject(reason); - }); - }; - } - if (typeof globalScope.Promise.prototype.catch !== 'function') { - globalScope.Promise.prototype.catch = function (onReject) { - return globalScope.Promise.prototype.then(undefined, onReject); - }; - } - return; - } - var STATUS_PENDING = 0; - var STATUS_RESOLVED = 1; - var STATUS_REJECTED = 2; - - // In an attempt to avoid silent exceptions, unhandled rejections are - // tracked and if they aren't handled in a certain amount of time an - // error is logged. - var REJECTION_TIMEOUT = 500; - - var HandlerManager = { - handlers: [], - running: false, - unhandledRejections: [], - pendingRejectionCheck: false, - - scheduleHandlers: function scheduleHandlers(promise) { - if (promise._status === STATUS_PENDING) { - return; - } - - this.handlers = this.handlers.concat(promise._handlers); - promise._handlers = []; - - if (this.running) { - return; - } - this.running = true; - - setTimeout(this.runHandlers.bind(this), 0); - }, - - runHandlers: function runHandlers() { - var RUN_TIMEOUT = 1; // ms - var timeoutAt = Date.now() + RUN_TIMEOUT; - while (this.handlers.length > 0) { - var handler = this.handlers.shift(); - - var nextStatus = handler.thisPromise._status; - var nextValue = handler.thisPromise._value; - - try { - if (nextStatus === STATUS_RESOLVED) { - if (typeof handler.onResolve === 'function') { - nextValue = handler.onResolve(nextValue); - } - } else if (typeof handler.onReject === 'function') { - nextValue = handler.onReject(nextValue); - nextStatus = STATUS_RESOLVED; - - if (handler.thisPromise._unhandledRejection) { - this.removeUnhandeledRejection(handler.thisPromise); - } - } - } catch (ex) { - nextStatus = STATUS_REJECTED; - nextValue = ex; - } - - handler.nextPromise._updateStatus(nextStatus, nextValue); - if (Date.now() >= timeoutAt) { - break; - } - } - - if (this.handlers.length > 0) { - setTimeout(this.runHandlers.bind(this), 0); - return; - } - - this.running = false; - }, - - addUnhandledRejection: function addUnhandledRejection(promise) { - this.unhandledRejections.push({ - promise: promise, - time: Date.now() - }); - this.scheduleRejectionCheck(); - }, - - removeUnhandeledRejection: function removeUnhandeledRejection(promise) { - promise._unhandledRejection = false; - for (var i = 0; i < this.unhandledRejections.length; i++) { - if (this.unhandledRejections[i].promise === promise) { - this.unhandledRejections.splice(i); - i--; - } - } - }, - - scheduleRejectionCheck: function scheduleRejectionCheck() { - if (this.pendingRejectionCheck) { - return; - } - this.pendingRejectionCheck = true; - setTimeout(function rejectionCheck() { - this.pendingRejectionCheck = false; - var now = Date.now(); - for (var i = 0; i < this.unhandledRejections.length; i++) { - if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) { - var unhandled = this.unhandledRejections[i].promise._value; - var msg = 'Unhandled rejection: ' + unhandled; - if (unhandled.stack) { - msg += '\n' + unhandled.stack; - } - warn(msg); - this.unhandledRejections.splice(i); - i--; - } - } - if (this.unhandledRejections.length) { - this.scheduleRejectionCheck(); - } - }.bind(this), REJECTION_TIMEOUT); - } - }; - - function Promise(resolver) { - this._status = STATUS_PENDING; - this._handlers = []; - try { - resolver.call(this, this._resolve.bind(this), this._reject.bind(this)); - } catch (e) { - this._reject(e); - } - } - /** - * Builds a promise that is resolved when all the passed in promises are - * resolved. - * @param {array} array of data and/or promises to wait for. - * @return {Promise} New dependant promise. - */ - Promise.all = function Promise_all(promises) { - var resolveAll, rejectAll; - var deferred = new Promise(function (resolve, reject) { - resolveAll = resolve; - rejectAll = reject; - }); - var unresolved = promises.length; - var results = []; - if (unresolved === 0) { - resolveAll(results); - return deferred; - } - function reject(reason) { - if (deferred._status === STATUS_REJECTED) { - return; - } - results = []; - rejectAll(reason); - } - for (var i = 0, ii = promises.length; i < ii; ++i) { - var promise = promises[i]; - var resolve = (function(i) { - return function(value) { - if (deferred._status === STATUS_REJECTED) { - return; - } - results[i] = value; - unresolved--; - if (unresolved === 0) { - resolveAll(results); - } - }; - })(i); - if (Promise.isPromise(promise)) { - promise.then(resolve, reject); - } else { - resolve(promise); - } - } - return deferred; - }; - - /** - * Checks if the value is likely a promise (has a 'then' function). - * @return {boolean} true if value is thenable - */ - Promise.isPromise = function Promise_isPromise(value) { - return value && typeof value.then === 'function'; - }; - - /** - * Creates resolved promise - * @param value resolve value - * @returns {Promise} - */ - Promise.resolve = function Promise_resolve(value) { - return new Promise(function (resolve) { resolve(value); }); - }; - - /** - * Creates rejected promise - * @param reason rejection value - * @returns {Promise} - */ - Promise.reject = function Promise_reject(reason) { - return new Promise(function (resolve, reject) { reject(reason); }); - }; - - Promise.prototype = { - _status: null, - _value: null, - _handlers: null, - _unhandledRejection: null, - - _updateStatus: function Promise__updateStatus(status, value) { - if (this._status === STATUS_RESOLVED || - this._status === STATUS_REJECTED) { - return; - } - - if (status === STATUS_RESOLVED && - Promise.isPromise(value)) { - value.then(this._updateStatus.bind(this, STATUS_RESOLVED), - this._updateStatus.bind(this, STATUS_REJECTED)); - return; - } - - this._status = status; - this._value = value; - - if (status === STATUS_REJECTED && this._handlers.length === 0) { - this._unhandledRejection = true; - HandlerManager.addUnhandledRejection(this); - } - - HandlerManager.scheduleHandlers(this); - }, - - _resolve: function Promise_resolve(value) { - this._updateStatus(STATUS_RESOLVED, value); - }, - - _reject: function Promise_reject(reason) { - this._updateStatus(STATUS_REJECTED, reason); - }, - - then: function Promise_then(onResolve, onReject) { - var nextPromise = new Promise(function (resolve, reject) { - this.resolve = resolve; - this.reject = reject; - }); - this._handlers.push({ - thisPromise: this, - onResolve: onResolve, - onReject: onReject, - nextPromise: nextPromise - }); - HandlerManager.scheduleHandlers(this); - return nextPromise; - }, - - catch: function Promise_catch(onReject) { - return this.then(undefined, onReject); - } - }; - - globalScope.Promise = Promise; -})(); - -var StatTimer = (function StatTimerClosure() { - function rpad(str, pad, length) { - while (str.length < length) { - str += pad; - } - return str; - } - function StatTimer() { - this.started = {}; - this.times = []; - this.enabled = true; - } - StatTimer.prototype = { - time: function StatTimer_time(name) { - if (!this.enabled) { - return; - } - if (name in this.started) { - warn('Timer is already running for ' + name); - } - this.started[name] = Date.now(); - }, - timeEnd: function StatTimer_timeEnd(name) { - if (!this.enabled) { - return; - } - if (!(name in this.started)) { - warn('Timer has not been started for ' + name); - } - this.times.push({ - 'name': name, - 'start': this.started[name], - 'end': Date.now() - }); - // Remove timer from started so it can be called again. - delete this.started[name]; - }, - toString: function StatTimer_toString() { - var i, ii; - var times = this.times; - var out = ''; - // Find the longest name for padding purposes. - var longest = 0; - for (i = 0, ii = times.length; i < ii; ++i) { - var name = times[i]['name']; - if (name.length > longest) { - longest = name.length; - } - } - for (i = 0, ii = times.length; i < ii; ++i) { - var span = times[i]; - var duration = span.end - span.start; - out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n'; - } - return out; - } - }; - return StatTimer; -})(); - -PDFJS.createBlob = function createBlob(data, contentType) { - if (typeof Blob !== 'undefined') { - return new Blob([data], { type: contentType }); - } - // Blob builder is deprecated in FF14 and removed in FF18. - var bb = new MozBlobBuilder(); - bb.append(data); - return bb.getBlob(contentType); -}; - -PDFJS.createObjectURL = (function createObjectURLClosure() { - // Blob/createObjectURL is not available, falling back to data schema. - var digits = - 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; - +var createObjectURL = function createObjectURLClosure() { + var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; return function createObjectURL(data, contentType) { - if (!PDFJS.disableCreateObjectURL && - typeof URL !== 'undefined' && URL.createObjectURL) { - var blob = PDFJS.createBlob(data, contentType); - return URL.createObjectURL(blob); + 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; + 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; }; -})(); +}(); -function MessageHandler(sourceName, targetName, comObj) { - this.sourceName = sourceName; - this.targetName = targetName; - this.comObj = comObj; - this.callbackIndex = 1; - this.postMessageTransfers = true; - var callbacksCapabilities = this.callbacksCapabilities = {}; - var ah = this.actionHandler = {}; +exports.createObjectURL = createObjectURL; - this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) { - var data = event.data; - if (data.targetName !== this.sourceName) { +/***/ }), +/* 2 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +function _typeof(obj) { 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 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; } - 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(data.error); - } else { - callback.resolve(data.data); - } - } else { - 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) { - if (reason instanceof Error) { - // Serialize error to avoid "DataCloneError" - reason = reason + ''; - } - comObj.postMessage({ - sourceName: sourceName, - targetName: targetName, - isReply: true, - callbackId: data.callbackId, - error: reason - }); - }); - } else { - action[0].call(action[1], data.data); - } - } else { - error('Unknown action from worker: ' + data.action); + + globalScope.btoa = function (chars) { + return Buffer.from(chars, 'binary').toString('base64'); + }; + })(); + + (function checkNodeAtob() { + if (globalScope.atob || !isNodeJS()) { + return; } - }.bind(this); - comObj.addEventListener('message', this._onComObjOnMessage); + + globalScope.atob = function (input) { + return Buffer.from(input, 'base64').toString('binary'); + }; + })(); + + (function checkChildNodeRemove() { + if (!hasDOM) { + return; + } + + if (typeof Element.prototype.remove !== 'undefined') { + return; + } + + Element.prototype.remove = function () { + if (this.parentNode) { + this.parentNode.removeChild(this); + } + }; + })(); + + (function checkDOMTokenListAddRemove() { + if (!hasDOM || isNodeJS()) { + return; + } + + var div = document.createElement('div'); + div.classList.add('testOne', 'testTwo'); + + if (div.classList.contains('testOne') === true && div.classList.contains('testTwo') === true) { + return; + } + + var OriginalDOMTokenListAdd = DOMTokenList.prototype.add; + var OriginalDOMTokenListRemove = DOMTokenList.prototype.remove; + + 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; _i < tokens.length; _i++) { + var token = tokens[_i]; + OriginalDOMTokenListAdd.call(this, token); + } + }; + + DOMTokenList.prototype.remove = function () { + for (var _len2 = arguments.length, tokens = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + tokens[_key2] = arguments[_key2]; + } + + for (var _i2 = 0; _i2 < tokens.length; _i2++) { + var token = tokens[_i2]; + OriginalDOMTokenListRemove.call(this, token); + } + }; + })(); + + (function checkDOMTokenListToggle() { + if (!hasDOM || isNodeJS()) { + return; + } + + var div = document.createElement('div'); + + if (div.classList.toggle('test', 0) === false) { + return; + } + + DOMTokenList.prototype.toggle = function (token) { + var force = arguments.length > 1 ? !!arguments[1] : !this.contains(token); + return this[force ? 'add' : 'remove'](token), force; + }; + })(); + + (function checkStringStartsWith() { + if (String.prototype.startsWith) { + return; + } + + __w_pdfjs_require__(5); + })(); + + (function checkStringEndsWith() { + if (String.prototype.endsWith) { + return; + } + + __w_pdfjs_require__(35); + })(); + + (function checkStringIncludes() { + if (String.prototype.includes) { + return; + } + + __w_pdfjs_require__(37); + })(); + + (function checkArrayIncludes() { + if (Array.prototype.includes) { + return; + } + + __w_pdfjs_require__(39); + })(); + + (function checkArrayFrom() { + if (Array.from) { + return; + } + + __w_pdfjs_require__(46); + })(); + + (function checkObjectAssign() { + if (Object.assign) { + return; + } + + __w_pdfjs_require__(69); + })(); + + (function checkMathLog2() { + if (Math.log2) { + return; + } + + Math.log2 = __w_pdfjs_require__(74); + })(); + + (function checkNumberIsNaN() { + if (Number.isNaN) { + return; + } + + Number.isNaN = __w_pdfjs_require__(76); + })(); + + (function checkNumberIsInteger() { + if (Number.isInteger) { + return; + } + + Number.isInteger = __w_pdfjs_require__(78); + })(); + + (function checkPromise() { + if (globalScope.Promise && globalScope.Promise.prototype && globalScope.Promise.prototype.finally) { + return; + } + + globalScope.Promise = __w_pdfjs_require__(81); + })(); + + (function checkWeakMap() { + if (globalScope.WeakMap) { + return; + } + + globalScope.WeakMap = __w_pdfjs_require__(101); + })(); + + (function checkWeakSet() { + if (globalScope.WeakSet) { + return; + } + + globalScope.WeakSet = __w_pdfjs_require__(118); + })(); + + (function checkStringCodePointAt() { + if (String.codePointAt) { + return; + } + + String.codePointAt = __w_pdfjs_require__(122); + })(); + + (function checkStringFromCodePoint() { + if (String.fromCodePoint) { + return; + } + + String.fromCodePoint = __w_pdfjs_require__(124); + })(); + + (function checkSymbol() { + if (globalScope.Symbol) { + return; + } + + __w_pdfjs_require__(126); + })(); + + (function checkStringPadStart() { + if (String.prototype.padStart) { + return; + } + + __w_pdfjs_require__(133); + })(); + + (function checkStringPadEnd() { + if (String.prototype.padEnd) { + return; + } + + __w_pdfjs_require__(137); + })(); + + (function checkObjectValues() { + if (Object.values) { + return; + } + + Object.values = __w_pdfjs_require__(139); + })(); } -MessageHandler.prototype = { - on: function messageHandlerOn(actionName, handler, scope) { - var ah = this.actionHandler; - if (ah[actionName]) { - error('There is already an actionName called "' + actionName + '"'); - } - ah[actionName] = [handler, scope]; - }, - /** - * Sends a message to the comObj to invoke the action with the supplied data. - * @param {String} actionName Action to call. - * @param {JSON} data JSON data to send. - * @param {Array} [transfers] Optional list of transfers/ArrayBuffers - */ - send: function messageHandlerSend(actionName, data, transfers) { - var message = { - sourceName: this.sourceName, - targetName: this.targetName, - action: actionName, - data: data - }; - this.postMessage(message, transfers); - }, - /** - * Sends a message to the comObj to invoke the action with the supplied data. - * Expects that other side will callback with the response. - * @param {String} actionName Action to call. - * @param {JSON} data JSON data to send. - * @param {Array} [transfers] Optional list of transfers/ArrayBuffers. - * @returns {Promise} Promise to be resolved with response data. - */ - sendWithPromise: - function messageHandlerSendWithPromise(actionName, data, transfers) { - var callbackId = this.callbackIndex++; - var message = { - sourceName: this.sourceName, - targetName: this.targetName, - action: actionName, - data: data, - callbackId: callbackId - }; - var capability = createPromiseCapability(); - this.callbacksCapabilities[callbackId] = capability; - try { - this.postMessage(message, transfers); - } catch (e) { - capability.reject(e); - } - return capability.promise; - }, - /** - * Sends raw message to the comObj. - * @private - * @param message {Object} Raw message. - * @param transfers List of transfers/ArrayBuffers, or undefined. - */ - postMessage: function (message, transfers) { - if (transfers && this.postMessageTransfers) { - this.comObj.postMessage(message, transfers); - } else { - this.comObj.postMessage(message); - } - }, +/***/ }), +/* 3 */ +/***/ (function(module, exports, __w_pdfjs_require__) { - destroy: function () { - this.comObj.removeEventListener('message', this._onComObjOnMessage); +"use strict"; + + +module.exports = typeof window !== 'undefined' && window.Math === Math ? window : typeof global !== 'undefined' && global.Math === Math ? global : typeof self !== 'undefined' && self.Math === Math ? self : {}; + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +function _typeof(obj) { 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); } + +module.exports = function isNodeJS() { + return (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && process + '' === '[object process]' && !process.versions['nw']; +}; + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(6); + +module.exports = __w_pdfjs_require__(9).String.startsWith; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var toLength = __w_pdfjs_require__(25); + +var context = __w_pdfjs_require__(27); + +var STARTS_WITH = 'startsWith'; +var $startsWith = ''[STARTS_WITH]; +$export($export.P + $export.F * __w_pdfjs_require__(34)(STARTS_WITH), 'String', { + startsWith: function startsWith(searchString) { + var that = context(this, searchString, STARTS_WITH); + var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)); + var search = String(searchString); + return $startsWith ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search; + } +}); + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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 loadJpegStream(id, imageUrl, objs) { - var img = new Image(); - img.onload = (function loadJpegStream_onloadClosure() { - objs.resolve(id, img); +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 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; + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var core = module.exports = { + version: '2.6.2' +}; +if (typeof __e == 'number') __e = core; + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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; +}; + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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; +}; + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var isObject = __w_pdfjs_require__(13); + +module.exports = function (it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +function _typeof(obj) { 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); } + +module.exports = function (it) { + return _typeof(it) === 'object' ? it !== null : typeof it === 'function'; +}; + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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; +}); + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = !__w_pdfjs_require__(16)(function () { + return Object.defineProperty({}, 'a', { + get: function get() { + return 7; + } + }).a != 7; +}); + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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) : {}; +}; + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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"); +}; + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"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"; + + +var hasOwnProperty = {}.hasOwnProperty; + +module.exports = function (it, key) { + return hasOwnProperty.call(it, key); +}; + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var id = 0; +var px = Math.random(); + +module.exports = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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); + }; +}; + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var toInteger = __w_pdfjs_require__(26); + +var min = Math.min; + +module.exports = function (it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; +}; + +/***/ }), +/* 26 */ +/***/ (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); +}; + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var isRegExp = __w_pdfjs_require__(28); + +var defined = __w_pdfjs_require__(33); + +module.exports = function (that, searchString, NAME) { + if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); + return String(defined(that)); +}; + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var isObject = __w_pdfjs_require__(13); + +var cof = __w_pdfjs_require__(29); + +var MATCH = __w_pdfjs_require__(30)('match'); + +module.exports = function (it) { + var isRegExp; + return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); +}; + +/***/ }), +/* 29 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var toString = {}.toString; + +module.exports = function (it) { + return toString.call(it).slice(8, -1); +}; + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var store = __w_pdfjs_require__(31)('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; + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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__(32) ? 'pure' : 'global', + copyright: '© 2019 Denis Pushkarev (zloirock.ru)' +}); + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = false; + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var MATCH = __w_pdfjs_require__(30)('match'); + +module.exports = function (KEY) { + var re = /./; + + try { + '/./'[KEY](re); + } catch (e) { + try { + re[MATCH] = false; + return !'/./'[KEY](re); + } catch (f) {} + } + + return true; +}; + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(36); + +module.exports = __w_pdfjs_require__(9).String.endsWith; + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var toLength = __w_pdfjs_require__(25); + +var context = __w_pdfjs_require__(27); + +var ENDS_WITH = 'endsWith'; +var $endsWith = ''[ENDS_WITH]; +$export($export.P + $export.F * __w_pdfjs_require__(34)(ENDS_WITH), 'String', { + endsWith: function endsWith(searchString) { + var that = context(this, searchString, ENDS_WITH); + var endPosition = arguments.length > 1 ? arguments[1] : undefined; + var len = toLength(that.length); + var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len); + var search = String(searchString); + return $endsWith ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search; + } +}); + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(38); + +module.exports = __w_pdfjs_require__(9).String.includes; + +/***/ }), +/* 38 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var context = __w_pdfjs_require__(27); + +var INCLUDES = 'includes'; +$export($export.P + $export.F * __w_pdfjs_require__(34)(INCLUDES), 'String', { + includes: function includes(searchString) { + return !!~context(this, searchString, INCLUDES).indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +/***/ }), +/* 39 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(40); + +module.exports = __w_pdfjs_require__(9).Array.includes; + +/***/ }), +/* 40 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var $includes = __w_pdfjs_require__(41)(true); + +$export($export.P, 'Array', { + includes: function includes(el) { + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +__w_pdfjs_require__(45)('includes'); + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var toIObject = __w_pdfjs_require__(42); + +var toLength = __w_pdfjs_require__(25); + +var toAbsoluteIndex = __w_pdfjs_require__(44); + +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; + }; +}; + +/***/ }), +/* 42 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var IObject = __w_pdfjs_require__(43); + +var defined = __w_pdfjs_require__(33); + +module.exports = function (it) { + return IObject(defined(it)); +}; + +/***/ }), +/* 43 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var cof = __w_pdfjs_require__(29); + +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return cof(it) == 'String' ? it.split('') : Object(it); +}; + +/***/ }), +/* 44 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var toInteger = __w_pdfjs_require__(26); + +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); +}; + +/***/ }), +/* 45 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var UNSCOPABLES = __w_pdfjs_require__(30)('unscopables'); + +var ArrayProto = Array.prototype; +if (ArrayProto[UNSCOPABLES] == undefined) __w_pdfjs_require__(10)(ArrayProto, UNSCOPABLES, {}); + +module.exports = function (key) { + ArrayProto[UNSCOPABLES][key] = true; +}; + +/***/ }), +/* 46 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(47); + +__w_pdfjs_require__(62); + +module.exports = __w_pdfjs_require__(9).Array.from; + +/***/ }), +/* 47 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $at = __w_pdfjs_require__(48)(true); + +__w_pdfjs_require__(49)(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 + }; +}); + +/***/ }), +/* 48 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var toInteger = __w_pdfjs_require__(26); + +var defined = __w_pdfjs_require__(33); + +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; + }; +}; + +/***/ }), +/* 49 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var LIBRARY = __w_pdfjs_require__(32); + +var $export = __w_pdfjs_require__(7); + +var redefine = __w_pdfjs_require__(20); + +var hide = __w_pdfjs_require__(10); + +var Iterators = __w_pdfjs_require__(50); + +var $iterCreate = __w_pdfjs_require__(51); + +var setToStringTag = __w_pdfjs_require__(59); + +var getPrototypeOf = __w_pdfjs_require__(60); + +var ITERATOR = __w_pdfjs_require__(30)('iterator'); + +var BUGGY = !([].keys && 'next' in [].keys()); +var FF_ITERATOR = '@@iterator'; +var KEYS = 'keys'; +var VALUES = 'values'; + +var returnThis = function returnThis() { + return this; +}; + +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; +}; + +/***/ }), +/* 50 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = {}; + +/***/ }), +/* 51 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var create = __w_pdfjs_require__(52); + +var descriptor = __w_pdfjs_require__(19); + +var setToStringTag = __w_pdfjs_require__(59); + +var IteratorPrototype = {}; + +__w_pdfjs_require__(10)(IteratorPrototype, __w_pdfjs_require__(30)('iterator'), function () { + return this; +}); + +module.exports = function (Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { + next: descriptor(1, next) }); - img.onerror = (function loadJpegStream_onerrorClosure() { - objs.resolve(id, null); - warn('Error during JPEG image loading'); + setToStringTag(Constructor, NAME + ' Iterator'); +}; + +/***/ }), +/* 52 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var anObject = __w_pdfjs_require__(12); + +var dPs = __w_pdfjs_require__(53); + +var enumBugKeys = __w_pdfjs_require__(57); + +var IE_PROTO = __w_pdfjs_require__(56)('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__(58).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); +}; + +/***/ }), +/* 53 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var dP = __w_pdfjs_require__(11); + +var anObject = __w_pdfjs_require__(12); + +var getKeys = __w_pdfjs_require__(54); + +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; +}; + +/***/ }), +/* 54 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $keys = __w_pdfjs_require__(55); + +var enumBugKeys = __w_pdfjs_require__(57); + +module.exports = Object.keys || function keys(O) { + return $keys(O, enumBugKeys); +}; + +/***/ }), +/* 55 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var has = __w_pdfjs_require__(21); + +var toIObject = __w_pdfjs_require__(42); + +var arrayIndexOf = __w_pdfjs_require__(41)(false); + +var IE_PROTO = __w_pdfjs_require__(56)('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; +}; + +/***/ }), +/* 56 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var shared = __w_pdfjs_require__(31)('keys'); + +var uid = __w_pdfjs_require__(22); + +module.exports = function (key) { + return shared[key] || (shared[key] = uid(key)); +}; + +/***/ }), +/* 57 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(','); + +/***/ }), +/* 58 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var document = __w_pdfjs_require__(8).document; + +module.exports = document && document.documentElement; + +/***/ }), +/* 59 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var def = __w_pdfjs_require__(11).f; + +var has = __w_pdfjs_require__(21); + +var TAG = __w_pdfjs_require__(30)('toStringTag'); + +module.exports = function (it, tag, stat) { + if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { + configurable: true, + value: tag }); - img.src = imageUrl; +}; + +/***/ }), +/* 60 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var has = __w_pdfjs_require__(21); + +var toObject = __w_pdfjs_require__(61); + +var IE_PROTO = __w_pdfjs_require__(56)('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; +}; + +/***/ }), +/* 61 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var defined = __w_pdfjs_require__(33); + +module.exports = function (it) { + return Object(defined(it)); +}; + +/***/ }), +/* 62 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var ctx = __w_pdfjs_require__(23); + +var $export = __w_pdfjs_require__(7); + +var toObject = __w_pdfjs_require__(61); + +var call = __w_pdfjs_require__(63); + +var isArrayIter = __w_pdfjs_require__(64); + +var toLength = __w_pdfjs_require__(25); + +var createProperty = __w_pdfjs_require__(65); + +var getIterFn = __w_pdfjs_require__(66); + +$export($export.S + $export.F * !__w_pdfjs_require__(68)(function (iter) { + Array.from(iter); +}), 'Array', { + from: function from(arrayLike) { + var O = toObject(arrayLike); + var C = typeof this == 'function' ? this : Array; + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var index = 0; + var iterFn = getIterFn(O); + var length, result, step, iterator; + if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + + if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { + for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { + createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); + } + } else { + length = toLength(O.length); + + for (result = new C(length); length > index; index++) { + createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + } + } + + result.length = index; + return result; + } +}); + +/***/ }), +/* 63 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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; + } +}; + +/***/ }), +/* 64 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var Iterators = __w_pdfjs_require__(50); + +var ITERATOR = __w_pdfjs_require__(30)('iterator'); + +var ArrayProto = Array.prototype; + +module.exports = function (it) { + return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); +}; + +/***/ }), +/* 65 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $defineProperty = __w_pdfjs_require__(11); + +var createDesc = __w_pdfjs_require__(19); + +module.exports = function (object, index, value) { + if (index in object) $defineProperty.f(object, index, createDesc(0, value));else object[index] = value; +}; + +/***/ }), +/* 66 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var classof = __w_pdfjs_require__(67); + +var ITERATOR = __w_pdfjs_require__(30)('iterator'); + +var Iterators = __w_pdfjs_require__(50); + +module.exports = __w_pdfjs_require__(9).getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; +}; + +/***/ }), +/* 67 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var cof = __w_pdfjs_require__(29); + +var TAG = __w_pdfjs_require__(30)('toStringTag'); + +var ARG = cof(function () { + return arguments; +}()) == 'Arguments'; + +var tryGet = function tryGet(it, key) { + try { + return it[key]; + } catch (e) {} +}; + +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; +}; + +/***/ }), +/* 68 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var ITERATOR = __w_pdfjs_require__(30)('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; +}; + +/***/ }), +/* 69 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(70); + +module.exports = __w_pdfjs_require__(9).Object.assign; + +/***/ }), +/* 70 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +$export($export.S + $export.F, 'Object', { + assign: __w_pdfjs_require__(71) +}); + +/***/ }), +/* 71 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var getKeys = __w_pdfjs_require__(54); + +var gOPS = __w_pdfjs_require__(72); + +var pIE = __w_pdfjs_require__(73); + +var toObject = __w_pdfjs_require__(61); + +var IObject = __w_pdfjs_require__(43); + +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; + +/***/ }), +/* 72 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +exports.f = Object.getOwnPropertySymbols; + +/***/ }), +/* 73 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +exports.f = {}.propertyIsEnumerable; + +/***/ }), +/* 74 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(75); + +module.exports = __w_pdfjs_require__(9).Math.log2; + +/***/ }), +/* 75 */ +/***/ (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; + } +}); + +/***/ }), +/* 76 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(77); + +module.exports = __w_pdfjs_require__(9).Number.isNaN; + +/***/ }), +/* 77 */ +/***/ (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; + } +}); + +/***/ }), +/* 78 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(79); + +module.exports = __w_pdfjs_require__(9).Number.isInteger; + +/***/ }), +/* 79 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +$export($export.S, 'Number', { + isInteger: __w_pdfjs_require__(80) +}); + +/***/ }), +/* 80 */ +/***/ (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; +}; + +/***/ }), +/* 81 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(82); + +__w_pdfjs_require__(47); + +__w_pdfjs_require__(83); + +__w_pdfjs_require__(86); + +__w_pdfjs_require__(99); + +__w_pdfjs_require__(100); + +module.exports = __w_pdfjs_require__(9).Promise; + +/***/ }), +/* 82 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var classof = __w_pdfjs_require__(67); + +var test = {}; +test[__w_pdfjs_require__(30)('toStringTag')] = 'z'; + +if (test + '' != '[object z]') { + __w_pdfjs_require__(20)(Object.prototype, 'toString', function toString() { + return '[object ' + classof(this) + ']'; + }, true); } - // Polyfill from https://github.com/Polymer/URL -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ -(function checkURLConstructor(scope) { - /* jshint ignore:start */ +/***/ }), +/* 83 */ +/***/ (function(module, exports, __w_pdfjs_require__) { - // feature detect for URL constructor - var hasWorkingUrl = false; +"use strict"; + + +var $iterators = __w_pdfjs_require__(84); + +var getKeys = __w_pdfjs_require__(54); + +var redefine = __w_pdfjs_require__(20); + +var global = __w_pdfjs_require__(8); + +var hide = __w_pdfjs_require__(10); + +var Iterators = __w_pdfjs_require__(50); + +var wks = __w_pdfjs_require__(30); + +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); + } + } +} + +/***/ }), +/* 84 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var addToUnscopables = __w_pdfjs_require__(45); + +var step = __w_pdfjs_require__(85); + +var Iterators = __w_pdfjs_require__(50); + +var toIObject = __w_pdfjs_require__(42); + +module.exports = __w_pdfjs_require__(49)(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'); + +/***/ }), +/* 85 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = function (done, value) { + return { + value: value, + done: !!done + }; +}; + +/***/ }), +/* 86 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var LIBRARY = __w_pdfjs_require__(32); + +var global = __w_pdfjs_require__(8); + +var ctx = __w_pdfjs_require__(23); + +var classof = __w_pdfjs_require__(67); + +var $export = __w_pdfjs_require__(7); + +var isObject = __w_pdfjs_require__(13); + +var aFunction = __w_pdfjs_require__(24); + +var anInstance = __w_pdfjs_require__(87); + +var forOf = __w_pdfjs_require__(88); + +var speciesConstructor = __w_pdfjs_require__(89); + +var task = __w_pdfjs_require__(90).set; + +var microtask = __w_pdfjs_require__(92)(); + +var newPromiseCapabilityModule = __w_pdfjs_require__(93); + +var perform = __w_pdfjs_require__(94); + +var userAgent = __w_pdfjs_require__(95); + +var promiseResolve = __w_pdfjs_require__(96); + +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 { - if (typeof URL === 'function' && - typeof URL.prototype === 'object' && - ('origin' in URL.prototype)) { + var promise = $Promise.resolve(1); + + var FakePromise = (promise.constructor = {})[__w_pdfjs_require__(30)('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__(97)($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__(59)($Promise, PROMISE); + +__w_pdfjs_require__(98)(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__(68)(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; + } +}); + +/***/ }), +/* 87 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = function (it, Constructor, name, forbiddenField) { + if (!(it instanceof Constructor) || forbiddenField !== undefined && forbiddenField in it) { + throw TypeError(name + ': incorrect invocation!'); + } + + return it; +}; + +/***/ }), +/* 88 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var ctx = __w_pdfjs_require__(23); + +var call = __w_pdfjs_require__(63); + +var isArrayIter = __w_pdfjs_require__(64); + +var anObject = __w_pdfjs_require__(12); + +var toLength = __w_pdfjs_require__(25); + +var getIterFn = __w_pdfjs_require__(66); + +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; + +/***/ }), +/* 89 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var anObject = __w_pdfjs_require__(12); + +var aFunction = __w_pdfjs_require__(24); + +var SPECIES = __w_pdfjs_require__(30)('species'); + +module.exports = function (O, D) { + var C = anObject(O).constructor; + var S; + return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); +}; + +/***/ }), +/* 90 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var ctx = __w_pdfjs_require__(23); + +var invoke = __w_pdfjs_require__(91); + +var html = __w_pdfjs_require__(58); + +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__(29)(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); + }; + } +} + +module.exports = { + set: setTask, + clear: clearTask +}; + +/***/ }), +/* 91 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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); +}; + +/***/ }), +/* 92 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var global = __w_pdfjs_require__(8); + +var macrotask = __w_pdfjs_require__(90).set; + +var Observer = global.MutationObserver || global.WebKitMutationObserver; +var process = global.process; +var Promise = global.Promise; +var isNode = __w_pdfjs_require__(29)(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); + }; + } + + return function (fn) { + var task = { + fn: fn, + next: undefined + }; + if (last) last.next = task; + + if (!head) { + head = task; + notify(); + } + + last = task; + }; +}; + +/***/ }), +/* 93 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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); +} + +module.exports.f = function (C) { + return new PromiseCapability(C); +}; + +/***/ }), +/* 94 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = function (exec) { + try { + return { + e: false, + v: exec() + }; + } catch (e) { + return { + e: true, + v: e + }; + } +}; + +/***/ }), +/* 95 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var global = __w_pdfjs_require__(8); + +var navigator = global.navigator; +module.exports = navigator && navigator.userAgent || ''; + +/***/ }), +/* 96 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var anObject = __w_pdfjs_require__(12); + +var isObject = __w_pdfjs_require__(13); + +var newPromiseCapability = __w_pdfjs_require__(93); + +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; +}; + +/***/ }), +/* 97 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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; +}; + +/***/ }), +/* 98 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var global = __w_pdfjs_require__(8); + +var dP = __w_pdfjs_require__(11); + +var DESCRIPTORS = __w_pdfjs_require__(15); + +var SPECIES = __w_pdfjs_require__(30)('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; + } + }); +}; + +/***/ }), +/* 99 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var core = __w_pdfjs_require__(9); + +var global = __w_pdfjs_require__(8); + +var speciesConstructor = __w_pdfjs_require__(89); + +var promiseResolve = __w_pdfjs_require__(96); + +$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); + } +}); + +/***/ }), +/* 100 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var newPromiseCapability = __w_pdfjs_require__(93); + +var perform = __w_pdfjs_require__(94); + +$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; + } +}); + +/***/ }), +/* 101 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(82); + +__w_pdfjs_require__(83); + +__w_pdfjs_require__(102); + +__w_pdfjs_require__(114); + +__w_pdfjs_require__(116); + +module.exports = __w_pdfjs_require__(9).WeakMap; + +/***/ }), +/* 102 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var each = __w_pdfjs_require__(103)(0); + +var redefine = __w_pdfjs_require__(20); + +var meta = __w_pdfjs_require__(107); + +var assign = __w_pdfjs_require__(71); + +var weak = __w_pdfjs_require__(108); + +var isObject = __w_pdfjs_require__(13); + +var fails = __w_pdfjs_require__(16); + +var validate = __w_pdfjs_require__(109); + +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; + } + }, + set: function set(key, value) { + return weak.def(validate(this, WEAK_MAP), key, value); + } +}; + +var $WeakMap = module.exports = __w_pdfjs_require__(110)(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); + }); + }); +} + +/***/ }), +/* 103 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var ctx = __w_pdfjs_require__(23); + +var IObject = __w_pdfjs_require__(43); + +var toObject = __w_pdfjs_require__(61); + +var toLength = __w_pdfjs_require__(25); + +var asc = __w_pdfjs_require__(104); + +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; + }; +}; + +/***/ }), +/* 104 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var speciesConstructor = __w_pdfjs_require__(105); + +module.exports = function (original, length) { + return new (speciesConstructor(original))(length); +}; + +/***/ }), +/* 105 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var isObject = __w_pdfjs_require__(13); + +var isArray = __w_pdfjs_require__(106); + +var SPECIES = __w_pdfjs_require__(30)('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; + } + } + + return C === undefined ? Array : C; +}; + +/***/ }), +/* 106 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var cof = __w_pdfjs_require__(29); + +module.exports = Array.isArray || function isArray(arg) { + return cof(arg) == 'Array'; +}; + +/***/ }), +/* 107 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +function _typeof(obj) { 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 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: {} + } + }); +}; + +var fastKey = function fastKey(it, create) { + if (!isObject(it)) return _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 +}; + +/***/ }), +/* 108 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var redefineAll = __w_pdfjs_require__(97); + +var getWeak = __w_pdfjs_require__(107).getWeak; + +var anObject = __w_pdfjs_require__(12); + +var isObject = __w_pdfjs_require__(13); + +var anInstance = __w_pdfjs_require__(87); + +var forOf = __w_pdfjs_require__(88); + +var createArrayMethod = __w_pdfjs_require__(103); + +var $has = __w_pdfjs_require__(21); + +var validate = __w_pdfjs_require__(109); + +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); + } + }); + 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 +}; + +/***/ }), +/* 109 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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; +}; + +/***/ }), +/* 110 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var global = __w_pdfjs_require__(8); + +var $export = __w_pdfjs_require__(7); + +var redefine = __w_pdfjs_require__(20); + +var redefineAll = __w_pdfjs_require__(97); + +var meta = __w_pdfjs_require__(107); + +var forOf = __w_pdfjs_require__(88); + +var anInstance = __w_pdfjs_require__(87); + +var isObject = __w_pdfjs_require__(13); + +var fails = __w_pdfjs_require__(16); + +var $iterDetect = __w_pdfjs_require__(68); + +var setToStringTag = __w_pdfjs_require__(59); + +var inheritIfRequired = __w_pdfjs_require__(111); + +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; + } + + if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { + fixMethod('delete'); + fixMethod('has'); + IS_MAP && fixMethod('get'); + } + + 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; +}; + +/***/ }), +/* 111 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var isObject = __w_pdfjs_require__(13); + +var setPrototypeOf = __w_pdfjs_require__(112).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; +}; + +/***/ }), +/* 112 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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__(113).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 +}; + +/***/ }), +/* 113 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var pIE = __w_pdfjs_require__(73); + +var createDesc = __w_pdfjs_require__(19); + +var toIObject = __w_pdfjs_require__(42); + +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]); +}; + +/***/ }), +/* 114 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(115)('WeakMap'); + +/***/ }), +/* 115 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +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); + } + }); +}; + +/***/ }), +/* 116 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(117)('WeakMap'); + +/***/ }), +/* 117 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var aFunction = __w_pdfjs_require__(24); + +var ctx = __w_pdfjs_require__(23); + +var forOf = __w_pdfjs_require__(88); + +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); + } + }); +}; + +/***/ }), +/* 118 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(82); + +__w_pdfjs_require__(83); + +__w_pdfjs_require__(119); + +__w_pdfjs_require__(120); + +__w_pdfjs_require__(121); + +module.exports = __w_pdfjs_require__(9).WeakSet; + +/***/ }), +/* 119 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var weak = __w_pdfjs_require__(108); + +var validate = __w_pdfjs_require__(109); + +var WEAK_SET = 'WeakSet'; + +__w_pdfjs_require__(110)(WEAK_SET, function (get) { + return function WeakSet() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; +}, { + add: function add(value) { + return weak.def(validate(this, WEAK_SET), value, true); + } +}, weak, false, true); + +/***/ }), +/* 120 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(115)('WeakSet'); + +/***/ }), +/* 121 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(117)('WeakSet'); + +/***/ }), +/* 122 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(123); + +module.exports = __w_pdfjs_require__(9).String.codePointAt; + +/***/ }), +/* 123 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var $at = __w_pdfjs_require__(48)(false); + +$export($export.P, 'String', { + codePointAt: function codePointAt(pos) { + return $at(this, pos); + } +}); + +/***/ }), +/* 124 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(125); + +module.exports = __w_pdfjs_require__(9).String.fromCodePoint; + +/***/ }), +/* 125 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var toAbsoluteIndex = __w_pdfjs_require__(44); + +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(''); + } +}); + +/***/ }), +/* 126 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(127); + +__w_pdfjs_require__(82); + +module.exports = __w_pdfjs_require__(9).Symbol; + +/***/ }), +/* 127 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +function _typeof(obj) { 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 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__(107).KEY; + +var $fails = __w_pdfjs_require__(16); + +var shared = __w_pdfjs_require__(31); + +var setToStringTag = __w_pdfjs_require__(59); + +var uid = __w_pdfjs_require__(22); + +var wks = __w_pdfjs_require__(30); + +var wksExt = __w_pdfjs_require__(128); + +var wksDefine = __w_pdfjs_require__(129); + +var enumKeys = __w_pdfjs_require__(130); + +var isArray = __w_pdfjs_require__(106); + +var anObject = __w_pdfjs_require__(12); + +var isObject = __w_pdfjs_require__(13); + +var toIObject = __w_pdfjs_require__(42); + +var toPrimitive = __w_pdfjs_require__(18); + +var createDesc = __w_pdfjs_require__(19); + +var _create = __w_pdfjs_require__(52); + +var gOPNExt = __w_pdfjs_require__(131); + +var $GOPD = __w_pdfjs_require__(113); + +var $DP = __w_pdfjs_require__(11); + +var $keys = __w_pdfjs_require__(54); + +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 isSymbol = USE_NATIVE && _typeof($Symbol.iterator) == 'symbol' ? function (it) { + return _typeof(it) == 'symbol'; +} : function (it) { + return it instanceof $Symbol; +}; + +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); + } + + return dP(it, key, D); +}; + +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; +}; + +var $create = function create(it, P) { + return P === undefined ? _create(it) : $defineProperties(_create(it), P); +}; + +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; +}; + +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; +}; + +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; +}; + +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; +}; + +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__(132).f = gOPNExt.f = $getOwnPropertyNames; + __w_pdfjs_require__(73).f = $propertyIsEnumerable; + __w_pdfjs_require__(72).f = $getOwnPropertySymbols; + + if (DESCRIPTORS && !__w_pdfjs_require__(32)) { + 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); + } +}); +$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); + +/***/ }), +/* 128 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +exports.f = __w_pdfjs_require__(30); + +/***/ }), +/* 129 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var global = __w_pdfjs_require__(8); + +var core = __w_pdfjs_require__(9); + +var LIBRARY = __w_pdfjs_require__(32); + +var wksExt = __w_pdfjs_require__(128); + +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) + }); +}; + +/***/ }), +/* 130 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var getKeys = __w_pdfjs_require__(54); + +var gOPS = __w_pdfjs_require__(72); + +var pIE = __w_pdfjs_require__(73); + +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; +}; + +/***/ }), +/* 131 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +function _typeof(obj) { 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 toIObject = __w_pdfjs_require__(42); + +var gOPN = __w_pdfjs_require__(132).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(); + } +}; + +module.exports.f = function getOwnPropertyNames(it) { + return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); +}; + +/***/ }), +/* 132 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $keys = __w_pdfjs_require__(55); + +var hiddenKeys = __w_pdfjs_require__(57).concat('length', 'prototype'); + +exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return $keys(O, hiddenKeys); +}; + +/***/ }), +/* 133 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(134); + +module.exports = __w_pdfjs_require__(9).String.padStart; + +/***/ }), +/* 134 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var $pad = __w_pdfjs_require__(135); + +var userAgent = __w_pdfjs_require__(95); + +$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { + padStart: function padStart(maxLength) { + return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); + } +}); + +/***/ }), +/* 135 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var toLength = __w_pdfjs_require__(25); + +var repeat = __w_pdfjs_require__(136); + +var defined = __w_pdfjs_require__(33); + +module.exports = function (that, maxLength, fillString, left) { + var S = String(defined(that)); + var stringLength = S.length; + var fillStr = fillString === undefined ? ' ' : String(fillString); + var intMaxLength = toLength(maxLength); + if (intMaxLength <= stringLength || fillStr == '') return S; + var fillLen = intMaxLength - stringLength; + var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); + if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen); + return left ? stringFiller + S : S + stringFiller; +}; + +/***/ }), +/* 136 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var toInteger = __w_pdfjs_require__(26); + +var defined = __w_pdfjs_require__(33); + +module.exports = function repeat(count) { + var str = String(defined(this)); + var res = ''; + var n = toInteger(count); + if (n < 0 || n == Infinity) throw RangeError("Count can't be negative"); + + for (; n > 0; (n >>>= 1) && (str += str)) { + if (n & 1) res += str; + } + + return res; +}; + +/***/ }), +/* 137 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(138); + +module.exports = __w_pdfjs_require__(9).String.padEnd; + +/***/ }), +/* 138 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var $pad = __w_pdfjs_require__(135); + +var userAgent = __w_pdfjs_require__(95); + +$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { + padEnd: function padEnd(maxLength) { + return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); + } +}); + +/***/ }), +/* 139 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +__w_pdfjs_require__(140); + +module.exports = __w_pdfjs_require__(9).Object.values; + +/***/ }), +/* 140 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var $export = __w_pdfjs_require__(7); + +var $values = __w_pdfjs_require__(141)(false); + +$export($export.S, 'Object', { + values: function values(it) { + return $values(it); + } +}); + +/***/ }), +/* 141 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var getKeys = __w_pdfjs_require__(54); + +var toIObject = __w_pdfjs_require__(42); + +var isEnum = __w_pdfjs_require__(73).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; + }; +}; + +/***/ }), +/* 142 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +{ + 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__(143).ReadableStream; + } +} + +/***/ }), +/* 143 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } + +(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"; + + var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) { + return _typeof2(obj); + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _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 + }); + }; + + exports.createArrayFromList = function (elements) { + return elements.slice(); + }; + + exports.ArrayBufferCopy = function (dest, destOffset, src, srcOffset, n) { + new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset); + }; + + 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; + }; + + exports.IsFiniteNonNegativeNumber = function (v) { + if (Number.isNaN(v)) { + return false; + } + + if (v === Infinity) { + return false; + } + + if (v < 0) { + return false; + } + + 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); + } + + 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(); + }; + + 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; + }; + + 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 + }; + }; +}, function (module, exports, __w_pdfjs_require__) { + "use strict"; + + 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"; + + 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 + }; + + function AcquireWritableStreamDefaultWriter(stream) { + return new WritableStreamDefaultWriter(stream); + } + + function IsWritableStream(x) { + if (!typeIsObject(x)) { + return false; + } + + if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) { + return false; + } + + return true; + } + + function IsWritableStreamLocked(stream) { + assert(IsWritableStream(stream) === true, 'IsWritableStreamLocked should only be used on known writable streams'); + + if (stream._writer === undefined) { + return false; + } + + return true; + } + + 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; + } + + 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'; + }); + } + + 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"; + + 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; + }; + + 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; + }; + + 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; + }; +}, function (module, exports, __w_pdfjs_require__) { + "use strict"; + + 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), + 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'); + } + } + + _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 + }; + + 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; + }); + } + + 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; + } + + 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); + } 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')); + } 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; + } + + 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); + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + function ReadableStreamDefaultControllerError(controller, e) { + var stream = controller._controlledReadableStream; + assert(stream._state === 'readable'); + ResetQueue(controller); + ReadableStreamError(stream, e); + } + + function ReadableStreamDefaultControllerErrorIfNeeded(controller, e) { + if (controller._controlledReadableStream._state === 'readable') { + ReadableStreamDefaultControllerError(controller, 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; + } + + 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; + } + + function IsReadableStreamBYOBRequest(x) { + if (!typeIsObject(x)) { + return false; + } + + if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) { + return false; + } + + return true; + } + + 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; + } + + function ReadableByteStreamControllerClearPendingPullIntos(controller) { + ReadableByteStreamControllerInvalidateBYOBRequest(controller); + controller._pendingPullIntos = []; + } + + 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; + } + + 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 + }); + + 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; + } + + function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) { + assert(controller._pendingPullIntos.length === 0 || controller._pendingPullIntos[0] === pullIntoDescriptor); + ReadableByteStreamControllerInvalidateBYOBRequest(controller); + pullIntoDescriptor.bytesFilled += size; + } + + function ReadableByteStreamControllerHandleQueueDrain(controller) { + assert(controller._controlledReadableStream._state === 'readable'); + + if (controller._queueTotalSize === 0 && controller._closeRequested === true) { + ReadableStreamClose(controller._controlledReadableStream); + } 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) { + 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); + } + } + } + + 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 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); + } + } + } + + 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); + } + } + + function ReadableByteStreamControllerShiftPendingPullInto(controller) { + var descriptor = controller._pendingPullIntos.shift(); + + ReadableByteStreamControllerInvalidateBYOBRequest(controller); + return descriptor; + } + + function ReadableByteStreamControllerShouldCallPull(controller) { + var stream = controller._controlledReadableStream; + + 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; + } + + if (ReadableByteStreamControllerGetDesiredSize(controller) > 0) { + return true; + } + + 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 (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); + } else { + assert(IsReadableStreamLocked(stream) === false, 'stream must not be locked'); + ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); + } + } + + function ReadableByteStreamControllerError(controller, e) { + var stream = controller._controlledReadableStream; + assert(stream._state === 'readable'); + ReadableByteStreamControllerClearPendingPullIntos(controller); + ResetQueue(controller); + ReadableStreamError(stream, e); + } + + 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; + } + + 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'); + } + + firstDescriptor.buffer = view.buffer; + ReadableByteStreamControllerRespondInternal(controller, view.byteLength); + } + + function streamBrandCheckException(name) { + return new TypeError('ReadableStream.prototype.' + name + ' can only be used on a ReadableStream'); + } + + function readerLockException(name) { + return new TypeError('Cannot ' + name + ' a stream using a released reader'); + } + + function defaultReaderBrandCheckException(name) { + return new TypeError('ReadableStreamDefaultReader.prototype.' + name + ' can only be used on a ReadableStreamDefaultReader'); + } + + function defaultReaderClosedPromiseInitialize(reader) { + reader._closedPromise = new Promise(function (resolve, reject) { + reader._closedPromise_resolve = resolve; + reader._closedPromise_reject = reject; + }); + } + + function defaultReaderClosedPromiseInitializeAsRejected(reader, reason) { + reader._closedPromise = Promise.reject(reason); + reader._closedPromise_resolve = undefined; + reader._closedPromise_reject = undefined; + } + + function defaultReaderClosedPromiseInitializeAsResolved(reader) { + reader._closedPromise = Promise.resolve(undefined); + reader._closedPromise_resolve = undefined; + reader._closedPromise_reject = undefined; + } + + 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; + } + + function defaultReaderClosedPromiseResetToRejected(reader, reason) { + assert(reader._closedPromise_resolve === undefined); + assert(reader._closedPromise_reject === undefined); + reader._closedPromise = Promise.reject(reason); + } + + 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; + } + + function byobReaderBrandCheckException(name) { + return new TypeError('ReadableStreamBYOBReader.prototype.' + name + ' can only be used on a ReadableStreamBYOBReader'); + } + + function defaultControllerBrandCheckException(name) { + return new TypeError('ReadableStreamDefaultController.prototype.' + name + ' can only be used on a ReadableStreamDefaultController'); + } + + 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 ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise) { + try { + Promise.prototype.then.call(promise, undefined, function () {}); + } catch (e) {} + } +}, function (module, exports, __w_pdfjs_require__) { + "use strict"; + + 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"; + + 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); +}])); + +/***/ }), +/* 144 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +function _typeof(obj) { 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 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'; - hasWorkingUrl = u.href === 'http://a/c%20d'; + isURLSupported = u.href === 'http://a/c%20d'; } - } catch(e) { } + } catch (ex) {} - if (hasWorkingUrl) - return; + if (isURLSupported) { + exports.URL = URL; + } else { + var PolyfillURL = __w_pdfjs_require__(145).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; + } +} + +/***/ }), +/* 145 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +(function URLConstructorClosure() { + 'use strict'; var relative = Object.create(null); relative['ftp'] = 21; @@ -1830,7 +9185,6 @@ function loadJpegStream(id, imageUrl, objs) { relative['https'] = 443; relative['ws'] = 80; relative['wss'] = 443; - var relativePathDotMapping = Object.create(null); relativePathDotMapping['%2e'] = '.'; relativePathDotMapping['.%2e'] = '..'; @@ -1847,47 +9201,40 @@ function loadJpegStream(id, imageUrl, objs) { } function IDNAToASCII(h) { - if ('' == h) { - invalid.call(this) + if (h === '') { + invalid.call(this); } - // XXX - return h.toLowerCase() + + 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 - ) { + + if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1) { return c; } + return encodeURIComponent(c); } function percentEscapeQuery(c) { - // XXX This actually needs to encode c using encoding and then - // convert the bytes one-by-one. - var unicode = c.charCodeAt(0); - if (unicode > 0x20 && - unicode < 0x7F && - // " # < > ` (do not escape '?') - [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) == -1 - ) { + + if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1) { return c; } + return encodeURIComponent(c); } - var EOF = undefined, + var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/; function parse(input, stateOverride, base) { function err(message) { - errors.push(message) + errors.push(message); } var state = stateOverride || 'scheme start', @@ -1897,12 +9244,13 @@ function loadJpegStream(id, imageUrl, objs) { seenBracket = false, errors = []; - loop: while ((input[cursor - 1] != EOF || cursor == 0) && !this._isInvalid) { + 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(); // ASCII-safe + buffer += c.toLowerCase(); state = 'scheme'; } else if (!stateOverride) { buffer = ''; @@ -1912,23 +9260,27 @@ function loadJpegStream(id, imageUrl, objs) { err('Invalid scheme.'); break loop; } + break; case 'scheme': if (c && ALPHANUMERIC.test(c)) { - buffer += c.toLowerCase(); // ASCII-safe - } else if (':' == c) { + buffer += c.toLowerCase(); + } else if (c === ':') { this._scheme = buffer; buffer = ''; + if (stateOverride) { break loop; } + if (isRelativeScheme(this._scheme)) { this._isRelative = true; } - if ('file' == this._scheme) { + + if (this._scheme === 'file') { state = 'relative'; - } else if (this._isRelative && base && base._scheme == this._scheme) { + } else if (this._isRelative && base && base._scheme === this._scheme) { state = 'relative or authority'; } else if (this._isRelative) { state = 'authority first slash'; @@ -1940,54 +9292,60 @@ function loadJpegStream(id, imageUrl, objs) { cursor = 0; state = 'no scheme'; continue; - } else if (EOF == c) { + } else if (c === EOF) { break loop; } else { - err('Code point not allowed in scheme: ' + c) + err('Code point not allowed in scheme: ' + c); break loop; } + break; case 'scheme data': - if ('?' == c) { + if (c === '?') { this._query = '?'; state = 'query'; - } else if ('#' == c) { + } else if (c === '#') { this._fragment = '#'; state = 'fragment'; } else { - // XXX error handling - if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { this._schemeData += percentEscape(c); } } + break; case 'no scheme': - if (!base || !(isRelativeScheme(base._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]) { + if (c === '/' && input[cursor + 1] === '/') { state = 'authority ignore slashes'; } else { err('Expected /, got: ' + c); state = 'relative'; - continue + continue; } + break; case 'relative': this._isRelative = true; - if ('file' != this._scheme) + + if (this._scheme !== 'file') { this._scheme = base._scheme; - if (EOF == c) { + } + + if (c === EOF) { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -1995,11 +9353,13 @@ function loadJpegStream(id, imageUrl, objs) { this._username = base._username; this._password = base._password; break loop; - } else if ('/' == c || '\\' == c) { - if ('\\' == c) + } else if (c === '/' || c === '\\') { + if (c === '\\') { err('\\ is an invalid code point.'); + } + state = 'relative slash'; - } else if ('?' == c) { + } else if (c === '?') { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -2007,7 +9367,7 @@ function loadJpegStream(id, imageUrl, objs) { this._username = base._username; this._password = base._password; state = 'query'; - } else if ('#' == c) { + } else if (c === '#') { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -2017,96 +9377,114 @@ function loadJpegStream(id, imageUrl, objs) { this._password = base._password; state = 'fragment'; } else { - var nextC = input[cursor+1] - var nextNextC = input[cursor+2] - if ( - 'file' != this._scheme || !ALPHA.test(c) || - (nextC != ':' && nextC != '|') || - (EOF != nextNextC && '/' != nextNextC && '\\' != nextNextC && '?' != nextNextC && '#' != nextNextC)) { + 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) { + if (c === '/' || c === '\\') { + if (c === '\\') { err('\\ is an invalid code point.'); } - if ('file' == this._scheme) { + + if (this._scheme === 'file') { state = 'file host'; } else { state = 'authority ignore slashes'; } } else { - if ('file' != this._scheme) { + 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) { + if (c === '/') { state = 'authority second slash'; } else { - err("Expected '/', got: " + c); + err('Expected \'/\', got: ' + c); state = 'authority ignore slashes'; continue; } + break; case 'authority second slash': state = 'authority ignore slashes'; - if ('/' != c) { - err("Expected '/', got: " + c); + + if (c !== '/') { + err('Expected \'/\', got: ' + c); continue; } + break; case 'authority ignore slashes': - if ('/' != c && '\\' != c) { + if (c !== '/' && c !== '\\') { state = 'authority'; continue; } else { err('Expected authority, got: ' + c); } + break; case 'authority': - if ('@' == c) { + if (c === '@') { if (seenAt) { err('@ already seen.'); buffer += '%40'; } + seenAt = true; + for (var i = 0; i < buffer.length; i++) { var cp = buffer[i]; - if ('\t' == cp || '\n' == cp || '\r' == cp) { + + if (cp === '\t' || cp === '\n' || cp === '\r') { err('Invalid whitespace in authority.'); continue; } - // XXX check URL code points - if (':' == cp && null === this._password) { + + if (cp === ':' && this._password === null) { this._password = ''; continue; } + var tempC = percentEscape(cp); - (null !== this._password) ? this._password += tempC : this._username += tempC; + + if (this._password !== null) { + this._password += tempC; + } else { + this._username += tempC; + } } + buffer = ''; - } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { + } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') { cursor -= buffer.length; buffer = ''; state = 'host'; @@ -2114,137 +9492,163 @@ function loadJpegStream(id, imageUrl, objs) { } else { buffer += c; } + break; case 'file host': - if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { - if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ':' || buffer[1] == '|')) { + 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) { + } else if (buffer.length === 0) { state = 'relative path start'; } else { this._host = IDNAToASCII.call(this, buffer); buffer = ''; state = 'relative path start'; } + continue; - } else if ('\t' == c || '\n' == c || '\r' == c) { + } 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) { - // XXX host parsing + if (c === ':' && !seenBracket) { this._host = IDNAToASCII.call(this, buffer); buffer = ''; state = 'port'; - if ('hostname' == stateOverride) { + + if (stateOverride === 'hostname') { break loop; } - } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { + } 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 ('\t' != c && '\n' != c && '\r' != c) { - if ('[' == c) { + } else if (c !== '\t' && c !== '\n' && c !== '\r') { + if (c === '[') { seenBracket = true; - } else if (']' == c) { + } 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 (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c || stateOverride) { - if ('' != buffer) { + } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) { + if (buffer !== '') { var temp = parseInt(buffer, 10); - if (temp != relative[this._scheme]) { + + if (temp !== relative[this._scheme]) { this._port = temp + ''; } + buffer = ''; } + if (stateOverride) { break loop; } + state = 'relative path start'; continue; - } else if ('\t' == c || '\n' == c || '\r' == c) { + } 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."); + if (c === '\\') { + err('\'\\\' not allowed in path.'); + } + state = 'relative path'; - if ('/' != c && '\\' != c) { + + if (c !== '/' && c !== '\\') { continue; } + break; case 'relative path': - if (EOF == c || '/' == c || '\\' == c || (!stateOverride && ('?' == c || '#' == c))) { - if ('\\' == c) { + 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) { + + if (buffer === '..') { this._path.pop(); - if ('/' != c && '\\' != c) { + + if (c !== '/' && c !== '\\') { this._path.push(''); } - } else if ('.' == buffer && '/' != c && '\\' != c) { + } else if (buffer === '.' && c !== '/' && c !== '\\') { this._path.push(''); - } else if ('.' != buffer) { - if ('file' == this._scheme && this._path.length == 0 && buffer.length == 2 && ALPHA.test(buffer[0]) && buffer[1] == '|') { + } 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) { + + if (c === '?') { this._query = '?'; state = 'query'; - } else if ('#' == c) { + } else if (c === '#') { this._fragment = '#'; state = 'fragment'; } - } else if ('\t' != c && '\n' != c && '\r' != c) { + } else if (c !== '\t' && c !== '\n' && c !== '\r') { buffer += percentEscape(c); } + break; case 'query': - if (!stateOverride && '#' == c) { + if (!stateOverride && c === '#') { this._fragment = '#'; state = 'fragment'; - } else if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + } else if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { this._query += percentEscapeQuery(c); } + break; case 'fragment': - if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { this._fragment += c; } + break; } @@ -2266,2446 +9670,5064 @@ function loadJpegStream(id, imageUrl, objs) { this._isRelative = false; } - // Does not process domain names or IP addresses. - // Does not handle encoding for the query parameter. - function jURL(url, base /* , encoding */) { - if (base !== undefined && !(base instanceof jURL)) - base = new jURL(String(base)); + 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, ''); - // encoding = encoding || 'utf-8' - parse.call(this, input, null, base); } - jURL.prototype = { - toString: function() { + JURL.prototype = { + toString: function toString() { return this.href; }, - get href() { - if (this._isInvalid) - return this._url; - var authority = ''; - if ('' != this._username || null != this._password) { - authority = this._username + - (null != this._password ? ':' + this._password : '') + '@'; + get href() { + if (this._isInvalid) { + return this._url; } - return this.protocol + - (this._isRelative ? '//' + authority + this.host : '') + - this.pathname + this._query + this._fragment; + 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(href) { + + set href(value) { clear.call(this); - parse.call(this, href); + parse.call(this, value); }, get protocol() { return this._scheme + ':'; }, - set protocol(protocol) { - if (this._isInvalid) + + set protocol(value) { + if (this._isInvalid) { return; - parse.call(this, protocol + ':', 'scheme start'); + } + + parse.call(this, value + ':', 'scheme start'); }, get host() { - return this._isInvalid ? '' : this._port ? - this._host + ':' + this._port : this._host; + return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host; }, - set host(host) { - if (this._isInvalid || !this._isRelative) + + set host(value) { + if (this._isInvalid || !this._isRelative) { return; - parse.call(this, host, 'host'); + } + + parse.call(this, value, 'host'); }, get hostname() { return this._host; }, - set hostname(hostname) { - if (this._isInvalid || !this._isRelative) + + set hostname(value) { + if (this._isInvalid || !this._isRelative) { return; - parse.call(this, hostname, 'hostname'); + } + + parse.call(this, value, 'hostname'); }, get port() { return this._port; }, - set port(port) { - if (this._isInvalid || !this._isRelative) + + set port(value) { + if (this._isInvalid || !this._isRelative) { return; - parse.call(this, port, 'port'); + } + + parse.call(this, value, 'port'); }, get pathname() { - return this._isInvalid ? '' : this._isRelative ? - '/' + this._path.join('/') : this._schemeData; + return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData; }, - set pathname(pathname) { - if (this._isInvalid || !this._isRelative) + + set pathname(value) { + if (this._isInvalid || !this._isRelative) { return; + } + this._path = []; - parse.call(this, pathname, 'relative path start'); + parse.call(this, value, 'relative path start'); }, get search() { - return this._isInvalid || !this._query || '?' == this._query ? - '' : this._query; + return this._isInvalid || !this._query || this._query === '?' ? '' : this._query; }, - set search(search) { - if (this._isInvalid || !this._isRelative) + + set search(value) { + if (this._isInvalid || !this._isRelative) { return; + } + this._query = '?'; - if ('?' == search[0]) - search = search.slice(1); - parse.call(this, search, 'query'); + + if (value[0] === '?') { + value = value.slice(1); + } + + parse.call(this, value, 'query'); }, get hash() { - return this._isInvalid || !this._fragment || '#' == this._fragment ? - '' : this._fragment; + return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment; }, - set hash(hash) { - if (this._isInvalid) + + set hash(value) { + if (this._isInvalid) { return; + } + this._fragment = '#'; - if ('#' == hash[0]) - hash = hash.slice(1); - parse.call(this, hash, 'fragment'); + + if (value[0] === '#') { + value = value.slice(1); + } + + parse.call(this, value, 'fragment'); }, get origin() { var host; + if (this._isInvalid || !this._scheme) { return ''; } - // javascript: Gecko returns String(""), WebKit/Blink String("null") - // Gecko throws error for "data://" - // data: Gecko returns "", Blink returns "data://", WebKit returns "null" - // Gecko returns String("") for file: mailto: - // WebKit/Blink returns String("SCHEME://") for file: mailto: + 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; } + }; - - // Copy over the static methods - var OriginalURL = scope.URL; - if (OriginalURL) { - jURL.createObjectURL = function(blob) { - // IE extension allows a second optional options argument. - // http://msdn.microsoft.com/en-us/library/ie/hh772302(v=vs.85).aspx - return OriginalURL.createObjectURL.apply(OriginalURL, arguments); - }; - jURL.revokeObjectURL = function(url) { - OriginalURL.revokeObjectURL(url); - }; - } - - scope.URL = jURL; - /* jshint ignore:end */ -})(globalScope); - -exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; -exports.IDENTITY_MATRIX = IDENTITY_MATRIX; -exports.OPS = OPS; -exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; -exports.AnnotationBorderStyleType = AnnotationBorderStyleType; -exports.AnnotationFlag = AnnotationFlag; -exports.AnnotationType = AnnotationType; -exports.FontType = FontType; -exports.ImageKind = ImageKind; -exports.InvalidPDFException = InvalidPDFException; -exports.LinkTarget = LinkTarget; -exports.LinkTargetStringMap = LinkTargetStringMap; -exports.MessageHandler = MessageHandler; -exports.MissingDataException = MissingDataException; -exports.MissingPDFException = MissingPDFException; -exports.NotImplementedException = NotImplementedException; -exports.PasswordException = PasswordException; -exports.PasswordResponses = PasswordResponses; -exports.StatTimer = StatTimer; -exports.StreamType = StreamType; -exports.TextRenderingMode = TextRenderingMode; -exports.UnexpectedResponseException = UnexpectedResponseException; -exports.UnknownErrorException = UnknownErrorException; -exports.Util = Util; -exports.XRefParseException = XRefParseException; -exports.assert = assert; -exports.bytesToString = bytesToString; -exports.combineUrl = combineUrl; -exports.createPromiseCapability = createPromiseCapability; -exports.deprecated = deprecated; -exports.error = error; -exports.info = info; -exports.isArray = isArray; -exports.isArrayBuffer = isArrayBuffer; -exports.isBool = isBool; -exports.isEmptyObj = isEmptyObj; -exports.isExternalLinkTargetSet = isExternalLinkTargetSet; -exports.isInt = isInt; -exports.isNum = isNum; -exports.isString = isString; -exports.isValidUrl = isValidUrl; -exports.addLinkAttributes = addLinkAttributes; -exports.loadJpegStream = loadJpegStream; -exports.log2 = log2; -exports.readInt8 = readInt8; -exports.readUint16 = readUint16; -exports.readUint32 = readUint32; -exports.removeNullCharacters = removeNullCharacters; -exports.shadow = shadow; -exports.string32 = string32; -exports.stringToBytes = stringToBytes; -exports.stringToPDFString = stringToPDFString; -exports.stringToUTF8String = stringToUTF8String; -exports.utf8StringToString = utf8StringToString; -exports.warn = warn; -})); - - -(function (root, factory) { - { - factory((root.pdfjsDisplayAnnotationLayer = {}), root.pdfjsSharedUtil, - root.pdfjsDisplayDOMUtils); - } -}(this, function (exports, sharedUtil, displayDOMUtils) { - -var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType; -var AnnotationType = sharedUtil.AnnotationType; -var Util = sharedUtil.Util; -var addLinkAttributes = sharedUtil.addLinkAttributes; -var warn = sharedUtil.warn; -var CustomStyle = displayDOMUtils.CustomStyle; - -/** - * @typedef {Object} AnnotationElementParameters - * @property {Object} data - * @property {HTMLDivElement} layer - * @property {PDFPage} page - * @property {PageViewport} viewport - * @property {IPDFLinkService} linkService - */ - -/** - * @class - * @alias AnnotationElementFactory - */ -function AnnotationElementFactory() {} -AnnotationElementFactory.prototype = - /** @lends AnnotationElementFactory.prototype */ { - /** - * @param {AnnotationElementParameters} parameters - * @returns {AnnotationElement} - */ - create: function AnnotationElementFactory_create(parameters) { - var subtype = parameters.data.annotationType; - - switch (subtype) { - case AnnotationType.LINK: - return new LinkAnnotationElement(parameters); - - case AnnotationType.TEXT: - return new TextAnnotationElement(parameters); - - case AnnotationType.WIDGET: - return new WidgetAnnotationElement(parameters); - - case AnnotationType.POPUP: - return new PopupAnnotationElement(parameters); - - case AnnotationType.HIGHLIGHT: - return new HighlightAnnotationElement(parameters); - - case AnnotationType.UNDERLINE: - return new UnderlineAnnotationElement(parameters); - - case AnnotationType.SQUIGGLY: - return new SquigglyAnnotationElement(parameters); - - case AnnotationType.STRIKEOUT: - return new StrikeOutAnnotationElement(parameters); - - default: - throw new Error('Unimplemented annotation type "' + subtype + '"'); - } - } -}; - -/** - * @class - * @alias AnnotationElement - */ -var AnnotationElement = (function AnnotationElementClosure() { - function AnnotationElement(parameters) { - this.data = parameters.data; - this.layer = parameters.layer; - this.page = parameters.page; - this.viewport = parameters.viewport; - this.linkService = parameters.linkService; - - this.container = this._createContainer(); - } - - AnnotationElement.prototype = /** @lends AnnotationElement.prototype */ { - /** - * Create an empty container for the annotation's HTML element. - * - * @private - * @memberof AnnotationElement - * @returns {HTMLSectionElement} - */ - _createContainer: function AnnotationElement_createContainer() { - 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); - - // Do *not* modify `data.rect`, since that will corrupt the annotation - // position on subsequent calls to `_createContainer` (see issue 6804). - var rect = 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] - ]); - - CustomStyle.setProp('transform', container, - 'matrix(' + viewport.transform.join(',') + ')'); - CustomStyle.setProp('transformOrigin', container, - -rect[0] + 'px ' + -rect[1] + 'px'); - - if (data.borderStyle.width > 0) { - container.style.borderWidth = data.borderStyle.width + 'px'; - if (data.borderStyle.style !== AnnotationBorderStyleType.UNDERLINE) { - // Underline styles only have a bottom border, so we do not need - // to adjust for all borders. This yields a similar result as - // Adobe Acrobat/Reader. - 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'; - CustomStyle.setProp('borderRadius', container, radius); - } - - switch (data.borderStyle.style) { - case AnnotationBorderStyleType.SOLID: - container.style.borderStyle = 'solid'; - break; - - case AnnotationBorderStyleType.DASHED: - container.style.borderStyle = 'dashed'; - break; - - case AnnotationBorderStyleType.BEVELED: - warn('Unimplemented border style: beveled'); - break; - - case AnnotationBorderStyleType.INSET: - warn('Unimplemented border style: inset'); - break; - - case AnnotationBorderStyleType.UNDERLINE: - container.style.borderBottomStyle = 'solid'; - break; - - default: - break; - } - - if (data.color) { - container.style.borderColor = - Util.makeCssRgb(data.color[0] | 0, - data.color[1] | 0, - data.color[2] | 0); - } else { - // Transparent (invisible) border, so do not draw it at all. - 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; - }, - - /** - * Render the annotation's HTML element in the empty container. - * - * @public - * @memberof AnnotationElement - */ - render: function AnnotationElement_render() { - throw new Error('Abstract method AnnotationElement.render called'); - } - }; - - return AnnotationElement; + exports.URL = JURL; })(); -/** - * @class - * @alias LinkAnnotationElement - */ -var LinkAnnotationElement = (function LinkAnnotationElementClosure() { - function LinkAnnotationElement(parameters) { - AnnotationElement.call(this, parameters); - } +/***/ }), +/* 146 */ +/***/ (function(module, exports, __w_pdfjs_require__) { - Util.inherit(LinkAnnotationElement, AnnotationElement, { - /** - * Render the link annotation's HTML element in the empty container. - * - * @public - * @memberof LinkAnnotationElement - * @returns {HTMLSectionElement} - */ - render: function LinkAnnotationElement_render() { - this.container.className = 'linkAnnotation'; +"use strict"; - var link = document.createElement('a'); - addLinkAttributes(link, { url: this.data.url }); - if (!this.data.url) { - if (this.data.action) { - this._bindNamedAction(link, this.data.action); - } else { - this._bindLink(link, ('dest' in this.data) ? this.data.dest : null); - } - } +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; - this.container.appendChild(link); - return this.container; - }, +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); - /** - * Bind internal links to the link element. - * - * @private - * @param {Object} link - * @param {Object} destination - * @memberof LinkAnnotationElement - */ - _bindLink: function LinkAnnotationElement_bindLink(link, destination) { - var self = this; +var _util = __w_pdfjs_require__(1); - link.href = this.linkService.getDestinationHash(destination); - link.onclick = function() { - if (destination) { - self.linkService.navigateTo(destination); - } - return false; - }; - if (destination) { - link.className = 'internalLink'; - } - }, +var _dom_utils = __w_pdfjs_require__(151); - /** - * Bind named actions to the link element. - * - * @private - * @param {Object} link - * @param {Object} action - * @memberof LinkAnnotationElement - */ - _bindNamedAction: - function LinkAnnotationElement_bindNamedAction(link, action) { - var self = this; +var _font_loader = __w_pdfjs_require__(152); - link.href = this.linkService.getAnchorUrl(''); - link.onclick = function() { - self.linkService.executeNamedAction(action); - return false; - }; - link.className = 'internalLink'; +var _api_compatibility = __w_pdfjs_require__(153); + +var _canvas = __w_pdfjs_require__(154); + +var _global_scope = _interopRequireDefault(__w_pdfjs_require__(3)); + +var _worker_options = __w_pdfjs_require__(156); + +var _message_handler = __w_pdfjs_require__(157); + +var _metadata = __w_pdfjs_require__(158); + +var _transport_stream = __w_pdfjs_require__(160); + +var _webgl = __w_pdfjs_require__(161); + +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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } + +function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; 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; } + +function _typeof(obj) { 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 isWorkerDisabled = false; +var fallbackWorkerSrc; +var fakeWorkerFilesLoader = null; +{ + var useRequireEnsure = false; + + if (typeof window === 'undefined') { + isWorkerDisabled = true; + + if (typeof require.ensure === 'undefined') { + require.ensure = require('node-ensure'); } - }); - return LinkAnnotationElement; -})(); - -/** - * @class - * @alias TextAnnotationElement - */ -var TextAnnotationElement = (function TextAnnotationElementClosure() { - function TextAnnotationElement(parameters) { - AnnotationElement.call(this, parameters); + useRequireEnsure = true; + } else if (typeof require !== 'undefined' && typeof require.ensure === 'function') { + useRequireEnsure = true; } - Util.inherit(TextAnnotationElement, AnnotationElement, { - /** - * Render the text annotation's HTML element in the empty container. - * - * @public - * @memberof TextAnnotationElement - * @returns {HTMLSectionElement} - */ - render: function TextAnnotationElement_render() { - this.container.className = 'textAnnotation'; + if (typeof requirejs !== 'undefined' && requirejs.toUrl) { + fallbackWorkerSrc = requirejs.toUrl('pdfjs-dist/build/pdf.worker.js'); + } - var image = document.createElement('img'); - image.style.height = this.container.style.height; - image.style.width = this.container.style.width; - image.src = PDFJS.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}); + var dynamicLoaderSupported = typeof requirejs !== 'undefined' && requirejs.load; + fakeWorkerFilesLoader = useRequireEnsure ? function () { + return new Promise(function (resolve, reject) { + require.ensure([], function () { + try { + var worker; + 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 (!this.data.hasPopup) { - var popupElement = new PopupElement({ - container: this.container, - trigger: image, - color: this.data.color, - title: this.data.title, - contents: this.data.contents, - hideWrapper: true + if (!fallbackWorkerSrc && (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'); + } + } +} +var createPDFNetworkStream; + +function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) { + createPDFNetworkStream = pdfNetworkStreamFactory; +} + +function getDocument(src) { + var task = new PDFDocumentLoadingTask(); + var source; + + if (typeof src === 'string') { + source = { + url: src + }; + } else if ((0, _util.isArrayBuffer)(src)) { + source = { + data: src + }; + } else if (src instanceof PDFDataRangeTransport) { + source = { + range: src + }; + } else { + 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'); + } + + source = src; + } + + var params = Object.create(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; + continue; + } else if (key === 'range') { + rangeTransport = source[key]; + continue; + } else if (key === 'worker') { + worker = source[key]; + continue; + } else if (key === 'data' && !(source[key] instanceof Uint8Array)) { + var pdfBytes = source[key]; + + if (typeof pdfBytes === 'string') { + params[key] = (0, _util.stringToBytes)(pdfBytes); + } 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.'); + } + + continue; + } + + params[key] = source[key]; + } + + params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; + params.CMapReaderFactory = params.CMapReaderFactory || _dom_utils.DOMCMapReaderFactory; + params.ignoreErrors = params.stopAtErrors !== 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') { + params.isEvalSupported = true; + } + + if (typeof params.disableFontFace !== 'boolean') { + params.disableFontFace = _api_compatibility.apiCompatibilityParams.disableFontFace || false; + } + + if (typeof params.disableRange !== 'boolean') { + params.disableRange = false; + } + + if (typeof params.disableStream !== 'boolean') { + params.disableStream = false; + } + + 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, + port: _worker_options.GlobalWorkerOptions.workerPort + }; + 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'); + } + + return _fetchDocument(worker, params, rangeTransport, docId).then(function (workerId) { + if (task.destroyed) { + throw new Error('Loading aborted'); + } + + var networkStream; + + if (rangeTransport) { + networkStream = new _transport_stream.PDFDataTransportStream({ + length: params.length, + initialData: params.initialData, + disableRange: params.disableRange, + disableStream: params.disableStream + }, rangeTransport); + } else if (!params.data) { + networkStream = createPDFNetworkStream({ + url: params.url, + length: params.length, + httpHeaders: params.httpHeaders, + withCredentials: params.withCredentials, + rangeChunkSize: params.rangeChunkSize, + disableRange: params.disableRange, + disableStream: params.disableStream }); - var popup = popupElement.render(); - - // Position the popup next to the Text annotation's container. - popup.style.left = image.style.width; - - this.container.appendChild(popup); } - this.container.appendChild(image); - return this.container; - } - }); + 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); + }); + }).catch(task._capability.reject); + return task; +} - return TextAnnotationElement; -})(); - -/** - * @class - * @alias WidgetAnnotationElement - */ -var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() { - function WidgetAnnotationElement(parameters) { - AnnotationElement.call(this, parameters); +function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { + if (worker.destroyed) { + return Promise.reject(new Error('Worker was destroyed')); } - Util.inherit(WidgetAnnotationElement, AnnotationElement, { - /** - * Render the widget annotation's HTML element in the empty container. - * - * @public - * @memberof WidgetAnnotationElement - * @returns {HTMLSectionElement} - */ - render: function WidgetAnnotationElement_render() { - var content = document.createElement('div'); - content.textContent = this.data.fieldValue; - var textAlignment = this.data.textAlignment; - content.style.textAlign = ['left', 'center', 'right'][textAlignment]; - content.style.verticalAlign = 'middle'; - content.style.display = 'table-cell'; + if (pdfDataRangeTransport) { + source.length = pdfDataRangeTransport.length; + source.initialData = pdfDataRangeTransport.initialData; + } - var font = (this.data.fontRefName ? - this.page.commonObjs.getData(this.data.fontRefName) : null); - this._setTextStyle(content, font); - - this.container.appendChild(content); - return this.container; + return worker.messageHandler.sendWithPromise('GetDocRequest', { + docId: docId, + apiVersion: '2.1.266', + source: { + data: source.data, + url: source.url, + password: source.password, + disableAutoFetch: source.disableAutoFetch, + rangeChunkSize: source.rangeChunkSize, + length: source.length }, + maxImageSize: source.maxImageSize, + disableFontFace: source.disableFontFace, + disableCreateObjectURL: source.disableCreateObjectURL, + postMessageTransfers: worker.postMessageTransfers, + docBaseUrl: source.docBaseUrl, + nativeImageDecoderSupport: source.nativeImageDecoderSupport, + ignoreErrors: source.ignoreErrors, + isEvalSupported: source.isEvalSupported + }).then(function (workerId) { + if (worker.destroyed) { + throw new Error('Worker was destroyed'); + } - /** - * Apply text styles to the text in the element. - * - * @private - * @param {HTMLDivElement} element - * @param {Object} font - * @memberof WidgetAnnotationElement - */ - _setTextStyle: - function WidgetAnnotationElement_setTextStyle(element, font) { - // TODO: This duplicates some of the logic in CanvasGraphics.setFont(). - var style = element.style; - style.fontSize = this.data.fontSize + 'px'; - style.direction = (this.data.fontDirection < 0 ? 'rtl': 'ltr'); + return workerId; + }); +} - if (!font) { +var PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() { + var nextDocumentId = 0; + + var PDFDocumentLoadingTask = + /*#__PURE__*/ + function () { + function PDFDocumentLoadingTask() { + _classCallCheck(this, 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; + } + + _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: "then", + value: function then(onFulfilled, onRejected) { + (0, _util.deprecated)('PDFDocumentLoadingTask.then method, ' + 'use the `promise` getter instead.'); + return this.promise.then.apply(this.promise, arguments); + } + }, { + key: "promise", + get: function get() { + return this._capability.promise; + } + }]); + + return PDFDocumentLoadingTask; + }(); + + return PDFDocumentLoadingTask; +}(); + +var PDFDataRangeTransport = +/*#__PURE__*/ +function () { + function PDFDataRangeTransport(length, initialData) { + _classCallCheck(this, PDFDataRangeTransport); + + this.length = length; + this.initialData = initialData; + this._rangeListeners = []; + this._progressListeners = []; + this._progressiveReadListeners = []; + this._readyCapability = (0, _util.createPromiseCapability)(); + } + + _createClass(PDFDataRangeTransport, [{ + key: "addRangeListener", + value: function addRangeListener(listener) { + this._rangeListeners.push(listener); + } + }, { + key: "addProgressListener", + value: function addProgressListener(listener) { + this._progressListeners.push(listener); + } + }, { + key: "addProgressiveReadListener", + value: function addProgressiveReadListener(listener) { + this._progressiveReadListeners.push(listener); + } + }, { + key: "onDataRange", + value: function onDataRange(begin, chunk) { + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = this._rangeListeners[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var listener = _step.value; + listener(begin, chunk); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return != null) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + } + }, { + key: "onDataProgress", + value: function onDataProgress(loaded) { + var _this2 = this; + + this._readyCapability.promise.then(function () { + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = _this2._progressListeners[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var listener = _step2.value; + listener(loaded); + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return != null) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + }); + } + }, { + key: "onDataProgressiveRead", + value: function onDataProgressiveRead(chunk) { + var _this3 = this; + + this._readyCapability.promise.then(function () { + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for (var _iterator3 = _this3._progressiveReadListeners[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var listener = _step3.value; + listener(chunk); + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return != null) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + }); + } + }, { + key: "transportReady", + value: function transportReady() { + this._readyCapability.resolve(); + } + }, { + key: "requestDataRange", + value: function requestDataRange(begin, end) { + (0, _util.unreachable)('Abstract method PDFDataRangeTransport.requestDataRange'); + } + }, { + key: "abort", + value: function abort() {} + }]); + + return PDFDataRangeTransport; +}(); + +exports.PDFDataRangeTransport = PDFDataRangeTransport; + +var PDFDocumentProxy = +/*#__PURE__*/ +function () { + function PDFDocumentProxy(pdfInfo, transport, loadingTask) { + _classCallCheck(this, PDFDocumentProxy); + + this.loadingTask = loadingTask; + this._pdfInfo = pdfInfo; + this._transport = transport; + } + + _createClass(PDFDocumentProxy, [{ + key: "getPage", + value: function getPage(pageNumber) { + return this._transport.getPage(pageNumber); + } + }, { + key: "getPageIndex", + value: function getPageIndex(ref) { + return this._transport.getPageIndex(ref); + } + }, { + key: "getDestinations", + value: function getDestinations() { + return this._transport.getDestinations(); + } + }, { + key: "getDestination", + value: function getDestination(id) { + return this._transport.getDestination(id); + } + }, { + key: "getPageLabels", + value: function getPageLabels() { + return this._transport.getPageLabels(); + } + }, { + key: "getPageMode", + value: function getPageMode() { + return this._transport.getPageMode(); + } + }, { + key: "getOpenActionDestination", + value: function getOpenActionDestination() { + return this._transport.getOpenActionDestination(); + } + }, { + key: "getAttachments", + value: function getAttachments() { + return this._transport.getAttachments(); + } + }, { + key: "getJavaScript", + value: function getJavaScript() { + return this._transport.getJavaScript(); + } + }, { + key: "getOutline", + value: function getOutline() { + return this._transport.getOutline(); + } + }, { + key: "getPermissions", + value: function getPermissions() { + return this._transport.getPermissions(); + } + }, { + key: "getMetadata", + value: function getMetadata() { + return this._transport.getMetadata(); + } + }, { + key: "getData", + value: function getData() { + return this._transport.getData(); + } + }, { + key: "getDownloadInfo", + value: function getDownloadInfo() { + return this._transport.downloadInfoCapability.promise; + } + }, { + key: "getStats", + value: function getStats() { + return this._transport.getStats(); + } + }, { + key: "cleanup", + value: function cleanup() { + this._transport.startCleanup(); + } + }, { + key: "destroy", + value: function destroy() { + return this.loadingTask.destroy(); + } + }, { + key: "numPages", + get: function get() { + return this._pdfInfo.numPages; + } + }, { + key: "fingerprint", + get: function get() { + return this._pdfInfo.fingerprint; + } + }, { + key: "loadingParams", + get: function get() { + return this._transport.loadingParams; + } + }]); + + return PDFDocumentProxy; +}(); + +exports.PDFDocumentProxy = PDFDocumentProxy; + +var PDFPageProxy = +/*#__PURE__*/ +function () { + function PDFPageProxy(pageIndex, pageInfo, transport) { + var pdfBug = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + _classCallCheck(this, PDFPageProxy); + + this.pageIndex = pageIndex; + this._pageInfo = pageInfo; + this._transport = transport; + this._stats = pdfBug ? new _dom_utils.StatTimer() : _dom_utils.DummyStatTimer; + this._pdfBug = pdfBug; + this.commonObjs = transport.commonObjs; + this.objs = new PDFObjects(); + this.cleanupAfterRender = false; + this.pendingCleanup = false; + this.intentStates = Object.create(null); + this.destroyed = false; + } + + _createClass(PDFPageProxy, [{ + key: "getViewport", + value: function getViewport() { + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + scale = _ref.scale, + _ref$rotation = _ref.rotation, + rotation = _ref$rotation === void 0 ? this.rotate : _ref$rotation, + _ref$dontFlip = _ref.dontFlip, + dontFlip = _ref$dontFlip === void 0 ? false : _ref$dontFlip; + + if (arguments.length > 1 || typeof arguments[0] === 'number') { + (0, _util.deprecated)('getViewport is called with obsolete arguments.'); + scale = arguments[0]; + rotation = typeof arguments[1] === 'number' ? arguments[1] : this.rotate; + dontFlip = typeof arguments[2] === 'boolean' ? arguments[2] : false; + } + + return new _dom_utils.PageViewport({ + viewBox: this.view, + scale: scale, + rotation: rotation, + dontFlip: dontFlip + }); + } + }, { + key: "getAnnotations", + value: function getAnnotations() { + var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref2$intent = _ref2.intent, + intent = _ref2$intent === void 0 ? null : _ref2$intent; + + if (!this.annotationsPromise || this.annotationsIntent !== intent) { + this.annotationsPromise = this._transport.getAnnotations(this.pageIndex, intent); + this.annotationsIntent = intent; + } + + return this.annotationsPromise; + } + }, { + key: "render", + value: function render(_ref3) { + var _this4 = this; + + var canvasContext = _ref3.canvasContext, + viewport = _ref3.viewport, + _ref3$intent = _ref3.intent, + intent = _ref3$intent === void 0 ? 'display' : _ref3$intent, + _ref3$enableWebGL = _ref3.enableWebGL, + enableWebGL = _ref3$enableWebGL === void 0 ? false : _ref3$enableWebGL, + _ref3$renderInteracti = _ref3.renderInteractiveForms, + renderInteractiveForms = _ref3$renderInteracti === void 0 ? false : _ref3$renderInteracti, + _ref3$transform = _ref3.transform, + transform = _ref3$transform === void 0 ? null : _ref3$transform, + _ref3$imageLayer = _ref3.imageLayer, + imageLayer = _ref3$imageLayer === void 0 ? null : _ref3$imageLayer, + _ref3$canvasFactory = _ref3.canvasFactory, + canvasFactory = _ref3$canvasFactory === void 0 ? null : _ref3$canvasFactory, + _ref3$background = _ref3.background, + background = _ref3$background === void 0 ? null : _ref3$background; + var stats = this._stats; + stats.time('Overall'); + this.pendingCleanup = false; + var renderingIntent = intent === 'print' ? 'print' : 'display'; + var canvasFactoryInstance = canvasFactory || new _dom_utils.DOMCanvasFactory(); + var webGLContext = new _webgl.WebGLContext({ + enable: enableWebGL + }); + + if (!this.intentStates[renderingIntent]) { + this.intentStates[renderingIntent] = Object.create(null); + } + + var intentState = this.intentStates[renderingIntent]; + + 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, + intent: renderingIntent, + 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; + } + + _this4._tryCleanup(); + + if (error) { + internalRenderTask.capability.reject(error); + } else { + internalRenderTask.capability.resolve(); + } + + stats.timeEnd('Rendering'); + stats.timeEnd('Overall'); + }; + + 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, + pageNumber: this.pageNumber, + 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) { + complete(); + return; + } + + stats.time('Rendering'); + internalRenderTask.initializeGraphics(transparency); + internalRenderTask.operatorListChanged(); + }).catch(complete); + return renderTask; + } + }, { + 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'; + + 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); + intentState.operatorList = { + fnArray: [], + argsArray: [], + lastChunk: false + }; + + this._stats.time('Page Request'); + + this._transport.messageHandler.send('RenderPageRequest', { + pageIndex: this.pageIndex, + intent: renderingIntent + }); + } + + return intentState.opListReadCapability.promise; + } + }, { + key: "streamTextContent", + value: function streamTextContent() { + var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref4$normalizeWhites = _ref4.normalizeWhitespace, + normalizeWhitespace = _ref4$normalizeWhites === void 0 ? false : _ref4$normalizeWhites, + _ref4$disableCombineT = _ref4.disableCombineTextItems, + disableCombineTextItems = _ref4$disableCombineT === void 0 ? false : _ref4$disableCombineT; + + var TEXT_CONTENT_CHUNK_SIZE = 100; + return this._transport.messageHandler.sendWithStream('GetTextContent', { + pageIndex: this.pageNumber - 1, + normalizeWhitespace: normalizeWhitespace === true, + combineTextItems: disableCombineTextItems !== true + }, { + highWaterMark: TEXT_CONTENT_CHUNK_SIZE, + size: function size(textContent) { + return textContent.items.length; + } + }); + } + }, { + 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 (_ref5) { + var _textContent$items; + + var value = _ref5.value, + done = _ref5.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: [], + styles: Object.create(null) + }; + pump(); + }); + } + }, { + key: "_destroy", + value: function _destroy() { + this.destroyed = true; + this._transport.pageCache[this.pageIndex] = null; + var waitOn = []; + Object.keys(this.intentStates).forEach(function (intent) { + if (intent === 'oplist') { + return; + } + + var intentState = this.intentStates[intent]; + intentState.renderTasks.forEach(function (renderTask) { + 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); + } + }, { + key: "cleanup", + value: function cleanup() { + var resetStats = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + this.pendingCleanup = true; + + this._tryCleanup(resetStats); + } + }, { + key: "_tryCleanup", + value: function _tryCleanup() { + 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; } - style.fontWeight = (font.black ? - (font.bold ? '900' : 'bold') : - (font.bold ? 'bold' : 'normal')); - style.fontStyle = (font.italic ? 'italic' : 'normal'); + Object.keys(this.intentStates).forEach(function (intent) { + delete this.intentStates[intent]; + }, this); + this.objs.clear(); + this.annotationsPromise = null; - // Use a reasonable default font if the font doesn't specify a fallback. - var fontFamily = font.loadedName ? '"' + font.loadedName + '", ' : ''; - var fallbackName = font.fallbackName || 'Helvetica, sans-serif'; - style.fontFamily = fontFamily + fallbackName; - } - }); - - return WidgetAnnotationElement; -})(); - -/** - * @class - * @alias PopupAnnotationElement - */ -var PopupAnnotationElement = (function PopupAnnotationElementClosure() { - function PopupAnnotationElement(parameters) { - AnnotationElement.call(this, parameters); - } - - Util.inherit(PopupAnnotationElement, AnnotationElement, { - /** - * Render the popup annotation's HTML element in the empty container. - * - * @public - * @memberof PopupAnnotationElement - * @returns {HTMLSectionElement} - */ - render: function PopupAnnotationElement_render() { - this.container.className = 'popupAnnotation'; - - var selector = '[data-annotation-id="' + this.data.parentId + '"]'; - var parentElement = this.layer.querySelector(selector); - if (!parentElement) { - return this.container; + if (resetStats && this._stats instanceof _dom_utils.StatTimer) { + this._stats = new _dom_utils.StatTimer(); } - var popup = new PopupElement({ - container: this.container, - trigger: parentElement, - color: this.data.color, - title: this.data.title, - contents: this.data.contents + this.pendingCleanup = false; + } + }, { + key: "_startRenderPage", + value: function _startRenderPage(transparency, intent) { + var intentState = this.intentStates[intent]; + + if (intentState.displayReadyCapability) { + intentState.displayReadyCapability.resolve(transparency); + } + } + }, { + key: "_renderPageChunk", + value: function _renderPageChunk(operatorListChunk, intent) { + var intentState = this.intentStates[intent]; + + 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 (var _i = 0; _i < intentState.renderTasks.length; _i++) { + intentState.renderTasks[_i].operatorListChanged(); + } + + if (operatorListChunk.lastChunk) { + intentState.receivingOperatorList = false; + + this._tryCleanup(); + } + } + }, { + 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 instanceof _dom_utils.StatTimer ? this._stats : null; + } + }]); + + 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 _this5 = 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 (value === buffer) { + result = value; + } else 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' || typeof desc.value === 'function') { + continue; + } + + 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); }); - - // Position the popup next to the parent annotation's container. - // PDF viewers ignore a popup annotation's rectangle. - var parentLeft = parseFloat(parentElement.style.left); - var parentWidth = parseFloat(parentElement.style.width); - CustomStyle.setProp('transformOrigin', this.container, - -(parentLeft + parentWidth) + 'px -' + - parentElement.style.top); - this.container.style.left = (parentLeft + parentWidth) + 'px'; - - this.container.appendChild(popup.render()); - return this.container; } - }); + }, { + key: "addEventListener", + value: function addEventListener(name, listener) { + this._listeners.push(listener); + } + }, { + key: "removeEventListener", + value: function removeEventListener(name, listener) { + var i = this._listeners.indexOf(listener); - return PopupAnnotationElement; -})(); + this._listeners.splice(i, 1); + } + }, { + key: "terminate", + value: function terminate() { + this._listeners = []; + } + }]); -/** - * @class - * @alias PopupElement - */ -var PopupElement = (function PopupElementClosure() { - var BACKGROUND_ENLIGHT = 0.7; + return LoopbackPort; +}(); - function PopupElement(parameters) { - 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; +exports.LoopbackPort = LoopbackPort; - this.pinned = false; +var PDFWorker = function PDFWorkerClosure() { + var pdfWorkerPorts = new WeakMap(); + var nextFakeWorkerId = 0; + var fakeWorkerFilesLoadedCapability; + + function _getWorkerSrc() { + if (_worker_options.GlobalWorkerOptions.workerSrc) { + return _worker_options.GlobalWorkerOptions.workerSrc; + } + + if (typeof fallbackWorkerSrc !== 'undefined') { + return fallbackWorkerSrc; + } + + throw new Error('No "GlobalWorkerOptions.workerSrc" specified.'); } - PopupElement.prototype = /** @lends PopupElement.prototype */ { - /** - * Render the popup's HTML element. - * - * @public - * @memberof PopupElement - * @returns {HTMLSectionElement} - */ - render: function PopupElement_render() { - var wrapper = document.createElement('div'); - wrapper.className = 'popupWrapper'; - - // For Popup annotations we hide the entire section because it contains - // only the popup. However, for Text annotations without a separate Popup - // annotation, we cannot hide the entire container as the image would - // disappear too. In that special case, hiding the wrapper suffices. - 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) { - // Enlighten the 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.makeCssRgb(r | 0, g | 0, b | 0); + function getMainThreadWorkerMessageHandler() { + try { + if (typeof window !== 'undefined') { + return window.pdfjsWorker && window.pdfjsWorker.WorkerMessageHandler; } + } catch (ex) {} - var contents = this._formatContents(this.contents); - var title = document.createElement('h1'); - title.textContent = this.title; - - // Attach the event listeners to the trigger element. - 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; - }, - - /** - * Format the contents of the popup by adding newlines where necessary. - * - * @private - * @param {string} contents - * @memberof PopupElement - * @returns {HTMLParagraphElement} - */ - _formatContents: function PopupElement_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')); - } - } - return p; - }, - - /** - * Toggle the visibility of the popup. - * - * @private - * @memberof PopupElement - */ - _toggle: function PopupElement_toggle() { - if (this.pinned) { - this._hide(true); - } else { - this._show(true); - } - }, - - /** - * Show the popup. - * - * @private - * @param {boolean} pin - * @memberof PopupElement - */ - _show: function PopupElement_show(pin) { - if (pin) { - this.pinned = true; - } - if (this.hideElement.hasAttribute('hidden')) { - this.hideElement.removeAttribute('hidden'); - this.container.style.zIndex += 1; - } - }, - - /** - * Hide the popup. - * - * @private - * @param {boolean} unpin - * @memberof PopupElement - */ - _hide: function PopupElement_hide(unpin) { - if (unpin) { - this.pinned = false; - } - if (!this.hideElement.hasAttribute('hidden') && !this.pinned) { - this.hideElement.setAttribute('hidden', true); - this.container.style.zIndex -= 1; - } - } - }; - - return PopupElement; -})(); - -/** - * @class - * @alias HighlightAnnotationElement - */ -var HighlightAnnotationElement = ( - function HighlightAnnotationElementClosure() { - function HighlightAnnotationElement(parameters) { - AnnotationElement.call(this, parameters); + return null; } - Util.inherit(HighlightAnnotationElement, AnnotationElement, { - /** - * Render the highlight annotation's HTML element in the empty container. - * - * @public - * @memberof HighlightAnnotationElement - * @returns {HTMLSectionElement} - */ - render: function HighlightAnnotationElement_render() { - this.container.className = 'highlightAnnotation'; - return this.container; + function setupFakeWorkerGlobal() { + if (fakeWorkerFilesLoadedCapability) { + return fakeWorkerFilesLoadedCapability.promise; } - }); - return HighlightAnnotationElement; -})(); + fakeWorkerFilesLoadedCapability = (0, _util.createPromiseCapability)(); + var mainWorkerMessageHandler = getMainThreadWorkerMessageHandler(); -/** - * @class - * @alias UnderlineAnnotationElement - */ -var UnderlineAnnotationElement = ( - function UnderlineAnnotationElementClosure() { - function UnderlineAnnotationElement(parameters) { - AnnotationElement.call(this, parameters); + 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; } - Util.inherit(UnderlineAnnotationElement, AnnotationElement, { - /** - * Render the underline annotation's HTML element in the empty container. - * - * @public - * @memberof UnderlineAnnotationElement - * @returns {HTMLSectionElement} - */ - render: function UnderlineAnnotationElement_render() { - this.container.className = 'underlineAnnotation'; - return this.container; - } - }); - - return UnderlineAnnotationElement; -})(); - -/** - * @class - * @alias SquigglyAnnotationElement - */ -var SquigglyAnnotationElement = (function SquigglyAnnotationElementClosure() { - function SquigglyAnnotationElement(parameters) { - AnnotationElement.call(this, parameters); + function createCDNWrapper(url) { + var wrapper = 'importScripts(\'' + url + '\');'; + return _util.URL.createObjectURL(new Blob([wrapper])); } - Util.inherit(SquigglyAnnotationElement, AnnotationElement, { - /** - * Render the squiggly annotation's HTML element in the empty container. - * - * @public - * @memberof SquigglyAnnotationElement - * @returns {HTMLSectionElement} - */ - render: function SquigglyAnnotationElement_render() { - this.container.className = 'squigglyAnnotation'; - return this.container; + var PDFWorker = + /*#__PURE__*/ + function () { + function PDFWorker() { + var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref6$name = _ref6.name, + name = _ref6$name === void 0 ? null : _ref6$name, + _ref6$port = _ref6.port, + port = _ref6$port === void 0 ? null : _ref6$port, + _ref6$postMessageTran = _ref6.postMessageTransfers, + postMessageTransfers = _ref6$postMessageTran === void 0 ? true : _ref6$postMessageTran, + _ref6$verbosity = _ref6.verbosity, + verbosity = _ref6$verbosity === void 0 ? (0, _util.getVerbosityLevel)() : _ref6$verbosity; + + _classCallCheck(this, PDFWorker); + + 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(); } - }); - return SquigglyAnnotationElement; -})(); + _createClass(PDFWorker, [{ + key: "_initializeFromPort", + value: function _initializeFromPort(port) { + this._port = port; + this._messageHandler = new _message_handler.MessageHandler('main', 'worker', port); -/** - * @class - * @alias StrikeOutAnnotationElement - */ -var StrikeOutAnnotationElement = ( - function StrikeOutAnnotationElementClosure() { - function StrikeOutAnnotationElement(parameters) { - AnnotationElement.call(this, parameters); - } + this._messageHandler.on('ready', function () {}); - Util.inherit(StrikeOutAnnotationElement, AnnotationElement, { - /** - * Render the strikeout annotation's HTML element in the empty container. - * - * @public - * @memberof StrikeOutAnnotationElement - * @returns {HTMLSectionElement} - */ - render: function StrikeOutAnnotationElement_render() { - this.container.className = 'strikeoutAnnotation'; - return this.container; - } - }); + this._readyCapability.resolve(); + } + }, { + key: "_initialize", + value: function _initialize() { + var _this6 = this; - return StrikeOutAnnotationElement; -})(); + if (typeof Worker !== 'undefined' && !isWorkerDisabled && !getMainThreadWorkerMessageHandler()) { + var workerSrc = _getWorkerSrc(); -/** - * @typedef {Object} AnnotationLayerParameters - * @property {PageViewport} viewport - * @property {HTMLDivElement} div - * @property {Array} annotations - * @property {PDFPage} page - * @property {IPDFLinkService} linkService - */ + try { + if (!(0, _util.isSameOrigin)(window.location.href, workerSrc)) { + workerSrc = createCDNWrapper(new _util.URL(workerSrc, window.location).href); + } -/** - * @class - * @alias AnnotationLayer - */ -var AnnotationLayer = (function AnnotationLayerClosure() { - return { - /** - * Render a new annotation layer with all annotation elements. - * - * @public - * @param {AnnotationLayerParameters} parameters - * @memberof AnnotationLayer - */ - render: function AnnotationLayer_render(parameters) { - var annotationElementFactory = new AnnotationElementFactory(); + var worker = new Worker(workerSrc); + var messageHandler = new _message_handler.MessageHandler('main', 'worker', worker); - for (var i = 0, ii = parameters.annotations.length; i < ii; i++) { - var data = parameters.annotations[i]; - if (!data || !data.hasHtml) { - continue; + 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.'); + } } - var properties = { - data: data, - layer: parameters.div, - page: parameters.page, - viewport: parameters.viewport, - linkService: parameters.linkService - }; - var element = annotationElementFactory.create(properties); - parameters.div.appendChild(element.render()); + this._setupFakeWorker(); } - }, + }, { + key: "_setupFakeWorker", + value: function _setupFakeWorker() { + var _this7 = this; - /** - * Update the annotation elements on existing annotation layer. - * - * @public - * @param {AnnotationLayerParameters} parameters - * @memberof AnnotationLayer - */ - update: function AnnotationLayer_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) { - CustomStyle.setProp('transform', element, - 'matrix(' + parameters.viewport.transform.join(',') + ')'); + 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: \"".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; } } - parameters.div.removeAttribute('hidden'); - } - }; -})(); + }, { + 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.'); + } -PDFJS.AnnotationLayer = AnnotationLayer; + if (pdfWorkerPorts.has(params.port)) { + return pdfWorkerPorts.get(params.port); + } -exports.AnnotationLayer = AnnotationLayer; -})); + return new PDFWorker(params); + } + }, { + key: "getWorkerSrc", + value: function getWorkerSrc() { + return _getWorkerSrc(); + } + }]); + return PDFWorker; + }(); -(function (root, factory) { - { - factory((root.pdfjsDisplayFontLoader = {}), root.pdfjsSharedUtil, - root.pdfjsSharedGlobal); - } -}(this, function (exports, sharedUtil, sharedGlobal) { + return PDFWorker; +}(); -var assert = sharedUtil.assert; -var bytesToString = sharedUtil.bytesToString; -var string32 = sharedUtil.string32; -var shadow = sharedUtil.shadow; -var warn = sharedUtil.warn; +exports.PDFWorker = PDFWorker; -var PDFJS = sharedGlobal.PDFJS; -var globalScope = sharedGlobal.globalScope; -var isWorker = sharedGlobal.isWorker; +var WorkerTransport = +/*#__PURE__*/ +function () { + function WorkerTransport(messageHandler, loadingTask, networkStream, params) { + _classCallCheck(this, WorkerTransport); -function FontLoader(docId) { - this.docId = docId; - this.styleElement = null; - this.nativeFontFaces = []; - this.loadTestFontId = 0; - this.loadingContext = { - requests: [], - nextRequestId: 0 - }; -} -FontLoader.prototype = { - insertRule: function fontLoaderInsertRule(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); - }, - - clear: function fontLoaderClear() { - var styleElement = this.styleElement; - if (styleElement) { - styleElement.parentNode.removeChild(styleElement); - styleElement = this.styleElement = null; - } - this.nativeFontFaces.forEach(function(nativeFontFace) { - document.fonts.delete(nativeFontFace); + this.messageHandler = messageHandler; + this.loadingTask = loadingTask; + this.commonObjs = new PDFObjects(); + this.fontLoader = new _font_loader.FontLoader({ + docId: loadingTask.docId, + onUnsupportedFeature: this._onUnsupportedFeature.bind(this) }); - this.nativeFontFaces.length = 0; - }, - get loadTestFont() { - // This is a CFF font with 1 glyph for '.' that fills its entire width and - // height. - return shadow(this, 'loadTestFont', atob( - 'T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQ' + - 'AABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwA' + - 'AAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbm' + - 'FtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAA' + - 'AADOBO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AYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWF' + - 'hYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQA' + - 'AAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAg' + - 'ABAAAAAAAAAAAD6AAAAAAAAA==' - )); - }, + this._params = params; + this.CMapReaderFactory = new params.CMapReaderFactory({ + baseUrl: params.cMapUrl, + isCompressed: params.cMapPacked + }); + this.destroyed = false; + this.destroyCapability = null; + this._passwordCapability = null; + this._networkStream = networkStream; + this._fullReader = null; + this._lastProgress = null; + this.pageCache = []; + this.pagePromises = []; + this.downloadInfoCapability = (0, _util.createPromiseCapability)(); + this.setupMessageHandler(); + } - addNativeFontFace: function fontLoader_addNativeFontFace(nativeFontFace) { - this.nativeFontFaces.push(nativeFontFace); - document.fonts.add(nativeFontFace); - }, + _createClass(WorkerTransport, [{ + key: "destroy", + value: function destroy() { + var _this8 = this; - bind: function fontLoaderBind(fonts, callback) { - assert(!isWorker, 'bind() shall be called from main thread'); - - var rules = []; - var fontsToLoad = []; - var fontLoadPromises = []; - var getNativeFontPromise = function(nativeFontFace) { - // Return a promise that is always fulfilled, even when the font fails to - // load. - return nativeFontFace.loaded.catch(function(e) { - warn('Failed to load font "' + nativeFontFace.family + '": ' + e); - }); - }; - for (var i = 0, ii = fonts.length; i < ii; i++) { - var font = fonts[i]; - - // Add the font to the DOM only once or skip if the font - // is already loaded. - if (font.attached || font.loading === false) { - continue; + if (this.destroyCapability) { + return this.destroyCapability.promise; } - font.attached = true; - if (FontLoader.isFontLoadingAPISupported) { - var nativeFontFace = font.createNativeFontFace(); - if (nativeFontFace) { - this.addNativeFontFace(nativeFontFace); - fontLoadPromises.push(getNativeFontPromise(nativeFontFace)); + this.destroyed = true; + this.destroyCapability = (0, _util.createPromiseCapability)(); + + if (this._passwordCapability) { + this._passwordCapability.reject(new Error('Worker was destroyed during onPassword callback')); + } + + var waitOn = []; + this.pageCache.forEach(function (page) { + if (page) { + waitOn.push(page._destroy()); } - } else { - var rule = font.createFontFaceRule(); - if (rule) { - this.insertRule(rule); - rules.push(rule); - fontsToLoad.push(font); - } - } - } - - var request = this.queueLoadingCallback(callback); - if (FontLoader.isFontLoadingAPISupported) { - Promise.all(fontLoadPromises).then(function() { - request.complete(); }); - } else if (rules.length > 0 && !FontLoader.isSyncFontLoadingSupported) { - this.prepareFontLoadEvent(rules, fontsToLoad, request); - } else { - request.complete(); + this.pageCache = []; + this.pagePromises = []; + var terminated = this.messageHandler.sendWithPromise('Terminate', null); + waitOn.push(terminated); + Promise.all(waitOn).then(function () { + _this8.fontLoader.clear(); + + if (_this8._networkStream) { + _this8._networkStream.cancelAllRequests(); + } + + if (_this8.messageHandler) { + _this8.messageHandler.destroy(); + + _this8.messageHandler = null; + } + + _this8.destroyCapability.resolve(); + }, this.destroyCapability.reject); + return this.destroyCapability.promise; } - }, + }, { + key: "setupMessageHandler", + value: function setupMessageHandler() { + var messageHandler = this.messageHandler, + loadingTask = this.loadingTask; + messageHandler.on('GetReader', function (data, sink) { + var _this9 = this; - queueLoadingCallback: function FontLoader_queueLoadingCallback(callback) { - function LoadLoader_completeRequest() { - assert(!request.end, 'completeRequest() cannot be called twice'); - request.end = Date.now(); + (0, _util.assert)(this._networkStream); + this._fullReader = this._networkStream.getFullReader(); - // sending all completed requests in order how they were queued - while (context.requests.length > 0 && context.requests[0].end) { - var otherRequest = context.requests.shift(); - setTimeout(otherRequest.callback, 0); - } - } + this._fullReader.onProgress = function (evt) { + _this9._lastProgress = { + loaded: evt.loaded, + total: evt.total + }; + }; - var context = this.loadingContext; - var requestId = 'pdfjs-font-loading-' + (context.nextRequestId++); - var request = { - id: requestId, - complete: LoadLoader_completeRequest, - callback: callback, - started: Date.now() - }; - context.requests.push(request); - return request; - }, + sink.onPull = function () { + _this9._fullReader.read().then(function (_ref7) { + var value = _ref7.value, + done = _ref7.done; - prepareFontLoadEvent: function fontLoaderPrepareFontLoadEvent(rules, - fonts, - request) { - /** Hack begin */ - // There's currently no event when a font has finished downloading so the - // following code is a dirty hack to 'guess' when a font is - // ready. It's assumed fonts are loaded in order, so add a known test - // font after the desired fonts and then test for the loading of that - // test font. + if (done) { + sink.close(); + return; + } - function int32(data, offset) { - return (data.charCodeAt(offset) << 24) | - (data.charCodeAt(offset + 1) << 16) | - (data.charCodeAt(offset + 2) << 8) | - (data.charCodeAt(offset + 3) & 0xff); - } + (0, _util.assert)((0, _util.isArrayBuffer)(value)); + sink.enqueue(new Uint8Array(value), 1, [value]); + }).catch(function (reason) { + sink.error(reason); + }); + }; - function spliceString(s, offset, remove, insert) { - var chunk1 = s.substr(0, offset); - var chunk2 = s.substr(offset + remove); - return chunk1 + insert + chunk2; - } + sink.onCancel = function (reason) { + _this9._fullReader.cancel(reason); + }; + }, this); + messageHandler.on('ReaderHeadersReady', function (data) { + var _this10 = this; - var i, ii; + var headersCapability = (0, _util.createPromiseCapability)(); + var fullReader = this._fullReader; + fullReader.headersReady.then(function () { + if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) { + if (_this10._lastProgress && loadingTask.onProgress) { + loadingTask.onProgress(_this10._lastProgress); + } - var canvas = document.createElement('canvas'); - canvas.width = 1; - canvas.height = 1; - var ctx = canvas.getContext('2d'); + fullReader.onProgress = function (evt) { + if (loadingTask.onProgress) { + loadingTask.onProgress({ + loaded: evt.loaded, + total: evt.total + }); + } + }; + } - var called = 0; - function isFontReady(name, callback) { - called++; - // With setTimeout clamping this gives the font ~100ms to load. - if(called > 30) { - warn('Load test font never loaded.'); - callback(); + headersCapability.resolve({ + isStreamingSupported: fullReader.isStreamingSupported, + isRangeSupported: fullReader.isRangeSupported, + contentLength: fullReader.contentLength + }); + }, 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); + + sink.onPull = function () { + rangeReader.read().then(function (_ref8) { + var value = _ref8.value, + done = _ref8.done; + + if (done) { + sink.close(); + return; + } + + (0, _util.assert)((0, _util.isArrayBuffer)(value)); + sink.enqueue(new Uint8Array(value), 1, [value]); + }).catch(function (reason) { + sink.error(reason); + }); + }; + + sink.onCancel = function (reason) { + rangeReader.cancel(reason); + }; + }, this); + messageHandler.on('GetDoc', function (_ref9) { + var pdfInfo = _ref9.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; + + this._passwordCapability = (0, _util.createPromiseCapability)(); + + if (loadingTask.onPassword) { + var updatePassword = function updatePassword(password) { + _this11._passwordCapability.resolve({ + password: password + }); + }; + + try { + loadingTask.onPassword(updatePassword, exception.code); + } catch (ex) { + this._passwordCapability.reject(ex); + } + } else { + this._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) { + 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; } - ctx.font = '30px ' + name; - ctx.fillText('.', 0, 20); - var imageData = ctx.getImageData(0, 0, 1, 1); - if (imageData.data[3] > 0) { - callback(); + + 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) { return; } - setTimeout(isFontReady.bind(null, name, callback)); + + var page = this.pageCache[data.pageIndex]; + + page._renderPageChunk(data.operatorList, data.intent); + }, this); + messageHandler.on('commonobj', function (data) { + var _this12 = this; + + if (this.destroyed) { + return; + } + + var _data = _slicedToArray(data, 3), + id = _data[0], + type = _data[1], + exportedData = _data[2]; + + if (this.commonObjs.has(id)) { + return; + } + + switch (type) { + case 'Font': + var params = this._params; + + if ('error' in exportedData) { + var exportedError = exportedData.error; + (0, _util.warn)("Error during font loading: ".concat(exportedError)); + this.commonObjs.resolve(id, exportedError); + break; + } + + var fontRegistry = null; + + if (params.pdfBug && _global_scope.default.FontInspector && _global_scope.default.FontInspector.enabled) { + fontRegistry = { + registerFont: function registerFont(font, url) { + _global_scope.default['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), + fontRegistry: fontRegistry + }); + this.fontLoader.bind(font).then(function () { + _this12.commonObjs.resolve(id, font); + }, function (reason) { + messageHandler.sendWithPromise('FontFallback', { + id: id + }).finally(function () { + _this12.commonObjs.resolve(id, font); + }); + }); + break; + + case 'FontPath': + this.commonObjs.resolve(id, exportedData); + break; + + default: + throw new Error("Got unknown common object type ".concat(type)); + } + }, this); + messageHandler.on('obj', function (data) { + if (this.destroyed) { + return; + } + + var _data2 = _slicedToArray(data, 4), + id = _data2[0], + pageIndex = _data2[1], + type = _data2[2], + imageData = _data2[3]; + + var pageProxy = this.pageCache[pageIndex]; + + if (pageProxy.objs.has(id)) { + return; + } + + 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': + 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) { + pageProxy.cleanupAfterRender = true; + } + + break; + + default: + throw new Error("Got unknown object type ".concat(type)); + } + }, this); + messageHandler.on('DocProgress', function (data) { + if (this.destroyed) { + return; + } + + if (loadingTask.onProgress) { + loadingTask.onProgress({ + loaded: data.loaded, + total: data.total + }); + } + }, this); + messageHandler.on('PageError', function (data) { + if (this.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(); + } + } + }, 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]; + + 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 _i2 = 0, _j = 0; _i2 < rgbaLength; _i2 += 4, _j++) { + buf[_j] = data[_i2]; + } + } + + 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); + } + }, { + key: "_onUnsupportedFeature", + value: function _onUnsupportedFeature(_ref10) { + var featureId = _ref10.featureId; + + if (this.destroyed) { + return; } - var loadTestFontId = 'lt' + Date.now() + this.loadTestFontId++; - // Chromium seems to cache fonts based on a hash of the actual font data, - // so the font must be modified for each load test else it will appear to - // be loaded already. - // TODO: This could maybe be made faster by avoiding the btoa of the full - // font by splitting it in chunks before hand and padding the font id. - var data = this.loadTestFont; - var COMMENT_OFFSET = 976; // has to be on 4 byte boundary (for checksum) - data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, - loadTestFontId); - // CFF checksum is important for IE, adjusting it - var CFF_CHECKSUM_OFFSET = 16; - var XXXX_VALUE = 0x58585858; // the "comment" filled with 'X' - 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 (this.loadingTask.onUnsupportedFeature) { + this.loadingTask.onUnsupportedFeature(featureId); } - if (i < loadTestFontId.length) { // align to 4 bytes boundary - checksum = (checksum - XXXX_VALUE + - int32(loadTestFontId + 'XXX', i)) | 0; + } + }, { + key: "getData", + value: function getData() { + return this.messageHandler.sendWithPromise('GetData', null); + } + }, { + key: "getPage", + value: function getPage(pageNumber) { + var _this13 = this; + + if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this.numPages) { + return Promise.reject(new Error('Invalid page request')); } - data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, string32(checksum)); - var url = 'url(data:font/opentype;base64,' + btoa(data) + ');'; - var rule = '@font-face { font-family:"' + loadTestFontId + '";src:' + - url + '}'; - this.insertRule(rule); + var pageIndex = pageNumber - 1; - var names = []; - for (i = 0, ii = fonts.length; i < ii; i++) { - names.push(fonts[i].loadedName); + if (pageIndex in this.pagePromises) { + return this.pagePromises[pageIndex]; } - names.push(loadTestFontId); - var div = document.createElement('div'); - div.setAttribute('style', - 'visibility: hidden;' + - 'width: 10px; height: 10px;' + - 'position: absolute; top: 0px; left: 0px;'); - for (i = 0, ii = names.length; i < ii; ++i) { - var span = document.createElement('span'); - span.textContent = 'Hi'; - span.style.fontFamily = names[i]; - div.appendChild(span); - } - document.body.appendChild(div); + var promise = this.messageHandler.sendWithPromise('GetPage', { + pageIndex: pageIndex + }).then(function (pageInfo) { + if (_this13.destroyed) { + throw new Error('Transport destroyed'); + } - isFontReady(loadTestFontId, function() { - document.body.removeChild(div); - request.complete(); + var page = new PDFPageProxy(pageIndex, pageInfo, _this13, _this13._params.pdfBug); + _this13.pageCache[pageIndex] = page; + return page; }); - /** Hack end */ - } -}; -FontLoader.isFontLoadingAPISupported = (!isWorker && - typeof document !== 'undefined' && !!document.fonts); -Object.defineProperty(FontLoader, 'isSyncFontLoadingSupported', { - get: function () { - var supported = false; - - // User agent string sniffing is bad, but there is no reliable way to tell - // if font is fully loaded and ready to be used with canvas. - var userAgent = window.navigator.userAgent; - var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(userAgent); - if (m && m[1] >= 14) { - supported = true; + this.pagePromises[pageIndex] = promise; + return promise; } - // TODO other browsers - if (userAgent === 'node') { - supported = true; + }, { + key: "getPageIndex", + value: function getPageIndex(ref) { + return this.messageHandler.sendWithPromise('GetPageIndex', { + ref: ref + }).catch(function (reason) { + return Promise.reject(new Error(reason)); + }); } - return shadow(FontLoader, 'isSyncFontLoadingSupported', supported); - }, - enumerable: true, - configurable: true -}); - -var FontFaceObject = (function FontFaceObjectClosure() { - function FontFaceObject(translatedData) { - this.compiledGlyphs = {}; - // importing translated data - for (var i in translatedData) { - this[i] = translatedData[i]; + }, { + key: "getAnnotations", + value: function getAnnotations(pageIndex, intent) { + return this.messageHandler.sendWithPromise('GetAnnotations', { + pageIndex: pageIndex, + intent: intent + }); } - } - Object.defineProperty(FontFaceObject, 'isEvalSupported', { - get: function () { - var evalSupport = false; - if (PDFJS.isEvalSupported) { - try { - /* jshint evil: true */ - new Function(''); - evalSupport = true; - } catch (e) {} + }, { + key: "getDestinations", + value: function getDestinations() { + return this.messageHandler.sendWithPromise('GetDestinations', null); + } + }, { + key: "getDestination", + value: function getDestination(id) { + if (typeof id !== 'string') { + return Promise.reject(new Error('Invalid destination request.')); } - return shadow(this, 'isEvalSupported', evalSupport); - }, - enumerable: true, - configurable: true - }); - FontFaceObject.prototype = { - createNativeFontFace: function FontFaceObject_createNativeFontFace() { - if (!this.data) { + + return this.messageHandler.sendWithPromise('GetDestination', { + id: id + }); + } + }, { + key: "getPageLabels", + value: function getPageLabels() { + return this.messageHandler.sendWithPromise('GetPageLabels', null); + } + }, { + key: "getPageMode", + value: function getPageMode() { + return this.messageHandler.sendWithPromise('GetPageMode', null); + } + }, { + key: "getOpenActionDestination", + value: function getOpenActionDestination() { + return this.messageHandler.sendWithPromise('getOpenActionDestination', null); + } + }, { + key: "getAttachments", + value: function getAttachments() { + return this.messageHandler.sendWithPromise('GetAttachments', null); + } + }, { + key: "getJavaScript", + value: function getJavaScript() { + return this.messageHandler.sendWithPromise('GetJavaScript', null); + } + }, { + key: "getOutline", + value: function getOutline() { + return this.messageHandler.sendWithPromise('GetOutline', null); + } + }, { + key: "getPermissions", + value: function getPermissions() { + return this.messageHandler.sendWithPromise('GetPermissions', null); + } + }, { + key: "getMetadata", + value: function getMetadata() { + var _this14 = this; + + 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 + }; + }); + } + }, { + key: "getStats", + value: function getStats() { + return this.messageHandler.sendWithPromise('GetStats', null); + } + }, { + key: "startCleanup", + value: function startCleanup() { + var _this15 = this; + + 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(); + } + } + + _this15.commonObjs.clear(); + + _this15.fontLoader.clear(); + }); + } + }, { + key: "loadingParams", + get: function get() { + var params = this._params; + return (0, _util.shadow)(this, 'loadingParams', { + disableAutoFetch: params.disableAutoFetch, + disableCreateObjectURL: params.disableCreateObjectURL, + disableFontFace: params.disableFontFace, + nativeImageDecoderSupport: params.nativeImageDecoderSupport + }); + } + }]); + + return WorkerTransport; +}(); + +var PDFObjects = +/*#__PURE__*/ +function () { + function PDFObjects() { + _classCallCheck(this, PDFObjects); + + this._objs = Object.create(null); + } + + _createClass(PDFObjects, [{ + key: "_ensureObj", + value: function _ensureObj(objId) { + if (this._objs[objId]) { + return this._objs[objId]; + } + + return this._objs[objId] = { + capability: (0, _util.createPromiseCapability)(), + data: null, + resolved: false + }; + } + }, { + 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); + return null; } - if (PDFJS.disableFontFace) { - this.disableFontFace = true; + var obj = this._objs[objId]; + + if (!obj || !obj.resolved) { + throw new Error("Requesting object that isn't resolved yet ".concat(objId, ".")); + } + + return obj.data; + } + }, { + 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); + } + }, { + key: "clear", + value: function clear() { + this._objs = Object.create(null); + } + }]); + + return PDFObjects; +}(); + +var RenderTask = +/*#__PURE__*/ +function () { + function RenderTask(internalRenderTask) { + _classCallCheck(this, RenderTask); + + this._internalRenderTask = internalRenderTask; + this.onContinue = null; + } + + _createClass(RenderTask, [{ + key: "cancel", + value: function cancel() { + this._internalRenderTask.cancel(); + } + }, { + key: "then", + value: function then(onFulfilled, onRejected) { + (0, _util.deprecated)('RenderTask.then method, use the `promise` getter instead.'); + 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 WeakSet(); + + var InternalRenderTask = + /*#__PURE__*/ + function () { + function InternalRenderTask(_ref11) { + var callback = _ref11.callback, + params = _ref11.params, + objs = _ref11.objs, + commonObjs = _ref11.commonObjs, + operatorList = _ref11.operatorList, + pageNumber = _ref11.pageNumber, + canvasFactory = _ref11.canvasFactory, + webGLContext = _ref11.webGLContext, + _ref11$useRequestAnim = _ref11.useRequestAnimationFrame, + useRequestAnimationFrame = _ref11$useRequestAnim === void 0 ? false : _ref11$useRequestAnim, + _ref11$pdfBug = _ref11.pdfBug, + pdfBug = _ref11$pdfBug === void 0 ? false : _ref11$pdfBug; + + _classCallCheck(this, InternalRenderTask); + + 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 = 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; + } + + 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); + } + + if (this._pdfBug && _global_scope.default.StepperManager && _global_scope.default.StepperManager.enabled) { + this.stepper = _global_scope.default.StepperManager.create(this.pageNumber - 1); + 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(); + } + } + }, { + 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 _dom_utils.RenderingCancelledException("Rendering cancelled, page ".concat(this.pageNumber), 'canvas')); + } + }, { + key: "operatorListChanged", + value: function operatorListChanged() { + if (!this.graphicsReady) { + if (!this.graphicsReadyCallback) { + this.graphicsReadyCallback = this._continueBound; + } + + return; + } + + if (this.stepper) { + this.stepper.updateOperatorList(this.operatorList); + } + + if (this.running) { + return; + } + + this._continue(); + } + }, { + key: "_continue", + value: function _continue() { + this.running = true; + + if (this.cancelled) { + return; + } + + if (this.task.onContinue) { + this.task.onContinue(this._scheduleNextBound); + } else { + this._scheduleNext(); + } + } + }, { + key: "_scheduleNext", + value: function _scheduleNext() { + var _this16 = this; + + if (this._useRequestAnimationFrame) { + window.requestAnimationFrame(function () { + _this16._nextBound().catch(_this16.cancel.bind(_this16)); + }); + } else { + Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this)); + } + } + }, { + key: "_next", + value: function () { + var _next2 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee() { + return _regenerator.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!this.cancelled) { + _context.next = 2; + break; + } + + return _context.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 _context.stop(); + } + } + }, _callee, this); + })); + + function _next() { + return _next2.apply(this, arguments); + } + + return _next; + }() + }]); + + return InternalRenderTask; + }(); + + return InternalRenderTask; +}(); + +var version = '2.1.266'; +exports.version = version; +var build = '81f5835c'; +exports.build = build; + +/***/ }), +/* 147 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = __w_pdfjs_require__(148); + +/***/ }), +/* 148 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +function _typeof(obj) { 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 g = function () { + return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; +}() || 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__(149); + +if (hadRuntime) { + g.regeneratorRuntime = oldRuntime; +} else { + try { + delete g.regeneratorRuntime; + } catch (e) { + g.regeneratorRuntime = undefined; + } +} + +/***/ }), +/* 149 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(module) { + +function _typeof(obj) { 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) { + "use strict"; + + 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) === "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); + }, function (error) { + return invoke("throw", error, resolve, reject); + }); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(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) { + 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; + } + } + + 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; + } + } 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] + }; + + 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" + }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.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() { + 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; + } + } + + return { + next: doneResult + }; + } + + runtime.values = values; + + function doneResult() { + return { + value: undefined, + done: true + }; + } + + 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; + } + } + } + }, + stop: function stop() { + 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); + } 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; + } + } + + 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") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } 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); + 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; + + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + + return thrown; + } + } + + 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 || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; +}() || Function("return this")()); +/* WEBPACK VAR INJECTION */}.call(this, __w_pdfjs_require__(150)(module))) + +/***/ }), +/* 150 */ +/***/ (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; + } + + return module; +}; + +/***/ }), +/* 151 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.addLinkAttributes = addLinkAttributes; +exports.getFilenameFromUrl = getFilenameFromUrl; +exports.loadScript = loadScript; +exports.DummyStatTimer = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0; + +var _util = __w_pdfjs_require__(1); + +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); + } + + _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 + }; + } + }, { + 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; + } + }, { + 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 DOMCanvasFactory; +}(); + +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; + } + + _createClass(DOMCMapReaderFactory, [{ + key: "fetch", + value: function fetch(_ref2) { + var _this = this; + + var name = _ref2.name; + + 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; + + 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); + }); + } + }]); + + return DOMCMapReaderFactory; +}(); + +exports.DOMCMapReaderFactory = DOMCMapReaderFactory; + +var DOMSVGFactory = +/*#__PURE__*/ +function () { + function DOMSVGFactory() { + _classCallCheck(this, DOMSVGFactory); + } + + _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; +}(); + +exports.DOMSVGFactory = DOMSVGFactory; + +var PageViewport = +/*#__PURE__*/ +function () { + function PageViewport(_ref3) { + var viewBox = _ref3.viewBox, + scale = _ref3.scale, + rotation = _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; + + _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; + + default: + rotateA = 1; + rotateB = 0; + rotateC = 0; + rotateD = -1; + break; + } + + 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; + } + + _createClass(PageViewport, [{ + key: "clone", + value: function clone() { + var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref4$scale = _ref4.scale, + scale = _ref4$scale === void 0 ? this.scale : _ref4$scale, + _ref4$rotation = _ref4.rotation, + rotation = _ref4$rotation === void 0 ? this.rotation : _ref4$rotation, + _ref4$dontFlip = _ref4.dontFlip, + dontFlip = _ref4$dontFlip === void 0 ? 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; +}(); + +exports.PageViewport = 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; +}(); + +exports.RenderingCancelledException = RenderingCancelledException; +var LinkTarget = { + NONE: 0, + SELF: 1, + BLANK: 2, + PARENT: 3, + TOP: 4 +}; +exports.LinkTarget = LinkTarget; +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 = +/*#__PURE__*/ +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 += "".concat(span['name'].padEnd(longest), " ").concat(duration, "ms\n"); + } + + return out; + } + }]); + + return StatTimer; +}(); + +exports.StatTimer = StatTimer; + +var DummyStatTimer = +/*#__PURE__*/ +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; +}(); + +exports.DummyStatTimer = 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: ".concat(script.src))); + }; + + (document.head || document.documentElement).appendChild(script); + }); +} + +/***/ }), +/* 152 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.FontLoader = exports.FontFaceObject = void 0; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); + +var _util = __w_pdfjs_require__(1); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { 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 _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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +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 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 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(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_".concat(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 () { + var _bind = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee(font) { + var _this = this; + + 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; + } + + return _context.abrupt("return"); + + case 2: + font.attached = true; + + if (!this.isFontLoadingAPISupported) { + _context.next = 19; + break; + } + + nativeFontFace = font.createNativeFontFace(); + + if (!nativeFontFace) { + _context.next = 18; + break; + } + + this.addNativeFontFace(nativeFontFace); + _context.prev = 7; + _context.next = 10; + return nativeFontFace.loaded; + + case 10: + _context.next = 18; + break; + + case 12: + _context.prev = 12; + _context.t0 = _context["catch"](7); + + this._onUnsupportedFeature({ + featureId: _util.UNSUPPORTED_FEATURES.font + }); + + (0, _util.warn)("Failed to load font '".concat(nativeFontFace.family, "': '").concat(_context.t0, "'.")); + font.disableFontFace = true; + throw _context.t0; + + case 18: + return _context.abrupt("return"); + + case 19: + rule = font.createFontFaceRule(); + + if (!rule) { + _context.next = 25; + break; + } + + this.insertRule(rule); + + if (!this.isSyncFontLoadingSupported) { + _context.next = 24; + break; + } + + return _context.abrupt("return"); + + case 24: + return _context.abrupt("return", new Promise(function (resolve) { + var request = _this._queueLoadingCallback(resolve); + + _this._prepareFontLoadEvent([rule], [font], request); + })); + + case 25: + case "end": + return _context.stop(); + } + } + }, _callee, this, [[7, 12]]); + })); + + function bind(_x) { + return _bind.apply(this, arguments); + } + + return bind; + }() + }, { + key: "_queueLoadingCallback", + value: function _queueLoadingCallback(callback) { + (0, _util.unreachable)('Abstract method `_queueLoadingCallback`.'); + } + }, { + key: "_prepareFontLoadEvent", + value: function _prepareFontLoadEvent(rules, fontsToLoad, request) { + (0, _util.unreachable)('Abstract method `_prepareFontLoadEvent`.'); + } + }, { + key: "isFontLoadingAPISupported", + get: function get() { + (0, _util.unreachable)('Abstract method `isFontLoadingAPISupported`.'); + } + }, { + key: "isSyncFontLoadingSupported", + get: function get() { + (0, _util.unreachable)('Abstract method `isSyncFontLoadingSupported`.'); + } + }, { + key: "_loadTestFont", + get: function get() { + (0, _util.unreachable)('Abstract method `_loadTestFont`.'); + } + }]); + + return BaseFontLoader; +}(); + +var FontLoader; +exports.FontLoader = FontLoader; +{ + exports.FontLoader = FontLoader = + /*#__PURE__*/ + function (_BaseFontLoader) { + _inherits(GenericFontLoader, _BaseFontLoader); + + function GenericFontLoader(docId) { + var _this2; + + _classCallCheck(this, GenericFontLoader); + + _this2 = _possibleConstructorReturn(this, _getPrototypeOf(GenericFontLoader).call(this, docId)); + _this2.loadingContext = { + requests: [], + nextRequestId: 0 + }; + _this2.loadTestFontId = 0; + return _this2; + } + + _createClass(GenericFontLoader, [{ + 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, ii; + var canvas = document.createElement('canvas'); + canvas.width = 1; + canvas.height = 1; + var ctx = canvas.getContext('2d'); + var called = 0; + + function isFontReady(name, callback) { + called++; + + if (called > 30) { + (0, _util.warn)('Load test font never loaded.'); + callback(); + return; + } + + 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".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; + } + + data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, (0, _util.string32)(checksum)); + 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;'); + + for (i = 0, ii = names.length; i < ii; ++i) { + 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); + request.complete(); + }); + } + }, { + 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", + get: function get() { + var supported = false; + + 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); + } + }, { + key: "_loadTestFont", + get: function get() { + var getLoadTestFont = function getLoadTestFont() { + return atob('T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA' + 'FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA' + 'ALwAAAA2aGhlYQdkA+o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' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAA' + 'AAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQAC' + 'AQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3' + 'Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj' + 'FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=='); + }; + + 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 = +/*#__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; + this._onUnsupportedFeature = onUnsupportedFeature; + this.fontRegistry = fontRegistry; + } + + _createClass(FontFaceObject, [{ + key: "createNativeFontFace", + value: function createNativeFontFace() { + if (!this.data || this.disableFontFace) { return null; } var nativeFontFace = new FontFace(this.loadedName, this.data, {}); - if (PDFJS.pdfBug && 'FontInspector' in globalScope && - globalScope['FontInspector'].enabled) { - globalScope['FontInspector'].fontAdded(this); + if (this.fontRegistry) { + this.fontRegistry.registerFont(this); } + return nativeFontFace; - }, - - createFontFaceRule: function FontFaceObject_createFontFaceRule() { - if (!this.data) { + } + }, { + key: "createFontFaceRule", + value: function createFontFaceRule() { + if (!this.data || this.disableFontFace) { return null; } - if (PDFJS.disableFontFace) { - this.disableFontFace = true; - return null; - } + var data = (0, _util.bytesToString)(new Uint8Array(this.data)); + var url = "url(data:".concat(this.mimetype, ";base64,").concat(btoa(data), ");"); + var rule = "@font-face {font-family:\"".concat(this.loadedName, "\";src:").concat(url, "}"); - var data = bytesToString(new Uint8Array(this.data)); - var fontName = this.loadedName; - - // Add the font-face rule to the document - var url = ('url(data:' + this.mimetype + ';base64,' + - window.btoa(data) + ');'); - var rule = '@font-face { font-family:"' + fontName + '";src:' + url + '}'; - - if (PDFJS.pdfBug && 'FontInspector' in globalScope && - globalScope['FontInspector'].enabled) { - globalScope['FontInspector'].fontAdded(this, url); + if (this.fontRegistry) { + this.fontRegistry.registerFont(this, url); } return rule; - }, - - getPathGenerator: - function FontFaceObject_getPathGenerator(objs, character) { - if (!(character in this.compiledGlyphs)) { - var cmds = objs.get(this.loadedName + '_path_' + character); - var current, i, len; - - // If we can, compile cmds into JS for MAXIMUM SPEED - if (FontFaceObject.isEvalSupported) { - var args, js = ''; - for (i = 0, len = cmds.length; i < len; i++) { - current = cmds[i]; - - if (current.args !== undefined) { - args = current.args.join(','); - } else { - args = ''; - } - - js += 'c.' + current.cmd + '(' + args + ');\n'; - } - /* jshint -W054 */ - this.compiledGlyphs[character] = new Function('c', 'size', js); - } else { - // But fall back on using Function.prototype.apply() if we're - // blocked from using eval() for whatever reason (like CSP policies) - this.compiledGlyphs[character] = function(c, size) { - for (i = 0, len = cmds.length; i < len; i++) { - current = cmds[i]; - - if (current.cmd === 'scale') { - current.args = [size, -size]; - } - - c[current.cmd].apply(c, current.args); - } - }; - } - } - return this.compiledGlyphs[character]; } - }; + }, { + key: "getPathGenerator", + value: function getPathGenerator(objs, character) { + if (this.compiledGlyphs[character] !== undefined) { + return this.compiledGlyphs[character]; + } + + var cmds, current; + + try { + cmds = objs.get(this.loadedName + '_path_' + character); + } catch (ex) { + if (!this.ignoreErrors) { + throw ex; + } + + if (this._onUnsupportedFeature) { + this._onUnsupportedFeature({ + featureId: _util.UNSUPPORTED_FEATURES.font + }); + } + + (0, _util.warn)("getPathGenerator - ignoring character: \"".concat(ex, "\".")); + return this.compiledGlyphs[character] = function (c, size) {}; + } + + if (this.isEvalSupported && 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(','); + } else { + args = ''; + } + + js += 'c.' + current.cmd + '(' + args + ');\n'; + } + + 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') { + current.args = [size, -size]; + } + + c[current.cmd].apply(c, current.args); + } + }; + } + }]); + return FontFaceObject; -})(); +}(); exports.FontFaceObject = FontFaceObject; -exports.FontLoader = FontLoader; -})); + +/***/ }), +/* 153 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; -(function (root, factory) { - { - factory((root.pdfjsDisplayMetadata = {}), root.pdfjsSharedUtil); - } -}(this, function (exports, sharedUtil) { +var compatibilityParams = Object.create(null); +{ + var isNodeJS = __w_pdfjs_require__(4); -var error = sharedUtil.error; + var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || ''; + var isIE = /Trident/.test(userAgent); + var isIOSChrome = /CriOS/.test(userAgent); -var Metadata = PDFJS.Metadata = (function MetadataClosure() { - function fixMetadata(meta) { - return meta.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); - }); - var chars = ''; - for (var i = 0; i < bytes.length; i += 2) { - var code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); - chars += code >= 32 && code < 127 && code !== 60 && code !== 62 && - code !== 38 && false ? String.fromCharCode(code) : - '&#x' + (0x10000 + code).toString(16).substring(1) + ';'; - } - return '>' + chars; - }); - } - - function Metadata(meta) { - if (typeof meta === 'string') { - // Ghostscript produces invalid metadata - meta = fixMetadata(meta); - - var parser = new DOMParser(); - meta = parser.parseFromString(meta, 'application/xml'); - } else if (!(meta instanceof Document)) { - error('Metadata: Invalid metadata object'); + (function checkOnBlobSupport() { + if (isIE || isIOSChrome) { + compatibilityParams.disableCreateObjectURL = true; } + })(); - this.metaDocument = meta; - this.metadata = {}; - this.parse(); - } - - Metadata.prototype = { - parse: function Metadata_parse() { - var doc = this.metaDocument; - var rdf = doc.documentElement; - - if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') { // Wrapped in - 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, desc, entry, name, i, ii, length, iLength; - for (i = 0, length = children.length; i < length; i++) { - desc = children[i]; - if (desc.nodeName.toLowerCase() !== 'rdf:description') { - continue; - } - - for (ii = 0, iLength = desc.childNodes.length; ii < iLength; ii++) { - if (desc.childNodes[ii].nodeName.toLowerCase() !== '#text') { - entry = desc.childNodes[ii]; - name = entry.nodeName.toLowerCase(); - this.metadata[name] = entry.textContent.trim(); - } - } - } - }, - - get: function Metadata_get(name) { - return this.metadata[name] || null; - }, - - has: function Metadata_has(name) { - return typeof this.metadata[name] !== 'undefined'; + (function checkFontFaceAndImage() { + if (isNodeJS()) { + compatibilityParams.disableFontFace = true; + compatibilityParams.nativeImageDecoderSupport = 'none'; } - }; + })(); +} +exports.apiCompatibilityParams = Object.freeze(compatibilityParams); - return Metadata; -})(); +/***/ }), +/* 154 */ +/***/ (function(module, exports, __w_pdfjs_require__) { -exports.Metadata = Metadata; -})); +"use strict"; -(function (root, factory) { - { - factory((root.pdfjsDisplaySVG = {}), root.pdfjsSharedUtil); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.CanvasGraphics = void 0; + +var _util = __w_pdfjs_require__(1); + +var _pattern_helper = __w_pdfjs_require__(155); + +var MIN_FONT_SIZE = 16; +var MAX_FONT_SIZE = 100; +var MAX_GROUP_SIZE = 4096; +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)()); } -}(this, function (exports, sharedUtil) { -var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX; -var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX; -var ImageKind = sharedUtil.ImageKind; -var OPS = sharedUtil.OPS; -var Util = sharedUtil.Util; -var isNum = sharedUtil.isNum; -var isArray = sharedUtil.isArray; -var warn = sharedUtil.warn; - -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]); +function addContextCurrentTransform(ctx) { + if (!ctx.mozCurrentTransform) { + ctx._originalSave = ctx.save; + ctx._originalRestore = ctx.restore; + ctx._originalRotate = ctx.rotate; + ctx._originalScale = ctx.scale; + ctx._originalTranslate = ctx.translate; + ctx._originalTransform = ctx.transform; + ctx._originalSetTransform = ctx.setTransform; + ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0]; + ctx._transformStack = []; + Object.defineProperty(ctx, 'mozCurrentTransform', { + get: function getCurrentTransform() { + return this._transformMatrix; + } + }); + Object.defineProperty(ctx, 'mozCurrentTransformInverse', { + get: function getCurrentTransformInverse() { + var m = this._transformMatrix; + var a = m[0], + b = m[1], + c = m[2], + d = m[3], + e = m[4], + f = m[5]; + var ad_bc = a * d - b * c; + var bc_ad = b * c - a * d; + 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]; + } + }); - var CHUNK_WRAPPER_SIZE = 12; + ctx.save = function ctxSave() { + var old = this._transformMatrix; - 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); + 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); + canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0); } else { - c = (c >> 1) & 0x7fffffff; + canvasEntry = this.canvasFactory.create(width, height); + this.cache[id] = canvasEntry; + } + + if (trackTransform) { + addContextCurrentTransform(canvasEntry.context); + } + + return canvasEntry; + }, + clear: function clear() { + for (var id in this.cache) { + var canvasEntry = this.cache[id]; + this.canvasFactory.destroy(canvasEntry); + delete this.cache[id]; } } - 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 encode(imgData, kind) { - var width = imgData.width; - var height = imgData.height; - var bitDepth, colorType, lineSize; - var bytes = imgData.data; - - switch (kind) { - case ImageKind.GRAYSCALE_1BPP: - colorType = 0; - bitDepth = 1; - lineSize = (width + 7) >> 3; - break; - case ImageKind.RGB_24BPP: - colorType = 2; - bitDepth = 8; - lineSize = width * 3; - break; - case ImageKind.RGBA_32BPP: - colorType = 6; - bitDepth = 8; - lineSize = width * 4; - break; - default: - throw new Error('invalid format'); - } - - // prefix every row with predictor 0 - var literals = new Uint8Array((1 + lineSize) * height); - var offsetLiterals = 0, offsetBytes = 0; - var y, i; - for (y = 0; y < height; ++y) { - literals[offsetLiterals++] = 0; // no prediction - literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), - offsetLiterals); - offsetBytes += lineSize; - offsetLiterals += lineSize; - } - - if (kind === ImageKind.GRAYSCALE_1BPP) { - // inverting for B/W - offsetLiterals = 0; - for (y = 0; y < height; y++) { - offsetLiterals++; // skipping predictor - 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, // bit depth - colorType, // color type - 0x00, // compression method - 0x00, // filter method - 0x00 // interlace method - ]); - - 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; // compression method and flags - idat[pi++] = 0x9c; // flags - - var pos = 0; - while (len > maxBlockLength) { - // writing non-final DEFLATE blocks type 0 and length of 65535 - 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; - } - - // writing non-final DEFLATE blocks type 0 - 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); // checksum - idat[pi++] = adler >> 24 & 0xff; - idat[pi++] = adler >> 16 & 0xff; - idat[pi++] = adler >> 8 & 0xff; - idat[pi++] = adler & 0xff; - - // PNG will consists: header, IHDR+data, IDAT+data, and IEND. - 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 PDFJS.createObjectURL(data, 'image/png'); - } - - return function convertImgDataToPng(imgData) { - var kind = (imgData.kind === undefined ? - ImageKind.GRAYSCALE_1BPP : imgData.kind); - return encode(imgData, kind); }; -})(); + return CachedCanvases; +}(); -var SVGExtraState = (function SVGExtraStateClosure() { - function SVGExtraState() { - this.fontSizeScale = 1; - this.fontWeight = SVG_DEFAULTS.fontWeight; +function compileType3Glyph(imgData) { + var POINT_TO_PROCESS_LIMIT = 1000; + var width = imgData.width, + height = imgData.height; + var i, + j, + j0, + width1 = width + 1; + var points = new Uint8Array(width1 * (height + 1)); + var POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]); + var lineSize = width + 7 & ~7, + data0 = imgData.data; + 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; + } else { + type = pp & 0x33 * type >> 4; + points[p] &= type >> 2 | type << 2; + } + + coords.push(p % width1); + coords.push(p / width1 | 0); + --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]; + c.moveTo(o[0], o[1]); + + for (var j = 2, jj = o.length; j < jj; j += 2) { + c.lineTo(o[j], o[j + 1]); + } + } + + c.fill(); + c.beginPath(); + c.restore(); + }; + + return drawOutline; +} + +var CanvasExtraState = function CanvasExtraStateClosure() { + function CanvasExtraState() { + this.alphaIsShape = false; this.fontSize = 0; - - this.textMatrix = IDENTITY_MATRIX; - this.fontMatrix = FONT_IDENTITY_MATRIX; + this.fontSizeScale = 1; + this.textMatrix = _util.IDENTITY_MATRIX; + this.textMatrixScale = 1; + this.fontMatrix = _util.FONT_IDENTITY_MATRIX; this.leading = 0; - - // Current point (in user coordinates) this.x = 0; this.y = 0; - - // Start of text line (in text coordinates) this.lineX = 0; this.lineY = 0; - - // Character and word spacing this.charSpacing = 0; this.wordSpacing = 0; this.textHScale = 1; + this.textRenderingMode = _util.TextRenderingMode.FILL; this.textRise = 0; - - // Default foreground and background colors - this.fillColor = SVG_DEFAULTS.fillColor; + this.fillColor = '#000000'; this.strokeColor = '#000000'; - + this.patternFill = false; this.fillAlpha = 1; this.strokeAlpha = 1; this.lineWidth = 1; - this.lineJoin = ''; - this.lineCap = ''; - this.miterLimit = 0; - - this.dashArray = []; - this.dashPhase = 0; - - this.dependencies = []; - - // Clipping - this.clipId = ''; - this.pendingClip = false; - - this.maskId = ''; + this.activeSMask = null; + this.resumeSMaskCtx = null; } - SVGExtraState.prototype = { - clone: function SVGExtraState_clone() { + CanvasExtraState.prototype = { + clone: function CanvasExtraState_clone() { return Object.create(this); }, - setCurrentPoint: function SVGExtraState_setCurrentPoint(x, y) { + setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) { this.x = x; this.y = y; } }; - return SVGExtraState; -})(); + return CanvasExtraState; +}(); -var SVGGraphics = (function SVGGraphicsClosure() { - function createScratchSVG(width, height) { - var NS = 'http://www.w3.org/2000/svg'; - var svg = document.createElementNS(NS, 'svg:svg'); - svg.setAttributeNS(null, 'version', '1.1'); - svg.setAttributeNS(null, 'width', width + 'px'); - svg.setAttributeNS(null, 'height', height + 'px'); - svg.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height); - return svg; - } +var CanvasGraphics = function CanvasGraphicsClosure() { + var EXECUTION_TIME = 15; + var EXECUTION_STEPS = 10; - 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; - } - - /** - * Formats float number. - * @param value {number} number to format. - * @returns {string} - */ - function pf(value) { - if (value === (value | 0)) { // integer number - return value.toString(); - } - var s = value.toFixed(10); - var i = s.length - 1; - if (s[i] !== '0') { - return s; - } - // removing trailing zeros - do { - i--; - } while (s[i] === '0'); - return s.substr(0, s[i] === '.' ? i : i + 1); - } - - /** - * Formats transform matrix. The standard rotation, scale and translate - * matrices are replaced by their shorter forms, and for identity matrix - * returns empty string to save the memory. - * @param m {Array} matrix to format. - * @returns {string} - */ - 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]) + ')'; - } - - function SVGGraphics(commonObjs, objs) { - this.current = new SVGExtraState(); - this.transformMatrix = IDENTITY_MATRIX; // Graphics state matrix - this.transformStack = []; - this.extraStack = []; + function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, webGLContext, imageLayer) { + this.ctx = canvasCtx; + this.current = new CanvasExtraState(); + this.stateStack = []; + this.pendingClip = null; + this.pendingEOFill = false; + this.res = null; + this.xobjs = null; this.commonObjs = commonObjs; this.objs = objs; - this.pendingEOFill = false; + this.canvasFactory = canvasFactory; + this.webGLContext = webGLContext; + this.imageLayer = imageLayer; + this.groupStack = []; + this.processingType3 = null; + this.baseTransform = null; + this.baseTransformStack = []; + this.groupLevel = 0; + this.smaskStack = []; + this.smaskCounter = 0; + this.tempSMask = null; + this.cachedCanvases = new CachedCanvases(this.canvasFactory); - this.embedFonts = false; - this.embeddedFonts = {}; - this.cssStyle = null; + if (canvasCtx) { + addContextCurrentTransform(canvasCtx); + } + + this._cachedGetSinglePixelWidth = null; } - var NS = 'http://www.w3.org/2000/svg'; - 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; + function putBinaryImageData(ctx, imgData) { + if (typeof ImageData !== 'undefined' && imgData instanceof ImageData) { + ctx.putImageData(imgData, 0, 0); + return; + } - SVGGraphics.prototype = { - save: function SVGGraphics_save() { - this.transformStack.push(this.transformMatrix); - var old = this.current; - this.extraStack.push(old); - this.current = old.clone(); - }, + var height = imgData.height, + width = imgData.width; + var partialChunkHeight = height % FULL_CHUNK_HEIGHT; + var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; + var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; + var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); + var srcPos = 0, + destPos; + var src = imgData.data; + var dest = chunkImgData.data; + var i, j, thisChunkHeight, elemsInThisChunk; - restore: function SVGGraphics_restore() { - this.transformMatrix = this.transformStack.pop(); - this.current = this.extraStack.pop(); + 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; - this.tgrp = document.createElementNS(NS, 'svg:g'); - this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - this.pgrp.appendChild(this.tgrp); - }, + for (i = 0; i < totalChunks; i++) { + thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; + destPos = 0; - group: function SVGGraphics_group(items) { - this.save(); - this.executeOpTree(items); - this.restore(); - }, + for (j = 0; j < thisChunkHeight; j++) { + var srcDiff = srcLength - srcPos; + var k = 0; + var kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7; + var kEndUnrolled = kEnd & ~7; + var mask = 0; + var srcByte = 0; - loadDependencies: function SVGGraphics_loadDependencies(operatorList) { - var fnArray = operatorList.fnArray; - var fnArrayLen = fnArray.length; - var argsArray = operatorList.argsArray; + for (; k < kEndUnrolled; k += 8) { + srcByte = src[srcPos++]; + dest32[destPos++] = srcByte & 128 ? white : black; + dest32[destPos++] = srcByte & 64 ? white : black; + dest32[destPos++] = srcByte & 32 ? white : black; + dest32[destPos++] = srcByte & 16 ? white : black; + dest32[destPos++] = srcByte & 8 ? white : black; + dest32[destPos++] = srcByte & 4 ? white : black; + dest32[destPos++] = srcByte & 2 ? white : black; + dest32[destPos++] = srcByte & 1 ? white : black; + } - var self = this; - for (var i = 0; i < fnArrayLen; i++) { - if (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) { - self.commonObjs.get(obj, resolve); - }); - } else { - promise = new Promise(function(resolve) { - self.objs.get(obj, resolve); - }); + for (; k < kEnd; k++) { + if (mask === 0) { + srcByte = src[srcPos++]; + mask = 128; } - this.current.dependencies.push(promise); + + 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)); + ctx.putImageData(chunkImgData, 0, j); + } + } 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: ".concat(imgData.kind)); + } + } + + function putBinaryImageMask(ctx, imgData) { + var height = imgData.height, + width = imgData.width; + var partialChunkHeight = height % FULL_CHUNK_HEIGHT; + var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; + var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; + var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); + 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']; + + 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.globalAlpha = 1; + ctx.lineWidth = 1; + ctx.lineCap = 'butt'; + ctx.lineJoin = 'miter'; + ctx.miterLimit = 10; + 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; + bytes[i - 1] = b0; + } else if (alpha < 255) { + var alpha_ = 255 - alpha; + bytes[i - 3] = bytes[i - 3] * alpha + r0 * alpha_ >> 8; + bytes[i - 2] = bytes[i - 2] * alpha + g0 * alpha_ >> 8; + bytes[i - 1] = bytes[i - 1] * alpha + b0 * alpha_ >> 8; + } + } + } + + 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') { + 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, + mask: mask, + properties: { + subtype: smask.subtype, + backdrop: backdrop + } + }); + ctx.setTransform(1, 0, 0, 1, 0, 0); + 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 NORMAL_CLIP = {}; + var EO_CLIP = {}; + CanvasGraphics.prototype = { + beginDrawing: function beginDrawing(_ref) { + var transform = _ref.transform, + viewport = _ref.viewport, + _ref$transparency = _ref.transparency, + transparency = _ref$transparency === void 0 ? false : _ref$transparency, + _ref$background = _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.fillRect(0, 0, width, height); + this.ctx.restore(); + + if (transparency) { + 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(); } - 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 = PDFJS.Util.transform(this.transformMatrix, - transformMatrix); - - this.tgrp = document.createElementNS(NS, 'svg:g'); - this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - }, - - getSVG: function SVGGraphics_getSVG(operatorList, viewport) { - this.svg = createScratchSVG(viewport.width, viewport.height); - this.viewport = viewport; - - return this.loadDependencies(operatorList).then(function () { - this.transformMatrix = IDENTITY_MATRIX; - this.pgrp = document.createElementNS(NS, 'svg:g'); // Parent group - this.pgrp.setAttributeNS(null, 'transform', pm(viewport.transform)); - this.tgrp = document.createElementNS(NS, 'svg:g'); // Transform group - this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - this.defs = document.createElementNS(NS, 'svg:defs'); - this.pgrp.appendChild(this.defs); - this.pgrp.appendChild(this.tgrp); - this.svg.appendChild(this.pgrp); - var opTree = this.convertOpList(operatorList); - this.executeOpTree(opTree); - return this.svg; - }.bind(this)); - }, - - convertOpList: function SVGGraphics_convertOpList(operatorList) { + executeOperatorList: function CanvasGraphics_executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) { var argsArray = operatorList.argsArray; var fnArray = operatorList.fnArray; - var fnArrayLen = fnArray.length; - var REVOPS = []; - var opList = []; + var i = executionStartIdx || 0; + var argsArrayLen = argsArray.length; - for (var op in OPS) { - REVOPS[OPS[op]] = op; + if (argsArrayLen === i) { + return i; } - for (var x = 0; x < fnArrayLen; x++) { - var fnId = fnArray[x]; - opList.push({'fnId' : fnId, 'fn': REVOPS[fnId], 'args': argsArray[x]}); - } - return opListToTree(opList); - }, + 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; - 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; + while (true) { + if (stepper !== undefined && i === stepper.nextBreakPoint) { + stepper.breakIt(i, continueCallback); + return i; + } - switch (fnId | 0) { - case OPS.beginText: - this.beginText(); - break; - case OPS.setLeading: - this.setLeading(args); - break; - case OPS.setLeadingMoveText: - this.setLeadingMoveText(args[0], args[1]); - break; - case OPS.setFont: - this.setFont(args); - break; - case OPS.showText: - this.showText(args[0]); - break; - case OPS.showSpacedText: - this.showText(args[0]); - break; - case OPS.endText: - this.endText(); - break; - case OPS.moveText: - this.moveText(args[0], args[1]); - break; - case OPS.setCharSpacing: - this.setCharSpacing(args[0]); - break; - case OPS.setWordSpacing: - this.setWordSpacing(args[0]); - break; - case OPS.setHScale: - this.setHScale(args[0]); - break; - case OPS.setTextMatrix: - this.setTextMatrix(args[0], args[1], args[2], - args[3], args[4], args[5]); - break; - case OPS.setLineWidth: - this.setLineWidth(args[0]); - break; - case OPS.setLineJoin: - this.setLineJoin(args[0]); - break; - case OPS.setLineCap: - this.setLineCap(args[0]); - break; - case OPS.setMiterLimit: - this.setMiterLimit(args[0]); - break; - case OPS.setFillRGBColor: - this.setFillRGBColor(args[0], args[1], args[2]); - break; - case OPS.setStrokeRGBColor: - this.setStrokeRGBColor(args[0], args[1], args[2]); - break; - case OPS.setDash: - this.setDash(args[0], args[1]); - break; - case OPS.setGState: - this.setGState(args[0]); - break; - case OPS.fill: - this.fill(); - break; - case OPS.eoFill: - this.eoFill(); - break; - case OPS.stroke: - this.stroke(); - break; - case OPS.fillStroke: - this.fillStroke(); - break; - case OPS.eoFillStroke: - this.eoFillStroke(); - break; - case OPS.clip: - this.clip('nonzero'); - break; - case OPS.eoClip: - this.clip('evenodd'); - break; - case OPS.paintSolidColorImageMask: - this.paintSolidColorImageMask(); - break; - case OPS.paintJpegXObject: - this.paintJpegXObject(args[0], args[1], args[2]); - break; - case OPS.paintImageXObject: - this.paintImageXObject(args[0]); - break; - case OPS.paintInlineImageXObject: - this.paintInlineImageXObject(args[0]); - break; - case OPS.paintImageMaskXObject: - this.paintImageMaskXObject(args[0]); - break; - case OPS.paintFormXObjectBegin: - this.paintFormXObjectBegin(args[0], args[1]); - break; - case OPS.paintFormXObjectEnd: - this.paintFormXObjectEnd(); - break; - case OPS.closePath: - this.closePath(); - break; - case OPS.closeStroke: - this.closeStroke(); - break; - case OPS.closeFillStroke: - this.closeFillStroke(); - break; - case OPS.nextLine: - this.nextLine(); - break; - case OPS.transform: - this.transform(args[0], args[1], args[2], args[3], - args[4], args[5]); - break; - case OPS.constructPath: - this.constructPath(args[0], args[1]); - break; - case OPS.endPath: - this.endPath(); - break; - case 92: - this.group(opTree[x].items); - break; - default: - warn('Unimplemented method '+ fn); - break; + 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.has(depObjId)) { + objsPool.get(depObjId, continueCallback); + return i; + } + } + } + + i++; + + if (i === argsArrayLen) { + return i; + } + + if (chunkOperations && ++steps > EXECUTION_STEPS) { + if (Date.now() > endTime) { + continueCallback(); + return i; + } + + steps = 0; } } }, - - 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 = document.createElementNS(NS, '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 = document.createElementNS(NS, '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 = IDENTITY_MATRIX; - this.current.lineMatrix = IDENTITY_MATRIX; - this.current.tspan = document.createElementNS(NS, 'svg:tspan'); - this.current.txtElement = document.createElementNS(NS, 'svg:text'); - this.current.txtgrp = document.createElementNS(NS, '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 = document.createElementNS(NS, '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; + endDrawing: function CanvasGraphics_endDrawing() { + if (this.current.activeSMask !== null) { + this.endSMaskGroup(); } - 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]; + this.ctx.restore(); - var x = 0, i; - for (i = 0; i < glyphsLength; ++i) { - var glyph = glyphs[i]; - if (glyph === null) { - // word break - x += fontDirection * wordSpacing; - continue; - } else if (isNum(glyph)) { - x += -glyph * fontSize * 0.001; - continue; - } - current.xcoords.push(current.x + x * textHScale); - - var width = glyph.width; - var character = glyph.fontChar; - var charWidth = width * widthAdvanceScale + charSpacing * fontDirection; - x += charWidth; - - current.tspan.textContent += character; - } - if (vertical) { - current.y -= x * textHScale; - } else { - current.x += x * textHScale; + if (this.transparentCanvas) { + this.ctx = this.compositeCtx; + this.ctx.save(); + this.ctx.setTransform(1, 0, 0, 1, 0, 0); + this.ctx.drawImage(this.transparentCanvas, 0, 0); + this.ctx.restore(); + this.transparentCanvas = null; } - 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); - } - if (current.fillColor !== SVG_DEFAULTS.fillColor) { - current.tspan.setAttributeNS(null, 'fill', current.fillColor); - } - - current.txtElement.setAttributeNS(null, 'transform', - pm(current.textMatrix) + - ' scale(1, -1)' ); - current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve'); - current.txtElement.appendChild(current.tspan); - current.txtgrp.appendChild(current.txtElement); - - this.tgrp.appendChild(current.txtElement); + this.cachedCanvases.clear(); + this.webGLContext.clear(); + if (this.imageLayer) { + this.imageLayer.endLayout(); + } }, - - setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) { - this.setLeading(-y); - this.moveText(x, y); - }, - - addFontStyle: function SVGGraphics_addFontStyle(fontObj) { - if (!this.cssStyle) { - this.cssStyle = document.createElementNS(NS, 'svg:style'); - this.cssStyle.setAttributeNS(null, 'type', 'text/css'); - this.defs.appendChild(this.cssStyle); - } - - var url = PDFJS.createObjectURL(fontObj.data, fontObj.mimetype); - 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 : 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 = document.createElementNS(NS, 'svg:tspan'); - current.tspan.setAttributeNS(null, 'y', pf(-current.y)); - current.xcoords = []; - }, - - endText: function SVGGraphics_endText() { - if (this.current.pendingClip) { - this.cgrp.appendChild(this.tgrp); - this.pgrp.appendChild(this.cgrp); - } else { - this.pgrp.appendChild(this.tgrp); - } - this.tgrp = document.createElementNS(NS, 'svg:g'); - this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - }, - - // Path properties - setLineWidth: function SVGGraphics_setLineWidth(width) { + setLineWidth: function CanvasGraphics_setLineWidth(width) { this.current.lineWidth = width; + this.ctx.lineWidth = width; }, - setLineCap: function SVGGraphics_setLineCap(style) { - this.current.lineCap = LINE_CAP_STYLES[style]; + setLineCap: function CanvasGraphics_setLineCap(style) { + this.ctx.lineCap = LINE_CAP_STYLES[style]; }, - setLineJoin: function SVGGraphics_setLineJoin(style) { - this.current.lineJoin = LINE_JOIN_STYLES[style]; + setLineJoin: function CanvasGraphics_setLineJoin(style) { + this.ctx.lineJoin = LINE_JOIN_STYLES[style]; }, - setMiterLimit: function SVGGraphics_setMiterLimit(limit) { - this.current.miterLimit = limit; - }, - setStrokeRGBColor: function SVGGraphics_setStrokeRGBColor(r, g, b) { - var color = Util.makeCssRgb(r, g, b); - this.current.strokeColor = color; - }, - setFillRGBColor: function SVGGraphics_setFillRGBColor(r, g, b) { - var color = Util.makeCssRgb(r, g, b); - this.current.fillColor = color; - this.current.tspan = document.createElementNS(NS, 'svg:tspan'); - this.current.xcoords = []; - }, - setDash: function SVGGraphics_setDash(dashArray, dashPhase) { - this.current.dashArray = dashArray; - this.current.dashPhase = dashPhase; + setMiterLimit: function CanvasGraphics_setMiterLimit(limit) { + this.ctx.miterLimit = limit; }, + setDash: function CanvasGraphics_setDash(dashArray, dashPhase) { + var ctx = this.ctx; - constructPath: function SVGGraphics_constructPath(ops, args) { - var current = this.current; - var x = current.x, y = current.y; - current.path = document.createElementNS(NS, 'svg:path'); - var d = []; - var opLength = ops.length; - - for (var i = 0, j = 0; i < opLength; i++) { - switch (ops[i] | 0) { - case 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 OPS.moveTo: - x = args[j++]; - y = args[j++]; - d.push('M', pf(x), pf(y)); - break; - case OPS.lineTo: - x = args[j++]; - y = args[j++]; - d.push('L', pf(x) , pf(y)); - break; - case 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 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 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 OPS.closePath: - d.push('Z'); - break; - } + if (ctx.setLineDash !== undefined) { + ctx.setLineDash(dashArray); + ctx.lineDashOffset = dashPhase; } - current.path.setAttributeNS(null, 'd', d.join(' ')); - current.path.setAttributeNS(null, 'stroke-miterlimit', - pf(current.miterLimit)); - current.path.setAttributeNS(null, 'stroke-linecap', current.lineCap); - current.path.setAttributeNS(null, 'stroke-linejoin', current.lineJoin); - current.path.setAttributeNS(null, 'stroke-width', - pf(current.lineWidth) + 'px'); - current.path.setAttributeNS(null, 'stroke-dasharray', - current.dashArray.map(pf).join(' ')); - current.path.setAttributeNS(null, 'stroke-dashoffset', - pf(current.dashPhase) + 'px'); - current.path.setAttributeNS(null, 'fill', 'none'); - - this.tgrp.appendChild(current.path); - if (current.pendingClip) { - this.cgrp.appendChild(this.tgrp); - this.pgrp.appendChild(this.cgrp); - } else { - this.pgrp.appendChild(this.tgrp); - } - // Saving a reference in current.element so that it can be addressed - // in 'fill' and 'stroke' - current.element = current.path; - current.setCurrentPoint(x, y); }, - - endPath: function SVGGraphics_endPath() { - var current = this.current; - if (current.pendingClip) { - this.cgrp.appendChild(this.tgrp); - this.pgrp.appendChild(this.cgrp); - } else { - this.pgrp.appendChild(this.tgrp); - } - this.tgrp = document.createElementNS(NS, 'svg:g'); - this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - }, - - clip: function SVGGraphics_clip(type) { - var current = this.current; - // Add current path to clipping path - current.clipId = 'clippath' + clipCount; - clipCount++; - this.clippath = document.createElementNS(NS, 'svg:clipPath'); - this.clippath.setAttributeNS(null, 'id', current.clipId); - var clipElement = current.element.cloneNode(); - if (type === 'evenodd') { - clipElement.setAttributeNS(null, 'clip-rule', 'evenodd'); - } else { - clipElement.setAttributeNS(null, 'clip-rule', 'nonzero'); - } - this.clippath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); - this.clippath.appendChild(clipElement); - this.defs.appendChild(this.clippath); - - // Create a new group with that attribute - current.pendingClip = true; - this.cgrp = document.createElementNS(NS, 'svg:g'); - this.cgrp.setAttributeNS(null, 'clip-path', - 'url(#' + current.clipId + ')'); - this.pgrp.appendChild(this.cgrp); - }, - - closePath: function SVGGraphics_closePath() { - var current = this.current; - 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; - }, - - setHScale: function SVGGraphics_setHScale(scale) { - this.current.textHScale = scale / 100; - }, - - setGState: function SVGGraphics_setGState(states) { + setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) {}, + setFlatness: function CanvasGraphics_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]; @@ -4715,513 +14737,3353 @@ var SVGGraphics = (function SVGGraphicsClosure() { 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); + this.setFont(value[0], value[1]); break; + case 'CA': + this.current.strokeAlpha = state[1]; break; + case 'ca': + this.current.fillAlpha = state[1]; + this.ctx.globalAlpha = state[1]; break; + case 'BM': + this.ctx.globalCompositeOperation = value; break; + case 'SMask': + if (this.current.activeSMask) { + if (this.stateStack.length > 0 && this.stateStack[this.stateStack.length - 1].activeSMask === this.current.activeSMask) { + this.suspendSMaskGroup(); + } else { + this.endSMaskGroup(); + } + } + + this.current.activeSMask = value ? this.tempSMask : null; + + if (this.current.activeSMask) { + this.beginSMaskGroup(); + } + + this.tempSMask = null; break; } } }, - - fill: function SVGGraphics_fill() { - var current = this.current; - current.element.setAttributeNS(null, 'fill', current.fillColor); + beginSMaskGroup: function CanvasGraphics_beginSMaskGroup() { + var activeSMask = this.current.activeSMask; + var drawnWidth = activeSMask.canvas.width; + var drawnHeight = activeSMask.canvas.height; + var cacheId = 'smaskGroupAt' + this.groupLevel; + var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); + var currentCtx = this.ctx; + var currentTransform = currentCtx.mozCurrentTransform; + this.ctx.save(); + var groupCtx = scratchCanvas.context; + groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY); + groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY); + groupCtx.transform.apply(groupCtx, currentTransform); + activeSMask.startTransformInverse = groupCtx.mozCurrentTransformInverse; + copyCtxState(currentCtx, groupCtx); + this.ctx = groupCtx; + this.setGState([['BM', 'source-over'], ['ca', 1], ['CA', 1]]); + this.groupStack.push(currentCtx); + this.groupLevel++; }, + suspendSMaskGroup: function CanvasGraphics_endSMaskGroup() { + var groupCtx = this.ctx; + this.groupLevel--; + this.ctx = this.groupStack.pop(); + composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext); + this.ctx.restore(); + this.ctx.save(); + copyCtxState(groupCtx, this.ctx); + this.current.resumeSMaskCtx = groupCtx; - stroke: function SVGGraphics_stroke() { - var current = this.current; - current.element.setAttributeNS(null, 'stroke', current.strokeColor); - current.element.setAttributeNS(null, 'fill', 'none'); + 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); + groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height); + groupCtx.restore(); }, - - eoFill: function SVGGraphics_eoFill() { - var current = this.current; - current.element.setAttributeNS(null, 'fill', current.fillColor); - current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); + resumeSMaskGroup: function CanvasGraphics_endSMaskGroup() { + var groupCtx = this.current.resumeSMaskCtx; + var currentCtx = this.ctx; + this.ctx = groupCtx; + this.groupStack.push(currentCtx); + this.groupLevel++; }, + endSMaskGroup: function CanvasGraphics_endSMaskGroup() { + var groupCtx = this.ctx; + this.groupLevel--; + this.ctx = this.groupStack.pop(); + composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext); + this.ctx.restore(); + copyCtxState(groupCtx, this.ctx); - fillStroke: function SVGGraphics_fillStroke() { - // Order is important since stroke wants fill to be none. - // First stroke, then if fill needed, it will be overwritten. + var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); + + this.ctx.transform.apply(this.ctx, deltaTransform); + }, + save: function CanvasGraphics_save() { + this.ctx.save(); + var old = this.current; + this.stateStack.push(old); + this.current = old.clone(); + this.current.resumeSMaskCtx = null; + }, + restore: function CanvasGraphics_restore() { + if (this.current.resumeSMaskCtx) { + this.resumeSMaskGroup(); + } + + if (this.current.activeSMask !== null && (this.stateStack.length === 0 || this.stateStack[this.stateStack.length - 1].activeSMask !== this.current.activeSMask)) { + this.endSMaskGroup(); + } + + if (this.stateStack.length !== 0) { + this.current = this.stateStack.pop(); + this.ctx.restore(); + this.pendingClip = null; + this._cachedGetSinglePixelWidth = null; + } + }, + transform: function CanvasGraphics_transform(a, b, c, d, e, f) { + this.ctx.transform(a, b, c, d, e, f); + this._cachedGetSinglePixelWidth = null; + }, + constructPath: function CanvasGraphics_constructPath(ops, args) { + var ctx = this.ctx; + 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: + x = args[j++]; + 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); + this.ctx.lineTo(xw, y); + this.ctx.lineTo(xw, yh); + this.ctx.lineTo(x, yh); + 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; + 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') { + ctx.save(); + ctx.strokeStyle = strokeColor.getPattern(ctx, this); + ctx.stroke(); + ctx.restore(); + } else { + ctx.stroke(); + } + + if (consumePath) { + this.consumePath(); + } + + ctx.globalAlpha = this.current.fillAlpha; + }, + closeStroke: function CanvasGraphics_closeStroke() { + this.closePath(); this.stroke(); + }, + fill: function CanvasGraphics_fill(consumePath) { + 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'); + this.pendingEOFill = false; + } else { + ctx.fill(); + } + + if (needRestore) { + ctx.restore(); + } + + if (consumePath) { + this.consumePath(); + } + }, + eoFill: function CanvasGraphics_eoFill() { + this.pendingEOFill = true; this.fill(); }, - - eoFillStroke: function SVGGraphics_eoFillStroke() { - this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); + fillStroke: function CanvasGraphics_fillStroke() { + this.fill(false); + this.stroke(false); + this.consumePath(); + }, + eoFillStroke: function CanvasGraphics_eoFillStroke() { + this.pendingEOFill = true; this.fillStroke(); }, - - closeStroke: function SVGGraphics_closeStroke() { - this.closePath(); - this.stroke(); - }, - - closeFillStroke: function SVGGraphics_closeFillStroke() { + closeFillStroke: function CanvasGraphics_closeFillStroke() { this.closePath(); this.fillStroke(); }, - - paintSolidColorImageMask: - function SVGGraphics_paintSolidColorImageMask() { - var current = this.current; - var rect = document.createElementNS(NS, '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.tgrp.appendChild(rect); + closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() { + this.pendingEOFill = true; + this.closePath(); + this.fillStroke(); }, - - paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) { - var current = this.current; - var imgObj = this.objs.get(objId); - var imgEl = document.createElementNS(NS, 'svg:image'); - imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src); - imgEl.setAttributeNS(null, 'width', imgObj.width + 'px'); - imgEl.setAttributeNS(null, 'height', imgObj.height + 'px'); - imgEl.setAttributeNS(null, 'x', '0'); - imgEl.setAttributeNS(null, 'y', pf(-h)); - imgEl.setAttributeNS(null, 'transform', - 'scale(' + pf(1 / w) + ' ' + pf(-1 / h) + ')'); - - this.tgrp.appendChild(imgEl); - if (current.pendingClip) { - this.cgrp.appendChild(this.tgrp); - this.pgrp.appendChild(this.cgrp); - } else { - this.pgrp.appendChild(this.tgrp); - } + endPath: function CanvasGraphics_endPath() { + this.consumePath(); }, + clip: function CanvasGraphics_clip() { + this.pendingClip = NORMAL_CLIP; + }, + eoClip: function CanvasGraphics_eoClip() { + this.pendingClip = EO_CLIP; + }, + beginText: function CanvasGraphics_beginText() { + this.current.textMatrix = _util.IDENTITY_MATRIX; + this.current.textMatrixScale = 1; + this.current.x = this.current.lineX = 0; + this.current.y = this.current.lineY = 0; + }, + endText: function CanvasGraphics_endText() { + var paths = this.pendingTextPaths; + var ctx = this.ctx; - paintImageXObject: function SVGGraphics_paintImageXObject(objId) { - var imgData = this.objs.get(objId); - if (!imgData) { - warn('Dependent image isn\'t ready yet'); + if (paths === undefined) { + ctx.beginPath(); return; } - this.paintInlineImageXObject(imgData); - }, - paintInlineImageXObject: - function SVGGraphics_paintInlineImageXObject(imgData, mask) { - var current = this.current; - var width = imgData.width; - var height = imgData.height; + ctx.save(); + ctx.beginPath(); - var imgSrc = convertImgDataToPng(imgData); - var cliprect = document.createElementNS(NS, 'svg:rect'); - cliprect.setAttributeNS(null, 'x', '0'); - cliprect.setAttributeNS(null, 'y', '0'); - cliprect.setAttributeNS(null, 'width', pf(width)); - cliprect.setAttributeNS(null, 'height', pf(height)); - current.element = cliprect; - this.clip('nonzero'); - var imgEl = document.createElementNS(NS, '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.tgrp.appendChild(imgEl); + 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); } - if (current.pendingClip) { - this.cgrp.appendChild(this.tgrp); - this.pgrp.appendChild(this.cgrp); + + ctx.restore(); + ctx.clip(); + ctx.beginPath(); + delete this.pendingTextPaths; + }, + setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) { + this.current.charSpacing = spacing; + }, + setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) { + this.current.wordSpacing = spacing; + }, + setHScale: function CanvasGraphics_setHScale(scale) { + this.current.textHScale = scale / 100; + }, + setLeading: function CanvasGraphics_setLeading(leading) { + this.current.leading = -leading; + }, + 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 ".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); + } + + if (size < 0) { + size = -size; + current.fontDirection = -1; } else { - this.pgrp.appendChild(this.tgrp); + 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 = "\"".concat(name, "\", ").concat(fontObj.fallbackName); + var browserFontSize = size < MIN_FONT_SIZE ? MIN_FONT_SIZE : size > MAX_FONT_SIZE ? MAX_FONT_SIZE : size; + this.current.fontSizeScale = size / browserFontSize; + this.ctx.font = "".concat(italic, " ").concat(bold, " ").concat(browserFontSize, "px ").concat(typeface); + }, + setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) { + this.current.textRenderingMode = mode; + }, + setTextRise: function CanvasGraphics_setTextRise(rise) { + this.current.textRise = rise; + }, + moveText: function CanvasGraphics_moveText(x, y) { + this.current.x = this.current.lineX += x; + this.current.y = this.current.lineY += y; + }, + setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) { + this.setLeading(-y); + this.moveText(x, y); + }, + setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) { + this.current.textMatrix = [a, b, c, d, e, f]; + this.current.textMatrixScale = Math.sqrt(a * a + b * b); + this.current.x = this.current.lineX = 0; + this.current.y = this.current.lineY = 0; + }, + nextLine: function CanvasGraphics_nextLine() { + this.moveText(0, this.current.leading); + }, + paintChar: function paintChar(character, x, y, patternTransform) { + var ctx = this.ctx; + var current = this.current; + var font = current.font; + var textRenderingMode = current.textRenderingMode; + 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 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({ + transform: ctx.mozCurrentTransform, + x: x, + y: y, + fontSize: fontSize, + addToPath: addToPath + }); } }, - paintImageMaskXObject: - function SVGGraphics_paintImageMaskXObject(imgData) { - var current = this.current; - var width = imgData.width; - var height = imgData.height; - var fillColor = current.fillColor; + get isFontSubpixelAAEnabled() { + var ctx = this.canvasFactory.create(10, 10).context; + ctx.scale(1.5, 1); + ctx.fillText('I', 0, 10); + var data = ctx.getImageData(0, 0, 10, 10).data; + var enabled = false; - current.maskId = 'mask' + maskCount++; - var mask = document.createElementNS(NS, 'svg:mask'); - mask.setAttributeNS(null, 'id', current.maskId); + for (var i = 3; i < data.length; i += 4) { + if (data[i] > 0 && data[i] < 255) { + enabled = true; + break; + } + } - var rect = document.createElementNS(NS, '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.tgrp.appendChild(rect); - - this.paintInlineImageXObject(imgData, mask); + return (0, _util.shadow)(this, 'isFontSubpixelAAEnabled', enabled); }, - paintFormXObjectBegin: - function SVGGraphics_paintFormXObjectBegin(matrix, bbox) { + 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; + } + + var ctx = this.ctx; + var fontSizeScale = current.fontSizeScale; + 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 spacingDir = vertical ? 1 : -1; + var defaultVMetrics = font.defaultVMetrics; + var widthAdvanceScale = fontSize * current.fontMatrix[0]; + var simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill; + ctx.save(); + var patternTransform; + + if (current.patternFill) { + ctx.save(); + var pattern = current.fillColor.getPattern(ctx, this); + patternTransform = ctx.mozCurrentTransform; + 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; + } + } 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; + vx = glyph.vmetric ? vmetric[1] : width * 0.5; + vx = -vx * widthAdvanceScale; + vy = vmetric[2] * widthAdvanceScale; + width = vmetric ? -vmetric[0] : width; + scaledX = vx / fontSizeScale; + scaledY = (x + vy) / fontSizeScale; + } else { + 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; + ctx.save(); + ctx.scale(characterScaleX, 1); + scaledX /= characterScaleX; + } else if (width !== measuredWidth) { + 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; + this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform); + } + } + } + + var charWidth = width * widthAdvanceScale + spacing * fontDirection; + x += charWidth; + + if (restoreNeeded) { + ctx.restore(); + } + } + + if (vertical) { + current.y -= x * textHScale; + } else { + current.x += x * textHScale; + } + + ctx.restore(); + }, + showType3Text: function CanvasGraphics_showType3Text(glyphs) { + var ctx = this.ctx; + var current = this.current; + var font = current.font; + var fontSize = current.fontSize; + var fontDirection = current.fontDirection; + var spacingDir = font.vertical ? 1 : -1; + var charSpacing = current.charSpacing; + var wordSpacing = current.wordSpacing; + var textHScale = current.textHScale * fontDirection; + var fontMatrix = current.fontMatrix || _util.FONT_IDENTITY_MATRIX; + 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 \"".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; + }, + setCharWidth: function CanvasGraphics_setCharWidth(xWidth, yWidth) {}, + setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) { + this.ctx.rect(llx, lly, urx - llx, ury - lly); + this.clip(); + this.endPath(); + }, + getColorN_Pattern: function CanvasGraphics_getColorN_Pattern(IR) { + var _this = this; + + var pattern; + + if (IR[0] === 'TilingPattern') { + var color = IR[1]; + var baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice(); + var canvasGraphicsFactory = { + createCanvasGraphics: function createCanvasGraphics(ctx) { + return new CanvasGraphics(ctx, _this.commonObjs, _this.objs, _this.canvasFactory, _this.webGLContext); + } + }; + pattern = new _pattern_helper.TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform); + } else { + pattern = (0, _pattern_helper.getShadingPatternFromIR)(IR); + } + + return pattern; + }, + setStrokeColorN: function CanvasGraphics_setStrokeColorN() { + this.current.strokeColor = this.getColorN_Pattern(arguments); + }, + setFillColorN: function CanvasGraphics_setFillColorN() { + this.current.fillColor = this.getColorN_Pattern(arguments); + this.current.patternFill = true; + }, + 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; + }, + shadingFill: function CanvasGraphics_shadingFill(patternIR) { + var ctx = this.ctx; this.save(); + var pattern = (0, _pattern_helper.getShadingPatternFromIR)(patternIR); + ctx.fillStyle = pattern.getPattern(ctx, this, true); + var inv = ctx.mozCurrentTransformInverse; - if (isArray(matrix) && matrix.length === 6) { - this.transform(matrix[0], matrix[1], matrix[2], - matrix[3], matrix[4], matrix[5]); + 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]); + var y1 = Math.max(bl[1], br[1], ul[1], ur[1]); + this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0); + } else { + this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10); } - if (isArray(bbox) && bbox.length === 4) { + this.restore(); + }, + beginInlineImage: function CanvasGraphics_beginInlineImage() { + (0, _util.unreachable)('Should not call beginInlineImage'); + }, + beginImageData: function CanvasGraphics_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 (bbox) { var width = bbox[2] - bbox[0]; var height = bbox[3] - bbox[1]; - - var cliprect = document.createElementNS(NS, '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.ctx.rect(bbox[0], bbox[1], width, height); + this.clip(); this.endPath(); } }, - - paintFormXObjectEnd: - function SVGGraphics_paintFormXObjectEnd() { + paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() { this.restore(); - } - }; - return SVGGraphics; -})(); + this.baseTransform = this.baseTransformStack.pop(); + }, + beginGroup: function CanvasGraphics_beginGroup(group) { + this.save(); + var currentCtx = this.ctx; -PDFJS.SVGGraphics = SVGGraphics; + if (!group.isolated) { + (0, _util.info)('TODO: Support non-isolated groups.'); + } -exports.SVGGraphics = SVGGraphics; -})); + if (group.knockout) { + (0, _util.warn)('Knockout groups not supported.'); + } + var currentTransform = currentCtx.mozCurrentTransform; -(function (root, factory) { - { - factory((root.pdfjsDisplayTextLayer = {}), root.pdfjsSharedUtil, - root.pdfjsDisplayDOMUtils, root.pdfjsSharedGlobal); - } -}(this, function (exports, sharedUtil, displayDOMUtils, sharedGlobal) { + if (group.matrix) { + currentCtx.transform.apply(currentCtx, group.matrix); + } -var Util = sharedUtil.Util; -var createPromiseCapability = sharedUtil.createPromiseCapability; -var CustomStyle = displayDOMUtils.CustomStyle; -var PDFJS = sharedGlobal.PDFJS; + if (!group.bbox) { + throw new Error('Bounding box is required.'); + } -/** - * Text layer render parameters. - * - * @typedef {Object} TextLayerRenderParameters - * @property {TextContent} textContent - Text content to render (the object is - * returned by the page's getTextContent() method). - * @property {HTMLElement} container - HTML element that will contain text runs. - * @property {PDFJS.PageViewport} viewport - The target viewport to properly - * layout the text runs. - * @property {Array} textDivs - (optional) HTML elements that are correspond - * the text items of the textContent input. This is output and shall be - * initially be set to empty array. - * @property {number} timeout - (optional) Delay in milliseconds before - * rendering of the text runs occurs. - */ -var renderTextLayer = (function renderTextLayerClosure() { - var MAX_TEXT_DIVS_TO_RENDER = 100000; + var bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform); - var NonWhitespaceRegexp = /\S/; + 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]); + var offsetY = Math.floor(bounds[1]); + var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1); + var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1); + var scaleX = 1, + scaleY = 1; - function isAllWhitespace(str) { - return !NonWhitespaceRegexp.test(str); - } + if (drawnWidth > MAX_GROUP_SIZE) { + scaleX = drawnWidth / MAX_GROUP_SIZE; + drawnWidth = MAX_GROUP_SIZE; + } - function appendText(textDivs, viewport, geom, styles) { - var style = styles[geom.fontName]; - var textDiv = document.createElement('div'); - textDivs.push(textDiv); - if (isAllWhitespace(geom.str)) { - textDiv.dataset.isWhitespace = true; - return; - } - var tx = Util.transform(viewport.transform, geom.transform); - var angle = Math.atan2(tx[1], tx[0]); - 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; - } + if (drawnHeight > MAX_GROUP_SIZE) { + scaleY = drawnHeight / MAX_GROUP_SIZE; + drawnHeight = MAX_GROUP_SIZE; + } - 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)); - } - textDiv.style.left = left + 'px'; - textDiv.style.top = top + 'px'; - textDiv.style.fontSize = fontHeight + 'px'; - textDiv.style.fontFamily = style.fontFamily; + var cacheId = 'groupAt' + this.groupLevel; - textDiv.textContent = geom.str; - // |fontName| is only used by the Font Inspector. This test will succeed - // when e.g. the Font Inspector is off but the Stepper is on, but it's - // not worth the effort to do a more accurate test. - if (PDFJS.pdfBug) { - textDiv.dataset.fontName = geom.fontName; - } - // Storing into dataset will convert number into string. - if (angle !== 0) { - textDiv.dataset.angle = angle * (180 / Math.PI); - } - // We don't bother scaling single-char text divs, because it has very - // little effect on text highlighting. This makes scrolling on docs with - // lots of such divs a lot faster. - if (geom.str.length > 1) { - if (style.vertical) { - textDiv.dataset.canvasWidth = geom.height * viewport.scale; + if (group.smask) { + 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, + context: groupCtx, + offsetX: offsetX, + offsetY: offsetY, + scaleX: scaleX, + scaleY: scaleY, + subtype: group.smask.subtype, + backdrop: group.smask.backdrop, + transferMap: group.smask.transferMap || null, + startTransformInverse: null + }); } else { - textDiv.dataset.canvasWidth = geom.width * viewport.scale; - } - } - } - - function render(task) { - if (task._canceled) { - return; - } - var textLayerFrag = task._container; - var textDivs = task._textDivs; - var capability = task._capability; - var textDivsLength = textDivs.length; - - // No point in rendering many divs as it would make the browser - // unusable even after the divs are rendered. - if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) { - capability.resolve(); - return; - } - - var canvas = document.createElement('canvas'); - canvas.mozOpaque = true; - var ctx = canvas.getContext('2d', {alpha: false}); - - var lastFontSize; - var lastFontFamily; - for (var i = 0; i < textDivsLength; i++) { - var textDiv = textDivs[i]; - if (textDiv.dataset.isWhitespace !== undefined) { - continue; + currentCtx.setTransform(1, 0, 0, 1, 0, 0); + currentCtx.translate(offsetX, offsetY); + currentCtx.scale(scaleX, scaleY); } - var fontSize = textDiv.style.fontSize; - var fontFamily = textDiv.style.fontFamily; + copyCtxState(currentCtx, groupCtx); + this.ctx = groupCtx; + this.setGState([['BM', 'source-over'], ['ca', 1], ['CA', 1]]); + this.groupStack.push(currentCtx); + this.groupLevel++; + this.current.activeSMask = null; + }, + endGroup: function CanvasGraphics_endGroup(group) { + this.groupLevel--; + var groupCtx = this.ctx; + this.ctx = this.groupStack.pop(); - // Only build font string and set to context if different from last. - if (fontSize !== lastFontSize || fontFamily !== lastFontFamily) { - ctx.font = fontSize + ' ' + fontFamily; - lastFontSize = fontSize; - lastFontFamily = fontFamily; + if (this.ctx.imageSmoothingEnabled !== undefined) { + this.ctx.imageSmoothingEnabled = false; + } else { + this.ctx.mozImageSmoothingEnabled = false; } - var width = ctx.measureText(textDiv.textContent).width; - if (width > 0) { - textLayerFrag.appendChild(textDiv); - var transform; - if (textDiv.dataset.canvasWidth !== undefined) { - // Dataset values come of type string. - var textScale = textDiv.dataset.canvasWidth / width; - transform = 'scaleX(' + textScale + ')'; + 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); + } + }, + endAnnotations: function CanvasGraphics_endAnnotations() { + this.restore(); + }, + beginAnnotation: function CanvasGraphics_beginAnnotation(rect, transform, matrix) { + 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]; + this.ctx.rect(rect[0], rect[1], width, height); + 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, + height = img.height; + 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({ + data: img.data, + width: width, + height: height + }); } else { - transform = ''; - } - var rotation = textDiv.dataset.angle; - if (rotation) { - transform = 'rotate(' + rotation + 'deg) ' + transform; - } - if (transform) { - CustomStyle.setProp('transform' , textDiv, transform); + glyph.compiled = null; } } - } - capability.resolve(); - } - /** - * Text layer rendering task. - * - * @param {TextContent} textContent - * @param {HTMLElement} container - * @param {PDFJS.PageViewport} viewport - * @param {Array} textDivs - * @private - */ - function TextLayerRenderTask(textContent, container, viewport, textDivs) { - this._textContent = textContent; - this._container = container; - this._viewport = viewport; - textDivs = textDivs || []; - this._textDivs = textDivs; - this._canceled = false; - this._capability = createPromiseCapability(); - this._renderTimer = null; - } - TextLayerRenderTask.prototype = { - get promise() { - return this._capability.promise; + if (glyph && glyph.compiled) { + glyph.compiled(ctx); + return; + } + + var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', width, height); + var maskCtx = maskCanvas.context; + maskCtx.save(); + putBinaryImageMask(maskCtx, img); + maskCtx.globalCompositeOperation = 'source-in'; + maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; + maskCtx.fillRect(0, 0, width, height); + maskCtx.restore(); + this.paintInlineImageXObject(maskCanvas.canvas); }, + paintImageMaskXObjectRepeat: function CanvasGraphics_paintImageMaskXObjectRepeat(imgData, scaleX, scaleY, positions) { + var width = imgData.width; + var height = imgData.height; + var fillColor = this.current.fillColor; + var isPatternFill = this.current.patternFill; + var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', width, height); + var maskCtx = maskCanvas.context; + maskCtx.save(); + putBinaryImageMask(maskCtx, imgData); + maskCtx.globalCompositeOperation = 'source-in'; + maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; + maskCtx.fillRect(0, 0, width, height); + maskCtx.restore(); + var ctx = this.ctx; - cancel: function TextLayer_cancel() { - this._canceled = true; - if (this._renderTimer !== null) { - clearTimeout(this._renderTimer); - this._renderTimer = null; + for (var i = 0, ii = positions.length; i < ii; i += 2) { + ctx.save(); + ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]); + ctx.scale(1, -1); + ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1); + ctx.restore(); } - this._capability.reject('canceled'); }, + paintImageMaskXObjectGroup: function CanvasGraphics_paintImageMaskXObjectGroup(images) { + var ctx = this.ctx; + var fillColor = this.current.fillColor; + var isPatternFill = this.current.patternFill; - _render: function TextLayer_render(timeout) { - var textItems = this._textContent.items; - var styles = this._textContent.styles; - var textDivs = this._textDivs; - var viewport = this._viewport; - for (var i = 0, len = textItems.length; i < len; i++) { - appendText(textDivs, viewport, textItems[i], styles); + 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 maskCtx = maskCanvas.context; + maskCtx.save(); + putBinaryImageMask(maskCtx, image); + maskCtx.globalCompositeOperation = 'source-in'; + maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; + maskCtx.fillRect(0, 0, width, height); + maskCtx.restore(); + ctx.save(); + ctx.transform.apply(ctx, image.transform); + ctx.scale(1, -1); + ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1); + ctx.restore(); + } + }, + paintImageXObject: function CanvasGraphics_paintImageXObject(objId) { + var imgData = this.objs.get(objId); + + if (!imgData) { + (0, _util.warn)('Dependent image isn\'t ready yet'); + return; } - if (!timeout) { // Render right away - render(this); - } else { // Schedule - var self = this; - this._renderTimer = setTimeout(function() { - render(self); - self._renderTimer = null; - }, timeout); + this.paintInlineImageXObject(imgData); + }, + paintImageXObjectRepeat: function CanvasGraphics_paintImageXObjectRepeat(objId, scaleX, scaleY, positions) { + var imgData = this.objs.get(objId); + + if (!imgData) { + (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]], + x: 0, + y: 0, + w: width, + h: height + }); + } + + this.paintInlineImageXObjectGroup(imgData, map); + }, + paintInlineImageXObject: function CanvasGraphics_paintInlineImageXObject(imgData) { + var width = imgData.width; + var height = imgData.height; + var ctx = this.ctx; + this.save(); + ctx.scale(1 / width, -1 / height); + var currentTransform = ctx.mozCurrentTransformInverse; + var a = currentTransform[0], + b = currentTransform[1]; + var widthScale = Math.max(Math.sqrt(a * a + b * b), 1); + var c = currentTransform[2], + 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) { + imgToPaint = imgData; + } else { + 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'; + + 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); + tmpCtx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight); + imgToPaint = tmpCanvas.canvas; + paintWidth = newWidth; + paintHeight = newHeight; + 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({ + imgData: imgData, + left: position[0], + top: position[1], + width: width / currentTransform[0], + height: height / currentTransform[3] + }); + } + + 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]]; } }; - - /** - * Starts rendering of the text layer. - * - * @param {TextLayerRenderParameters} renderParameters - * @returns {TextLayerRenderTask} - */ - function renderTextLayer(renderParameters) { - var task = new TextLayerRenderTask(renderParameters.textContent, - renderParameters.container, - renderParameters.viewport, - renderParameters.textDivs); - task._render(renderParameters.timeout); - return task; + for (var op in _util.OPS) { + CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op]; } - return renderTextLayer; -})(); + return CanvasGraphics; +}(); -PDFJS.renderTextLayer = renderTextLayer; +exports.CanvasGraphics = CanvasGraphics; -exports.renderTextLayer = renderTextLayer; -})); +/***/ }), +/* 155 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; -(function (root, factory) { - { - factory((root.pdfjsDisplayWebGL = {}), root.pdfjsSharedUtil); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getShadingPatternFromIR = getShadingPatternFromIR; +exports.TilingPattern = void 0; + +var _util = __w_pdfjs_require__(1); + +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); + } + + for (var i = 0, ii = colorStops.length; i < ii; ++i) { + var c = colorStops[i]; + grad.addColorStop(c[0], c[1]); + } + + return grad; + } + }; } -}(this, function (exports, sharedUtil) { +}; -var shadow = sharedUtil.shadow; +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; -var WebGLUtils = (function WebGLUtilsClosure() { + 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; + 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; + } 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; + } + } + } + + 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 background = raw[8]; + return { + type: 'Pattern', + getPattern: function Mesh_getPattern(ctx, owner, shadingFill) { + 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 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(); + } + }, + 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) { + 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'); + } + }; + return TilingPattern; +}(); + +exports.TilingPattern = TilingPattern; + +/***/ }), +/* 156 */ +/***/ (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; + +/***/ }), +/* 157 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.MessageHandler = MessageHandler; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); + +var _util = __w_pdfjs_require__(1); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { 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 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 resolveCall(_x, _x2) { + return _resolveCall.apply(this, arguments); +} + +function _resolveCall() { + _resolveCall = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee(fn, args) { + var thisArg, + _args = arguments; + return _regenerator.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + thisArg = _args.length > 2 && _args[2] !== undefined ? _args[2] : null; + + if (fn) { + _context.next = 3; + break; + } + + return _context.abrupt("return"); + + case 3: + return _context.abrupt("return", fn.apply(thisArg, args)); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + return _resolveCall.apply(this, arguments); +} + +function wrapReason(reason) { + if (_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 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; + } + + 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); + } + } else { + throw new Error("Cannot resolve callback ".concat(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: ".concat(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 \"".concat(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(_ref) { + var stream = _ref.stream, + chunk = _ref.chunk, + transfers = _ref.transfers, + success = _ref.success, + reason = _ref.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.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; + } + + 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(_ref2) { + var stream = _ref2.stream, + success = _ref2.success, + reason = _ref2.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; + } + + 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); + } + }, + destroy: function destroy() { + this.comObj.removeEventListener('message', this._onComObjOnMessage); + } +}; + +/***/ }), +/* 158 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Metadata = void 0; + +var _util = __w_pdfjs_require__(1); + +var _xml_parser = __w_pdfjs_require__(159); + +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._metadata = Object.create(null); + + 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._metadata[name] = entry.textContent.trim(); + } + } + } + } + }, { + key: "get", + value: function get(name) { + var data = this._metadata[name]; + return typeof data !== 'undefined' ? data : null; + } + }, { + key: "getAll", + value: function getAll() { + return this._metadata; + } + }, { + key: "has", + value: function has(name) { + return typeof this._metadata[name] !== 'undefined'; + } + }]); + + return Metadata; +}(); + +exports.Metadata = Metadata; + +/***/ }), +/* 159 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.SimpleXMLParser = void 0; + +function _typeof(obj) { 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) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +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 _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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +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 _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 pos = start, + name, + attributes = []; + + function skipWs() { + while (pos < s.length && isWhitespace(s, pos)) { + ++pos; + } + } + + 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; + } + + 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, + name, + value; + + function skipWs() { + while (pos < s.length && isWhitespace(s, pos)) { + ++pos; + } + } + + 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)); + } + + 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); + + function SimpleXMLParser() { + var _this2; + + _classCallCheck(this, SimpleXMLParser); + + _this2 = _possibleConstructorReturn(this, _getPrototypeOf(SimpleXMLParser).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; + +/***/ }), +/* 160 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFDataTransportStream = void 0; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); + +var _util = __w_pdfjs_require__(1); + +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); }); }; } + +var PDFDataTransportStream = function PDFDataTransportStreamClosure() { + function PDFDataTransportStream(params, pdfDataRangeTransport) { + var _this = this; + + (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; + }, + 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); + }); + + 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 _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; + }(), + 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) { + 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); + }, + + get isStreamingSupported() { + return false; + }, + + read: 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; + }(), + 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); + } + }; + return PDFDataTransportStream; +}(); + +exports.PDFDataTransportStream = PDFDataTransportStream; + +/***/ }), +/* 161 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.WebGLContext = void 0; + +var _util = __w_pdfjs_require__(1); + +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); - - // Set the parameters so we can render any size image. 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); - - // Upload the image into the texture. 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 }); + currentGL = currentCanvas.getContext('webgl', { + premultipliedalpha: false + }); } var smaskVertexShaderCode = '\ @@ -5238,7 +18100,6 @@ var WebGLUtils = (function WebGLUtilsClosure() { \ v_texCoord = a_texCoord; \ } '; - var smaskFragmentShaderCode = '\ precision mediump float; \ \ @@ -5267,24 +18128,19 @@ var WebGLUtils = (function WebGLUtilsClosure() { imageColor.rgb *= imageColor.a; \ gl_FragColor = imageColor; \ } '; - var smaskCache = null; function initSmaskGL() { var canvas, gl; - generateGL(); canvas = currentCanvas; currentCanvas = null; gl = currentGL; currentGL = null; - - // setup a GLSL program 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; @@ -5292,84 +18148,58 @@ var WebGLUtils = (function WebGLUtilsClosure() { 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'); - - // provide texture coordinates for the rectangle. 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.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; + var width = layer.width, + height = layer.height; if (!smaskCache) { initSmaskGL(); } - var cache = smaskCache,canvas = cache.canvas, gl = cache.gl; + + 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); + 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); - // Create a textures + gl.uniform1i(cache.subtypeLocation, properties.subtype === 'Luminosity' ? 1 : 0); var texture = createTexture(gl, layer, gl.TEXTURE0); var maskTexture = createTexture(gl, mask, gl.TEXTURE1); - - - // Create a buffer and put a single clipspace rectangle in - // it (2 triangles) 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.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); - - // draw 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; } @@ -5390,7 +18220,6 @@ var WebGLUtils = (function WebGLUtilsClosure() { \ v_color = vec4(a_color / 255.0, 1.0); \ } '; - var figuresFragmentShaderCode = '\ precision mediump float; \ \ @@ -5399,24 +18228,19 @@ var WebGLUtils = (function WebGLUtilsClosure() { void main() { \ gl_FragColor = v_color; \ } '; - var figuresCache = null; function initFiguresGL() { var canvas, gl; - generateGL(); canvas = currentCanvas; currentCanvas = null; gl = currentGL; currentGL = null; - - // setup a GLSL program 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; @@ -5425,7 +18249,6 @@ var WebGLUtils = (function WebGLUtilsClosure() { cache.offsetLocation = gl.getUniformLocation(program, 'u_offset'); cache.positionLocation = gl.getAttribLocation(program, 'a_position'); cache.colorLocation = gl.getAttribLocation(program, 'a_color'); - figuresCache = cache; } @@ -5433,40 +18256,50 @@ var WebGLUtils = (function WebGLUtilsClosure() { if (!figuresCache) { initFiguresGL(); } - var cache = figuresCache, canvas = cache.canvas, gl = cache.gl; + 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); - - // count triangle points 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; + 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; } } - // transfer data + var coords = new Float32Array(count * 2); var colors = new Uint8Array(count * 3); - var coordsMap = context.coords, colorsMap = context.colors; - var pIndex = 0, cIndex = 0; + 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; + var figure = figures[i], + ps = figure.coords, + cs = figure.colors; + switch (figure.type) { case 'lattice': var cols = figure.verticesPerRow; - rows = (ps.length / cols) | 0; + 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]; @@ -5483,7 +18316,6 @@ var WebGLUtils = (function WebGLUtilsClosure() { 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]; @@ -5503,7 +18335,9 @@ var WebGLUtils = (function WebGLUtilsClosure() { cIndex += 18; } } + break; + case 'triangles': for (var j = 0, jj = ps.length; j < jj; j++) { coords[pIndex] = coordsMap[ps[j]]; @@ -5514,4862 +18348,5252 @@ var WebGLUtils = (function WebGLUtilsClosure() { pIndex += 2; cIndex += 3; } + break; } } - // draw if (backgroundColor) { - gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255, - backgroundColor[2] / 255, 1.0); + 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); + 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.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; } - function cleanup() { - if (smaskCache && smaskCache.canvas) { - smaskCache.canvas.width = 0; - smaskCache.canvas.height = 0; - } - if (figuresCache && figuresCache.canvas) { - figuresCache.canvas.width = 0; - figuresCache.canvas.height = 0; - } - smaskCache = null; - figuresCache = null; - } - return { - get isEnabled() { - if (PDFJS.disableWebGL) { - return false; - } - var enabled = false; + tryInitGL: function tryInitGL() { try { generateGL(); - enabled = !!currentGL; - } catch (e) { } - return shadow(this, 'isEnabled', enabled); + return !!currentGL; + } catch (ex) {} + + return false; }, composeSMask: composeSMask, drawFigures: drawFigures, - clear: cleanup - }; -})(); - -exports.WebGLUtils = WebGLUtils; -})); - - -(function (root, factory) { - { - factory((root.pdfjsDisplayPatternHelper = {}), root.pdfjsSharedUtil, - root.pdfjsDisplayWebGL); - } -}(this, function (exports, sharedUtil, displayWebGL) { - -var Util = sharedUtil.Util; -var info = sharedUtil.info; -var isArray = sharedUtil.isArray; -var error = sharedUtil.error; -var WebGLUtils = displayWebGL.WebGLUtils; - -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); - } - - for (var i = 0, ii = colorStops.length; i < ii; ++i) { - var c = colorStops[i]; - grad.addColorStop(c[0], c[1]); - } - return grad; + cleanup: function cleanup() { + if (smaskCache && smaskCache.canvas) { + smaskCache.canvas.width = 0; + smaskCache.canvas.height = 0; } - }; - } -}; -var createMeshCanvas = (function createMeshCanvasClosure() { - function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) { - // Very basic Gouraud-shaded triangle rasterization algorithm. - 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 (figuresCache && figuresCache.canvas) { + figuresCache.canvas.width = 0; + figuresCache.canvas.height = 0; + } + + smaskCache = null; + figuresCache = null; } - 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) { + }; +}(); + +/***/ }), +/* 162 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.renderTextLayer = void 0; + +var _util = __w_pdfjs_require__(1); + +var _global_scope = _interopRequireDefault(__w_pdfjs_require__(3)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +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('span'); + 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 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; + 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 { - 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; + textDivProperties.canvasWidth = geom.width * task._viewport.scale; } } - } - 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: - error('illigal figure'); - break; - } - } + task._textDivProperties.set(textDiv, textDivProperties); - function createMeshCanvas(bounds, combinesScale, coords, colors, figures, - backgroundColor, cachedCanvases) { - // we will increase scale on some weird factor to let antialiasing take - // care of "rough" edges - var EXPECTED_SCALE = 1.1; - // MAX_PATTERN_SIZE is used to avoid OOM situation. - var MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough - - 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 canvas, tmpCanvas, i, ii; - if (WebGLUtils.isEnabled) { - canvas = WebGLUtils.drawFigures(width, height, backgroundColor, - figures, context); - - // https://bugzilla.mozilla.org/show_bug.cgi?id=972126 - tmpCanvas = cachedCanvases.getCanvas('mesh', width, height, false); - tmpCanvas.context.drawImage(canvas, 0, 0); - canvas = tmpCanvas.canvas; - } else { - tmpCanvas = cachedCanvases.getCanvas('mesh', width, height, 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, 0, 0); - canvas = tmpCanvas.canvas; + if (task._textContentStream) { + task._layoutText(textDiv); } - return {canvas: canvas, offsetX: offsetX, offsetY: offsetY, - scaleX: scaleX, scaleY: scaleY}; - } - return createMeshCanvas; -})(); + if (task._enhanceTextSelection) { + var angleCos = 1, + angleSin = 0; -ShadingIRs.Mesh = { - fromIR: function Mesh_fromIR(raw) { - //var type = raw[1]; - 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) { - var scale; - if (shadingFill) { - scale = Util.singularValueDecompose2dScale(ctx.mozCurrentTransform); - } else { - // Obtain scale from matrix and current transformation matrix. - scale = Util.singularValueDecompose2dScale(owner.baseTransform); - if (matrix) { - var matrixScale = Util.singularValueDecompose2dScale(matrix); - scale = [scale[0] * matrixScale[0], - scale[1] * matrixScale[1]]; - } - } - - - // Rasterizing on the main thread since sending/queue large canvases - // might cause OOM. - var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords, - colors, figures, shadingFill ? null : background, - owner.cachedCanvases); - - 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'); + if (angle !== 0) { + angleCos = Math.cos(angle); + angleSin = Math.sin(angle); } - }; - } -}; -ShadingIRs.Dummy = { - fromIR: function Dummy_fromIR() { - return { - type: 'Pattern', - getPattern: function Dummy_fromIR_getPattern() { - return 'hotpink'; - } - }; - } -}; + var divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale; + var divHeight = fontHeight; + var m, b; -function getShadingPatternFromIR(raw) { - var shadingIR = ShadingIRs[raw[0]]; - if (!shadingIR) { - 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; // 10in @ 300dpi shall be enough - - 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; - - info('TilingType: ' + tilingType); - - var x0 = bbox[0], y0 = bbox[1], x1 = bbox[2], y1 = bbox[3]; - - var topLeft = [x0, y0]; - // we want the canvas to be as large as the step size - var botRight = [x0 + xstep, y0 + ystep]; - - var width = botRight[0] - topLeft[0]; - var height = botRight[1] - topLeft[1]; - - // Obtain scale from matrix and current transformation matrix. - var matrixScale = Util.singularValueDecompose2dScale(this.matrix); - var curMatrixScale = Util.singularValueDecompose2dScale( - this.baseTransform); - var combinedScale = [matrixScale[0] * curMatrixScale[0], - matrixScale[1] * curMatrixScale[1]]; - - // MAX_PATTERN_SIZE is used to avoid OOM situation. - // Use width and height values that are as close as possible to the end - // result when the pattern is used. Too low value makes the pattern look - // blurry. Too large value makes it look too crispy. - 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(tmpCtx, paintType, color); - - this.setScale(width, height, xstep, ystep); - this.transformToScale(graphics); - - // transform coordinates to pattern space - 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 (bbox && 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(context, paintType, color) { - switch (paintType) { - case PaintType.COLORED: - var ctx = this.ctx; - context.fillStyle = ctx.fillStyle; - context.strokeStyle = ctx.strokeStyle; - break; - case PaintType.UNCOLORED: - var cssColor = Util.makeCssRgb(color[0], color[1], color[2]); - context.fillStyle = cssColor; - context.strokeStyle = cssColor; - break; - default: - error('Unsupported paint type: ' + paintType); - } - }, - - 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'); - } - }; - - return TilingPattern; -})(); - -exports.getShadingPatternFromIR = getShadingPatternFromIR; -exports.TilingPattern = TilingPattern; -})); - - -(function (root, factory) { - { - factory((root.pdfjsDisplayCanvas = {}), root.pdfjsSharedUtil, - root.pdfjsDisplayPatternHelper, root.pdfjsDisplayWebGL); - } -}(this, function (exports, sharedUtil, displayPatternHelper, displayWebGL) { - -var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX; -var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX; -var ImageKind = sharedUtil.ImageKind; -var OPS = sharedUtil.OPS; -var TextRenderingMode = sharedUtil.TextRenderingMode; -var Uint32ArrayView = sharedUtil.Uint32ArrayView; -var Util = sharedUtil.Util; -var assert = sharedUtil.assert; -var info = sharedUtil.info; -var isNum = sharedUtil.isNum; -var isArray = sharedUtil.isArray; -var error = sharedUtil.error; -var shadow = sharedUtil.shadow; -var warn = sharedUtil.warn; -var TilingPattern = displayPatternHelper.TilingPattern; -var getShadingPatternFromIR = displayPatternHelper.getShadingPatternFromIR; -var WebGLUtils = displayWebGL.WebGLUtils; - -// contexts store most of the state we need natively. -// However, PDF needs a bit more state, which we store here. - -// Minimal font size that would be used during canvas fillText operations. -var MIN_FONT_SIZE = 16; -// Maximum font size that would be used during canvas fillText operations. -var MAX_FONT_SIZE = 100; -var MAX_GROUP_SIZE = 4096; - -// Heuristic value used when enforcing minimum line widths. -var MIN_WIDTH_FACTOR = 0.65; - -var COMPILE_TYPE3_GLYPHS = true; -var MAX_SIZE_TO_COMPILE = 1000; - -var FULL_CHUNK_HEIGHT = 16; - -function createScratchCanvas(width, height) { - var canvas = document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - return canvas; -} - -function addContextCurrentTransform(ctx) { - // If the context doesn't expose a `mozCurrentTransform`, add a JS based one. - if (!ctx.mozCurrentTransform) { - ctx._originalSave = ctx.save; - ctx._originalRestore = ctx.restore; - ctx._originalRotate = ctx.rotate; - ctx._originalScale = ctx.scale; - ctx._originalTranslate = ctx.translate; - ctx._originalTransform = ctx.transform; - ctx._originalSetTransform = ctx.setTransform; - - ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0]; - ctx._transformStack = []; - - Object.defineProperty(ctx, 'mozCurrentTransform', { - get: function getCurrentTransform() { - return this._transformMatrix; - } - }); - - Object.defineProperty(ctx, 'mozCurrentTransformInverse', { - get: function getCurrentTransformInverse() { - // Calculation done using WolframAlpha: - // http://www.wolframalpha.com/input/? - // i=Inverse+{{a%2C+c%2C+e}%2C+{b%2C+d%2C+f}%2C+{0%2C+0%2C+1}} - - var m = this._transformMatrix; - var a = m[0], b = m[1], c = m[2], d = m[3], e = m[4], f = m[5]; - - var ad_bc = a * d - b * c; - var bc_ad = b * c - a * d; - - 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() { - 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]; - canvasEntry.canvas.width = width; - canvasEntry.canvas.height = height; - // reset canvas transform for emulated mozCurrentTransform, if needed - canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0); + if (angle !== 0) { + m = [angleCos, angleSin, -angleSin, angleCos, left, top]; + b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m); } else { - var canvas = createScratchCanvas(width, height); - var ctx = canvas.getContext('2d'); - if (trackTransform) { - addContextCurrentTransform(ctx); - } - this.cache[id] = canvasEntry = {canvas: canvas, context: ctx}; - } - return canvasEntry; - }, - clear: function () { - for (var id in this.cache) { - var canvasEntry = this.cache[id]; - // Zeroing the width and height causes Firefox to release graphics - // resources immediately, which can greatly reduce memory consumption. - canvasEntry.canvas.width = 0; - canvasEntry.canvas.height = 0; - delete this.cache[id]; - } - } - }; - return CachedCanvases; -})(); - -function compileType3Glyph(imgData) { - var POINT_TO_PROCESS_LIMIT = 1000; - - var width = imgData.width, height = imgData.height; - var i, j, j0, width1 = width + 1; - var points = new Uint8Array(width1 * (height + 1)); - var POINT_TYPES = - new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]); - - // decodes bit-packed mask data - var lineSize = (width + 7) & ~7, data0 = imgData.data; - 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; - } - } - - // finding iteresting points: every point is located between mask pixels, - // so there will be points of the (width + 1)x(height + 1) grid. Every point - // will have flags assigned based on neighboring mask pixels: - // 4 | 8 - // --P-- - // 2 | 1 - // We are interested only in points with the flags: - // - outside corners: 1, 2, 4, 8; - // - inside corners: 7, 11, 13, 14; - // - and, intersections: 5, 10. - 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; - } - // 'sum' is the position of the current pixel configuration in the 'TYPES' - // array (in order 8-1-2-4, so we can use '>>2' to shift the column). - 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; - } - - // building outlines - 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) { - // set new direction - type = pp; - // delete mark - points[p] = 0; - } else { // type is 5 or 10, ie, a crossing - // set new direction - type = pp & ((0x33 * type) >> 4); - // set new type for "future hit" - points[p] &= (type >> 2 | type << 2); + b = [left, top, left + divWidth, top + divHeight]; } - coords.push(p % width1); - coords.push((p / width1) | 0); - --count; - } while (p0 !== p); - outlines.push(coords); - --i; + task._bounds.push({ + left: b[0], + top: b[1], + right: b[2], + bottom: b[3], + div: textDiv, + size: [divWidth, divHeight], + m: m + }); + } } - var drawOutline = function(c) { - c.save(); - // the path shall be painted in [0..1]x[0..1] space - 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]; - c.moveTo(o[0], o[1]); - for (var j = 2, jj = o.length; j < jj; j += 2) { - c.lineTo(o[j], o[j+1]); - } - } - c.fill(); - c.beginPath(); - c.restore(); - }; - - return drawOutline; -} - -var CanvasExtraState = (function CanvasExtraStateClosure() { - function CanvasExtraState(old) { - // Are soft masks and alpha values shapes or opacities? - this.alphaIsShape = false; - this.fontSize = 0; - this.fontSizeScale = 1; - this.textMatrix = IDENTITY_MATRIX; - this.textMatrixScale = 1; - this.fontMatrix = FONT_IDENTITY_MATRIX; - this.leading = 0; - // Current point (in user coordinates) - this.x = 0; - this.y = 0; - // Start of text line (in text coordinates) - this.lineX = 0; - this.lineY = 0; - // Character and word spacing - this.charSpacing = 0; - this.wordSpacing = 0; - this.textHScale = 1; - this.textRenderingMode = TextRenderingMode.FILL; - this.textRise = 0; - // Default fore and background colors - this.fillColor = '#000000'; - this.strokeColor = '#000000'; - this.patternFill = false; - // Note: fill alpha applies to all non-stroking operations - this.fillAlpha = 1; - this.strokeAlpha = 1; - this.lineWidth = 1; - this.activeSMask = null; // nonclonable field (see the save method below) - - this.old = old; - } - - CanvasExtraState.prototype = { - clone: function CanvasExtraState_clone() { - return Object.create(this); - }, - setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) { - this.x = x; - this.y = y; - } - }; - return CanvasExtraState; -})(); - -var CanvasGraphics = (function CanvasGraphicsClosure() { - // Defines the time the executeOperatorList is going to be executing - // before it stops and shedules a continue of execution. - var EXECUTION_TIME = 15; - // Defines the number of steps before checking the execution time - var EXECUTION_STEPS = 10; - - function CanvasGraphics(canvasCtx, commonObjs, objs, imageLayer) { - this.ctx = canvasCtx; - this.current = new CanvasExtraState(); - this.stateStack = []; - this.pendingClip = null; - this.pendingEOFill = false; - this.res = null; - this.xobjs = null; - this.commonObjs = commonObjs; - this.objs = objs; - this.imageLayer = imageLayer; - this.groupStack = []; - this.processingType3 = null; - // Patterns are painted relative to the initial page/form transform, see pdf - // spec 8.7.2 NOTE 1. - this.baseTransform = null; - this.baseTransformStack = []; - this.groupLevel = 0; - this.smaskStack = []; - this.smaskCounter = 0; - this.tempSMask = null; - this.cachedCanvases = new CachedCanvases(); - if (canvasCtx) { - // NOTE: if mozCurrentTransform is polyfilled, then the current state of - // the transformation must already be set in canvasCtx._transformMatrix. - addContextCurrentTransform(canvasCtx); - } - this.cachedGetSinglePixelWidth = null; - } - - function putBinaryImageData(ctx, imgData) { - if (typeof ImageData !== 'undefined' && imgData instanceof ImageData) { - ctx.putImageData(imgData, 0, 0); + function render(task) { + if (task._canceled) { return; } - // Put the image data to the canvas in chunks, rather than putting the - // whole image at once. This saves JS memory, because the ImageData object - // is smaller. It also possibly saves C++ memory within the implementation - // of putImageData(). (E.g. in Firefox we make two short-lived copies of - // the data passed to putImageData()). |n| shouldn't be too small, however, - // because too many putImageData() calls will slow things down. - // - // Note: as written, if the last chunk is partial, the putImageData() call - // will (conceptually) put pixels past the bounds of the canvas. But - // that's ok; any such pixels are ignored. + var textDivs = task._textDivs; + var capability = task._capability; + var textDivsLength = textDivs.length; - var height = imgData.height, width = imgData.width; - var partialChunkHeight = height % FULL_CHUNK_HEIGHT; - var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; - var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; - - var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); - var srcPos = 0, destPos; - var src = imgData.data; - var dest = chunkImgData.data; - var i, j, thisChunkHeight, elemsInThisChunk; - - // There are multiple forms in which the pixel data can be passed, and - // imgData.kind tells us which one this is. - if (imgData.kind === ImageKind.GRAYSCALE_1BPP) { - // Grayscale, 1 bit per pixel (i.e. black-and-white). - var srcLength = src.byteLength; - var dest32 = PDFJS.hasCanvasTypedArrays ? new Uint32Array(dest.buffer) : - new Uint32ArrayView(dest); - var dest32DataLength = dest32.length; - var fullSrcDiff = (width + 7) >> 3; - var white = 0xFFFFFFFF; - var black = (PDFJS.isLittleEndian || !PDFJS.hasCanvasTypedArrays) ? - 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; - var kEnd = (srcDiff > fullSrcDiff) ? width : srcDiff * 8 - 7; - var kEndUnrolled = kEnd & ~7; - var mask = 0; - var srcByte = 0; - for (; k < kEndUnrolled; k += 8) { - srcByte = src[srcPos++]; - dest32[destPos++] = (srcByte & 128) ? white : black; - dest32[destPos++] = (srcByte & 64) ? white : black; - dest32[destPos++] = (srcByte & 32) ? white : black; - dest32[destPos++] = (srcByte & 16) ? white : black; - dest32[destPos++] = (srcByte & 8) ? white : black; - dest32[destPos++] = (srcByte & 4) ? white : black; - 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; - } - } - // We ran out of input. Make all remaining pixels transparent. - while (destPos < dest32DataLength) { - dest32[destPos++] = 0; - } - - ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); - } - } else if (imgData.kind === ImageKind.RGBA_32BPP) { - // RGBA, 32-bits per pixel. - - 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)); - ctx.putImageData(chunkImgData, 0, j); - } - - } else if (imgData.kind === ImageKind.RGB_24BPP) { - // RGB, 24-bits per pixel. - 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 { - error('bad image kind: ' + imgData.kind); - } - } - - function putBinaryImageMask(ctx, imgData) { - var height = imgData.height, width = imgData.width; - var partialChunkHeight = height % FULL_CHUNK_HEIGHT; - var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; - var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; - - var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); - 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; - - // Expand the mask so it can be used by the canvas. Any required - // inversion has already been handled. - var destPos = 3; // alpha component offset - 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']; - 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; - } else if (sourceCtx.mozDashOffset !== undefined) { - destCtx.mozDash = sourceCtx.mozDash; - destCtx.mozDashOffset = sourceCtx.mozDashOffset; - } - } - - 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; - bytes[i - 1] = b0; - } else if (alpha < 255) { - var alpha_ = 255 - alpha; - bytes[i - 3] = (bytes[i - 3] * alpha + r0 * alpha_) >> 8; - bytes[i - 2] = (bytes[i - 2] * alpha + g0 * alpha_) >> 8; - bytes[i - 1] = (bytes[i - 1] * alpha + b0 * alpha_) >> 8; - } - } - } - - 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) + // * 0.3 / 255 * 0x10000 - (maskData[i - 2] * 152) + // * 0.59 .... - (maskData[i - 1] * 28); // * 0.11 .... - 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') { - composeFn = composeSMaskLuminosity; - } else { - composeFn = composeSMaskAlpha; - } - - // processing image in chunks to save memory - 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) { - 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 && WebGLUtils.isEnabled) { - var composed = WebGLUtils.composeSMask(layerCtx.canvas, mask, - {subtype: smask.subtype, backdrop: backdrop}); - ctx.setTransform(1, 0, 0, 1, 0, 0); - ctx.drawImage(composed, smask.offsetX, smask.offsetY); + if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) { + task._renderingDone = true; + capability.resolve(); return; } - genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height, - smask.subtype, backdrop, smask.transferMap); - ctx.drawImage(mask, 0, 0); + + if (!task._textContentStream) { + for (var i = 0; i < textDivsLength; i++) { + task._layoutText(textDivs[i]); + } + } + + task._renderingDone = true; + capability.resolve(); } - var LINE_CAP_STYLES = ['butt', 'round', 'square']; - var LINE_JOIN_STYLES = ['miter', 'round', 'bevel']; - var NORMAL_CLIP = {}; - var EO_CLIP = {}; + function expand(task) { + var bounds = task._bounds; + var viewport = task._viewport; + var expanded = expandBounds(viewport.width, viewport.height, bounds); - CanvasGraphics.prototype = { + for (var i = 0; i < expanded.length; i++) { + var div = bounds[i].div; - beginDrawing: function CanvasGraphics_beginDrawing(transform, viewport, - transparency) { - // For pdfs that use blend modes we have to clear the canvas else certain - // blend modes can look wrong since we'd be blending with a white - // backdrop. The problem with a transparent backdrop though is we then - // don't get sub pixel anti aliasing on text, creating temporary - // transparent canvas when we have blend modes. - var width = this.ctx.canvas.width; - var height = this.ctx.canvas.height; + var divProperties = task._textDivProperties.get(div); - this.ctx.save(); - this.ctx.fillStyle = 'rgb(255, 255, 255)'; - this.ctx.fillRect(0, 0, width, height); - this.ctx.restore(); + 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; - if (transparency) { - var transparentCanvas = this.cachedCanvases.getCanvas( - 'transparent', width, height, true); - this.compositeCtx = this.ctx; - this.transparentCanvas = transparentCanvas.canvas; - this.ctx = transparentCanvas.context; - this.ctx.save(); - // The transform can be applied before rendering, transferring it to - // the new canvas. - this.ctx.transform.apply(this.ctx, - this.compositeCtx.mozCurrentTransform); + task._textDivProperties.set(div, divProperties); + + continue; } - this.ctx.save(); - if (transform) { - this.ctx.transform.apply(this.ctx, transform); - } - this.ctx.transform.apply(this.ctx, viewport.transform); + 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); - this.baseTransform = this.ctx.mozCurrentTransform.slice(); + 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; + }); - if (this.imageLayer) { - this.imageLayer.beginLayout(); - } - }, + var findPositiveMin = function findPositiveMin(ts, offset, count) { + var result = 0; - executeOperatorList: function CanvasGraphics_executeOperatorList( - operatorList, - executionStartIdx, continueCallback, - stepper) { - var argsArray = operatorList.argsArray; - var fnArray = operatorList.fnArray; - var i = executionStartIdx || 0; - var argsArrayLen = argsArray.length; + for (var i = 0; i < count; i++) { + var t = ts[offset++]; - // Sometimes the OperatorList to execute is empty. - if (argsArrayLen === i) { - return i; - } - - 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 !== 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 the promise isn't resolved yet, add the continueCallback - // to the promise and bail out. - if (!objsPool.isResolved(depObjId)) { - objsPool.get(depObjId, continueCallback); - return i; - } + if (t > 0) { + result = result ? Math.min(t, result) : t; } } + 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 the entire operatorList was executed, stop as were done. - if (i === argsArrayLen) { - return i; - } - - // If the execution took longer then a certain amount of time and - // `continueCallback` is specified, interrupt the execution. - if (chunkOperations && ++steps > EXECUTION_STEPS) { - if (Date.now() > endTime) { - continueCallback(); - return i; - } - steps = 0; - } - - // If the operatorList isn't executed completely yet OR the execution - // time was short enough, do another execution round. - } - }, - - endDrawing: function CanvasGraphics_endDrawing() { - this.ctx.restore(); - - if (this.transparentCanvas) { - this.ctx = this.compositeCtx; - this.ctx.drawImage(this.transparentCanvas, 0, 0); - this.transparentCanvas = null; } - this.cachedCanvases.clear(); - WebGLUtils.clear(); + var j = horizon.length - 1; - if (this.imageLayer) { - this.imageLayer.endLayout(); - } - }, - - // Graphics state - setLineWidth: function CanvasGraphics_setLineWidth(width) { - this.current.lineWidth = width; - this.ctx.lineWidth = width; - }, - setLineCap: function CanvasGraphics_setLineCap(style) { - this.ctx.lineCap = LINE_CAP_STYLES[style]; - }, - setLineJoin: function CanvasGraphics_setLineJoin(style) { - this.ctx.lineJoin = LINE_JOIN_STYLES[style]; - }, - setMiterLimit: function CanvasGraphics_setMiterLimit(limit) { - this.ctx.miterLimit = limit; - }, - setDash: function CanvasGraphics_setDash(dashArray, dashPhase) { - var ctx = this.ctx; - if (ctx.setLineDash !== undefined) { - ctx.setLineDash(dashArray); - ctx.lineDashOffset = dashPhase; - } else { - ctx.mozDash = dashArray; - ctx.mozDashOffset = dashPhase; - } - }, - setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) { - // Maybe if we one day fully support color spaces this will be important - // for now we can ignore. - // TODO set rendering intent? - }, - setFlatness: function CanvasGraphics_setFlatness(flatness) { - // There's no way to control this with canvas, but we can safely ignore. - // TODO set 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': - 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[0], value[1]); - break; - case 'CA': - this.current.strokeAlpha = state[1]; - break; - case 'ca': - this.current.fillAlpha = state[1]; - this.ctx.globalAlpha = state[1]; - break; - case 'BM': - if (value && value.name && (value.name !== 'Normal')) { - var mode = value.name.replace(/([A-Z])/g, - function(c) { - return '-' + c.toLowerCase(); - } - ).substring(1); - this.ctx.globalCompositeOperation = mode; - if (this.ctx.globalCompositeOperation !== mode) { - warn('globalCompositeOperation "' + mode + - '" is not supported'); - } - } else { - this.ctx.globalCompositeOperation = 'source-over'; - } - break; - case 'SMask': - if (this.current.activeSMask) { - this.endSMaskGroup(); - } - this.current.activeSMask = value ? this.tempSMask : null; - if (this.current.activeSMask) { - this.beginSMaskGroup(); - } - this.tempSMask = null; - break; - } - } - }, - beginSMaskGroup: function CanvasGraphics_beginSMaskGroup() { - - var activeSMask = this.current.activeSMask; - var drawnWidth = activeSMask.canvas.width; - var drawnHeight = activeSMask.canvas.height; - var cacheId = 'smaskGroupAt' + this.groupLevel; - var scratchCanvas = this.cachedCanvases.getCanvas( - cacheId, drawnWidth, drawnHeight, true); - - var currentCtx = this.ctx; - var currentTransform = currentCtx.mozCurrentTransform; - this.ctx.save(); - - var groupCtx = scratchCanvas.context; - groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY); - groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY); - groupCtx.transform.apply(groupCtx, currentTransform); - - copyCtxState(currentCtx, groupCtx); - this.ctx = groupCtx; - this.setGState([ - ['BM', 'Normal'], - ['ca', 1], - ['CA', 1] - ]); - this.groupStack.push(currentCtx); - this.groupLevel++; - }, - endSMaskGroup: function CanvasGraphics_endSMaskGroup() { - var groupCtx = this.ctx; - this.groupLevel--; - this.ctx = this.groupStack.pop(); - - composeSMask(this.ctx, this.current.activeSMask, groupCtx); - this.ctx.restore(); - copyCtxState(groupCtx, this.ctx); - }, - save: function CanvasGraphics_save() { - this.ctx.save(); - var old = this.current; - this.stateStack.push(old); - this.current = old.clone(); - this.current.activeSMask = null; - }, - restore: function CanvasGraphics_restore() { - if (this.stateStack.length !== 0) { - if (this.current.activeSMask !== null) { - this.endSMaskGroup(); - } - - this.current = this.stateStack.pop(); - this.ctx.restore(); - - // Ensure that the clipping path is reset (fixes issue6413.pdf). - this.pendingClip = null; - - this.cachedGetSinglePixelWidth = null; - } - }, - transform: function CanvasGraphics_transform(a, b, c, d, e, f) { - this.ctx.transform(a, b, c, d, e, f); - - this.cachedGetSinglePixelWidth = null; - }, - - // Path - constructPath: function CanvasGraphics_constructPath(ops, args) { - var ctx = this.ctx; - 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 OPS.rectangle: - x = args[j++]; - 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); - this.ctx.lineTo(xw, y); - this.ctx.lineTo(xw, yh); - this.ctx.lineTo(x, yh); - this.ctx.lineTo(x, y); - this.ctx.closePath(); - break; - case OPS.moveTo: - x = args[j++]; - y = args[j++]; - ctx.moveTo(x, y); - break; - case OPS.lineTo: - x = args[j++]; - y = args[j++]; - ctx.lineTo(x, y); - break; - case 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 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 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 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; - var ctx = this.ctx; - var strokeColor = this.current.strokeColor; - // Prevent drawing too thin lines by enforcing a minimum line width. - ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, - this.current.lineWidth); - // For stroke we want to temporarily change the global alpha to the - // stroking alpha. - ctx.globalAlpha = this.current.strokeAlpha; - if (strokeColor && strokeColor.hasOwnProperty('type') && - strokeColor.type === 'Pattern') { - // for patterns, we transform to pattern space, calculate - // the pattern, call stroke, and restore to user space - ctx.save(); - ctx.strokeStyle = strokeColor.getPattern(ctx, this); - ctx.stroke(); - ctx.restore(); - } else { - ctx.stroke(); - } - if (consumePath) { - this.consumePath(); - } - // Restore the global alpha to the fill alpha - ctx.globalAlpha = this.current.fillAlpha; - }, - closeStroke: function CanvasGraphics_closeStroke() { - this.closePath(); - this.stroke(); - }, - fill: function CanvasGraphics_fill(consumePath) { - 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; + while (j >= 0 && horizon[j].start >= boundary.y2) { + j--; } - if (this.pendingEOFill) { - if (ctx.mozFillRule !== undefined) { - ctx.mozFillRule = 'evenodd'; - ctx.fill(); - ctx.mozFillRule = 'nonzero'; + 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 { - ctx.fill('evenodd'); + xNew = affectedBoundary.x2New; } - this.pendingEOFill = false; - } else { - ctx.fill(); - } - if (needRestore) { - ctx.restore(); - } - if (consumePath) { - this.consumePath(); - } - }, - eoFill: function CanvasGraphics_eoFill() { - this.pendingEOFill = true; - this.fill(); - }, - fillStroke: function CanvasGraphics_fillStroke() { - this.fill(false); - this.stroke(false); - - this.consumePath(); - }, - eoFillStroke: function CanvasGraphics_eoFillStroke() { - this.pendingEOFill = true; - this.fillStroke(); - }, - closeFillStroke: function CanvasGraphics_closeFillStroke() { - this.closePath(); - this.fillStroke(); - }, - closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() { - this.pendingEOFill = true; - this.closePath(); - this.fillStroke(); - }, - endPath: function CanvasGraphics_endPath() { - this.consumePath(); - }, - - // Clipping - clip: function CanvasGraphics_clip() { - this.pendingClip = NORMAL_CLIP; - }, - eoClip: function CanvasGraphics_eoClip() { - this.pendingClip = EO_CLIP; - }, - - // Text - beginText: function CanvasGraphics_beginText() { - this.current.textMatrix = IDENTITY_MATRIX; - this.current.textMatrixScale = 1; - this.current.x = this.current.lineX = 0; - this.current.y = this.current.lineY = 0; - }, - 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(); - delete this.pendingTextPaths; - }, - setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) { - this.current.charSpacing = spacing; - }, - setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) { - this.current.wordSpacing = spacing; - }, - setHScale: function CanvasGraphics_setHScale(scale) { - this.current.textHScale = scale / 100; - }, - setLeading: function CanvasGraphics_setLeading(leading) { - this.current.leading = -leading; - }, - setFont: function CanvasGraphics_setFont(fontRefName, size) { - var fontObj = this.commonObjs.get(fontRefName); - var current = this.current; - - if (!fontObj) { - error('Can\'t find font for ' + fontRefName); - } - - current.fontMatrix = (fontObj.fontMatrix ? - fontObj.fontMatrix : FONT_IDENTITY_MATRIX); - - // A valid matrix needs all main diagonal elements to be non-zero - // This also ensures we bypass FF bugzilla bug #719844. - if (current.fontMatrix[0] === 0 || - current.fontMatrix[3] === 0) { - warn('Invalid font matrix for font ' + fontRefName); - } - - // The spec for Tf (setFont) says that 'size' specifies the font 'scale', - // and in some docs this can be negative (inverted x-y axes). - if (size < 0) { - size = -size; - current.fontDirection = -1; - } else { - current.fontDirection = 1; - } - - this.current.font = fontObj; - this.current.fontSize = size; - - if (fontObj.isType3Font) { - return; // we don't need ctx.font for Type3 fonts - } - - var name = fontObj.loadedName || 'sans-serif'; - var bold = fontObj.black ? (fontObj.bold ? '900' : 'bold') : - (fontObj.bold ? 'bold' : 'normal'); - - var italic = fontObj.italic ? 'italic' : 'normal'; - var typeface = '"' + name + '", ' + fontObj.fallbackName; - - // Some font backends cannot handle fonts below certain size. - // Keeping the font at minimal size and using the fontSizeScale to change - // the current transformation matrix before the fillText/strokeText. - // See https://bugzilla.mozilla.org/show_bug.cgi?id=726227 - var browserFontSize = size < MIN_FONT_SIZE ? MIN_FONT_SIZE : - size > MAX_FONT_SIZE ? MAX_FONT_SIZE : size; - this.current.fontSizeScale = size / browserFontSize; - - var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface; - this.ctx.font = rule; - }, - setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) { - this.current.textRenderingMode = mode; - }, - setTextRise: function CanvasGraphics_setTextRise(rise) { - this.current.textRise = rise; - }, - moveText: function CanvasGraphics_moveText(x, y) { - this.current.x = this.current.lineX += x; - this.current.y = this.current.lineY += y; - }, - setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) { - this.setLeading(-y); - this.moveText(x, y); - }, - setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) { - this.current.textMatrix = [a, b, c, d, e, f]; - this.current.textMatrixScale = Math.sqrt(a * a + b * b); - - this.current.x = this.current.lineX = 0; - this.current.y = this.current.lineY = 0; - }, - nextLine: function CanvasGraphics_nextLine() { - this.moveText(0, this.current.leading); - }, - - paintChar: function CanvasGraphics_paintChar(character, x, y) { - var ctx = this.ctx; - var current = this.current; - var font = current.font; - var textRenderingMode = current.textRenderingMode; - var fontSize = current.fontSize / current.fontSizeScale; - var fillStrokeMode = textRenderingMode & - TextRenderingMode.FILL_STROKE_MASK; - var isAddToPathSet = !!(textRenderingMode & - TextRenderingMode.ADD_TO_PATH_FLAG); - - var addToPath; - if (font.disableFontFace || isAddToPathSet) { - addToPath = font.getPathGenerator(this.commonObjs, character); - } - - if (font.disableFontFace) { - ctx.save(); - ctx.translate(x, y); - ctx.beginPath(); - addToPath(ctx, fontSize); - if (fillStrokeMode === TextRenderingMode.FILL || - fillStrokeMode === TextRenderingMode.FILL_STROKE) { - ctx.fill(); - } - if (fillStrokeMode === TextRenderingMode.STROKE || - fillStrokeMode === TextRenderingMode.FILL_STROKE) { - ctx.stroke(); - } - ctx.restore(); - } else { - if (fillStrokeMode === TextRenderingMode.FILL || - fillStrokeMode === TextRenderingMode.FILL_STROKE) { - ctx.fillText(character, x, y); - } - if (fillStrokeMode === TextRenderingMode.STROKE || - fillStrokeMode === TextRenderingMode.FILL_STROKE) { - ctx.strokeText(character, x, y); + if (xNew > maxXNew) { + maxXNew = xNew; } } - if (isAddToPathSet) { - var paths = this.pendingTextPaths || (this.pendingTextPaths = []); - paths.push({ - transform: ctx.mozCurrentTransform, - x: x, - y: y, - fontSize: fontSize, - addToPath: addToPath - }); - } - }, + boundary.x1New = maxXNew; - get isFontSubpixelAAEnabled() { - // Checks if anti-aliasing is enabled when scaled text is painted. - // On Windows GDI scaled fonts looks bad. - var ctx = document.createElement('canvas').getContext('2d'); - ctx.scale(1.5, 1); - 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 shadow(this, 'isFontSubpixelAAEnabled', enabled); - }, + for (q = i; q <= j; q++) { + horizonPart = horizon[q]; + affectedBoundary = horizonPart.boundary; - 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; - } - - var ctx = this.ctx; - var fontSizeScale = current.fontSizeScale; - 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 spacingDir = vertical ? 1 : -1; - var defaultVMetrics = font.defaultVMetrics; - var widthAdvanceScale = fontSize * current.fontMatrix[0]; - - var simpleFillText = - current.textRenderingMode === TextRenderingMode.FILL && - !font.disableFontFace; - - ctx.save(); - ctx.transform.apply(ctx, current.textMatrix); - ctx.translate(current.x, current.y + current.textRise); - - if (current.patternFill) { - // TODO: Some shading patterns are not applied correctly to text, - // e.g. issues 3988 and 5432, and ShowText-ShadingPattern.pdf. - ctx.fillStyle = current.fillColor.getPattern(ctx, this); - } - - 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 & - TextRenderingMode.FILL_STROKE_MASK; - if (fillStrokeMode === TextRenderingMode.STROKE || - fillStrokeMode === TextRenderingMode.FILL_STROKE) { - this.cachedGetSinglePixelWidth = null; - lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR; - } - } 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 (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; - vx = glyph.vmetric ? vmetric[1] : width * 0.5; - vx = -vx * widthAdvanceScale; - vy = vmetric[2] * widthAdvanceScale; - - width = vmetric ? -vmetric[0] : width; - scaledX = vx / fontSizeScale; - scaledY = (x + vy) / fontSizeScale; - } else { - scaledX = x / fontSizeScale; - scaledY = 0; - } - - if (font.remeasure && width > 0) { - // Some standard fonts may not have the exact width: rescale per - // character if measured width is greater than expected glyph width - // and subpixel-aa is enabled, otherwise just center the glyph. - var measuredWidth = ctx.measureText(character).width * 1000 / - fontSize * fontSizeScale; - if (width < measuredWidth && this.isFontSubpixelAAEnabled) { - var characterScaleX = width / measuredWidth; - restoreNeeded = true; - ctx.save(); - ctx.scale(characterScaleX, 1); - scaledX /= characterScaleX; - } else if (width !== measuredWidth) { - scaledX += (width - measuredWidth) / 2000 * - fontSize / fontSizeScale; - } - } - - if (simpleFillText && !accent) { - // common case - ctx.fillText(character, scaledX, scaledY); - } else { - this.paintChar(character, scaledX, scaledY); - if (accent) { - scaledAccentX = scaledX + accent.offset.x / fontSizeScale; - scaledAccentY = scaledY - accent.offset.y / fontSizeScale; - this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY); - } - } - - var charWidth = width * widthAdvanceScale + spacing * fontDirection; - x += charWidth; - - if (restoreNeeded) { - ctx.restore(); - } - } - if (vertical) { - current.y -= x * textHScale; - } else { - current.x += x * textHScale; - } - ctx.restore(); - }, - - showType3Text: function CanvasGraphics_showType3Text(glyphs) { - // Type3 fonts - each glyph is a "mini-PDF" - var ctx = this.ctx; - var current = this.current; - var font = current.font; - var fontSize = current.fontSize; - var fontDirection = current.fontDirection; - var spacingDir = font.vertical ? 1 : -1; - var charSpacing = current.charSpacing; - var wordSpacing = current.wordSpacing; - var textHScale = current.textHScale * fontDirection; - var fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX; - var glyphsLength = glyphs.length; - var isTextInvisible = - current.textRenderingMode === 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 (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) { - warn('Type3 character \"' + 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.applyTransform([glyph.width, 0], fontMatrix); - width = transformed[0] * fontSize + spacing; - - ctx.translate(width, 0); - current.x += width * textHScale; - } - ctx.restore(); - this.processingType3 = null; - }, - - // Type3 fonts - setCharWidth: function CanvasGraphics_setCharWidth(xWidth, yWidth) { - // We can safely ignore this since the width should be the same - // as the width in the Widths array. - }, - setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(xWidth, - yWidth, - llx, - lly, - urx, - ury) { - // TODO According to the spec we're also suppose to ignore any operators - // that set color or include images while processing this type3 font. - this.ctx.rect(llx, lly, urx - llx, ury - lly); - this.clip(); - this.endPath(); - }, - - // Color - getColorN_Pattern: function CanvasGraphics_getColorN_Pattern(IR) { - var pattern; - if (IR[0] === 'TilingPattern') { - var color = IR[1]; - var baseTransform = this.baseTransform || - this.ctx.mozCurrentTransform.slice(); - var self = this; - var canvasGraphicsFactory = { - createCanvasGraphics: function (ctx) { - return new CanvasGraphics(ctx, self.commonObjs, self.objs); - } - }; - pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, - baseTransform); - } else { - pattern = getShadingPatternFromIR(IR); - } - return pattern; - }, - setStrokeColorN: function CanvasGraphics_setStrokeColorN(/*...*/) { - this.current.strokeColor = this.getColorN_Pattern(arguments); - }, - setFillColorN: function CanvasGraphics_setFillColorN(/*...*/) { - this.current.fillColor = this.getColorN_Pattern(arguments); - this.current.patternFill = true; - }, - setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) { - var color = Util.makeCssRgb(r, g, b); - this.ctx.strokeStyle = color; - this.current.strokeColor = color; - }, - setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) { - var color = Util.makeCssRgb(r, g, b); - this.ctx.fillStyle = color; - this.current.fillColor = color; - this.current.patternFill = false; - }, - - shadingFill: function CanvasGraphics_shadingFill(patternIR) { - var ctx = this.ctx; - - this.save(); - var pattern = 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.applyTransform([0, 0], inv); - var br = Util.applyTransform([0, height], inv); - var ul = Util.applyTransform([width, 0], inv); - var ur = 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]); - - this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0); - } else { - // HACK to draw the gradient onto an infinite rectangle. - // PDF gradients are drawn across the entire image while - // Canvas only allows gradients to be drawn in a rectangle - // The following bug should allow us to remove this. - // https://bugzilla.mozilla.org/show_bug.cgi?id=664884 - - this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10); - } - - this.restore(); - }, - - // Images - beginInlineImage: function CanvasGraphics_beginInlineImage() { - error('Should not call beginInlineImage'); - }, - beginImageData: function CanvasGraphics_beginImageData() { - error('Should not call beginImageData'); - }, - - paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix, - bbox) { - this.save(); - this.baseTransformStack.push(this.baseTransform); - - if (isArray(matrix) && 6 === matrix.length) { - this.transform.apply(this, matrix); - } - - this.baseTransform = this.ctx.mozCurrentTransform; - - if (isArray(bbox) && 4 === bbox.length) { - var width = bbox[2] - bbox[0]; - var height = bbox[3] - bbox[1]; - this.ctx.rect(bbox[0], bbox[1], width, height); - this.clip(); - this.endPath(); - } - }, - - paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() { - this.restore(); - this.baseTransform = this.baseTransformStack.pop(); - }, - - beginGroup: function CanvasGraphics_beginGroup(group) { - this.save(); - var currentCtx = this.ctx; - // TODO non-isolated groups - according to Rik at adobe non-isolated - // group results aren't usually that different and they even have tools - // that ignore this setting. Notes from Rik on implmenting: - // - When you encounter an transparency group, create a new canvas with - // the dimensions of the bbox - // - copy the content from the previous canvas to the new canvas - // - draw as usual - // - remove the backdrop alpha: - // alphaNew = 1 - (1 - alpha)/(1 - alphaBackdrop) with 'alpha' the alpha - // value of your transparency group and 'alphaBackdrop' the alpha of the - // backdrop - // - remove background color: - // colorNew = color - alphaNew *colorBackdrop /(1 - alphaNew) - if (!group.isolated) { - info('TODO: Support non-isolated groups.'); - } - - // TODO knockout - supposedly possible with the clever use of compositing - // modes. - if (group.knockout) { - warn('Knockout groups not supported.'); - } - - var currentTransform = currentCtx.mozCurrentTransform; - if (group.matrix) { - currentCtx.transform.apply(currentCtx, group.matrix); - } - assert(group.bbox, 'Bounding box is required.'); - - // Based on the current transform figure out how big the bounding box - // will actually be. - var bounds = Util.getAxialAlignedBoundingBox( - group.bbox, - currentCtx.mozCurrentTransform); - // Clip the bounding box to the current canvas. - var canvasBounds = [0, - 0, - currentCtx.canvas.width, - currentCtx.canvas.height]; - bounds = Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0]; - // Use ceil in case we're between sizes so we don't create canvas that is - // too small and make the canvas at least 1x1 pixels. - var offsetX = Math.floor(bounds[0]); - var offsetY = Math.floor(bounds[1]); - var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1); - 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; - if (group.smask) { - // Using two cache entries is case if masks are used one after another. - cacheId += '_smask_' + ((this.smaskCounter++) % 2); - } - var scratchCanvas = this.cachedCanvases.getCanvas( - cacheId, drawnWidth, drawnHeight, true); - var groupCtx = scratchCanvas.context; - - // Since we created a new canvas that is just the size of the bounding box - // we have to translate the group ctx. - groupCtx.scale(1 / scaleX, 1 / scaleY); - groupCtx.translate(-offsetX, -offsetY); - groupCtx.transform.apply(groupCtx, currentTransform); - - if (group.smask) { - // Saving state and cached mask to be used in setGState. - this.smaskStack.push({ - canvas: scratchCanvas.canvas, - context: groupCtx, - offsetX: offsetX, - offsetY: offsetY, - scaleX: scaleX, - scaleY: scaleY, - subtype: group.smask.subtype, - backdrop: group.smask.backdrop, - transferMap: group.smask.transferMap || null - }); - } else { - // Setup the current ctx so when the group is popped we draw it at the - // right location. - currentCtx.setTransform(1, 0, 0, 1, 0, 0); - currentCtx.translate(offsetX, offsetY); - currentCtx.scale(scaleX, scaleY); - } - // The transparency group inherits all off the current graphics state - // except the blend mode, soft mask, and alpha constants. - copyCtxState(currentCtx, groupCtx); - this.ctx = groupCtx; - this.setGState([ - ['BM', 'Normal'], - ['ca', 1], - ['CA', 1] - ]); - this.groupStack.push(currentCtx); - this.groupLevel++; - }, - - endGroup: function CanvasGraphics_endGroup(group) { - this.groupLevel--; - var groupCtx = this.ctx; - this.ctx = this.groupStack.pop(); - // Turn off image smoothing to avoid sub pixel interpolation which can - // look kind of blurry for some pdfs. - 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(); - this.current = new CanvasExtraState(); - - if (this.baseTransform) { - this.ctx.setTransform.apply(this.ctx, this.baseTransform); - } - }, - - endAnnotations: function CanvasGraphics_endAnnotations() { - this.restore(); - }, - - beginAnnotation: function CanvasGraphics_beginAnnotation(rect, transform, - matrix) { - this.save(); - - if (isArray(rect) && 4 === rect.length) { - var width = rect[2] - rect[0]; - var height = rect[3] - rect[1]; - this.ctx.rect(rect[0], rect[1], width, height); - 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) { - warn('Dependent image isn\'t ready yet'); - return; - } - - this.save(); - - var ctx = this.ctx; - // scale the image to the unit square - 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, height = img.height; - 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({data: img.data, width: width, height: height}); - } else { - glyph.compiled = null; - } - } - - if (glyph && glyph.compiled) { - glyph.compiled(ctx); - return; - } - - var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', - width, height); - var maskCtx = maskCanvas.context; - maskCtx.save(); - - putBinaryImageMask(maskCtx, img); - - maskCtx.globalCompositeOperation = 'source-in'; - - maskCtx.fillStyle = isPatternFill ? - fillColor.getPattern(maskCtx, this) : fillColor; - maskCtx.fillRect(0, 0, width, height); - - maskCtx.restore(); - - this.paintInlineImageXObject(maskCanvas.canvas); - }, - - paintImageMaskXObjectRepeat: - function CanvasGraphics_paintImageMaskXObjectRepeat(imgData, scaleX, - scaleY, positions) { - var width = imgData.width; - var height = imgData.height; - var fillColor = this.current.fillColor; - var isPatternFill = this.current.patternFill; - - var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', - width, height); - var maskCtx = maskCanvas.context; - maskCtx.save(); - - putBinaryImageMask(maskCtx, imgData); - - 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]); - ctx.scale(1, -1); - ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, - 0, -1, 1, 1); - ctx.restore(); - } - }, - - paintImageMaskXObjectGroup: - function CanvasGraphics_paintImageMaskXObjectGroup(images) { - 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 maskCtx = maskCanvas.context; - maskCtx.save(); - - putBinaryImageMask(maskCtx, image); - - maskCtx.globalCompositeOperation = 'source-in'; - - maskCtx.fillStyle = isPatternFill ? - fillColor.getPattern(maskCtx, this) : fillColor; - maskCtx.fillRect(0, 0, width, height); - - maskCtx.restore(); - - ctx.save(); - ctx.transform.apply(ctx, image.transform); - ctx.scale(1, -1); - ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, - 0, -1, 1, 1); - ctx.restore(); - } - }, - - paintImageXObject: function CanvasGraphics_paintImageXObject(objId) { - var imgData = this.objs.get(objId); - if (!imgData) { - 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); - if (!imgData) { - 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]], x: 0, y: 0, w: width, h: height}); - } - this.paintInlineImageXObjectGroup(imgData, map); - }, - - paintInlineImageXObject: - function CanvasGraphics_paintInlineImageXObject(imgData) { - var width = imgData.width; - var height = imgData.height; - var ctx = this.ctx; - - this.save(); - // scale the image to the unit square - ctx.scale(1 / width, -1 / height); - - var currentTransform = ctx.mozCurrentTransformInverse; - var a = currentTransform[0], b = currentTransform[1]; - var widthScale = Math.max(Math.sqrt(a * a + b * b), 1); - var c = currentTransform[2], d = currentTransform[3]; - var heightScale = Math.max(Math.sqrt(c * c + d * d), 1); - - var imgToPaint, tmpCanvas; - // instanceof HTMLElement does not work in jsdom node.js module - if (imgData instanceof HTMLElement || !imgData.data) { - imgToPaint = imgData; - } else { - 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'; - // Vertial or horizontal scaling shall not be more than 2 to not loose the - // pixels during drawImage operation, painting on the temporary canvas(es) - // that are twice smaller in size - 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); - tmpCtx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, - 0, 0, newWidth, newHeight); - imgToPaint = tmpCanvas.canvas; - paintWidth = newWidth; - paintHeight = newHeight; - 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({ - imgData: imgData, - left: position[0], - top: position[1], - width: width / currentTransform[0], - height: height / currentTransform[3] - }); - } - 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() { - warn('Unsupported \'paintXObject\' command.'); - }, - - // Marked content - - markPoint: function CanvasGraphics_markPoint(tag) { - // TODO Marked content. - }, - markPointProps: function CanvasGraphics_markPointProps(tag, properties) { - // TODO Marked content. - }, - beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) { - // TODO Marked content. - }, - beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps( - tag, properties) { - // TODO Marked content. - }, - endMarkedContent: function CanvasGraphics_endMarkedContent() { - // TODO Marked content. - }, - - // Compatibility - - beginCompat: function CanvasGraphics_beginCompat() { - // TODO ignore undefined operators (should we do that anyway?) - }, - endCompat: function CanvasGraphics_endCompat() { - // TODO stop ignoring undefined operators - }, - - // Helper functions - - consumePath: function CanvasGraphics_consumePath() { - var ctx = this.ctx; - if (this.pendingClip) { - if (this.pendingClip === EO_CLIP) { - if (ctx.mozFillRule !== undefined) { - ctx.mozFillRule = 'evenodd'; - ctx.clip(); - ctx.mozFillRule = 'nonzero'; + if (affectedBoundary.x2New === undefined) { + if (affectedBoundary.x2 > boundary.x1) { + if (affectedBoundary.index > boundary.index) { + affectedBoundary.x2New = affectedBoundary.x2; + } } else { - ctx.clip('evenodd'); + affectedBoundary.x2New = maxXNew; } - } else { - ctx.clip(); + } else if (affectedBoundary.x2New > maxXNew) { + affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2); } - this.pendingClip = null; } - ctx.beginPath(); - }, - getSinglePixelWidth: function CanvasGraphics_getSinglePixelWidth(scale) { - if (this.cachedGetSinglePixelWidth === null) { - var inverse = this.ctx.mozCurrentTransformInverse; - // max of the current horizontal and vertical scale - this.cachedGetSinglePixelWidth = Math.sqrt(Math.max( - (inverse[0] * inverse[0] + inverse[1] * inverse[1]), - (inverse[2] * inverse[2] + inverse[3] * inverse[3]))); + + 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; + } } - 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 OPS) { - CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op]; - } - - return CanvasGraphics; -})(); - -exports.CanvasGraphics = CanvasGraphics; -exports.createScratchCanvas = createScratchCanvas; -})); - - -(function (root, factory) { - { - factory((root.pdfjsDisplayAPI = {}), root.pdfjsSharedUtil, - root.pdfjsDisplayFontLoader, root.pdfjsDisplayCanvas, - root.pdfjsDisplayMetadata, root.pdfjsSharedGlobal); - } -}(this, function (exports, sharedUtil, displayFontLoader, displayCanvas, - displayMetadata, sharedGlobal, amdRequire) { - -var InvalidPDFException = sharedUtil.InvalidPDFException; -var MessageHandler = sharedUtil.MessageHandler; -var MissingPDFException = sharedUtil.MissingPDFException; -var PasswordResponses = sharedUtil.PasswordResponses; -var PasswordException = sharedUtil.PasswordException; -var StatTimer = sharedUtil.StatTimer; -var UnexpectedResponseException = sharedUtil.UnexpectedResponseException; -var UnknownErrorException = sharedUtil.UnknownErrorException; -var Util = sharedUtil.Util; -var createPromiseCapability = sharedUtil.createPromiseCapability; -var combineUrl = sharedUtil.combineUrl; -var error = sharedUtil.error; -var deprecated = sharedUtil.deprecated; -var info = sharedUtil.info; -var isArrayBuffer = sharedUtil.isArrayBuffer; -var loadJpegStream = sharedUtil.loadJpegStream; -var stringToBytes = sharedUtil.stringToBytes; -var warn = sharedUtil.warn; -var FontFaceObject = displayFontLoader.FontFaceObject; -var FontLoader = displayFontLoader.FontLoader; -var CanvasGraphics = displayCanvas.CanvasGraphics; -var createScratchCanvas = displayCanvas.createScratchCanvas; -var Metadata = displayMetadata.Metadata; -var PDFJS = sharedGlobal.PDFJS; -var globalScope = sharedGlobal.globalScope; - -var DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536 - - -var useRequireEnsure = false; -if (typeof module !== 'undefined' && module.require) { - // node.js - disable worker and set require.ensure. - PDFJS.disableWorker = true; - if (typeof require.ensure === 'undefined') { - require.ensure = require('node-ensure'); - } - useRequireEnsure = true; -} -if (typeof __webpack_require__ !== 'undefined') { - // Webpack - get/bundle pdf.worker.js as additional file. - PDFJS.workerSrc = require('entry?name=[hash]-worker.js!./pdf.worker.js'); - useRequireEnsure = true; -} -if (typeof requirejs !== 'undefined' && requirejs.toUrl) { - PDFJS.workerSrc = requirejs.toUrl('pdfjs-dist/build/pdf.worker.js'); -} -var fakeWorkerFilesLoader = useRequireEnsure ? (function (callback) { - require.ensure([], function () { - require('./pdf.worker.js'); - callback(); - }); -}) : (typeof requirejs !== 'undefined') ? (function (callback) { - requirejs(['pdfjs-dist/build/pdf.worker'], function (worker) { - callback(); - }); -}) : null; - - -/** - * The maximum allowed image size in total pixels e.g. width * height. Images - * above this value will not be drawn. Use -1 for no limit. - * @var {number} - */ -PDFJS.maxImageSize = (PDFJS.maxImageSize === undefined ? - -1 : PDFJS.maxImageSize); - -/** - * The url of where the predefined Adobe CMaps are located. Include trailing - * slash. - * @var {string} - */ -PDFJS.cMapUrl = (PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl); - -/** - * Specifies if CMaps are binary packed. - * @var {boolean} - */ -PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked; - -/** - * By default fonts are converted to OpenType fonts and loaded via font face - * rules. If disabled, the font will be rendered using a built in font renderer - * that constructs the glyphs with primitive path commands. - * @var {boolean} - */ -PDFJS.disableFontFace = (PDFJS.disableFontFace === undefined ? - false : PDFJS.disableFontFace); - -/** - * Path for image resources, mainly for annotation icons. Include trailing - * slash. - * @var {string} - */ -PDFJS.imageResourcesPath = (PDFJS.imageResourcesPath === undefined ? - '' : PDFJS.imageResourcesPath); - -/** - * Disable the web worker and run all code on the main thread. This will happen - * automatically if the browser doesn't support workers or sending typed arrays - * to workers. - * @var {boolean} - */ -PDFJS.disableWorker = (PDFJS.disableWorker === undefined ? - false : PDFJS.disableWorker); - -/** - * Path and filename of the worker file. Required when the worker is enabled in - * development mode. If unspecified in the production build, the worker will be - * loaded based on the location of the pdf.js file. It is recommended that - * the workerSrc is set in a custom application to prevent issues caused by - * third-party frameworks and libraries. - * @var {string} - */ -PDFJS.workerSrc = (PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc); - -/** - * Disable range request loading of PDF files. When enabled and if the server - * supports partial content requests then the PDF will be fetched in chunks. - * Enabled (false) by default. - * @var {boolean} - */ -PDFJS.disableRange = (PDFJS.disableRange === undefined ? - false : PDFJS.disableRange); - -/** - * Disable streaming of PDF file data. By default PDF.js attempts to load PDF - * in chunks. This default behavior can be disabled. - * @var {boolean} - */ -PDFJS.disableStream = (PDFJS.disableStream === undefined ? - false : PDFJS.disableStream); - -/** - * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js - * will automatically keep fetching more data even if it isn't needed to display - * the current page. This default behavior can be disabled. - * - * NOTE: It is also necessary to disable streaming, see above, - * in order for disabling of pre-fetching to work correctly. - * @var {boolean} - */ -PDFJS.disableAutoFetch = (PDFJS.disableAutoFetch === undefined ? - false : PDFJS.disableAutoFetch); - -/** - * Enables special hooks for debugging PDF.js. - * @var {boolean} - */ -PDFJS.pdfBug = (PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug); - -/** - * Enables transfer usage in postMessage for ArrayBuffers. - * @var {boolean} - */ -PDFJS.postMessageTransfers = (PDFJS.postMessageTransfers === undefined ? - true : PDFJS.postMessageTransfers); - -/** - * Disables URL.createObjectURL usage. - * @var {boolean} - */ -PDFJS.disableCreateObjectURL = (PDFJS.disableCreateObjectURL === undefined ? - false : PDFJS.disableCreateObjectURL); - -/** - * Disables WebGL usage. - * @var {boolean} - */ -PDFJS.disableWebGL = (PDFJS.disableWebGL === undefined ? - true : PDFJS.disableWebGL); - -/** - * Disables fullscreen support, and by extension Presentation Mode, - * in browsers which support the fullscreen API. - * @var {boolean} - */ -PDFJS.disableFullscreen = (PDFJS.disableFullscreen === undefined ? - false : PDFJS.disableFullscreen); - -/** - * Enables CSS only zooming. - * @var {boolean} - */ -PDFJS.useOnlyCssZoom = (PDFJS.useOnlyCssZoom === undefined ? - false : PDFJS.useOnlyCssZoom); - -/** - * Controls the logging level. - * The constants from PDFJS.VERBOSITY_LEVELS should be used: - * - errors - * - warnings [default] - * - infos - * @var {number} - */ -PDFJS.verbosity = (PDFJS.verbosity === undefined ? - PDFJS.VERBOSITY_LEVELS.warnings : PDFJS.verbosity); - -/** - * The maximum supported canvas size in total pixels e.g. width * height. - * The default value is 4096 * 4096. Use -1 for no limit. - * @var {number} - */ -PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ? - 16777216 : PDFJS.maxCanvasPixels); - -/** - * (Deprecated) Opens external links in a new window if enabled. - * The default behavior opens external links in the PDF.js window. - * - * NOTE: This property has been deprecated, please use - * `PDFJS.externalLinkTarget = PDFJS.LinkTarget.BLANK` instead. - * @var {boolean} - */ -PDFJS.openExternalLinksInNewWindow = ( - PDFJS.openExternalLinksInNewWindow === undefined ? - false : PDFJS.openExternalLinksInNewWindow); - -/** - * Specifies the |target| attribute for external links. - * The constants from PDFJS.LinkTarget should be used: - * - NONE [default] - * - SELF - * - BLANK - * - PARENT - * - TOP - * @var {number} - */ -PDFJS.externalLinkTarget = (PDFJS.externalLinkTarget === undefined ? - PDFJS.LinkTarget.NONE : PDFJS.externalLinkTarget); - -/** - * Specifies the |rel| attribute for external links. Defaults to stripping - * the referrer. - * @var {string} - */ -PDFJS.externalLinkRel = (PDFJS.externalLinkRel === undefined ? - 'noreferrer' : PDFJS.externalLinkRel); - -/** - * Determines if we can eval strings as JS. Primarily used to improve - * performance for font rendering. - * @var {boolean} - */ -PDFJS.isEvalSupported = (PDFJS.isEvalSupported === undefined ? - true : PDFJS.isEvalSupported); - -/** - * Document initialization / loading parameters object. - * - * @typedef {Object} DocumentInitParameters - * @property {string} url - The URL of the PDF. - * @property {TypedArray|Array|string} data - Binary PDF data. Use typed arrays - * (Uint8Array) to improve the memory usage. If PDF data is BASE64-encoded, - * use atob() to convert it to a binary string first. - * @property {Object} httpHeaders - Basic authentication headers. - * @property {boolean} withCredentials - Indicates whether or not cross-site - * Access-Control requests should be made using credentials such as cookies - * or authorization headers. The default is false. - * @property {string} password - For decrypting password-protected PDFs. - * @property {TypedArray} initialData - A typed array with the first portion or - * all of the pdf data. Used by the extension since some data is already - * loaded before the switch to range requests. - * @property {number} length - The PDF file length. It's used for progress - * reports and range requests operations. - * @property {PDFDataRangeTransport} range - * @property {number} rangeChunkSize - Optional parameter to specify - * maximum number of bytes fetched per range request. The default value is - * 2^16 = 65536. - * @property {PDFWorker} worker - The worker that will be used for the loading - * and parsing of the PDF data. - */ - -/** - * @typedef {Object} PDFDocumentStats - * @property {Array} streamTypes - Used stream types in the document (an item - * is set to true if specific stream ID was used in the document). - * @property {Array} fontTypes - Used font type in the document (an item is set - * to true if specific font ID was used in the document). - */ - -/** - * This is the main entry point for loading a PDF and interacting with it. - * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) - * is used, which means it must follow the same origin rules that any XHR does - * e.g. No cross domain requests without CORS. - * - * @param {string|TypedArray|DocumentInitParameters|PDFDataRangeTransport} src - * Can be a url to where a PDF is located, a typed array (Uint8Array) - * already populated with data or parameter object. - * - * @param {PDFDataRangeTransport} pdfDataRangeTransport (deprecated) It is used - * if you want to manually serve range requests for data in the PDF. - * - * @param {function} passwordCallback (deprecated) It is used to request a - * password if wrong or no password was provided. The callback receives two - * parameters: function that needs to be called with new password and reason - * (see {PasswordResponses}). - * - * @param {function} progressCallback (deprecated) It is used to be able to - * monitor the loading progress of the PDF file (necessary to implement e.g. - * a loading bar). The callback receives an {Object} with the properties: - * {number} loaded and {number} total. - * - * @return {PDFDocumentLoadingTask} - */ -PDFJS.getDocument = function getDocument(src, - pdfDataRangeTransport, - passwordCallback, - progressCallback) { - var task = new PDFDocumentLoadingTask(); - - // Support of the obsolete arguments (for compatibility with API v1.0) - if (arguments.length > 1) { - deprecated('getDocument is called with pdfDataRangeTransport, ' + - 'passwordCallback or progressCallback argument'); - } - if (pdfDataRangeTransport) { - if (!(pdfDataRangeTransport instanceof PDFDataRangeTransport)) { - // Not a PDFDataRangeTransport instance, trying to add missing properties. - pdfDataRangeTransport = Object.create(pdfDataRangeTransport); - pdfDataRangeTransport.length = src.length; - pdfDataRangeTransport.initialData = src.initialData; - if (!pdfDataRangeTransport.abort) { - pdfDataRangeTransport.abort = function () {}; + if (horizon[i].start < boundary.y1) { + changedHorizon[0].start = boundary.y1; + changedHorizon.unshift({ + start: horizon[i].start, + end: boundary.y1, + boundary: horizon[i].boundary + }); } - } - src = Object.create(src); - src.range = pdfDataRangeTransport; - } - task.onPassword = passwordCallback || null; - task.onProgress = progressCallback || null; - var source; - if (typeof src === 'string') { - source = { url: src }; - } else if (isArrayBuffer(src)) { - source = { data: src }; - } else if (src instanceof PDFDataRangeTransport) { - source = { range: src }; - } else { - if (typeof src !== 'object') { - error('Invalid parameter in getDocument, need either Uint8Array, ' + - 'string or a parameter object'); - } - if (!src.url && !src.data && !src.range) { - error('Invalid parameter object: need either .data, .range or .url'); - } - - source = src; - } - - var params = {}; - var rangeTransport = null; - var worker = null; - for (var key in source) { - if (key === 'url' && typeof window !== 'undefined') { - // The full path is required in the 'url' field. - params[key] = combineUrl(window.location.href, source[key]); - continue; - } else if (key === 'range') { - rangeTransport = source[key]; - continue; - } else if (key === 'worker') { - worker = source[key]; - continue; - } else if (key === 'data' && !(source[key] instanceof Uint8Array)) { - // Converting string or array-like data to Uint8Array. - var pdfBytes = source[key]; - if (typeof pdfBytes === 'string') { - params[key] = stringToBytes(pdfBytes); - } else if (typeof pdfBytes === 'object' && pdfBytes !== null && - !isNaN(pdfBytes.length)) { - params[key] = new Uint8Array(pdfBytes); - } else if (isArrayBuffer(pdfBytes)) { - params[key] = new Uint8Array(pdfBytes); - } else { - error('Invalid PDF binary data: either typed array, string or ' + - 'array-like object is expected in the data property.'); + 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 + }); } - continue; - } - params[key] = source[key]; - } - params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; + for (q = i; q <= j; q++) { + horizonPart = horizon[q]; + affectedBoundary = horizonPart.boundary; - if (!worker) { - // Worker was not provided -- creating and owning our own. - worker = new PDFWorker(); - task._worker = worker; - } - var docId = task.docId; - worker.promise.then(function () { - if (task.destroyed) { - throw new Error('Loading aborted'); - } - return _fetchDocument(worker, params, rangeTransport, docId).then( - function (workerId) { - if (task.destroyed) { - throw new Error('Loading aborted'); + 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; + } + + for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) { + used = horizon[k].boundary === affectedBoundary; + } + + for (k = 0; !used && k < changedHorizon.length; k++) { + used = changedHorizon[k].boundary === affectedBoundary; + } + + if (!used) { + affectedBoundary.x2New = maxXNew; + } } - var messageHandler = new MessageHandler(docId, workerId, worker.port); - messageHandler.send('Ready', null); - var transport = new WorkerTransport(messageHandler, task, rangeTransport); - task._transport = transport; + + Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon)); }); - }).catch(task._capability.reject); + horizon.forEach(function (horizonPart) { + var affectedBoundary = horizonPart.boundary; - return task; -}; - -/** - * Starts fetching of specified PDF document/data. - * @param {PDFWorker} worker - * @param {Object} source - * @param {PDFDataRangeTransport} pdfDataRangeTransport - * @param {string} docId Unique document id, used as MessageHandler id. - * @returns {Promise} The promise, which is resolved when worker id of - * MessageHandler is known. - * @private - */ -function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { - if (worker.destroyed) { - return Promise.reject(new Error('Worker was destroyed')); + if (affectedBoundary.x2New === undefined) { + affectedBoundary.x2New = Math.max(width, affectedBoundary.x2); + } + }); } - source.disableAutoFetch = PDFJS.disableAutoFetch; - source.disableStream = PDFJS.disableStream; - source.chunkedViewerLoading = !!pdfDataRangeTransport; - if (pdfDataRangeTransport) { - source.length = pdfDataRangeTransport.length; - source.initialData = pdfDataRangeTransport.initialData; - } - return worker.messageHandler.sendWithPromise('GetDocRequest', { - docId: docId, - source: source, - disableRange: PDFJS.disableRange, - maxImageSize: PDFJS.maxImageSize, - cMapUrl: PDFJS.cMapUrl, - cMapPacked: PDFJS.cMapPacked, - disableFontFace: PDFJS.disableFontFace, - disableCreateObjectURL: PDFJS.disableCreateObjectURL, - verbosity: PDFJS.verbosity - }).then(function (workerId) { - if (worker.destroyed) { - throw new Error('Worker was destroyed'); - } - return workerId; - }); -} - -/** - * PDF document loading operation. - * @class - * @alias PDFDocumentLoadingTask - */ -var PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() { - var nextDocumentId = 0; - - /** @constructs PDFDocumentLoadingTask */ - function PDFDocumentLoadingTask() { - this._capability = createPromiseCapability(); - this._transport = null; - this._worker = null; - - /** - * Unique document loading task id -- used in MessageHandlers. - * @type {string} - */ - this.docId = 'd' + (nextDocumentId++); - - /** - * Shows if loading task is destroyed. - * @type {boolean} - */ - this.destroyed = false; - - /** - * Callback to request a password if wrong or no password was provided. - * The callback receives two parameters: function that needs to be called - * with new password and reason (see {PasswordResponses}). - */ - this.onPassword = null; - - /** - * Callback to be able to monitor the loading progress of the PDF file - * (necessary to implement e.g. a loading bar). The callback receives - * an {Object} with the properties: {number} loaded and {number} total. - */ - this.onProgress = null; - - /** - * Callback to when unsupported feature is used. The callback receives - * an {PDFJS.UNSUPPORTED_FEATURES} argument. - */ - this.onUnsupportedFeature = null; + 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; + this._textContent = textContent; + this._textContentStream = textContentStream; + this._container = container; + this._viewport = viewport; + this._textDivs = textDivs || []; + this._textContentItemsStr = textContentItemsStr || []; + this._enhanceTextSelection = !!enhanceTextSelection; + this._fontInspectorEnabled = !!(_global_scope.default.FontInspector && _global_scope.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 = []; } - PDFDocumentLoadingTask.prototype = - /** @lends PDFDocumentLoadingTask.prototype */ { - /** - * @return {Promise} - */ + TextLayerRenderTask.prototype = { get promise() { return this._capability.promise; }, - /** - * Aborts all network requests and destroys worker. - * @return {Promise} A promise that is resolved after destruction activity - * is completed. - */ - destroy: function () { - this.destroyed = true; + cancel: function TextLayer_cancel() { + if (this._reader) { + this._reader.cancel(new _util.AbortException('text layer task cancelled')); - 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; - } - }.bind(this)); - }, - - /** - * Registers callbacks to indicate the document loading completion. - * - * @param {function} onFulfilled The callback for the loading completion. - * @param {function} onRejected The callback for the loading failure. - * @return {Promise} A promise that is resolved after the onFulfilled or - * onRejected callback. - */ - then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) { - return this.promise.then.apply(this.promise, arguments); - } - }; - - return PDFDocumentLoadingTask; -})(); - -/** - * Abstract class to support range requests file loading. - * @class - * @alias PDFJS.PDFDataRangeTransport - * @param {number} length - * @param {Uint8Array} initialData - */ -var PDFDataRangeTransport = (function pdfDataRangeTransportClosure() { - function PDFDataRangeTransport(length, initialData) { - this.length = length; - this.initialData = initialData; - - this._rangeListeners = []; - this._progressListeners = []; - this._progressiveReadListeners = []; - this._readyCapability = createPromiseCapability(); - } - PDFDataRangeTransport.prototype = - /** @lends PDFDataRangeTransport.prototype */ { - addRangeListener: - function PDFDataRangeTransport_addRangeListener(listener) { - this._rangeListeners.push(listener); - }, - - addProgressListener: - function PDFDataRangeTransport_addProgressListener(listener) { - this._progressListeners.push(listener); - }, - - addProgressiveReadListener: - function PDFDataRangeTransport_addProgressiveReadListener(listener) { - this._progressiveReadListeners.push(listener); - }, - - onDataRange: function PDFDataRangeTransport_onDataRange(begin, chunk) { - var listeners = this._rangeListeners; - for (var i = 0, n = listeners.length; i < n; ++i) { - listeners[i](begin, chunk); - } - }, - - onDataProgress: function PDFDataRangeTransport_onDataProgress(loaded) { - this._readyCapability.promise.then(function () { - var listeners = this._progressListeners; - for (var i = 0, n = listeners.length; i < n; ++i) { - listeners[i](loaded); - } - }.bind(this)); - }, - - onDataProgressiveRead: - function PDFDataRangeTransport_onDataProgress(chunk) { - this._readyCapability.promise.then(function () { - var listeners = this._progressiveReadListeners; - for (var i = 0, n = listeners.length; i < n; ++i) { - listeners[i](chunk); - } - }.bind(this)); - }, - - transportReady: function PDFDataRangeTransport_transportReady() { - this._readyCapability.resolve(); - }, - - requestDataRange: - function PDFDataRangeTransport_requestDataRange(begin, end) { - throw new Error('Abstract method PDFDataRangeTransport.requestDataRange'); - }, - - abort: function PDFDataRangeTransport_abort() { - } - }; - return PDFDataRangeTransport; -})(); - -PDFJS.PDFDataRangeTransport = PDFDataRangeTransport; - -/** - * Proxy to a PDFDocument in the worker thread. Also, contains commonly used - * properties that can be read synchronously. - * @class - * @alias PDFDocumentProxy - */ -var PDFDocumentProxy = (function PDFDocumentProxyClosure() { - function PDFDocumentProxy(pdfInfo, transport, loadingTask) { - this.pdfInfo = pdfInfo; - this.transport = transport; - this.loadingTask = loadingTask; - } - PDFDocumentProxy.prototype = /** @lends PDFDocumentProxy.prototype */ { - /** - * @return {number} Total number of pages the PDF contains. - */ - get numPages() { - return this.pdfInfo.numPages; - }, - /** - * @return {string} A unique ID to identify a PDF. Not guaranteed to be - * unique. - */ - get fingerprint() { - return this.pdfInfo.fingerprint; - }, - /** - * @param {number} pageNumber The page number to get. The first page is 1. - * @return {Promise} A promise that is resolved with a {@link PDFPageProxy} - * object. - */ - getPage: function PDFDocumentProxy_getPage(pageNumber) { - return this.transport.getPage(pageNumber); - }, - /** - * @param {{num: number, gen: number}} ref The page reference. Must have - * the 'num' and 'gen' properties. - * @return {Promise} A promise that is resolved with the page index that is - * associated with the reference. - */ - getPageIndex: function PDFDocumentProxy_getPageIndex(ref) { - return this.transport.getPageIndex(ref); - }, - /** - * @return {Promise} A promise that is resolved with a lookup table for - * mapping named destinations to reference numbers. - * - * This can be slow for large documents: use getDestination instead - */ - getDestinations: function PDFDocumentProxy_getDestinations() { - return this.transport.getDestinations(); - }, - /** - * @param {string} id The named destination to get. - * @return {Promise} A promise that is resolved with all information - * of the given named destination. - */ - getDestination: function PDFDocumentProxy_getDestination(id) { - return this.transport.getDestination(id); - }, - /** - * @return {Promise} A promise that is resolved with: - * an Array containing the pageLabels that correspond to the pageIndexes, - * or `null` when no pageLabels are present in the PDF file. - */ - getPageLabels: function PDFDocumentProxy_getPageLabels() { - return this.transport.getPageLabels(); - }, - /** - * @return {Promise} A promise that is resolved with a lookup table for - * mapping named attachments to their content. - */ - getAttachments: function PDFDocumentProxy_getAttachments() { - return this.transport.getAttachments(); - }, - /** - * @return {Promise} A promise that is resolved with an array of all the - * JavaScript strings in the name tree. - */ - getJavaScript: function PDFDocumentProxy_getJavaScript() { - return this.transport.getJavaScript(); - }, - /** - * @return {Promise} A promise that is resolved with an {Array} that is a - * tree outline (if it has one) of the PDF. The tree is in the format of: - * [ - * { - * title: string, - * bold: boolean, - * italic: boolean, - * color: rgb array, - * dest: dest obj, - * url: string, - * items: array of more items like this - * }, - * ... - * ]. - */ - getOutline: function PDFDocumentProxy_getOutline() { - return this.transport.getOutline(); - }, - /** - * @return {Promise} A promise that is resolved with an {Object} that has - * info and metadata properties. Info is an {Object} filled with anything - * available in the information dictionary and similarly metadata is a - * {Metadata} object with information from the metadata section of the PDF. - */ - getMetadata: function PDFDocumentProxy_getMetadata() { - return this.transport.getMetadata(); - }, - /** - * @return {Promise} A promise that is resolved with a TypedArray that has - * the raw data from the PDF. - */ - getData: function PDFDocumentProxy_getData() { - return this.transport.getData(); - }, - /** - * @return {Promise} A promise that is resolved when the document's data - * is loaded. It is resolved with an {Object} that contains the length - * property that indicates size of the PDF data in bytes. - */ - getDownloadInfo: function PDFDocumentProxy_getDownloadInfo() { - return this.transport.downloadInfoCapability.promise; - }, - /** - * @return {Promise} A promise this is resolved with current stats about - * document structures (see {@link PDFDocumentStats}). - */ - getStats: function PDFDocumentProxy_getStats() { - return this.transport.getStats(); - }, - /** - * Cleans up resources allocated by the document, e.g. created @font-face. - */ - cleanup: function PDFDocumentProxy_cleanup() { - this.transport.startCleanup(); - }, - /** - * Destroys current document instance and terminates worker. - */ - destroy: function PDFDocumentProxy_destroy() { - return this.loadingTask.destroy(); - } - }; - return PDFDocumentProxy; -})(); - -/** - * Page getTextContent parameters. - * - * @typedef {Object} getTextContentParameters - * @param {boolean} normalizeWhitespace - replaces all occurrences of - * whitespace with standard spaces (0x20). The default value is `false`. - */ - -/** - * Page text content. - * - * @typedef {Object} TextContent - * @property {array} items - array of {@link TextItem} - * @property {Object} styles - {@link TextStyles} objects, indexed by font - * name. - */ - -/** - * Page text content part. - * - * @typedef {Object} TextItem - * @property {string} str - text content. - * @property {string} dir - text direction: 'ttb', 'ltr' or 'rtl'. - * @property {array} transform - transformation matrix. - * @property {number} width - width in device space. - * @property {number} height - height in device space. - * @property {string} fontName - font name used by pdf.js for converted font. - */ - -/** - * Text style. - * - * @typedef {Object} TextStyle - * @property {number} ascent - font ascent. - * @property {number} descent - font descent. - * @property {boolean} vertical - text is in vertical mode. - * @property {string} fontFamily - possible font family - */ - -/** - * Page annotation parameters. - * - * @typedef {Object} GetAnnotationsParameters - * @param {string} intent - Determines the annotations that will be fetched, - * can be either 'display' (viewable annotations) or 'print' - * (printable annotations). - * If the parameter is omitted, all annotations are fetched. - */ - -/** - * Page render parameters. - * - * @typedef {Object} RenderParameters - * @property {Object} canvasContext - A 2D context of a DOM Canvas object. - * @property {PDFJS.PageViewport} viewport - Rendering viewport obtained by - * calling of PDFPage.getViewport method. - * @property {string} intent - Rendering intent, can be 'display' or 'print' - * (default value is 'display'). - * @property {Array} transform - (optional) Additional transform, applied - * just before viewport transform. - * @property {Object} imageLayer - (optional) An object that has beginLayout, - * endLayout and appendImage functions. - * @property {function} continueCallback - (deprecated) A function that will be - * called each time the rendering is paused. To continue - * rendering call the function that is the first argument - * to the callback. - */ - -/** - * PDF page operator list. - * - * @typedef {Object} PDFOperatorList - * @property {Array} fnArray - Array containing the operator functions. - * @property {Array} argsArray - Array containing the arguments of the - * functions. - */ - -/** - * Proxy to a PDFPage in the worker thread. - * @class - * @alias PDFPageProxy - */ -var PDFPageProxy = (function PDFPageProxyClosure() { - function PDFPageProxy(pageIndex, pageInfo, transport) { - this.pageIndex = pageIndex; - this.pageInfo = pageInfo; - this.transport = transport; - this.stats = new StatTimer(); - this.stats.enabled = !!globalScope.PDFJS.enableStats; - this.commonObjs = transport.commonObjs; - this.objs = new PDFObjects(); - this.cleanupAfterRender = false; - this.pendingCleanup = false; - this.intentStates = {}; - this.destroyed = false; - } - PDFPageProxy.prototype = /** @lends PDFPageProxy.prototype */ { - /** - * @return {number} Page number of the page. First page is 1. - */ - get pageNumber() { - return this.pageIndex + 1; - }, - /** - * @return {number} The number of degrees the page is rotated clockwise. - */ - get rotate() { - return this.pageInfo.rotate; - }, - /** - * @return {Object} The reference that points to this page. It has 'num' and - * 'gen' properties. - */ - get ref() { - return this.pageInfo.ref; - }, - /** - * @return {Array} An array of the visible portion of the PDF page in the - * user space units - [x1, y1, x2, y2]. - */ - get view() { - return this.pageInfo.view; - }, - /** - * @param {number} scale The desired scale of the viewport. - * @param {number} rotate Degrees to rotate the viewport. If omitted this - * defaults to the page rotation. - * @return {PDFJS.PageViewport} Contains 'width' and 'height' properties - * along with transforms required for rendering. - */ - getViewport: function PDFPageProxy_getViewport(scale, rotate) { - if (arguments.length < 2) { - rotate = this.rotate; - } - return new PDFJS.PageViewport(this.view, scale, rotate, 0, 0); - }, - /** - * @param {GetAnnotationsParameters} params - Annotation parameters. - * @return {Promise} A promise that is resolved with an {Array} of the - * annotation objects. - */ - 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.annotationsIntent = intent; - } - return this.annotationsPromise; - }, - /** - * Begins the process of rendering a page to the desired context. - * @param {RenderParameters} params Page render parameters. - * @return {RenderTask} An object that contains the promise, which - * is resolved when the page finishes rendering. - */ - render: function PDFPageProxy_render(params) { - var stats = this.stats; - stats.time('Overall'); - - // If there was a pending destroy cancel it so no cleanup happens during - // this call to render. - this.pendingCleanup = false; - - var renderingIntent = (params.intent === 'print' ? 'print' : 'display'); - - if (!this.intentStates[renderingIntent]) { - this.intentStates[renderingIntent] = {}; - } - var intentState = this.intentStates[renderingIntent]; - - // If there's no displayReadyCapability yet, then the operatorList - // was never requested before. Make the request and create the promise. - if (!intentState.displayReadyCapability) { - intentState.receivingOperatorList = true; - intentState.displayReadyCapability = createPromiseCapability(); - intentState.operatorList = { - fnArray: [], - argsArray: [], - lastChunk: false - }; - - this.stats.time('Page Request'); - this.transport.messageHandler.send('RenderPageRequest', { - pageIndex: this.pageNumber - 1, - intent: renderingIntent - }); + this._reader = null; } - var internalRenderTask = new InternalRenderTask(complete, params, - this.objs, - this.commonObjs, - intentState.operatorList, - this.pageNumber); - internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print'; - if (!intentState.renderTasks) { - intentState.renderTasks = []; - } - intentState.renderTasks.push(internalRenderTask); - var renderTask = internalRenderTask.task; + this._canceled = true; - // Obsolete parameter support - if (params.continueCallback) { - deprecated('render is used with continueCallback parameter'); - renderTask.onContinue = params.continueCallback; + if (this._renderTimer !== null) { + clearTimeout(this._renderTimer); + this._renderTimer = null; } - var self = this; - intentState.displayReadyCapability.promise.then( - function pageDisplayReadyPromise(transparency) { - if (self.pendingCleanup) { - complete(); - return; - } - stats.time('Rendering'); - internalRenderTask.initalizeGraphics(transparency); - internalRenderTask.operatorListChanged(); - }, - function pageDisplayReadPromiseError(reason) { - complete(reason); - } - ); + 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); - function complete(error) { - var i = intentState.renderTasks.indexOf(internalRenderTask); - if (i >= 0) { - intentState.renderTasks.splice(i, 1); - } - - if (self.cleanupAfterRender) { - self.pendingCleanup = true; - } - self._tryCleanup(); - - if (error) { - internalRenderTask.capability.reject(error); - } else { - internalRenderTask.capability.resolve(); - } - stats.timeEnd('Rendering'); - stats.timeEnd('Overall'); + appendText(this, items[i], styleCache); } - - return renderTask; }, + _layoutText: function _layoutText(textDiv) { + var textLayerFrag = this._container; - /** - * @return {Promise} A promise resolved with an {@link PDFOperatorList} - * object that represents page's operator list. - */ - getOperatorList: function PDFPageProxy_getOperatorList() { - function operatorListChanged() { - if (intentState.operatorList.lastChunk) { - intentState.opListReadCapability.resolve(intentState.operatorList); - } - } + var textDivProperties = this._textDivProperties.get(textDiv); - var renderingIntent = 'oplist'; - if (!this.intentStates[renderingIntent]) { - this.intentStates[renderingIntent] = {}; - } - var intentState = this.intentStates[renderingIntent]; - - if (!intentState.opListReadCapability) { - var opListTask = {}; - opListTask.operatorListChanged = operatorListChanged; - intentState.receivingOperatorList = true; - intentState.opListReadCapability = createPromiseCapability(); - intentState.renderTasks = []; - intentState.renderTasks.push(opListTask); - intentState.operatorList = { - fnArray: [], - argsArray: [], - lastChunk: false - }; - - this.transport.messageHandler.send('RenderPageRequest', { - pageIndex: this.pageIndex, - intent: renderingIntent - }); - } - return intentState.opListReadCapability.promise; - }, - - /** - * @param {getTextContentParameters} params - getTextContent parameters. - * @return {Promise} That is resolved a {@link TextContent} - * object that represent the page text content. - */ - getTextContent: function PDFPageProxy_getTextContent(params) { - var normalizeWhitespace = (params && params.normalizeWhitespace) || false; - - return this.transport.messageHandler.sendWithPromise('GetTextContent', { - pageIndex: this.pageNumber - 1, - normalizeWhitespace: normalizeWhitespace, - }); - }, - - /** - * Destroys page object. - */ - _destroy: function PDFPageProxy_destroy() { - this.destroyed = true; - this.transport.pageCache[this.pageIndex] = null; - - var waitOn = []; - Object.keys(this.intentStates).forEach(function(intent) { - var intentState = this.intentStates[intent]; - intentState.renderTasks.forEach(function(renderTask) { - var renderCompleted = renderTask.capability.promise. - catch(function () {}); // ignoring failures - waitOn.push(renderCompleted); - renderTask.cancel(); - }); - }, this); - this.objs.clear(); - this.annotationsPromise = null; - this.pendingCleanup = false; - return Promise.all(waitOn); - }, - - /** - * Cleans up resources allocated by the page. (deprecated) - */ - destroy: function() { - deprecated('page destroy method, use cleanup() instead'); - this.cleanup(); - }, - - /** - * Cleans up resources allocated by the page. - */ - cleanup: function PDFPageProxy_cleanup() { - this.pendingCleanup = true; - this._tryCleanup(); - }, - /** - * For internal use only. Attempts to clean up if rendering is in a state - * where that's possible. - * @ignore - */ - _tryCleanup: function PDFPageProxy_tryCleanup() { - if (!this.pendingCleanup || - Object.keys(this.intentStates).some(function(intent) { - var intentState = this.intentStates[intent]; - return (intentState.renderTasks.length !== 0 || - intentState.receivingOperatorList); - }, this)) { + if (textDivProperties.isWhitespace) { return; } - Object.keys(this.intentStates).forEach(function(intent) { - delete this.intentStates[intent]; - }, this); - this.objs.clear(); - this.annotationsPromise = null; - this.pendingCleanup = false; + 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; + } + + var width = this._layoutTextCtx.measureText(textDiv.textContent).width; + + var transform = ''; + + if (textDivProperties.canvasWidth !== 0 && width > 0) { + textDivProperties.scale = textDivProperties.canvasWidth / width; + transform = "scaleX(".concat(textDivProperties.scale, ")"); + } + + if (textDivProperties.angle !== 0) { + transform = "rotate(".concat(textDivProperties.angle, "deg) ").concat(transform); + } + + if (transform.length > 0) { + textDivProperties.originalTransform = transform; + textDiv.style.transform = transform; + } + + this._textDivProperties.set(textDiv, textDivProperties); + + textLayerFrag.appendChild(textDiv); }, - /** - * For internal use only. - * @ignore - */ - _startRenderPage: function PDFPageProxy_startRenderPage(transparency, - intent) { - var intentState = this.intentStates[intent]; - // TODO Refactor RenderPageRequest to separate rendering - // and operator list logic - if (intentState.displayReadyCapability) { - intentState.displayReadyCapability.resolve(transparency); - } - }, - /** - * For internal use only. - * @ignore - */ - _renderPageChunk: function PDFPageProxy_renderPageChunk(operatorListChunk, - intent) { - var intentState = this.intentStates[intent]; - var i, ii; - // Add the new chunk to the current operator list. - for (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; + _render: function TextLayer_render(timeout) { + var _this = this; - // Notify all the rendering tasks there are more operators to be consumed. - for (i = 0; i < intentState.renderTasks.length; i++) { - intentState.renderTasks[i].operatorListChanged(); - } - - if (operatorListChunk.lastChunk) { - intentState.receivingOperatorList = false; - this._tryCleanup(); - } - } - }; - return PDFPageProxy; -})(); - -/** - * PDF.js web worker abstraction, it controls instantiation of PDF documents and - * WorkerTransport for them. If creation of a web worker is not possible, - * a "fake" worker will be used instead. - * @class - */ -var PDFWorker = (function PDFWorkerClosure() { - var nextFakeWorkerId = 0; - - function getWorkerSrc() { - if (PDFJS.workerSrc) { - return PDFJS.workerSrc; - } - if (pdfjsFilePath) { - return pdfjsFilePath.replace(/\.js$/i, '.worker.js'); - } - error('No PDFJS.workerSrc specified'); - } - - // Loads worker code into main thread. - function setupFakeWorkerGlobal() { - if (!PDFJS.fakeWorkerFilesLoadedCapability) { - PDFJS.fakeWorkerFilesLoadedCapability = createPromiseCapability(); - // In the developer build load worker_loader which in turn loads all the - // other files and resolves the promise. In production only the - // pdf.worker.js file is needed. - var loader = fakeWorkerFilesLoader || function (callback) { - Util.loadScript(getWorkerSrc(), callback); - }; - loader(function () { - PDFJS.fakeWorkerFilesLoadedCapability.resolve(); + 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 }); - } - return PDFJS.fakeWorkerFilesLoadedCapability.promise; - } - function PDFWorker(name) { - this.name = name; - this.destroyed = false; + if (this._textContent) { + var textItems = this._textContent.items; + var textStyles = this._textContent.styles; - this._readyCapability = createPromiseCapability(); - this._port = null; - this._webWorker = null; - this._messageHandler = null; - this._initialize(); - } + this._processItems(textItems, textStyles); - PDFWorker.prototype = /** @lends PDFWorker.prototype */ { - get promise() { - return this._readyCapability.promise; - }, + capability.resolve(); + } else if (this._textContentStream) { + var pump = function pump() { + _this._reader.read().then(function (_ref2) { + var value = _ref2.value, + done = _ref2.done; - get port() { - return this._port; - }, - - get messageHandler() { - return this._messageHandler; - }, - - _initialize: function PDFWorker_initialize() { - // If worker support isn't disabled explicit and the browser has worker - // support, create a new web worker and test if it/the browser fullfills - // all requirements to run parts of pdf.js in a web worker. - // Right now, the requirement is, that an Uint8Array is still an - // Uint8Array as it arrives on the worker. (Chrome added this with v.15.) - if (!globalScope.PDFJS.disableWorker && typeof Worker !== 'undefined') { - var workerSrc = getWorkerSrc(); - - try { - // Some versions of FF can't create a worker on localhost, see: - // https://bugzilla.mozilla.org/show_bug.cgi?id=683280 - var worker = new Worker(workerSrc); - var messageHandler = new MessageHandler('main', 'worker', worker); - messageHandler.on('test', function PDFWorker_test(data) { - if (this.destroyed) { - this._readyCapability.reject(new Error('Worker was destroyed')); - messageHandler.destroy(); - worker.terminate(); - return; // worker was destroyed + if (done) { + capability.resolve(); + return; } - var supportTypedArray = data && data.supportTypedArray; - if (supportTypedArray) { - this._messageHandler = messageHandler; - this._port = worker; - this._webWorker = worker; - if (!data.supportTransfers) { - PDFJS.postMessageTransfers = false; - } - this._readyCapability.resolve(); - } else { - this._setupFakeWorker(); - messageHandler.destroy(); - worker.terminate(); - } - }.bind(this)); - messageHandler.on('console_log', function (data) { - console.log.apply(console, data); - }); - messageHandler.on('console_error', function (data) { - console.error.apply(console, data); - }); + Object.assign(styleCache, value.styles); - messageHandler.on('ready', function (data) { - if (this.destroyed) { - this._readyCapability.reject(new Error('Worker was destroyed')); - messageHandler.destroy(); - worker.terminate(); - return; // worker was destroyed - } - try { - sendTest(); - } catch (e) { - // We need fallback to a faked worker. - this._setupFakeWorker(); - } - }.bind(this)); + _this._processItems(value.items, styleCache); - var sendTest = function () { - var testObj = new Uint8Array( - [PDFJS.postMessageTransfers ? 255 : 0]); - // Some versions of Opera throw a DATA_CLONE_ERR on serializing the - // typed array. Also, checking if we can use transfers. - try { - messageHandler.send('test', testObj, [testObj.buffer]); - } catch (ex) { - info('Cannot use postMessage transfers'); - testObj[0] = 0; - messageHandler.send('test', testObj); - } - }; - - // It might take time for worker to initialize (especially when AMD - // loader is used). We will try to send test immediately, and then - // when 'ready' message will arrive. The worker shall process only - // first received 'test'. - sendTest(); - return; - } catch (e) { - info('The worker has been disabled.'); - } - } - // Either workers are disabled, not supported or have thrown an exception. - // Thus, we fallback to a faked worker. - this._setupFakeWorker(); - }, - - _setupFakeWorker: function PDFWorker_setupFakeWorker() { - if (!globalScope.PDFJS.disableWorker) { - warn('Setting up fake worker.'); - globalScope.PDFJS.disableWorker = true; - } - - setupFakeWorkerGlobal().then(function () { - if (this.destroyed) { - this._readyCapability.reject(new Error('Worker was destroyed')); - return; - } - - // If we don't use a worker, just post/sendMessage to the main thread. - var port = { - _listeners: [], - postMessage: function (obj) { - var e = {data: obj}; - this._listeners.forEach(function (listener) { - listener.call(this, e); - }, this); - }, - addEventListener: function (name, listener) { - this._listeners.push(listener); - }, - removeEventListener: function (name, listener) { - var i = this._listeners.indexOf(listener); - this._listeners.splice(i, 1); - }, - terminate: function () {} + pump(); + }, capability.reject); }; - this._port = port; - // All fake workers use the same port, making id unique. - var id = 'fake' + (nextFakeWorkerId++); - - // If the main thread is our worker, setup the handling for the - // messages -- the main thread sends to it self. - var workerHandler = new MessageHandler(id + '_worker', id, port); - PDFJS.WorkerMessageHandler.setup(workerHandler, port); - - var messageHandler = new MessageHandler(id, id + '_worker', port); - this._messageHandler = messageHandler; - this._readyCapability.resolve(); - }.bind(this)); - }, - - /** - * Destroys the worker instance. - */ - destroy: function PDFWorker_destroy() { - this.destroyed = true; - if (this._webWorker) { - // We need to terminate only web worker created resource. - this._webWorker.terminate(); - this._webWorker = null; - } - this._port = null; - if (this._messageHandler) { - this._messageHandler.destroy(); - this._messageHandler = null; - } - } - }; - - return PDFWorker; -})(); -PDFJS.PDFWorker = PDFWorker; - -/** - * For internal use only. - * @ignore - */ -var WorkerTransport = (function WorkerTransportClosure() { - function WorkerTransport(messageHandler, loadingTask, pdfDataRangeTransport) { - this.messageHandler = messageHandler; - this.loadingTask = loadingTask; - this.pdfDataRangeTransport = pdfDataRangeTransport; - this.commonObjs = new PDFObjects(); - this.fontLoader = new FontLoader(loadingTask.docId); - - this.destroyed = false; - this.destroyCapability = null; - - this.pageCache = []; - this.pagePromises = []; - this.downloadInfoCapability = createPromiseCapability(); - - this.setupMessageHandler(); - } - WorkerTransport.prototype = { - destroy: function WorkerTransport_destroy() { - if (this.destroyCapability) { - return this.destroyCapability.promise; + this._reader = this._textContentStream.getReader(); + pump(); + } else { + throw new Error('Neither "textContent" nor "textContentStream"' + ' parameters specified.'); } - this.destroyed = true; - this.destroyCapability = createPromiseCapability(); + capability.promise.then(function () { + styleCache = null; - var waitOn = []; - // We need to wait for all renderings to be completed, e.g. - // timeout/rAF can take a long time. - this.pageCache.forEach(function (page) { - if (page) { - waitOn.push(page._destroy()); - } - }); - this.pageCache = []; - this.pagePromises = []; - var self = this; - // We also need to wait for the worker to finish its long running tasks. - var terminated = this.messageHandler.sendWithPromise('Terminate', null); - waitOn.push(terminated); - Promise.all(waitOn).then(function () { - self.fontLoader.clear(); - if (self.pdfDataRangeTransport) { - self.pdfDataRangeTransport.abort(); - self.pdfDataRangeTransport = null; - } - if (self.messageHandler) { - self.messageHandler.destroy(); - self.messageHandler = null; - } - self.destroyCapability.resolve(); - }, this.destroyCapability.reject); - return this.destroyCapability.promise; - }, - - setupMessageHandler: - function WorkerTransport_setupMessageHandler() { - var messageHandler = this.messageHandler; - - function updatePassword(password) { - messageHandler.send('UpdatePassword', password); - } - - var pdfDataRangeTransport = this.pdfDataRangeTransport; - if (pdfDataRangeTransport) { - pdfDataRangeTransport.addRangeListener(function(begin, chunk) { - messageHandler.send('OnDataRange', { - begin: begin, - chunk: chunk - }); - }); - - pdfDataRangeTransport.addProgressListener(function(loaded) { - messageHandler.send('OnDataProgress', { - loaded: loaded - }); - }); - - pdfDataRangeTransport.addProgressiveReadListener(function(chunk) { - messageHandler.send('OnDataRange', { - chunk: chunk - }); - }); - - messageHandler.on('RequestDataRange', - function transportDataRange(data) { - pdfDataRangeTransport.requestDataRange(data.begin, data.end); - }, this); - } - - messageHandler.on('GetDoc', function transportDoc(data) { - var pdfInfo = data.pdfInfo; - this.numPages = data.pdfInfo.numPages; - var loadingTask = this.loadingTask; - var pdfDocument = new PDFDocumentProxy(pdfInfo, this, loadingTask); - this.pdfDocument = pdfDocument; - loadingTask._capability.resolve(pdfDocument); - }, this); - - messageHandler.on('NeedPassword', - function transportNeedPassword(exception) { - var loadingTask = this.loadingTask; - if (loadingTask.onPassword) { - return loadingTask.onPassword(updatePassword, - PasswordResponses.NEED_PASSWORD); - } - loadingTask._capability.reject( - new PasswordException(exception.message, exception.code)); - }, this); - - messageHandler.on('IncorrectPassword', - function transportIncorrectPassword(exception) { - var loadingTask = this.loadingTask; - if (loadingTask.onPassword) { - return loadingTask.onPassword(updatePassword, - PasswordResponses.INCORRECT_PASSWORD); - } - loadingTask._capability.reject( - new PasswordException(exception.message, exception.code)); - }, this); - - messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) { - this.loadingTask._capability.reject( - new InvalidPDFException(exception.message)); - }, this); - - messageHandler.on('MissingPDF', function transportMissingPDF(exception) { - this.loadingTask._capability.reject( - new MissingPDFException(exception.message)); - }, this); - - messageHandler.on('UnexpectedResponse', - function transportUnexpectedResponse(exception) { - this.loadingTask._capability.reject( - new UnexpectedResponseException(exception.message, exception.status)); - }, this); - - messageHandler.on('UnknownError', - function transportUnknownError(exception) { - this.loadingTask._capability.reject( - new UnknownErrorException(exception.message, exception.details)); - }, this); - - messageHandler.on('DataLoaded', function transportPage(data) { - this.downloadInfoCapability.resolve(data); - }, this); - - messageHandler.on('PDFManagerReady', function transportPage(data) { - if (this.pdfDataRangeTransport) { - this.pdfDataRangeTransport.transportReady(); - } - }, this); - - messageHandler.on('StartRenderPage', function transportRender(data) { - if (this.destroyed) { - return; // Ignore any pending requests if the worker was terminated. - } - var page = this.pageCache[data.pageIndex]; - - page.stats.timeEnd('Page Request'); - page._startRenderPage(data.transparency, data.intent); - }, this); - - messageHandler.on('RenderPageChunk', function transportRender(data) { - if (this.destroyed) { - return; // Ignore any pending requests if the worker was terminated. - } - var page = this.pageCache[data.pageIndex]; - - page._renderPageChunk(data.operatorList, data.intent); - }, this); - - messageHandler.on('commonobj', function transportObj(data) { - if (this.destroyed) { - return; // Ignore any pending requests if the worker was terminated. - } - - var id = data[0]; - var type = data[1]; - if (this.commonObjs.hasData(id)) { - return; - } - - switch (type) { - case 'Font': - var exportedData = data[2]; - - var font; - if ('error' in exportedData) { - var error = exportedData.error; - warn('Error during font loading: ' + error); - this.commonObjs.resolve(id, error); - break; - } else { - font = new FontFaceObject(exportedData); - } - - this.fontLoader.bind( - [font], - function fontReady(fontObjs) { - this.commonObjs.resolve(id, font); - }.bind(this) - ); - break; - case 'FontPath': - this.commonObjs.resolve(id, data[2]); - break; - default: - error('Got unknown common object type ' + type); - } - }, this); - - messageHandler.on('obj', function transportObj(data) { - if (this.destroyed) { - return; // Ignore any pending requests if the worker was terminated. - } - - var id = data[0]; - var pageIndex = data[1]; - var type = data[2]; - var pageProxy = this.pageCache[pageIndex]; - var imageData; - if (pageProxy.objs.hasData(id)) { - return; - } - - switch (type) { - case 'JpegStream': - imageData = data[3]; - loadJpegStream(id, imageData, pageProxy.objs); - break; - case 'Image': - imageData = data[3]; - pageProxy.objs.resolve(id, imageData); - - // heuristics that will allow not to store large data - var MAX_IMAGE_SIZE_TO_STORE = 8000000; - if (imageData && 'data' in imageData && - imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) { - pageProxy.cleanupAfterRender = true; - } - break; - default: - error('Got unknown object type ' + type); - } - }, this); - - messageHandler.on('DocProgress', function transportDocProgress(data) { - if (this.destroyed) { - return; // Ignore any pending requests if the worker was terminated. - } - - var loadingTask = this.loadingTask; - if (loadingTask.onProgress) { - loadingTask.onProgress({ - loaded: data.loaded, - total: data.total - }); - } - }, this); - - messageHandler.on('PageError', function transportError(data) { - if (this.destroyed) { - return; // Ignore any pending requests if the worker was terminated. - } - - var page = this.pageCache[data.pageNum - 1]; - var intentState = page.intentStates[data.intent]; - if (intentState.displayReadyCapability) { - intentState.displayReadyCapability.reject(data.error); + if (!timeout) { + render(_this); } else { - error(data.error); + _this._renderTimer = setTimeout(function () { + render(_this); + _this._renderTimer = null; + }, timeout); } - }, this); - - messageHandler.on('UnsupportedFeature', - function transportUnsupportedFeature(data) { - if (this.destroyed) { - return; // Ignore any pending requests if the worker was terminated. - } - var featureId = data.featureId; - var loadingTask = this.loadingTask; - if (loadingTask.onUnsupportedFeature) { - loadingTask.onUnsupportedFeature(featureId); - } - PDFJS.UnsupportedManager.notify(featureId); - }, this); - - messageHandler.on('JpegDecode', function(data) { - if (this.destroyed) { - return Promise.reject('Worker was terminated'); - } - - var imageUrl = data[0]; - var components = data[1]; - 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 Uint8Array(size * components); - var tmpCanvas = createScratchCanvas(width, height); - var tmpCtx = tmpCanvas.getContext('2d'); - tmpCtx.drawImage(img, 0, 0); - var data = tmpCtx.getImageData(0, 0, width, height).data; - var i, j; - - if (components === 3) { - for (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 (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); + }, this._capability.reject); }, - - getData: function WorkerTransport_getData() { - return this.messageHandler.sendWithPromise('GetData', null); - }, - - getPage: function WorkerTransport_getPage(pageNumber, capability) { - if (pageNumber <= 0 || pageNumber > this.numPages || - (pageNumber|0) !== pageNumber) { - return Promise.reject(new Error('Invalid page request')); + expandTextDivs: function TextLayer_expandTextDivs(expandDivs) { + if (!this._enhanceTextSelection || !this._renderingDone) { + return; } - var pageIndex = pageNumber - 1; - if (pageIndex in this.pagePromises) { - return this.pagePromises[pageIndex]; + if (this._bounds !== null) { + expand(this); + this._bounds = null; } - var promise = this.messageHandler.sendWithPromise('GetPage', { - pageIndex: pageIndex - }).then(function (pageInfo) { - if (this.destroyed) { - throw new Error('Transport destroyed'); + + 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; } - var page = new PDFPageProxy(pageIndex, pageInfo, this); - this.pageCache[pageIndex] = page; - return page; - }.bind(this)); - this.pagePromises[pageIndex] = promise; - return promise; - }, - getPageIndex: function WorkerTransport_getPageIndexByRef(ref) { - return this.messageHandler.sendWithPromise('GetPageIndex', { ref: ref }); - }, + if (expandDivs) { + var transform = '', + padding = ''; - getAnnotations: function WorkerTransport_getAnnotations(pageIndex, intent) { - return this.messageHandler.sendWithPromise('GetAnnotations', { - pageIndex: pageIndex, - intent: intent, - }); - }, - - getDestinations: function WorkerTransport_getDestinations() { - return this.messageHandler.sendWithPromise('GetDestinations', null); - }, - - getDestination: function WorkerTransport_getDestination(id) { - return this.messageHandler.sendWithPromise('GetDestination', { id: id }); - }, - - getPageLabels: function WorkerTransport_getPageLabels() { - return this.messageHandler.sendWithPromise('GetPageLabels', null); - }, - - getAttachments: function WorkerTransport_getAttachments() { - return this.messageHandler.sendWithPromise('GetAttachments', null); - }, - - getJavaScript: function WorkerTransport_getJavaScript() { - return this.messageHandler.sendWithPromise('GetJavaScript', null); - }, - - getOutline: function WorkerTransport_getOutline() { - return this.messageHandler.sendWithPromise('GetOutline', null); - }, - - getMetadata: function WorkerTransport_getMetadata() { - return this.messageHandler.sendWithPromise('GetMetadata', null). - then(function transportMetadata(results) { - return { - info: results[0], - metadata: (results[1] ? new Metadata(results[1]) : null) - }; - }); - }, - - getStats: function WorkerTransport_getStats() { - return this.messageHandler.sendWithPromise('GetStats', null); - }, - - startCleanup: function WorkerTransport_startCleanup() { - this.messageHandler.sendWithPromise('Cleanup', null). - then(function endCleanup() { - for (var i = 0, ii = this.pageCache.length; i < ii; i++) { - var page = this.pageCache[i]; - if (page) { - page.cleanup(); + 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; + } + } else { + div.style.padding = 0; + div.style.transform = divProperties.originalTransform || ''; } - this.commonObjs.clear(); - this.fontLoader.clear(); - }.bind(this)); + } } }; - return WorkerTransport; -})(); + 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 + }); -/** - * A PDF document and page is built of many objects. E.g. there are objects - * for fonts, images, rendering code and such. These objects might get processed - * inside of a worker. The `PDFObjects` implements some basic functions to - * manage these objects. - * @ignore - */ -var PDFObjects = (function PDFObjectsClosure() { - function PDFObjects() { - this.objs = {}; + task._render(renderParameters.timeout); + + return task; } - PDFObjects.prototype = { - /** - * Internal function. - * Ensures there is an object defined for `objId`. - */ - ensureObj: function PDFObjects_ensureObj(objId) { - if (this.objs[objId]) { - return this.objs[objId]; + return renderTextLayer; +}(); + +exports.renderTextLayer = renderTextLayer; + +/***/ }), +/* 163 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.AnnotationLayer = void 0; + +var _dom_utils = __w_pdfjs_require__(151); + +var _util = __w_pdfjs_require__(1); + +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) { 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 _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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +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 _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.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); + } + } + }]); + + 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); + } + } + + _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); + + 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; + } } - var obj = { - capability: createPromiseCapability(), - data: null, - resolved: false - }; - this.objs[objId] = obj; - - return obj; - }, - - /** - * If called *without* callback, this returns the data of `objId` but the - * object needs to be resolved. If it isn't, this function throws. - * - * If called *with* a callback, the callback is called with the data of the - * object once the object is resolved. That means, if you call this - * function and the object is already resolved, the callback gets called - * right away. - */ - get: function PDFObjects_get(objId, callback) { - // If there is a callback, then the get can be async and the object is - // not required to be resolved right now - if (callback) { - this.ensureObj(objId).capability.promise.then(callback); - return null; + 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); } - // If there isn't a callback, the user expects to get the resolved data - // directly. - var obj = this.objs[objId]; + 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'); + } + }]); - // If there isn't an object yet or the object isn't resolved, then the - // data isn't ready yet! - if (!obj || !obj.resolved) { - error('Requesting object that isn\'t resolved yet ' + objId); + return AnnotationElement; +}(); + +var LinkAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement) { + _inherits(LinkAnnotationElement, _AnnotationElement); + + function LinkAnnotationElement(parameters) { + _classCallCheck(this, LinkAnnotationElement); + + var isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action); + return _possibleConstructorReturn(this, _getPrototypeOf(LinkAnnotationElement).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'); + (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); + } } - return obj.data; - }, + this.container.appendChild(link); + return this.container; + } + }, { + key: "_bindLink", + value: function _bindLink(link, destination) { + var _this = this; - /** - * Resolves the object `objId` with optional `data`. - */ - resolve: function PDFObjects_resolve(objId, data) { - var obj = this.ensureObj(objId); + link.href = this.linkService.getDestinationHash(destination); - obj.resolved = true; - obj.data = data; - obj.capability.resolve(data); - }, + link.onclick = function () { + if (destination) { + _this.linkService.navigateTo(destination); + } - isResolved: function PDFObjects_isResolved(objId) { - var objs = this.objs; - - if (!objs[objId]) { return false; - } else { - return objs[objId].resolved; + }; + + if (destination) { + link.className = 'internalLink'; } - }, - - hasData: function PDFObjects_hasData(objId) { - return this.isResolved(objId); - }, - - /** - * Returns the data of `objId` if object exists, null otherwise. - */ - getData: function PDFObjects_getData(objId) { - var objs = this.objs; - if (!objs[objId] || !objs[objId].resolved) { - return null; - } else { - return objs[objId].data; - } - }, - - clear: function PDFObjects_clear() { - this.objs = {}; } - }; - return PDFObjects; -})(); + }, { + key: "_bindNamedAction", + value: function _bindNamedAction(link, action) { + var _this2 = this; -/** - * Allows controlling of the rendering tasks. - * @class - * @alias RenderTask - */ -var RenderTask = (function RenderTaskClosure() { - function RenderTask(internalRenderTask) { - this._internalRenderTask = internalRenderTask; + link.href = this.linkService.getAnchorUrl(''); - /** - * Callback for incremental rendering -- a function that will be called - * each time the rendering is paused. To continue rendering call the - * function that is the first argument to the callback. - * @type {function} - */ - this.onContinue = null; + link.onclick = function () { + _this2.linkService.executeNamedAction(action); + + return false; + }; + + link.className = 'internalLink'; + } + }]); + + return LinkAnnotationElement; +}(AnnotationElement); + +var TextAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement2) { + _inherits(TextAnnotationElement, _AnnotationElement2); + + function TextAnnotationElement(parameters) { + _classCallCheck(this, TextAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _possibleConstructorReturn(this, _getPrototypeOf(TextAnnotationElement).call(this, parameters, isRenderable)); } - RenderTask.prototype = /** @lends RenderTask.prototype */ { - /** - * Promise for rendering task completion. - * @return {Promise} - */ - get promise() { - return this._internalRenderTask.capability.promise; - }, + _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 + }); - /** - * Cancels the rendering task. If the task is currently rendering it will - * not be cancelled until graphics pauses with a timeout. The promise that - * this object extends will resolved when cancelled. - */ - cancel: function RenderTask_cancel() { - this._internalRenderTask.cancel(); - }, + if (!this.data.hasPopup) { + this._createPopup(this.container, image, this.data); + } - /** - * Registers callbacks to indicate the rendering task completion. - * - * @param {function} onFulfilled The callback for the rendering completion. - * @param {function} onRejected The callback for the rendering failure. - * @return {Promise} A promise that is resolved after the onFulfilled or - * onRejected callback. - */ - then: function RenderTask_then(onFulfilled, onRejected) { - return this.promise.then.apply(this.promise, arguments); + this.container.appendChild(image); + return this.container; } - }; + }]); - return RenderTask; -})(); + return TextAnnotationElement; +}(AnnotationElement); -/** - * For internal use only. - * @ignore - */ -var InternalRenderTask = (function InternalRenderTaskClosure() { +var WidgetAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement3) { + _inherits(WidgetAnnotationElement, _AnnotationElement3); - function InternalRenderTask(callback, params, objs, commonObjs, operatorList, - pageNumber) { - this.callback = callback; - this.params = params; - this.objs = objs; - this.commonObjs = commonObjs; - this.operatorListIdx = null; - this.operatorList = operatorList; - this.pageNumber = pageNumber; - this.running = false; - this.graphicsReadyCallback = null; - this.graphicsReady = false; - this.useRequestAnimationFrame = false; - this.cancelled = false; - this.capability = createPromiseCapability(); - this.task = new RenderTask(this); - // caching this-bound methods - this._continueBound = this._continue.bind(this); - this._scheduleNextBound = this._scheduleNext.bind(this); - this._nextBound = this._next.bind(this); + function WidgetAnnotationElement() { + _classCallCheck(this, WidgetAnnotationElement); + + return _possibleConstructorReturn(this, _getPrototypeOf(WidgetAnnotationElement).apply(this, arguments)); } - InternalRenderTask.prototype = { + _createClass(WidgetAnnotationElement, [{ + key: "render", + value: function render() { + return this.container; + } + }]); - initalizeGraphics: - function InternalRenderTask_initalizeGraphics(transparency) { + return WidgetAnnotationElement; +}(AnnotationElement); - if (this.cancelled) { - return; - } - if (PDFJS.pdfBug && 'StepperManager' in globalScope && - globalScope.StepperManager.enabled) { - this.stepper = globalScope.StepperManager.create(this.pageNumber - 1); - this.stepper.init(this.operatorList); - this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint(); - } +var TextWidgetAnnotationElement = +/*#__PURE__*/ +function (_WidgetAnnotationElem) { + _inherits(TextWidgetAnnotationElement, _WidgetAnnotationElem); - var params = this.params; - this.gfx = new CanvasGraphics(params.canvasContext, this.commonObjs, - this.objs, params.imageLayer); + function TextWidgetAnnotationElement(parameters) { + _classCallCheck(this, TextWidgetAnnotationElement); - this.gfx.beginDrawing(params.transform, params.viewport, transparency); - this.operatorListIdx = 0; - this.graphicsReady = true; - if (this.graphicsReadyCallback) { - this.graphicsReadyCallback(); - } - }, + var isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue; + return _possibleConstructorReturn(this, _getPrototypeOf(TextWidgetAnnotationElement).call(this, parameters, isRenderable)); + } - cancel: function InternalRenderTask_cancel() { - this.running = false; - this.cancelled = true; - this.callback('cancelled'); - }, + _createClass(TextWidgetAnnotationElement, [{ + key: "render", + value: function render() { + var TEXT_ALIGNMENT = ['left', 'center', 'right']; + this.container.className = 'textWidgetAnnotation'; + var element = null; - operatorListChanged: function InternalRenderTask_operatorListChanged() { - if (!this.graphicsReady) { - if (!this.graphicsReadyCallback) { - this.graphicsReadyCallback = this._continueBound; + 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); } - return; - } - if (this.stepper) { - this.stepper.updateOperatorList(this.operatorList); - } + element.disabled = this.data.readOnly; - if (this.running) { - return; - } - this._continue(); - }, + if (this.data.maxLen !== null) { + element.maxLength = this.data.maxLen; + } - _continue: function InternalRenderTask__continue() { - this.running = true; - if (this.cancelled) { - return; - } - if (this.task.onContinue) { - this.task.onContinue.call(this.task, this._scheduleNextBound); + 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 { - this._scheduleNext(); - } - }, + element = document.createElement('div'); + element.textContent = this.data.fieldValue; + element.style.verticalAlign = 'middle'; + element.style.display = 'table-cell'; + var font = null; - _scheduleNext: function InternalRenderTask__scheduleNext() { - if (this.useRequestAnimationFrame) { - window.requestAnimationFrame(this._nextBound); - } else { - Promise.resolve(undefined).then(this._nextBound); - } - }, + if (this.data.fontRefName && this.page.commonObjs.has(this.data.fontRefName)) { + font = this.page.commonObjs.get(this.data.fontRefName); + } - _next: function InternalRenderTask__next() { - if (this.cancelled) { + 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; } - 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(); - this.callback(); + + 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; + } + }]); + + return TextWidgetAnnotationElement; +}(WidgetAnnotationElement); + +var CheckboxWidgetAnnotationElement = +/*#__PURE__*/ +function (_WidgetAnnotationElem2) { + _inherits(CheckboxWidgetAnnotationElement, _WidgetAnnotationElem2); + + function CheckboxWidgetAnnotationElement(parameters) { + _classCallCheck(this, CheckboxWidgetAnnotationElement); + + return _possibleConstructorReturn(this, _getPrototypeOf(CheckboxWidgetAnnotationElement).call(this, parameters, parameters.renderInteractiveForms)); + } + + _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); + } + + this.container.appendChild(element); + return this.container; + } + }]); + + return CheckboxWidgetAnnotationElement; +}(WidgetAnnotationElement); + +var RadioButtonWidgetAnnotationElement = +/*#__PURE__*/ +function (_WidgetAnnotationElem3) { + _inherits(RadioButtonWidgetAnnotationElement, _WidgetAnnotationElem3); + + function RadioButtonWidgetAnnotationElement(parameters) { + _classCallCheck(this, RadioButtonWidgetAnnotationElement); + + return _possibleConstructorReturn(this, _getPrototypeOf(RadioButtonWidgetAnnotationElement).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); + } + + this.container.appendChild(element); + return this.container; + } + }]); + + return RadioButtonWidgetAnnotationElement; +}(WidgetAnnotationElement); + +var PushButtonWidgetAnnotationElement = +/*#__PURE__*/ +function (_LinkAnnotationElemen) { + _inherits(PushButtonWidgetAnnotationElement, _LinkAnnotationElemen); + + function PushButtonWidgetAnnotationElement() { + _classCallCheck(this, PushButtonWidgetAnnotationElement); + + return _possibleConstructorReturn(this, _getPrototypeOf(PushButtonWidgetAnnotationElement).apply(this, arguments)); + } + + _createClass(PushButtonWidgetAnnotationElement, [{ + key: "render", + value: function render() { + var container = _get(_getPrototypeOf(PushButtonWidgetAnnotationElement.prototype), "render", this).call(this); + + container.className = 'buttonWidgetAnnotation pushButton'; + return container; + } + }]); + + return PushButtonWidgetAnnotationElement; +}(LinkAnnotationElement); + +var ChoiceWidgetAnnotationElement = +/*#__PURE__*/ +function (_WidgetAnnotationElem4) { + _inherits(ChoiceWidgetAnnotationElement, _WidgetAnnotationElem4); + + function ChoiceWidgetAnnotationElement(parameters) { + _classCallCheck(this, ChoiceWidgetAnnotationElement); + + return _possibleConstructorReturn(this, _getPrototypeOf(ChoiceWidgetAnnotationElement).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; + + 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; + } + }]); + + return ChoiceWidgetAnnotationElement; +}(WidgetAnnotationElement); + +var PopupAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement4) { + _inherits(PopupAnnotationElement, _AnnotationElement4); + + function PopupAnnotationElement(parameters) { + _classCallCheck(this, PopupAnnotationElement); + + var isRenderable = !!(parameters.data.title || parameters.data.contents); + return _possibleConstructorReturn(this, _getPrototypeOf(PopupAnnotationElement).call(this, parameters, isRenderable)); + } + + _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; + } + }]); + + return PopupAnnotationElement; +}(AnnotationElement); + +var PopupElement = +/*#__PURE__*/ +function () { + function PopupElement(parameters) { + _classCallCheck(this, PopupElement); + + 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; + } + + _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); + } + + 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; + } + }, { + 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')); + } + } + + return p; + } + }, { + key: "_toggle", + value: function _toggle() { + if (this.pinned) { + this._hide(true); + } else { + this._show(true); + } + } + }, { + 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; + } + } + }, { + 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; + } + } + }]); + + return PopupElement; +}(); + +var LineAnnotationElement = +/*#__PURE__*/ +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, _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 = +/*#__PURE__*/ +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, _getPrototypeOf(SquareAnnotationElement).call(this, parameters, isRenderable, 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); + 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 (_AnnotationElement7) { + _inherits(CircleAnnotationElement, _AnnotationElement7); + + function CircleAnnotationElement(parameters) { + _classCallCheck(this, CircleAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _possibleConstructorReturn(this, _getPrototypeOf(CircleAnnotationElement).call(this, parameters, isRenderable, true)); + } + + _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; + } + }]); + + return CircleAnnotationElement; +}(AnnotationElement); + +var PolylineAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement8) { + _inherits(PolylineAnnotationElement, _AnnotationElement8); + + function PolylineAnnotationElement(parameters) { + var _this3; + + _classCallCheck(this, PolylineAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + _this3 = _possibleConstructorReturn(this, _getPrototypeOf(PolylineAnnotationElement).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 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; + } + }]); + + return PolylineAnnotationElement; +}(AnnotationElement); + +var PolygonAnnotationElement = +/*#__PURE__*/ +function (_PolylineAnnotationEl) { + _inherits(PolygonAnnotationElement, _PolylineAnnotationEl); + + function PolygonAnnotationElement(parameters) { + var _this4; + + _classCallCheck(this, PolygonAnnotationElement); + + _this4 = _possibleConstructorReturn(this, _getPrototypeOf(PolygonAnnotationElement).call(this, parameters)); + _this4.containerClassName = 'polygonAnnotation'; + _this4.svgElementName = 'svg:polygon'; + return _this4; + } + + return PolygonAnnotationElement; +}(PolylineAnnotationElement); + +var InkAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement9) { + _inherits(InkAnnotationElement, _AnnotationElement9); + + function InkAnnotationElement(parameters) { + var _this5; + + _classCallCheck(this, InkAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + _this5 = _possibleConstructorReturn(this, _getPrototypeOf(InkAnnotationElement).call(this, parameters, isRenderable, true)); + _this5.containerClassName = 'inkAnnotation'; + _this5.svgElementName = 'svg:polyline'; + return _this5; + } + + _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); + } + + this.container.append(svg); + return this.container; + } + }]); + + return InkAnnotationElement; +}(AnnotationElement); + +var HighlightAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement10) { + _inherits(HighlightAnnotationElement, _AnnotationElement10); + + function HighlightAnnotationElement(parameters) { + _classCallCheck(this, HighlightAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _possibleConstructorReturn(this, _getPrototypeOf(HighlightAnnotationElement).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.container; + } + }]); + + return HighlightAnnotationElement; +}(AnnotationElement); + +var UnderlineAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement11) { + _inherits(UnderlineAnnotationElement, _AnnotationElement11); + + function UnderlineAnnotationElement(parameters) { + _classCallCheck(this, UnderlineAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _possibleConstructorReturn(this, _getPrototypeOf(UnderlineAnnotationElement).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); + } + + return this.container; + } + }]); + + return UnderlineAnnotationElement; +}(AnnotationElement); + +var SquigglyAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement12) { + _inherits(SquigglyAnnotationElement, _AnnotationElement12); + + function SquigglyAnnotationElement(parameters) { + _classCallCheck(this, SquigglyAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _possibleConstructorReturn(this, _getPrototypeOf(SquigglyAnnotationElement).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); + } + + return this.container; + } + }]); + + return SquigglyAnnotationElement; +}(AnnotationElement); + +var StrikeOutAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement13) { + _inherits(StrikeOutAnnotationElement, _AnnotationElement13); + + function StrikeOutAnnotationElement(parameters) { + _classCallCheck(this, StrikeOutAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _possibleConstructorReturn(this, _getPrototypeOf(StrikeOutAnnotationElement).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); + } + + return this.container; + } + }]); + + return StrikeOutAnnotationElement; +}(AnnotationElement); + +var StampAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement14) { + _inherits(StampAnnotationElement, _AnnotationElement14); + + function StampAnnotationElement(parameters) { + _classCallCheck(this, StampAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _possibleConstructorReturn(this, _getPrototypeOf(StampAnnotationElement).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); + } + + return this.container; + } + }]); + + return StampAnnotationElement; +}(AnnotationElement); + +var FileAttachmentAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement15) { + _inherits(FileAttachmentAnnotationElement, _AnnotationElement15); + + function FileAttachmentAnnotationElement(parameters) { + var _this6; + + _classCallCheck(this, FileAttachmentAnnotationElement); + + _this6 = _possibleConstructorReturn(this, _getPrototypeOf(FileAttachmentAnnotationElement).call(this, parameters, true)); + var _this6$data$file = _this6.data.file, + filename = _this6$data$file.filename, + content = _this6$data$file.content; + _this6.filename = (0, _dom_utils.getFilenameFromUrl)(filename); + _this6.content = content; + + if (_this6.linkService.eventBus) { + _this6.linkService.eventBus.dispatch('fileattachmentannotation', { + source: _assertThisInitialized(_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); + } + + 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, ''); + } + }]); + + return FileAttachmentAnnotationElement; +}(AnnotationElement); + +var AnnotationLayer = +/*#__PURE__*/ +function () { + function AnnotationLayer() { + _classCallCheck(this, AnnotationLayer); + } + + _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; + +/***/ }), +/* 164 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.SVGGraphics = void 0; + +var _util = __w_pdfjs_require__(1); + +var _dom_utils = __w_pdfjs_require__(151); + +var _is_node = _interopRequireDefault(__w_pdfjs_require__(4)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var SVGGraphics = function SVGGraphics() { + throw new Error('Not implemented: SVGGraphics'); +}; + +exports.SVGGraphics = SVGGraphics; +{ + var SVG_DEFAULTS = { + fontStyle: 'normal', + fontWeight: 'normal', + fillColor: '#000000' }; - return InternalRenderTask; -})(); + 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); -/** - * (Deprecated) Global observer of unsupported feature usages. Use - * onUnsupportedFeature callback of the {PDFDocumentLoadingTask} instance. - */ -PDFJS.UnsupportedManager = (function UnsupportedManagerClosure() { - var listeners = []; + 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_node.default)()) { + return deflateSyncUncompressed(literals); + } + + 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]) + ')'; + } + + 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; + } + + 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; + + 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; + + 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(); + } + }, + setLineWidth: function SVGGraphics_setLineWidth(width) { + if (width > 0) { + 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; + }, + 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(); + }, + 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); + } + }, + 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]); + } + + 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(); + } + }, + 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; + } + + 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); + } + } + + return this.tgrp; + } + }; + return SVGGraphics; + }(); +} + +/***/ }), +/* 165 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFNodeStream = void 0; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); + +var _util = __w_pdfjs_require__(1); + +var _network_utils = __w_pdfjs_require__(166); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { 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 _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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +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 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 fs = require('fs'); + +var http = require('http'); + +var https = require('https'); + +var url = require('url'); + +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:///".concat(sourceUrl)); + } + + if (!parsedUrl.host) { + parsedUrl.protocol = 'file:'; + } + + return parsedUrl; +} + +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._fullRequest = null; + this._rangeRequestReaders = []; + } + + _createClass(PDFNodeStream, [{ + key: "getFullReader", + value: function getFullReader() { + (0, _util.assert)(!this._fullRequest); + this._fullRequest = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this); + return this._fullRequest; + } + }, { + 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: "cancelAllRequests", + value: function cancelAllRequests(reason) { + if (this._fullRequest) { + this._fullRequest.cancel(reason); + } + + var readers = this._rangeRequestReaders.slice(0); + + readers.forEach(function (reader) { + reader.cancel(reason); + }); + } + }]); + + return PDFNodeStream; +}(); + +exports.PDFNodeStream = PDFNodeStream; + +var BaseFullReader = +/*#__PURE__*/ +function () { + function BaseFullReader(stream) { + _classCallCheck(this, BaseFullReader); + + 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; + + 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 _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; + + case 2: + if (!this._done) { + _context.next = 4; + break; + } + + return _context.abrupt("return", { + value: undefined, + done: true + }); + + case 4: + if (!this._storedError) { + _context.next = 6; + break; + } + + throw this._storedError; + + case 6: + chunk = this._readableStream.read(); + + if (!(chunk === null)) { + _context.next = 10; + break; + } + + this._readCapability = (0, _util.createPromiseCapability)(); + return _context.abrupt("return", this.read()); + + 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 + }); + + case 14: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function read() { + return _read.apply(this, arguments); + } + + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + if (!this._readableStream) { + this._error(reason); + + 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); + }); + + 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; + } + }, { + key: "isStreamingSupported", + get: function get() { + return this._isStreamingSupported; + } + }]); + + return BaseFullReader; +}(); + +var BaseRangeReader = +/*#__PURE__*/ +function () { + function BaseRangeReader(stream) { + _classCallCheck(this, BaseRangeReader); + + 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(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; + + case 2: + if (!this._done) { + _context2.next = 4; + break; + } + + return _context2.abrupt("return", { + value: undefined, + done: true + }); + + case 4: + if (!this._storedError) { + _context2.next = 6; + break; + } + + throw this._storedError; + + case 6: + chunk = this._readableStream.read(); + + if (!(chunk === null)) { + _context2.next = 10; + break; + } + + this._readCapability = (0, _util.createPromiseCapability)(); + return _context2.abrupt("return", this.read()); + + 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(); + } + } + }, _callee2, this); + })); + + function read() { + return _read2.apply(this, arguments); + } + + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + if (!this._readableStream) { + this._error(reason); + + return; + } + + this._readableStream.destroy(reason); + } + }, { + key: "_error", + value: function _error(reason) { + this._storedError = reason; + + this._readCapability.resolve(); + } + }, { + 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: "isStreamingSupported", + get: function get() { + return this._isStreamingSupported; + } + }]); + + return BaseRangeReader; +}(); + +function createRequestOptions(url, headers) { return { - listen: function (cb) { - deprecated('Global UnsupportedManager.listen is used: ' + - ' use PDFDocumentLoadingTask.onUnsupportedFeature instead'); - listeners.push(cb); - }, - notify: function (featureId) { - for (var i = 0, ii = listeners.length; i < ii; i++) { - listeners[i](featureId); + protocol: url.protocol, + auth: url.auth, + host: url.hostname, + port: url.port, + path: url.path, + method: 'GET', + headers: headers + }; +} + +var PDFNodeStreamFullReader = +/*#__PURE__*/ +function (_BaseFullReader) { + _inherits(PDFNodeStreamFullReader, _BaseFullReader); + + function PDFNodeStreamFullReader(stream) { + var _this3; + + _classCallCheck(this, PDFNodeStreamFullReader); + + _this3 = _possibleConstructorReturn(this, _getPrototypeOf(PDFNodeStreamFullReader).call(this, stream)); + + var handleResponse = function handleResponse(response) { + if (response.statusCode === 404) { + var error = new _util.MissingPDFException("Missing PDF \"".concat(_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 = +/*#__PURE__*/ +function (_BaseRangeReader) { + _inherits(PDFNodeStreamRangeReader, _BaseRangeReader); + + function PDFNodeStreamRangeReader(stream, start, end) { + var _this4; + + _classCallCheck(this, PDFNodeStreamRangeReader); + + _this4 = _possibleConstructorReturn(this, _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=".concat(start, "-").concat(end - 1); + + var handleResponse = function handleResponse(response) { + if (response.statusCode === 404) { + var error = new _util.MissingPDFException("Missing PDF \"".concat(_this4._url, "\".")); + _this4._storedError = error; + return; + } + + _this4._setReadableStream(response); + }; + + _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 = +/*#__PURE__*/ +function (_BaseFullReader2) { + _inherits(PDFNodeStreamFsFullReader, _BaseFullReader2); + + function PDFNodeStreamFsFullReader(stream) { + var _this5; + + _classCallCheck(this, PDFNodeStreamFsFullReader); + + _this5 = _possibleConstructorReturn(this, _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 \"".concat(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 = +/*#__PURE__*/ +function (_BaseRangeReader2) { + _inherits(PDFNodeStreamFsRangeReader, _BaseRangeReader2); + + function PDFNodeStreamFsRangeReader(stream, start, end) { + var _this6; + + _classCallCheck(this, PDFNodeStreamFsRangeReader); + + _this6 = _possibleConstructorReturn(this, _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; + } + + return PDFNodeStreamFsRangeReader; +}(BaseRangeReader); + +/***/ }), +/* 166 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createResponseStatusError = createResponseStatusError; +exports.extractFilenameFromHeader = extractFilenameFromHeader; +exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities; +exports.validateResponseStatus = validateResponseStatus; + +var _util = __w_pdfjs_require__(1); + +var _content_disposition = __w_pdfjs_require__(167); + +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 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; +} + +/***/ }), +/* 167 */ +/***/ (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) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(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"] != 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); + + _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 = 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) {} + } } } + + 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(contentDisposition) { + var matches = [], + match; + 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; + } + + var _matches$n = _slicedToArray(matches[n], 2), + quot = _matches$n[0], + part = _matches$n[1]; + + 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.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; + } + + 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 (_, 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 ''; +} + +/***/ }), +/* 168 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFFetchStream = void 0; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); + +var _util = __w_pdfjs_require__(1); + +var _network_utils = __w_pdfjs_require__(166); + +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 createFetchOptions(headers, withCredentials, abortController) { + return { + method: 'GET', + headers: headers, + signal: abortController && abortController.signal, + mode: 'cors', + credentials: withCredentials ? 'include' : 'same-origin', + redirect: 'follow' }; -})(); +} -exports.getDocument = PDFJS.getDocument; -exports.PDFDataRangeTransport = PDFDataRangeTransport; -exports.PDFDocumentProxy = PDFDocumentProxy; -exports.PDFPageProxy = PDFPageProxy; -})); +var PDFFetchStream = +/*#__PURE__*/ +function () { + function PDFFetchStream(source) { + _classCallCheck(this, PDFFetchStream); + + this.source = source; + this.isHttp = /^https?:/i.test(source.url); + this.httpHeaders = this.isHttp && source.httpHeaders || {}; + this._fullRequestReader = null; + this._rangeRequestReaders = []; + } + + _createClass(PDFFetchStream, [{ + key: "getFullReader", + value: function getFullReader() { + (0, _util.assert)(!this._fullRequestReader); + this._fullRequestReader = new PDFFetchStreamReader(this); + return this._fullRequestReader; + } + }, { + key: "getRangeReader", + value: function getRangeReader(begin, end) { + var reader = new PDFFetchStreamRangeReader(this, begin, end); + + this._rangeRequestReaders.push(reader); + + return reader; + } + }, { + 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); + }); + } + }]); + + return PDFFetchStream; +}(); + +exports.PDFFetchStream = PDFFetchStream; + +var PDFFetchStreamReader = +/*#__PURE__*/ +function () { + function PDFFetchStreamReader(stream) { + var _this = this; + + _classCallCheck(this, PDFFetchStreamReader); + + this._stream = stream; + this._reader = null; + this._loaded = 0; + this._filename = null; + var source = stream.source; + this._withCredentials = source.withCredentials; + 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') { + 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); + } + + 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); + }; + + var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({ + getResponseHeader: getResponseHeader, + isHttp: _this._stream.isHttp, + rangeChunkSize: _this._rangeChunkSize, + disableRange: _this._disableRange + }), + allowRangeRequests = _validateRangeRequest.allowRangeRequests, + suggestedLength = _validateRangeRequest.suggestedLength; + + _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')); + } + }).catch(this._headersCapability.reject); + this.onProgress = null; + } + + _createClass(PDFFetchStreamReader, [{ + key: "read", + value: function () { + var _read = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee() { + var _ref, value, done, buffer; + + return _regenerator.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return this._headersCapability.promise; + + case 2: + _context.next = 4; + return this._reader.read(); + + case 4: + _ref = _context.sent; + value = _ref.value; + done = _ref.done; + + if (!done) { + _context.next = 9; + break; + } + + 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", { + value: buffer, + done: false + }); + + case 13: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function read() { + return _read.apply(this, arguments); + } + + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + if (this._reader) { + this._reader.cancel(reason); + } + + if (this._abortController) { + this._abortController.abort(); + } + } + }, { + 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 PDFFetchStreamReader; +}(); + +var PDFFetchStreamRangeReader = +/*#__PURE__*/ +function () { + function PDFFetchStreamRangeReader(stream, begin, end) { + var _this2 = this; + + _classCallCheck(this, PDFFetchStreamRangeReader); + + this._stream = stream; + this._reader = null; + this._loaded = 0; + var source = stream.source; + this._withCredentials = source.withCredentials; + this._readCapability = (0, _util.createPromiseCapability)(); + this._isStreamingSupported = !source.disableStream; + + 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); + + 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", + value: function () { + var _read2 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee2() { + var _ref2, value, done, buffer; + + return _regenerator.default.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return this._readCapability.promise; + + case 2: + _context2.next = 4; + return this._reader.read(); + + case 4: + _ref2 = _context2.sent; + value = _ref2.value; + done = _ref2.done; + + if (!done) { + _context2.next = 9; + break; + } + + return _context2.abrupt("return", { + value: value, + done: done + }); + + case 9: + this._loaded += value.byteLength; + + if (this.onProgress) { + this.onProgress({ + loaded: this._loaded + }); + } + + buffer = new Uint8Array(value).buffer; + return _context2.abrupt("return", { + value: buffer, + done: false + }); + + case 13: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function read() { + return _read2.apply(this, arguments); + } + + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + if (this._reader) { + this._reader.cancel(reason); + } + + if (this._abortController) { + this._abortController.abort(); + } + } + }, { + key: "isStreamingSupported", + get: function get() { + return this._isStreamingSupported; + } + }]); + + return PDFFetchStreamRangeReader; +}(); + +/***/ }), +/* 169 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; - }).call(pdfjsLibs); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFNetworkStream = PDFNetworkStream; +exports.NetworkManager = NetworkManager; - exports.PDFJS = pdfjsLibs.pdfjsSharedGlobal.PDFJS; +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); - exports.getDocument = pdfjsLibs.pdfjsDisplayAPI.getDocument; - exports.PDFDataRangeTransport = - pdfjsLibs.pdfjsDisplayAPI.PDFDataRangeTransport; - exports.renderTextLayer = pdfjsLibs.pdfjsDisplayTextLayer.renderTextLayer; - exports.AnnotationLayer = - pdfjsLibs.pdfjsDisplayAnnotationLayer.AnnotationLayer; - exports.CustomStyle = pdfjsLibs.pdfjsDisplayDOMUtils.CustomStyle; - exports.PasswordResponses = pdfjsLibs.pdfjsSharedUtil.PasswordResponses; - exports.InvalidPDFException = pdfjsLibs.pdfjsSharedUtil.InvalidPDFException; - exports.MissingPDFException = pdfjsLibs.pdfjsSharedUtil.MissingPDFException; - exports.UnexpectedResponseException = - pdfjsLibs.pdfjsSharedUtil.UnexpectedResponseException; -})); +var _util = __w_pdfjs_require__(1); +var _network_utils = __w_pdfjs_require__(166); +var _global_scope = _interopRequireDefault(__w_pdfjs_require__(3)); + +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); }); }; } + +; +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_scope.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 _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._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 _read.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 _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; + } + + 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; + }(), + 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(); + } +}; + +/***/ }) +/******/ ]); +}); +//# sourceMappingURL=pdf.js.map \ No newline at end of file diff --git a/public/vendor/plugins/pdfjs/build/pdf.js.map b/public/vendor/plugins/pdfjs/build/pdf.js.map new file mode 100644 index 000000000..7a4bf7ea2 --- /dev/null +++ b/public/vendor/plugins/pdfjs/build/pdf.js.map @@ -0,0 +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/starts-with.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.string.starts-with.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/_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/_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/string/ends-with.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.string.ends-with.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/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-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/array/from.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/_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/_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/_to-object.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.array.from.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/_create-property.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/_classof.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_iter-detect.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-gops.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_object-pie.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/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/_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/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/weak-set.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es6.weak-set.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es7.weak-set.of.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es7.weak-set.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/string/pad-start.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es7.string.pad-start.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_string-pad.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/_string-repeat.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/fn/string/pad-end.js","webpack://pdfjs-dist/build/pdf/node_modules/core-js/modules/es7.string.pad-end.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/node_modules/@babel/runtime/regenerator/index.js","webpack://pdfjs-dist/build/pdf/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime-module.js","webpack://pdfjs-dist/build/pdf/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js","webpack://pdfjs-dist/build/pdf/node_modules/webpack/buildin/module.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/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","params","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","value","enumerable","configurable","writable","lookup","initializer","PasswordException","UnknownErrorException","InvalidPDFException","MissingPDFException","UnexpectedResponseException","MissingDataException","XRefEntryException","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","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","isSettled","get","resolve","reject","createObjectURL","digits","forceDataSchema","URL","blob","type","buffer","b1","b2","b3","d1","d2","d3","d4","globalScope","hasDOM","Buffer","Element","div","document","OriginalDOMTokenListAdd","DOMTokenList","OriginalDOMTokenListRemove","token","force","arguments","Array","module","window","global","self","process","$export","toLength","context","STARTS_WITH","$startsWith","startsWith","that","index","search","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","exec","is","S","val","fn","has","SRC","TO_STRING","$toString","TPL","isFunction","hasOwnProperty","id","px","key","aFunction","toInteger","min","ceil","floor","isNaN","isRegExp","defined","cof","MATCH","toString","store","uid","Symbol","USE_SYMBOL","$exports","SHARED","mode","copyright","re","ENDS_WITH","$endsWith","endsWith","endPosition","len","end","INCLUDES","includes","$includes","toIObject","toAbsoluteIndex","IS_INCLUDES","el","IObject","max","UNSCOPABLES","ArrayProto","$at","done","point","s","l","LIBRARY","Iterators","$iterCreate","setToStringTag","getPrototypeOf","ITERATOR","BUGGY","FF_ITERATOR","KEYS","VALUES","returnThis","getMethod","kind","proto","TAG","NAME","DEF_VALUES","DEFAULT","VALUES_BUG","Base","$native","$default","$entries","$anyNative","IteratorPrototype","methods","keys","IS_SET","entries","create","descriptor","Constructor","next","dPs","enumBugKeys","IE_PROTO","Empty","createDict","iframe","lt","gt","iframeDocument","Properties","getKeys","$keys","arrayIndexOf","names","shared","def","stat","toObject","ObjectProto","call","isArrayIter","createProperty","getIterFn","from","C","aLen","mapfn","mapping","iterFn","iterator","step","ret","$defineProperty","classof","ARG","tryGet","SAFE_CLOSING","riter","safe","iter","assign","gOPS","pIE","$assign","A","B","K","T","getSymbols","isEnum","j","log2","isInteger","isFinite","test","$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","anInstance","forOf","speciesConstructor","task","microtask","newPromiseCapabilityModule","perform","userAgent","promiseResolve","PROMISE","versions","v8","$Promise","isNode","empty","newPromiseCapability","newGenericPromiseCapability","USE_NATIVE","promise","FakePromise","isThenable","notify","chain","ok","run","handler","reaction","domain","onHandleUnhandled","exited","then","isReject","onUnhandled","unhandled","isUnhandled","reason","$reject","$resolve","wrapper","_w","_d","Internal","executor","OwnPromiseCapability","Promise","Wrapper","$$reject","all","remaining","$index","alreadyCalled","race","forbiddenField","name","BREAK","RETURN","f","iterable","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","onFinally","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","mapFn","cb","WEAK_SET","add","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","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","$pad","padStart","repeat","stringLength","fillStr","fillString","intMaxLength","fillLen","stringFiller","left","padEnd","$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","waitForWritesToFinish","action","doTheRest","finalize","ReadableStreamReaderGenericRelease","branches","ReadableStreamTee","IsReadableStreamDisturbed","ReadableStreamDefaultControllerClose","ReadableStreamDefaultControllerEnqueue","ReadableStreamDefaultControllerError","ReadableStreamDefaultControllerGetDesiredSize","teeState","closedOrErrored","canceled1","canceled2","reason1","reason2","pull","create_ReadableStreamTeePullFunction","cancel1","create_ReadableStreamTeeBranch1CancelFunction","cancel2","create_ReadableStreamTeeBranch2CancelFunction","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","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","rangeTransport","pdfBytes","NativeImageDecoderValues","apiCompatibilityParams","setVerbosityLevel","workerParams","postMessageTransfers","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","constructor","transportDestroyed","deprecated","addRangeListener","addProgressListener","addProgressiveReadListener","onDataRange","onDataProgress","onDataProgressiveRead","requestDataRange","getPage","getPageIndex","getDestination","pdfBug","getViewport","rotation","dontFlip","scale","viewBox","getAnnotations","intent","enableWebGL","renderInteractiveForms","imageLayer","canvasFactory","background","render","stats","renderingIntent","canvasFactoryInstance","webGLContext","enable","intentState","fnArray","argsArray","lastChunk","pageIndex","complete","internalRenderTask","callback","canvasContext","viewport","objs","commonObjs","operatorList","pageNumber","useRequestAnimationFrame","renderTask","transparency","opListTask","streamTextContent","normalizeWhitespace","disableCombineTextItems","TEXT_CONTENT_CHUNK_SIZE","combineTextItems","textContent","getTextContent","pump","items","styles","waitOn","renderCompleted","resetStats","cleanup","_tryCleanup","_startRenderPage","_renderPageChunk","operatorListChunk","postMessage","cloned","transferable","transfers","desc","cloneValue","addEventListener","removeEventListener","pdfWorkerPorts","nextFakeWorkerId","fakeWorkerFilesLoadedCapability","mainWorkerMessageHandler","getMainThreadWorkerMessageHandler","loader","getWorkerSrc","_initializeFromPort","workerSrc","isSameOrigin","createCDNWrapper","terminateEarly","onWorkerError","sendTest","testObj","info","setupFakeWorkerGlobal","WorkerMessageHandler","workerHandler","loadingTask","onUnsupportedFeature","isCompressed","page","terminated","evt","loaded","total","headersCapability","fullReader","isStreamingSupported","isRangeSupported","contentLength","rangeReader","pdfInfo","updatePassword","exception","exportedError","exportedData","fontRegistry","registerFont","pageProxy","img","MAX_IMAGE_SIZE_TO_STORE","imageData","components","width","height","rgbaLength","buf","tmpCanvas","tmpCtx","_onUnsupportedFeature","pageInfo","ref","results","metadata","contentDispositionFilename","_ensureObj","resolved","InternalRenderTask","canvasInRendering","initializeGraphics","cancel","build","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","callInvokeWithMethodAndArg","defineIteratorMethods","AsyncIterator","doneResult","delegate","delegateResult","maybeInvokeDelegate","tryLoc","locs","iteratorMethod","Context","reset","stop","rootEntry","rootRecord","dispatchException","handle","hasCatch","hasFinally","abrupt","finallyEntry","finish","resetTryEntry","thrown","delegateYield","resultName","nextLoc","DEFAULT_LINK_REL","SVG_NS","canvas","canvasAndContext","destroy","fetch","request","XMLHttpRequest","cMapData","compressionType","svg","createElement","offsetX","offsetY","centerX","centerY","rotateA","rotateB","rotateC","rotateD","offsetCanvasX","offsetCanvasY","clone","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","addNativeFontFace","insertRule","styleElement","styleSheet","nativeFontFace","featureId","rule","_queueLoadingCallback","_prepareFontLoadEvent","FontLoader","requests","nextRequestId","otherRequest","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","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","executionStartIdx","argsArrayLen","chunkOperations","endTime","stepper","fnId","deps","nn","depObjId","objsPool","continueCallback","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","objId","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","backgroundColor","figures","cachedCanvases","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","wrapReason","sourceName","targetName","comObj","isReply","makeReasonSerializable","MessageHandler","on","send","sendWithPromise","sendWithStream","streamId","startCapability","startCall","isClosed","pullCapability","cancelCapability","_createStreamSink","sendStreamRequest","success","streamSink","enqueue","lastDesiredSize","close","sinkCapability","onPull","onCancel","isCancelled","resolveCall","_processStreamMessage","sendStreamResponse","deleteStreamController","resolveOrReject","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","skipWs","attrName","attrValue","attrEndChar","attrEndIndex","parsed","_parseProcessingInstruction","attrStart","parseXml","ch2","pi","q2","complexDoctype","doctypeContent","content","text","onResolveEntity","onPi","onComment","onCdata","onDoctype","onText","onBeginElement","onEndElement","onError","childNodes","child","parseFromString","documentElement","isWhitespaceString","lastElement","PDFDataTransportStream","begin","_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","generateGL","vertexShader","createVertexShader","fragmentShader","createFragmentShader","cache","texCoordLocation","texLayerLocation","texMaskLocation","texCoordBuffer","initSmaskGL","createTexture","maskTexture","figuresVertexShaderCode","figuresFragmentShaderCode","figuresCache","initFiguresGL","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","appendText","_layoutText","textLayerFrag","fontFamily","_render","styleCache","textItems","textStyles","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","filename","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","_initialize","definitions","rootGroup","_ensureClipGroup","clipGroup","_ensureTransformGroup","fs","http","https","fileUriRegex","parsedUrl","parseUrl","_error","_setReadableStream","protocol","auth","headers","handleResponse","response","getResponseHeader","isHttp","suggestedLength","extractFilenameFromHeader","createRequestOptions","returnValues","allowRangeRequests","contentEncoding","contentDisposition","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","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;;;;;;;;AClFA;;AAkBA,IAAIA,eAlBJ,SAkBA;AAEA,IAAIC,aApBJ,UAoBA;;AAGA,IAAIC,kBAAkBC,oBAvBtB,CAuBsBA,CAAtB;;AACA,IAAIC,kBAAkBD,oBAxBtB,GAwBsBA,CAAtB;;AACA,IAAIE,wBAAwBF,oBAzB5B,GAyB4BA,CAA5B;;AACA,IAAIG,8BAA8BH,oBA1BlC,GA0BkCA,CAAlC;;AACA,IAAII,uBAAuBJ,oBA3B3B,GA2B2BA,CAA3B;;AACA,IAAIK,kBAAkBL,oBA5BtB,GA4BsBA,CAAtB;;AACA,IAAIM,4BAA4BN,oBA7BhC,GA6BgCA,CAAhC;;AACA,IAAIO,+BAA+BP,oBA9BnC,GA8BmCA,CAAnC;;AAEiE;AAC/D,MAAMQ,WA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;AA6C3C,kCAVW,iBAUX;;AA7C2C,gDA8CpCA,kBAXI,OAnCgC;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAiD7C9jB,UAAQ,2DAA2D;AACjE,iBADiE,IACjE;;AACA,2BAAuB,6BAA6B;AAClD8jB,gCAA0B;AAAEvpD,eAAF;AAAoB6N,cAApB;AAAA,OAA1B07C;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/CsU,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\nconst XRefEntryException = (function XRefEntryExceptionClosure() {\n function XRefEntryException(msg) {\n this.message = msg;\n }\n\n XRefEntryException.prototype = new Error();\n XRefEntryException.prototype.name = 'XRefEntryException';\n XRefEntryException.constructor = XRefEntryException;\n\n return XRefEntryException;\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 {boolean} settled - If the Promise has been fulfilled/rejected.\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}\n */\nfunction createPromiseCapability() {\n const capability = Object.create(null);\n let isSettled = false;\n\n Object.defineProperty(capability, 'settled', {\n get() {\n return isSettled;\n },\n });\n capability.promise = new Promise(function(resolve, reject) {\n capability.resolve = function(data) {\n isSettled = true;\n resolve(data);\n };\n capability.reject = function(reason) {\n isSettled = true;\n reject(reason);\n };\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 XRefEntryException,\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\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 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.{add, remove}, with more than\n// one parameter, in legacy browsers.\n// Support: IE\n(function checkDOMTokenListAddRemove() {\n if (!hasDOM || isNodeJS()) {\n return;\n }\n const div = document.createElement('div');\n div.classList.add('testOne', 'testTwo');\n\n if (div.classList.contains('testOne') === true &&\n div.classList.contains('testTwo') === true) {\n return;\n }\n const OriginalDOMTokenListAdd = DOMTokenList.prototype.add;\n const OriginalDOMTokenListRemove = DOMTokenList.prototype.remove;\n\n DOMTokenList.prototype.add = function(...tokens) {\n for (let token of tokens) {\n OriginalDOMTokenListAdd.call(this, token);\n }\n };\n DOMTokenList.prototype.remove = function(...tokens) {\n for (let token of tokens) {\n OriginalDOMTokenListRemove.call(this, token);\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\n DOMTokenList.prototype.toggle = function(token) {\n let force = (arguments.length > 1 ? !!arguments[1] : !this.contains(token));\n return (this[force ? 'add' : 'remove'](token), force);\n };\n})();\n\n// Provides support for String.prototype.startsWith in legacy browsers.\n// Support: IE, Chrome<41\n(function checkStringStartsWith() {\n if (String.prototype.startsWith) {\n return;\n }\n require('core-js/fn/string/starts-with');\n})();\n\n// Provides support for String.prototype.endsWith in legacy browsers.\n// Support: IE, Chrome<41\n(function checkStringEndsWith() {\n if (String.prototype.endsWith) {\n return;\n }\n require('core-js/fn/string/ends-with');\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 Array.from in legacy browsers.\n// Support: IE\n(function checkArrayFrom() {\n if (Array.from) {\n return;\n }\n require('core-js/fn/array/from');\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<11, Chrome<63\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 && (globalScope.Promise.prototype &&\n globalScope.Promise.prototype.finally)) {\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// Support: IE11\n(function checkWeakSet() {\n if (globalScope.WeakSet) {\n return;\n }\n globalScope.WeakSet = require('core-js/fn/weak-set');\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// Provides support for String.prototype.padStart in legacy browsers.\n// Support: IE, Chrome<57\n(function checkStringPadStart() {\n if (String.prototype.padStart) {\n return;\n }\n require('core-js/fn/string/pad-start');\n})();\n\n// Provides support for String.prototype.padEnd in legacy browsers.\n// Support: IE, Chrome<57\n(function checkStringPadEnd() {\n if (String.prototype.padEnd) {\n return;\n }\n require('core-js/fn/string/pad-end');\n})();\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 // NW.js is a browser context, but copies some Node.js objects; see\n // http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context\n return typeof process === 'object' &&\n process + '' === '[object process]' &&\n !process.versions['nw'];\n};\n","require('../../modules/es6.string.starts-with');\nmodule.exports = require('../../modules/_core').String.startsWith;\n","// 21.1.3.18 String.prototype.startsWith(searchString [, position ])\n'use strict';\nvar $export = require('./_export');\nvar toLength = require('./_to-length');\nvar context = require('./_string-context');\nvar STARTS_WITH = 'startsWith';\nvar $startsWith = ''[STARTS_WITH];\n\n$export($export.P + $export.F * require('./_fails-is-regexp')(STARTS_WITH), 'String', {\n startsWith: function startsWith(searchString /* , position = 0 */) {\n var that = context(this, searchString, STARTS_WITH);\n var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length));\n var search = String(searchString);\n return $startsWith\n ? $startsWith.call(that, search, index)\n : that.slice(index, index + search.length) === search;\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.6.2' };\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","// 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","// 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: '© 2019 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/es6.string.ends-with');\nmodule.exports = require('../../modules/_core').String.endsWith;\n","// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])\n'use strict';\nvar $export = require('./_export');\nvar toLength = require('./_to-length');\nvar context = require('./_string-context');\nvar ENDS_WITH = 'endsWith';\nvar $endsWith = ''[ENDS_WITH];\n\n$export($export.P + $export.F * require('./_fails-is-regexp')(ENDS_WITH), 'String', {\n endsWith: function endsWith(searchString /* , endPosition = @length */) {\n var that = context(this, searchString, ENDS_WITH);\n var endPosition = arguments.length > 1 ? arguments[1] : undefined;\n var len = toLength(that.length);\n var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len);\n var search = String(searchString);\n return $endsWith\n ? $endsWith.call(that, search, end)\n : that.slice(end - search.length, end) === search;\n }\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","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","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.string.iterator');\nrequire('../../modules/es6.array.from');\nmodule.exports = require('../../modules/_core').Array.from;\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","// 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","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","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n","'use strict';\nvar ctx = require('./_ctx');\nvar $export = require('./_export');\nvar toObject = require('./_to-object');\nvar call = require('./_iter-call');\nvar isArrayIter = require('./_is-array-iter');\nvar toLength = require('./_to-length');\nvar createProperty = require('./_create-property');\nvar getIterFn = require('./core.get-iterator-method');\n\n$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', {\n // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)\n from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var C = typeof this == 'function' ? this : Array;\n var aLen = arguments.length;\n var mapfn = aLen > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var index = 0;\n var iterFn = getIterFn(O);\n var length, result, step, iterator;\n if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);\n // if object isn't iterable or it's array with default iterator - use simple case\n if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {\n for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {\n createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);\n }\n } else {\n length = toLength(O.length);\n for (result = new C(length); length > index; index++) {\n createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);\n }\n }\n result.length = index;\n return result;\n }\n});\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","'use strict';\nvar $defineProperty = require('./_object-dp');\nvar createDesc = require('./_property-desc');\n\nmodule.exports = function (object, index, value) {\n if (index in object) $defineProperty.f(object, index, createDesc(0, value));\n else object[index] = value;\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","// 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","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","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","exports.f = Object.getOwnPropertySymbols;\n","exports.f = {}.propertyIsEnumerable;\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","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","// 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","// 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.object.to-string');\nrequire('../modules/web.dom.iterable');\nrequire('../modules/es6.weak-set');\nrequire('../modules/es7.weak-set.of');\nrequire('../modules/es7.weak-set.from');\nmodule.exports = require('../modules/_core').WeakSet;\n","'use strict';\nvar weak = require('./_collection-weak');\nvar validate = require('./_validate-collection');\nvar WEAK_SET = 'WeakSet';\n\n// 23.4 WeakSet Objects\nrequire('./_collection')(WEAK_SET, function (get) {\n return function WeakSet() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };\n}, {\n // 23.4.3.1 WeakSet.prototype.add(value)\n add: function add(value) {\n return weak.def(validate(this, WEAK_SET), value, true);\n }\n}, weak, false, true);\n","// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of\nrequire('./_set-collection-of')('WeakSet');\n","// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from\nrequire('./_set-collection-from')('WeakSet');\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.string.pad-start');\nmodule.exports = require('../../modules/_core').String.padStart;\n","'use strict';\n// https://github.com/tc39/proposal-string-pad-start-end\nvar $export = require('./_export');\nvar $pad = require('./_string-pad');\nvar userAgent = require('./_user-agent');\n\n// https://github.com/zloirock/core-js/issues/280\n$export($export.P + $export.F * /Version\\/10\\.\\d+(\\.\\d+)? Safari\\//.test(userAgent), 'String', {\n padStart: function padStart(maxLength /* , fillString = ' ' */) {\n return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);\n }\n});\n","// https://github.com/tc39/proposal-string-pad-start-end\nvar toLength = require('./_to-length');\nvar repeat = require('./_string-repeat');\nvar defined = require('./_defined');\n\nmodule.exports = function (that, maxLength, fillString, left) {\n var S = String(defined(that));\n var stringLength = S.length;\n var fillStr = fillString === undefined ? ' ' : String(fillString);\n var intMaxLength = toLength(maxLength);\n if (intMaxLength <= stringLength || fillStr == '') return S;\n var fillLen = intMaxLength - stringLength;\n var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));\n if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen);\n return left ? stringFiller + S : S + stringFiller;\n};\n","'use strict';\nvar toInteger = require('./_to-integer');\nvar defined = require('./_defined');\n\nmodule.exports = function repeat(count) {\n var str = String(defined(this));\n var res = '';\n var n = toInteger(count);\n if (n < 0 || n == Infinity) throw RangeError(\"Count can't be negative\");\n for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str;\n return res;\n};\n","require('../../modules/es7.string.pad-end');\nmodule.exports = require('../../modules/_core').String.padEnd;\n","'use strict';\n// https://github.com/tc39/proposal-string-pad-start-end\nvar $export = require('./_export');\nvar $pad = require('./_string-pad');\nvar userAgent = require('./_user-agent');\n\n// https://github.com/zloirock/core-js/issues/280\n$export($export.P + $export.F * /Version\\/10\\.\\d+(\\.\\d+)? Safari\\//.test(userAgent), 'String', {\n padEnd: function padEnd(maxLength /* , fillString = ' ' */) {\n return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);\n }\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\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('MOZCENTRAL')) {\n if (typeof ReadableStream === 'undefined') {\n throw new Error('Please enable ReadableStream support by resetting the ' +\n '\"javascript.options.streams\" preference to \"true\" in about:config.');\n }\n exports.ReadableStream = ReadableStream;\n} else {\n let isReadableStreamSupported = false;\n if (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 }\n if (isReadableStreamSupported) {\n exports.ReadableStream = ReadableStream;\n } else if (typeof PDFJSDev !== 'undefined' &&\n 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 if (typeof PDFJSDev !== 'undefined' &&\n 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","/* 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/* eslint no-var: error */\n\nimport {\n assert, createPromiseCapability, deprecated, getVerbosityLevel, info,\n InvalidPDFException, isArrayBuffer, isSameOrigin, MissingPDFException,\n NativeImageDecoding, PasswordException, setVerbosityLevel, shadow,\n stringToBytes, UnexpectedResponseException, UnknownErrorException,\n 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 === 'object' &&\n 'currentScript' in document) {\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 */\nlet 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 const task = new PDFDocumentLoadingTask();\n\n let 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 source = src;\n }\n const params = Object.create(null);\n let rangeTransport = null, worker = null;\n\n for (const 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 const 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 port: GlobalWorkerOptions.workerPort,\n };\n // Worker was not provided -- creating and owning our own. If message port\n // is specified in global worker options, using it.\n worker = workerParams.port ? PDFWorker.fromPort(workerParams) :\n new PDFWorker(workerParams);\n task._worker = worker;\n }\n const 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 const messageHandler = new MessageHandler(docId, workerId, worker.port);\n messageHandler.postMessageTransfers = worker.postMessageTransfers;\n const 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 */\nconst PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {\n let nextDocumentId = 0;\n\n /** @constructs PDFDocumentLoadingTask */\n class PDFDocumentLoadingTask {\n constructor() {\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 /**\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 const 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(onFulfilled, onRejected) {\n deprecated('PDFDocumentLoadingTask.then method, ' +\n 'use the `promise` getter instead.');\n return this.promise.then.apply(this.promise, arguments);\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 an {Array} containing the\n * destination, or `null` when no open action is present in the PDF file.\n */\n getOpenActionDestination() {\n return this._transport.getOpenActionDestination();\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 getViewport parameters.\n *\n * @typedef {Object} GetViewportParameters\n * @property {number} scale - The desired scale of the viewport.\n * @property {number} rotation - (optional) The desired rotation, in degrees, of\n * the viewport. If omitted it defaults to the page rotation.\n * @property {boolean} dontFlip - (optional) If true, the y-axis will not be\n * flipped. The default value is `false`.\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 the `PDFPageProxy.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 * @alias PDFPageProxy\n */\nclass PDFPageProxy {\n constructor(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\n this.cleanupAfterRender = false;\n this.pendingCleanup = false;\n this.intentStates = Object.create(null);\n this.destroyed = false;\n }\n\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 /**\n * @return {number} The number of degrees the page is rotated clockwise.\n */\n get rotate() {\n return this._pageInfo.rotate;\n }\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 /**\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 /**\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 {GetViewportParameters} params - Viewport parameters.\n * @return {PageViewport} Contains 'width' and 'height' properties\n * along with transforms required for rendering.\n */\n getViewport({ scale, rotation = this.rotate, dontFlip = false, } = {}) {\n if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('GENERIC')) &&\n (arguments.length > 1 || typeof arguments[0] === 'number')) {\n deprecated('getViewport is called with obsolete arguments.');\n scale = arguments[0];\n rotation = typeof arguments[1] === 'number' ? arguments[1] : this.rotate;\n dontFlip = typeof arguments[2] === 'boolean' ? arguments[2] : false;\n }\n return new PageViewport({\n viewBox: this.view,\n scale,\n rotation,\n dontFlip,\n });\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({ intent = null, } = {}) {\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 /**\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({ canvasContext, viewport, intent = 'display', enableWebGL = false,\n renderInteractiveForms = false, transform = null, imageLayer = null,\n canvasFactory = null, background = null, }) {\n const 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 const renderingIntent = (intent === 'print' ? 'print' : 'display');\n const canvasFactoryInstance = canvasFactory || new DOMCanvasFactory();\n const webGLContext = new WebGLContext({\n enable: enableWebGL,\n });\n\n if (!this.intentStates[renderingIntent]) {\n this.intentStates[renderingIntent] = Object.create(null);\n }\n const 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: renderInteractiveForms === true,\n });\n }\n\n const complete = (error) => {\n const 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 const internalRenderTask = new InternalRenderTask({\n callback: complete,\n params: { // Include the required properties, and *not* the entire object.\n canvasContext,\n viewport,\n transform,\n imageLayer,\n background,\n },\n objs: this.objs,\n commonObjs: this.commonObjs,\n operatorList: intentState.operatorList,\n pageNumber: this.pageNumber,\n canvasFactory: canvasFactoryInstance,\n webGLContext,\n useRequestAnimationFrame: renderingIntent !== 'print',\n pdfBug: this._pdfBug,\n });\n\n if (!intentState.renderTasks) {\n intentState.renderTasks = [];\n }\n intentState.renderTasks.push(internalRenderTask);\n const 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() {\n function operatorListChanged() {\n if (intentState.operatorList.lastChunk) {\n intentState.opListReadCapability.resolve(intentState.operatorList);\n\n const i = intentState.renderTasks.indexOf(opListTask);\n if (i >= 0) {\n intentState.renderTasks.splice(i, 1);\n }\n }\n }\n\n const renderingIntent = 'oplist';\n if (!this.intentStates[renderingIntent]) {\n this.intentStates[renderingIntent] = Object.create(null);\n }\n const intentState = this.intentStates[renderingIntent];\n let 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({ normalizeWhitespace = false,\n disableCombineTextItems = false, } = {}) {\n const TEXT_CONTENT_CHUNK_SIZE = 100;\n\n return this._transport.messageHandler.sendWithStream('GetTextContent', {\n pageIndex: this.pageNumber - 1,\n normalizeWhitespace: normalizeWhitespace === true,\n combineTextItems: 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(params = {}) {\n const 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 const reader = readableStream.getReader();\n const textContent = {\n items: [],\n styles: Object.create(null),\n };\n pump();\n });\n }\n\n /**\n * Destroys page object.\n */\n _destroy() {\n this.destroyed = true;\n this._transport.pageCache[this.pageIndex] = null;\n\n const 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 const intentState = this.intentStates[intent];\n intentState.renderTasks.forEach(function(renderTask) {\n const 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 /**\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 const 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 /**\n * For internal use only.\n * @ignore\n */\n _startRenderPage(transparency, intent) {\n const 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 /**\n * For internal use only.\n * @ignore\n */\n _renderPageChunk(operatorListChunk, intent) {\n const intentState = this.intentStates[intent];\n // Add the new chunk to the current operator list.\n for (let 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 (let 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\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 let buffer, result;\n if ((buffer = value.buffer) && isArrayBuffer(buffer)) {\n // We found object with ArrayBuffer (typed array).\n const 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 (const i in value) {\n let 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 const cloned = new WeakMap();\n const 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 const 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 */\nconst PDFWorker = (function PDFWorkerClosure() {\n const pdfWorkerPorts = new WeakMap();\n let nextFakeWorkerId = 0;\n let fakeWorkerFilesLoadedCapability;\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 // Loads worker code into main thread.\n function setupFakeWorkerGlobal() {\n if (fakeWorkerFilesLoadedCapability) {\n return fakeWorkerFilesLoadedCapability.promise;\n }\n fakeWorkerFilesLoadedCapability = createPromiseCapability();\n\n const mainWorkerMessageHandler = getMainThreadWorkerMessageHandler();\n if (mainWorkerMessageHandler) {\n // The worker was already loaded using a ` - + + - - @@ -51,13 +47,13 @@ See https://github.com/adobe-type-tools/cmap-resources
- - -
@@ -70,27 +66,39 @@ See https://github.com/adobe-type-tools/cmap-resources
+
-
- - diff --git a/public/vendor/plugins/pdfjs/web/viewer.js b/public/vendor/plugins/pdfjs/web/viewer.js index 1fc9d7bfe..0aa14fe4f 100644 --- a/public/vendor/plugins/pdfjs/web/viewer.js +++ b/public/vendor/plugins/pdfjs/web/viewer.js @@ -1,4 +1,8 @@ -/* Copyright 2012 Mozilla Foundation +/** + * @licstart The following is the entire license notice for the + * Javascript code in this page + * + * Copyright 2018 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -11,64 +15,3513 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * @licend The above is the entire license notice for the + * Javascript code in this page */ -/* globals PDFJS, PDFBug, FirefoxCom, Stats, ProgressBar, - DownloadManager, getFileName, getPDFFileNameFromURL, - PDFHistory, Preferences, SidebarView, ViewHistory, Stats, - PDFThumbnailViewer, URL, noContextMenuHandler, SecondaryToolbar, - PasswordPrompt, PDFPresentationMode, PDFDocumentProperties, HandTool, - Promise, PDFLinkService, PDFOutlineView, PDFAttachmentView, - OverlayManager, PDFFindController, PDFFindBar, PDFViewer, - PDFRenderingQueue, PresentationModeState, parseQueryString, - RenderingStates, UNKNOWN_SCALE, DEFAULT_SCALE_VALUE, - IGNORE_CURRENT_POSITION_ON_ZOOM: true */ -'use strict'; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { -var DEFAULT_URL = 'compressed.tracemonkey-pldi-09.pdf'; -var DEFAULT_SCALE_DELTA = 1.1; -var MIN_SCALE = 0.25; -var MAX_SCALE = 10.0; -var SCALE_SELECT_CONTAINER_PADDING = 8; -var SCALE_SELECT_PADDING = 22; -var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading'; -var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; +"use strict"; -function configure(PDFJS) { - PDFJS.imageResourcesPath = './images/'; - PDFJS.workerSrc = '../build/pdf.worker.js'; + +; +var pdfjsWebApp, pdfjsWebAppOptions; +{ + pdfjsWebApp = __webpack_require__(1); + pdfjsWebAppOptions = __webpack_require__(12); } +; +{ + __webpack_require__(37); +} +; +{ + __webpack_require__(42); +} + +function getViewerConfiguration() { + return { + appContainer: document.body, + 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') + }, + 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') + }, + fullscreen: { + 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') + }, + 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') + }, + passwordOverlay: { + 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'), + 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') + } + }, + 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') + }, + 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, {}); + document.dispatchEvent(event); + pdfjsWebApp.PDFViewerApplication.run(config); +} + +if (document.readyState === 'interactive' || document.readyState === 'complete') { + webViewerLoad(); +} else { + document.addEventListener('DOMContentLoaded', webViewerLoad, true); +} + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFPrintServiceFactory = exports.DefaultExternalServices = exports.PDFViewerApplication = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +var _ui_utils = __webpack_require__(6); + +var _pdfjsLib = __webpack_require__(7); + +var _pdf_cursor_tools = __webpack_require__(8); + +var _pdf_rendering_queue = __webpack_require__(10); + +var _pdf_sidebar = __webpack_require__(11); + +var _app_options = __webpack_require__(12); + +var _overlay_manager = __webpack_require__(14); + +var _password_prompt = __webpack_require__(15); + +var _pdf_attachment_viewer = __webpack_require__(16); + +var _pdf_document_properties = __webpack_require__(17); + +var _pdf_find_bar = __webpack_require__(18); + +var _pdf_find_controller = __webpack_require__(19); + +var _pdf_history = __webpack_require__(21); + +var _pdf_link_service = __webpack_require__(22); + +var _pdf_outline_viewer = __webpack_require__(23); + +var _pdf_presentation_mode = __webpack_require__(24); + +var _pdf_sidebar_resizer = __webpack_require__(25); + +var _pdf_thumbnail_viewer = __webpack_require__(26); + +var _pdf_viewer = __webpack_require__(28); + +var _secondary_toolbar = __webpack_require__(33); + +var _toolbar = __webpack_require__(35); + +var _view_history = __webpack_require__(36); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(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"] != 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 DEFAULT_SCALE_DELTA = 1.1; +var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; +var FORCE_PAGES_LOADED_TIMEOUT = 10000; +var WHEEL_ZOOM_DISABLED_TIMEOUT = 1000; +var ViewOnLoad = { + UNKNOWN: -1, + PREVIOUS: 0, + INITIAL: 1 +}; +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'); + }, + supportsIntegratedFind: false, + supportsDocumentFonts: true, + supportsDocumentColors: true, + supportedMouseWheelZoomModifierKeys: { + ctrlKey: true, + metaKey: true + } +}; +exports.DefaultExternalServices = DefaultExternalServices; +var PDFViewerApplication = { + initialBookmark: document.location.hash.substring(1), + initialized: false, + fellback: false, + appConfig: null, + pdfDocument: null, + pdfLoadingTask: null, + printService: null, + pdfViewer: null, + pdfThumbnailViewer: null, + pdfRenderingQueue: null, + pdfPresentationMode: null, + pdfDocumentProperties: null, + pdfLinkService: null, + pdfHistory: null, + pdfSidebar: null, + pdfSidebarResizer: null, + pdfOutlineViewer: null, + pdfAttachmentViewer: null, + pdfCursorTools: null, + store: null, + downloadManager: null, + overlayManager: null, + preferences: null, + toolbar: null, + secondaryToolbar: null, + eventBus: null, + l10n: null, + isInitialViewSet: false, + downloadComplete: false, + isViewerEmbedded: window.parent !== window, + url: '', + baseUrl: '', + externalServices: DefaultExternalServices, + _boundEvents: {}, + contentDispositionFilename: null, + initialize: function () { + var _initialize = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee(appConfig) { + var _this = this; + + var appContainer; + return _regenerator.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + this.preferences = this.externalServices.createPreferences(); + this.appConfig = appConfig; + _context.next = 4; + return this._readPreferences(); + + case 4: + _context.next = 6; + return this._parseHashParameters(); + + case 6: + _context.next = 8; + return this._initializeL10n(); + + case 8: + 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(); + + case 11: + this.bindEvents(); + this.bindWindowEvents(); + appContainer = appConfig.appContainer || document.documentElement; + this.l10n.translate(appContainer).then(function () { + _this.eventBus.dispatch('localized', { + source: _this + }); + }); + this.initialized = true; + + case 16: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function initialize(_x) { + return _initialize.apply(this, arguments); + } + + return initialize; + }(), + _readPreferences: function () { + var _readPreferences2 = _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: + if (!(_app_options.AppOptions.get('disablePreferences') === true)) { + _context2.next = 2; + break; + } + + return _context2.abrupt("return"); + + case 2: + _context2.prev = 2; + _context2.next = 5; + return this.preferences.getAll(); + + case 5: + prefs = _context2.sent; + + for (name in prefs) { + _app_options.AppOptions.set(name, prefs[name]); + } + + _context2.next = 11; + break; + + case 9: + _context2.prev = 9; + _context2.t0 = _context2["catch"](2); + + case 11: + case "end": + return _context2.stop(); + } + } + }, _callee2, this, [[2, 9]]); + })); + + function _readPreferences() { + return _readPreferences2.apply(this, arguments); + } + + return _readPreferences; + }(), + _parseHashParameters: function () { + var _parseHashParameters2 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee3() { + var waitOn, hash, hashParams, viewer, enabled; + return _regenerator.default.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + if (_app_options.AppOptions.get('pdfBugEnabled')) { + _context3.next = 2; + break; + } + + return _context3.abrupt("return"); + + 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 ('disablerange' in hashParams) { + _app_options.AppOptions.set('disableRange', hashParams['disablerange'] === 'true'); + } + + if ('disablestream' in hashParams) { + _app_options.AppOptions.set('disableStream', hashParams['disablestream'] === 'true'); + } + + if ('disableautofetch' in hashParams) { + _app_options.AppOptions.set('disableAutoFetch', hashParams['disableautofetch'] === 'true'); + } + + if ('disablefontface' in hashParams) { + _app_options.AppOptions.set('disableFontFace', hashParams['disablefontface'] === 'true'); + } + + if ('disablehistory' in hashParams) { + _app_options.AppOptions.set('disableHistory', hashParams['disablehistory'] === 'true'); + } + + if ('webgl' in hashParams) { + _app_options.AppOptions.set('enableWebGL', hashParams['webgl'] === 'true'); + } + + if ('useonlycsszoom' in hashParams) { + _app_options.AppOptions.set('useOnlyCssZoom', hashParams['useonlycsszoom'] === 'true'); + } + + if ('verbosity' in hashParams) { + _app_options.AppOptions.set('verbosity', hashParams['verbosity'] | 0); + } + + 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; + break; + + case 18: + _app_options.AppOptions.set('textLayerMode', _ui_utils.TextLayerMode.DISABLE); + + return _context3.abrupt("break", 23); + + case 20: + viewer = this.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(','); + waitOn.push(loadAndEnablePDFBug(enabled)); + } + + if ('locale' in hashParams) { + _app_options.AppOptions.set('locale', hashParams['locale']); + } + + return _context3.abrupt("return", Promise.all(waitOn).catch(function (reason) { + console.error("_parseHashParameters: \"".concat(reason.message, "\".")); + })); + + case 26: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function _parseHashParameters() { + return _parseHashParameters2.apply(this, arguments); + } + + return _parseHashParameters; + }(), + _initializeL10n: function () { + var _initializeL10n2 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee4() { + var dir; + 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') + }); + _context4.next = 3; + return this.l10n.getDirection(); + + case 3: + dir = _context4.sent; + document.getElementsByTagName('html')[0].dir = dir; + + case 5: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + + function _initializeL10n() { + return _initializeL10n2.apply(this, arguments); + } + + return _initializeL10n; + }(), + _initializeViewerComponents: function () { + var _initializeViewerComponents2 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee5() { + var appConfig, dispatchToDOM, eventBus, pdfRenderingQueue, pdfLinkService, downloadManager, findController, container, viewer, thumbnailContainer, sidebarConfig; + 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, _ui_utils.getGlobalEventBus)(dispatchToDOM); + this.eventBus = eventBus; + pdfRenderingQueue = new _pdf_rendering_queue.PDFRenderingQueue(); + pdfRenderingQueue.onIdle = this.cleanup.bind(this); + this.pdfRenderingQueue = pdfRenderingQueue; + pdfLinkService = new _pdf_link_service.PDFLinkService({ + eventBus: eventBus, + externalLinkTarget: _app_options.AppOptions.get('externalLinkTarget'), + externalLinkRel: _app_options.AppOptions.get('externalLinkRel') + }); + this.pdfLinkService = pdfLinkService; + downloadManager = this.externalServices.createDownloadManager({ + disableCreateObjectURL: _app_options.AppOptions.get('disableCreateObjectURL') + }); + this.downloadManager = downloadManager; + findController = new _pdf_find_controller.PDFFindController({ + linkService: pdfLinkService, + eventBus: eventBus + }); + this.findController = findController; + container = appConfig.mainContainer; + viewer = appConfig.viewerContainer; + this.pdfViewer = new _pdf_viewer.PDFViewer({ + container: container, + viewer: viewer, + eventBus: eventBus, + renderingQueue: pdfRenderingQueue, + 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') + }); + pdfRenderingQueue.setViewer(this.pdfViewer); + pdfLinkService.setViewer(this.pdfViewer); + thumbnailContainer = appConfig.sidebar.thumbnailView; + this.pdfThumbnailViewer = new _pdf_thumbnail_viewer.PDFThumbnailViewer({ + container: thumbnailContainer, + renderingQueue: pdfRenderingQueue, + linkService: pdfLinkService, + l10n: this.l10n + }); + pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer); + this.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({ + container: container, + eventBus: eventBus, + 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({ + container: container, + viewer: viewer, + pdfViewer: this.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({ + container: appConfig.sidebar.outlineView, + eventBus: eventBus, + linkService: pdfLinkService + }); + this.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); + + case 39: + case "end": + return _context5.stop(); + } + } + }, _callee5, this); + })); + + function _initializeViewerComponents() { + return _initializeViewerComponents2.apply(this, arguments); + } + + return _initializeViewerComponents; + }(), + run: function run(config) { + this.initialize(config).then(webViewerInitialized); + }, + zoomIn: function zoomIn(ticks) { + 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) { + 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; + }, + + get pagesCount() { + return this.pdfDocument ? this.pdfDocument.numPages : 0; + }, + + set page(val) { + this.pdfViewer.currentPageNumber = val; + }, + + get page() { + return this.pdfViewer.currentPageNumber; + }, + + get printing() { + return !!this.printService; + }, + + get supportsPrinting() { + return PDFPrintServiceFactory.instance.supportsPrinting; + }, + + get supportsFullscreen() { + 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); + }, + + 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); + }, + + get supportedMouseWheelZoomModifierKeys() { + return this.externalServices.supportedMouseWheelZoomModifierKeys; + }, + + initPassiveLoading: function initPassiveLoading() { + throw new Error('Not implemented: initPassiveLoading'); + }, + setTitleUsingUrl: function setTitleUsingUrl() { + 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, ''); + + if (!title) { + try { + title = decodeURIComponent((0, _pdfjsLib.getFilenameFromUrl)(url)) || url; + } catch (ex) { + title = url; + } + } + + this.setTitle(title); + }, + setTitle: function setTitle(title) { + if (this.isViewerEmbedded) { + return; + } + + document.title = title; + }, + close: function () { + var _close = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee6() { + var errorWrapper, promise; + 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'); + + if (this.pdfLoadingTask) { + _context6.next = 4; + break; + } + + return _context6.abrupt("return"); + + 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); + } + + 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') { + PDFBug.cleanup(); + } + + return _context6.abrupt("return", promise); + + case 21: + case "end": + return _context6.stop(); + } + } + }, _callee6, this); + })); + + function close() { + return _close.apply(this, arguments); + } + + return close; + }(), + open: function () { + var _open = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee7(file, args) { + var _this2 = this; + + var workerParameters, key, parameters, apiParameters, _key, prop, loadingTask; + + return _regenerator.default.wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + if (!this.pdfLoadingTask) { + _context7.next = 3; + break; + } + + _context7.next = 3; + return this.close(); + + case 3: + workerParameters = _app_options.AppOptions.getAll('worker'); + + for (key in workerParameters) { + _pdfjsLib.GlobalWorkerOptions[key] = workerParameters[key]; + } + + parameters = Object.create(null); + + if (typeof file === 'string') { + this.setTitleUsingUrl(file); + parameters.url = file; + } else if (file && 'byteLength' in file) { + parameters.data = file; + } else if (file.url && file.originalUrl) { + this.setTitleUsingUrl(file.originalUrl); + parameters.url = file.url; + } + + apiParameters = _app_options.AppOptions.getAll('api'); + + for (_key in apiParameters) { + parameters[_key] = apiParameters[_key]; + } + + if (args) { + for (prop in args) { + if (prop === 'length') { + this.pdfDocumentProperties.setFileSize(args[prop]); + } + + parameters[prop] = args[prop]; + } + } + + loadingTask = (0, _pdfjsLib.getDocument)(parameters); + this.pdfLoadingTask = loadingTask; + + loadingTask.onPassword = function (updateCallback, reason) { + _this2.passwordPrompt.setUpdateCallback(updateCallback, reason); + + _this2.passwordPrompt.open(); + }; + + loadingTask.onProgress = function (_ref) { + var loaded = _ref.loaded, + total = _ref.total; + + _this2.progress(loaded / total); + }; + + loadingTask.onUnsupportedFeature = this.fallback.bind(this); + return _context7.abrupt("return", loadingTask.promise.then(function (pdfDocument) { + _this2.load(pdfDocument); + }, function (exception) { + if (loadingTask !== _this2.pdfLoadingTask) { + return; + } + + var message = exception && exception.message; + var loadingErrorMessage; + + if (exception instanceof _pdfjsLib.InvalidPDFException) { + loadingErrorMessage = _this2.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.'); + } else if (exception instanceof _pdfjsLib.UnexpectedResponseException) { + loadingErrorMessage = _this2.l10n.get('unexpected_response_error', null, 'Unexpected server response.'); + } else { + loadingErrorMessage = _this2.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); + }); + })); + + case 16: + case "end": + return _context7.stop(); + } + } + }, _callee7, this); + })); + + function open(_x2, _x3) { + return _open.apply(this, arguments); + } + + return open; + }(), + download: function download() { + var _this3 = 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: ".concat(err)); + }; + + if (!this.pdfDocument || !this.downloadComplete) { + downloadByUrl(); + return; + } + + this.pdfDocument.getData().then(function (data) { + var blob = new Blob([data], { + type: 'application/pdf' + }); + downloadManager.download(blob, url, filename); + }).catch(downloadByUrl); + }, + 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}})')]; + + if (moreInfo) { + 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}}')); + } else { + if (moreInfo.filename) { + 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}}')); + } + } + } + + var errorWrapperConfig = this.appConfig.errorWrapper; + var errorWrapper = errorWrapperConfig.container; + errorWrapper.removeAttribute('hidden'); + var errorMessage = errorWrapperConfig.errorMessage; + errorMessage.textContent = message; + var closeButton = errorWrapperConfig.closeButton; + + closeButton.onclick = function () { + 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'; + }; + + lessInfoButton.onclick = function () { + 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'); + Promise.all(moreInfoText).then(function (parts) { + errorMoreInfo.value = parts.join('\n'); + }); + }, + progress: function progress(level) { + var _this4 = 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'); + + 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; + }, DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT); + } + } + }, + load: function load(pdfDocument) { + var _this5 = this; + + this.pdfDocument = pdfDocument; + pdfDocument.getDownloadInfo().then(function () { + _this5.downloadComplete = true; + + _this5.loadingBar.hide(); + + firstPagePromise.then(function () { + _this5.eventBus.dispatch('documentloaded', { + source: _this5 + }); + }); + }); + var pageModePromise = pdfDocument.getPageMode().catch(function () {}); + var openActionDestPromise = pdfDocument.getOpenActionDestination().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; + 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 pdfThumbnailViewer = this.pdfThumbnailViewer; + pdfThumbnailViewer.setDocument(pdfDocument); + firstPagePromise.then(function (pdfPage) { + _this5.loadingBar.setWidth(_this5.appConfig.viewerContainer); + + var storePromise = store.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 () {}); + Promise.all([storePromise, pageModePromise, openActionDestPromise]).then( + /*#__PURE__*/ + function () { + var _ref3 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee8(_ref2) { + var _ref4, _ref4$, values, pageMode, openActionDest, viewOnLoad, initialBookmark, zoom, hash, rotation, sidebarView, scrollMode, spreadMode; + + return _regenerator.default.wrap(function _callee8$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + _ref4 = _slicedToArray(_ref2, 3), _ref4$ = _ref4[0], values = _ref4$ === void 0 ? {} : _ref4$, pageMode = _ref4[1], openActionDest = _ref4[2]; + viewOnLoad = _app_options.AppOptions.get('viewOnLoad'); + + _this5._initializePdfHistory({ + fingerprint: pdfDocument.fingerprint, + viewOnLoad: viewOnLoad, + initialDest: openActionDest + }); + + initialBookmark = _this5.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 && viewOnLoad !== ViewOnLoad.INITIAL) { + hash = "page=".concat(values.page, "&zoom=").concat(zoom || values.zoom, ",") + "".concat(values.scrollLeft, ",").concat(values.scrollTop); + rotation = parseInt(values.rotation, 10); + + if (sidebarView === _pdf_sidebar.SidebarView.UNKNOWN) { + sidebarView = values.sidebarView | 0; + } + + if (scrollMode === _ui_utils.ScrollMode.UNKNOWN) { + scrollMode = values.scrollMode | 0; + } + + if (spreadMode === _ui_utils.SpreadMode.UNKNOWN) { + spreadMode = values.spreadMode | 0; + } + } + + if (pageMode && sidebarView === _pdf_sidebar.SidebarView.UNKNOWN) { + sidebarView = apiPageModeToSidebarView(pageMode); + } + + _this5.setInitialView(hash, { + rotation: rotation, + sidebarView: sidebarView, + scrollMode: scrollMode, + spreadMode: spreadMode + }); + + _this5.eventBus.dispatch('documentinit', { + source: _this5 + }); + + if (!_this5.isViewerEmbedded) { + pdfViewer.focus(); + } + + _context8.next = 17; + return Promise.race([pagesPromise, new Promise(function (resolve) { + setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT); + })]); + + case 17: + if (!(!initialBookmark && !hash)) { + _context8.next = 19; + break; + } + + return _context8.abrupt("return"); + + case 19: + if (!pdfViewer.hasEqualPageSizes) { + _context8.next = 21; + break; + } + + return _context8.abrupt("return"); + + case 21: + _this5.initialBookmark = initialBookmark; + pdfViewer.currentScaleValue = pdfViewer.currentScaleValue; + + _this5.setInitialView(hash); + + case 24: + case "end": + return _context8.stop(); + } + } + }, _callee8, this); + })); + + return function (_x4) { + return _ref3.apply(this, arguments); + }; + }()).catch(function () { + _this5.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; + } + } + }); + }); + Promise.all([onePageRendered, _ui_utils.animationStarted]).then(function () { + pdfDocument.getOutline().then(function (outline) { + _this5.pdfOutlineViewer.render({ + outline: outline + }); + }); + pdfDocument.getAttachments().then(function (attachments) { + _this5.pdfAttachmentViewer.render({ + attachments: attachments + }); + }); + }); + pdfDocument.getMetadata().then(function (_ref5) { + var info = _ref5.info, + metadata = _ref5.metadata, + contentDispositionFilename = _ref5.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; + + 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("".concat(pdfTitle, " - ").concat(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); + } + }); + }, + _initializePdfHistory: function _initializePdfHistory(_ref6) { + var fingerprint = _ref6.fingerprint, + viewOnLoad = _ref6.viewOnLoad, + _ref6$initialDest = _ref6.initialDest, + initialDest = _ref6$initialDest === void 0 ? null : _ref6$initialDest; + + if (_app_options.AppOptions.get('disableHistory') || this.isViewerEmbedded) { + 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 + }); + } + }, + setInitialView: function setInitialView(storedHash) { + var _this6 = this; + + var _ref7 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + rotation = _ref7.rotation, + sidebarView = _ref7.sidebarView, + scrollMode = _ref7.scrollMode, + spreadMode = _ref7.spreadMode; + + var setRotation = function setRotation(angle) { + if ((0, _ui_utils.isValidRotation)(angle)) { + _this6.pdfViewer.pagesRotation = angle; + } + }; + + var setViewerModes = function setViewerModes(scroll, spread) { + if ((0, _ui_utils.isValidScrollMode)(scroll)) { + _this6.pdfViewer.scrollMode = scroll; + } + + if ((0, _ui_utils.isValidSpreadMode)(spread)) { + _this6.pdfViewer.spreadMode = spread; + } + }; + + this.isInitialViewSet = true; + this.pdfSidebar.setInitialView(sidebarView); + setViewerModes(scrollMode, spreadMode); + + if (this.initialBookmark) { + setRotation(this.initialRotation); + delete this.initialRotation; + this.pdfLinkService.setHash(this.initialBookmark); + this.initialBookmark = null; + } else if (storedHash) { + 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; + } + }, + cleanup: function cleanup() { + if (!this.pdfDocument) { + return; + } + + this.pdfViewer.cleanup(); + this.pdfThumbnailViewer.cleanup(); + + if (this.pdfViewer.renderer !== _ui_utils.RendererType.SVG) { + this.pdfDocument.cleanup(); + } + }, + forceRendering: function forceRendering() { + this.pdfRenderingQueue.printing = this.printing; + this.pdfRenderingQueue.isThumbnailViewEnabled = this.pdfSidebar.isThumbnailViewVisible; + this.pdfRenderingQueue.renderHighestPriority(); + }, + beforePrint: function beforePrint() { + var _this7 = 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); + }); + return; + } + + if (!this.pdfViewer.pageViewsReady) { + 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(); + }, + afterPrint: function pdfViewSetupAfterPrint() { + 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; + }, + requestPresentationMode: function requestPresentationMode() { + 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('visibilitychange', webViewerVisibilityChange); + 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.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('visibilitychange', webViewerVisibilityChange); + 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); + _boundEvents.windowResize = null; + _boundEvents.windowHashChange = null; + _boundEvents.windowBeforePrint = null; + _boundEvents.windowAfterPrint = null; + } +}; +exports.PDFViewerApplication = PDFViewerApplication; +var validateFileURL; +{ + 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'; + + if (HOSTED_VIEWER_ORIGINS.includes(viewerOrigin)) { + return; + } + + var _ref8 = new _pdfjsLib.URL(file, window.location.href), + origin = _ref8.origin, + protocol = _ref8.protocol; + + 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 + }); + }); + throw ex; + } + }; +} + +function loadFakeWorker() { + if (!_pdfjsLib.GlobalWorkerOptions.workerSrc) { + _pdfjsLib.GlobalWorkerOptions.workerSrc = _app_options.AppOptions.get('workerSrc'); + } + + return (0, _pdfjsLib.loadScript)(_pdfjsLib.PDFWorker.getWorkerSrc()); +} + +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 + }, appConfig.mainContainer); + }); +} + +function webViewerInitialized() { + var appConfig = PDFViewerApplication.appConfig; + 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'); + validateFileURL(file); + var fileInput = document.createElement('input'); + fileInput.id = appConfig.openFileInputName; + 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'); + } else { + fileInput.value = null; + } + + fileInput.addEventListener('change', function (evt) { + var files = evt.target.files; + + if (!files || files.length === 0) { + return; + } + + PDFViewerApplication.eventBus.dispatch('fileinputchange', { + source: this, + fileInput: evt.target + }); + }); + appConfig.mainContainer.addEventListener('dragover', function (evt) { + evt.preventDefault(); + evt.dataTransfer.dropEffect = 'move'; + }); + appConfig.mainContainer.addEventListener('drop', function (evt) { + evt.preventDefault(); + var files = evt.dataTransfer.files; + + if (!files || files.length === 0) { + return; + } + + PDFViewerApplication.eventBus.dispatch('fileinputchange', { + source: this, + fileInput: evt.dataTransfer + }); + }); + + if (!PDFViewerApplication.supportsPrinting) { + 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'); + } + + if (PDFViewerApplication.supportsIntegratedFind) { + appConfig.toolbar.viewFind.classList.add('hidden'); + } + + appConfig.mainContainer.addEventListener('transitionend', function (evt) { + if (evt.target === 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.error(msg, reason); + }); + } +} + +var webViewerOpenFileViaURL; +{ + webViewerOpenFileViaURL = function webViewerOpenFileViaURL(file) { + if (file && file.lastIndexOf('file:', 0) === 0) { + PDFViewerApplication.setTitleUsingUrl(file); + var xhr = new XMLHttpRequest(); + + xhr.onload = function () { + PDFViewerApplication.open(new Uint8Array(xhr.response)); + }; + + xhr.open('GET', file); + xhr.responseType = 'arraybuffer'; + xhr.send(); + return; + } + + if (file) { + PDFViewerApplication.open(file); + } + }; +} + +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) { + 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.error(msg, pageView.error); + }); + } +} + +function webViewerTextLayerRendered(evt) {} + +function webViewerPageMode(evt) { + var mode = evt.mode, + view; + + switch (mode) { + case 'thumbs': + view = _pdf_sidebar.SidebarView.THUMBS; + break; + + case 'bookmarks': + case 'outline': + view = _pdf_sidebar.SidebarView.OUTLINE; + break; + + case 'attachments': + view = _pdf_sidebar.SidebarView.ATTACHMENTS; + break; + + 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': + PDFViewerApplication.appConfig.toolbar.pageNumber.select(); + break; + + 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 webViewerSidebarViewChanged(evt) { + PDFViewerApplication.pdfRenderingQueue.isThumbnailViewEnabled = PDFViewerApplication.pdfSidebar.isThumbnailViewVisible; + var store = PDFViewerApplication.store; + + if (store && PDFViewerApplication.isInitialViewSet) { + 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 () {}); + } + + var href = PDFViewerApplication.pdfLinkService.getAnchorUrl(location.pdfOpenParams); + PDFViewerApplication.appConfig.toolbar.viewBookmark.href = href; + PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href = href; + var currentPage = PDFViewerApplication.pdfViewer.getPageView(PDFViewerApplication.page - 1); + 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 () {}); + } +} + +function webViewerSpreadModeChanged(evt) { + var store = PDFViewerApplication.store; + + if (store && PDFViewerApplication.isInitialViewSet) { + store.set('spreadMode', evt.mode).catch(function () {}); + } +} + +function webViewerResize() { + var pdfDocument = PDFViewerApplication.pdfDocument, + pdfViewer = PDFViewerApplication.pdfViewer; + + if (!pdfDocument) { + return; + } + + var currentScaleValue = pdfViewer.currentScaleValue; + + 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; +{ + 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 (file.name) { + url = { + url: url, + originalUrl: file.name + }; + } + + PDFViewerApplication.open(url); + } else { + PDFViewerApplication.setTitleUsingUrl(file.name); + var fileReader = new FileReader(); + + fileReader.onload = function webViewerChangeFileReaderOnload(evt) { + var buffer = evt.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'); + }; +} + +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 webViewerPageNumberChanged(evt) { + var pdfViewer = PDFViewerApplication.pdfViewer; + + 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, { + query: evt.query, + phraseSearch: evt.phraseSearch, + caseSensitive: evt.caseSensitive, + entireWord: evt.entireWord, + highlightAll: evt.highlightAll, + findPrevious: evt.findPrevious + }); +} + +function webViewerFindFromUrlHash(evt) { + PDFViewerApplication.findController.executeCommand('find', { + query: evt.query, + phraseSearch: evt.phraseSearch, + caseSensitive: false, + entireWord: false, + highlightAll: true, + findPrevious: false + }); +} + +function webViewerUpdateFindMatchesCount(_ref9) { + var matchesCount = _ref9.matchesCount; + + if (PDFViewerApplication.supportsIntegratedFind) { + PDFViewerApplication.externalServices.updateFindMatchesCount(matchesCount); + } else { + PDFViewerApplication.findBar.updateResultsCount(matchesCount); + } +} + +function webViewerUpdateFindControlState(_ref10) { + var state = _ref10.state, + previous = _ref10.previous, + matchesCount = _ref10.matchesCount; + + if (PDFViewerApplication.supportsIntegratedFind) { + PDFViewerApplication.externalServices.updateFindControlState({ + result: state, + findPrevious: previous, + matchesCount: matchesCount + }); + } else { + 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) { + var pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1); + + if (pageView && pageView.stats) { + Stats.add(page, pageView.stats); + } + } +} + +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; + + if (pdfViewer.isInPresentationMode) { + return; + } + + if (evt.ctrlKey || evt.metaKey) { + var support = PDFViewerApplication.supportedMouseWheelZoomModifierKeys; + + if (evt.ctrlKey && !support.ctrlKey || evt.metaKey && !support.metaKey) { + return; + } + + evt.preventDefault(); + + 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(); + var dx = evt.clientX - rect.left; + var dy = evt.clientY - rect.top; + pdfViewer.container.scrollLeft += dx * scaleCorrectionFactor; + pdfViewer.container.scrollTop += dy * scaleCorrectionFactor; + } + } else { + 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: + if (!PDFViewerApplication.supportsIntegratedFind) { + PDFViewerApplication.findBar.open(); + handled = true; + } + + break; + + case 71: + if (!PDFViewerApplication.supportsIntegratedFind) { + var findState = PDFViewerApplication.findController.state; + + if (findState) { + PDFViewerApplication.findController.executeCommand('findagain', { + query: findState.query, + phraseSearch: findState.phraseSearch, + caseSensitive: findState.caseSensitive, + entireWord: findState.entireWord, + highlightAll: findState.highlightAll, + findPrevious: cmd === 5 || cmd === 12 + }); + } + + handled = true; + } + + break; + + case 61: + case 107: + case 187: + case 171: + 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; + }); + 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; + } + } + + if (cmd === 1 || cmd === 8) { + switch (evt.keyCode) { + case 83: + PDFViewerApplication.download(); + 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 curElementTagName = curElement && curElement.tagName.toUpperCase(); + + if (curElementTagName === 'INPUT' || curElementTagName === 'TEXTAREA' || curElementTagName === 'SELECT') { + 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) { + if (PDFViewerApplication.page < PDFViewerApplication.pagesCount) { + PDFViewerApplication.page++; + } + } else { + if (PDFViewerApplication.page > 1) { + PDFViewerApplication.page--; + } + } + + handled = true; + } + } + + if (cmd === 4) { + switch (evt.keyCode) { + case 13: + case 32: + 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') { + ensureViewerFocused = true; + } + } + + if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) { + pdfViewer.focus(); + } + + if (handled) { + evt.preventDefault(); + } +} + +function apiPageModeToSidebarView(mode) { + switch (mode) { + case 'UseNone': + return _pdf_sidebar.SidebarView.NONE; + + case 'UseThumbs': + return _pdf_sidebar.SidebarView.THUMBS; + + case 'UseOutlines': + return _pdf_sidebar.SidebarView.OUTLINE; + + case 'UseAttachments': + return _pdf_sidebar.SidebarView.ATTACHMENTS; + + case 'UseOC': + } + + return _pdf_sidebar.SidebarView.NONE; +} + +var PDFPrintServiceFactory = { + instance: { + supportsPrinting: false, + createPrintService: function createPrintService() { + throw new Error('Not implemented: createPrintService'); + } + } +}; +exports.PDFPrintServiceFactory = PDFPrintServiceFactory; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = __webpack_require__(3); + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function _typeof(obj) { 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 g = function () { + return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; +}() || 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) { + +function _typeof(obj) { 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) { + "use strict"; + + 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) === "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); + }, function (error) { + return invoke("throw", error, resolve, reject); + }); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(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) { + 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; + } + } + + 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; + } + } 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] + }; + + 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" + }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.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() { + 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; + } + } + + return { + next: doneResult + }; + } + + runtime.values = values; + + function doneResult() { + return { + value: undefined, + done: true + }; + } + + 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; + } + } + } + }, + stop: function stop() { + 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); + } 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; + } + } + + 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") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } 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); + 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; + + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + + return thrown; + } + } + + 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 || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; +}() || Function("return this")()); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5)(module))) + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_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; + } + + return module; +}; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isValidRotation = isValidRotation; +exports.isValidScrollMode = isValidScrollMode; +exports.isValidSpreadMode = isValidSpreadMode; +exports.isPortraitOrientation = isPortraitOrientation; +exports.getGlobalEventBus = getGlobalEventBus; +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 = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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; } + +function _typeof(obj) { 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) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(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"] != 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; +exports.CSS_UNITS = CSS_UNITS; var DEFAULT_SCALE_VALUE = 'auto'; +exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE; var DEFAULT_SCALE = 1.0; +exports.DEFAULT_SCALE = DEFAULT_SCALE; +var MIN_SCALE = 0.10; +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' +}; +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; -function getFileName(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 formatL10nValue(text, args) { + if (!args) { + return text; + } + + return text.replace(/\{\{\s*(\w+)\s*\}\}/g, function (all, name) { + return name in args ? args[name] : '{{' + name + '}}'; + }); } -/** - * Returns scale factor for the canvas. It makes sense for the HiDPI displays. - * @return {Object} The object with horizontal (sx) and vertical (sy) - scales. The scaled property is set to false if scaling is - not required, true otherwise. - */ +var NullL10n = { + getLanguage: function () { + var _getLanguage = _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'); + + case 1: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function getLanguage() { + return _getLanguage.apply(this, arguments); + } + + return getLanguage; + }(), + getDirection: function () { + var _getDirection = _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'); + + case 1: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function getDirection() { + return _getDirection.apply(this, arguments); + } + + return getDirection; + }(), + get: function () { + var _get = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee3(property, args, fallback) { + return _regenerator.default.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + return _context3.abrupt("return", formatL10nValue(fallback, args)); + + case 1: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function get(_x, _x2, _x3) { + return _get.apply(this, arguments); + } + + return get; + }(), + translate: function () { + var _translate = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee4(element) { + return _regenerator.default.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + + function translate(_x4) { + return _translate.apply(this, arguments); + } + + return translate; + }() +}; +exports.NullL10n = NullL10n; + function getOutputScale(ctx) { var devicePixelRatio = window.devicePixelRatio || 1; - var backingStoreRatio = ctx.webkitBackingStorePixelRatio || - ctx.mozBackingStorePixelRatio || - ctx.msBackingStorePixelRatio || - ctx.oBackingStorePixelRatio || - ctx.backingStorePixelRatio || 1; + var backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1; var pixelRatio = devicePixelRatio / backingStoreRatio; return { sx: pixelRatio, @@ -77,109 +3530,101 @@ function getOutputScale(ctx) { }; } -/** - * Scrolls specified element into view of its parent. - * @param {Object} element - The element to be visible. - * @param {Object} spot - An object with optional top and left properties, - * specifying the offset from the top left edge. - * @param {boolean} skipOverflowHiddenElements - Ignore elements that have - * the CSS rule `overflow: hidden;` set. The default is false. - */ -function scrollIntoView(element, spot, skipOverflowHiddenElements) { - // Assuming offsetParent is available (it's not available when viewer is in - // hidden iframe or object). We have to scroll: if the offsetParent is not set - // producing the error. See also animationStartedClosure. +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'); return; } - var checkOverflow = skipOverflowHiddenElements || false; + var offsetY = element.offsetTop + element.clientTop; var offsetX = element.offsetLeft + element.clientLeft; - while (parent.clientHeight === parent.scrollHeight || - (checkOverflow && 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; // no need to scroll + return; } } + if (spot) { if (spot.top !== undefined) { offsetY += spot.top; } + if (spot.left !== undefined) { offsetX += spot.left; parent.scrollLeft = offsetX; } } + parent.scrollTop = offsetY; } -/** - * Helper function to start monitoring the scroll event and converting them into - * PDF.js friendly one: with scroll debounce and scroll direction. - */ function watchScroll(viewAreaElement, callback) { var debounceScroll = function debounceScroll(evt) { if (rAF) { return; } - // schedule an invocation of scroll for next animation frame. + 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, + lastX: viewAreaElement.scrollLeft, lastY: viewAreaElement.scrollTop, _eventHandler: debounceScroll }; - var rAF = null; viewAreaElement.addEventListener('scroll', debounceScroll, true); return state; } -/** - * Helper function to parse query string (e.g. ?param1=value&parm2=...). - */ function parseQueryString(query) { var parts = query.split('&'); - var params = {}; + var params = Object.create(null); + for (var i = 0, ii = parts.length; i < ii; ++i) { 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; } -/** - * Use binary search to find the index of the first item in a given array which - * passes a given condition. The items are expected to be sorted in the sense - * that if the condition is true for one item in the array, then it is also true - * for all following items. - * - * @returns {Number} Index of the first array element to pass the test, - * or |items.length| if no such element exists. - */ function binarySearchFirstItem(items, condition) { var minIndex = 0; var maxIndex = items.length - 1; @@ -187,64 +3632,71 @@ function binarySearchFirstItem(items, condition) { if (items.length === 0 || !condition(items[maxIndex])) { return items.length; } + if (condition(items[minIndex])) { return minIndex; } while (minIndex < maxIndex) { - var currentIndex = (minIndex + maxIndex) >> 1; + var currentIndex = minIndex + maxIndex >> 1; var currentItem = items[currentIndex]; + if (condition(currentItem)) { maxIndex = currentIndex; } else { minIndex = currentIndex + 1; } } - return minIndex; /* === maxIndex */ + + return minIndex; } -/** - * Approximates float number as a fraction using Farey sequence (max order - * of 8). - * @param {number} x - Positive float number. - * @returns {Array} Estimated fraction: the first array item is a numerator, - * the second one is a denominator. - */ function approximateFraction(x) { - // Fast paths for int numbers or their inversions. 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) { + } else if (Math.floor(xinv) === xinv) { return [1, xinv]; } var x_ = x > 1 ? xinv : x; - // a/b and c/d are neighbours in Farey sequence. - var a = 0, b = 1, c = 1, d = 1; - // Limiting search to order 8. + var a = 0, + b = 1, + c = 1, + d = 1; + while (true) { - // Generating next term in sequence (order of q). - var p = a + c, q = b + d; + var p = a + c, + q = b + d; + if (q > limit) { break; } + if (x_ <= p / q) { - c = p; d = q; + c = p; + d = q; } else { - a = p; b = q; + a = p; + b = q; } } - // Select closest of the neighbours to x. + + var result; + if (x_ - a / b < c / d - x_) { - return x_ === x ? [a, b] : [b, a]; + result = x_ === x ? [a, b] : [b, a]; } else { - return x_ === x ? [c, d] : [d, c]; + result = x_ === x ? [c, d] : [d, c]; } + + return result; } function roundToDivide(x, div) { @@ -252,134 +3704,407 @@ function roundToDivide(x, div) { return r === 0 ? x : Math.round(x - r + div); } -/** - * Generic helper to find out what elements are visible within a scroll pane. - */ -function getVisibleElements(scrollEl, views, sortByVisibility) { - var top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight; - var left = scrollEl.scrollLeft, right = left + scrollEl.clientWidth; +function getPageSizeInches(_ref) { + var view = _ref.view, + userUnit = _ref.userUnit, + rotate = _ref.rotate; - function isElementBottomBelowViewTop(view) { - var element = view.div; - var elementBottom = - element.offsetTop + element.clientTop + element.clientHeight; - return elementBottom > top; + var _view = _slicedToArray(view, 4), + x1 = _view[0], + y1 = _view[1], + x2 = _view[2], + y2 = _view[3]; + + var changeOrientation = rotate % 180 !== 0; + var width = (x2 - x1) / 72 * userUnit; + var height = (y2 - y1) / 72 * userUnit; + return { + width: changeOrientation ? height : width, + height: changeOrientation ? width : height + }; +} + +function backtrackBeforeAllVisibleElements(index, views, top) { + if (index < 2) { + return index; } - var visible = [], view, element; - var currentHeight, viewHeight, hiddenHeight, percentHeight; - var currentWidth, viewWidth; - var firstVisibleElementInd = (views.length === 0) ? 0 : - binarySearchFirstItem(views, isElementBottomBelowViewTop); + var elt = views[index].div; + var pageTop = elt.offsetTop + elt.clientTop; - for (var i = firstVisibleElementInd, ii = views.length; i < ii; i++) { - view = views[i]; - element = view.div; - currentHeight = element.offsetTop + element.clientTop; - viewHeight = element.clientHeight; + if (pageTop >= top) { + elt = views[index - 1].div; + pageTop = elt.offsetTop + elt.clientTop; + } - if (currentHeight > bottom) { + for (var i = index - 2; i >= 0; --i) { + elt = views[i].div; + + if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) { break; } - currentWidth = element.offsetLeft + element.clientLeft; - viewWidth = element.clientWidth; - if (currentWidth + viewWidth < left || currentWidth > right) { + 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 = [], + 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; 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; + } + } 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, currentHeight + viewHeight - bottom); - percentHeight = ((viewHeight - hiddenHeight) * 100 / viewHeight) | 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: percentHeight + 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) { + visible.sort(function (a, b) { var pc = a.percent - b.percent; + if (Math.abs(pc) > 0.001) { return -pc; } - return a.id - b.id; // ensure stability + + return a.id - b.id; }); } - return {first: first, last: last, views: visible}; + + return { + first: first, + last: last, + views: visible + }; } -/** - * Event handler to suppress context menu. - */ -function noContextMenuHandler(e) { - e.preventDefault(); +function noContextMenuHandler(evt) { + evt.preventDefault(); +} + +function isDataSchema(url) { + var i = 0, + ii = url.length; + + while (i < ii && url[i].trim() === '') { + i++; + } + + return url.substring(i, i + 5).toLowerCase() === 'data:'; } -/** - * Returns the filename or guessed filename from the url (see issue 3455). - * url {String} The original PDF location. - * @return {String} Guessed PDF file name. - */ function getPDFFileNameFromURL(url) { - var reURI = /^(?:([^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/; - // SCHEME HOST 1.PATH 2.QUERY 3.REF - // Pattern to get last matching NAME.pdf + var defaultFilename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'document.pdf'; + + if (typeof url !== 'string') { + return defaultFilename; + } + + if (isDataSchema(url)) { + 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]); + var suggestedFilename = reFilename.exec(splitURI[1]) || reFilename.exec(splitURI[2]) || reFilename.exec(splitURI[3]); + if (suggestedFilename) { suggestedFilename = suggestedFilename[0]; - if (suggestedFilename.indexOf('%') !== -1) { - // URL-encoded %2Fpath%2Fto%2Ffile.pdf should be file.pdf + + if (suggestedFilename.includes('%')) { try { - suggestedFilename = - reFilename.exec(decodeURIComponent(suggestedFilename))[0]; - } catch(e) { // Possible (extremely rare) errors: - // URIError "Malformed URI", e.g. for "%AA.pdf" - // TypeError "null has no properties", e.g. for "%2F.pdf" - } + suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0]; + } catch (ex) {} } } - return suggestedFilename || 'document.pdf'; + + return suggestedFilename || defaultFilename; } -var ProgressBar = (function ProgressBarClosure() { +function normalizeWheelEventDelta(evt) { + var delta = Math.sqrt(evt.deltaX * evt.deltaX + evt.deltaY * evt.deltaY); + var angle = Math.atan2(evt.deltaY, evt.deltaX); - function clamp(v, min, max) { - return Math.min(Math.max(v, min), max); + if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) { + delta = -delta; } - function ProgressBar(id, opts) { + 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' +}; +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) !== 'object' || !(name && typeof name === 'string') || !(Number.isInteger(delay) && delay >= 0)) { + throw new Error('waitOnEventOrTimeout - invalid parameters.'); + } + + function handler(type) { + if (target instanceof EventBus) { + target.off(name, eventHandler); + } else { + target.removeEventListener(name, eventHandler); + } + + if (timeout) { + clearTimeout(timeout); + } + + resolve(type); + } + + var eventHandler = handler.bind(null, WaitOnType.EVENT); + + if (target instanceof EventBus) { + 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 = +/*#__PURE__*/ +function () { + function EventBus() { + var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref3$dispatchToDOM = _ref3.dispatchToDOM, + dispatchToDOM = _ref3$dispatchToDOM === void 0 ? false : _ref3$dispatchToDOM; + + _classCallCheck(this, EventBus); + + this._listeners = Object.create(null); + this._dispatchToDOM = dispatchToDOM === true; + } + + _createClass(EventBus, [{ + key: "on", + value: function on(eventName, listener) { + var eventListeners = this._listeners[eventName]; + + if (!eventListeners) { + eventListeners = []; + this._listeners[eventName] = eventListeners; + } + + eventListeners.push(listener); + } + }, { + key: "off", + value: function off(eventName, listener) { + var eventListeners = this._listeners[eventName]; + var i; + + if (!eventListeners || (i = eventListeners.indexOf(listener)) < 0) { + return; + } + + eventListeners.splice(i, 1); + } + }, { + 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) { + listener.apply(null, args); + }); + + if (this._dispatchToDOM) { + this._dispatchDOMEvent(eventName, args); + } + } + }, { + key: "_dispatchDOMEvent", + value: function _dispatchDOMEvent(eventName) { + var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + 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; + } + } + + var event = document.createEvent('CustomEvent'); + event.initCustomEvent(eventName, true, true, details); + document.dispatchEvent(event); + } + }]); + + return EventBus; +}(); + +exports.EventBus = EventBus; +var globalEventBus = null; + +function getGlobalEventBus() { + var dispatchToDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + if (!globalEventBus) { + globalEventBus = new EventBus({ + dispatchToDOM: dispatchToDOM + }); + } + + return globalEventBus; +} + +function clamp(v, min, max) { + return Math.min(Math.max(v, min), max); +} + +var ProgressBar = +/*#__PURE__*/ +function () { + function ProgressBar(id) { + 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; - - // Fetch the sub-elements for later. this.div = document.querySelector(id + ' .progress'); - - // Get the loading bar element, so it can be resized to fit the viewer. this.bar = this.div.parentNode; - - // Get options, with sensible defaults. - this.height = opts.height || 100; - this.width = opts.width || 100; - this.units = opts.units || '%'; - - // Initialize heights. + this.height = height || 100; + this.width = width || 100; + this.units = units || '%'; this.div.style.height = this.height + this.units; this.percent = 0; } - ProgressBar.prototype = { - - updateBar: function ProgressBar_updateBar() { + _createClass(ProgressBar, [{ + key: "_updateBar", + value: function _updateBar() { if (this._indeterminate) { this.div.classList.add('indeterminate'); this.div.style.width = this.width + this.units; @@ -389,800 +4114,2819 @@ var ProgressBar = (function ProgressBarClosure() { this.div.classList.remove('indeterminate'); var progressSize = this.width * this._percent / 100; this.div.style.width = progressSize + this.units; - }, - - get percent() { - return this._percent; - }, - - set percent(val) { - this._indeterminate = isNaN(val); - this._percent = clamp(val, 0, 100); - this.updateBar(); - }, - - setWidth: function ProgressBar_setWidth(viewer) { - if (viewer) { - var container = viewer.parentNode; - var scrollbarWidth = container.offsetWidth - viewer.offsetWidth; - if (scrollbarWidth > 0) { - this.bar.setAttribute('style', 'width: calc(100% - ' + - scrollbarWidth + 'px);'); - } + } + }, { + key: "setWidth", + value: function setWidth(viewer) { + if (!viewer) { + return; } - }, - hide: function ProgressBar_hide() { + var container = viewer.parentNode; + var scrollbarWidth = container.offsetWidth - viewer.offsetWidth; + + if (scrollbarWidth > 0) { + this.bar.setAttribute('style', 'width: calc(100% - ' + scrollbarWidth + 'px);'); + } + } + }, { + key: "hide", + value: function hide() { if (!this.visible) { return; } + this.visible = false; this.bar.classList.add('hidden'); document.body.classList.remove('loadingInProgress'); - }, - - show: function ProgressBar_show() { + } + }, { + key: "show", + value: function show() { if (this.visible) { return; } + this.visible = true; document.body.classList.add('loadingInProgress'); this.bar.classList.remove('hidden'); } - }; + }, { + key: "percent", + get: function get() { + return this._percent; + }, + set: function set(val) { + this._indeterminate = isNaN(val); + this._percent = clamp(val, 0, 100); + + this._updateBar(); + } + }]); return ProgressBar; -})(); +}(); +exports.ProgressBar = ProgressBar; +function moveToEndOfArray(arr, condition) { + var moved = [], + len = arr.length; + var write = 0; -var DEFAULT_PREFERENCES = { - showPreviousViewOnLoad: true, - defaultZoomValue: '', - sidebarViewOnLoad: 0, - enableHandToolOnLoad: false, - enableWebGL: false, - pdfBugEnabled: false, - disableRange: false, - disableStream: false, - disableAutoFetch: false, - disableFontFace: false, - disableTextLayer: false, - useOnlyCssZoom: false, - externalLinkTarget: 0, -}; - - -var SidebarView = { - NONE: 0, - THUMBS: 1, - OUTLINE: 2, - ATTACHMENTS: 3 -}; - -/** - * Preferences - Utility for storing persistent settings. - * Used for settings that should be applied to all opened documents, - * or every time the viewer is loaded. - */ -var Preferences = { - prefs: Object.create(DEFAULT_PREFERENCES), - isInitializedPromiseResolved: false, - initializedPromise: null, - - /** - * Initialize and fetch the current preference values from storage. - * @return {Promise} A promise that is resolved when the preferences - * have been initialized. - */ - initialize: function preferencesInitialize() { - return this.initializedPromise = - this._readFromStorage(DEFAULT_PREFERENCES).then(function(prefObj) { - this.isInitializedPromiseResolved = true; - if (prefObj) { - this.prefs = prefObj; - } - }.bind(this)); - }, - - /** - * Stub function for writing preferences to storage. - * NOTE: This should be overridden by a build-specific function defined below. - * @param {Object} prefObj The preferences that should be written to storage. - * @return {Promise} A promise that is resolved when the preference values - * have been written. - */ - _writeToStorage: function preferences_writeToStorage(prefObj) { - return Promise.resolve(); - }, - - /** - * Stub function for reading preferences from storage. - * NOTE: This should be overridden by a build-specific function defined below. - * @param {Object} prefObj The preferences that should be read from storage. - * @return {Promise} A promise that is resolved with an {Object} containing - * the preferences that have been read. - */ - _readFromStorage: function preferences_readFromStorage(prefObj) { - return Promise.resolve(); - }, - - /** - * Reset the preferences to their default values and update storage. - * @return {Promise} A promise that is resolved when the preference values - * have been reset. - */ - reset: function preferencesReset() { - return this.initializedPromise.then(function() { - this.prefs = Object.create(DEFAULT_PREFERENCES); - return this._writeToStorage(DEFAULT_PREFERENCES); - }.bind(this)); - }, - - /** - * Replace the current preference values with the ones from storage. - * @return {Promise} A promise that is resolved when the preference values - * have been updated. - */ - reload: function preferencesReload() { - return this.initializedPromise.then(function () { - this._readFromStorage(DEFAULT_PREFERENCES).then(function(prefObj) { - if (prefObj) { - this.prefs = prefObj; - } - }.bind(this)); - }.bind(this)); - }, - - /** - * Set the value of a preference. - * @param {string} name The name of the preference that should be changed. - * @param {boolean|number|string} value The new value of the preference. - * @return {Promise} A promise that is resolved when the value has been set, - * provided that the preference exists and the types match. - */ - set: function preferencesSet(name, value) { - return this.initializedPromise.then(function () { - if (DEFAULT_PREFERENCES[name] === undefined) { - throw new Error('preferencesSet: \'' + name + '\' is undefined.'); - } else if (value === undefined) { - throw new Error('preferencesSet: no value is specified.'); - } - var valueType = typeof value; - var defaultType = typeof DEFAULT_PREFERENCES[name]; - - if (valueType !== defaultType) { - if (valueType === 'number' && defaultType === 'string') { - value = value.toString(); - } else { - throw new Error('Preferences_set: \'' + value + '\' is a \"' + - valueType + '\", expected \"' + defaultType + '\".'); - } - } else { - if (valueType === 'number' && (value | 0) !== value) { - throw new Error('Preferences_set: \'' + value + - '\' must be an \"integer\".'); - } - } - this.prefs[name] = value; - return this._writeToStorage(this.prefs); - }.bind(this)); - }, - - /** - * Get the value of a preference. - * @param {string} name The name of the preference whose value is requested. - * @return {Promise} A promise that is resolved with a {boolean|number|string} - * containing the value of the preference. - */ - get: function preferencesGet(name) { - return this.initializedPromise.then(function () { - var defaultValue = DEFAULT_PREFERENCES[name]; - - if (defaultValue === undefined) { - throw new Error('preferencesGet: \'' + name + '\' is undefined.'); - } else { - var prefValue = this.prefs[name]; - - if (prefValue !== undefined) { - return prefValue; - } - } - return defaultValue; - }.bind(this)); - } -}; - - -Preferences._writeToStorage = function (prefObj) { - return new Promise(function (resolve) { - localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj)); - resolve(); - }); -}; - -Preferences._readFromStorage = function (prefObj) { - return new Promise(function (resolve) { - var readPrefs = JSON.parse(localStorage.getItem('pdfjs.preferences')); - resolve(readPrefs); - }); -}; - - -(function mozPrintCallbackPolyfillClosure() { - if ('mozPrintCallback' in document.createElement('canvas')) { - return; - } - // Cause positive result on feature-detection: - HTMLCanvasElement.prototype.mozPrintCallback = undefined; - - var canvases; // During print task: non-live NodeList of elements - var index; // Index of element that is being processed - - var print = window.print; - window.print = function print() { - if (canvases) { - console.warn('Ignored window.print() because of a pending print job.'); - return; - } - try { - dispatchEvent('beforeprint'); - } finally { - canvases = document.querySelectorAll('canvas'); - index = -1; - next(); - } - }; - - function dispatchEvent(eventType) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent(eventType, false, false, 'custom'); - window.dispatchEvent(event); - } - - function next() { - if (!canvases) { - return; // Print task cancelled by user (state reset in abort()) - } - - renderProgress(); - if (++index < canvases.length) { - var canvas = canvases[index]; - if (typeof canvas.mozPrintCallback === 'function') { - canvas.mozPrintCallback({ - context: canvas.getContext('2d'), - abort: abort, - done: next - }); - } else { - next(); - } + for (var read = 0; read < len; ++read) { + if (condition(arr[read])) { + moved.push(arr[read]); } else { - renderProgress(); - print.call(window); - setTimeout(abort, 20); // Tidy-up + arr[write] = arr[read]; + ++write; } } - function abort() { - if (canvases) { - canvases = null; - renderProgress(); - dispatchEvent('afterprint'); - } + for (var _read = 0; write < len; ++_read, ++write) { + arr[write] = moved[_read]; } +} - function renderProgress() { - var progressContainer = document.getElementById('mozPrintCallback-shim'); - if (canvases && canvases.length) { - var progress = Math.round(100 * index / canvases.length); - var progressBar = progressContainer.querySelector('progress'); - var progressPerc = progressContainer.querySelector('.relative-progress'); - progressBar.value = progress; - progressPerc.textContent = progress + '%'; - progressContainer.removeAttribute('hidden'); - progressContainer.onclick = abort; - } else { - progressContainer.setAttribute('hidden', ''); - } - } +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { - var hasAttachEvent = !!document.attachEvent; +"use strict"; - window.addEventListener('keydown', function(event) { - // Intercept Cmd/Ctrl + P in all browsers. - // Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera - if (event.keyCode === 80/*P*/ && (event.ctrlKey || event.metaKey) && - !event.altKey && (!event.shiftKey || window.chrome || window.opera)) { - window.print(); - if (hasAttachEvent) { - // Only attachEvent can cancel Ctrl + P dialog in IE <=10 - // attachEvent is gone in IE11, so the dialog will re-appear in IE11. - return; - } - event.preventDefault(); - if (event.stopImmediatePropagation) { - event.stopImmediatePropagation(); - } else { - event.stopPropagation(); - } - return; - } - if (event.keyCode === 27 && canvases) { // Esc - abort(); - } - }, true); - if (hasAttachEvent) { - document.attachEvent('onkeydown', function(event) { - event = event || window.event; - if (event.keyCode === 80/*P*/ && event.ctrlKey) { - event.keyCode = 0; - return false; - } + +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; + +/***/ }), +/* 8 */ +/***/ (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__(9); + +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); }); } - if ('onbeforeprint' in window) { - // Do not propagate before/afterprint events when they are not triggered - // from within this polyfill. (FF/IE). - var stopPropagationIfNeeded = function(event) { - if (event.detail !== 'custom' && event.stopImmediatePropagation) { - event.stopImmediatePropagation(); - } - }; - window.addEventListener('beforeprint', stopPropagationIfNeeded, false); - window.addEventListener('afterprint', stopPropagationIfNeeded, false); - } -})(); + _createClass(PDFCursorTools, [{ + key: "switchTool", + value: function switchTool(tool) { + var _this2 = this; - - -var DownloadManager = (function DownloadManagerClosure() { - - function download(blobUrl, filename) { - var a = document.createElement('a'); - if (a.click) { - // Use a.click() if available. Otherwise, Chrome might show - // "Unsafe JavaScript attempt to initiate a navigation change - // for frame with URL" and not open the PDF at all. - // Supported by (not mentioned = untested): - // - Firefox 6 - 19 (4- does not support a.click, 5 ignores a.click) - // - Chrome 19 - 26 (18- does not support a.click) - // - Opera 9 - 12.15 - // - Internet Explorer 6 - 10 - // - Safari 6 (5.1- does not support a.click) - a.href = blobUrl; - a.target = '_parent'; - // Use a.download if available. This increases the likelihood that - // the file is downloaded instead of opened by another PDF plugin. - if ('download' in a) { - a.download = filename; - } - // must be in the document for IE and recent Firefox versions. - // (otherwise .click() is ignored) - (document.body || document.documentElement).appendChild(a); - a.click(); - a.parentNode.removeChild(a); - } else { - if (window.top === window && - blobUrl.split('#')[0] === window.location.href.split('#')[0]) { - // If _parent == self, then opening an identical URL with different - // location hash will only cause a navigation, not a download. - var padCharacter = blobUrl.indexOf('?') === -1 ? '?' : '&'; - blobUrl = blobUrl.replace(/#|$/, padCharacter + '$&'); - } - window.open(blobUrl, '_parent'); - } - } - - function DownloadManager() {} - - DownloadManager.prototype = { - downloadUrl: function DownloadManager_downloadUrl(url, filename) { - if (!PDFJS.isValidUrl(url, true)) { - return; // restricted/invalid URL - } - - download(url + '#pdfjs.action=download', filename); - }, - - downloadData: function DownloadManager_downloadData(data, filename, - contentType) { - if (navigator.msSaveBlob) { // IE10 and above - return navigator.msSaveBlob(new Blob([data], { type: contentType }), - filename); - } - - var blobUrl = PDFJS.createObjectURL(data, contentType); - download(blobUrl, filename); - }, - - download: function DownloadManager_download(blob, url, filename) { - if (!URL) { - // URL.createObjectURL is not supported - this.downloadUrl(url, filename); + if (this.activeBeforePresentationMode !== null) { return; } - if (navigator.msSaveBlob) { - // IE10 / IE11 - if (!navigator.msSaveBlob(blob, filename)) { - this.downloadUrl(url, filename); + 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: } - return; - } + }; - var blobUrl = URL.createObjectURL(blob); - download(blobUrl, filename); - } - }; - - return DownloadManager; -})(); - - - - - -var DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20; - -/** - * View History - This is a utility for saving various view parameters for - * recently opened files. - * - * The way that the view parameters are stored depends on how PDF.js is built, - * for 'node make ' the following cases exist: - * - FIREFOX or MOZCENTRAL - uses sessionStorage. - * - GENERIC or CHROME - uses localStorage, if it is available. - */ -var ViewHistory = (function ViewHistoryClosure() { - function ViewHistory(fingerprint, cacheSize) { - this.fingerprint = fingerprint; - this.cacheSize = cacheSize || DEFAULT_VIEW_HISTORY_CACHE_SIZE; - this.isInitializedPromiseResolved = false; - this.initializedPromise = - this._readFromStorage().then(function (databaseStr) { - this.isInitializedPromiseResolved = true; - - var database = JSON.parse(databaseStr || '{}'); - if (!('files' in database)) { - database.files = []; - } - if (database.files.length >= this.cacheSize) { - database.files.shift(); - } - var index; - for (var i = 0, length = database.files.length; i < length; i++) { - var branch = database.files[i]; - if (branch.fingerprint === this.fingerprint) { - index = i; + 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; } - } - if (typeof index !== 'number') { - index = database.files.push({fingerprint: this.fingerprint}) - 1; - } - this.file = database.files[index]; - this.database = database; - }.bind(this)); + + 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; + +/***/ }), +/* 9 */ +/***/ (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; } - ViewHistory.prototype = { - _writeToStorage: function ViewHistory_writeToStorage() { - return new Promise(function (resolve) { - var databaseStr = JSON.stringify(this.database); + 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); - localStorage.setItem('database', databaseStr); - resolve(); - }.bind(this)); - }, - - _readFromStorage: function ViewHistory_readFromStorage() { - return new Promise(function (resolve) { - - resolve(localStorage.getItem('database')); - }); - }, - - set: function ViewHistory_set(name, val) { - if (!this.isInitializedPromiseResolved) { - return; + if (this.onActiveChanged) { + this.onActiveChanged(true); } - this.file[name] = val; - return this._writeToStorage(); - }, - - setMultiple: function ViewHistory_setMultiple(properties) { - if (!this.isInitializedPromiseResolved) { - return; - } - for (var name in properties) { - this.file[name] = properties[name]; - } - return this._writeToStorage(); - }, - - get: function ViewHistory_get(name, defaultValue) { - if (!this.isInitializedPromiseResolved) { - return defaultValue; - } - return this.file[name] || defaultValue; } + }, + 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() { + if (this.active) { + this.deactivate(); + } else { + this.activate(); + } + }, + ignoreTarget: function GrabToPan_ignoreTarget(node) { + 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; + } catch (e) { + 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); + 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); + + 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' + }); + } 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.overlay.remove(); + } +}; +var matchesSelector; +['webkitM', 'mozM', 'msM', 'oM', 'm'].some(function (prefix) { + var name = prefix + 'atches'; + + if (name in document.documentElement) { + matchesSelector = name; + } + + 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) { + return !(event.buttons & 1); + } + + if (isChrome15OrOpera15plus || isSafari6plus) { + return event.which === 0; + } +} + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +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, + RUNNING: 1, + PAUSED: 2, + FINISHED: 3 +}; +exports.RenderingStates = RenderingStates; + +var PDFRenderingQueue = +/*#__PURE__*/ +function () { + function PDFRenderingQueue() { + _classCallCheck(this, PDFRenderingQueue); + + this.pdfViewer = null; + this.pdfThumbnailViewer = null; + this.onIdle = null; + this.highestPriorityPage = null; + this.idleTimeout = null; + this.printing = false; + this.isThumbnailViewEnabled = false; + } + + _createClass(PDFRenderingQueue, [{ + key: "setViewer", + value: function setViewer(pdfViewer) { + this.pdfViewer = pdfViewer; + } + }, { + key: "setThumbnailViewer", + value: function setThumbnailViewer(pdfThumbnailViewer) { + this.pdfThumbnailViewer = pdfThumbnailViewer; + } + }, { + key: "isHighestPriority", + value: function isHighestPriority(view) { + return this.highestPriorityPage === view.renderingId; + } + }, { + key: "renderHighestPriority", + value: function renderHighestPriority(currentlyVisiblePages) { + if (this.idleTimeout) { + clearTimeout(this.idleTimeout); + this.idleTimeout = null; + } + + if (this.pdfViewer.forceRendering(currentlyVisiblePages)) { + return; + } + + if (this.pdfThumbnailViewer && this.isThumbnailViewEnabled) { + if (this.pdfThumbnailViewer.forceRendering()) { + return; + } + } + + if (this.printing) { + return; + } + + if (this.onIdle) { + this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT); + } + } + }, { + key: "getHighestPriority", + value: function getHighestPriority(visible, views, scrolledDown) { + var visibleViews = visible.views; + var numVisible = visibleViews.length; + + if (numVisible === 0) { + return false; + } + + 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; + } + }, { + key: "isViewFinished", + value: function isViewFinished(view) { + return view.renderingState === RenderingStates.FINISHED; + } + }, { + key: "renderView", + value: function renderView(view) { + var _this = this; + + 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() { + _this.renderHighestPriority(); + }; + + view.draw().then(continueRendering, continueRendering); + break; + } + + return true; + } + }]); + + return PDFRenderingQueue; +}(); + +exports.PDFRenderingQueue = PDFRenderingQueue; + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFSidebar = exports.SidebarView = void 0; + +var _ui_utils = __webpack_require__(6); + +var _pdf_rendering_queue = __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 UI_NOTIFICATION_CLASS = 'pdfSidebarNotification'; +var SidebarView = { + UNKNOWN: -1, + NONE: 0, + THUMBS: 1, + OUTLINE: 2, + ATTACHMENTS: 3, + LAYERS: 4 +}; +exports.SidebarView = SidebarView; + +var PDFSidebar = +/*#__PURE__*/ +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.eventBus = eventBus; + this.l10n = l10n; + + this._addEventListeners(); + } + + _createClass(PDFSidebar, [{ + 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", + value: function setInitialView() { + var view = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SidebarView.NONE; + + if (this.isInitialViewSet) { + return; + } + + this.isInitialViewSet = true; + + if (view === SidebarView.NONE || view === SidebarView.UNKNOWN) { + this._dispatchEvent(); + + return; + } + + if (!this._switchView(view, true)) { + this._dispatchEvent(); + } + } + }, { + key: "switchView", + value: function switchView(view) { + var forceOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + 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: + if (this.isOpen && isViewChanged) { + shouldForceRendering = true; + } + + break; + + case SidebarView.OUTLINE: + if (this.outlineButton.disabled) { + return false; + } + + break; + + case SidebarView.ATTACHMENTS: + if (this.attachmentsButton.disabled) { + return false; + } + + break; + + default: + console.error("PDFSidebar._switchView: \"".concat(view, "\" is not a valid view.")); + return false; + } + + 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 true; + } + + if (shouldForceRendering) { + this._updateThumbnailViewer(); + + this._forceRendering(); + } + + if (isViewChanged) { + this._dispatchEvent(); + } + + this._hideUINotification(this.active); + + return isViewChanged; + } + }, { + key: "open", + value: function open() { + if (this.isOpen) { + return; + } + + this.isOpen = true; + this.toggleButton.classList.add('toggled'); + this.outerContainer.classList.add('sidebarMoving', '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; + } + } + }, { + 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]); + } + + 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.PDFSidebar = PDFSidebar; + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.OptionKind = exports.AppOptions = void 0; + +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"); } } + +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 OptionKind = { + VIEWER: 'viewer', + API: 'api', + WORKER: 'worker' +}; +exports.OptionKind = OptionKind; +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 + }, + 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 + }, + historyUpdateUrl: { + value: false, + kind: OptionKind.VIEWER + }, + imageResourcesPath: { + value: './images/', + kind: OptionKind.VIEWER + }, + maxCanvasPixels: { + value: 16777216, + compatibility: _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels, + kind: OptionKind.VIEWER + }, + pdfBugEnabled: { + value: false, + kind: OptionKind.VIEWER + }, + renderer: { + value: 'canvas', + kind: OptionKind.VIEWER + }, + renderInteractiveForms: { + value: false, + kind: OptionKind.VIEWER + }, + sidebarViewOnLoad: { + value: -1, + kind: OptionKind.VIEWER + }, + scrollModeOnLoad: { + value: -1, + kind: OptionKind.VIEWER + }, + spreadModeOnLoad: { + value: -1, + kind: OptionKind.VIEWER + }, + textLayerMode: { + value: 1, + kind: OptionKind.VIEWER + }, + useOnlyCssZoom: { + value: false, + kind: OptionKind.VIEWER + }, + viewOnLoad: { + value: 0, + kind: OptionKind.VIEWER + }, + cMapPacked: { + value: true, + kind: OptionKind.API + }, + cMapUrl: { + value: '../web/cmaps/', + kind: OptionKind.API + }, + disableAutoFetch: { + value: false, + kind: OptionKind.API + }, + disableCreateObjectURL: { + value: false, + compatibility: _pdfjsLib.apiCompatibilityParams.disableCreateObjectURL, + 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.disablePreferences = { + value: false, + kind: OptionKind.VIEWER }; + defaultOptions.locale = { + value: typeof navigator !== 'undefined' ? navigator.language : 'en-US', + kind: OptionKind.VIEWER + }; +} +var userOptions = Object.create(null); - return ViewHistory; -})(); +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; + } + + var defaultOption = defaultOptions[name]; + + if (defaultOption !== undefined) { + return defaultOption.compatibility || defaultOption.value; + } + + return undefined; + } + }, { + key: "getAll", + value: function getAll() { + var kind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var options = Object.create(null); + + for (var name in defaultOptions) { + var defaultOption = defaultOptions[name]; + + if (kind && kind !== defaultOption.kind) { + continue; + } + + var userOption = userOptions[name]; + options[name] = userOption !== undefined ? userOption : defaultOption.compatibility || defaultOption.value; + } + + return options; + } + }, { + key: "set", + value: function set(name, value) { + userOptions[name] = value; + } + }, { + key: "remove", + value: function remove(name) { + delete userOptions[name]; + } + }]); + + return AppOptions; +}(); + +exports.AppOptions = AppOptions; + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -/** - * Creates a "search bar" given a set of DOM elements that act as controls - * for searching or for setting search preferences in the UI. This object - * also sets up the appropriate events for the controls. Actual searching - * is done by PDFFindController. - */ -var PDFFindBar = (function PDFFindBarClosure() { +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; + } + })(); +} +exports.viewerCompatibilityParams = Object.freeze(compatibilityParams); + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.OverlayManager = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +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 OverlayManager = +/*#__PURE__*/ +function () { + function OverlayManager() { + _classCallCheck(this, OverlayManager); + + this._overlays = {}; + this._active = null; + this._keyDownBound = this._keyDown.bind(this); + } + + _createClass(OverlayManager, [{ + key: "register", + value: function () { + 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: + 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 = 6; + break; + } + + throw new Error('Not enough parameters.'); + + case 6: + if (!this._overlays[name]) { + _context.next = 8; + break; + } + + throw new Error('The overlay is already registered.'); + + case 8: + this._overlays[name] = { + element: element, + container: container, + callerCloseMethod: callerCloseMethod, + canForceClose: canForceClose + }; + + case 9: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function register(_x, _x2) { + return _register.apply(this, arguments); + } + + return register; + }() + }, { + key: "unregister", + value: function () { + 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: + if (this._overlays[name]) { + _context2.next = 4; + break; + } + + throw new Error('The overlay does not exist.'); + + case 4: + if (!(this._active === name)) { + _context2.next = 6; + break; + } + + throw new Error('The overlay cannot be removed while it is active.'); + + case 6: + delete this._overlays[name]; + + case 7: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function unregister(_x3) { + return _unregister.apply(this, arguments); + } + + return unregister; + }() + }, { + key: "open", + value: function () { + 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: + if (this._overlays[name]) { + _context3.next = 4; + break; + } + + throw new Error('The overlay does not exist.'); + + case 4: + if (!this._active) { + _context3.next = 14; + break; + } + + if (!this._overlays[name].canForceClose) { + _context3.next = 9; + break; + } + + this._closeThroughCaller(); + + _context3.next = 14; + break; + + case 9: + if (!(this._active === name)) { + _context3.next = 13; + break; + } + + throw new Error('The overlay is already active.'); + + case 13: + 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); + + case 18: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function open(_x4) { + return _open.apply(this, arguments); + } + + return open; + }() + }, { + key: "close", + value: function () { + 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: + if (this._overlays[name]) { + _context4.next = 4; + break; + } + + throw new Error('The overlay does not exist.'); + + case 4: + if (this._active) { + _context4.next = 8; + break; + } + + throw new Error('The overlay is currently not active.'); + + case 8: + if (!(this._active !== name)) { + _context4.next = 10; + break; + } + + 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._active = null; + window.removeEventListener('keydown', this._keyDownBound); + + case 14: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + + function close(_x5) { + return _close.apply(this, arguments); + } + + return close; + }() + }, { + key: "_keyDown", + value: function _keyDown(evt) { + if (this._active && evt.keyCode === 27) { + this._closeThroughCaller(); + + evt.preventDefault(); + } + } + }, { + 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", + get: function get() { + return this._active; + } + }]); + + return OverlayManager; +}(); + +exports.OverlayManager = OverlayManager; + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PasswordPrompt = void 0; + +var _ui_utils = __webpack_require__(6); + +var _pdfjsLib = __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 PasswordPrompt = +/*#__PURE__*/ +function () { + function PasswordPrompt(options, overlayManager) { + var _this = this; + + var l10n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ui_utils.NullL10n; + + _classCallCheck(this, PasswordPrompt); + + this.overlayName = options.overlayName; + this.container = options.container; + this.label = options.label; + this.input = options.input; + this.submitButton = options.submitButton; + this.cancelButton = options.cancelButton; + this.overlayManager = overlayManager; + 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) { + if (e.keyCode === 13) { + _this.verify(); + } + }); + this.overlayManager.register(this.overlayName, this.container, this.close.bind(this), true); + } + + _createClass(PasswordPrompt, [{ + key: "open", + value: function open() { + var _this2 = this; + + this.overlayManager.open(this.overlayName).then(function () { + _this2.input.focus(); + + var promptString; + + if (_this2.reason === _pdfjsLib.PasswordResponses.INCORRECT_PASSWORD) { + 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.then(function (msg) { + _this2.label.textContent = msg; + }); + }); + } + }, { + key: "close", + value: function close() { + var _this3 = this; + + this.overlayManager.close(this.overlayName).then(function () { + _this3.input.value = ''; + }); + } + }, { + key: "verify", + value: function verify() { + var password = this.input.value; + + if (password && password.length > 0) { + this.close(); + return this.updateCallback(password); + } + } + }, { + key: "setUpdateCallback", + value: function setUpdateCallback(updateCallback, reason) { + this.updateCallback = updateCallback; + this.reason = reason; + } + }]); + + return PasswordPrompt; +}(); + +exports.PasswordPrompt = PasswordPrompt; + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFAttachmentViewer = void 0; + +var _pdfjsLib = __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 PDFAttachmentViewer = +/*#__PURE__*/ +function () { + function PDFAttachmentViewer(_ref) { + var container = _ref.container, + eventBus = _ref.eventBus, + downloadManager = _ref.downloadManager; + + _classCallCheck(this, PDFAttachmentViewer); + + this.container = container; + this.eventBus = eventBus; + this.downloadManager = downloadManager; + this.reset(); + this.eventBus.on('fileattachmentannotation', this._appendAttachment.bind(this)); + } + + _createClass(PDFAttachmentViewer, [{ + key: "reset", + value: function reset() { + var keepRenderedCapability = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + this.attachments = null; + this.container.textContent = ''; + + if (!keepRenderedCapability) { + this._renderedCapability = (0, _pdfjsLib.createPromiseCapability)(); + } + } + }, { + key: "_dispatchEvent", + value: function _dispatchEvent(attachmentsCount) { + this._renderedCapability.resolve(); + + this.eventBus.dispatch('attachmentsloaded', { + source: this, + attachmentsCount: attachmentsCount + }); + } + }, { + key: "_bindPdfLink", + value: function _bindPdfLink(button, content, filename) { + if (this.downloadManager.disableCreateObjectURL) { + throw new Error('bindPdfLink: Unsupported "disableCreateObjectURL" value.'); + } + + var blobUrl; + + button.onclick = function () { + if (!blobUrl) { + blobUrl = (0, _pdfjsLib.createObjectURL)(content, 'application/pdf'); + } + + var viewerUrl; + viewerUrl = '?file=' + encodeURIComponent(blobUrl + '#' + filename); + window.open(viewerUrl); + return false; + }; + } + }, { + key: "_bindLink", + value: function _bindLink(button, content, filename) { + var _this = this; + + button.onclick = function () { + _this.downloadManager.downloadData(content, filename, ''); + + return false; + }; + } + }, { + key: "render", + value: function render(_ref2) { + var attachments = _ref2.attachments, + _ref2$keepRenderedCap = _ref2.keepRenderedCapability, + 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'); + 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", + value: function _appendAttachment(_ref3) { + var _this2 = this; + + var id = _ref3.id, + filename = _ref3.filename, + content = _ref3.content; + + this._renderedCapability.promise.then(function () { + var attachments = _this2.attachments; + + if (!attachments) { + attachments = Object.create(null); + } else { + for (var name in attachments) { + if (id === name) { + return; + } + } + } + + attachments[id] = { + filename: filename, + content: content + }; + + _this2.render({ + attachments: attachments, + keepRenderedCapability: true + }); + }); + } + }]); + + return PDFAttachmentViewer; +}(); + +exports.PDFAttachmentViewer = PDFAttachmentViewer; + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFDocumentProperties = void 0; + +var _ui_utils = __webpack_require__(6); + +var _pdfjsLib = __webpack_require__(7); + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(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"] != 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 DEFAULT_FIELD_CONTENT = '-'; +var NON_METRIC_LOCALES = ['en-us', 'en-lr', 'my']; +var US_PAGE_NAMES = { + '8.5x11': 'Letter', + '8.5x14': 'Legal' +}; +var METRIC_PAGE_NAMES = { + '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["".concat(width, "x").concat(height)]; +} + +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 l10n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _ui_utils.NullL10n; + + _classCallCheck(this, PDFDocumentProperties); + + this.overlayName = overlayName; + this.fields = fields; + this.container = container; + this.overlayManager = overlayManager; + this.l10n = l10n; + + this._reset(); + + if (closeButton) { + 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; + }); + } + + this._isNonMetricLocale = true; + l10n.getLanguage().then(function (locale) { + _this._isNonMetricLocale = NON_METRIC_LOCALES.includes(locale); + }); + } + + _createClass(PDFDocumentProperties, [{ + key: "open", + value: function open() { + var _this2 = this; + + var freezeFieldData = function freezeFieldData(data) { + 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']) { + _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 _this2._parsePageSize((0, _ui_utils.getPageSizeInches)(pdfPage), pagesRotation); + }), _this2._parseLinearization(info.IsLinearized)]); + }).then(function (_ref3) { + var _ref4 = _slicedToArray(_ref3, 8), + info = _ref4[0], + metadata = _ref4[1], + fileName = _ref4[2], + fileSize = _ref4[3], + creationDate = _ref4[4], + modDate = _ref4[5], + pageSize = _ref4[6], + 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 + }); + + _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']) { + return; + } + + var data = Object.assign(Object.create(null), _this2.fieldData); + data['fileSize'] = fileSize; + freezeFieldData(data); + + _this2._updateUI(); + }); + }); + } + }, { + key: "close", + value: function close() { + this.overlayManager.close(this.overlayName); + } + }, { + 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", + value: function setFileSize(fileSize) { + if (Number.isInteger(fileSize) && fileSize > 0) { + this.maybeFileSize = fileSize; + } + } + }, { + key: "_reset", + value: function _reset() { + this.pdfDocument = null; + this.url = null; + this.maybeFileSize = 0; + delete this.fieldData; + this._dataAvailableCapability = (0, _pdfjsLib.createPromiseCapability)(); + this._currentPageNumber = 1; + this._pagesRotation = 0; + } + }, { + key: "_updateUI", + value: function _updateUI() { + var reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + if (reset || !this.fieldData) { + 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; + 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)'); + } + + return this.l10n.get('document_properties_mb', { + size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(), + size_b: fileSize.toLocaleString() + }, '{{size_mb}} MB ({{size_b}} bytes)'); + } + }, { + key: "_parsePageSize", + value: function _parsePageSize(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; + } + } + } + + if (name) { + pageName = this.l10n.get('document_properties_page_size_name_' + name.toLowerCase(), null, name); + } + + 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}})'); + }); + } + }, { + key: "_parseDate", + value: function _parseDate(inputDate) { + if (!inputDate) { + return; + } + + 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", + value: function _parseLinearization(isLinearized) { + return this.l10n.get('document_properties_linearized_' + (isLinearized ? 'yes' : 'no'), null, isLinearized ? 'Yes' : 'No'); + } + }]); + + return PDFDocumentProperties; +}(); + +exports.PDFDocumentProperties = PDFDocumentProperties; + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFFindBar = void 0; + +var _ui_utils = __webpack_require__(6); + +var _pdf_find_controller = __webpack_require__(19); + +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 = +/*#__PURE__*/ +function () { function PDFFindBar(options) { + 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); + this.opened = false; this.bar = options.bar || null; this.toggleButton = options.toggleButton || null; this.findField = options.findField || null; this.highlightAll = options.highlightAllCheckbox || null; this.caseSensitive = options.caseSensitiveCheckbox || null; + this.entireWord = options.entireWordCheckbox || null; this.findMsg = options.findMsg || null; this.findResultsCount = options.findResultsCount || null; - this.findStatusIcon = options.findStatusIcon || null; this.findPreviousButton = options.findPreviousButton || null; this.findNextButton = options.findNextButton || null; - this.findController = options.findController || null; - - if (this.findController === null) { - throw new Error('PDFFindBar cannot be used without a ' + - 'PDFFindController instance.'); - } - - // Add event listeners to the DOM elements. - var self = this; - this.toggleButton.addEventListener('click', function() { - self.toggle(); + this.eventBus = eventBus; + this.l10n = l10n; + this.toggleButton.addEventListener('click', function () { + _this.toggle(); }); - - this.findField.addEventListener('input', function() { - self.dispatchEvent(''); + this.findField.addEventListener('input', function () { + _this.dispatchEvent(''); }); - - this.bar.addEventListener('keydown', function(evt) { - switch (evt.keyCode) { - case 13: // Enter - if (evt.target === self.findField) { - self.dispatchEvent('again', evt.shiftKey); + this.bar.addEventListener('keydown', function (e) { + switch (e.keyCode) { + case 13: + if (e.target === _this.findField) { + _this.dispatchEvent('again', e.shiftKey); } + break; - case 27: // Escape - self.close(); + + case 27: + _this.close(); + break; } }); - - this.findPreviousButton.addEventListener('click', function() { - self.dispatchEvent('again', true); + this.findPreviousButton.addEventListener('click', function () { + _this.dispatchEvent('again', true); }); - - this.findNextButton.addEventListener('click', function() { - self.dispatchEvent('again', false); + this.findNextButton.addEventListener('click', function () { + _this.dispatchEvent('again', false); }); - - this.highlightAll.addEventListener('click', function() { - self.dispatchEvent('highlightallchange'); + this.highlightAll.addEventListener('click', function () { + _this.dispatchEvent('highlightallchange'); }); - - this.caseSensitive.addEventListener('click', function() { - self.dispatchEvent('casesensitivitychange'); + this.caseSensitive.addEventListener('click', function () { + _this.dispatchEvent('casesensitivitychange'); }); + this.entireWord.addEventListener('click', function () { + _this.dispatchEvent('entirewordchange'); + }); + this.eventBus.on('resize', this._adjustWidth.bind(this)); } - PDFFindBar.prototype = { - dispatchEvent: function PDFFindBar_dispatchEvent(type, findPrev) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('find' + type, true, true, { + _createClass(PDFFindBar, [{ + key: "reset", + value: function reset() { + this.updateUIState(); + } + }, { + key: "dispatchEvent", + value: function dispatchEvent(type, findPrev) { + this.eventBus.dispatch('find', { + source: this, + type: type, query: this.findField.value, + phraseSearch: true, caseSensitive: this.caseSensitive.checked, + entireWord: this.entireWord.checked, highlightAll: this.highlightAll.checked, findPrevious: findPrev }); - return window.dispatchEvent(event); - }, + } + }, { + key: "updateUIState", + value: function updateUIState(state, previous, matchesCount) { + var _this2 = this; - updateUIState: - function PDFFindBar_updateUIState(state, previous, matchCount) { var notFound = false; var findMsg = ''; var status = ''; switch (state) { - case FindStates.FIND_FOUND: + case _pdf_find_controller.FindState.FOUND: break; - case FindStates.FIND_PENDING: + case _pdf_find_controller.FindState.PENDING: status = 'pending'; break; - case FindStates.FIND_NOTFOUND: - findMsg = 'Phrase not found'; + case _pdf_find_controller.FindState.NOT_FOUND: + findMsg = this.l10n.get('find_not_found', null, 'Phrase not found'); notFound = true; break; - case FindStates.FIND_WRAPPED: + case _pdf_find_controller.FindState.WRAPPED: if (previous) { - findMsg = 'Reached top of document, continued from bottom'; + findMsg = this.l10n.get('find_reached_top', null, 'Reached top of document, continued from bottom'); } else { - findMsg = 'Reached end of document, continued from top'; + findMsg = this.l10n.get('find_reached_bottom', null, 'Reached end of document, continued from top'); } + break; } - if (notFound) { - this.findField.classList.add('notFound'); - } else { - this.findField.classList.remove('notFound'); - } - + this.findField.classList.toggle('notFound', notFound); this.findField.setAttribute('data-status', status); - this.findMsg.textContent = findMsg; + Promise.resolve(findMsg).then(function (msg) { + _this2.findMsg.textContent = msg; - this.updateResultsCount(matchCount); - }, + _this2._adjustWidth(); + }); + this.updateResultsCount(matchesCount); + } + }, { + 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 === void 0 ? 0 : _ref$current, + _ref$total = _ref.total, + total = _ref$total === void 0 ? 0 : _ref$total; - updateResultsCount: function(matchCount) { if (!this.findResultsCount) { - return; // no UI control is provided - } - - // If there are no matches, hide the counter - if (!matchCount) { - this.findResultsCount.classList.add('hidden'); return; } - // Create the match counter - this.findResultsCount.textContent = matchCount.toLocaleString(); + var matchesCountMsg = '', + limit = MATCHES_COUNT_LIMIT; - // Show the counter - this.findResultsCount.classList.remove('hidden'); - }, + if (total > 0) { + if (total > limit) { + 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', { + current: current, + total: total + }, '{{current}} of {{total}} match' + (total !== 1 ? 'es' : '')); + } + } - open: function PDFFindBar_open() { + Promise.resolve(matchesCountMsg).then(function (msg) { + _this3.findResultsCount.textContent = msg; + + _this3.findResultsCount.classList.toggle('hidden', !total); + + _this3._adjustWidth(); + }); + } + }, { + key: "open", + value: function open() { if (!this.opened) { this.opened = true; this.toggleButton.classList.add('toggled'); this.bar.classList.remove('hidden'); } + this.findField.select(); this.findField.focus(); - }, - close: function PDFFindBar_close() { + this._adjustWidth(); + } + }, { + key: "close", + value: function close() { if (!this.opened) { return; } + this.opened = false; this.toggleButton.classList.remove('toggled'); this.bar.classList.add('hidden'); - this.findController.active = false; - }, - - toggle: function PDFFindBar_toggle() { + this.eventBus.dispatch('findbarclose', { + source: this + }); + } + }, { + key: "toggle", + value: function toggle() { if (this.opened) { this.close(); } else { this.open(); } } - }; - return PDFFindBar; -})(); + }, { + key: "_adjustWidth", + value: function _adjustWidth() { + if (!this.opened) { + return; + } + this.bar.classList.remove('wrapContainers'); + var findbarHeight = this.bar.clientHeight; + var inputContainerHeight = this.bar.firstElementChild.clientHeight; -var FindStates = { - FIND_FOUND: 0, - FIND_NOTFOUND: 1, - FIND_WRAPPED: 2, - FIND_PENDING: 3 -}; - -var FIND_SCROLL_OFFSET_TOP = -50; -var FIND_SCROLL_OFFSET_LEFT = -400; - -/** - * Provides "search" or "find" functionality for the PDF. - * This object actually performs the search for a given string. - */ -var PDFFindController = (function PDFFindControllerClosure() { - function PDFFindController(options) { - this.startedTextExtraction = false; - this.extractTextPromises = []; - this.pendingFindMatches = {}; - this.active = false; // If active, find results will be highlighted. - this.pageContents = []; // Stores the text for each page. - this.pageMatches = []; - this.matchCount = 0; - this.selected = { // Currently selected match. - pageIdx: -1, - matchIdx: -1 - }; - this.offset = { // Where the find algorithm currently is in the document. - pageIdx: null, - matchIdx: null - }; - this.pagesToSearch = null; - this.resumePageIdx = null; - this.state = null; - this.dirtyMatch = false; - this.findTimeout = null; - this.pdfViewer = options.pdfViewer || null; - this.integratedFind = options.integratedFind || false; - this.charactersToNormalize = { - '\u2018': '\'', // Left single quotation mark - '\u2019': '\'', // Right single quotation mark - '\u201A': '\'', // Single low-9 quotation mark - '\u201B': '\'', // Single high-reversed-9 quotation mark - '\u201C': '"', // Left double quotation mark - '\u201D': '"', // Right double quotation mark - '\u201E': '"', // Double low-9 quotation mark - '\u201F': '"', // Double high-reversed-9 quotation mark - '\u00BC': '1/4', // Vulgar fraction one quarter - '\u00BD': '1/2', // Vulgar fraction one half - '\u00BE': '3/4', // Vulgar fraction three quarters - }; - this.findBar = options.findBar || null; - - // Compile the regular expression for text normalization once - var replace = Object.keys(this.charactersToNormalize).join(''); - this.normalizationRegex = new RegExp('[' + replace + ']', 'g'); - - var events = [ - 'find', - 'findagain', - 'findhighlightallchange', - 'findcasesensitivitychange' - ]; - - this.firstPagePromise = new Promise(function (resolve) { - this.resolveFirstPage = resolve; - }.bind(this)); - this.handleEvent = this.handleEvent.bind(this); - - for (var i = 0, len = events.length; i < len; i++) { - window.addEventListener(events[i], this.handleEvent); + if (findbarHeight > inputContainerHeight) { + this.bar.classList.add('wrapContainers'); + } } + }]); + + return PDFFindBar; +}(); + +exports.PDFFindBar = PDFFindBar; + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFFindController = exports.FindState = void 0; + +var _ui_utils = __webpack_require__(6); + +var _pdfjsLib = __webpack_require__(7); + +var _pdf_find_utils = __webpack_require__(20); + +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' +}; +var normalizationRegex = null; + +function normalize(text) { + if (!normalizationRegex) { + var replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(''); + normalizationRegex = new RegExp("[".concat(replace, "]"), 'g'); } - PDFFindController.prototype = { - setFindBar: function PDFFindController_setFindBar(findBar) { - this.findBar = findBar; - }, + return text.replace(normalizationRegex, function (ch) { + return CHARACTERS_TO_NORMALIZE[ch]; + }); +} - reset: function PDFFindController_reset() { - this.startedTextExtraction = false; - this.extractTextPromises = []; - this.active = false; - }, +var PDFFindController = +/*#__PURE__*/ +function () { + function PDFFindController(_ref) { + var linkService = _ref.linkService, + _ref$eventBus = _ref.eventBus, + eventBus = _ref$eventBus === void 0 ? (0, _ui_utils.getGlobalEventBus)() : _ref$eventBus; - normalize: function PDFFindController_normalize(text) { - var self = this; - return text.replace(this.normalizationRegex, function (ch) { - return self.charactersToNormalize[ch]; + _classCallCheck(this, PDFFindController); + + this._linkService = linkService; + this._eventBus = eventBus; + + this._reset(); + + eventBus.on('findbarclose', this._onFindBarClose.bind(this)); + } + + _createClass(PDFFindController, [{ + key: "setDocument", + value: function setDocument(pdfDocument) { + if (this._pdfDocument) { + this._reset(); + } + + if (!pdfDocument) { + return; + } + + this._pdfDocument = pdfDocument; + + this._firstPageCapability.resolve(); + } + }, { + key: "executeCommand", + value: function executeCommand(cmd, state) { + var _this = this; + + if (!state) { + return; + } + + var pdfDocument = this._pdfDocument; + + if (this._state === null || this._shouldDirtyMatch(cmd, state)) { + this._dirtyMatch = true; + } + + this._state = state; + + 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') { + _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: "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; - calcFindMatch: function PDFFindController_calcFindMatch(pageIndex) { - var pageContent = this.normalize(this.pageContents[pageIndex]); - var query = this.normalize(this.state.query); - var caseSensitive = this.state.caseSensitive; + 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 = []; + this._state = null; + this._selected = { + pageIdx: -1, + matchIdx: -1 + }; + this._offset = { + pageIdx: null, + matchIdx: null, + wrapped: false + }; + this._extractTextPromises = []; + this._pageContents = []; + this._matchesCountTotal = 0; + this._pagesToSearch = null; + this._pendingFindMatches = Object.create(null); + this._resumePageIdx = null; + this._dirtyMatch = false; + clearTimeout(this._findTimeout); + this._findTimeout = null; + this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)(); + } + }, { + 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 && linkService.page !== pageNumber && linkService.isPageVisible && !linkService.isPageVisible(pageNumber)) { + break; + } + + return false; + + case 'findhighlightallchange': + return false; + } + + return true; + } + }, { + key: "_prepareMatches", + value: function _prepareMatches(matchesWithLength, matches, matchesLength) { + function isSubTerm(matchesWithLength, 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)) { + continue; + } + + matches.push(matchesWithLength[i].match); + matchesLength.push(matchesWithLength[i].matchLength); + } + } + }, { + 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", + value: function _calculatePhraseMatch(query, pageIndex, pageContent, entireWord) { + var matches = []; var queryLen = query.length; + var matchIdx = -queryLen; - if (queryLen === 0) { - // Do nothing: the matches should be wiped out already. + 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", + 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, + skipped: false + }); + } + } + + this._pageMatchesLength[pageIndex] = []; + this._pageMatches[pageIndex] = []; + + this._prepareMatches(matchesWithLength, this._pageMatches[pageIndex], this._pageMatchesLength[pageIndex]); + } + }, { + key: "_calculateMatch", + value: function _calculateMatch(pageIndex) { + 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; } @@ -1191,551 +6935,1340 @@ var PDFFindController = (function PDFFindControllerClosure() { query = query.toLowerCase(); } - var matches = []; - var matchIdx = -queryLen; - while (true) { - matchIdx = pageContent.indexOf(query, matchIdx + queryLen); - if (matchIdx === -1) { - break; - } - matches.push(matchIdx); - } - this.pageMatches[pageIndex] = matches; - this.updatePage(pageIndex); - if (this.resumePageIdx === pageIndex) { - this.resumePageIdx = null; - this.nextPageMatch(); + if (phraseSearch) { + this._calculatePhraseMatch(query, pageIndex, pageContent, entireWord); + } else { + this._calculateWordMatch(query, pageIndex, pageContent, entireWord); } - // Update the matches count - if (matches.length > 0) { - this.matchCount += matches.length; - this.updateUIResultsCount(); + if (this._state.highlightAll) { + this._updatePage(pageIndex); } - }, - extractText: function PDFFindController_extractText() { - if (this.startedTextExtraction) { + 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", + value: function _extractText() { + var _this2 = this; + + if (this._extractTextPromises.length > 0) { return; } - this.startedTextExtraction = true; - this.pageContents = []; - var extractTextPromisesResolves = []; - var numPages = this.pdfViewer.pagesCount; - for (var i = 0; i < numPages; i++) { - this.extractTextPromises.push(new Promise(function (resolve) { - extractTextPromisesResolves.push(resolve); - })); - } + var promise = Promise.resolve(); - var self = this; - function extractPageText(pageIndex) { - self.pdfViewer.getPageTextContent(pageIndex).then( - function textContentResolved(textContent) { + var _loop = function _loop(i, ii) { + var extractTextCapability = (0, _pdfjsLib.createPromiseCapability)(); + _this2._extractTextPromises[i] = extractTextCapability.promise; + promise = promise.then(function () { + return _this2._pdfDocument.getPage(i + 1).then(function (pdfPage) { + return pdfPage.getTextContent({ + normalizeWhitespace: true + }); + }).then(function (textContent) { var textItems = textContent.items; - var str = []; + var strBuf = []; - for (var i = 0, len = textItems.length; i < len; i++) { - str.push(textItems[i].str); + for (var j = 0, jj = textItems.length; j < jj; j++) { + strBuf.push(textItems[j].str); } - // Store the pageContent as a string. - self.pageContents.push(str.join('')); + _this2._pageContents[i] = normalize(strBuf.join('')); + extractTextCapability.resolve(i); + }, function (reason) { + console.error("Unable to get text content for page ".concat(i + 1), reason); + _this2._pageContents[i] = ''; + extractTextCapability.resolve(i); + }); + }); + }; - extractTextPromisesResolves[pageIndex](pageIndex); - if ((pageIndex + 1) < self.pdfViewer.pagesCount) { - extractPageText(pageIndex + 1); - } - } - ); + for (var i = 0, ii = this._linkService.pagesCount; i < ii; i++) { + _loop(i, ii); } - extractPageText(0); - }, - - handleEvent: function PDFFindController_handleEvent(e) { - if (this.state === null || e.type !== 'findagain') { - this.dirtyMatch = true; - } - this.state = e.detail; - this.updateUIState(FindStates.FIND_PENDING); - - this.firstPagePromise.then(function() { - this.extractText(); - - clearTimeout(this.findTimeout); - if (e.type === 'find') { - // Only trigger the find action after 250ms of silence. - this.findTimeout = setTimeout(this.nextMatch.bind(this), 250); - } else { - this.nextMatch(); - } - }.bind(this)); - }, - - updatePage: function PDFFindController_updatePage(index) { - if (this.selected.pageIdx === index) { - // If the page is selected, scroll the page into view, which triggers - // rendering the page, which adds the textLayer. Once the textLayer is - // build, it will scroll onto the selected match. - this.pdfViewer.scrollPageIntoView(index + 1); + } + }, { + key: "_updatePage", + value: function _updatePage(index) { + if (this._scrollMatches && this._selected.pageIdx === index) { + this._linkService.page = index + 1; } - var page = this.pdfViewer.getPageView(index); - if (page.textLayer) { - page.textLayer.updateMatches(); - } - }, + this._eventBus.dispatch('updatetextlayermatches', { + source: this, + pageIndex: index + }); + } + }, { + key: "_updateAllPages", + value: function _updateAllPages() { + this._eventBus.dispatch('updatetextlayermatches', { + source: this, + pageIndex: -1 + }); + } + }, { + key: "_nextMatch", + value: function _nextMatch() { + var _this3 = this; - nextMatch: function PDFFindController_nextMatch() { - var previous = this.state.findPrevious; - var currentPageIndex = this.pdfViewer.currentPageNumber - 1; - var numPages = this.pdfViewer.pagesCount; + var previous = this._state.findPrevious; + var currentPageIndex = this._linkService.page - 1; + var numPages = this._linkService.pagesCount; + this._highlightMatches = true; - this.active = 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.length = 0; + this._matchesCountTotal = 0; - if (this.dirtyMatch) { - // Need to recalculate the matches, reset everything. - this.dirtyMatch = false; - this.selected.pageIdx = this.selected.matchIdx = -1; - this.offset.pageIdx = currentPageIndex; - this.offset.matchIdx = null; - this.hadMatch = false; - this.resumePageIdx = null; - this.pageMatches = []; - this.matchCount = 0; - var self = this; + this._updateAllPages(); for (var i = 0; i < numPages; i++) { - // Wipe out any previous highlighted matches. - this.updatePage(i); - - // As soon as the text is extracted start finding the matches. - if (!(i in this.pendingFindMatches)) { - this.pendingFindMatches[i] = true; - this.extractTextPromises[i].then(function(pageIdx) { - delete self.pendingFindMatches[pageIdx]; - self.calcFindMatch(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 there's no query there's no point in searching. - if (this.state.query === '') { - this.updateUIState(FindStates.FIND_FOUND); + if (this._query === '') { + this._updateUIState(FindState.FOUND); + return; } - // If we're waiting on a page, we return since we can't do anything else. - if (this.resumePageIdx) { + if (this._resumePageIdx) { return; } - var offset = this.offset; - // Keep track of how many pages we should maximally iterate through. - this.pagesToSearch = numPages; - // If there's already a matchIdx that means we are iterating through a - // page's matches. + 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)) { - // The simple case; we just have advance the matchIdx to select - // the next match on the page. - this.hadMatch = true; - offset.matchIdx = (previous ? offset.matchIdx - 1 : - offset.matchIdx + 1); - this.updateMatch(true); + 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; } - // We went beyond the current page's matches, so we advance to - // the next page. - this.advanceOffsetPage(previous); - } - // Start searching through the page. - this.nextPageMatch(); - }, - matchesReady: function PDFFindController_matchesReady(matches) { - var offset = this.offset; + this._advanceOffsetPage(previous); + } + + this._nextPageMatch(); + } + }, { + key: "_matchesReady", + value: function _matchesReady(matches) { + var offset = this._offset; var numMatches = matches.length; - var previous = this.state.findPrevious; + var previous = this._state.findPrevious; if (numMatches) { - // There were matches for the page, so initialize the matchIdx. - this.hadMatch = true; - offset.matchIdx = (previous ? numMatches - 1 : 0); - this.updateMatch(true); + offset.matchIdx = previous ? numMatches - 1 : 0; + + this._updateMatch(true); + return true; - } else { - // No matches, so attempt to search the next page. - this.advanceOffsetPage(previous); - if (offset.wrapped) { - offset.matchIdx = null; - if (this.pagesToSearch < 0) { - // No point in wrapping again, there were no matches. - this.updateMatch(false); - // while matches were not found, searching for a page - // with matches should nevertheless halt. - return true; - } + } + + this._advanceOffsetPage(previous); + + if (offset.wrapped) { + offset.matchIdx = null; + + if (this._pagesToSearch < 0) { + this._updateMatch(false); + + return true; } - // Matches were not found (and searching is not done). - return false; } - }, - /** - * The method is called back from the text layer when match presentation - * is updated. - * @param {number} pageIndex - page index. - * @param {number} index - match index. - * @param {Array} elements - text layer div elements array. - * @param {number} beginIdx - start index of the div array for the match. - * @param {number} endIdx - end index of the div array for the match. - */ - updateMatchPosition: function PDFFindController_updateMatchPosition( - pageIndex, index, elements, beginIdx, endIdx) { - if (this.selected.matchIdx === index && - this.selected.pageIdx === pageIndex) { - var spot = { - top: FIND_SCROLL_OFFSET_TOP, - left: FIND_SCROLL_OFFSET_LEFT - }; - scrollIntoView(elements[beginIdx], spot, - /* skipOverflowHiddenElements = */ true); - } - }, - - nextPageMatch: function PDFFindController_nextPageMatch() { - if (this.resumePageIdx !== null) { + return false; + } + }, { + key: "_nextPageMatch", + value: function _nextPageMatch() { + if (this._resumePageIdx !== null) { console.error('There can only be one pending page.'); } + + var matches = null; + do { - var pageIdx = this.offset.pageIdx; - var matches = this.pageMatches[pageIdx]; + var pageIdx = this._offset.pageIdx; + matches = this._pageMatches[pageIdx]; + if (!matches) { - // The matches don't exist yet for processing by "matchesReady", - // so set a resume point for when they do exist. - this.resumePageIdx = pageIdx; + this._resumePageIdx = pageIdx; break; } - } while (!this.matchesReady(matches)); - }, - - advanceOffsetPage: function PDFFindController_advanceOffsetPage(previous) { - var offset = this.offset; - var numPages = this.extractTextPromises.length; - offset.pageIdx = (previous ? offset.pageIdx - 1 : offset.pageIdx + 1); + } while (!this._matchesReady(matches)); + } + }, { + 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--; + this._pagesToSearch--; if (offset.pageIdx >= numPages || offset.pageIdx < 0) { - offset.pageIdx = (previous ? numPages - 1 : 0); + offset.pageIdx = previous ? numPages - 1 : 0; offset.wrapped = true; } - }, - - updateMatch: function PDFFindController_updateMatch(found) { - var state = FindStates.FIND_NOTFOUND; - var wrapped = this.offset.wrapped; - this.offset.wrapped = false; + } + }, { + 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 ? FindStates.FIND_WRAPPED : FindStates.FIND_FOUND); - // Update the currently selected page to wipe out any selected matches. - if (previousPage !== -1 && previousPage !== this.selected.pageIdx) { - this.updatePage(previousPage); + 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.updatePage(this.selected.pageIdx); - } - }, + this._updateUIState(state, this._state.findPrevious); - updateUIResultsCount: - function PDFFindController_updateUIResultsCount() { - if (this.findBar === null) { - throw new Error('PDFFindController is not initialized with a ' + - 'PDFFindBar instance.'); - } - this.findBar.updateResultsCount(this.matchCount); - }, + if (this._selected.pageIdx !== -1) { + this._scrollMatches = true; - updateUIState: function PDFFindController_updateUIState(state, previous) { - if (this.integratedFind) { - FirefoxCom.request('updateFindControlState', - { result: state, findPrevious: previous }); + this._updatePage(this._selected.pageIdx); + } + } + }, { + 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; + } + + if (_this4._resumePageIdx) { + _this4._resumePageIdx = null; + _this4._dirtyMatch = true; + } + + _this4._updateUIState(FindState.FOUND); + + _this4._highlightMatches = false; + + _this4._updateAllPages(); + }); + } + }, { + key: "_requestMatchesCount", + value: function _requestMatchesCount() { + 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", + value: function _updateUIResultsCount() { + this._eventBus.dispatch('updatefindmatchescount', { + source: this, + matchesCount: this._requestMatchesCount() + }); + } + }, { + key: "_updateUIState", + value: function _updateUIState(state, previous) { + this._eventBus.dispatch('updatefindcontrolstate', { + source: this, + state: state, + previous: previous, + matchesCount: this._requestMatchesCount() + }); + } + }, { + key: "highlightMatches", + get: function get() { + return this._highlightMatches; + } + }, { + key: "pageMatches", + get: function get() { + return this._pageMatches; + } + }, { + key: "pageMatchesLength", + get: function get() { + return this._pageMatchesLength; + } + }, { + key: "selected", + get: function get() { + return this._selected; + } + }, { + 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.PDFFindController = PDFFindController; + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getCharacterType = getCharacterType; +exports.CharacterType = void 0; +var CharacterType = { + SPACE: 0, + ALPHA_LETTER: 1, + PUNCT: 2, + HAN_LETTER: 3, + KATAKANA_LETTER: 4, + HIRAGANA_LETTER: 5, + HALFWIDTH_KATAKANA_LETTER: 6, + THAI_LETTER: 7 +}; +exports.CharacterType = CharacterType; + +function isAlphabeticalScript(charCode) { + return charCode < 0x2E80; +} + +function isAscii(charCode) { + return (charCode & 0xFF80) === 0; +} + +function isAsciiAlpha(charCode) { + 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; +} + +function isHan(charCode) { + return charCode >= 0x3400 && charCode <= 0x9FFF || charCode >= 0xF900 && charCode <= 0xFAFF; +} + +function isKatakana(charCode) { + return charCode >= 0x30A0 && charCode <= 0x30FF; +} + +function isHiragana(charCode) { + return charCode >= 0x3040 && charCode <= 0x309F; +} + +function isHalfwidthKatakana(charCode) { + return charCode >= 0xFF60 && charCode <= 0xFF9F; +} + +function isThai(charCode) { + 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) { + return CharacterType.ALPHA_LETTER; + } + + return CharacterType.PUNCT; + } else if (isThai(charCode)) { + return CharacterType.THAI_LETTER; + } else if (charCode === 0xA0) { + return CharacterType.SPACE; + } + + return CharacterType.ALPHA_LETTER; + } + + if (isHan(charCode)) { + return CharacterType.HAN_LETTER; + } else if (isKatakana(charCode)) { + return CharacterType.KATAKANA_LETTER; + } else if (isHiragana(charCode)) { + return CharacterType.HIRAGANA_LETTER; + } else if (isHalfwidthKatakana(charCode)) { + return CharacterType.HALFWIDTH_KATAKANA_LETTER; + } + + return CharacterType.ALPHA_LETTER; +} + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isDestHashesEqual = isDestHashesEqual; +exports.isDestArraysEqual = isDestArraysEqual; +exports.PDFHistory = void 0; + +var _ui_utils = __webpack_require__(6); + +function _typeof(obj) { 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) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(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"] != 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 = +/*#__PURE__*/ +function () { + function PDFHistory(_ref) { + var _this = this; + + var linkService = _ref.linkService, + eventBus = _ref.eventBus; + + _classCallCheck(this, PDFHistory); + + this.linkService = linkService; + this.eventBus = eventBus || (0, _ui_utils.getGlobalEventBus)(); + this.initialized = false; + this.initialBookmark = null; + this.initialRotation = null; + this._boundEvents = Object.create(null); + this._isViewerInPresentationMode = false; + this._isPagesLoaded = false; + this.eventBus.on('presentationmodechanged', function (evt) { + _this._isViewerInPresentationMode = evt.active || evt.switchInProgress; + }); + this.eventBus.on('pagesloaded', function (evt) { + _this._isPagesLoaded = !!evt.pagesCount; + }); + } + + _createClass(PDFHistory, [{ + 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; } - if (this.findBar === null) { - throw new Error('PDFFindController is not initialized with a ' + - 'PDFFindBar instance.'); + + var reInitialized = this.initialized && this.fingerprint !== fingerprint; + this.fingerprint = fingerprint; + this._updateUrl = updateUrl === true; + + if (!this.initialized) { + 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(); + this._numPositionUpdates = 0; + this._uid = this._maxUid = 0; + this._destination = null; + this._position = null; + + if (!this._isValidState(state, true) || resetHistory) { + var _parseCurrentHash = parseCurrentHash(this.linkService), + hash = _parseCurrentHash.hash, + page = _parseCurrentHash.page, + rotation = _parseCurrentHash.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; + } + + if (destination.dest) { + this.initialBookmark = JSON.stringify(destination.dest); + this._destination.page = null; + } else if (destination.hash) { + this.initialBookmark = destination.hash; + } else if (destination.page) { + this.initialBookmark = "page=".concat(destination.page); } - this.findBar.updateUIState(state, previous, this.matchCount); } - }; - return PDFFindController; -})(); + }, { + key: "push", + value: function push(_ref3) { + var _this2 = this; + + var _ref3$namedDest = _ref3.namedDest, + namedDest = _ref3$namedDest === void 0 ? null : _ref3$namedDest, + explicitDest = _ref3.explicitDest, + pageNumber = _ref3.pageNumber; + + if (!this.initialized) { + return; + } + + 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 () { + _this2._popStateInProgress = false; + }); + } + } + }, { + key: "pushCurrentPosition", + value: function pushCurrentPosition() { + if (!this.initialized || this._popStateInProgress) { + return; + } + + this._tryPushCurrentPosition(); + } + }, { + key: "back", + value: function back() { + if (!this.initialized || this._popStateInProgress) { + return; + } + + var state = window.history.state; + + if (this._isValidState(state) && state.uid > 0) { + window.history.back(); + } + } + }, { + key: "forward", + value: function forward() { + if (!this.initialized || this._popStateInProgress) { + return; + } + + var state = window.history.state; + + if (this._isValidState(state) && state.uid < this._maxUid) { + window.history.forward(); + } + } + }, { + 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, + 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) { + if (newUrl) { + window.history.replaceState(newState, '', newUrl); + } else { + window.history.replaceState(newState, ''); + } + } else { + this._maxUid = this._uid; + + if (newUrl) { + window.history.pushState(newState, '', newUrl); + } else { + window.history.pushState(newState, ''); + } + } + } + }, { + 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.dest || !this._destination.first) { + return; + } + + forceReplace = true; + } + + this._pushOrReplaceState(position, forceReplace); + } + }, { + 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) { + 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') { + return false; + } + + return true; + } + }, { + key: "_updateInternalState", + value: function _updateInternalState(destination, uid) { + var removeTemporary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + if (this._updateViewareaTimeout) { + 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(_ref4) { + var _this3 = this; + + var location = _ref4.location; + + if (this._updateViewareaTimeout) { + clearTimeout(this._updateViewareaTimeout); + this._updateViewareaTimeout = null; + } + + this._position = { + 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(_ref5) { + var _this4 = this; + + var state = _ref5.state; + var newHash = getCurrentHash(), + hashChanged = this._currentHash !== newHash; + this._currentHash = newHash; + + if (!state || false) { + this._uid++; + + var _parseCurrentHash2 = parseCurrentHash(this.linkService), + hash = _parseCurrentHash2.hash, + page = _parseCurrentHash2.page, + rotation = _parseCurrentHash2.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', + 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) { + this.linkService.setHash(destination.hash); + } else if (destination.page) { + this.linkService.page = destination.page; + } + + Promise.resolve().then(function () { + _this4._popStateInProgress = false; + }); + } + }, { + key: "_bindEvents", + value: function _bindEvents() { + var _this5 = this; + + var _boundEvents = this._boundEvents, + eventBus = this.eventBus; + _boundEvents.updateViewarea = this._updateViewarea.bind(this); + _boundEvents.popState = this._popState.bind(this); + + _boundEvents.pageHide = function (evt) { + if (!_this5._destination || _this5._destination.temporary) { + _this5._tryPushCurrentPosition(); + } + }; + + eventBus.on('updateviewarea', _boundEvents.updateViewarea); + window.addEventListener('popstate', _boundEvents.popState); + window.addEventListener('pagehide', _boundEvents.pageHide); + } + }, { + key: "popStateInProgress", + get: function get() { + return this.initialized && (this._popStateInProgress || this._blockHashChange > 0); + } + }]); + + return PDFHistory; +}(); + +exports.PDFHistory = PDFHistory; + +function isDestHashesEqual(destHash, pushHash) { + if (typeof destHash !== 'string' || typeof pushHash !== 'string') { + return false; + } + + if (destHash === pushHash) { + return true; + } + + var _parseQueryString = (0, _ui_utils.parseQueryString)(destHash), + nameddest = _parseQueryString.nameddest; + + if (nameddest === pushHash) { + return true; + } + + return false; +} + +function isDestArraysEqual(firstDest, secondDest) { + function isEntryEqual(first, second) { + if (_typeof(first) !== _typeof(second)) { + return false; + } + + if (Array.isArray(first) || Array.isArray(second)) { + return false; + } + + 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; +} + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -/** - * Performs navigation functions inside PDF, such as opening specified page, - * or destination. - * @class - * @implements {IPDFLinkService} - */ -var PDFLinkService = (function () { - /** - * @constructs PDFLinkService - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.SimpleLinkService = exports.PDFLinkService = void 0; + +var _ui_utils = __webpack_require__(6); + +function _typeof(obj) { 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 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 === void 0 ? null : _ref$externalLinkTarg, + _ref$externalLinkRel = _ref.externalLinkRel, + externalLinkRel = _ref$externalLinkRel === void 0 ? null : _ref$externalLinkRel; + + _classCallCheck(this, PDFLinkService); + + this.eventBus = eventBus || (0, _ui_utils.getGlobalEventBus)(); + this.externalLinkTarget = externalLinkTarget; + this.externalLinkRel = externalLinkRel; this.baseUrl = null; this.pdfDocument = null; this.pdfViewer = null; this.pdfHistory = null; - this._pagesRefCache = null; } - PDFLinkService.prototype = { - setDocument: function PDFLinkService_setDocument(pdfDocument, baseUrl) { + _createClass(PDFLinkService, [{ + 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); - }, - - setViewer: function PDFLinkService_setViewer(pdfViewer) { + } + }, { + key: "setViewer", + value: function setViewer(pdfViewer) { this.pdfViewer = pdfViewer; - }, - - setHistory: function PDFLinkService_setHistory(pdfHistory) { + } + }, { + key: "setHistory", + value: function setHistory(pdfHistory) { this.pdfHistory = pdfHistory; - }, + } + }, { + key: "navigateTo", + value: function navigateTo(dest) { + var _this = this; - /** - * @returns {number} - */ - get pagesCount() { - return this.pdfDocument.numPages; - }, + var goToDestination = function goToDestination(_ref2) { + var namedDest = _ref2.namedDest, + explicitDest = _ref2.explicitDest; + var destRef = explicitDest[0], + pageNumber; - /** - * @returns {number} - */ - get page() { - return this.pdfViewer.currentPageNumber; - }, + if (destRef instanceof Object) { + pageNumber = _this._cachedPageNumber(destRef); - /** - * @param {number} value - */ - set page(value) { - this.pdfViewer.currentPageNumber = value; - }, + if (pageNumber === null) { + _this.pdfDocument.getPageIndex(destRef).then(function (pageIndex) { + _this.cachePageRef(pageIndex + 1, destRef); - /** - * @param dest - The PDF destination object. - */ - navigateTo: function PDFLinkService_navigateTo(dest) { - var destString = ''; - var self = this; - - var goToDestination = function(destRef) { - // dest array looks like that: - var pageNumber = destRef instanceof Object ? - self._pagesRefCache[destRef.num + ' ' + destRef.gen + ' R'] : - (destRef + 1); - if (pageNumber) { - if (pageNumber > self.pagesCount) { - pageNumber = self.pagesCount; - } - self.pdfViewer.scrollPageIntoView(pageNumber, dest); - - if (self.pdfHistory) { - // Update the browsing history. - self.pdfHistory.push({ - dest: dest, - hash: destString, - page: pageNumber + goToDestination({ + namedDest: namedDest, + explicitDest: explicitDest + }); + }).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 { - self.pdfDocument.getPageIndex(destRef).then(function (pageIndex) { - var pageNum = pageIndex + 1; - var cacheKey = destRef.num + ' ' + destRef.gen + ' R'; - self._pagesRefCache[cacheKey] = pageNum; - goToDestination(destRef); + 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: \"".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 + }); }; - var destinationPromise; - if (typeof dest === 'string') { - destString = dest; - destinationPromise = this.pdfDocument.getDestination(dest); - } else { - destinationPromise = Promise.resolve(dest); - } - destinationPromise.then(function(destination) { - dest = destination; - if (!(destination instanceof Array)) { - return; // invalid destination - } - goToDestination(destination[0]); - }); - }, + new Promise(function (resolve, reject) { + if (typeof dest === 'string') { + _this.pdfDocument.getDestination(dest).then(function (destArray) { + resolve({ + namedDest: dest, + explicitDest: destArray + }); + }); - /** - * @param dest - The PDF destination object. - * @returns {string} The hyperlink to the PDF object. - */ - getDestinationHash: function PDFLinkService_getDestinationHash(dest) { + return; + } + + resolve({ + namedDest: '', + explicitDest: dest + }); + }).then(function (data) { + if (!Array.isArray(data.explicitDest)) { + console.error("PDFLinkService.navigateTo: \"".concat(data.explicitDest, "\" is") + " not a valid destination array, for dest=\"".concat(dest, "\".")); + return; + } + + goToDestination(data); + }); + } + }, { + key: "getDestinationHash", + value: function getDestinationHash(dest) { if (typeof dest === 'string') { return this.getAnchorUrl('#' + escape(dest)); } - if (dest instanceof Array) { - var destRef = dest[0]; // see navigateTo method for dest format - var pageNumber = destRef instanceof Object ? - this._pagesRefCache[destRef.num + ' ' + destRef.gen + ' R'] : - (destRef + 1); - if (pageNumber) { - var pdfOpenParams = this.getAnchorUrl('#page=' + pageNumber); - var destKind = dest[1]; - if (typeof destKind === 'object' && 'name' in destKind && - destKind.name === 'XYZ') { - var scale = (dest[4] || this.pdfViewer.currentScaleValue); - var scaleNumber = parseFloat(scale); - if (scaleNumber) { - scale = scaleNumber * 100; - } - pdfOpenParams += '&zoom=' + scale; - if (dest[2] || dest[3]) { - pdfOpenParams += ',' + (dest[2] || 0) + ',' + (dest[3] || 0); - } - } - return pdfOpenParams; - } + + if (Array.isArray(dest)) { + var str = JSON.stringify(dest); + return this.getAnchorUrl('#' + escape(str)); } + return this.getAnchorUrl(''); - }, - - /** - * Prefix the full url on anchor links to make sure that links are resolved - * relative to the current URL instead of the one defined in . - * @param {String} anchor The anchor hash, including the #. - * @returns {string} The hyperlink to the PDF object. - */ - getAnchorUrl: function PDFLinkService_getAnchorUrl(anchor) { + } + }, { + key: "getAnchorUrl", + value: function getAnchorUrl(anchor) { return (this.baseUrl || '') + anchor; - }, + } + }, { + key: "setHash", + value: function setHash(hash) { + var pageNumber, dest; + + if (hash.includes('=')) { + var params = (0, _ui_utils.parseQueryString)(hash); + + if ('search' in params) { + this.eventBus.dispatch('findfromurlhash', { + source: this, + query: params['search'].replace(/"/g, ''), + phraseSearch: params['phrase'] === 'true' + }); + } - /** - * @param {string} hash - */ - setHash: function PDFLinkService_setHash(hash) { - if (hash.indexOf('=') >= 0) { - var params = parseQueryString(hash); - // borrowing syntax from "Parameters for Opening PDF Files" if ('nameddest' in params) { - if (this.pdfHistory) { - this.pdfHistory.updateNextHashParam(params.nameddest); - } this.navigateTo(params.nameddest); return; } - var pageNumber, dest; + if ('page' in params) { - pageNumber = (params.page | 0) || 1; + pageNumber = params.page | 0 || 1; } + if ('zoom' in params) { - // Build the destination array. - var zoomArgs = params.zoom.split(','); // scale,left,top + var zoomArgs = params.zoom.split(','); var zoomArg = zoomArgs[0]; var zoomArgNumber = parseFloat(zoomArg); - if (zoomArg.indexOf('Fit') === -1) { - // If the zoomArg is a number, it has to get divided by 100. If it's - // a string, it should stay as it is. - 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]; + 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\'.'); + 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 || this.page, dest); - } else if (pageNumber) { - this.page = pageNumber; // simple page - } - if ('pagemode' in params) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('pagemode', true, true, { - mode: params.pagemode, - }); - this.pdfViewer.container.dispatchEvent(event); - } - } else if (/^\d+$/.test(hash)) { // page number - this.page = hash; - } else { // named destination - if (this.pdfHistory) { - this.pdfHistory.updateNextHashParam(unescape(hash)); - } - this.navigateTo(unescape(hash)); - } - }, - /** - * @param {string} action - */ - executeNamedAction: function PDFLinkService_executeNamedAction(action) { - // See PDF reference, table 8.45 - Named action + if (dest) { + this.pdfViewer.scrollPageIntoView({ + pageNumber: pageNumber || this.page, + destArray: dest, + allowNegativeOffset: true + }); + } else if (pageNumber) { + this.page = pageNumber; + } + + if ('pagemode' in params) { + this.eventBus.dispatch('pagemode', { + source: this, + mode: params.pagemode + }); + } + } else { + dest = unescape(hash); + + try { + dest = JSON.parse(dest); + + if (!Array.isArray(dest)) { + dest = dest.toString(); + } + } catch (ex) {} + + if (typeof dest === 'string' || isValidExplicitDestination(dest)) { + this.navigateTo(dest); + return; + } + + console.error("PDFLinkService.setHash: \"".concat(unescape(hash), "\" is not ") + 'a valid destination.'); + } + } + }, { + key: "executeNamedAction", + value: function executeNamedAction(action) { switch (action) { case 'GoBack': if (this.pdfHistory) { this.pdfHistory.back(); } + break; case 'GoForward': if (this.pdfHistory) { this.pdfHistory.forward(); } + break; case 'NextPage': - this.page++; + if (this.page < this.pagesCount) { + this.page++; + } + break; case 'PrevPage': - this.page--; + if (this.page > 1) { + this.page--; + } + break; case 'LastPage': @@ -1747,626 +8280,527 @@ var PDFLinkService = (function () { break; default: - break; // No action according to spec + break; } - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('namedaction', true, true, { + this.eventBus.dispatch('namedaction', { + source: this, action: action }); - this.pdfViewer.container.dispatchEvent(event); - }, + } + }, { + key: "cachePageRef", + value: function cachePageRef(pageNum, pageRef) { + if (!pageRef) { + return; + } - /** - * @param {number} pageNum - page number. - * @param {Object} pageRef - reference to the page. - */ - cachePageRef: function PDFLinkService_cachePageRef(pageNum, pageRef) { var refStr = pageRef.num + ' ' + pageRef.gen + ' R'; this._pagesRefCache[refStr] = pageNum; } - }; + }, { + key: "_cachedPageNumber", + value: function _cachedPageNumber(pageRef) { + var refStr = pageRef.num + ' ' + pageRef.gen + ' R'; + return this._pagesRefCache && this._pagesRefCache[refStr] || null; + } + }, { + 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", + get: function get() { + return this.pdfViewer.currentPageNumber; + }, + set: function set(value) { + this.pdfViewer.currentPageNumber = value; + } + }, { + key: "rotation", + get: function get() { + return this.pdfViewer.pagesRotation; + }, + set: function set(value) { + this.pdfViewer.pagesRotation = value; + } + }]); return PDFLinkService; -})(); +}(); +exports.PDFLinkService = PDFLinkService; -var PDFHistory = (function () { - function PDFHistory(options) { - this.linkService = options.linkService; - - this.initialized = false; - this.initialDestination = null; - this.initialBookmark = null; +function isValidExplicitDestination(dest) { + if (!Array.isArray(dest)) { + return false; } - PDFHistory.prototype = { - /** - * @param {string} fingerprint - * @param {IPDFLinkService} linkService - */ - initialize: function pdfHistoryInitialize(fingerprint) { - this.initialized = true; - this.reInitialized = false; - this.allowHashChange = true; - this.historyUnlocked = true; - this.isViewerInPresentationMode = false; + var destLength = dest.length, + allowNull = true; - this.previousHash = window.location.hash.substring(1); - this.currentBookmark = ''; - this.currentPage = 0; - this.updatePreviousBookmark = false; - this.previousBookmark = ''; - this.previousPage = 0; - this.nextHashParam = ''; + if (destLength < 2) { + return false; + } - this.fingerprint = fingerprint; - this.currentUid = this.uid = 0; - this.current = {}; + var page = dest[0]; - var state = window.history.state; - if (this._isStateObjectDefined(state)) { - // This corresponds to navigating back to the document - // from another page in the browser history. - if (state.target.dest) { - this.initialDestination = state.target.dest; - } else { - this.initialBookmark = state.target.hash; - } - this.currentUid = state.uid; - this.uid = state.uid + 1; - this.current = state.target; - } else { - // This corresponds to the loading of a new document. - if (state && state.fingerprint && - this.fingerprint !== state.fingerprint) { - // Reinitialize the browsing history when a new document - // is opened in the web viewer. - this.reInitialized = true; - } - this._pushOrReplaceState({fingerprint: this.fingerprint}, true); + 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) === 'object' && typeof zoom.name === 'string')) { + return false; + } + + switch (zoom.name) { + case 'XYZ': + if (destLength !== 5) { + return false; } - var self = this; - window.addEventListener('popstate', function pdfHistoryPopstate(evt) { - if (!self.historyUnlocked) { - return; - } - if (evt.state) { - // Move back/forward in the history. - self._goTo(evt.state); - return; - } + break; - // If the state is not set, then the user tried to navigate to a - // different hash by manually editing the URL and pressing Enter, or by - // clicking on an in-page link (e.g. the "current view" link). - // Save the current view state to the browser history. + case 'Fit': + case 'FitB': + return destLength === 2; - // Note: In Firefox, history.null could also be null after an in-page - // navigation to the same URL, and without dispatching the popstate - // event: https://bugzilla.mozilla.org/show_bug.cgi?id=1183881 - - if (self.uid === 0) { - // Replace the previous state if it was not explicitly set. - var previousParams = (self.previousHash && self.currentBookmark && - self.previousHash !== self.currentBookmark) ? - {hash: self.currentBookmark, page: self.currentPage} : - {page: 1}; - replacePreviousHistoryState(previousParams, function() { - updateHistoryWithCurrentHash(); - }); - } else { - updateHistoryWithCurrentHash(); - } - }, false); - - - function updateHistoryWithCurrentHash() { - self.previousHash = window.location.hash.slice(1); - self._pushToHistory({hash: self.previousHash}, false, true); - self._updatePreviousBookmark(); + case 'FitH': + case 'FitBH': + case 'FitV': + case 'FitBV': + if (destLength !== 3) { + return false; } - function replacePreviousHistoryState(params, callback) { - // To modify the previous history entry, the following happens: - // 1. history.back() - // 2. _pushToHistory, which calls history.replaceState( ... ) - // 3. history.forward() - // Because a navigation via the history API does not immediately update - // the history state, the popstate event is used for synchronization. - self.historyUnlocked = false; + break; - // Suppress the hashchange event to avoid side effects caused by - // navigating back and forward. - self.allowHashChange = false; - window.addEventListener('popstate', rewriteHistoryAfterBack); - history.back(); - - function rewriteHistoryAfterBack() { - window.removeEventListener('popstate', rewriteHistoryAfterBack); - window.addEventListener('popstate', rewriteHistoryAfterForward); - self._pushToHistory(params, false, true); - history.forward(); - } - function rewriteHistoryAfterForward() { - window.removeEventListener('popstate', rewriteHistoryAfterForward); - self.allowHashChange = true; - self.historyUnlocked = true; - callback(); - } + case 'FitR': + if (destLength !== 6) { + return false; } - function pdfHistoryBeforeUnload() { - var previousParams = self._getPreviousParams(null, true); - if (previousParams) { - var replacePrevious = (!self.current.dest && - self.current.hash !== self.previousHash); - self._pushToHistory(previousParams, false, replacePrevious); - self._updatePreviousBookmark(); - } - // Remove the event listener when navigating away from the document, - // since 'beforeunload' prevents Firefox from caching the document. - window.removeEventListener('beforeunload', pdfHistoryBeforeUnload, - false); - } + allowNull = false; + break; - window.addEventListener('beforeunload', pdfHistoryBeforeUnload, false); + default: + return false; + } - window.addEventListener('pageshow', function pdfHistoryPageShow(evt) { - // If the entire viewer (including the PDF file) is cached in - // the browser, we need to reattach the 'beforeunload' event listener - // since the 'DOMContentLoaded' event is not fired on 'pageshow'. - window.addEventListener('beforeunload', pdfHistoryBeforeUnload, false); - }, false); + for (var i = 2; i < destLength; i++) { + var param = dest[i]; - window.addEventListener('presentationmodechanged', function(e) { - self.isViewerInPresentationMode = !!e.detail.active; + if (!(typeof param === 'number' || allowNull && param === null)) { + return false; + } + } + + return true; +} + +var SimpleLinkService = +/*#__PURE__*/ +function () { + function SimpleLinkService() { + _classCallCheck(this, SimpleLinkService); + + this.externalLinkTarget = null; + this.externalLinkRel = null; + } + + _createClass(SimpleLinkService, [{ + key: "navigateTo", + value: function navigateTo(dest) {} + }, { + key: "getDestinationHash", + value: function getDestinationHash(dest) { + return '#'; + } + }, { + key: "getAnchorUrl", + value: function getAnchorUrl(hash) { + return '#'; + } + }, { + key: "setHash", + value: function setHash(hash) {} + }, { + key: "executeNamedAction", + value: function executeNamedAction(action) {} + }, { + key: "cachePageRef", + value: function cachePageRef(pageNum, pageRef) {} + }, { + key: "isPageVisible", + value: function isPageVisible(pageNumber) { + return true; + } + }, { + key: "pagesCount", + get: function get() { + return 0; + } + }, { + key: "page", + get: function get() { + return 0; + }, + set: function set(value) {} + }, { + key: "rotation", + get: function get() { + return 0; + }, + set: function set(value) {} + }]); + + return SimpleLinkService; +}(); + +exports.SimpleLinkService = SimpleLinkService; + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFOutlineViewer = void 0; + +var _pdfjsLib = __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 DEFAULT_TITLE = "\u2013"; + +var PDFOutlineViewer = +/*#__PURE__*/ +function () { + function PDFOutlineViewer(_ref) { + var container = _ref.container, + linkService = _ref.linkService, + eventBus = _ref.eventBus; + + _classCallCheck(this, PDFOutlineViewer); + + this.container = container; + this.linkService = linkService; + this.eventBus = eventBus; + this.reset(); + eventBus.on('toggleoutlinetree', this.toggleOutlineTree.bind(this)); + } + + _createClass(PDFOutlineViewer, [{ + key: "reset", + value: function reset() { + this.outline = null; + this.lastToggleIsShow = true; + this.container.textContent = ''; + this.container.classList.remove('outlineWithDeepNesting'); + } + }, { + key: "_dispatchEvent", + value: function _dispatchEvent(outlineCount) { + this.eventBus.dispatch('outlineloaded', { + source: this, + outlineCount: outlineCount }); - }, + } + }, { + key: "_bindLink", + value: function _bindLink(element, _ref2) { + var url = _ref2.url, + newWindow = _ref2.newWindow, + dest = _ref2.dest; + var linkService = this.linkService; - clearHistoryState: function pdfHistory_clearHistoryState() { - this._pushOrReplaceState(null, true); - }, - - _isStateObjectDefined: function pdfHistory_isStateObjectDefined(state) { - return (state && state.uid >= 0 && - state.fingerprint && this.fingerprint === state.fingerprint && - state.target && state.target.hash) ? true : false; - }, - - _pushOrReplaceState: function pdfHistory_pushOrReplaceState(stateObj, - replace) { - if (replace) { - window.history.replaceState(stateObj, '', document.URL); - } else { - window.history.pushState(stateObj, '', document.URL); - } - }, - - get isHashChangeUnlocked() { - if (!this.initialized) { - return true; - } - return this.allowHashChange; - }, - - _updatePreviousBookmark: function pdfHistory_updatePreviousBookmark() { - if (this.updatePreviousBookmark && - this.currentBookmark && this.currentPage) { - this.previousBookmark = this.currentBookmark; - this.previousPage = this.currentPage; - this.updatePreviousBookmark = false; - } - }, - - updateCurrentBookmark: function pdfHistoryUpdateCurrentBookmark(bookmark, - pageNum) { - if (this.initialized) { - this.currentBookmark = bookmark.substring(1); - this.currentPage = pageNum | 0; - this._updatePreviousBookmark(); - } - }, - - updateNextHashParam: function pdfHistoryUpdateNextHashParam(param) { - if (this.initialized) { - this.nextHashParam = param; - } - }, - - push: function pdfHistoryPush(params, isInitialBookmark) { - if (!(this.initialized && this.historyUnlocked)) { + if (url) { + (0, _pdfjsLib.addLinkAttributes)(element, { + url: url, + target: newWindow ? _pdfjsLib.LinkTarget.BLANK : linkService.externalLinkTarget, + rel: linkService.externalLinkRel + }); return; } - if (params.dest && !params.hash) { - params.hash = (this.current.hash && this.current.dest && - this.current.dest === params.dest) ? - this.current.hash : - this.linkService.getDestinationHash(params.dest).split('#')[1]; - } - if (params.page) { - params.page |= 0; - } - if (isInitialBookmark) { - var target = window.history.state.target; - if (!target) { - // Invoked when the user specifies an initial bookmark, - // thus setting initialBookmark, when the document is loaded. - this._pushToHistory(params, false); - this.previousHash = window.location.hash.substring(1); - } - this.updatePreviousBookmark = this.nextHashParam ? false : true; - if (target) { - // If the current document is reloaded, - // avoid creating duplicate entries in the history. - this._updatePreviousBookmark(); - } - return; - } - if (this.nextHashParam) { - if (this.nextHashParam === params.hash) { - this.nextHashParam = null; - this.updatePreviousBookmark = true; - return; - } else { - this.nextHashParam = null; + + element.href = linkService.getDestinationHash(dest); + + element.onclick = function () { + if (dest) { + linkService.navigateTo(dest); } + + return false; + }; + } + }, { + key: "_setStyles", + value: function _setStyles(element, _ref3) { + var bold = _ref3.bold, + italic = _ref3.italic; + var styleStr = ''; + + if (bold) { + styleStr += 'font-weight: bold;'; } - if (params.hash) { - if (this.current.hash) { - if (this.current.hash !== params.hash) { - this._pushToHistory(params, true); - } else { - if (!this.current.page && params.page) { - this._pushToHistory(params, false, true); - } - this.updatePreviousBookmark = true; + if (italic) { + styleStr += 'font-style: italic;'; + } + + if (styleStr) { + element.setAttribute('style', styleStr); + } + } + }, { + key: "_addToggleButton", + value: function _addToggleButton(div) { + var _this = this; + + var toggler = document.createElement('div'); + toggler.className = 'outlineItemToggler'; + + toggler.onclick = function (evt) { + evt.stopPropagation(); + toggler.classList.toggle('outlineItemsHidden'); + + if (evt.shiftKey) { + var shouldShowAll = !toggler.classList.contains('outlineItemsHidden'); + + _this._toggleOutlineItem(div, shouldShowAll); + } + }; + + div.insertBefore(toggler, div.firstChild); + } + }, { + key: "_toggleOutlineItem", + value: function _toggleOutlineItem(root) { + var show = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + this.lastToggleIsShow = show; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = root.querySelectorAll('.outlineItemToggler')[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var toggler = _step.value; + toggler.classList.toggle('outlineItemsHidden', !show); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return != null) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; } - } else { - this._pushToHistory(params, true); } - } else if (this.current.page && params.page && - this.current.page !== params.page) { - this._pushToHistory(params, true); } - }, - - _getPreviousParams: function pdfHistory_getPreviousParams(onlyCheckPage, - beforeUnload) { - if (!(this.currentBookmark && this.currentPage)) { - return null; - } else if (this.updatePreviousBookmark) { - this.updatePreviousBookmark = false; - } - if (this.uid > 0 && !(this.previousBookmark && this.previousPage)) { - // Prevent the history from getting stuck in the current state, - // effectively preventing the user from going back/forward in - // the history. - // - // This happens if the current position in the document didn't change - // when the history was previously updated. The reasons for this are - // either: - // 1. The current zoom value is such that the document does not need to, - // or cannot, be scrolled to display the destination. - // 2. The previous destination is broken, and doesn't actally point to a - // position within the document. - // (This is either due to a bad PDF generator, or the user making a - // mistake when entering a destination in the hash parameters.) - return null; - } - if ((!this.current.dest && !onlyCheckPage) || beforeUnload) { - if (this.previousBookmark === this.currentBookmark) { - return null; - } - } else if (this.current.page || onlyCheckPage) { - if (this.previousPage === this.currentPage) { - return null; - } - } else { - return null; - } - var params = {hash: this.currentBookmark, page: this.currentPage}; - if (this.isViewerInPresentationMode) { - params.hash = null; - } - return params; - }, - - _stateObj: function pdfHistory_stateObj(params) { - return {fingerprint: this.fingerprint, uid: this.uid, target: params}; - }, - - _pushToHistory: function pdfHistory_pushToHistory(params, - addPrevious, overwrite) { - if (!this.initialized) { + } + }, { + key: "toggleOutlineTree", + value: function toggleOutlineTree() { + if (!this.outline) { return; } - if (!params.hash && params.page) { - params.hash = ('page=' + params.page); - } - if (addPrevious && !overwrite) { - var previousParams = this._getPreviousParams(); - if (previousParams) { - var replacePrevious = (!this.current.dest && - this.current.hash !== this.previousHash); - this._pushToHistory(previousParams, false, replacePrevious); - } - } - this._pushOrReplaceState(this._stateObj(params), - (overwrite || this.uid === 0)); - this.currentUid = this.uid++; - this.current = params; - this.updatePreviousBookmark = true; - }, - _goTo: function pdfHistory_goTo(state) { - if (!(this.initialized && this.historyUnlocked && - this._isStateObjectDefined(state))) { + this._toggleOutlineItem(this.container, !this.lastToggleIsShow); + } + }, { + key: "render", + value: function render(_ref4) { + var outline = _ref4.outline; + var outlineCount = 0; + + if (this.outline) { + this.reset(); + } + + this.outline = outline || null; + + if (!outline) { + this._dispatchEvent(outlineCount); + return; } - if (!this.reInitialized && state.uid < this.currentUid) { - var previousParams = this._getPreviousParams(true); - if (previousParams) { - this._pushToHistory(this.current, false); - this._pushToHistory(previousParams, false); - this.currentUid = state.uid; - window.history.back(); - 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 + }); + } + + levelData.parent.appendChild(div); + outlineCount++; } } - this.historyUnlocked = false; - if (state.target.dest) { - this.linkService.navigateTo(state.target.dest); - } else { - this.linkService.setHash(state.target.hash); + if (hasAnyNesting) { + this.container.classList.add('outlineWithDeepNesting'); } - this.currentUid = state.uid; - if (state.uid > this.uid) { - this.uid = state.uid; - } - this.current = state.target; - this.updatePreviousBookmark = true; - var currentHash = window.location.hash.substring(1); - if (this.previousHash !== currentHash) { - this.allowHashChange = false; - } - this.previousHash = currentHash; + this.container.appendChild(fragment); - this.historyUnlocked = true; - }, - - back: function pdfHistoryBack() { - this.go(-1); - }, - - forward: function pdfHistoryForward() { - this.go(1); - }, - - go: function pdfHistoryGo(direction) { - if (this.initialized && this.historyUnlocked) { - var state = window.history.state; - if (direction === -1 && state && state.uid > 0) { - window.history.back(); - } else if (direction === 1 && state && state.uid < (this.uid - 1)) { - window.history.forward(); - } - } + this._dispatchEvent(outlineCount); } - }; + }]); - return PDFHistory; -})(); + return PDFOutlineViewer; +}(); + +exports.PDFOutlineViewer = PDFOutlineViewer; + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -var SecondaryToolbar = { - opened: false, - previousContainerHeight: null, - newContainerHeight: null, +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFPresentationMode = void 0; - initialize: function secondaryToolbarInitialize(options) { - this.toolbar = options.toolbar; - this.buttonContainer = this.toolbar.firstElementChild; +var _ui_utils = __webpack_require__(6); - // Define the toolbar buttons. - this.toggleButton = options.toggleButton; - this.presentationModeButton = options.presentationModeButton; - this.openFile = options.openFile; - this.print = options.print; - this.download = options.download; - this.viewBookmark = options.viewBookmark; - this.firstPage = options.firstPage; - this.lastPage = options.lastPage; - this.pageRotateCw = options.pageRotateCw; - this.pageRotateCcw = options.pageRotateCcw; - this.documentPropertiesButton = options.documentPropertiesButton; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - // Attach the event listeners. - var elements = [ - // Button to toggle the visibility of the secondary toolbar: - { element: this.toggleButton, handler: this.toggle }, - // All items within the secondary toolbar - // (except for toggleHandTool, hand_tool.js is responsible for it): - { element: this.presentationModeButton, - handler: this.presentationModeClick }, - { element: this.openFile, handler: this.openFileClick }, - { element: this.print, handler: this.printClick }, - { element: this.download, handler: this.downloadClick }, - { element: this.viewBookmark, handler: this.viewBookmarkClick }, - { element: this.firstPage, handler: this.firstPageClick }, - { element: this.lastPage, handler: this.lastPageClick }, - { element: this.pageRotateCw, handler: this.pageRotateCwClick }, - { element: this.pageRotateCcw, handler: this.pageRotateCcwClick }, - { element: this.documentPropertiesButton, - handler: this.documentPropertiesClick } - ]; +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); } } - for (var item in elements) { - var element = elements[item].element; - if (element) { - element.addEventListener('click', elements[item].handler.bind(this)); - } - } - }, +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - // Event handling functions. - presentationModeClick: function secondaryToolbarPresentationModeClick(evt) { - PDFViewerApplication.requestPresentationMode(); - this.close(); - }, - - openFileClick: function secondaryToolbarOpenFileClick(evt) { - document.getElementById('fileInput').click(); - this.close(); - }, - - printClick: function secondaryToolbarPrintClick(evt) { - window.print(); - this.close(); - }, - - downloadClick: function secondaryToolbarDownloadClick(evt) { - PDFViewerApplication.download(); - this.close(); - }, - - viewBookmarkClick: function secondaryToolbarViewBookmarkClick(evt) { - this.close(); - }, - - firstPageClick: function secondaryToolbarFirstPageClick(evt) { - PDFViewerApplication.page = 1; - this.close(); - }, - - lastPageClick: function secondaryToolbarLastPageClick(evt) { - if (PDFViewerApplication.pdfDocument) { - PDFViewerApplication.page = PDFViewerApplication.pagesCount; - } - this.close(); - }, - - pageRotateCwClick: function secondaryToolbarPageRotateCwClick(evt) { - PDFViewerApplication.rotatePages(90); - }, - - pageRotateCcwClick: function secondaryToolbarPageRotateCcwClick(evt) { - PDFViewerApplication.rotatePages(-90); - }, - - documentPropertiesClick: function secondaryToolbarDocumentPropsClick(evt) { - PDFViewerApplication.pdfDocumentProperties.open(); - this.close(); - }, - - // Misc. functions for interacting with the toolbar. - setMaxHeight: function secondaryToolbarSetMaxHeight(container) { - if (!container || !this.buttonContainer) { - return; - } - this.newContainerHeight = container.clientHeight; - if (this.previousContainerHeight === this.newContainerHeight) { - return; - } - this.buttonContainer.setAttribute('style', - 'max-height: ' + (this.newContainerHeight - SCROLLBAR_PADDING) + 'px;'); - this.previousContainerHeight = this.newContainerHeight; - }, - - open: function secondaryToolbarOpen() { - if (this.opened) { - return; - } - this.opened = true; - this.toggleButton.classList.add('toggled'); - this.toolbar.classList.remove('hidden'); - }, - - close: function secondaryToolbarClose(target) { - if (!this.opened) { - return; - } else if (target && !this.toolbar.contains(target)) { - return; - } - this.opened = false; - this.toolbar.classList.add('hidden'); - this.toggleButton.classList.remove('toggled'); - }, - - toggle: function secondaryToolbarToggle() { - if (this.opened) { - this.close(); - } else { - this.open(); - } - } -}; - - -var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; // in ms -var DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms +var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; +var DELAY_BEFORE_HIDING_CONTROLS = 3000; 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; -/** - * @typedef {Object} PDFPresentationModeOptions - * @property {HTMLDivElement} container - The container for the viewer element. - * @property {HTMLDivElement} viewer - (optional) The viewer element. - * @property {PDFViewer} pdfViewer - The document viewer. - * @property {PDFThumbnailViewer} pdfThumbnailViewer - (optional) The thumbnail - * viewer. - * @property {Array} contextMenuItems - (optional) The menuitems that are added - * to the context menu in Presentation Mode. - */ +var PDFPresentationMode = +/*#__PURE__*/ +function () { + function PDFPresentationMode(_ref) { + var _this = this; -/** - * @class - */ -var PDFPresentationMode = (function PDFPresentationModeClosure() { - /** - * @constructs PDFPresentationMode - * @param {PDFPresentationModeOptions} options - */ - function PDFPresentationMode(options) { - this.container = options.container; - this.viewer = options.viewer || options.container.firstElementChild; - this.pdfViewer = options.pdfViewer; - this.pdfThumbnailViewer = options.pdfThumbnailViewer || null; - var contextMenuItems = options.contextMenuItems || null; + var container = _ref.container, + _ref$viewer = _ref.viewer, + viewer = _ref$viewer === void 0 ? null : _ref$viewer, + pdfViewer = _ref.pdfViewer, + eventBus = _ref.eventBus, + _ref$contextMenuItems = _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; this.args = null; this.contextMenuOpen = false; this.mouseScrollTimeStamp = 0; this.mouseScrollDelta = 0; + this.touchSwipeState = null; if (contextMenuItems) { - for (var i = 0, ii = contextMenuItems.length; i < ii; i++) { - var item = contextMenuItems[i]; - item.element.addEventListener('click', function (handler) { - this.contextMenuOpen = false; - handler(); - }.bind(this, item.handler)); - } + contextMenuItems.contextFirstPage.addEventListener('click', function () { + _this.contextMenuOpen = false; + + _this.eventBus.dispatch('firstpage', { + source: _this + }); + }); + contextMenuItems.contextLastPage.addEventListener('click', function () { + _this.contextMenuOpen = false; + + _this.eventBus.dispatch('lastpage', { + source: _this + }); + }); + contextMenuItems.contextPageRotateCw.addEventListener('click', function () { + _this.contextMenuOpen = false; + + _this.eventBus.dispatch('rotatecw', { + source: _this + }); + }); + contextMenuItems.contextPageRotateCcw.addEventListener('click', function () { + _this.contextMenuOpen = false; + + _this.eventBus.dispatch('rotateccw', { + source: _this + }); + }); } } - PDFPresentationMode.prototype = { - /** - * Request the browser to enter fullscreen mode. - * @returns {boolean} Indicating if the request was successful. - */ - request: function PDFPresentationMode_request() { - if (this.switchInProgress || this.active || - !this.viewer.hasChildNodes()) { + _createClass(PDFPresentationMode, [{ + key: "request", + value: function request() { + if (this.switchInProgress || this.active || !this.viewer.hasChildNodes()) { return false; } + this._addFullscreenChangeListeners(); + this._setSwitchInProgress(); + this._notifyStateChange(); if (this.container.requestFullscreen) { @@ -2383,1273 +8817,2843 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() { this.args = { page: this.pdfViewer.currentPageNumber, - previousScale: this.pdfViewer.currentScaleValue, + previousScale: this.pdfViewer.currentScaleValue }; - return true; - }, - - /** - * Switches page when the user scrolls (using a scroll wheel or a touchpad) - * with large enough motion, to prevent accidental page switches. - * @param {number} delta - The delta value from the mouse event. - */ - mouseScroll: function PDFPresentationMode_mouseScroll(delta) { + } + }, { + key: "_mouseWheel", + value: function _mouseWheel(evt) { if (!this.active) { return; } - var MOUSE_SCROLL_COOLDOWN_TIME = 50; - var PAGE_SWITCH_THRESHOLD = 120; - var PageSwitchDirection = { - UP: -1, - DOWN: 1 - }; - var currentTime = (new Date()).getTime(); + evt.preventDefault(); + var delta = (0, _ui_utils.normalizeWheelEventDelta)(evt); + var currentTime = new Date().getTime(); var storedTime = this.mouseScrollTimeStamp; - // If we've already switched page, avoid accidentally switching again. - if (currentTime > storedTime && - currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) { + if (currentTime > storedTime && currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) { return; } - // If the scroll direction changed, reset the accumulated scroll delta. - if ((this.mouseScrollDelta > 0 && delta < 0) || - (this.mouseScrollDelta < 0 && delta > 0)) { + + 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 pageSwitchDirection = (this.mouseScrollDelta > 0) ? - PageSwitchDirection.UP : PageSwitchDirection.DOWN; - var page = this.pdfViewer.currentPageNumber; + var totalDelta = this.mouseScrollDelta; + this._resetMouseScrollState(); - // If we're at the first/last page, we don't need to do anything. - if ((page === 1 && pageSwitchDirection === PageSwitchDirection.UP) || - (page === this.pdfViewer.pagesCount && - pageSwitchDirection === PageSwitchDirection.DOWN)) { - return; + var success = totalDelta > 0 ? this._goToPreviousPage() : this._goToNextPage(); + + if (success) { + this.mouseScrollTimeStamp = currentTime; } - this.pdfViewer.currentPageNumber = (page + pageSwitchDirection); - this.mouseScrollTimeStamp = currentTime; } - }, + } + }, { + key: "_goToPreviousPage", + value: function _goToPreviousPage() { + var page = this.pdfViewer.currentPageNumber; - get isFullscreen() { - return !!(document.fullscreenElement || - document.mozFullScreen || - document.webkitIsFullScreen || - document.msFullscreenElement); - }, + if (page <= 1) { + return false; + } - /** - * @private - */ - _notifyStateChange: function PDFPresentationMode_notifyStateChange() { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('presentationmodechanged', true, true, { + this.pdfViewer.currentPageNumber = page - 1; + return true; + } + }, { + 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", + value: function _notifyStateChange() { + this.eventBus.dispatch('presentationmodechanged', { + source: this, active: this.active, switchInProgress: !!this.switchInProgress }); - window.dispatchEvent(event); - }, + } + }, { + key: "_setSwitchInProgress", + value: function _setSwitchInProgress() { + var _this2 = this; - /** - * Used to initialize a timeout when requesting Presentation Mode, - * i.e. when the browser is requested to enter fullscreen mode. - * This timeout is used to prevent the current page from being scrolled - * partially, or completely, out of view when entering Presentation Mode. - * NOTE: This issue seems limited to certain zoom levels (e.g. page-width). - * @private - */ - _setSwitchInProgress: function PDFPresentationMode_setSwitchInProgress() { if (this.switchInProgress) { clearTimeout(this.switchInProgress); } - this.switchInProgress = setTimeout(function switchInProgressTimeout() { - this._removeFullscreenChangeListeners(); - delete this.switchInProgress; - this._notifyStateChange(); - }.bind(this), DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS); - }, - /** - * @private - */ - _resetSwitchInProgress: - function PDFPresentationMode_resetSwitchInProgress() { + this.switchInProgress = setTimeout(function () { + _this2._removeFullscreenChangeListeners(); + + delete _this2.switchInProgress; + + _this2._notifyStateChange(); + }, DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS); + } + }, { + key: "_resetSwitchInProgress", + value: function _resetSwitchInProgress() { if (this.switchInProgress) { clearTimeout(this.switchInProgress); delete this.switchInProgress; } - }, + } + }, { + key: "_enter", + value: function _enter() { + var _this3 = this; - /** - * @private - */ - _enter: function PDFPresentationMode_enter() { this.active = true; - this._resetSwitchInProgress(); - this._notifyStateChange(); - this.container.classList.add(ACTIVE_SELECTOR); - // Ensure that the correct page is scrolled into view when entering - // Presentation Mode, by waiting until fullscreen mode in enabled. - setTimeout(function enterPresentationModeTimeout() { - this.pdfViewer.currentPageNumber = this.args.page; - this.pdfViewer.currentScaleValue = 'page-fit'; - }.bind(this), 0); + this._resetSwitchInProgress(); + + this._notifyStateChange(); + + this.container.classList.add(ACTIVE_SELECTOR); + setTimeout(function () { + _this3.pdfViewer.currentPageNumber = _this3.args.page; + _this3.pdfViewer.currentScaleValue = 'page-fit'; + }, 0); this._addWindowListeners(); + this._showControls(); + this.contextMenuOpen = false; this.container.setAttribute('contextmenu', 'viewerContextMenu'); - - // Text selection is disabled in Presentation Mode, thus it's not possible - // for the user to deselect text that is selected (e.g. with "Select all") - // when entering Presentation Mode, hence we remove any active selection. window.getSelection().removeAllRanges(); - }, + } + }, { + key: "_exit", + value: function _exit() { + var _this4 = this; - /** - * @private - */ - _exit: function PDFPresentationMode_exit() { var page = this.pdfViewer.currentPageNumber; this.container.classList.remove(ACTIVE_SELECTOR); + setTimeout(function () { + _this4.active = false; - // Ensure that the correct page is scrolled into view when exiting - // Presentation Mode, by waiting until fullscreen mode is disabled. - setTimeout(function exitPresentationModeTimeout() { - this.active = false; - this._removeFullscreenChangeListeners(); - this._notifyStateChange(); + _this4._removeFullscreenChangeListeners(); - this.pdfViewer.currentScaleValue = this.args.previousScale; - this.pdfViewer.currentPageNumber = page; - this.args = null; - }.bind(this), 0); + _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.contextMenuOpen = false; - - if (this.pdfThumbnailViewer) { - this.pdfThumbnailViewer.ensureThumbnailVisible(page); - } - }, - - /** - * @private - */ - _mouseDown: function PDFPresentationMode_mouseDown(evt) { + } + }, { + key: "_mouseDown", + value: function _mouseDown(evt) { if (this.contextMenuOpen) { this.contextMenuOpen = false; evt.preventDefault(); return; } + if (evt.button === 0) { - // Enable clicking of links in presentation mode. Please note: - // Only links pointing to destinations in the current PDF document work. - var isInternalLink = (evt.target.href && - evt.target.classList.contains('internalLink')); + var isInternalLink = evt.target.href && evt.target.classList.contains('internalLink'); + if (!isInternalLink) { - // Unless an internal link was clicked, advance one page. evt.preventDefault(); - this.pdfViewer.currentPageNumber += (evt.shiftKey ? -1 : 1); + + if (evt.shiftKey) { + this._goToPreviousPage(); + } else { + this._goToNextPage(); + } } } - }, - - /** - * @private - */ - _contextMenu: function PDFPresentationMode_contextMenu() { + } + }, { + key: "_contextMenu", + value: function _contextMenu() { this.contextMenuOpen = true; - }, + } + }, { + key: "_showControls", + value: function _showControls() { + var _this5 = this; - /** - * @private - */ - _showControls: function PDFPresentationMode_showControls() { if (this.controlsTimeout) { clearTimeout(this.controlsTimeout); } else { this.container.classList.add(CONTROLS_SELECTOR); } - this.controlsTimeout = setTimeout(function showControlsTimeout() { - this.container.classList.remove(CONTROLS_SELECTOR); - delete this.controlsTimeout; - }.bind(this), DELAY_BEFORE_HIDING_CONTROLS); - }, - /** - * @private - */ - _hideControls: function PDFPresentationMode_hideControls() { + this.controlsTimeout = setTimeout(function () { + _this5.container.classList.remove(CONTROLS_SELECTOR); + + delete _this5.controlsTimeout; + }, DELAY_BEFORE_HIDING_CONTROLS); + } + }, { + key: "_hideControls", + value: function _hideControls() { if (!this.controlsTimeout) { return; } + clearTimeout(this.controlsTimeout); this.container.classList.remove(CONTROLS_SELECTOR); delete this.controlsTimeout; - }, - - /** - * Resets the properties used for tracking mouse scrolling events. - * @private - */ - _resetMouseScrollState: - function PDFPresentationMode_resetMouseScrollState() { + } + }, { + key: "_resetMouseScrollState", + value: function _resetMouseScrollState() { this.mouseScrollTimeStamp = 0; this.mouseScrollDelta = 0; - }, + } + }, { + key: "_touchSwipe", + value: function _touchSwipe(evt) { + if (!this.active) { + return; + } - /** - * @private - */ - _addWindowListeners: function PDFPresentationMode_addWindowListeners() { + if (evt.touches.length > 1) { + this.touchSwipeState = null; + return; + } + + switch (evt.type) { + case 'touchstart': + this.touchSwipeState = { + startX: evt.touches[0].pageX, + startY: evt.touches[0].pageY, + endX: evt.touches[0].pageX, + endY: evt.touches[0].pageY + }; + break; + + 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': + 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", + value: function _addWindowListeners() { this.showControlsBind = this._showControls.bind(this); this.mouseDownBind = this._mouseDown.bind(this); + this.mouseWheelBind = this._mouseWheel.bind(this); 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); - }, - - /** - * @private - */ - _removeWindowListeners: - function PDFPresentationMode_removeWindowListeners() { + window.addEventListener('touchstart', this.touchSwipeBind); + window.addEventListener('touchmove', this.touchSwipeBind); + window.addEventListener('touchend', this.touchSwipeBind); + } + }, { + 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); delete this.showControlsBind; delete this.mouseDownBind; + delete this.mouseWheelBind; delete this.resetMouseScrollStateBind; delete this.contextMenuBind; - }, - - /** - * @private - */ - _fullscreenChange: function PDFPresentationMode_fullscreenChange() { + delete this.touchSwipeBind; + } + }, { + key: "_fullscreenChange", + value: function _fullscreenChange() { if (this.isFullscreen) { this._enter(); } else { this._exit(); } - }, - - /** - * @private - */ - _addFullscreenChangeListeners: - function PDFPresentationMode_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('webkitfullscreenchange', this.fullscreenChangeBind); window.addEventListener('MSFullscreenChange', this.fullscreenChangeBind); - }, - - /** - * @private - */ - _removeFullscreenChangeListeners: - function PDFPresentationMode_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('mozfullscreenchange', this.fullscreenChangeBind); + window.removeEventListener('webkitfullscreenchange', this.fullscreenChangeBind); + window.removeEventListener('MSFullscreenChange', this.fullscreenChangeBind); delete this.fullscreenChangeBind; } - }; + }, { + key: "isFullscreen", + get: function get() { + return !!(document.fullscreenElement || document.mozFullScreen || document.webkitIsFullScreen || document.msFullscreenElement); + } + }]); return PDFPresentationMode; -})(); +}(); + +exports.PDFPresentationMode = PDFPresentationMode; + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFSidebarResizer = void 0; -var GrabToPan = (function GrabToPanClosure() { - /** - * Construct a GrabToPan instance for a given HTML element. - * @param options.element {Element} - * @param options.ignoreTarget {function} optional. See `ignoreTarget(node)` - * @param options.onActiveChanged {function(boolean)} optional. Called - * when grab-to-pan is (de)activated. The first argument is a boolean that - * shows whether grab-to-pan is activated. - */ - function GrabToPan(options) { - this.element = options.element; - this.document = options.element.ownerDocument; - if (typeof options.ignoreTarget === 'function') { - this.ignoreTarget = options.ignoreTarget; +var _ui_utils = __webpack_require__(6); + +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 SIDEBAR_WIDTH_VAR = '--sidebar-width'; +var SIDEBAR_MIN_WIDTH = 200; +var SIDEBAR_RESIZING_CLASS = 'sidebarResizing'; + +var PDFSidebarResizer = +/*#__PURE__*/ +function () { + function PDFSidebarResizer(options, eventBus) { + var _this = this; + + var l10n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ui_utils.NullL10n; + + _classCallCheck(this, PDFSidebarResizer); + + this.enabled = false; + this.isRTL = false; + this.sidebarOpen = false; + this.doc = document.documentElement; + this._width = null; + this._outerContainerWidth = null; + this._boundEvents = Object.create(null); + this.outerContainer = options.outerContainer; + 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 * ".concat(SIDEBAR_MIN_WIDTH, "px)"))) { + console.warn('PDFSidebarResizer: ' + 'The browser does not support resizing of the sidebar.'); + return; } - this.onActiveChanged = options.onActiveChanged; - // Bind the contexts to ensure that `this` always points to - // the GrabToPan instance. - 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); - - // This overlay will be inserted in the document when the mouse moves during - // a grab operation, to ensure that the cursor has the desired appearance. - var overlay = this.overlay = document.createElement('div'); - overlay.className = 'grab-to-pan-grabbing'; - } - GrabToPan.prototype = { - /** - * Class name of element which can be grabbed - */ - CSS_CLASS_GRAB: 'grab-to-pan-grab', - - /** - * Bind a mousedown event to the element to enable grab-detection. - */ - 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); - } - } - }, - - /** - * Removes all events. Any pending pan session is immediately stopped. - */ - 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() { - if (this.active) { - this.deactivate(); - } else { - this.activate(); - } - }, - - /** - * Whether to not pan if the target element is clicked. - * Override this method to change the default behaviour. - * - * @param node {Element} The target of the event - * @return {boolean} Whether to not react to the click event. - */ - ignoreTarget: function GrabToPan_ignoreTarget(node) { - // Use matchesSelector to check whether the clicked element - // is (a child of) an input element / link - return node[matchesSelector]( - 'a[href], a[href] *, input, textarea, button, button *, select, option' - ); - }, - - /** - * @private - */ - _onmousedown: function GrabToPan__onmousedown(event) { - if (event.button !== 0 || this.ignoreTarget(event.target)) { - return; - } - if (event.originalTarget) { - try { - /* jshint expr:true */ - event.originalTarget.tagName; - } catch (e) { - // Mozilla-specific: element is a scrollbar (XUL element) - 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); - // When a scroll event occurs before a mousemove, assume that the user - // dragged a scrollbar (necessary for Opera Presto, Safari and IE) - // (not needed for Chrome/Firefox) - this.element.addEventListener('scroll', this._endPan, true); - event.preventDefault(); - event.stopPropagation(); - this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING); - - var focusedElement = document.activeElement; - if (focusedElement && !focusedElement.contains(event.target)) { - focusedElement.blur(); - } - }, - - /** - * @private - */ - _onmousemove: function GrabToPan__onmousemove(event) { - 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; - this.element.scrollTop = this.scrollTopStart - yDiff; - this.element.scrollLeft = this.scrollLeftStart - xDiff; - if (!this.overlay.parentNode) { - document.body.appendChild(this.overlay); - } - }, - - /** - * @private - */ - _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); - if (this.overlay.parentNode) { - this.overlay.parentNode.removeChild(this.overlay); - } - } - }; - - // Get the correct (vendor-prefixed) name of the matches method. - var matchesSelector; - ['webkitM', 'mozM', 'msM', 'oM', 'm'].some(function(prefix) { - var name = prefix + 'atches'; - if (name in document.documentElement) { - matchesSelector = name; - } - name += 'Selector'; - if (name in document.documentElement) { - matchesSelector = name; - } - return matchesSelector; // If found, then truthy, and [].some() ends. - }); - - // Browser sniffing because it's impossible to feature-detect - // whether event.which for onmousemove is reliable - var isNotIEorIsIE10plus = !document.documentMode || document.documentMode > 9; - var chrome = window.chrome; - var isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app); - // ^ Chrome 15+ ^ Opera 15+ - var isSafari6plus = /Apple/.test(navigator.vendor) && - /Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent); - - /** - * Whether the left mouse is not pressed. - * @param event {MouseEvent} - * @return {boolean} True if the left mouse button is not pressed. - * False if unsure or if the left mouse button is pressed. - */ - function isLeftMouseReleased(event) { - if ('buttons' in event && isNotIEorIsIE10plus) { - // http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons - // Firefox 15+ - // Internet Explorer 10+ - return !(event.buttons | 1); - } - if (isChrome15OrOpera15plus || isSafari6plus) { - // Chrome 14+ - // Opera 15+ - // Safari 6.0+ - return event.which === 0; - } - } - - return GrabToPan; -})(); - -var HandTool = { - initialize: function handToolInitialize(options) { - var toggleHandTool = options.toggleHandTool; - this.handTool = new GrabToPan({ - element: options.container, - onActiveChanged: function(isActive) { - if (!toggleHandTool) { - return; - } - if (isActive) { - toggleHandTool.title = 'Disable hand tool'; - toggleHandTool.firstElementChild.textContent = 'Disable hand tool'; - } else { - toggleHandTool.title = 'Enable hand tool'; - toggleHandTool.firstElementChild.textContent = 'Enable hand tool'; - } - } + this.enabled = true; + this.resizer.classList.remove('hidden'); + this.l10n.getDirection().then(function (dir) { + _this.isRTL = dir === 'rtl'; }); - if (toggleHandTool) { - toggleHandTool.addEventListener('click', this.toggle.bind(this), false); - window.addEventListener('localized', function (evt) { - Preferences.get('enableHandToolOnLoad').then(function resolved(value) { - if (value) { - this.handTool.activate(); - } - }.bind(this), function rejected(reason) {}); - }.bind(this)); - - window.addEventListener('presentationmodechanged', function (evt) { - if (evt.detail.switchInProgress) { - return; - } - if (evt.detail.active) { - this.enterPresentationMode(); - } else { - this.exitPresentationMode(); - } - }.bind(this)); - } - }, - - toggle: function handToolToggle() { - this.handTool.toggle(); - SecondaryToolbar.close(); - }, - - enterPresentationMode: function handToolEnterPresentationMode() { - if (this.handTool.active) { - this.wasActive = true; - this.handTool.deactivate(); - } - }, - - exitPresentationMode: function handToolExitPresentationMode() { - if (this.wasActive) { - this.wasActive = null; - this.handTool.activate(); - } - } -}; - - -var OverlayManager = { - overlays: {}, - active: null, - - /** - * @param {string} name The name of the overlay that is registered. This must - * be equal to the ID of the overlay's DOM element. - * @param {function} callerCloseMethod (optional) The method that, if present, - * will call OverlayManager.close from the Object - * registering the overlay. Access to this method is - * necessary in order to run cleanup code when e.g. - * the overlay is force closed. The default is null. - * @param {boolean} canForceClose (optional) Indicates if opening the overlay - * will close an active overlay. The default is false. - * @returns {Promise} A promise that is resolved when the overlay has been - * registered. - */ - register: function overlayManagerRegister(name, - callerCloseMethod, canForceClose) { - return new Promise(function (resolve) { - var element, container; - if (!name || !(element = document.getElementById(name)) || - !(container = element.parentNode)) { - throw new Error('Not enough parameters.'); - } else if (this.overlays[name]) { - throw new Error('The overlay is already registered.'); - } - this.overlays[name] = { element: element, - container: container, - callerCloseMethod: (callerCloseMethod || null), - canForceClose: (canForceClose || false) }; - resolve(); - }.bind(this)); - }, - - /** - * @param {string} name The name of the overlay that is unregistered. - * @returns {Promise} A promise that is resolved when the overlay has been - * unregistered. - */ - unregister: function overlayManagerUnregister(name) { - return new Promise(function (resolve) { - if (!this.overlays[name]) { - throw new Error('The overlay does not exist.'); - } else if (this.active === name) { - throw new Error('The overlay cannot be removed while it is active.'); - } - delete this.overlays[name]; - - resolve(); - }.bind(this)); - }, - - /** - * @param {string} name The name of the overlay that should be opened. - * @returns {Promise} A promise that is resolved when the overlay has been - * opened. - */ - open: function overlayManagerOpen(name) { - return new Promise(function (resolve) { - if (!this.overlays[name]) { - throw new Error('The overlay does not exist.'); - } else if (this.active) { - if (this.overlays[name].canForceClose) { - this._closeThroughCaller(); - } else if (this.active === name) { - throw new Error('The overlay is already active.'); - } else { - throw new Error('Another overlay is currently active.'); - } - } - this.active = name; - this.overlays[this.active].element.classList.remove('hidden'); - this.overlays[this.active].container.classList.remove('hidden'); - - window.addEventListener('keydown', this._keyDown); - resolve(); - }.bind(this)); - }, - - /** - * @param {string} name The name of the overlay that should be closed. - * @returns {Promise} A promise that is resolved when the overlay has been - * closed. - */ - close: function overlayManagerClose(name) { - return new Promise(function (resolve) { - if (!this.overlays[name]) { - throw new Error('The overlay does not exist.'); - } else if (!this.active) { - throw new Error('The overlay is currently not active.'); - } else if (this.active !== name) { - throw new Error('Another overlay is currently active.'); - } - this.overlays[this.active].container.classList.add('hidden'); - this.overlays[this.active].element.classList.add('hidden'); - this.active = null; - - window.removeEventListener('keydown', this._keyDown); - resolve(); - }.bind(this)); - }, - - /** - * @private - */ - _keyDown: function overlayManager_keyDown(evt) { - var self = OverlayManager; - if (self.active && evt.keyCode === 27) { // Esc key. - self._closeThroughCaller(); - evt.preventDefault(); - } - }, - - /** - * @private - */ - _closeThroughCaller: function overlayManager_closeThroughCaller() { - if (this.overlays[this.active].callerCloseMethod) { - this.overlays[this.active].callerCloseMethod(); - } - if (this.active) { - this.close(this.active); - } - } -}; - - -var PasswordPrompt = { - overlayName: null, - updatePassword: null, - reason: null, - passwordField: null, - passwordText: null, - passwordSubmit: null, - passwordCancel: null, - - initialize: function secondaryToolbarInitialize(options) { - this.overlayName = options.overlayName; - this.passwordField = options.passwordField; - this.passwordText = options.passwordText; - this.passwordSubmit = options.passwordSubmit; - this.passwordCancel = options.passwordCancel; - - // Attach the event listeners. - this.passwordSubmit.addEventListener('click', - this.verifyPassword.bind(this)); - - this.passwordCancel.addEventListener('click', this.close.bind(this)); - - this.passwordField.addEventListener('keydown', function (e) { - if (e.keyCode === 13) { // Enter key - this.verifyPassword(); - } - }.bind(this)); - - OverlayManager.register(this.overlayName, this.close.bind(this), true); - }, - - open: function passwordPromptOpen() { - OverlayManager.open(this.overlayName).then(function () { - this.passwordField.type = 'password'; - this.passwordField.focus(); - - var promptString = 'Enter the password to open this PDF file.'; - - if (this.reason === PDFJS.PasswordResponses.INCORRECT_PASSWORD) { - promptString = 'Invalid password. Please try again.'; - } - - this.passwordText.textContent = promptString; - }.bind(this)); - }, - - close: function passwordPromptClose() { - OverlayManager.close(this.overlayName).then(function () { - this.passwordField.value = ''; - this.passwordField.type = ''; - }.bind(this)); - }, - - verifyPassword: function passwordPromptVerifyPassword() { - var password = this.passwordField.value; - if (password && password.length > 0) { - this.close(); - return this.updatePassword(password); - } - } -}; - - -/** - * @typedef {Object} PDFDocumentPropertiesOptions - * @property {string} overlayName - Name/identifier for the overlay. - * @property {Object} fields - Names and elements of the overlay's fields. - * @property {HTMLButtonElement} closeButton - Button for closing the overlay. - */ - -/** - * @class - */ -var PDFDocumentProperties = (function PDFDocumentPropertiesClosure() { - /** - * @constructs PDFDocumentProperties - * @param {PDFDocumentPropertiesOptions} options - */ - function PDFDocumentProperties(options) { - this.fields = options.fields; - this.overlayName = options.overlayName; - - this.rawFileSize = 0; - this.url = null; - this.pdfDocument = null; - - // Bind the event listener for the Close button. - if (options.closeButton) { - options.closeButton.addEventListener('click', this.close.bind(this)); - } - - this.dataAvailablePromise = new Promise(function (resolve) { - this.resolveDataAvailable = resolve; - }.bind(this)); - - OverlayManager.register(this.overlayName, this.close.bind(this)); + this._addEventListeners(); } - PDFDocumentProperties.prototype = { - /** - * Open the document properties overlay. - */ - open: function PDFDocumentProperties_open() { - Promise.all([OverlayManager.open(this.overlayName), - this.dataAvailablePromise]).then(function () { - this._getProperties(); - }.bind(this)); - }, + _createClass(PDFSidebarResizer, [{ + key: "_updateWidth", + value: function _updateWidth() { + var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - /** - * Close the document properties overlay. - */ - close: function PDFDocumentProperties_close() { - OverlayManager.close(this.overlayName); - }, - - /** - * Set the file size of the PDF document. This method is used to - * update the file size in the document properties overlay once it - * is known so we do not have to wait until the entire file is loaded. - * - * @param {number} fileSize - The file size of the PDF document. - */ - setFileSize: function PDFDocumentProperties_setFileSize(fileSize) { - if (fileSize > 0) { - this.rawFileSize = fileSize; - } - }, - - /** - * Set a reference to the PDF document and the URL in order - * to populate the overlay fields with the document properties. - * Note that the overlay will contain no information if this method - * is not called. - * - * @param {Object} pdfDocument - A reference to the PDF document. - * @param {string} url - The URL of the document. - */ - setDocumentAndUrl: - function PDFDocumentProperties_setDocumentAndUrl(pdfDocument, url) { - this.pdfDocument = pdfDocument; - this.url = url; - this.resolveDataAvailable(); - }, - - /** - * @private - */ - _getProperties: function PDFDocumentProperties_getProperties() { - if (!OverlayManager.active) { - // If the dialog was closed before dataAvailablePromise was resolved, - // don't bother updating the properties. - return; - } - // Get the file size (if it hasn't already been set). - this.pdfDocument.getDownloadInfo().then(function(data) { - if (data.length === this.rawFileSize) { - return; - } - this.setFileSize(data.length); - this._updateUI(this.fields['fileSize'], this._parseFileSize()); - }.bind(this)); - - // Get the document properties. - this.pdfDocument.getMetadata().then(function(data) { - var content = { - 'fileName': getPDFFileNameFromURL(this.url), - 'fileSize': this._parseFileSize(), - 'title': data.info.Title, - 'author': data.info.Author, - 'subject': data.info.Subject, - 'keywords': data.info.Keywords, - 'creationDate': this._parseDate(data.info.CreationDate), - 'modificationDate': this._parseDate(data.info.ModDate), - 'creator': data.info.Creator, - 'producer': data.info.Producer, - 'version': data.info.PDFFormatVersion, - 'pageCount': this.pdfDocument.numPages - }; - - // Show the properties in the dialog. - for (var identifier in content) { - this._updateUI(this.fields[identifier], content[identifier]); - } - }.bind(this)); - }, - - /** - * @private - */ - _updateUI: function PDFDocumentProperties_updateUI(field, content) { - if (field && content !== undefined && content !== '') { - field.textContent = content; - } - }, - - /** - * @private - */ - _parseFileSize: function PDFDocumentProperties_parseFileSize() { - var fileSize = this.rawFileSize, kb = fileSize / 1024; - if (!kb) { - return; - } else if (kb < 1024) { - return kb + ' KB ' + size_b + ' bytes'; - } else { - return (kb / 1024) + ' MB ' + size_b + ' bytes'; - } - }, - - /** - * @private - */ - _parseDate: function PDFDocumentProperties_parseDate(inputDate) { - // This is implemented according to the PDF specification, but note that - // Adobe Reader doesn't handle changing the date to universal time - // and doesn't use the user's time zone (they're effectively ignoring - // the HH' and mm' parts of the date string). - var dateToParse = inputDate; - if (dateToParse === undefined) { - return ''; - } - - // Remove the D: prefix if it is available. - if (dateToParse.substring(0,2) === 'D:') { - dateToParse = dateToParse.substring(2); - } - - // Get all elements from the PDF date string. - // JavaScript's Date object expects the month to be between - // 0 and 11 instead of 1 and 12, so we're correcting for this. - 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); - - // As per spec, utRel = 'Z' means equal to universal time. - // The other cases ('-' and '+') have to be handled here. - if (utRel === '-') { - hours += offsetHours; - minutes += offsetMinutes; - } else if (utRel === '+') { - hours -= offsetHours; - minutes -= offsetMinutes; - } - - // Return the new date format from the user's locale. - var date = new Date(Date.UTC(year, month, day, hours, minutes, seconds)); - var dateString = date.toLocaleDateString(); - var timeString = date.toLocaleTimeString(); - return dateString + ', ' + timeString; - } - }; - - return PDFDocumentProperties; -})(); - - -var PresentationModeState = { - UNKNOWN: 0, - NORMAL: 1, - CHANGING: 2, - FULLSCREEN: 3, -}; - -var IGNORE_CURRENT_POSITION_ON_ZOOM = false; -var DEFAULT_CACHE_SIZE = 10; - - -var CLEANUP_TIMEOUT = 30000; - -var RenderingStates = { - INITIAL: 0, - RUNNING: 1, - PAUSED: 2, - FINISHED: 3 -}; - -/** - * Controls rendering of the views for pages and thumbnails. - * @class - */ -var PDFRenderingQueue = (function PDFRenderingQueueClosure() { - /** - * @constructs - */ - function PDFRenderingQueue() { - this.pdfViewer = null; - this.pdfThumbnailViewer = null; - this.onIdle = null; - - this.highestPriorityPage = null; - this.idleTimeout = null; - this.printing = false; - this.isThumbnailViewEnabled = false; - } - - PDFRenderingQueue.prototype = /** @lends PDFRenderingQueue.prototype */ { - /** - * @param {PDFViewer} pdfViewer - */ - setViewer: function PDFRenderingQueue_setViewer(pdfViewer) { - this.pdfViewer = pdfViewer; - }, - - /** - * @param {PDFThumbnailViewer} pdfThumbnailViewer - */ - setThumbnailViewer: - function PDFRenderingQueue_setThumbnailViewer(pdfThumbnailViewer) { - this.pdfThumbnailViewer = pdfThumbnailViewer; - }, - - /** - * @param {IRenderableView} view - * @returns {boolean} - */ - isHighestPriority: function PDFRenderingQueue_isHighestPriority(view) { - return this.highestPriorityPage === view.renderingId; - }, - - renderHighestPriority: function - PDFRenderingQueue_renderHighestPriority(currentlyVisiblePages) { - if (this.idleTimeout) { - clearTimeout(this.idleTimeout); - this.idleTimeout = null; - } - - // Pages have a higher priority than thumbnails, so check them first. - if (this.pdfViewer.forceRendering(currentlyVisiblePages)) { - return; - } - // No pages needed rendering so check thumbnails. - if (this.pdfThumbnailViewer && this.isThumbnailViewEnabled) { - if (this.pdfThumbnailViewer.forceRendering()) { - return; - } - } - - if (this.printing) { - // If printing is currently ongoing do not reschedule cleanup. - return; - } - - if (this.onIdle) { - this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT); - } - }, - - getHighestPriority: function - PDFRenderingQueue_getHighestPriority(visible, views, scrolledDown) { - // The state has changed figure out which page has the highest priority to - // render next (if any). - // Priority: - // 1 visible pages - // 2 if last scrolled down page after the visible pages - // 2 if last scrolled up page before the visible pages - var visibleViews = visible.views; - - var numVisible = visibleViews.length; - if (numVisible === 0) { + if (!this.enabled) { return false; } - for (var i = 0; i < numVisible; ++i) { - var view = visibleViews[i].view; - if (!this.isViewFinished(view)) { - return view; - } + + var maxWidth = Math.floor(this.outerContainerWidth / 2); + + if (width > maxWidth) { + width = maxWidth; } - // All the visible views have rendered, try to render next/previous pages. - if (scrolledDown) { - var nextPageIndex = visible.last.id; - // ID's start at 1 so no need to add 1. - 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]; - } + if (width < SIDEBAR_MIN_WIDTH) { + width = SIDEBAR_MIN_WIDTH; } - // Everything that needs to be rendered has been. - return null; - }, - /** - * @param {IRenderableView} view - * @returns {boolean} - */ - isViewFinished: function PDFRenderingQueue_isViewFinished(view) { - return view.renderingState === RenderingStates.FINISHED; - }, - - /** - * Render a page or thumbnail view. This calls the appropriate function - * based on the views state. If the view is already rendered it will return - * false. - * @param {IRenderableView} view - */ - renderView: function PDFRenderingQueue_renderView(view) { - var state = view.renderingState; - switch (state) { - 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 () { - this.renderHighestPriority(); - }.bind(this); - view.draw().then(continueRendering, continueRendering); - break; + if (width === this._width) { + return false; } + + this._width = width; + this.doc.style.setProperty(SIDEBAR_WIDTH_VAR, "".concat(width, "px")); return true; - }, - }; + } + }, { + key: "_mouseMove", + value: function _mouseMove(evt) { + var width = evt.clientX; - return PDFRenderingQueue; -})(); + if (this.isRTL) { + width = this.outerContainerWidth - width; + } + + this._updateWidth(width); + } + }, { + key: "_mouseUp", + value: function _mouseUp(evt) { + this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS); + this.eventBus.dispatch('resize', { + source: this + }); + var _boundEvents = this._boundEvents; + window.removeEventListener('mousemove', _boundEvents.mouseMove); + window.removeEventListener('mouseup', _boundEvents.mouseUp); + } + }, { + 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) { + if (evt.button !== 0) { + return; + } + + _this2.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS); + + window.addEventListener('mousemove', _boundEvents.mouseMove); + window.addEventListener('mouseup', _boundEvents.mouseUp); + }); + 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); + } + } + } + }); + } + }, { + key: "outerContainerWidth", + get: function get() { + if (!this._outerContainerWidth) { + this._outerContainerWidth = this.outerContainer.clientWidth; + } + + return this._outerContainerWidth; + } + }]); + + return PDFSidebarResizer; +}(); + +exports.PDFSidebarResizer = PDFSidebarResizer; + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -var TEXT_LAYER_RENDER_DELAY = 200; // ms +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFThumbnailViewer = void 0; -/** - * @typedef {Object} PDFPageViewOptions - * @property {HTMLDivElement} container - The viewer element. - * @property {number} id - The page unique ID (normally its number). - * @property {number} scale - The page scale display. - * @property {PageViewport} defaultViewport - The page viewport. - * @property {PDFRenderingQueue} renderingQueue - The rendering queue object. - * @property {IPDFTextLayerFactory} textLayerFactory - * @property {IPDFAnnotationLayerFactory} annotationLayerFactory - */ +var _ui_utils = __webpack_require__(6); -/** - * @class - * @implements {IRenderableView} - */ -var PDFPageView = (function PDFPageViewClosure() { - /** - * @constructs PDFPageView - * @param {PDFPageViewOptions} options - */ - function PDFPageView(options) { - var container = options.container; - var id = options.id; - var scale = options.scale; - var defaultViewport = options.defaultViewport; - var renderingQueue = options.renderingQueue; - var textLayerFactory = options.textLayerFactory; - var annotationLayerFactory = options.annotationLayerFactory; +var _pdf_thumbnail_view = __webpack_require__(27); - this.id = id; - this.renderingId = 'page' + id; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - this.rotation = 0; - this.scale = scale || DEFAULT_SCALE; - this.viewport = defaultViewport; - this.pdfPageRotate = defaultViewport.rotation; - this.hasRestrictedScaling = false; +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 PDFThumbnailViewer = +/*#__PURE__*/ +function () { + function PDFThumbnailViewer(_ref) { + var container = _ref.container, + linkService = _ref.linkService, + renderingQueue = _ref.renderingQueue, + _ref$l10n = _ref.l10n, + l10n = _ref$l10n === void 0 ? _ui_utils.NullL10n : _ref$l10n; + + _classCallCheck(this, PDFThumbnailViewer); + + this.container = container; + this.linkService = linkService; this.renderingQueue = renderingQueue; - this.textLayerFactory = textLayerFactory; - this.annotationLayerFactory = annotationLayerFactory; + this.l10n = l10n; + this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdated.bind(this)); - this.renderingState = RenderingStates.INITIAL; - this.resume = null; - - this.onBeforeDraw = null; - this.onAfterDraw = null; - - this.textLayer = null; - - this.zoomLayer = null; - - this.annotationLayer = null; - - var div = document.createElement('div'); - div.id = 'pageContainer' + this.id; - 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); + this._resetView(); } - PDFPageView.prototype = { - setPdfPage: function PDFPageView_setPdfPage(pdfPage) { + _createClass(PDFThumbnailViewer, [{ + key: "_scrollUpdated", + value: function _scrollUpdated() { + this.renderingQueue.renderHighestPriority(); + } + }, { + key: "getThumbnail", + value: function getThumbnail(index) { + return this._thumbnails[index]; + } + }, { + key: "_getVisibleThumbs", + value: function _getVisibleThumbs() { + return (0, _ui_utils.getVisibleElements)(this.container, this._thumbnails); + } + }, { + 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 { + visibleThumbs.views.some(function (view) { + if (view.id !== pageNumber) { + return false; + } + + shouldScroll = view.percent < 100; + return true; + }); + } + + if (shouldScroll) { + (0, _ui_utils.scrollIntoView)(thumbnailView.div, { + top: THUMBNAIL_SCROLL_MARGIN + }); + } + } + + this._currentPageNumber = pageNumber; + } + }, { + key: "cleanup", + value: function cleanup() { + _pdf_thumbnail_view.PDFThumbnailView.cleanup(); + } + }, { + key: "_resetView", + value: function _resetView() { + this._thumbnails = []; + this._currentPageNumber = 1; + this._pageLabels = null; + this._pagesRotation = 0; + this._pagesRequests = []; + this.container.textContent = ''; + } + }, { + 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) { + var pagesCount = pdfDocument.numPages; + var viewport = firstPage.getViewport({ + scale: 1 + }); + + for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { + var thumbnail = new _pdf_thumbnail_view.PDFThumbnailView({ + container: _this.container, + id: pageNum, + defaultViewport: viewport.clone(), + linkService: _this.linkService, + renderingQueue: _this.renderingQueue, + disableCanvasToImageConversion: false, + l10n: _this.l10n + }); + + _this._thumbnails.push(thumbnail); + } + + 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); + }); + } + }, { + key: "_cancelRendering", + value: function _cancelRendering() { + for (var i = 0, ii = this._thumbnails.length; i < ii; i++) { + if (this._thumbnails[i]) { + this._thumbnails[i].cancelRendering(); + } + } + } + }, { + 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.'); + } 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", + 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]; + } + + var promise = this.pdfDocument.getPage(pageNumber).then(function (pdfPage) { + thumbView.setPdfPage(pdfPage); + _this2._pagesRequests[pageNumber] = null; + return pdfPage; + }).catch(function (reason) { + console.error('Unable to get page for thumb view', reason); + _this2._pagesRequests[pageNumber] = null; + }); + this._pagesRequests[pageNumber] = promise; + return promise; + } + }, { + 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", + get: function get() { + return this._pagesRotation; + }, + set: function set(rotation) { + if (!(0, _ui_utils.isValidRotation)(rotation)) { + 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); + } + } + }]); + + return PDFThumbnailViewer; +}(); + +exports.PDFThumbnailViewer = PDFThumbnailViewer; + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFThumbnailView = void 0; + +var _pdfjsLib = __webpack_require__(7); + +var _ui_utils = __webpack_require__(6); + +var _pdf_rendering_queue = __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 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'); + tempCanvasCache = tempCanvas; + } + + tempCanvas.width = width; + tempCanvas.height = height; + tempCanvas.mozOpaque = true; + var ctx = tempCanvas.getContext('2d', { + alpha: false + }); + ctx.save(); + 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 = +/*#__PURE__*/ +function () { + function PDFThumbnailView(_ref) { + var container = _ref.container, + id = _ref.id, + defaultViewport = _ref.defaultViewport, + linkService = _ref.linkService, + renderingQueue = _ref.renderingQueue, + _ref$disableCanvasToI = _ref.disableCanvasToImageConversion, + disableCanvasToImageConversion = _ref$disableCanvasToI === void 0 ? false : _ref$disableCanvasToI, + _ref$l10n = _ref.l10n, + l10n = _ref$l10n === void 0 ? _ui_utils.NullL10n : _ref$l10n; + + _classCallCheck(this, PDFThumbnailView); + + this.id = id; + this.renderingId = 'thumbnail' + id; + this.pageLabel = null; + this.pdfPage = null; + this.rotation = 0; + this.viewport = defaultViewport; + this.pdfPageRotate = defaultViewport.rotation; + this.linkService = linkService; + this.renderingQueue = renderingQueue; + this.renderTask = null; + this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; + this.resume = null; + this.disableCanvasToImageConversion = disableCanvasToImageConversion; + this.pageWidth = this.viewport.width; + this.pageHeight = this.viewport.height; + this.pageRatio = this.pageWidth / this.pageHeight; + this.canvasWidth = THUMBNAIL_WIDTH; + 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) { + 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); + this.div = div; + 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'; + this.ring = ring; + div.appendChild(ring); + anchor.appendChild(div); + container.appendChild(anchor); + } + + _createClass(PDFThumbnailView, [{ + 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 * CSS_UNITS, - totalRotation); - this.stats = pdfPage.stats; + this.viewport = pdfPage.getViewport({ + scale: 1, + rotation: totalRotation + }); this.reset(); - }, + } + }, { + key: "reset", + value: function reset() { + this.cancelRendering(); + 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'); + var ring = this.ring; + var childNodes = ring.childNodes; - destroy: function PDFPageView_destroy() { - this.zoomLayer = null; - this.reset(); - if (this.pdfPage) { - this.pdfPage.cleanup(); - } - }, - - reset: function PDFPageView_reset(keepZoomLayer, keepAnnotations) { - if (this.renderTask) { - this.renderTask.cancel(); - } - this.resume = null; - this.renderingState = RenderingStates.INITIAL; - - var div = this.div; - 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'); - - if (currentAnnotationNode) { - // Hide annotationLayer until all elements are resized - // so they are not displayed on the already-resized page - this.annotationLayer.hide(); - } else { - this.annotationLayer = null; + ring.removeChild(childNodes[i]); } - if (this.canvas && !currentZoomLayerNode) { - // Zeroing the width and height causes Firefox to release graphics - // resources immediately, which can greatly reduce memory consumption. + var borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH; + 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'); + delete this.image; + } + } + }, { + key: "update", + value: function update(rotation) { + if (typeof rotation !== 'undefined') { + this.rotation = rotation; + } + + var totalRotation = (this.rotation + this.pdfPageRotate) % 360; + this.viewport = this.viewport.clone({ + scale: 1, + rotation: totalRotation + }); + this.reset(); + } + }, { + 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", + value: function _getPageDrawContext() { + var noCtxScale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var canvas = document.createElement('canvas'); + this.canvas = canvas; + canvas.mozOpaque = true; + 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'; + + if (!noCtxScale && outputScale.scaled) { + ctx.scale(outputScale.sx, outputScale.sy); + } + + return ctx; + } + }, { + 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'; + + 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.div.setAttribute('data-loaded', true); + this.ring.appendChild(this.canvas); + return; + } + + var image = document.createElement('img'); + image.id = id; + image.className = className; + this.l10n.get('thumb_page_canvas', { + page: this.pageId + }, 'Thumbnail of Page {{page}}').then(function (msg) { + image.setAttribute('aria-label', msg); + }); + 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.ring.appendChild(image); + this.canvas.width = 0; + this.canvas.height = 0; + delete this.canvas; + } + }, { + 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'); + return Promise.resolve(undefined); + } + + 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 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); + renderTask.onContinue = renderContinueCallback; + renderTask.promise.then(function () { + finishRenderTask(null); + }, function (error) { + finishRenderTask(error); + }); + return renderCapability.promise; + } + }, { + 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'); + + 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", + 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) { + _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) { + if (_this3.image) { + _this3.image.setAttribute('aria-label', ariaLabel); + } else if (_this3.disableCanvasToImageConversion && _this3.canvas) { + _this3.canvas.setAttribute('aria-label', ariaLabel); + } + }); + } + }, { + key: "pageId", + get: function get() { + return this.pageLabel !== null ? this.pageLabel : this.id; + } + }], [{ + key: "cleanup", + value: function cleanup() { + TempImageFactory.destroyCanvas(); + } + }]); + + return PDFThumbnailView; +}(); + +exports.PDFThumbnailView = PDFThumbnailView; + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFViewer = void 0; + +var _base_viewer = __webpack_require__(29); + +var _pdfjsLib = __webpack_require__(7); + +function _typeof(obj) { 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; } + +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 _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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +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); } + +var PDFViewer = +/*#__PURE__*/ +function (_BaseViewer) { + _inherits(PDFViewer, _BaseViewer); + + function PDFViewer() { + _classCallCheck(this, PDFViewer); + + return _possibleConstructorReturn(this, _getPrototypeOf(PDFViewer).apply(this, arguments)); + } + + _createClass(PDFViewer, [{ + key: "_scrollIntoView", + value: function _scrollIntoView(_ref) { + var pageDiv = _ref.pageDiv, + _ref$pageSpot = _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 _this$container = this.container, + scrollLeft = _this$container.scrollLeft, + clientWidth = _this$container.clientWidth; + + if (this._isScrollModeHorizontal || left < scrollLeft || right > scrollLeft + clientWidth) { + pageSpot = { + left: 0, + top: 0 + }; + } + } + + _get(_getPrototypeOf(PDFViewer.prototype), "_scrollIntoView", this).call(this, { + pageDiv: pageDiv, + pageSpot: pageSpot, + pageNumber: pageNumber + }); + } + }, { + key: "_getVisiblePages", + value: function _getVisiblePages() { + if (this.isInPresentationMode) { + return this._getCurrentVisiblePage(); + } + + return _get(_getPrototypeOf(PDFViewer.prototype), "_getVisiblePages", this).call(this); + } + }, { + key: "_updateHelper", + value: function _updateHelper(visiblePages) { + if (this.isInPresentationMode) { + return; + } + + var currentId = this._currentPageNumber; + var stillFullyVisible = false; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = visiblePages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var page = _step.value; + + if (page.percent < 100) { + break; + } + + if (page.id === currentId) { + stillFullyVisible = true; + break; + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return != null) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + if (!stillFullyVisible) { + currentId = visiblePages[0].id; + } + + this._setCurrentPageNumber(currentId); + } + }, { + key: "_setDocumentViewerElement", + get: function get() { + return (0, _pdfjsLib.shadow)(this, '_setDocumentViewerElement', this.viewer); + } + }]); + + return PDFViewer; +}(_base_viewer.BaseViewer); + +exports.PDFViewer = PDFViewer; + +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.BaseViewer = void 0; + +var _ui_utils = __webpack_require__(6); + +var _pdf_rendering_queue = __webpack_require__(10); + +var _annotation_layer_builder = __webpack_require__(30); + +var _pdfjsLib = __webpack_require__(7); + +var _pdf_page_view = __webpack_require__(31); + +var _pdf_link_service = __webpack_require__(22); + +var _text_layer_builder = __webpack_require__(32); + +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_CACHE_SIZE = 10; + +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 = +/*#__PURE__*/ +function () { + function BaseViewer(options) { + var _this = this; + + _classCallCheck(this, BaseViewer); + + if (this.constructor === 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, _ui_utils.getGlobalEventBus)(); + 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.renderInteractiveForms = options.renderInteractiveForms || false; + this.enablePrintAutoRotate = options.enablePrintAutoRotate || false; + this.renderer = options.renderer || _ui_utils.RendererType.CANVAS; + this.enableWebGL = options.enableWebGL || false; + this.useOnlyCssZoom = options.useOnlyCssZoom || false; + 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._resetView(); + + if (this.removePageBorders) { + this.viewer.classList.add('removePageBorders'); + } + + Promise.resolve().then(function () { + _this.eventBus.dispatch('baseviewerinit', { + source: _this + }); + }); + } + + _createClass(BaseViewer, [{ + key: "getPageView", + value: function getPageView(index) { + return this._pages[index]; + } + }, { + key: "_setCurrentPageNumber", + value: function _setCurrentPageNumber(val) { + var resetCurrentPageView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + if (this._currentPageNumber === val) { + if (resetCurrentPageView) { + this._resetCurrentPageView(); + } + + return true; + } + + if (!(0 < val && val <= this.pagesCount)) { + return false; + } + + this._currentPageNumber = val; + this.eventBus.dispatch('pagechanging', { + source: this, + pageNumber: val, + pageLabel: this._pageLabels && this._pageLabels[val - 1] + }); + + if (resetCurrentPageView) { + this._resetCurrentPageView(); + } + + return true; + } + }, { + 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', { + source: _this2, + pagesCount: pagesCount + }); + }); + 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 (!onePageRenderedCapability.settled) { + onePageRenderedCapability.resolve(); + } + }; + }; + + var firstPagePromise = pdfDocument.getPage(1); + this.firstPagePromise = firstPagePromise; + firstPagePromise.then(function (pdfPage) { + var scale = _this2.currentScale; + var viewport = pdfPage.getViewport({ + scale: scale * _ui_utils.CSS_UNITS + }); + + 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, + eventBus: _this2.eventBus, + id: pageNum, + scale: scale, + defaultViewport: viewport.clone(), + renderingQueue: _this2.renderingQueue, + textLayerFactory: textLayerFactory, + textLayerMode: _this2.textLayerMode, + annotationLayerFactory: _this2, + imageResourcesPath: _this2.imageResourcesPath, + renderInteractiveForms: _this2.renderInteractiveForms, + renderer: _this2.renderer, + enableWebGL: _this2.enableWebGL, + useOnlyCssZoom: _this2.useOnlyCssZoom, + maxCanvasPixels: _this2.maxCanvasPixels, + l10n: _this2.l10n + }); + bindOnAfterAndBeforeDraw(pageView); + + _this2._pages.push(pageView); + } + + if (_this2._spreadMode !== _ui_utils.SpreadMode.NONE) { + _this2._updateSpreadMode(); + } + + onePageRenderedCapability.promise.then(function () { + if (pdfDocument.loadingParams['disableAutoFetch']) { + 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(); + } + }, function (reason) { + console.error("Unable to get page ".concat(_pageNum, " to initialize viewer"), reason); + + if (--getPagesLeft === 0) { + pagesCapability.resolve(); + } + }); + }; + + for (var _pageNum = 1; _pageNum <= pagesCount; ++_pageNum) { + _loop(_pageNum); + } + }); + + _this2.eventBus.dispatch('pagesinit', { + source: _this2 + }); + + if (_this2.findController) { + _this2.findController.setDocument(pdfDocument); + } + + if (_this2.defaultRenderingQueue) { + _this2.update(); + } + }).catch(function (reason) { + console.error('Unable to initialize viewer', reason); + }); + } + }, { + 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("".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]; + pageView.setPageLabel(label); + } + } + }, { + key: "_resetView", + value: function _resetView() { + this._pages = []; + this._currentPageNumber = 1; + this._currentScale = _ui_utils.UNKNOWN_SCALE; + this._currentScaleValue = null; + this._pageLabels = null; + this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE); + this._location = null; + this._pagesRotation = 0; + this._pagesRequests = []; + this._pageViewsReady = false; + this._scrollMode = _ui_utils.ScrollMode.VERTICAL; + this._spreadMode = _ui_utils.SpreadMode.NONE; + this.viewer.textContent = ''; + + this._updateScrollMode(); + } + }, { + key: "_scrollUpdate", + value: function _scrollUpdate() { + if (this.pagesCount === 0) { + return; + } + + this.update(); + } + }, { + key: "_scrollIntoView", + value: function _scrollIntoView(_ref) { + var pageDiv = _ref.pageDiv, + _ref$pageSpot = _ref.pageSpot, + pageSpot = _ref$pageSpot === void 0 ? null : _ref$pageSpot, + _ref$pageNumber = _ref.pageNumber, + pageNumber = _ref$pageNumber === void 0 ? null : _ref$pageNumber; + (0, _ui_utils.scrollIntoView)(pageDiv, pageSpot); + } + }, { + 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.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; + + if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) { + page = this._location.pageNumber; + dest = [null, { + name: 'XYZ' + }, this._location.left, this._location.top, null]; + } + + this.scrollPageIntoView({ + pageNumber: page, + destArray: dest, + allowNegativeOffset: true + }); + } + + this.eventBus.dispatch('scalechanging', { + source: this, + scale: newScale, + presetValue: preset ? newValue : undefined + }); + + if (this.defaultRenderingQueue) { + this.update(); + } + } + }, { + 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': + scale = 1; + break; + + case 'page-width': + scale = pageWidthScale; + break; + + case 'page-height': + scale = pageHeightScale; + break; + + case 'page-fit': + scale = Math.min(pageWidthScale, pageHeightScale); + break; + + 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("".concat(this._name, "._setScale: \"").concat(value, "\" is an unknown zoom value.")); + return; + } + + this._setScaleUpdatePages(scale, value, noScroll, true); + } + } + }, { + 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 + }); + } + }, { + 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; + + if (!this.pdfDocument) { + return; + } + + 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; + } + + if (this.isInPresentationMode || !destArray) { + this._setCurrentPageNumber(pageNumber, true); + + return; + } + + var x = 0, + y = 0; + var width = 0, + height = 0, + widthScale, + heightScale; + var changeOrientation = pageView.rotation % 180 === 0 ? false : true; + 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 (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'; + break; + + 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 = destArray[2]; + width = pageWidth; + height = pageHeight; + scale = 'page-height'; + break; + + 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("".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 (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: { + left: left, + top: top + }, + pageNumber: pageNumber + }); + } + }, { + 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 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; + this._location = { + pageNumber: pageNumber, + scale: normalizedScaleValue, + top: intTop, + left: intLeft, + rotation: this._pagesRotation, + pdfOpenParams: pdfOpenParams + }; + } + }, { + key: "_updateHelper", + value: function _updateHelper(visiblePages) { + throw new Error('Not implemented: _updateHelper'); + } + }, { + key: "update", + value: function 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", + value: function containsElement(element) { + return this.container.contains(element); + } + }, { + key: "focus", + value: function focus() { + this.container.focus(); + } + }, { + 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() { + return (0, _ui_utils.getVisibleElements)(this.container, this._pages, true, this._isScrollModeHorizontal); + } + }, { + key: "isPageVisible", + value: function isPageVisible(pageNumber) { + if (!this.pdfDocument) { + return false; + } + + if (this.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", + 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) { + this._pages[i].reset(); + } + } + } + }, { + key: "_cancelRendering", + value: function _cancelRendering() { + for (var i = 0, ii = this._pages.length; i < ii; i++) { + if (this._pages[i]) { + this._pages[i].cancelRendering(); + } + } + } + }, { + 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]; + } + + var promise = this.pdfDocument.getPage(pageNumber).then(function (pdfPage) { + if (!pageView.pdfPage) { + pageView.setPdfPage(pdfPage); + } + + _this3._pagesRequests[pageNumber] = null; + return pdfPage; + }).catch(function (reason) { + console.error('Unable to get page for page view', reason); + _this3._pagesRequests[pageNumber] = null; + }); + this._pagesRequests[pageNumber] = promise; + return promise; + } + }, { + 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", + value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) { + var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + return new _text_layer_builder.TextLayerBuilder({ + textLayerDiv: textLayerDiv, + eventBus: this.eventBus, + pageIndex: pageIndex, + viewport: viewport, + findController: this.isInPresentationMode ? null : this.findController, + enhanceTextSelection: this.isInPresentationMode ? false : enhanceTextSelection + }); + } + }, { + key: "createAnnotationLayerBuilder", + value: function createAnnotationLayerBuilder(pageDiv, pdfPage) { + 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, + imageResourcesPath: imageResourcesPath, + renderInteractiveForms: renderInteractiveForms, + linkService: this.linkService, + downloadManager: this.downloadManager, + l10n: l10n + }); + } + }, { + key: "getPagesOverview", + value: function getPagesOverview() { + var pagesOverview = this._pages.map(function (pageView) { + 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, + rotation: (size.rotation + 90) % 360 + }; + }); + } + }, { + 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 === _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._setCurrentPageNumber(pageNumber, true); + + this.update(); + } + }, { + 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 === _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'; + viewer.appendChild(spread); + } else if (_i % 2 === parity) { + spread = spread.cloneNode(false); + viewer.appendChild(spread); + } + + spread.appendChild(pages[_i].div); + } + } + + if (!pageNumber) { + return; + } + + this._setCurrentPageNumber(pageNumber, true); + + this.update(); + } + }, { + key: "pagesCount", + get: function get() { + return this._pages.length; + } + }, { + key: "pageViewsReady", + get: function get() { + return this._pageViewsReady; + } + }, { + key: "currentPageNumber", + get: function get() { + return this._currentPageNumber; + }, + set: function set(val) { + if (!Number.isInteger(val)) { + throw new Error('Invalid page number.'); + } + + if (!this.pdfDocument) { + return; + } + + if (!this._setCurrentPageNumber(val, true)) { + console.error("".concat(this._name, ".currentPageNumber: \"").concat(val, "\" is not a valid page.")); + } + } + }, { + key: "currentPageLabel", + get: function get() { + return this._pageLabels && this._pageLabels[this._currentPageNumber - 1]; + }, + set: function set(val) { + if (!this.pdfDocument) { + return; + } + + var page = val | 0; + + if (this._pageLabels) { + var i = this._pageLabels.indexOf(val); + + if (i >= 0) { + page = i + 1; + } + } + + if (!this._setCurrentPageNumber(page, true)) { + console.error("".concat(this._name, ".currentPageLabel: \"").concat(val, "\" is not a valid page.")); + } + } + }, { + 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.'); + } + + if (!this.pdfDocument) { + return; + } + + this._setScale(val, false); + } + }, { + key: "currentScaleValue", + get: function get() { + return this._currentScaleValue; + }, + set: function set(val) { + if (!this.pdfDocument) { + return; + } + + this._setScale(val, false); + } + }, { + 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.'); + } + + 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', { + source: this, + pagesRotation: rotation, + pageNumber: pageNumber + }); + + if (this.defaultRenderingQueue) { + this.update(); + } + } + }, { + key: "_setDocumentViewerElement", + get: function get() { + throw new Error('Not implemented: _setDocumentViewerElement'); + } + }, { + 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", + get: function get() { + return this.presentationModeState === _ui_utils.PresentationModeState.CHANGING; + } + }, { + key: "isHorizontalScrollbarEnabled", + get: function get() { + return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth; + } + }, { + key: "isVerticalScrollbarEnabled", + get: function get() { + return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight; + } + }, { + 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", + get: function get() { + return this._scrollMode; + }, + set: function set(mode) { + if (this._scrollMode === mode) { + return; + } + + if (!(0, _ui_utils.isValidScrollMode)(mode)) { + throw new Error("Invalid scroll mode: ".concat(mode)); + } + + this._scrollMode = mode; + this.eventBus.dispatch('scrollmodechanged', { + source: this, + mode: mode + }); + + this._updateScrollMode(this._currentPageNumber); + } + }, { + key: "spreadMode", + get: function get() { + return this._spreadMode; + }, + set: function set(mode) { + if (this._spreadMode === mode) { + return; + } + + if (!(0, _ui_utils.isValidSpreadMode)(mode)) { + throw new Error("Invalid spread mode: ".concat(mode)); + } + + this._spreadMode = mode; + this.eventBus.dispatch('spreadmodechanged', { + source: this, + mode: mode + }); + + this._updateSpreadMode(this._currentPageNumber); + } + }]); + + return BaseViewer; +}(); + +exports.BaseViewer = BaseViewer; + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = void 0; + +var _pdfjsLib = __webpack_require__(7); + +var _ui_utils = __webpack_require__(6); + +var _pdf_link_service = __webpack_require__(22); + +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 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 === void 0 ? '' : _ref$imageResourcesPa, + _ref$renderInteractiv = _ref.renderInteractiveForms, + renderInteractiveForms = _ref$renderInteractiv === void 0 ? false : _ref$renderInteractiv, + _ref$l10n = _ref.l10n, + l10n = _ref$l10n === void 0 ? _ui_utils.NullL10n : _ref$l10n; + + _classCallCheck(this, AnnotationLayerBuilder); + + this.pageDiv = pageDiv; + this.pdfPage = pdfPage; + this.linkService = linkService; + this.downloadManager = downloadManager; + this.imageResourcesPath = imageResourcesPath; + this.renderInteractiveForms = renderInteractiveForms; + this.l10n = l10n; + this.div = null; + this._cancelled = false; + } + + _createClass(AnnotationLayerBuilder, [{ + 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) { + if (_this._cancelled) { + return; + } + + var parameters = { + viewport: viewport.clone({ + dontFlip: true + }), + div: _this.div, + annotations: annotations, + page: _this.pdfPage, + imageResourcesPath: _this.imageResourcesPath, + renderInteractiveForms: _this.renderInteractiveForms, + 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.pageDiv.appendChild(_this.div); + + parameters.div = _this.div; + + _pdfjsLib.AnnotationLayer.render(parameters); + + _this.l10n.translate(_this.div); + } + }); + } + }, { + key: "cancel", + value: function cancel() { + this._cancelled = true; + } + }, { + key: "hide", + value: function hide() { + if (!this.div) { + return; + } + + this.div.setAttribute('hidden', 'true'); + } + }]); + + return AnnotationLayerBuilder; +}(); + +exports.AnnotationLayerBuilder = AnnotationLayerBuilder; + +var DefaultAnnotationLayerFactory = +/*#__PURE__*/ +function () { + function DefaultAnnotationLayerFactory() { + _classCallCheck(this, DefaultAnnotationLayerFactory); + } + + _createClass(DefaultAnnotationLayerFactory, [{ + key: "createAnnotationLayerBuilder", + value: function createAnnotationLayerBuilder(pageDiv, pdfPage) { + 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, + imageResourcesPath: imageResourcesPath, + renderInteractiveForms: renderInteractiveForms, + linkService: new _pdf_link_service.SimpleLinkService(), + l10n: l10n + }); + } + }]); + + return DefaultAnnotationLayerFactory; +}(); + +exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory; + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFPageView = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +var _ui_utils = __webpack_require__(6); + +var _pdfjsLib = __webpack_require__(7); + +var _pdf_rendering_queue = __webpack_require__(10); + +var _viewer_compatibility = __webpack_require__(13); + +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 MAX_CANVAS_PIXELS = _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels || 16777216; + +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.pdfPage = null; + this.pageLabel = null; + this.rotation = 0; + this.scale = options.scale || _ui_utils.DEFAULT_SCALE; + this.viewport = defaultViewport; + this.pdfPageRotate = defaultViewport.rotation; + this.hasRestrictedScaling = false; + this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE; + 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, _ui_utils.getGlobalEventBus)(); + this.renderingQueue = options.renderingQueue; + this.textLayerFactory = options.textLayerFactory; + this.annotationLayerFactory = options.annotationLayerFactory; + this.renderer = options.renderer || _ui_utils.RendererType.CANVAS; + this.enableWebGL = options.enableWebGL || false; + this.l10n = options.l10n || _ui_utils.NullL10n; + this.paintTask = null; + this.paintedViewportMap = new WeakMap(); + 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); + this.div = div; + container.appendChild(div); + } + + _createClass(PDFPageView, [{ + key: "setPdfPage", + value: function setPdfPage(pdfPage) { + this.pdfPage = pdfPage; + this.pdfPageRotate = pdfPage.rotate; + var totalRotation = (this.rotation + this.pdfPageRotate) % 360; + this.viewport = pdfPage.getViewport({ + scale: this.scale * _ui_utils.CSS_UNITS, + rotation: totalRotation + }); + this.stats = pdfPage.stats; + this.reset(); + } + }, { + key: "destroy", + value: function destroy() { + this.reset(); + + if (this.pdfPage) { + this.pdfPage.cleanup(); + } + } + }, { + 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); + zoomLayerCanvas.width = 0; + zoomLayerCanvas.height = 0; + + if (removeFromDOM) { + this.zoomLayer.remove(); + } + + this.zoomLayer = null; + } + }, { + 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); + var div = this.div; + 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'); + + 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.canvas.width = 0; + this.canvas.height = 0; + delete this.canvas; + } + + this._resetZoomLayer(); + } + + if (this.svg) { + this.paintedViewportMap.delete(this.svg); + delete this.svg; + } + this.loadingIconDiv = document.createElement('div'); this.loadingIconDiv.className = 'loadingIcon'; div.appendChild(this.loadingIconDiv); - }, - - update: function PDFPageView_update(scale, rotation) { + } + }, { + key: "update", + value: function update(scale, rotation) { this.scale = scale || this.scale; if (typeof rotation !== 'undefined') { @@ -3658,189 +11662,370 @@ var PDFPageView = (function PDFPageViewClosure() { var totalRotation = (this.rotation + this.pdfPageRotate) % 360; this.viewport = this.viewport.clone({ - scale: this.scale * CSS_UNITS, + scale: this.scale * _ui_utils.CSS_UNITS, rotation: totalRotation }); + if (this.svg) { + this.cssTransform(this.svg, true); + this.eventBus.dispatch('pagerendered', { + source: this, + pageNumber: this.id, + cssTransform: true + }); + return; + } + var isScalingRestricted = false; - if (this.canvas && PDFJS.maxCanvasPixels > 0) { + + if (this.canvas && this.maxCanvasPixels > 0) { var outputScale = this.outputScale; - var pixelsInViewport = this.viewport.width * this.viewport.height; - var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport); - if (((Math.floor(this.viewport.width) * outputScale.sx) | 0) * - ((Math.floor(this.viewport.height) * outputScale.sy) | 0) > - PDFJS.maxCanvasPixels) { + + 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 (PDFJS.useOnlyCssZoom || - (this.hasRestrictedScaling && isScalingRestricted)) { + if (this.useOnlyCssZoom || this.hasRestrictedScaling && isScalingRestricted) { this.cssTransform(this.canvas, true); - - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('pagerendered', true, true, { + this.eventBus.dispatch('pagerendered', { + source: this, pageNumber: this.id, - cssTransform: true, + cssTransform: true }); - this.div.dispatchEvent(event); - return; } - if (!this.zoomLayer) { + + if (!this.zoomLayer && !this.canvas.hasAttribute('hidden')) { this.zoomLayer = this.canvas.parentNode; this.zoomLayer.style.position = 'absolute'; } } + if (this.zoomLayer) { this.cssTransform(this.zoomLayer.firstChild); } - this.reset(/* keepZoomLayer = */ true, /* keepAnnotations = */ true); - }, - /** - * Called when moved in the parent's container. - */ - updatePosition: function PDFPageView_updatePosition() { - if (this.textLayer) { - this.textLayer.render(TEXT_LAYER_RENDER_DELAY); + this.reset(true, true); + } + }, { + 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; } - }, - cssTransform: function PDFPageView_transform(canvas, redrawAnnotations) { - var CustomStyle = PDFJS.CustomStyle; + this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; + this.resume = null; - // Scale canvas, canvas wrapper, and page container. + 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", + 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; - canvas.style.width = canvas.parentNode.style.width = div.style.width = - Math.floor(width) + 'px'; - canvas.style.height = canvas.parentNode.style.height = div.style.height = - Math.floor(height) + 'px'; - // The canvas may have been originally rotated, rotate relative to that. - var relativeRotation = this.viewport.rotation - canvas._viewport.rotation; + 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; + var scaleX = 1, + scaleY = 1; + if (absRotation === 90 || absRotation === 270) { - // Scale x and y because of the rotation. scaleX = height / width; scaleY = width / height; } - var cssTransform = 'rotate(' + relativeRotation + 'deg) ' + - 'scale(' + scaleX + ',' + scaleY + ')'; - CustomStyle.setProp('transform', canvas, cssTransform); + + var cssTransform = 'rotate(' + relativeRotation + 'deg) ' + 'scale(' + scaleX + ',' + scaleY + ')'; + target.style.transform = cssTransform; if (this.textLayer) { - // Rotating the text layer is more complicated since the divs inside the - // the text layer are rotated. - // TODO: This could probably be simplified by drawing the text layer in - // one orientation then rotating overall. var textLayerViewport = this.textLayer.viewport; - var textRelativeRotation = this.viewport.rotation - - textLayerViewport.rotation; + 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, transY; + switch (textAbsRotation) { case 0: transX = transY = 0; break; + case 90: transX = 0; transY = '-' + textLayerDiv.style.height; break; + case 180: transX = '-' + textLayerDiv.style.width; transY = '-' + textLayerDiv.style.height; break; + case 270: transX = '-' + textLayerDiv.style.width; transY = 0; break; + default: console.error('Bad rotation value.'); break; } - CustomStyle.setProp('transform', textLayerDiv, - 'rotate(' + textAbsRotation + 'deg) ' + - 'scale(' + scale + ', ' + scale + ') ' + - 'translate(' + transX + ', ' + transY + ')'); - CustomStyle.setProp('transformOrigin', textLayerDiv, '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'); } - }, - - get width() { - return this.viewport.width; - }, - - get height() { - return this.viewport.height; - }, - - getPagePoint: function PDFPageView_getPagePoint(x, y) { + } + }, { + key: "getPagePoint", + value: function getPagePoint(x, y) { return this.viewport.convertToPdfPoint(x, y); - }, + } + }, { + key: "draw", + value: function draw() { + var _this = this; - draw: function PDFPageView_draw() { - if (this.renderingState !== RenderingStates.INITIAL) { + if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) { console.error('Must be in new state before drawing'); + this.reset(); } - this.renderingState = RenderingStates.RUNNING; + if (!this.pdfPage) { + this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; + return Promise.reject(new Error('Page is not loaded')); + } + this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING; var pdfPage = this.pdfPage; - var viewport = this.viewport; var div = this.div; - // Wrap the canvas so if it has a css transform for highdpi the overflow - // will be hidden in FF. var canvasWrapper = document.createElement('div'); canvasWrapper.style.width = div.style.width; canvasWrapper.style.height = div.style.height; canvasWrapper.classList.add('canvasWrapper'); - var canvas = document.createElement('canvas'); - canvas.id = 'page' + this.id; - // Keep the canvas hidden until the first draw callback, or until drawing - // is complete when `!this.renderingQueue`, to prevent black flickering. - canvas.setAttribute('hidden', 'hidden'); - var isCanvasHidden = true; - - canvasWrapper.appendChild(canvas); if (this.annotationLayer && this.annotationLayer.div) { - // annotationLayer needs to stay on top div.insertBefore(canvasWrapper, this.annotationLayer.div); } else { div.appendChild(canvasWrapper); } - this.canvas = canvas; + var textLayer = null; + + if (this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && this.textLayerFactory) { + 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); + } + + 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 = + /*#__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; + + if (_this.onAfterDraw) { + _this.onAfterDraw(); + } + + _this.eventBus.dispatch('pagerendered', { + source: _this, + pageNumber: _this.id, + cssTransform: false + }); + + if (!error) { + _context.next = 13; + break; + } + + throw error; + + case 13: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + 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 + }); + textLayer.setTextContentStream(readableStream); + textLayer.render(); + } + }); + }, 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(); + } + + return resultPromise; + } + }, { + key: "paintOnCanvas", + value: function paintOnCanvas(canvasWrapper) { + var renderCapability = (0, _pdfjsLib.createPromiseCapability)(); + var result = { + promise: renderCapability.promise, + onRenderContinue: function onRenderContinue(cont) { + cont(); + }, + cancel: function cancel() { + renderTask.cancel(); + } + }; + var viewport = this.viewport; + var canvas = document.createElement('canvas'); + canvas.id = this.renderingId; + canvas.setAttribute('hidden', 'hidden'); + var isCanvasHidden = true; + + var showCanvas = function showCanvas() { + if (isCanvasHidden) { + canvas.removeAttribute('hidden'); + isCanvasHidden = false; + } + }; + + canvasWrapper.appendChild(canvas); + this.canvas = canvas; canvas.mozOpaque = true; - var ctx = canvas.getContext('2d', {alpha: false}); - var outputScale = getOutputScale(ctx); + var ctx = canvas.getContext('2d', { + alpha: false + }); + var outputScale = (0, _ui_utils.getOutputScale)(ctx); this.outputScale = outputScale; - if (PDFJS.useOnlyCssZoom) { - var actualSizeViewport = viewport.clone({scale: CSS_UNITS}); - // Use a scale that will make the canvas be the original intended size - // of the page. + if (this.useOnlyCssZoom) { + 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 (PDFJS.maxCanvasPixels > 0) { + if (this.maxCanvasPixels > 0) { var pixelsInViewport = viewport.width * viewport.height; - var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport); + var maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport); + if (outputScale.sx > maxScale || outputScale.sy > maxScale) { outputScale.sx = maxScale; outputScale.sy = maxScale; @@ -3851,344 +12036,265 @@ var PDFPageView = (function PDFPageViewClosure() { } } - var sfx = approximateFraction(outputScale.sx); - var sfy = approximateFraction(outputScale.sy); - canvas.width = roundToDivide(viewport.width * outputScale.sx, sfx[0]); - canvas.height = roundToDivide(viewport.height * outputScale.sy, sfy[0]); - canvas.style.width = roundToDivide(viewport.width, sfx[1]) + 'px'; - canvas.style.height = roundToDivide(viewport.height, sfy[1]) + 'px'; - // Add the viewport so it's known what it was originally drawn with. - canvas._viewport = viewport; - - var textLayerDiv = null; - var textLayer = null; - if (this.textLayerFactory) { - 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) { - // annotationLayer needs to stay on top - div.insertBefore(textLayerDiv, this.annotationLayer.div); - } else { - div.appendChild(textLayerDiv); - } - - textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, - this.id - 1, - this.viewport); - } - this.textLayer = textLayer; - - var resolveRenderPromise, rejectRenderPromise; - var promise = new Promise(function (resolve, reject) { - resolveRenderPromise = resolve; - rejectRenderPromise = reject; - }); - - // Rendering area - - var self = this; - function pageViewDrawCallback(error) { - // The renderTask may have been replaced by a new one, so only remove - // the reference to the renderTask if it matches the one that is - // triggering this callback. - if (renderTask === self.renderTask) { - self.renderTask = null; - } - - if (error === 'cancelled') { - rejectRenderPromise(error); - return; - } - - self.renderingState = RenderingStates.FINISHED; - - if (isCanvasHidden) { - self.canvas.removeAttribute('hidden'); - isCanvasHidden = false; - } - - if (self.loadingIconDiv) { - div.removeChild(self.loadingIconDiv); - delete self.loadingIconDiv; - } - - if (self.zoomLayer) { - // Zeroing the width and height causes Firefox to release graphics - // resources immediately, which can greatly reduce memory consumption. - var zoomLayerCanvas = self.zoomLayer.firstChild; - zoomLayerCanvas.width = 0; - zoomLayerCanvas.height = 0; - - div.removeChild(self.zoomLayer); - self.zoomLayer = null; - } - - self.error = error; - self.stats = pdfPage.stats; - if (self.onAfterDraw) { - self.onAfterDraw(); - } - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('pagerendered', true, true, { - pageNumber: self.id, - cssTransform: false, - }); - div.dispatchEvent(event); - // This custom event is deprecated, and will be removed in the future, - // please use the |pagerendered| event instead. - var deprecatedEvent = document.createEvent('CustomEvent'); - deprecatedEvent.initCustomEvent('pagerender', true, true, { - pageNumber: pdfPage.pageNumber - }); - div.dispatchEvent(deprecatedEvent); - - if (!error) { - resolveRenderPromise(undefined); - } else { - rejectRenderPromise(error); - } - } - - var renderContinueCallback = null; - if (this.renderingQueue) { - renderContinueCallback = function renderContinueCallback(cont) { - if (!self.renderingQueue.isHighestPriority(self)) { - self.renderingState = RenderingStates.PAUSED; - self.resume = function resumeCallback() { - self.renderingState = RenderingStates.RUNNING; - cont(); - }; - return; - } - if (isCanvasHidden) { - self.canvas.removeAttribute('hidden'); - isCanvasHidden = false; - } - cont(); - }; - } - - var transform = !outputScale.scaled ? null : - [outputScale.sx, 0, 0, outputScale.sy, 0, 0]; + 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'; + this.paintedViewportMap.set(canvas, viewport); + var transform = !outputScale.scaled ? null : [outputScale.sx, 0, 0, outputScale.sy, 0, 0]; var renderContext = { canvasContext: ctx, transform: transform, viewport: this.viewport, - // intent: 'default', // === 'display' + enableWebGL: this.enableWebGL, + renderInteractiveForms: this.renderInteractiveForms }; - var renderTask = this.renderTask = this.pdfPage.render(renderContext); - renderTask.onContinue = renderContinueCallback; + var renderTask = this.pdfPage.render(renderContext); - this.renderTask.promise.then( - function pdfPageRenderCallback() { - pageViewDrawCallback(null); - if (textLayer) { - self.pdfPage.getTextContent({ normalizeWhitespace: true }).then( - function textContentResolved(textContent) { - textLayer.setTextContent(textContent); - textLayer.render(TEXT_LAYER_RENDER_DELAY); - } - ); - } - }, - function pdfPageRenderError(error) { - pageViewDrawCallback(error); + renderTask.onContinue = function (cont) { + showCanvas(); + + if (result.onRenderContinue) { + result.onRenderContinue(cont); + } else { + cont(); } - ); + }; - if (this.annotationLayerFactory) { - if (!this.annotationLayer) { - this.annotationLayer = this.annotationLayerFactory. - createAnnotationLayerBuilder(div, this.pdfPage); + renderTask.promise.then(function () { + showCanvas(); + renderCapability.resolve(undefined); + }, function (error) { + showCanvas(); + renderCapability.reject(error); + }); + return result; + } + }, { + 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'); } - this.annotationLayer.render(this.viewport, 'display'); - } - div.setAttribute('data-loaded', true); + }; - if (self.onBeforeDraw) { - self.onBeforeDraw(); - } - return promise; - }, - - beforePrint: function PDFPageView_beforePrint() { - var CustomStyle = PDFJS.CustomStyle; var pdfPage = this.pdfPage; + 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; - var viewport = pdfPage.getViewport(1); - // Use the same hack we use for high dpi displays for printing to get - // better output until bug 811002 is fixed in FF. - var PRINT_OUTPUT_SCALE = 2; - var canvas = document.createElement('canvas'); + _this2.paintedViewportMap.set(svg, actualSizeViewport); - // The logical size of the canvas. - canvas.width = Math.floor(viewport.width) * PRINT_OUTPUT_SCALE; - canvas.height = Math.floor(viewport.height) * PRINT_OUTPUT_SCALE; - - // The rendered size of the canvas, relative to the size of canvasWrapper. - canvas.style.width = (PRINT_OUTPUT_SCALE * 100) + '%'; - canvas.style.height = (PRINT_OUTPUT_SCALE * 100) + '%'; - - var cssScale = 'scale(' + (1 / PRINT_OUTPUT_SCALE) + ', ' + - (1 / PRINT_OUTPUT_SCALE) + ')'; - CustomStyle.setProp('transform' , canvas, cssScale); - CustomStyle.setProp('transformOrigin' , canvas, '0% 0%'); - - var printContainer = document.getElementById('printContainer'); - var canvasWrapper = document.createElement('div'); - canvasWrapper.style.width = viewport.width + 'pt'; - canvasWrapper.style.height = viewport.height + 'pt'; - canvasWrapper.appendChild(canvas); - printContainer.appendChild(canvasWrapper); - - canvas.mozPrintCallback = function(obj) { - var ctx = obj.context; - - ctx.save(); - ctx.fillStyle = 'rgb(255, 255, 255)'; - ctx.fillRect(0, 0, canvas.width, canvas.height); - ctx.restore(); - // Used by the mozCurrentTransform polyfill in src/display/canvas.js. - ctx._transformMatrix = - [PRINT_OUTPUT_SCALE, 0, 0, PRINT_OUTPUT_SCALE, 0, 0]; - ctx.scale(PRINT_OUTPUT_SCALE, PRINT_OUTPUT_SCALE); - - var renderContext = { - canvasContext: ctx, - viewport: viewport, - intent: 'print' - }; - - pdfPage.render(renderContext).promise.then(function() { - // Tell the printEngine that rendering this canvas/page has finished. - obj.done(); - }, function(error) { - console.error(error); - // Tell the printEngine that rendering this canvas/page has failed. - // This will make the print proces stop. - if ('abort' in obj) { - obj.abort(); - } else { - obj.done(); - } + svg.style.width = wrapper.style.width; + svg.style.height = wrapper.style.height; + _this2.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; + wrapper.appendChild(svg); }); + }); + return { + promise: promise, + onRenderContinue: function onRenderContinue(cont) { + cont(); + }, + cancel: function cancel() { + cancelled = true; + } }; - }, - }; + } + }, { + key: "setPageLabel", + value: function setPageLabel(label) { + this.pageLabel = typeof label === 'string' ? label : null; + + if (this.pageLabel !== null) { + this.div.setAttribute('data-page-label', this.pageLabel); + } else { + this.div.removeAttribute('data-page-label'); + } + } + }, { + key: "width", + get: function get() { + return this.viewport.width; + } + }, { + key: "height", + get: function get() { + return this.viewport.height; + } + }]); return PDFPageView; -})(); +}(); + +exports.PDFPageView = PDFPageView; + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -/** - * @typedef {Object} TextLayerBuilderOptions - * @property {HTMLDivElement} textLayerDiv - The text layer container. - * @property {number} pageIndex - The page index. - * @property {PageViewport} viewport - The viewport of the text layer. - * @property {PDFFindController} findController - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.DefaultTextLayerFactory = exports.TextLayerBuilder = void 0; -/** - * TextLayerBuilder provides text-selection functionality for the PDF. - * It does this by creating overlay divs over the PDF text. These divs - * contain text that matches the PDF text they are overlaying. This object - * also provides a way to highlight text that is being searched for. - * @class - */ -var TextLayerBuilder = (function TextLayerBuilderClosure() { - function TextLayerBuilder(options) { - this.textLayerDiv = options.textLayerDiv; +var _ui_utils = __webpack_require__(6); + +var _pdfjsLib = __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 EXPAND_DIVS_TIMEOUT = 300; + +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 === void 0 ? null : _ref$findController, + _ref$enhanceTextSelec = _ref.enhanceTextSelection, + enhanceTextSelection = _ref$enhanceTextSelec === void 0 ? false : _ref$enhanceTextSelec; + + _classCallCheck(this, TextLayerBuilder); + + this.textLayerDiv = textLayerDiv; + this.eventBus = eventBus || (0, _ui_utils.getGlobalEventBus)(); + this.textContent = null; + this.textContentItemsStr = []; + this.textContentStream = null; this.renderingDone = false; - this.divContentDone = false; - this.pageIdx = options.pageIndex; + this.pageIdx = pageIndex; this.pageNumber = this.pageIdx + 1; this.matches = []; - this.viewport = options.viewport; + this.viewport = viewport; this.textDivs = []; - this.findController = options.findController || null; + this.findController = findController; this.textLayerRenderTask = null; + this.enhanceTextSelection = enhanceTextSelection; + this._boundEvents = Object.create(null); + + this._bindEvents(); + this._bindMouse(); } - TextLayerBuilder.prototype = { - _finishRendering: function TextLayerBuilder_finishRendering() { + _createClass(TextLayerBuilder, [{ + key: "_finishRendering", + value: function _finishRendering() { this.renderingDone = true; - var endOfContent = document.createElement('div'); - endOfContent.className = 'endOfContent'; - this.textLayerDiv.appendChild(endOfContent); + if (!this.enhanceTextSelection) { + var endOfContent = document.createElement('div'); + endOfContent.className = 'endOfContent'; + this.textLayerDiv.appendChild(endOfContent); + } - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('textlayerrendered', true, true, { - pageNumber: this.pageNumber + this.eventBus.dispatch('textlayerrendered', { + source: this, + pageNumber: this.pageNumber, + numTextDivs: this.textDivs.length }); - this.textLayerDiv.dispatchEvent(event); - }, + } + }, { + key: "render", + value: function render() { + var _this = this; - /** - * Renders the text layer. - * @param {number} timeout (optional) if specified, the rendering waits - * for specified amount of ms. - */ - render: function TextLayerBuilder_render(timeout) { - if (!this.divContentDone || this.renderingDone) { + var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + + if (!(this.textContent || this.textContentStream) || this.renderingDone) { return; } - if (this.textLayerRenderTask) { - this.textLayerRenderTask.cancel(); - this.textLayerRenderTask = null; - } - + this.cancel(); this.textDivs = []; var textLayerFrag = document.createDocumentFragment(); - this.textLayerRenderTask = PDFJS.renderTextLayer({ + this.textLayerRenderTask = (0, _pdfjsLib.renderTextLayer)({ textContent: this.textContent, + textContentStream: this.textContentStream, container: textLayerFrag, viewport: this.viewport, textDivs: this.textDivs, - timeout: timeout + textContentItemsStr: this.textContentItemsStr, + timeout: timeout, + enhanceTextSelection: this.enhanceTextSelection }); this.textLayerRenderTask.promise.then(function () { - this.textLayerDiv.appendChild(textLayerFrag); - this._finishRendering(); - this.updateMatches(); - }.bind(this), function (reason) { - // canceled or failed to render text layer -- skipping errors - }); - }, + _this.textLayerDiv.appendChild(textLayerFrag); - setTextContent: function TextLayerBuilder_setTextContent(textContent) { + _this._finishRendering(); + + _this._updateMatches(); + }, function (reason) {}); + } + }, { + key: "cancel", + value: function cancel() { if (this.textLayerRenderTask) { this.textLayerRenderTask.cancel(); this.textLayerRenderTask = null; } + } + }, { + key: "setTextContentStream", + value: function setTextContentStream(readableStream) { + this.cancel(); + this.textContentStream = readableStream; + } + }, { + key: "setTextContent", + value: function setTextContent(textContent) { + this.cancel(); this.textContent = textContent; - this.divContentDone = true; - }, + } + }, { + key: "_convertMatches", + value: function _convertMatches(matches, matchesLength) { + if (!matches) { + return []; + } - convertMatches: function TextLayerBuilder_convertMatches(matches) { - var i = 0; - var iIndex = 0; - var bidiTexts = this.textContent.items; - var end = bidiTexts.length - 1; - var queryLen = (this.findController === null ? - 0 : this.findController.state.query.length); - var ret = []; + 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, len = matches.length; m < len; m++) { - // Calculate the start position. + for (var m = 0, mm = matches.length; m < mm; m++) { var matchIdx = matches[m]; - // Loop over the divIdxs. - while (i !== end && matchIdx >= (iIndex + bidiTexts[i].str.length)) { - iIndex += bidiTexts[i].str.length; + while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) { + iIndex += textContentItemsStr[i].length; i++; } - if (i === bidiTexts.length) { + if (i === textContentItemsStr.length) { console.error('Could not find a matching mapping'); } @@ -4199,13 +12305,14 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() { } }; - // Calculate the end position. - matchIdx += queryLen; + if (matchesLength) { + matchIdx += matchesLength[m]; + } else { + matchIdx += queryLen; + } - // Somewhat the same array as above, but use > instead of >= to get - // the end position right. - while (i !== end && matchIdx > (iIndex + bidiTexts[i].str.length)) { - iIndex += bidiTexts[i].str.length; + while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) { + iIndex += textContentItemsStr[i].length; i++; } @@ -4213,28 +12320,26 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() { divIdx: i, offset: matchIdx - iIndex }; - ret.push(match); + result.push(match); } - return ret; - }, - - renderMatches: function TextLayerBuilder_renderMatches(matches) { - // Early exit if there is nothing to render. + return result; + } + }, { + key: "_renderMatches", + value: function _renderMatches(matches) { if (matches.length === 0) { return; } - var bidiTexts = this.textContent.items; - 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 @@ -4248,8 +12353,9 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() { function appendTextToDiv(divIdx, fromOffset, toOffset, className) { var div = textDivs[divIdx]; - var content = bidiTexts[divIdx].str.substring(fromOffset, toOffset); + var content = textContentItemsStr[divIdx].substring(fromOffset, toOffset); var node = document.createTextNode(content); + if (className) { var span = document.createElement('span'); span.className = className; @@ -4257,15 +12363,17 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() { div.appendChild(span); return; } + div.appendChild(node); } - var i0 = selectedMatchIdx, i1 = i0 + 1; + var i0 = selectedMatchIdx, + i1 = i0 + 1; + if (highlightAll) { i0 = 0; i1 = matches.length; } else if (!isSelectedPage) { - // Not highlighting all and this isn't the selected page, so do nothing. return; } @@ -4273,3680 +12381,3179 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() { var match = matches[i]; var begin = match.begin; var end = match.end; - var isSelected = (isSelectedPage && i === selectedMatchIdx); - var highlightSuffix = (isSelected ? ' selected' : ''); + var isSelected = isSelectedPage && i === selectedMatchIdx; + var highlightSuffix = isSelected ? ' selected' : ''; - if (this.findController) { - this.findController.updateMatchPosition(pageIdx, i, textDivs, - begin.divIdx, end.divIdx); + if (isSelected) { + findController.scrollMatchIntoView({ + element: textDivs[begin.divIdx], + pageIndex: pageIdx, + matchIndex: selectedMatchIdx + }); } - // Match inside new div. if (!prevEnd || begin.divIdx !== prevEnd.divIdx) { - // If there was a previous div, then add the text at the end. if (prevEnd !== null) { appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset); } - // Clear the divs and set the content until the starting point. + 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; } + beginText(end, 'highlight end' + highlightSuffix); } + prevEnd = end; } if (prevEnd) { appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset); } - }, - - updateMatches: function TextLayerBuilder_updateMatches() { - // Only show matches when all rendering is done. + } + }, { + key: "_updateMatches", + value: function _updateMatches() { if (!this.renderingDone) { return; } - // Clear all matches. - var matches = this.matches; - var textDivs = this.textDivs; - var bidiTexts = this.textContent.items; + var findController = this.findController, + matches = this.matches, + pageIdx = this.pageIdx, + textContentItemsStr = this.textContentItemsStr, + textDivs = this.textDivs; var clearedUntilDivIdx = -1; - // Clear all current matches. - 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 = bidiTexts[n].str; + div.textContent = textContentItemsStr[n]; div.className = ''; } + clearedUntilDivIdx = match.end.divIdx + 1; } - if (this.findController === null || !this.findController.active) { + if (!findController || !findController.highlightMatches) { return; } - // Convert the matches on the page controller into the match format - // used for the textLayer. - this.matches = this.convertMatches(this.findController === null ? - [] : (this.findController.pageMatches[this.pageIdx] || [])); - this.renderMatches(this.matches); - }, + var pageMatches = findController.pageMatches[pageIdx] || null; + var pageMatchesLength = findController.pageMatchesLength[pageIdx] || 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; + + _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); + } + }, { + key: "_bindMouse", + value: function _bindMouse() { + var _this3 = this; - /** - * Fixes text selection: adds additional div where mouse was clicked. - * This reduces flickering of the content if mouse slowly dragged down/up. - * @private - */ - _bindMouse: function TextLayerBuilder_bindMouse() { var div = this.textLayerDiv; - div.addEventListener('mousedown', function (e) { + var expandDivsTimer = null; + div.addEventListener('mousedown', function (evt) { + if (_this3.enhanceTextSelection && _this3.textLayerRenderTask) { + _this3.textLayerRenderTask.expandTextDivs(true); + + if (expandDivsTimer) { + clearTimeout(expandDivsTimer); + expandDivsTimer = null; + } + + return; + } + var end = div.querySelector('.endOfContent'); + if (!end) { return; } - // On non-Firefox browsers, the selection will feel better if the height - // of the endOfContent div will be adjusted to start at mouse click - // location -- this will avoid flickering when selections moves up. - // However it does not work when selection started on empty space. - var adjustTop = e.target !== div; - adjustTop = adjustTop && window.getComputedStyle(end). - getPropertyValue('-moz-user-select') !== 'none'; + + var adjustTop = evt.target !== div; + adjustTop = adjustTop && window.getComputedStyle(end).getPropertyValue('-moz-user-select') !== 'none'; + if (adjustTop) { var divBounds = div.getBoundingClientRect(); - var r = Math.max(0, (e.pageY - divBounds.top) / divBounds.height); + var r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height); end.style.top = (r * 100).toFixed(2) + '%'; } + end.classList.add('active'); }); - div.addEventListener('mouseup', function (e) { + div.addEventListener('mouseup', function () { + if (_this3.enhanceTextSelection && _this3.textLayerRenderTask) { + expandDivsTimer = setTimeout(function () { + if (_this3.textLayerRenderTask) { + _this3.textLayerRenderTask.expandTextDivs(false); + } + + expandDivsTimer = null; + }, EXPAND_DIVS_TIMEOUT); + return; + } + var end = div.querySelector('.endOfContent'); + if (!end) { return; } + end.style.top = ''; end.classList.remove('active'); }); - }, - }; + } + }]); + return TextLayerBuilder; -})(); +}(); -/** - * @constructor - * @implements IPDFTextLayerFactory - */ -function DefaultTextLayerFactory() {} -DefaultTextLayerFactory.prototype = { - /** - * @param {HTMLDivElement} textLayerDiv - * @param {number} pageIndex - * @param {PageViewport} viewport - * @returns {TextLayerBuilder} - */ - createTextLayerBuilder: function (textLayerDiv, pageIndex, viewport) { - return new TextLayerBuilder({ - textLayerDiv: textLayerDiv, - pageIndex: pageIndex, - viewport: viewport - }); - } -}; +exports.TextLayerBuilder = TextLayerBuilder; - -/** - * @typedef {Object} AnnotationLayerBuilderOptions - * @property {HTMLDivElement} pageDiv - * @property {PDFPage} pdfPage - * @property {IPDFLinkService} linkService - */ - -/** - * @class - */ -var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() { - /** - * @param {AnnotationLayerBuilderOptions} options - * @constructs AnnotationLayerBuilder - */ - function AnnotationLayerBuilder(options) { - this.pageDiv = options.pageDiv; - this.pdfPage = options.pdfPage; - this.linkService = options.linkService; - - this.div = null; +var DefaultTextLayerFactory = +/*#__PURE__*/ +function () { + function DefaultTextLayerFactory() { + _classCallCheck(this, DefaultTextLayerFactory); } - AnnotationLayerBuilder.prototype = - /** @lends AnnotationLayerBuilder.prototype */ { - - /** - * @param {PageViewport} viewport - * @param {string} intent (default value is 'display') - */ - render: function AnnotationLayerBuilder_render(viewport, intent) { - var self = this; - var parameters = { - intent: (intent === undefined ? 'display' : intent), - }; - - this.pdfPage.getAnnotations(parameters).then(function (annotations) { - viewport = viewport.clone({ dontFlip: true }); - parameters = { - viewport: viewport, - div: self.div, - annotations: annotations, - page: self.pdfPage, - linkService: self.linkService - }; - - if (self.div) { - // If an annotationLayer already exists, refresh its children's - // transformation matrices. - PDFJS.AnnotationLayer.update(parameters); - } else { - // Create an annotation layer div and render the annotations - // if there is at least one annotation. - if (annotations.length === 0) { - return; - } - - self.div = document.createElement('div'); - self.div.className = 'annotationLayer'; - self.pageDiv.appendChild(self.div); - parameters.div = self.div; - - PDFJS.AnnotationLayer.render(parameters); - } - }); - }, - - hide: function AnnotationLayerBuilder_hide() { - if (!this.div) { - return; - } - this.div.setAttribute('hidden', 'true'); - } - }; - - return AnnotationLayerBuilder; -})(); - -/** - * @constructor - * @implements IPDFAnnotationLayerFactory - */ -function DefaultAnnotationLayerFactory() {} -DefaultAnnotationLayerFactory.prototype = { - /** - * @param {HTMLDivElement} pageDiv - * @param {PDFPage} pdfPage - * @returns {AnnotationLayerBuilder} - */ - createAnnotationLayerBuilder: function (pageDiv, pdfPage) { - return new AnnotationLayerBuilder({ - pageDiv: pageDiv, - pdfPage: pdfPage, - linkService: new SimpleLinkService(), - }); - } -}; - - -/** - * @typedef {Object} PDFViewerOptions - * @property {HTMLDivElement} container - The container for the viewer element. - * @property {HTMLDivElement} viewer - (optional) The viewer element. - * @property {IPDFLinkService} linkService - The navigation/linking service. - * @property {PDFRenderingQueue} renderingQueue - (optional) The rendering - * queue object. - * @property {boolean} removePageBorders - (optional) Removes the border shadow - * around the pages. The default is false. - */ - -/** - * Simple viewer control to display PDF content/pages. - * @class - * @implements {IRenderableView} - */ -var PDFViewer = (function pdfViewer() { - function PDFPageViewBuffer(size) { - var data = []; - this.push = function cachePush(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) { - size = newSize; - while (data.length > size) { - data.shift().destroy(); - } - }; - } - - function isSameScale(oldScale, newScale) { - if (newScale === oldScale) { - return true; - } - if (Math.abs(newScale - oldScale) < 1e-15) { - // Prevent unnecessary re-rendering of all pages when the scale - // changes only because of limited numerical precision. - return true; - } - return false; - } - - /** - * @constructs PDFViewer - * @param {PDFViewerOptions} options - */ - function PDFViewer(options) { - this.container = options.container; - this.viewer = options.viewer || options.container.firstElementChild; - this.linkService = options.linkService || new SimpleLinkService(); - this.removePageBorders = options.removePageBorders || false; - - this.defaultRenderingQueue = !options.renderingQueue; - if (this.defaultRenderingQueue) { - // Custom rendering queue is not specified, using default one - this.renderingQueue = new PDFRenderingQueue(); - this.renderingQueue.setViewer(this); - } else { - this.renderingQueue = options.renderingQueue; - } - - this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this)); - this.updateInProgress = false; - this.presentationModeState = PresentationModeState.UNKNOWN; - this._resetView(); - - if (this.removePageBorders) { - this.viewer.classList.add('removePageBorders'); - } - } - - PDFViewer.prototype = /** @lends PDFViewer.prototype */{ - get pagesCount() { - return this._pages.length; - }, - - getPageView: function (index) { - return this._pages[index]; - }, - - get currentPageNumber() { - return this._currentPageNumber; - }, - - set currentPageNumber(val) { - if (!this.pdfDocument) { - this._currentPageNumber = val; - return; - } - - var event = document.createEvent('UIEvents'); - event.initUIEvent('pagechange', true, true, window, 0); - event.updateInProgress = this.updateInProgress; - - if (!(0 < val && val <= this.pagesCount)) { - event.pageNumber = this._currentPageNumber; - event.previousPageNumber = val; - this.container.dispatchEvent(event); - return; - } - - event.previousPageNumber = this._currentPageNumber; - this._currentPageNumber = val; - event.pageNumber = val; - this.container.dispatchEvent(event); - - // Check if the caller is `PDFViewer_update`, to avoid breaking scrolling. - if (this.updateInProgress) { - return; - } - this.scrollPageIntoView(val); - }, - - /** - * @returns {number} - */ - get currentScale() { - return this._currentScale !== UNKNOWN_SCALE ? this._currentScale : - DEFAULT_SCALE; - }, - - /** - * @param {number} val - Scale of the pages in percents. - */ - set currentScale(val) { - if (isNaN(val)) { - throw new Error('Invalid numeric scale'); - } - if (!this.pdfDocument) { - this._currentScale = val; - this._currentScaleValue = val !== UNKNOWN_SCALE ? val.toString() : null; - return; - } - this._setScale(val, false); - }, - - /** - * @returns {string} - */ - get currentScaleValue() { - return this._currentScaleValue; - }, - - /** - * @param val - The scale of the pages (in percent or predefined value). - */ - set currentScaleValue(val) { - if (!this.pdfDocument) { - this._currentScale = isNaN(val) ? UNKNOWN_SCALE : val; - this._currentScaleValue = val; - return; - } - this._setScale(val, false); - }, - - /** - * @returns {number} - */ - get pagesRotation() { - return this._pagesRotation; - }, - - /** - * @param {number} rotation - The rotation of the pages (0, 90, 180, 270). - */ - set pagesRotation(rotation) { - this._pagesRotation = rotation; - - for (var i = 0, l = this._pages.length; i < l; i++) { - var pageView = this._pages[i]; - pageView.update(pageView.scale, rotation); - } - - this._setScale(this._currentScaleValue, true); - - if (this.defaultRenderingQueue) { - this.update(); - } - }, - - /** - * @param pdfDocument {PDFDocument} - */ - setDocument: function (pdfDocument) { - if (this.pdfDocument) { - this._resetView(); - } - - this.pdfDocument = pdfDocument; - if (!pdfDocument) { - return; - } - - var pagesCount = pdfDocument.numPages; - var self = this; - - var resolvePagesPromise; - var pagesPromise = new Promise(function (resolve) { - resolvePagesPromise = resolve; - }); - this.pagesPromise = pagesPromise; - pagesPromise.then(function () { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('pagesloaded', true, true, { - pagesCount: pagesCount - }); - self.container.dispatchEvent(event); - }); - - var isOnePageRenderedResolved = false; - var resolveOnePageRendered = null; - var onePageRendered = new Promise(function (resolve) { - resolveOnePageRendered = resolve; - }); - this.onePageRendered = onePageRendered; - - var bindOnAfterAndBeforeDraw = function (pageView) { - pageView.onBeforeDraw = function pdfViewLoadOnBeforeDraw() { - // Add the page to the buffer at the start of drawing. That way it can - // be evicted from the buffer and destroyed even if we pause its - // rendering. - self._buffer.push(this); - }; - // when page is painted, using the image as thumbnail base - pageView.onAfterDraw = function pdfViewLoadOnAfterDraw() { - if (!isOnePageRenderedResolved) { - isOnePageRenderedResolved = true; - resolveOnePageRendered(); - } - }; - }; - - var firstPagePromise = pdfDocument.getPage(1); - this.firstPagePromise = firstPagePromise; - - // Fetch a single page so we can get a viewport that will be the default - // viewport for all pages - return firstPagePromise.then(function(pdfPage) { - var scale = this.currentScale; - var viewport = pdfPage.getViewport(scale * CSS_UNITS); - for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { - var textLayerFactory = null; - if (!PDFJS.disableTextLayer) { - textLayerFactory = this; - } - var pageView = new PDFPageView({ - container: this.viewer, - id: pageNum, - scale: scale, - defaultViewport: viewport.clone(), - renderingQueue: this.renderingQueue, - textLayerFactory: textLayerFactory, - annotationLayerFactory: this - }); - bindOnAfterAndBeforeDraw(pageView); - this._pages.push(pageView); - } - - var linkService = this.linkService; - - // Fetch all the pages since the viewport is needed before printing - // starts to create the correct size canvas. Wait until one page is - // rendered so we don't tie up too many resources early on. - onePageRendered.then(function () { - if (!PDFJS.disableAutoFetch) { - var getPagesLeft = pagesCount; - for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { - pdfDocument.getPage(pageNum).then(function (pageNum, pdfPage) { - var pageView = self._pages[pageNum - 1]; - if (!pageView.pdfPage) { - pageView.setPdfPage(pdfPage); - } - linkService.cachePageRef(pageNum, pdfPage.ref); - getPagesLeft--; - if (!getPagesLeft) { - resolvePagesPromise(); - } - }.bind(null, pageNum)); - } - } else { - // XXX: Printing is semi-broken with auto fetch disabled. - resolvePagesPromise(); - } - }); - - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('pagesinit', true, true, null); - self.container.dispatchEvent(event); - - if (this.defaultRenderingQueue) { - this.update(); - } - - if (this.findController) { - this.findController.resolveFirstPage(); - } - }.bind(this)); - }, - - _resetView: function () { - this._pages = []; - this._currentPageNumber = 1; - this._currentScale = UNKNOWN_SCALE; - this._currentScaleValue = null; - this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE); - this._location = null; - this._pagesRotation = 0; - this._pagesRequests = []; - - var container = this.viewer; - while (container.hasChildNodes()) { - container.removeChild(container.lastChild); - } - }, - - _scrollUpdate: function PDFViewer_scrollUpdate() { - if (this.pagesCount === 0) { - return; - } - this.update(); - for (var i = 0, ii = this._pages.length; i < ii; i++) { - this._pages[i].updatePosition(); - } - }, - - _setScaleDispatchEvent: function pdfViewer_setScaleDispatchEvent( - newScale, newValue, preset) { - var event = document.createEvent('UIEvents'); - event.initUIEvent('scalechange', true, true, window, 0); - event.scale = newScale; - if (preset) { - event.presetValue = newValue; - } - this.container.dispatchEvent(event); - }, - - _setScaleUpdatePages: function pdfViewer_setScaleUpdatePages( - newScale, newValue, noScroll, preset) { - this._currentScaleValue = newValue; - - if (isSameScale(this._currentScale, newScale)) { - if (preset) { - this._setScaleDispatchEvent(newScale, newValue, true); - } - 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; - if (this._location && !IGNORE_CURRENT_POSITION_ON_ZOOM && - !(this.isInPresentationMode || this.isChangingPresentationMode)) { - page = this._location.pageNumber; - dest = [null, { name: 'XYZ' }, this._location.left, - this._location.top, null]; - } - this.scrollPageIntoView(page, dest); - } - - this._setScaleDispatchEvent(newScale, newValue, preset); - - if (this.defaultRenderingQueue) { - this.update(); - } - }, - - _setScale: function pdfViewer_setScale(value, noScroll) { - 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 hPadding = (this.isInPresentationMode || this.removePageBorders) ? - 0 : SCROLLBAR_PADDING; - var vPadding = (this.isInPresentationMode || this.removePageBorders) ? - 0 : VERTICAL_PADDING; - 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': - scale = 1; - break; - case 'page-width': - scale = pageWidthScale; - break; - case 'page-height': - scale = pageHeightScale; - break; - case 'page-fit': - scale = Math.min(pageWidthScale, pageHeightScale); - break; - case 'auto': - var isLandscape = (currentPage.width > currentPage.height); - // For pages in landscape mode, fit the page height to the viewer - // *unless* the page would thus become too wide to fit horizontally. - var horizontalScale = isLandscape ? - Math.min(pageHeightScale, pageWidthScale) : pageWidthScale; - scale = Math.min(MAX_AUTO_SCALE, horizontalScale); - break; - default: - console.error('pdfViewSetScale: \'' + value + - '\' is an unknown zoom value.'); - return; - } - this._setScaleUpdatePages(scale, value, noScroll, true); - } - }, - - /** - * Scrolls page into view. - * @param {number} pageNumber - * @param {Array} dest - (optional) original PDF destination array: - * - */ - scrollPageIntoView: function PDFViewer_scrollPageIntoView(pageNumber, - dest) { - if (!this.pdfDocument) { - return; - } - - var pageView = this._pages[pageNumber - 1]; - - if (this.isInPresentationMode) { - if (this._currentPageNumber !== pageView.id) { - // Avoid breaking getVisiblePages in presentation mode. - this.currentPageNumber = pageView.id; - return; - } - dest = null; - // Fixes the case when PDF has different page sizes. - this._setScale(this._currentScaleValue, true); - } - if (!dest) { - scrollIntoView(pageView.div); - return; - } - - var x = 0, y = 0; - var width = 0, height = 0, widthScale, heightScale; - var changeOrientation = (pageView.rotation % 180 === 0 ? false : true); - var pageWidth = (changeOrientation ? pageView.height : pageView.width) / - pageView.scale / CSS_UNITS; - var pageHeight = (changeOrientation ? pageView.width : pageView.height) / - pageView.scale / CSS_UNITS; - var scale = 0; - switch (dest[1].name) { - case 'XYZ': - x = dest[2]; - y = dest[3]; - scale = dest[4]; - // If x and/or y coordinates are not supplied, default to - // _top_ left of the page (not the obvious bottom left, - // since aligning the bottom of the intended page with the - // top of the window is rarely helpful). - x = x !== null ? x : 0; - y = y !== null ? y : pageHeight; - break; - case 'Fit': - case 'FitB': - scale = 'page-fit'; - break; - case 'FitH': - case 'FitBH': - y = dest[2]; - scale = 'page-width'; - // According to the PDF spec, section 12.3.2.2, a `null` value in the - // parameter should maintain the position relative to the new page. - if (y === null && this._location) { - x = this._location.left; - y = this._location.top; - } - break; - case 'FitV': - case 'FitBV': - x = dest[2]; - width = pageWidth; - height = pageHeight; - scale = 'page-height'; - break; - case 'FitR': - x = dest[2]; - y = dest[3]; - width = dest[4] - x; - height = dest[5] - y; - var hPadding = this.removePageBorders ? 0 : SCROLLBAR_PADDING; - var vPadding = this.removePageBorders ? 0 : VERTICAL_PADDING; - - widthScale = (this.container.clientWidth - hPadding) / - width / CSS_UNITS; - heightScale = (this.container.clientHeight - vPadding) / - height / CSS_UNITS; - scale = Math.min(Math.abs(widthScale), Math.abs(heightScale)); - break; - default: - return; - } - - if (scale && scale !== this._currentScale) { - this.currentScaleValue = scale; - } else if (this._currentScale === UNKNOWN_SCALE) { - this.currentScaleValue = DEFAULT_SCALE_VALUE; - } - - if (scale === 'page-fit' && !dest[4]) { - scrollIntoView(pageView.div); - 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]); - - scrollIntoView(pageView.div, { left: left, top: top }); - }, - - _updateLocation: function (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 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; - - this._location = { - pageNumber: pageNumber, - scale: normalizedScaleValue, - top: intTop, - left: intLeft, - pdfOpenParams: pdfOpenParams - }; - }, - - update: function PDFViewer_update() { - var visible = this._getVisiblePages(); - var visiblePages = visible.views; - if (visiblePages.length === 0) { - return; - } - - this.updateInProgress = true; - - var suggestedCacheSize = Math.max(DEFAULT_CACHE_SIZE, - 2 * visiblePages.length + 1); - this._buffer.resize(suggestedCacheSize); - - this.renderingQueue.renderHighestPriority(visible); - - var currentId = this._currentPageNumber; - var firstPage = visible.first; - - for (var i = 0, ii = visiblePages.length, stillFullyVisible = false; - i < ii; ++i) { - var page = visiblePages[i]; - - if (page.percent < 100) { - break; - } - if (page.id === currentId) { - stillFullyVisible = true; - break; - } - } - - if (!stillFullyVisible) { - currentId = visiblePages[0].id; - } - - if (!this.isInPresentationMode) { - this.currentPageNumber = currentId; - } - - this._updateLocation(firstPage); - - this.updateInProgress = false; - - var event = document.createEvent('UIEvents'); - event.initUIEvent('updateviewarea', true, true, window, 0); - event.location = this._location; - this.container.dispatchEvent(event); - }, - - containsElement: function (element) { - return this.container.contains(element); - }, - - focus: function () { - this.container.focus(); - }, - - get isInPresentationMode() { - return this.presentationModeState === PresentationModeState.FULLSCREEN; - }, - - get isChangingPresentationMode() { - return this.presentationModeState === PresentationModeState.CHANGING; - }, - - get isHorizontalScrollbarEnabled() { - return (this.isInPresentationMode ? - false : (this.container.scrollWidth > this.container.clientWidth)); - }, - - _getVisiblePages: function () { - if (!this.isInPresentationMode) { - return getVisibleElements(this.container, this._pages, true); - } else { - // The algorithm in getVisibleElements doesn't work in all browsers and - // configurations when presentation mode is active. - var visible = []; - var currentPage = this._pages[this._currentPageNumber - 1]; - visible.push({ id: currentPage.id, view: currentPage }); - return { first: currentPage, last: currentPage, views: visible }; - } - }, - - cleanup: function () { - for (var i = 0, ii = this._pages.length; i < ii; i++) { - if (this._pages[i] && - this._pages[i].renderingState !== RenderingStates.FINISHED) { - this._pages[i].reset(); - } - } - }, - - /** - * @param {PDFPageView} pageView - * @returns {PDFPage} - * @private - */ - _ensurePdfPageLoaded: function (pageView) { - if (pageView.pdfPage) { - return Promise.resolve(pageView.pdfPage); - } - var pageNumber = pageView.id; - if (this._pagesRequests[pageNumber]) { - return this._pagesRequests[pageNumber]; - } - var promise = this.pdfDocument.getPage(pageNumber).then( - function (pdfPage) { - pageView.setPdfPage(pdfPage); - this._pagesRequests[pageNumber] = null; - return pdfPage; - }.bind(this)); - this._pagesRequests[pageNumber] = promise; - return promise; - }, - - forceRendering: function (currentlyVisiblePages) { - var visiblePages = currentlyVisiblePages || this._getVisiblePages(); - var pageView = this.renderingQueue.getHighestPriority(visiblePages, - this._pages, - this.scroll.down); - if (pageView) { - this._ensurePdfPageLoaded(pageView).then(function () { - this.renderingQueue.renderView(pageView); - }.bind(this)); - return true; - } - return false; - }, - - getPageTextContent: function (pageIndex) { - return this.pdfDocument.getPage(pageIndex + 1).then(function (page) { - return page.getTextContent({ normalizeWhitespace: true }); - }); - }, - - /** - * @param {HTMLDivElement} textLayerDiv - * @param {number} pageIndex - * @param {PageViewport} viewport - * @returns {TextLayerBuilder} - */ - createTextLayerBuilder: function (textLayerDiv, pageIndex, viewport) { + _createClass(DefaultTextLayerFactory, [{ + key: "createTextLayerBuilder", + value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) { + var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; return new TextLayerBuilder({ textLayerDiv: textLayerDiv, pageIndex: pageIndex, viewport: viewport, - findController: this.isInPresentationMode ? null : this.findController - }); - }, - - /** - * @param {HTMLDivElement} pageDiv - * @param {PDFPage} pdfPage - * @returns {AnnotationLayerBuilder} - */ - createAnnotationLayerBuilder: function (pageDiv, pdfPage) { - return new AnnotationLayerBuilder({ - pageDiv: pageDiv, - pdfPage: pdfPage, - linkService: this.linkService - }); - }, - - setFindController: function (findController) { - this.findController = findController; - }, - }; - - return PDFViewer; -})(); - -var SimpleLinkService = (function SimpleLinkServiceClosure() { - function SimpleLinkService() {} - - SimpleLinkService.prototype = { - /** - * @returns {number} - */ - get page() { - return 0; - }, - /** - * @param {number} value - */ - set page(value) {}, - /** - * @param dest - The PDF destination object. - */ - navigateTo: function (dest) {}, - /** - * @param dest - The PDF destination object. - * @returns {string} The hyperlink to the PDF object. - */ - getDestinationHash: function (dest) { - return '#'; - }, - /** - * @param hash - The PDF parameters/hash. - * @returns {string} The hyperlink to the PDF object. - */ - getAnchorUrl: function (hash) { - return '#'; - }, - /** - * @param {string} hash - */ - setHash: function (hash) {}, - /** - * @param {string} action - */ - executeNamedAction: function (action) {}, - /** - * @param {number} pageNum - page number. - * @param {Object} pageRef - reference to the page. - */ - cachePageRef: function (pageNum, pageRef) {} - }; - return SimpleLinkService; -})(); - - -var THUMBNAIL_SCROLL_MARGIN = -19; - - -var THUMBNAIL_WIDTH = 98; // px -var THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px - -/** - * @typedef {Object} PDFThumbnailViewOptions - * @property {HTMLDivElement} container - The viewer element. - * @property {number} id - The thumbnail's unique ID (normally its number). - * @property {PageViewport} defaultViewport - The page viewport. - * @property {IPDFLinkService} linkService - The navigation/linking service. - * @property {PDFRenderingQueue} renderingQueue - The rendering queue object. - */ - -/** - * @class - * @implements {IRenderableView} - */ -var PDFThumbnailView = (function PDFThumbnailViewClosure() { - function getTempCanvas(width, height) { - var tempCanvas = PDFThumbnailView.tempImageCache; - if (!tempCanvas) { - tempCanvas = document.createElement('canvas'); - PDFThumbnailView.tempImageCache = tempCanvas; - } - tempCanvas.width = width; - tempCanvas.height = height; - - // Since this is a temporary canvas, we need to fill the canvas with a white - // background ourselves. |_getPageDrawContext| uses CSS rules for this. - tempCanvas.mozOpaque = true; - var ctx = tempCanvas.getContext('2d', {alpha: false}); - ctx.save(); - ctx.fillStyle = 'rgb(255, 255, 255)'; - ctx.fillRect(0, 0, width, height); - ctx.restore(); - return tempCanvas; - } - - /** - * @constructs PDFThumbnailView - * @param {PDFThumbnailViewOptions} options - */ - function PDFThumbnailView(options) { - var container = options.container; - var id = options.id; - var defaultViewport = options.defaultViewport; - var linkService = options.linkService; - var renderingQueue = options.renderingQueue; - - this.id = id; - this.renderingId = 'thumbnail' + id; - - this.pdfPage = null; - this.rotation = 0; - this.viewport = defaultViewport; - this.pdfPageRotate = defaultViewport.rotation; - - this.linkService = linkService; - this.renderingQueue = renderingQueue; - - this.hasImage = false; - this.resume = null; - this.renderingState = RenderingStates.INITIAL; - - this.pageWidth = this.viewport.width; - this.pageHeight = this.viewport.height; - this.pageRatio = this.pageWidth / this.pageHeight; - - this.canvasWidth = THUMBNAIL_WIDTH; - this.canvasHeight = (this.canvasWidth / this.pageRatio) | 0; - this.scale = this.canvasWidth / this.pageWidth; - - var anchor = document.createElement('a'); - anchor.href = linkService.getAnchorUrl('#page=' + id); - anchor.title = 'Page ' + id; - anchor.onclick = function stopNavigation() { - linkService.page = id; - return false; - }; - - var div = document.createElement('div'); - div.id = 'thumbnailContainer' + id; - div.className = 'thumbnail'; - this.div = div; - - if (id === 1) { - // Highlight the thumbnail of the first page when no page number is - // specified (or exists in cache) when the document is loaded. - div.classList.add('selected'); - } - - 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'; - this.ring = ring; - - div.appendChild(ring); - anchor.appendChild(div); - container.appendChild(anchor); - } - - PDFThumbnailView.prototype = { - setPdfPage: function PDFThumbnailView_setPdfPage(pdfPage) { - this.pdfPage = pdfPage; - this.pdfPageRotate = pdfPage.rotate; - var totalRotation = (this.rotation + this.pdfPageRotate) % 360; - this.viewport = pdfPage.getViewport(1, totalRotation); - this.reset(); - }, - - reset: function PDFThumbnailView_reset() { - if (this.renderTask) { - this.renderTask.cancel(); - } - this.hasImage = false; - this.resume = null; - this.renderingState = 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'); - 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'; - - if (this.canvas) { - // Zeroing the width and height causes Firefox to release graphics - // resources immediately, which can greatly reduce memory consumption. - this.canvas.width = 0; - this.canvas.height = 0; - delete this.canvas; - } - if (this.image) { - this.image.removeAttribute('src'); - delete this.image; - } - }, - - update: function PDFThumbnailView_update(rotation) { - if (typeof rotation !== 'undefined') { - this.rotation = rotation; - } - var totalRotation = (this.rotation + this.pdfPageRotate) % 360; - this.viewport = this.viewport.clone({ - scale: 1, - rotation: totalRotation - }); - this.reset(); - }, - - /** - * @private - */ - _getPageDrawContext: - function PDFThumbnailView_getPageDrawContext(noCtxScale) { - var canvas = document.createElement('canvas'); - this.canvas = canvas; - - canvas.mozOpaque = true; - var ctx = canvas.getContext('2d', {alpha: false}); - var outputScale = 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'; - - if (!noCtxScale && outputScale.scaled) { - ctx.scale(outputScale.sx, outputScale.sy); - } - - var image = document.createElement('img'); - this.image = image; - - image.id = this.renderingId; - image.className = 'thumbnailImage'; - image.setAttribute('aria-label', 'Thumbnail of Page ' + this.id); - - image.style.width = canvas.style.width; - image.style.height = canvas.style.height; - - return ctx; - }, - - /** - * @private - */ - _convertCanvasToImage: function PDFThumbnailView_convertCanvasToImage() { - if (!this.canvas) { - return; - } - this.image.src = this.canvas.toDataURL(); - - this.div.setAttribute('data-loaded', true); - this.ring.appendChild(this.image); - - // Zeroing the width and height causes Firefox to release graphics - // resources immediately, which can greatly reduce memory consumption. - this.canvas.width = 0; - this.canvas.height = 0; - delete this.canvas; - }, - - draw: function PDFThumbnailView_draw() { - if (this.renderingState !== RenderingStates.INITIAL) { - console.error('Must be in new state before drawing'); - } - if (this.hasImage) { - return Promise.resolve(undefined); - } - this.hasImage = true; - this.renderingState = RenderingStates.RUNNING; - - var resolveRenderPromise, rejectRenderPromise; - var promise = new Promise(function (resolve, reject) { - resolveRenderPromise = resolve; - rejectRenderPromise = reject; - }); - - var self = this; - function thumbnailDrawCallback(error) { - // The renderTask may have been replaced by a new one, so only remove - // the reference to the renderTask if it matches the one that is - // triggering this callback. - if (renderTask === self.renderTask) { - self.renderTask = null; - } - if (error === 'cancelled') { - rejectRenderPromise(error); - return; - } - self.renderingState = RenderingStates.FINISHED; - self._convertCanvasToImage(); - - if (!error) { - resolveRenderPromise(undefined); - } else { - rejectRenderPromise(error); - } - } - - var ctx = this._getPageDrawContext(); - var drawViewport = this.viewport.clone({ scale: this.scale }); - var renderContinueCallback = function renderContinueCallback(cont) { - if (!self.renderingQueue.isHighestPriority(self)) { - self.renderingState = RenderingStates.PAUSED; - self.resume = function resumeCallback() { - self.renderingState = RenderingStates.RUNNING; - cont(); - }; - return; - } - cont(); - }; - - var renderContext = { - canvasContext: ctx, - viewport: drawViewport - }; - var renderTask = this.renderTask = this.pdfPage.render(renderContext); - renderTask.onContinue = renderContinueCallback; - - renderTask.promise.then( - function pdfPageRenderCallback() { - thumbnailDrawCallback(null); - }, - function pdfPageRenderError(error) { - thumbnailDrawCallback(error); - } - ); - return promise; - }, - - setImage: function PDFThumbnailView_setImage(pageView) { - var img = pageView.canvas; - if (this.hasImage || !img) { - return; - } - if (!this.pdfPage) { - this.setPdfPage(pageView.pdfPage); - } - this.hasImage = true; - this.renderingState = 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; - } - // drawImage does an awful job of rescaling the image, doing it gradually. - var MAX_NUM_SCALING_STEPS = 3; - var reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS; - var reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS; - var reducedImage = getTempCanvas(reducedWidth, reducedHeight); - 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(); - } - }; - - return PDFThumbnailView; -})(); - -PDFThumbnailView.tempImageCache = null; - - -/** - * @typedef {Object} PDFThumbnailViewerOptions - * @property {HTMLDivElement} container - The container for the thumbnail - * elements. - * @property {IPDFLinkService} linkService - The navigation/linking service. - * @property {PDFRenderingQueue} renderingQueue - The rendering queue object. - */ - -/** - * Simple viewer control to display thumbnails for pages. - * @class - * @implements {IRenderableView} - */ -var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() { - /** - * @constructs PDFThumbnailViewer - * @param {PDFThumbnailViewerOptions} options - */ - function PDFThumbnailViewer(options) { - this.container = options.container; - this.renderingQueue = options.renderingQueue; - this.linkService = options.linkService; - - this.scroll = watchScroll(this.container, this._scrollUpdated.bind(this)); - this._resetView(); - } - - PDFThumbnailViewer.prototype = { - /** - * @private - */ - _scrollUpdated: function PDFThumbnailViewer_scrollUpdated() { - this.renderingQueue.renderHighestPriority(); - }, - - getThumbnail: function PDFThumbnailViewer_getThumbnail(index) { - return this.thumbnails[index]; - }, - - /** - * @private - */ - _getVisibleThumbs: function PDFThumbnailViewer_getVisibleThumbs() { - return getVisibleElements(this.container, this.thumbnails); - }, - - scrollThumbnailIntoView: - function PDFThumbnailViewer_scrollThumbnailIntoView(page) { - var selected = document.querySelector('.thumbnail.selected'); - if (selected) { - selected.classList.remove('selected'); - } - var thumbnail = document.getElementById('thumbnailContainer' + page); - if (thumbnail) { - thumbnail.classList.add('selected'); - } - var visibleThumbs = this._getVisibleThumbs(); - var numVisibleThumbs = visibleThumbs.views.length; - - // If the thumbnail isn't currently visible, scroll it into view. - if (numVisibleThumbs > 0) { - var first = visibleThumbs.first.id; - // Account for only one thumbnail being visible. - var last = (numVisibleThumbs > 1 ? visibleThumbs.last.id : first); - if (page <= first || page >= last) { - scrollIntoView(thumbnail, { top: THUMBNAIL_SCROLL_MARGIN }); - } - } - }, - - get pagesRotation() { - return this._pagesRotation; - }, - - set pagesRotation(rotation) { - this._pagesRotation = rotation; - for (var i = 0, l = this.thumbnails.length; i < l; i++) { - var thumb = this.thumbnails[i]; - thumb.update(rotation); - } - }, - - cleanup: function PDFThumbnailViewer_cleanup() { - var tempCanvas = PDFThumbnailView.tempImageCache; - if (tempCanvas) { - // Zeroing the width and height causes Firefox to release graphics - // resources immediately, which can greatly reduce memory consumption. - tempCanvas.width = 0; - tempCanvas.height = 0; - } - PDFThumbnailView.tempImageCache = null; - }, - - /** - * @private - */ - _resetView: function PDFThumbnailViewer_resetView() { - this.thumbnails = []; - this._pagesRotation = 0; - this._pagesRequests = []; - }, - - setDocument: function PDFThumbnailViewer_setDocument(pdfDocument) { - if (this.pdfDocument) { - // cleanup of the elements and views - var thumbsView = this.container; - while (thumbsView.hasChildNodes()) { - thumbsView.removeChild(thumbsView.lastChild); - } - this._resetView(); - } - - this.pdfDocument = pdfDocument; - if (!pdfDocument) { - return Promise.resolve(); - } - - return pdfDocument.getPage(1).then(function (firstPage) { - var pagesCount = pdfDocument.numPages; - var viewport = firstPage.getViewport(1.0); - for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { - var thumbnail = new PDFThumbnailView({ - container: this.container, - id: pageNum, - defaultViewport: viewport.clone(), - linkService: this.linkService, - renderingQueue: this.renderingQueue - }); - this.thumbnails.push(thumbnail); - } - }.bind(this)); - }, - - /** - * @param {PDFPageView} pageView - * @returns {PDFPage} - * @private - */ - _ensurePdfPageLoaded: - function PDFThumbnailViewer_ensurePdfPageLoaded(thumbView) { - if (thumbView.pdfPage) { - return Promise.resolve(thumbView.pdfPage); - } - var pageNumber = thumbView.id; - if (this._pagesRequests[pageNumber]) { - return this._pagesRequests[pageNumber]; - } - var promise = this.pdfDocument.getPage(pageNumber).then( - function (pdfPage) { - thumbView.setPdfPage(pdfPage); - this._pagesRequests[pageNumber] = null; - return pdfPage; - }.bind(this)); - this._pagesRequests[pageNumber] = promise; - return promise; - }, - - ensureThumbnailVisible: - function PDFThumbnailViewer_ensureThumbnailVisible(page) { - // Ensure that the thumbnail of the current page is visible - // when switching from another view. - scrollIntoView(document.getElementById('thumbnailContainer' + page)); - }, - - forceRendering: function () { - var visibleThumbs = this._getVisibleThumbs(); - var thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, - this.thumbnails, - this.scroll.down); - if (thumbView) { - this._ensurePdfPageLoaded(thumbView).then(function () { - this.renderingQueue.renderView(thumbView); - }.bind(this)); - return true; - } - return false; - } - }; - - return PDFThumbnailViewer; -})(); - - -/** - * @typedef {Object} PDFOutlineViewOptions - * @property {HTMLDivElement} container - The viewer element. - * @property {Array} outline - An array of outline objects. - * @property {IPDFLinkService} linkService - The navigation/linking service. - */ - -/** - * @class - */ -var PDFOutlineView = (function PDFOutlineViewClosure() { - /** - * @constructs PDFOutlineView - * @param {PDFOutlineViewOptions} options - */ - function PDFOutlineView(options) { - this.container = options.container; - this.outline = options.outline; - this.linkService = options.linkService; - this.lastToggleIsShow = true; - } - - PDFOutlineView.prototype = { - reset: function PDFOutlineView_reset() { - var container = this.container; - while (container.firstChild) { - container.removeChild(container.firstChild); - } - this.lastToggleIsShow = true; - }, - - /** - * @private - */ - _dispatchEvent: function PDFOutlineView_dispatchEvent(outlineCount) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('outlineloaded', true, true, { - outlineCount: outlineCount - }); - this.container.dispatchEvent(event); - }, - - /** - * @private - */ - _bindLink: function PDFOutlineView_bindLink(element, item) { - if (item.url) { - PDFJS.addLinkAttributes(element, { url: item.url }); - return; - } - var linkService = this.linkService; - element.href = linkService.getDestinationHash(item.dest); - element.onclick = function goToDestination(e) { - linkService.navigateTo(item.dest); - return false; - }; - }, - - /** - * Prepend a button before an outline item which allows the user to toggle - * the visibility of all outline items at that level. - * - * @private - */ - _addToggleButton: function PDFOutlineView_addToggleButton(div) { - var toggler = document.createElement('div'); - toggler.className = 'outlineItemToggler'; - toggler.onclick = function(event) { - event.stopPropagation(); - toggler.classList.toggle('outlineItemsHidden'); - - if (event.shiftKey) { - var shouldShowAll = !toggler.classList.contains('outlineItemsHidden'); - this._toggleOutlineItem(div, shouldShowAll); - } - }.bind(this); - div.insertBefore(toggler, div.firstChild); - }, - - /** - * Toggle the visibility of the subtree of an outline item. - * - * @param {Element} root - the root of the outline (sub)tree. - * @param {boolean} state - whether to show the outline (sub)tree. If false, - * the outline subtree rooted at |root| will be collapsed. - * - * @private - */ - _toggleOutlineItem: function PDFOutlineView_toggleOutlineItem(root, show) { - 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'); - } - }, - - /** - * Collapse or expand all subtrees of the outline. - */ - toggleOutlineTree: function PDFOutlineView_toggleOutlineTree() { - this._toggleOutlineItem(this.container, !this.lastToggleIsShow); - }, - - render: function PDFOutlineView_render() { - var outline = this.outline; - var outlineCount = 0; - - this.reset(); - - 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); - element.textContent = PDFJS.removeNullCharacters(item.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 }); - } - - levelData.parent.appendChild(div); - outlineCount++; - } - } - if (hasAnyNesting) { - this.container.classList.add('outlineWithDeepNesting'); - } - - this.container.appendChild(fragment); - - this._dispatchEvent(outlineCount); - } - }; - - return PDFOutlineView; -})(); - - -/** - * @typedef {Object} PDFAttachmentViewOptions - * @property {HTMLDivElement} container - The viewer element. - * @property {Array} attachments - An array of attachment objects. - * @property {DownloadManager} downloadManager - The download manager. - */ - -/** - * @class - */ -var PDFAttachmentView = (function PDFAttachmentViewClosure() { - /** - * @constructs PDFAttachmentView - * @param {PDFAttachmentViewOptions} options - */ - function PDFAttachmentView(options) { - this.container = options.container; - this.attachments = options.attachments; - this.downloadManager = options.downloadManager; - } - - PDFAttachmentView.prototype = { - reset: function PDFAttachmentView_reset() { - var container = this.container; - while (container.firstChild) { - container.removeChild(container.firstChild); - } - }, - - /** - * @private - */ - _dispatchEvent: function PDFAttachmentView_dispatchEvent(attachmentsCount) { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('attachmentsloaded', true, true, { - attachmentsCount: attachmentsCount - }); - this.container.dispatchEvent(event); - }, - - /** - * @private - */ - _bindLink: function PDFAttachmentView_bindLink(button, content, filename) { - button.onclick = function downloadFile(e) { - this.downloadManager.downloadData(content, filename, ''); - return false; - }.bind(this); - }, - - render: function PDFAttachmentView_render() { - var attachments = this.attachments; - var attachmentsCount = 0; - - this.reset(); - - 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 = getFileName(item.filename); - var div = document.createElement('div'); - div.className = 'attachmentsItem'; - var button = document.createElement('button'); - this._bindLink(button, item.content, filename); - button.textContent = PDFJS.removeNullCharacters(filename); - div.appendChild(button); - this.container.appendChild(div); - } - - this._dispatchEvent(attachmentsCount); - } - }; - - return PDFAttachmentView; -})(); - - -var PDFViewerApplication = { - initialBookmark: document.location.hash.substring(1), - initialDestination: null, - initialized: false, - fellback: false, - pdfDocument: null, - pdfLoadingTask: null, - sidebarOpen: false, - printing: false, - /** @type {PDFViewer} */ - pdfViewer: null, - /** @type {PDFThumbnailViewer} */ - pdfThumbnailViewer: null, - /** @type {PDFRenderingQueue} */ - pdfRenderingQueue: null, - /** @type {PDFPresentationMode} */ - pdfPresentationMode: null, - /** @type {PDFDocumentProperties} */ - pdfDocumentProperties: null, - /** @type {PDFLinkService} */ - pdfLinkService: null, - /** @type {PDFHistory} */ - pdfHistory: null, - pageRotation: 0, - isInitialViewSet: false, - animationStartedPromise: null, - preferenceSidebarViewOnLoad: SidebarView.NONE, - preferencePdfBugEnabled: false, - preferenceShowPreviousViewOnLoad: true, - preferenceDefaultZoomValue: '', - isViewerEmbedded: (window.parent !== window), - url: '', - - // called once when the document is loaded - initialize: function pdfViewInitialize() { - var pdfRenderingQueue = new PDFRenderingQueue(); - pdfRenderingQueue.onIdle = this.cleanup.bind(this); - this.pdfRenderingQueue = pdfRenderingQueue; - - var pdfLinkService = new PDFLinkService(); - this.pdfLinkService = pdfLinkService; - - var container = document.getElementById('viewerContainer'); - var viewer = document.getElementById('viewer'); - this.pdfViewer = new PDFViewer({ - container: container, - viewer: viewer, - renderingQueue: pdfRenderingQueue, - linkService: pdfLinkService - }); - pdfRenderingQueue.setViewer(this.pdfViewer); - pdfLinkService.setViewer(this.pdfViewer); - - var thumbnailContainer = document.getElementById('thumbnailView'); - this.pdfThumbnailViewer = new PDFThumbnailViewer({ - container: thumbnailContainer, - renderingQueue: pdfRenderingQueue, - linkService: pdfLinkService - }); - pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer); - - Preferences.initialize(); - - this.pdfHistory = new PDFHistory({ - linkService: pdfLinkService - }); - pdfLinkService.setHistory(this.pdfHistory); - - this.findController = new PDFFindController({ - pdfViewer: this.pdfViewer, - integratedFind: this.supportsIntegratedFind - }); - this.pdfViewer.setFindController(this.findController); - - this.findBar = new PDFFindBar({ - bar: document.getElementById('findbar'), - toggleButton: document.getElementById('viewFind'), - findField: document.getElementById('findInput'), - highlightAllCheckbox: document.getElementById('findHighlightAll'), - caseSensitiveCheckbox: document.getElementById('findMatchCase'), - findMsg: document.getElementById('findMsg'), - findResultsCount: document.getElementById('findResultsCount'), - findStatusIcon: document.getElementById('findStatusIcon'), - findPreviousButton: document.getElementById('findPrevious'), - findNextButton: document.getElementById('findNext'), - findController: this.findController - }); - - this.findController.setFindBar(this.findBar); - - HandTool.initialize({ - container: container, - toggleHandTool: document.getElementById('toggleHandTool') - }); - - this.pdfDocumentProperties = new PDFDocumentProperties({ - overlayName: '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') - } - }); - - SecondaryToolbar.initialize({ - toolbar: document.getElementById('secondaryToolbar'), - toggleButton: document.getElementById('secondaryToolbarToggle'), - presentationModeButton: - document.getElementById('secondaryPresentationMode'), - openFile: document.getElementById('secondaryOpenFile'), - print: document.getElementById('secondaryPrint'), - download: document.getElementById('secondaryDownload'), - viewBookmark: document.getElementById('secondaryViewBookmark'), - firstPage: document.getElementById('firstPage'), - lastPage: document.getElementById('lastPage'), - pageRotateCw: document.getElementById('pageRotateCw'), - pageRotateCcw: document.getElementById('pageRotateCcw'), - documentPropertiesButton: document.getElementById('documentProperties') - }); - - if (this.supportsFullscreen) { - var toolbar = SecondaryToolbar; - this.pdfPresentationMode = new PDFPresentationMode({ - container: container, - viewer: viewer, - pdfViewer: this.pdfViewer, - pdfThumbnailViewer: this.pdfThumbnailViewer, - contextMenuItems: [ - { element: document.getElementById('contextFirstPage'), - handler: toolbar.firstPageClick.bind(toolbar) }, - { element: document.getElementById('contextLastPage'), - handler: toolbar.lastPageClick.bind(toolbar) }, - { element: document.getElementById('contextPageRotateCw'), - handler: toolbar.pageRotateCwClick.bind(toolbar) }, - { element: document.getElementById('contextPageRotateCcw'), - handler: toolbar.pageRotateCcwClick.bind(toolbar) } - ] + enhanceTextSelection: enhanceTextSelection }); } + }]); - PasswordPrompt.initialize({ - overlayName: 'passwordOverlay', - passwordField: document.getElementById('password'), - passwordText: document.getElementById('passwordText'), - passwordSubmit: document.getElementById('passwordSubmit'), - passwordCancel: document.getElementById('passwordCancel') - }); + return DefaultTextLayerFactory; +}(); - var self = this; - var initializedPromise = Promise.all([ - Preferences.get('enableWebGL').then(function resolved(value) { - PDFJS.disableWebGL = !value; - }), - Preferences.get('sidebarViewOnLoad').then(function resolved(value) { - self.preferenceSidebarViewOnLoad = value; - }), - Preferences.get('pdfBugEnabled').then(function resolved(value) { - self.preferencePdfBugEnabled = value; - }), - Preferences.get('showPreviousViewOnLoad').then(function resolved(value) { - self.preferenceShowPreviousViewOnLoad = value; - }), - Preferences.get('defaultZoomValue').then(function resolved(value) { - self.preferenceDefaultZoomValue = value; - }), - Preferences.get('disableTextLayer').then(function resolved(value) { - if (PDFJS.disableTextLayer === true) { - return; - } - PDFJS.disableTextLayer = value; - }), - Preferences.get('disableRange').then(function resolved(value) { - if (PDFJS.disableRange === true) { - return; - } - PDFJS.disableRange = value; - }), - Preferences.get('disableStream').then(function resolved(value) { - if (PDFJS.disableStream === true) { - return; - } - PDFJS.disableStream = value; - }), - Preferences.get('disableAutoFetch').then(function resolved(value) { - PDFJS.disableAutoFetch = value; - }), - Preferences.get('disableFontFace').then(function resolved(value) { - if (PDFJS.disableFontFace === true) { - return; - } - PDFJS.disableFontFace = value; - }), - Preferences.get('useOnlyCssZoom').then(function resolved(value) { - PDFJS.useOnlyCssZoom = value; - }), - Preferences.get('externalLinkTarget').then(function resolved(value) { - if (PDFJS.isExternalLinkTargetSet()) { - return; - } - PDFJS.externalLinkTarget = value; - }), - // TODO move more preferences and other async stuff here - ]).catch(function (reason) { }); +exports.DefaultTextLayerFactory = DefaultTextLayerFactory; - return initializedPromise.then(function () { - if (self.isViewerEmbedded && !PDFJS.isExternalLinkTargetSet()) { - // Prevent external links from "replacing" the viewer, - // when it's embedded in e.g. an iframe or an object. - PDFJS.externalLinkTarget = PDFJS.LinkTarget.TOP; - } +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { - self.initialized = true; - }); - }, - - zoomIn: function pdfViewZoomIn(ticks) { - var newScale = this.pdfViewer.currentScale; - do { - newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2); - newScale = Math.ceil(newScale * 10) / 10; - newScale = Math.min(MAX_SCALE, newScale); - } while (--ticks > 0 && newScale < MAX_SCALE); - this.pdfViewer.currentScaleValue = newScale; - }, - - zoomOut: function pdfViewZoomOut(ticks) { - var newScale = this.pdfViewer.currentScale; - do { - newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2); - newScale = Math.floor(newScale * 10) / 10; - newScale = Math.max(MIN_SCALE, newScale); - } while (--ticks > 0 && newScale > MIN_SCALE); - this.pdfViewer.currentScaleValue = newScale; - }, - - get pagesCount() { - return this.pdfDocument.numPages; - }, - - set page(val) { - this.pdfLinkService.page = val; - }, - - get page() { // TODO remove - return this.pdfLinkService.page; - }, - - get supportsPrinting() { - var canvas = document.createElement('canvas'); - var value = 'mozPrintCallback' in canvas; - - return PDFJS.shadow(this, 'supportsPrinting', value); - }, - - get supportsFullscreen() { - var doc = document.documentElement; - var support = !!(doc.requestFullscreen || doc.mozRequestFullScreen || - doc.webkitRequestFullScreen || doc.msRequestFullscreen); - - if (document.fullscreenEnabled === false || - document.mozFullScreenEnabled === false || - document.webkitFullscreenEnabled === false || - document.msFullscreenEnabled === false) { - support = false; - } - if (support && PDFJS.disableFullscreen === true) { - support = false; - } - - return PDFJS.shadow(this, 'supportsFullscreen', support); - }, - - get supportsIntegratedFind() { - var support = false; - - return PDFJS.shadow(this, 'supportsIntegratedFind', support); - }, - - get supportsDocumentFonts() { - var support = true; - - return PDFJS.shadow(this, 'supportsDocumentFonts', support); - }, - - get supportsDocumentColors() { - var support = true; - - return PDFJS.shadow(this, 'supportsDocumentColors', support); - }, - - get loadingBar() { - var bar = new ProgressBar('#loadingBar', {}); - - return PDFJS.shadow(this, 'loadingBar', bar); - }, - - get supportedMouseWheelZoomModifierKeys() { - var support = { - ctrlKey: true, - metaKey: true, - }; - - return PDFJS.shadow(this, 'supportedMouseWheelZoomModifierKeys', support); - }, +"use strict"; - setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) { - this.url = url; - try { - this.setTitle(decodeURIComponent(getFileName(url)) || url); - } catch (e) { - // decodeURIComponent may throw URIError, - // fall back to using the unprocessed url in that case - this.setTitle(url); - } - }, +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.SecondaryToolbar = void 0; - setTitle: function pdfViewSetTitle(title) { - if (this.isViewerEmbedded) { - // Embedded PDF viewers should not be changing their parent page's title. - return; - } - document.title = title; - }, +var _ui_utils = __webpack_require__(6); - /** - * Closes opened PDF document. - * @returns {Promise} - Returns the promise, which is resolved when all - * destruction is completed. - */ - close: function pdfViewClose() { - var errorWrapper = document.getElementById('errorWrapper'); - errorWrapper.setAttribute('hidden', 'true'); +var _pdf_cursor_tools = __webpack_require__(8); - if (!this.pdfLoadingTask) { - return Promise.resolve(); - } +var _pdf_single_page_viewer = __webpack_require__(34); - var promise = this.pdfLoadingTask.destroy(); - this.pdfLoadingTask = null; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - if (this.pdfDocument) { - this.pdfDocument = null; +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); } } - this.pdfThumbnailViewer.setDocument(null); - this.pdfViewer.setDocument(null); - this.pdfLinkService.setDocument(null, null); - } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - if (typeof PDFBug !== 'undefined') { - PDFBug.cleanup(); - } - return promise; - }, +var SecondaryToolbar = +/*#__PURE__*/ +function () { + function SecondaryToolbar(options, mainContainer, eventBus) { + var _this = this; - /** - * Opens PDF document specified by URL or array with additional arguments. - * @param {string|TypedArray|ArrayBuffer} file - PDF location or binary data. - * @param {Object} args - (optional) Additional arguments for the getDocument - * call, e.g. HTTP headers ('httpHeaders') or - * alternative data transport ('range'). - * @returns {Promise} - Returns the promise, which is resolved when document - * is opened. - */ - open: function pdfViewOpen(file, args) { - var scale = 0; - if (arguments.length > 2 || typeof args === 'number') { - console.warn('Call of open() with obsolete signature.'); - if (typeof args === 'number') { - scale = args; // scale argument was found - } - args = arguments[4] || null; - if (arguments[3] && typeof arguments[3] === 'object') { - // The pdfDataRangeTransport argument is present. - args = Object.create(args); - args.range = arguments[3]; - } - if (typeof arguments[2] === 'string') { - // The password argument is present. - args = Object.create(args); - args.password = arguments[2]; - } - } + _classCallCheck(this, SecondaryToolbar); - if (this.pdfLoadingTask) { - // We need to destroy already opened document. - return this.close().then(function () { - // Reload the preferences if a document was previously opened. - Preferences.reload(); - // ... and repeat the open() call. - return this.open(file, args); - }.bind(this)); - } - - var parameters = Object.create(null); - if (typeof file === 'string') { // URL - this.setTitleUsingUrl(file); - parameters.url = file; - } else if (file && 'byteLength' in file) { // ArrayBuffer - parameters.data = file; - } else if (file.url && file.originalUrl) { - this.setTitleUsingUrl(file.originalUrl); - parameters.url = file.url; - } - if (args) { - for (var prop in args) { - parameters[prop] = args[prop]; - } - } - - var self = this; - self.downloadComplete = false; - - var loadingTask = PDFJS.getDocument(parameters); - this.pdfLoadingTask = loadingTask; - - loadingTask.onPassword = function passwordNeeded(updatePassword, reason) { - PasswordPrompt.updatePassword = updatePassword; - PasswordPrompt.reason = reason; - PasswordPrompt.open(); - }; - - loadingTask.onProgress = function getDocumentProgress(progressData) { - self.progress(progressData.loaded / progressData.total); - }; - - // Listen for unsupported features to trigger the fallback UI. - loadingTask.onUnsupportedFeature = this.fallback.bind(this); - - var result = loadingTask.promise.then( - function getDocumentCallback(pdfDocument) { - self.load(pdfDocument, scale); + this.toolbar = options.toolbar; + this.toggleButton = options.toggleButton; + this.toolbarButtonContainer = options.toolbarButtonContainer; + this.buttons = [{ + element: options.presentationModeButton, + eventName: 'presentationmode', + close: true + }, { + element: options.openFileButton, + eventName: 'openfile', + close: true + }, { + element: options.printButton, + eventName: 'print', + close: true + }, { + element: options.downloadButton, + eventName: 'download', + close: true + }, { + element: options.viewBookmarkButton, + eventName: null, + close: true + }, { + element: options.firstPageButton, + eventName: 'firstpage', + close: true + }, { + element: options.lastPageButton, + eventName: 'lastpage', + close: true + }, { + element: options.pageRotateCwButton, + eventName: 'rotatecw', + close: false + }, { + element: options.pageRotateCcwButton, + eventName: 'rotateccw', + close: false + }, { + element: options.cursorSelectToolButton, + eventName: 'switchcursortool', + eventDetails: { + tool: _pdf_cursor_tools.CursorTool.SELECT }, - function getDocumentError(exception) { - var message = exception && exception.message; - var loadingErrorMessage = 'An error occurred while loading the PDF.'; - - if (exception instanceof PDFJS.InvalidPDFException) { - // change error message also for other builds - loadingErrorMessage = 'Invalid or corrupted PDF file.'; - } else if (exception instanceof PDFJS.MissingPDFException) { - // special message for missing PDF's - loadingErrorMessage = 'Missing PDF file.'; - } else if (exception instanceof PDFJS.UnexpectedResponseException) { - loadingErrorMessage = 'Unexpected server response.'; - } - - var moreInfo = { - message: message - }; - self.error(loadingErrorMessage, moreInfo); - - throw new Error(loadingErrorMessage); - } - ); - - if (args && args.length) { - PDFViewerApplication.pdfDocumentProperties.setFileSize(args.length); - } - return result; - }, - - download: function pdfViewDownload() { - function downloadByUrl() { - downloadManager.downloadUrl(url, filename); - } - - var url = this.url.split('#')[0]; - var filename = getPDFFileNameFromURL(url); - var downloadManager = new DownloadManager(); - downloadManager.onerror = function (err) { - // This error won't really be helpful because it's likely the - // fallback won't work either (or is already open). - PDFViewerApplication.error('PDF failed to download.'); - }; - - if (!this.pdfDocument) { // the PDF is not ready yet - downloadByUrl(); - return; - } - - if (!this.downloadComplete) { // the PDF is still downloading - downloadByUrl(); - return; - } - - this.pdfDocument.getData().then( - function getDataSuccess(data) { - var blob = PDFJS.createBlob(data, 'application/pdf'); - downloadManager.download(blob, url, filename); + close: true + }, { + element: options.cursorHandToolButton, + eventName: 'switchcursortool', + eventDetails: { + tool: _pdf_cursor_tools.CursorTool.HAND }, - downloadByUrl // Error occurred try downloading with just the url. - ).then(null, downloadByUrl); - }, + close: true + }, { + element: options.scrollVerticalButton, + eventName: 'switchscrollmode', + eventDetails: { + mode: _ui_utils.ScrollMode.VERTICAL + }, + close: true + }, { + element: options.scrollHorizontalButton, + eventName: 'switchscrollmode', + eventDetails: { + mode: _ui_utils.ScrollMode.HORIZONTAL + }, + close: true + }, { + element: options.scrollWrappedButton, + eventName: 'switchscrollmode', + eventDetails: { + mode: _ui_utils.ScrollMode.WRAPPED + }, + close: true + }, { + element: options.spreadNoneButton, + eventName: 'switchspreadmode', + eventDetails: { + mode: _ui_utils.SpreadMode.NONE + }, + close: true + }, { + element: options.spreadOddButton, + eventName: 'switchspreadmode', + eventDetails: { + mode: _ui_utils.SpreadMode.ODD + }, + close: true + }, { + element: options.spreadEvenButton, + eventName: 'switchspreadmode', + eventDetails: { + mode: _ui_utils.SpreadMode.EVEN + }, + close: true + }, { + element: options.documentPropertiesButton, + eventName: 'documentproperties', + close: true + }]; + this.items = { + firstPage: options.firstPageButton, + lastPage: options.lastPageButton, + pageRotateCw: options.pageRotateCwButton, + pageRotateCcw: options.pageRotateCcwButton + }; + this.mainContainer = mainContainer; + this.eventBus = eventBus; + this.opened = false; + this.containerHeight = null; + this.previousContainerHeight = null; + this.reset(); - fallback: function pdfViewFallback(featureId) { - }, + this._bindClickListeners(); - /** - * Show the error box. - * @param {String} message A message that is human readable. - * @param {Object} moreInfo (optional) Further information about the error - * that is more technical. Should have a 'message' - * and optionally a 'stack' property. - */ - error: function pdfViewError(message, moreInfo) { - var moreInfoText = 'PDF.js v' + (PDFJS.version || '?') + '(build: ' + (PDFJS.build || '?') + ')\n'; - if (moreInfo) { - moreInfoText += 'Message: ' + moreInfo.message - if (moreInfo.stack) { - moreInfoText += '\nStack: ' + moreInfo.stack; + this._bindCursorToolsListener(options); + + this._bindScrollModeListener(options); + + this._bindSpreadModeListener(options); + + 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'); } else { - if (moreInfo.filename) { - moreInfoText += '\nFile: ' + moreInfo.filename; - } - if (moreInfo.lineNumber) { - moreInfoText += '\nLine: ' + moreInfo.lineNumber; - } + _this.toolbarButtonContainer.classList.remove('hiddenScrollModeButtons', 'hiddenSpreadModeButtons'); } - } - - var errorWrapper = document.getElementById('errorWrapper'); - errorWrapper.removeAttribute('hidden'); - - var errorMessage = document.getElementById('errorMessage'); - errorMessage.textContent = message; - - var closeButton = document.getElementById('errorClose'); - closeButton.onclick = function() { - errorWrapper.setAttribute('hidden', 'true'); - }; - - var errorMoreInfo = document.getElementById('errorMoreInfo'); - var moreInfoButton = document.getElementById('errorShowMore'); - var lessInfoButton = document.getElementById('errorShowLess'); - moreInfoButton.onclick = function() { - 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'); - }; - moreInfoButton.oncontextmenu = noContextMenuHandler; - lessInfoButton.oncontextmenu = noContextMenuHandler; - closeButton.oncontextmenu = noContextMenuHandler; - moreInfoButton.removeAttribute('hidden'); - lessInfoButton.setAttribute('hidden', 'true'); - errorMoreInfo.value = moreInfoText; - }, - - progress: function pdfViewProgress(level) { - var percent = Math.round(level * 100); - // When we transition from full request to range requests, it's possible - // that we discard some of the loaded data. This can cause the loading - // bar to move backwards. So prevent this by only updating the bar if it - // increases. - if (percent > this.loadingBar.percent || isNaN(percent)) { - this.loadingBar.percent = percent; - - // When disableAutoFetch is enabled, it's not uncommon for the entire file - // to never be fetched (depends on e.g. the file structure). In this case - // the loading bar will not be completely filled, nor will it be hidden. - // To prevent displaying a partially filled loading bar permanently, we - // hide it when no data has been loaded during a certain amount of time. - if (PDFJS.disableAutoFetch && percent) { - if (this.disableAutoFetchLoadingBarTimeout) { - clearTimeout(this.disableAutoFetchLoadingBarTimeout); - this.disableAutoFetchLoadingBarTimeout = null; - } - this.loadingBar.show(); - - this.disableAutoFetchLoadingBarTimeout = setTimeout(function () { - this.loadingBar.hide(); - this.disableAutoFetchLoadingBarTimeout = null; - }.bind(this), DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT); - } - } - }, - - load: function pdfViewLoad(pdfDocument, scale) { - var self = this; - scale = scale || UNKNOWN_SCALE; - - this.findController.reset(); - - this.pdfDocument = pdfDocument; - - this.pdfDocumentProperties.setDocumentAndUrl(pdfDocument, this.url); - - var downloadedPromise = pdfDocument.getDownloadInfo().then(function() { - self.downloadComplete = true; - self.loadingBar.hide(); }); + } - var pagesCount = pdfDocument.numPages; - document.getElementById('numPages').textContent = 'of ' + pagesCount; - document.getElementById('pageNumber').max = pagesCount; + _createClass(SecondaryToolbar, [{ + key: "setPageNumber", + value: function setPageNumber(pageNumber) { + this.pageNumber = pageNumber; - var id = this.documentFingerprint = pdfDocument.fingerprint; - var store = this.store = new ViewHistory(id); + this._updateUIState(); + } + }, { + key: "setPagesCount", + value: function setPagesCount(pagesCount) { + this.pagesCount = pagesCount; - var baseDocumentUrl = null; - this.pdfLinkService.setDocument(pdfDocument, baseDocumentUrl); + this._updateUIState(); + } + }, { + key: "reset", + value: function reset() { + this.pageNumber = 0; + this.pagesCount = 0; - var pdfViewer = this.pdfViewer; - pdfViewer.currentScale = scale; - pdfViewer.setDocument(pdfDocument); - var firstPagePromise = pdfViewer.firstPagePromise; - var pagesPromise = pdfViewer.pagesPromise; - var onePageRendered = pdfViewer.onePageRendered; + this._updateUIState(); - this.pageRotation = 0; - this.isInitialViewSet = false; - - this.pdfThumbnailViewer.setDocument(pdfDocument); - - firstPagePromise.then(function(pdfPage) { - downloadedPromise.then(function () { - var event = document.createEvent('CustomEvent'); - event.initCustomEvent('documentload', true, true, {}); - window.dispatchEvent(event); + this.eventBus.dispatch('secondarytoolbarreset', { + source: this }); + } + }, { + key: "_updateUIState", + value: function _updateUIState() { + this.items.firstPage.disabled = this.pageNumber <= 1; + this.items.lastPage.disabled = this.pageNumber >= this.pagesCount; + this.items.pageRotateCw.disabled = this.pagesCount === 0; + this.items.pageRotateCcw.disabled = this.pagesCount === 0; + } + }, { + key: "_bindClickListeners", + value: function _bindClickListeners() { + var _this2 = this; - self.loadingBar.setWidth(document.getElementById('viewer')); + this.toggleButton.addEventListener('click', this.toggle.bind(this)); - if (!PDFJS.disableHistory && !self.isViewerEmbedded) { - // The browsing history is only enabled when the viewer is standalone, - // i.e. not when it is embedded in a web page. - if (!self.preferenceShowPreviousViewOnLoad) { - self.pdfHistory.clearHistoryState(); - } - self.pdfHistory.initialize(self.documentFingerprint); + var _loop = function _loop(button) { + var _this2$buttons$button = _this2.buttons[button], + element = _this2$buttons$button.element, + eventName = _this2$buttons$button.eventName, + close = _this2$buttons$button.close, + eventDetails = _this2$buttons$button.eventDetails; + element.addEventListener('click', function (evt) { + if (eventName !== null) { + var details = { + source: _this2 + }; - if (self.pdfHistory.initialDestination) { - self.initialDestination = self.pdfHistory.initialDestination; - } else if (self.pdfHistory.initialBookmark) { - self.initialBookmark = self.pdfHistory.initialBookmark; - } - } + for (var property in eventDetails) { + details[property] = eventDetails[property]; + } - var initialParams = { - destination: self.initialDestination, - bookmark: self.initialBookmark, - hash: null, + _this2.eventBus.dispatch(eventName, details); + } + + if (close) { + _this2.close(); + } + }); }; - store.initializedPromise.then(function resolved() { - var storedHash = null; - if (self.preferenceShowPreviousViewOnLoad && - store.get('exists', false)) { - var pageNum = store.get('page', '1'); - var zoom = self.preferenceDefaultZoomValue || - store.get('zoom', DEFAULT_SCALE_VALUE); - var left = store.get('scrollLeft', '0'); - var top = store.get('scrollTop', '0'); - - storedHash = 'page=' + pageNum + '&zoom=' + zoom + ',' + - left + ',' + top; - } else if (self.preferenceDefaultZoomValue) { - storedHash = 'page=1&zoom=' + self.preferenceDefaultZoomValue; - } - self.setInitialView(storedHash, scale); - - initialParams.hash = storedHash; - - // Make all navigation keys work on document load, - // unless the viewer is embedded in a web page. - if (!self.isViewerEmbedded) { - self.pdfViewer.focus(); - } - }, function rejected(reason) { - console.error(reason); - self.setInitialView(null, scale); + for (var button in this.buttons) { + _loop(button); + } + } + }, { + key: "_bindCursorToolsListener", + value: function _bindCursorToolsListener(buttons) { + 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", + value: function _bindScrollModeListener(buttons) { + var _this3 = this; - // For documents with different page sizes, - // ensure that the correct location becomes visible on load. - pagesPromise.then(function resolved() { - if (!initialParams.destination && !initialParams.bookmark && - !initialParams.hash) { - return; - } - if (self.hasEqualPageSizes) { - return; - } - self.initialDestination = initialParams.destination; - self.initialBookmark = initialParams.bookmark; + 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; + } - self.pdfViewer.currentScaleValue = self.pdfViewer.currentScaleValue; - self.setInitialView(initialParams.hash, scale); + this.eventBus.on('scrollmodechanged', scrollModeChanged); + this.eventBus.on('secondarytoolbarreset', function (evt) { + if (evt.source === _this3) { + scrollModeChanged({ + mode: _ui_utils.ScrollMode.VERTICAL + }); + } }); + } + }, { + key: "_bindSpreadModeListener", + value: function _bindSpreadModeListener(buttons) { + var _this4 = this; + + 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) { + if (evt.source === _this4) { + spreadModeChanged({ + mode: _ui_utils.SpreadMode.NONE + }); + } + }); + } + }, { + key: "open", + value: function open() { + if (this.opened) { + return; + } + + this.opened = true; + + this._setMaxHeight(); + + this.toggleButton.classList.add('toggled'); + this.toolbar.classList.remove('hidden'); + } + }, { + key: "close", + value: function close() { + if (!this.opened) { + return; + } + + this.opened = false; + this.toolbar.classList.add('hidden'); + this.toggleButton.classList.remove('toggled'); + } + }, { + key: "toggle", + value: function toggle() { + if (this.opened) { + this.close(); + } else { + this.open(); + } + } + }, { + 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.previousContainerHeight = this.containerHeight; + } + }, { + key: "isOpen", + get: function get() { + return this.opened; + } + }]); + + return SecondaryToolbar; +}(); + +exports.SecondaryToolbar = SecondaryToolbar; + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFSinglePageViewer = void 0; + +var _base_viewer = __webpack_require__(29); + +var _pdfjsLib = __webpack_require__(7); + +function _typeof(obj) { 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; } + +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 _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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +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); } + +var PDFSinglePageViewer = +/*#__PURE__*/ +function (_BaseViewer) { + _inherits(PDFSinglePageViewer, _BaseViewer); + + function PDFSinglePageViewer(options) { + var _this; + + _classCallCheck(this, PDFSinglePageViewer); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(PDFSinglePageViewer).call(this, options)); + + _this.eventBus.on('pagesinit', function (evt) { + _this._ensurePageViewVisible(); }); - pagesPromise.then(function() { - if (self.supportsPrinting) { - pdfDocument.getJavaScript().then(function(javaScript) { - if (javaScript.length) { - console.warn('Warning: JavaScript is not supported'); - self.fallback(PDFJS.UNSUPPORTED_FEATURES.javaScript); + return _this; + } + + _createClass(PDFSinglePageViewer, [{ + key: "_resetView", + value: function _resetView() { + _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_resetView", this).call(this); + + this._previousPageNumber = 1; + this._shadowViewer = document.createDocumentFragment(); + this._updateScrollDown = null; + } + }, { + 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.'); } - // Hack to support auto printing. - 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; - } + + 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.'); } - }); - // outline depends on pagesRefMap - var promises = [pagesPromise, this.animationStartedPromise]; - Promise.all(promises).then(function() { - pdfDocument.getOutline().then(function(outline) { - var container = document.getElementById('outlineView'); - self.outline = new PDFOutlineView({ - container: container, - outline: outline, - linkService: self.pdfLinkService - }); - self.outline.render(); - document.getElementById('viewOutline').disabled = !outline; + this._previousPageNumber = this._currentPageNumber; + } + }, { + key: "_scrollUpdate", + value: function _scrollUpdate() { + if (this._updateScrollDown) { + this._updateScrollDown(); + } - if (!outline && !container.classList.contains('hidden')) { - self.switchSidebarView('thumbs'); - } - if (outline && - self.preferenceSidebarViewOnLoad === SidebarView.OUTLINE) { - self.switchSidebarView('outline', true); - } + _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_scrollUpdate", this).call(this); + } + }, { + key: "_scrollIntoView", + value: function _scrollIntoView(_ref) { + var _this2 = this; + + var pageDiv = _ref.pageDiv, + _ref$pageSpot = _ref.pageSpot, + pageSpot = _ref$pageSpot === void 0 ? null : _ref$pageSpot, + _ref$pageNumber = _ref.pageNumber, + pageNumber = _ref$pageNumber === void 0 ? null : _ref$pageNumber; + + if (pageNumber) { + this._setCurrentPageNumber(pageNumber); + } + + var scrolledDown = this._currentPageNumber >= this._previousPageNumber; + + this._ensurePageViewVisible(); + + this.update(); + + _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_scrollIntoView", this).call(this, { + pageDiv: pageDiv, + pageSpot: pageSpot, + pageNumber: pageNumber }); - pdfDocument.getAttachments().then(function(attachments) { - var container = document.getElementById('attachmentsView'); - self.attachments = new PDFAttachmentView({ - container: container, - attachments: attachments, - downloadManager: new DownloadManager() + + this._updateScrollDown = function () { + _this2.scroll.down = scrolledDown; + _this2._updateScrollDown = null; + }; + } + }, { + key: "_getVisiblePages", + value: function _getVisiblePages() { + return this._getCurrentVisiblePage(); + } + }, { + key: "_updateHelper", + value: function _updateHelper(visiblePages) {} + }, { + key: "_updateScrollMode", + value: function _updateScrollMode() {} + }, { + key: "_updateSpreadMode", + value: function _updateSpreadMode() {} + }, { + key: "_setDocumentViewerElement", + get: function get() { + return (0, _pdfjsLib.shadow)(this, '_setDocumentViewerElement', this._shadowViewer); + } + }, { + key: "_isScrollModeHorizontal", + get: function get() { + return (0, _pdfjsLib.shadow)(this, '_isScrollModeHorizontal', false); + } + }]); + + return PDFSinglePageViewer; +}(_base_viewer.BaseViewer); + +exports.PDFSinglePageViewer = PDFSinglePageViewer; + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Toolbar = void 0; + +var _ui_utils = __webpack_require__(6); + +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 PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading'; +var SCALE_SELECT_CONTAINER_PADDING = 8; +var SCALE_SELECT_PADDING = 22; + +var Toolbar = +/*#__PURE__*/ +function () { + function Toolbar(options, eventBus) { + var l10n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ui_utils.NullL10n; + + _classCallCheck(this, Toolbar); + + this.toolbar = options.container; + this.eventBus = eventBus; + this.l10n = l10n; + this.items = options; + this._wasLocalized = false; + this.reset(); + + this._bindListeners(); + } + + _createClass(Toolbar, [{ + key: "setPageNumber", + value: function setPageNumber(pageNumber, pageLabel) { + this.pageNumber = pageNumber; + this.pageLabel = pageLabel; + + this._updateUIState(false); + } + }, { + key: "setPagesCount", + value: function setPagesCount(pagesCount, hasPageLabels) { + this.pagesCount = pagesCount; + this.hasPageLabels = hasPageLabels; + + this._updateUIState(true); + } + }, { + key: "setPageScale", + value: function setPageScale(pageScaleValue, pageScale) { + this.pageScaleValue = (pageScaleValue || pageScale).toString(); + this.pageScale = pageScale; + + this._updateUIState(false); + } + }, { + key: "reset", + value: function reset() { + this.pageNumber = 0; + this.pageLabel = null; + this.hasPageLabels = false; + this.pagesCount = 0; + this.pageScaleValue = _ui_utils.DEFAULT_SCALE_VALUE; + this.pageScale = _ui_utils.DEFAULT_SCALE; + + this._updateUIState(true); + } + }, { + key: "_bindListeners", + value: function _bindListeners() { + var _this = this; + + var eventBus = this.eventBus, + items = this.items; + var self = this; + items.previous.addEventListener('click', function () { + eventBus.dispatch('previouspage', { + source: self }); - self.attachments.render(); - document.getElementById('viewAttachments').disabled = !attachments; - - if (!attachments && !container.classList.contains('hidden')) { - self.switchSidebarView('thumbs'); - } - if (attachments && - self.preferenceSidebarViewOnLoad === SidebarView.ATTACHMENTS) { - self.switchSidebarView('attachments', true); - } }); - }); - - if (self.preferenceSidebarViewOnLoad === SidebarView.THUMBS) { - Promise.all([firstPagePromise, onePageRendered]).then(function () { - self.switchSidebarView('thumbs', true); + items.next.addEventListener('click', function () { + eventBus.dispatch('nextpage', { + source: self + }); }); - } - - pdfDocument.getMetadata().then(function(data) { - var info = data.info, metadata = data.metadata; - self.documentInfo = info; - self.metadata = metadata; - - // Provides some basic debug information - console.log('PDF ' + pdfDocument.fingerprint + ' [' + - info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() + - ' / ' + (info.Creator || '-').trim() + ']' + - ' (PDF.js: ' + (PDFJS.version || '-') + - (!PDFJS.disableWebGL ? ' [WebGL]' : '') + ')'); - - var pdfTitle; - if (metadata && metadata.has('dc:title')) { - var title = metadata.get('dc:title'); - // Ghostscript sometimes return 'Untitled', sets the title to 'Untitled' - if (title !== 'Untitled') { - pdfTitle = title; - } - } - - if (!pdfTitle && info && info['Title']) { - pdfTitle = info['Title']; - } - - if (pdfTitle) { - self.setTitle(pdfTitle + ' - ' + document.title); - } - - if (info.IsAcroFormPresent) { - console.warn('Warning: AcroForm/XFA is not supported'); - self.fallback(PDFJS.UNSUPPORTED_FEATURES.forms); - } - - }); - }, - - setInitialView: function pdfViewSetInitialView(storedHash, scale) { - this.isInitialViewSet = true; - - // When opening a new file, when one is already loaded in the viewer, - // ensure that the 'pageNumber' element displays the correct value. - document.getElementById('pageNumber').value = - this.pdfViewer.currentPageNumber; - - if (this.initialDestination) { - this.pdfLinkService.navigateTo(this.initialDestination); - this.initialDestination = null; - } else if (this.initialBookmark) { - this.pdfLinkService.setHash(this.initialBookmark); - this.pdfHistory.push({ hash: this.initialBookmark }, true); - this.initialBookmark = null; - } else if (storedHash) { - this.pdfLinkService.setHash(storedHash); - } else if (scale) { - this.pdfViewer.currentScaleValue = scale; - this.page = 1; - } - - if (!this.pdfViewer.currentScaleValue) { - // Scale was not initialized: invalid bookmark or scale was not specified. - // Setting the default one. - this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE; - } - }, - - cleanup: function pdfViewCleanup() { - if (!this.pdfDocument) { - return; // run cleanup when document is loaded - } - this.pdfViewer.cleanup(); - this.pdfThumbnailViewer.cleanup(); - this.pdfDocument.cleanup(); - }, - - forceRendering: function pdfViewForceRendering() { - this.pdfRenderingQueue.printing = this.printing; - this.pdfRenderingQueue.isThumbnailViewEnabled = this.sidebarOpen; - this.pdfRenderingQueue.renderHighestPriority(); - }, - - refreshThumbnailViewer: function pdfViewRefreshThumbnailViewer() { - var pdfViewer = this.pdfViewer; - var thumbnailViewer = this.pdfThumbnailViewer; - - // set thumbnail images of rendered pages - var pagesCount = pdfViewer.pagesCount; - for (var pageIndex = 0; pageIndex < pagesCount; pageIndex++) { - var pageView = pdfViewer.getPageView(pageIndex); - if (pageView && pageView.renderingState === RenderingStates.FINISHED) { - var thumbnailView = thumbnailViewer.getThumbnail(pageIndex); - thumbnailView.setImage(pageView); - } - } - - thumbnailViewer.scrollThumbnailIntoView(this.page); - }, - - switchSidebarView: function pdfViewSwitchSidebarView(view, openSidebar) { - if (openSidebar && !this.sidebarOpen) { - document.getElementById('sidebarToggle').click(); - } - var thumbsView = document.getElementById('thumbnailView'); - var outlineView = document.getElementById('outlineView'); - var attachmentsView = document.getElementById('attachmentsView'); - - var thumbsButton = document.getElementById('viewThumbnail'); - var outlineButton = document.getElementById('viewOutline'); - var attachmentsButton = document.getElementById('viewAttachments'); - - switch (view) { - case 'thumbs': - var wasAnotherViewVisible = thumbsView.classList.contains('hidden'); - - thumbsButton.classList.add('toggled'); - outlineButton.classList.remove('toggled'); - attachmentsButton.classList.remove('toggled'); - thumbsView.classList.remove('hidden'); - outlineView.classList.add('hidden'); - attachmentsView.classList.add('hidden'); - - this.forceRendering(); - - if (wasAnotherViewVisible) { - this.pdfThumbnailViewer.ensureThumbnailVisible(this.page); - } - break; - - case 'outline': - if (outlineButton.disabled) { + 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 () { + this.select(); + }); + items.pageNumber.addEventListener('change', function () { + eventBus.dispatch('pagenumberchanged', { + source: self, + value: this.value + }); + }); + items.scaleSelect.addEventListener('change', function () { + if (this.value === 'custom') { return; } - thumbsButton.classList.remove('toggled'); - outlineButton.classList.add('toggled'); - attachmentsButton.classList.remove('toggled'); - thumbsView.classList.add('hidden'); - outlineView.classList.remove('hidden'); - attachmentsView.classList.add('hidden'); - break; - case 'attachments': - if (attachmentsButton.disabled) { - return; + 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(); + }); + } + }, { + key: "_localized", + value: function _localized() { + this._wasLocalized = true; + + this._adjustScaleWidth(); + + this._updateUIState(true); + } + }, { + 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, + pageScale = this.pageScale, + items = this.items; + + if (resetNumPages) { + if (this.hasPageLabels) { + items.pageNumber.type = 'text'; + } else { + items.pageNumber.type = 'number'; + this.l10n.get('of_pages', { + pagesCount: pagesCount + }, 'of {{pagesCount}}').then(function (msg) { + items.numPages.textContent = msg; + }); } - thumbsButton.classList.remove('toggled'); - outlineButton.classList.remove('toggled'); - attachmentsButton.classList.add('toggled'); - thumbsView.classList.add('hidden'); - outlineView.classList.add('hidden'); - attachmentsView.classList.remove('hidden'); - break; - } - }, - beforePrint: function pdfViewSetupBeforePrint() { - if (!this.supportsPrinting) { - var printMessage = 'Warning: Printing is not fully supported by this browser.'; - this.error(printMessage); - return; - } + items.pageNumber.max = pagesCount; + } - var alertNotReady = false; - var i, ii; - if (!this.pdfDocument || !this.pagesCount) { - alertNotReady = true; - } else { - for (i = 0, ii = this.pagesCount; i < ii; ++i) { - if (!this.pdfViewer.getPageView(i).pdfPage) { - alertNotReady = true; + if (this.hasPageLabels) { + items.pageNumber.value = this.pageLabel; + this.l10n.get('page_of_pages', { + pageNumber: pageNumber, + pagesCount: pagesCount + }, '({{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; + 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; + } + + option.selected = true; + predefinedValueFound = true; + } + + if (!predefinedValueFound) { + items.customScaleOption.textContent = msg; + items.customScaleOption.selected = true; + } + }); + } + }, { + 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;'); + } + }); + } + }]); + + return Toolbar; +}(); + +exports.Toolbar = Toolbar; + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ViewHistory = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +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 DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20; + +var ViewHistory = +/*#__PURE__*/ +function () { + function ViewHistory(fingerprint) { + var _this = this; + + var cacheSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_VIEW_HISTORY_CACHE_SIZE; + + _classCallCheck(this, ViewHistory); + + this.fingerprint = fingerprint; + this.cacheSize = cacheSize; + this._initializedPromise = this._readFromStorage().then(function (databaseStr) { + var database = JSON.parse(databaseStr || '{}'); + + if (!('files' in database)) { + 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; } } + + if (index === -1) { + index = database.files.push({ + fingerprint: _this.fingerprint + }) - 1; + } + + _this.file = database.files[index]; + _this.database = database; + }); + } + + _createClass(ViewHistory, [{ + key: "_writeToStorage", + value: function () { + var _writeToStorage2 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee() { + var databaseStr; + 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); + + case 2: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function _writeToStorage() { + return _writeToStorage2.apply(this, arguments); + } + + return _writeToStorage; + }() + }, { + key: "_readFromStorage", + value: function () { + 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')); + + case 1: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function _readFromStorage() { + return _readFromStorage2.apply(this, arguments); + } + + return _readFromStorage; + }() + }, { + key: "set", + value: function () { + 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: + _context3.next = 2; + return this._initializedPromise; + + case 2: + this.file[name] = val; + return _context3.abrupt("return", this._writeToStorage()); + + case 4: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function set(_x, _x2) { + return _set.apply(this, arguments); + } + + return set; + }() + }, { + key: "setMultiple", + value: function () { + var _setMultiple = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee4(properties) { + var name; + return _regenerator.default.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + _context4.next = 2; + return this._initializedPromise; + + case 2: + for (name in properties) { + this.file[name] = properties[name]; + } + + return _context4.abrupt("return", this._writeToStorage()); + + case 4: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + + function setMultiple(_x3) { + return _setMultiple.apply(this, arguments); + } + + return setMultiple; + }() + }, { + key: "get", + value: function () { + var _get = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee5(name, defaultValue) { + var val; + return _regenerator.default.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + _context5.next = 2; + return this._initializedPromise; + + case 2: + val = this.file[name]; + return _context5.abrupt("return", val !== undefined ? val : defaultValue); + + case 4: + case "end": + return _context5.stop(); + } + } + }, _callee5, this); + })); + + function get(_x4, _x5) { + return _get.apply(this, arguments); + } + + return get; + }() + }, { + key: "getMultiple", + value: function () { + var _getMultiple = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee6(properties) { + var values, name, val; + return _regenerator.default.wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + _context6.next = 2; + return this._initializedPromise; + + case 2: + values = Object.create(null); + + for (name in properties) { + val = this.file[name]; + values[name] = val !== undefined ? val : properties[name]; + } + + return _context6.abrupt("return", values); + + case 5: + case "end": + return _context6.stop(); + } + } + }, _callee6, this); + })); + + function getMultiple(_x6) { + return _getMultiple.apply(this, arguments); + } + + return getMultiple; + }() + }]); + + return ViewHistory; +}(); + +exports.ViewHistory = ViewHistory; + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.GenericCom = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +var _app = __webpack_require__(1); + +var _preferences = __webpack_require__(38); + +var _download_manager = __webpack_require__(39); + +var _genericl10n = __webpack_require__(40); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { 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 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 _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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +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); } + +; +var GenericCom = {}; +exports.GenericCom = GenericCom; + +var GenericPreferences = +/*#__PURE__*/ +function (_BasePreferences) { + _inherits(GenericPreferences, _BasePreferences); + + function GenericPreferences() { + _classCallCheck(this, GenericPreferences); + + return _possibleConstructorReturn(this, _getPrototypeOf(GenericPreferences).apply(this, arguments)); + } + + _createClass(GenericPreferences, [{ + key: "_writeToStorage", + value: function () { + 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)); + + case 1: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function _writeToStorage(_x) { + return _writeToStorage2.apply(this, arguments); + } + + return _writeToStorage; + }() + }, { + key: "_readFromStorage", + value: function () { + 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'))); + + case 1: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function _readFromStorage(_x2) { + return _readFromStorage2.apply(this, arguments); + } + + return _readFromStorage; + }() + }]); + + 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 (_ref) { + var _ref$locale = _ref.locale, + locale = _ref$locale === void 0 ? 'en-US' : _ref$locale; + return new _genericl10n.GenericL10n(locale); +}; + +_app.PDFViewerApplication.externalServices = GenericExternalServices; + +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.BasePreferences = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +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 _typeof(obj) { 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({ + "viewOnLoad": 0, + "defaultZoomValue": "", + "sidebarViewOnLoad": -1, + "cursorToolOnLoad": 0, + "enableWebGL": false, + "eventBusDispatchToDOM": false, + "pdfBugEnabled": false, + "disableRange": false, + "disableStream": false, + "disableAutoFetch": false, + "disableFontFace": false, + "textLayerMode": 1, + "useOnlyCssZoom": false, + "externalLinkTarget": 0, + "renderer": "canvas", + "renderInteractiveForms": false, + "enablePrintAutoRotate": false, + "disablePageLabels": false, + "historyUpdateUrl": false, + "scrollModeOnLoad": -1, + "spreadModeOnLoad": -1 + }); + } + + return defaultPreferences; +} + +var BasePreferences = +/*#__PURE__*/ +function () { + function BasePreferences() { + var _this = this; + + _classCallCheck(this, BasePreferences); + + if (this.constructor === BasePreferences) { + throw new Error('Cannot initialize BasePreferences.'); } - if (alertNotReady) { - var notReadyMessage = 'Warning: The PDF is not fully loaded for printing.'; - window.alert(notReadyMessage); + + this.prefs = null; + this._initializedPromise = getDefaultPreferences().then(function (defaults) { + Object.defineProperty(_this, 'defaults', { + value: Object.freeze(defaults), + writable: false, + enumerable: true, + configurable: false + }); + _this.prefs = Object.assign(Object.create(null), defaults); + return _this._readFromStorage(defaults); + }).then(function (prefs) { + if (!prefs) { + return; + } + + for (var name in prefs) { + var defaultValue = _this.defaults[name], + prefValue = prefs[name]; + + if (defaultValue === undefined || _typeof(prefValue) !== _typeof(defaultValue)) { + continue; + } + + _this.prefs[name] = prefValue; + } + }); + } + + _createClass(BasePreferences, [{ + key: "_writeToStorage", + value: function () { + 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'); + + case 1: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function _writeToStorage(_x) { + return _writeToStorage2.apply(this, arguments); + } + + return _writeToStorage; + }() + }, { + key: "_readFromStorage", + value: function () { + 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'); + + case 1: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function _readFromStorage(_x2) { + return _readFromStorage2.apply(this, arguments); + } + + return _readFromStorage; + }() + }, { + key: "reset", + value: function () { + 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: + _context3.next = 2; + return this._initializedPromise; + + case 2: + this.prefs = Object.assign(Object.create(null), this.defaults); + return _context3.abrupt("return", this._writeToStorage(this.defaults)); + + case 4: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function reset() { + return _reset.apply(this, arguments); + } + + return reset; + }() + }, { + key: "set", + value: function () { + var _set = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee4(name, value) { + var defaultValue, valueType, defaultType; + return _regenerator.default.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + _context4.next = 2; + return this._initializedPromise; + + case 2: + defaultValue = this.defaults[name]; + + if (!(defaultValue === undefined)) { + _context4.next = 7; + break; + } + + throw new Error("Set preference: \"".concat(name, "\" is undefined.")); + + case 7: + if (!(value === undefined)) { + _context4.next = 9; + break; + } + + throw new Error('Set preference: no value is specified.'); + + case 9: + valueType = _typeof(value); + defaultType = _typeof(defaultValue); + + if (!(valueType !== defaultType)) { + _context4.next = 19; + break; + } + + if (!(valueType === 'number' && defaultType === 'string')) { + _context4.next = 16; + break; + } + + value = value.toString(); + _context4.next = 17; + break; + + case 16: + 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))) { + _context4.next = 21; + break; + } + + throw new Error("Set preference: \"".concat(value, "\" must be an integer.")); + + case 21: + this.prefs[name] = value; + return _context4.abrupt("return", this._writeToStorage(this.prefs)); + + case 23: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + + function set(_x3, _x4) { + return _set.apply(this, arguments); + } + + return set; + }() + }, { + key: "get", + value: function () { + var _get = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee5(name) { + var defaultValue, prefValue; + return _regenerator.default.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + _context5.next = 2; + return this._initializedPromise; + + case 2: + defaultValue = this.defaults[name]; + + if (!(defaultValue === undefined)) { + _context5.next = 7; + break; + } + + throw new Error("Get preference: \"".concat(name, "\" is undefined.")); + + case 7: + prefValue = this.prefs[name]; + + if (!(prefValue !== undefined)) { + _context5.next = 10; + break; + } + + return _context5.abrupt("return", prefValue); + + case 10: + return _context5.abrupt("return", defaultValue); + + case 11: + case "end": + return _context5.stop(); + } + } + }, _callee5, this); + })); + + function get(_x5) { + return _get.apply(this, arguments); + } + + return get; + }() + }, { + key: "getAll", + value: function () { + 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: + _context6.next = 2; + return this._initializedPromise; + + case 2: + return _context6.abrupt("return", Object.assign(Object.create(null), this.defaults, this.prefs)); + + case 3: + case "end": + return _context6.stop(); + } + } + }, _callee6, this); + })); + + function getAll() { + return _getAll.apply(this, arguments); + } + + return getAll; + }() + }]); + + return BasePreferences; +}(); + +exports.BasePreferences = BasePreferences; + +/***/ }), +/* 39 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.DownloadManager = void 0; + +var _pdfjsLib = __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; + +function _download(blobUrl, filename) { + 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.download = filename; + } + + (document.body || document.documentElement).appendChild(a); + a.click(); + a.remove(); +} + +var DownloadManager = +/*#__PURE__*/ +function () { + function DownloadManager(_ref) { + var _ref$disableCreateObj = _ref.disableCreateObjectURL, + disableCreateObjectURL = _ref$disableCreateObj === void 0 ? DISABLE_CREATE_OBJECT_URL : _ref$disableCreateObj; + + _classCallCheck(this, DownloadManager); + + this.disableCreateObjectURL = disableCreateObjectURL; + } + + _createClass(DownloadManager, [{ + key: "downloadUrl", + value: function downloadUrl(url, filename) { + if (!(0, _pdfjsLib.createValidAbsoluteUrl)(url, 'http://example.com')) { + return; + } + + _download(url + '#pdfjs.action=download', filename); + } + }, { + key: "downloadData", + value: function downloadData(data, filename, contentType) { + if (navigator.msSaveBlob) { + return navigator.msSaveBlob(new Blob([data], { + type: contentType + }), filename); + } + + var blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, this.disableCreateObjectURL); + + _download(blobUrl, filename); + } + }, { + 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); + + _download(blobUrl, filename); + } + }]); + + return DownloadManager; +}(); + +exports.DownloadManager = DownloadManager; + +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.GenericL10n = void 0; + +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +__webpack_require__(41); + +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 webL10n = document.webL10n; + +var GenericL10n = +/*#__PURE__*/ +function () { + function GenericL10n(lang) { + _classCallCheck(this, GenericL10n); + + this._lang = lang; + this._ready = new Promise(function (resolve, reject) { + webL10n.setLanguage(lang, function () { + resolve(webL10n); + }); + }); + } + + _createClass(GenericL10n, [{ + key: "getLanguage", + value: function () { + var _getLanguage = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee() { + var l10n; + return _regenerator.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return this._ready; + + case 2: + l10n = _context.sent; + return _context.abrupt("return", l10n.getLanguage()); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function getLanguage() { + return _getLanguage.apply(this, arguments); + } + + return getLanguage; + }() + }, { + key: "getDirection", + value: function () { + var _getDirection = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee2() { + var l10n; + return _regenerator.default.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return this._ready; + + case 2: + l10n = _context2.sent; + return _context2.abrupt("return", l10n.getDirection()); + + case 4: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function getDirection() { + return _getDirection.apply(this, arguments); + } + + return getDirection; + }() + }, { + key: "get", + value: function () { + var _get = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee3(property, args, fallback) { + var l10n; + return _regenerator.default.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return this._ready; + + case 2: + l10n = _context3.sent; + return _context3.abrupt("return", l10n.get(property, args, fallback)); + + case 4: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function get(_x, _x2, _x3) { + return _get.apply(this, arguments); + } + + return get; + }() + }, { + key: "translate", + value: function () { + var _translate = _asyncToGenerator( + /*#__PURE__*/ + _regenerator.default.mark(function _callee4(element) { + var l10n; + return _regenerator.default.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + _context4.next = 2; + return this._ready; + + case 2: + l10n = _context4.sent; + return _context4.abrupt("return", l10n.translate(element)); + + case 4: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + + function translate(_x4) { + return _translate.apply(this, arguments); + } + + return translate; + }() + }]); + + return GenericL10n; +}(); + +exports.GenericL10n = GenericL10n; + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +document.webL10n = function (window, document, undefined) { + var gL10nData = {}; + var gTextData = ''; + var gTextProp = 'textContent'; + var gLanguage = ''; + 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); + } catch (e) { + 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) { + onSuccess(xhr.responseText); + } else { + onFailure(); + } + } + }; + + 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*$/; + var reComment = /^\s*#|^\s*$/; + 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; + continue; + } 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); + }, function () { + console.warn(url + ' not found.'); + callback(); + }); + } + + parseRawLines(text, true, function () { + parsedPropertiesCallback(dictionary); + }); + } + + xhrLoadText(href, function (response) { + gTextData += response; + parseProperties(response, function (data) { + for (var key in data) { + var id, + prop, + index = key.lastIndexOf('.'); + + if (index > 0) { + id = key.substring(0, index); + prop = key.substring(index + 1); + } else { + 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; + } else if (anyCaseLang === defaultLocale) { + gL10nData = dict.locales[defaultLocale]; + } + } + } + + callback(); + } else { + console.log('no resource to load, early way out'); + } + + fireL10nReadyEvent(lang); + gReadyState = 'complete'; return; } - this.printing = true; - this.forceRendering(); + var onResourceLoaded = null; + var gResourceCount = 0; - var body = document.querySelector('body'); - body.setAttribute('data-mozPrintCallback', true); + onResourceLoaded = function onResourceLoaded() { + gResourceCount++; - if (!this.hasEqualPageSizes) { - console.warn('Not all pages have the same size. The printed result ' + - 'may be incorrect!'); + 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.'); + console.warn('"' + lang + '" resource not found'); + gLanguage = ''; + callback(); + }); + }; } - // Insert a @page + size rule to make sure that the page size is correctly - // set. Note that we assume that all pages have the same size, because - // variable-size pages are not supported yet (at least in Chrome & Firefox). - // TODO(robwu): Use named pages when size calculation bugs get resolved - // (e.g. https://crbug.com/355116) AND when support for named pages is - // added (http://www.w3.org/TR/css3-page/#using-named-pages). - // In browsers where @page + size is not supported (such as Firefox, - // https://bugzil.la/851441), the next stylesheet will be ignored and the - // user has to select the correct paper size in the UI if wanted. - this.pageStyleSheet = document.createElement('style'); - var pageSize = this.pdfViewer.getPageView(0).pdfPage.getViewport(1); - this.pageStyleSheet.textContent = - // "size: " is what we need. But also add "A4" because - // Firefox incorrectly reports support for the other value. - '@supports ((size:A4) and (size:1pt 1pt)) {' + - '@page { size: ' + pageSize.width + 'pt ' + pageSize.height + 'pt;}' + - // The canvas and each ancestor node must have a height of 100% to make - // sure that each canvas is printed on exactly one page. - '#printContainer {height:100%}' + - '#printContainer > div {width:100% !important;height:100% !important;}' + - '}'; - body.appendChild(this.pageStyleSheet); + for (var i = 0; i < langCount; i++) { + var resource = new L10nResourceLink(langLinks[i]); + resource.load(lang, onResourceLoaded); + } + } - for (i = 0, ii = this.pagesCount; i < ii; ++i) { - this.pdfViewer.getPageView(i).beforePrint(); + function clear() { + gL10nData = {}; + gTextData = ''; + gLanguage = ''; + } + + function getPluralRules(lang) { + var locales2rules = { + 'af': 3, + 'ak': 4, + 'am': 4, + 'ar': 1, + 'asa': 3, + 'az': 0, + 'be': 11, + 'bem': 3, + 'bez': 3, + 'bg': 3, + 'bh': 4, + 'bm': 0, + 'bn': 3, + 'bo': 0, + 'br': 20, + 'brx': 3, + 'bs': 11, + 'ca': 3, + 'cgg': 3, + 'chr': 3, + 'cs': 12, + 'cy': 17, + 'da': 3, + 'de': 3, + 'dv': 3, + 'dz': 0, + 'ee': 3, + 'el': 3, + 'en': 3, + 'eo': 3, + 'es': 3, + 'et': 3, + 'eu': 3, + 'fa': 0, + 'ff': 5, + 'fi': 3, + 'fil': 4, + 'fo': 3, + 'fr': 5, + 'fur': 3, + 'fy': 3, + 'ga': 8, + 'gd': 24, + 'gl': 3, + 'gsw': 3, + 'gu': 3, + 'guw': 4, + 'gv': 23, + 'ha': 3, + 'haw': 3, + 'he': 2, + 'hi': 4, + 'hr': 11, + 'hu': 0, + 'id': 0, + 'ig': 0, + 'ii': 0, + 'is': 3, + 'it': 3, + 'iu': 7, + 'ja': 0, + 'jmc': 3, + 'jv': 0, + 'ka': 0, + 'kab': 5, + 'kaj': 3, + 'kcg': 3, + 'kde': 0, + 'kea': 0, + 'kk': 3, + 'kl': 3, + 'km': 0, + 'kn': 0, + 'ko': 0, + 'ksb': 3, + 'ksh': 21, + 'ku': 3, + 'kw': 7, + 'lag': 18, + 'lb': 3, + 'lg': 3, + 'ln': 4, + 'lo': 0, + 'lt': 10, + 'lv': 6, + 'mas': 3, + 'mg': 4, + 'mk': 16, + 'ml': 3, + 'mn': 3, + 'mo': 9, + 'mr': 3, + 'ms': 0, + 'mt': 15, + 'my': 0, + 'nah': 3, + 'naq': 7, + 'nb': 3, + 'nd': 3, + 'ne': 3, + 'nl': 3, + 'nn': 3, + 'no': 3, + 'nr': 3, + 'nso': 4, + 'ny': 3, + 'nyn': 3, + 'om': 3, + 'or': 3, + 'pa': 3, + 'pap': 3, + 'pl': 13, + 'ps': 3, + 'pt': 3, + 'rm': 3, + 'ro': 9, + 'rof': 3, + 'ru': 11, + 'rwk': 3, + 'sah': 0, + 'saq': 3, + 'se': 7, + 'seh': 3, + 'ses': 0, + 'sg': 0, + 'sh': 11, + 'shi': 19, + 'sk': 12, + 'sl': 14, + 'sma': 7, + 'smi': 7, + 'smj': 7, + 'smn': 7, + 'sms': 7, + 'sn': 3, + 'so': 3, + 'sq': 3, + 'sr': 11, + 'ss': 3, + 'ssy': 3, + 'st': 3, + 'sv': 3, + 'sw': 3, + 'syr': 3, + 'ta': 3, + 'te': 3, + 'teo': 3, + 'th': 0, + 'ti': 4, + 'tig': 3, + 'tk': 3, + 'tl': 4, + 'tn': 3, + 'to': 0, + 'tr': 0, + 'ts': 3, + 'tzm': 22, + 'uk': 11, + 'ur': 3, + 've': 3, + 'vi': 0, + 'vun': 3, + 'wa': 4, + 'wae': 3, + 'wo': 0, + 'xh': 3, + 'xog': 3, + 'yo': 0, + 'zh': 0, + 'zu': 3 + }; + + function isIn(n, list) { + return list.indexOf(n) !== -1; } - }, + function isBetween(n, start, end) { + return start <= n && n <= end; + } - // Whether all pages of the PDF have the same width and height. - get hasEqualPageSizes() { - var firstPage = this.pdfViewer.getPageView(0); - for (var i = 1, ii = this.pagesCount; i < ii; ++i) { - var pageView = this.pdfViewer.getPageView(i); - if (pageView.width !== firstPage.width || - pageView.height !== firstPage.height) { - return false; + var pluralRules = { + '0': function _(n) { + return 'other'; + }, + '1': function _(n) { + if (isBetween(n % 100, 3, 10)) return 'few'; + if (n === 0) return 'zero'; + if (isBetween(n % 100, 11, 99)) return 'many'; + if (n == 2) return 'two'; + if (n == 1) return 'one'; + return 'other'; + }, + '2': function _(n) { + if (n !== 0 && n % 10 === 0) return 'many'; + if (n == 2) return 'two'; + if (n == 1) return 'one'; + return 'other'; + }, + '3': function _(n) { + if (n == 1) return 'one'; + return 'other'; + }, + '4': function _(n) { + if (isBetween(n, 0, 1)) return 'one'; + return 'other'; + }, + '5': function _(n) { + if (isBetween(n, 0, 2) && n != 2) return 'one'; + return 'other'; + }, + '6': function _(n) { + if (n === 0) return 'zero'; + if (n % 10 == 1 && n % 100 != 11) return 'one'; + return 'other'; + }, + '7': function _(n) { + if (n == 2) return 'two'; + if (n == 1) return 'one'; + return 'other'; + }, + '8': function _(n) { + if (isBetween(n, 3, 6)) return 'few'; + if (isBetween(n, 7, 10)) return 'many'; + if (n == 2) return 'two'; + if (n == 1) return 'one'; + return 'other'; + }, + '9': function _(n) { + if (n === 0 || n != 1 && isBetween(n % 100, 1, 19)) return 'few'; + if (n == 1) return 'one'; + return 'other'; + }, + '10': function _(n) { + if (isBetween(n % 10, 2, 9) && !isBetween(n % 100, 11, 19)) return 'few'; + if (n % 10 == 1 && !isBetween(n % 100, 11, 19)) return 'one'; + return 'other'; + }, + '11': function _(n) { + if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few'; + if (n % 10 === 0 || isBetween(n % 10, 5, 9) || isBetween(n % 100, 11, 14)) return 'many'; + if (n % 10 == 1 && n % 100 != 11) return 'one'; + return 'other'; + }, + '12': function _(n) { + if (isBetween(n, 2, 4)) return 'few'; + if (n == 1) return 'one'; + return 'other'; + }, + '13': function _(n) { + if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few'; + if (n != 1 && isBetween(n % 10, 0, 1) || isBetween(n % 10, 5, 9) || isBetween(n % 100, 12, 14)) return 'many'; + if (n == 1) return 'one'; + return 'other'; + }, + '14': function _(n) { + if (isBetween(n % 100, 3, 4)) return 'few'; + if (n % 100 == 2) return 'two'; + if (n % 100 == 1) return 'one'; + return 'other'; + }, + '15': function _(n) { + if (n === 0 || isBetween(n % 100, 2, 10)) return 'few'; + if (isBetween(n % 100, 11, 19)) return 'many'; + if (n == 1) return 'one'; + return 'other'; + }, + '16': function _(n) { + if (n % 10 == 1 && n != 11) return 'one'; + return 'other'; + }, + '17': function _(n) { + if (n == 3) return 'few'; + if (n === 0) return 'zero'; + if (n == 6) return 'many'; + if (n == 2) return 'two'; + if (n == 1) return 'one'; + return 'other'; + }, + '18': function _(n) { + if (n === 0) return 'zero'; + if (isBetween(n, 0, 2) && n !== 0 && n != 2) return 'one'; + return 'other'; + }, + '19': function _(n) { + if (isBetween(n, 2, 10)) return 'few'; + if (isBetween(n, 0, 1)) return 'one'; + return 'other'; + }, + '20': function _(n) { + if ((isBetween(n % 10, 3, 4) || n % 10 == 9) && !(isBetween(n % 100, 10, 19) || isBetween(n % 100, 70, 79) || isBetween(n % 100, 90, 99))) return 'few'; + if (n % 1000000 === 0 && n !== 0) return 'many'; + if (n % 10 == 2 && !isIn(n % 100, [12, 72, 92])) return 'two'; + if (n % 10 == 1 && !isIn(n % 100, [11, 71, 91])) return 'one'; + return 'other'; + }, + '21': function _(n) { + if (n === 0) return 'zero'; + if (n == 1) return 'one'; + return 'other'; + }, + '22': function _(n) { + if (isBetween(n, 0, 1) || isBetween(n, 11, 99)) return 'one'; + return 'other'; + }, + '23': function _(n) { + if (isBetween(n % 10, 1, 2) || n % 20 === 0) return 'one'; + return 'other'; + }, + '24': function _(n) { + if (isBetween(n, 3, 10) || isBetween(n, 13, 19)) return 'few'; + if (isIn(n, [2, 12])) return 'two'; + if (isIn(n, [1, 11])) return 'one'; + return 'other'; + } + }; + 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) { + str = gL10nData[key + '[one]'][prop]; + } else if (n == 2 && key + '[two]' in gL10nData) { + str = gL10nData[key + '[two]'][prop]; + } else if (key + index in gL10nData) { + str = gL10nData[key + index][prop]; + } 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); + if (!reMatch || !reMatch.length) return str; + 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) { + children[i].nodeValue = ''; + } else { + children[i].nodeValue = data[gTextProp]; + found = true; + } + } + } + + 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() { + return gL10nData; + }, + getText: function getText() { + return gTextData; + }, + getLanguage: function getLanguage() { + return gLanguage; + }, + setLanguage: function setLanguage(lang, callback) { + loadLocale(lang, function () { + if (callback) callback(); + }); + }, + getDirection: function getDirection() { + var rtlList = ['ar', 'he', 'fa', 'ps', 'ur']; + var shortCode = gLanguage.split('-', 1)[0]; + return rtlList.indexOf(shortCode) >= 0 ? 'rtl' : 'ltr'; + }, + translate: translateFragment, + getReadyState: function getReadyState() { + return gReadyState; + }, + ready: function ready(callback) { + if (!callback) { + return; + } else if (gReadyState == 'complete' || gReadyState == 'interactive') { + window.setTimeout(function () { + callback(); + }); + } else if (document.addEventListener) { + document.addEventListener('localized', function once() { + document.removeEventListener('localized', once); + callback(); + }); } } - return true; - }, + }; +}(window, document); - afterPrint: function pdfViewSetupAfterPrint() { - var div = document.getElementById('printContainer'); - while (div.hasChildNodes()) { - div.removeChild(div.lastChild); +/***/ }), +/* 42 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFPrintService = PDFPrintService; + +var _ui_utils = __webpack_require__(6); + +var _app = __webpack_require__(1); + +var _pdfjsLib = __webpack_require__(7); + +var activeService = null; +var overlayManager = null; + +function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) { + var scratchCanvas = activeService.scratchCanvas; + var PRINT_RESOLUTION = 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'); + ctx.save(); + 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({ + scale: 1, + rotation: size.rotation + }), + intent: 'print' + }; + return pdfPage.render(renderContext).promise; + }).then(function () { + return { + width: width, + height: height + }; + }); +} + +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.currentPage = -1; + this.scratchCanvas = document.createElement('canvas'); +} + +PDFPrintService.prototype = { + layout: function layout() { + this.throwIfInactive(); + 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!'); } - if (this.pageStyleSheet && this.pageStyleSheet.parentNode) { - this.pageStyleSheet.parentNode.removeChild(this.pageStyleSheet); + 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;}' + '}'; + body.appendChild(this.pageStyleSheet); + }, + destroy: function destroy() { + if (activeService !== this) { + return; + } + + this.printContainer.textContent = ''; + + if (this.pageStyleSheet) { + this.pageStyleSheet.remove(); this.pageStyleSheet = null; } - this.printing = false; - this.forceRendering(); + this.scratchCanvas.width = this.scratchCanvas.height = 0; + this.scratchCanvas = null; + activeService = null; + ensureOverlay().then(function () { + if (overlayManager.active !== 'printServiceOverlay') { + return; + } + + overlayManager.close('printServiceOverlay'); + }); }, + renderPages: function renderPages() { + var _this = this; - rotatePages: function pdfViewRotatePages(delta) { - var pageNumber = this.page; - this.pageRotation = (this.pageRotation + 360 + delta) % 360; - this.pdfViewer.pagesRotation = this.pageRotation; - this.pdfThumbnailViewer.pagesRotation = this.pageRotation; + var pageCount = this.pagesOverview.length; - this.forceRendering(); + var renderNextPage = function renderNextPage(resolve, reject) { + _this.throwIfInactive(); - this.pdfViewer.scrollPageIntoView(pageNumber); + 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'); + img.style.width = printItem.width; + img.style.height = printItem.height; + var scratchCanvas = this.scratchCanvas; - requestPresentationMode: function pdfViewRequestPresentationMode() { - if (!this.pdfPresentationMode) { - return; + if ('toBlob' in scratchCanvas && !this.disableCreateObjectURL) { + scratchCanvas.toBlob(function (blob) { + img.src = _pdfjsLib.URL.createObjectURL(blob); + }); + } else { + img.src = scratchCanvas.toDataURL(); } - this.pdfPresentationMode.request(); + + var wrapper = document.createElement('div'); + wrapper.appendChild(img); + this.printContainer.appendChild(wrapper); + return new Promise(function (resolve, reject) { + img.onload = resolve; + img.onerror = reject; + }); + }, + performPrint: function performPrint() { + var _this2 = this; + + this.throwIfInactive(); + return new Promise(function (resolve) { + setTimeout(function () { + if (!_this2.active) { + resolve(); + return; + } + + print.call(window); + setTimeout(resolve, 20); + }, 0); + }); }, - /** - * @param {number} delta - The delta value from the mouse event. - */ - scrollPresentationMode: function pdfViewScrollPresentationMode(delta) { - if (!this.pdfPresentationMode) { - return; + get active() { + return this === activeService; + }, + + throwIfInactive: function throwIfInactive() { + if (!this.active) { + throw new Error('This print request was cancelled or completed.'); } - this.pdfPresentationMode.mouseScroll(delta); } }; -window.PDFView = PDFViewerApplication; // obsolete name, using it as an alias +var print = window.print; +window.print = function print() { + if (activeService) { + console.warn('Ignored window.print() because of a pending print job.'); + return; + } + + ensureOverlay().then(function () { + if (activeService) { + overlayManager.open('printServiceOverlay'); + } + }); -var HOSTED_VIEWER_ORIGINS = ['null', - 'http://mozilla.github.io', 'https://mozilla.github.io']; -function validateFileURL(file) { try { - var viewerOrigin = new URL(window.location.href).origin || 'null'; - if (HOSTED_VIEWER_ORIGINS.indexOf(viewerOrigin) >= 0) { - // Hosted or local viewer, allow for any file locations + dispatchEvent('beforeprint'); + } finally { + if (!activeService) { + console.error('Expected print service to be initialized.'); + ensureOverlay().then(function () { + if (overlayManager.active === 'printServiceOverlay') { + overlayManager.close('printServiceOverlay'); + } + }); return; } - var fileOrigin = new URL(file, window.location.href).origin; - // Removing of the following line will not guarantee that the viewer will - // start accepting URLs from foreign origin -- CORS headers on the remote - // server must be properly configured. - if (fileOrigin !== viewerOrigin) { - throw new Error('file origin does not match viewer\'s'); - } - } catch (e) { - var message = e && e.message; - var loadingErrorMessage = 'An error occurred while loading the PDF.'; - var moreInfo = { - message: message - }; - PDFViewerApplication.error(loadingErrorMessage, moreInfo); - throw e; + var activeServiceOnEntry = activeService; + activeService.renderPages().then(function () { + return activeServiceOnEntry.performPrint(); + }).catch(function () {}).then(function () { + if (activeServiceOnEntry.active) { + abort(); + } + }); + } +}; + +function dispatchEvent(eventType) { + var event = document.createEvent('CustomEvent'); + event.initCustomEvent(eventType, false, false, 'custom'); + window.dispatchEvent(event); +} + +function abort() { + if (activeService) { + activeService.destroy(); + dispatchEvent('afterprint'); } } -function webViewerLoad(evt) { - configure(PDFJS); - PDFViewerApplication.initialize().then(webViewerInitialized); +function renderProgress(index, total, l10n) { + var progressContainer = document.getElementById('printServiceOverlay'); + var progress = Math.round(100 * index / total); + 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) { + progressPerc.textContent = msg; + }); } -function webViewerInitialized() { - var queryString = document.location.search.substring(1); - var params = parseQueryString(queryString); - var file = 'file' in params ? params.file : DEFAULT_URL; - validateFileURL(file); +var hasAttachEvent = !!document.attachEvent; +window.addEventListener('keydown', function (event) { + if (event.keyCode === 80 && (event.ctrlKey || event.metaKey) && !event.altKey && (!event.shiftKey || window.chrome || window.opera)) { + window.print(); - var fileInput = document.createElement('input'); - fileInput.id = 'fileInput'; - fileInput.className = 'fileInput'; - fileInput.setAttribute('type', 'file'); - fileInput.oncontextmenu = noContextMenuHandler; - document.body.appendChild(fileInput); - - if (!window.File || !window.FileReader || !window.FileList || !window.Blob) { - document.getElementById('openFile').setAttribute('hidden', 'true'); - document.getElementById('secondaryOpenFile').setAttribute('hidden', 'true'); - } else { - document.getElementById('fileInput').value = null; - } - - var locale = PDFJS.locale || navigator.language; - - if (PDFViewerApplication.preferencePdfBugEnabled) { - // Special debugging flags in the hash section of the URL. - var hash = document.location.hash.substring(1); - var hashParams = parseQueryString(hash); - - if ('disableworker' in hashParams) { - PDFJS.disableWorker = (hashParams['disableworker'] === 'true'); - } - if ('disablerange' in hashParams) { - PDFJS.disableRange = (hashParams['disablerange'] === 'true'); - } - if ('disablestream' in hashParams) { - PDFJS.disableStream = (hashParams['disablestream'] === 'true'); - } - if ('disableautofetch' in hashParams) { - PDFJS.disableAutoFetch = (hashParams['disableautofetch'] === 'true'); - } - if ('disablefontface' in hashParams) { - PDFJS.disableFontFace = (hashParams['disablefontface'] === 'true'); - } - if ('disablehistory' in hashParams) { - PDFJS.disableHistory = (hashParams['disablehistory'] === 'true'); - } - if ('webgl' in hashParams) { - PDFJS.disableWebGL = (hashParams['webgl'] !== 'true'); - } - if ('useonlycsszoom' in hashParams) { - PDFJS.useOnlyCssZoom = (hashParams['useonlycsszoom'] === 'true'); - } - if ('verbosity' in hashParams) { - PDFJS.verbosity = hashParams['verbosity'] | 0; - } - if ('ignorecurrentpositiononzoom' in hashParams) { - IGNORE_CURRENT_POSITION_ON_ZOOM = - (hashParams['ignorecurrentpositiononzoom'] === 'true'); - } - if ('locale' in hashParams) { - locale = hashParams['locale']; - } - if ('textlayer' in hashParams) { - switch (hashParams['textlayer']) { - case 'off': - PDFJS.disableTextLayer = true; - break; - case 'visible': - case 'shadow': - case 'hover': - var viewer = document.getElementById('viewer'); - viewer.classList.add('textLayer-' + hashParams['textlayer']); - break; - } - } - if ('pdfbug' in hashParams) { - PDFJS.pdfBug = true; - var pdfBug = hashParams['pdfbug']; - var enabled = pdfBug.split(','); - PDFBug.enable(enabled); - PDFBug.init(); - } - } - - if (!PDFViewerApplication.supportsPrinting) { - document.getElementById('print').classList.add('hidden'); - document.getElementById('secondaryPrint').classList.add('hidden'); - } - - if (!PDFViewerApplication.supportsFullscreen) { - document.getElementById('presentationMode').classList.add('hidden'); - document.getElementById('secondaryPresentationMode'). - classList.add('hidden'); - } - - if (PDFViewerApplication.supportsIntegratedFind) { - document.getElementById('viewFind').classList.add('hidden'); - } - - // Suppress context menus for some controls - document.getElementById('scaleSelect').oncontextmenu = noContextMenuHandler; - - var mainContainer = document.getElementById('mainContainer'); - var outerContainer = document.getElementById('outerContainer'); - mainContainer.addEventListener('transitionend', function(e) { - if (e.target === mainContainer) { - var event = document.createEvent('UIEvents'); - event.initUIEvent('resize', false, false, window, 0); - window.dispatchEvent(event); - outerContainer.classList.remove('sidebarMoving'); - } - }, true); - - document.getElementById('sidebarToggle').addEventListener('click', - function() { - this.classList.toggle('toggled'); - outerContainer.classList.add('sidebarMoving'); - outerContainer.classList.toggle('sidebarOpen'); - PDFViewerApplication.sidebarOpen = - outerContainer.classList.contains('sidebarOpen'); - if (PDFViewerApplication.sidebarOpen) { - PDFViewerApplication.refreshThumbnailViewer(); - } - PDFViewerApplication.forceRendering(); - }); - - document.getElementById('viewThumbnail').addEventListener('click', - function() { - PDFViewerApplication.switchSidebarView('thumbs'); - }); - - document.getElementById('viewOutline').addEventListener('click', - function() { - PDFViewerApplication.switchSidebarView('outline'); - }); - - document.getElementById('viewOutline').addEventListener('dblclick', - function() { - PDFViewerApplication.outline.toggleOutlineTree(); - }); - - document.getElementById('viewAttachments').addEventListener('click', - function() { - PDFViewerApplication.switchSidebarView('attachments'); - }); - - document.getElementById('previous').addEventListener('click', - function() { - PDFViewerApplication.page--; - }); - - document.getElementById('next').addEventListener('click', - function() { - PDFViewerApplication.page++; - }); - - document.getElementById('zoomIn').addEventListener('click', - function() { - PDFViewerApplication.zoomIn(); - }); - - document.getElementById('zoomOut').addEventListener('click', - function() { - PDFViewerApplication.zoomOut(); - }); - - document.getElementById('pageNumber').addEventListener('click', function() { - this.select(); - }); - - document.getElementById('pageNumber').addEventListener('change', function() { - // Handle the user inputting a floating point number. - PDFViewerApplication.page = (this.value | 0); - - if (this.value !== (this.value | 0).toString()) { - this.value = PDFViewerApplication.page; - } - }); - - document.getElementById('scaleSelect').addEventListener('change', function() { - if (this.value === 'custom') { + if (hasAttachEvent) { return; } - PDFViewerApplication.pdfViewer.currentScaleValue = this.value; - }); - document.getElementById('presentationMode').addEventListener('click', - SecondaryToolbar.presentationModeClick.bind(SecondaryToolbar)); + event.preventDefault(); - document.getElementById('openFile').addEventListener('click', - SecondaryToolbar.openFileClick.bind(SecondaryToolbar)); - - document.getElementById('print').addEventListener('click', - SecondaryToolbar.printClick.bind(SecondaryToolbar)); - - document.getElementById('download').addEventListener('click', - SecondaryToolbar.downloadClick.bind(SecondaryToolbar)); - - - if (file && file.lastIndexOf('file:', 0) === 0) { - // file:-scheme. Load the contents in the main thread because QtWebKit - // cannot load file:-URLs in a Web Worker. file:-URLs are usually loaded - // very quickly, so there is no need to set up progress event listeners. - 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 (e) { - PDFViewerApplication.error('An error occurred while loading the PDF.', e); - } - return; - } - - if (file) { - PDFViewerApplication.open(file); - } -} - -document.addEventListener('DOMContentLoaded', webViewerLoad, true); - -document.addEventListener('pagerendered', function (e) { - var pageNumber = e.detail.pageNumber; - var pageIndex = pageNumber - 1; - var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex); - - if (PDFViewerApplication.sidebarOpen) { - var thumbnailView = PDFViewerApplication.pdfThumbnailViewer. - getThumbnail(pageIndex); - thumbnailView.setImage(pageView); - } - - if (PDFJS.pdfBug && Stats.enabled && pageView.stats) { - Stats.add(pageNumber, pageView.stats); - } - - if (pageView.error) { - PDFViewerApplication.error('An error occurred while rendering the page.', pageView.error); - } - - // If the page is still visible when it has finished rendering, - // ensure that the page number input loading indicator is hidden. - if (pageNumber === PDFViewerApplication.page) { - var pageNumberInput = document.getElementById('pageNumber'); - pageNumberInput.classList.remove(PAGE_NUMBER_LOADING_INDICATOR); - } - -}, true); - -document.addEventListener('textlayerrendered', function (e) { - var pageIndex = e.detail.pageNumber - 1; - var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex); - -}, true); - -document.addEventListener('pagemode', function (evt) { - if (!PDFViewerApplication.initialized) { - return; - } - // Handle the 'pagemode' hash parameter, see also `PDFLinkService_setHash`. - var mode = evt.detail.mode; - switch (mode) { - case 'bookmarks': - // Note: Our code calls this property 'outline', even though the - // Open Parameter specification calls it 'bookmarks'. - mode = 'outline'; - /* falls through */ - case 'thumbs': - case 'attachments': - PDFViewerApplication.switchSidebarView(mode, true); - break; - case 'none': - if (PDFViewerApplication.sidebarOpen) { - document.getElementById('sidebarToggle').click(); - } - break; - } -}, true); - -document.addEventListener('namedaction', function (e) { - if (!PDFViewerApplication.initialized) { - return; - } - // Processing couple of named actions that might be useful. - // See also PDFLinkService.executeNamedAction - var action = e.detail.action; - switch (action) { - case 'GoToPage': - document.getElementById('pageNumber').focus(); - break; - - case 'Find': - if (!PDFViewerApplication.supportsIntegratedFind) { - PDFViewerApplication.findBar.toggle(); - } - break; - } -}, true); - -window.addEventListener('presentationmodechanged', function (e) { - var active = e.detail.active; - var switchInProgress = e.detail.switchInProgress; - PDFViewerApplication.pdfViewer.presentationModeState = - switchInProgress ? PresentationModeState.CHANGING : - active ? PresentationModeState.FULLSCREEN : PresentationModeState.NORMAL; -}); - -window.addEventListener('updateviewarea', function (evt) { - if (!PDFViewerApplication.initialized) { - return; - } - var location = evt.location; - - PDFViewerApplication.store.initializedPromise.then(function() { - PDFViewerApplication.store.setMultiple({ - 'exists': true, - 'page': location.pageNumber, - 'zoom': location.scale, - 'scrollLeft': location.left, - 'scrollTop': location.top - }).catch(function() { - // unable to write to storage - }); - }); - var href = - PDFViewerApplication.pdfLinkService.getAnchorUrl(location.pdfOpenParams); - document.getElementById('viewBookmark').href = href; - document.getElementById('secondaryViewBookmark').href = href; - - // Update the current bookmark in the browsing history. - PDFViewerApplication.pdfHistory.updateCurrentBookmark(location.pdfOpenParams, - location.pageNumber); - - // Show/hide the loading indicator in the page number input element. - var pageNumberInput = document.getElementById('pageNumber'); - var currentPage = - PDFViewerApplication.pdfViewer.getPageView(PDFViewerApplication.page - 1); - - if (currentPage.renderingState === RenderingStates.FINISHED) { - pageNumberInput.classList.remove(PAGE_NUMBER_LOADING_INDICATOR); - } else { - pageNumberInput.classList.add(PAGE_NUMBER_LOADING_INDICATOR); - } -}, true); - -window.addEventListener('resize', function webViewerResize(evt) { - if (PDFViewerApplication.initialized) { - var currentScaleValue = PDFViewerApplication.pdfViewer.currentScaleValue; - if (currentScaleValue === 'auto' || - currentScaleValue === 'page-fit' || - currentScaleValue === 'page-width') { - // Note: the scale is constant for 'page-actual'. - PDFViewerApplication.pdfViewer.currentScaleValue = currentScaleValue; - } else if (!currentScaleValue) { - // Normally this shouldn't happen, but if the scale wasn't initialized - // we set it to the default value in order to prevent any issues. - // (E.g. the document being rendered with the wrong scale on load.) - PDFViewerApplication.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE; - } - PDFViewerApplication.pdfViewer.update(); - } - - // Set the 'max-height' CSS property of the secondary toolbar. - SecondaryToolbar.setMaxHeight(document.getElementById('viewerContainer')); -}); - -window.addEventListener('hashchange', function webViewerHashchange(evt) { - if (PDFViewerApplication.pdfHistory.isHashChangeUnlocked) { - var hash = document.location.hash.substring(1); - if (!hash) { - return; - } - if (!PDFViewerApplication.isInitialViewSet) { - PDFViewerApplication.initialBookmark = hash; + if (event.stopImmediatePropagation) { + event.stopImmediatePropagation(); } else { - PDFViewerApplication.pdfLinkService.setHash(hash); + event.stopPropagation(); } - } -}); -window.addEventListener('change', function webViewerChange(evt) { - var files = evt.target.files; - if (!files || files.length === 0) { return; } - var file = files[0]; - - if (!PDFJS.disableCreateObjectURL && - typeof URL !== 'undefined' && URL.createObjectURL) { - PDFViewerApplication.open(URL.createObjectURL(file)); - } else { - // Read the local file into a Uint8Array. - var fileReader = new FileReader(); - fileReader.onload = function webViewerChangeFileReaderOnload(evt) { - var buffer = evt.target.result; - var uint8Array = new Uint8Array(buffer); - PDFViewerApplication.open(uint8Array); - }; - fileReader.readAsArrayBuffer(file); - } - - PDFViewerApplication.setTitleUsingUrl(file.name); - - // URL does not reflect proper document location - hiding some icons. - document.getElementById('viewBookmark').setAttribute('hidden', 'true'); - document.getElementById('secondaryViewBookmark'). - setAttribute('hidden', 'true'); - document.getElementById('download').setAttribute('hidden', 'true'); - document.getElementById('secondaryDownload').setAttribute('hidden', 'true'); }, true); -function selectScaleOption(value) { - var options = document.getElementById('scaleSelect').options; - var predefinedValueFound = false; - for (var i = 0, ii = options.length; i < ii; i++) { - var option = options[i]; - if (option.value !== value) { - option.selected = false; - continue; +if (hasAttachEvent) { + document.attachEvent('onkeydown', function (event) { + event = event || window.event; + + if (event.keyCode === 80 && event.ctrlKey) { + event.keyCode = 0; + return false; } - option.selected = true; - predefinedValueFound = true; - } - return predefinedValueFound; + }); } -window.addEventListener('localized', function localized(evt) { -// document.getElementsByTagName('html')[0].dir = mozL10n.getDirection(); - - PDFViewerApplication.animationStartedPromise.then(function() { - // Adjust the width of the zoom box to fit the content. - // Note: If the window is narrow enough that the zoom box is not visible, - // we temporarily show it to be able to adjust its width. - var container = document.getElementById('scaleSelectContainer'); - if (container.clientWidth === 0) { - container.setAttribute('style', 'display: inherit;'); - } - if (container.clientWidth > 0) { - var select = document.getElementById('scaleSelect'); - 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;'); +if ('onbeforeprint' in window) { + var stopPropagationIfNeeded = function stopPropagationIfNeeded(event) { + if (event.detail !== 'custom' && event.stopImmediatePropagation) { + event.stopImmediatePropagation(); } + }; - // Set the 'max-height' CSS property of the secondary toolbar. - SecondaryToolbar.setMaxHeight(document.getElementById('viewerContainer')); - }); -}, true); - -window.addEventListener('scalechange', function scalechange(evt) { - document.getElementById('zoomOut').disabled = (evt.scale === MIN_SCALE); - document.getElementById('zoomIn').disabled = (evt.scale === MAX_SCALE); - - // Update the 'scaleSelect' DOM element. - var predefinedValueFound = selectScaleOption(evt.presetValue || - '' + evt.scale); - if (!predefinedValueFound) { - var customScaleOption = document.getElementById('customScaleOption'); - var customScale = Math.round(evt.scale * 10000) / 100; - customScaleOption.textContent = customScale + '%'; - customScaleOption.selected = true; - } - if (!PDFViewerApplication.initialized) { - return; - } - PDFViewerApplication.pdfViewer.update(); -}, true); - -window.addEventListener('pagechange', function pagechange(evt) { - var page = evt.pageNumber; - if (evt.previousPageNumber !== page) { - document.getElementById('pageNumber').value = page; - if (PDFViewerApplication.sidebarOpen) { - PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page); - } - } - var numPages = PDFViewerApplication.pagesCount; - - document.getElementById('previous').disabled = (page <= 1); - document.getElementById('next').disabled = (page >= numPages); - - document.getElementById('firstPage').disabled = (page <= 1); - document.getElementById('lastPage').disabled = (page >= numPages); - - // we need to update stats - if (PDFJS.pdfBug && Stats.enabled) { - var pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1); - if (pageView.stats) { - Stats.add(page, pageView.stats); - } - } -}, true); - -function handleMouseWheel(evt) { - var MOUSE_WHEEL_DELTA_FACTOR = 40; - var ticks = (evt.type === 'DOMMouseScroll') ? -evt.detail : - evt.wheelDelta / MOUSE_WHEEL_DELTA_FACTOR; - var direction = (ticks < 0) ? 'zoomOut' : 'zoomIn'; - - var pdfViewer = PDFViewerApplication.pdfViewer; - if (pdfViewer.isInPresentationMode) { - evt.preventDefault(); - PDFViewerApplication.scrollPresentationMode(ticks * - MOUSE_WHEEL_DELTA_FACTOR); - } else if (evt.ctrlKey || evt.metaKey) { - var support = PDFViewerApplication.supportedMouseWheelZoomModifierKeys; - if ((evt.ctrlKey && !support.ctrlKey) || - (evt.metaKey && !support.metaKey)) { - return; - } - // Only zoom the pages, not the entire viewer. - evt.preventDefault(); - - var previousScale = pdfViewer.currentScale; - - PDFViewerApplication[direction](Math.abs(ticks)); - - var currentScale = pdfViewer.currentScale; - if (previousScale !== currentScale) { - // After scaling the page via zoomIn/zoomOut, the position of the upper- - // left corner is restored. When the mouse wheel is used, the position - // under the cursor should be restored instead. - var scaleCorrectionFactor = currentScale / previousScale - 1; - var rect = pdfViewer.container.getBoundingClientRect(); - var dx = evt.clientX - rect.left; - var dy = evt.clientY - rect.top; - pdfViewer.container.scrollLeft += dx * scaleCorrectionFactor; - pdfViewer.container.scrollTop += dy * scaleCorrectionFactor; - } - } + window.addEventListener('beforeprint', stopPropagationIfNeeded); + window.addEventListener('afterprint', stopPropagationIfNeeded); } -window.addEventListener('DOMMouseScroll', handleMouseWheel); -window.addEventListener('mousewheel', handleMouseWheel); +var overlayPromise; -window.addEventListener('click', function click(evt) { - if (SecondaryToolbar.opened && - PDFViewerApplication.pdfViewer.containsElement(evt.target)) { - SecondaryToolbar.close(); - } -}, false); +function ensureOverlay() { + if (!overlayPromise) { + overlayManager = _app.PDFViewerApplication.overlayManager; -window.addEventListener('keydown', function keydown(evt) { - if (OverlayManager.active) { - return; - } - - var handled = 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; - - // First, handle the key bindings that are independent whether an input - // control is selected or not. - if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) { - // either CTRL or META key with optional SHIFT. - switch (evt.keyCode) { - case 70: // f - if (!PDFViewerApplication.supportsIntegratedFind) { - PDFViewerApplication.findBar.open(); - handled = true; - } - break; - case 71: // g - if (!PDFViewerApplication.supportsIntegratedFind) { - PDFViewerApplication.findBar.dispatchEvent('again', - cmd === 5 || cmd === 12); - handled = true; - } - break; - case 61: // FF/Mac '=' - case 107: // FF '+' and '=' - case 187: // Chrome '+' - case 171: // FF with German keyboard - if (!isViewerInPresentationMode) { - PDFViewerApplication.zoomIn(); - } - handled = true; - break; - case 173: // FF/Mac '-' - case 109: // FF '-' - case 189: // Chrome '-' - if (!isViewerInPresentationMode) { - PDFViewerApplication.zoomOut(); - } - handled = true; - break; - case 48: // '0' - case 96: // '0' on Numpad of Swedish keyboard - if (!isViewerInPresentationMode) { - // keeping it unhandled (to restore page zoom to 100%) - setTimeout(function () { - // ... and resetting the scale after browser adjusts its scale - pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE; - }); - handled = false; - } - break; + if (!overlayManager) { + 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; } - // CTRL or META without shift - if (cmd === 1 || cmd === 8) { - switch (evt.keyCode) { - case 83: // s - PDFViewerApplication.download(); - handled = true; - break; + 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.'); } + + activeService = new PDFPrintService(pdfDocument, pagesOverview, printContainer, l10n); + return activeService; } +}; - // CTRL+ALT or Option+Command - if (cmd === 3 || cmd === 10) { - switch (evt.keyCode) { - case 80: // p - PDFViewerApplication.requestPresentationMode(); - handled = true; - break; - case 71: // g - // focuses input#pageNumber field - document.getElementById('pageNumber').select(); - handled = true; - break; - } - } - - if (handled) { - evt.preventDefault(); - return; - } - - // Some shortcuts should not get handled if a control/input element - // is selected. - var curElement = document.activeElement || document.querySelector(':focus'); - var curElementTagName = curElement && curElement.tagName.toUpperCase(); - if (curElementTagName === 'INPUT' || - curElementTagName === 'TEXTAREA' || - curElementTagName === 'SELECT') { - // Make sure that the secondary toolbar is closed when Escape is pressed. - if (evt.keyCode !== 27) { // 'Esc' - return; - } - } - var ensureViewerFocused = false; - - if (cmd === 0) { // no control key pressed at all. - switch (evt.keyCode) { - case 38: // up arrow - case 33: // pg up - case 8: // backspace - if (!isViewerInPresentationMode && - pdfViewer.currentScaleValue !== 'page-fit') { - break; - } - /* in presentation mode */ - /* falls through */ - case 37: // left arrow - // horizontal scrolling using arrow keys - if (pdfViewer.isHorizontalScrollbarEnabled) { - break; - } - /* falls through */ - case 75: // 'k' - case 80: // 'p' - PDFViewerApplication.page--; - handled = true; - break; - case 27: // esc key - if (SecondaryToolbar.opened) { - SecondaryToolbar.close(); - handled = true; - } - if (!PDFViewerApplication.supportsIntegratedFind && - PDFViewerApplication.findBar.opened) { - PDFViewerApplication.findBar.close(); - handled = true; - } - break; - case 40: // down arrow - case 34: // pg down - case 32: // spacebar - if (!isViewerInPresentationMode && - pdfViewer.currentScaleValue !== 'page-fit') { - break; - } - /* falls through */ - case 39: // right arrow - // horizontal scrolling using arrow keys - if (pdfViewer.isHorizontalScrollbarEnabled) { - break; - } - /* falls through */ - case 74: // 'j' - case 78: // 'n' - PDFViewerApplication.page++; - handled = true; - break; - - case 36: // home - if (isViewerInPresentationMode || PDFViewerApplication.page > 1) { - PDFViewerApplication.page = 1; - handled = true; - ensureViewerFocused = true; - } - break; - case 35: // end - if (isViewerInPresentationMode || (PDFViewerApplication.pdfDocument && - PDFViewerApplication.page < PDFViewerApplication.pagesCount)) { - PDFViewerApplication.page = PDFViewerApplication.pagesCount; - handled = true; - ensureViewerFocused = true; - } - break; - - case 72: // 'h' - if (!isViewerInPresentationMode) { - HandTool.toggle(); - } - break; - case 82: // 'r' - PDFViewerApplication.rotatePages(90); - break; - } - } - - if (cmd === 4) { // shift-key - switch (evt.keyCode) { - case 32: // spacebar - if (!isViewerInPresentationMode && - pdfViewer.currentScaleValue !== 'page-fit') { - break; - } - PDFViewerApplication.page--; - handled = true; - break; - - case 82: // 'r' - PDFViewerApplication.rotatePages(-90); - break; - } - } - - if (!handled && !isViewerInPresentationMode) { - // 33=Page Up 34=Page Down 35=End 36=Home - // 37=Left 38=Up 39=Right 40=Down - // 32=Spacebar - if ((evt.keyCode >= 33 && evt.keyCode <= 40) || - (evt.keyCode === 32 && curElementTagName !== 'BUTTON')) { - ensureViewerFocused = true; - } - } - - if (cmd === 2) { // alt-key - switch (evt.keyCode) { - case 37: // left arrow - if (isViewerInPresentationMode) { - PDFViewerApplication.pdfHistory.back(); - handled = true; - } - break; - case 39: // right arrow - if (isViewerInPresentationMode) { - PDFViewerApplication.pdfHistory.forward(); - handled = true; - } - break; - } - } - - if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) { - // The page container is not focused, but a page navigation key has been - // pressed. Change the focus to the viewer container to make sure that - // navigation by keyboard works as expected. - pdfViewer.focus(); - } - - if (handled) { - evt.preventDefault(); - } -}); - -window.addEventListener('beforeprint', function beforePrint(evt) { - PDFViewerApplication.beforePrint(); -}); - -window.addEventListener('afterprint', function afterPrint(evt) { - PDFViewerApplication.afterPrint(); -}); - -(function animationStartedClosure() { - // The offsetParent is not set until the pdf.js iframe or object is visible. - // Waiting for first animation. - PDFViewerApplication.animationStartedPromise = new Promise( - function (resolve) { - window.requestAnimationFrame(resolve); - }); -})(); - +/***/ }) +/******/ ]); +//# sourceMappingURL=viewer.js.map \ No newline at end of file diff --git a/public/vendor/plugins/pdfjs/web/viewer.js.map b/public/vendor/plugins/pdfjs/web/viewer.js.map new file mode 100644 index 000000000..77184899d --- /dev/null +++ b/public/vendor/plugins/pdfjs/web/viewer.js.map @@ -0,0 +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/@babel/runtime/node_modules/regenerator-runtime/runtime-module.js","webpack:///node_modules/@babel/runtime/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/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","getViewerConfiguration","window","event","webViewerLoad","DEFAULT_SCALE_DELTA","DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT","FORCE_PAGES_LOADED_TIMEOUT","WHEEL_ZOOM_DISABLED_TIMEOUT","ViewOnLoad","UNKNOWN","PREVIOUS","INITIAL","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","prefs","waitOn","hash","hashParams","parseQueryString","loadFakeWorker","TextLayerMode","viewer","enabled","loadAndEnablePDFBug","reason","console","locale","dir","dispatchToDOM","getGlobalEventBus","externalLinkTarget","externalLinkRel","disableCreateObjectURL","findController","linkService","renderingQueue","renderer","enableWebGL","textLayerMode","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","exception","message","loadingErrorMessage","msg","filename","err","downloadByUrl","blob","type","error","moreInfoText","version","build","moreInfo","stack","line","errorWrapperConfig","Promise","parts","progress","percent","level","isNaN","disableAutoFetch","clearTimeout","load","firstPagePromise","pageModePromise","openActionDestPromise","baseDocumentUrl","pagesPromise","onePageRendered","pdfPage","storePromise","page","zoom","scrollLeft","scrollTop","rotation","sidebarView","SidebarView","scrollMode","ScrollMode","spreadMode","SpreadMode","values","viewOnLoad","fingerprint","initialDest","parseInt","pageMode","apiPageModeToSidebarView","resolve","setTimeout","labels","i","numLabels","javaScript","js","UNSUPPORTED_FEATURES","regex","ii","outline","attachments","info","metadata","pdfTitle","_initializePdfHistory","resetHistory","updateUrl","JSON","explicitDest","setInitialView","setRotation","angle","isValidRotation","setViewerModes","isValidScrollMode","isValidSpreadMode","cleanup","RendererType","forceRendering","beforePrint","printMessage","notReadyMessage","pagesOverview","afterPrint","rotatePages","newRotation","requestPresentationMode","bindEvents","bindWindowEvents","unbindEvents","unbindWindowEvents","HOSTED_VIEWER_ORIGINS","validateFileURL","viewerOrigin","origin","protocol","ex","loadScript","PDFWorker","OPS","createObjectURL","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","matchesCount","setZoomDisabledTimeout","zoomDisabledTimeout","previousScale","delta","normalizeWheelEventDelta","MOUSE_WHEEL_DELTA_PER_PAGE_SCALE","ticks","currentScale","scaleCorrectionFactor","rect","dx","dy","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","previousPromise","callInvokeWithMethodAndArg","defineIteratorMethods","AsyncIterator","iter","wrap","state","method","doneResult","delegate","delegateResult","maybeInvokeDelegate","done","entry","tryLoc","locs","keys","key","iteratorMethod","iterable","Context","constructor","reset","name","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","NORMAL","CHANGING","FULLSCREEN","CANVAS","SVG","DISABLE","ENABLE","ENABLE_ENHANCE","VERTICAL","HORIZONTAL","WRAPPED","NONE","ODD","EVEN","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","numViews","firstVisibleElementInd","binarySearchFirstItem","backtrackBeforeAllVisibleElements","lastEdge","currentWidth","currentHeight","viewWidth","viewHeight","viewRight","viewBottom","hiddenHeight","hiddenWidth","id","y","first","last","pc","defaultFilename","isDataSchema","reURI","reFilename","splitURI","suggestedFilename","MOUSE_DOM_DELTA_PIXEL_MODE","MOUSE_DOM_DELTA_LINE_MODE","MOUSE_PIXELS_PER_LINE","MOUSE_LINES_PER_PAGE","Number","size","WaitOnType","EVENT","TIMEOUT","delay","target","eventHandler","handler","timeoutHandler","timeout","animationStarted","on","eventListeners","off","dispatch","Array","listener","_dispatchDOMEvent","details","obj","globalEventBus","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","RUNNING","PAUSED","FINISHED","setViewer","setThumbnailViewer","isHighestPriority","renderHighestPriority","getHighestPriority","visibleViews","numVisible","nextPageIndex","previousPageIndex","isViewFinished","renderView","continueRendering","UI_NOTIFICATION_CLASS","THUMBS","OUTLINE","ATTACHMENTS","LAYERS","switchView","forceOpen","_switchView","isViewChanged","shouldForceRendering","pagesCount","_showUINotification","_hideUINotification","removeNotification","outlineCount","OptionKind","VIEWER","API","WORKER","defaultOptions","kind","defaultUrl","defaultZoomValue","disableHistory","disablePageLabels","eventBusDispatchToDOM","historyUpdateUrl","compatibility","viewerCompatibilityParams","pdfBugEnabled","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","cMapPacked","cMapUrl","apiCompatibilityParams","disableFontFace","disableRange","disableStream","isEvalSupported","maxImageSize","pdfBug","postMessageTransfers","verbosity","workerPort","workerSrc","userOptions","userOption","defaultOption","compatibilityParams","userAgent","isAndroid","isIOS","exports","callerCloseMethod","canForceClose","_keyDown","e","PasswordResponses","promptString","password","setUpdateCallback","keepRenderedCapability","_dispatchEvent","attachmentsCount","_bindPdfLink","button","blobUrl","viewerUrl","encodeURIComponent","_bindLink","render","names","item","removeNullCharacters","div","_appendAttachment","content","DEFAULT_FIELD_CONTENT","NON_METRIC_LOCALES","US_PAGE_NAMES","METRIC_PAGE_NAMES","isPortrait","pageNames","freezeFieldData","data","writable","configurable","currentPageNumber","pagesRotation","getPageSizeInches","fileSize","setDocument","setFileSize","_updateUI","_parseFileSize","kb","size_kb","size_b","size_mb","_parsePageSize","pageSizeInches","isPortraitOrientation","sizeInches","sizeMillimeters","pageName","getPageName","exactMillimeters","intMillimeters","unit","orientation","_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","PENDING","FIND_TIMEOUT","MATCH_SCROLL_OFFSET_TOP","MATCH_SCROLL_OFFSET_LEFT","CHARACTERS_TO_NORMALIZE","normalizationRegex","replace","executeCommand","findbarClosed","pendingTimeout","matchIndex","scrollMatchIntoView","scrollIntoView","pageIdx","matchIdx","wrapped","_shouldDirtyMatch","_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","normalizeWhitespace","textContent","textItems","strBuf","j","jj","normalize","_updatePage","currentPageIndex","offset","numPageMatches","_matchesReady","numMatches","_advanceOffsetPage","found","_updateMatch","previousPage","_onFindBarClose","_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","getCurrentHash","initialize","reInitialized","parseCurrentHash","destination","namedDest","push","forceReplace","isDestArraysEqual","dest","_pushOrReplaceState","shouldReplace","newState","uid","newUrl","temporary","_tryPushCurrentPosition","position","_isValidState","checkReload","performance","perfEntry","_updateInternalState","removeTemporary","_updateViewarea","_popState","newHash","hashChanged","waitOnEventOrTimeout","destHash","nameddest","second","isEntryEqual","firstDest","secondDest","setHistory","navigateTo","goToDestination","destRef","destArray","getDestinationHash","escape","str","getAnchorUrl","setHash","zoomArgs","zoomArg","zoomArgNumber","parseFloat","allowNegativeOffset","isValidExplicitDestination","executeNamedAction","cachePageRef","refStr","pageRef","_cachedPageNumber","isPageVisible","destLength","allowNull","DEFAULT_TITLE","addLinkAttributes","newWindow","rel","_setStyles","styleStr","_addToggleButton","toggler","shouldShowAll","_toggleOutlineItem","show","root","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","PDFThumbnailView","firstPage","viewport","scale","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","noCtxScale","_getPageDrawContext","canvas","outputScale","getOutputScale","className","image","renderCapability","finishRenderTask","renderTask","drawViewport","renderContinueCallback","cont","renderContext","canvasContext","setImage","img","reducedWidth","reducedHeight","reducedImage","reducedImageCtx","setPageLabel","ariaLabel","pageSpot","_scrollIntoView","pageDiv","_updateHelper","currentId","stillFullyVisible","visiblePages","DEFAULT_CACHE_SIZE","pageIdsToKeep","iMax","pagesToKeep","moveToEndOfArray","getPageView","_setCurrentPageNumber","resetCurrentPageView","val","pageLabel","pagesCapability","onePageRenderedCapability","bindOnAfterAndBeforeDraw","textLayerFactory","annotationLayerFactory","getPagesLeft","_setScaleUpdatePages","noScroll","preset","newValue","isSameScale","presetValue","_setScale","noPadding","hPadding","vPadding","pageWidthScale","pageHeightScale","horizontalScale","scrollPageIntoView","pageWidth","pageHeight","widthScale","heightScale","boundingRect","_updateLocation","normalizedScaleValue","pdfOpenParams","currentPageView","topLeft","intLeft","intTop","numVisiblePages","newCacheSize","containsElement","currentlyVisiblePages","scrollAhead","createTextLayerBuilder","enhanceTextSelection","textLayerDiv","createAnnotationLayerBuilder","isFirstPagePortrait","_updateScrollMode","_updateSpreadMode","pages","parity","spread","firstPageView","intent","annotations","dontFlip","AnnotationLayer","MAX_CANVAS_PIXELS","removeFromDOM","_resetZoomLayer","zoomLayerCanvas","keepZoomLayer","keepAnnotations","currentZoomLayerNode","currentAnnotationNode","cssTransform","isScalingRestricted","cancelRendering","renderingState","redrawAnnotations","relativeRotation","absRotation","scaleX","scaleY","textLayerViewport","textRelativeRotation","textAbsRotation","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","opList","svgGfx","svg","wrapper","EXPAND_DIVS_TIMEOUT","endOfContent","numTextDivs","textLayerFrag","textContentStream","textDivs","textContentItemsStr","setTextContentStream","setTextContent","_convertMatches","iIndex","end","m","mm","begin","divIdx","_renderMatches","isSelectedPage","selectedMatchIdx","prevEnd","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","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","databaseStr","database","length","branch","localStorage","properties","GenericCom","GenericExternalServices","defaultPreferences","defaults","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","parsedRawLinesCallback","loadImport","tmp","evalString","nextEntry","xhrLoadText","parseRawLines","parsedPropertiesCallback","parseProperties","successCallback","clear","langLinks","getL10nResourceLinks","langCount","dict","getL10nDictionary","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","abort","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;;AAAA;AAqCA,iBArCA,kBAqCA;AACoE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AArC,SAAoD;AAClDA,sBADkD,CAClDA;AACA,aAFkD,KAElD;AAJ8C;AADhC,GAClBtF;AAtSF;;AA+SA,IAAI,mBAAJ,QAA+B;AAG7B,MAAIs1C,0BAA0B,SAA1BA,uBAA0B,QAAgB;AAC5C,QAAIhwC,6BAA6BA,MAAjC,0BAAiE;AAC/DA,YAD+D,wBAC/DA;AAF0C;AAHjB,GAG7B;;AAKAD,yCAR6B,uBAQ7BA;AACAA,wCAT6B,uBAS7BA;AAxTF;;AA2TA,IA3TA,cA2TA;;AACA,yBAAyB;AACvB,MAAI,CAAJ,gBAAqB;AACnBgD,qBAAiBtB,0BADE,cACnBsB;;AACA,QAAI,CAAJ,gBAAqB;AACnB,YAAM,UADa,mDACb,CAAN;AAHiB;;AAMnBktC,qBAAiBltC,+CACfrI,wBADeqI,qBACfrI,CADeqI,SANE,IAMFA,CAAjBktC;AAEAv1C,qDARmB,KAQnBA;AATqB;;AAWvB,SAXuB,cAWvB;AAvUF;;AA0UAyL,uCAAkC;AAChCwL,oBADgC;AAGhCC,oBAHgC,8BAGhCA,WAHgC,EAGhCA,aAHgC,EAGhCA,cAHgC,EAGhCA,IAHgC,EAGqC;AACnE,uBAAmB;AACjB,YAAM,UADW,0CACX,CAAN;AAFiE;;AAInE08B,oBAAgB,gEAJmD,IAInD,CAAhBA;AAEA,WANmE,aAMnE;AAT8B;AAAA,CAAlCnoC,C","file":"viewer.js","sourcesContent":[" \t// 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 (optional) 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\n if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('GENERIC')) {\n // Give custom implementations of the default viewer a simpler way to\n // set various `AppOptions`, by dispatching an event once all viewer\n // files are loaded but *before* the viewer initialization has run.\n const event = document.createEvent('CustomEvent');\n event.initCustomEvent('webviewerloaded', true, true, {});\n document.dispatchEvent(event);\n }\n\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, getGlobalEventBus,\n getPDFFileNameFromURL, isValidRotation, isValidScrollMode, isValidSpreadMode,\n MAX_SCALE, MIN_SCALE, noContextMenuHandler, normalizeWheelEventDelta,\n parseQueryString, PresentationModeState, ProgressBar, RendererType,\n ScrollMode, SpreadMode, 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 { 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\nconst WHEEL_ZOOM_DISABLED_TIMEOUT = 1000; // ms\n\nconst ViewOnLoad = {\n UNKNOWN: -1,\n PREVIOUS: 0, // Default value.\n INITIAL: 1,\n};\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