diff --git a/public/vendor/VERSIONS b/public/vendor/VERSIONS
index da0d78e4852..6c5f10424fb 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 00e5ff1d70b..c17c2f14e86 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 c8877d51075..42250bb7008 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);
- } else {
-factory((root.pdfjsDistBuildPdf = {}));
- }
-}(this, function (exports) {
- // Use strict in our context only - users might not want it
- 'use strict';
-
-var pdfjsVersion = '1.4.20';
-var pdfjsBuild = 'b15f335';
-
- var pdfjsFilePath =
- typeof document !== 'undefined' && document.currentScript ?
- document.currentScript.src : null;
-
- var pdfjsLibs = {};
-
- (function pdfjsWrapper() {
-
-
-
-(function (root, factory) {
- {
- factory((root.pdfjsSharedGlobal = {}));
- }
-}(this, function (exports) {
- var globalScope = (typeof window !== 'undefined') ? window :
- (typeof global !== 'undefined') ? global :
- (typeof self !== 'undefined') ? self : this;
-
- var isWorker = (typeof window === 'undefined');
+(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;
- // 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 = {};
- }
+ pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
+ return new PDFFetchStream(params);
+ });
+ } else {
+ var PDFNetworkStream = __w_pdfjs_require__(169).PDFNetworkStream;
- if (typeof pdfjsVersion !== 'undefined') {
- globalScope.PDFJS.version = pdfjsVersion;
+ pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
+ return new PDFNetworkStream(params);
+ });
}
- if (typeof pdfjsVersion !== 'undefined') {
- globalScope.PDFJS.build = pdfjsBuild;
+}
+exports.build = pdfjsDisplayAPI.build;
+exports.version = pdfjsDisplayAPI.version;
+exports.getDocument = pdfjsDisplayAPI.getDocument;
+exports.LoopbackPort = pdfjsDisplayAPI.LoopbackPort;
+exports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport;
+exports.PDFWorker = pdfjsDisplayAPI.PDFWorker;
+exports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer;
+exports.AnnotationLayer = pdfjsDisplayAnnotationLayer.AnnotationLayer;
+exports.createPromiseCapability = pdfjsSharedUtil.createPromiseCapability;
+exports.PasswordResponses = pdfjsSharedUtil.PasswordResponses;
+exports.InvalidPDFException = pdfjsSharedUtil.InvalidPDFException;
+exports.MissingPDFException = pdfjsSharedUtil.MissingPDFException;
+exports.SVGGraphics = pdfjsDisplaySVG.SVGGraphics;
+exports.NativeImageDecoding = pdfjsSharedUtil.NativeImageDecoding;
+exports.CMapCompressionType = pdfjsSharedUtil.CMapCompressionType;
+exports.PermissionFlag = pdfjsSharedUtil.PermissionFlag;
+exports.UnexpectedResponseException = pdfjsSharedUtil.UnexpectedResponseException;
+exports.OPS = pdfjsSharedUtil.OPS;
+exports.VerbosityLevel = pdfjsSharedUtil.VerbosityLevel;
+exports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES;
+exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl;
+exports.createObjectURL = pdfjsSharedUtil.createObjectURL;
+exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters;
+exports.shadow = pdfjsSharedUtil.shadow;
+exports.Util = pdfjsSharedUtil.Util;
+exports.ReadableStream = pdfjsSharedUtil.ReadableStream;
+exports.URL = pdfjsSharedUtil.URL;
+exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException;
+exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl;
+exports.LinkTarget = pdfjsDisplayDOMUtils.LinkTarget;
+exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes;
+exports.loadScript = pdfjsDisplayDOMUtils.loadScript;
+exports.GlobalWorkerOptions = pdfjsDisplayWorkerOptions.GlobalWorkerOptions;
+exports.apiCompatibilityParams = pdfjsDisplayAPICompatibility.apiCompatibilityParams;
+
+/***/ }),
+/* 1 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+
+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;
}
-
- globalScope.PDFJS.pdfBug = false;
-
- exports.globalScope = globalScope;
- exports.isWorker = isWorker;
- exports.PDFJS = globalScope.PDFJS;
-}));
-
-
-(function (root, factory) {
- {
- factory((root.pdfjsDisplayDOMUtils = {}), root.pdfjsSharedGlobal);
+});
+Object.defineProperty(exports, "URL", {
+ enumerable: true,
+ get: function get() {
+ return _url_polyfill.URL;
}
-}(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.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;
-exports.CustomStyle = CustomStyle;
-}));
+__w_pdfjs_require__(2);
+var _streams_polyfill = __w_pdfjs_require__(142);
-(function (root, factory) {
- {
- factory((root.pdfjsSharedUtil = {}), root.pdfjsSharedGlobal);
- }
-}(this, function (exports, sharedGlobal) {
+var _url_polyfill = __w_pdfjs_require__(144);
-var PDFJS = sharedGlobal.PDFJS;
-var globalScope = sharedGlobal.globalScope;
+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 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,171 +511,132 @@ var OPS = PDFJS.OPS = {
paintSolidColorImageMask: 90,
constructPath: 91
};
+exports.OPS = OPS;
+var UNSUPPORTED_FEATURES = {
+ unknown: 'unknown',
+ forms: 'forms',
+ javaScript: 'javaScript',
+ smask: 'smask',
+ shadingPattern: 'shadingPattern',
+ font: 'font'
+};
+exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
+var PasswordResponses = {
+ NEED_PASSWORD: 1,
+ INCORRECT_PASSWORD: 2
+};
+exports.PasswordResponses = PasswordResponses;
+var verbosity = VerbosityLevel.WARNINGS;
+
+function setVerbosityLevel(level) {
+ if (Number.isInteger(level)) {
+ verbosity = level;
+ }
+}
+
+function getVerbosityLevel() {
+ return verbosity;
+}
-// 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) {
+ if (verbosity >= VerbosityLevel.INFOS) {
console.log('Info: ' + msg);
}
}
-// Non-fatal warnings.
function warn(msg) {
- if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.warnings) {
+ if (verbosity >= VerbosityLevel.WARNINGS) {
console.log('Warning: ' + msg);
}
}
-// Deprecated API function -- treated as warnings.
function deprecated(details) {
- warn('Deprecated API usage: ' + details);
+ console.log('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());
- }
+function unreachable(msg) {
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);
+ unreachable(msg);
}
}
-var UNSUPPORTED_FEATURES = PDFJS.UNSUPPORTED_FEATURES = {
- unknown: 'unknown',
- forms: 'forms',
- javaScript: 'javaScript',
- smask: 'smask',
- shadingPattern: 'shadingPattern',
- font: 'font'
-};
+function isSameOrigin(baseUrl, otherUrl) {
+ try {
+ var base = new _url_polyfill.URL(baseUrl);
-// 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;
+ if (!base.origin || base.origin === 'null') {
+ return false;
+ }
+ } catch (e) {
+ return false;
}
- return new URL(url, baseUrl).href;
+
+ var other = new _url_polyfill.URL(otherUrl, base);
+ return base.origin === other.origin;
}
-// Validates if URL is safe and allowed, e.g. to avoid XSS.
-function isValidUrl(url, allowRelative) {
+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) : '');
+function createValidAbsoluteUrl(url, baseUrl) {
+ if (!url) {
+ return null;
+ }
- if (url) {
- if (isExternalLinkTargetSet()) {
- link.target = LinkTargetStringMap[PDFJS.externalLinkTarget];
+ try {
+ var absoluteUrl = baseUrl ? new _url_polyfill.URL(url, baseUrl) : new _url_polyfill.URL(url);
+
+ if (_isValidProtocol(absoluteUrl)) {
+ return absoluteUrl;
}
- // Strip referrer from the URL.
- link.rel = PDFJS.externalLinkRel;
- }
+ } 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;
- }
- // 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;
-}
-PDFJS.isExternalLinkTargetSet = isExternalLinkTargetSet;
+function getLookupTableFactory(initializer) {
+ var lookup;
+ return function () {
+ if (initializer) {
+ lookup = Object.create(null);
+ initializer(lookup);
+ initializer = null;
+ }
-var PasswordResponses = PDFJS.PasswordResponses = {
- NEED_PASSWORD: 1,
- INCORRECT_PASSWORD: 2
-};
+ return lookup;
+ };
+}
-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;
+}();
+
+exports.PasswordException = PasswordException;
-var UnknownErrorException = (function UnknownErrorExceptionClosure() {
+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;
+}();
+
+exports.UnknownErrorException = UnknownErrorException;
-var InvalidPDFException = (function InvalidPDFExceptionClosure() {
+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;
+}();
+
+exports.InvalidPDFException = InvalidPDFException;
-var MissingPDFException = (function MissingPDFExceptionClosure() {
+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;
+}();
+
+exports.MissingPDFException = MissingPDFException;
-var UnexpectedResponseException =
- (function UnexpectedResponseExceptionClosure() {
+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;
- }
+}();
- NotImplementedException.prototype = new Error();
- NotImplementedException.prototype.name = 'NotImplementedException';
- NotImplementedException.constructor = NotImplementedException;
-
- return NotImplementedException;
-})();
+exports.UnexpectedResponseException = UnexpectedResponseException;
-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;
-})();
+}();
+
+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() {
+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());
- }
-});
-
-var Uint32ArrayView = (function Uint32ArrayViewClosure() {
-
- 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);
+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;
+
+ while (dict) {
+ var value = getArray ? dict.getArray(key) : dict.get(key);
+
+ if (value !== undefined) {
+ if (stopWhenFound) {
+ return value;
+ }
- 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 (!values) {
+ values = [];
}
- };
- }
- function ensureUint32ArrayViewProps(length) {
- while (uint32ArrayViewSetters < length) {
- Object.defineProperty(Uint32ArrayView.prototype,
- uint32ArrayViewSetters,
- createUint32ArrayProp(uint32ArrayViewSetters));
- uint32ArrayViewSetters++;
+ values.push(value);
}
- }
- return Uint32ArrayView;
-})();
+ if (++loopCount > LOOP_LIMIT) {
+ warn("getInheritableProperty: maximum loop count exceeded for \"".concat(key, "\""));
+ break;
+ }
-exports.Uint32ArrayView = Uint32ArrayView;
+ dict = dict.get('Parent');
+ }
-var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
+ return values;
+}
-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;
+}();
- // 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;
- }
+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'];
- if (dontFlip) {
- rotateC = -rotateC; rotateD = -rotateD;
- }
+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 = [];
- 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
- ];
+ while (number >= 1000) {
+ number -= 1000;
+ romanBuf.push('M');
+ }
- this.width = width;
- this.height = height;
- this.fontScale = scale;
- }
- 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;
-})();
+ 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
-];
+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,9168 +1117,22483 @@ 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;
+var createObjectURL = function createObjectURLClosure() {
+ var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
+ return function createObjectURL(data, contentType) {
+ var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-/**
- * 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 (!forceDataSchema && _url_polyfill.URL.createObjectURL) {
+ var blob = new Blob([data], {
+ type: contentType
+ });
+ return _url_polyfill.URL.createObjectURL(blob);
}
- if (typeof globalScope.Promise.reject !== 'function') {
- globalScope.Promise.reject = function (reason) {
- return new globalScope.Promise(function (resolve, reject) {
- reject(reason);
- });
- };
+
+ var buffer = 'data:' + contentType + ';base64,';
+
+ for (var i = 0, ii = data.length; i < ii; i += 3) {
+ var b1 = data[i] & 0xFF;
+ var b2 = data[i + 1] & 0xFF;
+ var b3 = data[i + 2] & 0xFF;
+ var d1 = b1 >> 2,
+ d2 = (b1 & 3) << 4 | b2 >> 4;
+ var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
+ var d4 = i + 2 < ii ? b3 & 0x3F : 64;
+ buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
}
- if (typeof globalScope.Promise.prototype.catch !== 'function') {
- globalScope.Promise.prototype.catch = function (onReject) {
- return globalScope.Promise.prototype.then(undefined, onReject);
- };
+
+ return buffer;
+ };
+}();
+
+exports.createObjectURL = createObjectURL;
+
+/***/ }),
+/* 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;
}
- 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;
+ globalScope.btoa = function (chars) {
+ return Buffer.from(chars, 'binary').toString('base64');
+ };
+ })();
- var HandlerManager = {
- handlers: [],
- running: false,
- unhandledRejections: [],
- pendingRejectionCheck: false,
+ (function checkNodeAtob() {
+ if (globalScope.atob || !isNodeJS()) {
+ return;
+ }
- scheduleHandlers: function scheduleHandlers(promise) {
- if (promise._status === STATUS_PENDING) {
- return;
- }
+ globalScope.atob = function (input) {
+ return Buffer.from(input, 'base64').toString('binary');
+ };
+ })();
+
+ (function checkChildNodeRemove() {
+ if (!hasDOM) {
+ return;
+ }
- this.handlers = this.handlers.concat(promise._handlers);
- promise._handlers = [];
+ if (typeof Element.prototype.remove !== 'undefined') {
+ return;
+ }
- if (this.running) {
- return;
+ Element.prototype.remove = function () {
+ if (this.parentNode) {
+ this.parentNode.removeChild(this);
}
- this.running = true;
+ };
+ })();
- setTimeout(this.runHandlers.bind(this), 0);
- },
+ (function checkDOMTokenListAddRemove() {
+ if (!hasDOM || isNodeJS()) {
+ return;
+ }
- 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 div = document.createElement('div');
+ div.classList.add('testOne', 'testTwo');
- var nextStatus = handler.thisPromise._status;
- var nextValue = handler.thisPromise._value;
+ if (div.classList.contains('testOne') === true && div.classList.contains('testTwo') === true) {
+ return;
+ }
- 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;
+ var OriginalDOMTokenListAdd = DOMTokenList.prototype.add;
+ var OriginalDOMTokenListRemove = DOMTokenList.prototype.remove;
- if (handler.thisPromise._unhandledRejection) {
- this.removeUnhandeledRejection(handler.thisPromise);
- }
- }
- } catch (ex) {
- nextStatus = STATUS_REJECTED;
- nextValue = ex;
- }
+ DOMTokenList.prototype.add = function () {
+ for (var _len = arguments.length, tokens = new Array(_len), _key = 0; _key < _len; _key++) {
+ tokens[_key] = arguments[_key];
+ }
- handler.nextPromise._updateStatus(nextStatus, nextValue);
- if (Date.now() >= timeoutAt) {
- break;
- }
+ for (var _i = 0; _i < tokens.length; _i++) {
+ var token = tokens[_i];
+ OriginalDOMTokenListAdd.call(this, token);
}
+ };
- if (this.handlers.length > 0) {
- setTimeout(this.runHandlers.bind(this), 0);
- return;
+ DOMTokenList.prototype.remove = function () {
+ for (var _len2 = arguments.length, tokens = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
+ tokens[_key2] = arguments[_key2];
}
- this.running = false;
- },
+ for (var _i2 = 0; _i2 < tokens.length; _i2++) {
+ var token = tokens[_i2];
+ OriginalDOMTokenListRemove.call(this, token);
+ }
+ };
+ })();
- addUnhandledRejection: function addUnhandledRejection(promise) {
- this.unhandledRejections.push({
- promise: promise,
- time: Date.now()
- });
- this.scheduleRejectionCheck();
- },
+ (function checkDOMTokenListToggle() {
+ if (!hasDOM || isNodeJS()) {
+ return;
+ }
- 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--;
- }
- }
- },
+ var div = document.createElement('div');
- 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);
+ if (div.classList.toggle('test', 0) === false) {
+ return;
}
- };
- 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);
+ 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;
}
- 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);
- }
+
+ __w_pdfjs_require__(5);
+ })();
+
+ (function checkStringEndsWith() {
+ if (String.prototype.endsWith) {
+ return;
}
- 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';
- };
+ __w_pdfjs_require__(35);
+ })();
- /**
- * Creates resolved promise
- * @param value resolve value
- * @returns {Promise}
- */
- Promise.resolve = function Promise_resolve(value) {
- return new Promise(function (resolve) { resolve(value); });
- };
+ (function checkStringIncludes() {
+ if (String.prototype.includes) {
+ return;
+ }
- /**
- * Creates rejected promise
- * @param reason rejection value
- * @returns {Promise}
- */
- Promise.reject = function Promise_reject(reason) {
- return new Promise(function (resolve, reject) { reject(reason); });
- };
+ __w_pdfjs_require__(37);
+ })();
- Promise.prototype = {
- _status: null,
- _value: null,
- _handlers: null,
- _unhandledRejection: null,
+ (function checkArrayIncludes() {
+ if (Array.prototype.includes) {
+ return;
+ }
- _updateStatus: function Promise__updateStatus(status, value) {
- if (this._status === STATUS_RESOLVED ||
- this._status === STATUS_REJECTED) {
- return;
- }
+ __w_pdfjs_require__(39);
+ })();
- if (status === STATUS_RESOLVED &&
- Promise.isPromise(value)) {
- value.then(this._updateStatus.bind(this, STATUS_RESOLVED),
- this._updateStatus.bind(this, STATUS_REJECTED));
- return;
- }
+ (function checkArrayFrom() {
+ if (Array.from) {
+ return;
+ }
- this._status = status;
- this._value = value;
+ __w_pdfjs_require__(46);
+ })();
- if (status === STATUS_REJECTED && this._handlers.length === 0) {
- this._unhandledRejection = true;
- HandlerManager.addUnhandledRejection(this);
- }
+ (function checkObjectAssign() {
+ if (Object.assign) {
+ return;
+ }
- HandlerManager.scheduleHandlers(this);
- },
+ __w_pdfjs_require__(69);
+ })();
- _resolve: function Promise_resolve(value) {
- this._updateStatus(STATUS_RESOLVED, value);
- },
+ (function checkMathLog2() {
+ if (Math.log2) {
+ return;
+ }
- _reject: function Promise_reject(reason) {
- this._updateStatus(STATUS_REJECTED, reason);
- },
+ Math.log2 = __w_pdfjs_require__(74);
+ })();
- 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;
- },
+ (function checkNumberIsNaN() {
+ if (Number.isNaN) {
+ return;
+ }
+
+ Number.isNaN = __w_pdfjs_require__(76);
+ })();
- catch: function Promise_catch(onReject) {
- return this.then(undefined, onReject);
+ (function checkNumberIsInteger() {
+ if (Number.isInteger) {
+ return;
}
- };
- globalScope.Promise = Promise;
-})();
+ Number.isInteger = __w_pdfjs_require__(78);
+ })();
-var StatTimer = (function StatTimerClosure() {
- function rpad(str, pad, length) {
- while (str.length < length) {
- str += pad;
+ (function checkPromise() {
+ if (globalScope.Promise && globalScope.Promise.prototype && globalScope.Promise.prototype.finally) {
+ return;
}
- 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);
-};
+ globalScope.Promise = __w_pdfjs_require__(81);
+ })();
-PDFJS.createObjectURL = (function createObjectURLClosure() {
- // Blob/createObjectURL is not available, falling back to data schema.
- var digits =
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
+ (function checkWeakMap() {
+ if (globalScope.WeakMap) {
+ return;
+ }
- return function createObjectURL(data, contentType) {
- if (!PDFJS.disableCreateObjectURL &&
- typeof URL !== 'undefined' && URL.createObjectURL) {
- var blob = PDFJS.createBlob(data, contentType);
- return URL.createObjectURL(blob);
+ globalScope.WeakMap = __w_pdfjs_require__(101);
+ })();
+
+ (function checkWeakSet() {
+ if (globalScope.WeakSet) {
+ return;
}
- var buffer = 'data:' + contentType + ';base64,';
- for (var i = 0, ii = data.length; i < ii; i += 3) {
- var b1 = data[i] & 0xFF;
- var b2 = data[i + 1] & 0xFF;
- var b3 = data[i + 2] & 0xFF;
- var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4);
- var d3 = i + 1 < ii ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64;
- var d4 = i + 2 < ii ? (b3 & 0x3F) : 64;
- buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
+ globalScope.WeakSet = __w_pdfjs_require__(118);
+ })();
+
+ (function checkStringCodePointAt() {
+ if (String.codePointAt) {
+ return;
}
- 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 = {};
+ String.codePointAt = __w_pdfjs_require__(122);
+ })();
- this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
- var data = event.data;
- if (data.targetName !== this.sourceName) {
+ (function checkStringFromCodePoint() {
+ if (String.fromCodePoint) {
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);
+
+ String.fromCodePoint = __w_pdfjs_require__(124);
+ })();
+
+ (function checkSymbol() {
+ if (globalScope.Symbol) {
+ return;
}
- }.bind(this);
- comObj.addEventListener('message', this._onComObjOnMessage);
-}
-MessageHandler.prototype = {
- on: function messageHandlerOn(actionName, handler, scope) {
- var ah = this.actionHandler;
- if (ah[actionName]) {
- error('There is already an actionName called "' + actionName + '"');
+ __w_pdfjs_require__(126);
+ })();
+
+ (function checkStringPadStart() {
+ if (String.prototype.padStart) {
+ return;
}
- 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);
+
+ __w_pdfjs_require__(133);
+ })();
+
+ (function checkStringPadEnd() {
+ if (String.prototype.padEnd) {
+ return;
}
- 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);
+
+ __w_pdfjs_require__(137);
+ })();
+
+ (function checkObjectValues() {
+ if (Object.values) {
+ return;
}
- },
- destroy: function () {
- this.comObj.removeEventListener('message', this._onComObjOnMessage);
- }
+ Object.values = __w_pdfjs_require__(139);
+ })();
+}
+
+/***/ }),
+/* 3 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"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'];
};
-function loadJpegStream(id, imageUrl, objs) {
- var img = new Image();
- img.onload = (function loadJpegStream_onloadClosure() {
- objs.resolve(id, img);
- });
- img.onerror = (function loadJpegStream_onerrorClosure() {
- objs.resolve(id, null);
- warn('Error during JPEG image loading');
- });
- img.src = imageUrl;
-}
+/***/ }),
+/* 5 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- // 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 */
+"use strict";
- // feature detect for URL constructor
- var hasWorkingUrl = 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';
- }
- } catch(e) { }
- if (hasWorkingUrl)
- return;
+__w_pdfjs_require__(6);
- var relative = Object.create(null);
- relative['ftp'] = 21;
- relative['file'] = 0;
- relative['gopher'] = 70;
- relative['http'] = 80;
- relative['https'] = 443;
- relative['ws'] = 80;
- relative['wss'] = 443;
+module.exports = __w_pdfjs_require__(9).String.startsWith;
- var relativePathDotMapping = Object.create(null);
- relativePathDotMapping['%2e'] = '.';
- relativePathDotMapping['.%2e'] = '..';
- relativePathDotMapping['%2e.'] = '..';
- relativePathDotMapping['%2e%2e'] = '..';
+/***/ }),
+/* 6 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- function isRelativeScheme(scheme) {
- return relative[scheme] !== undefined;
- }
+"use strict";
- function invalid() {
- clear.call(this);
- this._isInvalid = true;
- }
- function IDNAToASCII(h) {
- if ('' == h) {
- invalid.call(this)
- }
- // XXX
- return h.toLowerCase()
- }
+var $export = __w_pdfjs_require__(7);
- function percentEscape(c) {
- var unicode = c.charCodeAt(0);
- if (unicode > 0x20 &&
- unicode < 0x7F &&
- // " # < > ? `
- [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) == -1
- ) {
- return c;
- }
- return encodeURIComponent(c);
- }
+var toLength = __w_pdfjs_require__(25);
- function percentEscapeQuery(c) {
- // XXX This actually needs to encode c using encoding and then
- // convert the bytes one-by-one.
+var context = __w_pdfjs_require__(27);
- var unicode = c.charCodeAt(0);
- if (unicode > 0x20 &&
- unicode < 0x7F &&
- // " # < > ` (do not escape '?')
- [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) == -1
- ) {
- return c;
- }
- return encodeURIComponent(c);
+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;
}
+});
- var EOF = undefined,
- ALPHA = /[a-zA-Z]/,
- ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
+/***/ }),
+/* 7 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- function parse(input, stateOverride, base) {
- function err(message) {
- errors.push(message)
- }
+"use strict";
- var state = stateOverride || 'scheme start',
- cursor = 0,
- buffer = '',
- seenAt = false,
- seenBracket = false,
- errors = [];
- loop: while ((input[cursor - 1] != EOF || cursor == 0) && !this._isInvalid) {
- var c = input[cursor];
- switch (state) {
- case 'scheme start':
- if (c && ALPHA.test(c)) {
- buffer += c.toLowerCase(); // ASCII-safe
- state = 'scheme';
- } else if (!stateOverride) {
- buffer = '';
- state = 'no scheme';
- continue;
- } else {
- err('Invalid scheme.');
- break loop;
- }
- break;
+var global = __w_pdfjs_require__(8);
- case 'scheme':
- if (c && ALPHANUMERIC.test(c)) {
- buffer += c.toLowerCase(); // ASCII-safe
- } else if (':' == c) {
- this._scheme = buffer;
- buffer = '';
- if (stateOverride) {
- break loop;
- }
- if (isRelativeScheme(this._scheme)) {
- this._isRelative = true;
- }
- if ('file' == this._scheme) {
- state = 'relative';
- } else if (this._isRelative && base && base._scheme == this._scheme) {
- state = 'relative or authority';
- } else if (this._isRelative) {
- state = 'authority first slash';
- } else {
- state = 'scheme data';
- }
- } else if (!stateOverride) {
- buffer = '';
- cursor = 0;
- state = 'no scheme';
- continue;
- } else if (EOF == c) {
- break loop;
- } else {
- err('Code point not allowed in scheme: ' + c)
- break loop;
- }
- break;
+var core = __w_pdfjs_require__(9);
- case 'scheme data':
- if ('?' == c) {
- this._query = '?';
- state = 'query';
- } else if ('#' == c) {
- this._fragment = '#';
- state = 'fragment';
- } else {
- // XXX error handling
- if (EOF != c && '\t' != c && '\n' != c && '\r' != c) {
- this._schemeData += percentEscape(c);
- }
- }
- break;
+var hide = __w_pdfjs_require__(10);
- case 'no scheme':
- if (!base || !(isRelativeScheme(base._scheme))) {
- err('Missing scheme.');
- invalid.call(this);
- } else {
- state = 'relative';
- continue;
- }
- break;
+var redefine = __w_pdfjs_require__(20);
- case 'relative or authority':
- if ('/' == c && '/' == input[cursor+1]) {
- state = 'authority ignore slashes';
- } else {
- err('Expected /, got: ' + c);
- state = 'relative';
- continue
- }
- break;
+var ctx = __w_pdfjs_require__(23);
- case 'relative':
- this._isRelative = true;
- if ('file' != this._scheme)
- this._scheme = base._scheme;
- if (EOF == c) {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = base._query;
- this._username = base._username;
- this._password = base._password;
- break loop;
- } else if ('/' == c || '\\' == c) {
- if ('\\' == c)
- err('\\ is an invalid code point.');
- state = 'relative slash';
- } else if ('?' == c) {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = '?';
- this._username = base._username;
- this._password = base._password;
- state = 'query';
- } else if ('#' == c) {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = base._query;
- this._fragment = '#';
- this._username = base._username;
- this._password = base._password;
- state = 'fragment';
- } else {
- var nextC = input[cursor+1]
- var nextNextC = input[cursor+2]
- if (
- 'file' != this._scheme || !ALPHA.test(c) ||
- (nextC != ':' && nextC != '|') ||
- (EOF != nextNextC && '/' != 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;
+var PROTOTYPE = 'prototype';
- case 'relative slash':
- if ('/' == c || '\\' == c) {
- if ('\\' == c) {
- err('\\ is an invalid code point.');
- }
- if ('file' == this._scheme) {
- state = 'file host';
- } else {
- state = 'authority ignore slashes';
- }
- } else {
- if ('file' != this._scheme) {
- this._host = base._host;
- this._port = base._port;
- this._username = base._username;
- this._password = base._password;
- }
- state = 'relative path';
- continue;
- }
- break;
+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;
- case 'authority first slash':
- if ('/' == c) {
- state = 'authority second slash';
- } else {
- err("Expected '/', got: " + c);
- state = 'authority ignore slashes';
- continue;
- }
- break;
+ 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;
+ }
+};
- case 'authority second slash':
- state = 'authority ignore slashes';
- if ('/' != c) {
- err("Expected '/', got: " + c);
- continue;
- }
- break;
+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;
- case 'authority ignore slashes':
- if ('/' != c && '\\' != c) {
- state = 'authority';
- continue;
- } else {
- err('Expected authority, got: ' + c);
- }
- break;
+/***/ }),
+/* 8 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- case 'authority':
- if ('@' == c) {
- if (seenAt) {
- err('@ already seen.');
- buffer += '%40';
- }
- seenAt = true;
- for (var i = 0; i < buffer.length; i++) {
- var cp = buffer[i];
- if ('\t' == cp || '\n' == cp || '\r' == cp) {
- err('Invalid whitespace in authority.');
- continue;
- }
- // XXX check URL code points
- if (':' == cp && null === this._password) {
- this._password = '';
- continue;
- }
- var tempC = percentEscape(cp);
- (null !== this._password) ? this._password += tempC : this._username += tempC;
- }
- buffer = '';
- } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) {
- cursor -= buffer.length;
- buffer = '';
- state = 'host';
- continue;
- } else {
- buffer += c;
- }
- break;
+"use strict";
- case 'file host':
- if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) {
- if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ':' || buffer[1] == '|')) {
- state = 'relative path';
- } else if (buffer.length == 0) {
- state = 'relative path start';
- } else {
- this._host = IDNAToASCII.call(this, buffer);
- buffer = '';
- state = 'relative path start';
- }
- continue;
- } else if ('\t' == c || '\n' == c || '\r' == c) {
- err('Invalid whitespace in file host.');
- } else {
- buffer += c;
- }
- break;
- case 'host':
- case 'hostname':
- if (':' == c && !seenBracket) {
- // XXX host parsing
- this._host = IDNAToASCII.call(this, buffer);
- buffer = '';
- state = 'port';
- if ('hostname' == stateOverride) {
- break loop;
- }
- } else if (EOF == c || '/' == 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) {
- seenBracket = true;
- } else if (']' == c) {
- seenBracket = false;
- }
- buffer += c;
- } else {
- err('Invalid code point in host/hostname: ' + c);
- }
- break;
+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;
- case 'port':
- if (/[0-9]/.test(c)) {
- buffer += c;
- } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c || stateOverride) {
- if ('' != buffer) {
- var temp = parseInt(buffer, 10);
- if (temp != relative[this._scheme]) {
- this._port = temp + '';
- }
- buffer = '';
- }
- if (stateOverride) {
- break loop;
- }
- state = 'relative path start';
- continue;
- } else if ('\t' == c || '\n' == c || '\r' == c) {
- err('Invalid code point in port: ' + c);
- } else {
- invalid.call(this);
- }
- break;
+/***/ }),
+/* 9 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- case 'relative path start':
- if ('\\' == c)
- err("'\\' not allowed in path.");
- state = 'relative path';
- if ('/' != c && '\\' != c) {
- continue;
- }
- break;
+"use strict";
- case 'relative path':
- if (EOF == c || '/' == c || '\\' == c || (!stateOverride && ('?' == c || '#' == c))) {
- if ('\\' == c) {
- err('\\ not allowed in relative path.');
- }
- var tmp;
- if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
- buffer = tmp;
- }
- if ('..' == buffer) {
- this._path.pop();
- if ('/' != c && '\\' != c) {
- this._path.push('');
- }
- } else if ('.' == buffer && '/' != c && '\\' != c) {
- this._path.push('');
- } else if ('.' != buffer) {
- if ('file' == this._scheme && this._path.length == 0 && buffer.length == 2 && ALPHA.test(buffer[0]) && buffer[1] == '|') {
- buffer = buffer[0] + ':';
- }
- this._path.push(buffer);
- }
- buffer = '';
- if ('?' == c) {
- this._query = '?';
- state = 'query';
- } else if ('#' == c) {
- this._fragment = '#';
- state = 'fragment';
- }
- } else if ('\t' != c && '\n' != c && '\r' != c) {
- buffer += percentEscape(c);
- }
- break;
- case 'query':
- if (!stateOverride && '#' == c) {
- this._fragment = '#';
- state = 'fragment';
- } else if (EOF != c && '\t' != c && '\n' != c && '\r' != c) {
- this._query += percentEscapeQuery(c);
- }
- break;
+var core = module.exports = {
+ version: '2.6.2'
+};
+if (typeof __e == 'number') __e = core;
- case 'fragment':
- if (EOF != c && '\t' != c && '\n' != c && '\r' != c) {
- this._fragment += c;
- }
- break;
- }
+/***/ }),
+/* 10 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- cursor++;
- }
- }
+"use strict";
- function clear() {
- this._scheme = '';
- this._schemeData = '';
- this._username = '';
- this._password = null;
- this._host = '';
- this._port = '';
- this._path = [];
- this._query = '';
- this._fragment = '';
- this._isInvalid = false;
- this._isRelative = false;
- }
- // 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));
+var dP = __w_pdfjs_require__(11);
- this._url = url;
- clear.call(this);
+var createDesc = __w_pdfjs_require__(19);
- var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
- // encoding = encoding || 'utf-8'
+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;
+};
- parse.call(this, input, null, base);
- }
+/***/ }),
+/* 11 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- jURL.prototype = {
- toString: function() {
- return this.href;
- },
- get href() {
- if (this._isInvalid)
- return this._url;
+"use strict";
- var authority = '';
- if ('' != this._username || null != this._password) {
- authority = this._username +
- (null != this._password ? ':' + this._password : '') + '@';
- }
- return this.protocol +
- (this._isRelative ? '//' + authority + this.host : '') +
- this.pathname + this._query + this._fragment;
- },
- set href(href) {
- clear.call(this);
- parse.call(this, href);
- },
+var anObject = __w_pdfjs_require__(12);
- get protocol() {
- return this._scheme + ':';
- },
- set protocol(protocol) {
- if (this._isInvalid)
- return;
- parse.call(this, protocol + ':', 'scheme start');
- },
+var IE8_DOM_DEFINE = __w_pdfjs_require__(14);
- get host() {
- return this._isInvalid ? '' : this._port ?
- this._host + ':' + this._port : this._host;
- },
- set host(host) {
- if (this._isInvalid || !this._isRelative)
- return;
- parse.call(this, host, 'host');
- },
+var toPrimitive = __w_pdfjs_require__(18);
- get hostname() {
- return this._host;
- },
- set hostname(hostname) {
- if (this._isInvalid || !this._isRelative)
- return;
- parse.call(this, hostname, 'hostname');
- },
+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;
+};
- get port() {
- return this._port;
- },
- set port(port) {
- if (this._isInvalid || !this._isRelative)
- return;
- parse.call(this, port, 'port');
- },
+/***/ }),
+/* 12 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- get pathname() {
- return this._isInvalid ? '' : this._isRelative ?
- '/' + this._path.join('/') : this._schemeData;
- },
- set pathname(pathname) {
- if (this._isInvalid || !this._isRelative)
- return;
- this._path = [];
- parse.call(this, pathname, 'relative path start');
- },
+"use strict";
- get search() {
- return this._isInvalid || !this._query || '?' == this._query ?
- '' : this._query;
- },
- set search(search) {
- if (this._isInvalid || !this._isRelative)
- return;
- this._query = '?';
- if ('?' == search[0])
- search = search.slice(1);
- parse.call(this, search, 'query');
- },
- get hash() {
- return this._isInvalid || !this._fragment || '#' == this._fragment ?
- '' : this._fragment;
- },
- set hash(hash) {
- if (this._isInvalid)
- return;
- this._fragment = '#';
- if ('#' == hash[0])
- hash = hash.slice(1);
- parse.call(this, hash, 'fragment');
- },
+var isObject = __w_pdfjs_require__(13);
- 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';
- }
- host = this.host;
- if (!host) {
- return '';
- }
- return this._scheme + '://' + host;
- }
- };
+module.exports = function (it) {
+ if (!isObject(it)) throw TypeError(it + ' is not an object!');
+ return it;
+};
- // 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);
- };
- }
+/***/ }),
+/* 13 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- scope.URL = jURL;
- /* jshint ignore:end */
-})(globalScope);
+"use strict";
-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 _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.pdfjsDisplayAnnotationLayer = {}), root.pdfjsSharedUtil,
- root.pdfjsDisplayDOMUtils);
- }
-}(this, function (exports, sharedUtil, displayDOMUtils) {
+module.exports = function (it) {
+ return _typeof(it) === 'object' ? it !== null : typeof it === 'function';
+};
-var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
-var AnnotationType = sharedUtil.AnnotationType;
-var Util = sharedUtil.Util;
-var addLinkAttributes = sharedUtil.addLinkAttributes;
-var warn = sharedUtil.warn;
-var CustomStyle = displayDOMUtils.CustomStyle;
+/***/ }),
+/* 14 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
-/**
- * @typedef {Object} AnnotationElementParameters
- * @property {Object} data
- * @property {HTMLDivElement} layer
- * @property {PDFPage} page
- * @property {PageViewport} viewport
- * @property {IPDFLinkService} linkService
- */
+"use strict";
-/**
- * @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);
+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;
+});
- case AnnotationType.TEXT:
- return new TextAnnotationElement(parameters);
+/***/ }),
+/* 15 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- case AnnotationType.WIDGET:
- return new WidgetAnnotationElement(parameters);
+"use strict";
- case AnnotationType.POPUP:
- return new PopupAnnotationElement(parameters);
- case AnnotationType.HIGHLIGHT:
- return new HighlightAnnotationElement(parameters);
+module.exports = !__w_pdfjs_require__(16)(function () {
+ return Object.defineProperty({}, 'a', {
+ get: function get() {
+ return 7;
+ }
+ }).a != 7;
+});
- case AnnotationType.UNDERLINE:
- return new UnderlineAnnotationElement(parameters);
+/***/ }),
+/* 16 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- case AnnotationType.SQUIGGLY:
- return new SquigglyAnnotationElement(parameters);
+"use strict";
- case AnnotationType.STRIKEOUT:
- return new StrikeOutAnnotationElement(parameters);
- default:
- throw new Error('Unimplemented annotation type "' + subtype + '"');
- }
+module.exports = function (exec) {
+ try {
+ return !!exec();
+ } catch (e) {
+ return true;
}
};
-/**
- * @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();
- }
+/***/ }),
+/* 17 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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];
+"use strict";
- 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 isObject = __w_pdfjs_require__(13);
- 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);
- }
+var document = __w_pdfjs_require__(8).document;
- switch (data.borderStyle.style) {
- case AnnotationBorderStyleType.SOLID:
- container.style.borderStyle = 'solid';
- break;
+var is = isObject(document) && isObject(document.createElement);
- case AnnotationBorderStyleType.DASHED:
- container.style.borderStyle = 'dashed';
- break;
+module.exports = function (it) {
+ return is ? document.createElement(it) : {};
+};
- case AnnotationBorderStyleType.BEVELED:
- warn('Unimplemented border style: beveled');
- break;
+/***/ }),
+/* 18 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- case AnnotationBorderStyleType.INSET:
- warn('Unimplemented border style: inset');
- break;
+"use strict";
- case AnnotationBorderStyleType.UNDERLINE:
- container.style.borderBottomStyle = 'solid';
- break;
- default:
- break;
- }
+var isObject = __w_pdfjs_require__(13);
- 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;
- }
- }
+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");
+};
- container.style.left = rect[0] + 'px';
- container.style.top = rect[1] + 'px';
+/***/ }),
+/* 19 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- container.style.width = width + 'px';
- container.style.height = height + 'px';
+"use strict";
- 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');
- }
+module.exports = function (bitmap, value) {
+ return {
+ enumerable: !(bitmap & 1),
+ configurable: !(bitmap & 2),
+ writable: !(bitmap & 4),
+ value: value
};
+};
- return AnnotationElement;
-})();
+/***/ }),
+/* 20 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
-/**
- * @class
- * @alias LinkAnnotationElement
- */
-var LinkAnnotationElement = (function LinkAnnotationElementClosure() {
- function LinkAnnotationElement(parameters) {
- AnnotationElement.call(this, parameters);
- }
-
- 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);
- }
- }
+var global = __w_pdfjs_require__(8);
- this.container.appendChild(link);
- return this.container;
- },
+var hide = __w_pdfjs_require__(10);
- /**
- * 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 has = __w_pdfjs_require__(21);
- link.href = this.linkService.getDestinationHash(destination);
- link.onclick = function() {
- if (destination) {
- self.linkService.navigateTo(destination);
- }
- return false;
- };
- if (destination) {
- link.className = 'internalLink';
- }
- },
+var SRC = __w_pdfjs_require__(22)('src');
- /**
- * 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 TO_STRING = 'toString';
+var $toString = Function[TO_STRING];
+var TPL = ('' + $toString).split(TO_STRING);
- link.href = this.linkService.getAnchorUrl('');
- link.onclick = function() {
- self.linkService.executeNamedAction(action);
- return false;
- };
- link.className = 'internalLink';
- }
- });
+__w_pdfjs_require__(9).inspectSource = function (it) {
+ return $toString.call(it);
+};
- return LinkAnnotationElement;
-})();
+(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);
+});
-/**
- * @class
- * @alias TextAnnotationElement
- */
-var TextAnnotationElement = (function TextAnnotationElementClosure() {
- function TextAnnotationElement(parameters) {
- AnnotationElement.call(this, parameters);
- }
-
- 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';
+/***/ }),
+/* 21 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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});
+"use strict";
- 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
- });
- var popup = popupElement.render();
- // Position the popup next to the Text annotation's container.
- popup.style.left = image.style.width;
+var hasOwnProperty = {}.hasOwnProperty;
- this.container.appendChild(popup);
- }
+module.exports = function (it, key) {
+ return hasOwnProperty.call(it, key);
+};
- this.container.appendChild(image);
- return this.container;
- }
- });
+/***/ }),
+/* 22 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- return TextAnnotationElement;
-})();
+"use strict";
-/**
- * @class
- * @alias WidgetAnnotationElement
- */
-var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() {
- function WidgetAnnotationElement(parameters) {
- AnnotationElement.call(this, parameters);
- }
-
- 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';
-
- var font = (this.data.fontRefName ?
- this.page.commonObjs.getData(this.data.fontRefName) : null);
- this._setTextStyle(content, font);
-
- this.container.appendChild(content);
- return this.container;
- },
- /**
- * 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');
+var id = 0;
+var px = Math.random();
- if (!font) {
- return;
- }
+module.exports = function (key) {
+ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
+};
- style.fontWeight = (font.black ?
- (font.bold ? '900' : 'bold') :
- (font.bold ? 'bold' : 'normal'));
- style.fontStyle = (font.italic ? 'italic' : 'normal');
+/***/ }),
+/* 23 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- // 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;
- }
- });
+"use strict";
- 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 aFunction = __w_pdfjs_require__(24);
- var selector = '[data-annotation-id="' + this.data.parentId + '"]';
- var parentElement = this.layer.querySelector(selector);
- if (!parentElement) {
- return this.container;
- }
+module.exports = function (fn, that, length) {
+ aFunction(fn);
+ if (that === undefined) return fn;
- var popup = new PopupElement({
- container: this.container,
- trigger: parentElement,
- color: this.data.color,
- title: this.data.title,
- contents: this.data.contents
- });
+ switch (length) {
+ case 1:
+ return function (a) {
+ return fn.call(that, a);
+ };
- // 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';
+ case 2:
+ return function (a, b) {
+ return fn.call(that, a, b);
+ };
- this.container.appendChild(popup.render());
- return this.container;
- }
- });
+ case 3:
+ return function (a, b, c) {
+ return fn.call(that, a, b, c);
+ };
+ }
- return PopupAnnotationElement;
-})();
+ return function () {
+ return fn.apply(that, arguments);
+ };
+};
-/**
- * @class
- * @alias PopupElement
- */
-var PopupElement = (function PopupElementClosure() {
- var BACKGROUND_ENLIGHT = 0.7;
+/***/ }),
+/* 24 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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;
+"use strict";
- this.pinned = false;
- }
- 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);
+module.exports = function (it) {
+ if (typeof it != 'function') throw TypeError(it + ' is not a function!');
+ return it;
+};
- var popup = document.createElement('div');
- popup.className = 'popup';
+/***/ }),
+/* 25 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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);
- }
+"use strict";
- 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));
+var toInteger = __w_pdfjs_require__(26);
- popup.appendChild(title);
- popup.appendChild(contents);
- wrapper.appendChild(popup);
- return wrapper;
- },
+var min = Math.min;
- /**
- * 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;
- },
+module.exports = function (it) {
+ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0;
+};
- /**
- * Toggle the visibility of the popup.
- *
- * @private
- * @memberof PopupElement
- */
- _toggle: function PopupElement_toggle() {
- if (this.pinned) {
- this._hide(true);
- } else {
- this._show(true);
- }
- },
+/***/ }),
+/* 26 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- /**
- * 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;
- }
- },
+"use strict";
- /**
- * 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;
-})();
+var ceil = Math.ceil;
+var floor = Math.floor;
-/**
- * @class
- * @alias HighlightAnnotationElement
- */
-var HighlightAnnotationElement = (
- function HighlightAnnotationElementClosure() {
- function HighlightAnnotationElement(parameters) {
- AnnotationElement.call(this, parameters);
- }
-
- 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;
- }
- });
+module.exports = function (it) {
+ return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
+};
- return HighlightAnnotationElement;
-})();
+/***/ }),
+/* 27 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
-/**
- * @class
- * @alias UnderlineAnnotationElement
- */
-var UnderlineAnnotationElement = (
- function UnderlineAnnotationElementClosure() {
- function UnderlineAnnotationElement(parameters) {
- AnnotationElement.call(this, parameters);
- }
-
- 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;
- }
- });
+"use strict";
- return UnderlineAnnotationElement;
-})();
-/**
- * @class
- * @alias SquigglyAnnotationElement
- */
-var SquigglyAnnotationElement = (function SquigglyAnnotationElementClosure() {
- function SquigglyAnnotationElement(parameters) {
- AnnotationElement.call(this, parameters);
- }
-
- 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 isRegExp = __w_pdfjs_require__(28);
- return SquigglyAnnotationElement;
-})();
+var defined = __w_pdfjs_require__(33);
-/**
- * @class
- * @alias StrikeOutAnnotationElement
- */
-var StrikeOutAnnotationElement = (
- function StrikeOutAnnotationElementClosure() {
- function StrikeOutAnnotationElement(parameters) {
- AnnotationElement.call(this, parameters);
- }
-
- 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;
- }
- });
+module.exports = function (that, searchString, NAME) {
+ if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
+ return String(defined(that));
+};
- return StrikeOutAnnotationElement;
-})();
+/***/ }),
+/* 28 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
-/**
- * @typedef {Object} AnnotationLayerParameters
- * @property {PageViewport} viewport
- * @property {HTMLDivElement} div
- * @property {Array} annotations
- * @property {PDFPage} page
- * @property {IPDFLinkService} linkService
- */
+"use strict";
-/**
- * @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();
- for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
- var data = parameters.annotations[i];
- if (!data || !data.hasHtml) {
- continue;
- }
+var isObject = __w_pdfjs_require__(13);
- 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());
- }
- },
+var cof = __w_pdfjs_require__(29);
- /**
- * 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(',') + ')');
- }
- }
- parameters.div.removeAttribute('hidden');
- }
- };
-})();
+var MATCH = __w_pdfjs_require__(30)('match');
-PDFJS.AnnotationLayer = AnnotationLayer;
+module.exports = function (it) {
+ var isRegExp;
+ return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
+};
-exports.AnnotationLayer = AnnotationLayer;
-}));
-
-
-(function (root, factory) {
- {
- factory((root.pdfjsDisplayFontLoader = {}), root.pdfjsSharedUtil,
- root.pdfjsSharedGlobal);
- }
-}(this, function (exports, sharedUtil, sharedGlobal) {
-
-var assert = sharedUtil.assert;
-var bytesToString = sharedUtil.bytesToString;
-var string32 = sharedUtil.string32;
-var shadow = sharedUtil.shadow;
-var warn = sharedUtil.warn;
-
-var PDFJS = sharedGlobal.PDFJS;
-var globalScope = sharedGlobal.globalScope;
-var isWorker = sharedGlobal.isWorker;
-
-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);
- },
+/***/ }),
+/* 29 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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.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' +
- 'AADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6A' +
- 'ABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAA' +
- 'MQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAA' +
- 'AAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAA' +
- 'AAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQ' +
- 'AAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMA' +
- 'AQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAA' +
- 'EAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAA' +
- 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAA' +
- 'AAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgc' +
- 'A/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWF' +
- 'hYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQA' +
- 'AAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAg' +
- 'ABAAAAAAAAAAAD6AAAAAAAAA=='
- ));
- },
+"use strict";
- addNativeFontFace: function fontLoader_addNativeFontFace(nativeFontFace) {
- this.nativeFontFaces.push(nativeFontFace);
- document.fonts.add(nativeFontFace);
- },
- 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];
+var toString = {}.toString;
- // Add the font to the DOM only once or skip if the font
- // is already loaded.
- if (font.attached || font.loading === false) {
- continue;
- }
- font.attached = true;
+module.exports = function (it) {
+ return toString.call(it).slice(8, -1);
+};
- if (FontLoader.isFontLoadingAPISupported) {
- var nativeFontFace = font.createNativeFontFace();
- if (nativeFontFace) {
- this.addNativeFontFace(nativeFontFace);
- fontLoadPromises.push(getNativeFontPromise(nativeFontFace));
- }
- } else {
- var rule = font.createFontFaceRule();
- if (rule) {
- this.insertRule(rule);
- rules.push(rule);
- fontsToLoad.push(font);
- }
- }
- }
+/***/ }),
+/* 30 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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();
- }
- },
+"use strict";
- queueLoadingCallback: function FontLoader_queueLoadingCallback(callback) {
- function LoadLoader_completeRequest() {
- assert(!request.end, 'completeRequest() cannot be called twice');
- request.end = Date.now();
- // 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);
- }
- }
+var store = __w_pdfjs_require__(31)('wks');
- 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;
- },
+var uid = __w_pdfjs_require__(22);
- 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.
+var _Symbol = __w_pdfjs_require__(8).Symbol;
- function int32(data, offset) {
- return (data.charCodeAt(offset) << 24) |
- (data.charCodeAt(offset + 1) << 16) |
- (data.charCodeAt(offset + 2) << 8) |
- (data.charCodeAt(offset + 3) & 0xff);
- }
+var USE_SYMBOL = typeof _Symbol == 'function';
- function spliceString(s, offset, remove, insert) {
- var chunk1 = s.substr(0, offset);
- var chunk2 = s.substr(offset + remove);
- return chunk1 + insert + chunk2;
- }
+var $exports = module.exports = function (name) {
+ return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name));
+};
- var i, ii;
+$exports.store = store;
- var canvas = document.createElement('canvas');
- canvas.width = 1;
- canvas.height = 1;
- var ctx = canvas.getContext('2d');
-
- 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();
- 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' + 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 (i < loadTestFontId.length) { // align to 4 bytes boundary
- checksum = (checksum - XXXX_VALUE +
- int32(loadTestFontId + 'XXX', i)) | 0;
- }
- 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 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();
- });
- /** Hack end */
- }
-};
-FontLoader.isFontLoadingAPISupported = (!isWorker &&
- typeof document !== 'undefined' && !!document.fonts);
-Object.defineProperty(FontLoader, 'isSyncFontLoadingSupported', {
- get: function () {
- var supported = false;
+/***/ }),
+/* 31 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- // 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;
- }
- // TODO other browsers
- if (userAgent === 'node') {
- supported = true;
- }
- return shadow(FontLoader, 'isSyncFontLoadingSupported', supported);
- },
- enumerable: true,
- configurable: true
-});
+"use strict";
-var FontFaceObject = (function FontFaceObjectClosure() {
- function FontFaceObject(translatedData) {
- this.compiledGlyphs = {};
- // importing translated data
- for (var i in translatedData) {
- this[i] = translatedData[i];
- }
- }
- Object.defineProperty(FontFaceObject, 'isEvalSupported', {
- get: function () {
- var evalSupport = false;
- if (PDFJS.isEvalSupported) {
- try {
- /* jshint evil: true */
- new Function('');
- evalSupport = true;
- } catch (e) {}
- }
- return shadow(this, 'isEvalSupported', evalSupport);
- },
- enumerable: true,
- configurable: true
- });
- FontFaceObject.prototype = {
- createNativeFontFace: function FontFaceObject_createNativeFontFace() {
- if (!this.data) {
- return null;
- }
- if (PDFJS.disableFontFace) {
- this.disableFontFace = true;
- return null;
- }
+var core = __w_pdfjs_require__(9);
- var nativeFontFace = new FontFace(this.loadedName, this.data, {});
+var global = __w_pdfjs_require__(8);
- if (PDFJS.pdfBug && 'FontInspector' in globalScope &&
- globalScope['FontInspector'].enabled) {
- globalScope['FontInspector'].fontAdded(this);
- }
- return nativeFontFace;
- },
+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)'
+});
- createFontFaceRule: function FontFaceObject_createFontFaceRule() {
- if (!this.data) {
- return null;
- }
+/***/ }),
+/* 32 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- if (PDFJS.disableFontFace) {
- this.disableFontFace = true;
- return null;
- }
+"use strict";
- 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 + '}';
+module.exports = false;
- if (PDFJS.pdfBug && 'FontInspector' in globalScope &&
- globalScope['FontInspector'].enabled) {
- globalScope['FontInspector'].fontAdded(this, url);
- }
+/***/ }),
+/* 33 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- return rule;
- },
+"use strict";
- 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];
+module.exports = function (it) {
+ if (it == undefined) throw TypeError("Can't call method on " + it);
+ return it;
+};
- if (current.args !== undefined) {
- args = current.args.join(',');
- } else {
- args = '';
- }
+/***/ }),
+/* 34 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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];
- }
+"use strict";
- c[current.cmd].apply(c, current.args);
- }
- };
- }
- }
- return this.compiledGlyphs[character];
- }
- };
- return FontFaceObject;
-})();
-exports.FontFaceObject = FontFaceObject;
-exports.FontLoader = FontLoader;
-}));
+var MATCH = __w_pdfjs_require__(30)('match');
+module.exports = function (KEY) {
+ var re = /./;
-(function (root, factory) {
- {
- factory((root.pdfjsDisplayMetadata = {}), root.pdfjsSharedUtil);
+ try {
+ '/./'[KEY](re);
+ } catch (e) {
+ try {
+ re[MATCH] = false;
+ return !'/./'[KEY](re);
+ } catch (f) {}
}
-}(this, function (exports, sharedUtil) {
-var error = sharedUtil.error;
+ return true;
+};
-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) :
- '' + (0x10000 + code).toString(16).substring(1) + ';';
- }
- return '>' + chars;
- });
- }
+/***/ }),
+/* 35 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- function Metadata(meta) {
- if (typeof meta === 'string') {
- // Ghostscript produces invalid metadata
- meta = fixMetadata(meta);
+"use strict";
- var parser = new DOMParser();
- meta = parser.parseFromString(meta, 'application/xml');
- } else if (!(meta instanceof Document)) {
- error('Metadata: Invalid metadata object');
- }
- this.metaDocument = meta;
- this.metadata = {};
- this.parse();
- }
+__w_pdfjs_require__(36);
- Metadata.prototype = {
- parse: function Metadata_parse() {
- var doc = this.metaDocument;
- var rdf = doc.documentElement;
+module.exports = __w_pdfjs_require__(9).String.endsWith;
- if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') { // Wrapped in
- rdf = rdf.firstChild;
- while (rdf && rdf.nodeName.toLowerCase() !== 'rdf:rdf') {
- rdf = rdf.nextSibling;
- }
- }
+/***/ }),
+/* 36 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- var nodeName = (rdf) ? rdf.nodeName.toLowerCase() : null;
- if (!rdf || nodeName !== 'rdf:rdf' || !rdf.hasChildNodes()) {
- return;
- }
+"use strict";
- 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();
- }
- }
- }
- },
+var $export = __w_pdfjs_require__(7);
- get: function Metadata_get(name) {
- return this.metadata[name] || null;
- },
+var toLength = __w_pdfjs_require__(25);
- has: function Metadata_has(name) {
- return typeof this.metadata[name] !== 'undefined';
- }
- };
+var context = __w_pdfjs_require__(27);
- return Metadata;
-})();
+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;
+ }
+});
-exports.Metadata = Metadata;
-}));
+/***/ }),
+/* 37 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+"use strict";
-(function (root, factory) {
- {
- factory((root.pdfjsDisplaySVG = {}), root.pdfjsSharedUtil);
- }
-}(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;
+__w_pdfjs_require__(38);
-var SVG_DEFAULTS = {
- fontStyle: 'normal',
- fontWeight: 'normal',
- fillColor: '#000000'
-};
+module.exports = __w_pdfjs_require__(9).String.includes;
-var convertImgDataToPng = (function convertImgDataToPngClosure() {
- var PNG_HEADER =
- new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
+/***/ }),
+/* 38 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- var CHUNK_WRAPPER_SIZE = 12;
+"use strict";
- var crcTable = new Int32Array(256);
- for (var i = 0; i < 256; i++) {
- var c = i;
- for (var h = 0; h < 8; h++) {
- if (c & 1) {
- c = 0xedB88320 ^ ((c >> 1) & 0x7fffffff);
- } else {
- c = (c >> 1) & 0x7fffffff;
- }
- }
- crcTable[i] = c;
- }
- function crc32(data, start, end) {
- var crc = -1;
- for (var i = start; i < end; i++) {
- var a = (crc ^ data[i]) & 0xff;
- var b = crcTable[a];
- crc = (crc >>> 8) ^ b;
- }
- return crc ^ -1;
+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);
}
+});
- function writePngChunk(type, body, data, offset) {
- var p = offset;
- var len = body.length;
+/***/ }),
+/* 39 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- data[p] = len >> 24 & 0xff;
- data[p + 1] = len >> 16 & 0xff;
- data[p + 2] = len >> 8 & 0xff;
- data[p + 3] = len & 0xff;
- p += 4;
+"use strict";
- 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;
+__w_pdfjs_require__(40);
- var crc = crc32(data, offset + 4, p);
+module.exports = __w_pdfjs_require__(9).Array.includes;
- data[p] = crc >> 24 & 0xff;
- data[p + 1] = crc >> 16 & 0xff;
- data[p + 2] = crc >> 8 & 0xff;
- data[p + 3] = crc & 0xff;
- }
+/***/ }),
+/* 40 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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;
- }
+"use strict";
- 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);
- };
-})();
-
-var SVGExtraState = (function SVGExtraStateClosure() {
- function SVGExtraState() {
- this.fontSizeScale = 1;
- this.fontWeight = SVG_DEFAULTS.fontWeight;
- this.fontSize = 0;
-
- this.textMatrix = IDENTITY_MATRIX;
- this.fontMatrix = FONT_IDENTITY_MATRIX;
- this.leading = 0;
+var $export = __w_pdfjs_require__(7);
- // Current point (in user coordinates)
- this.x = 0;
- this.y = 0;
+var $includes = __w_pdfjs_require__(41)(true);
- // Start of text line (in text coordinates)
- this.lineX = 0;
- this.lineY = 0;
+$export($export.P, 'Array', {
+ includes: function includes(el) {
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
- // Character and word spacing
- this.charSpacing = 0;
- this.wordSpacing = 0;
- this.textHScale = 1;
- this.textRise = 0;
+__w_pdfjs_require__(45)('includes');
- // Default foreground and background colors
- this.fillColor = SVG_DEFAULTS.fillColor;
- this.strokeColor = '#000000';
+/***/ }),
+/* 41 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- this.fillAlpha = 1;
- this.strokeAlpha = 1;
- this.lineWidth = 1;
- this.lineJoin = '';
- this.lineCap = '';
- this.miterLimit = 0;
+"use strict";
- this.dashArray = [];
- this.dashPhase = 0;
- this.dependencies = [];
+var toIObject = __w_pdfjs_require__(42);
- // Clipping
- this.clipId = '';
- this.pendingClip = false;
+var toLength = __w_pdfjs_require__(25);
- this.maskId = '';
- }
+var toAbsoluteIndex = __w_pdfjs_require__(44);
- SVGExtraState.prototype = {
- clone: function SVGExtraState_clone() {
- return Object.create(this);
- },
- setCurrentPoint: function SVGExtraState_setCurrentPoint(x, y) {
- this.x = x;
- this.y = y;
+module.exports = function (IS_INCLUDES) {
+ return function ($this, el, fromIndex) {
+ var O = toIObject($this);
+ var length = toLength(O.length);
+ var index = toAbsoluteIndex(fromIndex, length);
+ var value;
+ if (IS_INCLUDES && el != el) while (length > index) {
+ value = O[index++];
+ if (value != value) return true;
+ } else for (; length > index; index++) {
+ if (IS_INCLUDES || index in O) {
+ if (O[index] === el) return IS_INCLUDES || index || 0;
+ }
}
+ return !IS_INCLUDES && -1;
};
- return SVGExtraState;
-})();
+};
-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;
- }
-
- 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;
- }
+/***/ }),
+/* 42 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- if(opList[x].fn === 'restore') {
- opTree = tmp.pop();
- } else {
- opTree.push(opList[x]);
- }
- }
- return opTree;
- }
+"use strict";
- /**
- * 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 = [];
- this.commonObjs = commonObjs;
- this.objs = objs;
- this.pendingEOFill = false;
+var IObject = __w_pdfjs_require__(43);
- this.embedFonts = false;
- this.embeddedFonts = {};
- this.cssStyle = null;
- }
+var defined = __w_pdfjs_require__(33);
- 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;
+module.exports = function (it) {
+ return IObject(defined(it));
+};
- SVGGraphics.prototype = {
- save: function SVGGraphics_save() {
- this.transformStack.push(this.transformMatrix);
- var old = this.current;
- this.extraStack.push(old);
- this.current = old.clone();
- },
+/***/ }),
+/* 43 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- restore: function SVGGraphics_restore() {
- this.transformMatrix = this.transformStack.pop();
- this.current = this.extraStack.pop();
+"use strict";
- this.tgrp = document.createElementNS(NS, 'svg:g');
- this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
- this.pgrp.appendChild(this.tgrp);
- },
- group: function SVGGraphics_group(items) {
- this.save();
- this.executeOpTree(items);
- this.restore();
- },
+var cof = __w_pdfjs_require__(29);
- loadDependencies: function SVGGraphics_loadDependencies(operatorList) {
- var fnArray = operatorList.fnArray;
- var fnArrayLen = fnArray.length;
- var argsArray = operatorList.argsArray;
+module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
+ return cof(it) == 'String' ? it.split('') : Object(it);
+};
- 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);
- });
- }
- this.current.dependencies.push(promise);
- }
- }
- }
- return Promise.all(this.current.dependencies);
- },
+/***/ }),
+/* 44 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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);
+"use strict";
- 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;
+var toInteger = __w_pdfjs_require__(26);
- 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));
- },
+var max = Math.max;
+var min = Math.min;
- convertOpList: function SVGGraphics_convertOpList(operatorList) {
- var argsArray = operatorList.argsArray;
- var fnArray = operatorList.fnArray;
- var fnArrayLen = fnArray.length;
- var REVOPS = [];
- var opList = [];
+module.exports = function (index, length) {
+ index = toInteger(index);
+ return index < 0 ? max(index + length, 0) : min(index, length);
+};
- for (var op in OPS) {
- REVOPS[OPS[op]] = op;
- }
+/***/ }),
+/* 45 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- for (var x = 0; x < fnArrayLen; x++) {
- var fnId = fnArray[x];
- opList.push({'fnId' : fnId, 'fn': REVOPS[fnId], 'args': argsArray[x]});
- }
- return opListToTree(opList);
- },
+"use strict";
- 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 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;
- }
- }
- },
+var UNSCOPABLES = __w_pdfjs_require__(30)('unscopables');
- setWordSpacing: function SVGGraphics_setWordSpacing(wordSpacing) {
- this.current.wordSpacing = wordSpacing;
- },
+var ArrayProto = Array.prototype;
+if (ArrayProto[UNSCOPABLES] == undefined) __w_pdfjs_require__(10)(ArrayProto, UNSCOPABLES, {});
- setCharSpacing: function SVGGraphics_setCharSpacing(charSpacing) {
- this.current.charSpacing = charSpacing;
- },
+module.exports = function (key) {
+ ArrayProto[UNSCOPABLES][key] = true;
+};
- nextLine: function SVGGraphics_nextLine() {
- this.moveText(0, this.current.leading);
- },
+/***/ }),
+/* 46 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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];
+"use strict";
- 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));
+__w_pdfjs_require__(47);
- current.txtElement = document.createElementNS(NS, 'svg:text');
- current.txtElement.appendChild(current.tspan);
- },
+__w_pdfjs_require__(62);
- 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 = [];
- },
+module.exports = __w_pdfjs_require__(9).Array.from;
- moveText: function SVGGraphics_moveText(x, y) {
- var current = this.current;
- this.current.x = this.current.lineX += x;
- this.current.y = this.current.lineY += y;
+/***/ }),
+/* 47 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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));
- },
+"use strict";
- showText: function SVGGraphics_showText(glyphs) {
- var current = this.current;
- var font = current.font;
- var fontSize = current.fontSize;
- if (fontSize === 0) {
- return;
- }
+var $at = __w_pdfjs_require__(48)(true);
- 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];
+__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
+ };
+});
- 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);
+/***/ }),
+/* 48 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- var width = glyph.width;
- var character = glyph.fontChar;
- var charWidth = width * widthAdvanceScale + charSpacing * fontDirection;
- x += charWidth;
+"use strict";
- current.tspan.textContent += character;
- }
- 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);
- }
- if (current.fillColor !== SVG_DEFAULTS.fillColor) {
- current.tspan.setAttributeNS(null, 'fill', current.fillColor);
- }
+var toInteger = __w_pdfjs_require__(26);
- 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);
+var defined = __w_pdfjs_require__(33);
- this.tgrp.appendChild(current.txtElement);
+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__) {
- setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) {
- this.setLeading(-y);
- this.moveText(x, y);
- },
+"use strict";
- 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';
- },
+var LIBRARY = __w_pdfjs_require__(32);
- setFont: function SVGGraphics_setFont(details) {
- var current = this.current;
- var fontObj = this.commonObjs.get(details[0]);
- var size = details[1];
- this.current.font = fontObj;
+var $export = __w_pdfjs_require__(7);
- if (this.embedFonts && fontObj.data &&
- !this.embeddedFonts[fontObj.loadedName]) {
- this.addFontStyle(fontObj);
- this.embeddedFonts[fontObj.loadedName] = fontObj;
- }
+var redefine = __w_pdfjs_require__(20);
- current.fontMatrix = (fontObj.fontMatrix ?
- fontObj.fontMatrix : FONT_IDENTITY_MATRIX);
+var hide = __w_pdfjs_require__(10);
- var bold = fontObj.black ? (fontObj.bold ? 'bolder' : 'bold') :
- (fontObj.bold ? 'bold' : 'normal');
- var italic = fontObj.italic ? 'italic' : 'normal';
+var Iterators = __w_pdfjs_require__(50);
- 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;
+var $iterCreate = __w_pdfjs_require__(51);
- current.tspan = document.createElementNS(NS, 'svg:tspan');
- current.tspan.setAttributeNS(null, 'y', pf(-current.y));
- current.xcoords = [];
- },
+var setToStringTag = __w_pdfjs_require__(59);
- 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));
- },
+var getPrototypeOf = __w_pdfjs_require__(60);
- // Path properties
- setLineWidth: function SVGGraphics_setLineWidth(width) {
- this.current.lineWidth = width;
- },
- setLineCap: function SVGGraphics_setLineCap(style) {
- this.current.lineCap = LINE_CAP_STYLES[style];
- },
- setLineJoin: function SVGGraphics_setLineJoin(style) {
- this.current.lineJoin = LINE_JOIN_STYLES[style];
- },
- setMiterLimit: function SVGGraphics_setMiterLimit(limit) {
- this.current.miterLimit = limit;
- },
- 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;
- },
+var ITERATOR = __w_pdfjs_require__(30)('iterator');
- 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;
+var BUGGY = !([].keys && 'next' in [].keys());
+var FF_ITERATOR = '@@iterator';
+var KEYS = 'keys';
+var VALUES = 'values';
- 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;
- }
- }
- 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);
- },
+var returnThis = function returnThis() {
+ return this;
+};
- 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));
- },
+module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
+ $iterCreate(Constructor, NAME, next);
- 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);
+ var getMethod = function getMethod(kind) {
+ if (!BUGGY && kind in proto) return proto[kind];
- // 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);
- },
+ switch (kind) {
+ case KEYS:
+ return function keys() {
+ return new Constructor(this, kind);
+ };
- closePath: function SVGGraphics_closePath() {
- var current = this.current;
- var d = current.path.getAttributeNS(null, 'd');
- d += 'Z';
- current.path.setAttributeNS(null, 'd', d);
- },
+ case VALUES:
+ return function values() {
+ return new Constructor(this, kind);
+ };
+ }
- setLeading: function SVGGraphics_setLeading(leading) {
- this.current.leading = -leading;
- },
+ return function entries() {
+ return new Constructor(this, kind);
+ };
+ };
- setTextRise: function SVGGraphics_setTextRise(textRise) {
- this.current.textRise = textRise;
- },
+ 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);
+ }
+ }
- setHScale: function SVGGraphics_setHScale(scale) {
- this.current.textHScale = scale / 100;
- },
+ if (DEF_VALUES && $native && $native.name !== VALUES) {
+ VALUES_BUG = true;
- 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];
+ $default = function values() {
+ return $native.call(this);
+ };
+ }
- 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':
- break;
- case 'FL':
- break;
- case 'Font':
- this.setFont(value);
- break;
- case 'CA':
- break;
- case 'ca':
- break;
- case 'BM':
- break;
- case 'SMask':
- break;
- }
- }
- },
+ if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
+ hide(proto, ITERATOR, $default);
+ }
- fill: function SVGGraphics_fill() {
- var current = this.current;
- current.element.setAttributeNS(null, 'fill', current.fillColor);
- },
+ Iterators[NAME] = $default;
+ Iterators[TAG] = returnThis;
- stroke: function SVGGraphics_stroke() {
- var current = this.current;
- current.element.setAttributeNS(null, 'stroke', current.strokeColor);
- current.element.setAttributeNS(null, 'fill', 'none');
- },
+ 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);
+ }
- eoFill: function SVGGraphics_eoFill() {
- var current = this.current;
- current.element.setAttributeNS(null, 'fill', current.fillColor);
- current.element.setAttributeNS(null, 'fill-rule', 'evenodd');
- },
+ return methods;
+};
- fillStroke: function SVGGraphics_fillStroke() {
- // Order is important since stroke wants fill to be none.
- // First stroke, then if fill needed, it will be overwritten.
- this.stroke();
- this.fill();
- },
+/***/ }),
+/* 50 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- eoFillStroke: function SVGGraphics_eoFillStroke() {
- this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd');
- this.fillStroke();
- },
+"use strict";
- closeStroke: function SVGGraphics_closeStroke() {
- this.closePath();
- this.stroke();
- },
- closeFillStroke: function SVGGraphics_closeFillStroke() {
- this.closePath();
- this.fillStroke();
- },
+module.exports = {};
- 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);
- },
+/***/ }),
+/* 51 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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);
- }
- },
+"use strict";
- paintImageXObject: function SVGGraphics_paintImageXObject(objId) {
- var imgData = this.objs.get(objId);
- if (!imgData) {
- warn('Dependent image isn\'t ready yet');
- return;
- }
- this.paintInlineImageXObject(imgData);
- },
- paintInlineImageXObject:
- function SVGGraphics_paintInlineImageXObject(imgData, mask) {
- var current = this.current;
- var width = imgData.width;
- var height = imgData.height;
+var create = __w_pdfjs_require__(52);
- 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);
- }
- if (current.pendingClip) {
- this.cgrp.appendChild(this.tgrp);
- this.pgrp.appendChild(this.cgrp);
- } else {
- this.pgrp.appendChild(this.tgrp);
- }
- },
+var descriptor = __w_pdfjs_require__(19);
- paintImageMaskXObject:
- function SVGGraphics_paintImageMaskXObject(imgData) {
- var current = this.current;
- var width = imgData.width;
- var height = imgData.height;
- var fillColor = current.fillColor;
+var setToStringTag = __w_pdfjs_require__(59);
- current.maskId = 'mask' + maskCount++;
- var mask = document.createElementNS(NS, 'svg:mask');
- mask.setAttributeNS(null, 'id', current.maskId);
+var IteratorPrototype = {};
- 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);
+__w_pdfjs_require__(10)(IteratorPrototype, __w_pdfjs_require__(30)('iterator'), function () {
+ return this;
+});
- this.paintInlineImageXObject(imgData, mask);
- },
+module.exports = function (Constructor, NAME, next) {
+ Constructor.prototype = create(IteratorPrototype, {
+ next: descriptor(1, next)
+ });
+ setToStringTag(Constructor, NAME + ' Iterator');
+};
- paintFormXObjectBegin:
- function SVGGraphics_paintFormXObjectBegin(matrix, bbox) {
- this.save();
+/***/ }),
+/* 52 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- if (isArray(matrix) && matrix.length === 6) {
- this.transform(matrix[0], matrix[1], matrix[2],
- matrix[3], matrix[4], matrix[5]);
- }
+"use strict";
- if (isArray(bbox) && bbox.length === 4) {
- 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.endPath();
- }
- },
+var anObject = __w_pdfjs_require__(12);
- paintFormXObjectEnd:
- function SVGGraphics_paintFormXObjectEnd() {
- this.restore();
- }
- };
- return SVGGraphics;
-})();
+var dPs = __w_pdfjs_require__(53);
-PDFJS.SVGGraphics = SVGGraphics;
+var enumBugKeys = __w_pdfjs_require__(57);
-exports.SVGGraphics = SVGGraphics;
-}));
+var IE_PROTO = __w_pdfjs_require__(56)('IE_PROTO');
+var Empty = function Empty() {};
-(function (root, factory) {
- {
- factory((root.pdfjsDisplayTextLayer = {}), root.pdfjsSharedUtil,
- root.pdfjsDisplayDOMUtils, root.pdfjsSharedGlobal);
- }
-}(this, function (exports, sharedUtil, displayDOMUtils, sharedGlobal) {
+var PROTOTYPE = 'prototype';
-var Util = sharedUtil.Util;
-var createPromiseCapability = sharedUtil.createPromiseCapability;
-var CustomStyle = displayDOMUtils.CustomStyle;
-var PDFJS = sharedGlobal.PDFJS;
+var _createDict = function createDict() {
+ var iframe = __w_pdfjs_require__(17)('iframe');
-/**
- * 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 i = enumBugKeys.length;
+ var lt = '<';
+ var gt = '>';
+ var iframeDocument;
+ iframe.style.display = 'none';
- var NonWhitespaceRegexp = /\S/;
+ __w_pdfjs_require__(58).appendChild(iframe);
- function isAllWhitespace(str) {
- return !NonWhitespaceRegexp.test(str);
+ 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]];
}
- 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;
- }
+ return _createDict();
+};
- 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;
+module.exports = Object.create || function create(O, Properties) {
+ var result;
- 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;
- } else {
- textDiv.dataset.canvasWidth = geom.width * viewport.scale;
- }
- }
- }
+ if (O !== null) {
+ Empty[PROTOTYPE] = anObject(O);
+ result = new Empty();
+ Empty[PROTOTYPE] = null;
+ result[IE_PROTO] = O;
+ } else result = _createDict();
- function render(task) {
- if (task._canceled) {
- return;
- }
- var textLayerFrag = task._container;
- var textDivs = task._textDivs;
- var capability = task._capability;
- var textDivsLength = textDivs.length;
+ return Properties === undefined ? result : dPs(result, Properties);
+};
- // 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;
- }
+/***/ }),
+/* 53 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- var canvas = document.createElement('canvas');
- canvas.mozOpaque = true;
- var ctx = canvas.getContext('2d', {alpha: false});
+"use strict";
- var lastFontSize;
- var lastFontFamily;
- for (var i = 0; i < textDivsLength; i++) {
- var textDiv = textDivs[i];
- if (textDiv.dataset.isWhitespace !== undefined) {
- continue;
- }
- var fontSize = textDiv.style.fontSize;
- var fontFamily = textDiv.style.fontFamily;
+var dP = __w_pdfjs_require__(11);
- // 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;
- }
-
- 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 + ')';
- } else {
- transform = '';
- }
- var rotation = textDiv.dataset.angle;
- if (rotation) {
- transform = 'rotate(' + rotation + 'deg) ' + transform;
- }
- if (transform) {
- CustomStyle.setProp('transform' , textDiv, transform);
- }
- }
- }
- capability.resolve();
- }
+var anObject = __w_pdfjs_require__(12);
- /**
- * 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;
+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]);
}
- TextLayerRenderTask.prototype = {
- get promise() {
- return this._capability.promise;
- },
- cancel: function TextLayer_cancel() {
- this._canceled = true;
- if (this._renderTimer !== null) {
- clearTimeout(this._renderTimer);
- this._renderTimer = null;
- }
- this._capability.reject('canceled');
- },
+ return O;
+};
- _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);
- }
+/***/ }),
+/* 54 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- if (!timeout) { // Render right away
- render(this);
- } else { // Schedule
- var self = this;
- this._renderTimer = setTimeout(function() {
- render(self);
- self._renderTimer = null;
- }, timeout);
- }
- }
- };
+"use strict";
- /**
- * 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;
- }
+var $keys = __w_pdfjs_require__(55);
- return renderTextLayer;
-})();
+var enumBugKeys = __w_pdfjs_require__(57);
-PDFJS.renderTextLayer = renderTextLayer;
+module.exports = Object.keys || function keys(O) {
+ return $keys(O, enumBugKeys);
+};
-exports.renderTextLayer = renderTextLayer;
-}));
+/***/ }),
+/* 55 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+"use strict";
-(function (root, factory) {
- {
- factory((root.pdfjsDisplayWebGL = {}), root.pdfjsSharedUtil);
- }
-}(this, function (exports, sharedUtil) {
-var shadow = sharedUtil.shadow;
+var has = __w_pdfjs_require__(21);
-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);
+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);
}
- 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);
+
+ while (names.length > i) {
+ if (has(O, key = names[i++])) {
+ ~arrayIndexOf(result, key) || result.push(key);
}
- 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);
+ return result;
+};
- // Upload the image into the texture.
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
- return texture;
- }
+/***/ }),
+/* 56 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- var currentGL, currentCanvas;
- function generateGL() {
- if (currentGL) {
- return;
- }
- currentCanvas = document.createElement('canvas');
- currentGL = currentCanvas.getContext('webgl',
- { premultipliedalpha: false });
- }
+"use strict";
- var smaskVertexShaderCode = '\
- attribute vec2 a_position; \
- attribute vec2 a_texCoord; \
- \
- uniform vec2 u_resolution; \
- \
- varying vec2 v_texCoord; \
- \
- void main() { \
- vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \
- gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \
- \
- v_texCoord = a_texCoord; \
- } ';
- var smaskFragmentShaderCode = '\
- precision mediump float; \
- \
- uniform vec4 u_backdrop; \
- uniform int u_subtype; \
- uniform sampler2D u_image; \
- uniform sampler2D u_mask; \
- \
- varying vec2 v_texCoord; \
- \
- void main() { \
- vec4 imageColor = texture2D(u_image, v_texCoord); \
- vec4 maskColor = texture2D(u_mask, v_texCoord); \
- if (u_backdrop.a > 0.0) { \
- maskColor.rgb = maskColor.rgb * maskColor.a + \
- u_backdrop.rgb * (1.0 - maskColor.a); \
- } \
- float lum; \
- if (u_subtype == 0) { \
- lum = maskColor.a; \
- } else { \
- lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \
- maskColor.b * 0.11; \
- } \
- imageColor.a *= lum; \
- imageColor.rgb *= imageColor.a; \
- gl_FragColor = imageColor; \
- } ';
+var shared = __w_pdfjs_require__(31)('keys');
- var smaskCache = null;
+var uid = __w_pdfjs_require__(22);
- function initSmaskGL() {
- var canvas, gl;
+module.exports = function (key) {
+ return shared[key] || (shared[key] = uid(key));
+};
- generateGL();
- canvas = currentCanvas;
- currentCanvas = null;
- gl = currentGL;
- currentGL = null;
+/***/ }),
+/* 57 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- // setup a GLSL program
- var vertexShader = createVertexShader(gl, smaskVertexShaderCode);
- var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode);
- var program = createProgram(gl, [vertexShader, fragmentShader]);
- gl.useProgram(program);
+"use strict";
- var cache = {};
- cache.gl = gl;
- cache.canvas = canvas;
- cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution');
- cache.positionLocation = gl.getAttribLocation(program, 'a_position');
- cache.backdropLocation = gl.getUniformLocation(program, 'u_backdrop');
- cache.subtypeLocation = gl.getUniformLocation(program, 'u_subtype');
- var texCoordLocation = gl.getAttribLocation(program, 'a_texCoord');
- var texLayerLocation = gl.getUniformLocation(program, 'u_image');
- var texMaskLocation = gl.getUniformLocation(program, 'u_mask');
+module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(',');
- // 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.enableVertexAttribArray(texCoordLocation);
- gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0);
+/***/ }),
+/* 58 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- gl.uniform1i(texLayerLocation, 0);
- gl.uniform1i(texMaskLocation, 1);
+"use strict";
- smaskCache = cache;
- }
- function composeSMask(layer, mask, properties) {
- var width = layer.width, height = layer.height;
+var document = __w_pdfjs_require__(8).document;
- if (!smaskCache) {
- initSmaskGL();
- }
- var cache = smaskCache,canvas = cache.canvas, gl = cache.gl;
- canvas.width = width;
- canvas.height = height;
- gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
- gl.uniform2f(cache.resolutionLocation, width, height);
+module.exports = document && document.documentElement;
- if (properties.backdrop) {
- gl.uniform4f(cache.resolutionLocation, properties.backdrop[0],
- properties.backdrop[1], properties.backdrop[2], 1);
- } else {
- gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0);
- }
- gl.uniform1i(cache.subtypeLocation,
- properties.subtype === 'Luminosity' ? 1 : 0);
+/***/ }),
+/* 59 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- // Create a textures
- var texture = createTexture(gl, layer, gl.TEXTURE0);
- var maskTexture = createTexture(gl, mask, gl.TEXTURE1);
+"use strict";
- // 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.enableVertexAttribArray(cache.positionLocation);
- gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0);
+var def = __w_pdfjs_require__(11).f;
- // 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);
+var has = __w_pdfjs_require__(21);
- gl.drawArrays(gl.TRIANGLES, 0, 6);
+var TAG = __w_pdfjs_require__(30)('toStringTag');
- gl.flush();
+module.exports = function (it, tag, stat) {
+ if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, {
+ configurable: true,
+ value: tag
+ });
+};
- gl.deleteTexture(texture);
- gl.deleteTexture(maskTexture);
- gl.deleteBuffer(buffer);
+/***/ }),
+/* 60 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- return canvas;
+"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;
}
- var figuresVertexShaderCode = '\
- attribute vec2 a_position; \
- attribute vec3 a_color; \
- \
- uniform vec2 u_resolution; \
- uniform vec2 u_scale; \
- uniform vec2 u_offset; \
- \
- varying vec4 v_color; \
- \
- void main() { \
- vec2 position = (a_position + u_offset) * u_scale; \
- vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \
- gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \
- \
- v_color = vec4(a_color / 255.0, 1.0); \
- } ';
+ return O instanceof Object ? ObjectProto : null;
+};
- var figuresFragmentShaderCode = '\
- precision mediump float; \
- \
- varying vec4 v_color; \
- \
- void main() { \
- gl_FragColor = v_color; \
- } ';
+/***/ }),
+/* 61 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- var figuresCache = null;
+"use strict";
- function initFiguresGL() {
- var canvas, gl;
- generateGL();
- canvas = currentCanvas;
- currentCanvas = null;
- gl = currentGL;
- currentGL = null;
+var defined = __w_pdfjs_require__(33);
- // setup a GLSL program
- var vertexShader = createVertexShader(gl, figuresVertexShaderCode);
- var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode);
- var program = createProgram(gl, [vertexShader, fragmentShader]);
- gl.useProgram(program);
+module.exports = function (it) {
+ return Object(defined(it));
+};
- var cache = {};
- cache.gl = gl;
- cache.canvas = canvas;
- cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution');
- cache.scaleLocation = gl.getUniformLocation(program, 'u_scale');
- cache.offsetLocation = gl.getUniformLocation(program, 'u_offset');
- cache.positionLocation = gl.getAttribLocation(program, 'a_position');
- cache.colorLocation = gl.getAttribLocation(program, 'a_color');
+/***/ }),
+/* 62 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- figuresCache = cache;
- }
+"use strict";
- function drawFigures(width, height, backgroundColor, figures, context) {
- if (!figuresCache) {
- initFiguresGL();
- }
- var cache = figuresCache, canvas = cache.canvas, gl = cache.gl;
- canvas.width = width;
- canvas.height = height;
- gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
- gl.uniform2f(cache.resolutionLocation, width, height);
+var ctx = __w_pdfjs_require__(23);
- // 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;
- count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6;
- break;
- case 'triangles':
- count += figures[i].coords.length;
- break;
+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);
}
- }
- // 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;
- for (i = 0, ii = figures.length; i < ii; i++) {
- var figure = figures[i], ps = figure.coords, cs = figure.colors;
- switch (figure.type) {
- case 'lattice':
- var cols = figure.verticesPerRow;
- rows = (ps.length / cols) | 0;
- for (var row = 1; row < rows; row++) {
- var offset = row * cols + 1;
- for (var col = 1; col < cols; col++, offset++) {
- coords[pIndex] = coordsMap[ps[offset - cols - 1]];
- coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1];
- coords[pIndex + 2] = coordsMap[ps[offset - cols]];
- coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1];
- coords[pIndex + 4] = coordsMap[ps[offset - 1]];
- coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1];
- colors[cIndex] = colorsMap[cs[offset - cols - 1]];
- colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1];
- colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2];
- colors[cIndex + 3] = colorsMap[cs[offset - cols]];
- colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1];
- colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2];
- colors[cIndex + 6] = colorsMap[cs[offset - 1]];
- colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1];
- colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2];
+ } else {
+ length = toLength(O.length);
- coords[pIndex + 6] = coords[pIndex + 2];
- coords[pIndex + 7] = coords[pIndex + 3];
- coords[pIndex + 8] = coords[pIndex + 4];
- coords[pIndex + 9] = coords[pIndex + 5];
- coords[pIndex + 10] = coordsMap[ps[offset]];
- coords[pIndex + 11] = coordsMap[ps[offset] + 1];
- colors[cIndex + 9] = colors[cIndex + 3];
- colors[cIndex + 10] = colors[cIndex + 4];
- colors[cIndex + 11] = colors[cIndex + 5];
- colors[cIndex + 12] = colors[cIndex + 6];
- colors[cIndex + 13] = colors[cIndex + 7];
- colors[cIndex + 14] = colors[cIndex + 8];
- colors[cIndex + 15] = colorsMap[cs[offset]];
- colors[cIndex + 16] = colorsMap[cs[offset] + 1];
- colors[cIndex + 17] = colorsMap[cs[offset] + 2];
- pIndex += 12;
- cIndex += 18;
- }
- }
- break;
- case 'triangles':
- for (var j = 0, jj = ps.length; j < jj; j++) {
- coords[pIndex] = coordsMap[ps[j]];
- coords[pIndex + 1] = coordsMap[ps[j] + 1];
- colors[cIndex] = colorsMap[cs[j]];
- colors[cIndex + 1] = colorsMap[cs[j] + 1];
- colors[cIndex + 2] = colorsMap[cs[j] + 2];
- pIndex += 2;
- cIndex += 3;
- }
- break;
+ for (result = new C(length); length > index; index++) {
+ createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
}
}
- // draw
- if (backgroundColor) {
- gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255,
- backgroundColor[2] / 255, 1.0);
- } else {
- gl.clearColor(0, 0, 0, 0);
- }
- gl.clear(gl.COLOR_BUFFER_BIT);
-
- var coordsBuffer = gl.createBuffer();
- gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW);
- gl.enableVertexAttribArray(cache.positionLocation);
- gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0);
-
- var colorsBuffer = gl.createBuffer();
- gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW);
- gl.enableVertexAttribArray(cache.colorLocation);
- gl.vertexAttribPointer(cache.colorLocation, 3, gl.UNSIGNED_BYTE, false,
- 0, 0);
+ result.length = index;
+ return result;
+ }
+});
- gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY);
- gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY);
+/***/ }),
+/* 63 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- gl.drawArrays(gl.TRIANGLES, 0, count);
+"use strict";
- gl.flush();
- gl.deleteBuffer(coordsBuffer);
- gl.deleteBuffer(colorsBuffer);
+var anObject = __w_pdfjs_require__(12);
- return canvas;
+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;
}
+};
- 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;
- }
+/***/ }),
+/* 64 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- return {
- get isEnabled() {
- if (PDFJS.disableWebGL) {
- return false;
- }
- var enabled = false;
- try {
- generateGL();
- enabled = !!currentGL;
- } catch (e) { }
- return shadow(this, 'isEnabled', enabled);
- },
- composeSMask: composeSMask,
- drawFigures: drawFigures,
- clear: cleanup
- };
-})();
+"use strict";
-exports.WebGLUtils = WebGLUtils;
-}));
+var Iterators = __w_pdfjs_require__(50);
-(function (root, factory) {
- {
- factory((root.pdfjsDisplayPatternHelper = {}), root.pdfjsSharedUtil,
- root.pdfjsDisplayWebGL);
- }
-}(this, function (exports, sharedUtil, displayWebGL) {
+var ITERATOR = __w_pdfjs_require__(30)('iterator');
-var Util = sharedUtil.Util;
-var info = sharedUtil.info;
-var isArray = sharedUtil.isArray;
-var error = sharedUtil.error;
-var WebGLUtils = displayWebGL.WebGLUtils;
+var ArrayProto = Array.prototype;
-var ShadingIRs = {};
+module.exports = function (it) {
+ return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
+};
-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);
- }
+/***/ }),
+/* 65 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- for (var i = 0, ii = colorStops.length; i < ii; ++i) {
- var c = colorStops[i];
- grad.addColorStop(c[0], c[1]);
- }
- return grad;
- }
- };
- }
-};
+"use strict";
-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 (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;
- }
- }
- }
+var $defineProperty = __w_pdfjs_require__(11);
- 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;
- }
- }
+var createDesc = __w_pdfjs_require__(19);
- 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
+module.exports = function (object, index, value) {
+ if (index in object) $defineProperty.f(object, index, createDesc(0, value));else object[index] = value;
+};
- 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;
+/***/ }),
+/* 66 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- 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;
+"use strict";
- 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);
+var classof = __w_pdfjs_require__(67);
- // 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 ITERATOR = __w_pdfjs_require__(30)('iterator');
- 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;
- }
+var Iterators = __w_pdfjs_require__(50);
- return {canvas: canvas, offsetX: offsetX, offsetY: offsetY,
- scaleX: scaleX, scaleY: scaleY};
- }
- return createMeshCanvas;
-})();
+module.exports = __w_pdfjs_require__(9).getIteratorMethod = function (it) {
+ if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
+};
-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]];
- }
- }
+/***/ }),
+/* 67 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+"use strict";
- // 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);
- }
- }
+var cof = __w_pdfjs_require__(29);
- ctx.translate(temporaryPatternCanvas.offsetX,
- temporaryPatternCanvas.offsetY);
- ctx.scale(temporaryPatternCanvas.scaleX,
- temporaryPatternCanvas.scaleY);
+var TAG = __w_pdfjs_require__(30)('toStringTag');
- return ctx.createPattern(temporaryPatternCanvas.canvas, 'no-repeat');
- }
- };
- }
+var ARG = cof(function () {
+ return arguments;
+}()) == 'Arguments';
+
+var tryGet = function tryGet(it, key) {
+ try {
+ return it[key];
+ } catch (e) {}
};
-ShadingIRs.Dummy = {
- fromIR: function Dummy_fromIR() {
- return {
- type: 'Pattern',
- getPattern: function Dummy_fromIR_getPattern() {
- return 'hotpink';
- }
- };
- }
+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;
};
-function getShadingPatternFromIR(raw) {
- var shadingIR = ShadingIRs[raw[0]];
- if (!shadingIR) {
- error('Unknown IR type: ' + raw[0]);
- }
- return shadingIR.fromIR(raw);
-}
+/***/ }),
+/* 68 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
-var TilingPattern = (function TilingPatternClosure() {
- var PaintType = {
- COLORED: 1,
- UNCOLORED: 2
- };
+"use strict";
- 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;
- }
+var ITERATOR = __w_pdfjs_require__(30)('iterator');
- 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;
+var SAFE_CLOSING = false;
- info('TilingType: ' + tilingType);
+try {
+ var riter = [7][ITERATOR]();
- var x0 = bbox[0], y0 = bbox[1], x1 = bbox[2], y1 = bbox[3];
+ riter['return'] = function () {
+ SAFE_CLOSING = true;
+ };
- var topLeft = [x0, y0];
- // we want the canvas to be as large as the step size
- var botRight = [x0 + xstep, y0 + ystep];
+ Array.from(riter, function () {
+ throw 2;
+ });
+} catch (e) {}
- var width = botRight[0] - topLeft[0];
- var height = botRight[1] - topLeft[1];
+module.exports = function (exec, skipClosing) {
+ if (!skipClosing && !SAFE_CLOSING) return false;
+ var safe = false;
- // 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;
+ try {
+ var arr = [7];
+ var iter = arr[ITERATOR]();
- this.setFillAndStrokeStyleToContext(tmpCtx, paintType, color);
+ iter.next = function () {
+ return {
+ done: safe = true
+ };
+ };
- this.setScale(width, height, xstep, ystep);
- this.transformToScale(graphics);
+ arr[ITERATOR] = function () {
+ return iter;
+ };
- // transform coordinates to pattern space
- var tmpTranslate = [1, 0, 0, 1, -topLeft[0], -topLeft[1]];
- graphics.transform.apply(graphics, tmpTranslate);
+ exec(arr);
+ } catch (e) {}
- this.clipBbox(graphics, bbox, x0, y0, x1, y1);
+ return safe;
+};
- graphics.executeOperatorList(operatorList);
- return tmpCanvas.canvas;
- },
+/***/ }),
+/* 69 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- setScale: function TilingPattern_setScale(width, height, xstep, ystep) {
- this.scale = [width / xstep, height / ystep];
- },
+"use strict";
- 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]);
- },
+__w_pdfjs_require__(70);
- 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();
- }
- },
+module.exports = __w_pdfjs_require__(9).Object.assign;
- 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);
- }
- },
+/***/ }),
+/* 70 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
- getPattern: function TilingPattern_getPattern(ctx, owner) {
- var temporaryPatternCanvas = this.createPatternCanvas(owner);
+"use strict";
- ctx = this.ctx;
- ctx.setTransform.apply(ctx, this.baseTransform);
- ctx.transform.apply(ctx, this.matrix);
- this.scaleToContext();
- return ctx.createPattern(temporaryPatternCanvas, 'repeat');
- }
- };
+var $export = __w_pdfjs_require__(7);
- return TilingPattern;
-})();
+$export($export.S + $export.F, 'Object', {
+ assign: __w_pdfjs_require__(71)
+});
-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;
-
-//