Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_pdfviewer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'js/pdfjs/build/pdf.worker.js')
-rw-r--r--js/pdfjs/build/pdf.worker.js27896
1 files changed, 20082 insertions, 7814 deletions
diff --git a/js/pdfjs/build/pdf.worker.js b/js/pdfjs/build/pdf.worker.js
index af4e466..8f19e78 100644
--- a/js/pdfjs/build/pdf.worker.js
+++ b/js/pdfjs/build/pdf.worker.js
@@ -128,15 +128,15 @@ Object.defineProperty(exports, "__esModule", {
});
Object.defineProperty(exports, "WorkerMessageHandler", {
enumerable: true,
- get: function () {
+ get: function get() {
return _worker.WorkerMessageHandler;
}
});
var _worker = __w_pdfjs_require__(1);
-const pdfjsVersion = '2.5.207';
-const pdfjsBuild = '0974d6052';
+var pdfjsVersion = '2.5.207';
+var pdfjsBuild = '0974d6052';
/***/ }),
/* 1 */
@@ -150,19 +150,39 @@ Object.defineProperty(exports, "__esModule", {
});
exports.WorkerMessageHandler = exports.WorkerTask = void 0;
-var _util = __w_pdfjs_require__(2);
+var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
+
+var _util = __w_pdfjs_require__(5);
+
+var _primitives = __w_pdfjs_require__(198);
+
+var _pdf_manager = __w_pdfjs_require__(199);
+
+var _is_node = __w_pdfjs_require__(7);
+
+var _message_handler = __w_pdfjs_require__(238);
+
+var _worker_stream = __w_pdfjs_require__(239);
-var _primitives = __w_pdfjs_require__(5);
+var _core_utils = __w_pdfjs_require__(201);
-var _pdf_manager = __w_pdfjs_require__(6);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
-var _is_node = __w_pdfjs_require__(4);
+function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
-var _message_handler = __w_pdfjs_require__(45);
+function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
-var _worker_stream = __w_pdfjs_require__(46);
+function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
-var _core_utils = __w_pdfjs_require__(8);
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
+
+function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
+
+function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
+
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
var WorkerTask = function WorkerTaskClosure() {
function WorkerTask(name) {
@@ -176,27 +196,24 @@ var WorkerTask = function WorkerTaskClosure() {
return this._capability.promise;
},
- finish() {
+ finish: function finish() {
this._capability.resolve();
},
-
- terminate() {
+ terminate: function terminate() {
this.terminated = true;
},
-
- ensureNotTerminated() {
+ ensureNotTerminated: function ensureNotTerminated() {
if (this.terminated) {
throw new Error("Worker task was terminated");
}
}
-
};
return WorkerTask;
}();
exports.WorkerTask = WorkerTask;
var WorkerMessageHandler = {
- setup(handler, port) {
+ setup: function setup(handler, port) {
var testMessageProcessed = false;
handler.on("test", function wphSetupTest(data) {
if (testMessageProcessed) {
@@ -210,10 +227,10 @@ var WorkerMessageHandler = {
return;
}
- const supportTransfers = data[0] === 255;
+ var supportTransfers = data[0] === 255;
handler.postMessageTransfers = supportTransfers;
handler.send("test", {
- supportTransfers
+ supportTransfers: supportTransfers
});
});
handler.on("configure", function wphConfigure(data) {
@@ -223,23 +240,22 @@ var WorkerMessageHandler = {
return WorkerMessageHandler.createDocumentHandler(data, port);
});
},
-
- createDocumentHandler(docParams, port) {
+ createDocumentHandler: function createDocumentHandler(docParams, port) {
var pdfManager;
var terminated = false;
var cancelXHRs = null;
var WorkerTasks = [];
- const verbosity = (0, _util.getVerbosityLevel)();
- const apiVersion = docParams.apiVersion;
- const workerVersion = '2.5.207';
+ var verbosity = (0, _util.getVerbosityLevel)();
+ var apiVersion = docParams.apiVersion;
+ var workerVersion = '2.5.207';
if (apiVersion !== workerVersion) {
- throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
+ throw new Error("The API version \"".concat(apiVersion, "\" does not match ") + "the Worker version \"".concat(workerVersion, "\"."));
}
- const enumerableProperties = [];
+ var enumerableProperties = [];
- for (const property in []) {
+ for (var property in []) {
enumerableProperties.push(property);
}
@@ -247,10 +263,6 @@ var WorkerMessageHandler = {
throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
}
- if (typeof ReadableStream === "undefined" || typeof Promise.allSettled === "undefined") {
- throw new Error("The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. " + "`ReadableStream` and/or `Promise.allSettled`); " + "please use an ES5-compatible build instead.");
- }
-
var docId = docParams.docId;
var docBaseUrl = docParams.docBaseUrl;
var workerHandlerName = docParams.docId + "_worker";
@@ -273,25 +285,65 @@ var WorkerMessageHandler = {
WorkerTasks.splice(i, 1);
}
- async function loadDocument(recoveryMode) {
- await pdfManager.ensureDoc("checkHeader");
- await pdfManager.ensureDoc("parseStartXRef");
- await pdfManager.ensureDoc("parse", [recoveryMode]);
+ function loadDocument(_x) {
+ return _loadDocument.apply(this, arguments);
+ }
- if (!recoveryMode) {
- await pdfManager.ensureDoc("checkFirstPage");
- }
+ function _loadDocument() {
+ _loadDocument = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(recoveryMode) {
+ var _yield$Promise$all, _yield$Promise$all2, numPages, fingerprint;
- const [numPages, fingerprint] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprint")]);
- return {
- numPages,
- fingerprint
- };
+ return _regenerator["default"].wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ _context.next = 2;
+ return pdfManager.ensureDoc("checkHeader");
+
+ case 2:
+ _context.next = 4;
+ return pdfManager.ensureDoc("parseStartXRef");
+
+ case 4:
+ _context.next = 6;
+ return pdfManager.ensureDoc("parse", [recoveryMode]);
+
+ case 6:
+ if (recoveryMode) {
+ _context.next = 9;
+ break;
+ }
+
+ _context.next = 9;
+ return pdfManager.ensureDoc("checkFirstPage");
+
+ case 9:
+ _context.next = 11;
+ return Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprint")]);
+
+ case 11:
+ _yield$Promise$all = _context.sent;
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
+ numPages = _yield$Promise$all2[0];
+ fingerprint = _yield$Promise$all2[1];
+ return _context.abrupt("return", {
+ numPages: numPages,
+ fingerprint: fingerprint
+ });
+
+ case 16:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee);
+ }));
+ return _loadDocument.apply(this, arguments);
}
function getPdfManager(data, evaluatorOptions) {
var pdfManagerCapability = (0, _util.createPromiseCapability)();
- let newPdfManager;
+ var newPdfManager;
var source = data.source;
if (source.data) {
@@ -326,24 +378,24 @@ var WorkerMessageHandler = {
msgHandler: handler,
password: source.password,
length: fullRequest.contentLength,
- disableAutoFetch,
+ disableAutoFetch: disableAutoFetch,
rangeChunkSize: source.rangeChunkSize
}, evaluatorOptions, docBaseUrl);
- for (let i = 0; i < cachedChunks.length; i++) {
+ for (var i = 0; i < cachedChunks.length; i++) {
newPdfManager.sendProgressiveData(cachedChunks[i]);
}
cachedChunks = [];
pdfManagerCapability.resolve(newPdfManager);
cancelXHRs = null;
- }).catch(function (reason) {
+ })["catch"](function (reason) {
pdfManagerCapability.reject(reason);
cancelXHRs = null;
});
var loaded = 0;
- var flushChunks = function () {
+ var flushChunks = function flushChunks() {
var pdfFile = (0, _util.arraysToBytes)(cachedChunks);
if (source.length && pdfFile.length !== source.length) {
@@ -361,10 +413,10 @@ var WorkerMessageHandler = {
};
var readPromise = new Promise(function (resolve, reject) {
- var readChunk = function ({
- value,
- done
- }) {
+ var readChunk = function readChunk(_ref) {
+ var value = _ref.value,
+ done = _ref.done;
+
try {
ensureNotTerminated();
@@ -381,7 +433,7 @@ var WorkerMessageHandler = {
if (!fullRequest.isStreamingSupported) {
handler.send("DocProgress", {
- loaded,
+ loaded: loaded,
total: Math.max(loaded, fullRequest.contentLength || 0)
});
}
@@ -400,12 +452,12 @@ var WorkerMessageHandler = {
fullRequest.read().then(readChunk, reject);
});
- readPromise.catch(function (e) {
+ readPromise["catch"](function (e) {
pdfManagerCapability.reject(e);
cancelXHRs = null;
});
- cancelXHRs = function (reason) {
+ cancelXHRs = function cancelXHRs(reason) {
pdfStream.cancelAllRequests(reason);
};
@@ -424,15 +476,14 @@ var WorkerMessageHandler = {
ensureNotTerminated();
if (ex instanceof _util.PasswordException) {
- var task = new WorkerTask(`PasswordException: response ${ex.code}`);
+ var task = new WorkerTask("PasswordException: response ".concat(ex.code));
startWorkerTask(task);
- handler.sendWithPromise("PasswordRequest", ex).then(function ({
- password
- }) {
+ handler.sendWithPromise("PasswordRequest", ex).then(function (_ref2) {
+ var password = _ref2.password;
finishWorkerTask(task);
pdfManager.updatePassword(password);
pdfManagerReady();
- }).catch(function () {
+ })["catch"](function () {
finishWorkerTask(task);
handler.send("DocException", ex);
});
@@ -486,12 +537,18 @@ var WorkerMessageHandler = {
handler.on("GetPage", function wphSetupGetPage(data) {
return pdfManager.getPage(data.pageIndex).then(function (page) {
- return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
+ return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function (_ref3) {
+ var _ref4 = _slicedToArray(_ref3, 4),
+ rotate = _ref4[0],
+ ref = _ref4[1],
+ userUnit = _ref4[2],
+ view = _ref4[3];
+
return {
- rotate,
- ref,
- userUnit,
- view
+ rotate: rotate,
+ ref: ref,
+ userUnit: userUnit,
+ view: view
};
});
});
@@ -547,10 +604,9 @@ var WorkerMessageHandler = {
handler.on("GetStats", function wphSetupGetStats(data) {
return pdfManager.pdfDocument.xref.stats;
});
- handler.on("GetAnnotations", function ({
- pageIndex,
- intent
- }) {
+ handler.on("GetAnnotations", function (_ref5) {
+ var pageIndex = _ref5.pageIndex,
+ intent = _ref5.intent;
return pdfManager.getPage(pageIndex).then(function (page) {
return page.getAnnotationsData(intent);
});
@@ -558,20 +614,20 @@ var WorkerMessageHandler = {
handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
var pageIndex = data.pageIndex;
pdfManager.getPage(pageIndex).then(function (page) {
- var task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
+ var task = new WorkerTask("GetOperatorList: page ".concat(pageIndex));
startWorkerTask(task);
- const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
+ var start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
page.getOperatorList({
- handler,
- sink,
- task,
+ handler: handler,
+ sink: sink,
+ task: task,
intent: data.intent,
renderInteractiveForms: data.renderInteractiveForms
}).then(function (operatorListInfo) {
finishWorkerTask(task);
if (start) {
- (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
+ (0, _util.info)("page=".concat(pageIndex + 1, " - getOperatorList: time=") + "".concat(Date.now() - start, "ms, len=").concat(operatorListInfo.length));
}
sink.close();
@@ -599,18 +655,18 @@ var WorkerMessageHandler = {
pdfManager.getPage(pageIndex).then(function (page) {
var task = new WorkerTask("GetTextContent: page " + pageIndex);
startWorkerTask(task);
- const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
+ var start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
page.extractTextContent({
- handler,
- task,
- sink,
+ handler: handler,
+ task: task,
+ sink: sink,
normalizeWhitespace: data.normalizeWhitespace,
combineTextItems: data.combineTextItems
}).then(function () {
finishWorkerTask(task);
if (start) {
- (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
+ (0, _util.info)("page=".concat(pageIndex + 1, " - getTextContent: time=") + "".concat(Date.now() - start, "ms"));
}
sink.close();
@@ -633,11 +689,11 @@ var WorkerMessageHandler = {
});
handler.on("Terminate", function wphTerminate(data) {
terminated = true;
- const waitOn = [];
+ var waitOn = [];
if (pdfManager) {
pdfManager.terminate(new _util.AbortException("Worker was terminated."));
- const cleanupPromise = pdfManager.cleanup();
+ var cleanupPromise = pdfManager.cleanup();
waitOn.push(cleanupPromise);
pdfManager = null;
} else {
@@ -663,13 +719,11 @@ var WorkerMessageHandler = {
});
return workerHandlerName;
},
-
- initializeFromPort(port) {
+ initializeFromPort: function initializeFromPort(port) {
var handler = new _message_handler.MessageHandler("worker", "main", port);
WorkerMessageHandler.setup(handler, port);
handler.send("ready", null);
}
-
};
exports.WorkerMessageHandler = WorkerMessageHandler;
@@ -688,6 +742,628 @@ if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "unde
"use strict";
+module.exports = __w_pdfjs_require__(3);
+
+/***/ }),
+/* 3 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(module) {
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+var runtime = function (exports) {
+ "use strict";
+
+ var Op = Object.prototype;
+ var hasOwn = Op.hasOwnProperty;
+ var undefined;
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
+
+ function wrap(innerFn, outerFn, self, tryLocsList) {
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
+ var generator = Object.create(protoGenerator.prototype);
+ var context = new Context(tryLocsList || []);
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
+ return generator;
+ }
+
+ exports.wrap = wrap;
+
+ function tryCatch(fn, obj, arg) {
+ try {
+ return {
+ type: "normal",
+ arg: fn.call(obj, arg)
+ };
+ } catch (err) {
+ return {
+ type: "throw",
+ arg: err
+ };
+ }
+ }
+
+ var GenStateSuspendedStart = "suspendedStart";
+ var GenStateSuspendedYield = "suspendedYield";
+ var GenStateExecuting = "executing";
+ var GenStateCompleted = "completed";
+ var ContinueSentinel = {};
+
+ function Generator() {}
+
+ function GeneratorFunction() {}
+
+ function GeneratorFunctionPrototype() {}
+
+ var IteratorPrototype = {};
+
+ IteratorPrototype[iteratorSymbol] = function () {
+ return this;
+ };
+
+ var getProto = Object.getPrototypeOf;
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
+
+ if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
+ IteratorPrototype = NativeIteratorPrototype;
+ }
+
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
+ GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";
+
+ function defineIteratorMethods(prototype) {
+ ["next", "throw", "return"].forEach(function (method) {
+ prototype[method] = function (arg) {
+ return this._invoke(method, arg);
+ };
+ });
+ }
+
+ exports.isGeneratorFunction = function (genFun) {
+ var ctor = typeof genFun === "function" && genFun.constructor;
+ return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
+ };
+
+ exports.mark = function (genFun) {
+ if (Object.setPrototypeOf) {
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
+ } else {
+ genFun.__proto__ = GeneratorFunctionPrototype;
+
+ if (!(toStringTagSymbol in genFun)) {
+ genFun[toStringTagSymbol] = "GeneratorFunction";
+ }
+ }
+
+ genFun.prototype = Object.create(Gp);
+ return genFun;
+ };
+
+ exports.awrap = function (arg) {
+ return {
+ __await: arg
+ };
+ };
+
+ function AsyncIterator(generator, PromiseImpl) {
+ function invoke(method, arg, resolve, reject) {
+ var record = tryCatch(generator[method], generator, arg);
+
+ if (record.type === "throw") {
+ reject(record.arg);
+ } else {
+ var result = record.arg;
+ var value = result.value;
+
+ if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
+ return PromiseImpl.resolve(value.__await).then(function (value) {
+ invoke("next", value, resolve, reject);
+ }, function (err) {
+ invoke("throw", err, resolve, reject);
+ });
+ }
+
+ return PromiseImpl.resolve(value).then(function (unwrapped) {
+ result.value = unwrapped;
+ resolve(result);
+ }, function (error) {
+ return invoke("throw", error, resolve, reject);
+ });
+ }
+ }
+
+ var previousPromise;
+
+ function enqueue(method, arg) {
+ function callInvokeWithMethodAndArg() {
+ return new PromiseImpl(function (resolve, reject) {
+ invoke(method, arg, resolve, reject);
+ });
+ }
+
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
+ }
+
+ this._invoke = enqueue;
+ }
+
+ defineIteratorMethods(AsyncIterator.prototype);
+
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
+ return this;
+ };
+
+ exports.AsyncIterator = AsyncIterator;
+
+ exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
+ return result.done ? result.value : iter.next();
+ });
+ };
+
+ function makeInvokeMethod(innerFn, self, context) {
+ var state = GenStateSuspendedStart;
+ return function invoke(method, arg) {
+ if (state === GenStateExecuting) {
+ throw new Error("Generator is already running");
+ }
+
+ if (state === GenStateCompleted) {
+ if (method === "throw") {
+ throw arg;
+ }
+
+ return doneResult();
+ }
+
+ context.method = method;
+ context.arg = arg;
+
+ while (true) {
+ var delegate = context.delegate;
+
+ if (delegate) {
+ var delegateResult = maybeInvokeDelegate(delegate, context);
+
+ if (delegateResult) {
+ if (delegateResult === ContinueSentinel) continue;
+ return delegateResult;
+ }
+ }
+
+ if (context.method === "next") {
+ context.sent = context._sent = context.arg;
+ } else if (context.method === "throw") {
+ if (state === GenStateSuspendedStart) {
+ state = GenStateCompleted;
+ throw context.arg;
+ }
+
+ context.dispatchException(context.arg);
+ } else if (context.method === "return") {
+ context.abrupt("return", context.arg);
+ }
+
+ state = GenStateExecuting;
+ var record = tryCatch(innerFn, self, context);
+
+ if (record.type === "normal") {
+ state = context.done ? GenStateCompleted : GenStateSuspendedYield;
+
+ if (record.arg === ContinueSentinel) {
+ continue;
+ }
+
+ return {
+ value: record.arg,
+ done: context.done
+ };
+ } else if (record.type === "throw") {
+ state = GenStateCompleted;
+ context.method = "throw";
+ context.arg = record.arg;
+ }
+ }
+ };
+ }
+
+ function maybeInvokeDelegate(delegate, context) {
+ var method = delegate.iterator[context.method];
+
+ if (method === undefined) {
+ context.delegate = null;
+
+ if (context.method === "throw") {
+ if (delegate.iterator["return"]) {
+ context.method = "return";
+ context.arg = undefined;
+ maybeInvokeDelegate(delegate, context);
+
+ if (context.method === "throw") {
+ return ContinueSentinel;
+ }
+ }
+
+ context.method = "throw";
+ context.arg = new TypeError("The iterator does not provide a 'throw' method");
+ }
+
+ return ContinueSentinel;
+ }
+
+ var record = tryCatch(method, delegate.iterator, context.arg);
+
+ if (record.type === "throw") {
+ context.method = "throw";
+ context.arg = record.arg;
+ context.delegate = null;
+ return ContinueSentinel;
+ }
+
+ var info = record.arg;
+
+ if (!info) {
+ context.method = "throw";
+ context.arg = new TypeError("iterator result is not an object");
+ context.delegate = null;
+ return ContinueSentinel;
+ }
+
+ if (info.done) {
+ context[delegate.resultName] = info.value;
+ context.next = delegate.nextLoc;
+
+ if (context.method !== "return") {
+ context.method = "next";
+ context.arg = undefined;
+ }
+ } else {
+ return info;
+ }
+
+ context.delegate = null;
+ return ContinueSentinel;
+ }
+
+ defineIteratorMethods(Gp);
+ Gp[toStringTagSymbol] = "Generator";
+
+ Gp[iteratorSymbol] = function () {
+ return this;
+ };
+
+ Gp.toString = function () {
+ return "[object Generator]";
+ };
+
+ function pushTryEntry(locs) {
+ var entry = {
+ tryLoc: locs[0]
+ };
+
+ if (1 in locs) {
+ entry.catchLoc = locs[1];
+ }
+
+ if (2 in locs) {
+ entry.finallyLoc = locs[2];
+ entry.afterLoc = locs[3];
+ }
+
+ this.tryEntries.push(entry);
+ }
+
+ function resetTryEntry(entry) {
+ var record = entry.completion || {};
+ record.type = "normal";
+ delete record.arg;
+ entry.completion = record;
+ }
+
+ function Context(tryLocsList) {
+ this.tryEntries = [{
+ tryLoc: "root"
+ }];
+ tryLocsList.forEach(pushTryEntry, this);
+ this.reset(true);
+ }
+
+ exports.keys = function (object) {
+ var keys = [];
+
+ for (var key in object) {
+ keys.push(key);
+ }
+
+ keys.reverse();
+ return function next() {
+ while (keys.length) {
+ var key = keys.pop();
+
+ if (key in object) {
+ next.value = key;
+ next.done = false;
+ return next;
+ }
+ }
+
+ next.done = true;
+ return next;
+ };
+ };
+
+ function values(iterable) {
+ if (iterable) {
+ var iteratorMethod = iterable[iteratorSymbol];
+
+ if (iteratorMethod) {
+ return iteratorMethod.call(iterable);
+ }
+
+ if (typeof iterable.next === "function") {
+ return iterable;
+ }
+
+ if (!isNaN(iterable.length)) {
+ var i = -1,
+ next = function next() {
+ while (++i < iterable.length) {
+ if (hasOwn.call(iterable, i)) {
+ next.value = iterable[i];
+ next.done = false;
+ return next;
+ }
+ }
+
+ next.value = undefined;
+ next.done = true;
+ return next;
+ };
+
+ return next.next = next;
+ }
+ }
+
+ return {
+ next: doneResult
+ };
+ }
+
+ exports.values = values;
+
+ function doneResult() {
+ return {
+ value: undefined,
+ done: true
+ };
+ }
+
+ Context.prototype = {
+ constructor: Context,
+ reset: function reset(skipTempReset) {
+ this.prev = 0;
+ this.next = 0;
+ this.sent = this._sent = undefined;
+ this.done = false;
+ this.delegate = null;
+ this.method = "next";
+ this.arg = undefined;
+ this.tryEntries.forEach(resetTryEntry);
+
+ if (!skipTempReset) {
+ for (var name in this) {
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
+ this[name] = undefined;
+ }
+ }
+ }
+ },
+ stop: function stop() {
+ this.done = true;
+ var rootEntry = this.tryEntries[0];
+ var rootRecord = rootEntry.completion;
+
+ if (rootRecord.type === "throw") {
+ throw rootRecord.arg;
+ }
+
+ return this.rval;
+ },
+ dispatchException: function dispatchException(exception) {
+ if (this.done) {
+ throw exception;
+ }
+
+ var context = this;
+
+ function handle(loc, caught) {
+ record.type = "throw";
+ record.arg = exception;
+ context.next = loc;
+
+ if (caught) {
+ context.method = "next";
+ context.arg = undefined;
+ }
+
+ return !!caught;
+ }
+
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
+ var entry = this.tryEntries[i];
+ var record = entry.completion;
+
+ if (entry.tryLoc === "root") {
+ return handle("end");
+ }
+
+ if (entry.tryLoc <= this.prev) {
+ var hasCatch = hasOwn.call(entry, "catchLoc");
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
+
+ if (hasCatch && hasFinally) {
+ if (this.prev < entry.catchLoc) {
+ return handle(entry.catchLoc, true);
+ } else if (this.prev < entry.finallyLoc) {
+ return handle(entry.finallyLoc);
+ }
+ } else if (hasCatch) {
+ if (this.prev < entry.catchLoc) {
+ return handle(entry.catchLoc, true);
+ }
+ } else if (hasFinally) {
+ if (this.prev < entry.finallyLoc) {
+ return handle(entry.finallyLoc);
+ }
+ } else {
+ throw new Error("try statement without catch or finally");
+ }
+ }
+ }
+ },
+ abrupt: function abrupt(type, arg) {
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
+ var entry = this.tryEntries[i];
+
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
+ var finallyEntry = entry;
+ break;
+ }
+ }
+
+ if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
+ finallyEntry = null;
+ }
+
+ var record = finallyEntry ? finallyEntry.completion : {};
+ record.type = type;
+ record.arg = arg;
+
+ if (finallyEntry) {
+ this.method = "next";
+ this.next = finallyEntry.finallyLoc;
+ return ContinueSentinel;
+ }
+
+ return this.complete(record);
+ },
+ complete: function complete(record, afterLoc) {
+ if (record.type === "throw") {
+ throw record.arg;
+ }
+
+ if (record.type === "break" || record.type === "continue") {
+ this.next = record.arg;
+ } else if (record.type === "return") {
+ this.rval = this.arg = record.arg;
+ this.method = "return";
+ this.next = "end";
+ } else if (record.type === "normal" && afterLoc) {
+ this.next = afterLoc;
+ }
+
+ return ContinueSentinel;
+ },
+ finish: function finish(finallyLoc) {
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
+ var entry = this.tryEntries[i];
+
+ if (entry.finallyLoc === finallyLoc) {
+ this.complete(entry.completion, entry.afterLoc);
+ resetTryEntry(entry);
+ return ContinueSentinel;
+ }
+ }
+ },
+ "catch": function _catch(tryLoc) {
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
+ var entry = this.tryEntries[i];
+
+ if (entry.tryLoc === tryLoc) {
+ var record = entry.completion;
+
+ if (record.type === "throw") {
+ var thrown = record.arg;
+ resetTryEntry(entry);
+ }
+
+ return thrown;
+ }
+ }
+
+ throw new Error("illegal catch attempt");
+ },
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
+ this.delegate = {
+ iterator: values(iterable),
+ resultName: resultName,
+ nextLoc: nextLoc
+ };
+
+ if (this.method === "next") {
+ this.arg = undefined;
+ }
+
+ return ContinueSentinel;
+ }
+ };
+ return exports;
+}(( false ? undefined : _typeof(module)) === "object" ? module.exports : {});
+
+try {
+ regeneratorRuntime = runtime;
+} catch (accidentalStrictMode) {
+ Function("r", "regeneratorRuntime = r")(runtime);
+}
+/* WEBPACK VAR INJECTION */}.call(this, __w_pdfjs_require__(4)(module)))
+
+/***/ }),
+/* 4 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+
+module.exports = function (module) {
+ if (!module.webpackPolyfill) {
+ module.deprecate = function () {};
+
+ module.paths = [];
+ if (!module.children) module.children = [];
+ Object.defineProperty(module, "loaded", {
+ enumerable: true,
+ get: function get() {
+ return module.l;
+ }
+ });
+ Object.defineProperty(module, "id", {
+ enumerable: true,
+ get: function get() {
+ return module.i;
+ }
+ });
+ module.webpackPolyfill = 1;
+ }
+
+ return module;
+};
+
+/***/ }),
+/* 5 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -718,13 +1394,35 @@ exports.warn = warn;
exports.unreachable = unreachable;
exports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0;
-__w_pdfjs_require__(3);
+__w_pdfjs_require__(6);
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
-const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
+var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
-const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
+var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
-const PermissionFlag = {
+var PermissionFlag = {
PRINT: 0x04,
MODIFY_CONTENTS: 0x08,
COPY: 0x10,
@@ -735,7 +1433,7 @@ const PermissionFlag = {
PRINT_HIGH_QUALITY: 0x800
};
exports.PermissionFlag = PermissionFlag;
-const TextRenderingMode = {
+var TextRenderingMode = {
FILL: 0,
STROKE: 1,
FILL_STROKE: 2,
@@ -748,13 +1446,13 @@ const TextRenderingMode = {
ADD_TO_PATH_FLAG: 4
};
exports.TextRenderingMode = TextRenderingMode;
-const ImageKind = {
+var ImageKind = {
GRAYSCALE_1BPP: 1,
RGB_24BPP: 2,
RGBA_32BPP: 3
};
exports.ImageKind = ImageKind;
-const AnnotationType = {
+var AnnotationType = {
TEXT: 1,
LINK: 2,
FREETEXT: 3,
@@ -783,17 +1481,17 @@ const AnnotationType = {
REDACT: 26
};
exports.AnnotationType = AnnotationType;
-const AnnotationStateModelType = {
+var AnnotationStateModelType = {
MARKED: "Marked",
REVIEW: "Review"
};
exports.AnnotationStateModelType = AnnotationStateModelType;
-const AnnotationMarkedState = {
+var AnnotationMarkedState = {
MARKED: "Marked",
UNMARKED: "Unmarked"
};
exports.AnnotationMarkedState = AnnotationMarkedState;
-const AnnotationReviewState = {
+var AnnotationReviewState = {
ACCEPTED: "Accepted",
REJECTED: "Rejected",
CANCELLED: "Cancelled",
@@ -801,12 +1499,12 @@ const AnnotationReviewState = {
NONE: "None"
};
exports.AnnotationReviewState = AnnotationReviewState;
-const AnnotationReplyType = {
+var AnnotationReplyType = {
GROUP: "Group",
REPLY: "R"
};
exports.AnnotationReplyType = AnnotationReplyType;
-const AnnotationFlag = {
+var AnnotationFlag = {
INVISIBLE: 0x01,
HIDDEN: 0x02,
PRINT: 0x04,
@@ -819,7 +1517,7 @@ const AnnotationFlag = {
LOCKEDCONTENTS: 0x200
};
exports.AnnotationFlag = AnnotationFlag;
-const AnnotationFieldFlag = {
+var AnnotationFieldFlag = {
READONLY: 0x0000001,
REQUIRED: 0x0000002,
NOEXPORT: 0x0000004,
@@ -841,7 +1539,7 @@ const AnnotationFieldFlag = {
COMMITONSELCHANGE: 0x4000000
};
exports.AnnotationFieldFlag = AnnotationFieldFlag;
-const AnnotationBorderStyleType = {
+var AnnotationBorderStyleType = {
SOLID: 1,
DASHED: 2,
BEVELED: 3,
@@ -849,7 +1547,7 @@ const AnnotationBorderStyleType = {
UNDERLINE: 5
};
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
-const StreamType = {
+var StreamType = {
UNKNOWN: "UNKNOWN",
FLATE: "FLATE",
LZW: "LZW",
@@ -862,7 +1560,7 @@ const StreamType = {
RLX: "RLX"
};
exports.StreamType = StreamType;
-const FontType = {
+var FontType = {
UNKNOWN: "UNKNOWN",
TYPE1: "TYPE1",
TYPE1C: "TYPE1C",
@@ -876,19 +1574,19 @@ const FontType = {
MMTYPE1: "MMTYPE1"
};
exports.FontType = FontType;
-const VerbosityLevel = {
+var VerbosityLevel = {
ERRORS: 0,
WARNINGS: 1,
INFOS: 5
};
exports.VerbosityLevel = VerbosityLevel;
-const CMapCompressionType = {
+var CMapCompressionType = {
NONE: 0,
BINARY: 1,
STREAM: 2
};
exports.CMapCompressionType = CMapCompressionType;
-const OPS = {
+var OPS = {
dependency: 1,
setLineWidth: 2,
setLineCap: 3,
@@ -982,7 +1680,7 @@ const OPS = {
constructPath: 91
};
exports.OPS = OPS;
-const UNSUPPORTED_FEATURES = {
+var UNSUPPORTED_FEATURES = {
unknown: "unknown",
forms: "forms",
javaScript: "javaScript",
@@ -1003,12 +1701,12 @@ const UNSUPPORTED_FEATURES = {
errorFontGetPath: "errorFontGetPath"
};
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
-const PasswordResponses = {
+var PasswordResponses = {
NEED_PASSWORD: 1,
INCORRECT_PASSWORD: 2
};
exports.PasswordResponses = PasswordResponses;
-let verbosity = VerbosityLevel.WARNINGS;
+var verbosity = VerbosityLevel.WARNINGS;
function setVerbosityLevel(level) {
if (Number.isInteger(level)) {
@@ -1022,13 +1720,13 @@ function getVerbosityLevel() {
function info(msg) {
if (verbosity >= VerbosityLevel.INFOS) {
- console.log(`Info: ${msg}`);
+ console.log("Info: ".concat(msg));
}
}
function warn(msg) {
if (verbosity >= VerbosityLevel.WARNINGS) {
- console.log(`Warning: ${msg}`);
+ console.log("Warning: ".concat(msg));
}
}
@@ -1043,7 +1741,7 @@ function assert(cond, msg) {
}
function isSameOrigin(baseUrl, otherUrl) {
- let base;
+ var base;
try {
base = new URL(baseUrl);
@@ -1055,7 +1753,7 @@ function isSameOrigin(baseUrl, otherUrl) {
return false;
}
- const other = new URL(otherUrl, base);
+ var other = new URL(otherUrl, base);
return base.origin === other.origin;
}
@@ -1083,7 +1781,7 @@ function createValidAbsoluteUrl(url, baseUrl) {
}
try {
- const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
+ var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
if (_isValidProtocol(absoluteUrl)) {
return absoluteUrl;
@@ -1095,7 +1793,7 @@ function createValidAbsoluteUrl(url, baseUrl) {
function shadow(obj, prop, value) {
Object.defineProperty(obj, prop, {
- value,
+ value: value,
enumerable: true,
configurable: true,
writable: false
@@ -1103,7 +1801,7 @@ function shadow(obj, prop, value) {
return value;
}
-const BaseException = function BaseExceptionClosure() {
+var BaseException = function BaseExceptionClosure() {
function BaseException(message) {
if (this.constructor === BaseException) {
unreachable("Cannot initialize BaseException.");
@@ -1120,52 +1818,130 @@ const BaseException = function BaseExceptionClosure() {
exports.BaseException = BaseException;
-class PasswordException extends BaseException {
- constructor(msg, code) {
- super(msg);
- this.code = code;
+var PasswordException = /*#__PURE__*/function (_BaseException) {
+ _inherits(PasswordException, _BaseException);
+
+ var _super = _createSuper(PasswordException);
+
+ function PasswordException(msg, code) {
+ var _this;
+
+ _classCallCheck(this, PasswordException);
+
+ _this = _super.call(this, msg);
+ _this.code = code;
+ return _this;
}
-}
+ return PasswordException;
+}(BaseException);
exports.PasswordException = PasswordException;
-class UnknownErrorException extends BaseException {
- constructor(msg, details) {
- super(msg);
- this.details = details;
+var UnknownErrorException = /*#__PURE__*/function (_BaseException2) {
+ _inherits(UnknownErrorException, _BaseException2);
+
+ var _super2 = _createSuper(UnknownErrorException);
+
+ function UnknownErrorException(msg, details) {
+ var _this2;
+
+ _classCallCheck(this, UnknownErrorException);
+
+ _this2 = _super2.call(this, msg);
+ _this2.details = details;
+ return _this2;
}
-}
+ return UnknownErrorException;
+}(BaseException);
exports.UnknownErrorException = UnknownErrorException;
-class InvalidPDFException extends BaseException {}
+var InvalidPDFException = /*#__PURE__*/function (_BaseException3) {
+ _inherits(InvalidPDFException, _BaseException3);
+
+ var _super3 = _createSuper(InvalidPDFException);
+
+ function InvalidPDFException() {
+ _classCallCheck(this, InvalidPDFException);
+
+ return _super3.apply(this, arguments);
+ }
+
+ return InvalidPDFException;
+}(BaseException);
exports.InvalidPDFException = InvalidPDFException;
-class MissingPDFException extends BaseException {}
+var MissingPDFException = /*#__PURE__*/function (_BaseException4) {
+ _inherits(MissingPDFException, _BaseException4);
+
+ var _super4 = _createSuper(MissingPDFException);
+
+ function MissingPDFException() {
+ _classCallCheck(this, MissingPDFException);
+
+ return _super4.apply(this, arguments);
+ }
+
+ return MissingPDFException;
+}(BaseException);
exports.MissingPDFException = MissingPDFException;
-class UnexpectedResponseException extends BaseException {
- constructor(msg, status) {
- super(msg);
- this.status = status;
+var UnexpectedResponseException = /*#__PURE__*/function (_BaseException5) {
+ _inherits(UnexpectedResponseException, _BaseException5);
+
+ var _super5 = _createSuper(UnexpectedResponseException);
+
+ function UnexpectedResponseException(msg, status) {
+ var _this3;
+
+ _classCallCheck(this, UnexpectedResponseException);
+
+ _this3 = _super5.call(this, msg);
+ _this3.status = status;
+ return _this3;
}
-}
+ return UnexpectedResponseException;
+}(BaseException);
exports.UnexpectedResponseException = UnexpectedResponseException;
-class FormatError extends BaseException {}
+var FormatError = /*#__PURE__*/function (_BaseException6) {
+ _inherits(FormatError, _BaseException6);
+
+ var _super6 = _createSuper(FormatError);
+
+ function FormatError() {
+ _classCallCheck(this, FormatError);
+
+ return _super6.apply(this, arguments);
+ }
+
+ return FormatError;
+}(BaseException);
exports.FormatError = FormatError;
-class AbortException extends BaseException {}
+var AbortException = /*#__PURE__*/function (_BaseException7) {
+ _inherits(AbortException, _BaseException7);
+
+ var _super7 = _createSuper(AbortException);
+
+ function AbortException() {
+ _classCallCheck(this, AbortException);
+
+ return _super7.apply(this, arguments);
+ }
+
+ return AbortException;
+}(BaseException);
exports.AbortException = AbortException;
-const NullCharactersRegExp = /\x00/g;
+var NullCharactersRegExp = /\x00/g;
function removeNullCharacters(str) {
if (typeof str !== "string") {
@@ -1177,19 +1953,19 @@ function removeNullCharacters(str) {
}
function bytesToString(bytes) {
- assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
- const length = bytes.length;
- const MAX_ARGUMENT_COUNT = 8192;
+ 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);
}
- const strBuf = [];
+ var strBuf = [];
- for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
- const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
- const chunk = bytes.subarray(i, chunkEnd);
+ 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));
}
@@ -1198,10 +1974,10 @@ function bytesToString(bytes) {
function stringToBytes(str) {
assert(typeof str === "string", "Invalid argument for stringToBytes");
- const length = str.length;
- const bytes = new Uint8Array(length);
+ var length = str.length;
+ var bytes = new Uint8Array(length);
- for (let i = 0; i < length; ++i) {
+ for (var i = 0; i < length; ++i) {
bytes[i] = str.charCodeAt(i) & 0xff;
}
@@ -1218,23 +1994,23 @@ function arrayByteLength(arr) {
}
function arraysToBytes(arr) {
- const length = arr.length;
+ var length = arr.length;
if (length === 1 && arr[0] instanceof Uint8Array) {
return arr[0];
}
- let resultLength = 0;
+ var resultLength = 0;
- for (let i = 0; i < length; i++) {
+ for (var i = 0; i < length; i++) {
resultLength += arrayByteLength(arr[i]);
}
- let pos = 0;
- const data = new Uint8Array(resultLength);
+ var pos = 0;
+ var data = new Uint8Array(resultLength);
- for (let i = 0; i < length; i++) {
- let item = arr[i];
+ for (var _i = 0; _i < length; _i++) {
+ var item = arr[_i];
if (!(item instanceof Uint8Array)) {
if (typeof item === "string") {
@@ -1244,7 +2020,7 @@ function arraysToBytes(arr) {
}
}
- const itemLength = item.byteLength;
+ var itemLength = item.byteLength;
data.set(item, pos);
pos += itemLength;
}
@@ -1257,13 +2033,13 @@ function string32(value) {
}
function isLittleEndian() {
- const buffer8 = new Uint8Array(4);
+ var buffer8 = new Uint8Array(4);
buffer8[0] = 1;
- const view32 = new Uint32Array(buffer8.buffer, 0, 1);
+ var view32 = new Uint32Array(buffer8.buffer, 0, 1);
return view32[0] === 1;
}
-const IsLittleEndianCached = {
+var IsLittleEndianCached = {
get value() {
return shadow(this, "value", isLittleEndian());
}
@@ -1280,135 +2056,152 @@ function isEvalSupported() {
}
}
-const IsEvalSupportedCached = {
+var IsEvalSupportedCached = {
get value() {
return shadow(this, "value", isEvalSupported());
}
};
exports.IsEvalSupportedCached = IsEvalSupportedCached;
-const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"];
-
-class Util {
- static makeCssRgb(r, g, b) {
- rgbBuf[1] = r;
- rgbBuf[3] = g;
- rgbBuf[5] = b;
- return rgbBuf.join("");
- }
-
- static 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]];
- }
-
- static applyTransform(p, m) {
- const xt = p[0] * m[0] + p[1] * m[2] + m[4];
- const yt = p[0] * m[1] + p[1] * m[3] + m[5];
- return [xt, yt];
- }
+var rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"];
- static applyInverseTransform(p, m) {
- const d = m[0] * m[3] - m[1] * m[2];
- const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
- const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
- return [xt, yt];
+var Util = /*#__PURE__*/function () {
+ function Util() {
+ _classCallCheck(this, Util);
}
- static getAxialAlignedBoundingBox(r, m) {
- const p1 = Util.applyTransform(r, m);
- const p2 = Util.applyTransform(r.slice(2, 4), m);
- const p3 = Util.applyTransform([r[0], r[3]], m);
- const 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])];
- }
-
- static inverseTransform(m) {
- const 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];
- }
-
- static 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]];
- }
-
- static singularValueDecompose2dScale(m) {
- const transpose = [m[0], m[2], m[1], m[3]];
- const a = m[0] * transpose[0] + m[1] * transpose[2];
- const b = m[0] * transpose[1] + m[1] * transpose[3];
- const c = m[2] * transpose[0] + m[3] * transpose[2];
- const d = m[2] * transpose[1] + m[3] * transpose[3];
- const first = (a + d) / 2;
- const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
- const sx = first + second || 1;
- const sy = first - second || 1;
- return [Math.sqrt(sx), Math.sqrt(sy)];
- }
-
- static normalizeRect(rect) {
- const r = rect.slice(0);
-
- if (rect[0] > rect[2]) {
- r[0] = rect[2];
- r[2] = rect[0];
+ _createClass(Util, null, [{
+ key: "makeCssRgb",
+ value: function makeCssRgb(r, g, b) {
+ rgbBuf[1] = r;
+ rgbBuf[3] = g;
+ rgbBuf[5] = b;
+ return rgbBuf.join("");
}
-
- if (rect[1] > rect[3]) {
- r[1] = rect[3];
- r[3] = rect[1];
+ }, {
+ key: "transform",
+ value: function transform(m1, m2) {
+ return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
}
+ }, {
+ key: "applyTransform",
+ value: function applyTransform(p, m) {
+ var xt = p[0] * m[0] + p[1] * m[2] + m[4];
+ var yt = p[0] * m[1] + p[1] * m[3] + m[5];
+ return [xt, yt];
+ }
+ }, {
+ key: "applyInverseTransform",
+ value: function applyInverseTransform(p, m) {
+ var d = m[0] * m[3] - m[1] * m[2];
+ var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
+ var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
+ return [xt, yt];
+ }
+ }, {
+ key: "getAxialAlignedBoundingBox",
+ value: function getAxialAlignedBoundingBox(r, m) {
+ var p1 = Util.applyTransform(r, m);
+ var p2 = Util.applyTransform(r.slice(2, 4), m);
+ var p3 = Util.applyTransform([r[0], r[3]], m);
+ var p4 = Util.applyTransform([r[2], r[1]], m);
+ return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
+ }
+ }, {
+ key: "inverseTransform",
+ value: function inverseTransform(m) {
+ var d = m[0] * m[3] - m[1] * m[2];
+ return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
+ }
+ }, {
+ key: "apply3dTransform",
+ value: function apply3dTransform(m, v) {
+ return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
+ }
+ }, {
+ key: "singularValueDecompose2dScale",
+ value: function singularValueDecompose2dScale(m) {
+ var transpose = [m[0], m[2], m[1], m[3]];
+ var a = m[0] * transpose[0] + m[1] * transpose[2];
+ var b = m[0] * transpose[1] + m[1] * transpose[3];
+ var c = m[2] * transpose[0] + m[3] * transpose[2];
+ var d = m[2] * transpose[1] + m[3] * transpose[3];
+ var first = (a + d) / 2;
+ var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
+ var sx = first + second || 1;
+ var sy = first - second || 1;
+ return [Math.sqrt(sx), Math.sqrt(sy)];
+ }
+ }, {
+ key: "normalizeRect",
+ value: function normalizeRect(rect) {
+ var r = rect.slice(0);
- return r;
- }
+ if (rect[0] > rect[2]) {
+ r[0] = rect[2];
+ r[2] = rect[0];
+ }
- static intersect(rect1, rect2) {
- function compare(a, b) {
- return a - b;
+ if (rect[1] > rect[3]) {
+ r[1] = rect[3];
+ r[3] = rect[1];
+ }
+
+ return r;
}
+ }, {
+ key: "intersect",
+ value: function intersect(rect1, rect2) {
+ function compare(a, b) {
+ return a - b;
+ }
- const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
- const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
- const result = [];
- rect1 = Util.normalizeRect(rect1);
- rect2 = Util.normalizeRect(rect2);
+ var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
+ var orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
+ var result = [];
+ rect1 = Util.normalizeRect(rect1);
+ rect2 = Util.normalizeRect(rect2);
- if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
- result[0] = orderedX[1];
- result[2] = orderedX[2];
- } else {
- return null;
- }
+ if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
+ result[0] = orderedX[1];
+ result[2] = orderedX[2];
+ } else {
+ return null;
+ }
- if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
- result[1] = orderedY[1];
- result[3] = orderedY[2];
- } else {
- return null;
- }
+ if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
+ result[1] = orderedY[1];
+ result[3] = orderedY[2];
+ } else {
+ return null;
+ }
- return result;
- }
+ return result;
+ }
+ }]);
-}
+ return Util;
+}();
exports.Util = Util;
-const 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) {
- const length = str.length,
- strBuf = [];
+ var length = str.length,
+ strBuf = [];
if (str[0] === "\xFE" && str[1] === "\xFF") {
- for (let i = 2; i < length; i += 2) {
+ for (var i = 2; i < length; i += 2) {
strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
}
} else if (str[0] === "\xFF" && str[1] === "\xFE") {
- for (let i = 2; i < length; i += 2) {
- strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
+ for (var _i2 = 2; _i2 < length; _i2 += 2) {
+ strBuf.push(String.fromCharCode(str.charCodeAt(_i2 + 1) << 8 | str.charCodeAt(_i2)));
}
} else {
- for (let i = 0; i < length; ++i) {
- const code = PDFStringTranslateTable[str.charCodeAt(i)];
- strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
+ for (var _i3 = 0; _i3 < length; ++_i3) {
+ var code = PDFStringTranslateTable[str.charCodeAt(_i3)];
+ strBuf.push(code ? String.fromCharCode(code) : str.charAt(_i3));
}
}
@@ -1424,7 +2217,7 @@ function utf8StringToString(str) {
}
function isEmptyObj(obj) {
- for (const key in obj) {
+ for (var key in obj) {
return false;
}
@@ -1444,7 +2237,7 @@ function isString(v) {
}
function isArrayBuffer(v) {
- return typeof v === "object" && v !== null && v.byteLength !== undefined;
+ return _typeof(v) === "object" && v !== null && v.byteLength !== undefined;
}
function isArrayEqual(arr1, arr2) {
@@ -1458,13 +2251,12 @@ function isArrayEqual(arr1, arr2) {
}
function createPromiseCapability() {
- const capability = Object.create(null);
- let isSettled = false;
+ var capability = Object.create(null);
+ var isSettled = false;
Object.defineProperty(capability, "settled", {
- get() {
+ get: function get() {
return isSettled;
}
-
});
capability.promise = new Promise(function (resolve, reject) {
capability.resolve = function (data) {
@@ -1480,26 +2272,28 @@ function createPromiseCapability() {
return capability;
}
-const createObjectURL = function createObjectURLClosure() {
- const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- return function createObjectURL(data, contentType, forceDataSchema = false) {
+var createObjectURL = function createObjectURLClosure() {
+ var digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+ return function createObjectURL(data, contentType) {
+ var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
if (!forceDataSchema && URL.createObjectURL) {
- const blob = new Blob([data], {
+ var blob = new Blob([data], {
type: contentType
});
return URL.createObjectURL(blob);
}
- let buffer = `data:${contentType};base64,`;
+ var buffer = "data:".concat(contentType, ";base64,");
- for (let i = 0, ii = data.length; i < ii; i += 3) {
- const b1 = data[i] & 0xff;
- const b2 = data[i + 1] & 0xff;
- const b3 = data[i + 2] & 0xff;
- const d1 = b1 >> 2,
- d2 = (b1 & 3) << 4 | b2 >> 4;
- const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
- const d4 = i + 2 < ii ? b3 & 0x3f : 64;
+ 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];
}
@@ -1510,18 +2304,332 @@ const createObjectURL = function createObjectURLClosure() {
exports.createObjectURL = createObjectURL;
/***/ }),
-/* 3 */
+/* 6 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
-var _is_node = __w_pdfjs_require__(4);
+var _is_node = __w_pdfjs_require__(7);
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+if (typeof globalThis === "undefined" || !globalThis._pdfjsCompatibilityChecked) {
+ if (typeof globalThis === "undefined" || globalThis.Math !== Math) {
+ globalThis = __w_pdfjs_require__(8);
+ }
+
+ globalThis._pdfjsCompatibilityChecked = true;
+ var hasDOM = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === "object";
+ var userAgent = typeof navigator !== "undefined" && navigator.userAgent || "";
+ var isIE = /Trident/.test(userAgent);
+
+ (function checkNodeBtoa() {
+ if (globalThis.btoa || !_is_node.isNodeJS) {
+ return;
+ }
+
+ globalThis.btoa = function (chars) {
+ return Buffer.from(chars, "binary").toString("base64");
+ };
+ })();
+
+ (function checkNodeAtob() {
+ if (globalThis.atob || !_is_node.isNodeJS) {
+ return;
+ }
+
+ globalThis.atob = function (input) {
+ return Buffer.from(input, "base64").toString("binary");
+ };
+ })();
+
+ (function checkChildNodeRemove() {
+ if (!hasDOM) {
+ return;
+ }
+
+ if (typeof Element.prototype.remove !== "undefined") {
+ return;
+ }
+
+ Element.prototype.remove = function () {
+ if (this.parentNode) {
+ this.parentNode.removeChild(this);
+ }
+ };
+ })();
+
+ (function checkDOMTokenListAddRemove() {
+ if (!hasDOM || _is_node.isNodeJS) {
+ return;
+ }
+
+ var div = document.createElement("div");
+ div.classList.add("testOne", "testTwo");
+
+ if (div.classList.contains("testOne") === true && div.classList.contains("testTwo") === true) {
+ return;
+ }
+
+ var OriginalDOMTokenListAdd = DOMTokenList.prototype.add;
+ var OriginalDOMTokenListRemove = DOMTokenList.prototype.remove;
+
+ DOMTokenList.prototype.add = function () {
+ for (var _len = arguments.length, tokens = new Array(_len), _key = 0; _key < _len; _key++) {
+ tokens[_key] = arguments[_key];
+ }
+
+ for (var _i = 0, _tokens = tokens; _i < _tokens.length; _i++) {
+ var token = _tokens[_i];
+ OriginalDOMTokenListAdd.call(this, token);
+ }
+ };
+
+ DOMTokenList.prototype.remove = function () {
+ for (var _len2 = arguments.length, tokens = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
+ tokens[_key2] = arguments[_key2];
+ }
+
+ for (var _i2 = 0, _tokens2 = tokens; _i2 < _tokens2.length; _i2++) {
+ var token = _tokens2[_i2];
+ OriginalDOMTokenListRemove.call(this, token);
+ }
+ };
+ })();
+
+ (function checkDOMTokenListToggle() {
+ if (!hasDOM || _is_node.isNodeJS) {
+ return;
+ }
+
+ var div = document.createElement("div");
+
+ if (div.classList.toggle("test", 0) === false) {
+ return;
+ }
+
+ DOMTokenList.prototype.toggle = function (token) {
+ var force = arguments.length > 1 ? !!arguments[1] : !this.contains(token);
+ return this[force ? "add" : "remove"](token), force;
+ };
+ })();
+
+ (function checkWindowHistoryPushStateReplaceState() {
+ if (!hasDOM || !isIE) {
+ return;
+ }
+
+ var OriginalPushState = window.history.pushState;
+ var OriginalReplaceState = window.history.replaceState;
+
+ window.history.pushState = function (state, title, url) {
+ var args = url === undefined ? [state, title] : [state, title, url];
+ OriginalPushState.apply(this, args);
+ };
+
+ window.history.replaceState = function (state, title, url) {
+ var args = url === undefined ? [state, title] : [state, title, url];
+ OriginalReplaceState.apply(this, args);
+ };
+ })();
+
+ (function checkStringStartsWith() {
+ if (String.prototype.startsWith) {
+ return;
+ }
+
+ __w_pdfjs_require__(53);
+ })();
+
+ (function checkStringEndsWith() {
+ if (String.prototype.endsWith) {
+ return;
+ }
+
+ __w_pdfjs_require__(64);
+ })();
+
+ (function checkStringIncludes() {
+ if (String.prototype.includes) {
+ return;
+ }
+
+ __w_pdfjs_require__(66);
+ })();
+
+ (function checkArrayIncludes() {
+ if (Array.prototype.includes) {
+ return;
+ }
+
+ __w_pdfjs_require__(68);
+ })();
+
+ (function checkArrayFrom() {
+ if (Array.from) {
+ return;
+ }
+
+ __w_pdfjs_require__(76);
+ })();
+
+ (function checkObjectAssign() {
+ if (Object.assign) {
+ return;
+ }
+
+ __w_pdfjs_require__(98);
+ })();
+
+ (function checkMathLog2() {
+ if (Math.log2) {
+ return;
+ }
+
+ Math.log2 = __w_pdfjs_require__(101);
+ })();
+
+ (function checkNumberIsNaN() {
+ if (Number.isNaN) {
+ return;
+ }
+
+ Number.isNaN = __w_pdfjs_require__(103);
+ })();
+
+ (function checkNumberIsInteger() {
+ if (Number.isInteger) {
+ return;
+ }
+
+ Number.isInteger = __w_pdfjs_require__(105);
+ })();
+
+ (function checkTypedArraySlice() {
+ if (Uint8Array.prototype.slice) {
+ return;
+ }
+
+ __w_pdfjs_require__(108);
+ })();
+
+ (function checkPromise() {
+ if (globalThis.Promise && globalThis.Promise.allSettled) {
+ return;
+ }
+
+ globalThis.Promise = __w_pdfjs_require__(113);
+ })();
+
+ (function checkURL() {
+ globalThis.URL = __w_pdfjs_require__(136);
+ })();
+
+ (function checkReadableStream() {
+ var isReadableStreamSupported = false;
+
+ if (typeof ReadableStream !== "undefined") {
+ try {
+ new ReadableStream({
+ start: function start(controller) {
+ controller.close();
+ }
+ });
+ isReadableStreamSupported = true;
+ } catch (e) {}
+ }
+
+ if (isReadableStreamSupported) {
+ return;
+ }
+
+ globalThis.ReadableStream = __w_pdfjs_require__(143).ReadableStream;
+ })();
+
+ (function checkMapEntries() {
+ if (globalThis.Map && globalThis.Map.prototype.entries) {
+ return;
+ }
+
+ globalThis.Map = __w_pdfjs_require__(144);
+ })();
+
+ (function checkSetEntries() {
+ if (globalThis.Set && globalThis.Set.prototype.entries) {
+ return;
+ }
+
+ globalThis.Set = __w_pdfjs_require__(151);
+ })();
+
+ (function checkWeakMap() {
+ if (globalThis.WeakMap) {
+ return;
+ }
+
+ globalThis.WeakMap = __w_pdfjs_require__(153);
+ })();
+
+ (function checkWeakSet() {
+ if (globalThis.WeakSet) {
+ return;
+ }
+
+ globalThis.WeakSet = __w_pdfjs_require__(159);
+ })();
+
+ (function checkStringCodePointAt() {
+ if (String.prototype.codePointAt) {
+ return;
+ }
+
+ __w_pdfjs_require__(161);
+ })();
+
+ (function checkStringFromCodePoint() {
+ if (String.fromCodePoint) {
+ return;
+ }
+
+ String.fromCodePoint = __w_pdfjs_require__(163);
+ })();
+
+ (function checkSymbol() {
+ if (globalThis.Symbol) {
+ return;
+ }
+
+ __w_pdfjs_require__(165);
+ })();
+
+ (function checkStringPadStart() {
+ if (String.prototype.padStart) {
+ return;
+ }
+
+ __w_pdfjs_require__(188);
+ })();
+
+ (function checkStringPadEnd() {
+ if (String.prototype.padEnd) {
+ return;
+ }
+
+ __w_pdfjs_require__(193);
+ })();
+
+ (function checkObjectValues() {
+ if (Object.values) {
+ return;
+ }
-;
+ Object.values = __w_pdfjs_require__(195);
+ })();
+}
/***/ }),
-/* 4 */
+/* 7 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -1531,11 +2639,9087 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isNodeJS = void 0;
-const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !process.versions.electron;
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+var isNodeJS = (typeof process === "undefined" ? "undefined" : _typeof(process)) === "object" && process + "" === "[object process]" && !process.versions.nw && !process.versions.electron;
exports.isNodeJS = isNodeJS;
/***/ }),
-/* 5 */
+/* 8 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(9);
+module.exports = __w_pdfjs_require__(11);
+
+/***/ }),
+/* 9 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var $ = __w_pdfjs_require__(10);
+var global = __w_pdfjs_require__(11);
+$({ global: true }, { globalThis: global });
+
+/***/ }),
+/* 10 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f;
+var createNonEnumerableProperty = __w_pdfjs_require__(26);
+var redefine = __w_pdfjs_require__(29);
+var setGlobal = __w_pdfjs_require__(30);
+var copyConstructorProperties = __w_pdfjs_require__(40);
+var isForced = __w_pdfjs_require__(52);
+module.exports = function (options, source) {
+ var TARGET = options.target;
+ var GLOBAL = options.global;
+ var STATIC = options.stat;
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
+ if (GLOBAL) {
+ target = global;
+ } else if (STATIC) {
+ target = global[TARGET] || setGlobal(TARGET, {});
+ } else {
+ target = (global[TARGET] || {}).prototype;
+ }
+ if (target)
+ for (key in source) {
+ sourceProperty = source[key];
+ if (options.noTargetGet) {
+ descriptor = getOwnPropertyDescriptor(target, key);
+ targetProperty = descriptor && descriptor.value;
+ } else
+ targetProperty = target[key];
+ FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
+ if (!FORCED && targetProperty !== undefined) {
+ if (typeof sourceProperty === typeof targetProperty)
+ continue;
+ copyConstructorProperties(sourceProperty, targetProperty);
+ }
+ if (options.sham || targetProperty && targetProperty.sham) {
+ createNonEnumerableProperty(sourceProperty, 'sham', true);
+ }
+ redefine(target, key, sourceProperty, options);
+ }
+};
+
+/***/ }),
+/* 11 */
+/***/ (function(module, exports) {
+
+var check = function (it) {
+ return it && it.Math == Math && it;
+};
+module.exports = check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || Function('return this')();
+
+/***/ }),
+/* 12 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var propertyIsEnumerableModule = __w_pdfjs_require__(15);
+var createPropertyDescriptor = __w_pdfjs_require__(16);
+var toIndexedObject = __w_pdfjs_require__(17);
+var toPrimitive = __w_pdfjs_require__(21);
+var has = __w_pdfjs_require__(23);
+var IE8_DOM_DEFINE = __w_pdfjs_require__(24);
+var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
+ O = toIndexedObject(O);
+ P = toPrimitive(P, true);
+ if (IE8_DOM_DEFINE)
+ try {
+ return nativeGetOwnPropertyDescriptor(O, P);
+ } catch (error) {
+ }
+ if (has(O, P))
+ return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
+};
+
+/***/ }),
+/* 13 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var fails = __w_pdfjs_require__(14);
+module.exports = !fails(function () {
+ return Object.defineProperty({}, 1, {
+ get: function () {
+ return 7;
+ }
+ })[1] != 7;
+});
+
+/***/ }),
+/* 14 */
+/***/ (function(module, exports) {
+
+module.exports = function (exec) {
+ try {
+ return !!exec();
+ } catch (error) {
+ return true;
+ }
+};
+
+/***/ }),
+/* 15 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
+var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
+exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
+ var descriptor = getOwnPropertyDescriptor(this, V);
+ return !!descriptor && descriptor.enumerable;
+} : nativePropertyIsEnumerable;
+
+/***/ }),
+/* 16 */
+/***/ (function(module, exports) {
+
+module.exports = function (bitmap, value) {
+ return {
+ enumerable: !(bitmap & 1),
+ configurable: !(bitmap & 2),
+ writable: !(bitmap & 4),
+ value: value
+ };
+};
+
+/***/ }),
+/* 17 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var IndexedObject = __w_pdfjs_require__(18);
+var requireObjectCoercible = __w_pdfjs_require__(20);
+module.exports = function (it) {
+ return IndexedObject(requireObjectCoercible(it));
+};
+
+/***/ }),
+/* 18 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var fails = __w_pdfjs_require__(14);
+var classof = __w_pdfjs_require__(19);
+var split = ''.split;
+module.exports = fails(function () {
+ return !Object('z').propertyIsEnumerable(0);
+}) ? function (it) {
+ return classof(it) == 'String' ? split.call(it, '') : Object(it);
+} : Object;
+
+/***/ }),
+/* 19 */
+/***/ (function(module, exports) {
+
+var toString = {}.toString;
+module.exports = function (it) {
+ return toString.call(it).slice(8, -1);
+};
+
+/***/ }),
+/* 20 */
+/***/ (function(module, exports) {
+
+module.exports = function (it) {
+ if (it == undefined)
+ throw TypeError("Can't call method on " + it);
+ return it;
+};
+
+/***/ }),
+/* 21 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var isObject = __w_pdfjs_require__(22);
+module.exports = function (input, PREFERRED_STRING) {
+ if (!isObject(input))
+ return input;
+ var fn, val;
+ if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input)))
+ return val;
+ if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input)))
+ return val;
+ if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input)))
+ return val;
+ throw TypeError("Can't convert object to primitive value");
+};
+
+/***/ }),
+/* 22 */
+/***/ (function(module, exports) {
+
+module.exports = function (it) {
+ return typeof it === 'object' ? it !== null : typeof it === 'function';
+};
+
+/***/ }),
+/* 23 */
+/***/ (function(module, exports) {
+
+var hasOwnProperty = {}.hasOwnProperty;
+module.exports = function (it, key) {
+ return hasOwnProperty.call(it, key);
+};
+
+/***/ }),
+/* 24 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var fails = __w_pdfjs_require__(14);
+var createElement = __w_pdfjs_require__(25);
+module.exports = !DESCRIPTORS && !fails(function () {
+ return Object.defineProperty(createElement('div'), 'a', {
+ get: function () {
+ return 7;
+ }
+ }).a != 7;
+});
+
+/***/ }),
+/* 25 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var isObject = __w_pdfjs_require__(22);
+var document = global.document;
+var EXISTS = isObject(document) && isObject(document.createElement);
+module.exports = function (it) {
+ return EXISTS ? document.createElement(it) : {};
+};
+
+/***/ }),
+/* 26 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var definePropertyModule = __w_pdfjs_require__(27);
+var createPropertyDescriptor = __w_pdfjs_require__(16);
+module.exports = DESCRIPTORS ? function (object, key, value) {
+ return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
+} : function (object, key, value) {
+ object[key] = value;
+ return object;
+};
+
+/***/ }),
+/* 27 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var IE8_DOM_DEFINE = __w_pdfjs_require__(24);
+var anObject = __w_pdfjs_require__(28);
+var toPrimitive = __w_pdfjs_require__(21);
+var nativeDefineProperty = Object.defineProperty;
+exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
+ anObject(O);
+ P = toPrimitive(P, true);
+ anObject(Attributes);
+ if (IE8_DOM_DEFINE)
+ try {
+ return nativeDefineProperty(O, P, Attributes);
+ } catch (error) {
+ }
+ if ('get' in Attributes || 'set' in Attributes)
+ throw TypeError('Accessors not supported');
+ if ('value' in Attributes)
+ O[P] = Attributes.value;
+ return O;
+};
+
+/***/ }),
+/* 28 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var isObject = __w_pdfjs_require__(22);
+module.exports = function (it) {
+ if (!isObject(it)) {
+ throw TypeError(String(it) + ' is not an object');
+ }
+ return it;
+};
+
+/***/ }),
+/* 29 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var createNonEnumerableProperty = __w_pdfjs_require__(26);
+var has = __w_pdfjs_require__(23);
+var setGlobal = __w_pdfjs_require__(30);
+var inspectSource = __w_pdfjs_require__(31);
+var InternalStateModule = __w_pdfjs_require__(33);
+var getInternalState = InternalStateModule.get;
+var enforceInternalState = InternalStateModule.enforce;
+var TEMPLATE = String(String).split('String');
+(module.exports = function (O, key, value, options) {
+ var unsafe = options ? !!options.unsafe : false;
+ var simple = options ? !!options.enumerable : false;
+ var noTargetGet = options ? !!options.noTargetGet : false;
+ if (typeof value == 'function') {
+ if (typeof key == 'string' && !has(value, 'name'))
+ createNonEnumerableProperty(value, 'name', key);
+ enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
+ }
+ if (O === global) {
+ if (simple)
+ O[key] = value;
+ else
+ setGlobal(key, value);
+ return;
+ } else if (!unsafe) {
+ delete O[key];
+ } else if (!noTargetGet && O[key]) {
+ simple = true;
+ }
+ if (simple)
+ O[key] = value;
+ else
+ createNonEnumerableProperty(O, key, value);
+})(Function.prototype, 'toString', function toString() {
+ return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
+});
+
+/***/ }),
+/* 30 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var createNonEnumerableProperty = __w_pdfjs_require__(26);
+module.exports = function (key, value) {
+ try {
+ createNonEnumerableProperty(global, key, value);
+ } catch (error) {
+ global[key] = value;
+ }
+ return value;
+};
+
+/***/ }),
+/* 31 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var store = __w_pdfjs_require__(32);
+var functionToString = Function.toString;
+if (typeof store.inspectSource != 'function') {
+ store.inspectSource = function (it) {
+ return functionToString.call(it);
+ };
+}
+module.exports = store.inspectSource;
+
+/***/ }),
+/* 32 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var setGlobal = __w_pdfjs_require__(30);
+var SHARED = '__core-js_shared__';
+var store = global[SHARED] || setGlobal(SHARED, {});
+module.exports = store;
+
+/***/ }),
+/* 33 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var NATIVE_WEAK_MAP = __w_pdfjs_require__(34);
+var global = __w_pdfjs_require__(11);
+var isObject = __w_pdfjs_require__(22);
+var createNonEnumerableProperty = __w_pdfjs_require__(26);
+var objectHas = __w_pdfjs_require__(23);
+var sharedKey = __w_pdfjs_require__(35);
+var hiddenKeys = __w_pdfjs_require__(39);
+var WeakMap = global.WeakMap;
+var set, get, has;
+var enforce = function (it) {
+ return has(it) ? get(it) : set(it, {});
+};
+var getterFor = function (TYPE) {
+ return function (it) {
+ var state;
+ if (!isObject(it) || (state = get(it)).type !== TYPE) {
+ throw TypeError('Incompatible receiver, ' + TYPE + ' required');
+ }
+ return state;
+ };
+};
+if (NATIVE_WEAK_MAP) {
+ var store = new WeakMap();
+ var wmget = store.get;
+ var wmhas = store.has;
+ var wmset = store.set;
+ set = function (it, metadata) {
+ wmset.call(store, it, metadata);
+ return metadata;
+ };
+ get = function (it) {
+ return wmget.call(store, it) || {};
+ };
+ has = function (it) {
+ return wmhas.call(store, it);
+ };
+} else {
+ var STATE = sharedKey('state');
+ hiddenKeys[STATE] = true;
+ set = function (it, metadata) {
+ createNonEnumerableProperty(it, STATE, metadata);
+ return metadata;
+ };
+ get = function (it) {
+ return objectHas(it, STATE) ? it[STATE] : {};
+ };
+ has = function (it) {
+ return objectHas(it, STATE);
+ };
+}
+module.exports = {
+ set: set,
+ get: get,
+ has: has,
+ enforce: enforce,
+ getterFor: getterFor
+};
+
+/***/ }),
+/* 34 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var inspectSource = __w_pdfjs_require__(31);
+var WeakMap = global.WeakMap;
+module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
+
+/***/ }),
+/* 35 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var shared = __w_pdfjs_require__(36);
+var uid = __w_pdfjs_require__(38);
+var keys = shared('keys');
+module.exports = function (key) {
+ return keys[key] || (keys[key] = uid(key));
+};
+
+/***/ }),
+/* 36 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var IS_PURE = __w_pdfjs_require__(37);
+var store = __w_pdfjs_require__(32);
+(module.exports = function (key, value) {
+ return store[key] || (store[key] = value !== undefined ? value : {});
+})('versions', []).push({
+ version: '3.6.5',
+ mode: IS_PURE ? 'pure' : 'global',
+ copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
+});
+
+/***/ }),
+/* 37 */
+/***/ (function(module, exports) {
+
+module.exports = false;
+
+/***/ }),
+/* 38 */
+/***/ (function(module, exports) {
+
+var id = 0;
+var postfix = Math.random();
+module.exports = function (key) {
+ return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
+};
+
+/***/ }),
+/* 39 */
+/***/ (function(module, exports) {
+
+module.exports = {};
+
+/***/ }),
+/* 40 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var has = __w_pdfjs_require__(23);
+var ownKeys = __w_pdfjs_require__(41);
+var getOwnPropertyDescriptorModule = __w_pdfjs_require__(12);
+var definePropertyModule = __w_pdfjs_require__(27);
+module.exports = function (target, source) {
+ var keys = ownKeys(source);
+ var defineProperty = definePropertyModule.f;
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ if (!has(target, key))
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
+ }
+};
+
+/***/ }),
+/* 41 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var getBuiltIn = __w_pdfjs_require__(42);
+var getOwnPropertyNamesModule = __w_pdfjs_require__(44);
+var getOwnPropertySymbolsModule = __w_pdfjs_require__(51);
+var anObject = __w_pdfjs_require__(28);
+module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
+ var keys = getOwnPropertyNamesModule.f(anObject(it));
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
+ return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
+};
+
+/***/ }),
+/* 42 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var path = __w_pdfjs_require__(43);
+var global = __w_pdfjs_require__(11);
+var aFunction = function (variable) {
+ return typeof variable == 'function' ? variable : undefined;
+};
+module.exports = function (namespace, method) {
+ return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
+};
+
+/***/ }),
+/* 43 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+module.exports = global;
+
+/***/ }),
+/* 44 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var internalObjectKeys = __w_pdfjs_require__(45);
+var enumBugKeys = __w_pdfjs_require__(50);
+var hiddenKeys = enumBugKeys.concat('length', 'prototype');
+exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
+ return internalObjectKeys(O, hiddenKeys);
+};
+
+/***/ }),
+/* 45 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var has = __w_pdfjs_require__(23);
+var toIndexedObject = __w_pdfjs_require__(17);
+var indexOf = __w_pdfjs_require__(46).indexOf;
+var hiddenKeys = __w_pdfjs_require__(39);
+module.exports = function (object, names) {
+ var O = toIndexedObject(object);
+ var i = 0;
+ var result = [];
+ var key;
+ for (key in O)
+ !has(hiddenKeys, key) && has(O, key) && result.push(key);
+ while (names.length > i)
+ if (has(O, key = names[i++])) {
+ ~indexOf(result, key) || result.push(key);
+ }
+ return result;
+};
+
+/***/ }),
+/* 46 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var toIndexedObject = __w_pdfjs_require__(17);
+var toLength = __w_pdfjs_require__(47);
+var toAbsoluteIndex = __w_pdfjs_require__(49);
+var createMethod = function (IS_INCLUDES) {
+ return function ($this, el, fromIndex) {
+ var O = toIndexedObject($this);
+ var length = toLength(O.length);
+ var index = toAbsoluteIndex(fromIndex, length);
+ var value;
+ if (IS_INCLUDES && el != el)
+ while (length > index) {
+ value = O[index++];
+ if (value != value)
+ return true;
+ }
+ else
+ for (; length > index; index++) {
+ if ((IS_INCLUDES || index in O) && O[index] === el)
+ return IS_INCLUDES || index || 0;
+ }
+ return !IS_INCLUDES && -1;
+ };
+};
+module.exports = {
+ includes: createMethod(true),
+ indexOf: createMethod(false)
+};
+
+/***/ }),
+/* 47 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var toInteger = __w_pdfjs_require__(48);
+var min = Math.min;
+module.exports = function (argument) {
+ return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0;
+};
+
+/***/ }),
+/* 48 */
+/***/ (function(module, exports) {
+
+var ceil = Math.ceil;
+var floor = Math.floor;
+module.exports = function (argument) {
+ return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
+};
+
+/***/ }),
+/* 49 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var toInteger = __w_pdfjs_require__(48);
+var max = Math.max;
+var min = Math.min;
+module.exports = function (index, length) {
+ var integer = toInteger(index);
+ return integer < 0 ? max(integer + length, 0) : min(integer, length);
+};
+
+/***/ }),
+/* 50 */
+/***/ (function(module, exports) {
+
+module.exports = [
+ 'constructor',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'toLocaleString',
+ 'toString',
+ 'valueOf'
+];
+
+/***/ }),
+/* 51 */
+/***/ (function(module, exports) {
+
+exports.f = Object.getOwnPropertySymbols;
+
+/***/ }),
+/* 52 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var fails = __w_pdfjs_require__(14);
+var replacement = /#|\.prototype\./;
+var isForced = function (feature, detection) {
+ var value = data[normalize(feature)];
+ return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection;
+};
+var normalize = isForced.normalize = function (string) {
+ return String(string).replace(replacement, '.').toLowerCase();
+};
+var data = isForced.data = {};
+var NATIVE = isForced.NATIVE = 'N';
+var POLYFILL = isForced.POLYFILL = 'P';
+module.exports = isForced;
+
+/***/ }),
+/* 53 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(54);
+var entryUnbind = __w_pdfjs_require__(61);
+module.exports = entryUnbind('String', 'startsWith');
+
+/***/ }),
+/* 54 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f;
+var toLength = __w_pdfjs_require__(47);
+var notARegExp = __w_pdfjs_require__(55);
+var requireObjectCoercible = __w_pdfjs_require__(20);
+var correctIsRegExpLogic = __w_pdfjs_require__(60);
+var IS_PURE = __w_pdfjs_require__(37);
+var nativeStartsWith = ''.startsWith;
+var min = Math.min;
+var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
+var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {
+ var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
+ return descriptor && !descriptor.writable;
+}();
+$({
+ target: 'String',
+ proto: true,
+ forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC
+}, {
+ startsWith: function startsWith(searchString) {
+ var that = String(requireObjectCoercible(this));
+ notARegExp(searchString);
+ var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
+ var search = String(searchString);
+ return nativeStartsWith ? nativeStartsWith.call(that, search, index) : that.slice(index, index + search.length) === search;
+ }
+});
+
+/***/ }),
+/* 55 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var isRegExp = __w_pdfjs_require__(56);
+module.exports = function (it) {
+ if (isRegExp(it)) {
+ throw TypeError("The method doesn't accept regular expressions");
+ }
+ return it;
+};
+
+/***/ }),
+/* 56 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var isObject = __w_pdfjs_require__(22);
+var classof = __w_pdfjs_require__(19);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var MATCH = wellKnownSymbol('match');
+module.exports = function (it) {
+ var isRegExp;
+ return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
+};
+
+/***/ }),
+/* 57 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var shared = __w_pdfjs_require__(36);
+var has = __w_pdfjs_require__(23);
+var uid = __w_pdfjs_require__(38);
+var NATIVE_SYMBOL = __w_pdfjs_require__(58);
+var USE_SYMBOL_AS_UID = __w_pdfjs_require__(59);
+var WellKnownSymbolsStore = shared('wks');
+var Symbol = global.Symbol;
+var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
+module.exports = function (name) {
+ if (!has(WellKnownSymbolsStore, name)) {
+ if (NATIVE_SYMBOL && has(Symbol, name))
+ WellKnownSymbolsStore[name] = Symbol[name];
+ else
+ WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
+ }
+ return WellKnownSymbolsStore[name];
+};
+
+/***/ }),
+/* 58 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var fails = __w_pdfjs_require__(14);
+module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
+ return !String(Symbol());
+});
+
+/***/ }),
+/* 59 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var NATIVE_SYMBOL = __w_pdfjs_require__(58);
+module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol';
+
+/***/ }),
+/* 60 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var MATCH = wellKnownSymbol('match');
+module.exports = function (METHOD_NAME) {
+ var regexp = /./;
+ try {
+ '/./'[METHOD_NAME](regexp);
+ } catch (e) {
+ try {
+ regexp[MATCH] = false;
+ return '/./'[METHOD_NAME](regexp);
+ } catch (f) {
+ }
+ }
+ return false;
+};
+
+/***/ }),
+/* 61 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var bind = __w_pdfjs_require__(62);
+var call = Function.call;
+module.exports = function (CONSTRUCTOR, METHOD, length) {
+ return bind(call, global[CONSTRUCTOR].prototype[METHOD], length);
+};
+
+/***/ }),
+/* 62 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var aFunction = __w_pdfjs_require__(63);
+module.exports = function (fn, that, length) {
+ aFunction(fn);
+ if (that === undefined)
+ return fn;
+ switch (length) {
+ case 0:
+ return function () {
+ return fn.call(that);
+ };
+ case 1:
+ return function (a) {
+ return fn.call(that, a);
+ };
+ case 2:
+ return function (a, b) {
+ return fn.call(that, a, b);
+ };
+ case 3:
+ return function (a, b, c) {
+ return fn.call(that, a, b, c);
+ };
+ }
+ return function () {
+ return fn.apply(that, arguments);
+ };
+};
+
+/***/ }),
+/* 63 */
+/***/ (function(module, exports) {
+
+module.exports = function (it) {
+ if (typeof it != 'function') {
+ throw TypeError(String(it) + ' is not a function');
+ }
+ return it;
+};
+
+/***/ }),
+/* 64 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(65);
+var entryUnbind = __w_pdfjs_require__(61);
+module.exports = entryUnbind('String', 'endsWith');
+
+/***/ }),
+/* 65 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f;
+var toLength = __w_pdfjs_require__(47);
+var notARegExp = __w_pdfjs_require__(55);
+var requireObjectCoercible = __w_pdfjs_require__(20);
+var correctIsRegExpLogic = __w_pdfjs_require__(60);
+var IS_PURE = __w_pdfjs_require__(37);
+var nativeEndsWith = ''.endsWith;
+var min = Math.min;
+var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('endsWith');
+var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {
+ var descriptor = getOwnPropertyDescriptor(String.prototype, 'endsWith');
+ return descriptor && !descriptor.writable;
+}();
+$({
+ target: 'String',
+ proto: true,
+ forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC
+}, {
+ endsWith: function endsWith(searchString) {
+ var that = String(requireObjectCoercible(this));
+ notARegExp(searchString);
+ var endPosition = arguments.length > 1 ? arguments[1] : undefined;
+ var len = toLength(that.length);
+ var end = endPosition === undefined ? len : min(toLength(endPosition), len);
+ var search = String(searchString);
+ return nativeEndsWith ? nativeEndsWith.call(that, search, end) : that.slice(end - search.length, end) === search;
+ }
+});
+
+/***/ }),
+/* 66 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(67);
+var entryUnbind = __w_pdfjs_require__(61);
+module.exports = entryUnbind('String', 'includes');
+
+/***/ }),
+/* 67 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var notARegExp = __w_pdfjs_require__(55);
+var requireObjectCoercible = __w_pdfjs_require__(20);
+var correctIsRegExpLogic = __w_pdfjs_require__(60);
+$({
+ target: 'String',
+ proto: true,
+ forced: !correctIsRegExpLogic('includes')
+}, {
+ includes: function includes(searchString) {
+ return !!~String(requireObjectCoercible(this)).indexOf(notARegExp(searchString), arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+/***/ }),
+/* 68 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(69);
+var entryUnbind = __w_pdfjs_require__(61);
+module.exports = entryUnbind('Array', 'includes');
+
+/***/ }),
+/* 69 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var $includes = __w_pdfjs_require__(46).includes;
+var addToUnscopables = __w_pdfjs_require__(70);
+var arrayMethodUsesToLength = __w_pdfjs_require__(75);
+var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', {
+ ACCESSORS: true,
+ 1: 0
+});
+$({
+ target: 'Array',
+ proto: true,
+ forced: !USES_TO_LENGTH
+}, {
+ includes: function includes(el) {
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+addToUnscopables('includes');
+
+/***/ }),
+/* 70 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var create = __w_pdfjs_require__(71);
+var definePropertyModule = __w_pdfjs_require__(27);
+var UNSCOPABLES = wellKnownSymbol('unscopables');
+var ArrayPrototype = Array.prototype;
+if (ArrayPrototype[UNSCOPABLES] == undefined) {
+ definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
+ configurable: true,
+ value: create(null)
+ });
+}
+module.exports = function (key) {
+ ArrayPrototype[UNSCOPABLES][key] = true;
+};
+
+/***/ }),
+/* 71 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var anObject = __w_pdfjs_require__(28);
+var defineProperties = __w_pdfjs_require__(72);
+var enumBugKeys = __w_pdfjs_require__(50);
+var hiddenKeys = __w_pdfjs_require__(39);
+var html = __w_pdfjs_require__(74);
+var documentCreateElement = __w_pdfjs_require__(25);
+var sharedKey = __w_pdfjs_require__(35);
+var GT = '>';
+var LT = '<';
+var PROTOTYPE = 'prototype';
+var SCRIPT = 'script';
+var IE_PROTO = sharedKey('IE_PROTO');
+var EmptyConstructor = function () {
+};
+var scriptTag = function (content) {
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
+};
+var NullProtoObjectViaActiveX = function (activeXDocument) {
+ activeXDocument.write(scriptTag(''));
+ activeXDocument.close();
+ var temp = activeXDocument.parentWindow.Object;
+ activeXDocument = null;
+ return temp;
+};
+var NullProtoObjectViaIFrame = function () {
+ var iframe = documentCreateElement('iframe');
+ var JS = 'java' + SCRIPT + ':';
+ var iframeDocument;
+ iframe.style.display = 'none';
+ html.appendChild(iframe);
+ iframe.src = String(JS);
+ iframeDocument = iframe.contentWindow.document;
+ iframeDocument.open();
+ iframeDocument.write(scriptTag('document.F=Object'));
+ iframeDocument.close();
+ return iframeDocument.F;
+};
+var activeXDocument;
+var NullProtoObject = function () {
+ try {
+ activeXDocument = document.domain && new ActiveXObject('htmlfile');
+ } catch (error) {
+ }
+ NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
+ var length = enumBugKeys.length;
+ while (length--)
+ delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
+ return NullProtoObject();
+};
+hiddenKeys[IE_PROTO] = true;
+module.exports = Object.create || function create(O, Properties) {
+ var result;
+ if (O !== null) {
+ EmptyConstructor[PROTOTYPE] = anObject(O);
+ result = new EmptyConstructor();
+ EmptyConstructor[PROTOTYPE] = null;
+ result[IE_PROTO] = O;
+ } else
+ result = NullProtoObject();
+ return Properties === undefined ? result : defineProperties(result, Properties);
+};
+
+/***/ }),
+/* 72 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var definePropertyModule = __w_pdfjs_require__(27);
+var anObject = __w_pdfjs_require__(28);
+var objectKeys = __w_pdfjs_require__(73);
+module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
+ anObject(O);
+ var keys = objectKeys(Properties);
+ var length = keys.length;
+ var index = 0;
+ var key;
+ while (length > index)
+ definePropertyModule.f(O, key = keys[index++], Properties[key]);
+ return O;
+};
+
+/***/ }),
+/* 73 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var internalObjectKeys = __w_pdfjs_require__(45);
+var enumBugKeys = __w_pdfjs_require__(50);
+module.exports = Object.keys || function keys(O) {
+ return internalObjectKeys(O, enumBugKeys);
+};
+
+/***/ }),
+/* 74 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var getBuiltIn = __w_pdfjs_require__(42);
+module.exports = getBuiltIn('document', 'documentElement');
+
+/***/ }),
+/* 75 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var fails = __w_pdfjs_require__(14);
+var has = __w_pdfjs_require__(23);
+var defineProperty = Object.defineProperty;
+var cache = {};
+var thrower = function (it) {
+ throw it;
+};
+module.exports = function (METHOD_NAME, options) {
+ if (has(cache, METHOD_NAME))
+ return cache[METHOD_NAME];
+ if (!options)
+ options = {};
+ var method = [][METHOD_NAME];
+ var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
+ var argument0 = has(options, 0) ? options[0] : thrower;
+ var argument1 = has(options, 1) ? options[1] : undefined;
+ return cache[METHOD_NAME] = !!method && !fails(function () {
+ if (ACCESSORS && !DESCRIPTORS)
+ return true;
+ var O = { length: -1 };
+ if (ACCESSORS)
+ defineProperty(O, 1, {
+ enumerable: true,
+ get: thrower
+ });
+ else
+ O[1] = 1;
+ method.call(O, argument0, argument1);
+ });
+};
+
+/***/ }),
+/* 76 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(77);
+__w_pdfjs_require__(89);
+var path = __w_pdfjs_require__(43);
+module.exports = path.Array.from;
+
+/***/ }),
+/* 77 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var charAt = __w_pdfjs_require__(78).charAt;
+var InternalStateModule = __w_pdfjs_require__(33);
+var defineIterator = __w_pdfjs_require__(79);
+var STRING_ITERATOR = 'String Iterator';
+var setInternalState = InternalStateModule.set;
+var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
+defineIterator(String, 'String', function (iterated) {
+ setInternalState(this, {
+ type: STRING_ITERATOR,
+ string: String(iterated),
+ index: 0
+ });
+}, function next() {
+ var state = getInternalState(this);
+ var string = state.string;
+ var index = state.index;
+ var point;
+ if (index >= string.length)
+ return {
+ value: undefined,
+ done: true
+ };
+ point = charAt(string, index);
+ state.index += point.length;
+ return {
+ value: point,
+ done: false
+ };
+});
+
+/***/ }),
+/* 78 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var toInteger = __w_pdfjs_require__(48);
+var requireObjectCoercible = __w_pdfjs_require__(20);
+var createMethod = function (CONVERT_TO_STRING) {
+ return function ($this, pos) {
+ var S = String(requireObjectCoercible($this));
+ var position = toInteger(pos);
+ var size = S.length;
+ var first, second;
+ if (position < 0 || position >= size)
+ return CONVERT_TO_STRING ? '' : undefined;
+ first = S.charCodeAt(position);
+ return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
+ };
+};
+module.exports = {
+ codeAt: createMethod(false),
+ charAt: createMethod(true)
+};
+
+/***/ }),
+/* 79 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var createIteratorConstructor = __w_pdfjs_require__(80);
+var getPrototypeOf = __w_pdfjs_require__(82);
+var setPrototypeOf = __w_pdfjs_require__(87);
+var setToStringTag = __w_pdfjs_require__(85);
+var createNonEnumerableProperty = __w_pdfjs_require__(26);
+var redefine = __w_pdfjs_require__(29);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var IS_PURE = __w_pdfjs_require__(37);
+var Iterators = __w_pdfjs_require__(86);
+var IteratorsCore = __w_pdfjs_require__(81);
+var IteratorPrototype = IteratorsCore.IteratorPrototype;
+var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
+var ITERATOR = wellKnownSymbol('iterator');
+var KEYS = 'keys';
+var VALUES = 'values';
+var ENTRIES = 'entries';
+var returnThis = function () {
+ return this;
+};
+module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
+ createIteratorConstructor(IteratorConstructor, NAME, next);
+ var getIterationMethod = function (KIND) {
+ if (KIND === DEFAULT && defaultIterator)
+ return defaultIterator;
+ if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype)
+ return IterablePrototype[KIND];
+ switch (KIND) {
+ case KEYS:
+ return function keys() {
+ return new IteratorConstructor(this, KIND);
+ };
+ case VALUES:
+ return function values() {
+ return new IteratorConstructor(this, KIND);
+ };
+ case ENTRIES:
+ return function entries() {
+ return new IteratorConstructor(this, KIND);
+ };
+ }
+ return function () {
+ return new IteratorConstructor(this);
+ };
+ };
+ var TO_STRING_TAG = NAME + ' Iterator';
+ var INCORRECT_VALUES_NAME = false;
+ var IterablePrototype = Iterable.prototype;
+ var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
+ var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
+ var CurrentIteratorPrototype, methods, KEY;
+ if (anyNativeIterator) {
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
+ if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
+ if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
+ if (setPrototypeOf) {
+ setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
+ } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
+ createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis);
+ }
+ }
+ setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
+ if (IS_PURE)
+ Iterators[TO_STRING_TAG] = returnThis;
+ }
+ }
+ if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
+ INCORRECT_VALUES_NAME = true;
+ defaultIterator = function values() {
+ return nativeIterator.call(this);
+ };
+ }
+ if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
+ createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator);
+ }
+ Iterators[NAME] = defaultIterator;
+ if (DEFAULT) {
+ methods = {
+ values: getIterationMethod(VALUES),
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
+ entries: getIterationMethod(ENTRIES)
+ };
+ if (FORCED)
+ for (KEY in methods) {
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
+ redefine(IterablePrototype, KEY, methods[KEY]);
+ }
+ }
+ else
+ $({
+ target: NAME,
+ proto: true,
+ forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
+ }, methods);
+ }
+ return methods;
+};
+
+/***/ }),
+/* 80 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var IteratorPrototype = __w_pdfjs_require__(81).IteratorPrototype;
+var create = __w_pdfjs_require__(71);
+var createPropertyDescriptor = __w_pdfjs_require__(16);
+var setToStringTag = __w_pdfjs_require__(85);
+var Iterators = __w_pdfjs_require__(86);
+var returnThis = function () {
+ return this;
+};
+module.exports = function (IteratorConstructor, NAME, next) {
+ var TO_STRING_TAG = NAME + ' Iterator';
+ IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
+ setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
+ Iterators[TO_STRING_TAG] = returnThis;
+ return IteratorConstructor;
+};
+
+/***/ }),
+/* 81 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var getPrototypeOf = __w_pdfjs_require__(82);
+var createNonEnumerableProperty = __w_pdfjs_require__(26);
+var has = __w_pdfjs_require__(23);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var IS_PURE = __w_pdfjs_require__(37);
+var ITERATOR = wellKnownSymbol('iterator');
+var BUGGY_SAFARI_ITERATORS = false;
+var returnThis = function () {
+ return this;
+};
+var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
+if ([].keys) {
+ arrayIterator = [].keys();
+ if (!('next' in arrayIterator))
+ BUGGY_SAFARI_ITERATORS = true;
+ else {
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype)
+ IteratorPrototype = PrototypeOfArrayIteratorPrototype;
+ }
+}
+if (IteratorPrototype == undefined)
+ IteratorPrototype = {};
+if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) {
+ createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
+}
+module.exports = {
+ IteratorPrototype: IteratorPrototype,
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
+};
+
+/***/ }),
+/* 82 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var has = __w_pdfjs_require__(23);
+var toObject = __w_pdfjs_require__(83);
+var sharedKey = __w_pdfjs_require__(35);
+var CORRECT_PROTOTYPE_GETTER = __w_pdfjs_require__(84);
+var IE_PROTO = sharedKey('IE_PROTO');
+var ObjectPrototype = Object.prototype;
+module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
+ O = toObject(O);
+ if (has(O, IE_PROTO))
+ return O[IE_PROTO];
+ if (typeof O.constructor == 'function' && O instanceof O.constructor) {
+ return O.constructor.prototype;
+ }
+ return O instanceof Object ? ObjectPrototype : null;
+};
+
+/***/ }),
+/* 83 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var requireObjectCoercible = __w_pdfjs_require__(20);
+module.exports = function (argument) {
+ return Object(requireObjectCoercible(argument));
+};
+
+/***/ }),
+/* 84 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var fails = __w_pdfjs_require__(14);
+module.exports = !fails(function () {
+ function F() {
+ }
+ F.prototype.constructor = null;
+ return Object.getPrototypeOf(new F()) !== F.prototype;
+});
+
+/***/ }),
+/* 85 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineProperty = __w_pdfjs_require__(27).f;
+var has = __w_pdfjs_require__(23);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+module.exports = function (it, TAG, STATIC) {
+ if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
+ defineProperty(it, TO_STRING_TAG, {
+ configurable: true,
+ value: TAG
+ });
+ }
+};
+
+/***/ }),
+/* 86 */
+/***/ (function(module, exports) {
+
+module.exports = {};
+
+/***/ }),
+/* 87 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var anObject = __w_pdfjs_require__(28);
+var aPossiblePrototype = __w_pdfjs_require__(88);
+module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
+ var CORRECT_SETTER = false;
+ var test = {};
+ var setter;
+ try {
+ setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
+ setter.call(test, []);
+ CORRECT_SETTER = test instanceof Array;
+ } catch (error) {
+ }
+ return function setPrototypeOf(O, proto) {
+ anObject(O);
+ aPossiblePrototype(proto);
+ if (CORRECT_SETTER)
+ setter.call(O, proto);
+ else
+ O.__proto__ = proto;
+ return O;
+ };
+}() : undefined);
+
+/***/ }),
+/* 88 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var isObject = __w_pdfjs_require__(22);
+module.exports = function (it) {
+ if (!isObject(it) && it !== null) {
+ throw TypeError("Can't set " + String(it) + ' as a prototype');
+ }
+ return it;
+};
+
+/***/ }),
+/* 89 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var $ = __w_pdfjs_require__(10);
+var from = __w_pdfjs_require__(90);
+var checkCorrectnessOfIteration = __w_pdfjs_require__(97);
+var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
+ Array.from(iterable);
+});
+$({
+ target: 'Array',
+ stat: true,
+ forced: INCORRECT_ITERATION
+}, { from: from });
+
+/***/ }),
+/* 90 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var bind = __w_pdfjs_require__(62);
+var toObject = __w_pdfjs_require__(83);
+var callWithSafeIterationClosing = __w_pdfjs_require__(91);
+var isArrayIteratorMethod = __w_pdfjs_require__(92);
+var toLength = __w_pdfjs_require__(47);
+var createProperty = __w_pdfjs_require__(93);
+var getIteratorMethod = __w_pdfjs_require__(94);
+module.exports = function from(arrayLike) {
+ var O = toObject(arrayLike);
+ var C = typeof this == 'function' ? this : Array;
+ var argumentsLength = arguments.length;
+ var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
+ var mapping = mapfn !== undefined;
+ var iteratorMethod = getIteratorMethod(O);
+ var index = 0;
+ var length, result, step, iterator, next, value;
+ if (mapping)
+ mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
+ if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
+ iterator = iteratorMethod.call(O);
+ next = iterator.next;
+ result = new C();
+ for (; !(step = next.call(iterator)).done; index++) {
+ value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [
+ step.value,
+ index
+ ], true) : step.value;
+ createProperty(result, index, value);
+ }
+ } else {
+ length = toLength(O.length);
+ result = new C(length);
+ for (; length > index; index++) {
+ value = mapping ? mapfn(O[index], index) : O[index];
+ createProperty(result, index, value);
+ }
+ }
+ result.length = index;
+ return result;
+};
+
+/***/ }),
+/* 91 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var anObject = __w_pdfjs_require__(28);
+module.exports = function (iterator, fn, value, ENTRIES) {
+ try {
+ return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
+ } catch (error) {
+ var returnMethod = iterator['return'];
+ if (returnMethod !== undefined)
+ anObject(returnMethod.call(iterator));
+ throw error;
+ }
+};
+
+/***/ }),
+/* 92 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var Iterators = __w_pdfjs_require__(86);
+var ITERATOR = wellKnownSymbol('iterator');
+var ArrayPrototype = Array.prototype;
+module.exports = function (it) {
+ return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
+};
+
+/***/ }),
+/* 93 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var toPrimitive = __w_pdfjs_require__(21);
+var definePropertyModule = __w_pdfjs_require__(27);
+var createPropertyDescriptor = __w_pdfjs_require__(16);
+module.exports = function (object, key, value) {
+ var propertyKey = toPrimitive(key);
+ if (propertyKey in object)
+ definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
+ else
+ object[propertyKey] = value;
+};
+
+/***/ }),
+/* 94 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var classof = __w_pdfjs_require__(95);
+var Iterators = __w_pdfjs_require__(86);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var ITERATOR = wellKnownSymbol('iterator');
+module.exports = function (it) {
+ if (it != undefined)
+ return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
+};
+
+/***/ }),
+/* 95 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(96);
+var classofRaw = __w_pdfjs_require__(19);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+var CORRECT_ARGUMENTS = classofRaw(function () {
+ return arguments;
+}()) == 'Arguments';
+var tryGet = function (it, key) {
+ try {
+ return it[key];
+ } catch (error) {
+ }
+};
+module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
+ var O, tag, result;
+ return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
+};
+
+/***/ }),
+/* 96 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+var test = {};
+test[TO_STRING_TAG] = 'z';
+module.exports = String(test) === '[object z]';
+
+/***/ }),
+/* 97 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var ITERATOR = wellKnownSymbol('iterator');
+var SAFE_CLOSING = false;
+try {
+ var called = 0;
+ var iteratorWithReturn = {
+ next: function () {
+ return { done: !!called++ };
+ },
+ 'return': function () {
+ SAFE_CLOSING = true;
+ }
+ };
+ iteratorWithReturn[ITERATOR] = function () {
+ return this;
+ };
+ Array.from(iteratorWithReturn, function () {
+ throw 2;
+ });
+} catch (error) {
+}
+module.exports = function (exec, SKIP_CLOSING) {
+ if (!SKIP_CLOSING && !SAFE_CLOSING)
+ return false;
+ var ITERATION_SUPPORT = false;
+ try {
+ var object = {};
+ object[ITERATOR] = function () {
+ return {
+ next: function () {
+ return { done: ITERATION_SUPPORT = true };
+ }
+ };
+ };
+ exec(object);
+ } catch (error) {
+ }
+ return ITERATION_SUPPORT;
+};
+
+/***/ }),
+/* 98 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(99);
+var path = __w_pdfjs_require__(43);
+module.exports = path.Object.assign;
+
+/***/ }),
+/* 99 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var $ = __w_pdfjs_require__(10);
+var assign = __w_pdfjs_require__(100);
+$({
+ target: 'Object',
+ stat: true,
+ forced: Object.assign !== assign
+}, { assign: assign });
+
+/***/ }),
+/* 100 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var fails = __w_pdfjs_require__(14);
+var objectKeys = __w_pdfjs_require__(73);
+var getOwnPropertySymbolsModule = __w_pdfjs_require__(51);
+var propertyIsEnumerableModule = __w_pdfjs_require__(15);
+var toObject = __w_pdfjs_require__(83);
+var IndexedObject = __w_pdfjs_require__(18);
+var nativeAssign = Object.assign;
+var defineProperty = Object.defineProperty;
+module.exports = !nativeAssign || fails(function () {
+ if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {
+ enumerable: true,
+ get: function () {
+ defineProperty(this, 'b', {
+ value: 3,
+ enumerable: false
+ });
+ }
+ }), { b: 2 })).b !== 1)
+ return true;
+ var A = {};
+ var B = {};
+ var symbol = Symbol();
+ var alphabet = 'abcdefghijklmnopqrst';
+ A[symbol] = 7;
+ alphabet.split('').forEach(function (chr) {
+ B[chr] = chr;
+ });
+ return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
+}) ? function assign(target, source) {
+ var T = toObject(target);
+ var argumentsLength = arguments.length;
+ var index = 1;
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
+ while (argumentsLength > index) {
+ var S = IndexedObject(arguments[index++]);
+ var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
+ var length = keys.length;
+ var j = 0;
+ var key;
+ while (length > j) {
+ key = keys[j++];
+ if (!DESCRIPTORS || propertyIsEnumerable.call(S, key))
+ T[key] = S[key];
+ }
+ }
+ return T;
+} : nativeAssign;
+
+/***/ }),
+/* 101 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(102);
+var path = __w_pdfjs_require__(43);
+module.exports = path.Math.log2;
+
+/***/ }),
+/* 102 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var $ = __w_pdfjs_require__(10);
+var log = Math.log;
+var LN2 = Math.LN2;
+$({
+ target: 'Math',
+ stat: true
+}, {
+ log2: function log2(x) {
+ return log(x) / LN2;
+ }
+});
+
+/***/ }),
+/* 103 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(104);
+var path = __w_pdfjs_require__(43);
+module.exports = path.Number.isNaN;
+
+/***/ }),
+/* 104 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var $ = __w_pdfjs_require__(10);
+$({
+ target: 'Number',
+ stat: true
+}, {
+ isNaN: function isNaN(number) {
+ return number != number;
+ }
+});
+
+/***/ }),
+/* 105 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(106);
+var path = __w_pdfjs_require__(43);
+module.exports = path.Number.isInteger;
+
+/***/ }),
+/* 106 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var $ = __w_pdfjs_require__(10);
+var isInteger = __w_pdfjs_require__(107);
+$({
+ target: 'Number',
+ stat: true
+}, { isInteger: isInteger });
+
+/***/ }),
+/* 107 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var isObject = __w_pdfjs_require__(22);
+var floor = Math.floor;
+module.exports = function isInteger(it) {
+ return !isObject(it) && isFinite(it) && floor(it) === it;
+};
+
+/***/ }),
+/* 108 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(109);
+
+/***/ }),
+/* 109 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __w_pdfjs_require__(110);
+var speciesConstructor = __w_pdfjs_require__(112);
+var fails = __w_pdfjs_require__(14);
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+var $slice = [].slice;
+var FORCED = fails(function () {
+ new Int8Array(1).slice();
+});
+exportTypedArrayMethod('slice', function slice(start, end) {
+ var list = $slice.call(aTypedArray(this), start, end);
+ var C = speciesConstructor(this, this.constructor);
+ var index = 0;
+ var length = list.length;
+ var result = new (aTypedArrayConstructor(C))(length);
+ while (length > index)
+ result[index] = list[index++];
+ return result;
+}, FORCED);
+
+/***/ }),
+/* 110 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var NATIVE_ARRAY_BUFFER = __w_pdfjs_require__(111);
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var global = __w_pdfjs_require__(11);
+var isObject = __w_pdfjs_require__(22);
+var has = __w_pdfjs_require__(23);
+var classof = __w_pdfjs_require__(95);
+var createNonEnumerableProperty = __w_pdfjs_require__(26);
+var redefine = __w_pdfjs_require__(29);
+var defineProperty = __w_pdfjs_require__(27).f;
+var getPrototypeOf = __w_pdfjs_require__(82);
+var setPrototypeOf = __w_pdfjs_require__(87);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var uid = __w_pdfjs_require__(38);
+var Int8Array = global.Int8Array;
+var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
+var Uint8ClampedArray = global.Uint8ClampedArray;
+var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
+var TypedArray = Int8Array && getPrototypeOf(Int8Array);
+var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
+var ObjectPrototype = Object.prototype;
+var isPrototypeOf = ObjectPrototype.isPrototypeOf;
+var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
+var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
+var TYPED_ARRAY_TAG_REQIRED = false;
+var NAME;
+var TypedArrayConstructorsList = {
+ Int8Array: 1,
+ Uint8Array: 1,
+ Uint8ClampedArray: 1,
+ Int16Array: 2,
+ Uint16Array: 2,
+ Int32Array: 4,
+ Uint32Array: 4,
+ Float32Array: 4,
+ Float64Array: 8
+};
+var isView = function isView(it) {
+ var klass = classof(it);
+ return klass === 'DataView' || has(TypedArrayConstructorsList, klass);
+};
+var isTypedArray = function (it) {
+ return isObject(it) && has(TypedArrayConstructorsList, classof(it));
+};
+var aTypedArray = function (it) {
+ if (isTypedArray(it))
+ return it;
+ throw TypeError('Target is not a typed array');
+};
+var aTypedArrayConstructor = function (C) {
+ if (setPrototypeOf) {
+ if (isPrototypeOf.call(TypedArray, C))
+ return C;
+ } else
+ for (var ARRAY in TypedArrayConstructorsList)
+ if (has(TypedArrayConstructorsList, NAME)) {
+ var TypedArrayConstructor = global[ARRAY];
+ if (TypedArrayConstructor && (C === TypedArrayConstructor || isPrototypeOf.call(TypedArrayConstructor, C))) {
+ return C;
+ }
+ }
+ throw TypeError('Target is not a typed array constructor');
+};
+var exportTypedArrayMethod = function (KEY, property, forced) {
+ if (!DESCRIPTORS)
+ return;
+ if (forced)
+ for (var ARRAY in TypedArrayConstructorsList) {
+ var TypedArrayConstructor = global[ARRAY];
+ if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) {
+ delete TypedArrayConstructor.prototype[KEY];
+ }
+ }
+ if (!TypedArrayPrototype[KEY] || forced) {
+ redefine(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property);
+ }
+};
+var exportTypedArrayStaticMethod = function (KEY, property, forced) {
+ var ARRAY, TypedArrayConstructor;
+ if (!DESCRIPTORS)
+ return;
+ if (setPrototypeOf) {
+ if (forced)
+ for (ARRAY in TypedArrayConstructorsList) {
+ TypedArrayConstructor = global[ARRAY];
+ if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) {
+ delete TypedArrayConstructor[KEY];
+ }
+ }
+ if (!TypedArray[KEY] || forced) {
+ try {
+ return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8Array[KEY] || property);
+ } catch (error) {
+ }
+ } else
+ return;
+ }
+ for (ARRAY in TypedArrayConstructorsList) {
+ TypedArrayConstructor = global[ARRAY];
+ if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
+ redefine(TypedArrayConstructor, KEY, property);
+ }
+ }
+};
+for (NAME in TypedArrayConstructorsList) {
+ if (!global[NAME])
+ NATIVE_ARRAY_BUFFER_VIEWS = false;
+}
+if (!NATIVE_ARRAY_BUFFER_VIEWS || typeof TypedArray != 'function' || TypedArray === Function.prototype) {
+ TypedArray = function TypedArray() {
+ throw TypeError('Incorrect invocation');
+ };
+ if (NATIVE_ARRAY_BUFFER_VIEWS)
+ for (NAME in TypedArrayConstructorsList) {
+ if (global[NAME])
+ setPrototypeOf(global[NAME], TypedArray);
+ }
+}
+if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
+ TypedArrayPrototype = TypedArray.prototype;
+ if (NATIVE_ARRAY_BUFFER_VIEWS)
+ for (NAME in TypedArrayConstructorsList) {
+ if (global[NAME])
+ setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
+ }
+}
+if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
+ setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
+}
+if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) {
+ TYPED_ARRAY_TAG_REQIRED = true;
+ defineProperty(TypedArrayPrototype, TO_STRING_TAG, {
+ get: function () {
+ return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
+ }
+ });
+ for (NAME in TypedArrayConstructorsList)
+ if (global[NAME]) {
+ createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
+ }
+}
+module.exports = {
+ NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
+ TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG,
+ aTypedArray: aTypedArray,
+ aTypedArrayConstructor: aTypedArrayConstructor,
+ exportTypedArrayMethod: exportTypedArrayMethod,
+ exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
+ isView: isView,
+ isTypedArray: isTypedArray,
+ TypedArray: TypedArray,
+ TypedArrayPrototype: TypedArrayPrototype
+};
+
+/***/ }),
+/* 111 */
+/***/ (function(module, exports) {
+
+module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined';
+
+/***/ }),
+/* 112 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var anObject = __w_pdfjs_require__(28);
+var aFunction = __w_pdfjs_require__(63);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var SPECIES = wellKnownSymbol('species');
+module.exports = function (O, defaultConstructor) {
+ var C = anObject(O).constructor;
+ var S;
+ return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
+};
+
+/***/ }),
+/* 113 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(114);
+__w_pdfjs_require__(77);
+__w_pdfjs_require__(116);
+__w_pdfjs_require__(119);
+__w_pdfjs_require__(134);
+__w_pdfjs_require__(135);
+var path = __w_pdfjs_require__(43);
+module.exports = path.Promise;
+
+/***/ }),
+/* 114 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(96);
+var redefine = __w_pdfjs_require__(29);
+var toString = __w_pdfjs_require__(115);
+if (!TO_STRING_TAG_SUPPORT) {
+ redefine(Object.prototype, 'toString', toString, { unsafe: true });
+}
+
+/***/ }),
+/* 115 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(96);
+var classof = __w_pdfjs_require__(95);
+module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
+ return '[object ' + classof(this) + ']';
+};
+
+/***/ }),
+/* 116 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var DOMIterables = __w_pdfjs_require__(117);
+var ArrayIteratorMethods = __w_pdfjs_require__(118);
+var createNonEnumerableProperty = __w_pdfjs_require__(26);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var ITERATOR = wellKnownSymbol('iterator');
+var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+var ArrayValues = ArrayIteratorMethods.values;
+for (var COLLECTION_NAME in DOMIterables) {
+ var Collection = global[COLLECTION_NAME];
+ var CollectionPrototype = Collection && Collection.prototype;
+ if (CollectionPrototype) {
+ if (CollectionPrototype[ITERATOR] !== ArrayValues)
+ try {
+ createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
+ } catch (error) {
+ CollectionPrototype[ITERATOR] = ArrayValues;
+ }
+ if (!CollectionPrototype[TO_STRING_TAG]) {
+ createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
+ }
+ if (DOMIterables[COLLECTION_NAME])
+ for (var METHOD_NAME in ArrayIteratorMethods) {
+ if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME])
+ try {
+ createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
+ } catch (error) {
+ CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
+ }
+ }
+ }
+}
+
+/***/ }),
+/* 117 */
+/***/ (function(module, exports) {
+
+module.exports = {
+ CSSRuleList: 0,
+ CSSStyleDeclaration: 0,
+ CSSValueList: 0,
+ ClientRectList: 0,
+ DOMRectList: 0,
+ DOMStringList: 0,
+ DOMTokenList: 1,
+ DataTransferItemList: 0,
+ FileList: 0,
+ HTMLAllCollection: 0,
+ HTMLCollection: 0,
+ HTMLFormElement: 0,
+ HTMLSelectElement: 0,
+ MediaList: 0,
+ MimeTypeArray: 0,
+ NamedNodeMap: 0,
+ NodeList: 1,
+ PaintRequestList: 0,
+ Plugin: 0,
+ PluginArray: 0,
+ SVGLengthList: 0,
+ SVGNumberList: 0,
+ SVGPathSegList: 0,
+ SVGPointList: 0,
+ SVGStringList: 0,
+ SVGTransformList: 0,
+ SourceBufferList: 0,
+ StyleSheetList: 0,
+ TextTrackCueList: 0,
+ TextTrackList: 0,
+ TouchList: 0
+};
+
+/***/ }),
+/* 118 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var toIndexedObject = __w_pdfjs_require__(17);
+var addToUnscopables = __w_pdfjs_require__(70);
+var Iterators = __w_pdfjs_require__(86);
+var InternalStateModule = __w_pdfjs_require__(33);
+var defineIterator = __w_pdfjs_require__(79);
+var ARRAY_ITERATOR = 'Array Iterator';
+var setInternalState = InternalStateModule.set;
+var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
+module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
+ setInternalState(this, {
+ type: ARRAY_ITERATOR,
+ target: toIndexedObject(iterated),
+ index: 0,
+ kind: kind
+ });
+}, function () {
+ var state = getInternalState(this);
+ var target = state.target;
+ var kind = state.kind;
+ var index = state.index++;
+ if (!target || index >= target.length) {
+ state.target = undefined;
+ return {
+ value: undefined,
+ done: true
+ };
+ }
+ if (kind == 'keys')
+ return {
+ value: index,
+ done: false
+ };
+ if (kind == 'values')
+ return {
+ value: target[index],
+ done: false
+ };
+ return {
+ value: [
+ index,
+ target[index]
+ ],
+ done: false
+ };
+}, 'values');
+Iterators.Arguments = Iterators.Array;
+addToUnscopables('keys');
+addToUnscopables('values');
+addToUnscopables('entries');
+
+/***/ }),
+/* 119 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var IS_PURE = __w_pdfjs_require__(37);
+var global = __w_pdfjs_require__(11);
+var getBuiltIn = __w_pdfjs_require__(42);
+var NativePromise = __w_pdfjs_require__(120);
+var redefine = __w_pdfjs_require__(29);
+var redefineAll = __w_pdfjs_require__(121);
+var setToStringTag = __w_pdfjs_require__(85);
+var setSpecies = __w_pdfjs_require__(122);
+var isObject = __w_pdfjs_require__(22);
+var aFunction = __w_pdfjs_require__(63);
+var anInstance = __w_pdfjs_require__(123);
+var classof = __w_pdfjs_require__(19);
+var inspectSource = __w_pdfjs_require__(31);
+var iterate = __w_pdfjs_require__(124);
+var checkCorrectnessOfIteration = __w_pdfjs_require__(97);
+var speciesConstructor = __w_pdfjs_require__(112);
+var task = __w_pdfjs_require__(125).set;
+var microtask = __w_pdfjs_require__(128);
+var promiseResolve = __w_pdfjs_require__(129);
+var hostReportErrors = __w_pdfjs_require__(131);
+var newPromiseCapabilityModule = __w_pdfjs_require__(130);
+var perform = __w_pdfjs_require__(132);
+var InternalStateModule = __w_pdfjs_require__(33);
+var isForced = __w_pdfjs_require__(52);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var V8_VERSION = __w_pdfjs_require__(133);
+var SPECIES = wellKnownSymbol('species');
+var PROMISE = 'Promise';
+var getInternalState = InternalStateModule.get;
+var setInternalState = InternalStateModule.set;
+var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
+var PromiseConstructor = NativePromise;
+var TypeError = global.TypeError;
+var document = global.document;
+var process = global.process;
+var $fetch = getBuiltIn('fetch');
+var newPromiseCapability = newPromiseCapabilityModule.f;
+var newGenericPromiseCapability = newPromiseCapability;
+var IS_NODE = classof(process) == 'process';
+var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
+var UNHANDLED_REJECTION = 'unhandledrejection';
+var REJECTION_HANDLED = 'rejectionhandled';
+var PENDING = 0;
+var FULFILLED = 1;
+var REJECTED = 2;
+var HANDLED = 1;
+var UNHANDLED = 2;
+var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
+var FORCED = isForced(PROMISE, function () {
+ var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
+ if (!GLOBAL_CORE_JS_PROMISE) {
+ if (V8_VERSION === 66)
+ return true;
+ if (!IS_NODE && typeof PromiseRejectionEvent != 'function')
+ return true;
+ }
+ if (IS_PURE && !PromiseConstructor.prototype['finally'])
+ return true;
+ if (V8_VERSION >= 51 && /native code/.test(PromiseConstructor))
+ return false;
+ var promise = PromiseConstructor.resolve(1);
+ var FakePromise = function (exec) {
+ exec(function () {
+ }, function () {
+ });
+ };
+ var constructor = promise.constructor = {};
+ constructor[SPECIES] = FakePromise;
+ return !(promise.then(function () {
+ }) instanceof FakePromise);
+});
+var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
+ PromiseConstructor.all(iterable)['catch'](function () {
+ });
+});
+var isThenable = function (it) {
+ var then;
+ return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
+};
+var notify = function (promise, state, isReject) {
+ if (state.notified)
+ return;
+ state.notified = true;
+ var chain = state.reactions;
+ microtask(function () {
+ var value = state.value;
+ var ok = state.state == FULFILLED;
+ var index = 0;
+ while (chain.length > index) {
+ var reaction = chain[index++];
+ var handler = ok ? reaction.ok : reaction.fail;
+ var resolve = reaction.resolve;
+ var reject = reaction.reject;
+ var domain = reaction.domain;
+ var result, then, exited;
+ try {
+ if (handler) {
+ if (!ok) {
+ if (state.rejection === UNHANDLED)
+ onHandleUnhandled(promise, state);
+ state.rejection = HANDLED;
+ }
+ if (handler === true)
+ result = value;
+ else {
+ if (domain)
+ domain.enter();
+ result = handler(value);
+ if (domain) {
+ domain.exit();
+ exited = true;
+ }
+ }
+ if (result === reaction.promise) {
+ reject(TypeError('Promise-chain cycle'));
+ } else if (then = isThenable(result)) {
+ then.call(result, resolve, reject);
+ } else
+ resolve(result);
+ } else
+ reject(value);
+ } catch (error) {
+ if (domain && !exited)
+ domain.exit();
+ reject(error);
+ }
+ }
+ state.reactions = [];
+ state.notified = false;
+ if (isReject && !state.rejection)
+ onUnhandled(promise, state);
+ });
+};
+var dispatchEvent = function (name, promise, reason) {
+ var event, handler;
+ if (DISPATCH_EVENT) {
+ event = document.createEvent('Event');
+ event.promise = promise;
+ event.reason = reason;
+ event.initEvent(name, false, true);
+ global.dispatchEvent(event);
+ } else
+ event = {
+ promise: promise,
+ reason: reason
+ };
+ if (handler = global['on' + name])
+ handler(event);
+ else if (name === UNHANDLED_REJECTION)
+ hostReportErrors('Unhandled promise rejection', reason);
+};
+var onUnhandled = function (promise, state) {
+ task.call(global, function () {
+ var value = state.value;
+ var IS_UNHANDLED = isUnhandled(state);
+ var result;
+ if (IS_UNHANDLED) {
+ result = perform(function () {
+ if (IS_NODE) {
+ process.emit('unhandledRejection', value, promise);
+ } else
+ dispatchEvent(UNHANDLED_REJECTION, promise, value);
+ });
+ state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
+ if (result.error)
+ throw result.value;
+ }
+ });
+};
+var isUnhandled = function (state) {
+ return state.rejection !== HANDLED && !state.parent;
+};
+var onHandleUnhandled = function (promise, state) {
+ task.call(global, function () {
+ if (IS_NODE) {
+ process.emit('rejectionHandled', promise);
+ } else
+ dispatchEvent(REJECTION_HANDLED, promise, state.value);
+ });
+};
+var bind = function (fn, promise, state, unwrap) {
+ return function (value) {
+ fn(promise, state, value, unwrap);
+ };
+};
+var internalReject = function (promise, state, value, unwrap) {
+ if (state.done)
+ return;
+ state.done = true;
+ if (unwrap)
+ state = unwrap;
+ state.value = value;
+ state.state = REJECTED;
+ notify(promise, state, true);
+};
+var internalResolve = function (promise, state, value, unwrap) {
+ if (state.done)
+ return;
+ state.done = true;
+ if (unwrap)
+ state = unwrap;
+ try {
+ if (promise === value)
+ throw TypeError("Promise can't be resolved itself");
+ var then = isThenable(value);
+ if (then) {
+ microtask(function () {
+ var wrapper = { done: false };
+ try {
+ then.call(value, bind(internalResolve, promise, wrapper, state), bind(internalReject, promise, wrapper, state));
+ } catch (error) {
+ internalReject(promise, wrapper, error, state);
+ }
+ });
+ } else {
+ state.value = value;
+ state.state = FULFILLED;
+ notify(promise, state, false);
+ }
+ } catch (error) {
+ internalReject(promise, { done: false }, error, state);
+ }
+};
+if (FORCED) {
+ PromiseConstructor = function Promise(executor) {
+ anInstance(this, PromiseConstructor, PROMISE);
+ aFunction(executor);
+ Internal.call(this);
+ var state = getInternalState(this);
+ try {
+ executor(bind(internalResolve, this, state), bind(internalReject, this, state));
+ } catch (error) {
+ internalReject(this, state, error);
+ }
+ };
+ Internal = function Promise(executor) {
+ setInternalState(this, {
+ type: PROMISE,
+ done: false,
+ notified: false,
+ parent: false,
+ reactions: [],
+ rejection: false,
+ state: PENDING,
+ value: undefined
+ });
+ };
+ Internal.prototype = redefineAll(PromiseConstructor.prototype, {
+ then: function then(onFulfilled, onRejected) {
+ var state = getInternalPromiseState(this);
+ var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
+ reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
+ reaction.fail = typeof onRejected == 'function' && onRejected;
+ reaction.domain = IS_NODE ? process.domain : undefined;
+ state.parent = true;
+ state.reactions.push(reaction);
+ if (state.state != PENDING)
+ notify(this, state, false);
+ return reaction.promise;
+ },
+ 'catch': function (onRejected) {
+ return this.then(undefined, onRejected);
+ }
+ });
+ OwnPromiseCapability = function () {
+ var promise = new Internal();
+ var state = getInternalState(promise);
+ this.promise = promise;
+ this.resolve = bind(internalResolve, promise, state);
+ this.reject = bind(internalReject, promise, state);
+ };
+ newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
+ return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C);
+ };
+ if (!IS_PURE && typeof NativePromise == 'function') {
+ nativeThen = NativePromise.prototype.then;
+ redefine(NativePromise.prototype, 'then', function then(onFulfilled, onRejected) {
+ var that = this;
+ return new PromiseConstructor(function (resolve, reject) {
+ nativeThen.call(that, resolve, reject);
+ }).then(onFulfilled, onRejected);
+ }, { unsafe: true });
+ if (typeof $fetch == 'function')
+ $({
+ global: true,
+ enumerable: true,
+ forced: true
+ }, {
+ fetch: function fetch(input) {
+ return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments));
+ }
+ });
+ }
+}
+$({
+ global: true,
+ wrap: true,
+ forced: FORCED
+}, { Promise: PromiseConstructor });
+setToStringTag(PromiseConstructor, PROMISE, false, true);
+setSpecies(PROMISE);
+PromiseWrapper = getBuiltIn(PROMISE);
+$({
+ target: PROMISE,
+ stat: true,
+ forced: FORCED
+}, {
+ reject: function reject(r) {
+ var capability = newPromiseCapability(this);
+ capability.reject.call(undefined, r);
+ return capability.promise;
+ }
+});
+$({
+ target: PROMISE,
+ stat: true,
+ forced: IS_PURE || FORCED
+}, {
+ resolve: function resolve(x) {
+ return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x);
+ }
+});
+$({
+ target: PROMISE,
+ stat: true,
+ forced: INCORRECT_ITERATION
+}, {
+ all: function all(iterable) {
+ var C = this;
+ var capability = newPromiseCapability(C);
+ var resolve = capability.resolve;
+ var reject = capability.reject;
+ var result = perform(function () {
+ var $promiseResolve = aFunction(C.resolve);
+ var values = [];
+ var counter = 0;
+ var remaining = 1;
+ iterate(iterable, function (promise) {
+ var index = counter++;
+ var alreadyCalled = false;
+ values.push(undefined);
+ remaining++;
+ $promiseResolve.call(C, promise).then(function (value) {
+ if (alreadyCalled)
+ return;
+ alreadyCalled = true;
+ values[index] = value;
+ --remaining || resolve(values);
+ }, reject);
+ });
+ --remaining || resolve(values);
+ });
+ if (result.error)
+ reject(result.value);
+ return capability.promise;
+ },
+ race: function race(iterable) {
+ var C = this;
+ var capability = newPromiseCapability(C);
+ var reject = capability.reject;
+ var result = perform(function () {
+ var $promiseResolve = aFunction(C.resolve);
+ iterate(iterable, function (promise) {
+ $promiseResolve.call(C, promise).then(capability.resolve, reject);
+ });
+ });
+ if (result.error)
+ reject(result.value);
+ return capability.promise;
+ }
+});
+
+/***/ }),
+/* 120 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+module.exports = global.Promise;
+
+/***/ }),
+/* 121 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var redefine = __w_pdfjs_require__(29);
+module.exports = function (target, src, options) {
+ for (var key in src)
+ redefine(target, key, src[key], options);
+ return target;
+};
+
+/***/ }),
+/* 122 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var getBuiltIn = __w_pdfjs_require__(42);
+var definePropertyModule = __w_pdfjs_require__(27);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var SPECIES = wellKnownSymbol('species');
+module.exports = function (CONSTRUCTOR_NAME) {
+ var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
+ var defineProperty = definePropertyModule.f;
+ if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
+ defineProperty(Constructor, SPECIES, {
+ configurable: true,
+ get: function () {
+ return this;
+ }
+ });
+ }
+};
+
+/***/ }),
+/* 123 */
+/***/ (function(module, exports) {
+
+module.exports = function (it, Constructor, name) {
+ if (!(it instanceof Constructor)) {
+ throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
+ }
+ return it;
+};
+
+/***/ }),
+/* 124 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var anObject = __w_pdfjs_require__(28);
+var isArrayIteratorMethod = __w_pdfjs_require__(92);
+var toLength = __w_pdfjs_require__(47);
+var bind = __w_pdfjs_require__(62);
+var getIteratorMethod = __w_pdfjs_require__(94);
+var callWithSafeIterationClosing = __w_pdfjs_require__(91);
+var Result = function (stopped, result) {
+ this.stopped = stopped;
+ this.result = result;
+};
+var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
+ var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);
+ var iterator, iterFn, index, length, result, next, step;
+ if (IS_ITERATOR) {
+ iterator = iterable;
+ } else {
+ iterFn = getIteratorMethod(iterable);
+ if (typeof iterFn != 'function')
+ throw TypeError('Target is not iterable');
+ if (isArrayIteratorMethod(iterFn)) {
+ for (index = 0, length = toLength(iterable.length); length > index; index++) {
+ result = AS_ENTRIES ? boundFunction(anObject(step = iterable[index])[0], step[1]) : boundFunction(iterable[index]);
+ if (result && result instanceof Result)
+ return result;
+ }
+ return new Result(false);
+ }
+ iterator = iterFn.call(iterable);
+ }
+ next = iterator.next;
+ while (!(step = next.call(iterator)).done) {
+ result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);
+ if (typeof result == 'object' && result && result instanceof Result)
+ return result;
+ }
+ return new Result(false);
+};
+iterate.stop = function (result) {
+ return new Result(true, result);
+};
+
+/***/ }),
+/* 125 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var fails = __w_pdfjs_require__(14);
+var classof = __w_pdfjs_require__(19);
+var bind = __w_pdfjs_require__(62);
+var html = __w_pdfjs_require__(74);
+var createElement = __w_pdfjs_require__(25);
+var IS_IOS = __w_pdfjs_require__(126);
+var location = global.location;
+var set = global.setImmediate;
+var clear = global.clearImmediate;
+var process = global.process;
+var MessageChannel = global.MessageChannel;
+var Dispatch = global.Dispatch;
+var counter = 0;
+var queue = {};
+var ONREADYSTATECHANGE = 'onreadystatechange';
+var defer, channel, port;
+var run = function (id) {
+ if (queue.hasOwnProperty(id)) {
+ var fn = queue[id];
+ delete queue[id];
+ fn();
+ }
+};
+var runner = function (id) {
+ return function () {
+ run(id);
+ };
+};
+var listener = function (event) {
+ run(event.data);
+};
+var post = function (id) {
+ global.postMessage(id + '', location.protocol + '//' + location.host);
+};
+if (!set || !clear) {
+ set = function setImmediate(fn) {
+ var args = [];
+ var i = 1;
+ while (arguments.length > i)
+ args.push(arguments[i++]);
+ queue[++counter] = function () {
+ (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
+ };
+ defer(counter);
+ return counter;
+ };
+ clear = function clearImmediate(id) {
+ delete queue[id];
+ };
+ if (classof(process) == 'process') {
+ defer = function (id) {
+ process.nextTick(runner(id));
+ };
+ } else if (Dispatch && Dispatch.now) {
+ defer = function (id) {
+ Dispatch.now(runner(id));
+ };
+ } else if (MessageChannel && !IS_IOS) {
+ channel = new MessageChannel();
+ port = channel.port2;
+ channel.port1.onmessage = listener;
+ defer = bind(port.postMessage, port, 1);
+ } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts && !fails(post) && location.protocol !== 'file:') {
+ defer = post;
+ global.addEventListener('message', listener, false);
+ } else if (ONREADYSTATECHANGE in createElement('script')) {
+ defer = function (id) {
+ html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
+ html.removeChild(this);
+ run(id);
+ };
+ };
+ } else {
+ defer = function (id) {
+ setTimeout(runner(id), 0);
+ };
+ }
+}
+module.exports = {
+ set: set,
+ clear: clear
+};
+
+/***/ }),
+/* 126 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var userAgent = __w_pdfjs_require__(127);
+module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);
+
+/***/ }),
+/* 127 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var getBuiltIn = __w_pdfjs_require__(42);
+module.exports = getBuiltIn('navigator', 'userAgent') || '';
+
+/***/ }),
+/* 128 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f;
+var classof = __w_pdfjs_require__(19);
+var macrotask = __w_pdfjs_require__(125).set;
+var IS_IOS = __w_pdfjs_require__(126);
+var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
+var process = global.process;
+var Promise = global.Promise;
+var IS_NODE = classof(process) == 'process';
+var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
+var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
+var flush, head, last, notify, toggle, node, promise, then;
+if (!queueMicrotask) {
+ flush = function () {
+ var parent, fn;
+ if (IS_NODE && (parent = process.domain))
+ parent.exit();
+ while (head) {
+ fn = head.fn;
+ head = head.next;
+ try {
+ fn();
+ } catch (error) {
+ if (head)
+ notify();
+ else
+ last = undefined;
+ throw error;
+ }
+ }
+ last = undefined;
+ if (parent)
+ parent.enter();
+ };
+ if (IS_NODE) {
+ notify = function () {
+ process.nextTick(flush);
+ };
+ } else if (MutationObserver && !IS_IOS) {
+ toggle = true;
+ node = document.createTextNode('');
+ new MutationObserver(flush).observe(node, { characterData: true });
+ notify = function () {
+ node.data = toggle = !toggle;
+ };
+ } else if (Promise && Promise.resolve) {
+ promise = Promise.resolve(undefined);
+ then = promise.then;
+ notify = function () {
+ then.call(promise, flush);
+ };
+ } else {
+ notify = function () {
+ macrotask.call(global, flush);
+ };
+ }
+}
+module.exports = queueMicrotask || function (fn) {
+ var task = {
+ fn: fn,
+ next: undefined
+ };
+ if (last)
+ last.next = task;
+ if (!head) {
+ head = task;
+ notify();
+ }
+ last = task;
+};
+
+/***/ }),
+/* 129 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var anObject = __w_pdfjs_require__(28);
+var isObject = __w_pdfjs_require__(22);
+var newPromiseCapability = __w_pdfjs_require__(130);
+module.exports = function (C, x) {
+ anObject(C);
+ if (isObject(x) && x.constructor === C)
+ return x;
+ var promiseCapability = newPromiseCapability.f(C);
+ var resolve = promiseCapability.resolve;
+ resolve(x);
+ return promiseCapability.promise;
+};
+
+/***/ }),
+/* 130 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var aFunction = __w_pdfjs_require__(63);
+var PromiseCapability = function (C) {
+ var resolve, reject;
+ this.promise = new C(function ($$resolve, $$reject) {
+ if (resolve !== undefined || reject !== undefined)
+ throw TypeError('Bad Promise constructor');
+ resolve = $$resolve;
+ reject = $$reject;
+ });
+ this.resolve = aFunction(resolve);
+ this.reject = aFunction(reject);
+};
+module.exports.f = function (C) {
+ return new PromiseCapability(C);
+};
+
+/***/ }),
+/* 131 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+module.exports = function (a, b) {
+ var console = global.console;
+ if (console && console.error) {
+ arguments.length === 1 ? console.error(a) : console.error(a, b);
+ }
+};
+
+/***/ }),
+/* 132 */
+/***/ (function(module, exports) {
+
+module.exports = function (exec) {
+ try {
+ return {
+ error: false,
+ value: exec()
+ };
+ } catch (error) {
+ return {
+ error: true,
+ value: error
+ };
+ }
+};
+
+/***/ }),
+/* 133 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var userAgent = __w_pdfjs_require__(127);
+var process = global.process;
+var versions = process && process.versions;
+var v8 = versions && versions.v8;
+var match, version;
+if (v8) {
+ match = v8.split('.');
+ version = match[0] + match[1];
+} else if (userAgent) {
+ match = userAgent.match(/Edge\/(\d+)/);
+ if (!match || match[1] >= 74) {
+ match = userAgent.match(/Chrome\/(\d+)/);
+ if (match)
+ version = match[1];
+ }
+}
+module.exports = version && +version;
+
+/***/ }),
+/* 134 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var aFunction = __w_pdfjs_require__(63);
+var newPromiseCapabilityModule = __w_pdfjs_require__(130);
+var perform = __w_pdfjs_require__(132);
+var iterate = __w_pdfjs_require__(124);
+$({
+ target: 'Promise',
+ stat: true
+}, {
+ allSettled: function allSettled(iterable) {
+ var C = this;
+ var capability = newPromiseCapabilityModule.f(C);
+ var resolve = capability.resolve;
+ var reject = capability.reject;
+ var result = perform(function () {
+ var promiseResolve = aFunction(C.resolve);
+ var values = [];
+ var counter = 0;
+ var remaining = 1;
+ iterate(iterable, function (promise) {
+ var index = counter++;
+ var alreadyCalled = false;
+ values.push(undefined);
+ remaining++;
+ promiseResolve.call(C, promise).then(function (value) {
+ if (alreadyCalled)
+ return;
+ alreadyCalled = true;
+ values[index] = {
+ status: 'fulfilled',
+ value: value
+ };
+ --remaining || resolve(values);
+ }, function (e) {
+ if (alreadyCalled)
+ return;
+ alreadyCalled = true;
+ values[index] = {
+ status: 'rejected',
+ reason: e
+ };
+ --remaining || resolve(values);
+ });
+ });
+ --remaining || resolve(values);
+ });
+ if (result.error)
+ reject(result.value);
+ return capability.promise;
+ }
+});
+
+/***/ }),
+/* 135 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var IS_PURE = __w_pdfjs_require__(37);
+var NativePromise = __w_pdfjs_require__(120);
+var fails = __w_pdfjs_require__(14);
+var getBuiltIn = __w_pdfjs_require__(42);
+var speciesConstructor = __w_pdfjs_require__(112);
+var promiseResolve = __w_pdfjs_require__(129);
+var redefine = __w_pdfjs_require__(29);
+var NON_GENERIC = !!NativePromise && fails(function () {
+ NativePromise.prototype['finally'].call({
+ then: function () {
+ }
+ }, function () {
+ });
+});
+$({
+ target: 'Promise',
+ proto: true,
+ real: true,
+ forced: NON_GENERIC
+}, {
+ 'finally': function (onFinally) {
+ var C = speciesConstructor(this, getBuiltIn('Promise'));
+ var isFunction = typeof onFinally == 'function';
+ return this.then(isFunction ? function (x) {
+ return promiseResolve(C, onFinally()).then(function () {
+ return x;
+ });
+ } : onFinally, isFunction ? function (e) {
+ return promiseResolve(C, onFinally()).then(function () {
+ throw e;
+ });
+ } : onFinally);
+ }
+});
+if (!IS_PURE && typeof NativePromise == 'function' && !NativePromise.prototype['finally']) {
+ redefine(NativePromise.prototype, 'finally', getBuiltIn('Promise').prototype['finally']);
+}
+
+/***/ }),
+/* 136 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(137);
+__w_pdfjs_require__(142);
+__w_pdfjs_require__(140);
+var path = __w_pdfjs_require__(43);
+module.exports = path.URL;
+
+/***/ }),
+/* 137 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+__w_pdfjs_require__(77);
+var $ = __w_pdfjs_require__(10);
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var USE_NATIVE_URL = __w_pdfjs_require__(138);
+var global = __w_pdfjs_require__(11);
+var defineProperties = __w_pdfjs_require__(72);
+var redefine = __w_pdfjs_require__(29);
+var anInstance = __w_pdfjs_require__(123);
+var has = __w_pdfjs_require__(23);
+var assign = __w_pdfjs_require__(100);
+var arrayFrom = __w_pdfjs_require__(90);
+var codeAt = __w_pdfjs_require__(78).codeAt;
+var toASCII = __w_pdfjs_require__(139);
+var setToStringTag = __w_pdfjs_require__(85);
+var URLSearchParamsModule = __w_pdfjs_require__(140);
+var InternalStateModule = __w_pdfjs_require__(33);
+var NativeURL = global.URL;
+var URLSearchParams = URLSearchParamsModule.URLSearchParams;
+var getInternalSearchParamsState = URLSearchParamsModule.getState;
+var setInternalState = InternalStateModule.set;
+var getInternalURLState = InternalStateModule.getterFor('URL');
+var floor = Math.floor;
+var pow = Math.pow;
+var INVALID_AUTHORITY = 'Invalid authority';
+var INVALID_SCHEME = 'Invalid scheme';
+var INVALID_HOST = 'Invalid host';
+var INVALID_PORT = 'Invalid port';
+var ALPHA = /[A-Za-z]/;
+var ALPHANUMERIC = /[\d+-.A-Za-z]/;
+var DIGIT = /\d/;
+var HEX_START = /^(0x|0X)/;
+var OCT = /^[0-7]+$/;
+var DEC = /^\d+$/;
+var HEX = /^[\dA-Fa-f]+$/;
+var FORBIDDEN_HOST_CODE_POINT = /[\u0000\u0009\u000A\u000D #%/:?@[\\]]/;
+var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\u0009\u000A\u000D #/:?@[\\]]/;
+var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g;
+var TAB_AND_NEW_LINE = /[\u0009\u000A\u000D]/g;
+var EOF;
+var parseHost = function (url, input) {
+ var result, codePoints, index;
+ if (input.charAt(0) == '[') {
+ if (input.charAt(input.length - 1) != ']')
+ return INVALID_HOST;
+ result = parseIPv6(input.slice(1, -1));
+ if (!result)
+ return INVALID_HOST;
+ url.host = result;
+ } else if (!isSpecial(url)) {
+ if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input))
+ return INVALID_HOST;
+ result = '';
+ codePoints = arrayFrom(input);
+ for (index = 0; index < codePoints.length; index++) {
+ result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);
+ }
+ url.host = result;
+ } else {
+ input = toASCII(input);
+ if (FORBIDDEN_HOST_CODE_POINT.test(input))
+ return INVALID_HOST;
+ result = parseIPv4(input);
+ if (result === null)
+ return INVALID_HOST;
+ url.host = result;
+ }
+};
+var parseIPv4 = function (input) {
+ var parts = input.split('.');
+ var partsLength, numbers, index, part, radix, number, ipv4;
+ if (parts.length && parts[parts.length - 1] == '') {
+ parts.pop();
+ }
+ partsLength = parts.length;
+ if (partsLength > 4)
+ return input;
+ numbers = [];
+ for (index = 0; index < partsLength; index++) {
+ part = parts[index];
+ if (part == '')
+ return input;
+ radix = 10;
+ if (part.length > 1 && part.charAt(0) == '0') {
+ radix = HEX_START.test(part) ? 16 : 8;
+ part = part.slice(radix == 8 ? 1 : 2);
+ }
+ if (part === '') {
+ number = 0;
+ } else {
+ if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part))
+ return input;
+ number = parseInt(part, radix);
+ }
+ numbers.push(number);
+ }
+ for (index = 0; index < partsLength; index++) {
+ number = numbers[index];
+ if (index == partsLength - 1) {
+ if (number >= pow(256, 5 - partsLength))
+ return null;
+ } else if (number > 255)
+ return null;
+ }
+ ipv4 = numbers.pop();
+ for (index = 0; index < numbers.length; index++) {
+ ipv4 += numbers[index] * pow(256, 3 - index);
+ }
+ return ipv4;
+};
+var parseIPv6 = function (input) {
+ var address = [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ];
+ var pieceIndex = 0;
+ var compress = null;
+ var pointer = 0;
+ var value, length, numbersSeen, ipv4Piece, number, swaps, swap;
+ var char = function () {
+ return input.charAt(pointer);
+ };
+ if (char() == ':') {
+ if (input.charAt(1) != ':')
+ return;
+ pointer += 2;
+ pieceIndex++;
+ compress = pieceIndex;
+ }
+ while (char()) {
+ if (pieceIndex == 8)
+ return;
+ if (char() == ':') {
+ if (compress !== null)
+ return;
+ pointer++;
+ pieceIndex++;
+ compress = pieceIndex;
+ continue;
+ }
+ value = length = 0;
+ while (length < 4 && HEX.test(char())) {
+ value = value * 16 + parseInt(char(), 16);
+ pointer++;
+ length++;
+ }
+ if (char() == '.') {
+ if (length == 0)
+ return;
+ pointer -= length;
+ if (pieceIndex > 6)
+ return;
+ numbersSeen = 0;
+ while (char()) {
+ ipv4Piece = null;
+ if (numbersSeen > 0) {
+ if (char() == '.' && numbersSeen < 4)
+ pointer++;
+ else
+ return;
+ }
+ if (!DIGIT.test(char()))
+ return;
+ while (DIGIT.test(char())) {
+ number = parseInt(char(), 10);
+ if (ipv4Piece === null)
+ ipv4Piece = number;
+ else if (ipv4Piece == 0)
+ return;
+ else
+ ipv4Piece = ipv4Piece * 10 + number;
+ if (ipv4Piece > 255)
+ return;
+ pointer++;
+ }
+ address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;
+ numbersSeen++;
+ if (numbersSeen == 2 || numbersSeen == 4)
+ pieceIndex++;
+ }
+ if (numbersSeen != 4)
+ return;
+ break;
+ } else if (char() == ':') {
+ pointer++;
+ if (!char())
+ return;
+ } else if (char())
+ return;
+ address[pieceIndex++] = value;
+ }
+ if (compress !== null) {
+ swaps = pieceIndex - compress;
+ pieceIndex = 7;
+ while (pieceIndex != 0 && swaps > 0) {
+ swap = address[pieceIndex];
+ address[pieceIndex--] = address[compress + swaps - 1];
+ address[compress + --swaps] = swap;
+ }
+ } else if (pieceIndex != 8)
+ return;
+ return address;
+};
+var findLongestZeroSequence = function (ipv6) {
+ var maxIndex = null;
+ var maxLength = 1;
+ var currStart = null;
+ var currLength = 0;
+ var index = 0;
+ for (; index < 8; index++) {
+ if (ipv6[index] !== 0) {
+ if (currLength > maxLength) {
+ maxIndex = currStart;
+ maxLength = currLength;
+ }
+ currStart = null;
+ currLength = 0;
+ } else {
+ if (currStart === null)
+ currStart = index;
+ ++currLength;
+ }
+ }
+ if (currLength > maxLength) {
+ maxIndex = currStart;
+ maxLength = currLength;
+ }
+ return maxIndex;
+};
+var serializeHost = function (host) {
+ var result, index, compress, ignore0;
+ if (typeof host == 'number') {
+ result = [];
+ for (index = 0; index < 4; index++) {
+ result.unshift(host % 256);
+ host = floor(host / 256);
+ }
+ return result.join('.');
+ } else if (typeof host == 'object') {
+ result = '';
+ compress = findLongestZeroSequence(host);
+ for (index = 0; index < 8; index++) {
+ if (ignore0 && host[index] === 0)
+ continue;
+ if (ignore0)
+ ignore0 = false;
+ if (compress === index) {
+ result += index ? ':' : '::';
+ ignore0 = true;
+ } else {
+ result += host[index].toString(16);
+ if (index < 7)
+ result += ':';
+ }
+ }
+ return '[' + result + ']';
+ }
+ return host;
+};
+var C0ControlPercentEncodeSet = {};
+var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {
+ ' ': 1,
+ '"': 1,
+ '<': 1,
+ '>': 1,
+ '`': 1
+});
+var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, {
+ '#': 1,
+ '?': 1,
+ '{': 1,
+ '}': 1
+});
+var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, {
+ '/': 1,
+ ':': 1,
+ ';': 1,
+ '=': 1,
+ '@': 1,
+ '[': 1,
+ '\\': 1,
+ ']': 1,
+ '^': 1,
+ '|': 1
+});
+var percentEncode = function (char, set) {
+ var code = codeAt(char, 0);
+ return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char);
+};
+var specialSchemes = {
+ ftp: 21,
+ file: null,
+ http: 80,
+ https: 443,
+ ws: 80,
+ wss: 443
+};
+var isSpecial = function (url) {
+ return has(specialSchemes, url.scheme);
+};
+var includesCredentials = function (url) {
+ return url.username != '' || url.password != '';
+};
+var cannotHaveUsernamePasswordPort = function (url) {
+ return !url.host || url.cannotBeABaseURL || url.scheme == 'file';
+};
+var isWindowsDriveLetter = function (string, normalized) {
+ var second;
+ return string.length == 2 && ALPHA.test(string.charAt(0)) && ((second = string.charAt(1)) == ':' || !normalized && second == '|');
+};
+var startsWithWindowsDriveLetter = function (string) {
+ var third;
+ return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (string.length == 2 || ((third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#'));
+};
+var shortenURLsPath = function (url) {
+ var path = url.path;
+ var pathSize = path.length;
+ if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {
+ path.pop();
+ }
+};
+var isSingleDot = function (segment) {
+ return segment === '.' || segment.toLowerCase() === '%2e';
+};
+var isDoubleDot = function (segment) {
+ segment = segment.toLowerCase();
+ return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';
+};
+var SCHEME_START = {};
+var SCHEME = {};
+var NO_SCHEME = {};
+var SPECIAL_RELATIVE_OR_AUTHORITY = {};
+var PATH_OR_AUTHORITY = {};
+var RELATIVE = {};
+var RELATIVE_SLASH = {};
+var SPECIAL_AUTHORITY_SLASHES = {};
+var SPECIAL_AUTHORITY_IGNORE_SLASHES = {};
+var AUTHORITY = {};
+var HOST = {};
+var HOSTNAME = {};
+var PORT = {};
+var FILE = {};
+var FILE_SLASH = {};
+var FILE_HOST = {};
+var PATH_START = {};
+var PATH = {};
+var CANNOT_BE_A_BASE_URL_PATH = {};
+var QUERY = {};
+var FRAGMENT = {};
+var parseURL = function (url, input, stateOverride, base) {
+ var state = stateOverride || SCHEME_START;
+ var pointer = 0;
+ var buffer = '';
+ var seenAt = false;
+ var seenBracket = false;
+ var seenPasswordToken = false;
+ var codePoints, char, bufferCodePoints, failure;
+ if (!stateOverride) {
+ url.scheme = '';
+ url.username = '';
+ url.password = '';
+ url.host = null;
+ url.port = null;
+ url.path = [];
+ url.query = null;
+ url.fragment = null;
+ url.cannotBeABaseURL = false;
+ input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');
+ }
+ input = input.replace(TAB_AND_NEW_LINE, '');
+ codePoints = arrayFrom(input);
+ while (pointer <= codePoints.length) {
+ char = codePoints[pointer];
+ switch (state) {
+ case SCHEME_START:
+ if (char && ALPHA.test(char)) {
+ buffer += char.toLowerCase();
+ state = SCHEME;
+ } else if (!stateOverride) {
+ state = NO_SCHEME;
+ continue;
+ } else
+ return INVALID_SCHEME;
+ break;
+ case SCHEME:
+ if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) {
+ buffer += char.toLowerCase();
+ } else if (char == ':') {
+ if (stateOverride && (isSpecial(url) != has(specialSchemes, buffer) || buffer == 'file' && (includesCredentials(url) || url.port !== null) || url.scheme == 'file' && !url.host))
+ return;
+ url.scheme = buffer;
+ if (stateOverride) {
+ if (isSpecial(url) && specialSchemes[url.scheme] == url.port)
+ url.port = null;
+ return;
+ }
+ buffer = '';
+ if (url.scheme == 'file') {
+ state = FILE;
+ } else if (isSpecial(url) && base && base.scheme == url.scheme) {
+ state = SPECIAL_RELATIVE_OR_AUTHORITY;
+ } else if (isSpecial(url)) {
+ state = SPECIAL_AUTHORITY_SLASHES;
+ } else if (codePoints[pointer + 1] == '/') {
+ state = PATH_OR_AUTHORITY;
+ pointer++;
+ } else {
+ url.cannotBeABaseURL = true;
+ url.path.push('');
+ state = CANNOT_BE_A_BASE_URL_PATH;
+ }
+ } else if (!stateOverride) {
+ buffer = '';
+ state = NO_SCHEME;
+ pointer = 0;
+ continue;
+ } else
+ return INVALID_SCHEME;
+ break;
+ case NO_SCHEME:
+ if (!base || base.cannotBeABaseURL && char != '#')
+ return INVALID_SCHEME;
+ if (base.cannotBeABaseURL && char == '#') {
+ url.scheme = base.scheme;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ url.cannotBeABaseURL = true;
+ state = FRAGMENT;
+ break;
+ }
+ state = base.scheme == 'file' ? FILE : RELATIVE;
+ continue;
+ case SPECIAL_RELATIVE_OR_AUTHORITY:
+ if (char == '/' && codePoints[pointer + 1] == '/') {
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ pointer++;
+ } else {
+ state = RELATIVE;
+ continue;
+ }
+ break;
+ case PATH_OR_AUTHORITY:
+ if (char == '/') {
+ state = AUTHORITY;
+ break;
+ } else {
+ state = PATH;
+ continue;
+ }
+ case RELATIVE:
+ url.scheme = base.scheme;
+ if (char == EOF) {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = base.query;
+ } else if (char == '/' || char == '\\' && isSpecial(url)) {
+ state = RELATIVE_SLASH;
+ } else if (char == '?') {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ state = FRAGMENT;
+ } else {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.path.pop();
+ state = PATH;
+ continue;
+ }
+ break;
+ case RELATIVE_SLASH:
+ if (isSpecial(url) && (char == '/' || char == '\\')) {
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ } else if (char == '/') {
+ state = AUTHORITY;
+ } else {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ state = PATH;
+ continue;
+ }
+ break;
+ case SPECIAL_AUTHORITY_SLASHES:
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ if (char != '/' || buffer.charAt(pointer + 1) != '/')
+ continue;
+ pointer++;
+ break;
+ case SPECIAL_AUTHORITY_IGNORE_SLASHES:
+ if (char != '/' && char != '\\') {
+ state = AUTHORITY;
+ continue;
+ }
+ break;
+ case AUTHORITY:
+ if (char == '@') {
+ if (seenAt)
+ buffer = '%40' + buffer;
+ seenAt = true;
+ bufferCodePoints = arrayFrom(buffer);
+ for (var i = 0; i < bufferCodePoints.length; i++) {
+ var codePoint = bufferCodePoints[i];
+ if (codePoint == ':' && !seenPasswordToken) {
+ seenPasswordToken = true;
+ continue;
+ }
+ var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);
+ if (seenPasswordToken)
+ url.password += encodedCodePoints;
+ else
+ url.username += encodedCodePoints;
+ }
+ buffer = '';
+ } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url)) {
+ if (seenAt && buffer == '')
+ return INVALID_AUTHORITY;
+ pointer -= arrayFrom(buffer).length + 1;
+ buffer = '';
+ state = HOST;
+ } else
+ buffer += char;
+ break;
+ case HOST:
+ case HOSTNAME:
+ if (stateOverride && url.scheme == 'file') {
+ state = FILE_HOST;
+ continue;
+ } else if (char == ':' && !seenBracket) {
+ if (buffer == '')
+ return INVALID_HOST;
+ failure = parseHost(url, buffer);
+ if (failure)
+ return failure;
+ buffer = '';
+ state = PORT;
+ if (stateOverride == HOSTNAME)
+ return;
+ } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url)) {
+ if (isSpecial(url) && buffer == '')
+ return INVALID_HOST;
+ if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null))
+ return;
+ failure = parseHost(url, buffer);
+ if (failure)
+ return failure;
+ buffer = '';
+ state = PATH_START;
+ if (stateOverride)
+ return;
+ continue;
+ } else {
+ if (char == '[')
+ seenBracket = true;
+ else if (char == ']')
+ seenBracket = false;
+ buffer += char;
+ }
+ break;
+ case PORT:
+ if (DIGIT.test(char)) {
+ buffer += char;
+ } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url) || stateOverride) {
+ if (buffer != '') {
+ var port = parseInt(buffer, 10);
+ if (port > 0xFFFF)
+ return INVALID_PORT;
+ url.port = isSpecial(url) && port === specialSchemes[url.scheme] ? null : port;
+ buffer = '';
+ }
+ if (stateOverride)
+ return;
+ state = PATH_START;
+ continue;
+ } else
+ return INVALID_PORT;
+ break;
+ case FILE:
+ url.scheme = 'file';
+ if (char == '/' || char == '\\')
+ state = FILE_SLASH;
+ else if (base && base.scheme == 'file') {
+ if (char == EOF) {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = base.query;
+ } else if (char == '?') {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ state = FRAGMENT;
+ } else {
+ if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
+ url.host = base.host;
+ url.path = base.path.slice();
+ shortenURLsPath(url);
+ }
+ state = PATH;
+ continue;
+ }
+ } else {
+ state = PATH;
+ continue;
+ }
+ break;
+ case FILE_SLASH:
+ if (char == '/' || char == '\\') {
+ state = FILE_HOST;
+ break;
+ }
+ if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
+ if (isWindowsDriveLetter(base.path[0], true))
+ url.path.push(base.path[0]);
+ else
+ url.host = base.host;
+ }
+ state = PATH;
+ continue;
+ case FILE_HOST:
+ if (char == EOF || char == '/' || char == '\\' || char == '?' || char == '#') {
+ if (!stateOverride && isWindowsDriveLetter(buffer)) {
+ state = PATH;
+ } else if (buffer == '') {
+ url.host = '';
+ if (stateOverride)
+ return;
+ state = PATH_START;
+ } else {
+ failure = parseHost(url, buffer);
+ if (failure)
+ return failure;
+ if (url.host == 'localhost')
+ url.host = '';
+ if (stateOverride)
+ return;
+ buffer = '';
+ state = PATH_START;
+ }
+ continue;
+ } else
+ buffer += char;
+ break;
+ case PATH_START:
+ if (isSpecial(url)) {
+ state = PATH;
+ if (char != '/' && char != '\\')
+ continue;
+ } else if (!stateOverride && char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (!stateOverride && char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ state = PATH;
+ if (char != '/')
+ continue;
+ }
+ break;
+ case PATH:
+ if (char == EOF || char == '/' || char == '\\' && isSpecial(url) || !stateOverride && (char == '?' || char == '#')) {
+ if (isDoubleDot(buffer)) {
+ shortenURLsPath(url);
+ if (char != '/' && !(char == '\\' && isSpecial(url))) {
+ url.path.push('');
+ }
+ } else if (isSingleDot(buffer)) {
+ if (char != '/' && !(char == '\\' && isSpecial(url))) {
+ url.path.push('');
+ }
+ } else {
+ if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {
+ if (url.host)
+ url.host = '';
+ buffer = buffer.charAt(0) + ':';
+ }
+ url.path.push(buffer);
+ }
+ buffer = '';
+ if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) {
+ while (url.path.length > 1 && url.path[0] === '') {
+ url.path.shift();
+ }
+ }
+ if (char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ }
+ } else {
+ buffer += percentEncode(char, pathPercentEncodeSet);
+ }
+ break;
+ case CANNOT_BE_A_BASE_URL_PATH:
+ if (char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ url.path[0] += percentEncode(char, C0ControlPercentEncodeSet);
+ }
+ break;
+ case QUERY:
+ if (!stateOverride && char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ if (char == "'" && isSpecial(url))
+ url.query += '%27';
+ else if (char == '#')
+ url.query += '%23';
+ else
+ url.query += percentEncode(char, C0ControlPercentEncodeSet);
+ }
+ break;
+ case FRAGMENT:
+ if (char != EOF)
+ url.fragment += percentEncode(char, fragmentPercentEncodeSet);
+ break;
+ }
+ pointer++;
+ }
+};
+var URLConstructor = function URL(url) {
+ var that = anInstance(this, URLConstructor, 'URL');
+ var base = arguments.length > 1 ? arguments[1] : undefined;
+ var urlString = String(url);
+ var state = setInternalState(that, { type: 'URL' });
+ var baseState, failure;
+ if (base !== undefined) {
+ if (base instanceof URLConstructor)
+ baseState = getInternalURLState(base);
+ else {
+ failure = parseURL(baseState = {}, String(base));
+ if (failure)
+ throw TypeError(failure);
+ }
+ }
+ failure = parseURL(state, urlString, null, baseState);
+ if (failure)
+ throw TypeError(failure);
+ var searchParams = state.searchParams = new URLSearchParams();
+ var searchParamsState = getInternalSearchParamsState(searchParams);
+ searchParamsState.updateSearchParams(state.query);
+ searchParamsState.updateURL = function () {
+ state.query = String(searchParams) || null;
+ };
+ if (!DESCRIPTORS) {
+ that.href = serializeURL.call(that);
+ that.origin = getOrigin.call(that);
+ that.protocol = getProtocol.call(that);
+ that.username = getUsername.call(that);
+ that.password = getPassword.call(that);
+ that.host = getHost.call(that);
+ that.hostname = getHostname.call(that);
+ that.port = getPort.call(that);
+ that.pathname = getPathname.call(that);
+ that.search = getSearch.call(that);
+ that.searchParams = getSearchParams.call(that);
+ that.hash = getHash.call(that);
+ }
+};
+var URLPrototype = URLConstructor.prototype;
+var serializeURL = function () {
+ var url = getInternalURLState(this);
+ var scheme = url.scheme;
+ var username = url.username;
+ var password = url.password;
+ var host = url.host;
+ var port = url.port;
+ var path = url.path;
+ var query = url.query;
+ var fragment = url.fragment;
+ var output = scheme + ':';
+ if (host !== null) {
+ output += '//';
+ if (includesCredentials(url)) {
+ output += username + (password ? ':' + password : '') + '@';
+ }
+ output += serializeHost(host);
+ if (port !== null)
+ output += ':' + port;
+ } else if (scheme == 'file')
+ output += '//';
+ output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
+ if (query !== null)
+ output += '?' + query;
+ if (fragment !== null)
+ output += '#' + fragment;
+ return output;
+};
+var getOrigin = function () {
+ var url = getInternalURLState(this);
+ var scheme = url.scheme;
+ var port = url.port;
+ if (scheme == 'blob')
+ try {
+ return new URL(scheme.path[0]).origin;
+ } catch (error) {
+ return 'null';
+ }
+ if (scheme == 'file' || !isSpecial(url))
+ return 'null';
+ return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : '');
+};
+var getProtocol = function () {
+ return getInternalURLState(this).scheme + ':';
+};
+var getUsername = function () {
+ return getInternalURLState(this).username;
+};
+var getPassword = function () {
+ return getInternalURLState(this).password;
+};
+var getHost = function () {
+ var url = getInternalURLState(this);
+ var host = url.host;
+ var port = url.port;
+ return host === null ? '' : port === null ? serializeHost(host) : serializeHost(host) + ':' + port;
+};
+var getHostname = function () {
+ var host = getInternalURLState(this).host;
+ return host === null ? '' : serializeHost(host);
+};
+var getPort = function () {
+ var port = getInternalURLState(this).port;
+ return port === null ? '' : String(port);
+};
+var getPathname = function () {
+ var url = getInternalURLState(this);
+ var path = url.path;
+ return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
+};
+var getSearch = function () {
+ var query = getInternalURLState(this).query;
+ return query ? '?' + query : '';
+};
+var getSearchParams = function () {
+ return getInternalURLState(this).searchParams;
+};
+var getHash = function () {
+ var fragment = getInternalURLState(this).fragment;
+ return fragment ? '#' + fragment : '';
+};
+var accessorDescriptor = function (getter, setter) {
+ return {
+ get: getter,
+ set: setter,
+ configurable: true,
+ enumerable: true
+ };
+};
+if (DESCRIPTORS) {
+ defineProperties(URLPrototype, {
+ href: accessorDescriptor(serializeURL, function (href) {
+ var url = getInternalURLState(this);
+ var urlString = String(href);
+ var failure = parseURL(url, urlString);
+ if (failure)
+ throw TypeError(failure);
+ getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
+ }),
+ origin: accessorDescriptor(getOrigin),
+ protocol: accessorDescriptor(getProtocol, function (protocol) {
+ var url = getInternalURLState(this);
+ parseURL(url, String(protocol) + ':', SCHEME_START);
+ }),
+ username: accessorDescriptor(getUsername, function (username) {
+ var url = getInternalURLState(this);
+ var codePoints = arrayFrom(String(username));
+ if (cannotHaveUsernamePasswordPort(url))
+ return;
+ url.username = '';
+ for (var i = 0; i < codePoints.length; i++) {
+ url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);
+ }
+ }),
+ password: accessorDescriptor(getPassword, function (password) {
+ var url = getInternalURLState(this);
+ var codePoints = arrayFrom(String(password));
+ if (cannotHaveUsernamePasswordPort(url))
+ return;
+ url.password = '';
+ for (var i = 0; i < codePoints.length; i++) {
+ url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);
+ }
+ }),
+ host: accessorDescriptor(getHost, function (host) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL)
+ return;
+ parseURL(url, String(host), HOST);
+ }),
+ hostname: accessorDescriptor(getHostname, function (hostname) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL)
+ return;
+ parseURL(url, String(hostname), HOSTNAME);
+ }),
+ port: accessorDescriptor(getPort, function (port) {
+ var url = getInternalURLState(this);
+ if (cannotHaveUsernamePasswordPort(url))
+ return;
+ port = String(port);
+ if (port == '')
+ url.port = null;
+ else
+ parseURL(url, port, PORT);
+ }),
+ pathname: accessorDescriptor(getPathname, function (pathname) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL)
+ return;
+ url.path = [];
+ parseURL(url, pathname + '', PATH_START);
+ }),
+ search: accessorDescriptor(getSearch, function (search) {
+ var url = getInternalURLState(this);
+ search = String(search);
+ if (search == '') {
+ url.query = null;
+ } else {
+ if ('?' == search.charAt(0))
+ search = search.slice(1);
+ url.query = '';
+ parseURL(url, search, QUERY);
+ }
+ getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
+ }),
+ searchParams: accessorDescriptor(getSearchParams),
+ hash: accessorDescriptor(getHash, function (hash) {
+ var url = getInternalURLState(this);
+ hash = String(hash);
+ if (hash == '') {
+ url.fragment = null;
+ return;
+ }
+ if ('#' == hash.charAt(0))
+ hash = hash.slice(1);
+ url.fragment = '';
+ parseURL(url, hash, FRAGMENT);
+ })
+ });
+}
+redefine(URLPrototype, 'toJSON', function toJSON() {
+ return serializeURL.call(this);
+}, { enumerable: true });
+redefine(URLPrototype, 'toString', function toString() {
+ return serializeURL.call(this);
+}, { enumerable: true });
+if (NativeURL) {
+ var nativeCreateObjectURL = NativeURL.createObjectURL;
+ var nativeRevokeObjectURL = NativeURL.revokeObjectURL;
+ if (nativeCreateObjectURL)
+ redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) {
+ return nativeCreateObjectURL.apply(NativeURL, arguments);
+ });
+ if (nativeRevokeObjectURL)
+ redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) {
+ return nativeRevokeObjectURL.apply(NativeURL, arguments);
+ });
+}
+setToStringTag(URLConstructor, 'URL');
+$({
+ global: true,
+ forced: !USE_NATIVE_URL,
+ sham: !DESCRIPTORS
+}, { URL: URLConstructor });
+
+/***/ }),
+/* 138 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var fails = __w_pdfjs_require__(14);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var IS_PURE = __w_pdfjs_require__(37);
+var ITERATOR = wellKnownSymbol('iterator');
+module.exports = !fails(function () {
+ var url = new URL('b?a=1&b=2&c=3', 'http://a');
+ var searchParams = url.searchParams;
+ var result = '';
+ url.pathname = 'c%20d';
+ searchParams.forEach(function (value, key) {
+ searchParams['delete']('b');
+ result += key + value;
+ });
+ return IS_PURE && !url.toJSON || !searchParams.sort || url.href !== 'http://a/c%20d?a=1&c=3' || searchParams.get('c') !== '3' || String(new URLSearchParams('?a=1')) !== 'a=1' || !searchParams[ITERATOR] || new URL('https://a@b').username !== 'a' || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' || new URL('http://тест').host !== 'xn--e1aybc' || new URL('http://a#б').hash !== '#%D0%B1' || result !== 'a1c3' || new URL('http://x', undefined).host !== 'x';
+});
+
+/***/ }),
+/* 139 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var maxInt = 2147483647;
+var base = 36;
+var tMin = 1;
+var tMax = 26;
+var skew = 38;
+var damp = 700;
+var initialBias = 72;
+var initialN = 128;
+var delimiter = '-';
+var regexNonASCII = /[^\0-\u007E]/;
+var regexSeparators = /[.\u3002\uFF0E\uFF61]/g;
+var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';
+var baseMinusTMin = base - tMin;
+var floor = Math.floor;
+var stringFromCharCode = String.fromCharCode;
+var ucs2decode = function (string) {
+ var output = [];
+ var counter = 0;
+ var length = string.length;
+ while (counter < length) {
+ var value = string.charCodeAt(counter++);
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
+ var extra = string.charCodeAt(counter++);
+ if ((extra & 0xFC00) == 0xDC00) {
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
+ } else {
+ output.push(value);
+ counter--;
+ }
+ } else {
+ output.push(value);
+ }
+ }
+ return output;
+};
+var digitToBasic = function (digit) {
+ return digit + 22 + 75 * (digit < 26);
+};
+var adapt = function (delta, numPoints, firstTime) {
+ var k = 0;
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
+ delta += floor(delta / numPoints);
+ for (; delta > baseMinusTMin * tMax >> 1; k += base) {
+ delta = floor(delta / baseMinusTMin);
+ }
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
+};
+var encode = function (input) {
+ var output = [];
+ input = ucs2decode(input);
+ var inputLength = input.length;
+ var n = initialN;
+ var delta = 0;
+ var bias = initialBias;
+ var i, currentValue;
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue < 0x80) {
+ output.push(stringFromCharCode(currentValue));
+ }
+ }
+ var basicLength = output.length;
+ var handledCPCount = basicLength;
+ if (basicLength) {
+ output.push(delimiter);
+ }
+ while (handledCPCount < inputLength) {
+ var m = maxInt;
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue >= n && currentValue < m) {
+ m = currentValue;
+ }
+ }
+ var handledCPCountPlusOne = handledCPCount + 1;
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
+ throw RangeError(OVERFLOW_ERROR);
+ }
+ delta += (m - n) * handledCPCountPlusOne;
+ n = m;
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue < n && ++delta > maxInt) {
+ throw RangeError(OVERFLOW_ERROR);
+ }
+ if (currentValue == n) {
+ var q = delta;
+ for (var k = base;; k += base) {
+ var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
+ if (q < t)
+ break;
+ var qMinusT = q - t;
+ var baseMinusT = base - t;
+ output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT)));
+ q = floor(qMinusT / baseMinusT);
+ }
+ output.push(stringFromCharCode(digitToBasic(q)));
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
+ delta = 0;
+ ++handledCPCount;
+ }
+ }
+ ++delta;
+ ++n;
+ }
+ return output.join('');
+};
+module.exports = function (input) {
+ var encoded = [];
+ var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.');
+ var i, label;
+ for (i = 0; i < labels.length; i++) {
+ label = labels[i];
+ encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label);
+ }
+ return encoded.join('.');
+};
+
+/***/ }),
+/* 140 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+__w_pdfjs_require__(118);
+var $ = __w_pdfjs_require__(10);
+var getBuiltIn = __w_pdfjs_require__(42);
+var USE_NATIVE_URL = __w_pdfjs_require__(138);
+var redefine = __w_pdfjs_require__(29);
+var redefineAll = __w_pdfjs_require__(121);
+var setToStringTag = __w_pdfjs_require__(85);
+var createIteratorConstructor = __w_pdfjs_require__(80);
+var InternalStateModule = __w_pdfjs_require__(33);
+var anInstance = __w_pdfjs_require__(123);
+var hasOwn = __w_pdfjs_require__(23);
+var bind = __w_pdfjs_require__(62);
+var classof = __w_pdfjs_require__(95);
+var anObject = __w_pdfjs_require__(28);
+var isObject = __w_pdfjs_require__(22);
+var create = __w_pdfjs_require__(71);
+var createPropertyDescriptor = __w_pdfjs_require__(16);
+var getIterator = __w_pdfjs_require__(141);
+var getIteratorMethod = __w_pdfjs_require__(94);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var $fetch = getBuiltIn('fetch');
+var Headers = getBuiltIn('Headers');
+var ITERATOR = wellKnownSymbol('iterator');
+var URL_SEARCH_PARAMS = 'URLSearchParams';
+var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';
+var setInternalState = InternalStateModule.set;
+var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);
+var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR);
+var plus = /\+/g;
+var sequences = Array(4);
+var percentSequence = function (bytes) {
+ return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\da-f]{2}){' + bytes + '})', 'gi'));
+};
+var percentDecode = function (sequence) {
+ try {
+ return decodeURIComponent(sequence);
+ } catch (error) {
+ return sequence;
+ }
+};
+var deserialize = function (it) {
+ var result = it.replace(plus, ' ');
+ var bytes = 4;
+ try {
+ return decodeURIComponent(result);
+ } catch (error) {
+ while (bytes) {
+ result = result.replace(percentSequence(bytes--), percentDecode);
+ }
+ return result;
+ }
+};
+var find = /[!'()~]|%20/g;
+var replace = {
+ '!': '%21',
+ "'": '%27',
+ '(': '%28',
+ ')': '%29',
+ '~': '%7E',
+ '%20': '+'
+};
+var replacer = function (match) {
+ return replace[match];
+};
+var serialize = function (it) {
+ return encodeURIComponent(it).replace(find, replacer);
+};
+var parseSearchParams = function (result, query) {
+ if (query) {
+ var attributes = query.split('&');
+ var index = 0;
+ var attribute, entry;
+ while (index < attributes.length) {
+ attribute = attributes[index++];
+ if (attribute.length) {
+ entry = attribute.split('=');
+ result.push({
+ key: deserialize(entry.shift()),
+ value: deserialize(entry.join('='))
+ });
+ }
+ }
+ }
+};
+var updateSearchParams = function (query) {
+ this.entries.length = 0;
+ parseSearchParams(this.entries, query);
+};
+var validateArgumentsLength = function (passed, required) {
+ if (passed < required)
+ throw TypeError('Not enough arguments');
+};
+var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {
+ setInternalState(this, {
+ type: URL_SEARCH_PARAMS_ITERATOR,
+ iterator: getIterator(getInternalParamsState(params).entries),
+ kind: kind
+ });
+}, 'Iterator', function next() {
+ var state = getInternalIteratorState(this);
+ var kind = state.kind;
+ var step = state.iterator.next();
+ var entry = step.value;
+ if (!step.done) {
+ step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [
+ entry.key,
+ entry.value
+ ];
+ }
+ return step;
+});
+var URLSearchParamsConstructor = function URLSearchParams() {
+ anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);
+ var init = arguments.length > 0 ? arguments[0] : undefined;
+ var that = this;
+ var entries = [];
+ var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key;
+ setInternalState(that, {
+ type: URL_SEARCH_PARAMS,
+ entries: entries,
+ updateURL: function () {
+ },
+ updateSearchParams: updateSearchParams
+ });
+ if (init !== undefined) {
+ if (isObject(init)) {
+ iteratorMethod = getIteratorMethod(init);
+ if (typeof iteratorMethod === 'function') {
+ iterator = iteratorMethod.call(init);
+ next = iterator.next;
+ while (!(step = next.call(iterator)).done) {
+ entryIterator = getIterator(anObject(step.value));
+ entryNext = entryIterator.next;
+ if ((first = entryNext.call(entryIterator)).done || (second = entryNext.call(entryIterator)).done || !entryNext.call(entryIterator).done)
+ throw TypeError('Expected sequence with length 2');
+ entries.push({
+ key: first.value + '',
+ value: second.value + ''
+ });
+ }
+ } else
+ for (key in init)
+ if (hasOwn(init, key))
+ entries.push({
+ key: key,
+ value: init[key] + ''
+ });
+ } else {
+ parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');
+ }
+ }
+};
+var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
+redefineAll(URLSearchParamsPrototype, {
+ append: function append(name, value) {
+ validateArgumentsLength(arguments.length, 2);
+ var state = getInternalParamsState(this);
+ state.entries.push({
+ key: name + '',
+ value: value + ''
+ });
+ state.updateURL();
+ },
+ 'delete': function (name) {
+ validateArgumentsLength(arguments.length, 1);
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ var key = name + '';
+ var index = 0;
+ while (index < entries.length) {
+ if (entries[index].key === key)
+ entries.splice(index, 1);
+ else
+ index++;
+ }
+ state.updateURL();
+ },
+ get: function get(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var index = 0;
+ for (; index < entries.length; index++) {
+ if (entries[index].key === key)
+ return entries[index].value;
+ }
+ return null;
+ },
+ getAll: function getAll(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var result = [];
+ var index = 0;
+ for (; index < entries.length; index++) {
+ if (entries[index].key === key)
+ result.push(entries[index].value);
+ }
+ return result;
+ },
+ has: function has(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var index = 0;
+ while (index < entries.length) {
+ if (entries[index++].key === key)
+ return true;
+ }
+ return false;
+ },
+ set: function set(name, value) {
+ validateArgumentsLength(arguments.length, 1);
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ var found = false;
+ var key = name + '';
+ var val = value + '';
+ var index = 0;
+ var entry;
+ for (; index < entries.length; index++) {
+ entry = entries[index];
+ if (entry.key === key) {
+ if (found)
+ entries.splice(index--, 1);
+ else {
+ found = true;
+ entry.value = val;
+ }
+ }
+ }
+ if (!found)
+ entries.push({
+ key: key,
+ value: val
+ });
+ state.updateURL();
+ },
+ sort: function sort() {
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ var slice = entries.slice();
+ var entry, entriesIndex, sliceIndex;
+ entries.length = 0;
+ for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) {
+ entry = slice[sliceIndex];
+ for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) {
+ if (entries[entriesIndex].key > entry.key) {
+ entries.splice(entriesIndex, 0, entry);
+ break;
+ }
+ }
+ if (entriesIndex === sliceIndex)
+ entries.push(entry);
+ }
+ state.updateURL();
+ },
+ forEach: function forEach(callback) {
+ var entries = getInternalParamsState(this).entries;
+ var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3);
+ var index = 0;
+ var entry;
+ while (index < entries.length) {
+ entry = entries[index++];
+ boundFunction(entry.value, entry.key, this);
+ }
+ },
+ keys: function keys() {
+ return new URLSearchParamsIterator(this, 'keys');
+ },
+ values: function values() {
+ return new URLSearchParamsIterator(this, 'values');
+ },
+ entries: function entries() {
+ return new URLSearchParamsIterator(this, 'entries');
+ }
+}, { enumerable: true });
+redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries);
+redefine(URLSearchParamsPrototype, 'toString', function toString() {
+ var entries = getInternalParamsState(this).entries;
+ var result = [];
+ var index = 0;
+ var entry;
+ while (index < entries.length) {
+ entry = entries[index++];
+ result.push(serialize(entry.key) + '=' + serialize(entry.value));
+ }
+ return result.join('&');
+}, { enumerable: true });
+setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
+$({
+ global: true,
+ forced: !USE_NATIVE_URL
+}, { URLSearchParams: URLSearchParamsConstructor });
+if (!USE_NATIVE_URL && typeof $fetch == 'function' && typeof Headers == 'function') {
+ $({
+ global: true,
+ enumerable: true,
+ forced: true
+ }, {
+ fetch: function fetch(input) {
+ var args = [input];
+ var init, body, headers;
+ if (arguments.length > 1) {
+ init = arguments[1];
+ if (isObject(init)) {
+ body = init.body;
+ if (classof(body) === URL_SEARCH_PARAMS) {
+ headers = init.headers ? new Headers(init.headers) : new Headers();
+ if (!headers.has('content-type')) {
+ headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
+ }
+ init = create(init, {
+ body: createPropertyDescriptor(0, String(body)),
+ headers: createPropertyDescriptor(0, headers)
+ });
+ }
+ }
+ args.push(init);
+ }
+ return $fetch.apply(this, args);
+ }
+ });
+}
+module.exports = {
+ URLSearchParams: URLSearchParamsConstructor,
+ getState: getInternalParamsState
+};
+
+/***/ }),
+/* 141 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var anObject = __w_pdfjs_require__(28);
+var getIteratorMethod = __w_pdfjs_require__(94);
+module.exports = function (it) {
+ var iteratorMethod = getIteratorMethod(it);
+ if (typeof iteratorMethod != 'function') {
+ throw TypeError(String(it) + ' is not iterable');
+ }
+ return anObject(iteratorMethod.call(it));
+};
+
+/***/ }),
+/* 142 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+$({
+ target: 'URL',
+ proto: true,
+ enumerable: true
+}, {
+ toJSON: function toJSON() {
+ return URL.prototype.toString.call(this);
+ }
+});
+
+/***/ }),
+/* 143 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+(function (global, factory) {
+ true ? factory(exports) : undefined;
+}(this, function (exports) {
+ 'use strict';
+ var SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol : function (description) {
+ return "Symbol(" + description + ")";
+ };
+ function noop() {
+ }
+ var NumberIsNaN = Number.isNaN || function (x) {
+ return x !== x;
+ };
+ var rethrowAssertionErrorRejection = noop;
+ function typeIsObject(x) {
+ return typeof x === 'object' && x !== null || typeof x === 'function';
+ }
+ function createArrayFromList(elements) {
+ return elements.slice();
+ }
+ function ArrayBufferCopy(dest, destOffset, src, srcOffset, n) {
+ new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
+ }
+ function IsFiniteNonNegativeNumber(v) {
+ if (IsNonNegativeNumber(v) === false) {
+ return false;
+ }
+ if (v === Infinity) {
+ return false;
+ }
+ return true;
+ }
+ function IsNonNegativeNumber(v) {
+ if (typeof v !== 'number') {
+ return false;
+ }
+ if (NumberIsNaN(v)) {
+ return false;
+ }
+ if (v < 0) {
+ return false;
+ }
+ return true;
+ }
+ function Call(F, V, args) {
+ if (typeof F !== 'function') {
+ throw new TypeError('Argument is not a function');
+ }
+ return Function.prototype.apply.call(F, V, args);
+ }
+ function CreateAlgorithmFromUnderlyingMethod(underlyingObject, methodName, algoArgCount, extraArgs) {
+ var method = underlyingObject[methodName];
+ if (method !== undefined) {
+ if (typeof method !== 'function') {
+ throw new TypeError(method + " is not a method");
+ }
+ switch (algoArgCount) {
+ case 0: {
+ return function () {
+ return PromiseCall(method, underlyingObject, extraArgs);
+ };
+ }
+ case 1: {
+ return function (arg) {
+ var fullArgs = [arg].concat(extraArgs);
+ return PromiseCall(method, underlyingObject, fullArgs);
+ };
+ }
+ }
+ }
+ return function () {
+ return promiseResolvedWith(undefined);
+ };
+ }
+ function InvokeOrNoop(O, P, args) {
+ var method = O[P];
+ if (method === undefined) {
+ return undefined;
+ }
+ return Call(method, O, args);
+ }
+ function PromiseCall(F, V, args) {
+ try {
+ return promiseResolvedWith(Call(F, V, args));
+ } catch (value) {
+ return promiseRejectedWith(value);
+ }
+ }
+ function TransferArrayBuffer(O) {
+ return O;
+ }
+ function IsDetachedBuffer(O) {
+ return false;
+ }
+ function ValidateAndNormalizeHighWaterMark(highWaterMark) {
+ highWaterMark = Number(highWaterMark);
+ if (NumberIsNaN(highWaterMark) || highWaterMark < 0) {
+ throw new RangeError('highWaterMark property of a queuing strategy must be non-negative and non-NaN');
+ }
+ return highWaterMark;
+ }
+ function MakeSizeAlgorithmFromSizeFunction(size) {
+ if (size === undefined) {
+ return function () {
+ return 1;
+ };
+ }
+ if (typeof size !== 'function') {
+ throw new TypeError('size property of a queuing strategy must be a function');
+ }
+ return function (chunk) {
+ return size(chunk);
+ };
+ }
+ var originalPromise = Promise;
+ var originalPromiseThen = Promise.prototype.then;
+ var originalPromiseResolve = Promise.resolve.bind(originalPromise);
+ var originalPromiseReject = Promise.reject.bind(originalPromise);
+ function newPromise(executor) {
+ return new originalPromise(executor);
+ }
+ function promiseResolvedWith(value) {
+ return originalPromiseResolve(value);
+ }
+ function promiseRejectedWith(reason) {
+ return originalPromiseReject(reason);
+ }
+ function PerformPromiseThen(promise, onFulfilled, onRejected) {
+ return originalPromiseThen.call(promise, onFulfilled, onRejected);
+ }
+ function uponPromise(promise, onFulfilled, onRejected) {
+ PerformPromiseThen(PerformPromiseThen(promise, onFulfilled, onRejected), undefined, rethrowAssertionErrorRejection);
+ }
+ function uponFulfillment(promise, onFulfilled) {
+ uponPromise(promise, onFulfilled);
+ }
+ function uponRejection(promise, onRejected) {
+ uponPromise(promise, undefined, onRejected);
+ }
+ function transformPromiseWith(promise, fulfillmentHandler, rejectionHandler) {
+ return PerformPromiseThen(promise, fulfillmentHandler, rejectionHandler);
+ }
+ function setPromiseIsHandledToTrue(promise) {
+ PerformPromiseThen(promise, undefined, rethrowAssertionErrorRejection);
+ }
+ var QUEUE_MAX_ARRAY_SIZE = 16384;
+ var SimpleQueue = function () {
+ function SimpleQueue() {
+ this._cursor = 0;
+ this._size = 0;
+ this._front = {
+ _elements: [],
+ _next: undefined
+ };
+ this._back = this._front;
+ this._cursor = 0;
+ this._size = 0;
+ }
+ Object.defineProperty(SimpleQueue.prototype, "length", {
+ get: function () {
+ return this._size;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ SimpleQueue.prototype.push = function (element) {
+ var oldBack = this._back;
+ var newBack = oldBack;
+ if (oldBack._elements.length === QUEUE_MAX_ARRAY_SIZE - 1) {
+ newBack = {
+ _elements: [],
+ _next: undefined
+ };
+ }
+ oldBack._elements.push(element);
+ if (newBack !== oldBack) {
+ this._back = newBack;
+ oldBack._next = newBack;
+ }
+ ++this._size;
+ };
+ SimpleQueue.prototype.shift = function () {
+ var oldFront = this._front;
+ var newFront = oldFront;
+ var oldCursor = this._cursor;
+ var newCursor = oldCursor + 1;
+ var elements = oldFront._elements;
+ var element = elements[oldCursor];
+ if (newCursor === QUEUE_MAX_ARRAY_SIZE) {
+ newFront = oldFront._next;
+ newCursor = 0;
+ }
+ --this._size;
+ this._cursor = newCursor;
+ if (oldFront !== newFront) {
+ this._front = newFront;
+ }
+ elements[oldCursor] = undefined;
+ return element;
+ };
+ SimpleQueue.prototype.forEach = function (callback) {
+ var i = this._cursor;
+ var node = this._front;
+ var elements = node._elements;
+ while (i !== elements.length || node._next !== undefined) {
+ if (i === elements.length) {
+ node = node._next;
+ elements = node._elements;
+ i = 0;
+ if (elements.length === 0) {
+ break;
+ }
+ }
+ callback(elements[i]);
+ ++i;
+ }
+ };
+ SimpleQueue.prototype.peek = function () {
+ var front = this._front;
+ var cursor = this._cursor;
+ return front._elements[cursor];
+ };
+ return SimpleQueue;
+ }();
+ function ReadableStreamCreateReadResult(value, done, forAuthorCode) {
+ var prototype = null;
+ if (forAuthorCode === true) {
+ prototype = Object.prototype;
+ }
+ var obj = Object.create(prototype);
+ obj.value = value;
+ obj.done = done;
+ return obj;
+ }
+ function ReadableStreamReaderGenericInitialize(reader, stream) {
+ reader._forAuthorCode = true;
+ reader._ownerReadableStream = stream;
+ stream._reader = reader;
+ if (stream._state === 'readable') {
+ defaultReaderClosedPromiseInitialize(reader);
+ } else if (stream._state === 'closed') {
+ defaultReaderClosedPromiseInitializeAsResolved(reader);
+ } else {
+ defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError);
+ }
+ }
+ function ReadableStreamReaderGenericCancel(reader, reason) {
+ var stream = reader._ownerReadableStream;
+ return ReadableStreamCancel(stream, reason);
+ }
+ function ReadableStreamReaderGenericRelease(reader) {
+ if (reader._ownerReadableStream._state === 'readable') {
+ defaultReaderClosedPromiseReject(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness'));
+ } else {
+ defaultReaderClosedPromiseResetToRejected(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness'));
+ }
+ reader._ownerReadableStream._reader = undefined;
+ reader._ownerReadableStream = undefined;
+ }
+ function readerLockException(name) {
+ return new TypeError('Cannot ' + name + ' a stream using a released reader');
+ }
+ function defaultReaderClosedPromiseInitialize(reader) {
+ reader._closedPromise = newPromise(function (resolve, reject) {
+ reader._closedPromise_resolve = resolve;
+ reader._closedPromise_reject = reject;
+ });
+ }
+ function defaultReaderClosedPromiseInitializeAsRejected(reader, reason) {
+ defaultReaderClosedPromiseInitialize(reader);
+ defaultReaderClosedPromiseReject(reader, reason);
+ }
+ function defaultReaderClosedPromiseInitializeAsResolved(reader) {
+ defaultReaderClosedPromiseInitialize(reader);
+ defaultReaderClosedPromiseResolve(reader);
+ }
+ function defaultReaderClosedPromiseReject(reader, reason) {
+ setPromiseIsHandledToTrue(reader._closedPromise);
+ reader._closedPromise_reject(reason);
+ reader._closedPromise_resolve = undefined;
+ reader._closedPromise_reject = undefined;
+ }
+ function defaultReaderClosedPromiseResetToRejected(reader, reason) {
+ defaultReaderClosedPromiseInitializeAsRejected(reader, reason);
+ }
+ function defaultReaderClosedPromiseResolve(reader) {
+ reader._closedPromise_resolve(undefined);
+ reader._closedPromise_resolve = undefined;
+ reader._closedPromise_reject = undefined;
+ }
+ var CancelSteps = SymbolPolyfill('[[CancelSteps]]');
+ var PullSteps = SymbolPolyfill('[[PullSteps]]');
+ function AcquireReadableStreamDefaultReader(stream, forAuthorCode) {
+ if (forAuthorCode === void 0) {
+ forAuthorCode = false;
+ }
+ var reader = new ReadableStreamDefaultReader(stream);
+ reader._forAuthorCode = forAuthorCode;
+ return reader;
+ }
+ function ReadableStreamAddReadRequest(stream) {
+ var promise = newPromise(function (resolve, reject) {
+ var readRequest = {
+ _resolve: resolve,
+ _reject: reject
+ };
+ stream._reader._readRequests.push(readRequest);
+ });
+ return promise;
+ }
+ function ReadableStreamFulfillReadRequest(stream, chunk, done) {
+ var reader = stream._reader;
+ var readRequest = reader._readRequests.shift();
+ readRequest._resolve(ReadableStreamCreateReadResult(chunk, done, reader._forAuthorCode));
+ }
+ function ReadableStreamGetNumReadRequests(stream) {
+ return stream._reader._readRequests.length;
+ }
+ function ReadableStreamHasDefaultReader(stream) {
+ var reader = stream._reader;
+ if (reader === undefined) {
+ return false;
+ }
+ if (!IsReadableStreamDefaultReader(reader)) {
+ return false;
+ }
+ return true;
+ }
+ var ReadableStreamDefaultReader = function () {
+ function ReadableStreamDefaultReader(stream) {
+ if (IsReadableStream(stream) === false) {
+ throw new TypeError('ReadableStreamDefaultReader can only be constructed with a ReadableStream instance');
+ }
+ if (IsReadableStreamLocked(stream) === true) {
+ throw new TypeError('This stream has already been locked for exclusive reading by another reader');
+ }
+ ReadableStreamReaderGenericInitialize(this, stream);
+ this._readRequests = new SimpleQueue();
+ }
+ Object.defineProperty(ReadableStreamDefaultReader.prototype, "closed", {
+ get: function () {
+ if (!IsReadableStreamDefaultReader(this)) {
+ return promiseRejectedWith(defaultReaderBrandCheckException('closed'));
+ }
+ return this._closedPromise;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ ReadableStreamDefaultReader.prototype.cancel = function (reason) {
+ if (!IsReadableStreamDefaultReader(this)) {
+ return promiseRejectedWith(defaultReaderBrandCheckException('cancel'));
+ }
+ if (this._ownerReadableStream === undefined) {
+ return promiseRejectedWith(readerLockException('cancel'));
+ }
+ return ReadableStreamReaderGenericCancel(this, reason);
+ };
+ ReadableStreamDefaultReader.prototype.read = function () {
+ if (!IsReadableStreamDefaultReader(this)) {
+ return promiseRejectedWith(defaultReaderBrandCheckException('read'));
+ }
+ if (this._ownerReadableStream === undefined) {
+ return promiseRejectedWith(readerLockException('read from'));
+ }
+ return ReadableStreamDefaultReaderRead(this);
+ };
+ ReadableStreamDefaultReader.prototype.releaseLock = function () {
+ if (!IsReadableStreamDefaultReader(this)) {
+ throw defaultReaderBrandCheckException('releaseLock');
+ }
+ if (this._ownerReadableStream === undefined) {
+ return;
+ }
+ if (this._readRequests.length > 0) {
+ throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
+ }
+ ReadableStreamReaderGenericRelease(this);
+ };
+ return ReadableStreamDefaultReader;
+ }();
+ function IsReadableStreamDefaultReader(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) {
+ return false;
+ }
+ return true;
+ }
+ function ReadableStreamDefaultReaderRead(reader) {
+ var stream = reader._ownerReadableStream;
+ stream._disturbed = true;
+ if (stream._state === 'closed') {
+ return promiseResolvedWith(ReadableStreamCreateReadResult(undefined, true, reader._forAuthorCode));
+ }
+ if (stream._state === 'errored') {
+ return promiseRejectedWith(stream._storedError);
+ }
+ return stream._readableStreamController[PullSteps]();
+ }
+ function defaultReaderBrandCheckException(name) {
+ return new TypeError("ReadableStreamDefaultReader.prototype." + name + " can only be used on a ReadableStreamDefaultReader");
+ }
+ var _a;
+ var AsyncIteratorPrototype;
+ if (typeof SymbolPolyfill.asyncIterator === 'symbol') {
+ AsyncIteratorPrototype = (_a = {}, _a[SymbolPolyfill.asyncIterator] = function () {
+ return this;
+ }, _a);
+ Object.defineProperty(AsyncIteratorPrototype, SymbolPolyfill.asyncIterator, { enumerable: false });
+ }
+ var ReadableStreamAsyncIteratorPrototype = {
+ next: function () {
+ if (IsReadableStreamAsyncIterator(this) === false) {
+ return promiseRejectedWith(streamAsyncIteratorBrandCheckException('next'));
+ }
+ var reader = this._asyncIteratorReader;
+ if (reader._ownerReadableStream === undefined) {
+ return promiseRejectedWith(readerLockException('iterate'));
+ }
+ return transformPromiseWith(ReadableStreamDefaultReaderRead(reader), function (result) {
+ var done = result.done;
+ if (done) {
+ ReadableStreamReaderGenericRelease(reader);
+ }
+ var value = result.value;
+ return ReadableStreamCreateReadResult(value, done, true);
+ });
+ },
+ return: function (value) {
+ if (IsReadableStreamAsyncIterator(this) === false) {
+ return promiseRejectedWith(streamAsyncIteratorBrandCheckException('next'));
+ }
+ var reader = this._asyncIteratorReader;
+ if (reader._ownerReadableStream === undefined) {
+ return promiseRejectedWith(readerLockException('finish iterating'));
+ }
+ if (reader._readRequests.length > 0) {
+ return promiseRejectedWith(new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled'));
+ }
+ if (this._preventCancel === false) {
+ var result = ReadableStreamReaderGenericCancel(reader, value);
+ ReadableStreamReaderGenericRelease(reader);
+ return transformPromiseWith(result, function () {
+ return ReadableStreamCreateReadResult(value, true, true);
+ });
+ }
+ ReadableStreamReaderGenericRelease(reader);
+ return promiseResolvedWith(ReadableStreamCreateReadResult(value, true, true));
+ }
+ };
+ if (AsyncIteratorPrototype !== undefined) {
+ Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
+ }
+ Object.defineProperty(ReadableStreamAsyncIteratorPrototype, 'next', { enumerable: false });
+ Object.defineProperty(ReadableStreamAsyncIteratorPrototype, 'return', { enumerable: false });
+ function AcquireReadableStreamAsyncIterator(stream, preventCancel) {
+ if (preventCancel === void 0) {
+ preventCancel = false;
+ }
+ var reader = AcquireReadableStreamDefaultReader(stream);
+ var iterator = Object.create(ReadableStreamAsyncIteratorPrototype);
+ iterator._asyncIteratorReader = reader;
+ iterator._preventCancel = Boolean(preventCancel);
+ return iterator;
+ }
+ function IsReadableStreamAsyncIterator(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_asyncIteratorReader')) {
+ return false;
+ }
+ return true;
+ }
+ function streamAsyncIteratorBrandCheckException(name) {
+ return new TypeError("ReadableStreamAsyncIterator." + name + " can only be used on a ReadableSteamAsyncIterator");
+ }
+ function DequeueValue(container) {
+ var pair = container._queue.shift();
+ container._queueTotalSize -= pair.size;
+ if (container._queueTotalSize < 0) {
+ container._queueTotalSize = 0;
+ }
+ return pair.value;
+ }
+ function EnqueueValueWithSize(container, value, size) {
+ size = Number(size);
+ if (!IsFiniteNonNegativeNumber(size)) {
+ throw new RangeError('Size must be a finite, non-NaN, non-negative number.');
+ }
+ container._queue.push({
+ value: value,
+ size: size
+ });
+ container._queueTotalSize += size;
+ }
+ function PeekQueueValue(container) {
+ var pair = container._queue.peek();
+ return pair.value;
+ }
+ function ResetQueue(container) {
+ container._queue = new SimpleQueue();
+ container._queueTotalSize = 0;
+ }
+ var AbortSteps = SymbolPolyfill('[[AbortSteps]]');
+ var ErrorSteps = SymbolPolyfill('[[ErrorSteps]]');
+ var WritableStream = function () {
+ function WritableStream(underlyingSink, strategy) {
+ if (underlyingSink === void 0) {
+ underlyingSink = {};
+ }
+ if (strategy === void 0) {
+ strategy = {};
+ }
+ InitializeWritableStream(this);
+ var size = strategy.size;
+ var highWaterMark = strategy.highWaterMark;
+ var type = underlyingSink.type;
+ if (type !== undefined) {
+ throw new RangeError('Invalid type is specified');
+ }
+ var sizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(size);
+ if (highWaterMark === undefined) {
+ highWaterMark = 1;
+ }
+ highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark);
+ SetUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, highWaterMark, sizeAlgorithm);
+ }
+ Object.defineProperty(WritableStream.prototype, "locked", {
+ get: function () {
+ if (IsWritableStream(this) === false) {
+ throw streamBrandCheckException('locked');
+ }
+ return IsWritableStreamLocked(this);
+ },
+ enumerable: true,
+ configurable: true
+ });
+ WritableStream.prototype.abort = function (reason) {
+ if (IsWritableStream(this) === false) {
+ return promiseRejectedWith(streamBrandCheckException('abort'));
+ }
+ if (IsWritableStreamLocked(this) === true) {
+ return promiseRejectedWith(new TypeError('Cannot abort a stream that already has a writer'));
+ }
+ return WritableStreamAbort(this, reason);
+ };
+ WritableStream.prototype.close = function () {
+ if (IsWritableStream(this) === false) {
+ return promiseRejectedWith(streamBrandCheckException('close'));
+ }
+ if (IsWritableStreamLocked(this) === true) {
+ return promiseRejectedWith(new TypeError('Cannot close a stream that already has a writer'));
+ }
+ if (WritableStreamCloseQueuedOrInFlight(this) === true) {
+ return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));
+ }
+ return WritableStreamClose(this);
+ };
+ WritableStream.prototype.getWriter = function () {
+ if (IsWritableStream(this) === false) {
+ throw streamBrandCheckException('getWriter');
+ }
+ return AcquireWritableStreamDefaultWriter(this);
+ };
+ return WritableStream;
+ }();
+ function AcquireWritableStreamDefaultWriter(stream) {
+ return new WritableStreamDefaultWriter(stream);
+ }
+ function CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {
+ if (highWaterMark === void 0) {
+ highWaterMark = 1;
+ }
+ if (sizeAlgorithm === void 0) {
+ sizeAlgorithm = function () {
+ return 1;
+ };
+ }
+ var stream = Object.create(WritableStream.prototype);
+ InitializeWritableStream(stream);
+ var controller = Object.create(WritableStreamDefaultController.prototype);
+ SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
+ return stream;
+ }
+ function InitializeWritableStream(stream) {
+ stream._state = 'writable';
+ stream._storedError = undefined;
+ stream._writer = undefined;
+ stream._writableStreamController = undefined;
+ stream._writeRequests = new SimpleQueue();
+ stream._inFlightWriteRequest = undefined;
+ stream._closeRequest = undefined;
+ stream._inFlightCloseRequest = undefined;
+ stream._pendingAbortRequest = undefined;
+ stream._backpressure = false;
+ }
+ function IsWritableStream(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {
+ return false;
+ }
+ return true;
+ }
+ function IsWritableStreamLocked(stream) {
+ if (stream._writer === undefined) {
+ return false;
+ }
+ return true;
+ }
+ function WritableStreamAbort(stream, reason) {
+ var state = stream._state;
+ if (state === 'closed' || state === 'errored') {
+ return promiseResolvedWith(undefined);
+ }
+ if (stream._pendingAbortRequest !== undefined) {
+ return stream._pendingAbortRequest._promise;
+ }
+ var wasAlreadyErroring = false;
+ if (state === 'erroring') {
+ wasAlreadyErroring = true;
+ reason = undefined;
+ }
+ var promise = newPromise(function (resolve, reject) {
+ stream._pendingAbortRequest = {
+ _promise: undefined,
+ _resolve: resolve,
+ _reject: reject,
+ _reason: reason,
+ _wasAlreadyErroring: wasAlreadyErroring
+ };
+ });
+ stream._pendingAbortRequest._promise = promise;
+ if (wasAlreadyErroring === false) {
+ WritableStreamStartErroring(stream, reason);
+ }
+ return promise;
+ }
+ function WritableStreamClose(stream) {
+ var state = stream._state;
+ if (state === 'closed' || state === 'errored') {
+ return promiseRejectedWith(new TypeError("The stream (in " + state + " state) is not in the writable state and cannot be closed"));
+ }
+ var promise = newPromise(function (resolve, reject) {
+ var closeRequest = {
+ _resolve: resolve,
+ _reject: reject
+ };
+ stream._closeRequest = closeRequest;
+ });
+ var writer = stream._writer;
+ if (writer !== undefined && stream._backpressure === true && state === 'writable') {
+ defaultWriterReadyPromiseResolve(writer);
+ }
+ WritableStreamDefaultControllerClose(stream._writableStreamController);
+ return promise;
+ }
+ function WritableStreamAddWriteRequest(stream) {
+ var promise = newPromise(function (resolve, reject) {
+ var writeRequest = {
+ _resolve: resolve,
+ _reject: reject
+ };
+ stream._writeRequests.push(writeRequest);
+ });
+ return promise;
+ }
+ function WritableStreamDealWithRejection(stream, error) {
+ var state = stream._state;
+ if (state === 'writable') {
+ WritableStreamStartErroring(stream, error);
+ return;
+ }
+ WritableStreamFinishErroring(stream);
+ }
+ function WritableStreamStartErroring(stream, reason) {
+ var controller = stream._writableStreamController;
+ stream._state = 'erroring';
+ stream._storedError = reason;
+ var writer = stream._writer;
+ if (writer !== undefined) {
+ WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);
+ }
+ if (WritableStreamHasOperationMarkedInFlight(stream) === false && controller._started === true) {
+ WritableStreamFinishErroring(stream);
+ }
+ }
+ function WritableStreamFinishErroring(stream) {
+ stream._state = 'errored';
+ stream._writableStreamController[ErrorSteps]();
+ var storedError = stream._storedError;
+ stream._writeRequests.forEach(function (writeRequest) {
+ writeRequest._reject(storedError);
+ });
+ stream._writeRequests = new SimpleQueue();
+ if (stream._pendingAbortRequest === undefined) {
+ WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
+ return;
+ }
+ var abortRequest = stream._pendingAbortRequest;
+ stream._pendingAbortRequest = undefined;
+ if (abortRequest._wasAlreadyErroring === true) {
+ abortRequest._reject(storedError);
+ WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
+ return;
+ }
+ var promise = stream._writableStreamController[AbortSteps](abortRequest._reason);
+ uponPromise(promise, function () {
+ abortRequest._resolve();
+ WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
+ }, function (reason) {
+ abortRequest._reject(reason);
+ WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
+ });
+ }
+ function WritableStreamFinishInFlightWrite(stream) {
+ stream._inFlightWriteRequest._resolve(undefined);
+ stream._inFlightWriteRequest = undefined;
+ }
+ function WritableStreamFinishInFlightWriteWithError(stream, error) {
+ stream._inFlightWriteRequest._reject(error);
+ stream._inFlightWriteRequest = undefined;
+ WritableStreamDealWithRejection(stream, error);
+ }
+ function WritableStreamFinishInFlightClose(stream) {
+ stream._inFlightCloseRequest._resolve(undefined);
+ stream._inFlightCloseRequest = undefined;
+ var state = stream._state;
+ if (state === 'erroring') {
+ stream._storedError = undefined;
+ if (stream._pendingAbortRequest !== undefined) {
+ stream._pendingAbortRequest._resolve();
+ stream._pendingAbortRequest = undefined;
+ }
+ }
+ stream._state = 'closed';
+ var writer = stream._writer;
+ if (writer !== undefined) {
+ defaultWriterClosedPromiseResolve(writer);
+ }
+ }
+ function WritableStreamFinishInFlightCloseWithError(stream, error) {
+ stream._inFlightCloseRequest._reject(error);
+ stream._inFlightCloseRequest = undefined;
+ if (stream._pendingAbortRequest !== undefined) {
+ stream._pendingAbortRequest._reject(error);
+ stream._pendingAbortRequest = undefined;
+ }
+ WritableStreamDealWithRejection(stream, error);
+ }
+ function WritableStreamCloseQueuedOrInFlight(stream) {
+ if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) {
+ return false;
+ }
+ return true;
+ }
+ function WritableStreamHasOperationMarkedInFlight(stream) {
+ if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) {
+ return false;
+ }
+ return true;
+ }
+ function WritableStreamMarkCloseRequestInFlight(stream) {
+ stream._inFlightCloseRequest = stream._closeRequest;
+ stream._closeRequest = undefined;
+ }
+ function WritableStreamMarkFirstWriteRequestInFlight(stream) {
+ stream._inFlightWriteRequest = stream._writeRequests.shift();
+ }
+ function WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream) {
+ if (stream._closeRequest !== undefined) {
+ stream._closeRequest._reject(stream._storedError);
+ stream._closeRequest = undefined;
+ }
+ var writer = stream._writer;
+ if (writer !== undefined) {
+ defaultWriterClosedPromiseReject(writer, stream._storedError);
+ }
+ }
+ function WritableStreamUpdateBackpressure(stream, backpressure) {
+ var writer = stream._writer;
+ if (writer !== undefined && backpressure !== stream._backpressure) {
+ if (backpressure === true) {
+ defaultWriterReadyPromiseReset(writer);
+ } else {
+ defaultWriterReadyPromiseResolve(writer);
+ }
+ }
+ stream._backpressure = backpressure;
+ }
+ var WritableStreamDefaultWriter = function () {
+ function WritableStreamDefaultWriter(stream) {
+ if (IsWritableStream(stream) === false) {
+ throw new TypeError('WritableStreamDefaultWriter can only be constructed with a WritableStream instance');
+ }
+ if (IsWritableStreamLocked(stream) === true) {
+ throw new TypeError('This stream has already been locked for exclusive writing by another writer');
+ }
+ this._ownerWritableStream = stream;
+ stream._writer = this;
+ var state = stream._state;
+ if (state === 'writable') {
+ if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._backpressure === true) {
+ defaultWriterReadyPromiseInitialize(this);
+ } else {
+ defaultWriterReadyPromiseInitializeAsResolved(this);
+ }
+ defaultWriterClosedPromiseInitialize(this);
+ } else if (state === 'erroring') {
+ defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError);
+ defaultWriterClosedPromiseInitialize(this);
+ } else if (state === 'closed') {
+ defaultWriterReadyPromiseInitializeAsResolved(this);
+ defaultWriterClosedPromiseInitializeAsResolved(this);
+ } else {
+ var storedError = stream._storedError;
+ defaultWriterReadyPromiseInitializeAsRejected(this, storedError);
+ defaultWriterClosedPromiseInitializeAsRejected(this, storedError);
+ }
+ }
+ Object.defineProperty(WritableStreamDefaultWriter.prototype, "closed", {
+ get: function () {
+ if (IsWritableStreamDefaultWriter(this) === false) {
+ return promiseRejectedWith(defaultWriterBrandCheckException('closed'));
+ }
+ return this._closedPromise;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(WritableStreamDefaultWriter.prototype, "desiredSize", {
+ get: function () {
+ if (IsWritableStreamDefaultWriter(this) === false) {
+ throw defaultWriterBrandCheckException('desiredSize');
+ }
+ if (this._ownerWritableStream === undefined) {
+ throw defaultWriterLockException('desiredSize');
+ }
+ return WritableStreamDefaultWriterGetDesiredSize(this);
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(WritableStreamDefaultWriter.prototype, "ready", {
+ get: function () {
+ if (IsWritableStreamDefaultWriter(this) === false) {
+ return promiseRejectedWith(defaultWriterBrandCheckException('ready'));
+ }
+ return this._readyPromise;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ WritableStreamDefaultWriter.prototype.abort = function (reason) {
+ if (IsWritableStreamDefaultWriter(this) === false) {
+ return promiseRejectedWith(defaultWriterBrandCheckException('abort'));
+ }
+ if (this._ownerWritableStream === undefined) {
+ return promiseRejectedWith(defaultWriterLockException('abort'));
+ }
+ return WritableStreamDefaultWriterAbort(this, reason);
+ };
+ WritableStreamDefaultWriter.prototype.close = function () {
+ if (IsWritableStreamDefaultWriter(this) === false) {
+ return promiseRejectedWith(defaultWriterBrandCheckException('close'));
+ }
+ var stream = this._ownerWritableStream;
+ if (stream === undefined) {
+ return promiseRejectedWith(defaultWriterLockException('close'));
+ }
+ if (WritableStreamCloseQueuedOrInFlight(stream) === true) {
+ return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));
+ }
+ return WritableStreamDefaultWriterClose(this);
+ };
+ WritableStreamDefaultWriter.prototype.releaseLock = function () {
+ if (IsWritableStreamDefaultWriter(this) === false) {
+ throw defaultWriterBrandCheckException('releaseLock');
+ }
+ var stream = this._ownerWritableStream;
+ if (stream === undefined) {
+ return;
+ }
+ WritableStreamDefaultWriterRelease(this);
+ };
+ WritableStreamDefaultWriter.prototype.write = function (chunk) {
+ if (IsWritableStreamDefaultWriter(this) === false) {
+ return promiseRejectedWith(defaultWriterBrandCheckException('write'));
+ }
+ if (this._ownerWritableStream === undefined) {
+ return promiseRejectedWith(defaultWriterLockException('write to'));
+ }
+ return WritableStreamDefaultWriterWrite(this, chunk);
+ };
+ return WritableStreamDefaultWriter;
+ }();
+ function IsWritableStreamDefaultWriter(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {
+ return false;
+ }
+ return true;
+ }
+ function WritableStreamDefaultWriterAbort(writer, reason) {
+ var stream = writer._ownerWritableStream;
+ return WritableStreamAbort(stream, reason);
+ }
+ function WritableStreamDefaultWriterClose(writer) {
+ var stream = writer._ownerWritableStream;
+ return WritableStreamClose(stream);
+ }
+ function WritableStreamDefaultWriterCloseWithErrorPropagation(writer) {
+ var stream = writer._ownerWritableStream;
+ var state = stream._state;
+ if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {
+ return promiseResolvedWith(undefined);
+ }
+ if (state === 'errored') {
+ return promiseRejectedWith(stream._storedError);
+ }
+ return WritableStreamDefaultWriterClose(writer);
+ }
+ function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error) {
+ if (writer._closedPromiseState === 'pending') {
+ defaultWriterClosedPromiseReject(writer, error);
+ } else {
+ defaultWriterClosedPromiseResetToRejected(writer, error);
+ }
+ }
+ function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) {
+ if (writer._readyPromiseState === 'pending') {
+ defaultWriterReadyPromiseReject(writer, error);
+ } else {
+ defaultWriterReadyPromiseResetToRejected(writer, error);
+ }
+ }
+ function WritableStreamDefaultWriterGetDesiredSize(writer) {
+ var stream = writer._ownerWritableStream;
+ var state = stream._state;
+ if (state === 'errored' || state === 'erroring') {
+ return null;
+ }
+ if (state === 'closed') {
+ return 0;
+ }
+ return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController);
+ }
+ function WritableStreamDefaultWriterRelease(writer) {
+ var stream = writer._ownerWritableStream;
+ var releasedError = new TypeError('Writer was released and can no longer be used to monitor the stream\'s closedness');
+ WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);
+ WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);
+ stream._writer = undefined;
+ writer._ownerWritableStream = undefined;
+ }
+ function WritableStreamDefaultWriterWrite(writer, chunk) {
+ var stream = writer._ownerWritableStream;
+ var controller = stream._writableStreamController;
+ var chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk);
+ if (stream !== writer._ownerWritableStream) {
+ return promiseRejectedWith(defaultWriterLockException('write to'));
+ }
+ var state = stream._state;
+ if (state === 'errored') {
+ return promiseRejectedWith(stream._storedError);
+ }
+ if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {
+ return promiseRejectedWith(new TypeError('The stream is closing or closed and cannot be written to'));
+ }
+ if (state === 'erroring') {
+ return promiseRejectedWith(stream._storedError);
+ }
+ var promise = WritableStreamAddWriteRequest(stream);
+ WritableStreamDefaultControllerWrite(controller, chunk, chunkSize);
+ return promise;
+ }
+ var WritableStreamDefaultController = function () {
+ function WritableStreamDefaultController() {
+ throw new TypeError('WritableStreamDefaultController cannot be constructed explicitly');
+ }
+ WritableStreamDefaultController.prototype.error = function (e) {
+ if (IsWritableStreamDefaultController(this) === false) {
+ throw new TypeError('WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController');
+ }
+ var state = this._controlledWritableStream._state;
+ if (state !== 'writable') {
+ return;
+ }
+ WritableStreamDefaultControllerError(this, e);
+ };
+ WritableStreamDefaultController.prototype[AbortSteps] = function (reason) {
+ var result = this._abortAlgorithm(reason);
+ WritableStreamDefaultControllerClearAlgorithms(this);
+ return result;
+ };
+ WritableStreamDefaultController.prototype[ErrorSteps] = function () {
+ ResetQueue(this);
+ };
+ return WritableStreamDefaultController;
+ }();
+ function IsWritableStreamDefaultController(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_controlledWritableStream')) {
+ return false;
+ }
+ return true;
+ }
+ function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {
+ controller._controlledWritableStream = stream;
+ stream._writableStreamController = controller;
+ controller._queue = undefined;
+ controller._queueTotalSize = undefined;
+ ResetQueue(controller);
+ controller._started = false;
+ controller._strategySizeAlgorithm = sizeAlgorithm;
+ controller._strategyHWM = highWaterMark;
+ controller._writeAlgorithm = writeAlgorithm;
+ controller._closeAlgorithm = closeAlgorithm;
+ controller._abortAlgorithm = abortAlgorithm;
+ var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
+ WritableStreamUpdateBackpressure(stream, backpressure);
+ var startResult = startAlgorithm();
+ var startPromise = promiseResolvedWith(startResult);
+ uponPromise(startPromise, function () {
+ controller._started = true;
+ WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
+ }, function (r) {
+ controller._started = true;
+ WritableStreamDealWithRejection(stream, r);
+ });
+ }
+ function SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyingSink, highWaterMark, sizeAlgorithm) {
+ var controller = Object.create(WritableStreamDefaultController.prototype);
+ function startAlgorithm() {
+ return InvokeOrNoop(underlyingSink, 'start', [controller]);
+ }
+ var writeAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, 'write', 1, [controller]);
+ var closeAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, 'close', 0, []);
+ var abortAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, 'abort', 1, []);
+ SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
+ }
+ function WritableStreamDefaultControllerClearAlgorithms(controller) {
+ controller._writeAlgorithm = undefined;
+ controller._closeAlgorithm = undefined;
+ controller._abortAlgorithm = undefined;
+ controller._strategySizeAlgorithm = undefined;
+ }
+ function WritableStreamDefaultControllerClose(controller) {
+ EnqueueValueWithSize(controller, 'close', 0);
+ WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
+ }
+ function WritableStreamDefaultControllerGetChunkSize(controller, chunk) {
+ try {
+ return controller._strategySizeAlgorithm(chunk);
+ } catch (chunkSizeE) {
+ WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);
+ return 1;
+ }
+ }
+ function WritableStreamDefaultControllerGetDesiredSize(controller) {
+ return controller._strategyHWM - controller._queueTotalSize;
+ }
+ function WritableStreamDefaultControllerWrite(controller, chunk, chunkSize) {
+ var writeRecord = { chunk: chunk };
+ try {
+ EnqueueValueWithSize(controller, writeRecord, chunkSize);
+ } catch (enqueueE) {
+ WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);
+ return;
+ }
+ var stream = controller._controlledWritableStream;
+ if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._state === 'writable') {
+ var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
+ WritableStreamUpdateBackpressure(stream, backpressure);
+ }
+ WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
+ }
+ function WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller) {
+ var stream = controller._controlledWritableStream;
+ if (controller._started === false) {
+ return;
+ }
+ if (stream._inFlightWriteRequest !== undefined) {
+ return;
+ }
+ var state = stream._state;
+ if (state === 'erroring') {
+ WritableStreamFinishErroring(stream);
+ return;
+ }
+ if (controller._queue.length === 0) {
+ return;
+ }
+ var writeRecord = PeekQueueValue(controller);
+ if (writeRecord === 'close') {
+ WritableStreamDefaultControllerProcessClose(controller);
+ } else {
+ WritableStreamDefaultControllerProcessWrite(controller, writeRecord.chunk);
+ }
+ }
+ function WritableStreamDefaultControllerErrorIfNeeded(controller, error) {
+ if (controller._controlledWritableStream._state === 'writable') {
+ WritableStreamDefaultControllerError(controller, error);
+ }
+ }
+ function WritableStreamDefaultControllerProcessClose(controller) {
+ var stream = controller._controlledWritableStream;
+ WritableStreamMarkCloseRequestInFlight(stream);
+ DequeueValue(controller);
+ var sinkClosePromise = controller._closeAlgorithm();
+ WritableStreamDefaultControllerClearAlgorithms(controller);
+ uponPromise(sinkClosePromise, function () {
+ WritableStreamFinishInFlightClose(stream);
+ }, function (reason) {
+ WritableStreamFinishInFlightCloseWithError(stream, reason);
+ });
+ }
+ function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
+ var stream = controller._controlledWritableStream;
+ WritableStreamMarkFirstWriteRequestInFlight(stream);
+ var sinkWritePromise = controller._writeAlgorithm(chunk);
+ uponPromise(sinkWritePromise, function () {
+ WritableStreamFinishInFlightWrite(stream);
+ var state = stream._state;
+ DequeueValue(controller);
+ if (WritableStreamCloseQueuedOrInFlight(stream) === false && state === 'writable') {
+ var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
+ WritableStreamUpdateBackpressure(stream, backpressure);
+ }
+ WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
+ }, function (reason) {
+ if (stream._state === 'writable') {
+ WritableStreamDefaultControllerClearAlgorithms(controller);
+ }
+ WritableStreamFinishInFlightWriteWithError(stream, reason);
+ });
+ }
+ function WritableStreamDefaultControllerGetBackpressure(controller) {
+ var desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);
+ return desiredSize <= 0;
+ }
+ function WritableStreamDefaultControllerError(controller, error) {
+ var stream = controller._controlledWritableStream;
+ WritableStreamDefaultControllerClearAlgorithms(controller);
+ WritableStreamStartErroring(stream, error);
+ }
+ function streamBrandCheckException(name) {
+ return new TypeError("WritableStream.prototype." + name + " can only be used on a WritableStream");
+ }
+ function defaultWriterBrandCheckException(name) {
+ return new TypeError("WritableStreamDefaultWriter.prototype." + name + " can only be used on a WritableStreamDefaultWriter");
+ }
+ function defaultWriterLockException(name) {
+ return new TypeError('Cannot ' + name + ' a stream using a released writer');
+ }
+ function defaultWriterClosedPromiseInitialize(writer) {
+ writer._closedPromise = newPromise(function (resolve, reject) {
+ writer._closedPromise_resolve = resolve;
+ writer._closedPromise_reject = reject;
+ writer._closedPromiseState = 'pending';
+ });
+ }
+ function defaultWriterClosedPromiseInitializeAsRejected(writer, reason) {
+ defaultWriterClosedPromiseInitialize(writer);
+ defaultWriterClosedPromiseReject(writer, reason);
+ }
+ function defaultWriterClosedPromiseInitializeAsResolved(writer) {
+ defaultWriterClosedPromiseInitialize(writer);
+ defaultWriterClosedPromiseResolve(writer);
+ }
+ function defaultWriterClosedPromiseReject(writer, reason) {
+ setPromiseIsHandledToTrue(writer._closedPromise);
+ writer._closedPromise_reject(reason);
+ writer._closedPromise_resolve = undefined;
+ writer._closedPromise_reject = undefined;
+ writer._closedPromiseState = 'rejected';
+ }
+ function defaultWriterClosedPromiseResetToRejected(writer, reason) {
+ defaultWriterClosedPromiseInitializeAsRejected(writer, reason);
+ }
+ function defaultWriterClosedPromiseResolve(writer) {
+ writer._closedPromise_resolve(undefined);
+ writer._closedPromise_resolve = undefined;
+ writer._closedPromise_reject = undefined;
+ writer._closedPromiseState = 'resolved';
+ }
+ function defaultWriterReadyPromiseInitialize(writer) {
+ writer._readyPromise = newPromise(function (resolve, reject) {
+ writer._readyPromise_resolve = resolve;
+ writer._readyPromise_reject = reject;
+ });
+ writer._readyPromiseState = 'pending';
+ }
+ function defaultWriterReadyPromiseInitializeAsRejected(writer, reason) {
+ defaultWriterReadyPromiseInitialize(writer);
+ defaultWriterReadyPromiseReject(writer, reason);
+ }
+ function defaultWriterReadyPromiseInitializeAsResolved(writer) {
+ defaultWriterReadyPromiseInitialize(writer);
+ defaultWriterReadyPromiseResolve(writer);
+ }
+ function defaultWriterReadyPromiseReject(writer, reason) {
+ setPromiseIsHandledToTrue(writer._readyPromise);
+ writer._readyPromise_reject(reason);
+ writer._readyPromise_resolve = undefined;
+ writer._readyPromise_reject = undefined;
+ writer._readyPromiseState = 'rejected';
+ }
+ function defaultWriterReadyPromiseReset(writer) {
+ defaultWriterReadyPromiseInitialize(writer);
+ }
+ function defaultWriterReadyPromiseResetToRejected(writer, reason) {
+ defaultWriterReadyPromiseInitializeAsRejected(writer, reason);
+ }
+ function defaultWriterReadyPromiseResolve(writer) {
+ writer._readyPromise_resolve(undefined);
+ writer._readyPromise_resolve = undefined;
+ writer._readyPromise_reject = undefined;
+ writer._readyPromiseState = 'fulfilled';
+ }
+ function isAbortSignal(value) {
+ if (typeof value !== 'object' || value === null) {
+ return false;
+ }
+ try {
+ return typeof value.aborted === 'boolean';
+ } catch (_a) {
+ return false;
+ }
+ }
+ var NativeDOMException = typeof DOMException !== 'undefined' ? DOMException : undefined;
+ function isDOMExceptionConstructor(ctor) {
+ if (!(typeof ctor === 'function' || typeof ctor === 'object')) {
+ return false;
+ }
+ try {
+ new ctor();
+ return true;
+ } catch (_a) {
+ return false;
+ }
+ }
+ function createDOMExceptionPolyfill() {
+ var ctor = function DOMException(message, name) {
+ this.message = message || '';
+ this.name = name || 'Error';
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, this.constructor);
+ }
+ };
+ ctor.prototype = Object.create(Error.prototype);
+ Object.defineProperty(ctor.prototype, 'constructor', {
+ value: ctor,
+ writable: true,
+ configurable: true
+ });
+ return ctor;
+ }
+ var DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill();
+ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) {
+ var reader = AcquireReadableStreamDefaultReader(source);
+ var writer = AcquireWritableStreamDefaultWriter(dest);
+ source._disturbed = true;
+ var shuttingDown = false;
+ var currentWrite = promiseResolvedWith(undefined);
+ return newPromise(function (resolve, reject) {
+ var abortAlgorithm;
+ if (signal !== undefined) {
+ abortAlgorithm = function () {
+ var error = new DOMException$1('Aborted', 'AbortError');
+ var actions = [];
+ if (preventAbort === false) {
+ actions.push(function () {
+ if (dest._state === 'writable') {
+ return WritableStreamAbort(dest, error);
+ }
+ return promiseResolvedWith(undefined);
+ });
+ }
+ if (preventCancel === false) {
+ actions.push(function () {
+ if (source._state === 'readable') {
+ return ReadableStreamCancel(source, error);
+ }
+ return promiseResolvedWith(undefined);
+ });
+ }
+ shutdownWithAction(function () {
+ return Promise.all(actions.map(function (action) {
+ return action();
+ }));
+ }, true, error);
+ };
+ if (signal.aborted === true) {
+ abortAlgorithm();
+ return;
+ }
+ signal.addEventListener('abort', abortAlgorithm);
+ }
+ function pipeLoop() {
+ return newPromise(function (resolveLoop, rejectLoop) {
+ function next(done) {
+ if (done) {
+ resolveLoop();
+ } else {
+ PerformPromiseThen(pipeStep(), next, rejectLoop);
+ }
+ }
+ next(false);
+ });
+ }
+ function pipeStep() {
+ if (shuttingDown === true) {
+ return promiseResolvedWith(true);
+ }
+ return PerformPromiseThen(writer._readyPromise, function () {
+ return PerformPromiseThen(ReadableStreamDefaultReaderRead(reader), function (result) {
+ if (result.done === true) {
+ return true;
+ }
+ currentWrite = PerformPromiseThen(WritableStreamDefaultWriterWrite(writer, result.value), undefined, noop);
+ return false;
+ });
+ });
+ }
+ isOrBecomesErrored(source, reader._closedPromise, function (storedError) {
+ if (preventAbort === false) {
+ shutdownWithAction(function () {
+ return WritableStreamAbort(dest, storedError);
+ }, true, storedError);
+ } else {
+ shutdown(true, storedError);
+ }
+ });
+ isOrBecomesErrored(dest, writer._closedPromise, function (storedError) {
+ if (preventCancel === false) {
+ shutdownWithAction(function () {
+ return ReadableStreamCancel(source, storedError);
+ }, true, storedError);
+ } else {
+ shutdown(true, storedError);
+ }
+ });
+ isOrBecomesClosed(source, reader._closedPromise, function () {
+ if (preventClose === false) {
+ shutdownWithAction(function () {
+ return WritableStreamDefaultWriterCloseWithErrorPropagation(writer);
+ });
+ } else {
+ shutdown();
+ }
+ });
+ if (WritableStreamCloseQueuedOrInFlight(dest) === true || dest._state === 'closed') {
+ var destClosed_1 = new TypeError('the destination writable stream closed before all data could be piped to it');
+ if (preventCancel === false) {
+ shutdownWithAction(function () {
+ return ReadableStreamCancel(source, destClosed_1);
+ }, true, destClosed_1);
+ } else {
+ shutdown(true, destClosed_1);
+ }
+ }
+ setPromiseIsHandledToTrue(pipeLoop());
+ function waitForWritesToFinish() {
+ var oldCurrentWrite = currentWrite;
+ return PerformPromiseThen(currentWrite, function () {
+ return oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined;
+ });
+ }
+ function isOrBecomesErrored(stream, promise, action) {
+ if (stream._state === 'errored') {
+ action(stream._storedError);
+ } else {
+ uponRejection(promise, action);
+ }
+ }
+ function isOrBecomesClosed(stream, promise, action) {
+ if (stream._state === 'closed') {
+ action();
+ } else {
+ uponFulfillment(promise, action);
+ }
+ }
+ function shutdownWithAction(action, originalIsError, originalError) {
+ if (shuttingDown === true) {
+ return;
+ }
+ shuttingDown = true;
+ if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {
+ uponFulfillment(waitForWritesToFinish(), doTheRest);
+ } else {
+ doTheRest();
+ }
+ function doTheRest() {
+ uponPromise(action(), function () {
+ return finalize(originalIsError, originalError);
+ }, function (newError) {
+ return finalize(true, newError);
+ });
+ }
+ }
+ function shutdown(isError, error) {
+ if (shuttingDown === true) {
+ return;
+ }
+ shuttingDown = true;
+ if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {
+ uponFulfillment(waitForWritesToFinish(), function () {
+ return finalize(isError, error);
+ });
+ } else {
+ finalize(isError, error);
+ }
+ }
+ function finalize(isError, error) {
+ WritableStreamDefaultWriterRelease(writer);
+ ReadableStreamReaderGenericRelease(reader);
+ if (signal !== undefined) {
+ signal.removeEventListener('abort', abortAlgorithm);
+ }
+ if (isError) {
+ reject(error);
+ } else {
+ resolve(undefined);
+ }
+ }
+ });
+ }
+ var ReadableStreamDefaultController = function () {
+ function ReadableStreamDefaultController() {
+ throw new TypeError();
+ }
+ Object.defineProperty(ReadableStreamDefaultController.prototype, "desiredSize", {
+ get: function () {
+ if (IsReadableStreamDefaultController(this) === false) {
+ throw defaultControllerBrandCheckException('desiredSize');
+ }
+ return ReadableStreamDefaultControllerGetDesiredSize(this);
+ },
+ enumerable: true,
+ configurable: true
+ });
+ ReadableStreamDefaultController.prototype.close = function () {
+ if (IsReadableStreamDefaultController(this) === false) {
+ throw defaultControllerBrandCheckException('close');
+ }
+ if (ReadableStreamDefaultControllerCanCloseOrEnqueue(this) === false) {
+ throw new TypeError('The stream is not in a state that permits close');
+ }
+ ReadableStreamDefaultControllerClose(this);
+ };
+ ReadableStreamDefaultController.prototype.enqueue = function (chunk) {
+ if (IsReadableStreamDefaultController(this) === false) {
+ throw defaultControllerBrandCheckException('enqueue');
+ }
+ if (ReadableStreamDefaultControllerCanCloseOrEnqueue(this) === false) {
+ throw new TypeError('The stream is not in a state that permits enqueue');
+ }
+ return ReadableStreamDefaultControllerEnqueue(this, chunk);
+ };
+ ReadableStreamDefaultController.prototype.error = function (e) {
+ if (IsReadableStreamDefaultController(this) === false) {
+ throw defaultControllerBrandCheckException('error');
+ }
+ ReadableStreamDefaultControllerError(this, e);
+ };
+ ReadableStreamDefaultController.prototype[CancelSteps] = function (reason) {
+ ResetQueue(this);
+ var result = this._cancelAlgorithm(reason);
+ ReadableStreamDefaultControllerClearAlgorithms(this);
+ return result;
+ };
+ ReadableStreamDefaultController.prototype[PullSteps] = function () {
+ var stream = this._controlledReadableStream;
+ if (this._queue.length > 0) {
+ var chunk = DequeueValue(this);
+ if (this._closeRequested === true && this._queue.length === 0) {
+ ReadableStreamDefaultControllerClearAlgorithms(this);
+ ReadableStreamClose(stream);
+ } else {
+ ReadableStreamDefaultControllerCallPullIfNeeded(this);
+ }
+ return promiseResolvedWith(ReadableStreamCreateReadResult(chunk, false, stream._reader._forAuthorCode));
+ }
+ var pendingPromise = ReadableStreamAddReadRequest(stream);
+ ReadableStreamDefaultControllerCallPullIfNeeded(this);
+ return pendingPromise;
+ };
+ return ReadableStreamDefaultController;
+ }();
+ function IsReadableStreamDefaultController(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableStream')) {
+ return false;
+ }
+ return true;
+ }
+ function ReadableStreamDefaultControllerCallPullIfNeeded(controller) {
+ var shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);
+ if (shouldPull === false) {
+ return;
+ }
+ if (controller._pulling === true) {
+ controller._pullAgain = true;
+ return;
+ }
+ controller._pulling = true;
+ var pullPromise = controller._pullAlgorithm();
+ uponPromise(pullPromise, function () {
+ controller._pulling = false;
+ if (controller._pullAgain === true) {
+ controller._pullAgain = false;
+ ReadableStreamDefaultControllerCallPullIfNeeded(controller);
+ }
+ }, function (e) {
+ ReadableStreamDefaultControllerError(controller, e);
+ });
+ }
+ function ReadableStreamDefaultControllerShouldCallPull(controller) {
+ var stream = controller._controlledReadableStream;
+ if (ReadableStreamDefaultControllerCanCloseOrEnqueue(controller) === false) {
+ return false;
+ }
+ if (controller._started === false) {
+ return false;
+ }
+ if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
+ return true;
+ }
+ var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);
+ if (desiredSize > 0) {
+ return true;
+ }
+ return false;
+ }
+ function ReadableStreamDefaultControllerClearAlgorithms(controller) {
+ controller._pullAlgorithm = undefined;
+ controller._cancelAlgorithm = undefined;
+ controller._strategySizeAlgorithm = undefined;
+ }
+ function ReadableStreamDefaultControllerClose(controller) {
+ var stream = controller._controlledReadableStream;
+ controller._closeRequested = true;
+ if (controller._queue.length === 0) {
+ ReadableStreamDefaultControllerClearAlgorithms(controller);
+ ReadableStreamClose(stream);
+ }
+ }
+ function ReadableStreamDefaultControllerEnqueue(controller, chunk) {
+ var stream = controller._controlledReadableStream;
+ if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
+ ReadableStreamFulfillReadRequest(stream, chunk, false);
+ } else {
+ var chunkSize = void 0;
+ try {
+ chunkSize = controller._strategySizeAlgorithm(chunk);
+ } catch (chunkSizeE) {
+ ReadableStreamDefaultControllerError(controller, chunkSizeE);
+ throw chunkSizeE;
+ }
+ try {
+ EnqueueValueWithSize(controller, chunk, chunkSize);
+ } catch (enqueueE) {
+ ReadableStreamDefaultControllerError(controller, enqueueE);
+ throw enqueueE;
+ }
+ }
+ ReadableStreamDefaultControllerCallPullIfNeeded(controller);
+ }
+ function ReadableStreamDefaultControllerError(controller, e) {
+ var stream = controller._controlledReadableStream;
+ if (stream._state !== 'readable') {
+ return;
+ }
+ ResetQueue(controller);
+ ReadableStreamDefaultControllerClearAlgorithms(controller);
+ ReadableStreamError(stream, e);
+ }
+ function ReadableStreamDefaultControllerGetDesiredSize(controller) {
+ var stream = controller._controlledReadableStream;
+ var state = stream._state;
+ if (state === 'errored') {
+ return null;
+ }
+ if (state === 'closed') {
+ return 0;
+ }
+ return controller._strategyHWM - controller._queueTotalSize;
+ }
+ function ReadableStreamDefaultControllerHasBackpressure(controller) {
+ if (ReadableStreamDefaultControllerShouldCallPull(controller) === true) {
+ return false;
+ }
+ return true;
+ }
+ function ReadableStreamDefaultControllerCanCloseOrEnqueue(controller) {
+ var state = controller._controlledReadableStream._state;
+ if (controller._closeRequested === false && state === 'readable') {
+ return true;
+ }
+ return false;
+ }
+ function SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm) {
+ controller._controlledReadableStream = stream;
+ controller._queue = undefined;
+ controller._queueTotalSize = undefined;
+ ResetQueue(controller);
+ controller._started = false;
+ controller._closeRequested = false;
+ controller._pullAgain = false;
+ controller._pulling = false;
+ controller._strategySizeAlgorithm = sizeAlgorithm;
+ controller._strategyHWM = highWaterMark;
+ controller._pullAlgorithm = pullAlgorithm;
+ controller._cancelAlgorithm = cancelAlgorithm;
+ stream._readableStreamController = controller;
+ var startResult = startAlgorithm();
+ uponPromise(promiseResolvedWith(startResult), function () {
+ controller._started = true;
+ ReadableStreamDefaultControllerCallPullIfNeeded(controller);
+ }, function (r) {
+ ReadableStreamDefaultControllerError(controller, r);
+ });
+ }
+ function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underlyingSource, highWaterMark, sizeAlgorithm) {
+ var controller = Object.create(ReadableStreamDefaultController.prototype);
+ function startAlgorithm() {
+ return InvokeOrNoop(underlyingSource, 'start', [controller]);
+ }
+ var pullAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSource, 'pull', 0, [controller]);
+ var cancelAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSource, 'cancel', 1, []);
+ SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
+ }
+ function defaultControllerBrandCheckException(name) {
+ return new TypeError("ReadableStreamDefaultController.prototype." + name + " can only be used on a ReadableStreamDefaultController");
+ }
+ function ReadableStreamTee(stream, cloneForBranch2) {
+ var reader = AcquireReadableStreamDefaultReader(stream);
+ var reading = false;
+ var canceled1 = false;
+ var canceled2 = false;
+ var reason1;
+ var reason2;
+ var branch1;
+ var branch2;
+ var resolveCancelPromise;
+ var cancelPromise = newPromise(function (resolve) {
+ resolveCancelPromise = resolve;
+ });
+ function pullAlgorithm() {
+ if (reading === true) {
+ return promiseResolvedWith(undefined);
+ }
+ reading = true;
+ var readPromise = transformPromiseWith(ReadableStreamDefaultReaderRead(reader), function (result) {
+ reading = false;
+ var done = result.done;
+ if (done === true) {
+ if (canceled1 === false) {
+ ReadableStreamDefaultControllerClose(branch1._readableStreamController);
+ }
+ if (canceled2 === false) {
+ ReadableStreamDefaultControllerClose(branch2._readableStreamController);
+ }
+ return;
+ }
+ var value = result.value;
+ var value1 = value;
+ var value2 = value;
+ if (canceled1 === false) {
+ ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController, value1);
+ }
+ if (canceled2 === false) {
+ ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, value2);
+ }
+ });
+ setPromiseIsHandledToTrue(readPromise);
+ return promiseResolvedWith(undefined);
+ }
+ function cancel1Algorithm(reason) {
+ canceled1 = true;
+ reason1 = reason;
+ if (canceled2 === true) {
+ var compositeReason = createArrayFromList([
+ reason1,
+ reason2
+ ]);
+ var cancelResult = ReadableStreamCancel(stream, compositeReason);
+ resolveCancelPromise(cancelResult);
+ }
+ return cancelPromise;
+ }
+ function cancel2Algorithm(reason) {
+ canceled2 = true;
+ reason2 = reason;
+ if (canceled1 === true) {
+ var compositeReason = createArrayFromList([
+ reason1,
+ reason2
+ ]);
+ var cancelResult = ReadableStreamCancel(stream, compositeReason);
+ resolveCancelPromise(cancelResult);
+ }
+ return cancelPromise;
+ }
+ function startAlgorithm() {
+ }
+ branch1 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel1Algorithm);
+ branch2 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel2Algorithm);
+ uponRejection(reader._closedPromise, function (r) {
+ ReadableStreamDefaultControllerError(branch1._readableStreamController, r);
+ ReadableStreamDefaultControllerError(branch2._readableStreamController, r);
+ });
+ return [
+ branch1,
+ branch2
+ ];
+ }
+ var NumberIsInteger = Number.isInteger || function (value) {
+ return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
+ };
+ var ReadableStreamBYOBRequest = function () {
+ function ReadableStreamBYOBRequest() {
+ throw new TypeError('ReadableStreamBYOBRequest cannot be used directly');
+ }
+ Object.defineProperty(ReadableStreamBYOBRequest.prototype, "view", {
+ get: function () {
+ if (IsReadableStreamBYOBRequest(this) === false) {
+ throw byobRequestBrandCheckException('view');
+ }
+ return this._view;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ ReadableStreamBYOBRequest.prototype.respond = function (bytesWritten) {
+ if (IsReadableStreamBYOBRequest(this) === false) {
+ throw byobRequestBrandCheckException('respond');
+ }
+ if (this._associatedReadableByteStreamController === undefined) {
+ throw new TypeError('This BYOB request has been invalidated');
+ }
+ if (IsDetachedBuffer(this._view.buffer) === true);
+ ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);
+ };
+ ReadableStreamBYOBRequest.prototype.respondWithNewView = function (view) {
+ if (IsReadableStreamBYOBRequest(this) === false) {
+ throw byobRequestBrandCheckException('respond');
+ }
+ if (this._associatedReadableByteStreamController === undefined) {
+ throw new TypeError('This BYOB request has been invalidated');
+ }
+ if (!ArrayBuffer.isView(view)) {
+ throw new TypeError('You can only respond with array buffer views');
+ }
+ if (IsDetachedBuffer(view.buffer) === true);
+ ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
+ };
+ return ReadableStreamBYOBRequest;
+ }();
+ var ReadableByteStreamController = function () {
+ function ReadableByteStreamController() {
+ throw new TypeError('ReadableByteStreamController constructor cannot be used directly');
+ }
+ Object.defineProperty(ReadableByteStreamController.prototype, "byobRequest", {
+ get: function () {
+ if (IsReadableByteStreamController(this) === false) {
+ throw byteStreamControllerBrandCheckException('byobRequest');
+ }
+ if (this._byobRequest === undefined && this._pendingPullIntos.length > 0) {
+ var firstDescriptor = this._pendingPullIntos.peek();
+ var view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);
+ var byobRequest = Object.create(ReadableStreamBYOBRequest.prototype);
+ SetUpReadableStreamBYOBRequest(byobRequest, this, view);
+ this._byobRequest = byobRequest;
+ }
+ return this._byobRequest;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(ReadableByteStreamController.prototype, "desiredSize", {
+ get: function () {
+ if (IsReadableByteStreamController(this) === false) {
+ throw byteStreamControllerBrandCheckException('desiredSize');
+ }
+ return ReadableByteStreamControllerGetDesiredSize(this);
+ },
+ enumerable: true,
+ configurable: true
+ });
+ ReadableByteStreamController.prototype.close = function () {
+ if (IsReadableByteStreamController(this) === false) {
+ throw byteStreamControllerBrandCheckException('close');
+ }
+ if (this._closeRequested === true) {
+ throw new TypeError('The stream has already been closed; do not close it again!');
+ }
+ var state = this._controlledReadableByteStream._state;
+ if (state !== 'readable') {
+ throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be closed");
+ }
+ ReadableByteStreamControllerClose(this);
+ };
+ ReadableByteStreamController.prototype.enqueue = function (chunk) {
+ if (IsReadableByteStreamController(this) === false) {
+ throw byteStreamControllerBrandCheckException('enqueue');
+ }
+ if (this._closeRequested === true) {
+ throw new TypeError('stream is closed or draining');
+ }
+ var state = this._controlledReadableByteStream._state;
+ if (state !== 'readable') {
+ throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be enqueued to");
+ }
+ if (!ArrayBuffer.isView(chunk)) {
+ throw new TypeError('You can only enqueue array buffer views when using a ReadableByteStreamController');
+ }
+ if (IsDetachedBuffer(chunk.buffer) === true);
+ ReadableByteStreamControllerEnqueue(this, chunk);
+ };
+ ReadableByteStreamController.prototype.error = function (e) {
+ if (IsReadableByteStreamController(this) === false) {
+ throw byteStreamControllerBrandCheckException('error');
+ }
+ ReadableByteStreamControllerError(this, e);
+ };
+ ReadableByteStreamController.prototype[CancelSteps] = function (reason) {
+ if (this._pendingPullIntos.length > 0) {
+ var firstDescriptor = this._pendingPullIntos.peek();
+ firstDescriptor.bytesFilled = 0;
+ }
+ ResetQueue(this);
+ var result = this._cancelAlgorithm(reason);
+ ReadableByteStreamControllerClearAlgorithms(this);
+ return result;
+ };
+ ReadableByteStreamController.prototype[PullSteps] = function () {
+ var stream = this._controlledReadableByteStream;
+ if (this._queueTotalSize > 0) {
+ var entry = this._queue.shift();
+ this._queueTotalSize -= entry.byteLength;
+ ReadableByteStreamControllerHandleQueueDrain(this);
+ var view = void 0;
+ try {
+ view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
+ } catch (viewE) {
+ return promiseRejectedWith(viewE);
+ }
+ return promiseResolvedWith(ReadableStreamCreateReadResult(view, false, stream._reader._forAuthorCode));
+ }
+ var autoAllocateChunkSize = this._autoAllocateChunkSize;
+ if (autoAllocateChunkSize !== undefined) {
+ var buffer = void 0;
+ try {
+ buffer = new ArrayBuffer(autoAllocateChunkSize);
+ } catch (bufferE) {
+ return promiseRejectedWith(bufferE);
+ }
+ var pullIntoDescriptor = {
+ buffer: buffer,
+ byteOffset: 0,
+ byteLength: autoAllocateChunkSize,
+ bytesFilled: 0,
+ elementSize: 1,
+ ctor: Uint8Array,
+ readerType: 'default'
+ };
+ this._pendingPullIntos.push(pullIntoDescriptor);
+ }
+ var promise = ReadableStreamAddReadRequest(stream);
+ ReadableByteStreamControllerCallPullIfNeeded(this);
+ return promise;
+ };
+ return ReadableByteStreamController;
+ }();
+ function IsReadableByteStreamController(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableByteStream')) {
+ return false;
+ }
+ return true;
+ }
+ function IsReadableStreamBYOBRequest(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {
+ return false;
+ }
+ return true;
+ }
+ function ReadableByteStreamControllerCallPullIfNeeded(controller) {
+ var shouldPull = ReadableByteStreamControllerShouldCallPull(controller);
+ if (shouldPull === false) {
+ return;
+ }
+ if (controller._pulling === true) {
+ controller._pullAgain = true;
+ return;
+ }
+ controller._pulling = true;
+ var pullPromise = controller._pullAlgorithm();
+ uponPromise(pullPromise, function () {
+ controller._pulling = false;
+ if (controller._pullAgain === true) {
+ controller._pullAgain = false;
+ ReadableByteStreamControllerCallPullIfNeeded(controller);
+ }
+ }, function (e) {
+ ReadableByteStreamControllerError(controller, e);
+ });
+ }
+ function ReadableByteStreamControllerClearPendingPullIntos(controller) {
+ ReadableByteStreamControllerInvalidateBYOBRequest(controller);
+ controller._pendingPullIntos = new SimpleQueue();
+ }
+ function ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor) {
+ var done = false;
+ if (stream._state === 'closed') {
+ done = true;
+ }
+ var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
+ if (pullIntoDescriptor.readerType === 'default') {
+ ReadableStreamFulfillReadRequest(stream, filledView, done);
+ } else {
+ ReadableStreamFulfillReadIntoRequest(stream, filledView, done);
+ }
+ }
+ function ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor) {
+ var bytesFilled = pullIntoDescriptor.bytesFilled;
+ var elementSize = pullIntoDescriptor.elementSize;
+ return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize);
+ }
+ function ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byteOffset, byteLength) {
+ controller._queue.push({
+ buffer: buffer,
+ byteOffset: byteOffset,
+ byteLength: byteLength
+ });
+ controller._queueTotalSize += byteLength;
+ }
+ function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) {
+ var elementSize = pullIntoDescriptor.elementSize;
+ var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize;
+ var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);
+ var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;
+ var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize;
+ var totalBytesToCopyRemaining = maxBytesToCopy;
+ var ready = false;
+ if (maxAlignedBytes > currentAlignedBytes) {
+ totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;
+ ready = true;
+ }
+ var queue = controller._queue;
+ while (totalBytesToCopyRemaining > 0) {
+ var headOfQueue = queue.peek();
+ var bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength);
+ var destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
+ ArrayBufferCopy(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy);
+ if (headOfQueue.byteLength === bytesToCopy) {
+ queue.shift();
+ } else {
+ headOfQueue.byteOffset += bytesToCopy;
+ headOfQueue.byteLength -= bytesToCopy;
+ }
+ controller._queueTotalSize -= bytesToCopy;
+ ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor);
+ totalBytesToCopyRemaining -= bytesToCopy;
+ }
+ return ready;
+ }
+ function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) {
+ ReadableByteStreamControllerInvalidateBYOBRequest(controller);
+ pullIntoDescriptor.bytesFilled += size;
+ }
+ function ReadableByteStreamControllerHandleQueueDrain(controller) {
+ if (controller._queueTotalSize === 0 && controller._closeRequested === true) {
+ ReadableByteStreamControllerClearAlgorithms(controller);
+ ReadableStreamClose(controller._controlledReadableByteStream);
+ } else {
+ ReadableByteStreamControllerCallPullIfNeeded(controller);
+ }
+ }
+ function ReadableByteStreamControllerInvalidateBYOBRequest(controller) {
+ if (controller._byobRequest === undefined) {
+ return;
+ }
+ controller._byobRequest._associatedReadableByteStreamController = undefined;
+ controller._byobRequest._view = undefined;
+ controller._byobRequest = undefined;
+ }
+ function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller) {
+ while (controller._pendingPullIntos.length > 0) {
+ if (controller._queueTotalSize === 0) {
+ return;
+ }
+ var pullIntoDescriptor = controller._pendingPullIntos.peek();
+ if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
+ ReadableByteStreamControllerShiftPendingPullInto(controller);
+ ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
+ }
+ }
+ }
+ function ReadableByteStreamControllerPullInto(controller, view) {
+ var stream = controller._controlledReadableByteStream;
+ var elementSize = 1;
+ if (view.constructor !== DataView) {
+ elementSize = view.constructor.BYTES_PER_ELEMENT;
+ }
+ var ctor = view.constructor;
+ var buffer = TransferArrayBuffer(view.buffer);
+ var pullIntoDescriptor = {
+ buffer: buffer,
+ byteOffset: view.byteOffset,
+ byteLength: view.byteLength,
+ bytesFilled: 0,
+ elementSize: elementSize,
+ ctor: ctor,
+ readerType: 'byob'
+ };
+ if (controller._pendingPullIntos.length > 0) {
+ controller._pendingPullIntos.push(pullIntoDescriptor);
+ return ReadableStreamAddReadIntoRequest(stream);
+ }
+ if (stream._state === 'closed') {
+ var emptyView = new ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);
+ return promiseResolvedWith(ReadableStreamCreateReadResult(emptyView, true, stream._reader._forAuthorCode));
+ }
+ if (controller._queueTotalSize > 0) {
+ if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
+ var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
+ ReadableByteStreamControllerHandleQueueDrain(controller);
+ return promiseResolvedWith(ReadableStreamCreateReadResult(filledView, false, stream._reader._forAuthorCode));
+ }
+ if (controller._closeRequested === true) {
+ var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
+ ReadableByteStreamControllerError(controller, e);
+ return promiseRejectedWith(e);
+ }
+ }
+ controller._pendingPullIntos.push(pullIntoDescriptor);
+ var promise = ReadableStreamAddReadIntoRequest(stream);
+ ReadableByteStreamControllerCallPullIfNeeded(controller);
+ return promise;
+ }
+ function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
+ firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);
+ var stream = controller._controlledReadableByteStream;
+ if (ReadableStreamHasBYOBReader(stream) === true) {
+ while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
+ var pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller);
+ ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor);
+ }
+ }
+ }
+ function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
+ if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) {
+ throw new RangeError('bytesWritten out of range');
+ }
+ ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
+ if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
+ return;
+ }
+ ReadableByteStreamControllerShiftPendingPullInto(controller);
+ var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
+ if (remainderSize > 0) {
+ var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
+ var remainder = pullIntoDescriptor.buffer.slice(end - remainderSize, end);
+ ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
+ }
+ pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
+ pullIntoDescriptor.bytesFilled -= remainderSize;
+ ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
+ ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
+ }
+ function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
+ var firstDescriptor = controller._pendingPullIntos.peek();
+ var stream = controller._controlledReadableByteStream;
+ if (stream._state === 'closed') {
+ if (bytesWritten !== 0) {
+ throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');
+ }
+ ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);
+ } else {
+ ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
+ }
+ ReadableByteStreamControllerCallPullIfNeeded(controller);
+ }
+ function ReadableByteStreamControllerShiftPendingPullInto(controller) {
+ var descriptor = controller._pendingPullIntos.shift();
+ ReadableByteStreamControllerInvalidateBYOBRequest(controller);
+ return descriptor;
+ }
+ function ReadableByteStreamControllerShouldCallPull(controller) {
+ var stream = controller._controlledReadableByteStream;
+ if (stream._state !== 'readable') {
+ return false;
+ }
+ if (controller._closeRequested === true) {
+ return false;
+ }
+ if (controller._started === false) {
+ return false;
+ }
+ if (ReadableStreamHasDefaultReader(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
+ return true;
+ }
+ if (ReadableStreamHasBYOBReader(stream) === true && ReadableStreamGetNumReadIntoRequests(stream) > 0) {
+ return true;
+ }
+ var desiredSize = ReadableByteStreamControllerGetDesiredSize(controller);
+ if (desiredSize > 0) {
+ return true;
+ }
+ return false;
+ }
+ function ReadableByteStreamControllerClearAlgorithms(controller) {
+ controller._pullAlgorithm = undefined;
+ controller._cancelAlgorithm = undefined;
+ }
+ function ReadableByteStreamControllerClose(controller) {
+ var stream = controller._controlledReadableByteStream;
+ if (controller._queueTotalSize > 0) {
+ controller._closeRequested = true;
+ return;
+ }
+ if (controller._pendingPullIntos.length > 0) {
+ var firstPendingPullInto = controller._pendingPullIntos.peek();
+ if (firstPendingPullInto.bytesFilled > 0) {
+ var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
+ ReadableByteStreamControllerError(controller, e);
+ throw e;
+ }
+ }
+ ReadableByteStreamControllerClearAlgorithms(controller);
+ ReadableStreamClose(stream);
+ }
+ function ReadableByteStreamControllerEnqueue(controller, chunk) {
+ var stream = controller._controlledReadableByteStream;
+ var buffer = chunk.buffer;
+ var byteOffset = chunk.byteOffset;
+ var byteLength = chunk.byteLength;
+ var transferredBuffer = TransferArrayBuffer(buffer);
+ if (ReadableStreamHasDefaultReader(stream) === true) {
+ if (ReadableStreamGetNumReadRequests(stream) === 0) {
+ ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
+ } else {
+ var transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);
+ ReadableStreamFulfillReadRequest(stream, transferredView, false);
+ }
+ } else if (ReadableStreamHasBYOBReader(stream) === true) {
+ ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
+ ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
+ } else {
+ ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
+ }
+ ReadableByteStreamControllerCallPullIfNeeded(controller);
+ }
+ function ReadableByteStreamControllerError(controller, e) {
+ var stream = controller._controlledReadableByteStream;
+ if (stream._state !== 'readable') {
+ return;
+ }
+ ReadableByteStreamControllerClearPendingPullIntos(controller);
+ ResetQueue(controller);
+ ReadableByteStreamControllerClearAlgorithms(controller);
+ ReadableStreamError(stream, e);
+ }
+ function ReadableByteStreamControllerGetDesiredSize(controller) {
+ var stream = controller._controlledReadableByteStream;
+ var state = stream._state;
+ if (state === 'errored') {
+ return null;
+ }
+ if (state === 'closed') {
+ return 0;
+ }
+ return controller._strategyHWM - controller._queueTotalSize;
+ }
+ function ReadableByteStreamControllerRespond(controller, bytesWritten) {
+ bytesWritten = Number(bytesWritten);
+ if (IsFiniteNonNegativeNumber(bytesWritten) === false) {
+ throw new RangeError('bytesWritten must be a finite');
+ }
+ ReadableByteStreamControllerRespondInternal(controller, bytesWritten);
+ }
+ function ReadableByteStreamControllerRespondWithNewView(controller, view) {
+ var firstDescriptor = controller._pendingPullIntos.peek();
+ if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {
+ throw new RangeError('The region specified by view does not match byobRequest');
+ }
+ if (firstDescriptor.byteLength !== view.byteLength) {
+ throw new RangeError('The buffer of view has different capacity than byobRequest');
+ }
+ firstDescriptor.buffer = view.buffer;
+ ReadableByteStreamControllerRespondInternal(controller, view.byteLength);
+ }
+ function SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize) {
+ controller._controlledReadableByteStream = stream;
+ controller._pullAgain = false;
+ controller._pulling = false;
+ controller._byobRequest = undefined;
+ controller._queue = controller._queueTotalSize = undefined;
+ ResetQueue(controller);
+ controller._closeRequested = false;
+ controller._started = false;
+ controller._strategyHWM = ValidateAndNormalizeHighWaterMark(highWaterMark);
+ controller._pullAlgorithm = pullAlgorithm;
+ controller._cancelAlgorithm = cancelAlgorithm;
+ controller._autoAllocateChunkSize = autoAllocateChunkSize;
+ controller._pendingPullIntos = new SimpleQueue();
+ stream._readableStreamController = controller;
+ var startResult = startAlgorithm();
+ uponPromise(promiseResolvedWith(startResult), function () {
+ controller._started = true;
+ ReadableByteStreamControllerCallPullIfNeeded(controller);
+ }, function (r) {
+ ReadableByteStreamControllerError(controller, r);
+ });
+ }
+ function SetUpReadableByteStreamControllerFromUnderlyingSource(stream, underlyingByteSource, highWaterMark) {
+ var controller = Object.create(ReadableByteStreamController.prototype);
+ function startAlgorithm() {
+ return InvokeOrNoop(underlyingByteSource, 'start', [controller]);
+ }
+ var pullAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingByteSource, 'pull', 0, [controller]);
+ var cancelAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingByteSource, 'cancel', 1, []);
+ var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
+ if (autoAllocateChunkSize !== undefined) {
+ autoAllocateChunkSize = Number(autoAllocateChunkSize);
+ if (NumberIsInteger(autoAllocateChunkSize) === false || autoAllocateChunkSize <= 0) {
+ throw new RangeError('autoAllocateChunkSize must be a positive integer');
+ }
+ }
+ SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize);
+ }
+ function SetUpReadableStreamBYOBRequest(request, controller, view) {
+ request._associatedReadableByteStreamController = controller;
+ request._view = view;
+ }
+ function byobRequestBrandCheckException(name) {
+ return new TypeError("ReadableStreamBYOBRequest.prototype." + name + " can only be used on a ReadableStreamBYOBRequest");
+ }
+ function byteStreamControllerBrandCheckException(name) {
+ return new TypeError("ReadableByteStreamController.prototype." + name + " can only be used on a ReadableByteStreamController");
+ }
+ function AcquireReadableStreamBYOBReader(stream, forAuthorCode) {
+ if (forAuthorCode === void 0) {
+ forAuthorCode = false;
+ }
+ var reader = new ReadableStreamBYOBReader(stream);
+ reader._forAuthorCode = forAuthorCode;
+ return reader;
+ }
+ function ReadableStreamAddReadIntoRequest(stream) {
+ var promise = newPromise(function (resolve, reject) {
+ var readIntoRequest = {
+ _resolve: resolve,
+ _reject: reject
+ };
+ stream._reader._readIntoRequests.push(readIntoRequest);
+ });
+ return promise;
+ }
+ function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) {
+ var reader = stream._reader;
+ var readIntoRequest = reader._readIntoRequests.shift();
+ readIntoRequest._resolve(ReadableStreamCreateReadResult(chunk, done, reader._forAuthorCode));
+ }
+ function ReadableStreamGetNumReadIntoRequests(stream) {
+ return stream._reader._readIntoRequests.length;
+ }
+ function ReadableStreamHasBYOBReader(stream) {
+ var reader = stream._reader;
+ if (reader === undefined) {
+ return false;
+ }
+ if (!IsReadableStreamBYOBReader(reader)) {
+ return false;
+ }
+ return true;
+ }
+ var ReadableStreamBYOBReader = function () {
+ function ReadableStreamBYOBReader(stream) {
+ if (!IsReadableStream(stream)) {
+ throw new TypeError('ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a ' + 'byte source');
+ }
+ if (IsReadableByteStreamController(stream._readableStreamController) === false) {
+ throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' + 'source');
+ }
+ if (IsReadableStreamLocked(stream)) {
+ throw new TypeError('This stream has already been locked for exclusive reading by another reader');
+ }
+ ReadableStreamReaderGenericInitialize(this, stream);
+ this._readIntoRequests = new SimpleQueue();
+ }
+ Object.defineProperty(ReadableStreamBYOBReader.prototype, "closed", {
+ get: function () {
+ if (!IsReadableStreamBYOBReader(this)) {
+ return promiseRejectedWith(byobReaderBrandCheckException('closed'));
+ }
+ return this._closedPromise;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ ReadableStreamBYOBReader.prototype.cancel = function (reason) {
+ if (!IsReadableStreamBYOBReader(this)) {
+ return promiseRejectedWith(byobReaderBrandCheckException('cancel'));
+ }
+ if (this._ownerReadableStream === undefined) {
+ return promiseRejectedWith(readerLockException('cancel'));
+ }
+ return ReadableStreamReaderGenericCancel(this, reason);
+ };
+ ReadableStreamBYOBReader.prototype.read = function (view) {
+ if (!IsReadableStreamBYOBReader(this)) {
+ return promiseRejectedWith(byobReaderBrandCheckException('read'));
+ }
+ if (this._ownerReadableStream === undefined) {
+ return promiseRejectedWith(readerLockException('read from'));
+ }
+ if (!ArrayBuffer.isView(view)) {
+ return promiseRejectedWith(new TypeError('view must be an array buffer view'));
+ }
+ if (IsDetachedBuffer(view.buffer) === true);
+ if (view.byteLength === 0) {
+ return promiseRejectedWith(new TypeError('view must have non-zero byteLength'));
+ }
+ return ReadableStreamBYOBReaderRead(this, view);
+ };
+ ReadableStreamBYOBReader.prototype.releaseLock = function () {
+ if (!IsReadableStreamBYOBReader(this)) {
+ throw byobReaderBrandCheckException('releaseLock');
+ }
+ if (this._ownerReadableStream === undefined) {
+ return;
+ }
+ if (this._readIntoRequests.length > 0) {
+ throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
+ }
+ ReadableStreamReaderGenericRelease(this);
+ };
+ return ReadableStreamBYOBReader;
+ }();
+ function IsReadableStreamBYOBReader(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {
+ return false;
+ }
+ return true;
+ }
+ function ReadableStreamBYOBReaderRead(reader, view) {
+ var stream = reader._ownerReadableStream;
+ stream._disturbed = true;
+ if (stream._state === 'errored') {
+ return promiseRejectedWith(stream._storedError);
+ }
+ return ReadableByteStreamControllerPullInto(stream._readableStreamController, view);
+ }
+ function byobReaderBrandCheckException(name) {
+ return new TypeError("ReadableStreamBYOBReader.prototype." + name + " can only be used on a ReadableStreamBYOBReader");
+ }
+ var ReadableStream = function () {
+ function ReadableStream(underlyingSource, strategy) {
+ if (underlyingSource === void 0) {
+ underlyingSource = {};
+ }
+ if (strategy === void 0) {
+ strategy = {};
+ }
+ InitializeReadableStream(this);
+ var size = strategy.size;
+ var highWaterMark = strategy.highWaterMark;
+ var type = underlyingSource.type;
+ var typeString = String(type);
+ if (typeString === 'bytes') {
+ if (size !== undefined) {
+ throw new RangeError('The strategy for a byte stream cannot have a size function');
+ }
+ if (highWaterMark === undefined) {
+ highWaterMark = 0;
+ }
+ highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark);
+ SetUpReadableByteStreamControllerFromUnderlyingSource(this, underlyingSource, highWaterMark);
+ } else if (type === undefined) {
+ var sizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(size);
+ if (highWaterMark === undefined) {
+ highWaterMark = 1;
+ }
+ highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark);
+ SetUpReadableStreamDefaultControllerFromUnderlyingSource(this, underlyingSource, highWaterMark, sizeAlgorithm);
+ } else {
+ throw new RangeError('Invalid type is specified');
+ }
+ }
+ Object.defineProperty(ReadableStream.prototype, "locked", {
+ get: function () {
+ if (IsReadableStream(this) === false) {
+ throw streamBrandCheckException$1('locked');
+ }
+ return IsReadableStreamLocked(this);
+ },
+ enumerable: true,
+ configurable: true
+ });
+ ReadableStream.prototype.cancel = function (reason) {
+ if (IsReadableStream(this) === false) {
+ return promiseRejectedWith(streamBrandCheckException$1('cancel'));
+ }
+ if (IsReadableStreamLocked(this) === true) {
+ return promiseRejectedWith(new TypeError('Cannot cancel a stream that already has a reader'));
+ }
+ return ReadableStreamCancel(this, reason);
+ };
+ ReadableStream.prototype.getReader = function (_a) {
+ var mode = (_a === void 0 ? {} : _a).mode;
+ if (IsReadableStream(this) === false) {
+ throw streamBrandCheckException$1('getReader');
+ }
+ if (mode === undefined) {
+ return AcquireReadableStreamDefaultReader(this, true);
+ }
+ mode = String(mode);
+ if (mode === 'byob') {
+ return AcquireReadableStreamBYOBReader(this, true);
+ }
+ throw new RangeError('Invalid mode is specified');
+ };
+ ReadableStream.prototype.pipeThrough = function (_a, _b) {
+ var writable = _a.writable, readable = _a.readable;
+ var _c = _b === void 0 ? {} : _b, preventClose = _c.preventClose, preventAbort = _c.preventAbort, preventCancel = _c.preventCancel, signal = _c.signal;
+ if (IsReadableStream(this) === false) {
+ throw streamBrandCheckException$1('pipeThrough');
+ }
+ if (IsWritableStream(writable) === false) {
+ throw new TypeError('writable argument to pipeThrough must be a WritableStream');
+ }
+ if (IsReadableStream(readable) === false) {
+ throw new TypeError('readable argument to pipeThrough must be a ReadableStream');
+ }
+ preventClose = Boolean(preventClose);
+ preventAbort = Boolean(preventAbort);
+ preventCancel = Boolean(preventCancel);
+ if (signal !== undefined && !isAbortSignal(signal)) {
+ throw new TypeError('ReadableStream.prototype.pipeThrough\'s signal option must be an AbortSignal');
+ }
+ if (IsReadableStreamLocked(this) === true) {
+ throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream');
+ }
+ if (IsWritableStreamLocked(writable) === true) {
+ throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream');
+ }
+ var promise = ReadableStreamPipeTo(this, writable, preventClose, preventAbort, preventCancel, signal);
+ setPromiseIsHandledToTrue(promise);
+ return readable;
+ };
+ ReadableStream.prototype.pipeTo = function (dest, _a) {
+ var _b = _a === void 0 ? {} : _a, preventClose = _b.preventClose, preventAbort = _b.preventAbort, preventCancel = _b.preventCancel, signal = _b.signal;
+ if (IsReadableStream(this) === false) {
+ return promiseRejectedWith(streamBrandCheckException$1('pipeTo'));
+ }
+ if (IsWritableStream(dest) === false) {
+ return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo\'s first argument must be a WritableStream'));
+ }
+ preventClose = Boolean(preventClose);
+ preventAbort = Boolean(preventAbort);
+ preventCancel = Boolean(preventCancel);
+ if (signal !== undefined && !isAbortSignal(signal)) {
+ return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo\'s signal option must be an AbortSignal'));
+ }
+ if (IsReadableStreamLocked(this) === true) {
+ return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream'));
+ }
+ if (IsWritableStreamLocked(dest) === true) {
+ return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream'));
+ }
+ return ReadableStreamPipeTo(this, dest, preventClose, preventAbort, preventCancel, signal);
+ };
+ ReadableStream.prototype.tee = function () {
+ if (IsReadableStream(this) === false) {
+ throw streamBrandCheckException$1('tee');
+ }
+ var branches = ReadableStreamTee(this);
+ return createArrayFromList(branches);
+ };
+ ReadableStream.prototype.getIterator = function (_a) {
+ var _b = (_a === void 0 ? {} : _a).preventCancel, preventCancel = _b === void 0 ? false : _b;
+ if (IsReadableStream(this) === false) {
+ throw streamBrandCheckException$1('getIterator');
+ }
+ return AcquireReadableStreamAsyncIterator(this, preventCancel);
+ };
+ return ReadableStream;
+ }();
+ if (typeof SymbolPolyfill.asyncIterator === 'symbol') {
+ Object.defineProperty(ReadableStream.prototype, SymbolPolyfill.asyncIterator, {
+ value: ReadableStream.prototype.getIterator,
+ enumerable: false,
+ writable: true,
+ configurable: true
+ });
+ }
+ function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm) {
+ if (highWaterMark === void 0) {
+ highWaterMark = 1;
+ }
+ if (sizeAlgorithm === void 0) {
+ sizeAlgorithm = function () {
+ return 1;
+ };
+ }
+ var stream = Object.create(ReadableStream.prototype);
+ InitializeReadableStream(stream);
+ var controller = Object.create(ReadableStreamDefaultController.prototype);
+ SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
+ return stream;
+ }
+ function InitializeReadableStream(stream) {
+ stream._state = 'readable';
+ stream._reader = undefined;
+ stream._storedError = undefined;
+ stream._disturbed = false;
+ }
+ function IsReadableStream(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {
+ return false;
+ }
+ return true;
+ }
+ function IsReadableStreamLocked(stream) {
+ if (stream._reader === undefined) {
+ return false;
+ }
+ return true;
+ }
+ function ReadableStreamCancel(stream, reason) {
+ stream._disturbed = true;
+ if (stream._state === 'closed') {
+ return promiseResolvedWith(undefined);
+ }
+ if (stream._state === 'errored') {
+ return promiseRejectedWith(stream._storedError);
+ }
+ ReadableStreamClose(stream);
+ var sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);
+ return transformPromiseWith(sourceCancelPromise, noop);
+ }
+ function ReadableStreamClose(stream) {
+ stream._state = 'closed';
+ var reader = stream._reader;
+ if (reader === undefined) {
+ return;
+ }
+ if (IsReadableStreamDefaultReader(reader)) {
+ reader._readRequests.forEach(function (readRequest) {
+ readRequest._resolve(ReadableStreamCreateReadResult(undefined, true, reader._forAuthorCode));
+ });
+ reader._readRequests = new SimpleQueue();
+ }
+ defaultReaderClosedPromiseResolve(reader);
+ }
+ function ReadableStreamError(stream, e) {
+ stream._state = 'errored';
+ stream._storedError = e;
+ var reader = stream._reader;
+ if (reader === undefined) {
+ return;
+ }
+ if (IsReadableStreamDefaultReader(reader)) {
+ reader._readRequests.forEach(function (readRequest) {
+ readRequest._reject(e);
+ });
+ reader._readRequests = new SimpleQueue();
+ } else {
+ reader._readIntoRequests.forEach(function (readIntoRequest) {
+ readIntoRequest._reject(e);
+ });
+ reader._readIntoRequests = new SimpleQueue();
+ }
+ defaultReaderClosedPromiseReject(reader, e);
+ }
+ function streamBrandCheckException$1(name) {
+ return new TypeError("ReadableStream.prototype." + name + " can only be used on a ReadableStream");
+ }
+ var ByteLengthQueuingStrategy = function () {
+ function ByteLengthQueuingStrategy(_a) {
+ var highWaterMark = _a.highWaterMark;
+ this.highWaterMark = highWaterMark;
+ }
+ ByteLengthQueuingStrategy.prototype.size = function (chunk) {
+ return chunk.byteLength;
+ };
+ return ByteLengthQueuingStrategy;
+ }();
+ var CountQueuingStrategy = function () {
+ function CountQueuingStrategy(_a) {
+ var highWaterMark = _a.highWaterMark;
+ this.highWaterMark = highWaterMark;
+ }
+ CountQueuingStrategy.prototype.size = function () {
+ return 1;
+ };
+ return CountQueuingStrategy;
+ }();
+ var TransformStream = function () {
+ function TransformStream(transformer, writableStrategy, readableStrategy) {
+ if (transformer === void 0) {
+ transformer = {};
+ }
+ if (writableStrategy === void 0) {
+ writableStrategy = {};
+ }
+ if (readableStrategy === void 0) {
+ readableStrategy = {};
+ }
+ var writableSizeFunction = writableStrategy.size;
+ var writableHighWaterMark = writableStrategy.highWaterMark;
+ var readableSizeFunction = readableStrategy.size;
+ var readableHighWaterMark = readableStrategy.highWaterMark;
+ var writableType = transformer.writableType;
+ if (writableType !== undefined) {
+ throw new RangeError('Invalid writable type specified');
+ }
+ var writableSizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(writableSizeFunction);
+ if (writableHighWaterMark === undefined) {
+ writableHighWaterMark = 1;
+ }
+ writableHighWaterMark = ValidateAndNormalizeHighWaterMark(writableHighWaterMark);
+ var readableType = transformer.readableType;
+ if (readableType !== undefined) {
+ throw new RangeError('Invalid readable type specified');
+ }
+ var readableSizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(readableSizeFunction);
+ if (readableHighWaterMark === undefined) {
+ readableHighWaterMark = 0;
+ }
+ readableHighWaterMark = ValidateAndNormalizeHighWaterMark(readableHighWaterMark);
+ var startPromise_resolve;
+ var startPromise = newPromise(function (resolve) {
+ startPromise_resolve = resolve;
+ });
+ InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
+ SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
+ var startResult = InvokeOrNoop(transformer, 'start', [this._transformStreamController]);
+ startPromise_resolve(startResult);
+ }
+ Object.defineProperty(TransformStream.prototype, "readable", {
+ get: function () {
+ if (IsTransformStream(this) === false) {
+ throw streamBrandCheckException$2('readable');
+ }
+ return this._readable;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(TransformStream.prototype, "writable", {
+ get: function () {
+ if (IsTransformStream(this) === false) {
+ throw streamBrandCheckException$2('writable');
+ }
+ return this._writable;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return TransformStream;
+ }();
+ function InitializeTransformStream(stream, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm) {
+ function startAlgorithm() {
+ return startPromise;
+ }
+ function writeAlgorithm(chunk) {
+ return TransformStreamDefaultSinkWriteAlgorithm(stream, chunk);
+ }
+ function abortAlgorithm(reason) {
+ return TransformStreamDefaultSinkAbortAlgorithm(stream, reason);
+ }
+ function closeAlgorithm() {
+ return TransformStreamDefaultSinkCloseAlgorithm(stream);
+ }
+ stream._writable = CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, writableHighWaterMark, writableSizeAlgorithm);
+ function pullAlgorithm() {
+ return TransformStreamDefaultSourcePullAlgorithm(stream);
+ }
+ function cancelAlgorithm(reason) {
+ TransformStreamErrorWritableAndUnblockWrite(stream, reason);
+ return promiseResolvedWith(undefined);
+ }
+ stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
+ stream._backpressure = undefined;
+ stream._backpressureChangePromise = undefined;
+ stream._backpressureChangePromise_resolve = undefined;
+ TransformStreamSetBackpressure(stream, true);
+ stream._transformStreamController = undefined;
+ }
+ function IsTransformStream(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {
+ return false;
+ }
+ return true;
+ }
+ function TransformStreamError(stream, e) {
+ ReadableStreamDefaultControllerError(stream._readable._readableStreamController, e);
+ TransformStreamErrorWritableAndUnblockWrite(stream, e);
+ }
+ function TransformStreamErrorWritableAndUnblockWrite(stream, e) {
+ TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController);
+ WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e);
+ if (stream._backpressure === true) {
+ TransformStreamSetBackpressure(stream, false);
+ }
+ }
+ function TransformStreamSetBackpressure(stream, backpressure) {
+ if (stream._backpressureChangePromise !== undefined) {
+ stream._backpressureChangePromise_resolve();
+ }
+ stream._backpressureChangePromise = newPromise(function (resolve) {
+ stream._backpressureChangePromise_resolve = resolve;
+ });
+ stream._backpressure = backpressure;
+ }
+ var TransformStreamDefaultController = function () {
+ function TransformStreamDefaultController() {
+ throw new TypeError('TransformStreamDefaultController instances cannot be created directly');
+ }
+ Object.defineProperty(TransformStreamDefaultController.prototype, "desiredSize", {
+ get: function () {
+ if (IsTransformStreamDefaultController(this) === false) {
+ throw defaultControllerBrandCheckException$1('desiredSize');
+ }
+ var readableController = this._controlledTransformStream._readable._readableStreamController;
+ return ReadableStreamDefaultControllerGetDesiredSize(readableController);
+ },
+ enumerable: true,
+ configurable: true
+ });
+ TransformStreamDefaultController.prototype.enqueue = function (chunk) {
+ if (IsTransformStreamDefaultController(this) === false) {
+ throw defaultControllerBrandCheckException$1('enqueue');
+ }
+ TransformStreamDefaultControllerEnqueue(this, chunk);
+ };
+ TransformStreamDefaultController.prototype.error = function (reason) {
+ if (IsTransformStreamDefaultController(this) === false) {
+ throw defaultControllerBrandCheckException$1('error');
+ }
+ TransformStreamDefaultControllerError(this, reason);
+ };
+ TransformStreamDefaultController.prototype.terminate = function () {
+ if (IsTransformStreamDefaultController(this) === false) {
+ throw defaultControllerBrandCheckException$1('terminate');
+ }
+ TransformStreamDefaultControllerTerminate(this);
+ };
+ return TransformStreamDefaultController;
+ }();
+ function IsTransformStreamDefaultController(x) {
+ if (!typeIsObject(x)) {
+ return false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {
+ return false;
+ }
+ return true;
+ }
+ function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm) {
+ controller._controlledTransformStream = stream;
+ stream._transformStreamController = controller;
+ controller._transformAlgorithm = transformAlgorithm;
+ controller._flushAlgorithm = flushAlgorithm;
+ }
+ function SetUpTransformStreamDefaultControllerFromTransformer(stream, transformer) {
+ var controller = Object.create(TransformStreamDefaultController.prototype);
+ var transformAlgorithm = function (chunk) {
+ try {
+ TransformStreamDefaultControllerEnqueue(controller, chunk);
+ return promiseResolvedWith(undefined);
+ } catch (transformResultE) {
+ return promiseRejectedWith(transformResultE);
+ }
+ };
+ var transformMethod = transformer.transform;
+ if (transformMethod !== undefined) {
+ if (typeof transformMethod !== 'function') {
+ throw new TypeError('transform is not a method');
+ }
+ transformAlgorithm = function (chunk) {
+ return PromiseCall(transformMethod, transformer, [
+ chunk,
+ controller
+ ]);
+ };
+ }
+ var flushAlgorithm = CreateAlgorithmFromUnderlyingMethod(transformer, 'flush', 0, [controller]);
+ SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm);
+ }
+ function TransformStreamDefaultControllerClearAlgorithms(controller) {
+ controller._transformAlgorithm = undefined;
+ controller._flushAlgorithm = undefined;
+ }
+ function TransformStreamDefaultControllerEnqueue(controller, chunk) {
+ var stream = controller._controlledTransformStream;
+ var readableController = stream._readable._readableStreamController;
+ if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === false) {
+ throw new TypeError('Readable side is not in a state that permits enqueue');
+ }
+ try {
+ ReadableStreamDefaultControllerEnqueue(readableController, chunk);
+ } catch (e) {
+ TransformStreamErrorWritableAndUnblockWrite(stream, e);
+ throw stream._readable._storedError;
+ }
+ var backpressure = ReadableStreamDefaultControllerHasBackpressure(readableController);
+ if (backpressure !== stream._backpressure) {
+ TransformStreamSetBackpressure(stream, true);
+ }
+ }
+ function TransformStreamDefaultControllerError(controller, e) {
+ TransformStreamError(controller._controlledTransformStream, e);
+ }
+ function TransformStreamDefaultControllerPerformTransform(controller, chunk) {
+ var transformPromise = controller._transformAlgorithm(chunk);
+ return transformPromiseWith(transformPromise, undefined, function (r) {
+ TransformStreamError(controller._controlledTransformStream, r);
+ throw r;
+ });
+ }
+ function TransformStreamDefaultControllerTerminate(controller) {
+ var stream = controller._controlledTransformStream;
+ var readableController = stream._readable._readableStreamController;
+ if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === true) {
+ ReadableStreamDefaultControllerClose(readableController);
+ }
+ var error = new TypeError('TransformStream terminated');
+ TransformStreamErrorWritableAndUnblockWrite(stream, error);
+ }
+ function TransformStreamDefaultSinkWriteAlgorithm(stream, chunk) {
+ var controller = stream._transformStreamController;
+ if (stream._backpressure === true) {
+ var backpressureChangePromise = stream._backpressureChangePromise;
+ return transformPromiseWith(backpressureChangePromise, function () {
+ var writable = stream._writable;
+ var state = writable._state;
+ if (state === 'erroring') {
+ throw writable._storedError;
+ }
+ return TransformStreamDefaultControllerPerformTransform(controller, chunk);
+ });
+ }
+ return TransformStreamDefaultControllerPerformTransform(controller, chunk);
+ }
+ function TransformStreamDefaultSinkAbortAlgorithm(stream, reason) {
+ TransformStreamError(stream, reason);
+ return promiseResolvedWith(undefined);
+ }
+ function TransformStreamDefaultSinkCloseAlgorithm(stream) {
+ var readable = stream._readable;
+ var controller = stream._transformStreamController;
+ var flushPromise = controller._flushAlgorithm();
+ TransformStreamDefaultControllerClearAlgorithms(controller);
+ return transformPromiseWith(flushPromise, function () {
+ if (readable._state === 'errored') {
+ throw readable._storedError;
+ }
+ var readableController = readable._readableStreamController;
+ if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === true) {
+ ReadableStreamDefaultControllerClose(readableController);
+ }
+ }, function (r) {
+ TransformStreamError(stream, r);
+ throw readable._storedError;
+ });
+ }
+ function TransformStreamDefaultSourcePullAlgorithm(stream) {
+ TransformStreamSetBackpressure(stream, false);
+ return stream._backpressureChangePromise;
+ }
+ function defaultControllerBrandCheckException$1(name) {
+ return new TypeError("TransformStreamDefaultController.prototype." + name + " can only be used on a TransformStreamDefaultController");
+ }
+ function streamBrandCheckException$2(name) {
+ return new TypeError("TransformStream.prototype." + name + " can only be used on a TransformStream");
+ }
+ exports.ByteLengthQueuingStrategy = ByteLengthQueuingStrategy;
+ exports.CountQueuingStrategy = CountQueuingStrategy;
+ exports.ReadableStream = ReadableStream;
+ exports.TransformStream = TransformStream;
+ exports.WritableStream = WritableStream;
+ Object.defineProperty(exports, '__esModule', { value: true });
+}));
+
+/***/ }),
+/* 144 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(145);
+__w_pdfjs_require__(114);
+__w_pdfjs_require__(77);
+__w_pdfjs_require__(116);
+var path = __w_pdfjs_require__(43);
+module.exports = path.Map;
+
+/***/ }),
+/* 145 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var collection = __w_pdfjs_require__(146);
+var collectionStrong = __w_pdfjs_require__(150);
+module.exports = collection('Map', function (init) {
+ return function Map() {
+ return init(this, arguments.length ? arguments[0] : undefined);
+ };
+}, collectionStrong);
+
+/***/ }),
+/* 146 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var global = __w_pdfjs_require__(11);
+var isForced = __w_pdfjs_require__(52);
+var redefine = __w_pdfjs_require__(29);
+var InternalMetadataModule = __w_pdfjs_require__(147);
+var iterate = __w_pdfjs_require__(124);
+var anInstance = __w_pdfjs_require__(123);
+var isObject = __w_pdfjs_require__(22);
+var fails = __w_pdfjs_require__(14);
+var checkCorrectnessOfIteration = __w_pdfjs_require__(97);
+var setToStringTag = __w_pdfjs_require__(85);
+var inheritIfRequired = __w_pdfjs_require__(149);
+module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
+ var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
+ var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
+ var ADDER = IS_MAP ? 'set' : 'add';
+ var NativeConstructor = global[CONSTRUCTOR_NAME];
+ var NativePrototype = NativeConstructor && NativeConstructor.prototype;
+ var Constructor = NativeConstructor;
+ var exported = {};
+ var fixMethod = function (KEY) {
+ var nativeMethod = NativePrototype[KEY];
+ redefine(NativePrototype, KEY, KEY == 'add' ? function add(value) {
+ nativeMethod.call(this, value === 0 ? 0 : value);
+ return this;
+ } : KEY == 'delete' ? function (key) {
+ return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
+ } : KEY == 'get' ? function get(key) {
+ return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);
+ } : KEY == 'has' ? function has(key) {
+ return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
+ } : function set(key, value) {
+ nativeMethod.call(this, key === 0 ? 0 : key, value);
+ return this;
+ });
+ };
+ if (isForced(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
+ new NativeConstructor().entries().next();
+ })))) {
+ Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
+ InternalMetadataModule.REQUIRED = true;
+ } else if (isForced(CONSTRUCTOR_NAME, true)) {
+ var instance = new Constructor();
+ var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
+ var THROWS_ON_PRIMITIVES = fails(function () {
+ instance.has(1);
+ });
+ var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) {
+ new NativeConstructor(iterable);
+ });
+ var BUGGY_ZERO = !IS_WEAK && fails(function () {
+ var $instance = new NativeConstructor();
+ var index = 5;
+ while (index--)
+ $instance[ADDER](index, index);
+ return !$instance.has(-0);
+ });
+ if (!ACCEPT_ITERABLES) {
+ Constructor = wrapper(function (dummy, iterable) {
+ anInstance(dummy, Constructor, CONSTRUCTOR_NAME);
+ var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
+ if (iterable != undefined)
+ iterate(iterable, that[ADDER], that, IS_MAP);
+ return that;
+ });
+ Constructor.prototype = NativePrototype;
+ NativePrototype.constructor = Constructor;
+ }
+ if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
+ fixMethod('delete');
+ fixMethod('has');
+ IS_MAP && fixMethod('get');
+ }
+ if (BUGGY_ZERO || HASNT_CHAINING)
+ fixMethod(ADDER);
+ if (IS_WEAK && NativePrototype.clear)
+ delete NativePrototype.clear;
+ }
+ exported[CONSTRUCTOR_NAME] = Constructor;
+ $({
+ global: true,
+ forced: Constructor != NativeConstructor
+ }, exported);
+ setToStringTag(Constructor, CONSTRUCTOR_NAME);
+ if (!IS_WEAK)
+ common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
+ return Constructor;
+};
+
+/***/ }),
+/* 147 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var hiddenKeys = __w_pdfjs_require__(39);
+var isObject = __w_pdfjs_require__(22);
+var has = __w_pdfjs_require__(23);
+var defineProperty = __w_pdfjs_require__(27).f;
+var uid = __w_pdfjs_require__(38);
+var FREEZING = __w_pdfjs_require__(148);
+var METADATA = uid('meta');
+var id = 0;
+var isExtensible = Object.isExtensible || function () {
+ return true;
+};
+var setMetadata = function (it) {
+ defineProperty(it, METADATA, {
+ value: {
+ objectID: 'O' + ++id,
+ weakData: {}
+ }
+ });
+};
+var fastKey = function (it, create) {
+ if (!isObject(it))
+ return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
+ if (!has(it, METADATA)) {
+ if (!isExtensible(it))
+ return 'F';
+ if (!create)
+ return 'E';
+ setMetadata(it);
+ }
+ return it[METADATA].objectID;
+};
+var getWeakData = function (it, create) {
+ if (!has(it, METADATA)) {
+ if (!isExtensible(it))
+ return true;
+ if (!create)
+ return false;
+ setMetadata(it);
+ }
+ return it[METADATA].weakData;
+};
+var onFreeze = function (it) {
+ if (FREEZING && meta.REQUIRED && isExtensible(it) && !has(it, METADATA))
+ setMetadata(it);
+ return it;
+};
+var meta = module.exports = {
+ REQUIRED: false,
+ fastKey: fastKey,
+ getWeakData: getWeakData,
+ onFreeze: onFreeze
+};
+hiddenKeys[METADATA] = true;
+
+/***/ }),
+/* 148 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var fails = __w_pdfjs_require__(14);
+module.exports = !fails(function () {
+ return Object.isExtensible(Object.preventExtensions({}));
+});
+
+/***/ }),
+/* 149 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var isObject = __w_pdfjs_require__(22);
+var setPrototypeOf = __w_pdfjs_require__(87);
+module.exports = function ($this, dummy, Wrapper) {
+ var NewTarget, NewTargetPrototype;
+ if (setPrototypeOf && typeof (NewTarget = dummy.constructor) == 'function' && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype)
+ setPrototypeOf($this, NewTargetPrototype);
+ return $this;
+};
+
+/***/ }),
+/* 150 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var defineProperty = __w_pdfjs_require__(27).f;
+var create = __w_pdfjs_require__(71);
+var redefineAll = __w_pdfjs_require__(121);
+var bind = __w_pdfjs_require__(62);
+var anInstance = __w_pdfjs_require__(123);
+var iterate = __w_pdfjs_require__(124);
+var defineIterator = __w_pdfjs_require__(79);
+var setSpecies = __w_pdfjs_require__(122);
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var fastKey = __w_pdfjs_require__(147).fastKey;
+var InternalStateModule = __w_pdfjs_require__(33);
+var setInternalState = InternalStateModule.set;
+var internalStateGetterFor = InternalStateModule.getterFor;
+module.exports = {
+ getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
+ var C = wrapper(function (that, iterable) {
+ anInstance(that, C, CONSTRUCTOR_NAME);
+ setInternalState(that, {
+ type: CONSTRUCTOR_NAME,
+ index: create(null),
+ first: undefined,
+ last: undefined,
+ size: 0
+ });
+ if (!DESCRIPTORS)
+ that.size = 0;
+ if (iterable != undefined)
+ iterate(iterable, that[ADDER], that, IS_MAP);
+ });
+ var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
+ var define = function (that, key, value) {
+ var state = getInternalState(that);
+ var entry = getEntry(that, key);
+ var previous, index;
+ if (entry) {
+ entry.value = value;
+ } else {
+ state.last = entry = {
+ index: index = fastKey(key, true),
+ key: key,
+ value: value,
+ previous: previous = state.last,
+ next: undefined,
+ removed: false
+ };
+ if (!state.first)
+ state.first = entry;
+ if (previous)
+ previous.next = entry;
+ if (DESCRIPTORS)
+ state.size++;
+ else
+ that.size++;
+ if (index !== 'F')
+ state.index[index] = entry;
+ }
+ return that;
+ };
+ var getEntry = function (that, key) {
+ var state = getInternalState(that);
+ var index = fastKey(key);
+ var entry;
+ if (index !== 'F')
+ return state.index[index];
+ for (entry = state.first; entry; entry = entry.next) {
+ if (entry.key == key)
+ return entry;
+ }
+ };
+ redefineAll(C.prototype, {
+ clear: function clear() {
+ var that = this;
+ var state = getInternalState(that);
+ var data = state.index;
+ var entry = state.first;
+ while (entry) {
+ entry.removed = true;
+ if (entry.previous)
+ entry.previous = entry.previous.next = undefined;
+ delete data[entry.index];
+ entry = entry.next;
+ }
+ state.first = state.last = undefined;
+ if (DESCRIPTORS)
+ state.size = 0;
+ else
+ that.size = 0;
+ },
+ 'delete': function (key) {
+ var that = this;
+ var state = getInternalState(that);
+ var entry = getEntry(that, key);
+ if (entry) {
+ var next = entry.next;
+ var prev = entry.previous;
+ delete state.index[entry.index];
+ entry.removed = true;
+ if (prev)
+ prev.next = next;
+ if (next)
+ next.previous = prev;
+ if (state.first == entry)
+ state.first = next;
+ if (state.last == entry)
+ state.last = prev;
+ if (DESCRIPTORS)
+ state.size--;
+ else
+ that.size--;
+ }
+ return !!entry;
+ },
+ forEach: function forEach(callbackfn) {
+ var state = getInternalState(this);
+ var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
+ var entry;
+ while (entry = entry ? entry.next : state.first) {
+ boundFunction(entry.value, entry.key, this);
+ while (entry && entry.removed)
+ entry = entry.previous;
+ }
+ },
+ has: function has(key) {
+ return !!getEntry(this, key);
+ }
+ });
+ redefineAll(C.prototype, IS_MAP ? {
+ get: function get(key) {
+ var entry = getEntry(this, key);
+ return entry && entry.value;
+ },
+ set: function set(key, value) {
+ return define(this, key === 0 ? 0 : key, value);
+ }
+ } : {
+ add: function add(value) {
+ return define(this, value = value === 0 ? 0 : value, value);
+ }
+ });
+ if (DESCRIPTORS)
+ defineProperty(C.prototype, 'size', {
+ get: function () {
+ return getInternalState(this).size;
+ }
+ });
+ return C;
+ },
+ setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
+ var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
+ var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
+ var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
+ defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
+ setInternalState(this, {
+ type: ITERATOR_NAME,
+ target: iterated,
+ state: getInternalCollectionState(iterated),
+ kind: kind,
+ last: undefined
+ });
+ }, function () {
+ var state = getInternalIteratorState(this);
+ var kind = state.kind;
+ var entry = state.last;
+ while (entry && entry.removed)
+ entry = entry.previous;
+ if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
+ state.target = undefined;
+ return {
+ value: undefined,
+ done: true
+ };
+ }
+ if (kind == 'keys')
+ return {
+ value: entry.key,
+ done: false
+ };
+ if (kind == 'values')
+ return {
+ value: entry.value,
+ done: false
+ };
+ return {
+ value: [
+ entry.key,
+ entry.value
+ ],
+ done: false
+ };
+ }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
+ setSpecies(CONSTRUCTOR_NAME);
+ }
+};
+
+/***/ }),
+/* 151 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(152);
+__w_pdfjs_require__(114);
+__w_pdfjs_require__(77);
+__w_pdfjs_require__(116);
+var path = __w_pdfjs_require__(43);
+module.exports = path.Set;
+
+/***/ }),
+/* 152 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var collection = __w_pdfjs_require__(146);
+var collectionStrong = __w_pdfjs_require__(150);
+module.exports = collection('Set', function (init) {
+ return function Set() {
+ return init(this, arguments.length ? arguments[0] : undefined);
+ };
+}, collectionStrong);
+
+/***/ }),
+/* 153 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(114);
+__w_pdfjs_require__(154);
+__w_pdfjs_require__(116);
+var path = __w_pdfjs_require__(43);
+module.exports = path.WeakMap;
+
+/***/ }),
+/* 154 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var global = __w_pdfjs_require__(11);
+var redefineAll = __w_pdfjs_require__(121);
+var InternalMetadataModule = __w_pdfjs_require__(147);
+var collection = __w_pdfjs_require__(146);
+var collectionWeak = __w_pdfjs_require__(155);
+var isObject = __w_pdfjs_require__(22);
+var enforceIternalState = __w_pdfjs_require__(33).enforce;
+var NATIVE_WEAK_MAP = __w_pdfjs_require__(34);
+var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
+var isExtensible = Object.isExtensible;
+var InternalWeakMap;
+var wrapper = function (init) {
+ return function WeakMap() {
+ return init(this, arguments.length ? arguments[0] : undefined);
+ };
+};
+var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak);
+if (NATIVE_WEAK_MAP && IS_IE11) {
+ InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
+ InternalMetadataModule.REQUIRED = true;
+ var WeakMapPrototype = $WeakMap.prototype;
+ var nativeDelete = WeakMapPrototype['delete'];
+ var nativeHas = WeakMapPrototype.has;
+ var nativeGet = WeakMapPrototype.get;
+ var nativeSet = WeakMapPrototype.set;
+ redefineAll(WeakMapPrototype, {
+ 'delete': function (key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen)
+ state.frozen = new InternalWeakMap();
+ return nativeDelete.call(this, key) || state.frozen['delete'](key);
+ }
+ return nativeDelete.call(this, key);
+ },
+ has: function has(key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen)
+ state.frozen = new InternalWeakMap();
+ return nativeHas.call(this, key) || state.frozen.has(key);
+ }
+ return nativeHas.call(this, key);
+ },
+ get: function get(key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen)
+ state.frozen = new InternalWeakMap();
+ return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key);
+ }
+ return nativeGet.call(this, key);
+ },
+ set: function set(key, value) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceIternalState(this);
+ if (!state.frozen)
+ state.frozen = new InternalWeakMap();
+ nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value);
+ } else
+ nativeSet.call(this, key, value);
+ return this;
+ }
+ });
+}
+
+/***/ }),
+/* 155 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var redefineAll = __w_pdfjs_require__(121);
+var getWeakData = __w_pdfjs_require__(147).getWeakData;
+var anObject = __w_pdfjs_require__(28);
+var isObject = __w_pdfjs_require__(22);
+var anInstance = __w_pdfjs_require__(123);
+var iterate = __w_pdfjs_require__(124);
+var ArrayIterationModule = __w_pdfjs_require__(156);
+var $has = __w_pdfjs_require__(23);
+var InternalStateModule = __w_pdfjs_require__(33);
+var setInternalState = InternalStateModule.set;
+var internalStateGetterFor = InternalStateModule.getterFor;
+var find = ArrayIterationModule.find;
+var findIndex = ArrayIterationModule.findIndex;
+var id = 0;
+var uncaughtFrozenStore = function (store) {
+ return store.frozen || (store.frozen = new UncaughtFrozenStore());
+};
+var UncaughtFrozenStore = function () {
+ this.entries = [];
+};
+var findUncaughtFrozen = function (store, key) {
+ return find(store.entries, function (it) {
+ return it[0] === key;
+ });
+};
+UncaughtFrozenStore.prototype = {
+ get: function (key) {
+ var entry = findUncaughtFrozen(this, key);
+ if (entry)
+ return entry[1];
+ },
+ has: function (key) {
+ return !!findUncaughtFrozen(this, key);
+ },
+ set: function (key, value) {
+ var entry = findUncaughtFrozen(this, key);
+ if (entry)
+ entry[1] = value;
+ else
+ this.entries.push([
+ key,
+ value
+ ]);
+ },
+ 'delete': function (key) {
+ var index = findIndex(this.entries, function (it) {
+ return it[0] === key;
+ });
+ if (~index)
+ this.entries.splice(index, 1);
+ return !!~index;
+ }
+};
+module.exports = {
+ getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
+ var C = wrapper(function (that, iterable) {
+ anInstance(that, C, CONSTRUCTOR_NAME);
+ setInternalState(that, {
+ type: CONSTRUCTOR_NAME,
+ id: id++,
+ frozen: undefined
+ });
+ if (iterable != undefined)
+ iterate(iterable, that[ADDER], that, IS_MAP);
+ });
+ var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
+ var define = function (that, key, value) {
+ var state = getInternalState(that);
+ var data = getWeakData(anObject(key), true);
+ if (data === true)
+ uncaughtFrozenStore(state).set(key, value);
+ else
+ data[state.id] = value;
+ return that;
+ };
+ redefineAll(C.prototype, {
+ 'delete': function (key) {
+ var state = getInternalState(this);
+ if (!isObject(key))
+ return false;
+ var data = getWeakData(key);
+ if (data === true)
+ return uncaughtFrozenStore(state)['delete'](key);
+ return data && $has(data, state.id) && delete data[state.id];
+ },
+ has: function has(key) {
+ var state = getInternalState(this);
+ if (!isObject(key))
+ return false;
+ var data = getWeakData(key);
+ if (data === true)
+ return uncaughtFrozenStore(state).has(key);
+ return data && $has(data, state.id);
+ }
+ });
+ redefineAll(C.prototype, IS_MAP ? {
+ get: function get(key) {
+ var state = getInternalState(this);
+ if (isObject(key)) {
+ var data = getWeakData(key);
+ if (data === true)
+ return uncaughtFrozenStore(state).get(key);
+ return data ? data[state.id] : undefined;
+ }
+ },
+ set: function set(key, value) {
+ return define(this, key, value);
+ }
+ } : {
+ add: function add(value) {
+ return define(this, value, true);
+ }
+ });
+ return C;
+ }
+};
+
+/***/ }),
+/* 156 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var bind = __w_pdfjs_require__(62);
+var IndexedObject = __w_pdfjs_require__(18);
+var toObject = __w_pdfjs_require__(83);
+var toLength = __w_pdfjs_require__(47);
+var arraySpeciesCreate = __w_pdfjs_require__(157);
+var push = [].push;
+var createMethod = function (TYPE) {
+ var IS_MAP = TYPE == 1;
+ var IS_FILTER = TYPE == 2;
+ var IS_SOME = TYPE == 3;
+ var IS_EVERY = TYPE == 4;
+ var IS_FIND_INDEX = TYPE == 6;
+ var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
+ return function ($this, callbackfn, that, specificCreate) {
+ var O = toObject($this);
+ var self = IndexedObject(O);
+ var boundFunction = bind(callbackfn, that, 3);
+ var length = toLength(self.length);
+ var index = 0;
+ var create = specificCreate || arraySpeciesCreate;
+ var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
+ var value, result;
+ for (; length > index; index++)
+ if (NO_HOLES || index in self) {
+ value = self[index];
+ result = boundFunction(value, index, O);
+ if (TYPE) {
+ if (IS_MAP)
+ target[index] = result;
+ else if (result)
+ switch (TYPE) {
+ case 3:
+ return true;
+ case 5:
+ return value;
+ case 6:
+ return index;
+ case 2:
+ push.call(target, value);
+ }
+ else if (IS_EVERY)
+ return false;
+ }
+ }
+ return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
+ };
+};
+module.exports = {
+ forEach: createMethod(0),
+ map: createMethod(1),
+ filter: createMethod(2),
+ some: createMethod(3),
+ every: createMethod(4),
+ find: createMethod(5),
+ findIndex: createMethod(6)
+};
+
+/***/ }),
+/* 157 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var isObject = __w_pdfjs_require__(22);
+var isArray = __w_pdfjs_require__(158);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var SPECIES = wellKnownSymbol('species');
+module.exports = function (originalArray, length) {
+ var C;
+ if (isArray(originalArray)) {
+ C = originalArray.constructor;
+ if (typeof C == 'function' && (C === Array || isArray(C.prototype)))
+ C = undefined;
+ else if (isObject(C)) {
+ C = C[SPECIES];
+ if (C === null)
+ C = undefined;
+ }
+ }
+ return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
+};
+
+/***/ }),
+/* 158 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var classof = __w_pdfjs_require__(19);
+module.exports = Array.isArray || function isArray(arg) {
+ return classof(arg) == 'Array';
+};
+
+/***/ }),
+/* 159 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(114);
+__w_pdfjs_require__(160);
+__w_pdfjs_require__(116);
+var path = __w_pdfjs_require__(43);
+module.exports = path.WeakSet;
+
+/***/ }),
+/* 160 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var collection = __w_pdfjs_require__(146);
+var collectionWeak = __w_pdfjs_require__(155);
+collection('WeakSet', function (init) {
+ return function WeakSet() {
+ return init(this, arguments.length ? arguments[0] : undefined);
+ };
+}, collectionWeak);
+
+/***/ }),
+/* 161 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(162);
+var entryUnbind = __w_pdfjs_require__(61);
+module.exports = entryUnbind('String', 'codePointAt');
+
+/***/ }),
+/* 162 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var codeAt = __w_pdfjs_require__(78).codeAt;
+$({
+ target: 'String',
+ proto: true
+}, {
+ codePointAt: function codePointAt(pos) {
+ return codeAt(this, pos);
+ }
+});
+
+/***/ }),
+/* 163 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(164);
+var path = __w_pdfjs_require__(43);
+module.exports = path.String.fromCodePoint;
+
+/***/ }),
+/* 164 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var $ = __w_pdfjs_require__(10);
+var toAbsoluteIndex = __w_pdfjs_require__(49);
+var fromCharCode = String.fromCharCode;
+var nativeFromCodePoint = String.fromCodePoint;
+var INCORRECT_LENGTH = !!nativeFromCodePoint && nativeFromCodePoint.length != 1;
+$({
+ target: 'String',
+ stat: true,
+ forced: INCORRECT_LENGTH
+}, {
+ fromCodePoint: function fromCodePoint(x) {
+ var elements = [];
+ var length = arguments.length;
+ var i = 0;
+ var code;
+ while (length > i) {
+ code = +arguments[i++];
+ if (toAbsoluteIndex(code, 0x10FFFF) !== code)
+ throw RangeError(code + ' is not a valid code point');
+ elements.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00));
+ }
+ return elements.join('');
+ }
+});
+
+/***/ }),
+/* 165 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(166);
+__w_pdfjs_require__(114);
+__w_pdfjs_require__(168);
+__w_pdfjs_require__(172);
+__w_pdfjs_require__(173);
+__w_pdfjs_require__(174);
+__w_pdfjs_require__(175);
+__w_pdfjs_require__(176);
+__w_pdfjs_require__(177);
+__w_pdfjs_require__(178);
+__w_pdfjs_require__(179);
+__w_pdfjs_require__(180);
+__w_pdfjs_require__(181);
+__w_pdfjs_require__(182);
+__w_pdfjs_require__(183);
+__w_pdfjs_require__(184);
+__w_pdfjs_require__(185);
+__w_pdfjs_require__(186);
+__w_pdfjs_require__(187);
+var path = __w_pdfjs_require__(43);
+module.exports = path.Symbol;
+
+/***/ }),
+/* 166 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var fails = __w_pdfjs_require__(14);
+var isArray = __w_pdfjs_require__(158);
+var isObject = __w_pdfjs_require__(22);
+var toObject = __w_pdfjs_require__(83);
+var toLength = __w_pdfjs_require__(47);
+var createProperty = __w_pdfjs_require__(93);
+var arraySpeciesCreate = __w_pdfjs_require__(157);
+var arrayMethodHasSpeciesSupport = __w_pdfjs_require__(167);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var V8_VERSION = __w_pdfjs_require__(133);
+var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
+var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
+var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
+var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
+ var array = [];
+ array[IS_CONCAT_SPREADABLE] = false;
+ return array.concat()[0] !== array;
+});
+var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
+var isConcatSpreadable = function (O) {
+ if (!isObject(O))
+ return false;
+ var spreadable = O[IS_CONCAT_SPREADABLE];
+ return spreadable !== undefined ? !!spreadable : isArray(O);
+};
+var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
+$({
+ target: 'Array',
+ proto: true,
+ forced: FORCED
+}, {
+ concat: function concat(arg) {
+ var O = toObject(this);
+ var A = arraySpeciesCreate(O, 0);
+ var n = 0;
+ var i, k, length, len, E;
+ for (i = -1, length = arguments.length; i < length; i++) {
+ E = i === -1 ? O : arguments[i];
+ if (isConcatSpreadable(E)) {
+ len = toLength(E.length);
+ if (n + len > MAX_SAFE_INTEGER)
+ throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
+ for (k = 0; k < len; k++, n++)
+ if (k in E)
+ createProperty(A, n, E[k]);
+ } else {
+ if (n >= MAX_SAFE_INTEGER)
+ throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
+ createProperty(A, n++, E);
+ }
+ }
+ A.length = n;
+ return A;
+ }
+});
+
+/***/ }),
+/* 167 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var fails = __w_pdfjs_require__(14);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var V8_VERSION = __w_pdfjs_require__(133);
+var SPECIES = wellKnownSymbol('species');
+module.exports = function (METHOD_NAME) {
+ return V8_VERSION >= 51 || !fails(function () {
+ var array = [];
+ var constructor = array.constructor = {};
+ constructor[SPECIES] = function () {
+ return { foo: 1 };
+ };
+ return array[METHOD_NAME](Boolean).foo !== 1;
+ });
+};
+
+/***/ }),
+/* 168 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var global = __w_pdfjs_require__(11);
+var getBuiltIn = __w_pdfjs_require__(42);
+var IS_PURE = __w_pdfjs_require__(37);
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var NATIVE_SYMBOL = __w_pdfjs_require__(58);
+var USE_SYMBOL_AS_UID = __w_pdfjs_require__(59);
+var fails = __w_pdfjs_require__(14);
+var has = __w_pdfjs_require__(23);
+var isArray = __w_pdfjs_require__(158);
+var isObject = __w_pdfjs_require__(22);
+var anObject = __w_pdfjs_require__(28);
+var toObject = __w_pdfjs_require__(83);
+var toIndexedObject = __w_pdfjs_require__(17);
+var toPrimitive = __w_pdfjs_require__(21);
+var createPropertyDescriptor = __w_pdfjs_require__(16);
+var nativeObjectCreate = __w_pdfjs_require__(71);
+var objectKeys = __w_pdfjs_require__(73);
+var getOwnPropertyNamesModule = __w_pdfjs_require__(44);
+var getOwnPropertyNamesExternal = __w_pdfjs_require__(169);
+var getOwnPropertySymbolsModule = __w_pdfjs_require__(51);
+var getOwnPropertyDescriptorModule = __w_pdfjs_require__(12);
+var definePropertyModule = __w_pdfjs_require__(27);
+var propertyIsEnumerableModule = __w_pdfjs_require__(15);
+var createNonEnumerableProperty = __w_pdfjs_require__(26);
+var redefine = __w_pdfjs_require__(29);
+var shared = __w_pdfjs_require__(36);
+var sharedKey = __w_pdfjs_require__(35);
+var hiddenKeys = __w_pdfjs_require__(39);
+var uid = __w_pdfjs_require__(38);
+var wellKnownSymbol = __w_pdfjs_require__(57);
+var wrappedWellKnownSymbolModule = __w_pdfjs_require__(170);
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+var setToStringTag = __w_pdfjs_require__(85);
+var InternalStateModule = __w_pdfjs_require__(33);
+var $forEach = __w_pdfjs_require__(156).forEach;
+var HIDDEN = sharedKey('hidden');
+var SYMBOL = 'Symbol';
+var PROTOTYPE = 'prototype';
+var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
+var setInternalState = InternalStateModule.set;
+var getInternalState = InternalStateModule.getterFor(SYMBOL);
+var ObjectPrototype = Object[PROTOTYPE];
+var $Symbol = global.Symbol;
+var $stringify = getBuiltIn('JSON', 'stringify');
+var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
+var nativeDefineProperty = definePropertyModule.f;
+var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
+var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
+var AllSymbols = shared('symbols');
+var ObjectPrototypeSymbols = shared('op-symbols');
+var StringToSymbolRegistry = shared('string-to-symbol-registry');
+var SymbolToStringRegistry = shared('symbol-to-string-registry');
+var WellKnownSymbolsStore = shared('wks');
+var QObject = global.QObject;
+var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
+var setSymbolDescriptor = DESCRIPTORS && fails(function () {
+ return nativeObjectCreate(nativeDefineProperty({}, 'a', {
+ get: function () {
+ return nativeDefineProperty(this, 'a', { value: 7 }).a;
+ }
+ })).a != 7;
+}) ? function (O, P, Attributes) {
+ var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
+ if (ObjectPrototypeDescriptor)
+ delete ObjectPrototype[P];
+ nativeDefineProperty(O, P, Attributes);
+ if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
+ nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
+ }
+} : nativeDefineProperty;
+var wrap = function (tag, description) {
+ var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]);
+ setInternalState(symbol, {
+ type: SYMBOL,
+ tag: tag,
+ description: description
+ });
+ if (!DESCRIPTORS)
+ symbol.description = description;
+ return symbol;
+};
+var isSymbol = USE_SYMBOL_AS_UID ? function (it) {
+ return typeof it == 'symbol';
+} : function (it) {
+ return Object(it) instanceof $Symbol;
+};
+var $defineProperty = function defineProperty(O, P, Attributes) {
+ if (O === ObjectPrototype)
+ $defineProperty(ObjectPrototypeSymbols, P, Attributes);
+ anObject(O);
+ var key = toPrimitive(P, true);
+ anObject(Attributes);
+ if (has(AllSymbols, key)) {
+ if (!Attributes.enumerable) {
+ if (!has(O, HIDDEN))
+ nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
+ O[HIDDEN][key] = true;
+ } else {
+ if (has(O, HIDDEN) && O[HIDDEN][key])
+ O[HIDDEN][key] = false;
+ Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
+ }
+ return setSymbolDescriptor(O, key, Attributes);
+ }
+ return nativeDefineProperty(O, key, Attributes);
+};
+var $defineProperties = function defineProperties(O, Properties) {
+ anObject(O);
+ var properties = toIndexedObject(Properties);
+ var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
+ $forEach(keys, function (key) {
+ if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key))
+ $defineProperty(O, key, properties[key]);
+ });
+ return O;
+};
+var $create = function create(O, Properties) {
+ return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
+};
+var $propertyIsEnumerable = function propertyIsEnumerable(V) {
+ var P = toPrimitive(V, true);
+ var enumerable = nativePropertyIsEnumerable.call(this, P);
+ if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P))
+ return false;
+ return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
+};
+var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
+ var it = toIndexedObject(O);
+ var key = toPrimitive(P, true);
+ if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key))
+ return;
+ var descriptor = nativeGetOwnPropertyDescriptor(it, key);
+ if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
+ descriptor.enumerable = true;
+ }
+ return descriptor;
+};
+var $getOwnPropertyNames = function getOwnPropertyNames(O) {
+ var names = nativeGetOwnPropertyNames(toIndexedObject(O));
+ var result = [];
+ $forEach(names, function (key) {
+ if (!has(AllSymbols, key) && !has(hiddenKeys, key))
+ result.push(key);
+ });
+ return result;
+};
+var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
+ var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
+ var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
+ var result = [];
+ $forEach(names, function (key) {
+ if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
+ result.push(AllSymbols[key]);
+ }
+ });
+ return result;
+};
+if (!NATIVE_SYMBOL) {
+ $Symbol = function Symbol() {
+ if (this instanceof $Symbol)
+ throw TypeError('Symbol is not a constructor');
+ var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
+ var tag = uid(description);
+ var setter = function (value) {
+ if (this === ObjectPrototype)
+ setter.call(ObjectPrototypeSymbols, value);
+ if (has(this, HIDDEN) && has(this[HIDDEN], tag))
+ this[HIDDEN][tag] = false;
+ setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
+ };
+ if (DESCRIPTORS && USE_SETTER)
+ setSymbolDescriptor(ObjectPrototype, tag, {
+ configurable: true,
+ set: setter
+ });
+ return wrap(tag, description);
+ };
+ redefine($Symbol[PROTOTYPE], 'toString', function toString() {
+ return getInternalState(this).tag;
+ });
+ redefine($Symbol, 'withoutSetter', function (description) {
+ return wrap(uid(description), description);
+ });
+ propertyIsEnumerableModule.f = $propertyIsEnumerable;
+ definePropertyModule.f = $defineProperty;
+ getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
+ getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
+ getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
+ wrappedWellKnownSymbolModule.f = function (name) {
+ return wrap(wellKnownSymbol(name), name);
+ };
+ if (DESCRIPTORS) {
+ nativeDefineProperty($Symbol[PROTOTYPE], 'description', {
+ configurable: true,
+ get: function description() {
+ return getInternalState(this).description;
+ }
+ });
+ if (!IS_PURE) {
+ redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
+ }
+ }
+}
+$({
+ global: true,
+ wrap: true,
+ forced: !NATIVE_SYMBOL,
+ sham: !NATIVE_SYMBOL
+}, { Symbol: $Symbol });
+$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
+ defineWellKnownSymbol(name);
+});
+$({
+ target: SYMBOL,
+ stat: true,
+ forced: !NATIVE_SYMBOL
+}, {
+ 'for': function (key) {
+ var string = String(key);
+ if (has(StringToSymbolRegistry, string))
+ return StringToSymbolRegistry[string];
+ var symbol = $Symbol(string);
+ StringToSymbolRegistry[string] = symbol;
+ SymbolToStringRegistry[symbol] = string;
+ return symbol;
+ },
+ keyFor: function keyFor(sym) {
+ if (!isSymbol(sym))
+ throw TypeError(sym + ' is not a symbol');
+ if (has(SymbolToStringRegistry, sym))
+ return SymbolToStringRegistry[sym];
+ },
+ useSetter: function () {
+ USE_SETTER = true;
+ },
+ useSimple: function () {
+ USE_SETTER = false;
+ }
+});
+$({
+ target: 'Object',
+ stat: true,
+ forced: !NATIVE_SYMBOL,
+ sham: !DESCRIPTORS
+}, {
+ create: $create,
+ defineProperty: $defineProperty,
+ defineProperties: $defineProperties,
+ getOwnPropertyDescriptor: $getOwnPropertyDescriptor
+});
+$({
+ target: 'Object',
+ stat: true,
+ forced: !NATIVE_SYMBOL
+}, {
+ getOwnPropertyNames: $getOwnPropertyNames,
+ getOwnPropertySymbols: $getOwnPropertySymbols
+});
+$({
+ target: 'Object',
+ stat: true,
+ forced: fails(function () {
+ getOwnPropertySymbolsModule.f(1);
+ })
+}, {
+ getOwnPropertySymbols: function getOwnPropertySymbols(it) {
+ return getOwnPropertySymbolsModule.f(toObject(it));
+ }
+});
+if ($stringify) {
+ var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () {
+ var symbol = $Symbol();
+ return $stringify([symbol]) != '[null]' || $stringify({ a: symbol }) != '{}' || $stringify(Object(symbol)) != '{}';
+ });
+ $({
+ target: 'JSON',
+ stat: true,
+ forced: FORCED_JSON_STRINGIFY
+ }, {
+ stringify: function stringify(it, replacer, space) {
+ var args = [it];
+ var index = 1;
+ var $replacer;
+ while (arguments.length > index)
+ args.push(arguments[index++]);
+ $replacer = replacer;
+ if (!isObject(replacer) && it === undefined || isSymbol(it))
+ return;
+ if (!isArray(replacer))
+ replacer = function (key, value) {
+ if (typeof $replacer == 'function')
+ value = $replacer.call(this, key, value);
+ if (!isSymbol(value))
+ return value;
+ };
+ args[1] = replacer;
+ return $stringify.apply(null, args);
+ }
+ });
+}
+if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {
+ createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
+}
+setToStringTag($Symbol, SYMBOL);
+hiddenKeys[HIDDEN] = true;
+
+/***/ }),
+/* 169 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var toIndexedObject = __w_pdfjs_require__(17);
+var nativeGetOwnPropertyNames = __w_pdfjs_require__(44).f;
+var toString = {}.toString;
+var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
+var getWindowNames = function (it) {
+ try {
+ return nativeGetOwnPropertyNames(it);
+ } catch (error) {
+ return windowNames.slice();
+ }
+};
+module.exports.f = function getOwnPropertyNames(it) {
+ return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : nativeGetOwnPropertyNames(toIndexedObject(it));
+};
+
+/***/ }),
+/* 170 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var wellKnownSymbol = __w_pdfjs_require__(57);
+exports.f = wellKnownSymbol;
+
+/***/ }),
+/* 171 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var path = __w_pdfjs_require__(43);
+var has = __w_pdfjs_require__(23);
+var wrappedWellKnownSymbolModule = __w_pdfjs_require__(170);
+var defineProperty = __w_pdfjs_require__(27).f;
+module.exports = function (NAME) {
+ var Symbol = path.Symbol || (path.Symbol = {});
+ if (!has(Symbol, NAME))
+ defineProperty(Symbol, NAME, { value: wrappedWellKnownSymbolModule.f(NAME) });
+};
+
+/***/ }),
+/* 172 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('asyncIterator');
+
+/***/ }),
+/* 173 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var global = __w_pdfjs_require__(11);
+var has = __w_pdfjs_require__(23);
+var isObject = __w_pdfjs_require__(22);
+var defineProperty = __w_pdfjs_require__(27).f;
+var copyConstructorProperties = __w_pdfjs_require__(40);
+var NativeSymbol = global.Symbol;
+if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) || NativeSymbol().description !== undefined)) {
+ var EmptyStringDescriptionStore = {};
+ var SymbolWrapper = function Symbol() {
+ var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
+ var result = this instanceof SymbolWrapper ? new NativeSymbol(description) : description === undefined ? NativeSymbol() : NativeSymbol(description);
+ if (description === '')
+ EmptyStringDescriptionStore[result] = true;
+ return result;
+ };
+ copyConstructorProperties(SymbolWrapper, NativeSymbol);
+ var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
+ symbolPrototype.constructor = SymbolWrapper;
+ var symbolToString = symbolPrototype.toString;
+ var native = String(NativeSymbol('test')) == 'Symbol(test)';
+ var regexp = /^Symbol\((.*)\)[^)]+$/;
+ defineProperty(symbolPrototype, 'description', {
+ configurable: true,
+ get: function description() {
+ var symbol = isObject(this) ? this.valueOf() : this;
+ var string = symbolToString.call(symbol);
+ if (has(EmptyStringDescriptionStore, symbol))
+ return '';
+ var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
+ return desc === '' ? undefined : desc;
+ }
+ });
+ $({
+ global: true,
+ forced: true
+ }, { Symbol: SymbolWrapper });
+}
+
+/***/ }),
+/* 174 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('hasInstance');
+
+/***/ }),
+/* 175 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('isConcatSpreadable');
+
+/***/ }),
+/* 176 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('iterator');
+
+/***/ }),
+/* 177 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('match');
+
+/***/ }),
+/* 178 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('matchAll');
+
+/***/ }),
+/* 179 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('replace');
+
+/***/ }),
+/* 180 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('search');
+
+/***/ }),
+/* 181 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('species');
+
+/***/ }),
+/* 182 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('split');
+
+/***/ }),
+/* 183 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('toPrimitive');
+
+/***/ }),
+/* 184 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('toStringTag');
+
+/***/ }),
+/* 185 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var defineWellKnownSymbol = __w_pdfjs_require__(171);
+defineWellKnownSymbol('unscopables');
+
+/***/ }),
+/* 186 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var setToStringTag = __w_pdfjs_require__(85);
+setToStringTag(Math, 'Math', true);
+
+/***/ }),
+/* 187 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var global = __w_pdfjs_require__(11);
+var setToStringTag = __w_pdfjs_require__(85);
+setToStringTag(global.JSON, 'JSON', true);
+
+/***/ }),
+/* 188 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(189);
+var entryUnbind = __w_pdfjs_require__(61);
+module.exports = entryUnbind('String', 'padStart');
+
+/***/ }),
+/* 189 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var $padStart = __w_pdfjs_require__(190).start;
+var WEBKIT_BUG = __w_pdfjs_require__(192);
+$({
+ target: 'String',
+ proto: true,
+ forced: WEBKIT_BUG
+}, {
+ padStart: function padStart(maxLength) {
+ return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+/***/ }),
+/* 190 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var toLength = __w_pdfjs_require__(47);
+var repeat = __w_pdfjs_require__(191);
+var requireObjectCoercible = __w_pdfjs_require__(20);
+var ceil = Math.ceil;
+var createMethod = function (IS_END) {
+ return function ($this, maxLength, fillString) {
+ var S = String(requireObjectCoercible($this));
+ var stringLength = S.length;
+ var fillStr = fillString === undefined ? ' ' : String(fillString);
+ var intMaxLength = toLength(maxLength);
+ var fillLen, stringFiller;
+ if (intMaxLength <= stringLength || fillStr == '')
+ return S;
+ fillLen = intMaxLength - stringLength;
+ stringFiller = repeat.call(fillStr, ceil(fillLen / fillStr.length));
+ if (stringFiller.length > fillLen)
+ stringFiller = stringFiller.slice(0, fillLen);
+ return IS_END ? S + stringFiller : stringFiller + S;
+ };
+};
+module.exports = {
+ start: createMethod(false),
+ end: createMethod(true)
+};
+
+/***/ }),
+/* 191 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var toInteger = __w_pdfjs_require__(48);
+var requireObjectCoercible = __w_pdfjs_require__(20);
+module.exports = ''.repeat || function repeat(count) {
+ var str = String(requireObjectCoercible(this));
+ var result = '';
+ var n = toInteger(count);
+ if (n < 0 || n == Infinity)
+ throw RangeError('Wrong number of repetitions');
+ for (; n > 0; (n >>>= 1) && (str += str))
+ if (n & 1)
+ result += str;
+ return result;
+};
+
+/***/ }),
+/* 192 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var userAgent = __w_pdfjs_require__(127);
+module.exports = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);
+
+/***/ }),
+/* 193 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(194);
+var entryUnbind = __w_pdfjs_require__(61);
+module.exports = entryUnbind('String', 'padEnd');
+
+/***/ }),
+/* 194 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+"use strict";
+
+var $ = __w_pdfjs_require__(10);
+var $padEnd = __w_pdfjs_require__(190).end;
+var WEBKIT_BUG = __w_pdfjs_require__(192);
+$({
+ target: 'String',
+ proto: true,
+ forced: WEBKIT_BUG
+}, {
+ padEnd: function padEnd(maxLength) {
+ return $padEnd(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+/***/ }),
+/* 195 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+__w_pdfjs_require__(196);
+var path = __w_pdfjs_require__(43);
+module.exports = path.Object.values;
+
+/***/ }),
+/* 196 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var $ = __w_pdfjs_require__(10);
+var $values = __w_pdfjs_require__(197).values;
+$({
+ target: 'Object',
+ stat: true
+}, {
+ values: function values(O) {
+ return $values(O);
+ }
+});
+
+/***/ }),
+/* 197 */
+/***/ (function(module, exports, __w_pdfjs_require__) {
+
+var DESCRIPTORS = __w_pdfjs_require__(13);
+var objectKeys = __w_pdfjs_require__(73);
+var toIndexedObject = __w_pdfjs_require__(17);
+var propertyIsEnumerable = __w_pdfjs_require__(15).f;
+var createMethod = function (TO_ENTRIES) {
+ return function (it) {
+ var O = toIndexedObject(it);
+ var keys = objectKeys(O);
+ var length = keys.length;
+ var i = 0;
+ var result = [];
+ var key;
+ while (length > i) {
+ key = keys[i++];
+ if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) {
+ result.push(TO_ENTRIES ? [
+ key,
+ O[key]
+ ] : O[key]);
+ }
+ }
+ return result;
+ };
+};
+module.exports = {
+ entries: createMethod(true),
+ values: createMethod(false)
+};
+
+/***/ }),
+/* 198 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -1554,13 +11738,23 @@ exports.isRefsEqual = isRefsEqual;
exports.isStream = isStream;
exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = void 0;
-var _util = __w_pdfjs_require__(2);
+var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
+
+var _util = __w_pdfjs_require__(5);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
+
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
var EOF = {};
exports.EOF = EOF;
var Name = function NameClosure() {
- let nameCache = Object.create(null);
+ var nameCache = Object.create(null);
function Name(name) {
this.name = name;
@@ -1583,7 +11777,7 @@ var Name = function NameClosure() {
exports.Name = Name;
var Cmd = function CmdClosure() {
- let cmdCache = Object.create(null);
+ var cmdCache = Object.create(null);
function Cmd(cmd) {
this.cmd = cmd;
@@ -1622,9 +11816,8 @@ var Dict = function DictClosure() {
assignXref: function Dict_assignXref(newXref) {
this.xref = newXref;
},
-
- get(key1, key2, key3) {
- let value = this._map[key1];
+ get: function get(key1, key2, key3) {
+ var value = this._map[key1];
if (value === undefined && key2 !== undefined) {
value = this._map[key2];
@@ -1640,27 +11833,45 @@ var Dict = function DictClosure() {
return value;
},
+ getAsync: function getAsync(key1, key2, key3) {
+ var _this = this;
- async getAsync(key1, key2, key3) {
- let value = this._map[key1];
+ return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
+ var value;
+ return _regenerator["default"].wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ value = _this._map[key1];
- if (value === undefined && key2 !== undefined) {
- value = this._map[key2];
+ if (value === undefined && key2 !== undefined) {
+ value = _this._map[key2];
- if (value === undefined && key3 !== undefined) {
- value = this._map[key3];
- }
- }
+ if (value === undefined && key3 !== undefined) {
+ value = _this._map[key3];
+ }
+ }
- if (value instanceof Ref && this.xref) {
- return this.xref.fetchAsync(value, this.suppressEncryption);
- }
+ if (!(value instanceof Ref && _this.xref)) {
+ _context.next = 4;
+ break;
+ }
- return value;
- },
+ return _context.abrupt("return", _this.xref.fetchAsync(value, _this.suppressEncryption));
- getArray(key1, key2, key3) {
- let value = this.get(key1, key2, key3);
+ case 4:
+ return _context.abrupt("return", value);
+
+ case 5:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee);
+ }))();
+ },
+ getArray: function getArray(key1, key2, key3) {
+ var value = this.get(key1, key2, key3);
if (!Array.isArray(value) || !this.xref) {
return value;
@@ -1668,7 +11879,7 @@ var Dict = function DictClosure() {
value = value.slice();
- for (let i = 0, ii = value.length; i < ii; i++) {
+ for (var i = 0, ii = value.length; i < ii; i++) {
if (!(value[i] instanceof Ref)) {
continue;
}
@@ -1678,7 +11889,6 @@ var Dict = function DictClosure() {
return value;
},
-
getRaw: function Dict_getRaw(key) {
return this._map[key];
},
@@ -1700,16 +11910,16 @@ var Dict = function DictClosure() {
Dict.empty = new Dict(null);
Dict.merge = function (xref, dictArray) {
- const mergedDict = new Dict(xref);
+ var mergedDict = new Dict(xref);
- for (let i = 0, ii = dictArray.length; i < ii; i++) {
- const dict = dictArray[i];
+ for (var i = 0, ii = dictArray.length; i < ii; i++) {
+ var dict = dictArray[i];
if (!isDict(dict)) {
continue;
}
- for (const keyName in dict._map) {
+ for (var keyName in dict._map) {
if (mergedDict._map[keyName] !== undefined) {
continue;
}
@@ -1727,7 +11937,7 @@ var Dict = function DictClosure() {
exports.Dict = Dict;
var Ref = function RefClosure() {
- let refCache = Object.create(null);
+ var refCache = Object.create(null);
function Ref(num, gen) {
this.num = num;
@@ -1737,16 +11947,16 @@ var Ref = function RefClosure() {
Ref.prototype = {
toString: function Ref_toString() {
if (this.gen === 0) {
- return `${this.num}R`;
+ return "".concat(this.num, "R");
}
- return `${this.num}R${this.gen}`;
+ return "".concat(this.num, "R").concat(this.gen);
}
};
Ref.get = function (num, gen) {
- const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
- const refValue = refCache[key];
+ var key = gen === 0 ? "".concat(num, "R") : "".concat(num, "R").concat(gen);
+ var refValue = refCache[key];
return refValue ? refValue : refCache[key] = new Ref(num, gen);
};
@@ -1803,7 +12013,7 @@ var RefSetCache = function RefSetCacheClosure() {
this.dict[ref.toString()] = this.get(aliasRef);
},
forEach: function RefSetCache_forEach(callback) {
- for (const i in this.dict) {
+ for (var i in this.dict) {
callback(this.dict[i]);
}
},
@@ -1841,7 +12051,7 @@ function isRefsEqual(v1, v2) {
}
function isStream(v) {
- return typeof v === "object" && v !== null && v.getBytes !== undefined;
+ return _typeof(v) === "object" && v !== null && v.getBytes !== undefined;
}
function clearPrimitiveCaches() {
@@ -1853,7 +12063,7 @@ function clearPrimitiveCaches() {
}
/***/ }),
-/* 6 */
+/* 199 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -1864,203 +12074,367 @@ Object.defineProperty(exports, "__esModule", {
});
exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
-var _util = __w_pdfjs_require__(2);
+var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
-var _chunked_stream = __w_pdfjs_require__(7);
+var _util = __w_pdfjs_require__(5);
-var _core_utils = __w_pdfjs_require__(8);
+var _chunked_stream = __w_pdfjs_require__(200);
-var _document = __w_pdfjs_require__(9);
+var _core_utils = __w_pdfjs_require__(201);
-var _stream = __w_pdfjs_require__(12);
+var _document = __w_pdfjs_require__(202);
-class BasePdfManager {
- constructor() {
- if (this.constructor === BasePdfManager) {
- (0, _util.unreachable)("Cannot initialize BasePdfManager.");
- }
- }
+var _stream = __w_pdfjs_require__(205);
- get docId() {
- return this._docId;
- }
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- get password() {
- return this._password;
- }
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- get docBaseUrl() {
- let docBaseUrl = null;
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
- if (this._docBaseUrl) {
- const absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- if (absoluteUrl) {
- docBaseUrl = absoluteUrl.href;
- } else {
- (0, _util.warn)(`Invalid absolute docBaseUrl: "${this._docBaseUrl}".`);
- }
- }
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
- return (0, _util.shadow)(this, "docBaseUrl", docBaseUrl);
- }
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
- onLoadedStream() {
- (0, _util.unreachable)("Abstract method `onLoadedStream` called");
- }
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- ensureDoc(prop, args) {
- return this.ensure(this.pdfDocument, prop, args);
- }
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
- ensureXRef(prop, args) {
- return this.ensure(this.pdfDocument.xref, prop, args);
- }
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- ensureCatalog(prop, args) {
- return this.ensure(this.pdfDocument.catalog, prop, args);
- }
+function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
- getPage(pageIndex) {
- return this.pdfDocument.getPage(pageIndex);
- }
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
- fontFallback(id, handler) {
- return this.pdfDocument.fontFallback(id, handler);
- }
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- cleanup(manuallyTriggered = false) {
- return this.pdfDocument.cleanup(manuallyTriggered);
- }
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- async ensure(obj, prop, args) {
- (0, _util.unreachable)("Abstract method `ensure` called");
- }
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- requestRange(begin, end) {
- (0, _util.unreachable)("Abstract method `requestRange` called");
- }
+var BasePdfManager = /*#__PURE__*/function () {
+ function BasePdfManager() {
+ _classCallCheck(this, BasePdfManager);
- requestLoadedStream() {
- (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
+ if (this.constructor === BasePdfManager) {
+ (0, _util.unreachable)("Cannot initialize BasePdfManager.");
+ }
}
- sendProgressiveData(chunk) {
- (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
- }
+ _createClass(BasePdfManager, [{
+ key: "onLoadedStream",
+ value: function onLoadedStream() {
+ (0, _util.unreachable)("Abstract method `onLoadedStream` called");
+ }
+ }, {
+ key: "ensureDoc",
+ value: function ensureDoc(prop, args) {
+ return this.ensure(this.pdfDocument, prop, args);
+ }
+ }, {
+ key: "ensureXRef",
+ value: function ensureXRef(prop, args) {
+ return this.ensure(this.pdfDocument.xref, prop, args);
+ }
+ }, {
+ key: "ensureCatalog",
+ value: function ensureCatalog(prop, args) {
+ return this.ensure(this.pdfDocument.catalog, prop, args);
+ }
+ }, {
+ key: "getPage",
+ value: function getPage(pageIndex) {
+ return this.pdfDocument.getPage(pageIndex);
+ }
+ }, {
+ key: "fontFallback",
+ value: function fontFallback(id, handler) {
+ return this.pdfDocument.fontFallback(id, handler);
+ }
+ }, {
+ key: "cleanup",
+ value: function cleanup() {
+ var manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ return this.pdfDocument.cleanup(manuallyTriggered);
+ }
+ }, {
+ key: "ensure",
+ value: function () {
+ var _ensure = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(obj, prop, args) {
+ return _regenerator["default"].wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ (0, _util.unreachable)("Abstract method `ensure` called");
- updatePassword(password) {
- this._password = password;
- }
+ case 1:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee);
+ }));
- terminate(reason) {
- (0, _util.unreachable)("Abstract method `terminate` called");
- }
+ function ensure(_x, _x2, _x3) {
+ return _ensure.apply(this, arguments);
+ }
-}
+ return ensure;
+ }()
+ }, {
+ key: "requestRange",
+ value: function requestRange(begin, end) {
+ (0, _util.unreachable)("Abstract method `requestRange` called");
+ }
+ }, {
+ key: "requestLoadedStream",
+ value: function requestLoadedStream() {
+ (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
+ }
+ }, {
+ key: "sendProgressiveData",
+ value: function sendProgressiveData(chunk) {
+ (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
+ }
+ }, {
+ key: "updatePassword",
+ value: function updatePassword(password) {
+ this._password = password;
+ }
+ }, {
+ key: "terminate",
+ value: function terminate(reason) {
+ (0, _util.unreachable)("Abstract method `terminate` called");
+ }
+ }, {
+ key: "docId",
+ get: function get() {
+ return this._docId;
+ }
+ }, {
+ key: "password",
+ get: function get() {
+ return this._password;
+ }
+ }, {
+ key: "docBaseUrl",
+ get: function get() {
+ var docBaseUrl = null;
-class LocalPdfManager extends BasePdfManager {
- constructor(docId, data, password, evaluatorOptions, docBaseUrl) {
- super();
- this._docId = docId;
- this._password = password;
- this._docBaseUrl = docBaseUrl;
- this.evaluatorOptions = evaluatorOptions;
- const stream = new _stream.Stream(data);
- this.pdfDocument = new _document.PDFDocument(this, stream);
- this._loadedStreamPromise = Promise.resolve(stream);
- }
+ if (this._docBaseUrl) {
+ var absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
- async ensure(obj, prop, args) {
- const value = obj[prop];
+ if (absoluteUrl) {
+ docBaseUrl = absoluteUrl.href;
+ } else {
+ (0, _util.warn)("Invalid absolute docBaseUrl: \"".concat(this._docBaseUrl, "\"."));
+ }
+ }
- if (typeof value === "function") {
- return value.apply(obj, args);
+ return (0, _util.shadow)(this, "docBaseUrl", docBaseUrl);
}
+ }]);
- return value;
- }
+ return BasePdfManager;
+}();
- requestRange(begin, end) {
- return Promise.resolve();
- }
+var LocalPdfManager = /*#__PURE__*/function (_BasePdfManager) {
+ _inherits(LocalPdfManager, _BasePdfManager);
+
+ var _super = _createSuper(LocalPdfManager);
- requestLoadedStream() {}
+ function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
+ var _this;
- onLoadedStream() {
- return this._loadedStreamPromise;
+ _classCallCheck(this, LocalPdfManager);
+
+ _this = _super.call(this);
+ _this._docId = docId;
+ _this._password = password;
+ _this._docBaseUrl = docBaseUrl;
+ _this.evaluatorOptions = evaluatorOptions;
+ var stream = new _stream.Stream(data);
+ _this.pdfDocument = new _document.PDFDocument(_assertThisInitialized(_this), stream);
+ _this._loadedStreamPromise = Promise.resolve(stream);
+ return _this;
}
- terminate(reason) {}
+ _createClass(LocalPdfManager, [{
+ key: "ensure",
+ value: function () {
+ var _ensure2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(obj, prop, args) {
+ var value;
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
+ while (1) {
+ switch (_context2.prev = _context2.next) {
+ case 0:
+ value = obj[prop];
-}
+ if (!(typeof value === "function")) {
+ _context2.next = 3;
+ break;
+ }
+
+ return _context2.abrupt("return", value.apply(obj, args));
+
+ case 3:
+ return _context2.abrupt("return", value);
+
+ case 4:
+ case "end":
+ return _context2.stop();
+ }
+ }
+ }, _callee2);
+ }));
+
+ function ensure(_x4, _x5, _x6) {
+ return _ensure2.apply(this, arguments);
+ }
+
+ return ensure;
+ }()
+ }, {
+ key: "requestRange",
+ value: function requestRange(begin, end) {
+ return Promise.resolve();
+ }
+ }, {
+ key: "requestLoadedStream",
+ value: function requestLoadedStream() {}
+ }, {
+ key: "onLoadedStream",
+ value: function onLoadedStream() {
+ return this._loadedStreamPromise;
+ }
+ }, {
+ key: "terminate",
+ value: function terminate(reason) {}
+ }]);
+
+ return LocalPdfManager;
+}(BasePdfManager);
exports.LocalPdfManager = LocalPdfManager;
-class NetworkPdfManager extends BasePdfManager {
- constructor(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
- super();
- this._docId = docId;
- this._password = args.password;
- this._docBaseUrl = docBaseUrl;
- this.msgHandler = args.msgHandler;
- this.evaluatorOptions = evaluatorOptions;
- this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
+var NetworkPdfManager = /*#__PURE__*/function (_BasePdfManager2) {
+ _inherits(NetworkPdfManager, _BasePdfManager2);
+
+ var _super2 = _createSuper(NetworkPdfManager);
+
+ function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
+ var _this2;
+
+ _classCallCheck(this, NetworkPdfManager);
+
+ _this2 = _super2.call(this);
+ _this2._docId = docId;
+ _this2._password = args.password;
+ _this2._docBaseUrl = docBaseUrl;
+ _this2.msgHandler = args.msgHandler;
+ _this2.evaluatorOptions = evaluatorOptions;
+ _this2.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
msgHandler: args.msgHandler,
length: args.length,
disableAutoFetch: args.disableAutoFetch,
rangeChunkSize: args.rangeChunkSize
});
- this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
- }
+ _this2.pdfDocument = new _document.PDFDocument(_assertThisInitialized(_this2), _this2.streamManager.getStream());
+ return _this2;
+ }
+
+ _createClass(NetworkPdfManager, [{
+ key: "ensure",
+ value: function () {
+ var _ensure3 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(obj, prop, args) {
+ var value;
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
+ while (1) {
+ switch (_context3.prev = _context3.next) {
+ case 0:
+ _context3.prev = 0;
+ value = obj[prop];
- async ensure(obj, prop, args) {
- try {
- const value = obj[prop];
+ if (!(typeof value === "function")) {
+ _context3.next = 4;
+ break;
+ }
- if (typeof value === "function") {
- return value.apply(obj, args);
- }
+ return _context3.abrupt("return", value.apply(obj, args));
- return value;
- } catch (ex) {
- if (!(ex instanceof _core_utils.MissingDataException)) {
- throw ex;
- }
+ case 4:
+ return _context3.abrupt("return", value);
- await this.requestRange(ex.begin, ex.end);
- return this.ensure(obj, prop, args);
- }
- }
+ case 7:
+ _context3.prev = 7;
+ _context3.t0 = _context3["catch"](0);
- requestRange(begin, end) {
- return this.streamManager.requestRange(begin, end);
- }
+ if (_context3.t0 instanceof _core_utils.MissingDataException) {
+ _context3.next = 11;
+ break;
+ }
- requestLoadedStream() {
- this.streamManager.requestAllChunks();
- }
+ throw _context3.t0;
- sendProgressiveData(chunk) {
- this.streamManager.onReceiveData({
- chunk
- });
- }
+ case 11:
+ _context3.next = 13;
+ return this.requestRange(_context3.t0.begin, _context3.t0.end);
- onLoadedStream() {
- return this.streamManager.onLoadedStream();
- }
+ case 13:
+ return _context3.abrupt("return", this.ensure(obj, prop, args));
- terminate(reason) {
- this.streamManager.abort(reason);
- }
+ case 14:
+ case "end":
+ return _context3.stop();
+ }
+ }
+ }, _callee3, this, [[0, 7]]);
+ }));
-}
+ function ensure(_x7, _x8, _x9) {
+ return _ensure3.apply(this, arguments);
+ }
+
+ return ensure;
+ }()
+ }, {
+ key: "requestRange",
+ value: function requestRange(begin, end) {
+ return this.streamManager.requestRange(begin, end);
+ }
+ }, {
+ key: "requestLoadedStream",
+ value: function requestLoadedStream() {
+ this.streamManager.requestAllChunks();
+ }
+ }, {
+ key: "sendProgressiveData",
+ value: function sendProgressiveData(chunk) {
+ this.streamManager.onReceiveData({
+ chunk: chunk
+ });
+ }
+ }, {
+ key: "onLoadedStream",
+ value: function onLoadedStream() {
+ return this.streamManager.onLoadedStream();
+ }
+ }, {
+ key: "terminate",
+ value: function terminate(reason) {
+ this.streamManager.abort(reason);
+ }
+ }]);
+
+ return NetworkPdfManager;
+}(BasePdfManager);
exports.NetworkPdfManager = NetworkPdfManager;
/***/ }),
-/* 7 */
+/* 200 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -2071,12 +12445,26 @@ Object.defineProperty(exports, "__esModule", {
});
exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+var _core_utils = __w_pdfjs_require__(201);
+
+function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
+
+function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
+
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-var _core_utils = __w_pdfjs_require__(8);
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var ChunkedStream = /*#__PURE__*/function () {
+ function ChunkedStream(length, chunkSize, manager) {
+ _classCallCheck(this, ChunkedStream);
-class ChunkedStream {
- constructor(length, chunkSize, manager) {
this.bytes = new Uint8Array(length);
this.start = 0;
this.pos = 0;
@@ -2090,292 +12478,322 @@ class ChunkedStream {
this.lastSuccessfulEnsureByteChunk = -1;
}
- getMissingChunks() {
- const chunks = [];
+ _createClass(ChunkedStream, [{
+ key: "getMissingChunks",
+ value: function getMissingChunks() {
+ var chunks = [];
- for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
- if (!this.loadedChunks[chunk]) {
- chunks.push(chunk);
+ for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
+ if (!this.loadedChunks[chunk]) {
+ chunks.push(chunk);
+ }
}
- }
-
- return chunks;
- }
-
- getBaseStreams() {
- return [this];
- }
-
- allChunksLoaded() {
- return this.numChunksLoaded === this.numChunks;
- }
-
- onReceiveData(begin, chunk) {
- const chunkSize = this.chunkSize;
- if (begin % chunkSize !== 0) {
- throw new Error(`Bad begin offset: ${begin}`);
+ return chunks;
}
-
- const end = begin + chunk.byteLength;
-
- if (end % chunkSize !== 0 && end !== this.bytes.length) {
- throw new Error(`Bad end offset: ${end}`);
+ }, {
+ key: "getBaseStreams",
+ value: function getBaseStreams() {
+ return [this];
}
-
- this.bytes.set(new Uint8Array(chunk), begin);
- const beginChunk = Math.floor(begin / chunkSize);
- const endChunk = Math.floor((end - 1) / chunkSize) + 1;
-
- for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
- if (!this.loadedChunks[curChunk]) {
- this.loadedChunks[curChunk] = true;
- ++this.numChunksLoaded;
- }
+ }, {
+ key: "allChunksLoaded",
+ value: function allChunksLoaded() {
+ return this.numChunksLoaded === this.numChunks;
}
- }
-
- onReceiveProgressiveData(data) {
- let position = this.progressiveDataLength;
- const beginChunk = Math.floor(position / this.chunkSize);
- this.bytes.set(new Uint8Array(data), position);
- position += data.byteLength;
- this.progressiveDataLength = position;
- const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
+ }, {
+ key: "onReceiveData",
+ value: function onReceiveData(begin, chunk) {
+ var chunkSize = this.chunkSize;
- for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
- if (!this.loadedChunks[curChunk]) {
- this.loadedChunks[curChunk] = true;
- ++this.numChunksLoaded;
+ if (begin % chunkSize !== 0) {
+ throw new Error("Bad begin offset: ".concat(begin));
}
- }
- }
- ensureByte(pos) {
- if (pos < this.progressiveDataLength) {
- return;
- }
+ var end = begin + chunk.byteLength;
- const chunk = Math.floor(pos / this.chunkSize);
+ if (end % chunkSize !== 0 && end !== this.bytes.length) {
+ throw new Error("Bad end offset: ".concat(end));
+ }
- if (chunk === this.lastSuccessfulEnsureByteChunk) {
- return;
- }
+ this.bytes.set(new Uint8Array(chunk), begin);
+ var beginChunk = Math.floor(begin / chunkSize);
+ var endChunk = Math.floor((end - 1) / chunkSize) + 1;
- if (!this.loadedChunks[chunk]) {
- throw new _core_utils.MissingDataException(pos, pos + 1);
+ for (var curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
+ if (!this.loadedChunks[curChunk]) {
+ this.loadedChunks[curChunk] = true;
+ ++this.numChunksLoaded;
+ }
+ }
}
+ }, {
+ key: "onReceiveProgressiveData",
+ value: function onReceiveProgressiveData(data) {
+ var position = this.progressiveDataLength;
+ var beginChunk = Math.floor(position / this.chunkSize);
+ this.bytes.set(new Uint8Array(data), position);
+ position += data.byteLength;
+ this.progressiveDataLength = position;
+ var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
- this.lastSuccessfulEnsureByteChunk = chunk;
- }
-
- ensureRange(begin, end) {
- if (begin >= end) {
- return;
+ for (var curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
+ if (!this.loadedChunks[curChunk]) {
+ this.loadedChunks[curChunk] = true;
+ ++this.numChunksLoaded;
+ }
+ }
}
+ }, {
+ key: "ensureByte",
+ value: function ensureByte(pos) {
+ if (pos < this.progressiveDataLength) {
+ return;
+ }
- if (end <= this.progressiveDataLength) {
- return;
- }
+ var chunk = Math.floor(pos / this.chunkSize);
- const chunkSize = this.chunkSize;
- const beginChunk = Math.floor(begin / chunkSize);
- const endChunk = Math.floor((end - 1) / chunkSize) + 1;
+ if (chunk === this.lastSuccessfulEnsureByteChunk) {
+ return;
+ }
- for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
if (!this.loadedChunks[chunk]) {
- throw new _core_utils.MissingDataException(begin, end);
+ throw new _core_utils.MissingDataException(pos, pos + 1);
}
+
+ this.lastSuccessfulEnsureByteChunk = chunk;
}
- }
+ }, {
+ key: "ensureRange",
+ value: function ensureRange(begin, end) {
+ if (begin >= end) {
+ return;
+ }
- nextEmptyChunk(beginChunk) {
- const numChunks = this.numChunks;
+ if (end <= this.progressiveDataLength) {
+ return;
+ }
- for (let i = 0; i < numChunks; ++i) {
- const chunk = (beginChunk + i) % numChunks;
+ var chunkSize = this.chunkSize;
+ var beginChunk = Math.floor(begin / chunkSize);
+ var endChunk = Math.floor((end - 1) / chunkSize) + 1;
- if (!this.loadedChunks[chunk]) {
- return chunk;
+ for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
+ if (!this.loadedChunks[chunk]) {
+ throw new _core_utils.MissingDataException(begin, end);
+ }
}
}
+ }, {
+ key: "nextEmptyChunk",
+ value: function nextEmptyChunk(beginChunk) {
+ var numChunks = this.numChunks;
- return null;
- }
+ for (var i = 0; i < numChunks; ++i) {
+ var chunk = (beginChunk + i) % numChunks;
- hasChunk(chunk) {
- return !!this.loadedChunks[chunk];
- }
+ if (!this.loadedChunks[chunk]) {
+ return chunk;
+ }
+ }
- get length() {
- return this.end - this.start;
- }
+ return null;
+ }
+ }, {
+ key: "hasChunk",
+ value: function hasChunk(chunk) {
+ return !!this.loadedChunks[chunk];
+ }
+ }, {
+ key: "getByte",
+ value: function getByte() {
+ var pos = this.pos;
- get isEmpty() {
- return this.length === 0;
- }
+ if (pos >= this.end) {
+ return -1;
+ }
- getByte() {
- const pos = this.pos;
+ if (pos >= this.progressiveDataLength) {
+ this.ensureByte(pos);
+ }
- if (pos >= this.end) {
- return -1;
+ return this.bytes[this.pos++];
}
+ }, {
+ key: "getUint16",
+ value: function getUint16() {
+ var b0 = this.getByte();
+ var b1 = this.getByte();
- if (pos >= this.progressiveDataLength) {
- this.ensureByte(pos);
- }
+ if (b0 === -1 || b1 === -1) {
+ return -1;
+ }
- return this.bytes[this.pos++];
- }
+ return (b0 << 8) + b1;
+ }
+ }, {
+ key: "getInt32",
+ value: function getInt32() {
+ var b0 = this.getByte();
+ var b1 = this.getByte();
+ var b2 = this.getByte();
+ var b3 = this.getByte();
+ return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
+ }
+ }, {
+ key: "getBytes",
+ value: function getBytes(length) {
+ var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var bytes = this.bytes;
+ var pos = this.pos;
+ var strEnd = this.end;
- getUint16() {
- const b0 = this.getByte();
- const b1 = this.getByte();
+ if (!length) {
+ if (strEnd > this.progressiveDataLength) {
+ this.ensureRange(pos, strEnd);
+ }
- if (b0 === -1 || b1 === -1) {
- return -1;
- }
+ var _subarray = bytes.subarray(pos, strEnd);
- return (b0 << 8) + b1;
- }
+ return forceClamped ? new Uint8ClampedArray(_subarray) : _subarray;
+ }
- getInt32() {
- const b0 = this.getByte();
- const b1 = this.getByte();
- const b2 = this.getByte();
- const b3 = this.getByte();
- return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
- }
+ var end = pos + length;
- getBytes(length, forceClamped = false) {
- const bytes = this.bytes;
- const pos = this.pos;
- const strEnd = this.end;
+ if (end > strEnd) {
+ end = strEnd;
+ }
- if (!length) {
- if (strEnd > this.progressiveDataLength) {
- this.ensureRange(pos, strEnd);
+ if (end > this.progressiveDataLength) {
+ this.ensureRange(pos, end);
}
- const subarray = bytes.subarray(pos, strEnd);
+ this.pos = end;
+ var subarray = bytes.subarray(pos, end);
return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
}
+ }, {
+ key: "peekByte",
+ value: function peekByte() {
+ var peekedByte = this.getByte();
- let end = pos + length;
-
- if (end > strEnd) {
- end = strEnd;
- }
+ if (peekedByte !== -1) {
+ this.pos--;
+ }
- if (end > this.progressiveDataLength) {
- this.ensureRange(pos, end);
+ return peekedByte;
}
-
- this.pos = end;
- const subarray = bytes.subarray(pos, end);
- return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
- }
-
- peekByte() {
- const peekedByte = this.getByte();
-
- if (peekedByte !== -1) {
- this.pos--;
+ }, {
+ key: "peekBytes",
+ value: function peekBytes(length) {
+ var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var bytes = this.getBytes(length, forceClamped);
+ this.pos -= bytes.length;
+ return bytes;
}
+ }, {
+ key: "getByteRange",
+ value: function getByteRange(begin, end) {
+ if (begin < 0) {
+ begin = 0;
+ }
- return peekedByte;
- }
+ if (end > this.end) {
+ end = this.end;
+ }
- peekBytes(length, forceClamped = false) {
- const bytes = this.getBytes(length, forceClamped);
- this.pos -= bytes.length;
- return bytes;
- }
+ if (end > this.progressiveDataLength) {
+ this.ensureRange(begin, end);
+ }
- getByteRange(begin, end) {
- if (begin < 0) {
- begin = 0;
+ return this.bytes.subarray(begin, end);
}
+ }, {
+ key: "skip",
+ value: function skip(n) {
+ if (!n) {
+ n = 1;
+ }
- if (end > this.end) {
- end = this.end;
+ this.pos += n;
}
-
- if (end > this.progressiveDataLength) {
- this.ensureRange(begin, end);
+ }, {
+ key: "reset",
+ value: function reset() {
+ this.pos = this.start;
}
-
- return this.bytes.subarray(begin, end);
- }
-
- skip(n) {
- if (!n) {
- n = 1;
+ }, {
+ key: "moveStart",
+ value: function moveStart() {
+ this.start = this.pos;
}
-
- this.pos += n;
- }
-
- reset() {
- this.pos = this.start;
- }
-
- moveStart() {
- this.start = this.pos;
- }
-
- makeSubStream(start, length, dict) {
- if (length) {
- if (start + length > this.progressiveDataLength) {
- this.ensureRange(start, start + length);
- }
- } else {
- if (start >= this.progressiveDataLength) {
- this.ensureByte(start);
+ }, {
+ key: "makeSubStream",
+ value: function makeSubStream(start, length, dict) {
+ if (length) {
+ if (start + length > this.progressiveDataLength) {
+ this.ensureRange(start, start + length);
+ }
+ } else {
+ if (start >= this.progressiveDataLength) {
+ this.ensureByte(start);
+ }
}
- }
- function ChunkedStreamSubstream() {}
+ function ChunkedStreamSubstream() {}
- ChunkedStreamSubstream.prototype = Object.create(this);
+ ChunkedStreamSubstream.prototype = Object.create(this);
- ChunkedStreamSubstream.prototype.getMissingChunks = function () {
- const chunkSize = this.chunkSize;
- const beginChunk = Math.floor(this.start / chunkSize);
- const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
- const missingChunks = [];
+ ChunkedStreamSubstream.prototype.getMissingChunks = function () {
+ var chunkSize = this.chunkSize;
+ var beginChunk = Math.floor(this.start / chunkSize);
+ var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
+ var missingChunks = [];
- for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
- if (!this.loadedChunks[chunk]) {
- missingChunks.push(chunk);
+ for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
+ if (!this.loadedChunks[chunk]) {
+ missingChunks.push(chunk);
+ }
}
- }
- return missingChunks;
- };
+ return missingChunks;
+ };
- ChunkedStreamSubstream.prototype.allChunksLoaded = function () {
- if (this.numChunksLoaded === this.numChunks) {
- return true;
- }
+ ChunkedStreamSubstream.prototype.allChunksLoaded = function () {
+ if (this.numChunksLoaded === this.numChunks) {
+ return true;
+ }
- return this.getMissingChunks().length === 0;
- };
+ return this.getMissingChunks().length === 0;
+ };
- const subStream = new ChunkedStreamSubstream();
- subStream.pos = subStream.start = start;
- subStream.end = start + length || this.end;
- subStream.dict = dict;
- return subStream;
- }
+ var subStream = new ChunkedStreamSubstream();
+ subStream.pos = subStream.start = start;
+ subStream.end = start + length || this.end;
+ subStream.dict = dict;
+ return subStream;
+ }
+ }, {
+ key: "length",
+ get: function get() {
+ return this.end - this.start;
+ }
+ }, {
+ key: "isEmpty",
+ get: function get() {
+ return this.length === 0;
+ }
+ }]);
-}
+ return ChunkedStream;
+}();
exports.ChunkedStream = ChunkedStream;
-class ChunkedStreamManager {
- constructor(pdfNetworkStream, args) {
+var ChunkedStreamManager = /*#__PURE__*/function () {
+ function ChunkedStreamManager(pdfNetworkStream, args) {
+ _classCallCheck(this, ChunkedStreamManager);
+
this.length = args.length;
this.chunkSize = args.rangeChunkSize;
this.stream = new ChunkedStream(this.length, this.chunkSize, this);
@@ -2391,289 +12809,351 @@ class ChunkedStreamManager {
this._loadedStreamCapability = (0, _util.createPromiseCapability)();
}
- onLoadedStream() {
- return this._loadedStreamCapability.promise;
- }
+ _createClass(ChunkedStreamManager, [{
+ key: "onLoadedStream",
+ value: function onLoadedStream() {
+ return this._loadedStreamCapability.promise;
+ }
+ }, {
+ key: "sendRequest",
+ value: function sendRequest(begin, end) {
+ var _this = this;
- sendRequest(begin, end) {
- const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
+ var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
- if (!rangeReader.isStreamingSupported) {
- rangeReader.onProgress = this.onProgress.bind(this);
- }
+ if (!rangeReader.isStreamingSupported) {
+ rangeReader.onProgress = this.onProgress.bind(this);
+ }
- let chunks = [],
- loaded = 0;
- const promise = new Promise((resolve, reject) => {
- const readChunk = chunk => {
- try {
- if (!chunk.done) {
- const data = chunk.value;
- chunks.push(data);
- loaded += (0, _util.arrayByteLength)(data);
-
- if (rangeReader.isStreamingSupported) {
- this.onProgress({
- loaded
- });
+ var chunks = [],
+ loaded = 0;
+ var promise = new Promise(function (resolve, reject) {
+ var readChunk = function readChunk(chunk) {
+ try {
+ if (!chunk.done) {
+ var data = chunk.value;
+ chunks.push(data);
+ loaded += (0, _util.arrayByteLength)(data);
+
+ if (rangeReader.isStreamingSupported) {
+ _this.onProgress({
+ loaded: loaded
+ });
+ }
+
+ rangeReader.read().then(readChunk, reject);
+ return;
}
- rangeReader.read().then(readChunk, reject);
- return;
+ var chunkData = (0, _util.arraysToBytes)(chunks);
+ chunks = null;
+ resolve(chunkData);
+ } catch (e) {
+ reject(e);
}
+ };
- const chunkData = (0, _util.arraysToBytes)(chunks);
- chunks = null;
- resolve(chunkData);
- } catch (e) {
- reject(e);
+ rangeReader.read().then(readChunk, reject);
+ });
+ promise.then(function (data) {
+ if (_this.aborted) {
+ return;
}
- };
-
- rangeReader.read().then(readChunk, reject);
- });
- promise.then(data => {
- if (this.aborted) {
- return;
- }
- this.onReceiveData({
- chunk: data,
- begin
+ _this.onReceiveData({
+ chunk: data,
+ begin: begin
+ });
});
- });
- }
-
- requestAllChunks() {
- const missingChunks = this.stream.getMissingChunks();
-
- this._requestChunks(missingChunks);
-
- return this._loadedStreamCapability.promise;
- }
+ }
+ }, {
+ key: "requestAllChunks",
+ value: function requestAllChunks() {
+ var missingChunks = this.stream.getMissingChunks();
- _requestChunks(chunks) {
- const requestId = this.currRequestId++;
- const chunksNeeded = Object.create(null);
- this.chunksNeededByRequest[requestId] = chunksNeeded;
+ this._requestChunks(missingChunks);
- for (const chunk of chunks) {
- if (!this.stream.hasChunk(chunk)) {
- chunksNeeded[chunk] = true;
- }
+ return this._loadedStreamCapability.promise;
}
+ }, {
+ key: "_requestChunks",
+ value: function _requestChunks(chunks) {
+ var requestId = this.currRequestId++;
+ var chunksNeeded = Object.create(null);
+ this.chunksNeededByRequest[requestId] = chunksNeeded;
- if ((0, _util.isEmptyObj)(chunksNeeded)) {
- return Promise.resolve();
- }
+ var _iterator = _createForOfIteratorHelper(chunks),
+ _step;
- const capability = (0, _util.createPromiseCapability)();
- this.promisesByRequest[requestId] = capability;
- const chunksToRequest = [];
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ var _chunk = _step.value;
- for (let chunk in chunksNeeded) {
- chunk = chunk | 0;
+ if (!this.stream.hasChunk(_chunk)) {
+ chunksNeeded[_chunk] = true;
+ }
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
- if (!(chunk in this.requestsByChunk)) {
- this.requestsByChunk[chunk] = [];
- chunksToRequest.push(chunk);
+ if ((0, _util.isEmptyObj)(chunksNeeded)) {
+ return Promise.resolve();
}
- this.requestsByChunk[chunk].push(requestId);
- }
+ var capability = (0, _util.createPromiseCapability)();
+ this.promisesByRequest[requestId] = capability;
+ var chunksToRequest = [];
- if (!chunksToRequest.length) {
- return capability.promise;
- }
+ for (var chunk in chunksNeeded) {
+ chunk = chunk | 0;
- const groupedChunksToRequest = this.groupChunks(chunksToRequest);
+ if (!(chunk in this.requestsByChunk)) {
+ this.requestsByChunk[chunk] = [];
+ chunksToRequest.push(chunk);
+ }
- for (const groupedChunk of groupedChunksToRequest) {
- const begin = groupedChunk.beginChunk * this.chunkSize;
- const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
- this.sendRequest(begin, end);
- }
+ this.requestsByChunk[chunk].push(requestId);
+ }
- return capability.promise;
- }
+ if (!chunksToRequest.length) {
+ return capability.promise;
+ }
- getStream() {
- return this.stream;
- }
+ var groupedChunksToRequest = this.groupChunks(chunksToRequest);
- requestRange(begin, end) {
- end = Math.min(end, this.length);
- const beginChunk = this.getBeginChunk(begin);
- const endChunk = this.getEndChunk(end);
- const chunks = [];
+ var _iterator2 = _createForOfIteratorHelper(groupedChunksToRequest),
+ _step2;
- for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
- chunks.push(chunk);
- }
+ try {
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
+ var groupedChunk = _step2.value;
+ var begin = groupedChunk.beginChunk * this.chunkSize;
+ var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
+ this.sendRequest(begin, end);
+ }
+ } catch (err) {
+ _iterator2.e(err);
+ } finally {
+ _iterator2.f();
+ }
- return this._requestChunks(chunks);
- }
+ return capability.promise;
+ }
+ }, {
+ key: "getStream",
+ value: function getStream() {
+ return this.stream;
+ }
+ }, {
+ key: "requestRange",
+ value: function requestRange(begin, end) {
+ end = Math.min(end, this.length);
+ var beginChunk = this.getBeginChunk(begin);
+ var endChunk = this.getEndChunk(end);
+ var chunks = [];
+
+ for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
+ chunks.push(chunk);
+ }
- requestRanges(ranges = []) {
- const chunksToRequest = [];
+ return this._requestChunks(chunks);
+ }
+ }, {
+ key: "requestRanges",
+ value: function requestRanges() {
+ var ranges = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
+ var chunksToRequest = [];
- for (const range of ranges) {
- const beginChunk = this.getBeginChunk(range.begin);
- const endChunk = this.getEndChunk(range.end);
+ var _iterator3 = _createForOfIteratorHelper(ranges),
+ _step3;
- for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
- if (!chunksToRequest.includes(chunk)) {
- chunksToRequest.push(chunk);
+ try {
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
+ var range = _step3.value;
+ var beginChunk = this.getBeginChunk(range.begin);
+ var endChunk = this.getEndChunk(range.end);
+
+ for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
+ if (!chunksToRequest.includes(chunk)) {
+ chunksToRequest.push(chunk);
+ }
+ }
}
+ } catch (err) {
+ _iterator3.e(err);
+ } finally {
+ _iterator3.f();
}
+
+ chunksToRequest.sort(function (a, b) {
+ return a - b;
+ });
+ return this._requestChunks(chunksToRequest);
}
+ }, {
+ key: "groupChunks",
+ value: function groupChunks(chunks) {
+ var groupedChunks = [];
+ var beginChunk = -1;
+ var prevChunk = -1;
- chunksToRequest.sort(function (a, b) {
- return a - b;
- });
- return this._requestChunks(chunksToRequest);
- }
+ for (var i = 0, ii = chunks.length; i < ii; ++i) {
+ var chunk = chunks[i];
- groupChunks(chunks) {
- const groupedChunks = [];
- let beginChunk = -1;
- let prevChunk = -1;
+ if (beginChunk < 0) {
+ beginChunk = chunk;
+ }
+
+ if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
+ groupedChunks.push({
+ beginChunk: beginChunk,
+ endChunk: prevChunk + 1
+ });
+ beginChunk = chunk;
+ }
- for (let i = 0, ii = chunks.length; i < ii; ++i) {
- const chunk = chunks[i];
+ if (i + 1 === chunks.length) {
+ groupedChunks.push({
+ beginChunk: beginChunk,
+ endChunk: chunk + 1
+ });
+ }
- if (beginChunk < 0) {
- beginChunk = chunk;
+ prevChunk = chunk;
}
- if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
- groupedChunks.push({
- beginChunk,
- endChunk: prevChunk + 1
- });
- beginChunk = chunk;
+ return groupedChunks;
+ }
+ }, {
+ key: "onProgress",
+ value: function onProgress(args) {
+ this.msgHandler.send("DocProgress", {
+ loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
+ total: this.length
+ });
+ }
+ }, {
+ key: "onReceiveData",
+ value: function onReceiveData(args) {
+ var chunk = args.chunk;
+ var isProgressive = args.begin === undefined;
+ var begin = isProgressive ? this.progressiveDataLength : args.begin;
+ var end = begin + chunk.byteLength;
+ var beginChunk = Math.floor(begin / this.chunkSize);
+ var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
+
+ if (isProgressive) {
+ this.stream.onReceiveProgressiveData(chunk);
+ this.progressiveDataLength = end;
+ } else {
+ this.stream.onReceiveData(begin, chunk);
}
- if (i + 1 === chunks.length) {
- groupedChunks.push({
- beginChunk,
- endChunk: chunk + 1
- });
+ if (this.stream.allChunksLoaded()) {
+ this._loadedStreamCapability.resolve(this.stream);
}
- prevChunk = chunk;
- }
+ var loadedRequests = [];
- return groupedChunks;
- }
+ for (var curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
+ var requestIds = this.requestsByChunk[curChunk] || [];
+ delete this.requestsByChunk[curChunk];
- onProgress(args) {
- this.msgHandler.send("DocProgress", {
- loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
- total: this.length
- });
- }
+ var _iterator4 = _createForOfIteratorHelper(requestIds),
+ _step4;
- onReceiveData(args) {
- const chunk = args.chunk;
- const isProgressive = args.begin === undefined;
- const begin = isProgressive ? this.progressiveDataLength : args.begin;
- const end = begin + chunk.byteLength;
- const beginChunk = Math.floor(begin / this.chunkSize);
- const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
+ try {
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
+ var requestId = _step4.value;
+ var chunksNeeded = this.chunksNeededByRequest[requestId];
- if (isProgressive) {
- this.stream.onReceiveProgressiveData(chunk);
- this.progressiveDataLength = end;
- } else {
- this.stream.onReceiveData(begin, chunk);
- }
+ if (curChunk in chunksNeeded) {
+ delete chunksNeeded[curChunk];
+ }
- if (this.stream.allChunksLoaded()) {
- this._loadedStreamCapability.resolve(this.stream);
- }
+ if (!(0, _util.isEmptyObj)(chunksNeeded)) {
+ continue;
+ }
- const loadedRequests = [];
+ loadedRequests.push(requestId);
+ }
+ } catch (err) {
+ _iterator4.e(err);
+ } finally {
+ _iterator4.f();
+ }
+ }
- for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
- const requestIds = this.requestsByChunk[curChunk] || [];
- delete this.requestsByChunk[curChunk];
+ if (!this.disableAutoFetch && (0, _util.isEmptyObj)(this.requestsByChunk)) {
+ var nextEmptyChunk;
- for (const requestId of requestIds) {
- const chunksNeeded = this.chunksNeededByRequest[requestId];
+ if (this.stream.numChunksLoaded === 1) {
+ var lastChunk = this.stream.numChunks - 1;
- if (curChunk in chunksNeeded) {
- delete chunksNeeded[curChunk];
+ if (!this.stream.hasChunk(lastChunk)) {
+ nextEmptyChunk = lastChunk;
+ }
+ } else {
+ nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
}
- if (!(0, _util.isEmptyObj)(chunksNeeded)) {
- continue;
+ if (Number.isInteger(nextEmptyChunk)) {
+ this._requestChunks([nextEmptyChunk]);
}
-
- loadedRequests.push(requestId);
}
- }
-
- if (!this.disableAutoFetch && (0, _util.isEmptyObj)(this.requestsByChunk)) {
- let nextEmptyChunk;
- if (this.stream.numChunksLoaded === 1) {
- const lastChunk = this.stream.numChunks - 1;
-
- if (!this.stream.hasChunk(lastChunk)) {
- nextEmptyChunk = lastChunk;
- }
- } else {
- nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
+ for (var _i = 0, _loadedRequests = loadedRequests; _i < _loadedRequests.length; _i++) {
+ var _requestId = _loadedRequests[_i];
+ var capability = this.promisesByRequest[_requestId];
+ delete this.promisesByRequest[_requestId];
+ capability.resolve();
}
- if (Number.isInteger(nextEmptyChunk)) {
- this._requestChunks([nextEmptyChunk]);
- }
+ this.msgHandler.send("DocProgress", {
+ loaded: this.stream.numChunksLoaded * this.chunkSize,
+ total: this.length
+ });
}
-
- for (const requestId of loadedRequests) {
- const capability = this.promisesByRequest[requestId];
- delete this.promisesByRequest[requestId];
- capability.resolve();
+ }, {
+ key: "onError",
+ value: function onError(err) {
+ this._loadedStreamCapability.reject(err);
}
-
- this.msgHandler.send("DocProgress", {
- loaded: this.stream.numChunksLoaded * this.chunkSize,
- total: this.length
- });
- }
-
- onError(err) {
- this._loadedStreamCapability.reject(err);
- }
-
- getBeginChunk(begin) {
- return Math.floor(begin / this.chunkSize);
- }
-
- getEndChunk(end) {
- return Math.floor((end - 1) / this.chunkSize) + 1;
- }
-
- abort(reason) {
- this.aborted = true;
-
- if (this.pdfNetworkStream) {
- this.pdfNetworkStream.cancelAllRequests(reason);
+ }, {
+ key: "getBeginChunk",
+ value: function getBeginChunk(begin) {
+ return Math.floor(begin / this.chunkSize);
+ }
+ }, {
+ key: "getEndChunk",
+ value: function getEndChunk(end) {
+ return Math.floor((end - 1) / this.chunkSize) + 1;
}
+ }, {
+ key: "abort",
+ value: function abort(reason) {
+ this.aborted = true;
- for (const requestId in this.promisesByRequest) {
- this.promisesByRequest[requestId].reject(reason);
+ if (this.pdfNetworkStream) {
+ this.pdfNetworkStream.cancelAllRequests(reason);
+ }
+
+ for (var requestId in this.promisesByRequest) {
+ this.promisesByRequest[requestId].reject(reason);
+ }
}
- }
+ }]);
-}
+ return ChunkedStreamManager;
+}();
exports.ChunkedStreamManager = ChunkedStreamManager;
/***/ }),
-/* 8 */
+/* 201 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -2692,10 +13172,28 @@ exports.readUint32 = readUint32;
exports.isWhiteSpace = isWhiteSpace;
exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function getLookupTableFactory(initializer) {
- let lookup;
+ var lookup;
return function () {
if (initializer) {
lookup = Object.create(null);
@@ -2707,37 +13205,72 @@ function getLookupTableFactory(initializer) {
};
}
-class MissingDataException extends _util.BaseException {
- constructor(begin, end) {
- super(`Missing data [${begin}, ${end})`);
- this.begin = begin;
- this.end = end;
+var MissingDataException = /*#__PURE__*/function (_BaseException) {
+ _inherits(MissingDataException, _BaseException);
+
+ var _super = _createSuper(MissingDataException);
+
+ function MissingDataException(begin, end) {
+ var _this;
+
+ _classCallCheck(this, MissingDataException);
+
+ _this = _super.call(this, "Missing data [".concat(begin, ", ").concat(end, ")"));
+ _this.begin = begin;
+ _this.end = end;
+ return _this;
}
-}
+ return MissingDataException;
+}(_util.BaseException);
exports.MissingDataException = MissingDataException;
-class XRefEntryException extends _util.BaseException {}
+var XRefEntryException = /*#__PURE__*/function (_BaseException2) {
+ _inherits(XRefEntryException, _BaseException2);
+
+ var _super2 = _createSuper(XRefEntryException);
+
+ function XRefEntryException() {
+ _classCallCheck(this, XRefEntryException);
+
+ return _super2.apply(this, arguments);
+ }
+
+ return XRefEntryException;
+}(_util.BaseException);
exports.XRefEntryException = XRefEntryException;
-class XRefParseException extends _util.BaseException {}
+var XRefParseException = /*#__PURE__*/function (_BaseException3) {
+ _inherits(XRefParseException, _BaseException3);
+
+ var _super3 = _createSuper(XRefParseException);
+
+ function XRefParseException() {
+ _classCallCheck(this, XRefParseException);
+
+ return _super3.apply(this, arguments);
+ }
+
+ return XRefParseException;
+}(_util.BaseException);
exports.XRefParseException = XRefParseException;
-function getInheritableProperty({
- dict,
- key,
- getArray = false,
- stopWhenFound = true
-}) {
- const LOOP_LIMIT = 100;
- let loopCount = 0;
- let values;
+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) {
- const value = getArray ? dict.getArray(key) : dict.get(key);
+ var value = getArray ? dict.getArray(key) : dict.get(key);
if (value !== undefined) {
if (stopWhenFound) {
@@ -2752,7 +13285,7 @@ function getInheritableProperty({
}
if (++loopCount > LOOP_LIMIT) {
- (0, _util.warn)(`getInheritableProperty: maximum loop count exceeded for "${key}"`);
+ (0, _util.warn)("getInheritableProperty: maximum loop count exceeded for \"".concat(key, "\""));
break;
}
@@ -2762,12 +13295,13 @@ function getInheritableProperty({
return values;
}
-const 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"];
+var ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
-function toRomanNumerals(number, lowerCase = false) {
+function toRomanNumerals(number) {
+ var lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
(0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
- const romanBuf = [];
- let pos;
+ var romanBuf = [];
+ var pos;
while (number >= 1000) {
number -= 1000;
@@ -2781,7 +13315,7 @@ function toRomanNumerals(number, lowerCase = false) {
number %= 10;
romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
- const romanStr = romanBuf.join("");
+ var romanStr = romanBuf.join("");
return lowerCase ? romanStr.toLowerCase() : romanStr;
}
@@ -2810,7 +13344,7 @@ function isWhiteSpace(ch) {
}
/***/ }),
-/* 9 */
+/* 202 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -2821,47 +13355,77 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFDocument = exports.Page = void 0;
-var _util = __w_pdfjs_require__(2);
+var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
+
+var _util = __w_pdfjs_require__(5);
+
+var _obj = __w_pdfjs_require__(203);
+
+var _primitives = __w_pdfjs_require__(198);
+
+var _core_utils = __w_pdfjs_require__(201);
-var _obj = __w_pdfjs_require__(10);
+var _stream = __w_pdfjs_require__(205);
-var _primitives = __w_pdfjs_require__(5);
+var _annotation = __w_pdfjs_require__(218);
-var _core_utils = __w_pdfjs_require__(8);
+var _crypto = __w_pdfjs_require__(215);
-var _stream = __w_pdfjs_require__(12);
+var _parser = __w_pdfjs_require__(204);
-var _annotation = __w_pdfjs_require__(25);
+var _operator_list = __w_pdfjs_require__(219);
-var _crypto = __w_pdfjs_require__(22);
+var _evaluator = __w_pdfjs_require__(220);
-var _parser = __w_pdfjs_require__(11);
+var _function = __w_pdfjs_require__(234);
-var _operator_list = __w_pdfjs_require__(26);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-var _evaluator = __w_pdfjs_require__(27);
+function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
-var _function = __w_pdfjs_require__(41);
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
-const DEFAULT_USER_UNIT = 1.0;
-const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
+function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
+
+function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
+
+function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
+
+function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
+
+function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
+
+function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
+
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var DEFAULT_USER_UNIT = 1.0;
+var LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
function isAnnotationRenderable(annotation, intent) {
return intent === "display" && annotation.viewable || intent === "print" && annotation.printable;
}
-class Page {
- constructor({
- pdfManager,
- xref,
- pageIndex,
- pageDict,
- ref,
- fontCache,
- builtInCMapCache,
- globalImageCache,
- pdfFunctionFactory
- }) {
+var Page = /*#__PURE__*/function () {
+ function Page(_ref) {
+ var pdfManager = _ref.pdfManager,
+ xref = _ref.xref,
+ pageIndex = _ref.pageIndex,
+ pageDict = _ref.pageDict,
+ ref = _ref.ref,
+ fontCache = _ref.fontCache,
+ builtInCMapCache = _ref.builtInCMapCache,
+ globalImageCache = _ref.globalImageCache,
+ pdfFunctionFactory = _ref.pdfFunctionFactory;
+
+ _classCallCheck(this, Page);
+
this.pdfManager = pdfManager;
this.pageIndex = pageIndex;
this.pageDict = pageDict;
@@ -2873,315 +13437,392 @@ class Page {
this.pdfFunctionFactory = pdfFunctionFactory;
this.evaluatorOptions = pdfManager.evaluatorOptions;
this.resourcesPromise = null;
- const idCounters = {
+ var idCounters = {
obj: 0
};
this.idFactory = {
- createObjId() {
- return `p${pageIndex}_${++idCounters.obj}`;
+ createObjId: function createObjId() {
+ return "p".concat(pageIndex, "_").concat(++idCounters.obj);
},
-
- getDocId() {
- return `g_${pdfManager.docId}`;
+ getDocId: function getDocId() {
+ return "g_".concat(pdfManager.docId);
}
-
};
}
- _getInheritableProperty(key, getArray = false) {
- const value = (0, _core_utils.getInheritableProperty)({
- dict: this.pageDict,
- key,
- getArray,
- stopWhenFound: false
- });
-
- if (!Array.isArray(value)) {
- return value;
- }
-
- if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
- return value[0];
- }
-
- return _primitives.Dict.merge(this.xref, value);
- }
-
- get content() {
- return this.pageDict.get("Contents");
- }
-
- get resources() {
- return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
- }
+ _createClass(Page, [{
+ key: "_getInheritableProperty",
+ value: function _getInheritableProperty(key) {
+ var getArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var value = (0, _core_utils.getInheritableProperty)({
+ dict: this.pageDict,
+ key: key,
+ getArray: getArray,
+ stopWhenFound: false
+ });
- _getBoundingBox(name) {
- const box = this._getInheritableProperty(name, true);
+ if (!Array.isArray(value)) {
+ return value;
+ }
- if (Array.isArray(box) && box.length === 4) {
- if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
- return box;
+ if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
+ return value[0];
}
- (0, _util.warn)(`Empty /${name} entry.`);
+ return _primitives.Dict.merge(this.xref, value);
}
+ }, {
+ key: "_getBoundingBox",
+ value: function _getBoundingBox(name) {
+ var box = this._getInheritableProperty(name, true);
- return null;
- }
-
- get mediaBox() {
- return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
- }
-
- get cropBox() {
- return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
- }
+ if (Array.isArray(box) && box.length === 4) {
+ if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
+ return box;
+ }
- get userUnit() {
- let obj = this.pageDict.get("UserUnit");
+ (0, _util.warn)("Empty /".concat(name, " entry."));
+ }
- if (!(0, _util.isNum)(obj) || obj <= 0) {
- obj = DEFAULT_USER_UNIT;
+ return null;
}
+ }, {
+ key: "getContentStream",
+ value: function getContentStream() {
+ var content = this.content;
+ var stream;
- return (0, _util.shadow)(this, "userUnit", obj);
- }
+ if (Array.isArray(content)) {
+ var xref = this.xref;
+ var streams = [];
- get view() {
- const {
- cropBox,
- mediaBox
- } = this;
- let view;
+ var _iterator = _createForOfIteratorHelper(content),
+ _step;
- if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
- view = mediaBox;
- } else {
- const box = _util.Util.intersect(cropBox, mediaBox);
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ var subStream = _step.value;
+ streams.push(xref.fetchIfRef(subStream));
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
- if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
- view = box;
+ stream = new _stream.StreamsSequenceStream(streams);
+ } else if ((0, _primitives.isStream)(content)) {
+ stream = content;
} else {
- (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
+ stream = new _stream.NullStream();
}
- }
- return (0, _util.shadow)(this, "view", view || mediaBox);
- }
+ return stream;
+ }
+ }, {
+ key: "loadResources",
+ value: function loadResources(keys) {
+ var _this = this;
- get rotate() {
- let rotate = this._getInheritableProperty("Rotate") || 0;
+ if (!this.resourcesPromise) {
+ this.resourcesPromise = this.pdfManager.ensure(this, "resources");
+ }
- if (rotate % 90 !== 0) {
- rotate = 0;
- } else if (rotate >= 360) {
- rotate = rotate % 360;
- } else if (rotate < 0) {
- rotate = (rotate % 360 + 360) % 360;
+ return this.resourcesPromise.then(function () {
+ var objectLoader = new _obj.ObjectLoader(_this.resources, keys, _this.xref);
+ return objectLoader.load();
+ });
}
+ }, {
+ key: "getOperatorList",
+ value: function getOperatorList(_ref2) {
+ var _this2 = this;
+
+ var handler = _ref2.handler,
+ sink = _ref2.sink,
+ task = _ref2.task,
+ intent = _ref2.intent,
+ renderInteractiveForms = _ref2.renderInteractiveForms;
+ var contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
+ var resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
+ var partialEvaluator = new _evaluator.PartialEvaluator({
+ xref: this.xref,
+ handler: handler,
+ pageIndex: this.pageIndex,
+ idFactory: this.idFactory,
+ fontCache: this.fontCache,
+ builtInCMapCache: this.builtInCMapCache,
+ globalImageCache: this.globalImageCache,
+ options: this.evaluatorOptions,
+ pdfFunctionFactory: this.pdfFunctionFactory
+ });
+ var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
+ var pageListPromise = dataPromises.then(function (_ref3) {
+ var _ref4 = _slicedToArray(_ref3, 1),
+ contentStream = _ref4[0];
+
+ var opList = new _operator_list.OperatorList(intent, sink, _this2.pageIndex);
+ handler.send("StartRenderPage", {
+ transparency: partialEvaluator.hasBlendModes(_this2.resources),
+ pageIndex: _this2.pageIndex,
+ intent: intent
+ });
+ return partialEvaluator.getOperatorList({
+ stream: contentStream,
+ task: task,
+ resources: _this2.resources,
+ operatorList: opList
+ }).then(function () {
+ return opList;
+ });
+ });
+ return Promise.all([pageListPromise, this._parsedAnnotations]).then(function (_ref5) {
+ var _ref6 = _slicedToArray(_ref5, 2),
+ pageOpList = _ref6[0],
+ annotations = _ref6[1];
- return (0, _util.shadow)(this, "rotate", rotate);
- }
+ if (annotations.length === 0) {
+ pageOpList.flush(true);
+ return {
+ length: pageOpList.totalLength
+ };
+ }
- getContentStream() {
- const content = this.content;
- let stream;
+ var opListPromises = [];
- if (Array.isArray(content)) {
- const xref = this.xref;
- const streams = [];
+ var _iterator2 = _createForOfIteratorHelper(annotations),
+ _step2;
- for (const subStream of content) {
- streams.push(xref.fetchIfRef(subStream));
- }
+ try {
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
+ var annotation = _step2.value;
- stream = new _stream.StreamsSequenceStream(streams);
- } else if ((0, _primitives.isStream)(content)) {
- stream = content;
- } else {
- stream = new _stream.NullStream();
- }
+ if (isAnnotationRenderable(annotation, intent)) {
+ opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms)["catch"](function (reason) {
+ (0, _util.warn)("getOperatorList - ignoring annotation data during " + "\"".concat(task.name, "\" task: \"").concat(reason, "\"."));
+ return null;
+ }));
+ }
+ }
+ } catch (err) {
+ _iterator2.e(err);
+ } finally {
+ _iterator2.f();
+ }
- return stream;
- }
+ return Promise.all(opListPromises).then(function (opLists) {
+ pageOpList.addOp(_util.OPS.beginAnnotations, []);
- loadResources(keys) {
- if (!this.resourcesPromise) {
- this.resourcesPromise = this.pdfManager.ensure(this, "resources");
- }
+ var _iterator3 = _createForOfIteratorHelper(opLists),
+ _step3;
- return this.resourcesPromise.then(() => {
- const objectLoader = new _obj.ObjectLoader(this.resources, keys, this.xref);
- return objectLoader.load();
- });
- }
+ try {
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
+ var opList = _step3.value;
+ pageOpList.addOpList(opList);
+ }
+ } catch (err) {
+ _iterator3.e(err);
+ } finally {
+ _iterator3.f();
+ }
- getOperatorList({
- handler,
- sink,
- task,
- intent,
- renderInteractiveForms
- }) {
- const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
- const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
- const partialEvaluator = new _evaluator.PartialEvaluator({
- xref: this.xref,
- handler,
- pageIndex: this.pageIndex,
- idFactory: this.idFactory,
- fontCache: this.fontCache,
- builtInCMapCache: this.builtInCMapCache,
- globalImageCache: this.globalImageCache,
- options: this.evaluatorOptions,
- pdfFunctionFactory: this.pdfFunctionFactory
- });
- const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
- const pageListPromise = dataPromises.then(([contentStream]) => {
- const opList = new _operator_list.OperatorList(intent, sink, this.pageIndex);
- handler.send("StartRenderPage", {
- transparency: partialEvaluator.hasBlendModes(this.resources),
- pageIndex: this.pageIndex,
- intent
+ pageOpList.addOp(_util.OPS.endAnnotations, []);
+ pageOpList.flush(true);
+ return {
+ length: pageOpList.totalLength
+ };
+ });
});
- return partialEvaluator.getOperatorList({
- stream: contentStream,
- task,
- resources: this.resources,
- operatorList: opList
- }).then(function () {
- return opList;
+ }
+ }, {
+ key: "extractTextContent",
+ value: function extractTextContent(_ref7) {
+ var _this3 = this;
+
+ var handler = _ref7.handler,
+ task = _ref7.task,
+ normalizeWhitespace = _ref7.normalizeWhitespace,
+ sink = _ref7.sink,
+ combineTextItems = _ref7.combineTextItems;
+ var contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
+ var resourcesPromise = this.loadResources(["ExtGState", "XObject", "Font"]);
+ var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
+ return dataPromises.then(function (_ref8) {
+ var _ref9 = _slicedToArray(_ref8, 1),
+ contentStream = _ref9[0];
+
+ var partialEvaluator = new _evaluator.PartialEvaluator({
+ xref: _this3.xref,
+ handler: handler,
+ pageIndex: _this3.pageIndex,
+ idFactory: _this3.idFactory,
+ fontCache: _this3.fontCache,
+ builtInCMapCache: _this3.builtInCMapCache,
+ globalImageCache: _this3.globalImageCache,
+ options: _this3.evaluatorOptions,
+ pdfFunctionFactory: _this3.pdfFunctionFactory
+ });
+ return partialEvaluator.getTextContent({
+ stream: contentStream,
+ task: task,
+ resources: _this3.resources,
+ normalizeWhitespace: normalizeWhitespace,
+ combineTextItems: combineTextItems,
+ sink: sink
+ });
});
- });
- return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
- if (annotations.length === 0) {
- pageOpList.flush(true);
- return {
- length: pageOpList.totalLength
- };
- }
-
- const opListPromises = [];
-
- for (const annotation of annotations) {
- if (isAnnotationRenderable(annotation, intent)) {
- opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms).catch(function (reason) {
- (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
- return null;
- }));
- }
- }
-
- return Promise.all(opListPromises).then(function (opLists) {
- pageOpList.addOp(_util.OPS.beginAnnotations, []);
+ }
+ }, {
+ key: "getAnnotationsData",
+ value: function getAnnotationsData(intent) {
+ return this._parsedAnnotations.then(function (annotations) {
+ var annotationsData = [];
- for (const opList of opLists) {
- pageOpList.addOpList(opList);
+ for (var i = 0, ii = annotations.length; i < ii; i++) {
+ if (!intent || isAnnotationRenderable(annotations[i], intent)) {
+ annotationsData.push(annotations[i].data);
+ }
}
- pageOpList.addOp(_util.OPS.endAnnotations, []);
- pageOpList.flush(true);
- return {
- length: pageOpList.totalLength
- };
+ return annotationsData;
});
- });
- }
+ }
+ }, {
+ key: "content",
+ get: function get() {
+ return this.pageDict.get("Contents");
+ }
+ }, {
+ key: "resources",
+ get: function get() {
+ return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
+ }
+ }, {
+ key: "mediaBox",
+ get: function get() {
+ return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
+ }
+ }, {
+ key: "cropBox",
+ get: function get() {
+ return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
+ }
+ }, {
+ key: "userUnit",
+ get: function get() {
+ var obj = this.pageDict.get("UserUnit");
- extractTextContent({
- handler,
- task,
- normalizeWhitespace,
- sink,
- combineTextItems
- }) {
- const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
- const resourcesPromise = this.loadResources(["ExtGState", "XObject", "Font"]);
- const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
- return dataPromises.then(([contentStream]) => {
- const partialEvaluator = new _evaluator.PartialEvaluator({
- xref: this.xref,
- handler,
- pageIndex: this.pageIndex,
- idFactory: this.idFactory,
- fontCache: this.fontCache,
- builtInCMapCache: this.builtInCMapCache,
- globalImageCache: this.globalImageCache,
- options: this.evaluatorOptions,
- pdfFunctionFactory: this.pdfFunctionFactory
- });
- return partialEvaluator.getTextContent({
- stream: contentStream,
- task,
- resources: this.resources,
- normalizeWhitespace,
- combineTextItems,
- sink
- });
- });
- }
+ if (!(0, _util.isNum)(obj) || obj <= 0) {
+ obj = DEFAULT_USER_UNIT;
+ }
- getAnnotationsData(intent) {
- return this._parsedAnnotations.then(function (annotations) {
- const annotationsData = [];
+ return (0, _util.shadow)(this, "userUnit", obj);
+ }
+ }, {
+ key: "view",
+ get: function get() {
+ var cropBox = this.cropBox,
+ mediaBox = this.mediaBox;
+ var view;
+
+ if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
+ view = mediaBox;
+ } else {
+ var box = _util.Util.intersect(cropBox, mediaBox);
- for (let i = 0, ii = annotations.length; i < ii; i++) {
- if (!intent || isAnnotationRenderable(annotations[i], intent)) {
- annotationsData.push(annotations[i].data);
+ if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
+ view = box;
+ } else {
+ (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
}
}
- return annotationsData;
- });
- }
+ return (0, _util.shadow)(this, "view", view || mediaBox);
+ }
+ }, {
+ key: "rotate",
+ get: function get() {
+ var rotate = this._getInheritableProperty("Rotate") || 0;
- get annotations() {
- return (0, _util.shadow)(this, "annotations", this._getInheritableProperty("Annots") || []);
- }
+ if (rotate % 90 !== 0) {
+ rotate = 0;
+ } else if (rotate >= 360) {
+ rotate = rotate % 360;
+ } else if (rotate < 0) {
+ rotate = (rotate % 360 + 360) % 360;
+ }
- get _parsedAnnotations() {
- const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
- const annotationPromises = [];
+ return (0, _util.shadow)(this, "rotate", rotate);
+ }
+ }, {
+ key: "annotations",
+ get: function get() {
+ return (0, _util.shadow)(this, "annotations", this._getInheritableProperty("Annots") || []);
+ }
+ }, {
+ key: "_parsedAnnotations",
+ get: function get() {
+ var _this4 = this;
- for (const annotationRef of this.annotations) {
- annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory).catch(function (reason) {
- (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
- return null;
- }));
- }
+ var parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(function () {
+ var annotationPromises = [];
+
+ var _iterator4 = _createForOfIteratorHelper(_this4.annotations),
+ _step4;
+
+ try {
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
+ var annotationRef = _step4.value;
+ annotationPromises.push(_annotation.AnnotationFactory.create(_this4.xref, annotationRef, _this4.pdfManager, _this4.idFactory)["catch"](function (reason) {
+ (0, _util.warn)("_parsedAnnotations: \"".concat(reason, "\"."));
+ return null;
+ }));
+ }
+ } catch (err) {
+ _iterator4.e(err);
+ } finally {
+ _iterator4.f();
+ }
- return Promise.all(annotationPromises).then(function (annotations) {
- return annotations.filter(annotation => !!annotation);
+ return Promise.all(annotationPromises).then(function (annotations) {
+ return annotations.filter(function (annotation) {
+ return !!annotation;
+ });
+ });
});
- });
- return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
- }
+ return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
+ }
+ }]);
-}
+ return Page;
+}();
exports.Page = Page;
-const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
-const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
-const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
-const FINGERPRINT_FIRST_BYTES = 1024;
-const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
-const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.[0-9]$/;
-
-function find(stream, signature, limit = 1024, backwards = false) {
- const signatureLength = signature.length;
- const scanBytes = stream.peekBytes(limit);
- const scanLength = scanBytes.length - signatureLength;
+var PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
+var STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
+var ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
+var FINGERPRINT_FIRST_BYTES = 1024;
+var EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
+var PDF_HEADER_VERSION_REGEXP = /^[1-9]\.[0-9]$/;
+
+function find(stream, signature) {
+ var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1024;
+ var backwards = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
+ var signatureLength = signature.length;
+ var scanBytes = stream.peekBytes(limit);
+ var scanLength = scanBytes.length - signatureLength;
if (scanLength <= 0) {
return false;
}
if (backwards) {
- const signatureEnd = signatureLength - 1;
- let pos = scanBytes.length - 1;
+ var signatureEnd = signatureLength - 1;
+ var pos = scanBytes.length - 1;
while (pos >= signatureEnd) {
- let j = 0;
+ var j = 0;
while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
j++;
@@ -3195,30 +13836,32 @@ function find(stream, signature, limit = 1024, backwards = false) {
pos--;
}
} else {
- let pos = 0;
+ var _pos = 0;
- while (pos <= scanLength) {
- let j = 0;
+ while (_pos <= scanLength) {
+ var _j = 0;
- while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
- j++;
+ while (_j < signatureLength && scanBytes[_pos + _j] === signature[_j]) {
+ _j++;
}
- if (j >= signatureLength) {
- stream.pos += pos;
+ if (_j >= signatureLength) {
+ stream.pos += _pos;
return true;
}
- pos++;
+ _pos++;
}
}
return false;
}
-class PDFDocument {
- constructor(pdfManager, arg) {
- let stream;
+var PDFDocument = /*#__PURE__*/function () {
+ function PDFDocument(pdfManager, arg) {
+ _classCallCheck(this, PDFDocument);
+
+ var stream;
if ((0, _primitives.isStream)(arg)) {
stream = arg;
@@ -3242,324 +13885,400 @@ class PDFDocument {
this._pagePromises = [];
}
- parse(recoveryMode) {
- this.setup(recoveryMode);
- const version = this.catalog.catDict.get("Version");
+ _createClass(PDFDocument, [{
+ key: "parse",
+ value: function parse(recoveryMode) {
+ this.setup(recoveryMode);
+ var version = this.catalog.catDict.get("Version");
- if ((0, _primitives.isName)(version)) {
- this.pdfFormatVersion = version.name;
- }
+ if ((0, _primitives.isName)(version)) {
+ this.pdfFormatVersion = version.name;
+ }
- try {
- this.acroForm = this.catalog.catDict.get("AcroForm");
+ try {
+ this.acroForm = this.catalog.catDict.get("AcroForm");
- if (this.acroForm) {
- this.xfa = this.acroForm.get("XFA");
- const fields = this.acroForm.get("Fields");
+ if (this.acroForm) {
+ this.xfa = this.acroForm.get("XFA");
+ var fields = this.acroForm.get("Fields");
- if ((!Array.isArray(fields) || fields.length === 0) && !this.xfa) {
- this.acroForm = null;
+ if ((!Array.isArray(fields) || fields.length === 0) && !this.xfa) {
+ this.acroForm = null;
+ }
+ }
+ } catch (ex) {
+ if (ex instanceof _core_utils.MissingDataException) {
+ throw ex;
}
- }
- } catch (ex) {
- if (ex instanceof _core_utils.MissingDataException) {
- throw ex;
- }
-
- (0, _util.info)("Cannot fetch AcroForm entry; assuming no AcroForms are present");
- this.acroForm = null;
- }
-
- try {
- const collection = this.catalog.catDict.get("Collection");
- if ((0, _primitives.isDict)(collection) && collection.getKeys().length > 0) {
- this.collection = collection;
- }
- } catch (ex) {
- if (ex instanceof _core_utils.MissingDataException) {
- throw ex;
+ (0, _util.info)("Cannot fetch AcroForm entry; assuming no AcroForms are present");
+ this.acroForm = null;
}
- (0, _util.info)("Cannot fetch Collection dictionary.");
- }
- }
+ try {
+ var collection = this.catalog.catDict.get("Collection");
- get linearization() {
- let linearization = null;
+ if ((0, _primitives.isDict)(collection) && collection.getKeys().length > 0) {
+ this.collection = collection;
+ }
+ } catch (ex) {
+ if (ex instanceof _core_utils.MissingDataException) {
+ throw ex;
+ }
- try {
- linearization = _parser.Linearization.create(this.stream);
- } catch (err) {
- if (err instanceof _core_utils.MissingDataException) {
- throw err;
+ (0, _util.info)("Cannot fetch Collection dictionary.");
}
-
- (0, _util.info)(err);
}
-
- return (0, _util.shadow)(this, "linearization", linearization);
- }
-
- get startXRef() {
- const stream = this.stream;
- let startXRef = 0;
-
- if (this.linearization) {
+ }, {
+ key: "checkHeader",
+ value: function checkHeader() {
+ var stream = this.stream;
stream.reset();
- if (find(stream, ENDOBJ_SIGNATURE)) {
- startXRef = stream.pos + 6 - stream.start;
+ if (!find(stream, PDF_HEADER_SIGNATURE)) {
+ return;
}
- } else {
- const step = 1024;
- const startXRefLength = STARTXREF_SIGNATURE.length;
- let found = false,
- pos = stream.end;
- while (!found && pos > 0) {
- pos -= step - startXRefLength;
+ stream.moveStart();
+ var MAX_PDF_VERSION_LENGTH = 12;
+ var version = "",
+ ch;
- if (pos < 0) {
- pos = 0;
+ while ((ch = stream.getByte()) > 0x20) {
+ if (version.length >= MAX_PDF_VERSION_LENGTH) {
+ break;
}
- stream.pos = pos;
- found = find(stream, STARTXREF_SIGNATURE, step, true);
+ version += String.fromCharCode(ch);
}
- if (found) {
- stream.skip(9);
- let ch;
+ if (!this.pdfFormatVersion) {
+ this.pdfFormatVersion = version.substring(5);
+ }
+ }
+ }, {
+ key: "parseStartXRef",
+ value: function parseStartXRef() {
+ this.xref.setStartXRef(this.startXRef);
+ }
+ }, {
+ key: "setup",
+ value: function setup(recoveryMode) {
+ this.xref.parse(recoveryMode);
+ this.catalog = new _obj.Catalog(this.pdfManager, this.xref);
+ }
+ }, {
+ key: "_getLinearizationPage",
+ value: function _getLinearizationPage(pageIndex) {
+ var catalog = this.catalog,
+ linearization = this.linearization;
- do {
- ch = stream.getByte();
- } while ((0, _core_utils.isWhiteSpace)(ch));
+ var ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
- let str = "";
+ return this.xref.fetchAsync(ref).then(function (obj) {
+ if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) {
+ if (ref && !catalog.pageKidsCountCache.has(ref)) {
+ catalog.pageKidsCountCache.put(ref, 1);
+ }
- while (ch >= 0x20 && ch <= 0x39) {
- str += String.fromCharCode(ch);
- ch = stream.getByte();
+ return [obj, ref];
}
- startXRef = parseInt(str, 10);
-
- if (isNaN(startXRef)) {
- startXRef = 0;
- }
- }
+ throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page dictionary.");
+ })["catch"](function (reason) {
+ (0, _util.info)(reason);
+ return catalog.getPageDict(pageIndex);
+ });
}
+ }, {
+ key: "getPage",
+ value: function getPage(pageIndex) {
+ var _this5 = this;
+
+ if (this._pagePromises[pageIndex] !== undefined) {
+ return this._pagePromises[pageIndex];
+ }
+
+ var catalog = this.catalog,
+ linearization = this.linearization;
+ var promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
+ return this._pagePromises[pageIndex] = promise.then(function (_ref10) {
+ var _ref11 = _slicedToArray(_ref10, 2),
+ pageDict = _ref11[0],
+ ref = _ref11[1];
+
+ return new Page({
+ pdfManager: _this5.pdfManager,
+ xref: _this5.xref,
+ pageIndex: pageIndex,
+ pageDict: pageDict,
+ ref: ref,
+ fontCache: catalog.fontCache,
+ builtInCMapCache: catalog.builtInCMapCache,
+ globalImageCache: catalog.globalImageCache,
+ pdfFunctionFactory: _this5.pdfFunctionFactory
+ });
+ });
+ }
+ }, {
+ key: "checkFirstPage",
+ value: function checkFirstPage() {
+ var _this6 = this;
+
+ return this.getPage(0)["catch"]( /*#__PURE__*/function () {
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(reason) {
+ return _regenerator["default"].wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ if (!(reason instanceof _core_utils.XRefEntryException)) {
+ _context.next = 5;
+ break;
+ }
- return (0, _util.shadow)(this, "startXRef", startXRef);
- }
+ _this6._pagePromises.length = 0;
+ _context.next = 4;
+ return _this6.cleanup();
- checkHeader() {
- const stream = this.stream;
- stream.reset();
+ case 4:
+ throw new _core_utils.XRefParseException();
- if (!find(stream, PDF_HEADER_SIGNATURE)) {
- return;
+ case 5:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee);
+ }));
+
+ return function (_x) {
+ return _ref12.apply(this, arguments);
+ };
+ }());
+ }
+ }, {
+ key: "fontFallback",
+ value: function fontFallback(id, handler) {
+ return this.catalog.fontFallback(id, handler);
}
+ }, {
+ key: "cleanup",
+ value: function () {
+ var _cleanup = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
+ var manuallyTriggered,
+ _args2 = arguments;
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
+ while (1) {
+ switch (_context2.prev = _context2.next) {
+ case 0:
+ manuallyTriggered = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : false;
+ return _context2.abrupt("return", this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)());
- stream.moveStart();
- const MAX_PDF_VERSION_LENGTH = 12;
- let version = "",
- ch;
+ case 2:
+ case "end":
+ return _context2.stop();
+ }
+ }
+ }, _callee2, this);
+ }));
- while ((ch = stream.getByte()) > 0x20) {
- if (version.length >= MAX_PDF_VERSION_LENGTH) {
- break;
+ function cleanup() {
+ return _cleanup.apply(this, arguments);
}
- version += String.fromCharCode(ch);
- }
+ return cleanup;
+ }()
+ }, {
+ key: "linearization",
+ get: function get() {
+ var linearization = null;
- if (!this.pdfFormatVersion) {
- this.pdfFormatVersion = version.substring(5);
- }
- }
+ try {
+ linearization = _parser.Linearization.create(this.stream);
+ } catch (err) {
+ if (err instanceof _core_utils.MissingDataException) {
+ throw err;
+ }
- parseStartXRef() {
- this.xref.setStartXRef(this.startXRef);
- }
+ (0, _util.info)(err);
+ }
- setup(recoveryMode) {
- this.xref.parse(recoveryMode);
- this.catalog = new _obj.Catalog(this.pdfManager, this.xref);
- }
+ return (0, _util.shadow)(this, "linearization", linearization);
+ }
+ }, {
+ key: "startXRef",
+ get: function get() {
+ var stream = this.stream;
+ var startXRef = 0;
- get numPages() {
- const linearization = this.linearization;
- const num = linearization ? linearization.numPages : this.catalog.numPages;
- return (0, _util.shadow)(this, "numPages", num);
- }
+ if (this.linearization) {
+ stream.reset();
- get documentInfo() {
- const DocumentInfoValidators = {
- Title: _util.isString,
- Author: _util.isString,
- Subject: _util.isString,
- Keywords: _util.isString,
- Creator: _util.isString,
- Producer: _util.isString,
- CreationDate: _util.isString,
- ModDate: _util.isString,
- Trapped: _primitives.isName
- };
- let version = this.pdfFormatVersion;
+ if (find(stream, ENDOBJ_SIGNATURE)) {
+ startXRef = stream.pos + 6 - stream.start;
+ }
+ } else {
+ var step = 1024;
+ var startXRefLength = STARTXREF_SIGNATURE.length;
+ var found = false,
+ pos = stream.end;
- if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
- (0, _util.warn)(`Invalid PDF header version number: ${version}`);
- version = null;
- }
+ while (!found && pos > 0) {
+ pos -= step - startXRefLength;
- const docInfo = {
- PDFFormatVersion: version,
- IsLinearized: !!this.linearization,
- IsAcroFormPresent: !!this.acroForm,
- IsXFAPresent: !!this.xfa,
- IsCollectionPresent: !!this.collection
- };
- let infoDict;
+ if (pos < 0) {
+ pos = 0;
+ }
- try {
- infoDict = this.xref.trailer.get("Info");
- } catch (err) {
- if (err instanceof _core_utils.MissingDataException) {
- throw err;
- }
+ stream.pos = pos;
+ found = find(stream, STARTXREF_SIGNATURE, step, true);
+ }
- (0, _util.info)("The document information dictionary is invalid.");
- }
+ if (found) {
+ stream.skip(9);
+ var ch;
- if ((0, _primitives.isDict)(infoDict)) {
- for (const key of infoDict.getKeys()) {
- const value = infoDict.get(key);
+ do {
+ ch = stream.getByte();
+ } while ((0, _core_utils.isWhiteSpace)(ch));
- if (DocumentInfoValidators[key]) {
- if (DocumentInfoValidators[key](value)) {
- docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value);
- } else {
- (0, _util.info)(`Bad value in document info for "${key}".`);
- }
- } else if (typeof key === "string") {
- let customValue;
+ var str = "";
- if ((0, _util.isString)(value)) {
- customValue = (0, _util.stringToPDFString)(value);
- } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {
- customValue = value;
- } else {
- (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`);
- continue;
+ while (ch >= 0x20 && ch <= 0x39) {
+ str += String.fromCharCode(ch);
+ ch = stream.getByte();
}
- if (!docInfo.Custom) {
- docInfo.Custom = Object.create(null);
- }
+ startXRef = parseInt(str, 10);
- docInfo.Custom[key] = customValue;
+ if (isNaN(startXRef)) {
+ startXRef = 0;
+ }
}
}
+
+ return (0, _util.shadow)(this, "startXRef", startXRef);
}
+ }, {
+ key: "numPages",
+ get: function get() {
+ var linearization = this.linearization;
+ var num = linearization ? linearization.numPages : this.catalog.numPages;
+ return (0, _util.shadow)(this, "numPages", num);
+ }
+ }, {
+ key: "documentInfo",
+ get: function get() {
+ var DocumentInfoValidators = {
+ Title: _util.isString,
+ Author: _util.isString,
+ Subject: _util.isString,
+ Keywords: _util.isString,
+ Creator: _util.isString,
+ Producer: _util.isString,
+ CreationDate: _util.isString,
+ ModDate: _util.isString,
+ Trapped: _primitives.isName
+ };
+ var version = this.pdfFormatVersion;
- return (0, _util.shadow)(this, "documentInfo", docInfo);
- }
+ if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
+ (0, _util.warn)("Invalid PDF header version number: ".concat(version));
+ version = null;
+ }
- get fingerprint() {
- let hash;
- const idArray = this.xref.trailer.get("ID");
+ var docInfo = {
+ PDFFormatVersion: version,
+ IsLinearized: !!this.linearization,
+ IsAcroFormPresent: !!this.acroForm,
+ IsXFAPresent: !!this.xfa,
+ IsCollectionPresent: !!this.collection
+ };
+ var infoDict;
- if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
- hash = (0, _util.stringToBytes)(idArray[0]);
- } else {
- hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
- }
+ try {
+ infoDict = this.xref.trailer.get("Info");
+ } catch (err) {
+ if (err instanceof _core_utils.MissingDataException) {
+ throw err;
+ }
- const fingerprintBuf = [];
+ (0, _util.info)("The document information dictionary is invalid.");
+ }
- for (let i = 0, ii = hash.length; i < ii; i++) {
- const hex = hash[i].toString(16);
- fingerprintBuf.push(hex.padStart(2, "0"));
- }
+ if ((0, _primitives.isDict)(infoDict)) {
+ var _iterator5 = _createForOfIteratorHelper(infoDict.getKeys()),
+ _step5;
- return (0, _util.shadow)(this, "fingerprint", fingerprintBuf.join(""));
- }
+ try {
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
+ var key = _step5.value;
+ var value = infoDict.get(key);
- _getLinearizationPage(pageIndex) {
- const {
- catalog,
- linearization
- } = this;
+ if (DocumentInfoValidators[key]) {
+ if (DocumentInfoValidators[key](value)) {
+ docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value);
+ } else {
+ (0, _util.info)("Bad value in document info for \"".concat(key, "\"."));
+ }
+ } else if (typeof key === "string") {
+ var customValue = void 0;
+
+ if ((0, _util.isString)(value)) {
+ customValue = (0, _util.stringToPDFString)(value);
+ } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {
+ customValue = value;
+ } else {
+ (0, _util.info)("Unsupported value in document info for (custom) \"".concat(key, "\"."));
+ continue;
+ }
- const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
+ if (!docInfo.Custom) {
+ docInfo.Custom = Object.create(null);
+ }
- return this.xref.fetchAsync(ref).then(obj => {
- if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) {
- if (ref && !catalog.pageKidsCountCache.has(ref)) {
- catalog.pageKidsCountCache.put(ref, 1);
+ docInfo.Custom[key] = customValue;
+ }
+ }
+ } catch (err) {
+ _iterator5.e(err);
+ } finally {
+ _iterator5.f();
}
-
- return [obj, ref];
}
- throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page dictionary.");
- }).catch(reason => {
- (0, _util.info)(reason);
- return catalog.getPageDict(pageIndex);
- });
- }
-
- getPage(pageIndex) {
- if (this._pagePromises[pageIndex] !== undefined) {
- return this._pagePromises[pageIndex];
+ return (0, _util.shadow)(this, "documentInfo", docInfo);
}
+ }, {
+ key: "fingerprint",
+ get: function get() {
+ var hash;
+ var idArray = this.xref.trailer.get("ID");
- const {
- catalog,
- linearization
- } = this;
- const promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
- return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => {
- return new Page({
- pdfManager: this.pdfManager,
- xref: this.xref,
- pageIndex,
- pageDict,
- ref,
- fontCache: catalog.fontCache,
- builtInCMapCache: catalog.builtInCMapCache,
- globalImageCache: catalog.globalImageCache,
- pdfFunctionFactory: this.pdfFunctionFactory
- });
- });
- }
-
- checkFirstPage() {
- return this.getPage(0).catch(async reason => {
- if (reason instanceof _core_utils.XRefEntryException) {
- this._pagePromises.length = 0;
- await this.cleanup();
- throw new _core_utils.XRefParseException();
+ if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
+ hash = (0, _util.stringToBytes)(idArray[0]);
+ } else {
+ hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
}
- });
- }
- fontFallback(id, handler) {
- return this.catalog.fontFallback(id, handler);
- }
+ var fingerprintBuf = [];
- async cleanup(manuallyTriggered = false) {
- return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)();
- }
+ for (var i = 0, ii = hash.length; i < ii; i++) {
+ var hex = hash[i].toString(16);
+ fingerprintBuf.push(hex.padStart(2, "0"));
+ }
-}
+ return (0, _util.shadow)(this, "fingerprint", fingerprintBuf.join(""));
+ }
+ }]);
+
+ return PDFDocument;
+}();
exports.PDFDocument = PDFDocument;
/***/ }),
-/* 10 */
+/* 203 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -3570,1105 +14289,1227 @@ Object.defineProperty(exports, "__esModule", {
});
exports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = void 0;
-var _util = __w_pdfjs_require__(2);
+var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
-var _primitives = __w_pdfjs_require__(5);
+var _util = __w_pdfjs_require__(5);
-var _parser = __w_pdfjs_require__(11);
+var _primitives = __w_pdfjs_require__(198);
-var _core_utils = __w_pdfjs_require__(8);
+var _parser = __w_pdfjs_require__(204);
-var _crypto = __w_pdfjs_require__(22);
+var _core_utils = __w_pdfjs_require__(201);
-var _colorspace = __w_pdfjs_require__(23);
+var _crypto = __w_pdfjs_require__(215);
-var _image_utils = __w_pdfjs_require__(24);
+var _colorspace = __w_pdfjs_require__(216);
-function fetchDestination(dest) {
- return (0, _primitives.isDict)(dest) ? dest.get("D") : dest;
-}
+var _image_utils = __w_pdfjs_require__(217);
-class Catalog {
- constructor(pdfManager, xref) {
- this.pdfManager = pdfManager;
- this.xref = xref;
- this.catDict = xref.getCatalogObj();
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- if (!(0, _primitives.isDict)(this.catDict)) {
- throw new _util.FormatError("Catalog object is not a dictionary.");
- }
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
- this.fontCache = new _primitives.RefSetCache();
- this.builtInCMapCache = new Map();
- this.globalImageCache = new _image_utils.GlobalImageCache();
- this.pageKidsCountCache = new _primitives.RefSetCache();
- }
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- get metadata() {
- const streamRef = this.catDict.getRaw("Metadata");
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
- if (!(0, _primitives.isRef)(streamRef)) {
- return (0, _util.shadow)(this, "metadata", null);
- }
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
- const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
- const stream = this.xref.fetch(streamRef, suppressEncryption);
- let metadata;
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- if (stream && (0, _primitives.isDict)(stream.dict)) {
- const type = stream.dict.get("Type");
- const subtype = stream.dict.get("Subtype");
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
- if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
- try {
- metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes()));
- } catch (e) {
- if (e instanceof _core_utils.MissingDataException) {
- throw e;
- }
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- (0, _util.info)("Skipping invalid metadata.");
- }
- }
- }
+function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
- return (0, _util.shadow)(this, "metadata", metadata);
- }
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
- get toplevelPagesDict() {
- const pagesObj = this.catDict.get("Pages");
+function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
- if (!(0, _primitives.isDict)(pagesObj)) {
- throw new _util.FormatError("Invalid top-level pages dictionary.");
- }
+function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
- }
+function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
- get documentOutline() {
- let obj = null;
+function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
- try {
- obj = this._readDocumentOutline();
- } catch (ex) {
- if (ex instanceof _core_utils.MissingDataException) {
- throw ex;
- }
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- (0, _util.warn)("Unable to read document outline.");
- }
+function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- return (0, _util.shadow)(this, "documentOutline", obj);
- }
+function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- _readDocumentOutline() {
- let obj = this.catDict.get("Outlines");
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- if (!(0, _primitives.isDict)(obj)) {
- return null;
- }
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- obj = obj.getRaw("First");
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- if (!(0, _primitives.isRef)(obj)) {
- return null;
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+function fetchDestination(dest) {
+ return (0, _primitives.isDict)(dest) ? dest.get("D") : dest;
+}
+
+var Catalog = /*#__PURE__*/function () {
+ function Catalog(pdfManager, xref) {
+ _classCallCheck(this, Catalog);
+
+ this.pdfManager = pdfManager;
+ this.xref = xref;
+ this.catDict = xref.getCatalogObj();
+
+ if (!(0, _primitives.isDict)(this.catDict)) {
+ throw new _util.FormatError("Catalog object is not a dictionary.");
}
- const root = {
- items: []
- };
- const queue = [{
- obj,
- parent: root
- }];
- const processed = new _primitives.RefSet();
- processed.put(obj);
- const xref = this.xref,
- blackColor = new Uint8ClampedArray(3);
+ this.fontCache = new _primitives.RefSetCache();
+ this.builtInCMapCache = new Map();
+ this.globalImageCache = new _image_utils.GlobalImageCache();
+ this.pageKidsCountCache = new _primitives.RefSetCache();
+ }
- while (queue.length > 0) {
- const i = queue.shift();
- const outlineDict = xref.fetchIfRef(i.obj);
+ _createClass(Catalog, [{
+ key: "_readDocumentOutline",
+ value: function _readDocumentOutline() {
+ var obj = this.catDict.get("Outlines");
- if (outlineDict === null) {
- continue;
+ if (!(0, _primitives.isDict)(obj)) {
+ return null;
}
- if (!outlineDict.has("Title")) {
- throw new _util.FormatError("Invalid outline item encountered.");
+ obj = obj.getRaw("First");
+
+ if (!(0, _primitives.isRef)(obj)) {
+ return null;
}
- const data = {
- url: null,
- dest: null
- };
- Catalog.parseDestDictionary({
- destDict: outlineDict,
- resultObj: data,
- docBaseUrl: this.pdfManager.docBaseUrl
- });
- const title = outlineDict.get("Title");
- const flags = outlineDict.get("F") || 0;
- const color = outlineDict.getArray("C");
- const count = outlineDict.get("Count");
- let rgbColor = blackColor;
-
- if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
- rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
- }
-
- const outlineItem = {
- dest: data.dest,
- url: data.url,
- unsafeUrl: data.unsafeUrl,
- newWindow: data.newWindow,
- title: (0, _util.stringToPDFString)(title),
- color: rgbColor,
- count: Number.isInteger(count) ? count : undefined,
- bold: !!(flags & 2),
- italic: !!(flags & 1),
+ var root = {
items: []
};
- i.parent.items.push(outlineItem);
- obj = outlineDict.getRaw("First");
+ var queue = [{
+ obj: obj,
+ parent: root
+ }];
+ var processed = new _primitives.RefSet();
+ processed.put(obj);
+ var xref = this.xref,
+ blackColor = new Uint8ClampedArray(3);
- if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
- queue.push({
- obj,
- parent: outlineItem
- });
- processed.put(obj);
- }
+ while (queue.length > 0) {
+ var i = queue.shift();
+ var outlineDict = xref.fetchIfRef(i.obj);
- obj = outlineDict.getRaw("Next");
+ if (outlineDict === null) {
+ continue;
+ }
- if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
- queue.push({
- obj,
- parent: i.parent
+ if (!outlineDict.has("Title")) {
+ throw new _util.FormatError("Invalid outline item encountered.");
+ }
+
+ var data = {
+ url: null,
+ dest: null
+ };
+ Catalog.parseDestDictionary({
+ destDict: outlineDict,
+ resultObj: data,
+ docBaseUrl: this.pdfManager.docBaseUrl
});
- processed.put(obj);
+ var title = outlineDict.get("Title");
+ var flags = outlineDict.get("F") || 0;
+ var color = outlineDict.getArray("C");
+ var count = outlineDict.get("Count");
+ var rgbColor = blackColor;
+
+ if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
+ rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
+ }
+
+ var outlineItem = {
+ dest: data.dest,
+ url: data.url,
+ unsafeUrl: data.unsafeUrl,
+ newWindow: data.newWindow,
+ title: (0, _util.stringToPDFString)(title),
+ color: rgbColor,
+ count: Number.isInteger(count) ? count : undefined,
+ bold: !!(flags & 2),
+ italic: !!(flags & 1),
+ items: []
+ };
+ i.parent.items.push(outlineItem);
+ obj = outlineDict.getRaw("First");
+
+ if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
+ queue.push({
+ obj: obj,
+ parent: outlineItem
+ });
+ processed.put(obj);
+ }
+
+ obj = outlineDict.getRaw("Next");
+
+ if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
+ queue.push({
+ obj: obj,
+ parent: i.parent
+ });
+ processed.put(obj);
+ }
}
+
+ return root.items.length > 0 ? root.items : null;
}
+ }, {
+ key: "_readPermissions",
+ value: function _readPermissions() {
+ var encrypt = this.xref.trailer.get("Encrypt");
- return root.items.length > 0 ? root.items : null;
- }
+ if (!(0, _primitives.isDict)(encrypt)) {
+ return null;
+ }
- get permissions() {
- let permissions = null;
+ var flags = encrypt.get("P");
- try {
- permissions = this._readPermissions();
- } catch (ex) {
- if (ex instanceof _core_utils.MissingDataException) {
- throw ex;
+ if (!(0, _util.isNum)(flags)) {
+ return null;
}
- (0, _util.warn)("Unable to read permissions.");
- }
+ flags += Math.pow(2, 32);
+ var permissions = [];
- return (0, _util.shadow)(this, "permissions", permissions);
- }
+ for (var key in _util.PermissionFlag) {
+ var value = _util.PermissionFlag[key];
- _readPermissions() {
- const encrypt = this.xref.trailer.get("Encrypt");
+ if (flags & value) {
+ permissions.push(value);
+ }
+ }
- if (!(0, _primitives.isDict)(encrypt)) {
- return null;
+ return permissions;
}
+ }, {
+ key: "getDestination",
+ value: function getDestination(destinationId) {
+ var obj = this._readDests();
- let flags = encrypt.get("P");
+ if (obj instanceof NameTree || obj instanceof _primitives.Dict) {
+ return fetchDestination(obj.get(destinationId) || null);
+ }
- if (!(0, _util.isNum)(flags)) {
return null;
}
+ }, {
+ key: "_readDests",
+ value: function _readDests() {
+ var obj = this.catDict.get("Names");
- flags += 2 ** 32;
- const permissions = [];
+ if (obj && obj.has("Dests")) {
+ return new NameTree(obj.getRaw("Dests"), this.xref);
+ } else if (this.catDict.has("Dests")) {
+ return this.catDict.get("Dests");
+ }
- for (const key in _util.PermissionFlag) {
- const value = _util.PermissionFlag[key];
+ return undefined;
+ }
+ }, {
+ key: "_readPageLabels",
+ value: function _readPageLabels() {
+ var obj = this.catDict.getRaw("PageLabels");
- if (flags & value) {
- permissions.push(value);
+ if (!obj) {
+ return null;
}
- }
- return permissions;
- }
+ var pageLabels = new Array(this.numPages);
+ var style = null,
+ prefix = "";
+ var numberTree = new NumberTree(obj, this.xref);
+ var nums = numberTree.getAll();
+ var currentLabel = "",
+ currentIndex = 1;
- get numPages() {
- const obj = this.toplevelPagesDict.get("Count");
+ for (var i = 0, ii = this.numPages; i < ii; i++) {
+ if (i in nums) {
+ var labelDict = nums[i];
- if (!Number.isInteger(obj)) {
- throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
- }
+ if (!(0, _primitives.isDict)(labelDict)) {
+ throw new _util.FormatError("PageLabel is not a dictionary.");
+ }
- return (0, _util.shadow)(this, "numPages", obj);
- }
+ if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
+ throw new _util.FormatError("Invalid type in PageLabel dictionary.");
+ }
- get destinations() {
- const obj = this._readDests(),
- dests = Object.create(null);
+ if (labelDict.has("S")) {
+ var s = labelDict.get("S");
- if (obj instanceof NameTree) {
- const names = obj.getAll();
+ if (!(0, _primitives.isName)(s)) {
+ throw new _util.FormatError("Invalid style in PageLabel dictionary.");
+ }
- for (const name in names) {
- dests[name] = fetchDestination(names[name]);
- }
- } else if (obj instanceof _primitives.Dict) {
- obj.forEach(function (key, value) {
- if (value) {
- dests[key] = fetchDestination(value);
- }
- });
- }
+ style = s.name;
+ } else {
+ style = null;
+ }
- return (0, _util.shadow)(this, "destinations", dests);
- }
+ if (labelDict.has("P")) {
+ var p = labelDict.get("P");
- getDestination(destinationId) {
- const obj = this._readDests();
+ if (!(0, _util.isString)(p)) {
+ throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
+ }
- if (obj instanceof NameTree || obj instanceof _primitives.Dict) {
- return fetchDestination(obj.get(destinationId) || null);
- }
+ prefix = (0, _util.stringToPDFString)(p);
+ } else {
+ prefix = "";
+ }
- return null;
- }
+ if (labelDict.has("St")) {
+ var st = labelDict.get("St");
- _readDests() {
- const obj = this.catDict.get("Names");
+ if (!(Number.isInteger(st) && st >= 1)) {
+ throw new _util.FormatError("Invalid start in PageLabel dictionary.");
+ }
- if (obj && obj.has("Dests")) {
- return new NameTree(obj.getRaw("Dests"), this.xref);
- } else if (this.catDict.has("Dests")) {
- return this.catDict.get("Dests");
- }
+ currentIndex = st;
+ } else {
+ currentIndex = 1;
+ }
+ }
- return undefined;
- }
+ switch (style) {
+ case "D":
+ currentLabel = currentIndex;
+ break;
- get pageLabels() {
- let obj = null;
+ case "R":
+ case "r":
+ currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
+ break;
- try {
- obj = this._readPageLabels();
- } catch (ex) {
- if (ex instanceof _core_utils.MissingDataException) {
- throw ex;
- }
+ case "A":
+ case "a":
+ var LIMIT = 26;
+ var A_UPPER_CASE = 0x41,
+ A_LOWER_CASE = 0x61;
+ var baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
+ var letterIndex = currentIndex - 1;
+ var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
+ var charBuf = [];
- (0, _util.warn)("Unable to read page labels.");
- }
+ for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
+ charBuf.push(character);
+ }
- return (0, _util.shadow)(this, "pageLabels", obj);
- }
+ currentLabel = charBuf.join("");
+ break;
- _readPageLabels() {
- const obj = this.catDict.getRaw("PageLabels");
+ default:
+ if (style) {
+ throw new _util.FormatError("Invalid style \"".concat(style, "\" in PageLabel dictionary."));
+ }
- if (!obj) {
- return null;
- }
+ currentLabel = "";
+ }
- const pageLabels = new Array(this.numPages);
- let style = null,
- prefix = "";
- const numberTree = new NumberTree(obj, this.xref);
- const nums = numberTree.getAll();
- let currentLabel = "",
- currentIndex = 1;
+ pageLabels[i] = prefix + currentLabel;
+ currentIndex++;
+ }
- for (let i = 0, ii = this.numPages; i < ii; i++) {
- if (i in nums) {
- const labelDict = nums[i];
+ return pageLabels;
+ }
+ }, {
+ key: "fontFallback",
+ value: function fontFallback(id, handler) {
+ var promises = [];
+ this.fontCache.forEach(function (promise) {
+ promises.push(promise);
+ });
+ return Promise.all(promises).then(function (translatedFonts) {
+ var _iterator = _createForOfIteratorHelper(translatedFonts),
+ _step;
- if (!(0, _primitives.isDict)(labelDict)) {
- throw new _util.FormatError("PageLabel is not a dictionary.");
- }
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ var translatedFont = _step.value;
- if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
- throw new _util.FormatError("Invalid type in PageLabel dictionary.");
+ if (translatedFont.loadedName === id) {
+ translatedFont.fallback(handler);
+ return;
+ }
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
}
+ });
+ }
+ }, {
+ key: "cleanup",
+ value: function cleanup() {
+ var _this = this;
+
+ var manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ (0, _primitives.clearPrimitiveCaches)();
+ this.globalImageCache.clear(manuallyTriggered);
+ this.pageKidsCountCache.clear();
+ var promises = [];
+ this.fontCache.forEach(function (promise) {
+ promises.push(promise);
+ });
+ return Promise.all(promises).then(function (translatedFonts) {
+ var _iterator2 = _createForOfIteratorHelper(translatedFonts),
+ _step2;
- if (labelDict.has("S")) {
- const s = labelDict.get("S");
-
- if (!(0, _primitives.isName)(s)) {
- throw new _util.FormatError("Invalid style in PageLabel dictionary.");
+ try {
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
+ var dict = _step2.value.dict;
+ delete dict.translated;
}
-
- style = s.name;
- } else {
- style = null;
+ } catch (err) {
+ _iterator2.e(err);
+ } finally {
+ _iterator2.f();
}
- if (labelDict.has("P")) {
- const p = labelDict.get("P");
+ _this.fontCache.clear();
- if (!(0, _util.isString)(p)) {
- throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
- }
+ _this.builtInCMapCache.clear();
+ });
+ }
+ }, {
+ key: "getPageDict",
+ value: function getPageDict(pageIndex) {
+ var capability = (0, _util.createPromiseCapability)();
+ var nodesToVisit = [this.catDict.getRaw("Pages")];
+ var visitedNodes = new _primitives.RefSet();
+ var xref = this.xref,
+ pageKidsCountCache = this.pageKidsCountCache;
+ var count,
+ currentPageIndex = 0;
- prefix = (0, _util.stringToPDFString)(p);
- } else {
- prefix = "";
- }
+ function next() {
+ var _loop = function _loop() {
+ var currentNode = nodesToVisit.pop();
- if (labelDict.has("St")) {
- const st = labelDict.get("St");
+ if ((0, _primitives.isRef)(currentNode)) {
+ count = pageKidsCountCache.get(currentNode);
- if (!(Number.isInteger(st) && st >= 1)) {
- throw new _util.FormatError("Invalid start in PageLabel dictionary.");
- }
+ if (count > 0 && currentPageIndex + count < pageIndex) {
+ currentPageIndex += count;
+ return "continue";
+ }
- currentIndex = st;
- } else {
- currentIndex = 1;
- }
- }
+ if (visitedNodes.has(currentNode)) {
+ capability.reject(new _util.FormatError("Pages tree contains circular reference."));
+ return {
+ v: void 0
+ };
+ }
- switch (style) {
- case "D":
- currentLabel = currentIndex;
- break;
+ visitedNodes.put(currentNode);
+ xref.fetchAsync(currentNode).then(function (obj) {
+ if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
+ if (pageIndex === currentPageIndex) {
+ if (currentNode && !pageKidsCountCache.has(currentNode)) {
+ pageKidsCountCache.put(currentNode, 1);
+ }
- case "R":
- case "r":
- currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
- break;
+ capability.resolve([obj, currentNode]);
+ } else {
+ currentPageIndex++;
+ next();
+ }
- case "A":
- case "a":
- const LIMIT = 26;
- const A_UPPER_CASE = 0x41,
- A_LOWER_CASE = 0x61;
- const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
- const letterIndex = currentIndex - 1;
- const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
- const charBuf = [];
+ return;
+ }
- for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
- charBuf.push(character);
+ nodesToVisit.push(obj);
+ next();
+ }, capability.reject);
+ return {
+ v: void 0
+ };
}
- currentLabel = charBuf.join("");
- break;
-
- default:
- if (style) {
- throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
+ if (!(0, _primitives.isDict)(currentNode)) {
+ capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
+ return {
+ v: void 0
+ };
}
- currentLabel = "";
- }
+ count = currentNode.get("Count");
- pageLabels[i] = prefix + currentLabel;
- currentIndex++;
- }
+ if (Number.isInteger(count) && count >= 0) {
+ var objId = currentNode.objId;
- return pageLabels;
- }
+ if (objId && !pageKidsCountCache.has(objId)) {
+ pageKidsCountCache.put(objId, count);
+ }
- get pageLayout() {
- const obj = this.catDict.get("PageLayout");
- let pageLayout = "";
+ if (currentPageIndex + count <= pageIndex) {
+ currentPageIndex += count;
+ return "continue";
+ }
+ }
- if ((0, _primitives.isName)(obj)) {
- switch (obj.name) {
- case "SinglePage":
- case "OneColumn":
- case "TwoColumnLeft":
- case "TwoColumnRight":
- case "TwoPageLeft":
- case "TwoPageRight":
- pageLayout = obj.name;
- }
- }
+ var kids = currentNode.get("Kids");
- return (0, _util.shadow)(this, "pageLayout", pageLayout);
- }
+ if (!Array.isArray(kids)) {
+ if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && currentNode.has("Contents")) {
+ if (currentPageIndex === pageIndex) {
+ capability.resolve([currentNode, null]);
+ return {
+ v: void 0
+ };
+ }
- get pageMode() {
- const obj = this.catDict.get("PageMode");
- let pageMode = "UseNone";
+ currentPageIndex++;
+ return "continue";
+ }
- if ((0, _primitives.isName)(obj)) {
- switch (obj.name) {
- case "UseNone":
- case "UseOutlines":
- case "UseThumbs":
- case "FullScreen":
- case "UseOC":
- case "UseAttachments":
- pageMode = obj.name;
- }
- }
+ capability.reject(new _util.FormatError("Page dictionary kids object is not an array."));
+ return {
+ v: void 0
+ };
+ }
- return (0, _util.shadow)(this, "pageMode", pageMode);
- }
+ for (var last = kids.length - 1; last >= 0; last--) {
+ nodesToVisit.push(kids[last]);
+ }
+ };
- get viewerPreferences() {
- const ViewerPreferencesValidators = {
- HideToolbar: _util.isBool,
- HideMenubar: _util.isBool,
- HideWindowUI: _util.isBool,
- FitWindow: _util.isBool,
- CenterWindow: _util.isBool,
- DisplayDocTitle: _util.isBool,
- NonFullScreenPageMode: _primitives.isName,
- Direction: _primitives.isName,
- ViewArea: _primitives.isName,
- ViewClip: _primitives.isName,
- PrintArea: _primitives.isName,
- PrintClip: _primitives.isName,
- PrintScaling: _primitives.isName,
- Duplex: _primitives.isName,
- PickTrayByPDFSize: _util.isBool,
- PrintPageRange: Array.isArray,
- NumCopies: Number.isInteger
- };
- const obj = this.catDict.get("ViewerPreferences");
- let prefs = null;
+ while (nodesToVisit.length) {
+ var _ret = _loop();
- if ((0, _primitives.isDict)(obj)) {
- for (const key in ViewerPreferencesValidators) {
- if (!obj.has(key)) {
- continue;
- }
-
- const value = obj.get(key);
+ switch (_ret) {
+ case "continue":
+ continue;
- if (!ViewerPreferencesValidators[key](value)) {
- (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
- continue;
+ default:
+ if (_typeof(_ret) === "object") return _ret.v;
+ }
}
- let prefValue;
+ capability.reject(new Error("Page index ".concat(pageIndex, " not found.")));
+ }
- switch (key) {
- case "NonFullScreenPageMode":
- switch (value.name) {
- case "UseNone":
- case "UseOutlines":
- case "UseThumbs":
- case "UseOC":
- prefValue = value.name;
- break;
+ next();
+ return capability.promise;
+ }
+ }, {
+ key: "getPageIndex",
+ value: function getPageIndex(pageRef) {
+ var xref = this.xref;
- default:
- prefValue = "UseNone";
- }
+ function pagesBeforeRef(kidRef) {
+ var total = 0,
+ parentRef;
+ return xref.fetchAsync(kidRef).then(function (node) {
+ if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) {
+ throw new _util.FormatError("The reference does not point to a /Page dictionary.");
+ }
- break;
+ if (!node) {
+ return null;
+ }
- case "Direction":
- switch (value.name) {
- case "L2R":
- case "R2L":
- prefValue = value.name;
- break;
+ if (!(0, _primitives.isDict)(node)) {
+ throw new _util.FormatError("Node must be a dictionary.");
+ }
- default:
- prefValue = "L2R";
- }
+ parentRef = node.getRaw("Parent");
+ return node.getAsync("Parent");
+ }).then(function (parent) {
+ if (!parent) {
+ return null;
+ }
- break;
+ if (!(0, _primitives.isDict)(parent)) {
+ throw new _util.FormatError("Parent must be a dictionary.");
+ }
- case "ViewArea":
- case "ViewClip":
- case "PrintArea":
- case "PrintClip":
- switch (value.name) {
- case "MediaBox":
- case "CropBox":
- case "BleedBox":
- case "TrimBox":
- case "ArtBox":
- prefValue = value.name;
- break;
+ return parent.getAsync("Kids");
+ }).then(function (kids) {
+ if (!kids) {
+ return null;
+ }
- default:
- prefValue = "CropBox";
- }
+ var kidPromises = [];
+ var found = false;
- break;
+ for (var i = 0, ii = kids.length; i < ii; i++) {
+ var kid = kids[i];
- case "PrintScaling":
- switch (value.name) {
- case "None":
- case "AppDefault":
- prefValue = value.name;
- break;
+ if (!(0, _primitives.isRef)(kid)) {
+ throw new _util.FormatError("Kid must be a reference.");
+ }
- default:
- prefValue = "AppDefault";
+ if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
+ found = true;
+ break;
}
- break;
+ kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
+ if (!(0, _primitives.isDict)(obj)) {
+ throw new _util.FormatError("Kid node must be a dictionary.");
+ }
- case "Duplex":
- switch (value.name) {
- case "Simplex":
- case "DuplexFlipShortEdge":
- case "DuplexFlipLongEdge":
- prefValue = value.name;
- break;
+ if (obj.has("Count")) {
+ total += obj.get("Count");
+ } else {
+ total++;
+ }
+ }));
+ }
- default:
- prefValue = "None";
- }
+ if (!found) {
+ throw new _util.FormatError("Kid reference not found in parent's kids.");
+ }
- break;
+ return Promise.all(kidPromises).then(function () {
+ return [total, parentRef];
+ });
+ });
+ }
- case "PrintPageRange":
- const length = value.length;
+ var total = 0;
- if (length % 2 !== 0) {
- break;
- }
+ function next(ref) {
+ return pagesBeforeRef(ref).then(function (args) {
+ if (!args) {
+ return total;
+ }
- const isValid = value.every((page, i, arr) => {
- return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
- });
+ var _args = _slicedToArray(args, 2),
+ count = _args[0],
+ parentRef = _args[1];
- if (isValid) {
- prefValue = value;
- }
+ total += count;
+ return next(parentRef);
+ });
+ }
- break;
+ return next(pageRef);
+ }
+ }, {
+ key: "metadata",
+ get: function get() {
+ var streamRef = this.catDict.getRaw("Metadata");
- case "NumCopies":
- if (value > 0) {
- prefValue = value;
- }
+ if (!(0, _primitives.isRef)(streamRef)) {
+ return (0, _util.shadow)(this, "metadata", null);
+ }
- break;
+ var suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
+ var stream = this.xref.fetch(streamRef, suppressEncryption);
+ var metadata;
- default:
- if (typeof value !== "boolean") {
- throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`);
- }
+ if (stream && (0, _primitives.isDict)(stream.dict)) {
+ var type = stream.dict.get("Type");
+ var subtype = stream.dict.get("Subtype");
- prefValue = value;
- }
+ if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
+ try {
+ metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes()));
+ } catch (e) {
+ if (e instanceof _core_utils.MissingDataException) {
+ throw e;
+ }
- if (prefValue !== undefined) {
- if (!prefs) {
- prefs = Object.create(null);
+ (0, _util.info)("Skipping invalid metadata.");
}
-
- prefs[key] = prefValue;
- } else {
- (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
}
}
- }
-
- return (0, _util.shadow)(this, "viewerPreferences", prefs);
- }
- get openAction() {
- const obj = this.catDict.get("OpenAction");
- let openAction = null;
+ return (0, _util.shadow)(this, "metadata", metadata);
+ }
+ }, {
+ key: "toplevelPagesDict",
+ get: function get() {
+ var pagesObj = this.catDict.get("Pages");
- if ((0, _primitives.isDict)(obj)) {
- const destDict = new _primitives.Dict(this.xref);
- destDict.set("A", obj);
- const resultObj = {
- url: null,
- dest: null,
- action: null
- };
- Catalog.parseDestDictionary({
- destDict,
- resultObj
- });
+ if (!(0, _primitives.isDict)(pagesObj)) {
+ throw new _util.FormatError("Invalid top-level pages dictionary.");
+ }
- if (Array.isArray(resultObj.dest)) {
- if (!openAction) {
- openAction = Object.create(null);
- }
+ return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
+ }
+ }, {
+ key: "documentOutline",
+ get: function get() {
+ var obj = null;
- openAction.dest = resultObj.dest;
- } else if (resultObj.action) {
- if (!openAction) {
- openAction = Object.create(null);
+ try {
+ obj = this._readDocumentOutline();
+ } catch (ex) {
+ if (ex instanceof _core_utils.MissingDataException) {
+ throw ex;
}
- openAction.action = resultObj.action;
- }
- } else if (Array.isArray(obj)) {
- if (!openAction) {
- openAction = Object.create(null);
+ (0, _util.warn)("Unable to read document outline.");
}
- openAction.dest = obj;
+ return (0, _util.shadow)(this, "documentOutline", obj);
}
+ }, {
+ key: "permissions",
+ get: function get() {
+ var permissions = null;
- return (0, _util.shadow)(this, "openAction", openAction);
- }
-
- get attachments() {
- const obj = this.catDict.get("Names");
- let attachments = null;
-
- if (obj && obj.has("EmbeddedFiles")) {
- const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
- const names = nameTree.getAll();
-
- for (const name in names) {
- const fs = new FileSpec(names[name], this.xref);
-
- if (!attachments) {
- attachments = Object.create(null);
+ try {
+ permissions = this._readPermissions();
+ } catch (ex) {
+ if (ex instanceof _core_utils.MissingDataException) {
+ throw ex;
}
- attachments[(0, _util.stringToPDFString)(name)] = fs.serializable;
+ (0, _util.warn)("Unable to read permissions.");
}
+
+ return (0, _util.shadow)(this, "permissions", permissions);
}
+ }, {
+ key: "numPages",
+ get: function get() {
+ var obj = this.toplevelPagesDict.get("Count");
- return (0, _util.shadow)(this, "attachments", attachments);
- }
+ if (!Number.isInteger(obj)) {
+ throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
+ }
- get javaScript() {
- const obj = this.catDict.get("Names");
- let javaScript = null;
+ return (0, _util.shadow)(this, "numPages", obj);
+ }
+ }, {
+ key: "destinations",
+ get: function get() {
+ var obj = this._readDests(),
+ dests = Object.create(null);
- function appendIfJavaScriptDict(jsDict) {
- const type = jsDict.get("S");
+ if (obj instanceof NameTree) {
+ var names = obj.getAll();
- if (!(0, _primitives.isName)(type, "JavaScript")) {
- return;
+ for (var name in names) {
+ dests[name] = fetchDestination(names[name]);
+ }
+ } else if (obj instanceof _primitives.Dict) {
+ obj.forEach(function (key, value) {
+ if (value) {
+ dests[key] = fetchDestination(value);
+ }
+ });
}
- let js = jsDict.get("JS");
+ return (0, _util.shadow)(this, "destinations", dests);
+ }
+ }, {
+ key: "pageLabels",
+ get: function get() {
+ var obj = null;
- if ((0, _primitives.isStream)(js)) {
- js = (0, _util.bytesToString)(js.getBytes());
- } else if (!(0, _util.isString)(js)) {
- return;
- }
+ try {
+ obj = this._readPageLabels();
+ } catch (ex) {
+ if (ex instanceof _core_utils.MissingDataException) {
+ throw ex;
+ }
- if (!javaScript) {
- javaScript = [];
+ (0, _util.warn)("Unable to read page labels.");
}
- javaScript.push((0, _util.stringToPDFString)(js));
+ return (0, _util.shadow)(this, "pageLabels", obj);
}
+ }, {
+ key: "pageLayout",
+ get: function get() {
+ var obj = this.catDict.get("PageLayout");
+ var pageLayout = "";
- if (obj && obj.has("JavaScript")) {
- const nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref);
- const names = nameTree.getAll();
+ if ((0, _primitives.isName)(obj)) {
+ switch (obj.name) {
+ case "SinglePage":
+ case "OneColumn":
+ case "TwoColumnLeft":
+ case "TwoColumnRight":
+ case "TwoPageLeft":
+ case "TwoPageRight":
+ pageLayout = obj.name;
+ }
+ }
- for (const name in names) {
- const jsDict = names[name];
+ return (0, _util.shadow)(this, "pageLayout", pageLayout);
+ }
+ }, {
+ key: "pageMode",
+ get: function get() {
+ var obj = this.catDict.get("PageMode");
+ var pageMode = "UseNone";
- if ((0, _primitives.isDict)(jsDict)) {
- appendIfJavaScriptDict(jsDict);
+ if ((0, _primitives.isName)(obj)) {
+ switch (obj.name) {
+ case "UseNone":
+ case "UseOutlines":
+ case "UseThumbs":
+ case "FullScreen":
+ case "UseOC":
+ case "UseAttachments":
+ pageMode = obj.name;
}
}
+
+ return (0, _util.shadow)(this, "pageMode", pageMode);
}
+ }, {
+ key: "viewerPreferences",
+ get: function get() {
+ var _this2 = this;
+
+ var ViewerPreferencesValidators = {
+ HideToolbar: _util.isBool,
+ HideMenubar: _util.isBool,
+ HideWindowUI: _util.isBool,
+ FitWindow: _util.isBool,
+ CenterWindow: _util.isBool,
+ DisplayDocTitle: _util.isBool,
+ NonFullScreenPageMode: _primitives.isName,
+ Direction: _primitives.isName,
+ ViewArea: _primitives.isName,
+ ViewClip: _primitives.isName,
+ PrintArea: _primitives.isName,
+ PrintClip: _primitives.isName,
+ PrintScaling: _primitives.isName,
+ Duplex: _primitives.isName,
+ PickTrayByPDFSize: _util.isBool,
+ PrintPageRange: Array.isArray,
+ NumCopies: Number.isInteger
+ };
+ var obj = this.catDict.get("ViewerPreferences");
+ var prefs = null;
- const openAction = this.catDict.get("OpenAction");
+ if ((0, _primitives.isDict)(obj)) {
+ for (var key in ViewerPreferencesValidators) {
+ if (!obj.has(key)) {
+ continue;
+ }
- if ((0, _primitives.isDict)(openAction) && (0, _primitives.isName)(openAction.get("S"), "JavaScript")) {
- appendIfJavaScriptDict(openAction);
- }
+ var value = obj.get(key);
- return (0, _util.shadow)(this, "javaScript", javaScript);
- }
+ if (!ViewerPreferencesValidators[key](value)) {
+ (0, _util.info)("Bad value in ViewerPreferences for \"".concat(key, "\"."));
+ continue;
+ }
- fontFallback(id, handler) {
- const promises = [];
- this.fontCache.forEach(function (promise) {
- promises.push(promise);
- });
- return Promise.all(promises).then(translatedFonts => {
- for (const translatedFont of translatedFonts) {
- if (translatedFont.loadedName === id) {
- translatedFont.fallback(handler);
- return;
- }
- }
- });
- }
+ var prefValue = void 0;
- cleanup(manuallyTriggered = false) {
- (0, _primitives.clearPrimitiveCaches)();
- this.globalImageCache.clear(manuallyTriggered);
- this.pageKidsCountCache.clear();
- const promises = [];
- this.fontCache.forEach(function (promise) {
- promises.push(promise);
- });
- return Promise.all(promises).then(translatedFonts => {
- for (const {
- dict
- } of translatedFonts) {
- delete dict.translated;
- }
+ switch (key) {
+ case "NonFullScreenPageMode":
+ switch (value.name) {
+ case "UseNone":
+ case "UseOutlines":
+ case "UseThumbs":
+ case "UseOC":
+ prefValue = value.name;
+ break;
- this.fontCache.clear();
- this.builtInCMapCache.clear();
- });
- }
+ default:
+ prefValue = "UseNone";
+ }
- getPageDict(pageIndex) {
- const capability = (0, _util.createPromiseCapability)();
- const nodesToVisit = [this.catDict.getRaw("Pages")];
- const visitedNodes = new _primitives.RefSet();
- const xref = this.xref,
- pageKidsCountCache = this.pageKidsCountCache;
- let count,
- currentPageIndex = 0;
+ break;
- function next() {
- while (nodesToVisit.length) {
- const currentNode = nodesToVisit.pop();
+ case "Direction":
+ switch (value.name) {
+ case "L2R":
+ case "R2L":
+ prefValue = value.name;
+ break;
- if ((0, _primitives.isRef)(currentNode)) {
- count = pageKidsCountCache.get(currentNode);
+ default:
+ prefValue = "L2R";
+ }
- if (count > 0 && currentPageIndex + count < pageIndex) {
- currentPageIndex += count;
- continue;
- }
+ break;
- if (visitedNodes.has(currentNode)) {
- capability.reject(new _util.FormatError("Pages tree contains circular reference."));
- return;
- }
+ case "ViewArea":
+ case "ViewClip":
+ case "PrintArea":
+ case "PrintClip":
+ switch (value.name) {
+ case "MediaBox":
+ case "CropBox":
+ case "BleedBox":
+ case "TrimBox":
+ case "ArtBox":
+ prefValue = value.name;
+ break;
- visitedNodes.put(currentNode);
- xref.fetchAsync(currentNode).then(function (obj) {
- if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
- if (pageIndex === currentPageIndex) {
- if (currentNode && !pageKidsCountCache.has(currentNode)) {
- pageKidsCountCache.put(currentNode, 1);
- }
+ default:
+ prefValue = "CropBox";
+ }
- capability.resolve([obj, currentNode]);
- } else {
- currentPageIndex++;
- next();
+ break;
+
+ case "PrintScaling":
+ switch (value.name) {
+ case "None":
+ case "AppDefault":
+ prefValue = value.name;
+ break;
+
+ default:
+ prefValue = "AppDefault";
}
- return;
- }
+ break;
- nodesToVisit.push(obj);
- next();
- }, capability.reject);
- return;
- }
+ case "Duplex":
+ switch (value.name) {
+ case "Simplex":
+ case "DuplexFlipShortEdge":
+ case "DuplexFlipLongEdge":
+ prefValue = value.name;
+ break;
- if (!(0, _primitives.isDict)(currentNode)) {
- capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
- return;
- }
+ default:
+ prefValue = "None";
+ }
- count = currentNode.get("Count");
+ break;
- if (Number.isInteger(count) && count >= 0) {
- const objId = currentNode.objId;
+ case "PrintPageRange":
+ var length = value.length;
- if (objId && !pageKidsCountCache.has(objId)) {
- pageKidsCountCache.put(objId, count);
- }
+ if (length % 2 !== 0) {
+ break;
+ }
- if (currentPageIndex + count <= pageIndex) {
- currentPageIndex += count;
- continue;
- }
- }
+ var isValid = value.every(function (page, i, arr) {
+ return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= _this2.numPages;
+ });
- const kids = currentNode.get("Kids");
+ if (isValid) {
+ prefValue = value;
+ }
- if (!Array.isArray(kids)) {
- if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && currentNode.has("Contents")) {
- if (currentPageIndex === pageIndex) {
- capability.resolve([currentNode, null]);
- return;
- }
+ break;
- currentPageIndex++;
- continue;
+ case "NumCopies":
+ if (value > 0) {
+ prefValue = value;
+ }
+
+ break;
+
+ default:
+ if (typeof value !== "boolean") {
+ throw new _util.FormatError("viewerPreferences - expected a boolean value for: ".concat(key));
+ }
+
+ prefValue = value;
}
- capability.reject(new _util.FormatError("Page dictionary kids object is not an array."));
- return;
- }
+ if (prefValue !== undefined) {
+ if (!prefs) {
+ prefs = Object.create(null);
+ }
- for (let last = kids.length - 1; last >= 0; last--) {
- nodesToVisit.push(kids[last]);
+ prefs[key] = prefValue;
+ } else {
+ (0, _util.info)("Bad value in ViewerPreferences for \"".concat(key, "\"."));
+ }
}
}
- capability.reject(new Error(`Page index ${pageIndex} not found.`));
+ return (0, _util.shadow)(this, "viewerPreferences", prefs);
}
+ }, {
+ key: "openAction",
+ get: function get() {
+ var obj = this.catDict.get("OpenAction");
+ var openAction = null;
+
+ if ((0, _primitives.isDict)(obj)) {
+ var destDict = new _primitives.Dict(this.xref);
+ destDict.set("A", obj);
+ var resultObj = {
+ url: null,
+ dest: null,
+ action: null
+ };
+ Catalog.parseDestDictionary({
+ destDict: destDict,
+ resultObj: resultObj
+ });
- next();
- return capability.promise;
- }
-
- getPageIndex(pageRef) {
- const xref = this.xref;
-
- function pagesBeforeRef(kidRef) {
- let total = 0,
- parentRef;
- return xref.fetchAsync(kidRef).then(function (node) {
- if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) {
- throw new _util.FormatError("The reference does not point to a /Page dictionary.");
- }
+ if (Array.isArray(resultObj.dest)) {
+ if (!openAction) {
+ openAction = Object.create(null);
+ }
- if (!node) {
- return null;
- }
+ openAction.dest = resultObj.dest;
+ } else if (resultObj.action) {
+ if (!openAction) {
+ openAction = Object.create(null);
+ }
- if (!(0, _primitives.isDict)(node)) {
- throw new _util.FormatError("Node must be a dictionary.");
+ openAction.action = resultObj.action;
}
-
- parentRef = node.getRaw("Parent");
- return node.getAsync("Parent");
- }).then(function (parent) {
- if (!parent) {
- return null;
+ } else if (Array.isArray(obj)) {
+ if (!openAction) {
+ openAction = Object.create(null);
}
- if (!(0, _primitives.isDict)(parent)) {
- throw new _util.FormatError("Parent must be a dictionary.");
- }
+ openAction.dest = obj;
+ }
- return parent.getAsync("Kids");
- }).then(function (kids) {
- if (!kids) {
- return null;
- }
+ return (0, _util.shadow)(this, "openAction", openAction);
+ }
+ }, {
+ key: "attachments",
+ get: function get() {
+ var obj = this.catDict.get("Names");
+ var attachments = null;
- const kidPromises = [];
- let found = false;
+ if (obj && obj.has("EmbeddedFiles")) {
+ var nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
+ var names = nameTree.getAll();
- for (let i = 0, ii = kids.length; i < ii; i++) {
- const kid = kids[i];
+ for (var name in names) {
+ var fs = new FileSpec(names[name], this.xref);
- if (!(0, _primitives.isRef)(kid)) {
- throw new _util.FormatError("Kid must be a reference.");
+ if (!attachments) {
+ attachments = Object.create(null);
}
- if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
- found = true;
- break;
- }
+ attachments[(0, _util.stringToPDFString)(name)] = fs.serializable;
+ }
+ }
- kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
- if (!(0, _primitives.isDict)(obj)) {
- throw new _util.FormatError("Kid node must be a dictionary.");
- }
+ return (0, _util.shadow)(this, "attachments", attachments);
+ }
+ }, {
+ key: "javaScript",
+ get: function get() {
+ var obj = this.catDict.get("Names");
+ var javaScript = null;
- if (obj.has("Count")) {
- total += obj.get("Count");
- } else {
- total++;
- }
- }));
- }
+ function appendIfJavaScriptDict(jsDict) {
+ var type = jsDict.get("S");
- if (!found) {
- throw new _util.FormatError("Kid reference not found in parent's kids.");
+ if (!(0, _primitives.isName)(type, "JavaScript")) {
+ return;
}
- return Promise.all(kidPromises).then(function () {
- return [total, parentRef];
- });
- });
- }
+ var js = jsDict.get("JS");
- let total = 0;
+ if ((0, _primitives.isStream)(js)) {
+ js = (0, _util.bytesToString)(js.getBytes());
+ } else if (!(0, _util.isString)(js)) {
+ return;
+ }
- function next(ref) {
- return pagesBeforeRef(ref).then(function (args) {
- if (!args) {
- return total;
+ if (!javaScript) {
+ javaScript = [];
}
- const [count, parentRef] = args;
- total += count;
- return next(parentRef);
- });
- }
+ javaScript.push((0, _util.stringToPDFString)(js));
+ }
- return next(pageRef);
- }
+ if (obj && obj.has("JavaScript")) {
+ var nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref);
+ var names = nameTree.getAll();
- static parseDestDictionary(params) {
- function addDefaultProtocolToUrl(url) {
- return url.startsWith("www.") ? `http://${url}` : url;
- }
+ for (var name in names) {
+ var jsDict = names[name];
- function tryConvertUrlEncoding(url) {
- try {
- return (0, _util.stringToUTF8String)(url);
- } catch (e) {
- return url;
+ if ((0, _primitives.isDict)(jsDict)) {
+ appendIfJavaScriptDict(jsDict);
+ }
+ }
}
- }
- const destDict = params.destDict;
+ var openAction = this.catDict.get("OpenAction");
- if (!(0, _primitives.isDict)(destDict)) {
- (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
- return;
- }
-
- const resultObj = params.resultObj;
+ if ((0, _primitives.isDict)(openAction) && (0, _primitives.isName)(openAction.get("S"), "JavaScript")) {
+ appendIfJavaScriptDict(openAction);
+ }
- if (typeof resultObj !== "object") {
- (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
- return;
+ return (0, _util.shadow)(this, "javaScript", javaScript);
}
+ }], [{
+ key: "parseDestDictionary",
+ value: function parseDestDictionary(params) {
+ function addDefaultProtocolToUrl(url) {
+ return url.startsWith("www.") ? "http://".concat(url) : url;
+ }
- const docBaseUrl = params.docBaseUrl || null;
- let action = destDict.get("A"),
- url,
- dest;
+ function tryConvertUrlEncoding(url) {
+ try {
+ return (0, _util.stringToUTF8String)(url);
+ } catch (e) {
+ return url;
+ }
+ }
- if (!(0, _primitives.isDict)(action) && destDict.has("Dest")) {
- action = destDict.get("Dest");
- }
+ var destDict = params.destDict;
- if ((0, _primitives.isDict)(action)) {
- const actionType = action.get("S");
+ if (!(0, _primitives.isDict)(destDict)) {
+ (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
+ return;
+ }
- if (!(0, _primitives.isName)(actionType)) {
- (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
+ var resultObj = params.resultObj;
+
+ if (_typeof(resultObj) !== "object") {
+ (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
return;
}
- const actionName = actionType.name;
+ var docBaseUrl = params.docBaseUrl || null;
+ var action = destDict.get("A"),
+ url,
+ dest;
- switch (actionName) {
- case "URI":
- url = action.get("URI");
+ if (!(0, _primitives.isDict)(action) && destDict.has("Dest")) {
+ action = destDict.get("Dest");
+ }
- if ((0, _primitives.isName)(url)) {
- url = "/" + url.name;
- } else if ((0, _util.isString)(url)) {
- url = addDefaultProtocolToUrl(url);
- }
+ if ((0, _primitives.isDict)(action)) {
+ var actionType = action.get("S");
- break;
+ if (!(0, _primitives.isName)(actionType)) {
+ (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
+ return;
+ }
- case "GoTo":
- dest = action.get("D");
- break;
+ var actionName = actionType.name;
- case "Launch":
- case "GoToR":
- const urlDict = action.get("F");
+ switch (actionName) {
+ case "URI":
+ url = action.get("URI");
- if ((0, _primitives.isDict)(urlDict)) {
- url = urlDict.get("F") || null;
- } else if ((0, _util.isString)(urlDict)) {
- url = urlDict;
- }
+ if ((0, _primitives.isName)(url)) {
+ url = "/" + url.name;
+ } else if ((0, _util.isString)(url)) {
+ url = addDefaultProtocolToUrl(url);
+ }
- let remoteDest = action.get("D");
+ break;
+
+ case "GoTo":
+ dest = action.get("D");
+ break;
- if (remoteDest) {
- if ((0, _primitives.isName)(remoteDest)) {
- remoteDest = remoteDest.name;
+ case "Launch":
+ case "GoToR":
+ var urlDict = action.get("F");
+
+ if ((0, _primitives.isDict)(urlDict)) {
+ url = urlDict.get("F") || null;
+ } else if ((0, _util.isString)(urlDict)) {
+ url = urlDict;
}
- if ((0, _util.isString)(url)) {
- const baseUrl = url.split("#")[0];
+ var remoteDest = action.get("D");
+
+ if (remoteDest) {
+ if ((0, _primitives.isName)(remoteDest)) {
+ remoteDest = remoteDest.name;
+ }
+
+ if ((0, _util.isString)(url)) {
+ var baseUrl = url.split("#")[0];
- if ((0, _util.isString)(remoteDest)) {
- url = baseUrl + "#" + remoteDest;
- } else if (Array.isArray(remoteDest)) {
- url = baseUrl + "#" + JSON.stringify(remoteDest);
+ if ((0, _util.isString)(remoteDest)) {
+ url = baseUrl + "#" + remoteDest;
+ } else if (Array.isArray(remoteDest)) {
+ url = baseUrl + "#" + JSON.stringify(remoteDest);
+ }
}
}
- }
- const newWindow = action.get("NewWindow");
+ var newWindow = action.get("NewWindow");
- if ((0, _util.isBool)(newWindow)) {
- resultObj.newWindow = newWindow;
- }
+ if ((0, _util.isBool)(newWindow)) {
+ resultObj.newWindow = newWindow;
+ }
- break;
+ break;
- case "Named":
- const namedAction = action.get("N");
+ case "Named":
+ var namedAction = action.get("N");
- if ((0, _primitives.isName)(namedAction)) {
- resultObj.action = namedAction.name;
- }
+ if ((0, _primitives.isName)(namedAction)) {
+ resultObj.action = namedAction.name;
+ }
- break;
+ break;
- case "JavaScript":
- const jsAction = action.get("JS");
- let js;
+ case "JavaScript":
+ var jsAction = action.get("JS");
+ var js;
- if ((0, _primitives.isStream)(jsAction)) {
- js = (0, _util.bytesToString)(jsAction.getBytes());
- } else if ((0, _util.isString)(jsAction)) {
- js = jsAction;
- }
+ if ((0, _primitives.isStream)(jsAction)) {
+ js = (0, _util.bytesToString)(jsAction.getBytes());
+ } else if ((0, _util.isString)(jsAction)) {
+ js = jsAction;
+ }
- if (js) {
- const URL_OPEN_METHODS = ["app.launchURL", "window.open"];
- const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
- const jsUrl = regex.exec((0, _util.stringToPDFString)(js));
+ if (js) {
+ var URL_OPEN_METHODS = ["app.launchURL", "window.open"];
+ var regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
+ var jsUrl = regex.exec((0, _util.stringToPDFString)(js));
- if (jsUrl && jsUrl[2]) {
- url = jsUrl[2];
+ if (jsUrl && jsUrl[2]) {
+ url = jsUrl[2];
- if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
- resultObj.newWindow = true;
- }
+ if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
+ resultObj.newWindow = true;
+ }
- break;
+ break;
+ }
}
- }
- default:
- (0, _util.warn)(`parseDestDictionary: unsupported action type "${actionName}".`);
- break;
+ default:
+ (0, _util.warn)("parseDestDictionary: unsupported action type \"".concat(actionName, "\"."));
+ break;
+ }
+ } else if (destDict.has("Dest")) {
+ dest = destDict.get("Dest");
}
- } else if (destDict.has("Dest")) {
- dest = destDict.get("Dest");
- }
-
- if ((0, _util.isString)(url)) {
- url = tryConvertUrlEncoding(url);
- const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);
- if (absoluteUrl) {
- resultObj.url = absoluteUrl.href;
- }
+ if ((0, _util.isString)(url)) {
+ url = tryConvertUrlEncoding(url);
+ var absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);
- resultObj.unsafeUrl = url;
- }
+ if (absoluteUrl) {
+ resultObj.url = absoluteUrl.href;
+ }
- if (dest) {
- if ((0, _primitives.isName)(dest)) {
- dest = dest.name;
+ resultObj.unsafeUrl = url;
}
- if ((0, _util.isString)(dest) || Array.isArray(dest)) {
- resultObj.dest = dest;
+ if (dest) {
+ if ((0, _primitives.isName)(dest)) {
+ dest = dest.name;
+ }
+
+ if ((0, _util.isString)(dest) || Array.isArray(dest)) {
+ resultObj.dest = dest;
+ }
}
}
- }
+ }]);
-}
+ return Catalog;
+}();
exports.Catalog = Catalog;
@@ -4701,7 +15542,7 @@ var XRef = function XRefClosure() {
trailerDict.assignXref(this);
this.trailer = trailerDict;
- let encrypt;
+ var encrypt;
try {
encrypt = trailerDict.get("Encrypt");
@@ -4710,7 +15551,7 @@ var XRef = function XRefClosure() {
throw ex;
}
- (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
+ (0, _util.warn)("XRef.parse - Invalid \"Encrypt\" reference: \"".concat(ex, "\"."));
}
if ((0, _primitives.isDict)(encrypt)) {
@@ -4720,7 +15561,7 @@ var XRef = function XRefClosure() {
this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
}
- let root;
+ var root;
try {
root = trailerDict.get("Root");
@@ -4729,7 +15570,7 @@ var XRef = function XRefClosure() {
throw ex;
}
- (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
+ (0, _util.warn)("XRef.parse - Invalid \"Root\" reference: \"".concat(ex, "\"."));
}
if ((0, _primitives.isDict)(root) && root.has("Pages")) {
@@ -4819,7 +15660,7 @@ var XRef = function XRefClosure() {
}
if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
- throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
+ throw new _util.FormatError("Invalid entry in XRef subsection: ".concat(first, ", ").concat(count));
}
if (i === 0 && entry.free && first === 1) {
@@ -4857,7 +15698,7 @@ var XRef = function XRefClosure() {
this.streamState = {
entryRanges: range,
- byteWidths,
+ byteWidths: byteWidths,
entryNum: 0,
streamPos: stream.pos
};
@@ -4882,11 +15723,11 @@ var XRef = function XRefClosure() {
var n = entryRanges[1];
if (!Number.isInteger(first) || !Number.isInteger(n)) {
- throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
+ throw new _util.FormatError("Invalid XRef range fields: ".concat(first, ", ").concat(n));
}
if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
- throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
+ throw new _util.FormatError("Invalid XRef entry fields length: ".concat(first, ", ").concat(n));
}
for (i = streamState.entryNum; i < n; ++i) {
@@ -4929,7 +15770,7 @@ var XRef = function XRefClosure() {
break;
default:
- throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
+ throw new _util.FormatError("Invalid XRef entry type: ".concat(type));
}
if (!this.entries[first + i]) {
@@ -4990,12 +15831,12 @@ var XRef = function XRefClosure() {
}
var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
- const endobjRegExp = /\bendobj[\b\s]$/;
- const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
- const CHECK_CONTENT_LENGTH = 25;
+ var endobjRegExp = /\bendobj[\b\s]$/;
+ var nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
+ var CHECK_CONTENT_LENGTH = 25;
var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
- const objBytes = new Uint8Array([111, 98, 106]);
+ var objBytes = new Uint8Array([111, 98, 106]);
var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
this.entries.length = 0;
var stream = this.stream;
@@ -5036,30 +15877,30 @@ var XRef = function XRefClosure() {
trailers.push(position);
position += skipUntil(buffer, position, startxrefBytes);
} else if (m = objRegExp.exec(token)) {
- const num = m[1] | 0,
- gen = m[2] | 0;
+ var num = m[1] | 0,
+ gen = m[2] | 0;
if (!this.entries[num] || this.entries[num].gen === gen) {
this.entries[num] = {
offset: position - stream.start,
- gen,
+ gen: gen,
uncompressed: true
};
}
- let contentLength,
+ var contentLength = void 0,
startPos = position + token.length;
while (startPos < buffer.length) {
- const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
+ var endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
contentLength = endPos - position;
- const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
- const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
+ var checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
+ var tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
if (endobjRegExp.test(tokenStr)) {
break;
} else {
- const objToken = nestedObjRegExp.exec(tokenStr);
+ var objToken = nestedObjRegExp.exec(tokenStr);
if (objToken && objToken[1]) {
(0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
@@ -5071,7 +15912,7 @@ var XRef = function XRefClosure() {
startPos = endPos;
}
- const content = buffer.subarray(position, position + contentLength);
+ var content = buffer.subarray(position, position + contentLength);
var xrefTagOffset = skipUntil(content, 0, xrefBytes);
if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
@@ -5095,11 +15936,11 @@ var XRef = function XRefClosure() {
this.readXRef(true);
}
- let trailerDict;
+ var trailerDict;
for (i = 0, ii = trailers.length; i < ii; ++i) {
stream.pos = trailers[i];
- const parser = new _parser.Parser({
+ var parser = new _parser.Parser({
lexer: new _parser.Lexer(stream),
xref: this,
allowStreams: true,
@@ -5111,13 +15952,13 @@ var XRef = function XRefClosure() {
continue;
}
- const dict = parser.getObj();
+ var dict = parser.getObj();
if (!(0, _primitives.isDict)(dict)) {
continue;
}
- let rootDict;
+ var rootDict = void 0;
try {
rootDict = dict.get("Root");
@@ -5148,7 +15989,7 @@ var XRef = function XRefClosure() {
},
readXRef: function XRef_readXRef(recoveryMode) {
var stream = this.stream;
- const startXRefParsedCache = Object.create(null);
+ var startXRefParsedCache = Object.create(null);
try {
while (this.startXRefQueue.length) {
@@ -5162,7 +16003,7 @@ var XRef = function XRefClosure() {
startXRefParsedCache[startXRef] = true;
stream.pos = startXRef + stream.start;
- const parser = new _parser.Parser({
+ var parser = new _parser.Parser({
lexer: new _parser.Lexer(stream),
xref: this,
allowStreams: true
@@ -5252,9 +16093,9 @@ var XRef = function XRefClosure() {
throw new Error("ref object is not a reference");
}
- const num = ref.num;
+ var num = ref.num;
- const cacheEntry = this._cacheMap.get(num);
+ var cacheEntry = this._cacheMap.get(num);
if (cacheEntry !== undefined) {
if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
@@ -5264,7 +16105,7 @@ var XRef = function XRefClosure() {
return cacheEntry;
}
- let xrefEntry = this.getEntry(num);
+ var xrefEntry = this.getEntry(num);
if (xrefEntry === null) {
this._cacheMap.set(num, xrefEntry);
@@ -5286,17 +16127,17 @@ var XRef = function XRefClosure() {
return xrefEntry;
},
-
- fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
+ fetchUncompressed: function fetchUncompressed(ref, xrefEntry) {
+ var suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var gen = ref.gen;
var num = ref.num;
if (xrefEntry.gen !== gen) {
- throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
+ throw new _core_utils.XRefEntryException("Inconsistent generation in XRef: ".concat(ref));
}
var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
- const parser = new _parser.Parser({
+ var parser = new _parser.Parser({
lexer: new _parser.Lexer(stream),
xref: this,
allowStreams: true
@@ -5306,7 +16147,7 @@ var XRef = function XRefClosure() {
var obj3 = parser.getObj();
if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
- throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
+ throw new _core_utils.XRefEntryException("Bad (uncompressed) XRef entry: ".concat(ref));
}
if (obj3.cmd !== "obj") {
@@ -5318,7 +16159,7 @@ var XRef = function XRefClosure() {
}
}
- throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
+ throw new _core_utils.XRefEntryException("Bad (uncompressed) XRef entry: ".concat(ref));
}
if (this.encrypt && !suppressEncryption) {
@@ -5333,50 +16174,50 @@ var XRef = function XRefClosure() {
return xrefEntry;
},
-
- fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
- const tableOffset = xrefEntry.offset;
- const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
+ fetchCompressed: function fetchCompressed(ref, xrefEntry) {
+ var suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+ var tableOffset = xrefEntry.offset;
+ var stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
if (!(0, _primitives.isStream)(stream)) {
throw new _util.FormatError("bad ObjStm stream");
}
- const first = stream.dict.get("First");
- const n = stream.dict.get("N");
+ var first = stream.dict.get("First");
+ var n = stream.dict.get("N");
if (!Number.isInteger(first) || !Number.isInteger(n)) {
throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
}
- const parser = new _parser.Parser({
+ var parser = new _parser.Parser({
lexer: new _parser.Lexer(stream),
xref: this,
allowStreams: true
});
- const nums = new Array(n);
+ var nums = new Array(n);
- for (let i = 0; i < n; ++i) {
- const num = parser.getObj();
+ for (var i = 0; i < n; ++i) {
+ var num = parser.getObj();
if (!Number.isInteger(num)) {
- throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
+ throw new _util.FormatError("invalid object number in the ObjStm stream: ".concat(num));
}
- const offset = parser.getObj();
+ var offset = parser.getObj();
if (!Number.isInteger(offset)) {
- throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
+ throw new _util.FormatError("invalid object offset in the ObjStm stream: ".concat(offset));
}
nums[i] = num;
}
- const entries = new Array(n);
+ var entries = new Array(n);
- for (let i = 0; i < n; ++i) {
- const obj = parser.getObj();
- entries[i] = obj;
+ for (var _i2 = 0; _i2 < n; ++_i2) {
+ var obj = parser.getObj();
+ entries[_i2] = obj;
if (parser.buf1 instanceof _primitives.Cmd && parser.buf1.cmd === "endobj") {
parser.shift();
@@ -5386,44 +16227,85 @@ var XRef = function XRefClosure() {
continue;
}
- const num = nums[i],
- entry = this.entries[num];
+ var _num = nums[_i2],
+ entry = this.entries[_num];
- if (entry && entry.offset === tableOffset && entry.gen === i) {
- this._cacheMap.set(num, obj);
+ if (entry && entry.offset === tableOffset && entry.gen === _i2) {
+ this._cacheMap.set(_num, obj);
}
}
xrefEntry = entries[xrefEntry.gen];
if (xrefEntry === undefined) {
- throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
+ throw new _core_utils.XRefEntryException("Bad (compressed) XRef entry: ".concat(ref));
}
return xrefEntry;
},
+ fetchIfRefAsync: function fetchIfRefAsync(obj, suppressEncryption) {
+ var _this3 = this;
- async fetchIfRefAsync(obj, suppressEncryption) {
- if (obj instanceof _primitives.Ref) {
- return this.fetchAsync(obj, suppressEncryption);
- }
+ return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
+ return _regenerator["default"].wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ if (!(obj instanceof _primitives.Ref)) {
+ _context.next = 2;
+ break;
+ }
- return obj;
- },
+ return _context.abrupt("return", _this3.fetchAsync(obj, suppressEncryption));
- async fetchAsync(ref, suppressEncryption) {
- try {
- return this.fetch(ref, suppressEncryption);
- } catch (ex) {
- if (!(ex instanceof _core_utils.MissingDataException)) {
- throw ex;
- }
+ case 2:
+ return _context.abrupt("return", obj);
- await this.pdfManager.requestRange(ex.begin, ex.end);
- return this.fetchAsync(ref, suppressEncryption);
- }
+ case 3:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee);
+ }))();
},
+ fetchAsync: function fetchAsync(ref, suppressEncryption) {
+ var _this4 = this;
+
+ return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
+ while (1) {
+ switch (_context2.prev = _context2.next) {
+ case 0:
+ _context2.prev = 0;
+ return _context2.abrupt("return", _this4.fetch(ref, suppressEncryption));
+
+ case 4:
+ _context2.prev = 4;
+ _context2.t0 = _context2["catch"](0);
+ if (_context2.t0 instanceof _core_utils.MissingDataException) {
+ _context2.next = 8;
+ break;
+ }
+
+ throw _context2.t0;
+
+ case 8:
+ _context2.next = 10;
+ return _this4.pdfManager.requestRange(_context2.t0.begin, _context2.t0.end);
+
+ case 10:
+ return _context2.abrupt("return", _this4.fetchAsync(ref, suppressEncryption));
+
+ case 11:
+ case "end":
+ return _context2.stop();
+ }
+ }
+ }, _callee2, null, [[0, 4]]);
+ }))();
+ },
getCatalogObj: function XRef_getCatalogObj() {
return this.root;
}
@@ -5433,8 +16315,10 @@ var XRef = function XRefClosure() {
exports.XRef = XRef;
-class NameOrNumberTree {
- constructor(root, xref, type) {
+var NameOrNumberTree = /*#__PURE__*/function () {
+ function NameOrNumberTree(root, xref, type) {
+ _classCallCheck(this, NameOrNumberTree);
+
if (this.constructor === NameOrNumberTree) {
(0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
}
@@ -5444,149 +16328,169 @@ class NameOrNumberTree {
this._type = type;
}
- getAll() {
- const dict = Object.create(null);
+ _createClass(NameOrNumberTree, [{
+ key: "getAll",
+ value: function getAll() {
+ var dict = Object.create(null);
- if (!this.root) {
- return dict;
- }
+ if (!this.root) {
+ return dict;
+ }
+
+ var xref = this.xref;
+ var processed = new _primitives.RefSet();
+ processed.put(this.root);
+ var queue = [this.root];
- const xref = this.xref;
- const processed = new _primitives.RefSet();
- processed.put(this.root);
- const queue = [this.root];
+ while (queue.length > 0) {
+ var obj = xref.fetchIfRef(queue.shift());
- while (queue.length > 0) {
- const obj = xref.fetchIfRef(queue.shift());
+ if (!(0, _primitives.isDict)(obj)) {
+ continue;
+ }
- if (!(0, _primitives.isDict)(obj)) {
- continue;
- }
+ if (obj.has("Kids")) {
+ var kids = obj.get("Kids");
- if (obj.has("Kids")) {
- const kids = obj.get("Kids");
+ for (var i = 0, ii = kids.length; i < ii; i++) {
+ var kid = kids[i];
- for (let i = 0, ii = kids.length; i < ii; i++) {
- const kid = kids[i];
+ if (processed.has(kid)) {
+ throw new _util.FormatError("Duplicate entry in \"".concat(this._type, "\" tree."));
+ }
- if (processed.has(kid)) {
- throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
+ queue.push(kid);
+ processed.put(kid);
}
- queue.push(kid);
- processed.put(kid);
+ continue;
}
- continue;
- }
+ var entries = obj.get(this._type);
- const entries = obj.get(this._type);
-
- if (Array.isArray(entries)) {
- for (let i = 0, ii = entries.length; i < ii; i += 2) {
- dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
+ if (Array.isArray(entries)) {
+ for (var _i3 = 0, _ii = entries.length; _i3 < _ii; _i3 += 2) {
+ dict[xref.fetchIfRef(entries[_i3])] = xref.fetchIfRef(entries[_i3 + 1]);
+ }
}
}
- }
-
- return dict;
- }
- get(key) {
- if (!this.root) {
- return null;
+ return dict;
}
-
- const xref = this.xref;
- let kidsOrEntries = xref.fetchIfRef(this.root);
- let loopCount = 0;
- const MAX_LEVELS = 10;
-
- while (kidsOrEntries.has("Kids")) {
- if (++loopCount > MAX_LEVELS) {
- (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
+ }, {
+ key: "get",
+ value: function get(key) {
+ if (!this.root) {
return null;
}
- const kids = kidsOrEntries.get("Kids");
+ var xref = this.xref;
+ var kidsOrEntries = xref.fetchIfRef(this.root);
+ var loopCount = 0;
+ var MAX_LEVELS = 10;
- if (!Array.isArray(kids)) {
- return null;
- }
+ while (kidsOrEntries.has("Kids")) {
+ if (++loopCount > MAX_LEVELS) {
+ (0, _util.warn)("Search depth limit reached for \"".concat(this._type, "\" tree."));
+ return null;
+ }
- let l = 0,
- r = kids.length - 1;
+ var kids = kidsOrEntries.get("Kids");
- while (l <= r) {
- const m = l + r >> 1;
- const kid = xref.fetchIfRef(kids[m]);
- const limits = kid.get("Limits");
+ if (!Array.isArray(kids)) {
+ return null;
+ }
- if (key < xref.fetchIfRef(limits[0])) {
- r = m - 1;
- } else if (key > xref.fetchIfRef(limits[1])) {
- l = m + 1;
- } else {
- kidsOrEntries = xref.fetchIfRef(kids[m]);
- break;
+ var l = 0,
+ r = kids.length - 1;
+
+ while (l <= r) {
+ var m = l + r >> 1;
+ var kid = xref.fetchIfRef(kids[m]);
+ var limits = kid.get("Limits");
+
+ if (key < xref.fetchIfRef(limits[0])) {
+ r = m - 1;
+ } else if (key > xref.fetchIfRef(limits[1])) {
+ l = m + 1;
+ } else {
+ kidsOrEntries = xref.fetchIfRef(kids[m]);
+ break;
+ }
}
- }
- if (l > r) {
- return null;
+ if (l > r) {
+ return null;
+ }
}
- }
- const entries = kidsOrEntries.get(this._type);
+ var entries = kidsOrEntries.get(this._type);
+
+ if (Array.isArray(entries)) {
+ var _l = 0,
+ _r = entries.length - 2;
- if (Array.isArray(entries)) {
- let l = 0,
- r = entries.length - 2;
+ while (_l <= _r) {
+ var tmp = _l + _r >> 1,
+ _m = tmp + (tmp & 1);
- while (l <= r) {
- const tmp = l + r >> 1,
- m = tmp + (tmp & 1);
- const currentKey = xref.fetchIfRef(entries[m]);
+ var currentKey = xref.fetchIfRef(entries[_m]);
- if (key < currentKey) {
- r = m - 2;
- } else if (key > currentKey) {
- l = m + 2;
- } else {
- return xref.fetchIfRef(entries[m + 1]);
+ if (key < currentKey) {
+ _r = _m - 2;
+ } else if (key > currentKey) {
+ _l = _m + 2;
+ } else {
+ return xref.fetchIfRef(entries[_m + 1]);
+ }
}
- }
- (0, _util.info)(`Falling back to an exhaustive search, for key "${key}", ` + `in "${this._type}" tree.`);
+ (0, _util.info)("Falling back to an exhaustive search, for key \"".concat(key, "\", ") + "in \"".concat(this._type, "\" tree."));
- for (let m = 0, mm = entries.length; m < mm; m += 2) {
- const currentKey = xref.fetchIfRef(entries[m]);
+ for (var _m2 = 0, mm = entries.length; _m2 < mm; _m2 += 2) {
+ var _currentKey = xref.fetchIfRef(entries[_m2]);
- if (currentKey === key) {
- (0, _util.warn)(`The "${key}" key was found at an incorrect, ` + `i.e. out-of-order, position in "${this._type}" tree.`);
- return xref.fetchIfRef(entries[m + 1]);
+ if (_currentKey === key) {
+ (0, _util.warn)("The \"".concat(key, "\" key was found at an incorrect, ") + "i.e. out-of-order, position in \"".concat(this._type, "\" tree."));
+ return xref.fetchIfRef(entries[_m2 + 1]);
+ }
}
}
+
+ return null;
}
+ }]);
- return null;
- }
+ return NameOrNumberTree;
+}();
-}
+var NameTree = /*#__PURE__*/function (_NameOrNumberTree) {
+ _inherits(NameTree, _NameOrNumberTree);
-class NameTree extends NameOrNumberTree {
- constructor(root, xref) {
- super(root, xref, "Names");
+ var _super = _createSuper(NameTree);
+
+ function NameTree(root, xref) {
+ _classCallCheck(this, NameTree);
+
+ return _super.call(this, root, xref, "Names");
}
-}
+ return NameTree;
+}(NameOrNumberTree);
+
+var NumberTree = /*#__PURE__*/function (_NameOrNumberTree2) {
+ _inherits(NumberTree, _NameOrNumberTree2);
-class NumberTree extends NameOrNumberTree {
- constructor(root, xref) {
- super(root, xref, "Nums");
+ var _super2 = _createSuper(NumberTree);
+
+ function NumberTree(root, xref) {
+ _classCallCheck(this, NumberTree);
+
+ return _super2.call(this, root, xref, "Nums");
}
-}
+ return NumberTree;
+}(NameOrNumberTree);
var FileSpec = function FileSpecClosure() {
function FileSpec(root, xref) {
@@ -5681,26 +16585,26 @@ var FileSpec = function FileSpecClosure() {
exports.FileSpec = FileSpec;
-const ObjectLoader = function () {
+var ObjectLoader = function () {
function mayHaveChildren(value) {
return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value);
}
function addChildren(node, nodesToVisit) {
if (node instanceof _primitives.Dict || (0, _primitives.isStream)(node)) {
- const dict = node instanceof _primitives.Dict ? node : node.dict;
- const dictKeys = dict.getKeys();
+ var dict = node instanceof _primitives.Dict ? node : node.dict;
+ var dictKeys = dict.getKeys();
- for (let i = 0, ii = dictKeys.length; i < ii; i++) {
- const rawValue = dict.getRaw(dictKeys[i]);
+ for (var i = 0, ii = dictKeys.length; i < ii; i++) {
+ var rawValue = dict.getRaw(dictKeys[i]);
if (mayHaveChildren(rawValue)) {
nodesToVisit.push(rawValue);
}
}
} else if (Array.isArray(node)) {
- for (let i = 0, ii = node.length; i < ii; i++) {
- const value = node[i];
+ for (var _i4 = 0, _ii2 = node.length; _i4 < _ii2; _i4++) {
+ var value = node[_i4];
if (mayHaveChildren(value)) {
nodesToVisit.push(value);
@@ -5717,99 +16621,163 @@ const ObjectLoader = function () {
}
ObjectLoader.prototype = {
- async load() {
- if (!this.xref.stream.allChunksLoaded || this.xref.stream.allChunksLoaded()) {
- return undefined;
- }
+ load: function load() {
+ var _this5 = this;
+
+ return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
+ var keys, dict, nodesToVisit, i, ii, rawValue;
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
+ while (1) {
+ switch (_context3.prev = _context3.next) {
+ case 0:
+ if (!(!_this5.xref.stream.allChunksLoaded || _this5.xref.stream.allChunksLoaded())) {
+ _context3.next = 2;
+ break;
+ }
- const {
- keys,
- dict
- } = this;
- this.refSet = new _primitives.RefSet();
- const nodesToVisit = [];
+ return _context3.abrupt("return", undefined);
- for (let i = 0, ii = keys.length; i < ii; i++) {
- const rawValue = dict.getRaw(keys[i]);
+ case 2:
+ keys = _this5.keys, dict = _this5.dict;
+ _this5.refSet = new _primitives.RefSet();
+ nodesToVisit = [];
- if (rawValue !== undefined) {
- nodesToVisit.push(rawValue);
- }
- }
+ for (i = 0, ii = keys.length; i < ii; i++) {
+ rawValue = dict.getRaw(keys[i]);
- return this._walk(nodesToVisit);
+ if (rawValue !== undefined) {
+ nodesToVisit.push(rawValue);
+ }
+ }
+
+ return _context3.abrupt("return", _this5._walk(nodesToVisit));
+
+ case 7:
+ case "end":
+ return _context3.stop();
+ }
+ }
+ }, _callee3);
+ }))();
},
+ _walk: function _walk(nodesToVisit) {
+ var _this6 = this;
- async _walk(nodesToVisit) {
- const nodesToRevisit = [];
- const pendingRequests = [];
+ return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
+ var nodesToRevisit, pendingRequests, currentNode, baseStreams, foundMissingData, i, ii, stream, _i5, _ii3, node;
- while (nodesToVisit.length) {
- let currentNode = nodesToVisit.pop();
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
+ while (1) {
+ switch (_context4.prev = _context4.next) {
+ case 0:
+ nodesToRevisit = [];
+ pendingRequests = [];
- if (currentNode instanceof _primitives.Ref) {
- if (this.refSet.has(currentNode)) {
- continue;
- }
+ case 2:
+ if (!nodesToVisit.length) {
+ _context4.next = 22;
+ break;
+ }
- try {
- this.refSet.put(currentNode);
- currentNode = this.xref.fetch(currentNode);
- } catch (ex) {
- if (!(ex instanceof _core_utils.MissingDataException)) {
- throw ex;
- }
+ currentNode = nodesToVisit.pop();
- nodesToRevisit.push(currentNode);
- pendingRequests.push({
- begin: ex.begin,
- end: ex.end
- });
- }
- }
+ if (!(currentNode instanceof _primitives.Ref)) {
+ _context4.next = 18;
+ break;
+ }
- if (currentNode && currentNode.getBaseStreams) {
- const baseStreams = currentNode.getBaseStreams();
- let foundMissingData = false;
+ if (!_this6.refSet.has(currentNode)) {
+ _context4.next = 7;
+ break;
+ }
- for (let i = 0, ii = baseStreams.length; i < ii; i++) {
- const stream = baseStreams[i];
+ return _context4.abrupt("continue", 2);
- if (stream.allChunksLoaded && !stream.allChunksLoaded()) {
- foundMissingData = true;
- pendingRequests.push({
- begin: stream.start,
- end: stream.end
- });
- }
- }
+ case 7:
+ _context4.prev = 7;
- if (foundMissingData) {
- nodesToRevisit.push(currentNode);
- }
- }
+ _this6.refSet.put(currentNode);
- addChildren(currentNode, nodesToVisit);
- }
+ currentNode = _this6.xref.fetch(currentNode);
+ _context4.next = 18;
+ break;
- if (pendingRequests.length) {
- await this.xref.stream.manager.requestRanges(pendingRequests);
+ case 12:
+ _context4.prev = 12;
+ _context4.t0 = _context4["catch"](7);
- for (let i = 0, ii = nodesToRevisit.length; i < ii; i++) {
- const node = nodesToRevisit[i];
+ if (_context4.t0 instanceof _core_utils.MissingDataException) {
+ _context4.next = 16;
+ break;
+ }
- if (node instanceof _primitives.Ref) {
- this.refSet.remove(node);
- }
- }
+ throw _context4.t0;
- return this._walk(nodesToRevisit);
- }
+ case 16:
+ nodesToRevisit.push(currentNode);
+ pendingRequests.push({
+ begin: _context4.t0.begin,
+ end: _context4.t0.end
+ });
- this.refSet = null;
- return undefined;
- }
+ case 18:
+ if (currentNode && currentNode.getBaseStreams) {
+ baseStreams = currentNode.getBaseStreams();
+ foundMissingData = false;
+
+ for (i = 0, ii = baseStreams.length; i < ii; i++) {
+ stream = baseStreams[i];
+
+ if (stream.allChunksLoaded && !stream.allChunksLoaded()) {
+ foundMissingData = true;
+ pendingRequests.push({
+ begin: stream.start,
+ end: stream.end
+ });
+ }
+ }
+
+ if (foundMissingData) {
+ nodesToRevisit.push(currentNode);
+ }
+ }
+
+ addChildren(currentNode, nodesToVisit);
+ _context4.next = 2;
+ break;
+ case 22:
+ if (!pendingRequests.length) {
+ _context4.next = 27;
+ break;
+ }
+
+ _context4.next = 25;
+ return _this6.xref.stream.manager.requestRanges(pendingRequests);
+
+ case 25:
+ for (_i5 = 0, _ii3 = nodesToRevisit.length; _i5 < _ii3; _i5++) {
+ node = nodesToRevisit[_i5];
+
+ if (node instanceof _primitives.Ref) {
+ _this6.refSet.remove(node);
+ }
+ }
+
+ return _context4.abrupt("return", _this6._walk(nodesToRevisit));
+
+ case 27:
+ _this6.refSet = null;
+ return _context4.abrupt("return", undefined);
+
+ case 29:
+ case "end":
+ return _context4.stop();
+ }
+ }
+ }, _callee4, null, [[7, 12]]);
+ }))();
+ }
};
return ObjectLoader;
}();
@@ -5817,7 +16785,7 @@ const ObjectLoader = function () {
exports.ObjectLoader = ObjectLoader;
/***/ }),
-/* 11 */
+/* 204 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -5828,31 +16796,37 @@ Object.defineProperty(exports, "__esModule", {
});
exports.Parser = exports.Linearization = exports.Lexer = void 0;
-var _stream = __w_pdfjs_require__(12);
+var _stream = __w_pdfjs_require__(205);
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
-var _primitives = __w_pdfjs_require__(5);
+var _primitives = __w_pdfjs_require__(198);
-var _core_utils = __w_pdfjs_require__(8);
+var _core_utils = __w_pdfjs_require__(201);
-var _ccitt_stream = __w_pdfjs_require__(13);
+var _ccitt_stream = __w_pdfjs_require__(206);
-var _jbig2_stream = __w_pdfjs_require__(15);
+var _jbig2_stream = __w_pdfjs_require__(208);
-var _jpeg_stream = __w_pdfjs_require__(18);
+var _jpeg_stream = __w_pdfjs_require__(211);
-var _jpx_stream = __w_pdfjs_require__(20);
+var _jpx_stream = __w_pdfjs_require__(213);
-const MAX_LENGTH_TO_CACHE = 1000;
-const MAX_ADLER32_LENGTH = 5552;
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var MAX_LENGTH_TO_CACHE = 1000;
+var MAX_ADLER32_LENGTH = 5552;
function computeAdler32(bytes) {
- const bytesLength = bytes.length;
- let a = 1,
+ var bytesLength = bytes.length;
+ var a = 1,
b = 0;
- for (let i = 0; i < bytesLength; ++i) {
+ for (var i = 0; i < bytesLength; ++i) {
a += bytes[i] & 0xff;
b += a;
}
@@ -5860,13 +16834,17 @@ function computeAdler32(bytes) {
return b % 65521 << 16 | a % 65521;
}
-class Parser {
- constructor({
- lexer,
- xref,
- allowStreams = false,
- recoveryMode = false
- }) {
+var Parser = /*#__PURE__*/function () {
+ function Parser(_ref) {
+ var lexer = _ref.lexer,
+ xref = _ref.xref,
+ _ref$allowStreams = _ref.allowStreams,
+ allowStreams = _ref$allowStreams === void 0 ? false : _ref$allowStreams,
+ _ref$recoveryMode = _ref.recoveryMode,
+ recoveryMode = _ref$recoveryMode === void 0 ? false : _ref$recoveryMode;
+
+ _classCallCheck(this, Parser);
+
this.lexer = lexer;
this.xref = xref;
this.allowStreams = allowStreams;
@@ -5875,683 +16853,699 @@ class Parser {
this.refill();
}
- refill() {
- this.buf1 = this.lexer.getObj();
- this.buf2 = this.lexer.getObj();
- }
-
- shift() {
- if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
- this.buf1 = this.buf2;
- this.buf2 = null;
- } else {
- this.buf1 = this.buf2;
+ _createClass(Parser, [{
+ key: "refill",
+ value: function refill() {
+ this.buf1 = this.lexer.getObj();
this.buf2 = this.lexer.getObj();
}
- }
-
- tryShift() {
- try {
- this.shift();
- return true;
- } catch (e) {
- if (e instanceof _core_utils.MissingDataException) {
- throw e;
+ }, {
+ key: "shift",
+ value: function shift() {
+ if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
+ this.buf1 = this.buf2;
+ this.buf2 = null;
+ } else {
+ this.buf1 = this.buf2;
+ this.buf2 = this.lexer.getObj();
}
+ }
+ }, {
+ key: "tryShift",
+ value: function tryShift() {
+ try {
+ this.shift();
+ return true;
+ } catch (e) {
+ if (e instanceof _core_utils.MissingDataException) {
+ throw e;
+ }
- return false;
+ return false;
+ }
}
- }
+ }, {
+ key: "getObj",
+ value: function getObj() {
+ var cipherTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
+ var buf1 = this.buf1;
+ this.shift();
- getObj(cipherTransform = null) {
- const buf1 = this.buf1;
- this.shift();
+ if (buf1 instanceof _primitives.Cmd) {
+ switch (buf1.cmd) {
+ case "BI":
+ return this.makeInlineImage(cipherTransform);
- if (buf1 instanceof _primitives.Cmd) {
- switch (buf1.cmd) {
- case "BI":
- return this.makeInlineImage(cipherTransform);
+ case "[":
+ var array = [];
- case "[":
- const array = [];
+ while (!(0, _primitives.isCmd)(this.buf1, "]") && !(0, _primitives.isEOF)(this.buf1)) {
+ array.push(this.getObj(cipherTransform));
+ }
- while (!(0, _primitives.isCmd)(this.buf1, "]") && !(0, _primitives.isEOF)(this.buf1)) {
- array.push(this.getObj(cipherTransform));
- }
+ if ((0, _primitives.isEOF)(this.buf1)) {
+ if (!this.recoveryMode) {
+ throw new _util.FormatError("End of file inside array");
+ }
- if ((0, _primitives.isEOF)(this.buf1)) {
- if (!this.recoveryMode) {
- throw new _util.FormatError("End of file inside array");
+ return array;
}
+ this.shift();
return array;
- }
- this.shift();
- return array;
+ case "<<":
+ var dict = new _primitives.Dict(this.xref);
- case "<<":
- const dict = new _primitives.Dict(this.xref);
+ while (!(0, _primitives.isCmd)(this.buf1, ">>") && !(0, _primitives.isEOF)(this.buf1)) {
+ if (!(0, _primitives.isName)(this.buf1)) {
+ (0, _util.info)("Malformed dictionary: key must be a name object");
+ this.shift();
+ continue;
+ }
- while (!(0, _primitives.isCmd)(this.buf1, ">>") && !(0, _primitives.isEOF)(this.buf1)) {
- if (!(0, _primitives.isName)(this.buf1)) {
- (0, _util.info)("Malformed dictionary: key must be a name object");
+ var key = this.buf1.name;
this.shift();
- continue;
- }
- const key = this.buf1.name;
- this.shift();
+ if ((0, _primitives.isEOF)(this.buf1)) {
+ break;
+ }
- if ((0, _primitives.isEOF)(this.buf1)) {
- break;
+ dict.set(key, this.getObj(cipherTransform));
}
- dict.set(key, this.getObj(cipherTransform));
- }
+ if ((0, _primitives.isEOF)(this.buf1)) {
+ if (!this.recoveryMode) {
+ throw new _util.FormatError("End of file inside dictionary");
+ }
- if ((0, _primitives.isEOF)(this.buf1)) {
- if (!this.recoveryMode) {
- throw new _util.FormatError("End of file inside dictionary");
+ return dict;
}
- return dict;
- }
-
- if ((0, _primitives.isCmd)(this.buf2, "stream")) {
- return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
- }
+ if ((0, _primitives.isCmd)(this.buf2, "stream")) {
+ return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
+ }
- this.shift();
- return dict;
+ this.shift();
+ return dict;
- default:
- return buf1;
+ default:
+ return buf1;
+ }
}
- }
- if (Number.isInteger(buf1)) {
- if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
- const ref = _primitives.Ref.get(buf1, this.buf1);
+ if (Number.isInteger(buf1)) {
+ if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
+ var ref = _primitives.Ref.get(buf1, this.buf1);
- this.shift();
- this.shift();
- return ref;
+ this.shift();
+ this.shift();
+ return ref;
+ }
+
+ return buf1;
}
- return buf1;
- }
+ if (typeof buf1 === "string") {
+ if (cipherTransform) {
+ return cipherTransform.decryptString(buf1);
+ }
- if (typeof buf1 === "string") {
- if (cipherTransform) {
- return cipherTransform.decryptString(buf1);
+ return buf1;
}
return buf1;
}
-
- return buf1;
- }
-
- findDefaultInlineStreamEnd(stream) {
- const E = 0x45,
+ }, {
+ key: "findDefaultInlineStreamEnd",
+ value: function findDefaultInlineStreamEnd(stream) {
+ var E = 0x45,
I = 0x49,
SPACE = 0x20,
LF = 0xa,
CR = 0xd;
- const n = 10,
+ var n = 10,
NUL = 0x0;
- const startPos = stream.pos;
- let state = 0,
- ch,
- maybeEIPos;
+ var startPos = stream.pos;
+ var state = 0,
+ ch,
+ maybeEIPos;
+
+ while ((ch = stream.getByte()) !== -1) {
+ if (state === 0) {
+ state = ch === E ? 1 : 0;
+ } else if (state === 1) {
+ state = ch === I ? 2 : 0;
+ } else {
+ (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
- while ((ch = stream.getByte()) !== -1) {
- if (state === 0) {
- state = ch === E ? 1 : 0;
- } else if (state === 1) {
- state = ch === I ? 2 : 0;
- } else {
- (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
+ if (ch === SPACE || ch === LF || ch === CR) {
+ maybeEIPos = stream.pos;
+ var followingBytes = stream.peekBytes(n);
- if (ch === SPACE || ch === LF || ch === CR) {
- maybeEIPos = stream.pos;
- const followingBytes = stream.peekBytes(n);
+ for (var i = 0, ii = followingBytes.length; i < ii; i++) {
+ ch = followingBytes[i];
- for (let i = 0, ii = followingBytes.length; i < ii; i++) {
- ch = followingBytes[i];
+ if (ch === NUL && followingBytes[i + 1] !== NUL) {
+ continue;
+ }
- if (ch === NUL && followingBytes[i + 1] !== NUL) {
- continue;
+ if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
+ state = 0;
+ break;
+ }
}
- if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
- state = 0;
+ if (state === 2) {
break;
}
+ } else {
+ state = 0;
}
-
- if (state === 2) {
- break;
- }
- } else {
- state = 0;
}
}
- }
- if (ch === -1) {
- (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
+ if (ch === -1) {
+ (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
- if (maybeEIPos) {
- (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
- stream.skip(-(stream.pos - maybeEIPos));
+ if (maybeEIPos) {
+ (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
+ stream.skip(-(stream.pos - maybeEIPos));
+ }
}
- }
-
- let endOffset = 4;
- stream.skip(-endOffset);
- ch = stream.peekByte();
- stream.skip(endOffset);
- if (!(0, _core_utils.isWhiteSpace)(ch)) {
- endOffset--;
- }
+ var endOffset = 4;
+ stream.skip(-endOffset);
+ ch = stream.peekByte();
+ stream.skip(endOffset);
- return stream.pos - endOffset - startPos;
- }
+ if (!(0, _core_utils.isWhiteSpace)(ch)) {
+ endOffset--;
+ }
- findDCTDecodeInlineStreamEnd(stream) {
- const startPos = stream.pos;
- let foundEOI = false,
- b,
- markerLength;
+ return stream.pos - endOffset - startPos;
+ }
+ }, {
+ key: "findDCTDecodeInlineStreamEnd",
+ value: function findDCTDecodeInlineStreamEnd(stream) {
+ var startPos = stream.pos;
+ var foundEOI = false,
+ b,
+ markerLength;
+
+ while ((b = stream.getByte()) !== -1) {
+ if (b !== 0xff) {
+ continue;
+ }
- while ((b = stream.getByte()) !== -1) {
- if (b !== 0xff) {
- continue;
- }
+ switch (stream.getByte()) {
+ case 0x00:
+ break;
- switch (stream.getByte()) {
- case 0x00:
- break;
+ case 0xff:
+ stream.skip(-1);
+ break;
- case 0xff:
- stream.skip(-1);
- break;
+ case 0xd9:
+ foundEOI = true;
+ break;
- case 0xd9:
- foundEOI = true;
- break;
+ case 0xc0:
+ case 0xc1:
+ case 0xc2:
+ case 0xc3:
+ case 0xc5:
+ case 0xc6:
+ case 0xc7:
+ case 0xc9:
+ case 0xca:
+ case 0xcb:
+ case 0xcd:
+ case 0xce:
+ case 0xcf:
+ case 0xc4:
+ case 0xcc:
+ case 0xda:
+ case 0xdb:
+ case 0xdc:
+ case 0xdd:
+ case 0xde:
+ case 0xdf:
+ case 0xe0:
+ case 0xe1:
+ case 0xe2:
+ case 0xe3:
+ case 0xe4:
+ case 0xe5:
+ case 0xe6:
+ case 0xe7:
+ case 0xe8:
+ case 0xe9:
+ case 0xea:
+ case 0xeb:
+ case 0xec:
+ case 0xed:
+ case 0xee:
+ case 0xef:
+ case 0xfe:
+ markerLength = stream.getUint16();
+
+ if (markerLength > 2) {
+ stream.skip(markerLength - 2);
+ } else {
+ stream.skip(-2);
+ }
- case 0xc0:
- case 0xc1:
- case 0xc2:
- case 0xc3:
- case 0xc5:
- case 0xc6:
- case 0xc7:
- case 0xc9:
- case 0xca:
- case 0xcb:
- case 0xcd:
- case 0xce:
- case 0xcf:
- case 0xc4:
- case 0xcc:
- case 0xda:
- case 0xdb:
- case 0xdc:
- case 0xdd:
- case 0xde:
- case 0xdf:
- case 0xe0:
- case 0xe1:
- case 0xe2:
- case 0xe3:
- case 0xe4:
- case 0xe5:
- case 0xe6:
- case 0xe7:
- case 0xe8:
- case 0xe9:
- case 0xea:
- case 0xeb:
- case 0xec:
- case 0xed:
- case 0xee:
- case 0xef:
- case 0xfe:
- markerLength = stream.getUint16();
-
- if (markerLength > 2) {
- stream.skip(markerLength - 2);
- } else {
- stream.skip(-2);
- }
+ break;
+ }
+ if (foundEOI) {
break;
+ }
}
- if (foundEOI) {
- break;
- }
- }
+ var length = stream.pos - startPos;
- const length = stream.pos - startPos;
+ if (b === -1) {
+ (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
+ stream.skip(-length);
+ return this.findDefaultInlineStreamEnd(stream);
+ }
- if (b === -1) {
- (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
- stream.skip(-length);
- return this.findDefaultInlineStreamEnd(stream);
+ this.inlineStreamSkipEI(stream);
+ return length;
}
-
- this.inlineStreamSkipEI(stream);
- return length;
- }
-
- findASCII85DecodeInlineStreamEnd(stream) {
- const TILDE = 0x7e,
+ }, {
+ key: "findASCII85DecodeInlineStreamEnd",
+ value: function findASCII85DecodeInlineStreamEnd(stream) {
+ var TILDE = 0x7e,
GT = 0x3e;
- const startPos = stream.pos;
- let ch;
-
- while ((ch = stream.getByte()) !== -1) {
- if (ch === TILDE) {
- const tildePos = stream.pos;
- ch = stream.peekByte();
+ var startPos = stream.pos;
+ var ch;
- while ((0, _core_utils.isWhiteSpace)(ch)) {
- stream.skip();
+ while ((ch = stream.getByte()) !== -1) {
+ if (ch === TILDE) {
+ var tildePos = stream.pos;
ch = stream.peekByte();
- }
-
- if (ch === GT) {
- stream.skip();
- break;
- }
- if (stream.pos > tildePos) {
- const maybeEI = stream.peekBytes(2);
+ while ((0, _core_utils.isWhiteSpace)(ch)) {
+ stream.skip();
+ ch = stream.peekByte();
+ }
- if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
+ if (ch === GT) {
+ stream.skip();
break;
}
+
+ if (stream.pos > tildePos) {
+ var maybeEI = stream.peekBytes(2);
+
+ if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
+ break;
+ }
+ }
}
}
- }
- const length = stream.pos - startPos;
+ var length = stream.pos - startPos;
- if (ch === -1) {
- (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
- stream.skip(-length);
- return this.findDefaultInlineStreamEnd(stream);
+ if (ch === -1) {
+ (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
+ stream.skip(-length);
+ return this.findDefaultInlineStreamEnd(stream);
+ }
+
+ this.inlineStreamSkipEI(stream);
+ return length;
}
+ }, {
+ key: "findASCIIHexDecodeInlineStreamEnd",
+ value: function findASCIIHexDecodeInlineStreamEnd(stream) {
+ var GT = 0x3e;
+ var startPos = stream.pos;
+ var ch;
- this.inlineStreamSkipEI(stream);
- return length;
- }
+ while ((ch = stream.getByte()) !== -1) {
+ if (ch === GT) {
+ break;
+ }
+ }
- findASCIIHexDecodeInlineStreamEnd(stream) {
- const GT = 0x3e;
- const startPos = stream.pos;
- let ch;
+ var length = stream.pos - startPos;
- while ((ch = stream.getByte()) !== -1) {
- if (ch === GT) {
- break;
+ if (ch === -1) {
+ (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
+ stream.skip(-length);
+ return this.findDefaultInlineStreamEnd(stream);
}
- }
- const length = stream.pos - startPos;
-
- if (ch === -1) {
- (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
- stream.skip(-length);
- return this.findDefaultInlineStreamEnd(stream);
+ this.inlineStreamSkipEI(stream);
+ return length;
}
-
- this.inlineStreamSkipEI(stream);
- return length;
- }
-
- inlineStreamSkipEI(stream) {
- const E = 0x45,
+ }, {
+ key: "inlineStreamSkipEI",
+ value: function inlineStreamSkipEI(stream) {
+ var E = 0x45,
I = 0x49;
- let state = 0,
- ch;
-
- while ((ch = stream.getByte()) !== -1) {
- if (state === 0) {
- state = ch === E ? 1 : 0;
- } else if (state === 1) {
- state = ch === I ? 2 : 0;
- } else if (state === 2) {
- break;
+ var state = 0,
+ ch;
+
+ while ((ch = stream.getByte()) !== -1) {
+ if (state === 0) {
+ state = ch === E ? 1 : 0;
+ } else if (state === 1) {
+ state = ch === I ? 2 : 0;
+ } else if (state === 2) {
+ break;
+ }
}
}
- }
+ }, {
+ key: "makeInlineImage",
+ value: function makeInlineImage(cipherTransform) {
+ var lexer = this.lexer;
+ var stream = lexer.stream;
+ var dict = new _primitives.Dict(this.xref);
+ var dictLength;
- makeInlineImage(cipherTransform) {
- const lexer = this.lexer;
- const stream = lexer.stream;
- const dict = new _primitives.Dict(this.xref);
- let dictLength;
+ while (!(0, _primitives.isCmd)(this.buf1, "ID") && !(0, _primitives.isEOF)(this.buf1)) {
+ if (!(0, _primitives.isName)(this.buf1)) {
+ throw new _util.FormatError("Dictionary key must be a name object");
+ }
- while (!(0, _primitives.isCmd)(this.buf1, "ID") && !(0, _primitives.isEOF)(this.buf1)) {
- if (!(0, _primitives.isName)(this.buf1)) {
- throw new _util.FormatError("Dictionary key must be a name object");
- }
+ var key = this.buf1.name;
+ this.shift();
- const key = this.buf1.name;
- this.shift();
+ if ((0, _primitives.isEOF)(this.buf1)) {
+ break;
+ }
- if ((0, _primitives.isEOF)(this.buf1)) {
- break;
+ dict.set(key, this.getObj(cipherTransform));
}
- dict.set(key, this.getObj(cipherTransform));
- }
-
- if (lexer.beginInlineImagePos !== -1) {
- dictLength = stream.pos - lexer.beginInlineImagePos;
- }
+ if (lexer.beginInlineImagePos !== -1) {
+ dictLength = stream.pos - lexer.beginInlineImagePos;
+ }
- const filter = dict.get("Filter", "F");
- let filterName;
+ var filter = dict.get("Filter", "F");
+ var filterName;
- if ((0, _primitives.isName)(filter)) {
- filterName = filter.name;
- } else if (Array.isArray(filter)) {
- const filterZero = this.xref.fetchIfRef(filter[0]);
+ if ((0, _primitives.isName)(filter)) {
+ filterName = filter.name;
+ } else if (Array.isArray(filter)) {
+ var filterZero = this.xref.fetchIfRef(filter[0]);
- if ((0, _primitives.isName)(filterZero)) {
- filterName = filterZero.name;
+ if ((0, _primitives.isName)(filterZero)) {
+ filterName = filterZero.name;
+ }
}
- }
- const startPos = stream.pos;
- let length;
+ var startPos = stream.pos;
+ var length;
- if (filterName === "DCTDecode" || filterName === "DCT") {
- length = this.findDCTDecodeInlineStreamEnd(stream);
- } else if (filterName === "ASCII85Decode" || filterName === "A85") {
- length = this.findASCII85DecodeInlineStreamEnd(stream);
- } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") {
- length = this.findASCIIHexDecodeInlineStreamEnd(stream);
- } else {
- length = this.findDefaultInlineStreamEnd(stream);
- }
+ if (filterName === "DCTDecode" || filterName === "DCT") {
+ length = this.findDCTDecodeInlineStreamEnd(stream);
+ } else if (filterName === "ASCII85Decode" || filterName === "A85") {
+ length = this.findASCII85DecodeInlineStreamEnd(stream);
+ } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") {
+ length = this.findASCIIHexDecodeInlineStreamEnd(stream);
+ } else {
+ length = this.findDefaultInlineStreamEnd(stream);
+ }
- let imageStream = stream.makeSubStream(startPos, length, dict);
- let cacheKey;
+ var imageStream = stream.makeSubStream(startPos, length, dict);
+ var cacheKey;
- if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
- const imageBytes = imageStream.getBytes();
- imageStream.reset();
- const initialStreamPos = stream.pos;
- stream.pos = lexer.beginInlineImagePos;
- const dictBytes = stream.getBytes(dictLength);
- stream.pos = initialStreamPos;
- cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
- const cacheEntry = this.imageCache[cacheKey];
+ if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
+ var imageBytes = imageStream.getBytes();
+ imageStream.reset();
+ var initialStreamPos = stream.pos;
+ stream.pos = lexer.beginInlineImagePos;
+ var dictBytes = stream.getBytes(dictLength);
+ stream.pos = initialStreamPos;
+ cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
+ var cacheEntry = this.imageCache[cacheKey];
- if (cacheEntry !== undefined) {
- this.buf2 = _primitives.Cmd.get("EI");
- this.shift();
- cacheEntry.reset();
- return cacheEntry;
+ if (cacheEntry !== undefined) {
+ this.buf2 = _primitives.Cmd.get("EI");
+ this.shift();
+ cacheEntry.reset();
+ return cacheEntry;
+ }
}
- }
-
- if (cipherTransform) {
- imageStream = cipherTransform.createStream(imageStream, length);
- }
- imageStream = this.filter(imageStream, dict, length);
- imageStream.dict = dict;
-
- if (cacheKey !== undefined) {
- imageStream.cacheKey = `inline_${length}_${cacheKey}`;
- this.imageCache[cacheKey] = imageStream;
- }
+ if (cipherTransform) {
+ imageStream = cipherTransform.createStream(imageStream, length);
+ }
- this.buf2 = _primitives.Cmd.get("EI");
- this.shift();
- return imageStream;
- }
+ imageStream = this.filter(imageStream, dict, length);
+ imageStream.dict = dict;
- _findStreamLength(startPos, signature) {
- const {
- stream
- } = this.lexer;
- stream.pos = startPos;
- const SCAN_BLOCK_LENGTH = 2048;
- const signatureLength = signature.length;
+ if (cacheKey !== undefined) {
+ imageStream.cacheKey = "inline_".concat(length, "_").concat(cacheKey);
+ this.imageCache[cacheKey] = imageStream;
+ }
- while (stream.pos < stream.end) {
- const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
- const scanLength = scanBytes.length - signatureLength;
+ this.buf2 = _primitives.Cmd.get("EI");
+ this.shift();
+ return imageStream;
+ }
+ }, {
+ key: "_findStreamLength",
+ value: function _findStreamLength(startPos, signature) {
+ var stream = this.lexer.stream;
+ stream.pos = startPos;
+ var SCAN_BLOCK_LENGTH = 2048;
+ var signatureLength = signature.length;
+
+ while (stream.pos < stream.end) {
+ var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
+ var scanLength = scanBytes.length - signatureLength;
+
+ if (scanLength <= 0) {
+ break;
+ }
- if (scanLength <= 0) {
- break;
- }
+ var pos = 0;
- let pos = 0;
+ while (pos < scanLength) {
+ var j = 0;
- while (pos < scanLength) {
- let j = 0;
+ while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
+ j++;
+ }
- while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
- j++;
- }
+ if (j >= signatureLength) {
+ stream.pos += pos;
+ return stream.pos - startPos;
+ }
- if (j >= signatureLength) {
- stream.pos += pos;
- return stream.pos - startPos;
+ pos++;
}
- pos++;
+ stream.pos += scanLength;
}
- stream.pos += scanLength;
+ return -1;
}
+ }, {
+ key: "makeStream",
+ value: function makeStream(dict, cipherTransform) {
+ var lexer = this.lexer;
+ var stream = lexer.stream;
+ lexer.skipToNextLine();
+ var startPos = stream.pos - 1;
+ var length = dict.get("Length");
- return -1;
- }
-
- makeStream(dict, cipherTransform) {
- const lexer = this.lexer;
- let stream = lexer.stream;
- lexer.skipToNextLine();
- const startPos = stream.pos - 1;
- let length = dict.get("Length");
+ if (!Number.isInteger(length)) {
+ (0, _util.info)("Bad length \"".concat(length, "\" in stream"));
+ length = 0;
+ }
- if (!Number.isInteger(length)) {
- (0, _util.info)(`Bad length "${length}" in stream`);
- length = 0;
- }
+ stream.pos = startPos + length;
+ lexer.nextChar();
- stream.pos = startPos + length;
- lexer.nextChar();
+ if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
+ this.shift();
+ } else {
+ var ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]);
- if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
- this.shift();
- } else {
- const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]);
+ var actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
- let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
+ if (actualLength < 0) {
+ var MAX_TRUNCATION = 1;
- if (actualLength < 0) {
- const MAX_TRUNCATION = 1;
+ for (var i = 1; i <= MAX_TRUNCATION; i++) {
+ var end = ENDSTREAM_SIGNATURE.length - i;
+ var TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
- for (let i = 1; i <= MAX_TRUNCATION; i++) {
- const end = ENDSTREAM_SIGNATURE.length - i;
- const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
+ var maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
- const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
+ if (maybeLength >= 0) {
+ var lastByte = stream.peekBytes(end + 1)[end];
- if (maybeLength >= 0) {
- const lastByte = stream.peekBytes(end + 1)[end];
+ if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
+ break;
+ }
- if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
+ (0, _util.info)("Found \"".concat((0, _util.bytesToString)(TRUNCATED_SIGNATURE), "\" when ") + "searching for endstream command.");
+ actualLength = maybeLength;
break;
}
+ }
- (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
- actualLength = maybeLength;
- break;
+ if (actualLength < 0) {
+ throw new _util.FormatError("Missing endstream command.");
}
}
- if (actualLength < 0) {
- throw new _util.FormatError("Missing endstream command.");
- }
+ length = actualLength;
+ lexer.nextChar();
+ this.shift();
+ this.shift();
}
- length = actualLength;
- lexer.nextChar();
- this.shift();
this.shift();
- }
+ stream = stream.makeSubStream(startPos, length, dict);
- this.shift();
- stream = stream.makeSubStream(startPos, length, dict);
+ if (cipherTransform) {
+ stream = cipherTransform.createStream(stream, length);
+ }
- if (cipherTransform) {
- stream = cipherTransform.createStream(stream, length);
+ stream = this.filter(stream, dict, length);
+ stream.dict = dict;
+ return stream;
}
+ }, {
+ key: "filter",
+ value: function filter(stream, dict, length) {
+ var filter = dict.get("Filter", "F");
+ var params = dict.get("DecodeParms", "DP");
- stream = this.filter(stream, dict, length);
- stream.dict = dict;
- return stream;
- }
-
- filter(stream, dict, length) {
- let filter = dict.get("Filter", "F");
- let params = dict.get("DecodeParms", "DP");
+ if ((0, _primitives.isName)(filter)) {
+ if (Array.isArray(params)) {
+ (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name.");
+ }
- if ((0, _primitives.isName)(filter)) {
- if (Array.isArray(params)) {
- (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name.");
+ return this.makeFilter(stream, filter.name, length, params);
}
- return this.makeFilter(stream, filter.name, length, params);
- }
+ var maybeLength = length;
- let maybeLength = length;
+ if (Array.isArray(filter)) {
+ var filterArray = filter;
+ var paramsArray = params;
- if (Array.isArray(filter)) {
- const filterArray = filter;
- const paramsArray = params;
+ for (var i = 0, ii = filterArray.length; i < ii; ++i) {
+ filter = this.xref.fetchIfRef(filterArray[i]);
- for (let i = 0, ii = filterArray.length; i < ii; ++i) {
- filter = this.xref.fetchIfRef(filterArray[i]);
+ if (!(0, _primitives.isName)(filter)) {
+ throw new _util.FormatError("Bad filter name \"".concat(filter, "\""));
+ }
- if (!(0, _primitives.isName)(filter)) {
- throw new _util.FormatError(`Bad filter name "${filter}"`);
- }
+ params = null;
- params = null;
+ if (Array.isArray(paramsArray) && i in paramsArray) {
+ params = this.xref.fetchIfRef(paramsArray[i]);
+ }
- if (Array.isArray(paramsArray) && i in paramsArray) {
- params = this.xref.fetchIfRef(paramsArray[i]);
+ stream = this.makeFilter(stream, filter.name, maybeLength, params);
+ maybeLength = null;
}
-
- stream = this.makeFilter(stream, filter.name, maybeLength, params);
- maybeLength = null;
}
- }
-
- return stream;
- }
- makeFilter(stream, name, maybeLength, params) {
- if (maybeLength === 0) {
- (0, _util.warn)(`Empty "${name}" stream.`);
- return new _stream.NullStream();
+ return stream;
}
+ }, {
+ key: "makeFilter",
+ value: function makeFilter(stream, name, maybeLength, params) {
+ if (maybeLength === 0) {
+ (0, _util.warn)("Empty \"".concat(name, "\" stream."));
+ return new _stream.NullStream();
+ }
- try {
- const xrefStreamStats = this.xref.stats.streamTypes;
+ try {
+ var xrefStreamStats = this.xref.stats.streamTypes;
+
+ if (name === "FlateDecode" || name === "Fl") {
+ xrefStreamStats[_util.StreamType.FLATE] = true;
- if (name === "FlateDecode" || name === "Fl") {
- xrefStreamStats[_util.StreamType.FLATE] = true;
+ if (params) {
+ return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params);
+ }
- if (params) {
- return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params);
+ return new _stream.FlateStream(stream, maybeLength);
}
- return new _stream.FlateStream(stream, maybeLength);
- }
+ if (name === "LZWDecode" || name === "LZW") {
+ xrefStreamStats[_util.StreamType.LZW] = true;
+ var earlyChange = 1;
- if (name === "LZWDecode" || name === "LZW") {
- xrefStreamStats[_util.StreamType.LZW] = true;
- let earlyChange = 1;
+ if (params) {
+ if (params.has("EarlyChange")) {
+ earlyChange = params.get("EarlyChange");
+ }
- if (params) {
- if (params.has("EarlyChange")) {
- earlyChange = params.get("EarlyChange");
+ return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
}
- return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
+ return new _stream.LZWStream(stream, maybeLength, earlyChange);
}
- return new _stream.LZWStream(stream, maybeLength, earlyChange);
- }
+ if (name === "DCTDecode" || name === "DCT") {
+ xrefStreamStats[_util.StreamType.DCT] = true;
+ return new _jpeg_stream.JpegStream(stream, maybeLength, stream.dict, params);
+ }
- if (name === "DCTDecode" || name === "DCT") {
- xrefStreamStats[_util.StreamType.DCT] = true;
- return new _jpeg_stream.JpegStream(stream, maybeLength, stream.dict, params);
- }
+ if (name === "JPXDecode" || name === "JPX") {
+ xrefStreamStats[_util.StreamType.JPX] = true;
+ return new _jpx_stream.JpxStream(stream, maybeLength, stream.dict, params);
+ }
- if (name === "JPXDecode" || name === "JPX") {
- xrefStreamStats[_util.StreamType.JPX] = true;
- return new _jpx_stream.JpxStream(stream, maybeLength, stream.dict, params);
- }
+ if (name === "ASCII85Decode" || name === "A85") {
+ xrefStreamStats[_util.StreamType.A85] = true;
+ return new _stream.Ascii85Stream(stream, maybeLength);
+ }
- if (name === "ASCII85Decode" || name === "A85") {
- xrefStreamStats[_util.StreamType.A85] = true;
- return new _stream.Ascii85Stream(stream, maybeLength);
- }
+ if (name === "ASCIIHexDecode" || name === "AHx") {
+ xrefStreamStats[_util.StreamType.AHX] = true;
+ return new _stream.AsciiHexStream(stream, maybeLength);
+ }
- if (name === "ASCIIHexDecode" || name === "AHx") {
- xrefStreamStats[_util.StreamType.AHX] = true;
- return new _stream.AsciiHexStream(stream, maybeLength);
- }
+ if (name === "CCITTFaxDecode" || name === "CCF") {
+ xrefStreamStats[_util.StreamType.CCF] = true;
+ return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
+ }
- if (name === "CCITTFaxDecode" || name === "CCF") {
- xrefStreamStats[_util.StreamType.CCF] = true;
- return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
- }
+ if (name === "RunLengthDecode" || name === "RL") {
+ xrefStreamStats[_util.StreamType.RLX] = true;
+ return new _stream.RunLengthStream(stream, maybeLength);
+ }
- if (name === "RunLengthDecode" || name === "RL") {
- xrefStreamStats[_util.StreamType.RLX] = true;
- return new _stream.RunLengthStream(stream, maybeLength);
- }
+ if (name === "JBIG2Decode") {
+ xrefStreamStats[_util.StreamType.JBIG] = true;
+ return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params);
+ }
- if (name === "JBIG2Decode") {
- xrefStreamStats[_util.StreamType.JBIG] = true;
- return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params);
- }
+ (0, _util.warn)("Filter \"".concat(name, "\" is not supported."));
+ return stream;
+ } catch (ex) {
+ if (ex instanceof _core_utils.MissingDataException) {
+ throw ex;
+ }
- (0, _util.warn)(`Filter "${name}" is not supported.`);
- return stream;
- } catch (ex) {
- if (ex instanceof _core_utils.MissingDataException) {
- throw ex;
+ (0, _util.warn)("Invalid stream: \"".concat(ex, "\""));
+ return new _stream.NullStream();
}
-
- (0, _util.warn)(`Invalid stream: "${ex}"`);
- return new _stream.NullStream();
}
- }
+ }]);
-}
+ return Parser;
+}();
exports.Parser = Parser;
-const specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+var specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
function toHexDigit(ch) {
if (ch >= 0x30 && ch <= 0x39) {
@@ -6565,8 +17559,12 @@ function toHexDigit(ch) {
return -1;
}
-class Lexer {
- constructor(stream, knownCommands = null) {
+var Lexer = /*#__PURE__*/function () {
+ function Lexer(stream) {
+ var knownCommands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
+
+ _classCallCheck(this, Lexer);
+
this.stream = stream;
this.nextChar();
this.strBuf = [];
@@ -6575,556 +17573,577 @@ class Lexer {
this.beginInlineImagePos = -1;
}
- nextChar() {
- return this.currentChar = this.stream.getByte();
- }
-
- peekChar() {
- return this.stream.peekByte();
- }
-
- getNumber() {
- let ch = this.currentChar;
- let eNotation = false;
- let divideBy = 0;
- let sign = 0;
-
- if (ch === 0x2d) {
- sign = -1;
- ch = this.nextChar();
+ _createClass(Lexer, [{
+ key: "nextChar",
+ value: function nextChar() {
+ return this.currentChar = this.stream.getByte();
+ }
+ }, {
+ key: "peekChar",
+ value: function peekChar() {
+ return this.stream.peekByte();
+ }
+ }, {
+ key: "getNumber",
+ value: function getNumber() {
+ var ch = this.currentChar;
+ var eNotation = false;
+ var divideBy = 0;
+ var sign = 0;
if (ch === 0x2d) {
+ sign = -1;
+ ch = this.nextChar();
+
+ if (ch === 0x2d) {
+ ch = this.nextChar();
+ }
+ } else if (ch === 0x2b) {
+ sign = 1;
ch = this.nextChar();
}
- } else if (ch === 0x2b) {
- sign = 1;
- ch = this.nextChar();
- }
- if (ch === 0x0a || ch === 0x0d) {
- do {
+ if (ch === 0x0a || ch === 0x0d) {
+ do {
+ ch = this.nextChar();
+ } while (ch === 0x0a || ch === 0x0d);
+ }
+
+ if (ch === 0x2e) {
+ divideBy = 10;
ch = this.nextChar();
- } while (ch === 0x0a || ch === 0x0d);
- }
+ }
- if (ch === 0x2e) {
- divideBy = 10;
- ch = this.nextChar();
- }
+ if (ch < 0x30 || ch > 0x39) {
+ if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) {
+ (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
+ return 0;
+ }
- if (ch < 0x30 || ch > 0x39) {
- if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) {
- (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
- return 0;
+ throw new _util.FormatError("Invalid number: ".concat(String.fromCharCode(ch), " (charCode ").concat(ch, ")"));
}
- throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
- }
+ sign = sign || 1;
+ var baseValue = ch - 0x30;
+ var powerValue = 0;
+ var powerValueSign = 1;
- sign = sign || 1;
- let baseValue = ch - 0x30;
- let powerValue = 0;
- let powerValueSign = 1;
+ while ((ch = this.nextChar()) >= 0) {
+ if (ch >= 0x30 && ch <= 0x39) {
+ var currentDigit = ch - 0x30;
- while ((ch = this.nextChar()) >= 0) {
- if (ch >= 0x30 && ch <= 0x39) {
- const currentDigit = ch - 0x30;
+ if (eNotation) {
+ powerValue = powerValue * 10 + currentDigit;
+ } else {
+ if (divideBy !== 0) {
+ divideBy *= 10;
+ }
- if (eNotation) {
- powerValue = powerValue * 10 + currentDigit;
- } else {
- if (divideBy !== 0) {
- divideBy *= 10;
+ baseValue = baseValue * 10 + currentDigit;
}
+ } else if (ch === 0x2e) {
+ if (divideBy === 0) {
+ divideBy = 1;
+ } else {
+ break;
+ }
+ } else if (ch === 0x2d) {
+ (0, _util.warn)("Badly formatted number: minus sign in the middle");
+ } else if (ch === 0x45 || ch === 0x65) {
+ ch = this.peekChar();
- baseValue = baseValue * 10 + currentDigit;
- }
- } else if (ch === 0x2e) {
- if (divideBy === 0) {
- divideBy = 1;
- } else {
- break;
- }
- } else if (ch === 0x2d) {
- (0, _util.warn)("Badly formatted number: minus sign in the middle");
- } else if (ch === 0x45 || ch === 0x65) {
- ch = this.peekChar();
+ if (ch === 0x2b || ch === 0x2d) {
+ powerValueSign = ch === 0x2d ? -1 : 1;
+ this.nextChar();
+ } else if (ch < 0x30 || ch > 0x39) {
+ break;
+ }
- if (ch === 0x2b || ch === 0x2d) {
- powerValueSign = ch === 0x2d ? -1 : 1;
- this.nextChar();
- } else if (ch < 0x30 || ch > 0x39) {
+ eNotation = true;
+ } else {
break;
}
+ }
- eNotation = true;
- } else {
- break;
+ if (divideBy !== 0) {
+ baseValue /= divideBy;
}
- }
- if (divideBy !== 0) {
- baseValue /= divideBy;
- }
+ if (eNotation) {
+ baseValue *= Math.pow(10, powerValueSign * powerValue);
+ }
- if (eNotation) {
- baseValue *= 10 ** (powerValueSign * powerValue);
+ return sign * baseValue;
}
+ }, {
+ key: "getString",
+ value: function getString() {
+ var numParen = 1;
+ var done = false;
+ var strBuf = this.strBuf;
+ strBuf.length = 0;
+ var ch = this.nextChar();
- return sign * baseValue;
- }
-
- getString() {
- let numParen = 1;
- let done = false;
- const strBuf = this.strBuf;
- strBuf.length = 0;
- let ch = this.nextChar();
-
- while (true) {
- let charBuffered = false;
-
- switch (ch | 0) {
- case -1:
- (0, _util.warn)("Unterminated string");
- done = true;
- break;
-
- case 0x28:
- ++numParen;
- strBuf.push("(");
- break;
+ while (true) {
+ var charBuffered = false;
- case 0x29:
- if (--numParen === 0) {
- this.nextChar();
+ switch (ch | 0) {
+ case -1:
+ (0, _util.warn)("Unterminated string");
done = true;
- } else {
- strBuf.push(")");
- }
-
- break;
+ break;
- case 0x5c:
- ch = this.nextChar();
+ case 0x28:
+ ++numParen;
+ strBuf.push("(");
+ break;
- switch (ch) {
- case -1:
- (0, _util.warn)("Unterminated string");
+ case 0x29:
+ if (--numParen === 0) {
+ this.nextChar();
done = true;
- break;
+ } else {
+ strBuf.push(")");
+ }
- case 0x6e:
- strBuf.push("\n");
- break;
+ break;
- case 0x72:
- strBuf.push("\r");
- break;
+ case 0x5c:
+ ch = this.nextChar();
- case 0x74:
- strBuf.push("\t");
- break;
+ switch (ch) {
+ case -1:
+ (0, _util.warn)("Unterminated string");
+ done = true;
+ break;
- case 0x62:
- strBuf.push("\b");
- break;
+ case 0x6e:
+ strBuf.push("\n");
+ break;
- case 0x66:
- strBuf.push("\f");
- break;
+ case 0x72:
+ strBuf.push("\r");
+ break;
- case 0x5c:
- case 0x28:
- case 0x29:
- strBuf.push(String.fromCharCode(ch));
- break;
+ case 0x74:
+ strBuf.push("\t");
+ break;
- case 0x30:
- case 0x31:
- case 0x32:
- case 0x33:
- case 0x34:
- case 0x35:
- case 0x36:
- case 0x37:
- let x = ch & 0x0f;
- ch = this.nextChar();
- charBuffered = true;
+ case 0x62:
+ strBuf.push("\b");
+ break;
+
+ case 0x66:
+ strBuf.push("\f");
+ break;
+
+ case 0x5c:
+ case 0x28:
+ case 0x29:
+ strBuf.push(String.fromCharCode(ch));
+ break;
- if (ch >= 0x30 && ch <= 0x37) {
- x = (x << 3) + (ch & 0x0f);
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ var x = ch & 0x0f;
ch = this.nextChar();
+ charBuffered = true;
if (ch >= 0x30 && ch <= 0x37) {
- charBuffered = false;
x = (x << 3) + (ch & 0x0f);
+ ch = this.nextChar();
+
+ if (ch >= 0x30 && ch <= 0x37) {
+ charBuffered = false;
+ x = (x << 3) + (ch & 0x0f);
+ }
}
- }
- strBuf.push(String.fromCharCode(x));
- break;
+ strBuf.push(String.fromCharCode(x));
+ break;
- case 0x0d:
- if (this.peekChar() === 0x0a) {
- this.nextChar();
- }
+ case 0x0d:
+ if (this.peekChar() === 0x0a) {
+ this.nextChar();
+ }
- break;
+ break;
- case 0x0a:
- break;
+ case 0x0a:
+ break;
- default:
- strBuf.push(String.fromCharCode(ch));
- break;
- }
+ default:
+ strBuf.push(String.fromCharCode(ch));
+ break;
+ }
- break;
+ break;
- default:
- strBuf.push(String.fromCharCode(ch));
+ default:
+ strBuf.push(String.fromCharCode(ch));
+ break;
+ }
+
+ if (done) {
break;
- }
+ }
- if (done) {
- break;
+ if (!charBuffered) {
+ ch = this.nextChar();
+ }
}
- if (!charBuffered) {
- ch = this.nextChar();
- }
+ return strBuf.join("");
}
+ }, {
+ key: "getName",
+ value: function getName() {
+ var ch, previousCh;
+ var strBuf = this.strBuf;
+ strBuf.length = 0;
+
+ while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
+ if (ch === 0x23) {
+ ch = this.nextChar();
- return strBuf.join("");
- }
-
- getName() {
- let ch, previousCh;
- const strBuf = this.strBuf;
- strBuf.length = 0;
-
- while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
- if (ch === 0x23) {
- ch = this.nextChar();
+ if (specialChars[ch]) {
+ (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
+ strBuf.push("#");
+ break;
+ }
- if (specialChars[ch]) {
- (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
- strBuf.push("#");
- break;
- }
+ var x = toHexDigit(ch);
- const x = toHexDigit(ch);
+ if (x !== -1) {
+ previousCh = ch;
+ ch = this.nextChar();
+ var x2 = toHexDigit(ch);
- if (x !== -1) {
- previousCh = ch;
- ch = this.nextChar();
- const x2 = toHexDigit(ch);
+ if (x2 === -1) {
+ (0, _util.warn)("Lexer_getName: Illegal digit (".concat(String.fromCharCode(ch), ") ") + "in hexadecimal number.");
+ strBuf.push("#", String.fromCharCode(previousCh));
- if (x2 === -1) {
- (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
- strBuf.push("#", String.fromCharCode(previousCh));
+ if (specialChars[ch]) {
+ break;
+ }
- if (specialChars[ch]) {
- break;
+ strBuf.push(String.fromCharCode(ch));
+ continue;
}
- strBuf.push(String.fromCharCode(ch));
- continue;
+ strBuf.push(String.fromCharCode(x << 4 | x2));
+ } else {
+ strBuf.push("#", String.fromCharCode(ch));
}
-
- strBuf.push(String.fromCharCode(x << 4 | x2));
} else {
- strBuf.push("#", String.fromCharCode(ch));
+ strBuf.push(String.fromCharCode(ch));
}
- } else {
- strBuf.push(String.fromCharCode(ch));
}
- }
- if (strBuf.length > 127) {
- (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
- }
+ if (strBuf.length > 127) {
+ (0, _util.warn)("Name token is longer than allowed by the spec: ".concat(strBuf.length));
+ }
- return _primitives.Name.get(strBuf.join(""));
- }
+ return _primitives.Name.get(strBuf.join(""));
+ }
+ }, {
+ key: "_hexStringWarn",
+ value: function _hexStringWarn(ch) {
+ var MAX_HEX_STRING_NUM_WARN = 5;
- _hexStringWarn(ch) {
- const MAX_HEX_STRING_NUM_WARN = 5;
+ if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
+ (0, _util.warn)("getHexString - ignoring additional invalid characters.");
+ return;
+ }
- if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
- (0, _util.warn)("getHexString - ignoring additional invalid characters.");
- return;
- }
+ if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
+ return;
+ }
- if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
- return;
+ (0, _util.warn)("getHexString - ignoring invalid character: ".concat(ch));
}
+ }, {
+ key: "getHexString",
+ value: function getHexString() {
+ var strBuf = this.strBuf;
+ strBuf.length = 0;
+ var ch = this.currentChar;
+ var isFirstHex = true;
+ var firstDigit, secondDigit;
+ this._hexStringNumWarn = 0;
- (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
- }
-
- getHexString() {
- const strBuf = this.strBuf;
- strBuf.length = 0;
- let ch = this.currentChar;
- let isFirstHex = true;
- let firstDigit, secondDigit;
- this._hexStringNumWarn = 0;
+ while (true) {
+ if (ch < 0) {
+ (0, _util.warn)("Unterminated hex string");
+ break;
+ } else if (ch === 0x3e) {
+ this.nextChar();
+ break;
+ } else if (specialChars[ch] === 1) {
+ ch = this.nextChar();
+ continue;
+ } else {
+ if (isFirstHex) {
+ firstDigit = toHexDigit(ch);
- while (true) {
- if (ch < 0) {
- (0, _util.warn)("Unterminated hex string");
- break;
- } else if (ch === 0x3e) {
- this.nextChar();
- break;
- } else if (specialChars[ch] === 1) {
- ch = this.nextChar();
- continue;
- } else {
- if (isFirstHex) {
- firstDigit = toHexDigit(ch);
+ if (firstDigit === -1) {
+ this._hexStringWarn(ch);
- if (firstDigit === -1) {
- this._hexStringWarn(ch);
+ ch = this.nextChar();
+ continue;
+ }
+ } else {
+ secondDigit = toHexDigit(ch);
- ch = this.nextChar();
- continue;
- }
- } else {
- secondDigit = toHexDigit(ch);
+ if (secondDigit === -1) {
+ this._hexStringWarn(ch);
- if (secondDigit === -1) {
- this._hexStringWarn(ch);
+ ch = this.nextChar();
+ continue;
+ }
- ch = this.nextChar();
- continue;
+ strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
}
- strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
+ isFirstHex = !isFirstHex;
+ ch = this.nextChar();
}
-
- isFirstHex = !isFirstHex;
- ch = this.nextChar();
}
+
+ return strBuf.join("");
}
+ }, {
+ key: "getObj",
+ value: function getObj() {
+ var comment = false;
+ var ch = this.currentChar;
- return strBuf.join("");
- }
+ while (true) {
+ if (ch < 0) {
+ return _primitives.EOF;
+ }
- getObj() {
- let comment = false;
- let ch = this.currentChar;
+ if (comment) {
+ if (ch === 0x0a || ch === 0x0d) {
+ comment = false;
+ }
+ } else if (ch === 0x25) {
+ comment = true;
+ } else if (specialChars[ch] !== 1) {
+ break;
+ }
- while (true) {
- if (ch < 0) {
- return _primitives.EOF;
+ ch = this.nextChar();
}
- if (comment) {
- if (ch === 0x0a || ch === 0x0d) {
- comment = false;
- }
- } else if (ch === 0x25) {
- comment = true;
- } else if (specialChars[ch] !== 1) {
- break;
- }
+ switch (ch | 0) {
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ case 0x38:
+ case 0x39:
+ case 0x2b:
+ case 0x2d:
+ case 0x2e:
+ return this.getNumber();
- ch = this.nextChar();
- }
+ case 0x28:
+ return this.getString();
- switch (ch | 0) {
- case 0x30:
- case 0x31:
- case 0x32:
- case 0x33:
- case 0x34:
- case 0x35:
- case 0x36:
- case 0x37:
- case 0x38:
- case 0x39:
- case 0x2b:
- case 0x2d:
- case 0x2e:
- return this.getNumber();
+ case 0x2f:
+ return this.getName();
- case 0x28:
- return this.getString();
+ case 0x5b:
+ this.nextChar();
+ return _primitives.Cmd.get("[");
- case 0x2f:
- return this.getName();
+ case 0x5d:
+ this.nextChar();
+ return _primitives.Cmd.get("]");
- case 0x5b:
- this.nextChar();
- return _primitives.Cmd.get("[");
+ case 0x3c:
+ ch = this.nextChar();
- case 0x5d:
- this.nextChar();
- return _primitives.Cmd.get("]");
+ if (ch === 0x3c) {
+ this.nextChar();
+ return _primitives.Cmd.get("<<");
+ }
- case 0x3c:
- ch = this.nextChar();
+ return this.getHexString();
- if (ch === 0x3c) {
- this.nextChar();
- return _primitives.Cmd.get("<<");
- }
+ case 0x3e:
+ ch = this.nextChar();
- return this.getHexString();
+ if (ch === 0x3e) {
+ this.nextChar();
+ return _primitives.Cmd.get(">>");
+ }
- case 0x3e:
- ch = this.nextChar();
+ return _primitives.Cmd.get(">");
- if (ch === 0x3e) {
+ case 0x7b:
this.nextChar();
- return _primitives.Cmd.get(">>");
- }
+ return _primitives.Cmd.get("{");
- return _primitives.Cmd.get(">");
+ case 0x7d:
+ this.nextChar();
+ return _primitives.Cmd.get("}");
- case 0x7b:
- this.nextChar();
- return _primitives.Cmd.get("{");
+ case 0x29:
+ this.nextChar();
+ throw new _util.FormatError("Illegal character: ".concat(ch));
+ }
- case 0x7d:
- this.nextChar();
- return _primitives.Cmd.get("}");
+ var str = String.fromCharCode(ch);
+ var knownCommands = this.knownCommands;
+ var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
- case 0x29:
- this.nextChar();
- throw new _util.FormatError(`Illegal character: ${ch}`);
- }
+ while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
+ var possibleCommand = str + String.fromCharCode(ch);
- let str = String.fromCharCode(ch);
- const knownCommands = this.knownCommands;
- let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
+ if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
+ break;
+ }
- while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
- const possibleCommand = str + String.fromCharCode(ch);
+ if (str.length === 128) {
+ throw new _util.FormatError("Command token too long: ".concat(str.length));
+ }
- if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
- break;
+ str = possibleCommand;
+ knownCommandFound = knownCommands && knownCommands[str] !== undefined;
}
- if (str.length === 128) {
- throw new _util.FormatError(`Command token too long: ${str.length}`);
+ if (str === "true") {
+ return true;
}
- str = possibleCommand;
- knownCommandFound = knownCommands && knownCommands[str] !== undefined;
- }
-
- if (str === "true") {
- return true;
- }
+ if (str === "false") {
+ return false;
+ }
- if (str === "false") {
- return false;
- }
+ if (str === "null") {
+ return null;
+ }
- if (str === "null") {
- return null;
- }
+ if (str === "BI") {
+ this.beginInlineImagePos = this.stream.pos;
+ }
- if (str === "BI") {
- this.beginInlineImagePos = this.stream.pos;
+ return _primitives.Cmd.get(str);
}
+ }, {
+ key: "skipToNextLine",
+ value: function skipToNextLine() {
+ var ch = this.currentChar;
- return _primitives.Cmd.get(str);
- }
-
- skipToNextLine() {
- let ch = this.currentChar;
+ while (ch >= 0) {
+ if (ch === 0x0d) {
+ ch = this.nextChar();
- while (ch >= 0) {
- if (ch === 0x0d) {
- ch = this.nextChar();
+ if (ch === 0x0a) {
+ this.nextChar();
+ }
- if (ch === 0x0a) {
+ break;
+ } else if (ch === 0x0a) {
this.nextChar();
+ break;
}
- break;
- } else if (ch === 0x0a) {
- this.nextChar();
- break;
+ ch = this.nextChar();
}
-
- ch = this.nextChar();
}
- }
+ }]);
-}
+ return Lexer;
+}();
exports.Lexer = Lexer;
-class Linearization {
- static create(stream) {
- function getInt(linDict, name, allowZeroValue = false) {
- const obj = linDict.get(name);
+var Linearization = /*#__PURE__*/function () {
+ function Linearization() {
+ _classCallCheck(this, Linearization);
+ }
+
+ _createClass(Linearization, null, [{
+ key: "create",
+ value: function create(stream) {
+ function getInt(linDict, name) {
+ var allowZeroValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+ var obj = linDict.get(name);
- if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
- return obj;
- }
+ if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
+ return obj;
+ }
- throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
- }
+ throw new Error("The \"".concat(name, "\" parameter in the linearization ") + "dictionary is invalid.");
+ }
- function getHints(linDict) {
- const hints = linDict.get("H");
- let hintsLength;
+ function getHints(linDict) {
+ var hints = linDict.get("H");
+ var hintsLength;
- if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
- for (let index = 0; index < hintsLength; index++) {
- const hint = hints[index];
+ if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
+ for (var index = 0; index < hintsLength; index++) {
+ var hint = hints[index];
- if (!(Number.isInteger(hint) && hint > 0)) {
- throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
+ if (!(Number.isInteger(hint) && hint > 0)) {
+ throw new Error("Hint (".concat(index, ") in the linearization dictionary is invalid."));
+ }
}
+
+ return hints;
}
- return hints;
+ throw new Error("Hint array in the linearization dictionary is invalid.");
}
- throw new Error("Hint array in the linearization dictionary is invalid.");
- }
+ var parser = new Parser({
+ lexer: new Lexer(stream),
+ xref: null
+ });
+ var obj1 = parser.getObj();
+ var obj2 = parser.getObj();
+ var obj3 = parser.getObj();
+ var linDict = parser.getObj();
+ var obj, length;
- const parser = new Parser({
- lexer: new Lexer(stream),
- xref: null
- });
- const obj1 = parser.getObj();
- const obj2 = parser.getObj();
- const obj3 = parser.getObj();
- const linDict = parser.getObj();
- let obj, length;
+ if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get("Linearized")) && obj > 0)) {
+ return null;
+ } else if ((length = getInt(linDict, "L")) !== stream.length) {
+ throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
+ }
- if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get("Linearized")) && obj > 0)) {
- return null;
- } else if ((length = getInt(linDict, "L")) !== stream.length) {
- throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
+ return {
+ length: length,
+ hints: getHints(linDict),
+ objectNumberFirst: getInt(linDict, "O"),
+ endFirst: getInt(linDict, "E"),
+ numPages: getInt(linDict, "N"),
+ mainXRefEntriesOffset: getInt(linDict, "T"),
+ pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
+ };
}
+ }]);
- return {
- length,
- hints: getHints(linDict),
- objectNumberFirst: getInt(linDict, "O"),
- endFirst: getInt(linDict, "E"),
- numPages: getInt(linDict, "N"),
- mainXRefEntriesOffset: getInt(linDict, "T"),
- pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
- };
- }
-
-}
+ return Linearization;
+}();
exports.Linearization = Linearization;
/***/ }),
-/* 12 */
+/* 205 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -7135,11 +18154,23 @@ Object.defineProperty(exports, "__esModule", {
});
exports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.AsciiHexStream = exports.Ascii85Stream = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+var _primitives = __w_pdfjs_require__(198);
+
+var _core_utils = __w_pdfjs_require__(201);
+
+function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
-var _primitives = __w_pdfjs_require__(5);
+function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
-var _core_utils = __w_pdfjs_require__(8);
+function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
+
+function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
+
+function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
+
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
var Stream = function StreamClosure() {
function Stream(arrayBuffer, start, length, dict) {
@@ -7183,15 +18214,16 @@ var Stream = function StreamClosure() {
var b3 = this.getByte();
return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
},
-
- getBytes(length, forceClamped = false) {
+ getBytes: function getBytes(length) {
+ var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var bytes = this.bytes;
var pos = this.pos;
var strEnd = this.end;
if (!length) {
- const subarray = bytes.subarray(pos, strEnd);
- return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
+ var _subarray = bytes.subarray(pos, strEnd);
+
+ return forceClamped ? new Uint8ClampedArray(_subarray) : _subarray;
}
var end = pos + length;
@@ -7201,10 +18233,9 @@ var Stream = function StreamClosure() {
}
this.pos = end;
- const subarray = bytes.subarray(pos, end);
+ var subarray = bytes.subarray(pos, end);
return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
},
-
peekByte: function Stream_peekByte() {
var peekedByte = this.getByte();
@@ -7214,14 +18245,13 @@ var Stream = function StreamClosure() {
return peekedByte;
},
-
- peekBytes(length, forceClamped = false) {
+ peekBytes: function peekBytes(length) {
+ var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var bytes = this.getBytes(length, forceClamped);
this.pos -= bytes.length;
return bytes;
},
-
- getByteRange(begin, end) {
+ getByteRange: function getByteRange(begin, end) {
if (begin < 0) {
begin = 0;
}
@@ -7232,7 +18262,6 @@ var Stream = function StreamClosure() {
return this.bytes.subarray(begin, end);
},
-
skip: function Stream_skip(n) {
if (!n) {
n = 1;
@@ -7257,7 +18286,7 @@ exports.Stream = Stream;
var StringStream = function StringStreamClosure() {
function StringStream(str) {
- const bytes = (0, _util.stringToBytes)(str);
+ var bytes = (0, _util.stringToBytes)(str);
Stream.call(this, bytes);
}
@@ -7341,8 +18370,8 @@ var DecodeStream = function DecodeStreamClosure() {
var b3 = this.getByte();
return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
},
-
- getBytes(length, forceClamped = false) {
+ getBytes: function getBytes(length) {
+ var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var end,
pos = this.pos;
@@ -7368,10 +18397,9 @@ var DecodeStream = function DecodeStreamClosure() {
}
this.pos = end;
- const subarray = this.buffer.subarray(pos, end);
+ var subarray = this.buffer.subarray(pos, end);
return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
},
-
peekByte: function DecodeStream_peekByte() {
var peekedByte = this.getByte();
@@ -7381,13 +18409,12 @@ var DecodeStream = function DecodeStreamClosure() {
return peekedByte;
},
-
- peekBytes(length, forceClamped = false) {
+ peekBytes: function peekBytes(length) {
+ var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var bytes = this.getBytes(length, forceClamped);
this.pos -= bytes.length;
return bytes;
},
-
makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
var end = start + length;
@@ -7397,11 +18424,9 @@ var DecodeStream = function DecodeStreamClosure() {
return new Stream(this.buffer, start, length, dict);
},
-
- getByteRange(begin, end) {
+ getByteRange: function getByteRange(begin, end) {
(0, _util.unreachable)("Should not call DecodeStream.getByteRange");
},
-
skip: function DecodeStream_skip(n) {
if (!n) {
n = 1;
@@ -7428,10 +18453,10 @@ exports.DecodeStream = DecodeStream;
var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
function StreamsSequenceStream(streams) {
this.streams = streams;
- let maybeLength = 0;
+ var maybeLength = 0;
- for (let i = 0, ii = streams.length; i < ii; i++) {
- const stream = streams[i];
+ for (var i = 0, ii = streams.length; i < ii; i++) {
+ var stream = streams[i];
if (stream instanceof DecodeStream) {
maybeLength += stream._rawMinBufferLength;
@@ -7469,7 +18494,7 @@ var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
var stream = this.streams[i];
if (stream.getBaseStreams) {
- baseStreams.push(...stream.getBaseStreams());
+ baseStreams.push.apply(baseStreams, _toConsumableArray(stream.getBaseStreams()));
}
}
@@ -7495,19 +18520,19 @@ var FlateStream = function FlateStreamClosure() {
var flg = str.getByte();
if (cmf === -1 || flg === -1) {
- throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
+ throw new _util.FormatError("Invalid header in flate stream: ".concat(cmf, ", ").concat(flg));
}
if ((cmf & 0x0f) !== 0x08) {
- throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
+ throw new _util.FormatError("Unknown compression method in flate stream: ".concat(cmf, ", ").concat(flg));
}
if (((cmf << 8) + flg) % 31 !== 0) {
- throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
+ throw new _util.FormatError("Bad FCHECK in flate stream: ".concat(cmf, ", ").concat(flg));
}
if (flg & 0x20) {
- throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
+ throw new _util.FormatError("FDICT bit set in flate stream: ".concat(cmf, ", ").concat(flg));
}
this.codeSize = 0;
@@ -7649,8 +18674,8 @@ var FlateStream = function FlateStreamClosure() {
this.codeBuf = 0;
this.codeSize = 0;
- const bufferLength = this.bufferLength,
- end = bufferLength + blockLen;
+ var bufferLength = this.bufferLength,
+ end = bufferLength + blockLen;
buffer = this.ensureBuffer(end);
this.bufferLength = end;
@@ -7659,7 +18684,7 @@ var FlateStream = function FlateStreamClosure() {
this.eof = true;
}
} else {
- const block = str.getBytes(blockLen);
+ var block = str.getBytes(blockLen);
buffer.set(block, bufferLength);
if (block.length < blockLen) {
@@ -7797,7 +18822,7 @@ var PredictorStream = function PredictorStreamClosure() {
}
if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
- throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
+ throw new _util.FormatError("Unsupported predictor: ".concat(predictor));
}
if (predictor === 2) {
@@ -8010,7 +19035,7 @@ var PredictorStream = function PredictorStreamClosure() {
break;
default:
- throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
+ throw new _util.FormatError("Unsupported predictor: ".concat(predictor));
}
this.bufferLength += rowBytes;
@@ -8282,7 +19307,7 @@ var LZWStream = function LZWStreamClosure() {
this.bitsCached = 0;
var maxLzwDictionarySize = 4096;
var lzwState = {
- earlyChange,
+ earlyChange: earlyChange,
codeLength: 9,
nextCode: 258,
dictionaryValues: new Uint8Array(maxLzwDictionarySize),
@@ -8426,7 +19451,7 @@ var NullStream = function NullStreamClosure() {
exports.NullStream = NullStream;
/***/ }),
-/* 13 */
+/* 206 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -8437,11 +19462,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.CCITTFaxStream = void 0;
-var _primitives = __w_pdfjs_require__(5);
+var _primitives = __w_pdfjs_require__(198);
-var _ccitt = __w_pdfjs_require__(14);
+var _ccitt = __w_pdfjs_require__(207);
-var _stream = __w_pdfjs_require__(12);
+var _stream = __w_pdfjs_require__(205);
var CCITTFaxStream = function CCITTFaxStreamClosure() {
function CCITTFaxStream(str, maybeLength, params) {
@@ -8452,11 +19477,10 @@ var CCITTFaxStream = function CCITTFaxStreamClosure() {
params = _primitives.Dict.empty;
}
- const source = {
- next() {
+ var source = {
+ next: function next() {
return str.getByte();
}
-
};
this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
K: params.get("K"),
@@ -8475,7 +19499,7 @@ var CCITTFaxStream = function CCITTFaxStreamClosure() {
CCITTFaxStream.prototype.readBlock = function () {
while (!this.eof) {
- const c = this.ccittFaxDecoder.readNextChar();
+ var c = this.ccittFaxDecoder.readNextChar();
if (c === -1) {
this.eof = true;
@@ -8493,7 +19517,7 @@ var CCITTFaxStream = function CCITTFaxStreamClosure() {
exports.CCITTFaxStream = CCITTFaxStream;
/***/ }),
-/* 14 */
+/* 207 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -8504,28 +19528,30 @@ Object.defineProperty(exports, "__esModule", {
});
exports.CCITTFaxDecoder = void 0;
-var _util = __w_pdfjs_require__(2);
-
-const CCITTFaxDecoder = function CCITTFaxDecoder() {
- const ccittEOL = -2;
- const ccittEOF = -1;
- const twoDimPass = 0;
- const twoDimHoriz = 1;
- const twoDimVert0 = 2;
- const twoDimVertR1 = 3;
- const twoDimVertL1 = 4;
- const twoDimVertR2 = 5;
- const twoDimVertL2 = 6;
- const twoDimVertR3 = 7;
- const twoDimVertL3 = 8;
- const twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
- const whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]];
- const whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
- const blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]];
- const blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]];
- const blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];
-
- function CCITTFaxDecoder(source, options = {}) {
+var _util = __w_pdfjs_require__(5);
+
+var CCITTFaxDecoder = function CCITTFaxDecoder() {
+ var ccittEOL = -2;
+ var ccittEOF = -1;
+ var twoDimPass = 0;
+ var twoDimHoriz = 1;
+ var twoDimVert0 = 2;
+ var twoDimVertR1 = 3;
+ var twoDimVertL1 = 4;
+ var twoDimVertR2 = 5;
+ var twoDimVertL2 = 6;
+ var twoDimVertR3 = 7;
+ var twoDimVertL3 = 8;
+ var twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
+ var whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]];
+ var whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
+ var blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]];
+ var blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]];
+ var blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];
+
+ function CCITTFaxDecoder(source) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+
if (!source || typeof source.next !== "function") {
throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
}
@@ -8537,7 +19563,7 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
this.byteAlign = options.EncodedByteAlign || false;
this.columns = options.Columns || 1728;
this.rows = options.Rows || 0;
- let eoblock = options.EndOfBlock;
+ var eoblock = options.EndOfBlock;
if (eoblock === null || eoblock === undefined) {
eoblock = true;
@@ -8555,7 +19581,7 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
this.inputBuf = 0;
this.outputBits = 0;
this.rowsDone = false;
- let code1;
+ var code1;
while ((code1 = this._lookBits(12)) === 0) {
this._eatBits(1);
@@ -8573,15 +19599,15 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
}
CCITTFaxDecoder.prototype = {
- readNextChar() {
+ readNextChar: function readNextChar() {
if (this.eof) {
return -1;
}
- const refLine = this.refLine;
- const codingLine = this.codingLine;
- const columns = this.columns;
- let refPos, blackPixels, bits, i;
+ var refLine = this.refLine;
+ var codingLine = this.codingLine;
+ var columns = this.columns;
+ var refPos, blackPixels, bits, i;
if (this.outputBits === 0) {
if (this.rowsDone) {
@@ -8593,7 +19619,7 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
}
this.err = false;
- let code1, code2, code3;
+ var code1, code2, code3;
if (this.nextLine2D) {
for (i = 0; codingLine[i] < columns; ++i) {
@@ -8808,7 +19834,7 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
}
}
- let gotEOL = false;
+ var gotEOL = false;
if (this.byteAlign) {
this.inputBits &= ~7;
@@ -8914,7 +19940,7 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
this.row++;
}
- let c;
+ var c;
if (this.outputBits >= 8) {
c = this.codingPos & 1 ? 0 : 0xff;
@@ -8965,10 +19991,9 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
return c;
},
-
- _addPixels(a1, blackPixels) {
- const codingLine = this.codingLine;
- let codingPos = this.codingPos;
+ _addPixels: function _addPixels(a1, blackPixels) {
+ var codingLine = this.codingLine;
+ var codingPos = this.codingPos;
if (a1 > codingLine[codingPos]) {
if (a1 > this.columns) {
@@ -8986,10 +20011,9 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
this.codingPos = codingPos;
},
-
- _addPixelsNeg(a1, blackPixels) {
- const codingLine = this.codingLine;
- let codingPos = this.codingPos;
+ _addPixelsNeg: function _addPixelsNeg(a1, blackPixels) {
+ var codingLine = this.codingLine;
+ var codingPos = this.codingPos;
if (a1 > codingLine[codingPos]) {
if (a1 > this.columns) {
@@ -9019,12 +20043,11 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
this.codingPos = codingPos;
},
+ _findTableCode: function _findTableCode(start, end, table, limit) {
+ var limitValue = limit || 0;
- _findTableCode(start, end, table, limit) {
- const limitValue = limit || 0;
-
- for (let i = start; i <= end; ++i) {
- let code = this._lookBits(i);
+ for (var i = start; i <= end; ++i) {
+ var code = this._lookBits(i);
if (code === ccittEOF) {
return [true, 1, false];
@@ -9035,7 +20058,7 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
}
if (!limitValue || code >= limitValue) {
- const p = table[code - limitValue];
+ var p = table[code - limitValue];
if (p[0] === i) {
this._eatBits(i);
@@ -9047,10 +20070,9 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
return [false, 0, false];
},
-
- _getTwoDimCode() {
- let code = 0;
- let p;
+ _getTwoDimCode: function _getTwoDimCode() {
+ var code = 0;
+ var p;
if (this.eoblock) {
code = this._lookBits(7);
@@ -9062,7 +20084,7 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
return p[1];
}
} else {
- const result = this._findTableCode(1, 7, twoDimTable);
+ var result = this._findTableCode(1, 7, twoDimTable);
if (result[0] && result[2]) {
return result[1];
@@ -9072,10 +20094,9 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
(0, _util.info)("Bad two dim code");
return ccittEOF;
},
-
- _getWhiteCode() {
- let code = 0;
- let p;
+ _getWhiteCode: function _getWhiteCode() {
+ var code = 0;
+ var p;
if (this.eoblock) {
code = this._lookBits(12);
@@ -9096,7 +20117,7 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
return p[1];
}
} else {
- let result = this._findTableCode(1, 9, whiteTable2);
+ var result = this._findTableCode(1, 9, whiteTable2);
if (result[0]) {
return result[1];
@@ -9115,9 +20136,8 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
return 1;
},
-
- _getBlackCode() {
- let code, p;
+ _getBlackCode: function _getBlackCode() {
+ var code, p;
if (this.eoblock) {
code = this._lookBits(13);
@@ -9140,7 +20160,7 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
return p[1];
}
} else {
- let result = this._findTableCode(2, 6, blackTable3);
+ var result = this._findTableCode(2, 6, blackTable3);
if (result[0]) {
return result[1];
@@ -9165,9 +20185,8 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
return 1;
},
-
- _lookBits(n) {
- let c;
+ _lookBits: function _lookBits(n) {
+ var c;
while (this.inputBits < n) {
if ((c = this.source.next()) === -1) {
@@ -9184,13 +20203,11 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
},
-
- _eatBits(n) {
+ _eatBits: function _eatBits(n) {
if ((this.inputBits -= n) < 0) {
this.inputBits = 0;
}
}
-
};
return CCITTFaxDecoder;
}();
@@ -9198,7 +20215,7 @@ const CCITTFaxDecoder = function CCITTFaxDecoder() {
exports.CCITTFaxDecoder = CCITTFaxDecoder;
/***/ }),
-/* 15 */
+/* 208 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -9209,15 +20226,15 @@ Object.defineProperty(exports, "__esModule", {
});
exports.Jbig2Stream = void 0;
-var _primitives = __w_pdfjs_require__(5);
+var _primitives = __w_pdfjs_require__(198);
-var _stream = __w_pdfjs_require__(12);
+var _stream = __w_pdfjs_require__(205);
-var _jbig = __w_pdfjs_require__(16);
+var _jbig = __w_pdfjs_require__(209);
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
-const Jbig2Stream = function Jbig2StreamClosure() {
+var Jbig2Stream = function Jbig2StreamClosure() {
function Jbig2Stream(stream, maybeLength, dict, params) {
this.stream = stream;
this.maybeLength = maybeLength;
@@ -9229,10 +20246,9 @@ const Jbig2Stream = function Jbig2StreamClosure() {
Jbig2Stream.prototype = Object.create(_stream.DecodeStream.prototype);
Object.defineProperty(Jbig2Stream.prototype, "bytes", {
- get() {
+ get: function get() {
return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
},
-
configurable: true
});
@@ -9243,14 +20259,14 @@ const Jbig2Stream = function Jbig2StreamClosure() {
return;
}
- const jbig2Image = new _jbig.Jbig2Image();
- const chunks = [];
+ var jbig2Image = new _jbig.Jbig2Image();
+ var chunks = [];
if ((0, _primitives.isDict)(this.params)) {
- const globalsStream = this.params.get("JBIG2Globals");
+ var globalsStream = this.params.get("JBIG2Globals");
if ((0, _primitives.isStream)(globalsStream)) {
- const globals = globalsStream.getBytes();
+ var globals = globalsStream.getBytes();
chunks.push({
data: globals,
start: 0,
@@ -9264,10 +20280,10 @@ const Jbig2Stream = function Jbig2StreamClosure() {
start: 0,
end: this.bytes.length
});
- const data = jbig2Image.parseChunks(chunks);
- const dataLength = data.length;
+ var data = jbig2Image.parseChunks(chunks);
+ var dataLength = data.length;
- for (let i = 0; i < dataLength; i++) {
+ for (var i = 0; i < dataLength; i++) {
data[i] ^= 0xff;
}
@@ -9282,7 +20298,7 @@ const Jbig2Stream = function Jbig2StreamClosure() {
exports.Jbig2Stream = Jbig2Stream;
/***/ }),
-/* 16 */
+/* 209 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -9293,33 +20309,57 @@ Object.defineProperty(exports, "__esModule", {
});
exports.Jbig2Image = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+var _core_utils = __w_pdfjs_require__(201);
+
+var _arithmetic_decoder = __w_pdfjs_require__(210);
+
+var _ccitt = __w_pdfjs_require__(207);
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
-var _core_utils = __w_pdfjs_require__(8);
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
-var _arithmetic_decoder = __w_pdfjs_require__(17);
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
-var _ccitt = __w_pdfjs_require__(14);
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
-class Jbig2Error extends _util.BaseException {
- constructor(msg) {
- super(`JBIG2 error: ${msg}`);
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+var Jbig2Error = /*#__PURE__*/function (_BaseException) {
+ _inherits(Jbig2Error, _BaseException);
+
+ var _super = _createSuper(Jbig2Error);
+
+ function Jbig2Error(msg) {
+ _classCallCheck(this, Jbig2Error);
+
+ return _super.call(this, "JBIG2 error: ".concat(msg));
}
-}
+ return Jbig2Error;
+}(_util.BaseException);
var Jbig2Image = function Jbig2ImageClosure() {
function ContextCache() {}
ContextCache.prototype = {
- getContexts(id) {
+ getContexts: function getContexts(id) {
if (id in this) {
return this[id];
}
return this[id] = new Int8Array(1 << 16);
}
-
};
function DecodingContext(data, start, end) {
@@ -9616,7 +20656,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
if (mmr) {
- const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
+ var input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
return decodeMMRBitmap(input, width, height, false);
}
@@ -9840,7 +20880,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
var symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
var decoder = decodingContext.decoder;
var contextCache = decodingContext.contextCache;
- let tableB1, symbolWidths;
+ var tableB1, symbolWidths;
if (huffman) {
tableB1 = getStandardTable(1);
@@ -9851,9 +20891,9 @@ var Jbig2Image = function Jbig2ImageClosure() {
while (newSymbols.length < numberOfNewSymbols) {
var deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
currentHeight += deltaHeight;
- let currentWidth = 0,
+ var currentWidth = 0,
totalWidth = 0;
- const firstSymbol = huffman ? symbolWidths.length : 0;
+ var firstSymbol = huffman ? symbolWidths.length : 0;
while (true) {
var deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
@@ -9889,35 +20929,35 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
if (huffman && !refinement) {
- const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
+ var bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
huffmanInput.byteAlign();
- let collectiveBitmap;
+ var collectiveBitmap = void 0;
if (bitmapSize === 0) {
collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
} else {
- const originalEnd = huffmanInput.end;
- const bitmapEnd = huffmanInput.position + bitmapSize;
+ var originalEnd = huffmanInput.end;
+ var bitmapEnd = huffmanInput.position + bitmapSize;
huffmanInput.end = bitmapEnd;
collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
huffmanInput.end = originalEnd;
huffmanInput.position = bitmapEnd;
}
- const numberOfSymbolsDecoded = symbolWidths.length;
+ var numberOfSymbolsDecoded = symbolWidths.length;
if (firstSymbol === numberOfSymbolsDecoded - 1) {
newSymbols.push(collectiveBitmap);
} else {
- let i,
- y,
+ var _i = void 0,
+ y = void 0,
xMin = 0,
- xMax,
- bitmapWidth,
- symbolBitmap;
+ xMax = void 0,
+ bitmapWidth = void 0,
+ symbolBitmap = void 0;
- for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
- bitmapWidth = symbolWidths[i];
+ for (_i = firstSymbol; _i < numberOfSymbolsDecoded; _i++) {
+ bitmapWidth = symbolWidths[_i];
xMax = xMin + bitmapWidth;
symbolBitmap = [];
@@ -9996,7 +21036,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
var currentS = firstS;
do {
- let currentT = 0;
+ var currentT = 0;
if (stripSize > 1) {
currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
@@ -10050,7 +21090,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
break;
default:
- throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
+ throw new Jbig2Error("operator ".concat(combinationOperator, " is not supported"));
}
}
@@ -10081,7 +21121,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
break;
default:
- throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
+ throw new Jbig2Error("operator ".concat(combinationOperator, " is not supported"));
}
}
@@ -10103,7 +21143,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
- const at = [];
+ var at = [];
if (!mmr) {
at.push({
@@ -10127,16 +21167,16 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
}
- const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
- const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
- const patterns = [];
+ var collectiveWidth = (maxPatternIndex + 1) * patternWidth;
+ var collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
+ var patterns = [];
- for (let i = 0; i <= maxPatternIndex; i++) {
- const patternBitmap = [];
- const xMin = patternWidth * i;
- const xMax = xMin + patternWidth;
+ for (var i = 0; i <= maxPatternIndex; i++) {
+ var patternBitmap = [];
+ var xMin = patternWidth * i;
+ var xMax = xMin + patternWidth;
- for (let y = 0; y < patternHeight; y++) {
+ for (var y = 0; y < patternHeight; y++) {
patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
}
@@ -10147,7 +21187,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
- const skip = null;
+ var skip = null;
if (enableSkip) {
throw new Jbig2Error("skip is not supported");
@@ -10157,8 +21197,8 @@ var Jbig2Image = function Jbig2ImageClosure() {
throw new Jbig2Error("operator " + combinationOperator + " is not supported in halftone region");
}
- const regionBitmap = [];
- let i, j, row;
+ var regionBitmap = [];
+ var i, j, row;
for (i = 0; i < regionHeight; i++) {
row = new Uint8Array(regionWidth);
@@ -10172,12 +21212,12 @@ var Jbig2Image = function Jbig2ImageClosure() {
regionBitmap.push(row);
}
- const numberOfPatterns = patterns.length;
- const pattern0 = patterns[0];
- const patternWidth = pattern0[0].length,
- patternHeight = pattern0.length;
- const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
- const at = [];
+ var numberOfPatterns = patterns.length;
+ var pattern0 = patterns[0];
+ var patternWidth = pattern0[0].length,
+ patternHeight = pattern0.length;
+ var bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
+ var at = [];
if (!mmr) {
at.push({
@@ -10201,8 +21241,8 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
}
- const grayScaleBitPlanes = [];
- let mmrInput, bitmap;
+ var grayScaleBitPlanes = [];
+ var mmrInput, bitmap;
if (mmr) {
mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
@@ -10218,7 +21258,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
grayScaleBitPlanes[i] = bitmap;
}
- let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
+ var mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
for (mg = 0; mg < gridHeight; mg++) {
for (ng = 0; ng < gridWidth; ng++) {
@@ -10244,7 +21284,8 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
}
} else {
- let regionX, regionY;
+ var regionX = void 0,
+ regionY = void 0;
for (i = 0; i < patternHeight; i++) {
regionY = y + i;
@@ -10304,7 +21345,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
segmentHeader.retainBits = retainBits;
- let referredToSegmentNumberSize = 4;
+ var referredToSegmentNumberSize = 4;
if (segmentHeader.number <= 256) {
referredToSegmentNumberSize = 1;
@@ -10316,7 +21357,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
var i, ii;
for (i = 0; i < referredToCount; i++) {
- let number;
+ var number = void 0;
if (referredToSegmentNumberSize === 1) {
number = data[position];
@@ -10394,7 +21435,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
position = segmentHeader.headerEnd;
var segment = {
header: segmentHeader,
- data
+ data: data
};
if (!header.randomAccess) {
@@ -10543,8 +21584,8 @@ var Jbig2Image = function Jbig2ImageClosure() {
break;
case 16:
- const patternDictionary = {};
- const patternDictionaryFlags = data[position++];
+ var patternDictionary = {};
+ var patternDictionaryFlags = data[position++];
patternDictionary.mmr = !!(patternDictionaryFlags & 1);
patternDictionary.template = patternDictionaryFlags >> 1 & 3;
patternDictionary.patternWidth = data[position++];
@@ -10556,10 +21597,10 @@ var Jbig2Image = function Jbig2ImageClosure() {
case 22:
case 23:
- const halftoneRegion = {};
+ var halftoneRegion = {};
halftoneRegion.info = readRegionSegmentInformation(data, position);
position += RegionSegmentInformationFieldLength;
- const halftoneRegionFlags = data[position++];
+ var halftoneRegionFlags = data[position++];
halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
@@ -10648,7 +21689,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
break;
default:
- throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
+ throw new Jbig2Error("segment type ".concat(header.typeName, "(").concat(header.type, ")") + " is not implemented");
}
var callbackName = "on" + header.typeName;
@@ -10677,16 +21718,16 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
function parseJbig2(data) {
- const end = data.length;
- let position = 0;
+ var end = data.length;
+ var position = 0;
if (data[position] !== 0x97 || data[position + 1] !== 0x4a || data[position + 2] !== 0x42 || data[position + 3] !== 0x32 || data[position + 4] !== 0x0d || data[position + 5] !== 0x0a || data[position + 6] !== 0x1a || data[position + 7] !== 0x0a) {
throw new Jbig2Error("parseJbig2 - invalid header.");
}
- const header = Object.create(null);
+ var header = Object.create(null);
position += 8;
- const flags = data[position++];
+ var flags = data[position++];
header.randomAccess = !(flags & 1);
if (!(flags & 2)) {
@@ -10694,23 +21735,22 @@ var Jbig2Image = function Jbig2ImageClosure() {
position += 4;
}
- const segments = readSegments(header, data, position, end);
- const visitor = new SimpleSegmentVisitor();
+ var segments = readSegments(header, data, position, end);
+ var visitor = new SimpleSegmentVisitor();
processSegments(segments, visitor);
- const {
- width,
- height
- } = visitor.currentPageInfo;
- const bitPacked = visitor.buffer;
- const imgData = new Uint8ClampedArray(width * height);
- let q = 0,
+ var _visitor$currentPageI = visitor.currentPageInfo,
+ width = _visitor$currentPageI.width,
+ height = _visitor$currentPageI.height;
+ var bitPacked = visitor.buffer;
+ var imgData = new Uint8ClampedArray(width * height);
+ var q = 0,
k = 0;
- for (let i = 0; i < height; i++) {
- let mask = 0,
- buffer;
+ for (var i = 0; i < height; i++) {
+ var mask = 0,
+ buffer = void 0;
- for (let j = 0; j < width; j++) {
+ for (var j = 0; j < width; j++) {
if (!mask) {
mask = 128;
buffer = bitPacked[k++];
@@ -10722,9 +21762,9 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
return {
- imgData,
- width,
- height
+ imgData: imgData,
+ width: width,
+ height: height
};
}
@@ -10803,7 +21843,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
break;
default:
- throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
+ throw new Jbig2Error("operator ".concat(combinationOperator, " is not supported"));
}
},
onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
@@ -10816,7 +21856,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
this.onImmediateGenericRegion.apply(this, arguments);
},
onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
- let huffmanTables, huffmanInput;
+ var huffmanTables, huffmanInput;
if (dictionary.huffman) {
huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
@@ -10832,7 +21872,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
var inputSymbols = [];
for (var i = 0, ii = referredSegments.length; i < ii; i++) {
- const referredSymbols = symbols[referredSegments[i]];
+ var referredSymbols = symbols[referredSegments[i]];
if (referredSymbols) {
inputSymbols = inputSymbols.concat(referredSymbols);
@@ -10844,12 +21884,12 @@ var Jbig2Image = function Jbig2ImageClosure() {
},
onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
var regionInfo = region.info;
- let huffmanTables, huffmanInput;
+ var huffmanTables, huffmanInput;
var symbols = this.symbols;
var inputSymbols = [];
for (var i = 0, ii = referredSegments.length; i < ii; i++) {
- const referredSymbols = symbols[referredSegments[i]];
+ var referredSymbols = symbols[referredSegments[i]];
if (referredSymbols) {
inputSymbols = inputSymbols.concat(referredSymbols);
@@ -10870,32 +21910,28 @@ var Jbig2Image = function Jbig2ImageClosure() {
onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
this.onImmediateTextRegion.apply(this, arguments);
},
-
- onPatternDictionary(dictionary, currentSegment, data, start, end) {
- let patterns = this.patterns;
+ onPatternDictionary: function onPatternDictionary(dictionary, currentSegment, data, start, end) {
+ var patterns = this.patterns;
if (!patterns) {
this.patterns = patterns = {};
}
- const decodingContext = new DecodingContext(data, start, end);
+ var decodingContext = new DecodingContext(data, start, end);
patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
},
-
- onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
- const patterns = this.patterns[referredSegments[0]];
- const regionInfo = region.info;
- const decodingContext = new DecodingContext(data, start, end);
- const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);
+ onImmediateHalftoneRegion: function onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
+ var patterns = this.patterns[referredSegments[0]];
+ var regionInfo = region.info;
+ var decodingContext = new DecodingContext(data, start, end);
+ var bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);
this.drawBitmap(regionInfo, bitmap);
},
-
- onImmediateLosslessHalftoneRegion() {
+ onImmediateLosslessHalftoneRegion: function onImmediateLosslessHalftoneRegion() {
this.onImmediateHalftoneRegion.apply(this, arguments);
},
-
- onTables(currentSegment, data, start, end) {
- let customTables = this.customTables;
+ onTables: function onTables(currentSegment, data, start, end) {
+ var customTables = this.customTables;
if (!customTables) {
this.customTables = customTables = {};
@@ -10903,7 +21939,6 @@ var Jbig2Image = function Jbig2ImageClosure() {
customTables[currentSegment] = decodeTablesSegment(data, start, end);
}
-
};
function HuffmanLine(lineData) {
@@ -10939,13 +21974,13 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
HuffmanTreeNode.prototype = {
- buildTree(line, shift) {
- const bit = line.prefixCode >> shift & 1;
+ buildTree: function buildTree(line, shift) {
+ var bit = line.prefixCode >> shift & 1;
if (shift <= 0) {
this.children[bit] = new HuffmanTreeNode(line);
} else {
- let node = this.children[bit];
+ var node = this.children[bit];
if (!node) {
this.children[bit] = node = new HuffmanTreeNode(null);
@@ -10954,18 +21989,17 @@ var Jbig2Image = function Jbig2ImageClosure() {
node.buildTree(line, shift - 1);
}
},
-
- decodeNode(reader) {
+ decodeNode: function decodeNode(reader) {
if (this.isLeaf) {
if (this.isOOB) {
return null;
}
- const htOffset = reader.readBits(this.rangeLength);
+ var htOffset = reader.readBits(this.rangeLength);
return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
}
- const node = this.children[reader.readBit()];
+ var node = this.children[reader.readBit()];
if (!node) {
throw new Jbig2Error("invalid Huffman data");
@@ -10973,7 +22007,6 @@ var Jbig2Image = function Jbig2ImageClosure() {
return node.decodeNode(reader);
}
-
};
function HuffmanTable(lines, prefixCodesDone) {
@@ -10983,8 +22016,8 @@ var Jbig2Image = function Jbig2ImageClosure() {
this.rootNode = new HuffmanTreeNode(null);
- for (let i = 0, ii = lines.length; i < ii; i++) {
- const line = lines[i];
+ for (var i = 0, ii = lines.length; i < ii; i++) {
+ var line = lines[i];
if (line.prefixLength > 0) {
this.rootNode.buildTree(line, line.prefixLength - 1);
@@ -10993,25 +22026,24 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
HuffmanTable.prototype = {
- decode(reader) {
+ decode: function decode(reader) {
return this.rootNode.decodeNode(reader);
},
+ assignPrefixCodes: function assignPrefixCodes(lines) {
+ var linesLength = lines.length;
+ var prefixLengthMax = 0;
- assignPrefixCodes(lines) {
- const linesLength = lines.length;
- let prefixLengthMax = 0;
-
- for (let i = 0; i < linesLength; i++) {
+ for (var i = 0; i < linesLength; i++) {
prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
}
- const histogram = new Uint32Array(prefixLengthMax + 1);
+ var histogram = new Uint32Array(prefixLengthMax + 1);
- for (let i = 0; i < linesLength; i++) {
- histogram[lines[i].prefixLength]++;
+ for (var _i2 = 0; _i2 < linesLength; _i2++) {
+ histogram[lines[_i2].prefixLength]++;
}
- let currentLength = 1,
+ var currentLength = 1,
firstCode = 0,
currentCode,
currentTemp,
@@ -11037,18 +22069,17 @@ var Jbig2Image = function Jbig2ImageClosure() {
currentLength++;
}
}
-
};
function decodeTablesSegment(data, start, end) {
- const flags = data[start];
- const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
- const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
- const reader = new Reader(data, start + 9, end);
- const prefixSizeBits = (flags >> 1 & 7) + 1;
- const rangeSizeBits = (flags >> 4 & 7) + 1;
- const lines = [];
- let prefixLength,
+ var flags = data[start];
+ var lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
+ var highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
+ var reader = new Reader(data, start + 9, end);
+ var prefixSizeBits = (flags >> 1 & 7) + 1;
+ var rangeSizeBits = (flags >> 4 & 7) + 1;
+ var lines = [];
+ var prefixLength,
rangeLength,
currentRangeLow = lowestValue;
@@ -11072,16 +22103,16 @@ var Jbig2Image = function Jbig2ImageClosure() {
return new HuffmanTable(lines, false);
}
- const standardTablesCache = {};
+ var standardTablesCache = {};
function getStandardTable(number) {
- let table = standardTablesCache[number];
+ var table = standardTablesCache[number];
if (table) {
return table;
}
- let lines;
+ var lines;
switch (number) {
case 1:
@@ -11145,10 +22176,10 @@ var Jbig2Image = function Jbig2ImageClosure() {
break;
default:
- throw new Jbig2Error(`standard table B.${number} does not exist`);
+ throw new Jbig2Error("standard table B.".concat(number, " does not exist"));
}
- for (let i = 0, ii = lines.length; i < ii; i++) {
+ for (var i = 0, ii = lines.length; i < ii; i++) {
lines[i] = new HuffmanLine(lines[i]);
}
@@ -11167,7 +22198,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
Reader.prototype = {
- readBit() {
+ readBit: function readBit() {
if (this.shift < 0) {
if (this.position >= this.end) {
throw new Jbig2Error("end of data while reading bit");
@@ -11177,13 +22208,12 @@ var Jbig2Image = function Jbig2ImageClosure() {
this.shift = 7;
}
- const bit = this.currentByte >> this.shift & 1;
+ var bit = this.currentByte >> this.shift & 1;
this.shift--;
return bit;
},
-
- readBits(numBits) {
- let result = 0,
+ readBits: function readBits(numBits) {
+ var result = 0,
i;
for (i = numBits - 1; i >= 0; i--) {
@@ -11192,26 +22222,23 @@ var Jbig2Image = function Jbig2ImageClosure() {
return result;
},
-
- byteAlign() {
+ byteAlign: function byteAlign() {
this.shift = -1;
},
-
- next() {
+ next: function next() {
if (this.position >= this.end) {
return -1;
}
return this.data[this.position++];
}
-
};
function getCustomHuffmanTable(index, referredTo, customTables) {
- let currentIndex = 0;
+ var currentIndex = 0;
- for (let i = 0, ii = referredTo.length; i < ii; i++) {
- const table = customTables[referredTo[i]];
+ for (var i = 0, ii = referredTo.length; i < ii; i++) {
+ var table = customTables[referredTo[i]];
if (table) {
if (index === currentIndex) {
@@ -11226,30 +22253,32 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
- const codes = [];
+ var codes = [];
- for (let i = 0; i <= 34; i++) {
- const codeLength = reader.readBits(4);
+ for (var i = 0; i <= 34; i++) {
+ var codeLength = reader.readBits(4);
codes.push(new HuffmanLine([i, codeLength, 0, 0]));
}
- const runCodesTable = new HuffmanTable(codes, false);
+ var runCodesTable = new HuffmanTable(codes, false);
codes.length = 0;
- for (let i = 0; i < numberOfSymbols;) {
- const codeLength = runCodesTable.decode(reader);
+ for (var _i3 = 0; _i3 < numberOfSymbols;) {
+ var _codeLength = runCodesTable.decode(reader);
- if (codeLength >= 32) {
- let repeatedLength, numberOfRepeats, j;
+ if (_codeLength >= 32) {
+ var repeatedLength = void 0,
+ numberOfRepeats = void 0,
+ j = void 0;
- switch (codeLength) {
+ switch (_codeLength) {
case 32:
- if (i === 0) {
+ if (_i3 === 0) {
throw new Jbig2Error("no previous value in symbol ID table");
}
numberOfRepeats = reader.readBits(2) + 3;
- repeatedLength = codes[i - 1].prefixLength;
+ repeatedLength = codes[_i3 - 1].prefixLength;
break;
case 33:
@@ -11267,18 +22296,18 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
for (j = 0; j < numberOfRepeats; j++) {
- codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
- i++;
+ codes.push(new HuffmanLine([_i3, repeatedLength, 0, 0]));
+ _i3++;
}
} else {
- codes.push(new HuffmanLine([i, codeLength, 0, 0]));
- i++;
+ codes.push(new HuffmanLine([_i3, _codeLength, 0, 0]));
+ _i3++;
}
}
reader.byteAlign();
- const symbolIDTable = new HuffmanTable(codes, false);
- let customIndex = 0,
+ var symbolIDTable = new HuffmanTable(codes, false);
+ var customIndex = 0,
tableFirstS,
tableDeltaS,
tableDeltaT;
@@ -11335,15 +22364,15 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
return {
- symbolIDTable,
- tableFirstS,
- tableDeltaS,
- tableDeltaT
+ symbolIDTable: symbolIDTable,
+ tableFirstS: tableFirstS,
+ tableDeltaS: tableDeltaS,
+ tableDeltaT: tableDeltaT
};
}
function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
- let customIndex = 0,
+ var customIndex = 0,
tableDeltaHeight,
tableDeltaWidth;
@@ -11377,7 +22406,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
throw new Jbig2Error("invalid Huffman DW selector");
}
- let tableBitmapSize, tableAggregateInstances;
+ var tableBitmapSize, tableAggregateInstances;
if (dictionary.bitmapSizeSelector) {
tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
@@ -11393,21 +22422,21 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
return {
- tableDeltaHeight,
- tableDeltaWidth,
- tableBitmapSize,
- tableAggregateInstances
+ tableDeltaHeight: tableDeltaHeight,
+ tableDeltaWidth: tableDeltaWidth,
+ tableBitmapSize: tableBitmapSize,
+ tableAggregateInstances: tableAggregateInstances
};
}
function readUncompressedBitmap(reader, width, height) {
- const bitmap = [];
+ var bitmap = [];
- for (let y = 0; y < height; y++) {
- const row = new Uint8Array(width);
+ for (var y = 0; y < height; y++) {
+ var row = new Uint8Array(width);
bitmap.push(row);
- for (let x = 0; x < width; x++) {
+ for (var x = 0; x < width; x++) {
row[x] = reader.readBit();
}
@@ -11418,24 +22447,24 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
function decodeMMRBitmap(input, width, height, endOfBlock) {
- const params = {
+ var params = {
K: -1,
Columns: width,
Rows: height,
BlackIs1: true,
EndOfBlock: endOfBlock
};
- const decoder = new _ccitt.CCITTFaxDecoder(input, params);
- const bitmap = [];
- let currentByte,
+ var decoder = new _ccitt.CCITTFaxDecoder(input, params);
+ var bitmap = [];
+ var currentByte,
eof = false;
- for (let y = 0; y < height; y++) {
- const row = new Uint8Array(width);
+ for (var y = 0; y < height; y++) {
+ var row = new Uint8Array(width);
bitmap.push(row);
- let shift = -1;
+ var shift = -1;
- for (let x = 0; x < width; x++) {
+ for (var x = 0; x < width; x++) {
if (shift < 0) {
currentByte = decoder.readNextChar();
@@ -11453,9 +22482,9 @@ var Jbig2Image = function Jbig2ImageClosure() {
}
if (endOfBlock && !eof) {
- const lookForEOFLimit = 5;
+ var lookForEOFLimit = 5;
- for (let i = 0; i < lookForEOFLimit; i++) {
+ for (var i = 0; i < lookForEOFLimit; i++) {
if (decoder.readNextChar() === -1) {
break;
}
@@ -11468,21 +22497,19 @@ var Jbig2Image = function Jbig2ImageClosure() {
function Jbig2Image() {}
Jbig2Image.prototype = {
- parseChunks(chunks) {
+ parseChunks: function parseChunks(chunks) {
return parseJbig2Chunks(chunks);
},
+ parse: function parse(data) {
+ var _parseJbig = parseJbig2(data),
+ imgData = _parseJbig.imgData,
+ width = _parseJbig.width,
+ height = _parseJbig.height;
- parse(data) {
- const {
- imgData,
- width,
- height
- } = parseJbig2(data);
this.width = width;
this.height = height;
return imgData;
}
-
};
return Jbig2Image;
}();
@@ -11490,7 +22517,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
exports.Jbig2Image = Jbig2Image;
/***/ }),
-/* 17 */
+/* 210 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -11500,7 +22527,14 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ArithmeticDecoder = void 0;
-const QeTable = [{
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var QeTable = [{
qe: 0x5601,
nmps: 1,
nlps: 1,
@@ -11737,8 +22771,10 @@ const QeTable = [{
switchFlag: 0
}];
-class ArithmeticDecoder {
- constructor(data, start, end) {
+var ArithmeticDecoder = /*#__PURE__*/function () {
+ function ArithmeticDecoder(data, start, end) {
+ _classCallCheck(this, ArithmeticDecoder);
+
this.data = data;
this.bp = start;
this.dataEnd = end;
@@ -11751,100 +22787,105 @@ class ArithmeticDecoder {
this.a = 0x8000;
}
- byteIn() {
- const data = this.data;
- let bp = this.bp;
+ _createClass(ArithmeticDecoder, [{
+ key: "byteIn",
+ value: function byteIn() {
+ var data = this.data;
+ var bp = this.bp;
- if (data[bp] === 0xff) {
- if (data[bp + 1] > 0x8f) {
- this.clow += 0xff00;
- this.ct = 8;
+ if (data[bp] === 0xff) {
+ if (data[bp + 1] > 0x8f) {
+ this.clow += 0xff00;
+ this.ct = 8;
+ } else {
+ bp++;
+ this.clow += data[bp] << 9;
+ this.ct = 7;
+ this.bp = bp;
+ }
} else {
bp++;
- this.clow += data[bp] << 9;
- this.ct = 7;
+ this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
+ this.ct = 8;
this.bp = bp;
}
- } else {
- bp++;
- this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
- this.ct = 8;
- this.bp = bp;
- }
- if (this.clow > 0xffff) {
- this.chigh += this.clow >> 16;
- this.clow &= 0xffff;
+ if (this.clow > 0xffff) {
+ this.chigh += this.clow >> 16;
+ this.clow &= 0xffff;
+ }
}
- }
+ }, {
+ key: "readBit",
+ value: function readBit(contexts, pos) {
+ var cx_index = contexts[pos] >> 1,
+ cx_mps = contexts[pos] & 1;
+ var qeTableIcx = QeTable[cx_index];
+ var qeIcx = qeTableIcx.qe;
+ var d;
+ var a = this.a - qeIcx;
+
+ if (this.chigh < qeIcx) {
+ if (a < qeIcx) {
+ a = qeIcx;
+ d = cx_mps;
+ cx_index = qeTableIcx.nmps;
+ } else {
+ a = qeIcx;
+ d = 1 ^ cx_mps;
- readBit(contexts, pos) {
- let cx_index = contexts[pos] >> 1,
- cx_mps = contexts[pos] & 1;
- const qeTableIcx = QeTable[cx_index];
- const qeIcx = qeTableIcx.qe;
- let d;
- let a = this.a - qeIcx;
+ if (qeTableIcx.switchFlag === 1) {
+ cx_mps = d;
+ }
- if (this.chigh < qeIcx) {
- if (a < qeIcx) {
- a = qeIcx;
- d = cx_mps;
- cx_index = qeTableIcx.nmps;
+ cx_index = qeTableIcx.nlps;
+ }
} else {
- a = qeIcx;
- d = 1 ^ cx_mps;
+ this.chigh -= qeIcx;
- if (qeTableIcx.switchFlag === 1) {
- cx_mps = d;
+ if ((a & 0x8000) !== 0) {
+ this.a = a;
+ return cx_mps;
}
- cx_index = qeTableIcx.nlps;
- }
- } else {
- this.chigh -= qeIcx;
+ if (a < qeIcx) {
+ d = 1 ^ cx_mps;
- if ((a & 0x8000) !== 0) {
- this.a = a;
- return cx_mps;
- }
-
- if (a < qeIcx) {
- d = 1 ^ cx_mps;
+ if (qeTableIcx.switchFlag === 1) {
+ cx_mps = d;
+ }
- if (qeTableIcx.switchFlag === 1) {
- cx_mps = d;
+ cx_index = qeTableIcx.nlps;
+ } else {
+ d = cx_mps;
+ cx_index = qeTableIcx.nmps;
}
-
- cx_index = qeTableIcx.nlps;
- } else {
- d = cx_mps;
- cx_index = qeTableIcx.nmps;
}
- }
- do {
- if (this.ct === 0) {
- this.byteIn();
- }
+ do {
+ if (this.ct === 0) {
+ this.byteIn();
+ }
- a <<= 1;
- this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
- this.clow = this.clow << 1 & 0xffff;
- this.ct--;
- } while ((a & 0x8000) === 0);
+ a <<= 1;
+ this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
+ this.clow = this.clow << 1 & 0xffff;
+ this.ct--;
+ } while ((a & 0x8000) === 0);
- this.a = a;
- contexts[pos] = cx_index << 1 | cx_mps;
- return d;
- }
+ this.a = a;
+ contexts[pos] = cx_index << 1 | cx_mps;
+ return d;
+ }
+ }]);
-}
+ return ArithmeticDecoder;
+}();
exports.ArithmeticDecoder = ArithmeticDecoder;
/***/ }),
-/* 18 */
+/* 211 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -11855,17 +22896,17 @@ Object.defineProperty(exports, "__esModule", {
});
exports.JpegStream = void 0;
-var _stream = __w_pdfjs_require__(12);
+var _stream = __w_pdfjs_require__(205);
-var _primitives = __w_pdfjs_require__(5);
+var _primitives = __w_pdfjs_require__(198);
-var _jpg = __w_pdfjs_require__(19);
+var _jpg = __w_pdfjs_require__(212);
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
-const JpegStream = function JpegStreamClosure() {
+var JpegStream = function JpegStreamClosure() {
function JpegStream(stream, maybeLength, dict, params) {
- let ch;
+ var ch;
while ((ch = stream.getByte()) !== -1) {
if (ch === 0xff) {
@@ -11897,20 +22938,20 @@ const JpegStream = function JpegStreamClosure() {
return;
}
- const jpegOptions = {
+ var jpegOptions = {
decodeTransform: undefined,
colorTransform: undefined
};
- const decodeArr = this.dict.getArray("Decode", "D");
+ var decodeArr = this.dict.getArray("Decode", "D");
if (this.forceRGB && Array.isArray(decodeArr)) {
- const bitsPerComponent = this.dict.get("BitsPerComponent") || 8;
- const decodeArrLength = decodeArr.length;
- const transform = new Int32Array(decodeArrLength);
- let transformNeeded = false;
- const maxValue = (1 << bitsPerComponent) - 1;
+ var bitsPerComponent = this.dict.get("BitsPerComponent") || 8;
+ var decodeArrLength = decodeArr.length;
+ var transform = new Int32Array(decodeArrLength);
+ var transformNeeded = false;
+ var maxValue = (1 << bitsPerComponent) - 1;
- for (let i = 0; i < decodeArrLength; i += 2) {
+ for (var i = 0; i < decodeArrLength; i += 2) {
transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
transform[i + 1] = decodeArr[i] * maxValue | 0;
@@ -11925,16 +22966,16 @@ const JpegStream = function JpegStreamClosure() {
}
if ((0, _primitives.isDict)(this.params)) {
- const colorTransform = this.params.get("ColorTransform");
+ var colorTransform = this.params.get("ColorTransform");
if (Number.isInteger(colorTransform)) {
jpegOptions.colorTransform = colorTransform;
}
}
- const jpegImage = new _jpg.JpegImage(jpegOptions);
+ var jpegImage = new _jpg.JpegImage(jpegOptions);
jpegImage.parse(this.bytes);
- const data = jpegImage.getData({
+ var data = jpegImage.getData({
width: this.drawWidth,
height: this.drawHeight,
forceRGB: this.forceRGB,
@@ -11951,7 +22992,7 @@ const JpegStream = function JpegStreamClosure() {
exports.JpegStream = JpegStream;
/***/ }),
-/* 19 */
+/* 212 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -11962,26 +23003,73 @@ Object.defineProperty(exports, "__esModule", {
});
exports.JpegImage = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+var _core_utils = __w_pdfjs_require__(201);
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
-var _core_utils = __w_pdfjs_require__(8);
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
-class JpegError extends _util.BaseException {
- constructor(msg) {
- super(`JPEG error: ${msg}`);
+var JpegError = /*#__PURE__*/function (_BaseException) {
+ _inherits(JpegError, _BaseException);
+
+ var _super = _createSuper(JpegError);
+
+ function JpegError(msg) {
+ _classCallCheck(this, JpegError);
+
+ return _super.call(this, "JPEG error: ".concat(msg));
}
-}
+ return JpegError;
+}(_util.BaseException);
+
+var DNLMarkerError = /*#__PURE__*/function (_BaseException2) {
+ _inherits(DNLMarkerError, _BaseException2);
+
+ var _super2 = _createSuper(DNLMarkerError);
+
+ function DNLMarkerError(message, scanLines) {
+ var _this;
-class DNLMarkerError extends _util.BaseException {
- constructor(message, scanLines) {
- super(message);
- this.scanLines = scanLines;
+ _classCallCheck(this, DNLMarkerError);
+
+ _this = _super2.call(this, message);
+ _this.scanLines = scanLines;
+ return _this;
}
-}
+ return DNLMarkerError;
+}(_util.BaseException);
+
+var EOIMarkerError = /*#__PURE__*/function (_BaseException3) {
+ _inherits(EOIMarkerError, _BaseException3);
+
+ var _super3 = _createSuper(EOIMarkerError);
+
+ function EOIMarkerError() {
+ _classCallCheck(this, EOIMarkerError);
+
+ return _super3.apply(this, arguments);
+ }
-class EOIMarkerError extends _util.BaseException {}
+ return EOIMarkerError;
+}(_util.BaseException);
var JpegImage = function JpegImageClosure() {
var dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
@@ -11994,10 +23082,13 @@ var JpegImage = function JpegImageClosure() {
var dctSqrt2 = 5793;
var dctSqrt1d2 = 2896;
- function JpegImage({
- decodeTransform = null,
- colorTransform = -1
- } = {}) {
+ function JpegImage() {
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
+ _ref$decodeTransform = _ref.decodeTransform,
+ decodeTransform = _ref$decodeTransform === void 0 ? null : _ref$decodeTransform,
+ _ref$colorTransform = _ref.colorTransform,
+ colorTransform = _ref$colorTransform === void 0 ? -1 : _ref$colorTransform;
+
this._decodeTransform = decodeTransform;
this._colorTransform = colorTransform;
}
@@ -12061,11 +23152,12 @@ var JpegImage = function JpegImageClosure() {
return 64 * ((component.blocksPerLine + 1) * row + col);
}
- function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
+ function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
+ var parseDNLMarker = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
var mcusPerLine = frame.mcusPerLine;
var progressive = frame.progressive;
- const startOffset = offset;
- let bitsData = 0,
+ var startOffset = offset;
+ var bitsData = 0,
bitsCount = 0;
function readBit() {
@@ -12082,7 +23174,7 @@ var JpegImage = function JpegImageClosure() {
if (nextByte) {
if (nextByte === 0xdc && parseDNLMarker) {
offset += 2;
- const scanLines = (0, _core_utils.readUint16)(data, offset);
+ var scanLines = (0, _core_utils.readUint16)(data, offset);
offset += 2;
if (scanLines > 0 && scanLines !== frame.scanLines) {
@@ -12090,7 +23182,7 @@ var JpegImage = function JpegImageClosure() {
}
} else if (nextByte === 0xd9) {
if (parseDNLMarker) {
- const maybeScanLines = blockRow * 8;
+ var maybeScanLines = blockRow * 8;
if (maybeScanLines > 0 && maybeScanLines < frame.scanLines / 10) {
throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
@@ -12100,7 +23192,7 @@ var JpegImage = function JpegImageClosure() {
throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
}
- throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
+ throw new JpegError("unexpected marker ".concat((bitsData << 8 | nextByte).toString(16)));
}
}
@@ -12114,7 +23206,7 @@ var JpegImage = function JpegImageClosure() {
while (true) {
node = node[readBit()];
- switch (typeof node) {
+ switch (_typeof(node)) {
case "number":
return node;
@@ -12232,8 +23324,8 @@ var JpegImage = function JpegImageClosure() {
var rs;
while (k <= e) {
- const offsetZ = blockOffset + dctZigZag[k];
- const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
+ var offsetZ = blockOffset + dctZigZag[k];
+ var sign = component.blockData[offsetZ] < 0 ? -1 : 1;
switch (successiveACState) {
case 0:
@@ -12304,21 +23396,21 @@ var JpegImage = function JpegImageClosure() {
}
}
- let blockRow = 0;
+ var blockRow = 0;
function decodeMcu(component, decode, mcu, row, col) {
var mcuRow = mcu / mcusPerLine | 0;
var mcuCol = mcu % mcusPerLine;
blockRow = mcuRow * component.v + row;
var blockCol = mcuCol * component.h + col;
- const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
+ var blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
decode(component, blockOffset);
}
function decodeBlock(component, decode, mcu) {
blockRow = mcu / component.blocksPerLine | 0;
var blockCol = mcu % component.blocksPerLine;
- const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
+ var blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
decode(component, blockOffset);
}
@@ -12392,8 +23484,8 @@ var JpegImage = function JpegImageClosure() {
}
if (fileMarker.invalid) {
- const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
- (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
+ var partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
+ (0, _util.warn)("decodeScan - ".concat(partialMsg, " MCU data, current marker is: ").concat(fileMarker.invalid));
offset = fileMarker.offset;
}
@@ -12644,8 +23736,9 @@ var JpegImage = function JpegImageClosure() {
return component.blockData;
}
- function findNextFileMarker(data, currentPos, startPos = currentPos) {
- const maxPos = data.length - 1;
+ function findNextFileMarker(data, currentPos) {
+ var startPos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentPos;
+ var maxPos = data.length - 1;
var newPos = startPos < currentPos ? startPos : currentPos;
if (currentPos >= maxPos) {
@@ -12680,13 +23773,15 @@ var JpegImage = function JpegImageClosure() {
}
JpegImage.prototype = {
- parse(data, {
- dnlScanLines = null
- } = {}) {
+ parse: function parse(data) {
+ var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
+ _ref2$dnlScanLines = _ref2.dnlScanLines,
+ dnlScanLines = _ref2$dnlScanLines === void 0 ? null : _ref2$dnlScanLines;
+
function readDataBlock() {
- const length = (0, _core_utils.readUint16)(data, offset);
+ var length = (0, _core_utils.readUint16)(data, offset);
offset += 2;
- let endOffset = offset + length - 2;
+ var endOffset = offset + length - 2;
var fileMarker = findNextFileMarker(data, endOffset, offset);
if (fileMarker && fileMarker.invalid) {
@@ -12723,11 +23818,11 @@ var JpegImage = function JpegImageClosure() {
var jfif = null;
var adobe = null;
var frame, resetInterval;
- let numSOSMarkers = 0;
+ var numSOSMarkers = 0;
var quantizationTables = [];
var huffmanTablesAC = [],
huffmanTablesDC = [];
- let fileMarker = (0, _core_utils.readUint16)(data, offset);
+ var fileMarker = (0, _core_utils.readUint16)(data, offset);
offset += 2;
if (fileMarker !== 0xffd8) {
@@ -12791,7 +23886,7 @@ var JpegImage = function JpegImageClosure() {
break;
case 0xffdb:
- const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
+ var quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
offset += 2;
var quantizationTablesEnd = quantizationTablesLength + offset - 2;
var z;
@@ -12832,7 +23927,7 @@ var JpegImage = function JpegImageClosure() {
frame.extended = fileMarker === 0xffc1;
frame.progressive = fileMarker === 0xffc2;
frame.precision = data[offset++];
- const sofScanLines = (0, _core_utils.readUint16)(data, offset);
+ var sofScanLines = (0, _core_utils.readUint16)(data, offset);
offset += 2;
frame.scanLines = dnlScanLines || sofScanLines;
frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
@@ -12859,8 +23954,8 @@ var JpegImage = function JpegImageClosure() {
var qId = data[offset + 2];
l = frame.components.push({
- h,
- v,
+ h: h,
+ v: v,
quantizationId: qId,
quantizationTable: null
});
@@ -12874,7 +23969,7 @@ var JpegImage = function JpegImageClosure() {
break;
case 0xffc4:
- const huffmanLength = (0, _core_utils.readUint16)(data, offset);
+ var huffmanLength = (0, _core_utils.readUint16)(data, offset);
offset += 2;
for (i = 2; i < huffmanLength;) {
@@ -12905,7 +24000,7 @@ var JpegImage = function JpegImageClosure() {
break;
case 0xffda:
- const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
+ var parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
offset += 2;
var selectorsCount = data[offset++];
var components = [],
@@ -12929,12 +24024,12 @@ var JpegImage = function JpegImageClosure() {
offset += processed;
} catch (ex) {
if (ex instanceof DNLMarkerError) {
- (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
+ (0, _util.warn)("".concat(ex.message, " -- attempting to re-parse the JPEG image."));
return this.parse(data, {
dnlScanLines: ex.scanLines
});
} else if (ex instanceof EOIMarkerError) {
- (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
+ (0, _util.warn)("".concat(ex.message, " -- ignoring the rest of the image data."));
break markerLoop;
}
@@ -12955,7 +24050,7 @@ var JpegImage = function JpegImageClosure() {
break;
default:
- const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
+ var nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
if (nextFileMarker && nextFileMarker.invalid) {
(0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
@@ -13001,8 +24096,8 @@ var JpegImage = function JpegImageClosure() {
this.numComponents = this.components.length;
return undefined;
},
-
- _getLinearizedBlockData(width, height, isSourcePDF = false) {
+ _getLinearizedBlockData: function _getLinearizedBlockData(width, height) {
+ var isSourcePDF = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var scaleX = this.width / width,
scaleY = this.height / height;
var component, componentScaleX, componentScaleY, blocksPerScanline;
@@ -13015,7 +24110,7 @@ var JpegImage = function JpegImageClosure() {
var data = new Uint8ClampedArray(dataLength);
var xScaleBlockOffset = new Uint32Array(width);
var mask3LSB = 0xfffffff8;
- let lastComponentScaleX;
+ var lastComponentScaleX;
for (i = 0; i < numComponents; i++) {
component = this.components[i];
@@ -13045,7 +24140,7 @@ var JpegImage = function JpegImageClosure() {
}
}
- let transform = this._decodeTransform;
+ var transform = this._decodeTransform;
if (!isSourcePDF && numComponents === 4 && !transform) {
transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
@@ -13142,13 +24237,14 @@ var JpegImage = function JpegImageClosure() {
return data.subarray(0, offset);
},
+ getData: function getData(_ref3) {
+ var width = _ref3.width,
+ height = _ref3.height,
+ _ref3$forceRGB = _ref3.forceRGB,
+ forceRGB = _ref3$forceRGB === void 0 ? false : _ref3$forceRGB,
+ _ref3$isSourcePDF = _ref3.isSourcePDF,
+ isSourcePDF = _ref3$isSourcePDF === void 0 ? false : _ref3$isSourcePDF;
- getData({
- width,
- height,
- forceRGB = false,
- isSourcePDF = false
- }) {
if (this.numComponents > 4) {
throw new JpegError("Unsupported color mode");
}
@@ -13184,7 +24280,6 @@ var JpegImage = function JpegImageClosure() {
return data;
}
-
};
return JpegImage;
}();
@@ -13192,7 +24287,7 @@ var JpegImage = function JpegImageClosure() {
exports.JpegImage = JpegImage;
/***/ }),
-/* 20 */
+/* 213 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -13203,13 +24298,13 @@ Object.defineProperty(exports, "__esModule", {
});
exports.JpxStream = void 0;
-var _stream = __w_pdfjs_require__(12);
+var _stream = __w_pdfjs_require__(205);
-var _jpx = __w_pdfjs_require__(21);
+var _jpx = __w_pdfjs_require__(214);
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
-const JpxStream = function JpxStreamClosure() {
+var JpxStream = function JpxStreamClosure() {
function JpxStream(stream, maybeLength, dict, params) {
this.stream = stream;
this.maybeLength = maybeLength;
@@ -13234,32 +24329,32 @@ const JpxStream = function JpxStreamClosure() {
return;
}
- const jpxImage = new _jpx.JpxImage();
+ var jpxImage = new _jpx.JpxImage();
jpxImage.parse(this.bytes);
- const width = jpxImage.width;
- const height = jpxImage.height;
- const componentsCount = jpxImage.componentsCount;
- const tileCount = jpxImage.tiles.length;
+ var width = jpxImage.width;
+ var height = jpxImage.height;
+ var componentsCount = jpxImage.componentsCount;
+ var tileCount = jpxImage.tiles.length;
if (tileCount === 1) {
this.buffer = jpxImage.tiles[0].items;
} else {
- const data = new Uint8ClampedArray(width * height * componentsCount);
-
- for (let k = 0; k < tileCount; k++) {
- const tileComponents = jpxImage.tiles[k];
- const tileWidth = tileComponents.width;
- const tileHeight = tileComponents.height;
- const tileLeft = tileComponents.left;
- const tileTop = tileComponents.top;
- const src = tileComponents.items;
- let srcPosition = 0;
- let dataPosition = (width * tileTop + tileLeft) * componentsCount;
- const imgRowSize = width * componentsCount;
- const tileRowSize = tileWidth * componentsCount;
-
- for (let j = 0; j < tileHeight; j++) {
- const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
+ var data = new Uint8ClampedArray(width * height * componentsCount);
+
+ for (var k = 0; k < tileCount; k++) {
+ var tileComponents = jpxImage.tiles[k];
+ var tileWidth = tileComponents.width;
+ var tileHeight = tileComponents.height;
+ var tileLeft = tileComponents.left;
+ var tileTop = tileComponents.top;
+ var src = tileComponents.items;
+ var srcPosition = 0;
+ var dataPosition = (width * tileTop + tileLeft) * componentsCount;
+ var imgRowSize = width * componentsCount;
+ var tileRowSize = tileWidth * componentsCount;
+
+ for (var j = 0; j < tileHeight; j++) {
+ var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
data.set(rowBytes, dataPosition);
srcPosition += tileRowSize;
dataPosition += imgRowSize;
@@ -13279,7 +24374,7 @@ const JpxStream = function JpxStreamClosure() {
exports.JpxStream = JpxStream;
/***/ }),
-/* 21 */
+/* 214 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -13290,18 +24385,43 @@ Object.defineProperty(exports, "__esModule", {
});
exports.JpxImage = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+var _core_utils = __w_pdfjs_require__(201);
+
+var _arithmetic_decoder = __w_pdfjs_require__(210);
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
-var _core_utils = __w_pdfjs_require__(8);
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
-var _arithmetic_decoder = __w_pdfjs_require__(17);
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
-class JpxError extends _util.BaseException {
- constructor(msg) {
- super(`JPX error: ${msg}`);
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+var JpxError = /*#__PURE__*/function (_BaseException) {
+ _inherits(JpxError, _BaseException);
+
+ var _super = _createSuper(JpxError);
+
+ function JpxError(msg) {
+ _classCallCheck(this, JpxError);
+
+ return _super.call(this, "JPX error: ".concat(msg));
}
-}
+ return JpxError;
+}(_util.BaseException);
var JpxImage = function JpxImageClosure() {
var SubbandsGainLog2 = {
@@ -13829,13 +24949,13 @@ var JpxImage = function JpxImageClosure() {
var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
var numprecincts = numprecinctswide * numprecinctshigh;
resolution.precinctParameters = {
- precinctWidth,
- precinctHeight,
- numprecinctswide,
- numprecinctshigh,
- numprecincts,
- precinctWidthInSubband,
- precinctHeightInSubband
+ precinctWidth: precinctWidth,
+ precinctHeight: precinctHeight,
+ numprecinctswide: numprecinctswide,
+ numprecinctshigh: numprecinctshigh,
+ numprecincts: numprecincts,
+ precinctWidthInSubband: precinctWidthInSubband,
+ precinctHeightInSubband: precinctHeightInSubband
};
}
@@ -13936,7 +25056,7 @@ var JpxImage = function JpxImageClosure() {
}
return {
- layerNumber,
+ layerNumber: layerNumber,
codeblocks: precinctCodeblocks
};
}
@@ -14049,7 +25169,7 @@ var JpxImage = function JpxImageClosure() {
var maxDecompositionLevelsCount = 0;
for (c = 0; c < componentsCount; c++) {
- const component = tile.components[c];
+ var component = tile.components[c];
maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
}
@@ -14078,13 +25198,13 @@ var JpxImage = function JpxImageClosure() {
for (; r <= maxDecompositionLevelsCount; r++) {
for (; p < maxNumPrecinctsInLevel[r]; p++) {
for (; c < componentsCount; c++) {
- const component = tile.components[c];
+ var _component = tile.components[c];
- if (r > component.codingStyleParameters.decompositionLevelsCount) {
+ if (r > _component.codingStyleParameters.decompositionLevelsCount) {
continue;
}
- var resolution = component.resolutions[r];
+ var resolution = _component.resolutions[r];
var numprecincts = resolution.precinctParameters.numprecincts;
if (p >= numprecincts) {
@@ -14274,10 +25394,10 @@ var JpxImage = function JpxImageClosure() {
return {
components: sizePerComponent,
- minWidth,
- minHeight,
- maxNumWide,
- maxNumHigh
+ minWidth: minWidth,
+ minHeight: minHeight,
+ maxNumWide: maxNumWide,
+ maxNumHigh: maxNumHigh
};
}
@@ -14382,7 +25502,7 @@ var JpxImage = function JpxImageClosure() {
break;
default:
- throw new JpxError(`Unsupported progression order ${progressionOrder}`);
+ throw new JpxError("Unsupported progression order ".concat(progressionOrder));
}
}
@@ -14565,8 +25685,8 @@ var JpxImage = function JpxImageClosure() {
var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
var codedDataLength = readBits(bits);
queue.push({
- codeblock,
- codingpasses,
+ codeblock: codeblock,
+ codingpasses: codingpasses,
dataLength: codedDataLength
});
}
@@ -14586,7 +25706,7 @@ var JpxImage = function JpxImageClosure() {
}
codeblock.data.push({
- data,
+ data: data,
start: offset + position,
end: offset + position + packetItem.dataLength,
codingpasses: packetItem.codingpasses
@@ -14746,14 +25866,14 @@ var JpxImage = function JpxImageClosure() {
var subband = resolution.subbands[j];
var gainLog2 = SubbandsGainLog2[subband.type];
- var delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
+ var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
var mb = guardBits + epsilon - 1;
copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
}
subbandCoefficients.push({
- width,
- height,
+ width: width,
+ height: height,
items: coefficients
});
}
@@ -14826,7 +25946,7 @@ var JpxImage = function JpxImageClosure() {
y0 = y0items[j] + offset;
y1 = y1items[j];
y2 = y2items[j];
- const g = y0 - (y2 + y1 >> 2);
+ var g = y0 - (y2 + y1 >> 2);
out[pos++] = g + y2 >> shift;
out[pos++] = g >> shift;
out[pos++] = g + y1 >> shift;
@@ -14880,8 +26000,8 @@ var JpxImage = function JpxImageClosure() {
for (var i = 0; i < levelsLength; i++) {
var level = {
- width,
- height,
+ width: width,
+ height: height,
items: []
};
this.levels.push(level);
@@ -14954,9 +26074,9 @@ var JpxImage = function JpxImageClosure() {
}
var level = {
- width,
- height,
- items
+ width: width,
+ height: height,
+ items: items
};
this.levels.push(level);
width = Math.ceil(width / 2);
@@ -15037,7 +26157,7 @@ var JpxImage = function JpxImageClosure() {
function BitModel(width, height, subband, zeroBitPlanes, mb) {
this.width = width;
this.height = height;
- let contextLabelTable;
+ var contextLabelTable;
if (subband === "HH") {
contextLabelTable = HHContextLabel;
@@ -15051,7 +26171,7 @@ var JpxImage = function JpxImageClosure() {
var coefficientCount = width * height;
this.neighborsSignificance = new Uint8Array(coefficientCount);
this.coefficentsSign = new Uint8Array(coefficientCount);
- let coefficentsMagnitude;
+ var coefficentsMagnitude;
if (mb > 14) {
coefficentsMagnitude = new Uint32Array(coefficientCount);
@@ -15483,9 +26603,9 @@ var JpxImage = function JpxImageClosure() {
}
return {
- width,
- height,
- items
+ width: width,
+ height: height,
+ items: items
};
};
@@ -15615,7 +26735,7 @@ var JpxImage = function JpxImageClosure() {
exports.JpxImage = JpxImage;
/***/ }),
-/* 22 */
+/* 215 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -15626,11 +26746,33 @@ Object.defineProperty(exports, "__esModule", {
});
exports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+var _primitives = __w_pdfjs_require__(198);
+
+var _stream = __w_pdfjs_require__(205);
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
-var _primitives = __w_pdfjs_require__(5);
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
-var _stream = __w_pdfjs_require__(12);
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var ARCFourCipher = function ARCFourCipherClosure() {
function ARCFourCipher(key) {
@@ -16227,8 +27369,10 @@ var NullCipher = function NullCipherClosure() {
return NullCipher;
}();
-class AESBaseCipher {
- constructor() {
+var AESBaseCipher = /*#__PURE__*/function () {
+ function AESBaseCipher() {
+ _classCallCheck(this, AESBaseCipher);
+
if (this.constructor === AESBaseCipher) {
(0, _util.unreachable)("Cannot initialize AESBaseCipher.");
}
@@ -16238,7 +27382,7 @@ class AESBaseCipher {
this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]);
this._mixCol = new Uint8Array(256);
- for (let i = 0; i < 256; i++) {
+ for (var i = 0; i < 256; i++) {
if (i < 128) {
this._mixCol[i] = i << 1;
} else {
@@ -16250,20 +27394,63 @@ class AESBaseCipher {
this.bufferPosition = 0;
}
- _expandKey(cipherKey) {
- (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
- }
+ _createClass(AESBaseCipher, [{
+ key: "_expandKey",
+ value: function _expandKey(cipherKey) {
+ (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
+ }
+ }, {
+ key: "_decrypt",
+ value: function _decrypt(input, key) {
+ var t, u, v;
+ var state = new Uint8Array(16);
+ state.set(input);
- _decrypt(input, key) {
- let t, u, v;
- const state = new Uint8Array(16);
- state.set(input);
+ for (var j = 0, k = this._keySize; j < 16; ++j, ++k) {
+ state[j] ^= key[k];
+ }
- for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
- state[j] ^= key[k];
- }
+ for (var i = this._cyclesOfRepetition - 1; i >= 1; --i) {
+ t = state[13];
+ state[13] = state[9];
+ state[9] = state[5];
+ state[5] = state[1];
+ state[1] = t;
+ t = state[14];
+ u = state[10];
+ state[14] = state[6];
+ state[10] = state[2];
+ state[6] = t;
+ state[2] = u;
+ t = state[15];
+ u = state[11];
+ v = state[7];
+ state[15] = state[3];
+ state[11] = t;
+ state[7] = u;
+ state[3] = v;
+
+ for (var _j = 0; _j < 16; ++_j) {
+ state[_j] = this._inv_s[state[_j]];
+ }
+
+ for (var _j2 = 0, _k = i * 16; _j2 < 16; ++_j2, ++_k) {
+ state[_j2] ^= key[_k];
+ }
+
+ for (var _j3 = 0; _j3 < 16; _j3 += 4) {
+ var s0 = this._mix[state[_j3]];
+ var s1 = this._mix[state[_j3 + 1]];
+ var s2 = this._mix[state[_j3 + 2]];
+ var s3 = this._mix[state[_j3 + 3]];
+ t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
+ state[_j3] = t >>> 24 & 0xff;
+ state[_j3 + 1] = t >> 16 & 0xff;
+ state[_j3 + 2] = t >> 8 & 0xff;
+ state[_j3 + 3] = t & 0xff;
+ }
+ }
- for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
t = state[13];
state[13] = state[9];
state[9] = state[5];
@@ -16283,67 +27470,68 @@ class AESBaseCipher {
state[7] = u;
state[3] = v;
- for (let j = 0; j < 16; ++j) {
- state[j] = this._inv_s[state[j]];
+ for (var _j4 = 0; _j4 < 16; ++_j4) {
+ state[_j4] = this._inv_s[state[_j4]];
+ state[_j4] ^= key[_j4];
}
- for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
- state[j] ^= key[k];
- }
-
- for (let j = 0; j < 16; j += 4) {
- const s0 = this._mix[state[j]];
- const s1 = this._mix[state[j + 1]];
- const s2 = this._mix[state[j + 2]];
- const s3 = this._mix[state[j + 3]];
- t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
- state[j] = t >>> 24 & 0xff;
- state[j + 1] = t >> 16 & 0xff;
- state[j + 2] = t >> 8 & 0xff;
- state[j + 3] = t & 0xff;
- }
- }
-
- t = state[13];
- state[13] = state[9];
- state[9] = state[5];
- state[5] = state[1];
- state[1] = t;
- t = state[14];
- u = state[10];
- state[14] = state[6];
- state[10] = state[2];
- state[6] = t;
- state[2] = u;
- t = state[15];
- u = state[11];
- v = state[7];
- state[15] = state[3];
- state[11] = t;
- state[7] = u;
- state[3] = v;
-
- for (let j = 0; j < 16; ++j) {
- state[j] = this._inv_s[state[j]];
- state[j] ^= key[j];
+ return state;
}
-
- return state;
- }
-
- _encrypt(input, key) {
- const s = this._s;
- let t, u, v;
- const state = new Uint8Array(16);
- state.set(input);
-
- for (let j = 0; j < 16; ++j) {
- state[j] ^= key[j];
- }
-
- for (let i = 1; i < this._cyclesOfRepetition; i++) {
- for (let j = 0; j < 16; ++j) {
- state[j] = s[state[j]];
+ }, {
+ key: "_encrypt",
+ value: function _encrypt(input, key) {
+ var s = this._s;
+ var t, u, v;
+ var state = new Uint8Array(16);
+ state.set(input);
+
+ for (var j = 0; j < 16; ++j) {
+ state[j] ^= key[j];
+ }
+
+ for (var i = 1; i < this._cyclesOfRepetition; i++) {
+ for (var _j5 = 0; _j5 < 16; ++_j5) {
+ state[_j5] = s[state[_j5]];
+ }
+
+ v = state[1];
+ state[1] = state[5];
+ state[5] = state[9];
+ state[9] = state[13];
+ state[13] = v;
+ v = state[2];
+ u = state[6];
+ state[2] = state[10];
+ state[6] = state[14];
+ state[10] = v;
+ state[14] = u;
+ v = state[3];
+ u = state[7];
+ t = state[11];
+ state[3] = state[15];
+ state[7] = v;
+ state[11] = u;
+ state[15] = t;
+
+ for (var _j6 = 0; _j6 < 16; _j6 += 4) {
+ var s0 = state[_j6 + 0];
+ var s1 = state[_j6 + 1];
+ var s2 = state[_j6 + 2];
+ var s3 = state[_j6 + 3];
+ t = s0 ^ s1 ^ s2 ^ s3;
+ state[_j6 + 0] ^= t ^ this._mixCol[s0 ^ s1];
+ state[_j6 + 1] ^= t ^ this._mixCol[s1 ^ s2];
+ state[_j6 + 2] ^= t ^ this._mixCol[s2 ^ s3];
+ state[_j6 + 3] ^= t ^ this._mixCol[s3 ^ s0];
+ }
+
+ for (var _j7 = 0, k = i * 16; _j7 < 16; ++_j7, ++k) {
+ state[_j7] ^= key[k];
+ }
+ }
+
+ for (var _j8 = 0; _j8 < 16; ++_j8) {
+ state[_j8] = s[state[_j8]];
}
v = state[1];
@@ -16365,293 +27553,285 @@ class AESBaseCipher {
state[11] = u;
state[15] = t;
- for (let j = 0; j < 16; j += 4) {
- const s0 = state[j + 0];
- const s1 = state[j + 1];
- const s2 = state[j + 2];
- const s3 = state[j + 3];
- t = s0 ^ s1 ^ s2 ^ s3;
- state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
- state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
- state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
- state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
+ for (var _j9 = 0, _k2 = this._keySize; _j9 < 16; ++_j9, ++_k2) {
+ state[_j9] ^= key[_k2];
}
- for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
- state[j] ^= key[k];
- }
+ return state;
}
+ }, {
+ key: "_decryptBlock2",
+ value: function _decryptBlock2(data, finalize) {
+ var sourceLength = data.length;
+ var buffer = this.buffer,
+ bufferLength = this.bufferPosition;
+ var result = [];
+ var iv = this.iv;
- for (let j = 0; j < 16; ++j) {
- state[j] = s[state[j]];
- }
-
- v = state[1];
- state[1] = state[5];
- state[5] = state[9];
- state[9] = state[13];
- state[13] = v;
- v = state[2];
- u = state[6];
- state[2] = state[10];
- state[6] = state[14];
- state[10] = v;
- state[14] = u;
- v = state[3];
- u = state[7];
- t = state[11];
- state[3] = state[15];
- state[7] = v;
- state[11] = u;
- state[15] = t;
-
- for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
- state[j] ^= key[k];
- }
+ for (var i = 0; i < sourceLength; ++i) {
+ buffer[bufferLength] = data[i];
+ ++bufferLength;
- return state;
- }
+ if (bufferLength < 16) {
+ continue;
+ }
- _decryptBlock2(data, finalize) {
- const sourceLength = data.length;
- let buffer = this.buffer,
- bufferLength = this.bufferPosition;
- const result = [];
- let iv = this.iv;
+ var plain = this._decrypt(buffer, this._key);
- for (let i = 0; i < sourceLength; ++i) {
- buffer[bufferLength] = data[i];
- ++bufferLength;
+ for (var j = 0; j < 16; ++j) {
+ plain[j] ^= iv[j];
+ }
- if (bufferLength < 16) {
- continue;
+ iv = buffer;
+ result.push(plain);
+ buffer = new Uint8Array(16);
+ bufferLength = 0;
}
- const plain = this._decrypt(buffer, this._key);
+ this.buffer = buffer;
+ this.bufferLength = bufferLength;
+ this.iv = iv;
- for (let j = 0; j < 16; ++j) {
- plain[j] ^= iv[j];
+ if (result.length === 0) {
+ return new Uint8Array(0);
}
- iv = buffer;
- result.push(plain);
- buffer = new Uint8Array(16);
- bufferLength = 0;
- }
+ var outputLength = 16 * result.length;
- this.buffer = buffer;
- this.bufferLength = bufferLength;
- this.iv = iv;
+ if (finalize) {
+ var lastBlock = result[result.length - 1];
+ var psLen = lastBlock[15];
- if (result.length === 0) {
- return new Uint8Array(0);
- }
-
- let outputLength = 16 * result.length;
-
- if (finalize) {
- const lastBlock = result[result.length - 1];
- let psLen = lastBlock[15];
-
- if (psLen <= 16) {
- for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
- if (lastBlock[i] !== psLen) {
- psLen = 0;
- break;
+ if (psLen <= 16) {
+ for (var _i = 15, ii = 16 - psLen; _i >= ii; --_i) {
+ if (lastBlock[_i] !== psLen) {
+ psLen = 0;
+ break;
+ }
}
- }
- outputLength -= psLen;
- result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
+ outputLength -= psLen;
+ result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
+ }
}
- }
- const output = new Uint8Array(outputLength);
+ var output = new Uint8Array(outputLength);
- for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
- output.set(result[i], j);
- }
+ for (var _i2 = 0, _j10 = 0, _ii = result.length; _i2 < _ii; ++_i2, _j10 += 16) {
+ output.set(result[_i2], _j10);
+ }
- return output;
- }
+ return output;
+ }
+ }, {
+ key: "decryptBlock",
+ value: function decryptBlock(data, finalize) {
+ var iv = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
+ var sourceLength = data.length;
+ var buffer = this.buffer;
+ var bufferLength = this.bufferPosition;
- decryptBlock(data, finalize, iv = null) {
- const sourceLength = data.length;
- const buffer = this.buffer;
- let bufferLength = this.bufferPosition;
+ if (iv) {
+ this.iv = iv;
+ } else {
+ for (var i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
+ buffer[bufferLength] = data[i];
+ }
- if (iv) {
- this.iv = iv;
- } else {
- for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
- buffer[bufferLength] = data[i];
- }
+ if (bufferLength < 16) {
+ this.bufferLength = bufferLength;
+ return new Uint8Array(0);
+ }
- if (bufferLength < 16) {
- this.bufferLength = bufferLength;
- return new Uint8Array(0);
+ this.iv = buffer;
+ data = data.subarray(16);
}
- this.iv = buffer;
- data = data.subarray(16);
+ this.buffer = new Uint8Array(16);
+ this.bufferLength = 0;
+ this.decryptBlock = this._decryptBlock2;
+ return this.decryptBlock(data, finalize);
}
+ }, {
+ key: "encrypt",
+ value: function encrypt(data, iv) {
+ var sourceLength = data.length;
+ var buffer = this.buffer,
+ bufferLength = this.bufferPosition;
+ var result = [];
- this.buffer = new Uint8Array(16);
- this.bufferLength = 0;
- this.decryptBlock = this._decryptBlock2;
- return this.decryptBlock(data, finalize);
- }
+ if (!iv) {
+ iv = new Uint8Array(16);
+ }
- encrypt(data, iv) {
- const sourceLength = data.length;
- let buffer = this.buffer,
- bufferLength = this.bufferPosition;
- const result = [];
+ for (var i = 0; i < sourceLength; ++i) {
+ buffer[bufferLength] = data[i];
+ ++bufferLength;
- if (!iv) {
- iv = new Uint8Array(16);
- }
+ if (bufferLength < 16) {
+ continue;
+ }
- for (let i = 0; i < sourceLength; ++i) {
- buffer[bufferLength] = data[i];
- ++bufferLength;
+ for (var j = 0; j < 16; ++j) {
+ buffer[j] ^= iv[j];
+ }
- if (bufferLength < 16) {
- continue;
- }
+ var cipher = this._encrypt(buffer, this._key);
- for (let j = 0; j < 16; ++j) {
- buffer[j] ^= iv[j];
+ iv = cipher;
+ result.push(cipher);
+ buffer = new Uint8Array(16);
+ bufferLength = 0;
}
- const cipher = this._encrypt(buffer, this._key);
-
- iv = cipher;
- result.push(cipher);
- buffer = new Uint8Array(16);
- bufferLength = 0;
- }
+ this.buffer = buffer;
+ this.bufferLength = bufferLength;
+ this.iv = iv;
- this.buffer = buffer;
- this.bufferLength = bufferLength;
- this.iv = iv;
+ if (result.length === 0) {
+ return new Uint8Array(0);
+ }
- if (result.length === 0) {
- return new Uint8Array(0);
- }
+ var outputLength = 16 * result.length;
+ var output = new Uint8Array(outputLength);
- const outputLength = 16 * result.length;
- const output = new Uint8Array(outputLength);
+ for (var _i3 = 0, _j11 = 0, ii = result.length; _i3 < ii; ++_i3, _j11 += 16) {
+ output.set(result[_i3], _j11);
+ }
- for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
- output.set(result[i], j);
+ return output;
}
+ }]);
- return output;
- }
-
-}
+ return AESBaseCipher;
+}();
-class AES128Cipher extends AESBaseCipher {
- constructor(key) {
- super();
- this._cyclesOfRepetition = 10;
- this._keySize = 160;
- this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]);
- this._key = this._expandKey(key);
- }
-
- _expandKey(cipherKey) {
- const b = 176;
- const s = this._s;
- const rcon = this._rcon;
- const result = new Uint8Array(b);
- result.set(cipherKey);
-
- for (let j = 16, i = 1; j < b; ++i) {
- let t1 = result[j - 3];
- let t2 = result[j - 2];
- let t3 = result[j - 1];
- let t4 = result[j - 4];
- t1 = s[t1];
- t2 = s[t2];
- t3 = s[t3];
- t4 = s[t4];
- t1 = t1 ^ rcon[i];
-
- for (let n = 0; n < 4; ++n) {
- result[j] = t1 ^= result[j - 16];
- j++;
- result[j] = t2 ^= result[j - 16];
- j++;
- result[j] = t3 ^= result[j - 16];
- j++;
- result[j] = t4 ^= result[j - 16];
- j++;
- }
- }
+var AES128Cipher = /*#__PURE__*/function (_AESBaseCipher) {
+ _inherits(AES128Cipher, _AESBaseCipher);
- return result;
- }
+ var _super = _createSuper(AES128Cipher);
-}
+ function AES128Cipher(key) {
+ var _this;
-exports.AES128Cipher = AES128Cipher;
+ _classCallCheck(this, AES128Cipher);
-class AES256Cipher extends AESBaseCipher {
- constructor(key) {
- super();
- this._cyclesOfRepetition = 14;
- this._keySize = 224;
- this._key = this._expandKey(key);
+ _this = _super.call(this);
+ _this._cyclesOfRepetition = 10;
+ _this._keySize = 160;
+ _this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]);
+ _this._key = _this._expandKey(key);
+ return _this;
}
- _expandKey(cipherKey) {
- const b = 240;
- const s = this._s;
- const result = new Uint8Array(b);
- result.set(cipherKey);
- let r = 1;
- let t1, t2, t3, t4;
+ _createClass(AES128Cipher, [{
+ key: "_expandKey",
+ value: function _expandKey(cipherKey) {
+ var b = 176;
+ var s = this._s;
+ var rcon = this._rcon;
+ var result = new Uint8Array(b);
+ result.set(cipherKey);
- for (let j = 32, i = 1; j < b; ++i) {
- if (j % 32 === 16) {
+ for (var j = 16, i = 1; j < b; ++i) {
+ var t1 = result[j - 3];
+ var t2 = result[j - 2];
+ var t3 = result[j - 1];
+ var t4 = result[j - 4];
t1 = s[t1];
t2 = s[t2];
t3 = s[t3];
t4 = s[t4];
- } else if (j % 32 === 0) {
- t1 = result[j - 3];
- t2 = result[j - 2];
- t3 = result[j - 1];
- t4 = result[j - 4];
- t1 = s[t1];
- t2 = s[t2];
- t3 = s[t3];
- t4 = s[t4];
- t1 = t1 ^ r;
+ t1 = t1 ^ rcon[i];
- if ((r <<= 1) >= 256) {
- r = (r ^ 0x1b) & 0xff;
+ for (var n = 0; n < 4; ++n) {
+ result[j] = t1 ^= result[j - 16];
+ j++;
+ result[j] = t2 ^= result[j - 16];
+ j++;
+ result[j] = t3 ^= result[j - 16];
+ j++;
+ result[j] = t4 ^= result[j - 16];
+ j++;
}
}
- for (let n = 0; n < 4; ++n) {
- result[j] = t1 ^= result[j - 32];
- j++;
- result[j] = t2 ^= result[j - 32];
- j++;
- result[j] = t3 ^= result[j - 32];
- j++;
- result[j] = t4 ^= result[j - 32];
- j++;
- }
+ return result;
}
+ }]);
- return result;
- }
+ return AES128Cipher;
+}(AESBaseCipher);
-}
+exports.AES128Cipher = AES128Cipher;
+
+var AES256Cipher = /*#__PURE__*/function (_AESBaseCipher2) {
+ _inherits(AES256Cipher, _AESBaseCipher2);
+
+ var _super2 = _createSuper(AES256Cipher);
+
+ function AES256Cipher(key) {
+ var _this2;
+
+ _classCallCheck(this, AES256Cipher);
+
+ _this2 = _super2.call(this);
+ _this2._cyclesOfRepetition = 14;
+ _this2._keySize = 224;
+ _this2._key = _this2._expandKey(key);
+ return _this2;
+ }
+
+ _createClass(AES256Cipher, [{
+ key: "_expandKey",
+ value: function _expandKey(cipherKey) {
+ var b = 240;
+ var s = this._s;
+ var result = new Uint8Array(b);
+ result.set(cipherKey);
+ var r = 1;
+ var t1, t2, t3, t4;
+
+ for (var j = 32, i = 1; j < b; ++i) {
+ if (j % 32 === 16) {
+ t1 = s[t1];
+ t2 = s[t2];
+ t3 = s[t3];
+ t4 = s[t4];
+ } else if (j % 32 === 0) {
+ t1 = result[j - 3];
+ t2 = result[j - 2];
+ t3 = result[j - 1];
+ t4 = result[j - 4];
+ t1 = s[t1];
+ t2 = s[t2];
+ t3 = s[t3];
+ t4 = s[t4];
+ t1 = t1 ^ r;
+
+ if ((r <<= 1) >= 256) {
+ r = (r ^ 0x1b) & 0xff;
+ }
+ }
+
+ for (var n = 0; n < 4; ++n) {
+ result[j] = t1 ^= result[j - 32];
+ j++;
+ result[j] = t2 ^= result[j - 32];
+ j++;
+ result[j] = t3 ^= result[j - 32];
+ j++;
+ result[j] = t4 ^= result[j - 32];
+ j++;
+ }
+ }
+
+ return result;
+ }
+ }]);
+
+ return AES256Cipher;
+}(AESBaseCipher);
exports.AES256Cipher = AES256Cipher;
@@ -17205,7 +28385,7 @@ var CipherTransformFactory = function CipherTransformFactoryClosure() {
exports.CipherTransformFactory = CipherTransformFactory;
/***/ }),
-/* 23 */
+/* 216 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -17216,28 +28396,50 @@ Object.defineProperty(exports, "__esModule", {
});
exports.ColorSpace = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
-var _primitives = __w_pdfjs_require__(5);
+var _primitives = __w_pdfjs_require__(198);
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
- const COMPONENTS = 3;
+ var COMPONENTS = 3;
alpha01 = alpha01 !== 1 ? 0 : alpha01;
- const xRatio = w1 / w2;
- const yRatio = h1 / h2;
- let newIndex = 0,
+ var xRatio = w1 / w2;
+ var yRatio = h1 / h2;
+ var newIndex = 0,
oldIndex;
- const xScaled = new Uint16Array(w2);
- const w1Scanline = w1 * COMPONENTS;
+ var xScaled = new Uint16Array(w2);
+ var w1Scanline = w1 * COMPONENTS;
- for (let i = 0; i < w2; i++) {
+ for (var i = 0; i < w2; i++) {
xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
}
- for (let i = 0; i < h2; i++) {
- const py = Math.floor(i * yRatio) * w1Scanline;
+ for (var _i = 0; _i < h2; _i++) {
+ var py = Math.floor(_i * yRatio) * w1Scanline;
- for (let j = 0; j < w2; j++) {
+ for (var j = 0; j < w2; j++) {
oldIndex = py + xScaled[j];
dest[newIndex++] = src[oldIndex++];
dest[newIndex++] = src[oldIndex++];
@@ -17247,8 +28449,10 @@ function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
}
}
-class ColorSpace {
- constructor(name, numComps) {
+var ColorSpace = /*#__PURE__*/function () {
+ function ColorSpace(name, numComps) {
+ _classCallCheck(this, ColorSpace);
+
if (this.constructor === ColorSpace) {
(0, _util.unreachable)("Cannot initialize ColorSpace.");
}
@@ -17257,608 +28461,718 @@ class ColorSpace {
this.numComps = numComps;
}
- getRgb(src, srcOffset) {
- const rgb = new Uint8ClampedArray(3);
- this.getRgbItem(src, srcOffset, rgb, 0);
- return rgb;
- }
-
- getRgbItem(src, srcOffset, dest, destOffset) {
- (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
- }
-
- getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
- }
-
- getOutputLength(inputLength, alpha01) {
- (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
- }
-
- isPassthrough(bits) {
- return false;
- }
+ _createClass(ColorSpace, [{
+ key: "getRgb",
+ value: function getRgb(src, srcOffset) {
+ var rgb = new Uint8ClampedArray(3);
+ this.getRgbItem(src, srcOffset, rgb, 0);
+ return rgb;
+ }
+ }, {
+ key: "getRgbItem",
+ value: function getRgbItem(src, srcOffset, dest, destOffset) {
+ (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
+ }
+ }, {
+ key: "getRgbBuffer",
+ value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+ (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
+ }
+ }, {
+ key: "getOutputLength",
+ value: function getOutputLength(inputLength, alpha01) {
+ (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
+ }
+ }, {
+ key: "isPassthrough",
+ value: function isPassthrough(bits) {
+ return false;
+ }
+ }, {
+ key: "isDefaultDecode",
+ value: function isDefaultDecode(decodeMap, bpc) {
+ return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
+ }
+ }, {
+ key: "fillRgb",
+ value: function fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
+ var count = originalWidth * originalHeight;
+ var rgbBuf = null;
+ var numComponentColors = 1 << bpc;
+ var needsResizing = originalHeight !== height || originalWidth !== width;
- isDefaultDecode(decodeMap, bpc) {
- return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
- }
+ if (this.isPassthrough(bpc)) {
+ rgbBuf = comps;
+ } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
+ var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
- fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
- const count = originalWidth * originalHeight;
- let rgbBuf = null;
- const numComponentColors = 1 << bpc;
- const needsResizing = originalHeight !== height || originalWidth !== width;
+ for (var i = 0; i < numComponentColors; i++) {
+ allColors[i] = i;
+ }
- if (this.isPassthrough(bpc)) {
- rgbBuf = comps;
- } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
- const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
+ var colorMap = new Uint8ClampedArray(numComponentColors * 3);
+ this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
- for (let i = 0; i < numComponentColors; i++) {
- allColors[i] = i;
- }
+ if (!needsResizing) {
+ var destPos = 0;
- const colorMap = new Uint8ClampedArray(numComponentColors * 3);
- this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
+ for (var _i2 = 0; _i2 < count; ++_i2) {
+ var key = comps[_i2] * 3;
+ dest[destPos++] = colorMap[key];
+ dest[destPos++] = colorMap[key + 1];
+ dest[destPos++] = colorMap[key + 2];
+ destPos += alpha01;
+ }
+ } else {
+ rgbBuf = new Uint8Array(count * 3);
+ var rgbPos = 0;
- if (!needsResizing) {
- let destPos = 0;
+ for (var _i3 = 0; _i3 < count; ++_i3) {
+ var _key = comps[_i3] * 3;
- for (let i = 0; i < count; ++i) {
- const key = comps[i] * 3;
- dest[destPos++] = colorMap[key];
- dest[destPos++] = colorMap[key + 1];
- dest[destPos++] = colorMap[key + 2];
- destPos += alpha01;
+ rgbBuf[rgbPos++] = colorMap[_key];
+ rgbBuf[rgbPos++] = colorMap[_key + 1];
+ rgbBuf[rgbPos++] = colorMap[_key + 2];
+ }
}
} else {
- rgbBuf = new Uint8Array(count * 3);
- let rgbPos = 0;
-
- for (let i = 0; i < count; ++i) {
- const key = comps[i] * 3;
- rgbBuf[rgbPos++] = colorMap[key];
- rgbBuf[rgbPos++] = colorMap[key + 1];
- rgbBuf[rgbPos++] = colorMap[key + 2];
+ if (!needsResizing) {
+ this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
+ } else {
+ rgbBuf = new Uint8ClampedArray(count * 3);
+ this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
}
}
- } else {
- if (!needsResizing) {
- this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
- } else {
- rgbBuf = new Uint8ClampedArray(count * 3);
- this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
- }
- }
- if (rgbBuf) {
- if (needsResizing) {
- resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
- } else {
- let destPos = 0,
- rgbPos = 0;
+ if (rgbBuf) {
+ if (needsResizing) {
+ resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
+ } else {
+ var _destPos = 0,
+ _rgbPos = 0;
- for (let i = 0, ii = width * actualHeight; i < ii; i++) {
- dest[destPos++] = rgbBuf[rgbPos++];
- dest[destPos++] = rgbBuf[rgbPos++];
- dest[destPos++] = rgbBuf[rgbPos++];
- destPos += alpha01;
+ for (var _i4 = 0, ii = width * actualHeight; _i4 < ii; _i4++) {
+ dest[_destPos++] = rgbBuf[_rgbPos++];
+ dest[_destPos++] = rgbBuf[_rgbPos++];
+ dest[_destPos++] = rgbBuf[_rgbPos++];
+ _destPos += alpha01;
+ }
}
}
}
- }
-
- get usesZeroToOneRange() {
- return (0, _util.shadow)(this, "usesZeroToOneRange", true);
- }
-
- static parse(cs, xref, res, pdfFunctionFactory) {
- const IR = this.parseToIR(cs, xref, res, pdfFunctionFactory);
- return this.fromIR(IR);
- }
-
- static fromIR(IR) {
- const name = Array.isArray(IR) ? IR[0] : IR;
- let whitePoint, blackPoint, gamma;
+ }, {
+ key: "usesZeroToOneRange",
+ get: function get() {
+ return (0, _util.shadow)(this, "usesZeroToOneRange", true);
+ }
+ }], [{
+ key: "parse",
+ value: function parse(cs, xref, res, pdfFunctionFactory) {
+ var IR = this.parseToIR(cs, xref, res, pdfFunctionFactory);
+ return this.fromIR(IR);
+ }
+ }, {
+ key: "fromIR",
+ value: function fromIR(IR) {
+ var name = Array.isArray(IR) ? IR[0] : IR;
+ var whitePoint, blackPoint, gamma;
- switch (name) {
- case "DeviceGrayCS":
- return this.singletons.gray;
+ switch (name) {
+ case "DeviceGrayCS":
+ return this.singletons.gray;
- case "DeviceRgbCS":
- return this.singletons.rgb;
+ case "DeviceRgbCS":
+ return this.singletons.rgb;
- case "DeviceCmykCS":
- return this.singletons.cmyk;
+ case "DeviceCmykCS":
+ return this.singletons.cmyk;
- case "CalGrayCS":
- whitePoint = IR[1];
- blackPoint = IR[2];
- gamma = IR[3];
- return new CalGrayCS(whitePoint, blackPoint, gamma);
+ case "CalGrayCS":
+ whitePoint = IR[1];
+ blackPoint = IR[2];
+ gamma = IR[3];
+ return new CalGrayCS(whitePoint, blackPoint, gamma);
- case "CalRGBCS":
- whitePoint = IR[1];
- blackPoint = IR[2];
- gamma = IR[3];
- const matrix = IR[4];
- return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
+ case "CalRGBCS":
+ whitePoint = IR[1];
+ blackPoint = IR[2];
+ gamma = IR[3];
+ var matrix = IR[4];
+ return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
- case "PatternCS":
- let basePatternCS = IR[1];
+ case "PatternCS":
+ var basePatternCS = IR[1];
- if (basePatternCS) {
- basePatternCS = this.fromIR(basePatternCS);
- }
+ if (basePatternCS) {
+ basePatternCS = this.fromIR(basePatternCS);
+ }
- return new PatternCS(basePatternCS);
+ return new PatternCS(basePatternCS);
- case "IndexedCS":
- const baseIndexedCS = IR[1];
- const hiVal = IR[2];
- const lookup = IR[3];
- return new IndexedCS(this.fromIR(baseIndexedCS), hiVal, lookup);
+ case "IndexedCS":
+ var baseIndexedCS = IR[1];
+ var hiVal = IR[2];
+ var lookup = IR[3];
+ return new IndexedCS(this.fromIR(baseIndexedCS), hiVal, lookup);
- case "AlternateCS":
- const numComps = IR[1];
- const alt = IR[2];
- const tintFn = IR[3];
- return new AlternateCS(numComps, this.fromIR(alt), tintFn);
+ case "AlternateCS":
+ var numComps = IR[1];
+ var alt = IR[2];
+ var tintFn = IR[3];
+ return new AlternateCS(numComps, this.fromIR(alt), tintFn);
- case "LabCS":
- whitePoint = IR[1];
- blackPoint = IR[2];
- const range = IR[3];
- return new LabCS(whitePoint, blackPoint, range);
+ case "LabCS":
+ whitePoint = IR[1];
+ blackPoint = IR[2];
+ var range = IR[3];
+ return new LabCS(whitePoint, blackPoint, range);
- default:
- throw new _util.FormatError(`Unknown colorspace name: ${name}`);
+ default:
+ throw new _util.FormatError("Unknown colorspace name: ".concat(name));
+ }
}
- }
-
- static parseToIR(cs, xref, res = null, pdfFunctionFactory) {
- cs = xref.fetchIfRef(cs);
+ }, {
+ key: "parseToIR",
+ value: function parseToIR(cs, xref) {
+ var res = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
+ var pdfFunctionFactory = arguments.length > 3 ? arguments[3] : undefined;
+ cs = xref.fetchIfRef(cs);
+
+ if ((0, _primitives.isName)(cs)) {
+ switch (cs.name) {
+ case "DeviceGray":
+ case "G":
+ return "DeviceGrayCS";
- if ((0, _primitives.isName)(cs)) {
- switch (cs.name) {
- case "DeviceGray":
- case "G":
- return "DeviceGrayCS";
+ case "DeviceRGB":
+ case "RGB":
+ return "DeviceRgbCS";
- case "DeviceRGB":
- case "RGB":
- return "DeviceRgbCS";
+ case "DeviceCMYK":
+ case "CMYK":
+ return "DeviceCmykCS";
- case "DeviceCMYK":
- case "CMYK":
- return "DeviceCmykCS";
+ case "Pattern":
+ return ["PatternCS", null];
- case "Pattern":
- return ["PatternCS", null];
+ default:
+ if ((0, _primitives.isDict)(res)) {
+ var colorSpaces = res.get("ColorSpace");
- default:
- if ((0, _primitives.isDict)(res)) {
- const colorSpaces = res.get("ColorSpace");
+ if ((0, _primitives.isDict)(colorSpaces)) {
+ var resCS = colorSpaces.get(cs.name);
- if ((0, _primitives.isDict)(colorSpaces)) {
- const resCS = colorSpaces.get(cs.name);
+ if (resCS) {
+ if ((0, _primitives.isName)(resCS)) {
+ return this.parseToIR(resCS, xref, res, pdfFunctionFactory);
+ }
- if (resCS) {
- if ((0, _primitives.isName)(resCS)) {
- return this.parseToIR(resCS, xref, res, pdfFunctionFactory);
+ cs = resCS;
+ break;
}
-
- cs = resCS;
- break;
}
}
- }
- throw new _util.FormatError(`unrecognized colorspace ${cs.name}`);
+ throw new _util.FormatError("unrecognized colorspace ".concat(cs.name));
+ }
}
- }
- if (Array.isArray(cs)) {
- const mode = xref.fetchIfRef(cs[0]).name;
- let numComps, params, alt, whitePoint, blackPoint, gamma;
+ if (Array.isArray(cs)) {
+ var mode = xref.fetchIfRef(cs[0]).name;
+ var numComps, params, alt, whitePoint, blackPoint, gamma;
- switch (mode) {
- case "DeviceGray":
- case "G":
- return "DeviceGrayCS";
-
- case "DeviceRGB":
- case "RGB":
- return "DeviceRgbCS";
-
- case "DeviceCMYK":
- case "CMYK":
- return "DeviceCmykCS";
-
- case "CalGray":
- params = xref.fetchIfRef(cs[1]);
- whitePoint = params.getArray("WhitePoint");
- blackPoint = params.getArray("BlackPoint");
- gamma = params.get("Gamma");
- return ["CalGrayCS", whitePoint, blackPoint, gamma];
+ switch (mode) {
+ case "DeviceGray":
+ case "G":
+ return "DeviceGrayCS";
- case "CalRGB":
- params = xref.fetchIfRef(cs[1]);
- whitePoint = params.getArray("WhitePoint");
- blackPoint = params.getArray("BlackPoint");
- gamma = params.getArray("Gamma");
- const matrix = params.getArray("Matrix");
- return ["CalRGBCS", whitePoint, blackPoint, gamma, matrix];
+ case "DeviceRGB":
+ case "RGB":
+ return "DeviceRgbCS";
- case "ICCBased":
- const stream = xref.fetchIfRef(cs[1]);
- const dict = stream.dict;
- numComps = dict.get("N");
- alt = dict.get("Alternate");
+ case "DeviceCMYK":
+ case "CMYK":
+ return "DeviceCmykCS";
- if (alt) {
- const altIR = this.parseToIR(alt, xref, res, pdfFunctionFactory);
- const altCS = this.fromIR(altIR, pdfFunctionFactory);
+ case "CalGray":
+ params = xref.fetchIfRef(cs[1]);
+ whitePoint = params.getArray("WhitePoint");
+ blackPoint = params.getArray("BlackPoint");
+ gamma = params.get("Gamma");
+ return ["CalGrayCS", whitePoint, blackPoint, gamma];
+
+ case "CalRGB":
+ params = xref.fetchIfRef(cs[1]);
+ whitePoint = params.getArray("WhitePoint");
+ blackPoint = params.getArray("BlackPoint");
+ gamma = params.getArray("Gamma");
+ var matrix = params.getArray("Matrix");
+ return ["CalRGBCS", whitePoint, blackPoint, gamma, matrix];
+
+ case "ICCBased":
+ var stream = xref.fetchIfRef(cs[1]);
+ var dict = stream.dict;
+ numComps = dict.get("N");
+ alt = dict.get("Alternate");
+
+ if (alt) {
+ var altIR = this.parseToIR(alt, xref, res, pdfFunctionFactory);
+ var altCS = this.fromIR(altIR, pdfFunctionFactory);
+
+ if (altCS.numComps === numComps) {
+ return altIR;
+ }
- if (altCS.numComps === numComps) {
- return altIR;
+ (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
}
- (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
- }
-
- if (numComps === 1) {
- return "DeviceGrayCS";
- } else if (numComps === 3) {
- return "DeviceRgbCS";
- } else if (numComps === 4) {
- return "DeviceCmykCS";
- }
+ if (numComps === 1) {
+ return "DeviceGrayCS";
+ } else if (numComps === 3) {
+ return "DeviceRgbCS";
+ } else if (numComps === 4) {
+ return "DeviceCmykCS";
+ }
- break;
+ break;
- case "Pattern":
- let basePatternCS = cs[1] || null;
+ case "Pattern":
+ var basePatternCS = cs[1] || null;
- if (basePatternCS) {
- basePatternCS = this.parseToIR(basePatternCS, xref, res, pdfFunctionFactory);
- }
+ if (basePatternCS) {
+ basePatternCS = this.parseToIR(basePatternCS, xref, res, pdfFunctionFactory);
+ }
- return ["PatternCS", basePatternCS];
+ return ["PatternCS", basePatternCS];
- case "Indexed":
- case "I":
- const baseIndexedCS = this.parseToIR(cs[1], xref, res, pdfFunctionFactory);
- const hiVal = xref.fetchIfRef(cs[2]) + 1;
- let lookup = xref.fetchIfRef(cs[3]);
+ case "Indexed":
+ case "I":
+ var baseIndexedCS = this.parseToIR(cs[1], xref, res, pdfFunctionFactory);
+ var hiVal = xref.fetchIfRef(cs[2]) + 1;
+ var lookup = xref.fetchIfRef(cs[3]);
- if ((0, _primitives.isStream)(lookup)) {
- lookup = lookup.getBytes();
- }
+ if ((0, _primitives.isStream)(lookup)) {
+ lookup = lookup.getBytes();
+ }
- return ["IndexedCS", baseIndexedCS, hiVal, lookup];
+ return ["IndexedCS", baseIndexedCS, hiVal, lookup];
- case "Separation":
- case "DeviceN":
- const name = xref.fetchIfRef(cs[1]);
- numComps = Array.isArray(name) ? name.length : 1;
- alt = this.parseToIR(cs[2], xref, res, pdfFunctionFactory);
- const tintFn = pdfFunctionFactory.create(xref.fetchIfRef(cs[3]));
- return ["AlternateCS", numComps, alt, tintFn];
+ case "Separation":
+ case "DeviceN":
+ var name = xref.fetchIfRef(cs[1]);
+ numComps = Array.isArray(name) ? name.length : 1;
+ alt = this.parseToIR(cs[2], xref, res, pdfFunctionFactory);
+ var tintFn = pdfFunctionFactory.create(xref.fetchIfRef(cs[3]));
+ return ["AlternateCS", numComps, alt, tintFn];
- case "Lab":
- params = xref.fetchIfRef(cs[1]);
- whitePoint = params.getArray("WhitePoint");
- blackPoint = params.getArray("BlackPoint");
- const range = params.getArray("Range");
- return ["LabCS", whitePoint, blackPoint, range];
+ case "Lab":
+ params = xref.fetchIfRef(cs[1]);
+ whitePoint = params.getArray("WhitePoint");
+ blackPoint = params.getArray("BlackPoint");
+ var range = params.getArray("Range");
+ return ["LabCS", whitePoint, blackPoint, range];
- default:
- throw new _util.FormatError(`unimplemented color space object "${mode}"`);
+ default:
+ throw new _util.FormatError("unimplemented color space object \"".concat(mode, "\""));
+ }
}
+
+ throw new _util.FormatError("unrecognized color space object: \"".concat(cs, "\""));
}
+ }, {
+ key: "isDefaultDecode",
+ value: function isDefaultDecode(decode, numComps) {
+ if (!Array.isArray(decode)) {
+ return true;
+ }
- throw new _util.FormatError(`unrecognized color space object: "${cs}"`);
- }
+ if (numComps * 2 !== decode.length) {
+ (0, _util.warn)("The decode map is not the correct length");
+ return true;
+ }
- static isDefaultDecode(decode, numComps) {
- if (!Array.isArray(decode)) {
- return true;
- }
+ for (var i = 0, ii = decode.length; i < ii; i += 2) {
+ if (decode[i] !== 0 || decode[i + 1] !== 1) {
+ return false;
+ }
+ }
- if (numComps * 2 !== decode.length) {
- (0, _util.warn)("The decode map is not the correct length");
return true;
}
+ }, {
+ key: "singletons",
+ get: function get() {
+ return (0, _util.shadow)(this, "singletons", {
+ get gray() {
+ return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
+ },
- for (let i = 0, ii = decode.length; i < ii; i += 2) {
- if (decode[i] !== 0 || decode[i + 1] !== 1) {
- return false;
- }
- }
+ get rgb() {
+ return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
+ },
- return true;
- }
+ get cmyk() {
+ return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
+ }
- static get singletons() {
- return (0, _util.shadow)(this, "singletons", {
- get gray() {
- return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
- },
+ });
+ }
+ }]);
- get rgb() {
- return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
- },
+ return ColorSpace;
+}();
- get cmyk() {
- return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
- }
+exports.ColorSpace = ColorSpace;
- });
- }
+var AlternateCS = /*#__PURE__*/function (_ColorSpace) {
+ _inherits(AlternateCS, _ColorSpace);
-}
+ var _super = _createSuper(AlternateCS);
-exports.ColorSpace = ColorSpace;
+ function AlternateCS(numComps, base, tintFn) {
+ var _this;
-class AlternateCS extends ColorSpace {
- constructor(numComps, base, tintFn) {
- super("Alternate", numComps);
- this.base = base;
- this.tintFn = tintFn;
- this.tmpBuf = new Float32Array(base.numComps);
- }
+ _classCallCheck(this, AlternateCS);
- getRgbItem(src, srcOffset, dest, destOffset) {
- const tmpBuf = this.tmpBuf;
- this.tintFn(src, srcOffset, tmpBuf, 0);
- this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
+ _this = _super.call(this, "Alternate", numComps);
+ _this.base = base;
+ _this.tintFn = tintFn;
+ _this.tmpBuf = new Float32Array(base.numComps);
+ return _this;
}
- getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- const tintFn = this.tintFn;
- const base = this.base;
- const scale = 1 / ((1 << bits) - 1);
- const baseNumComps = base.numComps;
- const usesZeroToOneRange = base.usesZeroToOneRange;
- const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
- let pos = isPassthrough ? destOffset : 0;
- const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
- const numComps = this.numComps;
- const scaled = new Float32Array(numComps);
- const tinted = new Float32Array(baseNumComps);
- let i, j;
+ _createClass(AlternateCS, [{
+ key: "getRgbItem",
+ value: function getRgbItem(src, srcOffset, dest, destOffset) {
+ var tmpBuf = this.tmpBuf;
+ this.tintFn(src, srcOffset, tmpBuf, 0);
+ this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
+ }
+ }, {
+ key: "getRgbBuffer",
+ value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+ var tintFn = this.tintFn;
+ var base = this.base;
+ var scale = 1 / ((1 << bits) - 1);
+ var baseNumComps = base.numComps;
+ var usesZeroToOneRange = base.usesZeroToOneRange;
+ var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
+ var pos = isPassthrough ? destOffset : 0;
+ var baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
+ var numComps = this.numComps;
+ var scaled = new Float32Array(numComps);
+ var tinted = new Float32Array(baseNumComps);
+ var i, j;
- for (i = 0; i < count; i++) {
- for (j = 0; j < numComps; j++) {
- scaled[j] = src[srcOffset++] * scale;
- }
+ for (i = 0; i < count; i++) {
+ for (j = 0; j < numComps; j++) {
+ scaled[j] = src[srcOffset++] * scale;
+ }
- tintFn(scaled, 0, tinted, 0);
+ tintFn(scaled, 0, tinted, 0);
- if (usesZeroToOneRange) {
- for (j = 0; j < baseNumComps; j++) {
- baseBuf[pos++] = tinted[j] * 255;
+ if (usesZeroToOneRange) {
+ for (j = 0; j < baseNumComps; j++) {
+ baseBuf[pos++] = tinted[j] * 255;
+ }
+ } else {
+ base.getRgbItem(tinted, 0, baseBuf, pos);
+ pos += baseNumComps;
}
- } else {
- base.getRgbItem(tinted, 0, baseBuf, pos);
- pos += baseNumComps;
}
- }
- if (!isPassthrough) {
- base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
+ if (!isPassthrough) {
+ base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
+ }
}
- }
+ }, {
+ key: "getOutputLength",
+ value: function getOutputLength(inputLength, alpha01) {
+ return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
+ }
+ }]);
- getOutputLength(inputLength, alpha01) {
- return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
- }
+ return AlternateCS;
+}(ColorSpace);
-}
+var PatternCS = /*#__PURE__*/function (_ColorSpace2) {
+ _inherits(PatternCS, _ColorSpace2);
-class PatternCS extends ColorSpace {
- constructor(baseCS) {
- super("Pattern", null);
- this.base = baseCS;
- }
+ var _super2 = _createSuper(PatternCS);
+
+ function PatternCS(baseCS) {
+ var _this2;
- isDefaultDecode(decodeMap, bpc) {
- (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
+ _classCallCheck(this, PatternCS);
+
+ _this2 = _super2.call(this, "Pattern", null);
+ _this2.base = baseCS;
+ return _this2;
}
-}
+ _createClass(PatternCS, [{
+ key: "isDefaultDecode",
+ value: function isDefaultDecode(decodeMap, bpc) {
+ (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
+ }
+ }]);
+
+ return PatternCS;
+}(ColorSpace);
+
+var IndexedCS = /*#__PURE__*/function (_ColorSpace3) {
+ _inherits(IndexedCS, _ColorSpace3);
+
+ var _super3 = _createSuper(IndexedCS);
+
+ function IndexedCS(base, highVal, lookup) {
+ var _this3;
-class IndexedCS extends ColorSpace {
- constructor(base, highVal, lookup) {
- super("Indexed", 1);
- this.base = base;
- this.highVal = highVal;
- const baseNumComps = base.numComps;
- const length = baseNumComps * highVal;
+ _classCallCheck(this, IndexedCS);
+
+ _this3 = _super3.call(this, "Indexed", 1);
+ _this3.base = base;
+ _this3.highVal = highVal;
+ var baseNumComps = base.numComps;
+ var length = baseNumComps * highVal;
if ((0, _primitives.isStream)(lookup)) {
- this.lookup = new Uint8Array(length);
- const bytes = lookup.getBytes(length);
- this.lookup.set(bytes);
+ _this3.lookup = new Uint8Array(length);
+ var bytes = lookup.getBytes(length);
+
+ _this3.lookup.set(bytes);
} else if ((0, _util.isString)(lookup)) {
- this.lookup = new Uint8Array(length);
+ _this3.lookup = new Uint8Array(length);
- for (let i = 0; i < length; ++i) {
- this.lookup[i] = lookup.charCodeAt(i);
+ for (var i = 0; i < length; ++i) {
+ _this3.lookup[i] = lookup.charCodeAt(i);
}
} else if (lookup instanceof Uint8Array) {
- this.lookup = lookup;
+ _this3.lookup = lookup;
} else {
- throw new _util.FormatError(`Unrecognized lookup table: ${lookup}`);
+ throw new _util.FormatError("Unrecognized lookup table: ".concat(lookup));
}
- }
- getRgbItem(src, srcOffset, dest, destOffset) {
- const numComps = this.base.numComps;
- const start = src[srcOffset] * numComps;
- this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
+ return _this3;
}
- getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- const base = this.base;
- const numComps = base.numComps;
- const outputDelta = base.getOutputLength(numComps, alpha01);
- const lookup = this.lookup;
+ _createClass(IndexedCS, [{
+ key: "getRgbItem",
+ value: function getRgbItem(src, srcOffset, dest, destOffset) {
+ var numComps = this.base.numComps;
+ var start = src[srcOffset] * numComps;
+ this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
+ }
+ }, {
+ key: "getRgbBuffer",
+ value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+ var base = this.base;
+ var numComps = base.numComps;
+ var outputDelta = base.getOutputLength(numComps, alpha01);
+ var lookup = this.lookup;
- for (let i = 0; i < count; ++i) {
- const lookupPos = src[srcOffset++] * numComps;
- base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
- destOffset += outputDelta;
+ for (var i = 0; i < count; ++i) {
+ var lookupPos = src[srcOffset++] * numComps;
+ base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
+ destOffset += outputDelta;
+ }
}
- }
+ }, {
+ key: "getOutputLength",
+ value: function getOutputLength(inputLength, alpha01) {
+ return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
+ }
+ }, {
+ key: "isDefaultDecode",
+ value: function isDefaultDecode(decodeMap, bpc) {
+ if (!Array.isArray(decodeMap)) {
+ return true;
+ }
- getOutputLength(inputLength, alpha01) {
- return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
- }
+ if (decodeMap.length !== 2) {
+ (0, _util.warn)("Decode map length is not correct");
+ return true;
+ }
- isDefaultDecode(decodeMap, bpc) {
- if (!Array.isArray(decodeMap)) {
- return true;
- }
+ if (!Number.isInteger(bpc) || bpc < 1) {
+ (0, _util.warn)("Bits per component is not correct");
+ return true;
+ }
- if (decodeMap.length !== 2) {
- (0, _util.warn)("Decode map length is not correct");
- return true;
+ return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
}
+ }]);
- if (!Number.isInteger(bpc) || bpc < 1) {
- (0, _util.warn)("Bits per component is not correct");
- return true;
- }
+ return IndexedCS;
+}(ColorSpace);
- return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
- }
+var DeviceGrayCS = /*#__PURE__*/function (_ColorSpace4) {
+ _inherits(DeviceGrayCS, _ColorSpace4);
-}
+ var _super4 = _createSuper(DeviceGrayCS);
-class DeviceGrayCS extends ColorSpace {
- constructor() {
- super("DeviceGray", 1);
- }
+ function DeviceGrayCS() {
+ _classCallCheck(this, DeviceGrayCS);
- getRgbItem(src, srcOffset, dest, destOffset) {
- const c = src[srcOffset] * 255;
- dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
+ return _super4.call(this, "DeviceGray", 1);
}
- getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- const scale = 255 / ((1 << bits) - 1);
- let j = srcOffset,
- q = destOffset;
+ _createClass(DeviceGrayCS, [{
+ key: "getRgbItem",
+ value: function getRgbItem(src, srcOffset, dest, destOffset) {
+ var c = src[srcOffset] * 255;
+ dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
+ }
+ }, {
+ key: "getRgbBuffer",
+ value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+ var scale = 255 / ((1 << bits) - 1);
+ var j = srcOffset,
+ q = destOffset;
- for (let i = 0; i < count; ++i) {
- const c = scale * src[j++];
- dest[q++] = c;
- dest[q++] = c;
- dest[q++] = c;
- q += alpha01;
+ for (var i = 0; i < count; ++i) {
+ var c = scale * src[j++];
+ dest[q++] = c;
+ dest[q++] = c;
+ dest[q++] = c;
+ q += alpha01;
+ }
}
- }
+ }, {
+ key: "getOutputLength",
+ value: function getOutputLength(inputLength, alpha01) {
+ return inputLength * (3 + alpha01);
+ }
+ }]);
- getOutputLength(inputLength, alpha01) {
- return inputLength * (3 + alpha01);
- }
+ return DeviceGrayCS;
+}(ColorSpace);
-}
+var DeviceRgbCS = /*#__PURE__*/function (_ColorSpace5) {
+ _inherits(DeviceRgbCS, _ColorSpace5);
-class DeviceRgbCS extends ColorSpace {
- constructor() {
- super("DeviceRGB", 3);
- }
+ var _super5 = _createSuper(DeviceRgbCS);
+
+ function DeviceRgbCS() {
+ _classCallCheck(this, DeviceRgbCS);
- getRgbItem(src, srcOffset, dest, destOffset) {
- dest[destOffset] = src[srcOffset] * 255;
- dest[destOffset + 1] = src[srcOffset + 1] * 255;
- dest[destOffset + 2] = src[srcOffset + 2] * 255;
+ return _super5.call(this, "DeviceRGB", 3);
}
- getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- if (bits === 8 && alpha01 === 0) {
- dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
- return;
+ _createClass(DeviceRgbCS, [{
+ key: "getRgbItem",
+ value: function getRgbItem(src, srcOffset, dest, destOffset) {
+ dest[destOffset] = src[srcOffset] * 255;
+ dest[destOffset + 1] = src[srcOffset + 1] * 255;
+ dest[destOffset + 2] = src[srcOffset + 2] * 255;
}
+ }, {
+ key: "getRgbBuffer",
+ value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+ if (bits === 8 && alpha01 === 0) {
+ dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
+ return;
+ }
- const scale = 255 / ((1 << bits) - 1);
- let j = srcOffset,
- q = destOffset;
+ var scale = 255 / ((1 << bits) - 1);
+ var j = srcOffset,
+ q = destOffset;
- for (let i = 0; i < count; ++i) {
- dest[q++] = scale * src[j++];
- dest[q++] = scale * src[j++];
- dest[q++] = scale * src[j++];
- q += alpha01;
+ for (var i = 0; i < count; ++i) {
+ dest[q++] = scale * src[j++];
+ dest[q++] = scale * src[j++];
+ dest[q++] = scale * src[j++];
+ q += alpha01;
+ }
}
- }
-
- getOutputLength(inputLength, alpha01) {
- return inputLength * (3 + alpha01) / 3 | 0;
- }
-
- isPassthrough(bits) {
- return bits === 8;
- }
+ }, {
+ key: "getOutputLength",
+ value: function getOutputLength(inputLength, alpha01) {
+ return inputLength * (3 + alpha01) / 3 | 0;
+ }
+ }, {
+ key: "isPassthrough",
+ value: function isPassthrough(bits) {
+ return bits === 8;
+ }
+ }]);
-}
+ return DeviceRgbCS;
+}(ColorSpace);
-const DeviceCmykCS = function DeviceCmykCSClosure() {
+var DeviceCmykCS = function DeviceCmykCSClosure() {
function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
- const c = src[srcOffset] * srcScale;
- const m = src[srcOffset + 1] * srcScale;
- const y = src[srcOffset + 2] * srcScale;
- const k = src[srcOffset + 3] * srcScale;
+ var c = src[srcOffset] * srcScale;
+ var m = src[srcOffset + 1] * srcScale;
+ var y = src[srcOffset + 2] * srcScale;
+ var k = src[srcOffset + 3] * srcScale;
dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);
dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);
dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);
}
- class DeviceCmykCS extends ColorSpace {
- constructor() {
- super("DeviceCMYK", 4);
- }
+ var DeviceCmykCS = /*#__PURE__*/function (_ColorSpace6) {
+ _inherits(DeviceCmykCS, _ColorSpace6);
- getRgbItem(src, srcOffset, dest, destOffset) {
- convertToRgb(src, srcOffset, 1, dest, destOffset);
- }
+ var _super6 = _createSuper(DeviceCmykCS);
- getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- const scale = 1 / ((1 << bits) - 1);
+ function DeviceCmykCS() {
+ _classCallCheck(this, DeviceCmykCS);
- for (let i = 0; i < count; i++) {
- convertToRgb(src, srcOffset, scale, dest, destOffset);
- srcOffset += 4;
- destOffset += 3 + alpha01;
- }
+ return _super6.call(this, "DeviceCMYK", 4);
}
- getOutputLength(inputLength, alpha01) {
- return inputLength / 4 * (3 + alpha01) | 0;
- }
+ _createClass(DeviceCmykCS, [{
+ key: "getRgbItem",
+ value: function getRgbItem(src, srcOffset, dest, destOffset) {
+ convertToRgb(src, srcOffset, 1, dest, destOffset);
+ }
+ }, {
+ key: "getRgbBuffer",
+ value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+ var scale = 1 / ((1 << bits) - 1);
- }
+ for (var i = 0; i < count; i++) {
+ convertToRgb(src, srcOffset, scale, dest, destOffset);
+ srcOffset += 4;
+ destOffset += 3 + alpha01;
+ }
+ }
+ }, {
+ key: "getOutputLength",
+ value: function getOutputLength(inputLength, alpha01) {
+ return inputLength / 4 * (3 + alpha01) | 0;
+ }
+ }]);
+
+ return DeviceCmykCS;
+ }(ColorSpace);
return DeviceCmykCS;
}();
-const CalGrayCS = function CalGrayCSClosure() {
+var CalGrayCS = function CalGrayCSClosure() {
function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
- const A = src[srcOffset] * scale;
- const AG = A ** cs.G;
- const L = cs.YW * AG;
- const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);
+ var A = src[srcOffset] * scale;
+ var AG = Math.pow(A, cs.G);
+ var L = cs.YW * AG;
+ var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0);
dest[destOffset] = val;
dest[destOffset + 1] = val;
dest[destOffset + 2] = val;
}
- class CalGrayCS extends ColorSpace {
- constructor(whitePoint, blackPoint, gamma) {
- super("CalGray", 1);
+ var CalGrayCS = /*#__PURE__*/function (_ColorSpace7) {
+ _inherits(CalGrayCS, _ColorSpace7);
+
+ var _super7 = _createSuper(CalGrayCS);
+
+ function CalGrayCS(whitePoint, blackPoint, gamma) {
+ var _this4;
+
+ _classCallCheck(this, CalGrayCS);
+
+ _this4 = _super7.call(this, "CalGray", 1);
if (!whitePoint) {
throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
@@ -17866,65 +29180,73 @@ const CalGrayCS = function CalGrayCSClosure() {
blackPoint = blackPoint || [0, 0, 0];
gamma = gamma || 1;
- this.XW = whitePoint[0];
- this.YW = whitePoint[1];
- this.ZW = whitePoint[2];
- this.XB = blackPoint[0];
- this.YB = blackPoint[1];
- this.ZB = blackPoint[2];
- this.G = gamma;
+ _this4.XW = whitePoint[0];
+ _this4.YW = whitePoint[1];
+ _this4.ZW = whitePoint[2];
+ _this4.XB = blackPoint[0];
+ _this4.YB = blackPoint[1];
+ _this4.ZB = blackPoint[2];
+ _this4.G = gamma;
- if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
- throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
+ if (_this4.XW < 0 || _this4.ZW < 0 || _this4.YW !== 1) {
+ throw new _util.FormatError("Invalid WhitePoint components for ".concat(_this4.name) + ", no fallback available");
}
- if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
- (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
- this.XB = this.YB = this.ZB = 0;
+ if (_this4.XB < 0 || _this4.YB < 0 || _this4.ZB < 0) {
+ (0, _util.info)("Invalid BlackPoint for ".concat(_this4.name, ", falling back to default."));
+ _this4.XB = _this4.YB = _this4.ZB = 0;
}
- if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
- (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
+ if (_this4.XB !== 0 || _this4.YB !== 0 || _this4.ZB !== 0) {
+ (0, _util.warn)("".concat(_this4.name, ", BlackPoint: XB: ").concat(_this4.XB, ", YB: ").concat(_this4.YB, ", ") + "ZB: ".concat(_this4.ZB, ", only default values are supported."));
}
- if (this.G < 1) {
- (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
- this.G = 1;
+ if (_this4.G < 1) {
+ (0, _util.info)("Invalid Gamma: ".concat(_this4.G, " for ").concat(_this4.name, ", ") + "falling back to default.");
+ _this4.G = 1;
}
- }
- getRgbItem(src, srcOffset, dest, destOffset) {
- convertToRgb(this, src, srcOffset, dest, destOffset, 1);
+ return _this4;
}
- getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- const scale = 1 / ((1 << bits) - 1);
-
- for (let i = 0; i < count; ++i) {
- convertToRgb(this, src, srcOffset, dest, destOffset, scale);
- srcOffset += 1;
- destOffset += 3 + alpha01;
+ _createClass(CalGrayCS, [{
+ key: "getRgbItem",
+ value: function getRgbItem(src, srcOffset, dest, destOffset) {
+ convertToRgb(this, src, srcOffset, dest, destOffset, 1);
}
- }
+ }, {
+ key: "getRgbBuffer",
+ value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+ var scale = 1 / ((1 << bits) - 1);
- getOutputLength(inputLength, alpha01) {
- return inputLength * (3 + alpha01);
- }
+ for (var i = 0; i < count; ++i) {
+ convertToRgb(this, src, srcOffset, dest, destOffset, scale);
+ srcOffset += 1;
+ destOffset += 3 + alpha01;
+ }
+ }
+ }, {
+ key: "getOutputLength",
+ value: function getOutputLength(inputLength, alpha01) {
+ return inputLength * (3 + alpha01);
+ }
+ }]);
- }
+ return CalGrayCS;
+ }(ColorSpace);
return CalGrayCS;
}();
-const CalRGBCS = function CalRGBCSClosure() {
- const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
- const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
- const SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
- const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
- const tempNormalizeMatrix = new Float32Array(3);
- const tempConvertMatrix1 = new Float32Array(3);
- const tempConvertMatrix2 = new Float32Array(3);
- const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
+var CalRGBCS = function CalRGBCSClosure() {
+ var BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
+ var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
+ var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
+ var FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
+ var tempNormalizeMatrix = new Float32Array(3);
+ var tempConvertMatrix1 = new Float32Array(3);
+ var tempConvertMatrix2 = new Float32Array(3);
+ var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
function matrixProduct(a, b, result) {
result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
@@ -17939,9 +29261,9 @@ const CalRGBCS = function CalRGBCSClosure() {
}
function convertToD65(sourceWhitePoint, LMS, result) {
- const D65X = 0.95047;
- const D65Y = 1;
- const D65Z = 1.08883;
+ var D65X = 0.95047;
+ var D65Y = 1;
+ var D65Z = 1.08883;
result[0] = LMS[0] * D65X / sourceWhitePoint[0];
result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
@@ -17952,7 +29274,7 @@ const CalRGBCS = function CalRGBCSClosure() {
return adjustToRange(0, 1, 12.92 * color);
}
- return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
+ return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
}
function adjustToRange(min, max, value) {
@@ -17965,7 +29287,7 @@ const CalRGBCS = function CalRGBCSClosure() {
}
if (L > 8.0) {
- return ((L + 16) / 116) ** 3;
+ return Math.pow((L + 16) / 116, 3);
}
return L * DECODE_L_CONSTANT;
@@ -17979,19 +29301,19 @@ const CalRGBCS = function CalRGBCSClosure() {
return;
}
- const zeroDecodeL = decodeL(0);
- const X_DST = zeroDecodeL;
- const X_SRC = decodeL(sourceBlackPoint[0]);
- const Y_DST = zeroDecodeL;
- const Y_SRC = decodeL(sourceBlackPoint[1]);
- const Z_DST = zeroDecodeL;
- const Z_SRC = decodeL(sourceBlackPoint[2]);
- const X_Scale = (1 - X_DST) / (1 - X_SRC);
- const X_Offset = 1 - X_Scale;
- const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
- const Y_Offset = 1 - Y_Scale;
- const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
- const Z_Offset = 1 - Z_Scale;
+ var zeroDecodeL = decodeL(0);
+ var X_DST = zeroDecodeL;
+ var X_SRC = decodeL(sourceBlackPoint[0]);
+ var Y_DST = zeroDecodeL;
+ var Y_SRC = decodeL(sourceBlackPoint[1]);
+ var Z_DST = zeroDecodeL;
+ var Z_SRC = decodeL(sourceBlackPoint[2]);
+ var X_Scale = (1 - X_DST) / (1 - X_SRC);
+ var X_Offset = 1 - X_Scale;
+ var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
+ var Y_Offset = 1 - Y_Scale;
+ var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
+ var Z_Offset = 1 - Z_Scale;
result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
@@ -18005,51 +29327,59 @@ const CalRGBCS = function CalRGBCSClosure() {
return;
}
- const LMS = result;
+ var LMS = result;
matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
- const LMS_Flat = tempNormalizeMatrix;
+ var LMS_Flat = tempNormalizeMatrix;
convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
}
function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
- const LMS = result;
+ var LMS = result;
matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
- const LMS_D65 = tempNormalizeMatrix;
+ var LMS_D65 = tempNormalizeMatrix;
convertToD65(sourceWhitePoint, LMS, LMS_D65);
matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
}
function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
- const A = adjustToRange(0, 1, src[srcOffset] * scale);
- const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
- const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
- const AGR = A ** cs.GR;
- const BGG = B ** cs.GG;
- const CGB = C ** cs.GB;
- const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
- const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
- const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
- const XYZ = tempConvertMatrix1;
+ var A = adjustToRange(0, 1, src[srcOffset] * scale);
+ var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
+ var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
+ var AGR = Math.pow(A, cs.GR);
+ var BGG = Math.pow(B, cs.GG);
+ var CGB = Math.pow(C, cs.GB);
+ var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
+ var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
+ var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
+ var XYZ = tempConvertMatrix1;
XYZ[0] = X;
XYZ[1] = Y;
XYZ[2] = Z;
- const XYZ_Flat = tempConvertMatrix2;
+ var XYZ_Flat = tempConvertMatrix2;
normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
- const XYZ_Black = tempConvertMatrix1;
+ var XYZ_Black = tempConvertMatrix1;
compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
- const XYZ_D65 = tempConvertMatrix2;
+ var XYZ_D65 = tempConvertMatrix2;
normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
- const SRGB = tempConvertMatrix1;
+ var SRGB = tempConvertMatrix1;
matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
}
- class CalRGBCS extends ColorSpace {
- constructor(whitePoint, blackPoint, gamma, matrix) {
- super("CalRGB", 3);
+ var CalRGBCS = /*#__PURE__*/function (_ColorSpace8) {
+ _inherits(CalRGBCS, _ColorSpace8);
+
+ var _super8 = _createSuper(CalRGBCS);
+
+ function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
+ var _this5;
+
+ _classCallCheck(this, CalRGBCS);
+
+ _this5 = _super8.call(this, "CalRGB", 3);
if (!whitePoint) {
throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
@@ -18058,68 +29388,76 @@ const CalRGBCS = function CalRGBCSClosure() {
blackPoint = blackPoint || new Float32Array(3);
gamma = gamma || new Float32Array([1, 1, 1]);
matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
- const XW = whitePoint[0];
- const YW = whitePoint[1];
- const ZW = whitePoint[2];
- this.whitePoint = whitePoint;
- const XB = blackPoint[0];
- const YB = blackPoint[1];
- const ZB = blackPoint[2];
- this.blackPoint = blackPoint;
- this.GR = gamma[0];
- this.GG = gamma[1];
- this.GB = gamma[2];
- this.MXA = matrix[0];
- this.MYA = matrix[1];
- this.MZA = matrix[2];
- this.MXB = matrix[3];
- this.MYB = matrix[4];
- this.MZB = matrix[5];
- this.MXC = matrix[6];
- this.MYC = matrix[7];
- this.MZC = matrix[8];
+ var XW = whitePoint[0];
+ var YW = whitePoint[1];
+ var ZW = whitePoint[2];
+ _this5.whitePoint = whitePoint;
+ var XB = blackPoint[0];
+ var YB = blackPoint[1];
+ var ZB = blackPoint[2];
+ _this5.blackPoint = blackPoint;
+ _this5.GR = gamma[0];
+ _this5.GG = gamma[1];
+ _this5.GB = gamma[2];
+ _this5.MXA = matrix[0];
+ _this5.MYA = matrix[1];
+ _this5.MZA = matrix[2];
+ _this5.MXB = matrix[3];
+ _this5.MYB = matrix[4];
+ _this5.MZB = matrix[5];
+ _this5.MXC = matrix[6];
+ _this5.MYC = matrix[7];
+ _this5.MZC = matrix[8];
if (XW < 0 || ZW < 0 || YW !== 1) {
- throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
+ throw new _util.FormatError("Invalid WhitePoint components for ".concat(_this5.name) + ", no fallback available");
}
if (XB < 0 || YB < 0 || ZB < 0) {
- (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
- this.blackPoint = new Float32Array(3);
+ (0, _util.info)("Invalid BlackPoint for ".concat(_this5.name, " [").concat(XB, ", ").concat(YB, ", ").concat(ZB, "], ") + "falling back to default.");
+ _this5.blackPoint = new Float32Array(3);
}
- if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
- (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
- this.GR = this.GG = this.GB = 1;
+ if (_this5.GR < 0 || _this5.GG < 0 || _this5.GB < 0) {
+ (0, _util.info)("Invalid Gamma [".concat(_this5.GR, ", ").concat(_this5.GG, ", ").concat(_this5.GB, "] for ") + "".concat(_this5.name, ", falling back to default."));
+ _this5.GR = _this5.GG = _this5.GB = 1;
}
- }
- getRgbItem(src, srcOffset, dest, destOffset) {
- convertToRgb(this, src, srcOffset, dest, destOffset, 1);
+ return _this5;
}
- getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- const scale = 1 / ((1 << bits) - 1);
-
- for (let i = 0; i < count; ++i) {
- convertToRgb(this, src, srcOffset, dest, destOffset, scale);
- srcOffset += 3;
- destOffset += 3 + alpha01;
+ _createClass(CalRGBCS, [{
+ key: "getRgbItem",
+ value: function getRgbItem(src, srcOffset, dest, destOffset) {
+ convertToRgb(this, src, srcOffset, dest, destOffset, 1);
}
- }
+ }, {
+ key: "getRgbBuffer",
+ value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+ var scale = 1 / ((1 << bits) - 1);
- getOutputLength(inputLength, alpha01) {
- return inputLength * (3 + alpha01) / 3 | 0;
- }
+ for (var i = 0; i < count; ++i) {
+ convertToRgb(this, src, srcOffset, dest, destOffset, scale);
+ srcOffset += 3;
+ destOffset += 3 + alpha01;
+ }
+ }
+ }, {
+ key: "getOutputLength",
+ value: function getOutputLength(inputLength, alpha01) {
+ return inputLength * (3 + alpha01) / 3 | 0;
+ }
+ }]);
- }
+ return CalRGBCS;
+ }(ColorSpace);
return CalRGBCS;
}();
-const LabCS = function LabCSClosure() {
+var LabCS = function LabCSClosure() {
function fn_g(x) {
- let result;
+ var result;
if (x >= 6 / 29) {
result = x * x * x;
@@ -18135,9 +29473,9 @@ const LabCS = function LabCSClosure() {
}
function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
- let Ls = src[srcOffset];
- let as = src[srcOffset + 1];
- let bs = src[srcOffset + 2];
+ var Ls = src[srcOffset];
+ var as = src[srcOffset + 1];
+ var bs = src[srcOffset + 2];
if (maxVal !== false) {
Ls = decode(Ls, maxVal, 0, 100);
@@ -18157,13 +29495,13 @@ const LabCS = function LabCSClosure() {
bs = cs.bmin;
}
- const M = (Ls + 16) / 116;
- const L = M + as / 500;
- const N = M - bs / 200;
- const X = cs.XW * fn_g(L);
- const Y = cs.YW * fn_g(M);
- const Z = cs.ZW * fn_g(N);
- let r, g, b;
+ var M = (Ls + 16) / 116;
+ var L = M + as / 500;
+ var N = M - bs / 200;
+ var X = cs.XW * fn_g(L);
+ var Y = cs.YW * fn_g(M);
+ var Z = cs.ZW * fn_g(N);
+ var r, g, b;
if (cs.ZW < 1) {
r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
@@ -18180,9 +29518,17 @@ const LabCS = function LabCSClosure() {
dest[destOffset + 2] = Math.sqrt(b) * 255;
}
- class LabCS extends ColorSpace {
- constructor(whitePoint, blackPoint, range) {
- super("Lab", 3);
+ var LabCS = /*#__PURE__*/function (_ColorSpace9) {
+ _inherits(LabCS, _ColorSpace9);
+
+ var _super9 = _createSuper(LabCS);
+
+ function LabCS(whitePoint, blackPoint, range) {
+ var _this6;
+
+ _classCallCheck(this, LabCS);
+
+ _this6 = _super9.call(this, "Lab", 3);
if (!whitePoint) {
throw new _util.FormatError("WhitePoint missing - required for color space Lab");
@@ -18190,68 +29536,78 @@ const LabCS = function LabCSClosure() {
blackPoint = blackPoint || [0, 0, 0];
range = range || [-100, 100, -100, 100];
- this.XW = whitePoint[0];
- this.YW = whitePoint[1];
- this.ZW = whitePoint[2];
- this.amin = range[0];
- this.amax = range[1];
- this.bmin = range[2];
- this.bmax = range[3];
- this.XB = blackPoint[0];
- this.YB = blackPoint[1];
- this.ZB = blackPoint[2];
-
- if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
+ _this6.XW = whitePoint[0];
+ _this6.YW = whitePoint[1];
+ _this6.ZW = whitePoint[2];
+ _this6.amin = range[0];
+ _this6.amax = range[1];
+ _this6.bmin = range[2];
+ _this6.bmax = range[3];
+ _this6.XB = blackPoint[0];
+ _this6.YB = blackPoint[1];
+ _this6.ZB = blackPoint[2];
+
+ if (_this6.XW < 0 || _this6.ZW < 0 || _this6.YW !== 1) {
throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
}
- if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
+ if (_this6.XB < 0 || _this6.YB < 0 || _this6.ZB < 0) {
(0, _util.info)("Invalid BlackPoint, falling back to default");
- this.XB = this.YB = this.ZB = 0;
+ _this6.XB = _this6.YB = _this6.ZB = 0;
}
- if (this.amin > this.amax || this.bmin > this.bmax) {
+ if (_this6.amin > _this6.amax || _this6.bmin > _this6.bmax) {
(0, _util.info)("Invalid Range, falling back to defaults");
- this.amin = -100;
- this.amax = 100;
- this.bmin = -100;
- this.bmax = 100;
+ _this6.amin = -100;
+ _this6.amax = 100;
+ _this6.bmin = -100;
+ _this6.bmax = 100;
}
- }
- getRgbItem(src, srcOffset, dest, destOffset) {
- convertToRgb(this, src, srcOffset, false, dest, destOffset);
+ return _this6;
}
- getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
- const maxVal = (1 << bits) - 1;
-
- for (let i = 0; i < count; i++) {
- convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
- srcOffset += 3;
- destOffset += 3 + alpha01;
+ _createClass(LabCS, [{
+ key: "getRgbItem",
+ value: function getRgbItem(src, srcOffset, dest, destOffset) {
+ convertToRgb(this, src, srcOffset, false, dest, destOffset);
}
- }
-
- getOutputLength(inputLength, alpha01) {
- return inputLength * (3 + alpha01) / 3 | 0;
- }
-
- isDefaultDecode(decodeMap, bpc) {
- return true;
- }
+ }, {
+ key: "getRgbBuffer",
+ value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
+ var maxVal = (1 << bits) - 1;
- get usesZeroToOneRange() {
- return (0, _util.shadow)(this, "usesZeroToOneRange", false);
- }
+ for (var i = 0; i < count; i++) {
+ convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
+ srcOffset += 3;
+ destOffset += 3 + alpha01;
+ }
+ }
+ }, {
+ key: "getOutputLength",
+ value: function getOutputLength(inputLength, alpha01) {
+ return inputLength * (3 + alpha01) / 3 | 0;
+ }
+ }, {
+ key: "isDefaultDecode",
+ value: function isDefaultDecode(decodeMap, bpc) {
+ return true;
+ }
+ }, {
+ key: "usesZeroToOneRange",
+ get: function get() {
+ return (0, _util.shadow)(this, "usesZeroToOneRange", false);
+ }
+ }]);
- }
+ return LabCS;
+ }(ColorSpace);
return LabCS;
}();
/***/ }),
-/* 24 */
+/* 217 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -18262,151 +29618,184 @@ Object.defineProperty(exports, "__esModule", {
});
exports.GlobalImageCache = exports.LocalImageCache = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+var _primitives = __w_pdfjs_require__(198);
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-var _primitives = __w_pdfjs_require__(5);
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var LocalImageCache = /*#__PURE__*/function () {
+ function LocalImageCache() {
+ _classCallCheck(this, LocalImageCache);
-class LocalImageCache {
- constructor() {
this._nameRefMap = new Map();
this._imageMap = new Map();
this._imageCache = new _primitives.RefSetCache();
}
- getByName(name) {
- const ref = this._nameRefMap.get(name);
+ _createClass(LocalImageCache, [{
+ key: "getByName",
+ value: function getByName(name) {
+ var ref = this._nameRefMap.get(name);
+
+ if (ref) {
+ return this.getByRef(ref);
+ }
- if (ref) {
- return this.getByRef(ref);
+ return this._imageMap.get(name) || null;
}
+ }, {
+ key: "getByRef",
+ value: function getByRef(ref) {
+ return this._imageCache.get(ref) || null;
+ }
+ }, {
+ key: "set",
+ value: function set(name) {
+ var ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
+ var data = arguments.length > 2 ? arguments[2] : undefined;
- return this._imageMap.get(name) || null;
- }
+ if (!name) {
+ throw new Error('LocalImageCache.set - expected "name" argument.');
+ }
- getByRef(ref) {
- return this._imageCache.get(ref) || null;
- }
+ if (ref) {
+ if (this._imageCache.has(ref)) {
+ return;
+ }
- set(name, ref = null, data) {
- if (!name) {
- throw new Error('LocalImageCache.set - expected "name" argument.');
- }
+ this._nameRefMap.set(name, ref);
+
+ this._imageCache.put(ref, data);
- if (ref) {
- if (this._imageCache.has(ref)) {
return;
}
- this._nameRefMap.set(name, ref);
-
- this._imageCache.put(ref, data);
-
- return;
- }
+ if (this._imageMap.has(name)) {
+ return;
+ }
- if (this._imageMap.has(name)) {
- return;
+ this._imageMap.set(name, data);
}
+ }]);
- this._imageMap.set(name, data);
- }
-
-}
+ return LocalImageCache;
+}();
exports.LocalImageCache = LocalImageCache;
-class GlobalImageCache {
- static get NUM_PAGES_THRESHOLD() {
- return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
- }
+var GlobalImageCache = /*#__PURE__*/function () {
+ _createClass(GlobalImageCache, null, [{
+ key: "NUM_PAGES_THRESHOLD",
+ get: function get() {
+ return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
+ }
+ }, {
+ key: "MAX_IMAGES_TO_CACHE",
+ get: function get() {
+ return (0, _util.shadow)(this, "MAX_IMAGES_TO_CACHE", 10);
+ }
+ }]);
- static get MAX_IMAGES_TO_CACHE() {
- return (0, _util.shadow)(this, "MAX_IMAGES_TO_CACHE", 10);
- }
+ function GlobalImageCache() {
+ _classCallCheck(this, GlobalImageCache);
- constructor() {
this._refCache = new _primitives.RefSetCache();
this._imageCache = new _primitives.RefSetCache();
}
- shouldCache(ref, pageIndex) {
- const pageIndexSet = this._refCache.get(ref);
+ _createClass(GlobalImageCache, [{
+ key: "shouldCache",
+ value: function shouldCache(ref, pageIndex) {
+ var pageIndexSet = this._refCache.get(ref);
- const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
+ var numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
- if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
- return false;
- }
+ if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
+ return false;
+ }
- if (!this._imageCache.has(ref) && this._imageCache.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) {
- return false;
- }
+ if (!this._imageCache.has(ref) && this._imageCache.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
+ }, {
+ key: "addPageIndex",
+ value: function addPageIndex(ref, pageIndex) {
+ var pageIndexSet = this._refCache.get(ref);
- addPageIndex(ref, pageIndex) {
- let pageIndexSet = this._refCache.get(ref);
+ if (!pageIndexSet) {
+ pageIndexSet = new Set();
- if (!pageIndexSet) {
- pageIndexSet = new Set();
+ this._refCache.put(ref, pageIndexSet);
+ }
- this._refCache.put(ref, pageIndexSet);
+ pageIndexSet.add(pageIndex);
}
+ }, {
+ key: "getData",
+ value: function getData(ref, pageIndex) {
+ if (!this._refCache.has(ref)) {
+ return null;
+ }
- pageIndexSet.add(pageIndex);
- }
-
- getData(ref, pageIndex) {
- if (!this._refCache.has(ref)) {
- return null;
- }
+ var pageIndexSet = this._refCache.get(ref);
- const pageIndexSet = this._refCache.get(ref);
+ if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
+ return null;
+ }
- if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
- return null;
- }
+ if (!this._imageCache.has(ref)) {
+ return null;
+ }
- if (!this._imageCache.has(ref)) {
- return null;
+ pageIndexSet.add(pageIndex);
+ return this._imageCache.get(ref);
}
+ }, {
+ key: "setData",
+ value: function setData(ref, data) {
+ if (!this._refCache.has(ref)) {
+ throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
+ }
- pageIndexSet.add(pageIndex);
- return this._imageCache.get(ref);
- }
-
- setData(ref, data) {
- if (!this._refCache.has(ref)) {
- throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
- }
+ if (this._imageCache.has(ref)) {
+ return;
+ }
- if (this._imageCache.has(ref)) {
- return;
- }
+ if (this._imageCache.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) {
+ (0, _util.info)("GlobalImageCache.setData - ignoring image above MAX_IMAGES_TO_CACHE.");
+ return;
+ }
- if (this._imageCache.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) {
- (0, _util.info)("GlobalImageCache.setData - ignoring image above MAX_IMAGES_TO_CACHE.");
- return;
+ this._imageCache.put(ref, data);
}
+ }, {
+ key: "clear",
+ value: function clear() {
+ var onlyData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- this._imageCache.put(ref, data);
- }
+ if (!onlyData) {
+ this._refCache.clear();
+ }
- clear(onlyData = false) {
- if (!onlyData) {
- this._refCache.clear();
+ this._imageCache.clear();
}
+ }]);
- this._imageCache.clear();
- }
-
-}
+ return GlobalImageCache;
+}();
exports.GlobalImageCache = GlobalImageCache;
/***/ }),
-/* 25 */
+/* 218 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -18418,128 +29807,177 @@ Object.defineProperty(exports, "__esModule", {
exports.getQuadPoints = getQuadPoints;
exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
-var _obj = __w_pdfjs_require__(10);
+var _obj = __w_pdfjs_require__(203);
-var _primitives = __w_pdfjs_require__(5);
+var _primitives = __w_pdfjs_require__(198);
-var _colorspace = __w_pdfjs_require__(23);
+var _colorspace = __w_pdfjs_require__(216);
-var _core_utils = __w_pdfjs_require__(8);
+var _core_utils = __w_pdfjs_require__(201);
-var _operator_list = __w_pdfjs_require__(26);
+var _operator_list = __w_pdfjs_require__(219);
-var _stream = __w_pdfjs_require__(12);
+var _stream = __w_pdfjs_require__(205);
-class AnnotationFactory {
- static create(xref, ref, pdfManager, idFactory) {
- return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory]);
- }
+function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
- static _create(xref, ref, pdfManager, idFactory) {
- const dict = xref.fetchIfRef(ref);
+function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
- if (!(0, _primitives.isDict)(dict)) {
- return undefined;
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
+
+function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
+
+function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
+
+function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
+
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
+
+function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var AnnotationFactory = /*#__PURE__*/function () {
+ function AnnotationFactory() {
+ _classCallCheck(this, AnnotationFactory);
+ }
+
+ _createClass(AnnotationFactory, null, [{
+ key: "create",
+ value: function create(xref, ref, pdfManager, idFactory) {
+ return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory]);
}
+ }, {
+ key: "_create",
+ value: function _create(xref, ref, pdfManager, idFactory) {
+ var dict = xref.fetchIfRef(ref);
- const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`;
- let subtype = dict.get("Subtype");
- subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
- const parameters = {
- xref,
- dict,
- subtype,
- id,
- pdfManager
- };
+ if (!(0, _primitives.isDict)(dict)) {
+ return undefined;
+ }
- switch (subtype) {
- case "Link":
- return new LinkAnnotation(parameters);
+ var id = (0, _primitives.isRef)(ref) ? ref.toString() : "annot_".concat(idFactory.createObjId());
+ var subtype = dict.get("Subtype");
+ subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
+ var parameters = {
+ xref: xref,
+ dict: dict,
+ subtype: subtype,
+ id: id,
+ pdfManager: pdfManager
+ };
- case "Text":
- return new TextAnnotation(parameters);
+ switch (subtype) {
+ case "Link":
+ return new LinkAnnotation(parameters);
- case "Widget":
- let fieldType = (0, _core_utils.getInheritableProperty)({
- dict,
- key: "FT"
- });
- fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
+ case "Text":
+ return new TextAnnotation(parameters);
- switch (fieldType) {
- case "Tx":
- return new TextWidgetAnnotation(parameters);
+ case "Widget":
+ var fieldType = (0, _core_utils.getInheritableProperty)({
+ dict: dict,
+ key: "FT"
+ });
+ fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
- case "Btn":
- return new ButtonWidgetAnnotation(parameters);
+ switch (fieldType) {
+ case "Tx":
+ return new TextWidgetAnnotation(parameters);
- case "Ch":
- return new ChoiceWidgetAnnotation(parameters);
- }
+ case "Btn":
+ return new ButtonWidgetAnnotation(parameters);
- (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + "falling back to base field type.");
- return new WidgetAnnotation(parameters);
+ case "Ch":
+ return new ChoiceWidgetAnnotation(parameters);
+ }
- case "Popup":
- return new PopupAnnotation(parameters);
+ (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + "falling back to base field type.");
+ return new WidgetAnnotation(parameters);
- case "FreeText":
- return new FreeTextAnnotation(parameters);
+ case "Popup":
+ return new PopupAnnotation(parameters);
- case "Line":
- return new LineAnnotation(parameters);
+ case "FreeText":
+ return new FreeTextAnnotation(parameters);
- case "Square":
- return new SquareAnnotation(parameters);
+ case "Line":
+ return new LineAnnotation(parameters);
- case "Circle":
- return new CircleAnnotation(parameters);
+ case "Square":
+ return new SquareAnnotation(parameters);
- case "PolyLine":
- return new PolylineAnnotation(parameters);
+ case "Circle":
+ return new CircleAnnotation(parameters);
- case "Polygon":
- return new PolygonAnnotation(parameters);
+ case "PolyLine":
+ return new PolylineAnnotation(parameters);
- case "Caret":
- return new CaretAnnotation(parameters);
+ case "Polygon":
+ return new PolygonAnnotation(parameters);
- case "Ink":
- return new InkAnnotation(parameters);
+ case "Caret":
+ return new CaretAnnotation(parameters);
- case "Highlight":
- return new HighlightAnnotation(parameters);
+ case "Ink":
+ return new InkAnnotation(parameters);
- case "Underline":
- return new UnderlineAnnotation(parameters);
+ case "Highlight":
+ return new HighlightAnnotation(parameters);
- case "Squiggly":
- return new SquigglyAnnotation(parameters);
+ case "Underline":
+ return new UnderlineAnnotation(parameters);
- case "StrikeOut":
- return new StrikeOutAnnotation(parameters);
+ case "Squiggly":
+ return new SquigglyAnnotation(parameters);
- case "Stamp":
- return new StampAnnotation(parameters);
+ case "StrikeOut":
+ return new StrikeOutAnnotation(parameters);
- case "FileAttachment":
- return new FileAttachmentAnnotation(parameters);
+ case "Stamp":
+ return new StampAnnotation(parameters);
- default:
- if (!subtype) {
- (0, _util.warn)("Annotation is missing the required /Subtype.");
- } else {
- (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + "falling back to base annotation.");
- }
+ case "FileAttachment":
+ return new FileAttachmentAnnotation(parameters);
- return new Annotation(parameters);
+ default:
+ if (!subtype) {
+ (0, _util.warn)("Annotation is missing the required /Subtype.");
+ } else {
+ (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + "falling back to base annotation.");
+ }
+
+ return new Annotation(parameters);
+ }
}
- }
+ }]);
-}
+ return AnnotationFactory;
+}();
exports.AnnotationFactory = AnnotationFactory;
@@ -18548,28 +29986,28 @@ function getQuadPoints(dict, rect) {
return null;
}
- const quadPoints = dict.getArray("QuadPoints");
+ var quadPoints = dict.getArray("QuadPoints");
if (!Array.isArray(quadPoints) || quadPoints.length % 8 > 0) {
return null;
}
- const quadPointsLists = [];
+ var quadPointsLists = [];
- for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
+ for (var i = 0, ii = quadPoints.length / 8; i < ii; i++) {
quadPointsLists.push([]);
- for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
- const x = quadPoints[j];
- const y = quadPoints[j + 1];
+ for (var j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
+ var x = quadPoints[j];
+ var y = quadPoints[j + 1];
if (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3]) {
return null;
}
quadPointsLists[i].push({
- x,
- y
+ x: x,
+ y: y
});
}
}
@@ -18578,20 +30016,27 @@ function getQuadPoints(dict, rect) {
}
function getTransformMatrix(rect, bbox, matrix) {
- const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
+ var _Util$getAxialAligned = _util.Util.getAxialAlignedBoundingBox(bbox, matrix),
+ _Util$getAxialAligned2 = _slicedToArray(_Util$getAxialAligned, 4),
+ minX = _Util$getAxialAligned2[0],
+ minY = _Util$getAxialAligned2[1],
+ maxX = _Util$getAxialAligned2[2],
+ maxY = _Util$getAxialAligned2[3];
if (minX === maxX || minY === maxY) {
return [1, 0, 0, 1, rect[0], rect[1]];
}
- const xRatio = (rect[2] - rect[0]) / (maxX - minX);
- const yRatio = (rect[3] - rect[1]) / (maxY - minY);
+ var xRatio = (rect[2] - rect[0]) / (maxX - minX);
+ var yRatio = (rect[3] - rect[1]) / (maxY - minY);
return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
}
-class Annotation {
- constructor(params) {
- const dict = params.dict;
+var Annotation = /*#__PURE__*/function () {
+ function Annotation(params) {
+ _classCallCheck(this, Annotation);
+
+ var dict = params.dict;
this.setContents(dict.get("Contents"));
this.setModificationDate(dict.get("M"));
this.setFlags(dict.get("F"));
@@ -18612,202 +30057,226 @@ class Annotation {
};
}
- _hasFlag(flags, flag) {
- return !!(flags & flag);
- }
-
- _isViewable(flags) {
- return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
- }
-
- _isPrintable(flags) {
- return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN);
- }
-
- get viewable() {
- if (this.flags === 0) {
- return true;
+ _createClass(Annotation, [{
+ key: "_hasFlag",
+ value: function _hasFlag(flags, flag) {
+ return !!(flags & flag);
}
-
- return this._isViewable(this.flags);
- }
-
- get printable() {
- if (this.flags === 0) {
- return false;
+ }, {
+ key: "_isViewable",
+ value: function _isViewable(flags) {
+ return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
}
-
- return this._isPrintable(this.flags);
- }
-
- setContents(contents) {
- this.contents = (0, _util.stringToPDFString)(contents || "");
- }
-
- setModificationDate(modificationDate) {
- this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
- }
-
- setFlags(flags) {
- this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
- }
-
- hasFlag(flag) {
- return this._hasFlag(this.flags, flag);
- }
-
- setRectangle(rectangle) {
- if (Array.isArray(rectangle) && rectangle.length === 4) {
- this.rectangle = _util.Util.normalizeRect(rectangle);
- } else {
- this.rectangle = [0, 0, 0, 0];
+ }, {
+ key: "_isPrintable",
+ value: function _isPrintable(flags) {
+ return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN);
}
- }
-
- setColor(color) {
- const rgbColor = new Uint8ClampedArray(3);
-
- if (!Array.isArray(color)) {
- this.color = rgbColor;
- return;
+ }, {
+ key: "setContents",
+ value: function setContents(contents) {
+ this.contents = (0, _util.stringToPDFString)(contents || "");
}
+ }, {
+ key: "setModificationDate",
+ value: function setModificationDate(modificationDate) {
+ this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
+ }
+ }, {
+ key: "setFlags",
+ value: function setFlags(flags) {
+ this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
+ }
+ }, {
+ key: "hasFlag",
+ value: function hasFlag(flag) {
+ return this._hasFlag(this.flags, flag);
+ }
+ }, {
+ key: "setRectangle",
+ value: function setRectangle(rectangle) {
+ if (Array.isArray(rectangle) && rectangle.length === 4) {
+ this.rectangle = _util.Util.normalizeRect(rectangle);
+ } else {
+ this.rectangle = [0, 0, 0, 0];
+ }
+ }
+ }, {
+ key: "setColor",
+ value: function setColor(color) {
+ var rgbColor = new Uint8ClampedArray(3);
- switch (color.length) {
- case 0:
- this.color = null;
- break;
-
- case 1:
- _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
-
+ if (!Array.isArray(color)) {
this.color = rgbColor;
- break;
+ return;
+ }
- case 3:
- _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
+ switch (color.length) {
+ case 0:
+ this.color = null;
+ break;
- this.color = rgbColor;
- break;
+ case 1:
+ _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
- case 4:
- _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
+ this.color = rgbColor;
+ break;
- this.color = rgbColor;
- break;
+ case 3:
+ _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
- default:
- this.color = rgbColor;
- break;
- }
- }
+ this.color = rgbColor;
+ break;
- setBorderStyle(borderStyle) {
- this.borderStyle = new AnnotationBorderStyle();
+ case 4:
+ _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
- if (!(0, _primitives.isDict)(borderStyle)) {
- return;
- }
+ this.color = rgbColor;
+ break;
- if (borderStyle.has("BS")) {
- const dict = borderStyle.get("BS");
- const dictType = dict.get("Type");
+ default:
+ this.color = rgbColor;
+ break;
+ }
+ }
+ }, {
+ key: "setBorderStyle",
+ value: function setBorderStyle(borderStyle) {
+ this.borderStyle = new AnnotationBorderStyle();
- if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
- this.borderStyle.setWidth(dict.get("W"), this.rectangle);
- this.borderStyle.setStyle(dict.get("S"));
- this.borderStyle.setDashArray(dict.getArray("D"));
+ if (!(0, _primitives.isDict)(borderStyle)) {
+ return;
}
- } else if (borderStyle.has("Border")) {
- const array = borderStyle.getArray("Border");
- if (Array.isArray(array) && array.length >= 3) {
- this.borderStyle.setHorizontalCornerRadius(array[0]);
- this.borderStyle.setVerticalCornerRadius(array[1]);
- this.borderStyle.setWidth(array[2], this.rectangle);
+ if (borderStyle.has("BS")) {
+ var dict = borderStyle.get("BS");
+ var dictType = dict.get("Type");
- if (array.length === 4) {
- this.borderStyle.setDashArray(array[3]);
+ if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
+ this.borderStyle.setWidth(dict.get("W"), this.rectangle);
+ this.borderStyle.setStyle(dict.get("S"));
+ this.borderStyle.setDashArray(dict.getArray("D"));
+ }
+ } else if (borderStyle.has("Border")) {
+ var array = borderStyle.getArray("Border");
+
+ if (Array.isArray(array) && array.length >= 3) {
+ this.borderStyle.setHorizontalCornerRadius(array[0]);
+ this.borderStyle.setVerticalCornerRadius(array[1]);
+ this.borderStyle.setWidth(array[2], this.rectangle);
+
+ if (array.length === 4) {
+ this.borderStyle.setDashArray(array[3]);
+ }
}
+ } else {
+ this.borderStyle.setWidth(0);
}
- } else {
- this.borderStyle.setWidth(0);
}
- }
+ }, {
+ key: "setAppearance",
+ value: function setAppearance(dict) {
+ this.appearance = null;
+ var appearanceStates = dict.get("AP");
- setAppearance(dict) {
- this.appearance = null;
- const appearanceStates = dict.get("AP");
+ if (!(0, _primitives.isDict)(appearanceStates)) {
+ return;
+ }
- if (!(0, _primitives.isDict)(appearanceStates)) {
- return;
- }
+ var normalAppearanceState = appearanceStates.get("N");
- const normalAppearanceState = appearanceStates.get("N");
+ if ((0, _primitives.isStream)(normalAppearanceState)) {
+ this.appearance = normalAppearanceState;
+ return;
+ }
- if ((0, _primitives.isStream)(normalAppearanceState)) {
- this.appearance = normalAppearanceState;
- return;
- }
+ if (!(0, _primitives.isDict)(normalAppearanceState)) {
+ return;
+ }
- if (!(0, _primitives.isDict)(normalAppearanceState)) {
- return;
- }
+ var as = dict.get("AS");
- const as = dict.get("AS");
+ if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
+ return;
+ }
- if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
- return;
+ this.appearance = normalAppearanceState.get(as.name);
}
+ }, {
+ key: "loadResources",
+ value: function loadResources(keys) {
+ return this.appearance.dict.getAsync("Resources").then(function (resources) {
+ if (!resources) {
+ return undefined;
+ }
- this.appearance = normalAppearanceState.get(as.name);
- }
+ var objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);
+ return objectLoader.load().then(function () {
+ return resources;
+ });
+ });
+ }
+ }, {
+ key: "getOperatorList",
+ value: function getOperatorList(evaluator, task, renderForms) {
+ var _this = this;
+
+ if (!this.appearance) {
+ return Promise.resolve(new _operator_list.OperatorList());
+ }
+
+ var data = this.data;
+ var appearanceDict = this.appearance.dict;
+ var resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
+ var bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
+ var matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
+ var transform = getTransformMatrix(data.rect, bbox, matrix);
+ return resourcesPromise.then(function (resources) {
+ var opList = new _operator_list.OperatorList();
+ opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]);
+ return evaluator.getOperatorList({
+ stream: _this.appearance,
+ task: task,
+ resources: resources,
+ operatorList: opList
+ }).then(function () {
+ opList.addOp(_util.OPS.endAnnotation, []);
- loadResources(keys) {
- return this.appearance.dict.getAsync("Resources").then(resources => {
- if (!resources) {
- return undefined;
- }
+ _this.appearance.reset();
- const objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);
- return objectLoader.load().then(function () {
- return resources;
+ return opList;
+ });
});
- });
- }
+ }
+ }, {
+ key: "viewable",
+ get: function get() {
+ if (this.flags === 0) {
+ return true;
+ }
- getOperatorList(evaluator, task, renderForms) {
- if (!this.appearance) {
- return Promise.resolve(new _operator_list.OperatorList());
+ return this._isViewable(this.flags);
}
+ }, {
+ key: "printable",
+ get: function get() {
+ if (this.flags === 0) {
+ return false;
+ }
- const data = this.data;
- const appearanceDict = this.appearance.dict;
- const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
- const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
- const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
- const transform = getTransformMatrix(data.rect, bbox, matrix);
- return resourcesPromise.then(resources => {
- const opList = new _operator_list.OperatorList();
- opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]);
- return evaluator.getOperatorList({
- stream: this.appearance,
- task,
- resources,
- operatorList: opList
- }).then(() => {
- opList.addOp(_util.OPS.endAnnotation, []);
- this.appearance.reset();
- return opList;
- });
- });
- }
+ return this._isPrintable(this.flags);
+ }
+ }]);
-}
+ return Annotation;
+}();
exports.Annotation = Annotation;
-class AnnotationBorderStyle {
- constructor() {
+var AnnotationBorderStyle = /*#__PURE__*/function () {
+ function AnnotationBorderStyle() {
+ _classCallCheck(this, AnnotationBorderStyle);
+
this.width = 1;
this.style = _util.AnnotationBorderStyleType.SOLID;
this.dashArray = [3];
@@ -18815,188 +30284,237 @@ class AnnotationBorderStyle {
this.verticalCornerRadius = 0;
}
- setWidth(width, rect = [0, 0, 0, 0]) {
- if ((0, _primitives.isName)(width)) {
- this.width = 0;
- return;
- }
+ _createClass(AnnotationBorderStyle, [{
+ key: "setWidth",
+ value: function setWidth(width) {
+ var rect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0];
- if (Number.isInteger(width)) {
- if (width > 0) {
- const maxWidth = (rect[2] - rect[0]) / 2;
- const maxHeight = (rect[3] - rect[1]) / 2;
-
- if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
- (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
- width = 1;
- }
+ if ((0, _primitives.isName)(width)) {
+ this.width = 0;
+ return;
}
- this.width = width;
- }
- }
+ if (Number.isInteger(width)) {
+ if (width > 0) {
+ var maxWidth = (rect[2] - rect[0]) / 2;
+ var maxHeight = (rect[3] - rect[1]) / 2;
- setStyle(style) {
- if (!(0, _primitives.isName)(style)) {
- return;
+ if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
+ (0, _util.warn)("AnnotationBorderStyle.setWidth - ignoring width: ".concat(width));
+ width = 1;
+ }
+ }
+
+ this.width = width;
+ }
}
+ }, {
+ key: "setStyle",
+ value: function setStyle(style) {
+ if (!(0, _primitives.isName)(style)) {
+ return;
+ }
- switch (style.name) {
- case "S":
- this.style = _util.AnnotationBorderStyleType.SOLID;
- break;
+ switch (style.name) {
+ case "S":
+ this.style = _util.AnnotationBorderStyleType.SOLID;
+ break;
- case "D":
- this.style = _util.AnnotationBorderStyleType.DASHED;
- break;
+ case "D":
+ this.style = _util.AnnotationBorderStyleType.DASHED;
+ break;
- case "B":
- this.style = _util.AnnotationBorderStyleType.BEVELED;
- break;
+ case "B":
+ this.style = _util.AnnotationBorderStyleType.BEVELED;
+ break;
- case "I":
- this.style = _util.AnnotationBorderStyleType.INSET;
- break;
+ case "I":
+ this.style = _util.AnnotationBorderStyleType.INSET;
+ break;
- case "U":
- this.style = _util.AnnotationBorderStyleType.UNDERLINE;
- break;
+ case "U":
+ this.style = _util.AnnotationBorderStyleType.UNDERLINE;
+ break;
- default:
- break;
+ default:
+ break;
+ }
}
- }
+ }, {
+ key: "setDashArray",
+ value: function setDashArray(dashArray) {
+ if (Array.isArray(dashArray) && dashArray.length > 0) {
+ var isValid = true;
+ var allZeros = true;
- setDashArray(dashArray) {
- if (Array.isArray(dashArray) && dashArray.length > 0) {
- let isValid = true;
- let allZeros = true;
+ var _iterator = _createForOfIteratorHelper(dashArray),
+ _step;
- for (const element of dashArray) {
- const validNumber = +element >= 0;
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ var element = _step.value;
+ var validNumber = +element >= 0;
- if (!validNumber) {
- isValid = false;
- break;
- } else if (element > 0) {
- allZeros = false;
+ if (!validNumber) {
+ isValid = false;
+ break;
+ } else if (element > 0) {
+ allZeros = false;
+ }
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
}
- }
- if (isValid && !allZeros) {
- this.dashArray = dashArray;
- } else {
+ if (isValid && !allZeros) {
+ this.dashArray = dashArray;
+ } else {
+ this.width = 0;
+ }
+ } else if (dashArray) {
this.width = 0;
}
- } else if (dashArray) {
- this.width = 0;
}
- }
-
- setHorizontalCornerRadius(radius) {
- if (Number.isInteger(radius)) {
- this.horizontalCornerRadius = radius;
+ }, {
+ key: "setHorizontalCornerRadius",
+ value: function setHorizontalCornerRadius(radius) {
+ if (Number.isInteger(radius)) {
+ this.horizontalCornerRadius = radius;
+ }
}
- }
-
- setVerticalCornerRadius(radius) {
- if (Number.isInteger(radius)) {
- this.verticalCornerRadius = radius;
+ }, {
+ key: "setVerticalCornerRadius",
+ value: function setVerticalCornerRadius(radius) {
+ if (Number.isInteger(radius)) {
+ this.verticalCornerRadius = radius;
+ }
}
- }
+ }]);
-}
+ return AnnotationBorderStyle;
+}();
exports.AnnotationBorderStyle = AnnotationBorderStyle;
-class MarkupAnnotation extends Annotation {
- constructor(parameters) {
- super(parameters);
- const dict = parameters.dict;
+var MarkupAnnotation = /*#__PURE__*/function (_Annotation) {
+ _inherits(MarkupAnnotation, _Annotation);
+
+ var _super = _createSuper(MarkupAnnotation);
+
+ function MarkupAnnotation(parameters) {
+ var _this2;
+
+ _classCallCheck(this, MarkupAnnotation);
+
+ _this2 = _super.call(this, parameters);
+ var dict = parameters.dict;
if (dict.has("IRT")) {
- const rawIRT = dict.getRaw("IRT");
- this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null;
- const rt = dict.get("RT");
- this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY;
+ var rawIRT = dict.getRaw("IRT");
+ _this2.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null;
+ var rt = dict.get("RT");
+ _this2.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY;
}
- if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
- const parent = dict.get("IRT");
- this.data.title = (0, _util.stringToPDFString)(parent.get("T") || "");
- this.setContents(parent.get("Contents"));
- this.data.contents = this.contents;
+ if (_this2.data.replyType === _util.AnnotationReplyType.GROUP) {
+ var parent = dict.get("IRT");
+ _this2.data.title = (0, _util.stringToPDFString)(parent.get("T") || "");
+
+ _this2.setContents(parent.get("Contents"));
+
+ _this2.data.contents = _this2.contents;
if (!parent.has("CreationDate")) {
- this.data.creationDate = null;
+ _this2.data.creationDate = null;
} else {
- this.setCreationDate(parent.get("CreationDate"));
- this.data.creationDate = this.creationDate;
+ _this2.setCreationDate(parent.get("CreationDate"));
+
+ _this2.data.creationDate = _this2.creationDate;
}
if (!parent.has("M")) {
- this.data.modificationDate = null;
+ _this2.data.modificationDate = null;
} else {
- this.setModificationDate(parent.get("M"));
- this.data.modificationDate = this.modificationDate;
+ _this2.setModificationDate(parent.get("M"));
+
+ _this2.data.modificationDate = _this2.modificationDate;
}
- this.data.hasPopup = parent.has("Popup");
+ _this2.data.hasPopup = parent.has("Popup");
if (!parent.has("C")) {
- this.data.color = null;
+ _this2.data.color = null;
} else {
- this.setColor(parent.getArray("C"));
- this.data.color = this.color;
+ _this2.setColor(parent.getArray("C"));
+
+ _this2.data.color = _this2.color;
}
} else {
- this.data.title = (0, _util.stringToPDFString)(dict.get("T") || "");
- this.setCreationDate(dict.get("CreationDate"));
- this.data.creationDate = this.creationDate;
- this.data.hasPopup = dict.has("Popup");
+ _this2.data.title = (0, _util.stringToPDFString)(dict.get("T") || "");
+
+ _this2.setCreationDate(dict.get("CreationDate"));
+
+ _this2.data.creationDate = _this2.creationDate;
+ _this2.data.hasPopup = dict.has("Popup");
if (!dict.has("C")) {
- this.data.color = null;
+ _this2.data.color = null;
}
}
- }
- setCreationDate(creationDate) {
- this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
+ return _this2;
}
-}
+ _createClass(MarkupAnnotation, [{
+ key: "setCreationDate",
+ value: function setCreationDate(creationDate) {
+ this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
+ }
+ }]);
+
+ return MarkupAnnotation;
+}(Annotation);
exports.MarkupAnnotation = MarkupAnnotation;
-class WidgetAnnotation extends Annotation {
- constructor(params) {
- super(params);
- const dict = params.dict;
- const data = this.data;
+var WidgetAnnotation = /*#__PURE__*/function (_Annotation2) {
+ _inherits(WidgetAnnotation, _Annotation2);
+
+ var _super2 = _createSuper(WidgetAnnotation);
+
+ function WidgetAnnotation(params) {
+ var _this3;
+
+ _classCallCheck(this, WidgetAnnotation);
+
+ _this3 = _super2.call(this, params);
+ var dict = params.dict;
+ var data = _this3.data;
data.annotationType = _util.AnnotationType.WIDGET;
- data.fieldName = this._constructFieldName(dict);
+ data.fieldName = _this3._constructFieldName(dict);
data.fieldValue = (0, _core_utils.getInheritableProperty)({
- dict,
+ dict: dict,
key: "V",
getArray: true
});
data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
data.defaultAppearance = (0, _core_utils.getInheritableProperty)({
- dict,
+ dict: dict,
key: "DA"
}) || "";
- const fieldType = (0, _core_utils.getInheritableProperty)({
- dict,
+ var fieldType = (0, _core_utils.getInheritableProperty)({
+ dict: dict,
key: "FT"
});
data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
- this.fieldResources = (0, _core_utils.getInheritableProperty)({
- dict,
+ _this3.fieldResources = (0, _core_utils.getInheritableProperty)({
+ dict: dict,
key: "DR"
}) || _primitives.Dict.empty;
data.fieldFlags = (0, _core_utils.getInheritableProperty)({
- dict,
+ dict: dict,
key: "Ff"
});
@@ -19004,68 +30522,85 @@ class WidgetAnnotation extends Annotation {
data.fieldFlags = 0;
}
- data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
+ data.readOnly = _this3.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
if (data.fieldType === "Sig") {
data.fieldValue = null;
- this.setFlags(_util.AnnotationFlag.HIDDEN);
+
+ _this3.setFlags(_util.AnnotationFlag.HIDDEN);
}
+
+ return _this3;
}
- _constructFieldName(dict) {
- if (!dict.has("T") && !dict.has("Parent")) {
- (0, _util.warn)("Unknown field name, falling back to empty field name.");
- return "";
- }
+ _createClass(WidgetAnnotation, [{
+ key: "_constructFieldName",
+ value: function _constructFieldName(dict) {
+ if (!dict.has("T") && !dict.has("Parent")) {
+ (0, _util.warn)("Unknown field name, falling back to empty field name.");
+ return "";
+ }
- if (!dict.has("Parent")) {
- return (0, _util.stringToPDFString)(dict.get("T"));
- }
+ if (!dict.has("Parent")) {
+ return (0, _util.stringToPDFString)(dict.get("T"));
+ }
- const fieldName = [];
+ var fieldName = [];
- if (dict.has("T")) {
- fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
- }
+ if (dict.has("T")) {
+ fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
+ }
- let loopDict = dict;
+ var loopDict = dict;
- while (loopDict.has("Parent")) {
- loopDict = loopDict.get("Parent");
+ while (loopDict.has("Parent")) {
+ loopDict = loopDict.get("Parent");
- if (!(0, _primitives.isDict)(loopDict)) {
- break;
+ if (!(0, _primitives.isDict)(loopDict)) {
+ break;
+ }
+
+ if (loopDict.has("T")) {
+ fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
+ }
}
- if (loopDict.has("T")) {
- fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
+ return fieldName.join(".");
+ }
+ }, {
+ key: "hasFieldFlag",
+ value: function hasFieldFlag(flag) {
+ return !!(this.data.fieldFlags & flag);
+ }
+ }, {
+ key: "getOperatorList",
+ value: function getOperatorList(evaluator, task, renderForms) {
+ if (renderForms) {
+ return Promise.resolve(new _operator_list.OperatorList());
}
+
+ return _get(_getPrototypeOf(WidgetAnnotation.prototype), "getOperatorList", this).call(this, evaluator, task, renderForms);
}
+ }]);
- return fieldName.join(".");
- }
+ return WidgetAnnotation;
+}(Annotation);
- hasFieldFlag(flag) {
- return !!(this.data.fieldFlags & flag);
- }
+var TextWidgetAnnotation = /*#__PURE__*/function (_WidgetAnnotation) {
+ _inherits(TextWidgetAnnotation, _WidgetAnnotation);
- getOperatorList(evaluator, task, renderForms) {
- if (renderForms) {
- return Promise.resolve(new _operator_list.OperatorList());
- }
+ var _super3 = _createSuper(TextWidgetAnnotation);
- return super.getOperatorList(evaluator, task, renderForms);
- }
+ function TextWidgetAnnotation(params) {
+ var _this4;
-}
+ _classCallCheck(this, TextWidgetAnnotation);
-class TextWidgetAnnotation extends WidgetAnnotation {
- constructor(params) {
- super(params);
- const dict = params.dict;
- this.data.fieldValue = (0, _util.stringToPDFString)(this.data.fieldValue || "");
- let alignment = (0, _core_utils.getInheritableProperty)({
- dict,
+ _this4 = _super3.call(this, params);
+ var dict = params.dict;
+ _this4.data.fieldValue = (0, _util.stringToPDFString)(_this4.data.fieldValue || "");
+ var alignment = (0, _core_utils.getInheritableProperty)({
+ dict: dict,
key: "Q"
});
@@ -19073,9 +30608,9 @@ class TextWidgetAnnotation extends WidgetAnnotation {
alignment = null;
}
- this.data.textAlignment = alignment;
- let maximumLength = (0, _core_utils.getInheritableProperty)({
- dict,
+ _this4.data.textAlignment = alignment;
+ var maximumLength = (0, _core_utils.getInheritableProperty)({
+ dict: dict,
key: "MaxLen"
});
@@ -19083,413 +30618,635 @@ class TextWidgetAnnotation extends WidgetAnnotation {
maximumLength = null;
}
- this.data.maxLen = maximumLength;
- this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
- this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
+ _this4.data.maxLen = maximumLength;
+ _this4.data.multiLine = _this4.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
+ _this4.data.comb = _this4.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && _this4.data.maxLen !== null;
+ return _this4;
}
- getOperatorList(evaluator, task, renderForms) {
- if (renderForms || this.appearance) {
- return super.getOperatorList(evaluator, task, renderForms);
- }
+ _createClass(TextWidgetAnnotation, [{
+ key: "getOperatorList",
+ value: function getOperatorList(evaluator, task, renderForms) {
+ if (renderForms || this.appearance) {
+ return _get(_getPrototypeOf(TextWidgetAnnotation.prototype), "getOperatorList", this).call(this, evaluator, task, renderForms);
+ }
- const operatorList = new _operator_list.OperatorList();
+ var operatorList = new _operator_list.OperatorList();
- if (!this.data.defaultAppearance) {
- return Promise.resolve(operatorList);
+ if (!this.data.defaultAppearance) {
+ return Promise.resolve(operatorList);
+ }
+
+ var stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance));
+ return evaluator.getOperatorList({
+ stream: stream,
+ task: task,
+ resources: this.fieldResources,
+ operatorList: operatorList
+ }).then(function () {
+ return operatorList;
+ });
}
+ }]);
- const stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance));
- return evaluator.getOperatorList({
- stream,
- task,
- resources: this.fieldResources,
- operatorList
- }).then(function () {
- return operatorList;
- });
- }
+ return TextWidgetAnnotation;
+}(WidgetAnnotation);
-}
+var ButtonWidgetAnnotation = /*#__PURE__*/function (_WidgetAnnotation2) {
+ _inherits(ButtonWidgetAnnotation, _WidgetAnnotation2);
+
+ var _super4 = _createSuper(ButtonWidgetAnnotation);
+
+ function ButtonWidgetAnnotation(params) {
+ var _this5;
-class ButtonWidgetAnnotation extends WidgetAnnotation {
- constructor(params) {
- super(params);
- this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
- this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
- this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
-
- if (this.data.checkBox) {
- this._processCheckBox(params);
- } else if (this.data.radioButton) {
- this._processRadioButton(params);
- } else if (this.data.pushButton) {
- this._processPushButton(params);
+ _classCallCheck(this, ButtonWidgetAnnotation);
+
+ _this5 = _super4.call(this, params);
+ _this5.data.checkBox = !_this5.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
+ _this5.data.radioButton = _this5.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
+ _this5.data.pushButton = _this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
+
+ if (_this5.data.checkBox) {
+ _this5._processCheckBox(params);
+ } else if (_this5.data.radioButton) {
+ _this5._processRadioButton(params);
+ } else if (_this5.data.pushButton) {
+ _this5._processPushButton(params);
} else {
(0, _util.warn)("Invalid field flags for button widget annotation");
}
+
+ return _this5;
}
- _processCheckBox(params) {
- if ((0, _primitives.isName)(this.data.fieldValue)) {
- this.data.fieldValue = this.data.fieldValue.name;
- }
+ _createClass(ButtonWidgetAnnotation, [{
+ key: "_processCheckBox",
+ value: function _processCheckBox(params) {
+ if ((0, _primitives.isName)(this.data.fieldValue)) {
+ this.data.fieldValue = this.data.fieldValue.name;
+ }
- const customAppearance = params.dict.get("AP");
+ var customAppearance = params.dict.get("AP");
- if (!(0, _primitives.isDict)(customAppearance)) {
- return;
- }
+ if (!(0, _primitives.isDict)(customAppearance)) {
+ return;
+ }
- const exportValueOptionsDict = customAppearance.get("D");
+ var exportValueOptionsDict = customAppearance.get("D");
- if (!(0, _primitives.isDict)(exportValueOptionsDict)) {
- return;
- }
+ if (!(0, _primitives.isDict)(exportValueOptionsDict)) {
+ return;
+ }
- const exportValues = exportValueOptionsDict.getKeys();
- const hasCorrectOptionCount = exportValues.length === 2;
+ var exportValues = exportValueOptionsDict.getKeys();
+ var hasCorrectOptionCount = exportValues.length === 2;
- if (!hasCorrectOptionCount) {
- return;
+ if (!hasCorrectOptionCount) {
+ return;
+ }
+
+ this.data.exportValue = exportValues[0] === "Off" ? exportValues[1] : exportValues[0];
}
+ }, {
+ key: "_processRadioButton",
+ value: function _processRadioButton(params) {
+ this.data.fieldValue = this.data.buttonValue = null;
+ var fieldParent = params.dict.get("Parent");
- this.data.exportValue = exportValues[0] === "Off" ? exportValues[1] : exportValues[0];
- }
+ if ((0, _primitives.isDict)(fieldParent) && fieldParent.has("V")) {
+ var fieldParentValue = fieldParent.get("V");
- _processRadioButton(params) {
- this.data.fieldValue = this.data.buttonValue = null;
- const fieldParent = params.dict.get("Parent");
+ if ((0, _primitives.isName)(fieldParentValue)) {
+ this.data.fieldValue = fieldParentValue.name;
+ }
+ }
- if ((0, _primitives.isDict)(fieldParent) && fieldParent.has("V")) {
- const fieldParentValue = fieldParent.get("V");
+ var appearanceStates = params.dict.get("AP");
- if ((0, _primitives.isName)(fieldParentValue)) {
- this.data.fieldValue = fieldParentValue.name;
+ if (!(0, _primitives.isDict)(appearanceStates)) {
+ return;
}
- }
- const appearanceStates = params.dict.get("AP");
+ var normalAppearanceState = appearanceStates.get("N");
- if (!(0, _primitives.isDict)(appearanceStates)) {
- return;
- }
+ if (!(0, _primitives.isDict)(normalAppearanceState)) {
+ return;
+ }
- const normalAppearanceState = appearanceStates.get("N");
+ var _iterator2 = _createForOfIteratorHelper(normalAppearanceState.getKeys()),
+ _step2;
- if (!(0, _primitives.isDict)(normalAppearanceState)) {
- return;
- }
+ try {
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
+ var key = _step2.value;
- for (const key of normalAppearanceState.getKeys()) {
- if (key !== "Off") {
- this.data.buttonValue = key;
- break;
+ if (key !== "Off") {
+ this.data.buttonValue = key;
+ break;
+ }
+ }
+ } catch (err) {
+ _iterator2.e(err);
+ } finally {
+ _iterator2.f();
}
}
- }
+ }, {
+ key: "_processPushButton",
+ value: function _processPushButton(params) {
+ if (!params.dict.has("A")) {
+ (0, _util.warn)("Push buttons without action dictionaries are not supported");
+ return;
+ }
- _processPushButton(params) {
- if (!params.dict.has("A")) {
- (0, _util.warn)("Push buttons without action dictionaries are not supported");
- return;
+ _obj.Catalog.parseDestDictionary({
+ destDict: params.dict,
+ resultObj: this.data,
+ docBaseUrl: params.pdfManager.docBaseUrl
+ });
}
+ }]);
- _obj.Catalog.parseDestDictionary({
- destDict: params.dict,
- resultObj: this.data,
- docBaseUrl: params.pdfManager.docBaseUrl
- });
- }
+ return ButtonWidgetAnnotation;
+}(WidgetAnnotation);
-}
+var ChoiceWidgetAnnotation = /*#__PURE__*/function (_WidgetAnnotation3) {
+ _inherits(ChoiceWidgetAnnotation, _WidgetAnnotation3);
+
+ var _super5 = _createSuper(ChoiceWidgetAnnotation);
+
+ function ChoiceWidgetAnnotation(params) {
+ var _this6;
-class ChoiceWidgetAnnotation extends WidgetAnnotation {
- constructor(params) {
- super(params);
- this.data.options = [];
- const options = (0, _core_utils.getInheritableProperty)({
+ _classCallCheck(this, ChoiceWidgetAnnotation);
+
+ _this6 = _super5.call(this, params);
+ _this6.data.options = [];
+ var options = (0, _core_utils.getInheritableProperty)({
dict: params.dict,
key: "Opt"
});
if (Array.isArray(options)) {
- const xref = params.xref;
+ var xref = params.xref;
- for (let i = 0, ii = options.length; i < ii; i++) {
- const option = xref.fetchIfRef(options[i]);
- const isOptionArray = Array.isArray(option);
- this.data.options[i] = {
+ for (var i = 0, ii = options.length; i < ii; i++) {
+ var option = xref.fetchIfRef(options[i]);
+ var isOptionArray = Array.isArray(option);
+ _this6.data.options[i] = {
exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
displayValue: (0, _util.stringToPDFString)(isOptionArray ? xref.fetchIfRef(option[1]) : option)
};
}
}
- if (!Array.isArray(this.data.fieldValue)) {
- this.data.fieldValue = [this.data.fieldValue];
+ if (!Array.isArray(_this6.data.fieldValue)) {
+ _this6.data.fieldValue = [_this6.data.fieldValue];
}
- this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
- this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
+ _this6.data.combo = _this6.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
+ _this6.data.multiSelect = _this6.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
+ return _this6;
}
-}
+ return ChoiceWidgetAnnotation;
+}(WidgetAnnotation);
+
+var TextAnnotation = /*#__PURE__*/function (_MarkupAnnotation) {
+ _inherits(TextAnnotation, _MarkupAnnotation);
+
+ var _super6 = _createSuper(TextAnnotation);
-class TextAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- const DEFAULT_ICON_SIZE = 22;
- super(parameters);
- const dict = parameters.dict;
- this.data.annotationType = _util.AnnotationType.TEXT;
+ function TextAnnotation(parameters) {
+ var _this7;
- if (this.data.hasAppearance) {
- this.data.name = "NoIcon";
+ _classCallCheck(this, TextAnnotation);
+
+ var DEFAULT_ICON_SIZE = 22;
+ _this7 = _super6.call(this, parameters);
+ var dict = parameters.dict;
+ _this7.data.annotationType = _util.AnnotationType.TEXT;
+
+ if (_this7.data.hasAppearance) {
+ _this7.data.name = "NoIcon";
} else {
- this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
- this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
- this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
+ _this7.data.rect[1] = _this7.data.rect[3] - DEFAULT_ICON_SIZE;
+ _this7.data.rect[2] = _this7.data.rect[0] + DEFAULT_ICON_SIZE;
+ _this7.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
}
if (dict.has("State")) {
- this.data.state = dict.get("State") || null;
- this.data.stateModel = dict.get("StateModel") || null;
+ _this7.data.state = dict.get("State") || null;
+ _this7.data.stateModel = dict.get("StateModel") || null;
} else {
- this.data.state = null;
- this.data.stateModel = null;
+ _this7.data.state = null;
+ _this7.data.stateModel = null;
}
+
+ return _this7;
}
-}
+ return TextAnnotation;
+}(MarkupAnnotation);
+
+var LinkAnnotation = /*#__PURE__*/function (_Annotation3) {
+ _inherits(LinkAnnotation, _Annotation3);
+
+ var _super7 = _createSuper(LinkAnnotation);
+
+ function LinkAnnotation(params) {
+ var _this8;
-class LinkAnnotation extends Annotation {
- constructor(params) {
- super(params);
- this.data.annotationType = _util.AnnotationType.LINK;
- const quadPoints = getQuadPoints(params.dict, this.rectangle);
+ _classCallCheck(this, LinkAnnotation);
+
+ _this8 = _super7.call(this, params);
+ _this8.data.annotationType = _util.AnnotationType.LINK;
+ var quadPoints = getQuadPoints(params.dict, _this8.rectangle);
if (quadPoints) {
- this.data.quadPoints = quadPoints;
+ _this8.data.quadPoints = quadPoints;
}
_obj.Catalog.parseDestDictionary({
destDict: params.dict,
- resultObj: this.data,
+ resultObj: _this8.data,
docBaseUrl: params.pdfManager.docBaseUrl
});
+
+ return _this8;
}
-}
+ return LinkAnnotation;
+}(Annotation);
-class PopupAnnotation extends Annotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.POPUP;
- let parentItem = parameters.dict.get("Parent");
+var PopupAnnotation = /*#__PURE__*/function (_Annotation4) {
+ _inherits(PopupAnnotation, _Annotation4);
+
+ var _super8 = _createSuper(PopupAnnotation);
+
+ function PopupAnnotation(parameters) {
+ var _this9;
+
+ _classCallCheck(this, PopupAnnotation);
+
+ _this9 = _super8.call(this, parameters);
+ _this9.data.annotationType = _util.AnnotationType.POPUP;
+ var parentItem = parameters.dict.get("Parent");
if (!parentItem) {
(0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
- return;
+ return _possibleConstructorReturn(_this9);
}
- const parentSubtype = parentItem.get("Subtype");
- this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
- const rawParent = parameters.dict.getRaw("Parent");
- this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null;
- const rt = parentItem.get("RT");
+ var parentSubtype = parentItem.get("Subtype");
+ _this9.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
+ var rawParent = parameters.dict.getRaw("Parent");
+ _this9.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null;
+ var rt = parentItem.get("RT");
if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
parentItem = parentItem.get("IRT");
}
if (!parentItem.has("M")) {
- this.data.modificationDate = null;
+ _this9.data.modificationDate = null;
} else {
- this.setModificationDate(parentItem.get("M"));
- this.data.modificationDate = this.modificationDate;
+ _this9.setModificationDate(parentItem.get("M"));
+
+ _this9.data.modificationDate = _this9.modificationDate;
}
if (!parentItem.has("C")) {
- this.data.color = null;
+ _this9.data.color = null;
} else {
- this.setColor(parentItem.getArray("C"));
- this.data.color = this.color;
+ _this9.setColor(parentItem.getArray("C"));
+
+ _this9.data.color = _this9.color;
}
- if (!this.viewable) {
- const parentFlags = parentItem.get("F");
+ if (!_this9.viewable) {
+ var parentFlags = parentItem.get("F");
- if (this._isViewable(parentFlags)) {
- this.setFlags(parentFlags);
+ if (_this9._isViewable(parentFlags)) {
+ _this9.setFlags(parentFlags);
}
}
- this.data.title = (0, _util.stringToPDFString)(parentItem.get("T") || "");
- this.data.contents = (0, _util.stringToPDFString)(parentItem.get("Contents") || "");
+ _this9.data.title = (0, _util.stringToPDFString)(parentItem.get("T") || "");
+ _this9.data.contents = (0, _util.stringToPDFString)(parentItem.get("Contents") || "");
+ return _this9;
}
-}
+ return PopupAnnotation;
+}(Annotation);
+
+var FreeTextAnnotation = /*#__PURE__*/function (_MarkupAnnotation2) {
+ _inherits(FreeTextAnnotation, _MarkupAnnotation2);
+
+ var _super9 = _createSuper(FreeTextAnnotation);
+
+ function FreeTextAnnotation(parameters) {
+ var _this10;
-class FreeTextAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.FREETEXT;
+ _classCallCheck(this, FreeTextAnnotation);
+
+ _this10 = _super9.call(this, parameters);
+ _this10.data.annotationType = _util.AnnotationType.FREETEXT;
+ return _this10;
}
-}
+ return FreeTextAnnotation;
+}(MarkupAnnotation);
+
+var LineAnnotation = /*#__PURE__*/function (_MarkupAnnotation3) {
+ _inherits(LineAnnotation, _MarkupAnnotation3);
-class LineAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.LINE;
- this.data.lineCoordinates = _util.Util.normalizeRect(parameters.dict.getArray("L"));
+ var _super10 = _createSuper(LineAnnotation);
+
+ function LineAnnotation(parameters) {
+ var _this11;
+
+ _classCallCheck(this, LineAnnotation);
+
+ _this11 = _super10.call(this, parameters);
+ _this11.data.annotationType = _util.AnnotationType.LINE;
+ _this11.data.lineCoordinates = _util.Util.normalizeRect(parameters.dict.getArray("L"));
+ return _this11;
}
-}
+ return LineAnnotation;
+}(MarkupAnnotation);
+
+var SquareAnnotation = /*#__PURE__*/function (_MarkupAnnotation4) {
+ _inherits(SquareAnnotation, _MarkupAnnotation4);
+
+ var _super11 = _createSuper(SquareAnnotation);
+
+ function SquareAnnotation(parameters) {
+ var _this12;
-class SquareAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.SQUARE;
+ _classCallCheck(this, SquareAnnotation);
+
+ _this12 = _super11.call(this, parameters);
+ _this12.data.annotationType = _util.AnnotationType.SQUARE;
+ return _this12;
}
-}
+ return SquareAnnotation;
+}(MarkupAnnotation);
+
+var CircleAnnotation = /*#__PURE__*/function (_MarkupAnnotation5) {
+ _inherits(CircleAnnotation, _MarkupAnnotation5);
+
+ var _super12 = _createSuper(CircleAnnotation);
-class CircleAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.CIRCLE;
+ function CircleAnnotation(parameters) {
+ var _this13;
+
+ _classCallCheck(this, CircleAnnotation);
+
+ _this13 = _super12.call(this, parameters);
+ _this13.data.annotationType = _util.AnnotationType.CIRCLE;
+ return _this13;
}
-}
+ return CircleAnnotation;
+}(MarkupAnnotation);
-class PolylineAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.POLYLINE;
- const rawVertices = parameters.dict.getArray("Vertices");
- this.data.vertices = [];
+var PolylineAnnotation = /*#__PURE__*/function (_MarkupAnnotation6) {
+ _inherits(PolylineAnnotation, _MarkupAnnotation6);
- for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
- this.data.vertices.push({
+ var _super13 = _createSuper(PolylineAnnotation);
+
+ function PolylineAnnotation(parameters) {
+ var _this14;
+
+ _classCallCheck(this, PolylineAnnotation);
+
+ _this14 = _super13.call(this, parameters);
+ _this14.data.annotationType = _util.AnnotationType.POLYLINE;
+ var rawVertices = parameters.dict.getArray("Vertices");
+ _this14.data.vertices = [];
+
+ for (var i = 0, ii = rawVertices.length; i < ii; i += 2) {
+ _this14.data.vertices.push({
x: rawVertices[i],
y: rawVertices[i + 1]
});
}
+
+ return _this14;
}
-}
+ return PolylineAnnotation;
+}(MarkupAnnotation);
+
+var PolygonAnnotation = /*#__PURE__*/function (_PolylineAnnotation) {
+ _inherits(PolygonAnnotation, _PolylineAnnotation);
-class PolygonAnnotation extends PolylineAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.POLYGON;
+ var _super14 = _createSuper(PolygonAnnotation);
+
+ function PolygonAnnotation(parameters) {
+ var _this15;
+
+ _classCallCheck(this, PolygonAnnotation);
+
+ _this15 = _super14.call(this, parameters);
+ _this15.data.annotationType = _util.AnnotationType.POLYGON;
+ return _this15;
}
-}
+ return PolygonAnnotation;
+}(PolylineAnnotation);
+
+var CaretAnnotation = /*#__PURE__*/function (_MarkupAnnotation7) {
+ _inherits(CaretAnnotation, _MarkupAnnotation7);
+
+ var _super15 = _createSuper(CaretAnnotation);
-class CaretAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.CARET;
+ function CaretAnnotation(parameters) {
+ var _this16;
+
+ _classCallCheck(this, CaretAnnotation);
+
+ _this16 = _super15.call(this, parameters);
+ _this16.data.annotationType = _util.AnnotationType.CARET;
+ return _this16;
}
-}
+ return CaretAnnotation;
+}(MarkupAnnotation);
+
+var InkAnnotation = /*#__PURE__*/function (_MarkupAnnotation8) {
+ _inherits(InkAnnotation, _MarkupAnnotation8);
+
+ var _super16 = _createSuper(InkAnnotation);
+
+ function InkAnnotation(parameters) {
+ var _this17;
+
+ _classCallCheck(this, InkAnnotation);
-class InkAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.INK;
- const xref = parameters.xref;
- const originalInkLists = parameters.dict.getArray("InkList");
- this.data.inkLists = [];
+ _this17 = _super16.call(this, parameters);
+ _this17.data.annotationType = _util.AnnotationType.INK;
+ var xref = parameters.xref;
+ var originalInkLists = parameters.dict.getArray("InkList");
+ _this17.data.inkLists = [];
- for (let i = 0, ii = originalInkLists.length; i < ii; ++i) {
- this.data.inkLists.push([]);
+ for (var i = 0, ii = originalInkLists.length; i < ii; ++i) {
+ _this17.data.inkLists.push([]);
- for (let j = 0, jj = originalInkLists[i].length; j < jj; j += 2) {
- this.data.inkLists[i].push({
+ for (var j = 0, jj = originalInkLists[i].length; j < jj; j += 2) {
+ _this17.data.inkLists[i].push({
x: xref.fetchIfRef(originalInkLists[i][j]),
y: xref.fetchIfRef(originalInkLists[i][j + 1])
});
}
}
+
+ return _this17;
}
-}
+ return InkAnnotation;
+}(MarkupAnnotation);
+
+var HighlightAnnotation = /*#__PURE__*/function (_MarkupAnnotation9) {
+ _inherits(HighlightAnnotation, _MarkupAnnotation9);
+
+ var _super17 = _createSuper(HighlightAnnotation);
-class HighlightAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
- const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
+ function HighlightAnnotation(parameters) {
+ var _this18;
+
+ _classCallCheck(this, HighlightAnnotation);
+
+ _this18 = _super17.call(this, parameters);
+ _this18.data.annotationType = _util.AnnotationType.HIGHLIGHT;
+ var quadPoints = getQuadPoints(parameters.dict, _this18.rectangle);
if (quadPoints) {
- this.data.quadPoints = quadPoints;
+ _this18.data.quadPoints = quadPoints;
}
+
+ return _this18;
}
-}
+ return HighlightAnnotation;
+}(MarkupAnnotation);
+
+var UnderlineAnnotation = /*#__PURE__*/function (_MarkupAnnotation10) {
+ _inherits(UnderlineAnnotation, _MarkupAnnotation10);
+
+ var _super18 = _createSuper(UnderlineAnnotation);
+
+ function UnderlineAnnotation(parameters) {
+ var _this19;
-class UnderlineAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.UNDERLINE;
- const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
+ _classCallCheck(this, UnderlineAnnotation);
+
+ _this19 = _super18.call(this, parameters);
+ _this19.data.annotationType = _util.AnnotationType.UNDERLINE;
+ var quadPoints = getQuadPoints(parameters.dict, _this19.rectangle);
if (quadPoints) {
- this.data.quadPoints = quadPoints;
+ _this19.data.quadPoints = quadPoints;
}
+
+ return _this19;
}
-}
+ return UnderlineAnnotation;
+}(MarkupAnnotation);
-class SquigglyAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.SQUIGGLY;
- const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
+var SquigglyAnnotation = /*#__PURE__*/function (_MarkupAnnotation11) {
+ _inherits(SquigglyAnnotation, _MarkupAnnotation11);
+
+ var _super19 = _createSuper(SquigglyAnnotation);
+
+ function SquigglyAnnotation(parameters) {
+ var _this20;
+
+ _classCallCheck(this, SquigglyAnnotation);
+
+ _this20 = _super19.call(this, parameters);
+ _this20.data.annotationType = _util.AnnotationType.SQUIGGLY;
+ var quadPoints = getQuadPoints(parameters.dict, _this20.rectangle);
if (quadPoints) {
- this.data.quadPoints = quadPoints;
+ _this20.data.quadPoints = quadPoints;
}
+
+ return _this20;
}
-}
+ return SquigglyAnnotation;
+}(MarkupAnnotation);
+
+var StrikeOutAnnotation = /*#__PURE__*/function (_MarkupAnnotation12) {
+ _inherits(StrikeOutAnnotation, _MarkupAnnotation12);
-class StrikeOutAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.STRIKEOUT;
- const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
+ var _super20 = _createSuper(StrikeOutAnnotation);
+
+ function StrikeOutAnnotation(parameters) {
+ var _this21;
+
+ _classCallCheck(this, StrikeOutAnnotation);
+
+ _this21 = _super20.call(this, parameters);
+ _this21.data.annotationType = _util.AnnotationType.STRIKEOUT;
+ var quadPoints = getQuadPoints(parameters.dict, _this21.rectangle);
if (quadPoints) {
- this.data.quadPoints = quadPoints;
+ _this21.data.quadPoints = quadPoints;
}
+
+ return _this21;
}
-}
+ return StrikeOutAnnotation;
+}(MarkupAnnotation);
+
+var StampAnnotation = /*#__PURE__*/function (_MarkupAnnotation13) {
+ _inherits(StampAnnotation, _MarkupAnnotation13);
+
+ var _super21 = _createSuper(StampAnnotation);
-class StampAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- this.data.annotationType = _util.AnnotationType.STAMP;
+ function StampAnnotation(parameters) {
+ var _this22;
+
+ _classCallCheck(this, StampAnnotation);
+
+ _this22 = _super21.call(this, parameters);
+ _this22.data.annotationType = _util.AnnotationType.STAMP;
+ return _this22;
}
-}
+ return StampAnnotation;
+}(MarkupAnnotation);
+
+var FileAttachmentAnnotation = /*#__PURE__*/function (_MarkupAnnotation14) {
+ _inherits(FileAttachmentAnnotation, _MarkupAnnotation14);
+
+ var _super22 = _createSuper(FileAttachmentAnnotation);
+
+ function FileAttachmentAnnotation(parameters) {
+ var _this23;
+
+ _classCallCheck(this, FileAttachmentAnnotation);
-class FileAttachmentAnnotation extends MarkupAnnotation {
- constructor(parameters) {
- super(parameters);
- const file = new _obj.FileSpec(parameters.dict.get("FS"), parameters.xref);
- this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
- this.data.file = file.serializable;
+ _this23 = _super22.call(this, parameters);
+ var file = new _obj.FileSpec(parameters.dict.get("FS"), parameters.xref);
+ _this23.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
+ _this23.data.file = file.serializable;
+ return _this23;
}
-}
+ return FileAttachmentAnnotation;
+}(MarkupAnnotation);
/***/ }),
-/* 26 */
+/* 219 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -19500,7 +31257,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.OperatorList = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
var QueueOptimizer = function QueueOptimizerClosure() {
function addState(parentState, pattern, checkFn, iterateFn, processFn) {
@@ -19512,9 +31269,9 @@ var QueueOptimizer = function QueueOptimizerClosure() {
}
state[pattern[pattern.length - 1]] = {
- checkFn,
- iterateFn,
- processFn
+ checkFn: checkFn,
+ iterateFn: iterateFn,
+ processFn: processFn
};
}
@@ -19556,7 +31313,7 @@ var QueueOptimizer = function QueueOptimizerClosure() {
return fnArray[i] === _util.OPS.restore;
}
- throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
+ throw new Error("iterateInlineImageGroup - invalid pos: ".concat(pos));
}, function foundInlineImageGroup(context, i) {
var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
@@ -19593,7 +31350,7 @@ var QueueOptimizer = function QueueOptimizerClosure() {
}
map.push({
- transform,
+ transform: transform,
x: currentX,
y: currentY,
w: img.width,
@@ -19664,7 +31421,7 @@ var QueueOptimizer = function QueueOptimizerClosure() {
return fnArray[i] === _util.OPS.restore;
}
- throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
+ throw new Error("iterateImageMaskGroup - invalid pos: ".concat(pos));
}, function foundImageMaskGroup(context, i) {
var MIN_IMAGES_IN_MASKS_BLOCK = 10;
var MAX_IMAGES_IN_MASKS_BLOCK = 100;
@@ -19790,7 +31547,7 @@ var QueueOptimizer = function QueueOptimizerClosure() {
return fnArray[i] === _util.OPS.restore;
}
- throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
+ throw new Error("iterateImageGroup - invalid pos: ".concat(pos));
}, function (context, i) {
var MIN_IMAGES_IN_BLOCK = 3;
var MAX_IMAGES_IN_BLOCK = 1000;
@@ -19858,7 +31615,7 @@ var QueueOptimizer = function QueueOptimizerClosure() {
return fnArray[i] === _util.OPS.endText;
}
- throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
+ throw new Error("iterateShowTextGroup - invalid pos: ".concat(pos));
}, function (context, i) {
var MIN_CHARS_IN_BLOCK = 3;
var MAX_CHARS_IN_BLOCK = 1000;
@@ -19909,23 +31666,23 @@ var QueueOptimizer = function QueueOptimizerClosure() {
}
QueueOptimizer.prototype = {
- _optimize() {
- const fnArray = this.queue.fnArray;
- let i = this.lastProcessed,
+ _optimize: function _optimize() {
+ var fnArray = this.queue.fnArray;
+ var i = this.lastProcessed,
ii = fnArray.length;
- let state = this.state;
- let match = this.match;
+ var state = this.state;
+ var match = this.match;
if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
this.lastProcessed = ii;
return;
}
- const context = this.context;
+ var context = this.context;
while (i < ii) {
if (match) {
- const iterate = (0, match.iterateFn)(context, i);
+ var iterate = (0, match.iterateFn)(context, i);
if (iterate) {
i++;
@@ -19965,17 +31722,15 @@ var QueueOptimizer = function QueueOptimizerClosure() {
this.match = match;
this.lastProcessed = i;
},
-
- push(fn, args) {
+ push: function push(fn, args) {
this.queue.fnArray.push(fn);
this.queue.argsArray.push(args);
this._optimize();
},
-
- flush() {
+ flush: function flush() {
while (this.match) {
- const length = this.queue.fnArray.length;
+ var length = this.queue.fnArray.length;
this.lastProcessed = (0, this.match.processFn)(this.context, length);
this.match = null;
this.state = null;
@@ -19983,13 +31738,11 @@ var QueueOptimizer = function QueueOptimizerClosure() {
this._optimize();
}
},
-
- reset() {
+ reset: function reset() {
this.state = null;
this.match = null;
this.lastProcessed = 0;
}
-
};
return QueueOptimizer;
}();
@@ -20000,15 +31753,12 @@ var NullOptimizer = function NullOptimizerClosure() {
}
NullOptimizer.prototype = {
- push(fn, args) {
+ push: function push(fn, args) {
this.queue.fnArray.push(fn);
this.queue.argsArray.push(args);
},
-
- flush() {},
-
- reset() {}
-
+ flush: function flush() {},
+ reset: function reset() {}
};
return NullOptimizer;
}();
@@ -20049,7 +31799,7 @@ var OperatorList = function OperatorListClosure() {
return this._totalLength + this.length;
},
- addOp(fn, args) {
+ addOp: function addOp(fn, args) {
this.optimizer.push(fn, args);
this.weight++;
@@ -20061,8 +31811,7 @@ var OperatorList = function OperatorListClosure() {
}
}
},
-
- addDependency(dependency) {
+ addDependency: function addDependency(dependency) {
if (dependency in this.dependencies) {
return;
}
@@ -20070,14 +31819,12 @@ var OperatorList = function OperatorListClosure() {
this.dependencies[dependency] = true;
this.addOp(_util.OPS.dependency, [dependency]);
},
-
- addDependencies(dependencies) {
+ addDependencies: function addDependencies(dependencies) {
for (var key in dependencies) {
this.addDependency(key);
}
},
-
- addOpList(opList) {
+ addOpList: function addOpList(opList) {
if (!(opList instanceof OperatorList)) {
(0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
return;
@@ -20089,8 +31836,7 @@ var OperatorList = function OperatorListClosure() {
this.addOp(opList.fnArray[i], opList.argsArray[i]);
}
},
-
- getIR() {
+ getIR: function getIR() {
return {
fnArray: this.fnArray,
argsArray: this.argsArray,
@@ -20099,19 +31845,17 @@ var OperatorList = function OperatorListClosure() {
},
get _transfers() {
- const transfers = [];
- const {
- fnArray,
- argsArray,
- length
- } = this;
-
- for (let i = 0; i < length; i++) {
+ var transfers = [];
+ var fnArray = this.fnArray,
+ argsArray = this.argsArray,
+ length = this.length;
+
+ for (var i = 0; i < length; i++) {
switch (fnArray[i]) {
case _util.OPS.paintInlineImageXObject:
case _util.OPS.paintInlineImageXObjectGroup:
case _util.OPS.paintImageMaskXObject:
- const arg = argsArray[i][0];
+ var arg = argsArray[i][0];
;
if (!arg.cached) {
@@ -20125,16 +31869,17 @@ var OperatorList = function OperatorListClosure() {
return transfers;
},
- flush(lastChunk = false) {
+ flush: function flush() {
+ var lastChunk = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
this.optimizer.flush();
- const length = this.length;
+ var length = this.length;
this._totalLength += length;
this._streamSink.enqueue({
fnArray: this.fnArray,
argsArray: this.argsArray,
- lastChunk,
- length
+ lastChunk: lastChunk,
+ length: length
}, 1, this._transfers);
this.dependencies = Object.create(null);
@@ -20143,7 +31888,6 @@ var OperatorList = function OperatorListClosure() {
this.weight = 0;
this.optimizer.reset();
}
-
};
return OperatorList;
}();
@@ -20151,7 +31895,7 @@ var OperatorList = function OperatorListClosure() {
exports.OperatorList = OperatorList;
/***/ }),
-/* 27 */
+/* 220 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -20162,48 +31906,68 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PartialEvaluator = void 0;
-var _util = __w_pdfjs_require__(2);
+var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
+
+var _util = __w_pdfjs_require__(5);
+
+var _cmap = __w_pdfjs_require__(221);
+
+var _primitives = __w_pdfjs_require__(198);
+
+var _fonts = __w_pdfjs_require__(222);
+
+var _encodings = __w_pdfjs_require__(225);
+
+var _core_utils = __w_pdfjs_require__(201);
+
+var _unicode = __w_pdfjs_require__(228);
+
+var _standard_fonts = __w_pdfjs_require__(227);
+
+var _pattern = __w_pdfjs_require__(231);
+
+var _parser = __w_pdfjs_require__(204);
-var _cmap = __w_pdfjs_require__(28);
+var _bidi = __w_pdfjs_require__(232);
-var _primitives = __w_pdfjs_require__(5);
+var _colorspace = __w_pdfjs_require__(216);
-var _fonts = __w_pdfjs_require__(29);
+var _stream = __w_pdfjs_require__(205);
-var _encodings = __w_pdfjs_require__(32);
+var _glyphlist = __w_pdfjs_require__(226);
-var _core_utils = __w_pdfjs_require__(8);
+var _metrics = __w_pdfjs_require__(233);
-var _unicode = __w_pdfjs_require__(35);
+var _function = __w_pdfjs_require__(234);
-var _standard_fonts = __w_pdfjs_require__(34);
+var _image_utils = __w_pdfjs_require__(217);
-var _pattern = __w_pdfjs_require__(38);
+var _murmurhash = __w_pdfjs_require__(236);
-var _parser = __w_pdfjs_require__(11);
+var _operator_list = __w_pdfjs_require__(219);
-var _bidi = __w_pdfjs_require__(39);
+var _image = __w_pdfjs_require__(237);
-var _colorspace = __w_pdfjs_require__(23);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
-var _stream = __w_pdfjs_require__(12);
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-var _glyphlist = __w_pdfjs_require__(33);
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
-var _metrics = __w_pdfjs_require__(40);
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-var _function = __w_pdfjs_require__(41);
+function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
-var _image_utils = __w_pdfjs_require__(24);
+function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
-var _murmurhash = __w_pdfjs_require__(43);
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
-var _operator_list = __w_pdfjs_require__(26);
+function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
-var _image = __w_pdfjs_require__(44);
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
var PartialEvaluator = function PartialEvaluatorClosure() {
- const DefaultPartialEvaluatorOptions = {
+ var DefaultPartialEvaluatorOptions = {
maxImageSize: -1,
disableFontFace: false,
ignoreErrors: false,
@@ -20211,17 +31975,19 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
fontExtraProperties: false
};
- function PartialEvaluator({
- xref,
- handler,
- pageIndex,
- idFactory,
- fontCache,
- builtInCMapCache,
- globalImageCache,
- options = null,
- pdfFunctionFactory
- }) {
+ function PartialEvaluator(_ref) {
+ var _this = this;
+
+ var xref = _ref.xref,
+ handler = _ref.handler,
+ pageIndex = _ref.pageIndex,
+ idFactory = _ref.idFactory,
+ fontCache = _ref.fontCache,
+ builtInCMapCache = _ref.builtInCMapCache,
+ globalImageCache = _ref.globalImageCache,
+ _ref$options = _ref.options,
+ options = _ref$options === void 0 ? null : _ref$options,
+ pdfFunctionFactory = _ref.pdfFunctionFactory;
this.xref = xref;
this.handler = handler;
this.pageIndex = pageIndex;
@@ -20233,39 +31999,65 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
this.pdfFunctionFactory = pdfFunctionFactory;
this.parsingType3Font = false;
- this.fetchBuiltInCMap = async name => {
- if (this.builtInCMapCache.has(name)) {
- return this.builtInCMapCache.get(name);
- }
+ this.fetchBuiltInCMap = /*#__PURE__*/function () {
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(name) {
+ var readableStream, reader, data;
+ return _regenerator["default"].wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ if (!_this.builtInCMapCache.has(name)) {
+ _context.next = 2;
+ break;
+ }
- const readableStream = this.handler.sendWithStream("FetchBuiltInCMap", {
- name
- });
- const reader = readableStream.getReader();
- const data = await new Promise(function (resolve, reject) {
- function pump() {
- reader.read().then(function ({
- value,
- done
- }) {
- if (done) {
- return;
- }
+ return _context.abrupt("return", _this.builtInCMapCache.get(name));
- resolve(value);
- pump();
- }, reject);
- }
+ case 2:
+ readableStream = _this.handler.sendWithStream("FetchBuiltInCMap", {
+ name: name
+ });
+ reader = readableStream.getReader();
+ _context.next = 6;
+ return new Promise(function (resolve, reject) {
+ function pump() {
+ reader.read().then(function (_ref3) {
+ var value = _ref3.value,
+ done = _ref3.done;
+
+ if (done) {
+ return;
+ }
+
+ resolve(value);
+ pump();
+ }, reject);
+ }
- pump();
- });
+ pump();
+ });
- if (data.compressionType !== _util.CMapCompressionType.NONE) {
- this.builtInCMapCache.set(name, data);
- }
+ case 6:
+ data = _context.sent;
- return data;
- };
+ if (data.compressionType !== _util.CMapCompressionType.NONE) {
+ _this.builtInCMapCache.set(name, data);
+ }
+
+ return _context.abrupt("return", data);
+
+ case 9:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee);
+ }));
+
+ return function (_x) {
+ return _ref2.apply(this, arguments);
+ };
+ }();
}
var TIME_SLOT_DURATION_MS = 20;
@@ -20290,17 +32082,19 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
};
- function normalizeBlendMode(value, parsingArray = false) {
+ function normalizeBlendMode(value) {
+ var parsingArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
if (Array.isArray(value)) {
- for (let i = 0, ii = value.length; i < ii; i++) {
- const maybeBM = normalizeBlendMode(value[i], true);
+ for (var i = 0, ii = value.length; i < ii; i++) {
+ var maybeBM = normalizeBlendMode(value[i], true);
if (maybeBM) {
return maybeBM;
}
}
- (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
+ (0, _util.warn)("Unsupported blend mode Array: ".concat(value));
return "source-over";
}
@@ -20367,7 +32161,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return null;
}
- (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
+ (0, _util.warn)("Unsupported blend mode: ".concat(value.name));
return "source-over";
}
@@ -20375,12 +32169,12 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var TILING_PATTERN = 1,
SHADING_PATTERN = 2;
PartialEvaluator.prototype = {
- clone(newOptions = DefaultPartialEvaluatorOptions) {
+ clone: function clone() {
+ var newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DefaultPartialEvaluatorOptions;
var newEvaluator = Object.create(this);
newEvaluator.options = newOptions;
return newEvaluator;
},
-
hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
if (!(resources instanceof _primitives.Dict)) {
return false;
@@ -20402,9 +32196,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
if (graphicStates instanceof _primitives.Dict) {
var graphicStatesKeys = graphicStates.getKeys();
- for (let i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
- const key = graphicStatesKeys[i];
- let graphicState = graphicStates.getRaw(key);
+ for (var i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
+ var key = graphicStatesKeys[i];
+ var graphicState = graphicStates.getRaw(key);
if (graphicState instanceof _primitives.Ref) {
if (processed[graphicState.toString()]) {
@@ -20426,7 +32220,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
this.handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
});
- (0, _util.warn)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
+ (0, _util.warn)("hasBlendModes - ignoring ExtGState: \"".concat(ex, "\"."));
continue;
}
@@ -20442,7 +32236,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
processed[graphicState.objId] = true;
}
- const bm = graphicState.get("BM");
+ var bm = graphicState.get("BM");
if (bm instanceof _primitives.Name) {
if (bm.name !== "Normal") {
@@ -20453,7 +32247,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
if (bm !== undefined && Array.isArray(bm)) {
- for (let j = 0, jj = bm.length; j < jj; j++) {
+ for (var j = 0, jj = bm.length; j < jj; j++) {
if (bm[j] instanceof _primitives.Name && bm[j].name !== "Normal") {
return true;
}
@@ -20470,9 +32264,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var xObjectsKeys = xObjects.getKeys();
- for (let i = 0, ii = xObjectsKeys.length; i < ii; i++) {
- const key = xObjectsKeys[i];
- var xObject = xObjects.getRaw(key);
+ for (var _i = 0, _ii = xObjectsKeys.length; _i < _ii; _i++) {
+ var _key = xObjectsKeys[_i];
+ var xObject = xObjects.getRaw(_key);
if (xObject instanceof _primitives.Ref) {
if (processed[xObject.toString()]) {
@@ -20494,7 +32288,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
this.handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.errorXObject
});
- (0, _util.warn)(`hasBlendModes - ignoring XObject: "${ex}".`);
+ (0, _util.warn)("hasBlendModes - ignoring XObject: \"".concat(ex, "\"."));
continue;
}
@@ -20528,216 +32322,278 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return false;
},
+ buildFormXObject: function buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
+ var _this2 = this;
- async buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
- var dict = xobj.dict;
- var matrix = dict.getArray("Matrix");
- var bbox = dict.getArray("BBox");
+ return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
+ var dict, matrix, bbox, group, groupOptions, groupSubtype, colorSpace;
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
+ while (1) {
+ switch (_context2.prev = _context2.next) {
+ case 0:
+ dict = xobj.dict;
+ matrix = dict.getArray("Matrix");
+ bbox = dict.getArray("BBox");
- if (Array.isArray(bbox) && bbox.length === 4) {
- bbox = _util.Util.normalizeRect(bbox);
- } else {
- bbox = null;
- }
+ if (Array.isArray(bbox) && bbox.length === 4) {
+ bbox = _util.Util.normalizeRect(bbox);
+ } else {
+ bbox = null;
+ }
- var group = dict.get("Group");
+ group = dict.get("Group");
- if (group) {
- var groupOptions = {
- matrix,
- bbox,
- smask,
- isolated: false,
- knockout: false
- };
- var groupSubtype = group.get("S");
- var colorSpace = null;
+ if (!group) {
+ _context2.next = 18;
+ break;
+ }
- if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
- groupOptions.isolated = group.get("I") || false;
- groupOptions.knockout = group.get("K") || false;
+ groupOptions = {
+ matrix: matrix,
+ bbox: bbox,
+ smask: smask,
+ isolated: false,
+ knockout: false
+ };
+ groupSubtype = group.get("S");
+ colorSpace = null;
- if (group.has("CS")) {
- colorSpace = await this.parseColorSpace({
- cs: group.get("CS"),
- resources
- });
- }
- }
+ if (!(0, _primitives.isName)(groupSubtype, "Transparency")) {
+ _context2.next = 16;
+ break;
+ }
- if (smask && smask.backdrop) {
- colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
- smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
- }
+ groupOptions.isolated = group.get("I") || false;
+ groupOptions.knockout = group.get("K") || false;
- operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
- }
+ if (!group.has("CS")) {
+ _context2.next = 16;
+ break;
+ }
- operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
- return this.getOperatorList({
- stream: xobj,
- task,
- resources: dict.get("Resources") || resources,
- operatorList,
- initialState
- }).then(function () {
- operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
+ _context2.next = 15;
+ return _this2.parseColorSpace({
+ cs: group.get("CS"),
+ resources: resources
+ });
- if (group) {
- operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
- }
- });
+ case 15:
+ colorSpace = _context2.sent;
+
+ case 16:
+ if (smask && smask.backdrop) {
+ colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
+ smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
+ }
+
+ operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
+
+ case 18:
+ operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
+ return _context2.abrupt("return", _this2.getOperatorList({
+ stream: xobj,
+ task: task,
+ resources: dict.get("Resources") || resources,
+ operatorList: operatorList,
+ initialState: initialState
+ }).then(function () {
+ operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
+
+ if (group) {
+ operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
+ }
+ }));
+
+ case 20:
+ case "end":
+ return _context2.stop();
+ }
+ }
+ }, _callee2);
+ }))();
},
+ buildPaintImageXObject: function buildPaintImageXObject(_ref4) {
+ var _this3 = this;
- async buildPaintImageXObject({
- resources,
- image,
- isInline = false,
- operatorList,
- cacheKey,
- localImageCache
- }) {
- var dict = image.dict;
- const imageRef = dict.objId;
- var w = dict.get("Width", "W");
- var h = dict.get("Height", "H");
-
- if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
- (0, _util.warn)("Image dimensions are missing, or not numbers.");
- return undefined;
- }
+ return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
+ var resources, image, _ref4$isInline, isInline, operatorList, cacheKey, localImageCache, dict, imageRef, w, h, maxImageSize, imageMask, imgData, args, width, height, bitStrideLength, imgArray, decode, softMask, mask, SMALL_IMAGE_DIMENSIONS, imageObj, objId, cacheGlobally, imgPromise;
- var maxImageSize = this.options.maxImageSize;
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
+ while (1) {
+ switch (_context3.prev = _context3.next) {
+ case 0:
+ resources = _ref4.resources, image = _ref4.image, _ref4$isInline = _ref4.isInline, isInline = _ref4$isInline === void 0 ? false : _ref4$isInline, operatorList = _ref4.operatorList, cacheKey = _ref4.cacheKey, localImageCache = _ref4.localImageCache;
+ dict = image.dict;
+ imageRef = dict.objId;
+ w = dict.get("Width", "W");
+ h = dict.get("Height", "H");
+
+ if (!(!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h)))) {
+ _context3.next = 8;
+ break;
+ }
- if (maxImageSize !== -1 && w * h > maxImageSize) {
- (0, _util.warn)("Image exceeded maximum allowed size and was removed.");
- return undefined;
- }
+ (0, _util.warn)("Image dimensions are missing, or not numbers.");
+ return _context3.abrupt("return", undefined);
- var imageMask = dict.get("ImageMask", "IM") || false;
- var imgData, args;
-
- if (imageMask) {
- var width = dict.get("Width", "W");
- var height = dict.get("Height", "H");
- var bitStrideLength = width + 7 >> 3;
- var imgArray = image.getBytes(bitStrideLength * height, true);
- var decode = dict.getArray("Decode", "D");
- imgData = _image.PDFImage.createMask({
- imgArray,
- width,
- height,
- imageIsFromDecodeStream: image instanceof _stream.DecodeStream,
- inverseDecode: !!decode && decode[0] > 0
- });
- imgData.cached = !!cacheKey;
- args = [imgData];
- operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
-
- if (cacheKey) {
- localImageCache.set(cacheKey, imageRef, {
- fn: _util.OPS.paintImageMaskXObject,
- args
- });
- }
+ case 8:
+ maxImageSize = _this3.options.maxImageSize;
- return undefined;
- }
+ if (!(maxImageSize !== -1 && w * h > maxImageSize)) {
+ _context3.next = 12;
+ break;
+ }
- var softMask = dict.get("SMask", "SM") || false;
- var mask = dict.get("Mask") || false;
- var SMALL_IMAGE_DIMENSIONS = 200;
+ (0, _util.warn)("Image exceeded maximum allowed size and was removed.");
+ return _context3.abrupt("return", undefined);
- if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
- const imageObj = new _image.PDFImage({
- xref: this.xref,
- res: resources,
- image,
- isInline,
- pdfFunctionFactory: this.pdfFunctionFactory
- });
- imgData = imageObj.createImageData(true);
- operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
- return undefined;
- }
+ case 12:
+ imageMask = dict.get("ImageMask", "IM") || false;
- let objId = `img_${this.idFactory.createObjId()}`,
- cacheGlobally = false;
+ if (!imageMask) {
+ _context3.next = 25;
+ break;
+ }
- if (this.parsingType3Font) {
- objId = `${this.idFactory.getDocId()}_type3res_${objId}`;
- } else if (imageRef) {
- cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
+ width = dict.get("Width", "W");
+ height = dict.get("Height", "H");
+ bitStrideLength = width + 7 >> 3;
+ imgArray = image.getBytes(bitStrideLength * height, true);
+ decode = dict.getArray("Decode", "D");
+ imgData = _image.PDFImage.createMask({
+ imgArray: imgArray,
+ width: width,
+ height: height,
+ imageIsFromDecodeStream: image instanceof _stream.DecodeStream,
+ inverseDecode: !!decode && decode[0] > 0
+ });
+ imgData.cached = !!cacheKey;
+ args = [imgData];
+ operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
+
+ if (cacheKey) {
+ localImageCache.set(cacheKey, imageRef, {
+ fn: _util.OPS.paintImageMaskXObject,
+ args: args
+ });
+ }
- if (cacheGlobally) {
- objId = `${this.idFactory.getDocId()}_${objId}`;
- }
- }
+ return _context3.abrupt("return", undefined);
- operatorList.addDependency(objId);
- args = [objId, w, h];
+ case 25:
+ softMask = dict.get("SMask", "SM") || false;
+ mask = dict.get("Mask") || false;
+ SMALL_IMAGE_DIMENSIONS = 200;
- const imgPromise = _image.PDFImage.buildImage({
- xref: this.xref,
- res: resources,
- image,
- isInline,
- pdfFunctionFactory: this.pdfFunctionFactory
- }).then(imageObj => {
- imgData = imageObj.createImageData(false);
+ if (!(isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS)) {
+ _context3.next = 33;
+ break;
+ }
- if (this.parsingType3Font) {
- return this.handler.sendWithPromise("commonobj", [objId, "FontType3Res", imgData], [imgData.data.buffer]);
- } else if (cacheGlobally) {
- this.handler.send("commonobj", [objId, "Image", imgData], [imgData.data.buffer]);
- return undefined;
- }
+ imageObj = new _image.PDFImage({
+ xref: _this3.xref,
+ res: resources,
+ image: image,
+ isInline: isInline,
+ pdfFunctionFactory: _this3.pdfFunctionFactory
+ });
+ imgData = imageObj.createImageData(true);
+ operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
+ return _context3.abrupt("return", undefined);
- this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], [imgData.data.buffer]);
- return undefined;
- }).catch(reason => {
- (0, _util.warn)("Unable to decode image: " + reason);
+ case 33:
+ objId = "img_".concat(_this3.idFactory.createObjId()), cacheGlobally = false;
- if (this.parsingType3Font) {
- return this.handler.sendWithPromise("commonobj", [objId, "FontType3Res", null]);
- } else if (cacheGlobally) {
- this.handler.send("commonobj", [objId, "Image", null]);
- return undefined;
- }
+ if (_this3.parsingType3Font) {
+ objId = "".concat(_this3.idFactory.getDocId(), "_type3res_").concat(objId);
+ } else if (imageRef) {
+ cacheGlobally = _this3.globalImageCache.shouldCache(imageRef, _this3.pageIndex);
- this.handler.send("obj", [objId, this.pageIndex, "Image", null]);
- return undefined;
- });
+ if (cacheGlobally) {
+ objId = "".concat(_this3.idFactory.getDocId(), "_").concat(objId);
+ }
+ }
- if (this.parsingType3Font) {
- await imgPromise;
- }
+ operatorList.addDependency(objId);
+ args = [objId, w, h];
+ imgPromise = _image.PDFImage.buildImage({
+ xref: _this3.xref,
+ res: resources,
+ image: image,
+ isInline: isInline,
+ pdfFunctionFactory: _this3.pdfFunctionFactory
+ }).then(function (imageObj) {
+ imgData = imageObj.createImageData(false);
+
+ if (_this3.parsingType3Font) {
+ return _this3.handler.sendWithPromise("commonobj", [objId, "FontType3Res", imgData], [imgData.data.buffer]);
+ } else if (cacheGlobally) {
+ _this3.handler.send("commonobj", [objId, "Image", imgData], [imgData.data.buffer]);
+
+ return undefined;
+ }
- operatorList.addOp(_util.OPS.paintImageXObject, args);
+ _this3.handler.send("obj", [objId, _this3.pageIndex, "Image", imgData], [imgData.data.buffer]);
- if (cacheKey) {
- localImageCache.set(cacheKey, imageRef, {
- fn: _util.OPS.paintImageXObject,
- args
- });
+ return undefined;
+ })["catch"](function (reason) {
+ (0, _util.warn)("Unable to decode image: " + reason);
- if (imageRef) {
- (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
- this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
+ if (_this3.parsingType3Font) {
+ return _this3.handler.sendWithPromise("commonobj", [objId, "FontType3Res", null]);
+ } else if (cacheGlobally) {
+ _this3.handler.send("commonobj", [objId, "Image", null]);
- if (cacheGlobally) {
- this.globalImageCache.setData(imageRef, {
- objId,
- fn: _util.OPS.paintImageXObject,
- args
- });
- }
- }
- }
+ return undefined;
+ }
- return undefined;
- },
+ _this3.handler.send("obj", [objId, _this3.pageIndex, "Image", null]);
+ return undefined;
+ });
+
+ if (!_this3.parsingType3Font) {
+ _context3.next = 41;
+ break;
+ }
+
+ _context3.next = 41;
+ return imgPromise;
+
+ case 41:
+ operatorList.addOp(_util.OPS.paintImageXObject, args);
+
+ if (cacheKey) {
+ localImageCache.set(cacheKey, imageRef, {
+ fn: _util.OPS.paintImageXObject,
+ args: args
+ });
+
+ if (imageRef) {
+ (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
+
+ _this3.globalImageCache.addPageIndex(imageRef, _this3.pageIndex);
+
+ if (cacheGlobally) {
+ _this3.globalImageCache.setData(imageRef, {
+ objId: objId,
+ fn: _util.OPS.paintImageXObject,
+ args: args
+ });
+ }
+ }
+ }
+
+ return _context3.abrupt("return", undefined);
+
+ case 44:
+ case "end":
+ return _context3.stop();
+ }
+ }
+ }, _callee3);
+ }))();
+ },
handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
var smaskContent = smask.get("G");
var smaskOptions = {
@@ -20747,7 +32603,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var transferObj = smask.get("TR");
if ((0, _function.isPDFFunction)(transferObj)) {
- const transferFn = this.pdfFunctionFactory.create(transferObj);
+ var transferFn = this.pdfFunctionFactory.create(transferObj);
var transferMap = new Uint8Array(256);
var tmp = new Float32Array(1);
@@ -20762,16 +32618,17 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
},
+ handleTilingType: function handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
+ var _this4 = this;
- handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
- const tilingOpList = new _operator_list.OperatorList();
- const resourcesArray = [patternDict.get("Resources"), resources];
+ var tilingOpList = new _operator_list.OperatorList();
+ var resourcesArray = [patternDict.get("Resources"), resources];
- const patternResources = _primitives.Dict.merge(this.xref, resourcesArray);
+ var patternResources = _primitives.Dict.merge(this.xref, resourcesArray);
return this.getOperatorList({
stream: pattern,
- task,
+ task: task,
resources: patternResources,
operatorList: tilingOpList
}).then(function () {
@@ -20782,24 +32639,26 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}).then(function (tilingPatternIR) {
operatorList.addDependencies(tilingOpList.dependencies);
operatorList.addOp(fn, tilingPatternIR);
- }, reason => {
+ }, function (reason) {
if (reason instanceof _util.AbortException) {
return;
}
- if (this.options.ignoreErrors) {
- this.handler.send("UnsupportedFeature", {
+ if (_this4.options.ignoreErrors) {
+ _this4.handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
});
- (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
+
+ (0, _util.warn)("handleTilingType - ignoring pattern: \"".concat(reason, "\"."));
return;
}
throw reason;
});
},
-
handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
+ var _this5 = this;
+
var fontName;
if (fontArgs) {
@@ -20807,37 +32666,37 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
fontName = fontArgs[0].name;
}
- return this.loadFont(fontName, fontRef, resources).then(translated => {
+ return this.loadFont(fontName, fontRef, resources).then(function (translated) {
if (!translated.font.isType3Font) {
return translated;
}
- return translated.loadType3Data(this, resources, operatorList, task).then(function () {
+ return translated.loadType3Data(_this5, resources, operatorList, task).then(function () {
return translated;
- }).catch(reason => {
- this.handler.send("UnsupportedFeature", {
+ })["catch"](function (reason) {
+ _this5.handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
});
+
return new TranslatedFont({
loadedName: "g_font_error",
- font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
+ font: new _fonts.ErrorFont("Type3 font load error: ".concat(reason)),
dict: translated.font,
- extraProperties: this.options.fontExtraProperties
+ extraProperties: _this5.options.fontExtraProperties
});
});
- }).then(translated => {
+ }).then(function (translated) {
state.font = translated.font;
- translated.send(this.handler);
+ translated.send(_this5.handler);
return translated.loadedName;
});
},
-
- handleText(chars, state) {
- const font = state.font;
- const glyphs = font.charsToGlyphs(chars);
+ handleText: function handleText(chars, state) {
+ var font = state.font;
+ var glyphs = font.charsToGlyphs(chars);
if (font.data) {
- const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
+ var isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
PartialEvaluator.buildFontPaths(font, glyphs, this.handler);
@@ -20846,33 +32705,33 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return glyphs;
},
-
- ensureStateFont(state) {
+ ensureStateFont: function ensureStateFont(state) {
if (state.font) {
return;
}
- const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
+ var reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
if (this.options.ignoreErrors) {
this.handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.errorFontState
});
- (0, _util.warn)(`ensureStateFont: "${reason}".`);
+ (0, _util.warn)("ensureStateFont: \"".concat(reason, "\"."));
return;
}
throw reason;
},
-
setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, stateManager) {
+ var _this6 = this;
+
var gStateObj = [];
var gStateKeys = gState.getKeys();
var promise = Promise.resolve();
- for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
- const key = gStateKeys[i];
- const value = gState.get(key);
+ var _loop = function _loop() {
+ var key = gStateKeys[i];
+ var value = gState.get(key);
switch (key) {
case "Type":
@@ -20891,8 +32750,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
break;
case "Font":
- promise = promise.then(() => {
- return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
+ promise = promise.then(function () {
+ return _this6.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
operatorList.addDependency(loadedName);
gStateObj.push([key, [loadedName, value[1]]]);
});
@@ -20910,8 +32769,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
if ((0, _primitives.isDict)(value)) {
- promise = promise.then(() => {
- return this.handleSMask(value, resources, operatorList, task, stateManager);
+ promise = promise.then(function () {
+ return _this6.handleSMask(value, resources, operatorList, task, stateManager);
});
gStateObj.push([key, true]);
} else {
@@ -20941,6 +32800,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
(0, _util.info)("Unknown graphic state operator " + key);
break;
}
+ };
+
+ for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
+ _loop();
}
return promise.then(function () {
@@ -20950,12 +32813,14 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
});
},
loadFont: function PartialEvaluator_loadFont(fontName, font, resources) {
- const errorFont = () => {
+ var _this7 = this;
+
+ var errorFont = function errorFont() {
return Promise.resolve(new TranslatedFont({
loadedName: "g_font_error",
- font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
+ font: new _fonts.ErrorFont("Font \"".concat(fontName, "\" is not available.")),
dict: font,
- extraProperties: this.options.fontExtraProperties
+ extraProperties: _this7.options.fontExtraProperties
}));
};
@@ -20977,17 +32842,17 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
if (!fontRef) {
- const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
+ var partialMsg = "Font \"".concat(fontName || font && font.toString(), "\" is not available");
if (!this.options.ignoreErrors && !this.parsingType3Font) {
- (0, _util.warn)(`${partialMsg}.`);
+ (0, _util.warn)("".concat(partialMsg, "."));
return errorFont();
}
this.handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
});
- (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
+ (0, _util.warn)("".concat(partialMsg, " -- attempting to fallback to a default font."));
fontRef = PartialEvaluator.getFallbackFontDict();
}
@@ -21007,10 +32872,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var fontCapability = (0, _util.createPromiseCapability)();
var preEvaluatedFont = this.preEvaluateFont(font);
- const {
- descriptor,
- hash
- } = preEvaluatedFont;
+ var descriptor = preEvaluatedFont.descriptor,
+ hash = preEvaluatedFont.hash;
var fontRefIsRef = (0, _primitives.isRef)(fontRef),
fontID;
@@ -21052,11 +32915,11 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
fontID = this.idFactory.createObjId();
}
- this.fontCache.put(`id_${fontID}`, fontCapability.promise);
+ this.fontCache.put("id_".concat(fontID), fontCapability.promise);
}
(0, _util.assert)(fontID, 'The "fontID" must be defined.');
- font.loadedName = `${this.idFactory.getDocId()}_f${fontID}`;
+ font.loadedName = "".concat(this.idFactory.getDocId(), "_f").concat(fontID);
font.translated = fontCapability.promise;
var translatedPromise;
@@ -21066,7 +32929,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
translatedPromise = Promise.reject(e);
}
- translatedPromise.then(translatedFont => {
+ translatedPromise.then(function (translatedFont) {
if (translatedFont.fontType !== undefined) {
var xrefFontStats = xref.stats.fontTypes;
xrefFontStats[translatedFont.fontType] = true;
@@ -21076,10 +32939,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
loadedName: font.loadedName,
font: translatedFont,
dict: font,
- extraProperties: this.options.fontExtraProperties
+ extraProperties: _this7.options.fontExtraProperties
}));
- }).catch(reason => {
- this.handler.send("UnsupportedFeature", {
+ })["catch"](function (reason) {
+ _this7.handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
});
@@ -21095,13 +32958,13 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
loadedName: font.loadedName,
font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
dict: font,
- extraProperties: this.options.fontExtraProperties
+ extraProperties: _this7.options.fontExtraProperties
}));
});
return fontCapability.promise;
},
-
- buildPath(operatorList, fn, args, parsingText = false) {
+ buildPath: function buildPath(operatorList, fn, args) {
+ var parsingText = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var lastIndex = operatorList.length - 1;
if (!args) {
@@ -21110,7 +32973,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
if (parsingText) {
- (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
+ (0, _util.warn)("Encountered path operator \"".concat(fn, "\" inside of a text object."));
operatorList.addOp(_util.OPS.save, null);
}
@@ -21125,62 +32988,92 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
Array.prototype.push.apply(opArgs[1], args);
}
},
+ parseColorSpace: function parseColorSpace(_ref5) {
+ var _this8 = this;
- parseColorSpace({
- cs,
- resources
- }) {
- return new Promise(resolve => {
- resolve(_colorspace.ColorSpace.parse(cs, this.xref, resources, this.pdfFunctionFactory));
- }).catch(reason => {
+ var cs = _ref5.cs,
+ resources = _ref5.resources;
+ return new Promise(function (resolve) {
+ resolve(_colorspace.ColorSpace.parse(cs, _this8.xref, resources, _this8.pdfFunctionFactory));
+ })["catch"](function (reason) {
if (reason instanceof _util.AbortException) {
return null;
}
- if (this.options.ignoreErrors) {
- this.handler.send("UnsupportedFeature", {
+ if (_this8.options.ignoreErrors) {
+ _this8.handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
});
- (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
+
+ (0, _util.warn)("parseColorSpace - ignoring ColorSpace: \"".concat(reason, "\"."));
return null;
}
throw reason;
});
},
+ handleColorN: function handleColorN(operatorList, fn, args, cs, patterns, resources, task) {
+ var _this9 = this;
- async handleColorN(operatorList, fn, args, cs, patterns, resources, task) {
- var patternName = args[args.length - 1];
- var pattern;
+ return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
+ var patternName, pattern, dict, typeNum, color, shading, matrix;
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
+ while (1) {
+ switch (_context4.prev = _context4.next) {
+ case 0:
+ patternName = args[args.length - 1];
- if ((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name))) {
- var dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
- var typeNum = dict.get("PatternType");
+ if (!((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name)))) {
+ _context4.next = 16;
+ break;
+ }
- if (typeNum === TILING_PATTERN) {
- var color = cs.base ? cs.base.getRgb(args, 0) : null;
- return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
- } else if (typeNum === SHADING_PATTERN) {
- var shading = dict.get("Shading");
- var matrix = dict.getArray("Matrix");
- pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this.pdfFunctionFactory);
- operatorList.addOp(fn, pattern.getIR());
- return undefined;
- }
+ dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
+ typeNum = dict.get("PatternType");
- throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
- }
+ if (!(typeNum === TILING_PATTERN)) {
+ _context4.next = 9;
+ break;
+ }
+
+ color = cs.base ? cs.base.getRgb(args, 0) : null;
+ return _context4.abrupt("return", _this9.handleTilingType(fn, color, resources, pattern, dict, operatorList, task));
+
+ case 9:
+ if (!(typeNum === SHADING_PATTERN)) {
+ _context4.next = 15;
+ break;
+ }
+
+ shading = dict.get("Shading");
+ matrix = dict.getArray("Matrix");
+ pattern = _pattern.Pattern.parseShading(shading, matrix, _this9.xref, resources, _this9.handler, _this9.pdfFunctionFactory);
+ operatorList.addOp(fn, pattern.getIR());
+ return _context4.abrupt("return", undefined);
- throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
+ case 15:
+ throw new _util.FormatError("Unknown PatternType: ".concat(typeNum));
+
+ case 16:
+ throw new _util.FormatError("Unknown PatternName: ".concat(patternName));
+
+ case 17:
+ case "end":
+ return _context4.stop();
+ }
+ }
+ }, _callee4);
+ }))();
},
+ getOperatorList: function getOperatorList(_ref6) {
+ var _this10 = this;
- getOperatorList({
- stream,
- task,
- resources,
- operatorList,
- initialState = null
- }) {
+ var stream = _ref6.stream,
+ task = _ref6.task,
+ resources = _ref6.resources,
+ operatorList = _ref6.operatorList,
+ _ref6$initialState = _ref6.initialState,
+ initialState = _ref6$initialState === void 0 ? null : _ref6$initialState;
resources = resources || _primitives.Dict.empty;
initialState = initialState || new EvalState();
@@ -21190,8 +33083,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var self = this;
var xref = this.xref;
- let parsingText = false;
- const localImageCache = new _image_utils.LocalImageCache();
+ var parsingText = false;
+ var localImageCache = new _image_utils.LocalImageCache();
var xobjs = resources.get("XObject") || _primitives.Dict.empty;
@@ -21208,7 +33101,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
return new Promise(function promiseBody(resolve, reject) {
- const next = function (promise) {
+ var next = function next(promise) {
Promise.all([promise, operatorList.ready]).then(function () {
try {
promiseBody(resolve, reject);
@@ -21241,7 +33134,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var name = args[0].name;
if (name) {
- const localImage = localImageCache.getByName(name);
+ var localImage = localImageCache.getByName(name);
if (localImage) {
operatorList.addOp(localImage.fn, localImage.args);
@@ -21255,18 +33148,18 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
throw new _util.FormatError("XObject must be referred to by name.");
}
- let xobj = xobjs.getRaw(name);
+ var xobj = xobjs.getRaw(name);
if (xobj instanceof _primitives.Ref) {
- const localImage = localImageCache.getByRef(xobj);
+ var _localImage = localImageCache.getByRef(xobj);
- if (localImage) {
- operatorList.addOp(localImage.fn, localImage.args);
+ if (_localImage) {
+ operatorList.addOp(_localImage.fn, _localImage.args);
resolveXObject();
return;
}
- const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
+ var globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
if (globalImage) {
operatorList.addDependency(globalImage.objId);
@@ -21288,7 +33181,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
throw new _util.FormatError("XObject should be a stream");
}
- const type = xobj.dict.get("Subtype");
+ var type = xobj.dict.get("Subtype");
if (!(0, _primitives.isName)(type)) {
throw new _util.FormatError("XObject should have a Name subtype");
@@ -21303,21 +33196,21 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return;
} else if (type.name === "Image") {
self.buildPaintImageXObject({
- resources,
+ resources: resources,
image: xobj,
- operatorList,
+ operatorList: operatorList,
cacheKey: name,
- localImageCache
+ localImageCache: localImageCache
}).then(resolveXObject, rejectXObject);
return;
} else if (type.name === "PS") {
(0, _util.info)("Ignored XObject subtype PS");
} else {
- throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
+ throw new _util.FormatError("Unhandled XObject subtype ".concat(type.name));
}
resolveXObject();
- }).catch(function (reason) {
+ })["catch"](function (reason) {
if (reason instanceof _util.AbortException) {
return;
}
@@ -21326,7 +33219,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
self.handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.errorXObject
});
- (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
+ (0, _util.warn)("getOperatorList - ignoring XObject: \"".concat(reason, "\"."));
return;
}
@@ -21354,22 +33247,22 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var cacheKey = args[0].cacheKey;
if (cacheKey) {
- const localImage = localImageCache.getByName(cacheKey);
+ var _localImage2 = localImageCache.getByName(cacheKey);
- if (localImage) {
- operatorList.addOp(localImage.fn, localImage.args);
+ if (_localImage2) {
+ operatorList.addOp(_localImage2.fn, _localImage2.args);
args = null;
continue;
}
}
next(self.buildPaintImageXObject({
- resources,
+ resources: resources,
image: args[0],
isInline: true,
- operatorList,
- cacheKey,
- localImageCache
+ operatorList: operatorList,
+ cacheKey: cacheKey,
+ localImageCache: localImageCache
}));
return;
@@ -21438,7 +33331,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
case _util.OPS.setFillColorSpace:
next(self.parseColorSpace({
cs: args[0],
- resources
+ resources: resources
}).then(function (colorSpace) {
if (colorSpace) {
stateManager.state.fillColorSpace = colorSpace;
@@ -21449,7 +33342,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
case _util.OPS.setStrokeColorSpace:
next(self.parseColorSpace({
cs: args[0],
- resources
+ resources: resources
}).then(function (colorSpace) {
if (colorSpace) {
stateManager.state.strokeColorSpace = colorSpace;
@@ -21604,16 +33497,17 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
closePendingRestoreOPS();
resolve();
- }).catch(reason => {
+ })["catch"](function (reason) {
if (reason instanceof _util.AbortException) {
return;
}
- if (this.options.ignoreErrors) {
- this.handler.send("UnsupportedFeature", {
+ if (_this10.options.ignoreErrors) {
+ _this10.handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
});
- (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
+
+ (0, _util.warn)("getOperatorList - ignoring errors during \"".concat(task.name, "\" ") + "task: \"".concat(reason, "\"."));
closePendingRestoreOPS();
return;
}
@@ -21621,17 +33515,21 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
throw reason;
});
},
-
- getTextContent({
- stream,
- task,
- resources,
- stateManager = null,
- normalizeWhitespace = false,
- combineTextItems = false,
- sink,
- seenStyles = Object.create(null)
- }) {
+ getTextContent: function getTextContent(_ref7) {
+ var _this11 = this;
+
+ var stream = _ref7.stream,
+ task = _ref7.task,
+ resources = _ref7.resources,
+ _ref7$stateManager = _ref7.stateManager,
+ stateManager = _ref7$stateManager === void 0 ? null : _ref7$stateManager,
+ _ref7$normalizeWhites = _ref7.normalizeWhitespace,
+ normalizeWhitespace = _ref7$normalizeWhites === void 0 ? false : _ref7$normalizeWhites,
+ _ref7$combineTextItem = _ref7.combineTextItems,
+ combineTextItems = _ref7$combineTextItem === void 0 ? false : _ref7$combineTextItem,
+ sink = _ref7.sink,
+ _ref7$seenStyles = _ref7.seenStyles,
+ seenStyles = _ref7$seenStyles === void 0 ? Object.create(null) : _ref7$seenStyles;
resources = resources || _primitives.Dict.empty;
stateManager = stateManager || new StateManager(new TextState());
var WhitespaceRegexp = /\s/g;
@@ -21662,7 +33560,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var self = this;
var xref = this.xref;
var xobjs = null;
- const emptyXObjectCache = new _image_utils.LocalImageCache();
+ var emptyXObjectCache = new _image_utils.LocalImageCache();
var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
var textState;
@@ -21687,7 +33585,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
- const glyphHeight = font.bbox[3] - font.bbox[1];
+ var glyphHeight = font.bbox[3] - font.bbox[1];
if (glyphHeight > 0) {
tsm[3] *= glyphHeight * textState.fontMatrix[3];
@@ -21867,7 +33765,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
function enqueueChunk() {
- const length = textContent.items.length;
+ var length = textContent.items.length;
if (length > 0) {
sink.enqueue(textContent, length);
@@ -21878,7 +33776,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var timeSlotManager = new TimeSlotManager();
return new Promise(function promiseBody(resolve, reject) {
- const next = function (promise) {
+ var next = function next(promise) {
enqueueChunk();
Promise.all([promise, sink.ready]).then(function () {
try {
@@ -22096,7 +33994,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
throw new _util.FormatError("XObject must be referred to by name.");
}
- let xobj = xobjs.getRaw(name);
+ var xobj = xobjs.getRaw(name);
if (xobj instanceof _primitives.Ref) {
if (emptyXObjectCache.getByRef(xobj)) {
@@ -22116,7 +34014,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
throw new _util.FormatError("XObject should be a stream");
}
- const type = xobj.dict.get("Subtype");
+ var type = xobj.dict.get("Subtype");
if (!(0, _primitives.isName)(type)) {
throw new _util.FormatError("XObject should have a Name subtype");
@@ -22128,19 +34026,18 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return;
}
- const currentState = stateManager.state.clone();
- const xObjStateManager = new StateManager(currentState);
- const matrix = xobj.dict.getArray("Matrix");
+ var currentState = stateManager.state.clone();
+ var xObjStateManager = new StateManager(currentState);
+ var matrix = xobj.dict.getArray("Matrix");
if (Array.isArray(matrix) && matrix.length === 6) {
xObjStateManager.transform(matrix);
}
enqueueChunk();
- const sinkWrapper = {
+ var sinkWrapper = {
enqueueInvoked: false,
-
- enqueue(chunk, size) {
+ enqueue: function enqueue(chunk, size) {
this.enqueueInvoked = true;
sink.enqueue(chunk, size);
},
@@ -22156,13 +34053,13 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
};
self.getTextContent({
stream: xobj,
- task,
+ task: task,
resources: xobj.dict.get("Resources") || resources,
stateManager: xObjStateManager,
- normalizeWhitespace,
- combineTextItems,
+ normalizeWhitespace: normalizeWhitespace,
+ combineTextItems: combineTextItems,
sink: sinkWrapper,
- seenStyles
+ seenStyles: seenStyles
}).then(function () {
if (!sinkWrapper.enqueueInvoked) {
emptyXObjectCache.set(name, xobj.dict.objId, true);
@@ -22170,13 +34067,13 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
resolveXObject();
}, rejectXObject);
- }).catch(function (reason) {
+ })["catch"](function (reason) {
if (reason instanceof _util.AbortException) {
return;
}
if (self.options.ignoreErrors) {
- (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
+ (0, _util.warn)("getTextContent - ignoring XObject: \"".concat(reason, "\"."));
return;
}
@@ -22225,13 +34122,13 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
flushTextContentItem();
enqueueChunk();
resolve();
- }).catch(reason => {
+ })["catch"](function (reason) {
if (reason instanceof _util.AbortException) {
return;
}
- if (this.options.ignoreErrors) {
- (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
+ if (_this11.options.ignoreErrors) {
+ (0, _util.warn)("getTextContent - ignoring errors during \"".concat(task.name, "\" ") + "task: \"".concat(reason, "\"."));
flushTextContentItem();
enqueueChunk();
return;
@@ -22240,10 +34137,11 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
throw reason;
});
},
-
extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) {
- const xref = this.xref;
- let cidToGidBytes;
+ var _this12 = this;
+
+ var xref = this.xref;
+ var cidToGidBytes;
var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
@@ -22288,7 +34186,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
} else if ((0, _primitives.isName)(data)) {
differences[index++] = data.name;
} else {
- throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
+ throw new _util.FormatError("Invalid entry in 'Differences' array: ".concat(data));
}
}
}
@@ -22333,29 +34231,29 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
properties.baseEncodingName = baseEncodingName;
properties.hasEncoding = !!baseEncodingName || differences.length > 0;
properties.dict = dict;
- return toUnicodePromise.then(readToUnicode => {
+ return toUnicodePromise.then(function (readToUnicode) {
properties.toUnicode = readToUnicode;
- return this.buildToUnicode(properties);
- }).then(builtToUnicode => {
+ return _this12.buildToUnicode(properties);
+ }).then(function (builtToUnicode) {
properties.toUnicode = builtToUnicode;
if (cidToGidBytes) {
- properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
+ properties.cidToGidMap = _this12.readCidToGidMap(cidToGidBytes, builtToUnicode);
}
return properties;
});
},
-
- _buildSimpleFontToUnicode(properties, forceGlyphs = false) {
+ _buildSimpleFontToUnicode: function _buildSimpleFontToUnicode(properties) {
+ var forceGlyphs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
(0, _util.assert)(!properties.composite, "Must be a simple font.");
- const toUnicode = [];
- const encoding = properties.defaultEncoding.slice();
- const baseEncodingName = properties.baseEncodingName;
- const differences = properties.differences;
+ var toUnicode = [];
+ var encoding = properties.defaultEncoding.slice();
+ var baseEncodingName = properties.baseEncodingName;
+ var differences = properties.differences;
- for (const charcode in differences) {
- const glyphName = differences[charcode];
+ for (var charcode in differences) {
+ var glyphName = differences[charcode];
if (glyphName === ".notdef") {
continue;
@@ -22364,35 +34262,35 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
encoding[charcode] = glyphName;
}
- const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
+ var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
- for (const charcode in encoding) {
- let glyphName = encoding[charcode];
+ for (var _charcode in encoding) {
+ var _glyphName = encoding[_charcode];
- if (glyphName === "") {
+ if (_glyphName === "") {
continue;
- } else if (glyphsUnicodeMap[glyphName] === undefined) {
- let code = 0;
+ } else if (glyphsUnicodeMap[_glyphName] === undefined) {
+ var code = 0;
- switch (glyphName[0]) {
+ switch (_glyphName[0]) {
case "G":
- if (glyphName.length === 3) {
- code = parseInt(glyphName.substring(1), 16);
+ if (_glyphName.length === 3) {
+ code = parseInt(_glyphName.substring(1), 16);
}
break;
case "g":
- if (glyphName.length === 5) {
- code = parseInt(glyphName.substring(1), 16);
+ if (_glyphName.length === 5) {
+ code = parseInt(_glyphName.substring(1), 16);
}
break;
case "C":
case "c":
- if (glyphName.length >= 3 && glyphName.length <= 4) {
- const codeStr = glyphName.substring(1);
+ if (_glyphName.length >= 3 && _glyphName.length <= 4) {
+ var codeStr = _glyphName.substring(1);
if (forceGlyphs) {
code = parseInt(codeStr, 16);
@@ -22409,7 +34307,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
break;
default:
- const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
+ var unicode = (0, _unicode.getUnicodeForGlyph)(_glyphName, glyphsUnicodeMap);
if (unicode !== -1) {
code = unicode;
@@ -22418,28 +34316,27 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
- if (baseEncodingName && code === +charcode) {
- const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
+ if (baseEncodingName && code === +_charcode) {
+ var baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
- if (baseEncoding && (glyphName = baseEncoding[charcode])) {
- toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
+ if (baseEncoding && (_glyphName = baseEncoding[_charcode])) {
+ toUnicode[_charcode] = String.fromCharCode(glyphsUnicodeMap[_glyphName]);
continue;
}
}
- toUnicode[charcode] = String.fromCodePoint(code);
+ toUnicode[_charcode] = String.fromCodePoint(code);
}
continue;
}
- toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
+ toUnicode[_charcode] = String.fromCharCode(glyphsUnicodeMap[_glyphName]);
}
return new _fonts.ToUnicodeMap(toUnicode);
},
-
- buildToUnicode(properties) {
+ buildToUnicode: function buildToUnicode(properties) {
properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
if (properties.hasIncludedToUnicodeMap) {
@@ -22455,24 +34352,24 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) {
- const registry = properties.cidSystemInfo.registry;
- const ordering = properties.cidSystemInfo.ordering;
+ var registry = properties.cidSystemInfo.registry;
+ var ordering = properties.cidSystemInfo.ordering;
- const ucs2CMapName = _primitives.Name.get(registry + "-" + ordering + "-UCS2");
+ var ucs2CMapName = _primitives.Name.get(registry + "-" + ordering + "-UCS2");
return _cmap.CMapFactory.create({
encoding: ucs2CMapName,
fetchBuiltInCMap: this.fetchBuiltInCMap,
useCMap: null
}).then(function (ucs2CMap) {
- const cMap = properties.cMap;
- const toUnicode = [];
+ var cMap = properties.cMap;
+ var toUnicode = [];
cMap.forEach(function (charcode, cid) {
if (cid > 0xffff) {
throw new _util.FormatError("Max size of CID is 65,535");
}
- const ucs2 = ucs2CMap.lookup(cid);
+ var ucs2 = ucs2CMap.lookup(cid);
if (ucs2) {
toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
@@ -22484,8 +34381,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return Promise.resolve(new _fonts.IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
},
-
readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
+ var _this13 = this;
+
var cmapObj = toUnicode;
if ((0, _primitives.isName)(cmapObj)) {
@@ -22530,16 +34428,17 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
map[charCode] = String.fromCodePoint.apply(String, str);
});
return new _fonts.ToUnicodeMap(map);
- }, reason => {
+ }, function (reason) {
if (reason instanceof _util.AbortException) {
return null;
}
- if (this.options.ignoreErrors) {
- this.handler.send("UnsupportedFeature", {
+ if (_this13.options.ignoreErrors) {
+ _this13.handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
});
- (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
+
+ (0, _util.warn)("readToUnicode - ignoring ToUnicode data: \"".concat(reason, "\"."));
return null;
}
@@ -22549,13 +34448,12 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return Promise.resolve(null);
},
-
- readCidToGidMap(glyphsData, toUnicode) {
+ readCidToGidMap: function readCidToGidMap(glyphsData, toUnicode) {
var result = [];
for (var j = 0, jj = glyphsData.length; j < jj; j++) {
var glyphID = glyphsData[j++] << 8 | glyphsData[j];
- const code = j >> 1;
+ var code = j >> 1;
if (glyphID === 0 && !toUnicode.has(code)) {
continue;
@@ -22566,7 +34464,6 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return result;
},
-
extractWidths: function PartialEvaluator_extractWidths(dict, descriptor, properties) {
var xref = this.xref;
var glyphsWidths = [];
@@ -22705,9 +34602,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
return {
- defaultWidth,
- monospace,
- widths
+ defaultWidth: defaultWidth,
+ monospace: monospace,
+ widths: widths
};
},
buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
@@ -22796,9 +34693,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
}
- const firstChar = dict.get("FirstChar") || 0;
- const lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
- hash.update(`${firstChar}-${lastChar}`);
+ var firstChar = dict.get("FirstChar") || 0;
+ var lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
+ hash.update("".concat(firstChar, "-").concat(lastChar));
var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
if ((0, _primitives.isStream)(toUnicode)) {
@@ -22818,15 +34715,17 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
return {
- descriptor,
- dict,
- baseDict,
- composite,
+ descriptor: descriptor,
+ dict: dict,
+ baseDict: baseDict,
+ composite: composite,
type: type.name,
hash: hash ? hash.hexdigest() : ""
};
},
translateFont: function PartialEvaluator_translateFont(preEvaluatedFont) {
+ var _this14 = this;
+
var baseDict = preEvaluatedFont.baseDict;
var dict = preEvaluatedFont.dict;
var composite = preEvaluatedFont.composite;
@@ -22834,8 +34733,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var type = preEvaluatedFont.type;
var maxCharIndex = composite ? 0xffff : 0xff;
var properties;
- const firstChar = dict.get("FirstChar") || 0;
- const lastChar = dict.get("LastChar") || maxCharIndex;
+ var firstChar = dict.get("FirstChar") || 0;
+ var lastChar = dict.get("LastChar") || maxCharIndex;
if (!descriptor) {
if (type === "Type3") {
@@ -22854,27 +34753,27 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var fontNameWoStyle = baseFontName.split("-")[0];
var flags = (this.isSerifFont(fontNameWoStyle) ? _fonts.FontFlags.Serif : 0) | (metrics.monospace ? _fonts.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts.FontFlags.Symbolic : _fonts.FontFlags.Nonsymbolic);
properties = {
- type,
+ type: type,
name: baseFontName,
widths: metrics.widths,
defaultWidth: metrics.defaultWidth,
- flags,
- firstChar,
- lastChar
+ flags: flags,
+ firstChar: firstChar,
+ lastChar: lastChar
};
- const widths = dict.get("Widths");
- return this.extractDataStructures(dict, dict, properties).then(newProperties => {
+ var widths = dict.get("Widths");
+ return this.extractDataStructures(dict, dict, properties).then(function (newProperties) {
if (widths) {
- const glyphWidths = [];
- let j = firstChar;
+ var glyphWidths = [];
+ var j = firstChar;
- for (let i = 0, ii = widths.length; i < ii; i++) {
- glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
+ for (var i = 0, ii = widths.length; i < ii; i++) {
+ glyphWidths[j++] = _this14.xref.fetchIfRef(widths[i]);
}
newProperties.widths = glyphWidths;
} else {
- newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
+ newProperties.widths = _this14.buildCharCodeToWidth(metrics.widths, newProperties);
}
return new _fonts.Font(baseFontName, null, newProperties);
@@ -22898,7 +34797,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var baseFontStr = baseFont && baseFont.name;
if (fontNameStr !== baseFontStr) {
- (0, _util.info)(`The FontDescriptor\'s FontName is "${fontNameStr}" but ` + `should be the same as the Font\'s BaseFont "${baseFontStr}".`);
+ (0, _util.info)("The FontDescriptor's FontName is \"".concat(fontNameStr, "\" but ") + "should be the same as the Font's BaseFont \"".concat(baseFontStr, "\"."));
if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
fontName = baseFont;
@@ -22929,15 +34828,15 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
properties = {
- type,
+ type: type,
name: fontName.name,
- subtype,
+ subtype: subtype,
file: fontFile,
- length1,
- length2,
- length3,
+ length1: length1,
+ length2: length2,
+ length3: length3,
loadedName: baseDict.loadedName,
- composite,
+ composite: composite,
fixedPitch: false,
fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
firstChar: firstChar || 0,
@@ -22972,10 +34871,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
cMapPromise = Promise.resolve(undefined);
}
- return cMapPromise.then(() => {
- return this.extractDataStructures(dict, baseDict, properties);
- }).then(newProperties => {
- this.extractWidths(dict, descriptor, newProperties);
+ return cMapPromise.then(function () {
+ return _this14.extractDataStructures(dict, baseDict, properties);
+ }).then(function (newProperties) {
+ _this14.extractWidths(dict, descriptor, newProperties);
if (type === "Type3") {
newProperties.isType3Font = true;
@@ -22992,16 +34891,26 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return;
}
- handler.send("commonobj", [`${font.loadedName}_path_${fontChar}`, "FontPath", font.renderer.getPathJs(fontChar)]);
+ handler.send("commonobj", ["".concat(font.loadedName, "_path_").concat(fontChar), "FontPath", font.renderer.getPathJs(fontChar)]);
}
- for (const glyph of glyphs) {
- buildPath(glyph.fontChar);
- const accent = glyph.accent;
+ var _iterator = _createForOfIteratorHelper(glyphs),
+ _step;
+
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ var glyph = _step.value;
+ buildPath(glyph.fontChar);
+ var accent = glyph.accent;
- if (accent && accent.fontChar) {
- buildPath(accent.fontChar);
+ if (accent && accent.fontChar) {
+ buildPath(accent.fontChar);
+ }
}
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
}
};
@@ -23010,7 +34919,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return this._fallbackFontDict;
}
- const dict = new _primitives.Dict();
+ var dict = new _primitives.Dict();
dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
dict.set("Type", _primitives.Name.get("FallbackType"));
dict.set("Subtype", _primitives.Name.get("FallbackType"));
@@ -23023,13 +34932,16 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
exports.PartialEvaluator = PartialEvaluator;
-class TranslatedFont {
- constructor({
- loadedName,
- font,
- dict,
- extraProperties = false
- }) {
+var TranslatedFont = /*#__PURE__*/function () {
+ function TranslatedFont(_ref8) {
+ var loadedName = _ref8.loadedName,
+ font = _ref8.font,
+ dict = _ref8.dict,
+ _ref8$extraProperties = _ref8.extraProperties,
+ extraProperties = _ref8$extraProperties === void 0 ? false : _ref8$extraProperties;
+
+ _classCallCheck(this, TranslatedFont);
+
this.loadedName = loadedName;
this.font = font;
this.dict = dict;
@@ -23038,73 +34950,83 @@ class TranslatedFont {
this.sent = false;
}
- send(handler) {
- if (this.sent) {
- return;
- }
-
- this.sent = true;
- handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._extraProperties)]);
- }
+ _createClass(TranslatedFont, [{
+ key: "send",
+ value: function send(handler) {
+ if (this.sent) {
+ return;
+ }
- fallback(handler) {
- if (!this.font.data) {
- return;
+ this.sent = true;
+ handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._extraProperties)]);
}
+ }, {
+ key: "fallback",
+ value: function fallback(handler) {
+ if (!this.font.data) {
+ return;
+ }
- this.font.disableFontFace = true;
- const glyphs = this.font.glyphCacheValues;
- PartialEvaluator.buildFontPaths(this.font, glyphs, handler);
- }
-
- loadType3Data(evaluator, resources, parentOperatorList, task) {
- if (!this.font.isType3Font) {
- throw new Error("Must be a Type3 font.");
+ this.font.disableFontFace = true;
+ var glyphs = this.font.glyphCacheValues;
+ PartialEvaluator.buildFontPaths(this.font, glyphs, handler);
}
+ }, {
+ key: "loadType3Data",
+ value: function loadType3Data(evaluator, resources, parentOperatorList, task) {
+ if (!this.font.isType3Font) {
+ throw new Error("Must be a Type3 font.");
+ }
+
+ if (this.type3Loaded) {
+ return this.type3Loaded;
+ }
+
+ var type3Options = Object.create(evaluator.options);
+ type3Options.ignoreErrors = false;
+ var type3Evaluator = evaluator.clone(type3Options);
+ type3Evaluator.parsingType3Font = true;
+ var translatedFont = this.font;
+ var loadCharProcsPromise = Promise.resolve();
+ var charProcs = this.dict.get("CharProcs");
+ var fontResources = this.dict.get("Resources") || resources;
+ var charProcKeys = charProcs.getKeys();
+ var charProcOperatorList = Object.create(null);
+
+ var _loop2 = function _loop2() {
+ var key = charProcKeys[i];
+ loadCharProcsPromise = loadCharProcsPromise.then(function () {
+ var glyphStream = charProcs.get(key);
+ var operatorList = new _operator_list.OperatorList();
+ return type3Evaluator.getOperatorList({
+ stream: glyphStream,
+ task: task,
+ resources: fontResources,
+ operatorList: operatorList
+ }).then(function () {
+ charProcOperatorList[key] = operatorList.getIR();
+ parentOperatorList.addDependencies(operatorList.dependencies);
+ })["catch"](function (reason) {
+ (0, _util.warn)("Type3 font resource \"".concat(key, "\" is not available."));
+ var dummyOperatorList = new _operator_list.OperatorList();
+ charProcOperatorList[key] = dummyOperatorList.getIR();
+ });
+ });
+ };
- if (this.type3Loaded) {
- return this.type3Loaded;
- }
+ for (var i = 0, n = charProcKeys.length; i < n; ++i) {
+ _loop2();
+ }
- var type3Options = Object.create(evaluator.options);
- type3Options.ignoreErrors = false;
- var type3Evaluator = evaluator.clone(type3Options);
- type3Evaluator.parsingType3Font = true;
- var translatedFont = this.font;
- var loadCharProcsPromise = Promise.resolve();
- var charProcs = this.dict.get("CharProcs");
- var fontResources = this.dict.get("Resources") || resources;
- var charProcKeys = charProcs.getKeys();
- var charProcOperatorList = Object.create(null);
-
- for (var i = 0, n = charProcKeys.length; i < n; ++i) {
- const key = charProcKeys[i];
- loadCharProcsPromise = loadCharProcsPromise.then(function () {
- var glyphStream = charProcs.get(key);
- var operatorList = new _operator_list.OperatorList();
- return type3Evaluator.getOperatorList({
- stream: glyphStream,
- task,
- resources: fontResources,
- operatorList
- }).then(function () {
- charProcOperatorList[key] = operatorList.getIR();
- parentOperatorList.addDependencies(operatorList.dependencies);
- }).catch(function (reason) {
- (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
- const dummyOperatorList = new _operator_list.OperatorList();
- charProcOperatorList[key] = dummyOperatorList.getIR();
- });
+ this.type3Loaded = loadCharProcsPromise.then(function () {
+ translatedFont.charProcOperatorList = charProcOperatorList;
});
+ return this.type3Loaded;
}
+ }]);
- this.type3Loaded = loadCharProcsPromise.then(function () {
- translatedFont.charProcOperatorList = charProcOperatorList;
- });
- return this.type3Loaded;
- }
-
-}
+ return TranslatedFont;
+}();
var StateManager = function StateManagerClosure() {
function StateManager(initialState) {
@@ -23113,24 +35035,21 @@ var StateManager = function StateManagerClosure() {
}
StateManager.prototype = {
- save() {
+ save: function save() {
var old = this.state;
this.stateStack.push(this.state);
this.state = old.clone();
},
-
- restore() {
+ restore: function restore() {
var prev = this.stateStack.pop();
if (prev) {
this.state = prev;
}
},
-
- transform(args) {
+ transform: function transform(args) {
this.state.ctm = _util.Util.transform(this.state.ctm, args);
}
-
};
return StateManager;
}();
@@ -23623,22 +35542,22 @@ var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
};
t.BM = null;
t.BD = null;
- t.true = null;
+ t["true"] = null;
t.fa = null;
t.fal = null;
t.fals = null;
- t.false = null;
+ t["false"] = null;
t.nu = null;
t.nul = null;
- t.null = null;
+ t["null"] = null;
});
- const MAX_INVALID_PATH_OPS = 20;
+ var MAX_INVALID_PATH_OPS = 20;
function EvaluatorPreprocessor(stream, xref, stateManager) {
this.opMap = getOPMap();
this.parser = new _parser.Parser({
lexer: new _parser.Lexer(stream, this.opMap),
- xref
+ xref: xref
});
this.stateManager = stateManager;
this.nonProcessedArgs = [];
@@ -23661,7 +35580,7 @@ var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
var opSpec = this.opMap[cmd];
if (!opSpec) {
- (0, _util.warn)(`Unknown command "${cmd}".`);
+ (0, _util.warn)("Unknown command \"".concat(cmd, "\"."));
continue;
}
@@ -23689,13 +35608,13 @@ var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
}
if (argsLength < numArgs) {
- const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
+ var partialMsg = "command ".concat(cmd, ": expected ").concat(numArgs, " args, ") + "but received ".concat(argsLength, " args.");
if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > MAX_INVALID_PATH_OPS) {
- throw new _util.FormatError(`Invalid ${partialMsg}`);
+ throw new _util.FormatError("Invalid ".concat(partialMsg));
}
- (0, _util.warn)(`Skipping ${partialMsg}`);
+ (0, _util.warn)("Skipping ".concat(partialMsg));
if (args !== null) {
args.length = 0;
@@ -23704,7 +35623,7 @@ var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
continue;
}
} else if (argsLength > numArgs) {
- (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
+ (0, _util.info)("Command ".concat(cmd, ": expected [0, ").concat(numArgs, "] args, ") + "but received ".concat(argsLength, " args."));
}
this.preprocessCommand(fn, args);
@@ -23750,7 +35669,7 @@ var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
}();
/***/ }),
-/* 28 */
+/* 221 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -23761,21 +35680,55 @@ Object.defineProperty(exports, "__esModule", {
});
exports.CMapFactory = exports.IdentityCMap = exports.CMap = void 0;
-var _util = __w_pdfjs_require__(2);
+var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
+
+var _util = __w_pdfjs_require__(5);
+
+var _primitives = __w_pdfjs_require__(198);
+
+var _parser = __w_pdfjs_require__(204);
-var _primitives = __w_pdfjs_require__(5);
+var _core_utils = __w_pdfjs_require__(201);
-var _parser = __w_pdfjs_require__(11);
+var _stream = __w_pdfjs_require__(205);
-var _core_utils = __w_pdfjs_require__(8);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-var _stream = __w_pdfjs_require__(12);
+function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
+
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"];
-const MAX_MAP_RANGE = 2 ** 24 - 1;
+var MAX_MAP_RANGE = Math.pow(2, 24) - 1;
+
+var CMap = /*#__PURE__*/function () {
+ function CMap() {
+ var builtInCMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ _classCallCheck(this, CMap);
-class CMap {
- constructor(builtInCMap = false) {
this.codespaceRanges = [[], [], [], []];
this.numCodespaceRanges = 0;
this._map = [];
@@ -23785,207 +35738,248 @@ class CMap {
this.builtInCMap = builtInCMap;
}
- addCodespaceRange(n, low, high) {
- this.codespaceRanges[n - 1].push(low, high);
- this.numCodespaceRanges++;
- }
-
- mapCidRange(low, high, dstLow) {
- if (high - low > MAX_MAP_RANGE) {
- throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
+ _createClass(CMap, [{
+ key: "addCodespaceRange",
+ value: function addCodespaceRange(n, low, high) {
+ this.codespaceRanges[n - 1].push(low, high);
+ this.numCodespaceRanges++;
}
+ }, {
+ key: "mapCidRange",
+ value: function mapCidRange(low, high, dstLow) {
+ if (high - low > MAX_MAP_RANGE) {
+ throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
+ }
- while (low <= high) {
- this._map[low++] = dstLow++;
+ while (low <= high) {
+ this._map[low++] = dstLow++;
+ }
}
- }
+ }, {
+ key: "mapBfRange",
+ value: function mapBfRange(low, high, dstLow) {
+ if (high - low > MAX_MAP_RANGE) {
+ throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
+ }
+
+ var lastByte = dstLow.length - 1;
- mapBfRange(low, high, dstLow) {
- if (high - low > MAX_MAP_RANGE) {
- throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
+ while (low <= high) {
+ this._map[low++] = dstLow;
+ dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
+ }
}
+ }, {
+ key: "mapBfRangeToArray",
+ value: function mapBfRangeToArray(low, high, array) {
+ if (high - low > MAX_MAP_RANGE) {
+ throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
+ }
- var lastByte = dstLow.length - 1;
+ var ii = array.length;
+ var i = 0;
- while (low <= high) {
- this._map[low++] = dstLow;
- dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
+ while (low <= high && i < ii) {
+ this._map[low] = array[i++];
+ ++low;
+ }
}
- }
-
- mapBfRangeToArray(low, high, array) {
- if (high - low > MAX_MAP_RANGE) {
- throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
+ }, {
+ key: "mapOne",
+ value: function mapOne(src, dst) {
+ this._map[src] = dst;
}
-
- const ii = array.length;
- let i = 0;
-
- while (low <= high && i < ii) {
- this._map[low] = array[i++];
- ++low;
+ }, {
+ key: "lookup",
+ value: function lookup(code) {
+ return this._map[code];
}
- }
-
- mapOne(src, dst) {
- this._map[src] = dst;
- }
-
- lookup(code) {
- return this._map[code];
- }
-
- contains(code) {
- return this._map[code] !== undefined;
- }
-
- forEach(callback) {
- const map = this._map;
- const length = map.length;
+ }, {
+ key: "contains",
+ value: function contains(code) {
+ return this._map[code] !== undefined;
+ }
+ }, {
+ key: "forEach",
+ value: function forEach(callback) {
+ var map = this._map;
+ var length = map.length;
- if (length <= 0x10000) {
- for (let i = 0; i < length; i++) {
- if (map[i] !== undefined) {
- callback(i, map[i]);
+ if (length <= 0x10000) {
+ for (var i = 0; i < length; i++) {
+ if (map[i] !== undefined) {
+ callback(i, map[i]);
+ }
+ }
+ } else {
+ for (var _i in map) {
+ callback(_i, map[_i]);
}
- }
- } else {
- for (const i in map) {
- callback(i, map[i]);
}
}
- }
-
- charCodeOf(value) {
- const map = this._map;
-
- if (map.length <= 0x10000) {
- return map.indexOf(value);
- }
+ }, {
+ key: "charCodeOf",
+ value: function charCodeOf(value) {
+ var map = this._map;
- for (const charCode in map) {
- if (map[charCode] === value) {
- return charCode | 0;
+ if (map.length <= 0x10000) {
+ return map.indexOf(value);
}
- }
- return -1;
- }
-
- getMap() {
- return this._map;
- }
+ for (var charCode in map) {
+ if (map[charCode] === value) {
+ return charCode | 0;
+ }
+ }
- readCharCode(str, offset, out) {
- let c = 0;
- const codespaceRanges = this.codespaceRanges;
+ return -1;
+ }
+ }, {
+ key: "getMap",
+ value: function getMap() {
+ return this._map;
+ }
+ }, {
+ key: "readCharCode",
+ value: function readCharCode(str, offset, out) {
+ var c = 0;
+ var codespaceRanges = this.codespaceRanges;
- for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
- c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
- const codespaceRange = codespaceRanges[n];
+ for (var n = 0, nn = codespaceRanges.length; n < nn; n++) {
+ c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
+ var codespaceRange = codespaceRanges[n];
- for (let k = 0, kk = codespaceRange.length; k < kk;) {
- const low = codespaceRange[k++];
- const high = codespaceRange[k++];
+ for (var k = 0, kk = codespaceRange.length; k < kk;) {
+ var low = codespaceRange[k++];
+ var high = codespaceRange[k++];
- if (c >= low && c <= high) {
- out.charcode = c;
- out.length = n + 1;
- return;
+ if (c >= low && c <= high) {
+ out.charcode = c;
+ out.length = n + 1;
+ return;
+ }
}
}
- }
- out.charcode = 0;
- out.length = 1;
- }
-
- get length() {
- return this._map.length;
- }
-
- get isIdentityCMap() {
- if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
- return false;
+ out.charcode = 0;
+ out.length = 1;
}
-
- if (this._map.length !== 0x10000) {
- return false;
+ }, {
+ key: "length",
+ get: function get() {
+ return this._map.length;
}
+ }, {
+ key: "isIdentityCMap",
+ get: function get() {
+ if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
+ return false;
+ }
- for (let i = 0; i < 0x10000; i++) {
- if (this._map[i] !== i) {
+ if (this._map.length !== 0x10000) {
return false;
}
- }
- return true;
- }
+ for (var i = 0; i < 0x10000; i++) {
+ if (this._map[i] !== i) {
+ return false;
+ }
+ }
-}
+ return true;
+ }
+ }]);
+
+ return CMap;
+}();
exports.CMap = CMap;
-class IdentityCMap extends CMap {
- constructor(vertical, n) {
- super();
- this.vertical = vertical;
- this.addCodespaceRange(n, 0, 0xffff);
- }
+var IdentityCMap = /*#__PURE__*/function (_CMap) {
+ _inherits(IdentityCMap, _CMap);
- mapCidRange(low, high, dstLow) {
- (0, _util.unreachable)("should not call mapCidRange");
- }
+ var _super = _createSuper(IdentityCMap);
- mapBfRange(low, high, dstLow) {
- (0, _util.unreachable)("should not call mapBfRange");
- }
+ function IdentityCMap(vertical, n) {
+ var _this;
- mapBfRangeToArray(low, high, array) {
- (0, _util.unreachable)("should not call mapBfRangeToArray");
- }
+ _classCallCheck(this, IdentityCMap);
- mapOne(src, dst) {
- (0, _util.unreachable)("should not call mapCidOne");
- }
+ _this = _super.call(this);
+ _this.vertical = vertical;
- lookup(code) {
- return Number.isInteger(code) && code <= 0xffff ? code : undefined;
- }
+ _this.addCodespaceRange(n, 0, 0xffff);
- contains(code) {
- return Number.isInteger(code) && code <= 0xffff;
+ return _this;
}
- forEach(callback) {
- for (let i = 0; i <= 0xffff; i++) {
- callback(i, i);
+ _createClass(IdentityCMap, [{
+ key: "mapCidRange",
+ value: function mapCidRange(low, high, dstLow) {
+ (0, _util.unreachable)("should not call mapCidRange");
}
- }
-
- charCodeOf(value) {
- return Number.isInteger(value) && value <= 0xffff ? value : -1;
- }
-
- getMap() {
- const map = new Array(0x10000);
-
- for (let i = 0; i <= 0xffff; i++) {
- map[i] = i;
+ }, {
+ key: "mapBfRange",
+ value: function mapBfRange(low, high, dstLow) {
+ (0, _util.unreachable)("should not call mapBfRange");
}
+ }, {
+ key: "mapBfRangeToArray",
+ value: function mapBfRangeToArray(low, high, array) {
+ (0, _util.unreachable)("should not call mapBfRangeToArray");
+ }
+ }, {
+ key: "mapOne",
+ value: function mapOne(src, dst) {
+ (0, _util.unreachable)("should not call mapCidOne");
+ }
+ }, {
+ key: "lookup",
+ value: function lookup(code) {
+ return Number.isInteger(code) && code <= 0xffff ? code : undefined;
+ }
+ }, {
+ key: "contains",
+ value: function contains(code) {
+ return Number.isInteger(code) && code <= 0xffff;
+ }
+ }, {
+ key: "forEach",
+ value: function forEach(callback) {
+ for (var i = 0; i <= 0xffff; i++) {
+ callback(i, i);
+ }
+ }
+ }, {
+ key: "charCodeOf",
+ value: function charCodeOf(value) {
+ return Number.isInteger(value) && value <= 0xffff ? value : -1;
+ }
+ }, {
+ key: "getMap",
+ value: function getMap() {
+ var map = new Array(0x10000);
- return map;
- }
-
- get length() {
- return 0x10000;
- }
+ for (var i = 0; i <= 0xffff; i++) {
+ map[i] = i;
+ }
- get isIdentityCMap() {
- (0, _util.unreachable)("should not access .isIdentityCMap");
- }
+ return map;
+ }
+ }, {
+ key: "length",
+ get: function get() {
+ return 0x10000;
+ }
+ }, {
+ key: "isIdentityCMap",
+ get: function get() {
+ (0, _util.unreachable)("should not access .isIdentityCMap");
+ }
+ }]);
-}
+ return IdentityCMap;
+}(CMap);
exports.IdentityCMap = IdentityCMap;
@@ -24043,15 +36037,14 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
}
BinaryCMapStream.prototype = {
- readByte() {
+ readByte: function readByte() {
if (this.pos >= this.end) {
return -1;
}
return this.buffer[this.pos++];
},
-
- readNumber() {
+ readNumber: function readNumber() {
var n = 0;
var last;
@@ -24068,18 +36061,15 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
return n;
},
-
- readSigned() {
+ readSigned: function readSigned() {
var n = this.readNumber();
return n & 1 ? ~(n >>> 1) : n >>> 1;
},
-
- readHex(num, size) {
+ readHex: function readHex(num, size) {
num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
this.pos += size + 1;
},
-
- readHexNumber(num, size) {
+ readHexNumber: function readHexNumber(num, size) {
var last;
var stack = this.tmpBuf,
sp = 0;
@@ -24111,8 +36101,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
bufferSize -= 8;
}
},
-
- readHexSigned(num, size) {
+ readHexSigned: function readHexSigned(num, size) {
this.readHexNumber(num, size);
var sign = num[size] & 1 ? 255 : 0;
var c = 0;
@@ -24122,8 +36111,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
num[i] = c >> 1 ^ sign;
}
},
-
- readString() {
+ readString: function readString() {
var len = this.readNumber();
var s = "";
@@ -24133,7 +36121,6 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
return s;
}
-
};
function processBinaryCMap(data, cMap, extend) {
@@ -24144,7 +36131,9 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
var useCMap = null;
var start = new Uint8Array(MAX_NUM_SIZE);
var end = new Uint8Array(MAX_NUM_SIZE);
- var char = new Uint8Array(MAX_NUM_SIZE);
+
+ var _char = new Uint8Array(MAX_NUM_SIZE);
+
var charCode = new Uint8Array(MAX_NUM_SIZE);
var tmp = new Uint8Array(MAX_NUM_SIZE);
var code;
@@ -24214,20 +36203,20 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
break;
case 2:
- stream.readHex(char, dataSize);
+ stream.readHex(_char, dataSize);
code = stream.readNumber();
- cMap.mapOne(hexToInt(char, dataSize), code);
+ cMap.mapOne(hexToInt(_char, dataSize), code);
for (i = 1; i < subitemsCount; i++) {
- incHex(char, dataSize);
+ incHex(_char, dataSize);
if (!sequence) {
stream.readHexNumber(tmp, dataSize);
- addHex(char, tmp, dataSize);
+ addHex(_char, tmp, dataSize);
}
code = stream.readSigned() + (code + 1);
- cMap.mapOne(hexToInt(char, dataSize), code);
+ cMap.mapOne(hexToInt(_char, dataSize), code);
}
break;
@@ -24258,22 +36247,22 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
break;
case 4:
- stream.readHex(char, ucs2DataSize);
+ stream.readHex(_char, ucs2DataSize);
stream.readHex(charCode, dataSize);
- cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
+ cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize));
for (i = 1; i < subitemsCount; i++) {
- incHex(char, ucs2DataSize);
+ incHex(_char, ucs2DataSize);
if (!sequence) {
stream.readHexNumber(tmp, ucs2DataSize);
- addHex(char, tmp, ucs2DataSize);
+ addHex(_char, tmp, ucs2DataSize);
}
incHex(charCode, dataSize);
stream.readHexSigned(tmp, dataSize);
addHex(charCode, tmp, dataSize);
- cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
+ cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize));
}
break;
@@ -24632,35 +36621,58 @@ var CMapFactory = function CMapFactoryClosure() {
}
return {
- async create(params) {
- var encoding = params.encoding;
- var fetchBuiltInCMap = params.fetchBuiltInCMap;
- var useCMap = params.useCMap;
-
- if ((0, _primitives.isName)(encoding)) {
- return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
- } else if ((0, _primitives.isStream)(encoding)) {
- var cMap = new CMap();
- var lexer = new _parser.Lexer(encoding);
- return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
- if (parsedCMap.isIdentityCMap) {
- return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
- }
-
- return parsedCMap;
- });
- }
+ create: function create(params) {
+ return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
+ var encoding, fetchBuiltInCMap, useCMap, cMap, lexer;
+ return _regenerator["default"].wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ encoding = params.encoding;
+ fetchBuiltInCMap = params.fetchBuiltInCMap;
+ useCMap = params.useCMap;
- throw new Error("Encoding required.");
- }
+ if (!(0, _primitives.isName)(encoding)) {
+ _context.next = 7;
+ break;
+ }
+
+ return _context.abrupt("return", createBuiltInCMap(encoding.name, fetchBuiltInCMap));
+
+ case 7:
+ if (!(0, _primitives.isStream)(encoding)) {
+ _context.next = 11;
+ break;
+ }
+
+ cMap = new CMap();
+ lexer = new _parser.Lexer(encoding);
+ return _context.abrupt("return", parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
+ if (parsedCMap.isIdentityCMap) {
+ return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
+ }
+ return parsedCMap;
+ }));
+
+ case 11:
+ throw new Error("Encoding required.");
+
+ case 12:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee);
+ }))();
+ }
};
}();
exports.CMapFactory = CMapFactory;
/***/ }),
-/* 29 */
+/* 222 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -24672,34 +36684,48 @@ Object.defineProperty(exports, "__esModule", {
exports.getFontType = getFontType;
exports.IdentityToUnicodeMap = exports.ToUnicodeMap = exports.FontFlags = exports.Font = exports.ErrorFont = exports.SEAC_ANALYSIS_ENABLED = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+var _cff_parser = __w_pdfjs_require__(223);
-var _cff_parser = __w_pdfjs_require__(30);
+var _glyphlist = __w_pdfjs_require__(226);
-var _glyphlist = __w_pdfjs_require__(33);
+var _encodings = __w_pdfjs_require__(225);
-var _encodings = __w_pdfjs_require__(32);
+var _standard_fonts = __w_pdfjs_require__(227);
-var _standard_fonts = __w_pdfjs_require__(34);
+var _unicode = __w_pdfjs_require__(228);
-var _unicode = __w_pdfjs_require__(35);
+var _core_utils = __w_pdfjs_require__(201);
-var _core_utils = __w_pdfjs_require__(8);
+var _font_renderer = __w_pdfjs_require__(229);
-var _font_renderer = __w_pdfjs_require__(36);
+var _cmap = __w_pdfjs_require__(221);
-var _cmap = __w_pdfjs_require__(28);
+var _stream = __w_pdfjs_require__(205);
-var _stream = __w_pdfjs_require__(12);
+var _type1_parser = __w_pdfjs_require__(230);
-var _type1_parser = __w_pdfjs_require__(37);
+function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
-const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
+function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
+
+function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
+
+function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
+
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
+
+function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
+
+var PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
var PDF_GLYPH_SPACE_UNITS = 1000;
var SEAC_ANALYSIS_ENABLED = true;
exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
-const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isMonospace", "isSerifFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
-const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
+var EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isMonospace", "isSerifFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
+var EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
var FontFlags = {
FixedPitch: 1,
Serif: 2,
@@ -24832,7 +36858,8 @@ var Glyph = function GlyphClosure() {
}();
var ToUnicodeMap = function ToUnicodeMapClosure() {
- function ToUnicodeMap(cmap = []) {
+ function ToUnicodeMap() {
+ var cmap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
this._map = cmap;
}
@@ -24841,28 +36868,25 @@ var ToUnicodeMap = function ToUnicodeMapClosure() {
return this._map.length;
},
- forEach(callback) {
+ forEach: function forEach(callback) {
for (var charCode in this._map) {
callback(charCode, this._map[charCode].charCodeAt(0));
}
},
-
- has(i) {
+ has: function has(i) {
return this._map[i] !== undefined;
},
-
- get(i) {
+ get: function get(i) {
return this._map[i];
},
-
- charCodeOf(value) {
- const map = this._map;
+ charCodeOf: function charCodeOf(value) {
+ var map = this._map;
if (map.length <= 0x10000) {
return map.indexOf(value);
}
- for (const charCode in map) {
+ for (var charCode in map) {
if (map[charCode] === value) {
return charCode | 0;
}
@@ -24870,13 +36894,11 @@ var ToUnicodeMap = function ToUnicodeMapClosure() {
return -1;
},
-
- amend(map) {
+ amend: function amend(map) {
for (var charCode in map) {
this._map[charCode] = map[charCode];
}
}
-
};
return ToUnicodeMap;
}();
@@ -24894,32 +36916,27 @@ var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
return this.lastChar + 1 - this.firstChar;
},
- forEach(callback) {
+ forEach: function forEach(callback) {
for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
callback(i, i);
}
},
-
- has(i) {
+ has: function has(i) {
return this.firstChar <= i && i <= this.lastChar;
},
-
- get(i) {
+ get: function get(i) {
if (this.firstChar <= i && i <= this.lastChar) {
return String.fromCharCode(i);
}
return undefined;
},
-
- charCodeOf(v) {
+ charCodeOf: function charCodeOf(v) {
return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
},
-
- amend(map) {
+ amend: function amend(map) {
(0, _util.unreachable)("Should not call amend()");
}
-
};
return IdentityToUnicodeMap;
}();
@@ -25066,7 +37083,7 @@ var Font = function FontClosure() {
var subtype = properties.subtype;
this.type = type;
this.subtype = subtype;
- let fallbackName = "sans-serif";
+ var fallbackName = "sans-serif";
if (this.isMonospace) {
fallbackName = "monospace";
@@ -25115,10 +37132,15 @@ var Font = function FontClosure() {
return;
}
- [type, subtype] = getFontFileType(file, properties);
+ var _getFontFileType = getFontFileType(file, properties);
+
+ var _getFontFileType2 = _slicedToArray(_getFontFileType, 2);
+
+ type = _getFontFileType2[0];
+ subtype = _getFontFileType2[1];
if (type !== this.type || subtype !== this.subtype) {
- (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
+ (0, _util.info)("Inconsistent font file Type/SubType, expected: " + "".concat(this.type, "/").concat(this.subtype, " but found: ").concat(type, "/").concat(subtype, "."));
}
try {
@@ -25150,7 +37172,7 @@ var Font = function FontClosure() {
break;
default:
- throw new _util.FormatError(`Font ${type} is not supported`);
+ throw new _util.FormatError("Font ".concat(type, " is not supported"));
}
} catch (e) {
(0, _util.warn)(e);
@@ -25212,7 +37234,7 @@ var Font = function FontClosure() {
}
function isTrueTypeCollectionFile(file) {
- const header = file.peekBytes(4);
+ var header = file.peekBytes(4);
return (0, _util.bytesToString)(header) === "ttcf";
}
@@ -25236,7 +37258,7 @@ var Font = function FontClosure() {
}
function isCFFFile(file) {
- const header = file.peekBytes(4);
+ var header = file.peekBytes(4);
if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
return true;
@@ -25245,12 +37267,11 @@ var Font = function FontClosure() {
return false;
}
- function getFontFileType(file, {
- type,
- subtype,
- composite
- }) {
- let fileType, fileSubtype;
+ function getFontFileType(file, _ref) {
+ var type = _ref.type,
+ subtype = _ref.subtype,
+ composite = _ref.composite;
+ var fileType, fileSubtype;
if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
if (composite) {
@@ -25348,9 +37369,9 @@ var Font = function FontClosure() {
}
return {
- toFontChar,
+ toFontChar: toFontChar,
charCodeToGlyphId: newMap,
- nextAvailableFontCharCode
+ nextAvailableFontCharCode: nextAvailableFontCharCode
};
}
@@ -25597,7 +37618,7 @@ var Font = function FontClosure() {
}
function createPostTable(properties) {
- var angle = Math.floor(properties.italicAngle * 2 ** 16);
+ var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
}
@@ -25656,28 +37677,40 @@ var Font = function FontClosure() {
return (0, _util.shadow)(this, "renderer", renderer);
},
- exportData(extraProperties = false) {
- const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
- const data = Object.create(null);
- let property, value;
+ exportData: function exportData() {
+ var extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var exportDataProperties = extraProperties ? [].concat(EXPORT_DATA_PROPERTIES, EXPORT_DATA_EXTRA_PROPERTIES) : EXPORT_DATA_PROPERTIES;
+ var data = Object.create(null);
+ var property, value;
- for (property of exportDataProperties) {
- value = this[property];
+ var _iterator = _createForOfIteratorHelper(exportDataProperties),
+ _step;
- if (value !== undefined) {
- data[property] = value;
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ property = _step.value;
+ value = this[property];
+
+ if (value !== undefined) {
+ data[property] = value;
+ }
}
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
}
return data;
},
-
fallbackToSystemFont: function Font_fallbackToSystemFont() {
+ var _this = this;
+
this.missingFile = true;
var name = this.name;
var type = this.type;
var subtype = this.subtype;
- let fontName = name.replace(/[,_]/g, "-").replace(/\s/g, "");
+ var fontName = name.replace(/[,_]/g, "-").replace(/\s/g, "");
var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
@@ -25688,24 +37721,24 @@ var Font = function FontClosure() {
this.remeasure = Object.keys(this.widths).length > 0;
if (isStandardFont && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
- const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
- const map = [];
+ var GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
+ var map = [];
- for (const charCode in GlyphMapForStandardFonts) {
+ for (var charCode in GlyphMapForStandardFonts) {
map[+charCode] = GlyphMapForStandardFonts[charCode];
}
if (/Arial-?Black/i.test(name)) {
var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
- for (const charCode in SupplementalGlyphMapForArialBlack) {
- map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
+ for (var _charCode in SupplementalGlyphMapForArialBlack) {
+ map[+_charCode] = SupplementalGlyphMapForArialBlack[_charCode];
}
} else if (/Calibri/i.test(name)) {
- const SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)();
+ var SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)();
- for (const charCode in SupplementalGlyphMapForCalibri) {
- map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
+ for (var _charCode2 in SupplementalGlyphMapForCalibri) {
+ map[+_charCode2] = SupplementalGlyphMapForCalibri[_charCode2];
}
}
@@ -25730,42 +37763,42 @@ var Font = function FontClosure() {
} else if (isStandardFont) {
this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
} else {
- const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
- const map = [];
- this.toUnicode.forEach((charCode, unicodeCharCode) => {
- if (!this.composite) {
- var glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
- const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
+ var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
+ var _map = [];
+ this.toUnicode.forEach(function (charCode, unicodeCharCode) {
+ if (!_this.composite) {
+ var glyphName = _this.differences[charCode] || _this.defaultEncoding[charCode];
+ var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
if (unicode !== -1) {
unicodeCharCode = unicode;
}
}
- map[+charCode] = unicodeCharCode;
+ _map[+charCode] = unicodeCharCode;
});
if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) {
if (/Verdana/i.test(name)) {
- const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
+ var _GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
- for (const charCode in GlyphMapForStandardFonts) {
- map[+charCode] = GlyphMapForStandardFonts[charCode];
+ for (var _charCode3 in _GlyphMapForStandardFonts) {
+ _map[+_charCode3] = _GlyphMapForStandardFonts[_charCode3];
}
}
}
- this.toFontChar = map;
+ this.toFontChar = _map;
}
this.loadedName = fontName.split("-")[0];
this.fontType = getFontType(type, subtype);
},
checkAndRepair: function Font_checkAndRepair(name, font, properties) {
- const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
+ var VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
function readTables(file, numTables) {
- const tables = Object.create(null);
+ var tables = Object.create(null);
tables["OS/2"] = null;
tables.cmap = null;
tables.head = null;
@@ -25775,8 +37808,8 @@ var Font = function FontClosure() {
tables.name = null;
tables.post = null;
- for (let i = 0; i < numTables; i++) {
- const table = readTableEntry(file);
+ for (var i = 0; i < numTables; i++) {
+ var table = readTableEntry(file);
if (!VALID_TABLES.includes(table.tag)) {
continue;
@@ -25809,11 +37842,11 @@ var Font = function FontClosure() {
}
return {
- tag,
- checksum,
- length,
- offset,
- data
+ tag: tag,
+ checksum: checksum,
+ length: length,
+ offset: offset,
+ data: data
};
}
@@ -25828,23 +37861,23 @@ var Font = function FontClosure() {
}
function readTrueTypeCollectionHeader(ttc) {
- const ttcTag = (0, _util.bytesToString)(ttc.getBytes(4));
+ var ttcTag = (0, _util.bytesToString)(ttc.getBytes(4));
(0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
- const majorVersion = ttc.getUint16();
- const minorVersion = ttc.getUint16();
- const numFonts = ttc.getInt32() >>> 0;
- const offsetTable = [];
+ var majorVersion = ttc.getUint16();
+ var minorVersion = ttc.getUint16();
+ var numFonts = ttc.getInt32() >>> 0;
+ var offsetTable = [];
- for (let i = 0; i < numFonts; i++) {
+ for (var i = 0; i < numFonts; i++) {
offsetTable.push(ttc.getInt32() >>> 0);
}
- const header = {
- ttcTag,
- majorVersion,
- minorVersion,
- numFonts,
- offsetTable
+ var header = {
+ ttcTag: ttcTag,
+ majorVersion: majorVersion,
+ minorVersion: minorVersion,
+ numFonts: numFonts,
+ offsetTable: offsetTable
};
switch (majorVersion) {
@@ -25858,29 +37891,28 @@ var Font = function FontClosure() {
return header;
}
- throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
+ throw new _util.FormatError("Invalid TrueType Collection majorVersion: ".concat(majorVersion, "."));
}
function readTrueTypeCollectionData(ttc, fontName) {
- const {
- numFonts,
- offsetTable
- } = readTrueTypeCollectionHeader(ttc);
+ var _readTrueTypeCollecti = readTrueTypeCollectionHeader(ttc),
+ numFonts = _readTrueTypeCollecti.numFonts,
+ offsetTable = _readTrueTypeCollecti.offsetTable;
- for (let i = 0; i < numFonts; i++) {
+ for (var i = 0; i < numFonts; i++) {
ttc.pos = (ttc.start || 0) + offsetTable[i];
- const potentialHeader = readOpenTypeHeader(ttc);
- const potentialTables = readTables(ttc, potentialHeader.numTables);
+ var potentialHeader = readOpenTypeHeader(ttc);
+ var potentialTables = readTables(ttc, potentialHeader.numTables);
if (!potentialTables.name) {
throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
}
- const nameTable = readNameTable(potentialTables.name);
+ var nameTable = readNameTable(potentialTables.name);
- for (let j = 0, jj = nameTable.length; j < jj; j++) {
- for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
- const nameEntry = nameTable[j][k];
+ for (var j = 0, jj = nameTable.length; j < jj; j++) {
+ for (var k = 0, kk = nameTable[j].length; k < kk; k++) {
+ var nameEntry = nameTable[j][k];
if (nameEntry && nameEntry.replace(/\s/g, "") === fontName) {
return {
@@ -25892,7 +37924,7 @@ var Font = function FontClosure() {
}
}
- throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
+ throw new _util.FormatError("TrueType Collection does not contain \"".concat(fontName, "\" font."));
}
function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
@@ -25941,9 +37973,9 @@ var Font = function FontClosure() {
if (useTable) {
potentialTable = {
- platformId,
- encodingId,
- offset
+ platformId: platformId,
+ encodingId: encodingId,
+ offset: offset
};
}
@@ -26047,7 +38079,7 @@ var Font = function FontClosure() {
glyphId = glyphId + delta & 0xffff;
mappings.push({
charCode: j,
- glyphId
+ glyphId: glyphId
});
}
}
@@ -26059,8 +38091,8 @@ var Font = function FontClosure() {
glyphId = file.getUint16();
var charCode = firstCode + j;
mappings.push({
- charCode,
- glyphId
+ charCode: charCode,
+ glyphId: glyphId
});
}
} else {
@@ -26087,8 +38119,8 @@ var Font = function FontClosure() {
return {
platformId: potentialTable.platformId,
encodingId: potentialTable.encodingId,
- mappings,
- hasShortCmap
+ mappings: mappings,
+ hasShortCmap: hasShortCmap
};
}
@@ -26185,7 +38217,7 @@ var Font = function FontClosure() {
glyf[j - 1] = flag & 0x3f;
}
- let xLength = 2;
+ var xLength = 2;
if (flag & 2) {
xLength = 1;
@@ -26193,7 +38225,7 @@ var Font = function FontClosure() {
xLength = 0;
}
- let yLength = 2;
+ var yLength = 2;
if (flag & 4) {
yLength = 1;
@@ -26201,7 +38233,7 @@ var Font = function FontClosure() {
yLength = 0;
}
- const xyLength = xLength + yLength;
+ var xyLength = xLength + yLength;
coordinatesLength += xyLength;
if (flag & 8) {
@@ -26376,8 +38408,8 @@ var Font = function FontClosure() {
}
return {
- missingGlyphs,
- maxSizeOfInstructions
+ missingGlyphs: missingGlyphs,
+ maxSizeOfInstructions: maxSizeOfInstructions
};
}
@@ -26610,7 +38642,7 @@ var Font = function FontClosure() {
ttContext.functionsUsed[funcId] = true;
if (funcId in ttContext.functionsStackDeltas) {
- const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
+ var newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
if (newStackLength < 0) {
(0, _util.warn)("TT: CALL invalid functions stack delta.");
@@ -26621,8 +38653,8 @@ var Font = function FontClosure() {
stack.length = newStackLength;
} else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
callstack.push({
- data,
- i,
+ data: data,
+ i: i,
stackTop: stack.length - 1
});
functionsCalled.push(funcId);
@@ -26649,8 +38681,8 @@ var Font = function FontClosure() {
lastDeff = i;
funcId = stack.pop();
ttContext.functionsDefined[funcId] = {
- data,
- i
+ data: data,
+ i: i
};
} else if (op === 0x2d) {
if (inFDEF) {
@@ -26699,7 +38731,7 @@ var Font = function FontClosure() {
}
if (!inFDEF && !inELSE) {
- let stackDelta = 0;
+ var stackDelta = 0;
if (op <= 0x8e) {
stackDelta = TTOpsStackDeltas[op];
@@ -26824,10 +38856,10 @@ var Font = function FontClosure() {
}
font = new _stream.Stream(new Uint8Array(font.getBytes()));
- let header, tables;
+ var header, tables;
if (isTrueTypeCollectionFile(font)) {
- const ttcData = readTrueTypeCollectionData(font, this.name);
+ var ttcData = readTrueTypeCollectionData(font, this.name);
header = ttcData.header;
tables = ttcData.tables;
} else {
@@ -26835,11 +38867,11 @@ var Font = function FontClosure() {
tables = readTables(font, header.numTables);
}
- let cff, cffFile;
+ var cff, cffFile;
var isTrueType = !tables["CFF "];
if (!isTrueType) {
- const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
+ var isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
cffFile = new _stream.Stream(tables["CFF "].data);
@@ -26876,9 +38908,9 @@ var Font = function FontClosure() {
font.pos = (font.start || 0) + tables.maxp.offset;
var version = font.getInt32();
- const numGlyphs = font.getUint16();
- let numGlyphsOut = numGlyphs + 1;
- let dupFirstEntry = true;
+ var numGlyphs = font.getUint16();
+ var numGlyphsOut = numGlyphs + 1;
+ var dupFirstEntry = true;
if (numGlyphsOut > 0xffff) {
dupFirstEntry = false;
@@ -26961,7 +38993,7 @@ var Font = function FontClosure() {
tag: "post",
data: createPostTable(properties)
};
- const charCodeToGlyphId = [];
+ var charCodeToGlyphId = [];
function hasGlyph(glyphId) {
return !missingGlyphs[glyphId];
@@ -27003,7 +39035,7 @@ var Font = function FontClosure() {
var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
- for (let charCode = 0; charCode < 256; charCode++) {
+ for (var charCode = 0; charCode < 256; charCode++) {
var glyphName, standardGlyphName;
if (this.differences && charCode in this.differences) {
@@ -27029,7 +39061,7 @@ var Font = function FontClosure() {
var found = false;
- for (let i = 0; i < cmapMappingsLength; ++i) {
+ for (var i = 0; i < cmapMappingsLength; ++i) {
if (cmapMappings[i].charCode !== unicodeOrCharCode) {
continue;
}
@@ -27052,18 +39084,18 @@ var Font = function FontClosure() {
}
}
} else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
- for (let i = 0; i < cmapMappingsLength; ++i) {
- charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
+ for (var _i2 = 0; _i2 < cmapMappingsLength; ++_i2) {
+ charCodeToGlyphId[cmapMappings[_i2].charCode] = cmapMappings[_i2].glyphId;
}
} else {
- for (let i = 0; i < cmapMappingsLength; ++i) {
- let charCode = cmapMappings[i].charCode;
+ for (var _i3 = 0; _i3 < cmapMappingsLength; ++_i3) {
+ var _charCode4 = cmapMappings[_i3].charCode;
- if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
- charCode &= 0xff;
+ if (cmapPlatformId === 3 && _charCode4 >= 0xf000 && _charCode4 <= 0xf0ff) {
+ _charCode4 &= 0xff;
}
- charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
+ charCodeToGlyphId[_charCode4] = cmapMappings[_i3].glyphId;
}
}
}
@@ -27072,7 +39104,7 @@ var Font = function FontClosure() {
charCodeToGlyphId[0] = 0;
}
- let glyphZeroId = numGlyphsOut - 1;
+ var glyphZeroId = numGlyphsOut - 1;
if (!dupFirstEntry) {
glyphZeroId = 0;
@@ -27130,7 +39162,7 @@ var Font = function FontClosure() {
adjustToUnicode(properties, properties.builtInEncoding);
}
- let glyphZeroId = 1;
+ var glyphZeroId = 1;
if (font instanceof CFFFont) {
glyphZeroId = font.numGlyphs - 1;
@@ -27197,15 +39229,15 @@ var Font = function FontClosure() {
continue;
}
- for (let i = 0, ii = charCodes.length; i < ii; i++) {
+ for (var i = 0, ii = charCodes.length; i < ii; i++) {
var charCode = charCodes[i];
var charCodeToGlyphId = newMapping.charCodeToGlyphId;
var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
seacMap[charCode] = {
- baseFontCharCode,
- accentFontCharCode,
- accentOffset
+ baseFontCharCode: baseFontCharCode,
+ accentFontCharCode: accentFontCharCode,
+ accentOffset: accentOffset
};
}
}
@@ -27225,14 +39257,14 @@ var Font = function FontClosure() {
var cffWidths = font.cff ? font.cff.widths : null;
var hmtx = "\x00\x00\x00\x00";
- for (let i = 1, ii = numGlyphs; i < ii; i++) {
+ for (var _i4 = 1, _ii = numGlyphs; _i4 < _ii; _i4++) {
var width = 0;
if (charstrings) {
- var charstring = charstrings[i - 1];
+ var charstring = charstrings[_i4 - 1];
width = "width" in charstring ? charstring.width : 0;
} else if (cffWidths) {
- width = Math.ceil(cffWidths[i] || 0);
+ width = Math.ceil(cffWidths[_i4] || 0);
}
hmtx += string16(width) + string16(0);
@@ -27296,7 +39328,7 @@ var Font = function FontClosure() {
width = this.widths[widthCode];
width = (0, _util.isNum)(width) ? width : this.defaultWidth;
var vmetric = this.vmetrics && this.vmetrics[widthCode];
- let unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode;
+ var unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode;
if (typeof unicode === "number") {
unicode = String.fromCharCode(unicode);
@@ -27306,7 +39338,7 @@ var Font = function FontClosure() {
fontCharCode = this.toFontChar[charcode] || charcode;
if (this.missingFile) {
- const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
+ var glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
fontCharCode = 0x20;
@@ -27331,13 +39363,13 @@ var Font = function FontClosure() {
};
}
- let fontChar = "";
+ var fontChar = "";
if (typeof fontCharCode === "number") {
if (fontCharCode <= 0x10ffff) {
fontChar = String.fromCodePoint(fontCharCode);
} else {
- (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
+ (0, _util.warn)("charToGlyph - invalid fontCharCode: ".concat(fontCharCode));
}
}
@@ -27415,13 +39447,12 @@ var ErrorFont = function ErrorFontClosure() {
charsToGlyphs: function ErrorFont_charsToGlyphs() {
return [];
},
-
- exportData(extraProperties = false) {
+ exportData: function exportData() {
+ var extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
return {
error: this.error
};
}
-
};
return ErrorFont;
}();
@@ -27525,7 +39556,7 @@ var Type1Font = function Type1FontClosure() {
}
return {
- found,
+ found: found,
length: i
};
}
@@ -27625,7 +39656,7 @@ var Type1Font = function Type1FontClosure() {
var eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
var data = eexecBlockParser.extractFontProgram(properties);
- for (const key in data.properties) {
+ for (var key in data.properties) {
properties[key] = data.properties[key];
}
@@ -27656,11 +39687,12 @@ var Type1Font = function Type1FontClosure() {
var charstrings = this.charstrings;
if (properties.composite) {
- const charCodeToGlyphId = Object.create(null);
+ var charCodeToGlyphId = Object.create(null);
+
+ for (var _glyphId = 0, charstringsLen = charstrings.length; _glyphId < charstringsLen; _glyphId++) {
+ var _charCode5 = properties.cMap.charCodeOf(_glyphId);
- for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
- const charCode = properties.cMap.charCodeOf(glyphId);
- charCodeToGlyphId[charCode] = glyphId + 1;
+ charCodeToGlyphId[_charCode5] = _glyphId + 1;
}
return charCodeToGlyphId;
@@ -27779,9 +39811,9 @@ var Type1Font = function Type1FontClosure() {
var i, ii;
for (i = 0; i < count; i++) {
- const glyphName = charstrings[i].glyphName;
+ var glyphName = charstrings[i].glyphName;
- const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
+ var index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
if (index === -1) {
strings.add(glyphName);
@@ -27870,7 +39902,7 @@ var CFFFont = function CFFFontClosure() {
if (properties.composite) {
charCodeToGlyphId = Object.create(null);
- let charCode;
+ var charCode;
if (cff.isCIDFont) {
for (glyphId = 0; glyphId < charsets.length; glyphId++) {
@@ -27900,7 +39932,7 @@ var CFFFont = function CFFFontClosure() {
}();
/***/ }),
-/* 30 */
+/* 223 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -27911,16 +39943,16 @@ Object.defineProperty(exports, "__esModule", {
});
exports.CFFFDSelect = exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFCharset = exports.CFFIndex = exports.CFFStrings = exports.CFFHeader = exports.CFF = exports.CFFParser = exports.CFFStandardStrings = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
-var _charsets = __w_pdfjs_require__(31);
+var _charsets = __w_pdfjs_require__(224);
-var _encodings = __w_pdfjs_require__(32);
+var _encodings = __w_pdfjs_require__(225);
var MAX_SUBR_NESTING = 10;
var CFFStandardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"];
exports.CFFStandardStrings = CFFStandardStrings;
-const NUM_STANDARD_CFF_STRINGS = 391;
+var NUM_STANDARD_CFF_STRINGS = 391;
var CFFParser = function CFFParserClosure() {
var CharstringValidationData = [null, {
@@ -28271,7 +40303,7 @@ var CFFParser = function CFFParserClosure() {
function parseFloatOperand() {
var str = "";
var eof = 15;
- const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
+ var lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
var length = dict.length;
while (pos < length) {
@@ -28546,15 +40578,13 @@ var CFFParser = function CFFParserClosure() {
state.stackSize = stackSize;
return true;
},
-
- parseCharStrings({
- charStrings,
- localSubrIndex,
- globalSubrIndex,
- fdSelect,
- fdArray,
- privateDict
- }) {
+ parseCharStrings: function parseCharStrings(_ref) {
+ var charStrings = _ref.charStrings,
+ localSubrIndex = _ref.localSubrIndex,
+ globalSubrIndex = _ref.globalSubrIndex,
+ fdSelect = _ref.fdSelect,
+ fdArray = _ref.fdArray,
+ privateDict = _ref.privateDict;
var seacs = [];
var widths = [];
var count = charStrings.count;
@@ -28602,10 +40632,10 @@ var CFFParser = function CFFParserClosure() {
}
if (state.width !== null) {
- const nominalWidth = privateDictToUse.getByName("nominalWidthX");
+ var nominalWidth = privateDictToUse.getByName("nominalWidthX");
widths[i] = nominalWidth + state.width;
} else {
- const defaultWidth = privateDictToUse.getByName("defaultWidthX");
+ var defaultWidth = privateDictToUse.getByName("defaultWidthX");
widths[i] = defaultWidth;
}
@@ -28619,12 +40649,11 @@ var CFFParser = function CFFParserClosure() {
}
return {
- charStrings,
- seacs,
- widths
+ charStrings: charStrings,
+ seacs: seacs,
+ widths: widths
};
},
-
emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
parentDict.setByKey(18, [0, 0]);
@@ -28684,7 +40713,7 @@ var CFFParser = function CFFParserClosure() {
var bytes = this.bytes;
var start = pos;
var format = bytes[pos++];
- const charset = [cid ? 0 : ".notdef"];
+ var charset = [cid ? 0 : ".notdef"];
var id, count, i;
length -= 1;
@@ -28788,7 +40817,7 @@ var CFFParser = function CFFParserClosure() {
break;
default:
- throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
+ throw new _util.FormatError("Unknown encoding format: ".concat(format, " in CFF"));
}
var dataEnd = pos;
@@ -28842,7 +40871,7 @@ var CFFParser = function CFFParserClosure() {
break;
default:
- throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
+ throw new _util.FormatError("parseFDSelect: Unknown format \"".concat(format, "\"."));
}
if (fdSelect.length !== length) {
@@ -28931,7 +40960,7 @@ var CFFStrings = function CFFStringsClosure() {
return CFFStandardStrings[0];
},
getSID: function CFFStrings_getSID(str) {
- let index = CFFStandardStrings.indexOf(str);
+ var index = CFFStandardStrings.indexOf(str);
if (index !== -1) {
return index;
@@ -29030,7 +41059,7 @@ var CFFDict = function CFFDictClosure() {
},
setByName: function CFFDict_setByName(name, value) {
if (!(name in this.nameToKeyMap)) {
- throw new _util.FormatError(`Invalid dictionary name "${name}"`);
+ throw new _util.FormatError("Invalid dictionary name \"".concat(name, "\""));
}
this.values[this.nameToKeyMap[name]] = value;
@@ -29040,7 +41069,7 @@ var CFFDict = function CFFDictClosure() {
},
getByName: function CFFDict_getByName(name) {
if (!(name in this.nameToKeyMap)) {
- throw new _util.FormatError(`Invalid dictionary name ${name}"`);
+ throw new _util.FormatError("Invalid dictionary name ".concat(name, "\""));
}
var key = this.nameToKeyMap[name];
@@ -29181,7 +41210,7 @@ var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
},
track: function CFFOffsetTracker_track(key, location) {
if (key in this.offsets) {
- throw new _util.FormatError(`Already tracking location of ${key}`);
+ throw new _util.FormatError("Already tracking location of ".concat(key));
}
this.offsets[key] = location;
@@ -29193,7 +41222,7 @@ var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
},
setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
if (!(key in this.offsets)) {
- throw new _util.FormatError(`Not tracking location of ${key}`);
+ throw new _util.FormatError("Not tracking location of ".concat(key));
}
var data = output.data;
@@ -29376,13 +41405,13 @@ var CFFCompiler = function CFFCompilerClosure() {
var sanitizedName = new Array(length);
for (var j = 0; j < length; j++) {
- var char = name[j];
+ var _char = name[j];
- if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
- char = "_";
+ if (_char < "!" || _char > "~" || _char === "[" || _char === "]" || _char === "(" || _char === ")" || _char === "{" || _char === "}" || _char === "<" || _char === ">" || _char === "/" || _char === "%") {
+ _char = "_";
}
- sanitizedName[j] = char;
+ sanitizedName[j] = _char;
}
sanitizedName = sanitizedName.join("");
@@ -29509,7 +41538,7 @@ var CFFCompiler = function CFFCompilerClosure() {
break;
default:
- throw new _util.FormatError(`Unknown data type of ${type}`);
+ throw new _util.FormatError("Unknown data type of ".concat(type));
}
}
@@ -29548,24 +41577,24 @@ var CFFCompiler = function CFFCompilerClosure() {
return this.compileIndex(charStringsIndex);
},
compileCharset: function CFFCompiler_compileCharset(charset, numGlyphs, strings, isCIDFont) {
- let out;
- const numGlyphsLessNotDef = numGlyphs - 1;
+ var out;
+ var numGlyphsLessNotDef = numGlyphs - 1;
if (isCIDFont) {
out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
} else {
- const length = 1 + numGlyphsLessNotDef * 2;
+ var length = 1 + numGlyphsLessNotDef * 2;
out = new Uint8Array(length);
out[0] = 0;
- let charsetIndex = 0;
- const numCharsets = charset.charset.length;
- let warned = false;
+ var charsetIndex = 0;
+ var numCharsets = charset.charset.length;
+ var warned = false;
- for (let i = 1; i < out.length; i += 2) {
- let sid = 0;
+ for (var i = 1; i < out.length; i += 2) {
+ var sid = 0;
if (charsetIndex < numCharsets) {
- const name = charset.charset[charsetIndex++];
+ var name = charset.charset[charsetIndex++];
sid = strings.getSID(name);
if (sid === -1) {
@@ -29573,7 +41602,7 @@ var CFFCompiler = function CFFCompilerClosure() {
if (!warned) {
warned = true;
- (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
+ (0, _util.warn)("Couldn't find ".concat(name, " in CFF strings"));
}
}
}
@@ -29589,8 +41618,8 @@ var CFFCompiler = function CFFCompilerClosure() {
return this.compileTypedArray(encoding.raw);
},
compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
- const format = fdSelect.format;
- let out, i;
+ var format = fdSelect.format;
+ var out, i;
switch (format) {
case 0:
@@ -29604,12 +41633,12 @@ var CFFCompiler = function CFFCompilerClosure() {
break;
case 3:
- const start = 0;
- let lastFD = fdSelect.fdSelect[0];
- const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
+ var start = 0;
+ var lastFD = fdSelect.fdSelect[0];
+ var ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
for (i = 1; i < fdSelect.fdSelect.length; i++) {
- const currentFD = fdSelect.fdSelect[i];
+ var currentFD = fdSelect.fdSelect[i];
if (currentFD !== lastFD) {
ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
@@ -29617,7 +41646,7 @@ var CFFCompiler = function CFFCompilerClosure() {
}
}
- const numRanges = (ranges.length - 3) / 3;
+ var numRanges = (ranges.length - 3) / 3;
ranges[1] = numRanges >> 8 & 0xff;
ranges[2] = numRanges & 0xff;
ranges.push(i >> 8 & 0xff, i & 0xff);
@@ -29703,7 +41732,7 @@ var CFFCompiler = function CFFCompilerClosure() {
exports.CFFCompiler = CFFCompiler;
/***/ }),
-/* 31 */
+/* 224 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -29713,15 +41742,15 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ExpertSubsetCharset = exports.ExpertCharset = exports.ISOAdobeCharset = void 0;
-const ISOAdobeCharset = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron"];
+var ISOAdobeCharset = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron"];
exports.ISOAdobeCharset = ISOAdobeCharset;
-const ExpertCharset = [".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
+var ExpertCharset = [".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
exports.ExpertCharset = ExpertCharset;
-const ExpertSubsetCharset = [".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior"];
+var ExpertSubsetCharset = [".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior"];
exports.ExpertSubsetCharset = ExpertSubsetCharset;
/***/ }),
-/* 32 */
+/* 225 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -29732,18 +41761,18 @@ Object.defineProperty(exports, "__esModule", {
});
exports.getEncoding = getEncoding;
exports.ExpertEncoding = exports.ZapfDingbatsEncoding = exports.SymbolSetEncoding = exports.MacRomanEncoding = exports.StandardEncoding = exports.WinAnsiEncoding = void 0;
-const ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", "osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", "hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
+var ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", "osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", "hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
exports.ExpertEncoding = ExpertEncoding;
-const MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", "questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", "Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", "seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", "osuperior", "fiveinferior", "", "commainferior", "periodinferior", "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", "", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", "exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", "tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", "", "", "", ""];
-const MacRomanEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron"];
+var MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", "questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", "Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", "seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", "osuperior", "fiveinferior", "", "commainferior", "periodinferior", "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", "", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", "exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", "tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", "", "", "", ""];
+var MacRomanEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron"];
exports.MacRomanEncoding = MacRomanEncoding;
-const StandardEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "", "endash", "dagger", "daggerdbl", "periodcentered", "", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "", "questiondown", "", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "", "ring", "cedilla", "", "hungarumlaut", "ogonek", "caron", "emdash", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "AE", "", "ordfeminine", "", "", "", "", "Lslash", "Oslash", "OE", "ordmasculine", "", "", "", "", "", "ae", "", "", "", "dotlessi", "", "", "lslash", "oslash", "oe", "germandbls", "", "", "", ""];
+var StandardEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "", "endash", "dagger", "daggerdbl", "periodcentered", "", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "", "questiondown", "", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "", "ring", "cedilla", "", "hungarumlaut", "ogonek", "caron", "emdash", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "AE", "", "ordfeminine", "", "", "", "", "Lslash", "Oslash", "OE", "ordmasculine", "", "", "", "", "", "ae", "", "", "", "dotlessi", "", "", "lslash", "oslash", "oe", "germandbls", "", "", "", ""];
exports.StandardEncoding = StandardEncoding;
-const WinAnsiEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "bullet", "Euro", "bullet", "quotesinglbase", "florin", "quotedblbase", "ellipsis", "dagger", "daggerdbl", "circumflex", "perthousand", "Scaron", "guilsinglleft", "OE", "bullet", "Zcaron", "bullet", "bullet", "quoteleft", "quoteright", "quotedblleft", "quotedblright", "bullet", "endash", "emdash", "tilde", "trademark", "scaron", "guilsinglright", "oe", "bullet", "zcaron", "Ydieresis", "space", "exclamdown", "cent", "sterling", "currency", "yen", "brokenbar", "section", "dieresis", "copyright", "ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered", "macron", "degree", "plusminus", "twosuperior", "threesuperior", "acute", "mu", "paragraph", "periodcentered", "cedilla", "onesuperior", "ordmasculine", "guillemotright", "onequarter", "onehalf", "threequarters", "questiondown", "Agrave", "Aacute", "Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla", "Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute", "Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute", "Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash", "Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn", "germandbls", "agrave", "aacute", "acircumflex", "atilde", "adieresis", "aring", "ae", "ccedilla", "egrave", "eacute", "ecircumflex", "edieresis", "igrave", "iacute", "icircumflex", "idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"];
+var WinAnsiEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "bullet", "Euro", "bullet", "quotesinglbase", "florin", "quotedblbase", "ellipsis", "dagger", "daggerdbl", "circumflex", "perthousand", "Scaron", "guilsinglleft", "OE", "bullet", "Zcaron", "bullet", "bullet", "quoteleft", "quoteright", "quotedblleft", "quotedblright", "bullet", "endash", "emdash", "tilde", "trademark", "scaron", "guilsinglright", "oe", "bullet", "zcaron", "Ydieresis", "space", "exclamdown", "cent", "sterling", "currency", "yen", "brokenbar", "section", "dieresis", "copyright", "ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered", "macron", "degree", "plusminus", "twosuperior", "threesuperior", "acute", "mu", "paragraph", "periodcentered", "cedilla", "onesuperior", "ordmasculine", "guillemotright", "onequarter", "onehalf", "threequarters", "questiondown", "Agrave", "Aacute", "Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla", "Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute", "Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute", "Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash", "Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn", "germandbls", "agrave", "aacute", "acircumflex", "atilde", "adieresis", "aring", "ae", "ccedilla", "egrave", "eacute", "ecircumflex", "edieresis", "igrave", "iacute", "icircumflex", "idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"];
exports.WinAnsiEncoding = WinAnsiEncoding;
-const SymbolSetEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "congruent", "Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi", "Gamma", "Eta", "Iota", "theta1", "Kappa", "Lambda", "Mu", "Nu", "Omicron", "Pi", "Theta", "Rho", "Sigma", "Tau", "Upsilon", "sigma1", "Omega", "Xi", "Psi", "Zeta", "bracketleft", "therefore", "bracketright", "perpendicular", "underscore", "radicalex", "alpha", "beta", "chi", "delta", "epsilon", "phi", "gamma", "eta", "iota", "phi1", "kappa", "lambda", "mu", "nu", "omicron", "pi", "theta", "rho", "sigma", "tau", "upsilon", "omega1", "omega", "xi", "psi", "zeta", "braceleft", "bar", "braceright", "similar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Euro", "Upsilon1", "minute", "lessequal", "fraction", "infinity", "florin", "club", "diamond", "heart", "spade", "arrowboth", "arrowleft", "arrowup", "arrowright", "arrowdown", "degree", "plusminus", "second", "greaterequal", "multiply", "proportional", "partialdiff", "bullet", "divide", "notequal", "equivalence", "approxequal", "ellipsis", "arrowvertex", "arrowhorizex", "carriagereturn", "aleph", "Ifraktur", "Rfraktur", "weierstrass", "circlemultiply", "circleplus", "emptyset", "intersection", "union", "propersuperset", "reflexsuperset", "notsubset", "propersubset", "reflexsubset", "element", "notelement", "angle", "gradient", "registerserif", "copyrightserif", "trademarkserif", "product", "radical", "dotmath", "logicalnot", "logicaland", "logicalor", "arrowdblboth", "arrowdblleft", "arrowdblup", "arrowdblright", "arrowdbldown", "lozenge", "angleleft", "registersans", "copyrightsans", "trademarksans", "summation", "parenlefttp", "parenleftex", "parenleftbt", "bracketlefttp", "bracketleftex", "bracketleftbt", "bracelefttp", "braceleftmid", "braceleftbt", "braceex", "", "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", ""];
+var SymbolSetEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "congruent", "Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi", "Gamma", "Eta", "Iota", "theta1", "Kappa", "Lambda", "Mu", "Nu", "Omicron", "Pi", "Theta", "Rho", "Sigma", "Tau", "Upsilon", "sigma1", "Omega", "Xi", "Psi", "Zeta", "bracketleft", "therefore", "bracketright", "perpendicular", "underscore", "radicalex", "alpha", "beta", "chi", "delta", "epsilon", "phi", "gamma", "eta", "iota", "phi1", "kappa", "lambda", "mu", "nu", "omicron", "pi", "theta", "rho", "sigma", "tau", "upsilon", "omega1", "omega", "xi", "psi", "zeta", "braceleft", "bar", "braceright", "similar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Euro", "Upsilon1", "minute", "lessequal", "fraction", "infinity", "florin", "club", "diamond", "heart", "spade", "arrowboth", "arrowleft", "arrowup", "arrowright", "arrowdown", "degree", "plusminus", "second", "greaterequal", "multiply", "proportional", "partialdiff", "bullet", "divide", "notequal", "equivalence", "approxequal", "ellipsis", "arrowvertex", "arrowhorizex", "carriagereturn", "aleph", "Ifraktur", "Rfraktur", "weierstrass", "circlemultiply", "circleplus", "emptyset", "intersection", "union", "propersuperset", "reflexsuperset", "notsubset", "propersubset", "reflexsubset", "element", "notelement", "angle", "gradient", "registerserif", "copyrightserif", "trademarkserif", "product", "radical", "dotmath", "logicalnot", "logicaland", "logicalor", "arrowdblboth", "arrowdblleft", "arrowdblup", "arrowdblright", "arrowdbldown", "lozenge", "angleleft", "registersans", "copyrightsans", "trademarksans", "summation", "parenlefttp", "parenleftex", "parenleftbt", "bracketlefttp", "bracketleftex", "bracketleftbt", "bracelefttp", "braceleftmid", "braceleftbt", "braceex", "", "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", ""];
exports.SymbolSetEncoding = SymbolSetEncoding;
-const ZapfDingbatsEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", "a84", "a97", "a98", "a99", "a100", "", "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", "a95", "a96", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a101", "a102", "a103", "a104", "a106", "a107", "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", "", "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", ""];
+var ZapfDingbatsEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", "a84", "a97", "a98", "a99", "a100", "", "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", "a95", "a96", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a101", "a102", "a103", "a104", "a106", "a107", "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", "", "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", ""];
exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
function getEncoding(encodingName) {
@@ -29775,10 +41804,10 @@ function getEncoding(encodingName) {
}
/***/ }),
-/* 33 */
+/* 226 */
/***/ (function(module, exports, __w_pdfjs_require__) {
-var getLookupTableFactory = __w_pdfjs_require__(8).getLookupTableFactory;
+var getLookupTableFactory = __w_pdfjs_require__(201).getLookupTableFactory;
var getGlyphsUnicode = getLookupTableFactory(function (t) {
t.A = 0x0041;
t.AE = 0x00c6;
@@ -34312,7 +46341,7 @@ exports.getGlyphsUnicode = getGlyphsUnicode;
exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
/***/ }),
-/* 34 */
+/* 227 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -34323,9 +46352,9 @@ Object.defineProperty(exports, "__esModule", {
});
exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = void 0;
-var _core_utils = __w_pdfjs_require__(8);
+var _core_utils = __w_pdfjs_require__(201);
-const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
+var getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
t.ArialNarrow = "Helvetica";
t["ArialNarrow-Bold"] = "Helvetica-Bold";
t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
@@ -34383,7 +46412,7 @@ const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
});
exports.getStdFontMap = getStdFontMap;
-const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
+var getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
t.Calibri = "Helvetica";
t["Calibri-Bold"] = "Helvetica-Bold";
t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
@@ -34423,7 +46452,7 @@ const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
t["Wingdings-Regular"] = "ZapfDingbats";
});
exports.getNonStdFontMap = getNonStdFontMap;
-const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
+var getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
t["Adobe Jenson"] = true;
t["Adobe Text"] = true;
t.Albertus = true;
@@ -34559,13 +46588,13 @@ const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
t.XITS = true;
});
exports.getSerifFonts = getSerifFonts;
-const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
+var getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
t.Dingbats = true;
t.Symbol = true;
t.ZapfDingbats = true;
});
exports.getSymbolsFonts = getSymbolsFonts;
-const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
+var getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
t[2] = 10;
t[3] = 32;
t[4] = 33;
@@ -34961,13 +46990,13 @@ const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(funct
t[3416] = 8377;
});
exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
-const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
+var getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
t[227] = 322;
t[264] = 261;
t[291] = 346;
});
exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
-const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
+var getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
t[1] = 32;
t[4] = 65;
t[17] = 66;
@@ -35056,10 +47085,10 @@ const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)
exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
/***/ }),
-/* 35 */
+/* 228 */
/***/ (function(module, exports, __w_pdfjs_require__) {
-var getLookupTableFactory = __w_pdfjs_require__(8).getLookupTableFactory;
+var getLookupTableFactory = __w_pdfjs_require__(201).getLookupTableFactory;
var getSpecialPUASymbols = getLookupTableFactory(function (t) {
t[63721] = 0x00a9;
t[63193] = 0x00a9;
@@ -37033,7 +49062,7 @@ exports.getNormalizedUnicodes = getNormalizedUnicodes;
exports.getUnicodeForGlyph = getUnicodeForGlyph;
/***/ }),
-/* 36 */
+/* 229 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -37044,15 +49073,37 @@ Object.defineProperty(exports, "__esModule", {
});
exports.FontRendererFactory = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
-var _cff_parser = __w_pdfjs_require__(30);
+var _cff_parser = __w_pdfjs_require__(223);
-var _glyphlist = __w_pdfjs_require__(33);
+var _glyphlist = __w_pdfjs_require__(226);
-var _encodings = __w_pdfjs_require__(32);
+var _encodings = __w_pdfjs_require__(225);
-var _stream = __w_pdfjs_require__(12);
+var _stream = __w_pdfjs_require__(205);
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var FontRendererFactory = function FontRendererFactoryClosure() {
function getLong(data, offset) {
@@ -37064,8 +49115,8 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
}
function getSubroutineBias(subrs) {
- const numSubrs = subrs.length;
- let bias = 32768;
+ var numSubrs = subrs.length;
+ var bias = 32768;
if (numSubrs < 1240) {
bias = 107;
@@ -37137,7 +49188,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
return ranges;
}
- throw new _util.FormatError(`unsupported cmap: ${format}`);
+ throw new _util.FormatError("unsupported cmap: ".concat(format));
}
function parseCff(data, start, end, seacAnalysisEnabled) {
@@ -37322,7 +49373,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
while (repeat-- > 0) {
points.push({
- flags
+ flags: flags
});
}
}
@@ -37512,11 +49563,11 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
subrCode = null;
if (font.isCFFCIDFont) {
- const fdIndex = font.fdSelect.getFDIndex(glyphId);
+ var fdIndex = font.fdSelect.getFDIndex(glyphId);
if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
- const fontDict = font.fdArray[fdIndex];
- let subrs;
+ var fontDict = font.fdArray[fdIndex];
+ var subrs = void 0;
if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
subrs = fontDict.privateDict.subrsIndex.objects;
@@ -37617,7 +49668,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
break;
default:
- throw new _util.FormatError(`unknown operator: 12 ${v}`);
+ throw new _util.FormatError("unknown operator: 12 ".concat(v));
}
break;
@@ -37814,7 +49865,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
default:
if (v < 32) {
- throw new _util.FormatError(`unknown operator: ${v}`);
+ throw new _util.FormatError("unknown operator: ".concat(v));
}
if (v < 247) {
@@ -37840,10 +49891,12 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
parse(charStringCode);
}
- const NOOP = [];
+ var NOOP = [];
+
+ var CompiledFont = /*#__PURE__*/function () {
+ function CompiledFont(fontMatrix) {
+ _classCallCheck(this, CompiledFont);
- class CompiledFont {
- constructor(fontMatrix) {
if (this.constructor === CompiledFont) {
(0, _util.unreachable)("Cannot initialize CompiledFont.");
}
@@ -37853,103 +49906,136 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
this.compiledCharCodeToGlyphId = Object.create(null);
}
- getPathJs(unicode) {
- const cmap = lookupCmap(this.cmap, unicode);
- let fn = this.compiledGlyphs[cmap.glyphId];
-
- if (!fn) {
- fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
- this.compiledGlyphs[cmap.glyphId] = fn;
- }
+ _createClass(CompiledFont, [{
+ key: "getPathJs",
+ value: function getPathJs(unicode) {
+ var cmap = lookupCmap(this.cmap, unicode);
+ var fn = this.compiledGlyphs[cmap.glyphId];
- if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
- this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
- }
+ if (!fn) {
+ fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
+ this.compiledGlyphs[cmap.glyphId] = fn;
+ }
- return fn;
- }
+ if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
+ this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
+ }
- compileGlyph(code, glyphId) {
- if (!code || code.length === 0 || code[0] === 14) {
- return NOOP;
+ return fn;
}
+ }, {
+ key: "compileGlyph",
+ value: function compileGlyph(code, glyphId) {
+ if (!code || code.length === 0 || code[0] === 14) {
+ return NOOP;
+ }
- let fontMatrix = this.fontMatrix;
+ var fontMatrix = this.fontMatrix;
- if (this.isCFFCIDFont) {
- const fdIndex = this.fdSelect.getFDIndex(glyphId);
+ if (this.isCFFCIDFont) {
+ var fdIndex = this.fdSelect.getFDIndex(glyphId);
- if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
- const fontDict = this.fdArray[fdIndex];
- fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
- } else {
- (0, _util.warn)("Invalid fd index for glyph index.");
+ if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
+ var fontDict = this.fdArray[fdIndex];
+ fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
+ } else {
+ (0, _util.warn)("Invalid fd index for glyph index.");
+ }
}
+
+ var cmds = [];
+ cmds.push({
+ cmd: "save"
+ });
+ cmds.push({
+ cmd: "transform",
+ args: fontMatrix.slice()
+ });
+ cmds.push({
+ cmd: "scale",
+ args: ["size", "-size"]
+ });
+ this.compileGlyphImpl(code, cmds, glyphId);
+ cmds.push({
+ cmd: "restore"
+ });
+ return cmds;
+ }
+ }, {
+ key: "compileGlyphImpl",
+ value: function compileGlyphImpl() {
+ (0, _util.unreachable)("Children classes should implement this.");
}
+ }, {
+ key: "hasBuiltPath",
+ value: function hasBuiltPath(unicode) {
+ var cmap = lookupCmap(this.cmap, unicode);
+ return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
+ }
+ }]);
- const cmds = [];
- cmds.push({
- cmd: "save"
- });
- cmds.push({
- cmd: "transform",
- args: fontMatrix.slice()
- });
- cmds.push({
- cmd: "scale",
- args: ["size", "-size"]
- });
- this.compileGlyphImpl(code, cmds, glyphId);
- cmds.push({
- cmd: "restore"
- });
- return cmds;
- }
+ return CompiledFont;
+ }();
- compileGlyphImpl() {
- (0, _util.unreachable)("Children classes should implement this.");
- }
+ var TrueTypeCompiled = /*#__PURE__*/function (_CompiledFont) {
+ _inherits(TrueTypeCompiled, _CompiledFont);
- hasBuiltPath(unicode) {
- const cmap = lookupCmap(this.cmap, unicode);
- return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
- }
+ var _super = _createSuper(TrueTypeCompiled);
- }
+ function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
+ var _this;
- class TrueTypeCompiled extends CompiledFont {
- constructor(glyphs, cmap, fontMatrix) {
- super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
- this.glyphs = glyphs;
- this.cmap = cmap;
- }
+ _classCallCheck(this, TrueTypeCompiled);
- compileGlyphImpl(code, cmds) {
- compileGlyf(code, cmds, this);
+ _this = _super.call(this, fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
+ _this.glyphs = glyphs;
+ _this.cmap = cmap;
+ return _this;
}
- }
+ _createClass(TrueTypeCompiled, [{
+ key: "compileGlyphImpl",
+ value: function compileGlyphImpl(code, cmds) {
+ compileGlyf(code, cmds, this);
+ }
+ }]);
- class Type2Compiled extends CompiledFont {
- constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
- super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
- this.glyphs = cffInfo.glyphs;
- this.gsubrs = cffInfo.gsubrs || [];
- this.subrs = cffInfo.subrs || [];
- this.cmap = cmap;
- this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
- this.gsubrsBias = getSubroutineBias(this.gsubrs);
- this.subrsBias = getSubroutineBias(this.subrs);
- this.isCFFCIDFont = cffInfo.isCFFCIDFont;
- this.fdSelect = cffInfo.fdSelect;
- this.fdArray = cffInfo.fdArray;
- }
+ return TrueTypeCompiled;
+ }(CompiledFont);
+
+ var Type2Compiled = /*#__PURE__*/function (_CompiledFont2) {
+ _inherits(Type2Compiled, _CompiledFont2);
+
+ var _super2 = _createSuper(Type2Compiled);
- compileGlyphImpl(code, cmds, glyphId) {
- compileCharString(code, cmds, this, glyphId);
+ function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
+ var _this2;
+
+ _classCallCheck(this, Type2Compiled);
+
+ _this2 = _super2.call(this, fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
+ _this2.glyphs = cffInfo.glyphs;
+ _this2.gsubrs = cffInfo.gsubrs || [];
+ _this2.subrs = cffInfo.subrs || [];
+ _this2.cmap = cmap;
+ _this2.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
+ _this2.gsubrsBias = getSubroutineBias(_this2.gsubrs);
+ _this2.subrsBias = getSubroutineBias(_this2.subrs);
+ _this2.isCFFCIDFont = cffInfo.isCFFCIDFont;
+ _this2.fdSelect = cffInfo.fdSelect;
+ _this2.fdArray = cffInfo.fdArray;
+ return _this2;
}
- }
+ _createClass(Type2Compiled, [{
+ key: "compileGlyphImpl",
+ value: function compileGlyphImpl(code, cmds, glyphId) {
+ compileCharString(code, cmds, this, glyphId);
+ }
+ }]);
+
+ return Type2Compiled;
+ }(CompiledFont);
return {
create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
@@ -37999,7 +50085,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
exports.FontRendererFactory = FontRendererFactory;
/***/ }),
-/* 37 */
+/* 230 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -38010,13 +50096,13 @@ Object.defineProperty(exports, "__esModule", {
});
exports.Type1Parser = void 0;
-var _encodings = __w_pdfjs_require__(32);
+var _encodings = __w_pdfjs_require__(225);
-var _core_utils = __w_pdfjs_require__(8);
+var _core_utils = __w_pdfjs_require__(201);
-var _stream = __w_pdfjs_require__(12);
+var _stream = __w_pdfjs_require__(205);
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
var HINTING_ENABLED = false;
@@ -38289,8 +50375,7 @@ var Type1CharString = function Type1CharStringClosure() {
return error;
},
-
- executeCommand(howManyArgs, command, keepStack) {
+ executeCommand: function executeCommand(howManyArgs, command, keepStack) {
var stackLength = this.stack.length;
if (howManyArgs > stackLength) {
@@ -38320,7 +50405,6 @@ var Type1CharString = function Type1CharStringClosure() {
return false;
}
-
};
return Type1CharString;
}();
@@ -38494,7 +50578,7 @@ var Type1Parser = function Type1ParserClosure() {
subrs: [],
charstrings: [],
properties: {
- privateData
+ privateData: privateData
}
};
var token, length, data, lenIV, encoded;
@@ -38538,8 +50622,8 @@ var Type1Parser = function Type1ParserClosure() {
}
charstrings.push({
- glyph,
- encoded
+ glyph: glyph,
+ encoded: encoded
});
}
@@ -38550,7 +50634,7 @@ var Type1Parser = function Type1ParserClosure() {
this.getToken();
while (this.getToken() === "dup") {
- const index = this.readInt();
+ var index = this.readInt();
length = this.readInt();
this.getToken();
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
@@ -38616,7 +50700,7 @@ var Type1Parser = function Type1ParserClosure() {
output = [14];
}
- const charStringObject = {
+ var charStringObject = {
glyphName: glyph,
charstring: output,
width: charString.width,
@@ -38631,10 +50715,10 @@ var Type1Parser = function Type1ParserClosure() {
}
if (properties.builtInEncoding) {
- const index = properties.builtInEncoding.indexOf(glyph);
+ var _index = properties.builtInEncoding.indexOf(glyph);
- if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
- properties.widths[index] = charString.width;
+ if (_index > -1 && properties.widths[_index] === undefined && _index >= properties.firstChar && _index <= properties.lastChar) {
+ properties.widths[_index] = charString.width;
}
}
}
@@ -38710,7 +50794,7 @@ var Type1Parser = function Type1ParserClosure() {
exports.Type1Parser = Type1Parser;
/***/ }),
-/* 38 */
+/* 231 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -38722,13 +50806,13 @@ Object.defineProperty(exports, "__esModule", {
exports.getTilingPatternIR = getTilingPatternIR;
exports.Pattern = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
-var _colorspace = __w_pdfjs_require__(23);
+var _colorspace = __w_pdfjs_require__(216);
-var _primitives = __w_pdfjs_require__(5);
+var _primitives = __w_pdfjs_require__(198);
-var _core_utils = __w_pdfjs_require__(8);
+var _core_utils = __w_pdfjs_require__(201);
var ShadingType = {
FUNCTION_BASED: 1,
@@ -38747,7 +50831,7 @@ var Pattern = function PatternClosure() {
Pattern.prototype = {
getPattern: function Pattern_getPattern(ctx) {
- (0, _util.unreachable)(`Should not call Pattern.getStyle: ${ctx}`);
+ (0, _util.unreachable)("Should not call Pattern.getStyle: ".concat(ctx));
}
};
@@ -38799,7 +50883,7 @@ Shadings.RadialAxial = function RadialAxialClosure() {
var cs = dict.get("ColorSpace", "CS");
cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
this.cs = cs;
- const bbox = dict.getArray("BBox");
+ var bbox = dict.getArray("BBox");
if (Array.isArray(bbox) && bbox.length === 4) {
this.bbox = _util.Util.normalizeRect(bbox);
@@ -38843,8 +50927,8 @@ Shadings.RadialAxial = function RadialAxialClosure() {
this.extendEnd = extendEnd;
var fnObj = dict.get("Function");
var fn = pdfFunctionFactory.createFromArray(fnObj);
- const NUMBER_OF_SAMPLES = 10;
- const step = (t1 - t0) / NUMBER_OF_SAMPLES;
+ var NUMBER_OF_SAMPLES = 10;
+ var step = (t1 - t0) / NUMBER_OF_SAMPLES;
var colorStops = this.colorStops = [];
if (t0 >= t1 || step <= 0) {
@@ -38856,7 +50940,7 @@ Shadings.RadialAxial = function RadialAxialClosure() {
ratio = new Float32Array(1);
var rgbColor;
- for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
+ for (var i = 0; i <= NUMBER_OF_SAMPLES; i++) {
ratio[0] = t0 + i * step;
fn(ratio, 0, color, 0);
rgbColor = cs.getRgb(color, 0);
@@ -38905,7 +50989,7 @@ Shadings.RadialAxial = function RadialAxialClosure() {
r1 = coordsArr[5];
type = "radial";
} else {
- (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
+ (0, _util.unreachable)("getPattern type unknown: ".concat(shadingType));
}
var matrix = this.matrix;
@@ -39094,7 +51178,7 @@ Shadings.Mesh = function MeshClosure() {
type: "lattice",
coords: new Int32Array(ps),
colors: new Int32Array(ps),
- verticesPerRow
+ verticesPerRow: verticesPerRow
});
}
@@ -39201,7 +51285,7 @@ Shadings.Mesh = function MeshClosure() {
type: "lattice",
coords: figureCoords,
colors: figureColors,
- verticesPerRow
+ verticesPerRow: verticesPerRow
};
}
@@ -39539,7 +51623,7 @@ Shadings.Mesh = function MeshClosure() {
this.matrix = matrix;
this.shadingType = dict.get("ShadingType");
this.type = "Pattern";
- const bbox = dict.getArray("BBox");
+ var bbox = dict.getArray("BBox");
if (Array.isArray(bbox) && bbox.length === 4) {
this.bbox = _util.Util.normalizeRect(bbox);
@@ -39632,24 +51716,24 @@ Shadings.Dummy = function DummyClosure() {
}();
function getTilingPatternIR(operatorList, dict, args) {
- const matrix = dict.getArray("Matrix");
+ var matrix = dict.getArray("Matrix");
- const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
+ var bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
- const xstep = dict.get("XStep");
- const ystep = dict.get("YStep");
- const paintType = dict.get("PaintType");
- const tilingType = dict.get("TilingType");
+ var xstep = dict.get("XStep");
+ var ystep = dict.get("YStep");
+ var paintType = dict.get("PaintType");
+ var tilingType = dict.get("TilingType");
if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
- throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
+ throw new _util.FormatError("Invalid getTilingPatternIR /BBox array: [".concat(bbox, "]."));
}
return ["TilingPattern", args, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
}
/***/ }),
-/* 39 */
+/* 232 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -39660,7 +51744,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.bidi = bidi;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
var baseTypes = ["BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "S", "B", "S", "WS", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "B", "B", "B", "S", "WS", "ON", "ON", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "ON", "ES", "CS", "ES", "CS", "CS", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "CS", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "BN", "BN", "BN", "BN", "BN", "BN", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "CS", "ON", "ET", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "L", "ON", "ON", "BN", "ON", "ON", "ET", "ET", "EN", "EN", "ON", "L", "ON", "ON", "ON", "EN", "L", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L"];
var arabicTypes = ["AN", "AN", "AN", "AN", "AN", "AN", "ON", "ON", "AL", "ET", "ET", "AL", "CS", "AL", "ON", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "ET", "AN", "AN", "AL", "AL", "AL", "NSM", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "NSM", "NSM", "ON", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "AL", "AL", "AL", "AL", "AL", "AL"];
@@ -39697,8 +51781,9 @@ function reverseValues(arr, start, end) {
}
}
-function createBidiText(str, isLTR, vertical = false) {
- let dir = "ltr";
+function createBidiText(str, isLTR) {
+ var vertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+ var dir = "ltr";
if (vertical) {
dir = "ttb";
@@ -39707,8 +51792,8 @@ function createBidiText(str, isLTR, vertical = false) {
}
return {
- str,
- dir
+ str: str,
+ dir: dir
};
}
@@ -39961,7 +52046,7 @@ function bidi(str, startLevel, vertical) {
}
/***/ }),
-/* 40 */
+/* 233 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -39972,7 +52057,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.getMetrics = void 0;
-var _core_utils = __w_pdfjs_require__(8);
+var _core_utils = __w_pdfjs_require__(201);
var getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
t.Courier = 600;
@@ -42915,7 +55000,7 @@ var getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
exports.getMetrics = getMetrics;
/***/ }),
-/* 41 */
+/* 234 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -42927,38 +55012,54 @@ Object.defineProperty(exports, "__esModule", {
exports.isPDFFunction = isPDFFunction;
exports.PostScriptCompiler = exports.PostScriptEvaluator = exports.PDFFunctionFactory = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+var _primitives = __w_pdfjs_require__(198);
+
+var _ps_parser = __w_pdfjs_require__(235);
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
-var _primitives = __w_pdfjs_require__(5);
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-var _ps_parser = __w_pdfjs_require__(42);
+var PDFFunctionFactory = /*#__PURE__*/function () {
+ function PDFFunctionFactory(_ref) {
+ var xref = _ref.xref,
+ _ref$isEvalSupported = _ref.isEvalSupported,
+ isEvalSupported = _ref$isEvalSupported === void 0 ? true : _ref$isEvalSupported;
+
+ _classCallCheck(this, PDFFunctionFactory);
-class PDFFunctionFactory {
- constructor({
- xref,
- isEvalSupported = true
- }) {
this.xref = xref;
this.isEvalSupported = isEvalSupported !== false;
}
- create(fn) {
- return PDFFunction.parse({
- xref: this.xref,
- isEvalSupported: this.isEvalSupported,
- fn
- });
- }
-
- createFromArray(fnObj) {
- return PDFFunction.parseArray({
- xref: this.xref,
- isEvalSupported: this.isEvalSupported,
- fnObj
- });
- }
+ _createClass(PDFFunctionFactory, [{
+ key: "create",
+ value: function create(fn) {
+ return PDFFunction.parse({
+ xref: this.xref,
+ isEvalSupported: this.isEvalSupported,
+ fn: fn
+ });
+ }
+ }, {
+ key: "createFromArray",
+ value: function createFromArray(fnObj) {
+ return PDFFunction.parseArray({
+ xref: this.xref,
+ isEvalSupported: this.isEvalSupported,
+ fnObj: fnObj
+ });
+ }
+ }]);
-}
+ return PDFFunctionFactory;
+}();
exports.PDFFunctionFactory = PDFFunctionFactory;
@@ -42967,13 +55068,13 @@ function toNumberArray(arr) {
return null;
}
- const length = arr.length;
+ var length = arr.length;
- for (let i = 0; i < length; i++) {
+ for (var i = 0; i < length; i++) {
if (typeof arr[i] !== "number") {
- const result = new Array(length);
+ var result = new Array(length);
- for (let j = 0; j < length; j++) {
+ for (var j = 0; j < length; j++) {
result[j] = +arr[j];
}
@@ -42985,12 +55086,12 @@ function toNumberArray(arr) {
}
var PDFFunction = function PDFFunctionClosure() {
- const CONSTRUCT_SAMPLED = 0;
- const CONSTRUCT_INTERPOLATED = 2;
- const CONSTRUCT_STICHED = 3;
- const CONSTRUCT_POSTSCRIPT = 4;
+ var CONSTRUCT_SAMPLED = 0;
+ var CONSTRUCT_INTERPOLATED = 2;
+ var CONSTRUCT_STICHED = 3;
+ var CONSTRUCT_POSTSCRIPT = 4;
return {
- getSampleArray(size, outputSize, bps, stream) {
+ getSampleArray: function getSampleArray(size, outputSize, bps, stream) {
var i, ii;
var length = 1;
@@ -43002,7 +55103,7 @@ var PDFFunction = function PDFFunctionClosure() {
var array = new Array(length);
var codeSize = 0;
var codeBuf = 0;
- var sampleMul = 1.0 / (2.0 ** bps - 1);
+ var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
var strBytes = stream.getBytes((length * bps + 7) / 8);
var strIdx = 0;
@@ -43020,12 +55121,10 @@ var PDFFunction = function PDFFunctionClosure() {
return array;
},
-
- getIR({
- xref,
- isEvalSupported,
- fn
- }) {
+ getIR: function getIR(_ref2) {
+ var xref = _ref2.xref,
+ isEvalSupported = _ref2.isEvalSupported,
+ fn = _ref2.fn;
var dict = fn.dict;
if (!dict) {
@@ -43041,77 +55140,72 @@ var PDFFunction = function PDFFunctionClosure() {
}
return typeFn.call(this, {
- xref,
- isEvalSupported,
- fn,
- dict
+ xref: xref,
+ isEvalSupported: isEvalSupported,
+ fn: fn,
+ dict: dict
});
},
-
- fromIR({
- xref,
- isEvalSupported,
- IR
- }) {
+ fromIR: function fromIR(_ref3) {
+ var xref = _ref3.xref,
+ isEvalSupported = _ref3.isEvalSupported,
+ IR = _ref3.IR;
var type = IR[0];
switch (type) {
case CONSTRUCT_SAMPLED:
return this.constructSampledFromIR({
- xref,
- isEvalSupported,
- IR
+ xref: xref,
+ isEvalSupported: isEvalSupported,
+ IR: IR
});
case CONSTRUCT_INTERPOLATED:
return this.constructInterpolatedFromIR({
- xref,
- isEvalSupported,
- IR
+ xref: xref,
+ isEvalSupported: isEvalSupported,
+ IR: IR
});
case CONSTRUCT_STICHED:
return this.constructStichedFromIR({
- xref,
- isEvalSupported,
- IR
+ xref: xref,
+ isEvalSupported: isEvalSupported,
+ IR: IR
});
default:
return this.constructPostScriptFromIR({
- xref,
- isEvalSupported,
- IR
+ xref: xref,
+ isEvalSupported: isEvalSupported,
+ IR: IR
});
}
},
-
- parse({
- xref,
- isEvalSupported,
- fn
- }) {
- const IR = this.getIR({
- xref,
- isEvalSupported,
- fn
+ parse: function parse(_ref4) {
+ var xref = _ref4.xref,
+ isEvalSupported = _ref4.isEvalSupported,
+ fn = _ref4.fn;
+ var IR = this.getIR({
+ xref: xref,
+ isEvalSupported: isEvalSupported,
+ fn: fn
});
return this.fromIR({
- xref,
- isEvalSupported,
- IR
+ xref: xref,
+ isEvalSupported: isEvalSupported,
+ IR: IR
});
},
+ parseArray: function parseArray(_ref5) {
+ var xref = _ref5.xref,
+ isEvalSupported = _ref5.isEvalSupported,
+ fnObj = _ref5.fnObj;
- parseArray({
- xref,
- isEvalSupported,
- fnObj
- }) {
if (!Array.isArray(fnObj)) {
return this.parse({
- xref,
- isEvalSupported,
+ xref: xref,
+ isEvalSupported: isEvalSupported,
fn: fnObj
});
}
@@ -43120,8 +55214,8 @@ var PDFFunction = function PDFFunctionClosure() {
for (var j = 0, jj = fnObj.length; j < jj; j++) {
fnArray.push(this.parse({
- xref,
- isEvalSupported,
+ xref: xref,
+ isEvalSupported: isEvalSupported,
fn: xref.fetchIfRef(fnObj[j])
}));
}
@@ -43132,13 +55226,12 @@ var PDFFunction = function PDFFunctionClosure() {
}
};
},
+ constructSampled: function constructSampled(_ref6) {
+ var xref = _ref6.xref,
+ isEvalSupported = _ref6.isEvalSupported,
+ fn = _ref6.fn,
+ dict = _ref6.dict;
- constructSampled({
- xref,
- isEvalSupported,
- fn,
- dict
- }) {
function toMultiArray(arr) {
var inputLength = arr.length;
var out = [];
@@ -43192,14 +55285,13 @@ var PDFFunction = function PDFFunctionClosure() {
}
var samples = this.getSampleArray(size, outputSize, bps, fn);
- return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, 2 ** bps - 1, range];
+ return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, Math.pow(2, bps) - 1, range];
},
+ constructSampledFromIR: function constructSampledFromIR(_ref7) {
+ var xref = _ref7.xref,
+ isEvalSupported = _ref7.isEvalSupported,
+ IR = _ref7.IR;
- constructSampledFromIR({
- xref,
- isEvalSupported,
- IR
- }) {
function interpolate(x, xmin, xmax, ymin, ymax) {
return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
}
@@ -43264,13 +55356,11 @@ var PDFFunction = function PDFFunctionClosure() {
}
};
},
-
- constructInterpolated({
- xref,
- isEvalSupported,
- fn,
- dict
- }) {
+ constructInterpolated: function constructInterpolated(_ref8) {
+ var xref = _ref8.xref,
+ isEvalSupported = _ref8.isEvalSupported,
+ fn = _ref8.fn,
+ dict = _ref8.dict;
var c0 = toNumberArray(dict.getArray("C0")) || [0];
var c1 = toNumberArray(dict.getArray("C1")) || [1];
var n = dict.get("N");
@@ -43283,31 +55373,27 @@ var PDFFunction = function PDFFunctionClosure() {
return [CONSTRUCT_INTERPOLATED, c0, diff, n];
},
-
- constructInterpolatedFromIR({
- xref,
- isEvalSupported,
- IR
- }) {
+ constructInterpolatedFromIR: function constructInterpolatedFromIR(_ref9) {
+ var xref = _ref9.xref,
+ isEvalSupported = _ref9.isEvalSupported,
+ IR = _ref9.IR;
var c0 = IR[1];
var diff = IR[2];
var n = IR[3];
var length = diff.length;
return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
- var x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
+ var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
for (var j = 0; j < length; ++j) {
dest[destOffset + j] = c0[j] + x * diff[j];
}
};
},
-
- constructStiched({
- xref,
- isEvalSupported,
- fn,
- dict
- }) {
+ constructStiched: function constructStiched(_ref10) {
+ var xref = _ref10.xref,
+ isEvalSupported = _ref10.isEvalSupported,
+ fn = _ref10.fn,
+ dict = _ref10.dict;
var domain = toNumberArray(dict.getArray("Domain"));
if (!domain) {
@@ -43325,8 +55411,8 @@ var PDFFunction = function PDFFunctionClosure() {
for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
fns.push(this.parse({
- xref,
- isEvalSupported,
+ xref: xref,
+ isEvalSupported: isEvalSupported,
fn: xref.fetchIfRef(fnRefs[i])
}));
}
@@ -43335,12 +55421,10 @@ var PDFFunction = function PDFFunctionClosure() {
var encode = toNumberArray(dict.getArray("Encode"));
return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
},
-
- constructStichedFromIR({
- xref,
- isEvalSupported,
- IR
- }) {
+ constructStichedFromIR: function constructStichedFromIR(_ref11) {
+ var xref = _ref11.xref,
+ isEvalSupported = _ref11.isEvalSupported,
+ IR = _ref11.IR;
var domain = IR[1];
var bounds = IR[2];
var encode = IR[3];
@@ -43383,13 +55467,11 @@ var PDFFunction = function PDFFunctionClosure() {
fns[i](tmpBuf, 0, dest, destOffset);
};
},
-
- constructPostScript({
- xref,
- isEvalSupported,
- fn,
- dict
- }) {
+ constructPostScript: function constructPostScript(_ref12) {
+ var xref = _ref12.xref,
+ isEvalSupported = _ref12.isEvalSupported,
+ fn = _ref12.fn,
+ dict = _ref12.dict;
var domain = toNumberArray(dict.getArray("Domain"));
var range = toNumberArray(dict.getArray("Range"));
@@ -43406,18 +55488,16 @@ var PDFFunction = function PDFFunctionClosure() {
var code = parser.parse();
return [CONSTRUCT_POSTSCRIPT, domain, range, code];
},
-
- constructPostScriptFromIR({
- xref,
- isEvalSupported,
- IR
- }) {
+ constructPostScriptFromIR: function constructPostScriptFromIR(_ref13) {
+ var xref = _ref13.xref,
+ isEvalSupported = _ref13.isEvalSupported,
+ IR = _ref13.IR;
var domain = IR[1];
var range = IR[2];
var code = IR[3];
if (isEvalSupported && _util.IsEvalSupportedCached.value) {
- const compiled = new PostScriptCompiler().compile(code, domain, range);
+ var compiled = new PostScriptCompiler().compile(code, domain, range);
if (compiled) {
return new Function("src", "srcOffset", "dest", "destOffset", compiled);
@@ -43479,14 +55559,13 @@ var PDFFunction = function PDFFunctionClosure() {
dest.set(output, destOffset);
};
}
-
};
}();
function isPDFFunction(v) {
var fnDict;
- if (typeof v !== "object") {
+ if (_typeof(v) !== "object") {
return false;
} else if ((0, _primitives.isDict)(v)) {
fnDict = v;
@@ -43689,7 +55768,7 @@ var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
case "exp":
b = stack.pop();
a = stack.pop();
- stack.push(a ** b);
+ stack.push(Math.pow(a, b));
break;
case "false":
@@ -43846,7 +55925,7 @@ var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
break;
default:
- throw new _util.FormatError(`Unknown operator ${operator}`);
+ throw new _util.FormatError("Unknown operator ".concat(operator));
}
}
@@ -43951,44 +56030,37 @@ var PostScriptCompiler = function PostScriptCompilerClosure() {
}
ExpressionBuilderVisitor.prototype = {
- visitArgument(arg) {
+ visitArgument: function visitArgument(arg) {
this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
},
-
- visitVariable(variable) {
+ visitVariable: function visitVariable(variable) {
this.parts.push("v", variable.index);
},
-
- visitLiteral(literal) {
+ visitLiteral: function visitLiteral(literal) {
this.parts.push(literal.number);
},
-
- visitBinaryOperation(operation) {
+ visitBinaryOperation: function visitBinaryOperation(operation) {
this.parts.push("(");
operation.arg1.visit(this);
this.parts.push(" ", operation.op, " ");
operation.arg2.visit(this);
this.parts.push(")");
},
-
- visitVariableDefinition(definition) {
+ visitVariableDefinition: function visitVariableDefinition(definition) {
this.parts.push("var ");
definition.variable.visit(this);
this.parts.push(" = ");
definition.arg.visit(this);
this.parts.push(";");
},
-
- visitMin(max) {
+ visitMin: function visitMin(max) {
this.parts.push("Math.min(");
max.arg.visit(this);
this.parts.push(", ", max.max, ")");
},
-
- toString() {
+ toString: function toString() {
return this.parts.join("");
}
-
};
function buildAddOperation(num1, num2) {
@@ -44069,12 +56141,12 @@ var PostScriptCompiler = function PostScriptCompilerClosure() {
var n, j;
var num1, num2, ast1, ast2, tmpVar, item;
- for (let i = 0; i < inputSize; i++) {
+ for (var i = 0; i < inputSize; i++) {
stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
}
- for (let i = 0, ii = code.length; i < ii; i++) {
- item = code[i];
+ for (var _i = 0, ii = code.length; _i < ii; _i++) {
+ item = code[_i];
if (typeof item === "number") {
stack.push(new AstLiteral(item));
@@ -44172,10 +56244,10 @@ var PostScriptCompiler = function PostScriptCompilerClosure() {
return null;
}
- if (typeof code[i + 1] === "number" && code[i + 2] === "gt" && code[i + 3] === i + 7 && code[i + 4] === "jz" && code[i + 5] === "pop" && code[i + 6] === code[i + 1]) {
+ if (typeof code[_i + 1] === "number" && code[_i + 2] === "gt" && code[_i + 3] === _i + 7 && code[_i + 4] === "jz" && code[_i + 5] === "pop" && code[_i + 6] === code[_i + 1]) {
num1 = stack.pop();
- stack.push(buildMinOperation(num1, code[i + 1]));
- i += 6;
+ stack.push(buildMinOperation(num1, code[_i + 1]));
+ _i += 6;
break;
}
@@ -44265,7 +56337,7 @@ var PostScriptCompiler = function PostScriptCompilerClosure() {
exports.PostScriptCompiler = PostScriptCompiler;
/***/ }),
-/* 42 */
+/* 235 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -44276,93 +56348,110 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PostScriptParser = exports.PostScriptLexer = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+var _primitives = __w_pdfjs_require__(198);
+
+var _core_utils = __w_pdfjs_require__(201);
-var _primitives = __w_pdfjs_require__(5);
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-var _core_utils = __w_pdfjs_require__(8);
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var PostScriptParser = /*#__PURE__*/function () {
+ function PostScriptParser(lexer) {
+ _classCallCheck(this, PostScriptParser);
-class PostScriptParser {
- constructor(lexer) {
this.lexer = lexer;
this.operators = [];
this.token = null;
this.prev = null;
}
- nextToken() {
- this.prev = this.token;
- this.token = this.lexer.getToken();
- }
-
- accept(type) {
- if (this.token.type === type) {
- this.nextToken();
- return true;
+ _createClass(PostScriptParser, [{
+ key: "nextToken",
+ value: function nextToken() {
+ this.prev = this.token;
+ this.token = this.lexer.getToken();
}
+ }, {
+ key: "accept",
+ value: function accept(type) {
+ if (this.token.type === type) {
+ this.nextToken();
+ return true;
+ }
- return false;
- }
-
- expect(type) {
- if (this.accept(type)) {
- return true;
+ return false;
}
+ }, {
+ key: "expect",
+ value: function expect(type) {
+ if (this.accept(type)) {
+ return true;
+ }
- throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
- }
-
- parse() {
- this.nextToken();
- this.expect(PostScriptTokenTypes.LBRACE);
- this.parseBlock();
- this.expect(PostScriptTokenTypes.RBRACE);
- return this.operators;
- }
-
- parseBlock() {
- while (true) {
- if (this.accept(PostScriptTokenTypes.NUMBER)) {
- this.operators.push(this.prev.value);
- } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
- this.operators.push(this.prev.value);
- } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
- this.parseCondition();
- } else {
- return;
+ throw new _util.FormatError("Unexpected symbol: found ".concat(this.token.type, " expected ").concat(type, "."));
+ }
+ }, {
+ key: "parse",
+ value: function parse() {
+ this.nextToken();
+ this.expect(PostScriptTokenTypes.LBRACE);
+ this.parseBlock();
+ this.expect(PostScriptTokenTypes.RBRACE);
+ return this.operators;
+ }
+ }, {
+ key: "parseBlock",
+ value: function parseBlock() {
+ while (true) {
+ if (this.accept(PostScriptTokenTypes.NUMBER)) {
+ this.operators.push(this.prev.value);
+ } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
+ this.operators.push(this.prev.value);
+ } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
+ this.parseCondition();
+ } else {
+ return;
+ }
}
}
- }
-
- parseCondition() {
- const conditionLocation = this.operators.length;
- this.operators.push(null, null);
- this.parseBlock();
- this.expect(PostScriptTokenTypes.RBRACE);
-
- if (this.accept(PostScriptTokenTypes.IF)) {
- this.operators[conditionLocation] = this.operators.length;
- this.operators[conditionLocation + 1] = "jz";
- } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
- const jumpLocation = this.operators.length;
+ }, {
+ key: "parseCondition",
+ value: function parseCondition() {
+ var conditionLocation = this.operators.length;
this.operators.push(null, null);
- const endOfTrue = this.operators.length;
this.parseBlock();
this.expect(PostScriptTokenTypes.RBRACE);
- this.expect(PostScriptTokenTypes.IFELSE);
- this.operators[jumpLocation] = this.operators.length;
- this.operators[jumpLocation + 1] = "j";
- this.operators[conditionLocation] = endOfTrue;
- this.operators[conditionLocation + 1] = "jz";
- } else {
- throw new _util.FormatError("PS Function: error parsing conditional.");
+
+ if (this.accept(PostScriptTokenTypes.IF)) {
+ this.operators[conditionLocation] = this.operators.length;
+ this.operators[conditionLocation + 1] = "jz";
+ } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
+ var jumpLocation = this.operators.length;
+ this.operators.push(null, null);
+ var endOfTrue = this.operators.length;
+ this.parseBlock();
+ this.expect(PostScriptTokenTypes.RBRACE);
+ this.expect(PostScriptTokenTypes.IFELSE);
+ this.operators[jumpLocation] = this.operators.length;
+ this.operators[jumpLocation + 1] = "j";
+ this.operators[conditionLocation] = endOfTrue;
+ this.operators[conditionLocation + 1] = "jz";
+ } else {
+ throw new _util.FormatError("PS Function: error parsing conditional.");
+ }
}
- }
+ }]);
-}
+ return PostScriptParser;
+}();
exports.PostScriptParser = PostScriptParser;
-const PostScriptTokenTypes = {
+var PostScriptTokenTypes = {
LBRACE: 0,
RBRACE: 1,
NUMBER: 2,
@@ -44371,155 +56460,173 @@ const PostScriptTokenTypes = {
IFELSE: 5
};
-const PostScriptToken = function PostScriptTokenClosure() {
- const opCache = Object.create(null);
+var PostScriptToken = function PostScriptTokenClosure() {
+ var opCache = Object.create(null);
+
+ var PostScriptToken = /*#__PURE__*/function () {
+ function PostScriptToken(type, value) {
+ _classCallCheck(this, PostScriptToken);
- class PostScriptToken {
- constructor(type, value) {
this.type = type;
this.value = value;
}
- static getOperator(op) {
- const opValue = opCache[op];
+ _createClass(PostScriptToken, null, [{
+ key: "getOperator",
+ value: function getOperator(op) {
+ var opValue = opCache[op];
- if (opValue) {
- return opValue;
- }
-
- return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
- }
-
- static get LBRACE() {
- return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
- }
-
- static get RBRACE() {
- return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
- }
-
- static get IF() {
- return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
- }
+ if (opValue) {
+ return opValue;
+ }
- static get IFELSE() {
- return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
- }
+ return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
+ }
+ }, {
+ key: "LBRACE",
+ get: function get() {
+ return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
+ }
+ }, {
+ key: "RBRACE",
+ get: function get() {
+ return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
+ }
+ }, {
+ key: "IF",
+ get: function get() {
+ return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
+ }
+ }, {
+ key: "IFELSE",
+ get: function get() {
+ return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
+ }
+ }]);
- }
+ return PostScriptToken;
+ }();
return PostScriptToken;
}();
-class PostScriptLexer {
- constructor(stream) {
+var PostScriptLexer = /*#__PURE__*/function () {
+ function PostScriptLexer(stream) {
+ _classCallCheck(this, PostScriptLexer);
+
this.stream = stream;
this.nextChar();
this.strBuf = [];
}
- nextChar() {
- return this.currentChar = this.stream.getByte();
- }
-
- getToken() {
- let comment = false;
- let ch = this.currentChar;
-
- while (true) {
- if (ch < 0) {
- return _primitives.EOF;
- }
+ _createClass(PostScriptLexer, [{
+ key: "nextChar",
+ value: function nextChar() {
+ return this.currentChar = this.stream.getByte();
+ }
+ }, {
+ key: "getToken",
+ value: function getToken() {
+ var comment = false;
+ var ch = this.currentChar;
- if (comment) {
- if (ch === 0x0a || ch === 0x0d) {
- comment = false;
+ while (true) {
+ if (ch < 0) {
+ return _primitives.EOF;
}
- } else if (ch === 0x25) {
- comment = true;
- } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
- break;
- }
- ch = this.nextChar();
- }
+ if (comment) {
+ if (ch === 0x0a || ch === 0x0d) {
+ comment = false;
+ }
+ } else if (ch === 0x25) {
+ comment = true;
+ } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
+ break;
+ }
- switch (ch | 0) {
- case 0x30:
- case 0x31:
- case 0x32:
- case 0x33:
- case 0x34:
- case 0x35:
- case 0x36:
- case 0x37:
- case 0x38:
- case 0x39:
- case 0x2b:
- case 0x2d:
- case 0x2e:
- return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
+ ch = this.nextChar();
+ }
- case 0x7b:
- this.nextChar();
- return PostScriptToken.LBRACE;
+ switch (ch | 0) {
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ case 0x38:
+ case 0x39:
+ case 0x2b:
+ case 0x2d:
+ case 0x2e:
+ return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
+
+ case 0x7b:
+ this.nextChar();
+ return PostScriptToken.LBRACE;
- case 0x7d:
- this.nextChar();
- return PostScriptToken.RBRACE;
- }
+ case 0x7d:
+ this.nextChar();
+ return PostScriptToken.RBRACE;
+ }
- const strBuf = this.strBuf;
- strBuf.length = 0;
- strBuf[0] = String.fromCharCode(ch);
+ var strBuf = this.strBuf;
+ strBuf.length = 0;
+ strBuf[0] = String.fromCharCode(ch);
- while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
- strBuf.push(String.fromCharCode(ch));
- }
+ while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
+ strBuf.push(String.fromCharCode(ch));
+ }
- const str = strBuf.join("");
+ var str = strBuf.join("");
- switch (str.toLowerCase()) {
- case "if":
- return PostScriptToken.IF;
+ switch (str.toLowerCase()) {
+ case "if":
+ return PostScriptToken.IF;
- case "ifelse":
- return PostScriptToken.IFELSE;
+ case "ifelse":
+ return PostScriptToken.IFELSE;
- default:
- return PostScriptToken.getOperator(str);
+ default:
+ return PostScriptToken.getOperator(str);
+ }
}
- }
-
- getNumber() {
- let ch = this.currentChar;
- const strBuf = this.strBuf;
- strBuf.length = 0;
- strBuf[0] = String.fromCharCode(ch);
+ }, {
+ key: "getNumber",
+ value: function getNumber() {
+ var ch = this.currentChar;
+ var strBuf = this.strBuf;
+ strBuf.length = 0;
+ strBuf[0] = String.fromCharCode(ch);
- while ((ch = this.nextChar()) >= 0) {
- if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
- strBuf.push(String.fromCharCode(ch));
- } else {
- break;
+ while ((ch = this.nextChar()) >= 0) {
+ if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
+ strBuf.push(String.fromCharCode(ch));
+ } else {
+ break;
+ }
}
- }
- const value = parseFloat(strBuf.join(""));
+ var value = parseFloat(strBuf.join(""));
- if (isNaN(value)) {
- throw new _util.FormatError(`Invalid floating point number: ${value}`);
- }
+ if (isNaN(value)) {
+ throw new _util.FormatError("Invalid floating point number: ".concat(value));
+ }
- return value;
- }
+ return value;
+ }
+ }]);
-}
+ return PostScriptLexer;
+}();
exports.PostScriptLexer = PostScriptLexer;
/***/ }),
-/* 43 */
+/* 236 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -44530,122 +56637,135 @@ Object.defineProperty(exports, "__esModule", {
});
exports.MurmurHash3_64 = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-const SEED = 0xc3d2e1f0;
-const MASK_HIGH = 0xffff0000;
-const MASK_LOW = 0xffff;
+var SEED = 0xc3d2e1f0;
+var MASK_HIGH = 0xffff0000;
+var MASK_LOW = 0xffff;
+
+var MurmurHash3_64 = /*#__PURE__*/function () {
+ function MurmurHash3_64(seed) {
+ _classCallCheck(this, MurmurHash3_64);
-class MurmurHash3_64 {
- constructor(seed) {
this.h1 = seed ? seed & 0xffffffff : SEED;
this.h2 = seed ? seed & 0xffffffff : SEED;
}
- update(input) {
- let data, length;
+ _createClass(MurmurHash3_64, [{
+ key: "update",
+ value: function update(input) {
+ var data, length;
- if ((0, _util.isString)(input)) {
- data = new Uint8Array(input.length * 2);
- length = 0;
+ if ((0, _util.isString)(input)) {
+ data = new Uint8Array(input.length * 2);
+ length = 0;
- for (let i = 0, ii = input.length; i < ii; i++) {
- const code = input.charCodeAt(i);
+ for (var i = 0, ii = input.length; i < ii; i++) {
+ var code = input.charCodeAt(i);
- if (code <= 0xff) {
- data[length++] = code;
- } else {
- data[length++] = code >>> 8;
- data[length++] = code & 0xff;
+ if (code <= 0xff) {
+ data[length++] = code;
+ } else {
+ data[length++] = code >>> 8;
+ data[length++] = code & 0xff;
+ }
}
+ } else if ((0, _util.isArrayBuffer)(input)) {
+ data = input;
+ length = data.byteLength;
+ } else {
+ throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
}
- } else if ((0, _util.isArrayBuffer)(input)) {
- data = input;
- length = data.byteLength;
- } else {
- throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
- }
- const blockCounts = length >> 2;
- const tailLength = length - blockCounts * 4;
- const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
- let k1 = 0,
- k2 = 0;
- let h1 = this.h1,
- h2 = this.h2;
- const C1 = 0xcc9e2d51,
+ var blockCounts = length >> 2;
+ var tailLength = length - blockCounts * 4;
+ var dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
+ var k1 = 0,
+ k2 = 0;
+ var h1 = this.h1,
+ h2 = this.h2;
+ var C1 = 0xcc9e2d51,
C2 = 0x1b873593;
- const C1_LOW = C1 & MASK_LOW,
+ var C1_LOW = C1 & MASK_LOW,
C2_LOW = C2 & MASK_LOW;
- for (let i = 0; i < blockCounts; i++) {
- if (i & 1) {
- k1 = dataUint32[i];
- k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
- k1 = k1 << 15 | k1 >>> 17;
- k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
- h1 ^= k1;
- h1 = h1 << 13 | h1 >>> 19;
- h1 = h1 * 5 + 0xe6546b64;
- } else {
- k2 = dataUint32[i];
- k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
- k2 = k2 << 15 | k2 >>> 17;
- k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
- h2 ^= k2;
- h2 = h2 << 13 | h2 >>> 19;
- h2 = h2 * 5 + 0xe6546b64;
+ for (var _i = 0; _i < blockCounts; _i++) {
+ if (_i & 1) {
+ k1 = dataUint32[_i];
+ k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
+ k1 = k1 << 15 | k1 >>> 17;
+ k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
+ h1 ^= k1;
+ h1 = h1 << 13 | h1 >>> 19;
+ h1 = h1 * 5 + 0xe6546b64;
+ } else {
+ k2 = dataUint32[_i];
+ k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
+ k2 = k2 << 15 | k2 >>> 17;
+ k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
+ h2 ^= k2;
+ h2 = h2 << 13 | h2 >>> 19;
+ h2 = h2 * 5 + 0xe6546b64;
+ }
}
- }
-
- k1 = 0;
- switch (tailLength) {
- case 3:
- k1 ^= data[blockCounts * 4 + 2] << 16;
+ k1 = 0;
- case 2:
- k1 ^= data[blockCounts * 4 + 1] << 8;
+ switch (tailLength) {
+ case 3:
+ k1 ^= data[blockCounts * 4 + 2] << 16;
- case 1:
- k1 ^= data[blockCounts * 4];
- k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
- k1 = k1 << 15 | k1 >>> 17;
- k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
+ case 2:
+ k1 ^= data[blockCounts * 4 + 1] << 8;
- if (blockCounts & 1) {
- h1 ^= k1;
- } else {
- h2 ^= k1;
- }
+ case 1:
+ k1 ^= data[blockCounts * 4];
+ k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
+ k1 = k1 << 15 | k1 >>> 17;
+ k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
- }
+ if (blockCounts & 1) {
+ h1 ^= k1;
+ } else {
+ h2 ^= k1;
+ }
- this.h1 = h1;
- this.h2 = h2;
- }
+ }
- hexdigest() {
- let h1 = this.h1,
- h2 = this.h2;
- h1 ^= h2 >>> 1;
- h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
- h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
- h1 ^= h2 >>> 1;
- h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
- h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
- h1 ^= h2 >>> 1;
- const hex1 = (h1 >>> 0).toString(16),
+ this.h1 = h1;
+ this.h2 = h2;
+ }
+ }, {
+ key: "hexdigest",
+ value: function hexdigest() {
+ var h1 = this.h1,
+ h2 = this.h2;
+ h1 ^= h2 >>> 1;
+ h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
+ h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
+ h1 ^= h2 >>> 1;
+ h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
+ h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
+ h1 ^= h2 >>> 1;
+ var hex1 = (h1 >>> 0).toString(16),
hex2 = (h2 >>> 0).toString(16);
- return hex1.padStart(8, "0") + hex2.padStart(8, "0");
- }
+ return hex1.padStart(8, "0") + hex2.padStart(8, "0");
+ }
+ }]);
-}
+ return MurmurHash3_64;
+}();
exports.MurmurHash3_64 = MurmurHash3_64;
/***/ }),
-/* 44 */
+/* 237 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -44656,17 +56776,17 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFImage = void 0;
-var _util = __w_pdfjs_require__(2);
+var _util = __w_pdfjs_require__(5);
-var _primitives = __w_pdfjs_require__(5);
+var _primitives = __w_pdfjs_require__(198);
-var _colorspace = __w_pdfjs_require__(23);
+var _colorspace = __w_pdfjs_require__(216);
-var _stream = __w_pdfjs_require__(12);
+var _stream = __w_pdfjs_require__(205);
-var _jpeg_stream = __w_pdfjs_require__(18);
+var _jpeg_stream = __w_pdfjs_require__(211);
-var _jpx = __w_pdfjs_require__(21);
+var _jpx = __w_pdfjs_require__(214);
var PDFImage = function PDFImageClosure() {
function decodeAndClamp(value, addend, coefficient, max) {
@@ -44683,7 +56803,7 @@ var PDFImage = function PDFImageClosure() {
function resizeImageMask(src, bpc, w1, h1, w2, h2) {
var length = w2 * h2;
- let dest;
+ var dest;
if (bpc <= 8) {
dest = new Uint8Array(length);
@@ -44719,19 +56839,22 @@ var PDFImage = function PDFImageClosure() {
return dest;
}
- function PDFImage({
- xref,
- res,
- image,
- isInline = false,
- smask = null,
- mask = null,
- isMask = false,
- pdfFunctionFactory
- }) {
+ function PDFImage(_ref) {
+ var xref = _ref.xref,
+ res = _ref.res,
+ image = _ref.image,
+ _ref$isInline = _ref.isInline,
+ isInline = _ref$isInline === void 0 ? false : _ref$isInline,
+ _ref$smask = _ref.smask,
+ smask = _ref$smask === void 0 ? null : _ref$smask,
+ _ref$mask = _ref.mask,
+ mask = _ref$mask === void 0 ? null : _ref$mask,
+ _ref$isMask = _ref.isMask,
+ isMask = _ref$isMask === void 0 ? false : _ref$isMask,
+ pdfFunctionFactory = _ref.pdfFunctionFactory;
this.image = image;
var dict = image.dict;
- const filter = dict.get("Filter");
+ var filter = dict.get("Filter");
if ((0, _primitives.isName)(filter)) {
switch (filter.name) {
@@ -44752,8 +56875,8 @@ var PDFImage = function PDFImageClosure() {
}
}
- let width = dict.get("Width", "W");
- let height = dict.get("Height", "H");
+ var width = dict.get("Width", "W");
+ var height = dict.get("Height", "H");
if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
(0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
@@ -44762,7 +56885,7 @@ var PDFImage = function PDFImageClosure() {
}
if (width < 1 || height < 1) {
- throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
+ throw new _util.FormatError("Invalid image width: ".concat(width, " or height: ").concat(height));
}
this.width = width;
@@ -44779,7 +56902,7 @@ var PDFImage = function PDFImageClosure() {
if (this.imageMask) {
bitsPerComponent = 1;
} else {
- throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
+ throw new _util.FormatError("Bits per component missing in image: ".concat(this.imageMask));
}
}
}
@@ -44806,11 +56929,11 @@ var PDFImage = function PDFImageClosure() {
break;
default:
- throw new Error(`JPX images with ${image.numComps} ` + "color components not supported.");
+ throw new Error("JPX images with ".concat(image.numComps, " ") + "color components not supported.");
}
}
- const resources = isInline ? res : null;
+ var resources = isInline ? res : null;
this.colorSpace = _colorspace.ColorSpace.parse(colorSpace, xref, resources, pdfFunctionFactory);
this.numComps = this.colorSpace.numComps;
}
@@ -44823,7 +56946,7 @@ var PDFImage = function PDFImageClosure() {
var max = (1 << bitsPerComponent) - 1;
this.decodeCoefficients = [];
this.decodeAddends = [];
- const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
+ var isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
var dmin = this.decode[i];
@@ -44835,11 +56958,11 @@ var PDFImage = function PDFImageClosure() {
if (smask) {
this.smask = new PDFImage({
- xref,
- res,
+ xref: xref,
+ res: res,
image: smask,
- isInline,
- pdfFunctionFactory
+ isInline: isInline,
+ pdfFunctionFactory: pdfFunctionFactory
});
} else if (mask) {
if ((0, _primitives.isStream)(mask)) {
@@ -44850,12 +56973,12 @@ var PDFImage = function PDFImageClosure() {
(0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
} else {
this.mask = new PDFImage({
- xref,
- res,
+ xref: xref,
+ res: res,
image: mask,
- isInline,
+ isInline: isInline,
isMask: true,
- pdfFunctionFactory
+ pdfFunctionFactory: pdfFunctionFactory
});
}
} else {
@@ -44864,18 +56987,18 @@ var PDFImage = function PDFImageClosure() {
}
}
- PDFImage.buildImage = function ({
- xref,
- res,
- image,
- isInline = false,
- pdfFunctionFactory
- }) {
- const imageData = image;
- let smaskData = null;
- let maskData = null;
- const smask = image.dict.get("SMask");
- const mask = image.dict.get("Mask");
+ PDFImage.buildImage = function (_ref2) {
+ var xref = _ref2.xref,
+ res = _ref2.res,
+ image = _ref2.image,
+ _ref2$isInline = _ref2.isInline,
+ isInline = _ref2$isInline === void 0 ? false : _ref2$isInline,
+ pdfFunctionFactory = _ref2.pdfFunctionFactory;
+ var imageData = image;
+ var smaskData = null;
+ var maskData = null;
+ var smask = image.dict.get("SMask");
+ var mask = image.dict.get("Mask");
if (smask) {
smaskData = smask;
@@ -44888,23 +57011,22 @@ var PDFImage = function PDFImageClosure() {
}
return Promise.resolve(new PDFImage({
- xref,
- res,
+ xref: xref,
+ res: res,
image: imageData,
- isInline,
+ isInline: isInline,
smask: smaskData,
mask: maskData,
- pdfFunctionFactory
+ pdfFunctionFactory: pdfFunctionFactory
}));
};
- PDFImage.createMask = function ({
- imgArray,
- width,
- height,
- imageIsFromDecodeStream,
- inverseDecode
- }) {
+ PDFImage.createMask = function (_ref3) {
+ var imgArray = _ref3.imgArray,
+ width = _ref3.width,
+ height = _ref3.height,
+ imageIsFromDecodeStream = _ref3.imageIsFromDecodeStream,
+ inverseDecode = _ref3.inverseDecode;
var computedLength = (width + 7 >> 3) * height;
var actualLength = imgArray.byteLength;
var haveFullData = computedLength === actualLength;
@@ -44931,9 +57053,9 @@ var PDFImage = function PDFImageClosure() {
}
return {
- data,
- width,
- height
+ data: data,
+ width: width,
+ height: height
};
};
@@ -44946,7 +57068,7 @@ var PDFImage = function PDFImageClosure() {
return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
},
- decodeBuffer(buffer) {
+ decodeBuffer: function decodeBuffer(buffer) {
var bpc = this.bpc;
var numComps = this.numComps;
var decodeAddends = this.decodeAddends;
@@ -44971,8 +57093,7 @@ var PDFImage = function PDFImageClosure() {
}
}
},
-
- getComponents(buffer) {
+ getComponents: function getComponents(buffer) {
var bpc = this.bpc;
if (bpc === 8) {
@@ -44984,7 +57105,7 @@ var PDFImage = function PDFImageClosure() {
var numComps = this.numComps;
var length = width * height * numComps;
var bufferPos = 0;
- let output;
+ var output;
if (bpc <= 8) {
output = new Uint8Array(length);
@@ -45046,7 +57167,7 @@ var PDFImage = function PDFImageClosure() {
}
var remainingBits = bits - bpc;
- let value = buf >> remainingBits;
+ var value = buf >> remainingBits;
if (value < 0) {
value = 0;
@@ -45062,8 +57183,7 @@ var PDFImage = function PDFImageClosure() {
return output;
},
-
- fillOpacity(rgbaBuf, width, height, actualHeight, image) {
+ fillOpacity: function fillOpacity(rgbaBuf, width, height, actualHeight, image) {
var smask = this.smask;
var mask = this.mask;
var alphaBuf, sw, sh, i, ii, j;
@@ -45127,8 +57247,7 @@ var PDFImage = function PDFImageClosure() {
}
}
},
-
- undoPreblend(buffer, width, height) {
+ undoPreblend: function undoPreblend(buffer, width, height) {
var matte = this.smask && this.smask.matte;
if (!matte) {
@@ -45157,8 +57276,8 @@ var PDFImage = function PDFImageClosure() {
buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
}
},
-
- createImageData(forceRGBA = false) {
+ createImageData: function createImageData() {
+ var forceRGBA = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var drawWidth = this.drawWidth;
var drawHeight = this.drawHeight;
var imgData = {
@@ -45208,7 +57327,7 @@ var PDFImage = function PDFImageClosure() {
}
if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
- let imageLength = originalHeight * rowBytes;
+ var imageLength = originalHeight * rowBytes;
switch (this.colorSpace.name) {
case "DeviceGray":
@@ -45253,12 +57372,11 @@ var PDFImage = function PDFImageClosure() {
return imgData;
},
-
- fillGrayBuffer(buffer) {
+ fillGrayBuffer: function fillGrayBuffer(buffer) {
var numComps = this.numComps;
if (numComps !== 1) {
- throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
+ throw new _util.FormatError("Reading gray scale from a color image: ".concat(numComps));
}
var width = this.width;
@@ -45296,15 +57414,14 @@ var PDFImage = function PDFImageClosure() {
buffer[i] = scale * comps[i];
}
},
-
- getImageBytes(length, drawWidth, drawHeight, forceRGB = false) {
+ getImageBytes: function getImageBytes(length, drawWidth, drawHeight) {
+ var forceRGB = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
this.image.reset();
this.image.drawWidth = drawWidth || this.width;
this.image.drawHeight = drawHeight || this.height;
this.image.forceRGB = !!forceRGB;
return this.image.getBytes(length, true);
}
-
};
return PDFImage;
}();
@@ -45312,7 +57429,7 @@ var PDFImage = function PDFImageClosure() {
exports.PDFImage = PDFImage;
/***/ }),
-/* 45 */
+/* 238 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -45323,14 +57440,30 @@ Object.defineProperty(exports, "__esModule", {
});
exports.MessageHandler = void 0;
-var _util = __w_pdfjs_require__(2);
+var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
+
+var _util = __w_pdfjs_require__(5);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
+
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
-const CallbackKind = {
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+var CallbackKind = {
UNKNOWN: 0,
DATA: 1,
ERROR: 2
};
-const StreamKind = {
+var StreamKind = {
UNKNOWN: 0,
CANCEL: 1,
CANCEL_COMPLETE: 2,
@@ -45343,7 +57476,7 @@ const StreamKind = {
};
function wrapReason(reason) {
- if (typeof reason !== "object" || reason === null) {
+ if (_typeof(reason) !== "object" || reason === null) {
return reason;
}
@@ -45365,8 +57498,12 @@ function wrapReason(reason) {
}
}
-class MessageHandler {
- constructor(sourceName, targetName, comObj) {
+var MessageHandler = /*#__PURE__*/function () {
+ function MessageHandler(sourceName, targetName, comObj) {
+ var _this = this;
+
+ _classCallCheck(this, MessageHandler);
+
this.sourceName = sourceName;
this.targetName = targetName;
this.comObj = comObj;
@@ -45378,28 +57515,28 @@ class MessageHandler {
this.callbackCapabilities = Object.create(null);
this.actionHandler = Object.create(null);
- this._onComObjOnMessage = event => {
- const data = event.data;
+ this._onComObjOnMessage = function (event) {
+ var data = event.data;
- if (data.targetName !== this.sourceName) {
+ if (data.targetName !== _this.sourceName) {
return;
}
if (data.stream) {
- this._processStreamMessage(data);
+ _this._processStreamMessage(data);
return;
}
if (data.callback) {
- const callbackId = data.callbackId;
- const capability = this.callbackCapabilities[callbackId];
+ var callbackId = data.callbackId;
+ var capability = _this.callbackCapabilities[callbackId];
if (!capability) {
- throw new Error(`Cannot resolve callback ${callbackId}`);
+ throw new Error("Cannot resolve callback ".concat(callbackId));
}
- delete this.callbackCapabilities[callbackId];
+ delete _this.callbackCapabilities[callbackId];
if (data.callback === CallbackKind.DATA) {
capability.resolve(data.data);
@@ -45412,15 +57549,15 @@ class MessageHandler {
return;
}
- const action = this.actionHandler[data.action];
+ var action = _this.actionHandler[data.action];
if (!action) {
- throw new Error(`Unknown action from worker: ${data.action}`);
+ throw new Error("Unknown action from worker: ".concat(data.action));
}
if (data.callbackId) {
- const cbSourceName = this.sourceName;
- const cbTargetName = data.sourceName;
+ var cbSourceName = _this.sourceName;
+ var cbTargetName = data.sourceName;
new Promise(function (resolve) {
resolve(action(data.data));
}).then(function (result) {
@@ -45444,7 +57581,7 @@ class MessageHandler {
}
if (data.streamId) {
- this._createStreamSink(data);
+ _this._createStreamSink(data);
return;
}
@@ -45455,365 +57592,397 @@ class MessageHandler {
comObj.addEventListener("message", this._onComObjOnMessage);
}
- on(actionName, handler) {
- const ah = this.actionHandler;
+ _createClass(MessageHandler, [{
+ key: "on",
+ value: function on(actionName, handler) {
+ var ah = this.actionHandler;
- if (ah[actionName]) {
- throw new Error(`There is already an actionName called "${actionName}"`);
- }
-
- ah[actionName] = handler;
- }
-
- send(actionName, data, transfers) {
- this._postMessage({
- sourceName: this.sourceName,
- targetName: this.targetName,
- action: actionName,
- data
- }, transfers);
- }
-
- sendWithPromise(actionName, data, transfers) {
- const callbackId = this.callbackId++;
- const capability = (0, _util.createPromiseCapability)();
- this.callbackCapabilities[callbackId] = capability;
+ if (ah[actionName]) {
+ throw new Error("There is already an actionName called \"".concat(actionName, "\""));
+ }
- try {
+ ah[actionName] = handler;
+ }
+ }, {
+ key: "send",
+ value: function send(actionName, data, transfers) {
this._postMessage({
sourceName: this.sourceName,
targetName: this.targetName,
action: actionName,
- callbackId,
- data
+ data: data
}, transfers);
- } catch (ex) {
- capability.reject(ex);
- }
-
- return capability.promise;
- }
-
- sendWithStream(actionName, data, queueingStrategy, transfers) {
- const streamId = this.streamId++;
- const sourceName = this.sourceName;
- const targetName = this.targetName;
- const comObj = this.comObj;
- return new ReadableStream({
- start: controller => {
- const startCapability = (0, _util.createPromiseCapability)();
- this.streamControllers[streamId] = {
- controller,
- startCall: startCapability,
- pullCall: null,
- cancelCall: null,
- isClosed: false
- };
+ }
+ }, {
+ key: "sendWithPromise",
+ value: function sendWithPromise(actionName, data, transfers) {
+ var callbackId = this.callbackId++;
+ var capability = (0, _util.createPromiseCapability)();
+ this.callbackCapabilities[callbackId] = capability;
+ try {
this._postMessage({
- sourceName,
- targetName,
+ sourceName: this.sourceName,
+ targetName: this.targetName,
action: actionName,
- streamId,
- data,
- desiredSize: controller.desiredSize
+ callbackId: callbackId,
+ data: data
}, transfers);
-
- return startCapability.promise;
- },
- pull: controller => {
- const pullCapability = (0, _util.createPromiseCapability)();
- this.streamControllers[streamId].pullCall = pullCapability;
- comObj.postMessage({
- sourceName,
- targetName,
- stream: StreamKind.PULL,
- streamId,
- desiredSize: controller.desiredSize
- });
- return pullCapability.promise;
- },
- cancel: reason => {
- (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
- const cancelCapability = (0, _util.createPromiseCapability)();
- this.streamControllers[streamId].cancelCall = cancelCapability;
- this.streamControllers[streamId].isClosed = true;
- comObj.postMessage({
- sourceName,
- targetName,
- stream: StreamKind.CANCEL,
- streamId,
- reason: wrapReason(reason)
- });
- return cancelCapability.promise;
+ } catch (ex) {
+ capability.reject(ex);
}
- }, queueingStrategy);
- }
-
- _createStreamSink(data) {
- const self = this;
- const action = this.actionHandler[data.action];
- const streamId = data.streamId;
- const sourceName = this.sourceName;
- const targetName = data.sourceName;
- const comObj = this.comObj;
- const streamSink = {
- enqueue(chunk, size = 1, transfers) {
- if (this.isCancelled) {
- return;
- }
- const lastDesiredSize = this.desiredSize;
- this.desiredSize -= size;
+ return capability.promise;
+ }
+ }, {
+ key: "sendWithStream",
+ value: function sendWithStream(actionName, data, queueingStrategy, transfers) {
+ var _this2 = this;
+
+ var streamId = this.streamId++;
+ var sourceName = this.sourceName;
+ var targetName = this.targetName;
+ var comObj = this.comObj;
+ return new ReadableStream({
+ start: function start(controller) {
+ var startCapability = (0, _util.createPromiseCapability)();
+ _this2.streamControllers[streamId] = {
+ controller: controller,
+ startCall: startCapability,
+ pullCall: null,
+ cancelCall: null,
+ isClosed: false
+ };
- if (lastDesiredSize > 0 && this.desiredSize <= 0) {
- this.sinkCapability = (0, _util.createPromiseCapability)();
- this.ready = this.sinkCapability.promise;
+ _this2._postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ action: actionName,
+ streamId: streamId,
+ data: data,
+ desiredSize: controller.desiredSize
+ }, transfers);
+
+ return startCapability.promise;
+ },
+ pull: function pull(controller) {
+ var pullCapability = (0, _util.createPromiseCapability)();
+ _this2.streamControllers[streamId].pullCall = pullCapability;
+ comObj.postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.PULL,
+ streamId: streamId,
+ desiredSize: controller.desiredSize
+ });
+ return pullCapability.promise;
+ },
+ cancel: function cancel(reason) {
+ (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
+ var cancelCapability = (0, _util.createPromiseCapability)();
+ _this2.streamControllers[streamId].cancelCall = cancelCapability;
+ _this2.streamControllers[streamId].isClosed = true;
+ comObj.postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.CANCEL,
+ streamId: streamId,
+ reason: wrapReason(reason)
+ });
+ return cancelCapability.promise;
}
+ }, queueingStrategy);
+ }
+ }, {
+ key: "_createStreamSink",
+ value: function _createStreamSink(data) {
+ var self = this;
+ var action = this.actionHandler[data.action];
+ var streamId = data.streamId;
+ var sourceName = this.sourceName;
+ var targetName = data.sourceName;
+ var comObj = this.comObj;
+ var streamSink = {
+ enqueue: function enqueue(chunk) {
+ var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
+ var transfers = arguments.length > 2 ? arguments[2] : undefined;
+
+ if (this.isCancelled) {
+ return;
+ }
- self._postMessage({
- sourceName,
- targetName,
- stream: StreamKind.ENQUEUE,
- streamId,
- chunk
- }, transfers);
- },
+ var lastDesiredSize = this.desiredSize;
+ this.desiredSize -= size;
- close() {
- if (this.isCancelled) {
- return;
- }
+ if (lastDesiredSize > 0 && this.desiredSize <= 0) {
+ this.sinkCapability = (0, _util.createPromiseCapability)();
+ this.ready = this.sinkCapability.promise;
+ }
- this.isCancelled = true;
- comObj.postMessage({
- sourceName,
- targetName,
- stream: StreamKind.CLOSE,
- streamId
- });
- delete self.streamSinks[streamId];
- },
+ self._postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.ENQUEUE,
+ streamId: streamId,
+ chunk: chunk
+ }, transfers);
+ },
+ close: function close() {
+ if (this.isCancelled) {
+ return;
+ }
- error(reason) {
- (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
+ this.isCancelled = true;
+ comObj.postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.CLOSE,
+ streamId: streamId
+ });
+ delete self.streamSinks[streamId];
+ },
+ error: function error(reason) {
+ (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
- if (this.isCancelled) {
- return;
- }
+ if (this.isCancelled) {
+ return;
+ }
- this.isCancelled = true;
+ this.isCancelled = true;
+ comObj.postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.ERROR,
+ streamId: streamId,
+ reason: wrapReason(reason)
+ });
+ },
+ sinkCapability: (0, _util.createPromiseCapability)(),
+ onPull: null,
+ onCancel: null,
+ isCancelled: false,
+ desiredSize: data.desiredSize,
+ ready: null
+ };
+ streamSink.sinkCapability.resolve();
+ streamSink.ready = streamSink.sinkCapability.promise;
+ this.streamSinks[streamId] = streamSink;
+ new Promise(function (resolve) {
+ resolve(action(data.data, streamSink));
+ }).then(function () {
+ comObj.postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.START_COMPLETE,
+ streamId: streamId,
+ success: true
+ });
+ }, function (reason) {
comObj.postMessage({
- sourceName,
- targetName,
- stream: StreamKind.ERROR,
- streamId,
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.START_COMPLETE,
+ streamId: streamId,
reason: wrapReason(reason)
});
- },
-
- sinkCapability: (0, _util.createPromiseCapability)(),
- onPull: null,
- onCancel: null,
- isCancelled: false,
- desiredSize: data.desiredSize,
- ready: null
- };
- streamSink.sinkCapability.resolve();
- streamSink.ready = streamSink.sinkCapability.promise;
- this.streamSinks[streamId] = streamSink;
- new Promise(function (resolve) {
- resolve(action(data.data, streamSink));
- }).then(function () {
- comObj.postMessage({
- sourceName,
- targetName,
- stream: StreamKind.START_COMPLETE,
- streamId,
- success: true
- });
- }, function (reason) {
- comObj.postMessage({
- sourceName,
- targetName,
- stream: StreamKind.START_COMPLETE,
- streamId,
- reason: wrapReason(reason)
});
- });
- }
+ }
+ }, {
+ key: "_processStreamMessage",
+ value: function _processStreamMessage(data) {
+ var streamId = data.streamId;
+ var sourceName = this.sourceName;
+ var targetName = data.sourceName;
+ var comObj = this.comObj;
+
+ switch (data.stream) {
+ case StreamKind.START_COMPLETE:
+ if (data.success) {
+ this.streamControllers[streamId].startCall.resolve();
+ } else {
+ this.streamControllers[streamId].startCall.reject(wrapReason(data.reason));
+ }
- _processStreamMessage(data) {
- const streamId = data.streamId;
- const sourceName = this.sourceName;
- const targetName = data.sourceName;
- const comObj = this.comObj;
+ break;
- switch (data.stream) {
- case StreamKind.START_COMPLETE:
- if (data.success) {
- this.streamControllers[streamId].startCall.resolve();
- } else {
- this.streamControllers[streamId].startCall.reject(wrapReason(data.reason));
- }
+ case StreamKind.PULL_COMPLETE:
+ if (data.success) {
+ this.streamControllers[streamId].pullCall.resolve();
+ } else {
+ this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason));
+ }
- break;
+ break;
- case StreamKind.PULL_COMPLETE:
- if (data.success) {
- this.streamControllers[streamId].pullCall.resolve();
- } else {
- this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason));
- }
+ case StreamKind.PULL:
+ if (!this.streamSinks[streamId]) {
+ comObj.postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.PULL_COMPLETE,
+ streamId: streamId,
+ success: true
+ });
+ break;
+ }
- break;
+ if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) {
+ this.streamSinks[streamId].sinkCapability.resolve();
+ }
- case StreamKind.PULL:
- if (!this.streamSinks[streamId]) {
- comObj.postMessage({
- sourceName,
- targetName,
- stream: StreamKind.PULL_COMPLETE,
- streamId,
- success: true
+ this.streamSinks[streamId].desiredSize = data.desiredSize;
+ var onPull = this.streamSinks[data.streamId].onPull;
+ new Promise(function (resolve) {
+ resolve(onPull && onPull());
+ }).then(function () {
+ comObj.postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.PULL_COMPLETE,
+ streamId: streamId,
+ success: true
+ });
+ }, function (reason) {
+ comObj.postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.PULL_COMPLETE,
+ streamId: streamId,
+ reason: wrapReason(reason)
+ });
});
break;
- }
- if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) {
- this.streamSinks[streamId].sinkCapability.resolve();
- }
-
- this.streamSinks[streamId].desiredSize = data.desiredSize;
- const {
- onPull
- } = this.streamSinks[data.streamId];
- new Promise(function (resolve) {
- resolve(onPull && onPull());
- }).then(function () {
- comObj.postMessage({
- sourceName,
- targetName,
- stream: StreamKind.PULL_COMPLETE,
- streamId,
- success: true
- });
- }, function (reason) {
- comObj.postMessage({
- sourceName,
- targetName,
- stream: StreamKind.PULL_COMPLETE,
- streamId,
- reason: wrapReason(reason)
- });
- });
- break;
+ case StreamKind.ENQUEUE:
+ (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller");
- case StreamKind.ENQUEUE:
- (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller");
+ if (this.streamControllers[streamId].isClosed) {
+ break;
+ }
- if (this.streamControllers[streamId].isClosed) {
+ this.streamControllers[streamId].controller.enqueue(data.chunk);
break;
- }
-
- this.streamControllers[streamId].controller.enqueue(data.chunk);
- break;
- case StreamKind.CLOSE:
- (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller");
+ case StreamKind.CLOSE:
+ (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller");
- if (this.streamControllers[streamId].isClosed) {
- break;
- }
+ if (this.streamControllers[streamId].isClosed) {
+ break;
+ }
- this.streamControllers[streamId].isClosed = true;
- this.streamControllers[streamId].controller.close();
+ this.streamControllers[streamId].isClosed = true;
+ this.streamControllers[streamId].controller.close();
- this._deleteStreamController(streamId);
+ this._deleteStreamController(streamId);
- break;
+ break;
- case StreamKind.ERROR:
- (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller");
- this.streamControllers[streamId].controller.error(wrapReason(data.reason));
+ case StreamKind.ERROR:
+ (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller");
+ this.streamControllers[streamId].controller.error(wrapReason(data.reason));
- this._deleteStreamController(streamId);
+ this._deleteStreamController(streamId);
- break;
-
- case StreamKind.CANCEL_COMPLETE:
- if (data.success) {
- this.streamControllers[streamId].cancelCall.resolve();
- } else {
- this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
- }
+ break;
- this._deleteStreamController(streamId);
+ case StreamKind.CANCEL_COMPLETE:
+ if (data.success) {
+ this.streamControllers[streamId].cancelCall.resolve();
+ } else {
+ this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
+ }
- break;
+ this._deleteStreamController(streamId);
- case StreamKind.CANCEL:
- if (!this.streamSinks[streamId]) {
break;
- }
- const {
- onCancel
- } = this.streamSinks[data.streamId];
- new Promise(function (resolve) {
- resolve(onCancel && onCancel(wrapReason(data.reason)));
- }).then(function () {
- comObj.postMessage({
- sourceName,
- targetName,
- stream: StreamKind.CANCEL_COMPLETE,
- streamId,
- success: true
- });
- }, function (reason) {
- comObj.postMessage({
- sourceName,
- targetName,
- stream: StreamKind.CANCEL_COMPLETE,
- streamId,
- reason: wrapReason(reason)
+ case StreamKind.CANCEL:
+ if (!this.streamSinks[streamId]) {
+ break;
+ }
+
+ var onCancel = this.streamSinks[data.streamId].onCancel;
+ new Promise(function (resolve) {
+ resolve(onCancel && onCancel(wrapReason(data.reason)));
+ }).then(function () {
+ comObj.postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.CANCEL_COMPLETE,
+ streamId: streamId,
+ success: true
+ });
+ }, function (reason) {
+ comObj.postMessage({
+ sourceName: sourceName,
+ targetName: targetName,
+ stream: StreamKind.CANCEL_COMPLETE,
+ streamId: streamId,
+ reason: wrapReason(reason)
+ });
});
- });
- this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason));
- this.streamSinks[streamId].isCancelled = true;
- delete this.streamSinks[streamId];
- break;
+ this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason));
+ this.streamSinks[streamId].isCancelled = true;
+ delete this.streamSinks[streamId];
+ break;
- default:
- throw new Error("Unexpected stream case");
+ default:
+ throw new Error("Unexpected stream case");
+ }
}
- }
+ }, {
+ key: "_deleteStreamController",
+ value: function () {
+ var _deleteStreamController2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(streamId) {
+ return _regenerator["default"].wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ _context.next = 2;
+ return Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
+ return capability && capability.promise;
+ }));
- async _deleteStreamController(streamId) {
- await Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
- return capability && capability.promise;
- }));
- delete this.streamControllers[streamId];
- }
+ case 2:
+ delete this.streamControllers[streamId];
- _postMessage(message, transfers) {
- if (transfers && this.postMessageTransfers) {
- this.comObj.postMessage(message, transfers);
- } else {
- this.comObj.postMessage(message);
- }
- }
+ case 3:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee, this);
+ }));
- destroy() {
- this.comObj.removeEventListener("message", this._onComObjOnMessage);
- }
+ function _deleteStreamController(_x) {
+ return _deleteStreamController2.apply(this, arguments);
+ }
-}
+ return _deleteStreamController;
+ }()
+ }, {
+ key: "_postMessage",
+ value: function _postMessage(message, transfers) {
+ if (transfers && this.postMessageTransfers) {
+ this.comObj.postMessage(message, transfers);
+ } else {
+ this.comObj.postMessage(message);
+ }
+ }
+ }, {
+ key: "destroy",
+ value: function destroy() {
+ this.comObj.removeEventListener("message", this._onComObjOnMessage);
+ }
+ }]);
+
+ return MessageHandler;
+}();
exports.MessageHandler = MessageHandler;
/***/ }),
-/* 46 */
+/* 239 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@@ -45824,146 +57993,245 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFWorkerStream = void 0;
-var _util = __w_pdfjs_require__(2);
+var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
+
+var _util = __w_pdfjs_require__(5);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
+
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var PDFWorkerStream = /*#__PURE__*/function () {
+ function PDFWorkerStream(msgHandler) {
+ _classCallCheck(this, PDFWorkerStream);
-class PDFWorkerStream {
- constructor(msgHandler) {
this._msgHandler = msgHandler;
this._contentLength = null;
this._fullRequestReader = null;
this._rangeRequestReaders = [];
}
- getFullReader() {
- (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
- this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
- return this._fullRequestReader;
- }
+ _createClass(PDFWorkerStream, [{
+ key: "getFullReader",
+ value: function getFullReader() {
+ (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
+ this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
+ return this._fullRequestReader;
+ }
+ }, {
+ key: "getRangeReader",
+ value: function getRangeReader(begin, end) {
+ var reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
- getRangeReader(begin, end) {
- const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
+ this._rangeRequestReaders.push(reader);
- this._rangeRequestReaders.push(reader);
+ return reader;
+ }
+ }, {
+ key: "cancelAllRequests",
+ value: function cancelAllRequests(reason) {
+ if (this._fullRequestReader) {
+ this._fullRequestReader.cancel(reason);
+ }
- return reader;
- }
+ var readers = this._rangeRequestReaders.slice(0);
- cancelAllRequests(reason) {
- if (this._fullRequestReader) {
- this._fullRequestReader.cancel(reason);
+ readers.forEach(function (reader) {
+ reader.cancel(reason);
+ });
}
+ }]);
- const readers = this._rangeRequestReaders.slice(0);
+ return PDFWorkerStream;
+}();
- readers.forEach(function (reader) {
- reader.cancel(reason);
- });
- }
+exports.PDFWorkerStream = PDFWorkerStream;
-}
+var PDFWorkerStreamReader = /*#__PURE__*/function () {
+ function PDFWorkerStreamReader(msgHandler) {
+ var _this = this;
-exports.PDFWorkerStream = PDFWorkerStream;
+ _classCallCheck(this, PDFWorkerStreamReader);
-class PDFWorkerStreamReader {
- constructor(msgHandler) {
this._msgHandler = msgHandler;
this.onProgress = null;
this._contentLength = null;
this._isRangeSupported = false;
this._isStreamingSupported = false;
- const readableStream = this._msgHandler.sendWithStream("GetReader");
+ var readableStream = this._msgHandler.sendWithStream("GetReader");
this._reader = readableStream.getReader();
- this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
- this._isStreamingSupported = data.isStreamingSupported;
- this._isRangeSupported = data.isRangeSupported;
- this._contentLength = data.contentLength;
+ this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(function (data) {
+ _this._isStreamingSupported = data.isStreamingSupported;
+ _this._isRangeSupported = data.isRangeSupported;
+ _this._contentLength = data.contentLength;
});
}
- get headersReady() {
- return this._headersReady;
- }
+ _createClass(PDFWorkerStreamReader, [{
+ key: "read",
+ value: function () {
+ var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
+ var _yield$this$_reader$r, value, done;
- get contentLength() {
- return this._contentLength;
- }
+ return _regenerator["default"].wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ _context.next = 2;
+ return this._reader.read();
- get isStreamingSupported() {
- return this._isStreamingSupported;
- }
+ case 2:
+ _yield$this$_reader$r = _context.sent;
+ value = _yield$this$_reader$r.value;
+ done = _yield$this$_reader$r.done;
- get isRangeSupported() {
- return this._isRangeSupported;
- }
+ if (!done) {
+ _context.next = 7;
+ break;
+ }
- async read() {
- const {
- value,
- done
- } = await this._reader.read();
+ return _context.abrupt("return", {
+ value: undefined,
+ done: true
+ });
- if (done) {
- return {
- value: undefined,
- done: true
- };
- }
+ case 7:
+ return _context.abrupt("return", {
+ value: value.buffer,
+ done: false
+ });
- return {
- value: value.buffer,
- done: false
- };
- }
+ case 8:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee, this);
+ }));
- cancel(reason) {
- this._reader.cancel(reason);
- }
+ function read() {
+ return _read.apply(this, arguments);
+ }
-}
+ return read;
+ }()
+ }, {
+ key: "cancel",
+ value: function cancel(reason) {
+ this._reader.cancel(reason);
+ }
+ }, {
+ key: "headersReady",
+ get: function get() {
+ return this._headersReady;
+ }
+ }, {
+ key: "contentLength",
+ get: function get() {
+ return this._contentLength;
+ }
+ }, {
+ key: "isStreamingSupported",
+ get: function get() {
+ return this._isStreamingSupported;
+ }
+ }, {
+ key: "isRangeSupported",
+ get: function get() {
+ return this._isRangeSupported;
+ }
+ }]);
+
+ return PDFWorkerStreamReader;
+}();
+
+var PDFWorkerStreamRangeReader = /*#__PURE__*/function () {
+ function PDFWorkerStreamRangeReader(begin, end, msgHandler) {
+ _classCallCheck(this, PDFWorkerStreamRangeReader);
-class PDFWorkerStreamRangeReader {
- constructor(begin, end, msgHandler) {
this._msgHandler = msgHandler;
this.onProgress = null;
- const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
- begin,
- end
+ var readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
+ begin: begin,
+ end: end
});
this._reader = readableStream.getReader();
}
- get isStreamingSupported() {
- return false;
- }
+ _createClass(PDFWorkerStreamRangeReader, [{
+ key: "read",
+ value: function () {
+ var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
+ var _yield$this$_reader$r2, value, done;
+
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
+ while (1) {
+ switch (_context2.prev = _context2.next) {
+ case 0:
+ _context2.next = 2;
+ return this._reader.read();
- async read() {
- const {
- value,
- done
- } = await this._reader.read();
+ case 2:
+ _yield$this$_reader$r2 = _context2.sent;
+ value = _yield$this$_reader$r2.value;
+ done = _yield$this$_reader$r2.done;
- if (done) {
- return {
- value: undefined,
- done: true
- };
- }
+ if (!done) {
+ _context2.next = 7;
+ break;
+ }
- return {
- value: value.buffer,
- done: false
- };
- }
+ return _context2.abrupt("return", {
+ value: undefined,
+ done: true
+ });
- cancel(reason) {
- this._reader.cancel(reason);
- }
+ case 7:
+ return _context2.abrupt("return", {
+ value: value.buffer,
+ done: false
+ });
-}
+ case 8:
+ case "end":
+ return _context2.stop();
+ }
+ }
+ }, _callee2, this);
+ }));
+
+ function read() {
+ return _read2.apply(this, arguments);
+ }
+
+ return read;
+ }()
+ }, {
+ key: "cancel",
+ value: function cancel(reason) {
+ this._reader.cancel(reason);
+ }
+ }, {
+ key: "isStreamingSupported",
+ get: function get() {
+ return false;
+ }
+ }]);
+
+ return PDFWorkerStreamRangeReader;
+}();
/***/ })
/******/ ]);