Socket
Socket
Sign inDemoInstall

pdfjs-dist

Package Overview
Dependencies
0
Maintainers
3
Versions
1538
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.4.456 to 2.5.207

2

bower.json
{
"name": "pdfjs-dist",
"version": "2.4.456",
"version": "2.5.207",
"main": [

@@ -5,0 +5,0 @@ "build/pdf.js",

@@ -57,8 +57,8 @@ /**

this.eof = false;
this.encoding = options["K"] || 0;
this.eoline = options["EndOfLine"] || false;
this.byteAlign = options["EncodedByteAlign"] || false;
this.columns = options["Columns"] || 1728;
this.rows = options["Rows"] || 0;
let eoblock = options["EndOfBlock"];
this.encoding = options.K || 0;
this.eoline = options.EndOfLine || false;
this.byteAlign = options.EncodedByteAlign || false;
this.columns = options.Columns || 1728;
this.rows = options.Rows || 0;
let eoblock = options.EndOfBlock;

@@ -70,3 +70,3 @@ if (eoblock === null || eoblock === undefined) {

this.eoblock = eoblock;
this.black = options["BlackIs1"] || false;
this.black = options.BlackIs1 || false;
this.codingLine = new Uint32Array(this.columns + 1);

@@ -73,0 +73,0 @@ this.refLine = new Uint32Array(this.columns + 2);

@@ -802,3 +802,3 @@ /**

var format = bytes[pos++];
var charset = [".notdef"];
const charset = [cid ? 0 : ".notdef"];
var id, count, i;

@@ -805,0 +805,0 @@ length -= 1;

@@ -553,5 +553,5 @@ /**

for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
const requestIds = this.requestsByChunk[chunk] || [];
delete this.requestsByChunk[chunk];
for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
const requestIds = this.requestsByChunk[curChunk] || [];
delete this.requestsByChunk[curChunk];

@@ -561,4 +561,4 @@ for (const requestId of requestIds) {

if (chunk in chunksNeeded) {
delete chunksNeeded[chunk];
if (curChunk in chunksNeeded) {
delete chunksNeeded[curChunk];
}

@@ -565,0 +565,0 @@

@@ -40,2 +40,3 @@ /**

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;

@@ -59,2 +60,6 @@ class CMap {

mapCidRange(low, high, dstLow) {
if (high - low > MAX_MAP_RANGE) {
throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
}
while (low <= high) {

@@ -66,2 +71,6 @@ this._map[low++] = dstLow++;

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;

@@ -76,2 +85,6 @@

mapBfRangeToArray(low, high, array) {
if (high - low > MAX_MAP_RANGE) {
throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
}
const ii = array.length;

@@ -78,0 +91,0 @@ let i = 0;

@@ -67,2 +67,3 @@ /**

builtInCMapCache,
globalImageCache,
pdfFunctionFactory

@@ -77,2 +78,3 @@ }) {

this.builtInCMapCache = builtInCMapCache;
this.globalImageCache = globalImageCache;
this.pdfFunctionFactory = pdfFunctionFactory;

@@ -199,4 +201,4 @@ this.evaluatorOptions = pdfManager.evaluatorOptions;

for (const stream of content) {
streams.push(xref.fetchIfRef(stream));
for (const subStream of content) {
streams.push(xref.fetchIfRef(subStream));
}

@@ -241,2 +243,3 @@

builtInCMapCache: this.builtInCMapCache,
globalImageCache: this.globalImageCache,
options: this.evaluatorOptions,

@@ -274,3 +277,6 @@ pdfFunctionFactory: this.pdfFunctionFactory

if (isAnnotationRenderable(annotation, intent)) {
opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms));
opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms).catch(function (reason) {
(0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
return null;
}));
}

@@ -313,2 +319,3 @@ }

builtInCMapCache: this.builtInCMapCache,
globalImageCache: this.globalImageCache,
options: this.evaluatorOptions,

@@ -348,16 +355,13 @@ pdfFunctionFactory: this.pdfFunctionFactory

const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
const annotationRefs = this.annotations;
const annotationPromises = [];
for (let i = 0, ii = annotationRefs.length; i < ii; i++) {
annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRefs[i], this.pdfManager, this.idFactory));
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;
}));
}
return Promise.all(annotationPromises).then(function (annotations) {
return annotations.filter(function isDefined(annotation) {
return !!annotation;
});
}, function (reason) {
(0, _util.warn)(`_parsedAnnotations: "${reason}".`);
return [];
return annotations.filter(annotation => !!annotation);
});

@@ -666,7 +670,7 @@ });

if (!docInfo["Custom"]) {
docInfo["Custom"] = Object.create(null);
if (!docInfo.Custom) {
docInfo.Custom = Object.create(null);
}
docInfo["Custom"][key] = customValue;
docInfo.Custom[key] = customValue;
}

@@ -704,3 +708,2 @@ }

} = this;
(0, _util.assert)(linearization && linearization.pageFirst === pageIndex);

@@ -744,2 +747,3 @@ const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);

builtInCMapCache: catalog.builtInCMapCache,
globalImageCache: catalog.globalImageCache,
pdfFunctionFactory: this.pdfFunctionFactory

@@ -764,4 +768,4 @@ });

async cleanup() {
return this.catalog ? this.catalog.cleanup() : (0, _primitives.clearPrimitiveCaches)();
async cleanup(manuallyTriggered = false) {
return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)();
}

@@ -768,0 +772,0 @@

@@ -388,8 +388,3 @@ /**

function compileCharString(code, cmds, font, glyphId) {
var stack = [];
var x = 0,
y = 0;
var stems = 0;
function compileCharString(charStringCode, cmds, font, glyphId) {
function moveTo(x, y) {

@@ -416,2 +411,7 @@ cmds.push({

var stack = [];
var x = 0,
y = 0;
var stems = 0;
function parse(code) {

@@ -824,3 +824,3 @@ var i = 0;

parse(code);
parse(charStringCode);
}

@@ -827,0 +827,0 @@

@@ -76,4 +76,4 @@ /**

for (let i = 0; i < length; i++) {
result[i] = +arr[i];
for (let j = 0; j < length; j++) {
result[j] = +arr[j];
}

@@ -1166,3 +1166,2 @@

var stack = [];
var i, ii;
var instructions = [];

@@ -1175,7 +1174,7 @@ var inputSize = domain.length >> 1,

for (i = 0; i < inputSize; i++) {
for (let i = 0; i < inputSize; i++) {
stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
}
for (i = 0, ii = code.length; i < ii; i++) {
for (let i = 0, ii = code.length; i < ii; i++) {
item = code[i];

@@ -1182,0 +1181,0 @@

@@ -27,69 +27,145 @@ /**

});
exports.NativeImageDecoder = void 0;
exports.GlobalImageCache = exports.LocalImageCache = void 0;
var _colorspace = require("./colorspace.js");
var _util = require("../shared/util.js");
var _jpeg_stream = require("./jpeg_stream.js");
var _primitives = require("./primitives.js");
var _stream = require("./stream.js");
class LocalImageCache {
constructor() {
this._nameRefMap = new Map();
this._imageMap = new Map();
this._imageCache = new _primitives.RefSetCache();
}
class NativeImageDecoder {
constructor({
xref,
resources,
handler,
forceDataSchema = false,
pdfFunctionFactory
}) {
this.xref = xref;
this.resources = resources;
this.handler = handler;
this.forceDataSchema = forceDataSchema;
this.pdfFunctionFactory = pdfFunctionFactory;
getByName(name) {
const ref = this._nameRefMap.get(name);
if (ref) {
return this.getByRef(ref);
}
return this._imageMap.get(name) || null;
}
canDecode(image) {
return image instanceof _jpeg_stream.JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources, this.pdfFunctionFactory) && image.maybeValidDimensions;
getByRef(ref) {
return this._imageCache.get(ref) || null;
}
decode(image) {
const dict = image.dict;
let colorSpace = dict.get("ColorSpace", "CS");
colorSpace = _colorspace.ColorSpace.parse(colorSpace, this.xref, this.resources, this.pdfFunctionFactory);
return this.handler.sendWithPromise("JpegDecode", [image.getIR(this.forceDataSchema), colorSpace.numComps]).then(function ({
data,
width,
height
}) {
return new _stream.Stream(data, 0, data.length, dict);
});
set(name, ref = null, data) {
if (!name) {
throw new Error('LocalImageCache.set - expected "name" argument.');
}
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;
}
this._imageMap.set(name, data);
}
static isSupported(image, xref, res, pdfFunctionFactory) {
const dict = image.dict;
}
if (dict.has("DecodeParms") || dict.has("DP")) {
exports.LocalImageCache = LocalImageCache;
class GlobalImageCache {
static get NUM_PAGES_THRESHOLD() {
return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
}
static get MAX_IMAGES_TO_CACHE() {
return (0, _util.shadow)(this, "MAX_IMAGES_TO_CACHE", 10);
}
constructor() {
this._refCache = new _primitives.RefSetCache();
this._imageCache = new _primitives.RefSetCache();
}
shouldCache(ref, pageIndex) {
const pageIndexSet = this._refCache.get(ref);
const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
return false;
}
const cs = _colorspace.ColorSpace.parse(dict.get("ColorSpace", "CS"), xref, res, pdfFunctionFactory);
if (!this._imageCache.has(ref) && this._imageCache.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) {
return false;
}
return (cs.name === "DeviceGray" || cs.name === "DeviceRGB") && cs.isDefaultDecode(dict.getArray("Decode", "D"));
return true;
}
static isDecodable(image, xref, res, pdfFunctionFactory) {
const dict = image.dict;
addPageIndex(ref, pageIndex) {
let pageIndexSet = this._refCache.get(ref);
if (dict.has("DecodeParms") || dict.has("DP")) {
return false;
if (!pageIndexSet) {
pageIndexSet = new Set();
this._refCache.put(ref, pageIndexSet);
}
const cs = _colorspace.ColorSpace.parse(dict.get("ColorSpace", "CS"), xref, res, pdfFunctionFactory);
pageIndexSet.add(pageIndex);
}
const bpc = dict.get("BitsPerComponent", "BPC") || 1;
return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray("Decode", "D"), bpc);
getData(ref, pageIndex) {
if (!this._refCache.has(ref)) {
return null;
}
const pageIndexSet = this._refCache.get(ref);
if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
return null;
}
if (!this._imageCache.has(ref)) {
return null;
}
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.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) {
(0, _util.info)("GlobalImageCache.setData - ignoring image above MAX_IMAGES_TO_CACHE.");
return;
}
this._imageCache.put(ref, data);
}
clear(onlyData = false) {
if (!onlyData) {
this._refCache.clear();
}
this._imageCache.clear();
}
}
exports.NativeImageDecoder = NativeImageDecoder;
exports.GlobalImageCache = GlobalImageCache;

@@ -42,13 +42,2 @@ /**

var PDFImage = function PDFImageClosure() {
function handleImageData(image, nativeDecoder) {
if (nativeDecoder && nativeDecoder.canDecode(image)) {
return nativeDecoder.decode(image).catch(reason => {
(0, _util.warn)("Native image decoding failed -- trying to recover: " + (reason && reason.message));
return image;
});
}
return Promise.resolve(image);
}
function decodeAndClamp(value, addend, coefficient, max) {

@@ -250,3 +239,2 @@ value = addend + value * coefficient;

PDFImage.buildImage = function ({
handler,
xref,

@@ -256,42 +244,29 @@ res,

isInline = false,
nativeDecoder = null,
pdfFunctionFactory
}) {
var imagePromise = handleImageData(image, nativeDecoder);
var smaskPromise;
var maskPromise;
var smask = image.dict.get("SMask");
var mask = image.dict.get("Mask");
const imageData = image;
let smaskData = null;
let maskData = null;
const smask = image.dict.get("SMask");
const mask = image.dict.get("Mask");
if (smask) {
smaskPromise = handleImageData(smask, nativeDecoder);
maskPromise = Promise.resolve(null);
} else {
smaskPromise = Promise.resolve(null);
if (mask) {
if ((0, _primitives.isStream)(mask)) {
maskPromise = handleImageData(mask, nativeDecoder);
} else if (Array.isArray(mask)) {
maskPromise = Promise.resolve(mask);
} else {
(0, _util.warn)("Unsupported mask format.");
maskPromise = Promise.resolve(null);
}
smaskData = smask;
} else if (mask) {
if ((0, _primitives.isStream)(mask) || Array.isArray(mask)) {
maskData = mask;
} else {
maskPromise = Promise.resolve(null);
(0, _util.warn)("Unsupported mask format.");
}
}
return Promise.all([imagePromise, smaskPromise, maskPromise]).then(function ([imageData, smaskData, maskData]) {
return new PDFImage({
xref,
res,
image: imageData,
isInline,
smask: smaskData,
mask: maskData,
pdfFunctionFactory
});
});
return Promise.resolve(new PDFImage({
xref,
res,
image: imageData,
isInline,
smask: smaskData,
mask: maskData,
pdfFunctionFactory
}));
};

@@ -298,0 +273,0 @@

@@ -29,4 +29,2 @@ /**

var _util = require("../shared/util.js");
var _stream = require("./stream.js");

@@ -38,2 +36,4 @@

var _util = require("../shared/util.js");
const JpegStream = function JpegStreamClosure() {

@@ -121,116 +121,2 @@ function JpegStream(stream, maybeLength, dict, params) {

Object.defineProperty(JpegStream.prototype, "maybeValidDimensions", {
get: function JpegStream_maybeValidDimensions() {
const {
dict,
stream
} = this;
const dictHeight = dict.get("Height", "H");
const startPos = stream.pos;
let validDimensions = true,
foundSOF = false,
b;
while ((b = stream.getByte()) !== -1) {
if (b !== 0xff) {
continue;
}
switch (stream.getByte()) {
case 0xc0:
case 0xc1:
case 0xc2:
foundSOF = true;
stream.pos += 2;
stream.pos += 1;
const scanLines = stream.getUint16();
if (scanLines === dictHeight) {
break;
}
if (scanLines === 0) {
validDimensions = false;
break;
}
if (scanLines > dictHeight * 10) {
validDimensions = false;
break;
}
break;
case 0xc3:
case 0xc5:
case 0xc6:
case 0xc7:
case 0xc9:
case 0xca:
case 0xcb:
case 0xcd:
case 0xce:
case 0xcf:
foundSOF = true;
break;
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:
const markerLength = stream.getUint16();
if (markerLength > 2) {
stream.skip(markerLength - 2);
} else {
stream.skip(-2);
}
break;
case 0xff:
stream.skip(-1);
break;
case 0xd9:
foundSOF = true;
break;
}
if (foundSOF) {
break;
}
}
stream.pos = startPos;
return (0, _util.shadow)(this, "maybeValidDimensions", validDimensions);
},
configurable: true
});
JpegStream.prototype.getIR = function (forceDataSchema = false) {
return (0, _util.createObjectURL)(this.bytes, "image/jpeg", forceDataSchema);
};
return JpegStream;

@@ -237,0 +123,0 @@ }();

@@ -131,4 +131,4 @@ /**

var progressive = frame.progressive;
var startOffset = offset,
bitsData = 0,
const startOffset = offset;
let bitsData = 0,
bitsCount = 0;

@@ -219,6 +219,6 @@

function decodeBaseline(component, offset) {
function decodeBaseline(component, blockOffset) {
var t = decodeHuffman(component.huffmanTableDC);
var diff = t === 0 ? 0 : receiveAndExtend(t);
component.blockData[offset] = component.pred += diff;
component.blockData[blockOffset] = component.pred += diff;
var k = 1;

@@ -242,3 +242,3 @@

var z = dctZigZag[k];
component.blockData[offset + z] = receiveAndExtend(s);
component.blockData[blockOffset + z] = receiveAndExtend(s);
k++;

@@ -248,10 +248,10 @@ }

function decodeDCFirst(component, offset) {
function decodeDCFirst(component, blockOffset) {
var t = decodeHuffman(component.huffmanTableDC);
var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
component.blockData[offset] = component.pred += diff;
component.blockData[blockOffset] = component.pred += diff;
}
function decodeDCSuccessive(component, offset) {
component.blockData[offset] |= readBit() << successive;
function decodeDCSuccessive(component, blockOffset) {
component.blockData[blockOffset] |= readBit() << successive;
}

@@ -261,3 +261,3 @@

function decodeACFirst(component, offset) {
function decodeACFirst(component, blockOffset) {
if (eobrun > 0) {

@@ -288,3 +288,3 @@ eobrun--;

var z = dctZigZag[k];
component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
k++;

@@ -297,3 +297,3 @@ }

function decodeACSuccessive(component, offset) {
function decodeACSuccessive(component, blockOffset) {
var k = spectralStart;

@@ -306,3 +306,3 @@ var e = spectralEnd;

while (k <= e) {
const offsetZ = offset + dctZigZag[k];
const offsetZ = blockOffset + dctZigZag[k];
const sign = component.blockData[offsetZ] < 0 ? -1 : 1;

@@ -386,4 +386,4 @@

var blockCol = mcuCol * component.h + col;
var offset = getBlockBufferOffset(component, blockRow, blockCol);
decode(component, offset);
const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
decode(component, blockOffset);
}

@@ -394,4 +394,4 @@

var blockCol = mcu % component.blocksPerLine;
var offset = getBlockBufferOffset(component, blockRow, blockCol);
decode(component, offset);
const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
decode(component, blockOffset);
}

@@ -425,33 +425,35 @@

while (mcu < mcuExpected) {
while (mcu <= mcuExpected) {
var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
for (i = 0; i < componentsLength; i++) {
components[i].pred = 0;
}
if (mcuToRead > 0) {
for (i = 0; i < componentsLength; i++) {
components[i].pred = 0;
}
eobrun = 0;
eobrun = 0;
if (componentsLength === 1) {
component = components[0];
if (componentsLength === 1) {
component = components[0];
for (n = 0; n < mcuToRead; n++) {
decodeBlock(component, decodeFn, mcu);
mcu++;
}
} else {
for (n = 0; n < mcuToRead; n++) {
for (i = 0; i < componentsLength; i++) {
component = components[i];
h = component.h;
v = component.v;
for (n = 0; n < mcuToRead; n++) {
decodeBlock(component, decodeFn, mcu);
mcu++;
}
} else {
for (n = 0; n < mcuToRead; n++) {
for (i = 0; i < componentsLength; i++) {
component = components[i];
h = component.h;
v = component.v;
for (j = 0; j < v; j++) {
for (k = 0; k < h; k++) {
decodeMcu(component, decodeFn, mcu, j, k);
for (j = 0; j < v; j++) {
for (k = 0; k < h; k++) {
decodeMcu(component, decodeFn, mcu, j, k);
}
}
}
mcu++;
}
mcu++;
}

@@ -465,14 +467,11 @@ }

break;
} else if (fileMarker.invalid) {
(0, _util.warn)("decodeScan - unexpected MCU data, current marker is: " + fileMarker.invalid);
offset = fileMarker.offset;
}
var marker = fileMarker && fileMarker.marker;
if (!marker || marker <= 0xff00) {
throw new JpegError("decodeScan - a valid marker was not found.");
if (fileMarker.invalid) {
const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
(0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
offset = fileMarker.offset;
}
if (marker >= 0xffd0 && marker <= 0xffd7) {
if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
offset += 2;

@@ -484,9 +483,2 @@ } else {

fileMarker = findNextFileMarker(data, offset);
if (fileMarker && fileMarker.invalid) {
(0, _util.warn)("decodeScan - unexpected Scan data, current marker is: " + fileMarker.invalid);
offset = fileMarker.offset;
}
return offset - startOffset;

@@ -493,0 +485,0 @@ }

@@ -41,2 +41,4 @@ /**

var _image_utils = require("./image_utils.js");
function fetchDestination(dest) {

@@ -58,2 +60,3 @@ return (0, _primitives.isDict)(dest) ? dest.get("D") : dest;

this.builtInCMapCache = new Map();
this.globalImageCache = new _image_utils.GlobalImageCache();
this.pageKidsCountCache = new _primitives.RefSetCache();

@@ -489,3 +492,3 @@ }

const obj = this.catDict.get("ViewerPreferences");
const prefs = Object.create(null);
let prefs = null;

@@ -607,3 +610,6 @@ if ((0, _primitives.isDict)(obj)) {

default:
(0, _util.assert)(typeof value === "boolean");
if (typeof value !== "boolean") {
throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`);
}
prefValue = value;

@@ -613,2 +619,6 @@ }

if (prefValue !== undefined) {
if (!prefs) {
prefs = Object.create(null);
}
prefs[key] = prefValue;

@@ -750,4 +760,5 @@ } else {

cleanup() {
cleanup(manuallyTriggered = false) {
(0, _primitives.clearPrimitiveCaches)();
this.globalImageCache.clear(manuallyTriggered);
this.pageKidsCountCache.clear();

@@ -919,9 +930,9 @@ const promises = [];

kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
if (!(0, _primitives.isDict)(kid)) {
kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
if (!(0, _primitives.isDict)(obj)) {
throw new _util.FormatError("Kid node must be a dictionary.");
}
if (kid.has("Count")) {
total += kid.get("Count");
if (obj.has("Count")) {
total += obj.get("Count");
} else {

@@ -928,0 +939,0 @@ total++;

@@ -607,2 +607,7 @@ /**

addOpList(opList) {
if (!(opList instanceof OperatorList)) {
(0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
return;
}
Object.assign(this.dependencies, opList.dependencies);

@@ -609,0 +614,0 @@

@@ -213,3 +213,3 @@ /**

} else {
(0, _util.assert)(state === 2);
(0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");

@@ -216,0 +216,0 @@ if (ch === SPACE || ch === LF || ch === CR) {

@@ -94,4 +94,4 @@ /**

cleanup() {
return this.pdfDocument.cleanup();
cleanup(manuallyTriggered = false) {
return this.pdfDocument.cleanup(manuallyTriggered);
}

@@ -98,0 +98,0 @@

@@ -269,2 +269,6 @@ /**

RefSetCache.prototype = {
get size() {
return Object.keys(this.dict).length;
},
get: function RefSetCache_get(ref) {

@@ -271,0 +275,0 @@ return this.dict[ref.toString()];

@@ -32,7 +32,7 @@ /**

const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
t["ArialNarrow"] = "Helvetica";
t.ArialNarrow = "Helvetica";
t["ArialNarrow-Bold"] = "Helvetica-Bold";
t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
t["ArialNarrow-Italic"] = "Helvetica-Oblique";
t["ArialBlack"] = "Helvetica";
t.ArialBlack = "Helvetica";
t["ArialBlack-Bold"] = "Helvetica-Bold";

@@ -45,3 +45,3 @@ t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";

t["Arial-Black-Italic"] = "Helvetica-Oblique";
t["Arial"] = "Helvetica";
t.Arial = "Helvetica";
t["Arial-Bold"] = "Helvetica-Bold";

@@ -53,7 +53,7 @@ t["Arial-BoldItalic"] = "Helvetica-BoldOblique";

t["Arial-ItalicMT"] = "Helvetica-Oblique";
t["ArialMT"] = "Helvetica";
t.ArialMT = "Helvetica";
t["Courier-Bold"] = "Courier-Bold";
t["Courier-BoldItalic"] = "Courier-BoldOblique";
t["Courier-Italic"] = "Courier-Oblique";
t["CourierNew"] = "Courier";
t.CourierNew = "Courier";
t["CourierNew-Bold"] = "Courier-Bold";

@@ -65,4 +65,4 @@ t["CourierNew-BoldItalic"] = "Courier-BoldOblique";

t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
t["CourierNewPSMT"] = "Courier";
t["Helvetica"] = "Helvetica";
t.CourierNewPSMT = "Courier";
t.Helvetica = "Helvetica";
t["Helvetica-Bold"] = "Helvetica-Bold";

@@ -76,7 +76,7 @@ t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";

t["Symbol-Italic"] = "Symbol";
t["TimesNewRoman"] = "Times-Roman";
t.TimesNewRoman = "Times-Roman";
t["TimesNewRoman-Bold"] = "Times-Bold";
t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
t["TimesNewRoman-Italic"] = "Times-Italic";
t["TimesNewRomanPS"] = "Times-Roman";
t.TimesNewRomanPS = "Times-Roman";
t["TimesNewRomanPS-Bold"] = "Times-Bold";

@@ -88,3 +88,3 @@ t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";

t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
t["TimesNewRomanPSMT"] = "Times-Roman";
t.TimesNewRomanPSMT = "Times-Roman";
t["TimesNewRomanPSMT-Bold"] = "Times-Bold";

@@ -96,15 +96,15 @@ t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";

const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
t["Calibri"] = "Helvetica";
t.Calibri = "Helvetica";
t["Calibri-Bold"] = "Helvetica-Bold";
t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
t["Calibri-Italic"] = "Helvetica-Oblique";
t["CenturyGothic"] = "Helvetica";
t.CenturyGothic = "Helvetica";
t["CenturyGothic-Bold"] = "Helvetica-Bold";
t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
t["CenturyGothic-Italic"] = "Helvetica-Oblique";
t["ComicSansMS"] = "Comic Sans MS";
t.ComicSansMS = "Comic Sans MS";
t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
t["LucidaConsole"] = "Courier";
t.LucidaConsole = "Courier";
t["LucidaConsole-Bold"] = "Courier-Bold";

@@ -130,5 +130,5 @@ t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";

t["MS-PMincho-Italic"] = "MS PMincho-Italic";
t["NuptialScript"] = "Times-Italic";
t["SegoeUISymbol"] = "Helvetica";
t["Wingdings"] = "ZapfDingbats";
t.NuptialScript = "Times-Italic";
t.SegoeUISymbol = "Helvetica";
t.Wingdings = "ZapfDingbats";
t["Wingdings-Regular"] = "ZapfDingbats";

@@ -140,90 +140,90 @@ });

t["Adobe Text"] = true;
t["Albertus"] = true;
t["Aldus"] = true;
t["Alexandria"] = true;
t["Algerian"] = true;
t.Albertus = true;
t.Aldus = true;
t.Alexandria = true;
t.Algerian = true;
t["American Typewriter"] = true;
t["Antiqua"] = true;
t["Apex"] = true;
t["Arno"] = true;
t["Aster"] = true;
t["Aurora"] = true;
t["Baskerville"] = true;
t["Bell"] = true;
t["Bembo"] = true;
t.Antiqua = true;
t.Apex = true;
t.Arno = true;
t.Aster = true;
t.Aurora = true;
t.Baskerville = true;
t.Bell = true;
t.Bembo = true;
t["Bembo Schoolbook"] = true;
t["Benguiat"] = true;
t.Benguiat = true;
t["Berkeley Old Style"] = true;
t["Bernhard Modern"] = true;
t["Berthold City"] = true;
t["Bodoni"] = true;
t.Bodoni = true;
t["Bauer Bodoni"] = true;
t["Book Antiqua"] = true;
t["Bookman"] = true;
t.Bookman = true;
t["Bordeaux Roman"] = true;
t["Californian FB"] = true;
t["Calisto"] = true;
t["Calvert"] = true;
t["Capitals"] = true;
t["Cambria"] = true;
t["Cartier"] = true;
t["Caslon"] = true;
t["Catull"] = true;
t["Centaur"] = true;
t.Calisto = true;
t.Calvert = true;
t.Capitals = true;
t.Cambria = true;
t.Cartier = true;
t.Caslon = true;
t.Catull = true;
t.Centaur = true;
t["Century Old Style"] = true;
t["Century Schoolbook"] = true;
t["Chaparral"] = true;
t.Chaparral = true;
t["Charis SIL"] = true;
t["Cheltenham"] = true;
t.Cheltenham = true;
t["Cholla Slab"] = true;
t["Clarendon"] = true;
t["Clearface"] = true;
t["Cochin"] = true;
t["Colonna"] = true;
t.Clarendon = true;
t.Clearface = true;
t.Cochin = true;
t.Colonna = true;
t["Computer Modern"] = true;
t["Concrete Roman"] = true;
t["Constantia"] = true;
t.Constantia = true;
t["Cooper Black"] = true;
t["Corona"] = true;
t["Ecotype"] = true;
t["Egyptienne"] = true;
t["Elephant"] = true;
t["Excelsior"] = true;
t["Fairfield"] = true;
t.Corona = true;
t.Ecotype = true;
t.Egyptienne = true;
t.Elephant = true;
t.Excelsior = true;
t.Fairfield = true;
t["FF Scala"] = true;
t["Folkard"] = true;
t["Footlight"] = true;
t["FreeSerif"] = true;
t.Folkard = true;
t.Footlight = true;
t.FreeSerif = true;
t["Friz Quadrata"] = true;
t["Garamond"] = true;
t["Gentium"] = true;
t["Georgia"] = true;
t["Gloucester"] = true;
t.Garamond = true;
t.Gentium = true;
t.Georgia = true;
t.Gloucester = true;
t["Goudy Old Style"] = true;
t["Goudy Schoolbook"] = true;
t["Goudy Pro Font"] = true;
t["Granjon"] = true;
t.Granjon = true;
t["Guardian Egyptian"] = true;
t["Heather"] = true;
t["Hercules"] = true;
t.Heather = true;
t.Hercules = true;
t["High Tower Text"] = true;
t["Hiroshige"] = true;
t.Hiroshige = true;
t["Hoefler Text"] = true;
t["Humana Serif"] = true;
t["Imprint"] = true;
t.Imprint = true;
t["Ionic No. 5"] = true;
t["Janson"] = true;
t["Joanna"] = true;
t["Korinna"] = true;
t["Lexicon"] = true;
t.Janson = true;
t.Joanna = true;
t.Korinna = true;
t.Lexicon = true;
t["Liberation Serif"] = true;
t["Linux Libertine"] = true;
t["Literaturnaya"] = true;
t["Lucida"] = true;
t.Literaturnaya = true;
t.Lucida = true;
t["Lucida Bright"] = true;
t["Melior"] = true;
t["Memphis"] = true;
t["Miller"] = true;
t["Minion"] = true;
t["Modern"] = true;
t.Melior = true;
t.Memphis = true;
t.Miller = true;
t.Minion = true;
t.Modern = true;
t["Mona Lisa"] = true;

@@ -236,44 +236,44 @@ t["Mrs Eaves"] = true;

t["NPS Rawlinson Roadway"] = true;
t["NuptialScript"] = true;
t["Palatino"] = true;
t["Perpetua"] = true;
t["Plantin"] = true;
t.NuptialScript = true;
t.Palatino = true;
t.Perpetua = true;
t.Plantin = true;
t["Plantin Schoolbook"] = true;
t["Playbill"] = true;
t.Playbill = true;
t["Poor Richard"] = true;
t["Rawlinson Roadway"] = true;
t["Renault"] = true;
t["Requiem"] = true;
t["Rockwell"] = true;
t["Roman"] = true;
t.Renault = true;
t.Requiem = true;
t.Rockwell = true;
t.Roman = true;
t["Rotis Serif"] = true;
t["Sabon"] = true;
t["Scala"] = true;
t["Seagull"] = true;
t["Sistina"] = true;
t["Souvenir"] = true;
t["STIX"] = true;
t.Sabon = true;
t.Scala = true;
t.Seagull = true;
t.Sistina = true;
t.Souvenir = true;
t.STIX = true;
t["Stone Informal"] = true;
t["Stone Serif"] = true;
t["Sylfaen"] = true;
t["Times"] = true;
t["Trajan"] = true;
t.Sylfaen = true;
t.Times = true;
t.Trajan = true;
t["Trinité"] = true;
t["Trump Mediaeval"] = true;
t["Utopia"] = true;
t.Utopia = true;
t["Vale Type"] = true;
t["Bitstream Vera"] = true;
t["Vera Serif"] = true;
t["Versailles"] = true;
t["Wanted"] = true;
t["Weiss"] = true;
t.Versailles = true;
t.Wanted = true;
t.Weiss = true;
t["Wide Latin"] = true;
t["Windsor"] = true;
t["XITS"] = true;
t.Windsor = true;
t.XITS = true;
});
exports.getSerifFonts = getSerifFonts;
const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
t["Dingbats"] = true;
t["Symbol"] = true;
t["ZapfDingbats"] = true;
t.Dingbats = true;
t.Symbol = true;
t.ZapfDingbats = true;
});

@@ -280,0 +280,0 @@ exports.getSymbolsFonts = getSymbolsFonts;

@@ -409,3 +409,3 @@ /**

return Array.prototype.slice.call(decrypted, discardNumber, j);
return decrypted.slice(discardNumber, j);
}

@@ -420,3 +420,3 @@

var data = stream.getBytes();
var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
var isBinary = !((isHexDigit(data[0]) || (0, _core_utils.isWhiteSpace)(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7]));
stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));

@@ -510,3 +510,3 @@ }

var privateData = Object.create(null);
privateData["lenIV"] = 4;
privateData.lenIV = 4;
var program = {

@@ -550,3 +550,3 @@ subrs: [],

data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
lenIV = program.properties.privateData["lenIV"];
lenIV = program.properties.privateData.lenIV;
encoded = this.readCharStrings(data, lenIV);

@@ -573,7 +573,7 @@ this.nextChar();

while (this.getToken() === "dup") {
var index = this.readInt();
const index = this.readInt();
length = this.readInt();
this.getToken();
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
lenIV = program.properties.privateData["lenIV"];
lenIV = program.properties.privateData.lenIV;
encoded = this.readCharStrings(data, lenIV);

@@ -580,0 +580,0 @@ this.nextChar();

@@ -40,3 +40,3 @@ /**

getFullReader() {
(0, _util.assert)(!this._fullRequestReader);
(0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);

@@ -43,0 +43,0 @@ return this._fullRequestReader;

@@ -110,3 +110,3 @@ /**

const apiVersion = docParams.apiVersion;
const workerVersion = '2.4.456';
const workerVersion = '2.5.207';

@@ -127,2 +127,6 @@ if (apiVersion !== workerVersion) {

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;

@@ -168,3 +172,3 @@ var docBaseUrl = docParams.docBaseUrl;

var pdfManagerCapability = (0, _util.createPromiseCapability)();
var pdfManager;
let newPdfManager;
var source = data.source;

@@ -174,4 +178,4 @@

try {
pdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
pdfManagerCapability.resolve(pdfManager);
newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
pdfManagerCapability.resolve(newPdfManager);
} catch (ex) {

@@ -201,3 +205,3 @@ pdfManagerCapability.reject(ex);

var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
pdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
msgHandler: handler,

@@ -211,7 +215,7 @@ password: source.password,

for (let i = 0; i < cachedChunks.length; i++) {
pdfManager.sendProgressiveData(cachedChunks[i]);
newPdfManager.sendProgressiveData(cachedChunks[i]);
}
cachedChunks = [];
pdfManagerCapability.resolve(pdfManager);
pdfManagerCapability.resolve(newPdfManager);
cancelXHRs = null;

@@ -232,4 +236,4 @@ }).catch(function (reason) {

try {
pdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
pdfManagerCapability.resolve(pdfManager);
newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
pdfManagerCapability.resolve(newPdfManager);
} catch (ex) {

@@ -243,8 +247,11 @@ pdfManagerCapability.reject(ex);

var readPromise = new Promise(function (resolve, reject) {
var readChunk = function (chunk) {
var readChunk = function ({
value,
done
}) {
try {
ensureNotTerminated();
if (chunk.done) {
if (!pdfManager) {
if (done) {
if (!newPdfManager) {
flushChunks();

@@ -257,4 +264,3 @@ }

var data = chunk.value;
loaded += (0, _util.arrayByteLength)(data);
loaded += (0, _util.arrayByteLength)(value);

@@ -268,6 +274,6 @@ if (!fullRequest.isStreamingSupported) {

if (pdfManager) {
pdfManager.sendProgressiveData(data);
if (newPdfManager) {
newPdfManager.sendProgressiveData(value);
} else {
cachedChunks.push(data);
cachedChunks.push(value);
}

@@ -309,5 +315,7 @@

startWorkerTask(task);
handler.sendWithPromise("PasswordRequest", ex).then(function (data) {
handler.sendWithPromise("PasswordRequest", ex).then(function ({
password
}) {
finishWorkerTask(task);
pdfManager.updatePassword(data.password);
pdfManager.updatePassword(password);
pdfManagerReady();

@@ -345,8 +353,7 @@ }).catch(function () {

var evaluatorOptions = {
forceDataSchema: data.disableCreateObjectURL,
maxImageSize: data.maxImageSize,
disableFontFace: data.disableFontFace,
nativeImageDecoderSupport: data.nativeImageDecoderSupport,
ignoreErrors: data.ignoreErrors,
isEvalSupported: data.isEvalSupported
isEvalSupported: data.isEvalSupported,
fontExtraProperties: data.fontExtraProperties
};

@@ -467,3 +474,3 @@ getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {

handler.send("UnsupportedFeature", {
featureId: _util.UNSUPPORTED_FEATURES.unknown
featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
});

@@ -514,3 +521,3 @@ sink.error(reason);

handler.on("Cleanup", function wphCleanup(data) {
return pdfManager.cleanup();
return pdfManager.cleanup(true);
});

@@ -517,0 +524,0 @@ handler.on("Terminate", function wphTerminate(data) {

@@ -350,2 +350,3 @@ /**

element.disabled = this.data.readOnly;
element.name = this.data.fieldName;

@@ -420,2 +421,3 @@ if (this.data.maxLen !== null) {

element.type = "checkbox";
element.name = this.data.fieldName;

@@ -472,2 +474,3 @@ if (this.data.fieldValue && this.data.fieldValue !== "Off") {

selectElement.disabled = this.data.readOnly;
selectElement.name = this.data.fieldName;

@@ -474,0 +477,0 @@ if (!this.data.combo) {

@@ -24,25 +24,18 @@ /**

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.apiCompatibilityParams = void 0;
var _is_node = require("../shared/is_node.js");
const compatibilityParams = Object.create(null);
{
const {
isNodeJS
} = require("../shared/is_node.js");
const userAgent = typeof navigator !== "undefined" && navigator.userAgent || "";
const isIE = /Trident/.test(userAgent);
const isIOSChrome = /CriOS/.test(userAgent);
(function checkOnBlobSupport() {
if (isIE || isIOSChrome) {
compatibilityParams.disableCreateObjectURL = true;
}
})();
(function checkFontFaceAndImage() {
if (isNodeJS) {
(function checkFontFace() {
if (_is_node.isNodeJS) {
compatibilityParams.disableFontFace = true;
compatibilityParams.nativeImageDecoderSupport = "none";
}
})();
}
exports.apiCompatibilityParams = Object.freeze(compatibilityParams);
const apiCompatibilityParams = Object.freeze(compatibilityParams);
exports.apiCompatibilityParams = apiCompatibilityParams;

@@ -125,9 +125,5 @@ /**

params.ignoreErrors = params.stopAtErrors !== true;
params.fontExtraProperties = params.fontExtraProperties === true;
params.pdfBug = params.pdfBug === true;
const NativeImageDecoderValues = Object.values(_util.NativeImageDecoding);
if (params.nativeImageDecoderSupport === undefined || !NativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) {
params.nativeImageDecoderSupport = _api_compatibility.apiCompatibilityParams.nativeImageDecoderSupport || _util.NativeImageDecoding.DECODE;
}
if (!Number.isInteger(params.maxImageSize)) {

@@ -157,6 +153,2 @@ params.maxImageSize = -1;

if (typeof params.disableCreateObjectURL !== "boolean") {
params.disableCreateObjectURL = _api_compatibility.apiCompatibilityParams.disableCreateObjectURL || false;
}
(0, _util.setVerbosityLevel)(params.verbosity);

@@ -179,7 +171,5 @@

return _fetchDocument(worker, params, rangeTransport, docId).then(function (workerId) {
if (task.destroyed) {
throw new Error("Loading aborted");
}
const workerIdPromise = _fetchDocument(worker, params, rangeTransport, docId);
const networkStreamPromise = new Promise(function (resolve) {
let networkStream;

@@ -207,2 +197,9 @@

resolve(networkStream);
});
return Promise.all([workerIdPromise, networkStreamPromise]).then(function ([workerId, networkStream]) {
if (task.destroyed) {
throw new Error("Loading aborted");
}
const messageHandler = new _message_handler.MessageHandler(docId, workerId, worker.port);

@@ -231,3 +228,3 @@ messageHandler.postMessageTransfers = worker.postMessageTransfers;

docId,
apiVersion: '2.4.456',
apiVersion: '2.5.207',
source: {

@@ -243,8 +240,7 @@ data: source.data,

disableFontFace: source.disableFontFace,
disableCreateObjectURL: source.disableCreateObjectURL,
postMessageTransfers: worker.postMessageTransfers,
docBaseUrl: source.docBaseUrl,
nativeImageDecoderSupport: source.nativeImageDecoderSupport,
ignoreErrors: source.ignoreErrors,
isEvalSupported: source.isEvalSupported
isEvalSupported: source.isEvalSupported,
fontExtraProperties: source.fontExtraProperties
}).then(function (workerId) {

@@ -292,6 +288,2 @@ if (worker.destroyed) {

then(onFulfilled, onRejected) {
throw new Error("Removed API method: " + "PDFDocumentLoadingTask.then, use the `promise` getter instead.");
}
}

@@ -525,6 +517,2 @@

} = {}) {
if (arguments.length > 1 || typeof arguments[0] === "number") {
throw new Error("PDFPageProxy.getViewport is called with obsolete arguments.");
}
return new _display_utils.PageViewport({

@@ -1439,3 +1427,3 @@ viewBox: this.view,

messageHandler.on("GetReader", (data, sink) => {
(0, _util.assert)(this._networkStream);
(0, _util.assert)(this._networkStream, "GetReader - no `IPDFStream` instance available.");
this._fullReader = this._networkStream.getFullReader();

@@ -1460,3 +1448,3 @@

(0, _util.assert)((0, _util.isArrayBuffer)(value));
(0, _util.assert)((0, _util.isArrayBuffer)(value), "GetReader - expected an ArrayBuffer.");
sink.enqueue(new Uint8Array(value), 1, [value]);

@@ -1500,3 +1488,3 @@ }).catch(reason => {

messageHandler.on("GetRangeReader", (data, sink) => {
(0, _util.assert)(this._networkStream);
(0, _util.assert)(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");

@@ -1520,3 +1508,3 @@ const rangeReader = this._networkStream.getRangeReader(data.begin, data.end);

(0, _util.assert)((0, _util.isArrayBuffer)(value));
(0, _util.assert)((0, _util.isArrayBuffer)(value), "GetRangeReader - expected an ArrayBuffer.");
sink.enqueue(new Uint8Array(value), 1, [value]);

@@ -1646,10 +1634,12 @@ }).catch(reason => {

});
this.fontLoader.bind(font).then(() => {
this.commonObjs.resolve(id, font);
}, reason => {
messageHandler.sendWithPromise("FontFallback", {
this.fontLoader.bind(font).catch(reason => {
return messageHandler.sendWithPromise("FontFallback", {
id
}).finally(() => {
this.commonObjs.resolve(id, font);
});
}).finally(() => {
if (!params.fontExtraProperties && font.data) {
font.data = null;
}
this.commonObjs.resolve(id, font);
});

@@ -1660,2 +1650,3 @@ break;

case "FontType3Res":
case "Image":
this.commonObjs.resolve(id, exportedData);

@@ -1681,20 +1672,2 @@ break;

switch (type) {
case "JpegStream":
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = function () {
resolve(img);
};
img.onerror = function () {
reject(new Error("Error during JPEG image loading"));
(0, _display_utils.releaseImageResources)(img);
};
img.src = imageData;
}).then(img => {
pageProxy.objs.resolve(id, img);
});
case "Image":

@@ -1729,67 +1702,2 @@ pageProxy.objs.resolve(id, imageData);

messageHandler.on("UnsupportedFeature", this._onUnsupportedFeature.bind(this));
messageHandler.on("JpegDecode", data => {
if (this.destroyed) {
return Promise.reject(new Error("Worker was destroyed"));
}
if (typeof document === "undefined") {
return Promise.reject(new Error('"document" is not defined.'));
}
const [imageUrl, components] = data;
if (components !== 3 && components !== 1) {
return Promise.reject(new Error("Only 3 components or 1 component can be returned"));
}
return new Promise(function (resolve, reject) {
const img = new Image();
img.onload = function () {
const {
width,
height
} = img;
const size = width * height;
const rgbaLength = size * 4;
const buf = new Uint8ClampedArray(size * components);
let tmpCanvas = document.createElement("canvas");
tmpCanvas.width = width;
tmpCanvas.height = height;
let tmpCtx = tmpCanvas.getContext("2d");
tmpCtx.drawImage(img, 0, 0);
const data = tmpCtx.getImageData(0, 0, width, height).data;
if (components === 3) {
for (let i = 0, j = 0; i < rgbaLength; i += 4, j += 3) {
buf[j] = data[i];
buf[j + 1] = data[i + 1];
buf[j + 2] = data[i + 2];
}
} else if (components === 1) {
for (let i = 0, j = 0; i < rgbaLength; i += 4, j++) {
buf[j] = data[i];
}
}
resolve({
data: buf,
width,
height
});
(0, _display_utils.releaseImageResources)(img);
tmpCanvas.width = 0;
tmpCanvas.height = 0;
tmpCanvas = null;
tmpCtx = null;
};
img.onerror = function () {
reject(new Error("JpegDecode failed to load image"));
(0, _display_utils.releaseImageResources)(img);
};
img.src = imageUrl;
});
});
messageHandler.on("FetchBuiltInCMap", (data, sink) => {

@@ -1963,5 +1871,3 @@ if (this.destroyed) {

disableAutoFetch: params.disableAutoFetch,
disableCreateObjectURL: params.disableCreateObjectURL,
disableFontFace: params.disableFontFace,
nativeImageDecoderSupport: params.nativeImageDecoderSupport
disableFontFace: params.disableFontFace
});

@@ -2019,12 +1925,2 @@ }

clear() {
for (const objId in this._objs) {
const {
data
} = this._objs[objId];
if (typeof Image !== "undefined" && data instanceof Image) {
(0, _display_utils.releaseImageResources)(data);
}
}
this._objs = Object.create(null);

@@ -2049,6 +1945,2 @@ }

then(onFulfilled, onRejected) {
throw new Error("Removed API method: " + "RenderTask.then, use the `promise` getter instead.");
}
}

@@ -2222,5 +2114,5 @@

const version = '2.4.456';
const version = '2.5.207';
exports.version = version;
const build = '228a591c';
const build = '0974d605';
exports.build = build;

@@ -102,3 +102,3 @@ /**

function rfc2231getparam(contentDisposition) {
function rfc2231getparam(contentDispositionStr) {
const matches = [];

@@ -108,3 +108,3 @@ let match;

while ((match = iter.exec(contentDisposition)) !== null) {
while ((match = iter.exec(contentDispositionStr)) !== null) {
let [, n, quot, part] = match;

@@ -187,6 +187,6 @@ n = parseInt(n, 10);

return value.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (_, charset, encoding, text) {
return value.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (matches, charset, encoding, text) {
if (encoding === "q" || encoding === "Q") {
text = text.replace(/_/g, " ");
text = text.replace(/=([0-9a-fA-F]{2})/g, function (_, hex) {
text = text.replace(/=([0-9a-fA-F]{2})/g, function (match, hex) {
return String.fromCharCode(parseInt(hex, 16));

@@ -193,0 +193,0 @@ });

@@ -33,3 +33,2 @@ /**

exports.deprecated = deprecated;
exports.releaseImageResources = releaseImageResources;
exports.PDFDateString = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0;

@@ -119,5 +118,5 @@

if (this.isCompressed) {
cMapData = new Uint8Array((await response.arrayBuffer()));
cMapData = new Uint8Array(await response.arrayBuffer());
} else {
cMapData = (0, _util.stringToBytes)((await response.text()));
cMapData = (0, _util.stringToBytes)(await response.text());
}

@@ -241,3 +240,3 @@

default:
case 0:
rotateA = 1;

@@ -248,2 +247,5 @@ rotateB = 0;

break;
default:
throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.");
}

@@ -469,13 +471,2 @@

function releaseImageResources(img) {
(0, _util.assert)(img instanceof Image, "Invalid `img` parameter.");
const url = img.src;
if (typeof url === "string" && url.startsWith("blob:") && URL.revokeObjectURL) {
URL.revokeObjectURL(url);
}
img.removeAttribute("src");
}
let pdfDateStringRegex;

@@ -482,0 +473,0 @@

@@ -33,2 +33,4 @@ /**

;
function createFetchOptions(headers, withCredentials, abortController) {

@@ -75,3 +77,3 @@ return {

getFullReader() {
(0, _util.assert)(!this._fullRequestReader);
(0, _util.assert)(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once.");
this._fullRequestReader = new PDFFetchStreamReader(this);

@@ -78,0 +80,0 @@ return this._fullRequestReader;

@@ -93,3 +93,3 @@ /**

this._onUnsupportedFeature({
featureId: _util.UNSUPPORTED_FEATURES.font
featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadNative
});

@@ -361,3 +361,3 @@

this._onUnsupportedFeature({
featureId: _util.UNSUPPORTED_FEATURES.font
featureId: _util.UNSUPPORTED_FEATURES.errorFontGetPath
});

@@ -364,0 +364,0 @@ }

@@ -250,3 +250,3 @@ /**

getFullReader() {
(0, _util.assert)(!this._fullRequestReader);
(0, _util.assert)(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once.");
this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source);

@@ -253,0 +253,0 @@ return this._fullRequestReader;

@@ -33,2 +33,4 @@ /**

;
const fs = require("fs");

@@ -78,3 +80,3 @@

getFullReader() {
(0, _util.assert)(!this._fullRequestReader);
(0, _util.assert)(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once.");
this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this);

@@ -326,9 +328,9 @@ return this._fullRequestReader;

function createRequestOptions(url, headers) {
function createRequestOptions(parsedUrl, headers) {
return {
protocol: url.protocol,
auth: url.auth,
host: url.hostname,
port: url.port,
path: url.path,
protocol: parsedUrl.protocol,
auth: parsedUrl.auth,
host: parsedUrl.hostname,
port: parsedUrl.port,
path: parsedUrl.path,
method: "GET",

@@ -409,3 +411,3 @@ headers

this._httpHeaders["Range"] = `bytes=${start}-${end - 1}`;
this._httpHeaders.Range = `bytes=${start}-${end - 1}`;

@@ -412,0 +414,0 @@ const handleResponse = response => {

@@ -190,3 +190,3 @@ /**

for (var x = x1_; x <= x2_; x++) {
let k = (xa - x) / (xa - xb);
k = (xa - x) / (xa - xb);

@@ -193,0 +193,0 @@ if (k < 0) {

@@ -369,3 +369,3 @@ /**

exports.SVGGraphics = SVGGraphics = class SVGGraphics {
constructor(commonObjs, objs, forceDataSchema) {
constructor(commonObjs, objs, forceDataSchema = false) {
this.svgFactory = new _display_utils.DOMSVGFactory();

@@ -618,6 +618,2 @@ this.current = new SVGExtraState();

case _util.OPS.paintJpegXObject:
this.paintJpegXObject(args[0], args[1], args[2]);
break;
case _util.OPS.paintImageXObject:

@@ -705,2 +701,3 @@ this.paintImageXObject(args[0]);

current.xcoords = [];
current.ycoords = [];
current.tspan = this.svgFactory.createElement("svg:tspan");

@@ -725,2 +722,3 @@ current.tspan.setAttributeNS(null, "font-family", current.fontFamily);

current.xcoords = [];
current.ycoords = [];
}

@@ -733,2 +731,3 @@

current.xcoords = [];
current.ycoords = [];
current.tspan = this.svgFactory.createElement("svg:tspan");

@@ -749,2 +748,3 @@ current.tspan.setAttributeNS(null, "font-family", current.fontFamily);

const fontSizeScale = current.fontSizeScale;
const charSpacing = current.charSpacing;

@@ -755,2 +755,4 @@ const wordSpacing = current.wordSpacing;

const vertical = font.vertical;
const spacingDir = vertical ? 1 : -1;
const defaultVMetrics = font.defaultVMetrics;
const widthAdvanceScale = fontSize * current.fontMatrix[0];

@@ -764,29 +766,60 @@ let x = 0;

} else if ((0, _util.isNum)(glyph)) {
x += -glyph * fontSize * 0.001;
x += spacingDir * glyph * fontSize / 1000;
continue;
}
const width = glyph.width;
const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
const character = glyph.fontChar;
const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
const charWidth = width * widthAdvanceScale + spacing * fontDirection;
let scaledX, scaledY;
let width = glyph.width;
if (!glyph.isInFont && !font.missingFile) {
x += charWidth;
continue;
if (vertical) {
let vx;
const vmetric = glyph.vmetric || defaultVMetrics;
vx = glyph.vmetric ? vmetric[1] : width * 0.5;
vx = -vx * widthAdvanceScale;
const vy = vmetric[2] * widthAdvanceScale;
width = vmetric ? -vmetric[0] : width;
scaledX = vx / fontSizeScale;
scaledY = (x + vy) / fontSizeScale;
} else {
scaledX = x / fontSizeScale;
scaledY = 0;
}
current.xcoords.push(current.x + x);
current.tspan.textContent += character;
if (glyph.isInFont || font.missingFile) {
current.xcoords.push(current.x + scaledX);
if (vertical) {
current.ycoords.push(-current.y + scaledY);
}
current.tspan.textContent += character;
} else {}
let charWidth;
if (vertical) {
charWidth = width * widthAdvanceScale - spacing * fontDirection;
} else {
charWidth = width * widthAdvanceScale + spacing * fontDirection;
}
x += charWidth;
}
current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" "));
if (vertical) {
current.y -= x * textHScale;
current.tspan.setAttributeNS(null, "y", current.ycoords.map(pf).join(" "));
} else {
current.tspan.setAttributeNS(null, "y", pf(-current.y));
}
if (vertical) {
current.y -= x;
} else {
current.x += x * textHScale;
}
current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" "));
current.tspan.setAttributeNS(null, "y", pf(-current.y));
current.tspan.setAttributeNS(null, "font-family", current.fontFamily);

@@ -846,2 +879,6 @@ current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);

addFontStyle(fontObj) {
if (!fontObj.data) {
throw new Error("addFontStyle: No font data available, " + 'ensure that the "fontExtraProperties" API parameter is set.');
}
if (!this.cssStyle) {

@@ -863,3 +900,3 @@ this.cssStyle = this.svgFactory.createElement("svg:style");

if (this.embedFonts && fontObj.data && !this.embeddedFonts[fontObj.loadedName]) {
if (this.embedFonts && !fontObj.missingFile && !this.embeddedFonts[fontObj.loadedName]) {
this.addFontStyle(fontObj);

@@ -894,2 +931,3 @@ this.embeddedFonts[fontObj.loadedName] = fontObj;

current.xcoords = [];
current.ycoords = [];
}

@@ -941,2 +979,3 @@

this.current.xcoords = [];
this.current.ycoords = [];
}

@@ -977,2 +1016,6 @@

if (this.current.fillAlpha < 1) {
rect.setAttributeNS(null, "fill-opacity", this.current.fillAlpha);
}
this._ensureTransformGroup().appendChild(rect);

@@ -1392,15 +1435,2 @@ }

paintJpegXObject(objId, w, h) {
const imgObj = this.objs.get(objId);
const imgEl = this.svgFactory.createElement("svg:image");
imgEl.setAttributeNS(XLINK_NS, "xlink:href", imgObj.src);
imgEl.setAttributeNS(null, "width", pf(w));
imgEl.setAttributeNS(null, "height", pf(h));
imgEl.setAttributeNS(null, "x", "0");
imgEl.setAttributeNS(null, "y", pf(-h));
imgEl.setAttributeNS(null, "transform", `scale(${pf(1 / w)} ${pf(-1 / h)})`);
this._ensureTransformGroup().appendChild(imgEl);
}
paintImageXObject(objId) {

@@ -1407,0 +1437,0 @@ const imgData = this.objs.get(objId);

@@ -105,3 +105,16 @@ /**

let shouldScaleText = false;
if (geom.str.length > 1) {
shouldScaleText = true;
} else if (geom.transform[0] !== geom.transform[3]) {
const absScaleX = Math.abs(geom.transform[0]),
absScaleY = Math.abs(geom.transform[3]);
if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) {
shouldScaleText = true;
}
}
if (shouldScaleText) {
if (style.vertical) {

@@ -177,2 +190,16 @@ textDivProperties.canvasWidth = geom.height * task._viewport.scale;

function findPositiveMin(ts, offset, count) {
let result = 0;
for (let i = 0; i < count; i++) {
const t = ts[offset++];
if (t > 0) {
result = result ? Math.min(t, result) : t;
}
}
return result;
}
function expand(task) {

@@ -206,37 +233,22 @@ var bounds = task._bounds;

var ts = new Float64Array(64);
points.forEach(function (p, i) {
points.forEach(function (p, j) {
var t = _util.Util.applyTransform(p, m);
ts[i + 0] = c && (e.left - t[0]) / c;
ts[i + 4] = s && (e.top - t[1]) / s;
ts[i + 8] = c && (e.right - t[0]) / c;
ts[i + 12] = s && (e.bottom - t[1]) / s;
ts[i + 16] = s && (e.left - t[0]) / -s;
ts[i + 20] = c && (e.top - t[1]) / c;
ts[i + 24] = s && (e.right - t[0]) / -s;
ts[i + 28] = c && (e.bottom - t[1]) / c;
ts[i + 32] = c && (e.left - t[0]) / -c;
ts[i + 36] = s && (e.top - t[1]) / -s;
ts[i + 40] = c && (e.right - t[0]) / -c;
ts[i + 44] = s && (e.bottom - t[1]) / -s;
ts[i + 48] = s && (e.left - t[0]) / s;
ts[i + 52] = c && (e.top - t[1]) / -c;
ts[i + 56] = s && (e.right - t[0]) / s;
ts[i + 60] = c && (e.bottom - t[1]) / -c;
ts[j + 0] = c && (e.left - t[0]) / c;
ts[j + 4] = s && (e.top - t[1]) / s;
ts[j + 8] = c && (e.right - t[0]) / c;
ts[j + 12] = s && (e.bottom - t[1]) / s;
ts[j + 16] = s && (e.left - t[0]) / -s;
ts[j + 20] = c && (e.top - t[1]) / c;
ts[j + 24] = s && (e.right - t[0]) / -s;
ts[j + 28] = c && (e.bottom - t[1]) / c;
ts[j + 32] = c && (e.left - t[0]) / -c;
ts[j + 36] = s && (e.top - t[1]) / -s;
ts[j + 40] = c && (e.right - t[0]) / -c;
ts[j + 44] = s && (e.bottom - t[1]) / -s;
ts[j + 48] = s && (e.left - t[0]) / s;
ts[j + 52] = c && (e.top - t[1]) / -c;
ts[j + 56] = s && (e.right - t[0]) / s;
ts[j + 60] = c && (e.bottom - t[1]) / -c;
});
var findPositiveMin = function (ts, offset, count) {
var result = 0;
for (var i = 0; i < count; i++) {
var t = ts[offset++];
if (t > 0) {
result = result ? Math.min(t, result) : t;
}
}
return result;
};
var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s));

@@ -243,0 +255,0 @@ divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale;

@@ -33,3 +33,3 @@ /**

constructor(params, pdfDataRangeTransport) {
(0, _util.assert)(pdfDataRangeTransport);
(0, _util.assert)(pdfDataRangeTransport, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
this._queuedChunks = [];

@@ -99,3 +99,3 @@ this._progressiveDone = params.progressiveDone || false;

(0, _util.assert)(found);
(0, _util.assert)(found, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
}

@@ -146,3 +146,3 @@ }

getFullReader() {
(0, _util.assert)(!this._fullRequestReader);
(0, _util.assert)(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
const queuedChunks = this._queuedChunks;

@@ -149,0 +149,0 @@ this._queuedChunks = null;

@@ -24,21 +24,216 @@ /**

var pdfjsVersion = '2.4.456';
var pdfjsBuild = '228a591c';
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "addLinkAttributes", {
enumerable: true,
get: function () {
return _display_utils.addLinkAttributes;
}
});
Object.defineProperty(exports, "getFilenameFromUrl", {
enumerable: true,
get: function () {
return _display_utils.getFilenameFromUrl;
}
});
Object.defineProperty(exports, "LinkTarget", {
enumerable: true,
get: function () {
return _display_utils.LinkTarget;
}
});
Object.defineProperty(exports, "loadScript", {
enumerable: true,
get: function () {
return _display_utils.loadScript;
}
});
Object.defineProperty(exports, "PDFDateString", {
enumerable: true,
get: function () {
return _display_utils.PDFDateString;
}
});
Object.defineProperty(exports, "RenderingCancelledException", {
enumerable: true,
get: function () {
return _display_utils.RenderingCancelledException;
}
});
Object.defineProperty(exports, "build", {
enumerable: true,
get: function () {
return _api.build;
}
});
Object.defineProperty(exports, "getDocument", {
enumerable: true,
get: function () {
return _api.getDocument;
}
});
Object.defineProperty(exports, "LoopbackPort", {
enumerable: true,
get: function () {
return _api.LoopbackPort;
}
});
Object.defineProperty(exports, "PDFDataRangeTransport", {
enumerable: true,
get: function () {
return _api.PDFDataRangeTransport;
}
});
Object.defineProperty(exports, "PDFWorker", {
enumerable: true,
get: function () {
return _api.PDFWorker;
}
});
Object.defineProperty(exports, "version", {
enumerable: true,
get: function () {
return _api.version;
}
});
Object.defineProperty(exports, "CMapCompressionType", {
enumerable: true,
get: function () {
return _util.CMapCompressionType;
}
});
Object.defineProperty(exports, "createObjectURL", {
enumerable: true,
get: function () {
return _util.createObjectURL;
}
});
Object.defineProperty(exports, "createPromiseCapability", {
enumerable: true,
get: function () {
return _util.createPromiseCapability;
}
});
Object.defineProperty(exports, "createValidAbsoluteUrl", {
enumerable: true,
get: function () {
return _util.createValidAbsoluteUrl;
}
});
Object.defineProperty(exports, "InvalidPDFException", {
enumerable: true,
get: function () {
return _util.InvalidPDFException;
}
});
Object.defineProperty(exports, "MissingPDFException", {
enumerable: true,
get: function () {
return _util.MissingPDFException;
}
});
Object.defineProperty(exports, "OPS", {
enumerable: true,
get: function () {
return _util.OPS;
}
});
Object.defineProperty(exports, "PasswordResponses", {
enumerable: true,
get: function () {
return _util.PasswordResponses;
}
});
Object.defineProperty(exports, "PermissionFlag", {
enumerable: true,
get: function () {
return _util.PermissionFlag;
}
});
Object.defineProperty(exports, "removeNullCharacters", {
enumerable: true,
get: function () {
return _util.removeNullCharacters;
}
});
Object.defineProperty(exports, "shadow", {
enumerable: true,
get: function () {
return _util.shadow;
}
});
Object.defineProperty(exports, "UnexpectedResponseException", {
enumerable: true,
get: function () {
return _util.UnexpectedResponseException;
}
});
Object.defineProperty(exports, "UNSUPPORTED_FEATURES", {
enumerable: true,
get: function () {
return _util.UNSUPPORTED_FEATURES;
}
});
Object.defineProperty(exports, "Util", {
enumerable: true,
get: function () {
return _util.Util;
}
});
Object.defineProperty(exports, "VerbosityLevel", {
enumerable: true,
get: function () {
return _util.VerbosityLevel;
}
});
Object.defineProperty(exports, "AnnotationLayer", {
enumerable: true,
get: function () {
return _annotation_layer.AnnotationLayer;
}
});
Object.defineProperty(exports, "apiCompatibilityParams", {
enumerable: true,
get: function () {
return _api_compatibility.apiCompatibilityParams;
}
});
Object.defineProperty(exports, "GlobalWorkerOptions", {
enumerable: true,
get: function () {
return _worker_options.GlobalWorkerOptions;
}
});
Object.defineProperty(exports, "renderTextLayer", {
enumerable: true,
get: function () {
return _text_layer.renderTextLayer;
}
});
Object.defineProperty(exports, "SVGGraphics", {
enumerable: true,
get: function () {
return _svg.SVGGraphics;
}
});
var pdfjsSharedUtil = require("./shared/util.js");
var _display_utils = require("./display/display_utils.js");
var pdfjsDisplayAPI = require("./display/api.js");
var _api = require("./display/api.js");
var pdfjsDisplayTextLayer = require("./display/text_layer.js");
var _util = require("./shared/util.js");
var pdfjsDisplayAnnotationLayer = require("./display/annotation_layer.js");
var _annotation_layer = require("./display/annotation_layer.js");
var pdfjsDisplayDisplayUtils = require("./display/display_utils.js");
var _api_compatibility = require("./display/api_compatibility.js");
var pdfjsDisplaySVG = require("./display/svg.js");
var _worker_options = require("./display/worker_options.js");
const pdfjsDisplayWorkerOptions = require("./display/worker_options.js");
var _text_layer = require("./display/text_layer.js");
const pdfjsDisplayAPICompatibility = require("./display/api_compatibility.js");
var _svg = require("./display/svg.js");
const pdfjsVersion = '2.5.207';
const pdfjsBuild = '0974d605';
{

@@ -52,3 +247,3 @@ const {

pdfjsDisplayAPI.setPDFNetworkStreamFactory(params => {
(0, _api.setPDFNetworkStreamFactory)(params => {
return new PDFNodeStream(params);

@@ -61,8 +256,8 @@ });

if (pdfjsDisplayDisplayUtils.isFetchSupported()) {
if ((0, _display_utils.isFetchSupported)()) {
PDFFetchStream = require("./display/fetch_stream.js").PDFFetchStream;
}
pdfjsDisplayAPI.setPDFNetworkStreamFactory(params => {
if (PDFFetchStream && pdfjsDisplayDisplayUtils.isValidFetchUrl(params.url)) {
(0, _api.setPDFNetworkStreamFactory)(params => {
if (PDFFetchStream && (0, _display_utils.isValidFetchUrl)(params.url)) {
return new PDFFetchStream(params);

@@ -74,35 +269,2 @@ }

}
}
exports.build = pdfjsDisplayAPI.build;
exports.version = pdfjsDisplayAPI.version;
exports.getDocument = pdfjsDisplayAPI.getDocument;
exports.LoopbackPort = pdfjsDisplayAPI.LoopbackPort;
exports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport;
exports.PDFWorker = pdfjsDisplayAPI.PDFWorker;
exports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer;
exports.AnnotationLayer = pdfjsDisplayAnnotationLayer.AnnotationLayer;
exports.createPromiseCapability = pdfjsSharedUtil.createPromiseCapability;
exports.PasswordResponses = pdfjsSharedUtil.PasswordResponses;
exports.InvalidPDFException = pdfjsSharedUtil.InvalidPDFException;
exports.MissingPDFException = pdfjsSharedUtil.MissingPDFException;
exports.SVGGraphics = pdfjsDisplaySVG.SVGGraphics;
exports.NativeImageDecoding = pdfjsSharedUtil.NativeImageDecoding;
exports.CMapCompressionType = pdfjsSharedUtil.CMapCompressionType;
exports.PermissionFlag = pdfjsSharedUtil.PermissionFlag;
exports.UnexpectedResponseException = pdfjsSharedUtil.UnexpectedResponseException;
exports.OPS = pdfjsSharedUtil.OPS;
exports.VerbosityLevel = pdfjsSharedUtil.VerbosityLevel;
exports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES;
exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl;
exports.createObjectURL = pdfjsSharedUtil.createObjectURL;
exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters;
exports.shadow = pdfjsSharedUtil.shadow;
exports.Util = pdfjsSharedUtil.Util;
exports.RenderingCancelledException = pdfjsDisplayDisplayUtils.RenderingCancelledException;
exports.getFilenameFromUrl = pdfjsDisplayDisplayUtils.getFilenameFromUrl;
exports.LinkTarget = pdfjsDisplayDisplayUtils.LinkTarget;
exports.addLinkAttributes = pdfjsDisplayDisplayUtils.addLinkAttributes;
exports.loadScript = pdfjsDisplayDisplayUtils.loadScript;
exports.PDFDateString = pdfjsDisplayDisplayUtils.PDFDateString;
exports.GlobalWorkerOptions = pdfjsDisplayWorkerOptions.GlobalWorkerOptions;
exports.apiCompatibilityParams = pdfjsDisplayAPICompatibility.apiCompatibilityParams;
}

@@ -24,7 +24,15 @@ /**

const pdfjsVersion = '2.4.456';
const pdfjsBuild = '228a591c';
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "WorkerMessageHandler", {
enumerable: true,
get: function () {
return _worker.WorkerMessageHandler;
}
});
const pdfjsCoreWorker = require("./core/worker.js");
var _worker = require("./core/worker.js");
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
const pdfjsVersion = '2.5.207';
const pdfjsBuild = '0974d605';

@@ -6,3 +6,3 @@ It's *very highly* recommended to *not* use these files, but rather use the

Please note that the "lib" build target exists mostly to enable unit-testing in
Node.js/Travis, and that you'll need to handle e.g. any Node.js dependencies
yourself if using the files in this folder.
Node.js/Travis, and that you'll need to handle e.g. any necessary polyfills
and/or Node.js dependencies yourself if using the files in this folder.

@@ -24,2 +24,4 @@ /**

var _is_node = require("./is_node.js");
;

@@ -28,3 +28,3 @@ /**

exports.isNodeJS = void 0;
const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions["nw"] && !process.versions["electron"];
const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !process.versions.electron;
exports.isNodeJS = isNodeJS;

@@ -125,4 +125,4 @@ /**

if (data.callbackId) {
const sourceName = this.sourceName;
const targetName = data.sourceName;
const cbSourceName = this.sourceName;
const cbTargetName = data.sourceName;
new Promise(function (resolve) {

@@ -132,4 +132,4 @@ resolve(action(data.data));

comObj.postMessage({
sourceName,
targetName,
sourceName: cbSourceName,
targetName: cbTargetName,
callback: CallbackKind.DATA,

@@ -141,4 +141,4 @@ callbackId: data.callbackId,

comObj.postMessage({
sourceName,
targetName,
sourceName: cbSourceName,
targetName: cbTargetName,
callback: CallbackKind.ERROR,

@@ -145,0 +145,0 @@ callbackId: data.callbackId,

@@ -52,3 +52,3 @@ /**

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.NativeImageDecoding = 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;
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;

@@ -61,8 +61,2 @@ require("./compatibility.js");

exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
const NativeImageDecoding = {
NONE: "none",
DECODE: "decode",
DISPLAY: "display"
};
exports.NativeImageDecoding = NativeImageDecoding;
const PermissionFlag = {

@@ -332,3 +326,15 @@ PRINT: 0x04,

shadingPattern: "shadingPattern",
font: "font"
font: "font",
errorTilingPattern: "errorTilingPattern",
errorExtGState: "errorExtGState",
errorXObject: "errorXObject",
errorFontLoadType3: "errorFontLoadType3",
errorFontState: "errorFontState",
errorFontMissing: "errorFontMissing",
errorFontTranslate: "errorFontTranslate",
errorColorSpace: "errorColorSpace",
errorOperatorList: "errorOperatorList",
errorFontToUnicode: "errorFontToUnicode",
errorFontLoadNative: "errorFontLoadNative",
errorFontGetPath: "errorFontGetPath"
};

@@ -546,3 +552,3 @@ exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;

assert(arr.byteLength !== undefined);
assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
return arr.byteLength;

@@ -549,0 +555,0 @@ }

@@ -133,8 +133,8 @@ /**

it("parses a CharString endchar with 4 args w/seac enabled", function () {
var parser = new _cff_parser.CFFParser(fontData, {}, true);
parser.parse();
const cffParser = new _cff_parser.CFFParser(fontData, {}, true);
cffParser.parse();
var bytes = new Uint8Array([0, 1, 1, 0, 237, 247, 22, 247, 72, 204, 247, 86, 14]);
parser.bytes = bytes;
var charStringsIndex = parser.parseIndex(0).obj;
var result = parser.parseCharStrings({
cffParser.bytes = bytes;
var charStringsIndex = cffParser.parseIndex(0).obj;
var result = cffParser.parseCharStrings({
charStrings: charStringsIndex,

@@ -153,8 +153,8 @@ privateDict: privateDictStub

it("parses a CharString endchar with 4 args w/seac disabled", function () {
var parser = new _cff_parser.CFFParser(fontData, {}, false);
parser.parse();
const cffParser = new _cff_parser.CFFParser(fontData, {}, false);
cffParser.parse();
var bytes = new Uint8Array([0, 1, 1, 0, 237, 247, 22, 247, 72, 204, 247, 86, 14]);
parser.bytes = bytes;
var charStringsIndex = parser.parseIndex(0).obj;
var result = parser.parseCharStrings({
cffParser.bytes = bytes;
var charStringsIndex = cffParser.parseIndex(0).obj;
var result = cffParser.parseCharStrings({
charStrings: charStringsIndex,

@@ -197,3 +197,3 @@ privateDict: privateDictStub

charset = parser.parseCharsets(3, 2, new _cff_parser.CFFStrings(), true);
expect(charset.charset).toEqual([".notdef", 8, 9]);
expect(charset.charset).toEqual([0, 8, 9]);
});

@@ -206,3 +206,3 @@ it("parses charset format 2", function () {

charset = parser.parseCharsets(3, 2, new _cff_parser.CFFStrings(), true);
expect(charset.charset).toEqual([".notdef", 8, 9]);
expect(charset.charset).toEqual([0, 8, 9]);
});

@@ -209,0 +209,0 @@ it("parses encoding format 0", function () {

@@ -33,3 +33,3 @@ /**

if (!_is_node.isNodeJS) {
throw new Error("The `gulp unittestcli` command can only be used in " + "Node.js environments.");
throw new Error("The `gulp unittestcli` command can only be used in Node.js environments.");
}

@@ -36,0 +36,0 @@

@@ -32,4 +32,2 @@ /**

var _util = require("../../shared/util.js");
var _svg = require("../../display/svg.js");

@@ -76,5 +74,3 @@

beforeAll(function (done) {
loadingTask = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)("xobject-image.pdf", {
nativeImageDecoderSupport: _util.NativeImageDecoding.DISPLAY
}));
loadingTask = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)("xobject-image.pdf"));
loadingTask.promise.then(function (doc) {

@@ -81,0 +77,0 @@ doc.getPage(1).then(function (firstPage) {

@@ -43,3 +43,3 @@ /**

if (isNodeJS) {
throw new Error("The `gulp unittest` command cannot be used in " + "Node.js environments.");
throw new Error("The `gulp unittest` command cannot be used in Node.js environments.");
}

@@ -119,3 +119,3 @@

if (queryString.getParam("browser")) {
var testReporter = new TestReporter(queryString.getParam("browser"), queryString.getParam("path"));
var testReporter = new TestReporter(queryString.getParam("browser"));
env.addReporter(testReporter);

@@ -122,0 +122,0 @@ }

@@ -30,3 +30,5 @@ /**

(0, _util.assert)(_is_node.isNodeJS);
if (!_is_node.isNodeJS) {
throw new Error('The "node_stream" unit-tests can only be run in Node.js environments.');
}

@@ -56,3 +58,3 @@ const path = require("path");

if (!request.headers["range"]) {
if (!request.headers.range) {
const contentLength = stat.size;

@@ -67,3 +69,3 @@ const stream = fs.createReadStream(filePath);

} else {
const [start, end] = request.headers["range"].split("=")[1].split("-").map(x => {
const [start, end] = request.headers.range.split("=")[1].split("-").map(x => {
return Number(x);

@@ -70,0 +72,0 @@ });

@@ -139,6 +139,6 @@ /**

for (const number of numbers) {
const input = new _stream.StringStream(number);
const lexer = new _parser.Lexer(input);
const invalidInput = new _stream.StringStream(number);
const invalidLexer = new _parser.Lexer(invalidInput);
expect(function () {
return lexer.getNumber();
return invalidLexer.getNumber();
}).toThrowError(_util.FormatError, /^Invalid number:\s/);

@@ -145,0 +145,0 @@ }

@@ -47,3 +47,3 @@ /**

return new Uint8Array((await response.arrayBuffer()));
return new Uint8Array(await response.arrayBuffer());
}

@@ -50,0 +50,0 @@

@@ -24,3 +24,3 @@ /**

var TestReporter = function (browser, appPath) {
var TestReporter = function (browser) {
function send(action, json, cb) {

@@ -43,3 +43,3 @@ var r = new XMLHttpRequest();

json["browser"] = browser;
json.browser = browser;
r.send(JSON.stringify(json));

@@ -61,3 +61,3 @@ }

if (typeof error !== "undefined") {
message["error"] = error;
message.error = error;
}

@@ -69,3 +69,3 @@

function sendQuitRequest() {
send("/tellMeToQuit?path=" + escape(appPath), {});
send(`/tellMeToQuit?browser=${escape(browser)}`, {});
}

@@ -72,0 +72,0 @@

@@ -231,3 +231,3 @@ /**

});
it("should not, by default, re-dispatch to DOM", function (done) {
it("should not re-dispatch to DOM", function (done) {
if (_is_node.isNodeJS) {

@@ -256,56 +256,2 @@ pending("Document in not supported in Node.js.");

});
it("should re-dispatch to DOM", function (done) {
if (_is_node.isNodeJS) {
pending("Document in not supported in Node.js.");
}
const eventBus = new _ui_utils.EventBus({
dispatchToDOM: true
});
let count = 0;
eventBus.on("test", function (evt) {
expect(evt).toEqual(undefined);
count++;
});
function domEventListener(evt) {
expect(evt.detail).toEqual({});
count++;
}
document.addEventListener("test", domEventListener);
eventBus.dispatch("test");
Promise.resolve().then(() => {
expect(count).toEqual(2);
document.removeEventListener("test", domEventListener);
done();
});
});
it("should re-dispatch to DOM, with arguments (without internal listeners)", function (done) {
if (_is_node.isNodeJS) {
pending("Document in not supported in Node.js.");
}
const eventBus = new _ui_utils.EventBus({
dispatchToDOM: true
});
let count = 0;
function domEventListener(evt) {
expect(evt.detail).toEqual({
abc: 123
});
count++;
}
document.addEventListener("test", domEventListener);
eventBus.dispatch("test", {
abc: 123
});
Promise.resolve().then(() => {
expect(count).toEqual(1);
document.removeEventListener("test", domEventListener);
done();
});
});
});

@@ -312,0 +258,0 @@ describe("isValidRotation", function () {

@@ -87,3 +87,3 @@ /**

it("should not normalize standard characters", function () {
expect(NormalizedUnicodes["A"]).toEqual(undefined);
expect(NormalizedUnicodes.A).toEqual(undefined);
});

@@ -90,0 +90,0 @@ });

@@ -29,4 +29,2 @@ /**

var _pdf = require("../pdf");
var _viewer_compatibility = require("./viewer_compatibility.js");

@@ -54,2 +52,7 @@

},
disableCreateObjectURL: {
value: false,
compatibility: _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL,
kind: OptionKind.VIEWER
},
disableHistory: {

@@ -63,11 +66,11 @@ value: false,

},
enablePrintAutoRotate: {
enablePermissions: {
value: false,
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
},
enableWebGL: {
enablePrintAutoRotate: {
value: false,
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
},
eventBusDispatchToDOM: {
enableWebGL: {
value: false,

@@ -105,2 +108,6 @@ kind: OptionKind.VIEWER + OptionKind.PREFERENCE

},
printResolution: {
value: 150,
kind: OptionKind.VIEWER
},
renderer: {

@@ -150,7 +157,2 @@ value: "canvas",

},
disableCreateObjectURL: {
value: false,
compatibility: _pdf.apiCompatibilityParams.disableCreateObjectURL,
kind: OptionKind.API
},
disableFontFace: {

@@ -172,2 +174,6 @@ value: false,

},
fontExtraProperties: {
value: false,
kind: OptionKind.API
},
isEvalSupported: {

@@ -174,0 +180,0 @@ value: true,

@@ -104,3 +104,3 @@ /**

this.viewer = options.viewer || options.container.firstElementChild;
this.eventBus = options.eventBus || (0, _ui_utils.getGlobalEventBus)();
this.eventBus = options.eventBus;
this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();

@@ -312,6 +312,14 @@ this.downloadManager = options.downloadManager || null;

get _setDocumentViewerElement() {
throw new Error("Not implemented: _setDocumentViewerElement");
get _viewerElement() {
throw new Error("Not implemented: _viewerElement");
}
_onePageRenderedOrForceFetch() {
if (!this.container.offsetParent || this._getVisiblePages().views.length === 0) {
return Promise.resolve();
}
return this._onePageRenderedCapability.promise;
}
setDocument(pdfDocument) {

@@ -381,3 +389,3 @@ if (this.pdfDocument) {

const pageView = new _pdf_page_view.PDFPageView({
container: this._setDocumentViewerElement,
container: this._viewerElement,
eventBus: this.eventBus,

@@ -414,3 +422,3 @@ id: pageNum,

this._onePageRenderedCapability.promise.then(() => {
this._onePageRenderedOrForceFetch().then(() => {
if (this.findController) {

@@ -420,3 +428,3 @@ this.findController.setDocument(pdfDocument);

if (pdfDocument.loadingParams["disableAutoFetch"] || pagesCount > 7500) {
if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > 7500) {
this._pagesCapability.resolve();

@@ -423,0 +431,0 @@

@@ -31,4 +31,6 @@ /**

var _viewer_compatibility = require("./viewer_compatibility.js");
;
const DISABLE_CREATE_OBJECT_URL = _pdf.apiCompatibilityParams.disableCreateObjectURL || false;
const DISABLE_CREATE_OBJECT_URL = _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL || false;

@@ -35,0 +37,0 @@ function download(blobUrl, filename) {

@@ -111,3 +111,3 @@ /**

const canvas = document.createElement("canvas");
const value = "mozPrintCallback" in canvas;
const value = ("mozPrintCallback" in canvas);
return (0, _pdf.shadow)(this, "supportsPrinting", value);

@@ -114,0 +114,0 @@ },

@@ -31,6 +31,6 @@ /**

var _app = require("./app.js");
var _pdf = require("../pdf");
var _app = require("./app.js");
var _preferences = require("./preferences.js");

@@ -103,3 +103,10 @@

downloadData(data, filename, contentType) {
const blobUrl = (0, _pdf.createObjectURL)(data, contentType);
const blobUrl = URL.createObjectURL(new Blob([data], {
type: contentType
}));
const onResponse = err => {
URL.revokeObjectURL(blobUrl);
};
FirefoxCom.request("download", {

@@ -110,3 +117,3 @@ blobUrl,

isAttachment: true
});
}, onResponse);
}

@@ -354,2 +361,7 @@

static get isInAutomation() {
const isInAutomation = FirefoxCom.requestSync("isInAutomation");
return (0, _pdf.shadow)(this, "isInAutomation", isInAutomation);
}
}

@@ -356,0 +368,0 @@

@@ -64,11 +64,9 @@ /**

_bindPdfLink(button, content, filename) {
if (this.downloadManager.disableCreateObjectURL) {
throw new Error('bindPdfLink: Unsupported "disableCreateObjectURL" value.');
}
let blobUrl;
button.onclick = function () {
button.onclick = () => {
if (!blobUrl) {
blobUrl = (0, _pdf.createObjectURL)(content, "application/pdf");
blobUrl = URL.createObjectURL(new Blob([content], {
type: "application/pdf"
}));
}

@@ -78,3 +76,12 @@

viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename);
window.open(viewerUrl);
try {
window.open(viewerUrl);
} catch (ex) {
console.error(`_bindPdfLink: ${ex}`);
URL.revokeObjectURL(blobUrl);
blobUrl = null;
this.downloadManager.downloadData(content, filename, "application/pdf");
}
return false;

@@ -81,0 +88,0 @@ };

@@ -65,17 +65,12 @@ /**

if (closeButton) {
closeButton.addEventListener("click", this.close.bind(this));
}
closeButton.addEventListener("click", this.close.bind(this));
this.overlayManager.register(this.overlayName, this.container, this.close.bind(this));
if (eventBus) {
eventBus._on("pagechanging", evt => {
this._currentPageNumber = evt.pageNumber;
});
eventBus._on("pagechanging", evt => {
this._currentPageNumber = evt.pageNumber;
});
eventBus._on("rotationchanging", evt => {
this._pagesRotation = evt.pagesRotation;
});
}
eventBus._on("rotationchanging", evt => {
this._pagesRotation = evt.pagesRotation;
});

@@ -102,3 +97,3 @@ this._isNonMetricLocale = true;

if (this.fieldData && currentPageNumber === this.fieldData["_currentPageNumber"] && pagesRotation === this.fieldData["_pagesRotation"]) {
if (this.fieldData && currentPageNumber === this.fieldData._currentPageNumber && pagesRotation === this.fieldData._pagesRotation) {
this._updateUI();

@@ -114,3 +109,3 @@

}) => {
return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(this.url || ""), this._parseFileSize(this.maybeFileSize), this._parseDate(info.CreationDate), this._parseDate(info.ModDate), this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {
return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(this.url), this._parseFileSize(this.maybeFileSize), this._parseDate(info.CreationDate), this._parseDate(info.ModDate), this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {
return this._parsePageSize((0, _ui_utils.getPageSizeInches)(pdfPage), pagesRotation);

@@ -147,3 +142,3 @@ }), this._parseLinearization(info.IsLinearized)]);

}).then(fileSize => {
if (fileSize === this.fieldData["fileSize"]) {
if (fileSize === this.fieldData.fileSize) {
return;

@@ -153,3 +148,3 @@ }

const data = Object.assign(Object.create(null), this.fieldData);
data["fileSize"] = fileSize;
data.fileSize = fileSize;
freezeFieldData(data);

@@ -156,0 +151,0 @@

@@ -29,6 +29,6 @@ /**

var _pdf_find_controller = require("./pdf_find_controller.js");
var _ui_utils = require("./ui_utils.js");
var _pdf_find_controller = require("./pdf_find_controller.js");
const MATCHES_COUNT_LIMIT = 1000;

@@ -49,3 +49,3 @@

this.findNextButton = options.findNextButton || null;
this.eventBus = eventBus || (0, _ui_utils.getGlobalEventBus)();
this.eventBus = eventBus;
this.l10n = l10n;

@@ -52,0 +52,0 @@ this.toggleButton.addEventListener("click", () => {

@@ -29,4 +29,2 @@ /**

var _ui_utils = require("./ui_utils.js");
var _pdf = require("../pdf");

@@ -36,2 +34,4 @@

var _ui_utils = require("./ui_utils.js");
const FindState = {

@@ -79,3 +79,3 @@ FOUND: 0,

this._linkService = linkService;
this._eventBus = eventBus || (0, _ui_utils.getGlobalEventBus)();
this._eventBus = eventBus;

@@ -82,0 +82,0 @@ this._reset();

@@ -47,3 +47,3 @@ /**

this.linkService = linkService;
this.eventBus = eventBus || (0, _ui_utils.getGlobalEventBus)();
this.eventBus = eventBus;
this._initialized = false;

@@ -107,3 +107,3 @@ this._fingerprint = "";

rotation
} = this._parseCurrentHash();
} = this._parseCurrentHash(true);

@@ -386,7 +386,9 @@ if (!hash || reInitialized || resetHistory) {

_parseCurrentHash() {
_parseCurrentHash(checkNameddest = false) {
const hash = unescape(getCurrentHash()).substring(1);
let page = (0, _ui_utils.parseQueryString)(hash).page | 0;
const params = (0, _ui_utils.parseQueryString)(hash);
const nameddest = params.nameddest || "";
let page = params.page | 0;
if (!(Number.isInteger(page) && page > 0 && page <= this.linkService.pagesCount)) {
if (!(Number.isInteger(page) && page > 0 && page <= this.linkService.pagesCount) || checkNameddest && nameddest.length > 0) {
page = null;

@@ -393,0 +395,0 @@ }

@@ -39,3 +39,3 @@ /**

} = {}) {
this.eventBus = eventBus || (0, _ui_utils.getGlobalEventBus)();
this.eventBus = eventBus;
this.externalLinkTarget = externalLinkTarget;

@@ -188,12 +188,7 @@ this.externalLinkRel = externalLinkRel;

source: this,
query: params["search"].replace(/"/g, ""),
phraseSearch: params["phrase"] === "true"
query: params.search.replace(/"/g, ""),
phraseSearch: params.phrase === "true"
});
}
if ("nameddest" in params) {
this.navigateTo(params.nameddest);
return;
}
if ("page" in params) {

@@ -251,2 +246,6 @@ pageNumber = params.page | 0 || 1;

}
if ("nameddest" in params) {
this.navigateTo(params.nameddest);
}
} else {

@@ -253,0 +252,0 @@ dest = unescape(hash);

@@ -57,3 +57,3 @@ /**

this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;
this.eventBus = options.eventBus || (0, _ui_utils.getGlobalEventBus)();
this.eventBus = options.eventBus;
this.renderingQueue = options.renderingQueue;

@@ -60,0 +60,0 @@ this.textLayerFactory = options.textLayerFactory;

@@ -369,3 +369,5 @@ /**

window.addEventListener("mousedown", this.mouseDownBind);
window.addEventListener("wheel", this.mouseWheelBind);
window.addEventListener("wheel", this.mouseWheelBind, {
passive: false
});
window.addEventListener("keydown", this.resetMouseScrollStateBind);

@@ -381,3 +383,5 @@ window.addEventListener("contextmenu", this.contextMenuBind);

window.removeEventListener("mousedown", this.mouseDownBind);
window.removeEventListener("wheel", this.mouseWheelBind);
window.removeEventListener("wheel", this.mouseWheelBind, {
passive: false
});
window.removeEventListener("keydown", this.resetMouseScrollStateBind);

@@ -384,0 +388,0 @@ window.removeEventListener("contextmenu", this.contextMenuBind);

@@ -75,3 +75,3 @@ /**

this.l10n = l10n || _ui_utils.NullL10n;
this.disableCreateObjectURL = pdfDocument.loadingParams["disableCreateObjectURL"];
this.disableCreateObjectURL = _app_options.AppOptions.get("disableCreateObjectURL");
this.currentPage = -1;

@@ -78,0 +78,0 @@ this.scratchCanvas = document.createElement("canvas");

@@ -42,4 +42,4 @@ /**

get _setDocumentViewerElement() {
return (0, _pdf.shadow)(this, "_setDocumentViewerElement", this._shadowViewer);
get _viewerElement() {
return (0, _pdf.shadow)(this, "_viewerElement", this._shadowViewer);
}

@@ -46,0 +46,0 @@

@@ -146,3 +146,3 @@ /**

const pdfjsVersion = '2.4.456';
const pdfjsBuild = '228a591c';
const pdfjsVersion = '2.5.207';
const pdfjsBuild = '0974d605';

@@ -34,4 +34,4 @@ /**

class PDFViewer extends _base_viewer.BaseViewer {
get _setDocumentViewerElement() {
return (0, _pdf.shadow)(this, "_setDocumentViewerElement", this.viewer);
get _viewerElement() {
return (0, _pdf.shadow)(this, "_viewerElement", this.viewer);
}

@@ -38,0 +38,0 @@

@@ -28,2 +28,5 @@ /**

exports.BasePreferences = void 0;
var _app_options = require("./app_options.js");
let defaultPreferences = null;

@@ -37,5 +40,5 @@

"disablePageLabels": false,
"enablePermissions": false,
"enablePrintAutoRotate": false,
"enableWebGL": false,
"eventBusDispatchToDOM": false,
"externalLinkTarget": 0,

@@ -42,0 +45,0 @@ "historyUpdateUrl": false,

@@ -29,4 +29,2 @@ /**

var _ui_utils = require("./ui_utils.js");
var _pdf = require("../pdf");

@@ -46,3 +44,3 @@

this.textLayerDiv = textLayerDiv;
this.eventBus = eventBus || (0, _ui_utils.getGlobalEventBus)();
this.eventBus = eventBus;
this.textContent = null;

@@ -49,0 +47,0 @@ this.textContentItemsStr = [];

@@ -31,3 +31,2 @@ /**

exports.isPortraitOrientation = isPortraitOrientation;
exports.getGlobalEventBus = getGlobalEventBus;
exports.clamp = clamp;

@@ -240,3 +239,3 @@ exports.getPDFFileNameFromURL = getPDFFileNameFromURL;

if (items.length === 0 || !condition(items[maxIndex])) {
if (maxIndex < 0 || !condition(items[maxIndex])) {
return items.length;

@@ -571,37 +570,8 @@ }

function dispatchDOMEvent(eventName, args = null) {
const details = Object.create(null);
if (args && args.length > 0) {
const obj = args[0];
for (const key in obj) {
const value = obj[key];
if (key === "source") {
if (value === window || value === document) {
return;
}
continue;
}
details[key] = value;
}
}
const event = document.createEvent("CustomEvent");
event.initCustomEvent(eventName, true, true, details);
document.dispatchEvent(event);
throw new Error("Not implemented: dispatchDOMEvent");
}
class EventBus {
constructor({
dispatchToDOM = false
} = {}) {
constructor(options) {
this._listeners = Object.create(null);
this._dispatchToDOM = dispatchToDOM === true;
if (dispatchToDOM) {
console.error("The `eventBusDispatchToDOM` option/preference is deprecated, " + "add event listeners to the EventBus instance rather than the DOM.");
}
}

@@ -625,7 +595,2 @@

if (!eventListeners || eventListeners.length === 0) {
if (this._dispatchToDOM) {
const args = Array.prototype.slice.call(arguments, 1);
dispatchDOMEvent(eventName, args);
}
return;

@@ -658,6 +623,2 @@ }

}
if (this._dispatchToDOM) {
dispatchDOMEvent(eventName, args);
}
}

@@ -696,16 +657,3 @@

exports.EventBus = EventBus;
let globalEventBus = null;
function getGlobalEventBus(dispatchToDOM = false) {
console.error("getGlobalEventBus is deprecated, use a manually created EventBus instance instead.");
if (!globalEventBus) {
globalEventBus = new EventBus({
dispatchToDOM
});
}
return globalEventBus;
}
function clamp(v, min, max) {

@@ -712,0 +660,0 @@ return Math.min(Math.max(v, min), max);

@@ -36,4 +36,5 @@ /**

const database = JSON.parse(databaseStr || "{}");
let index = -1;
if (!("files" in database)) {
if (!Array.isArray(database.files)) {
database.files = [];

@@ -44,12 +45,10 @@ } else {

}
}
let index = -1;
for (let i = 0, ii = database.files.length; i < ii; i++) {
const branch = database.files[i];
for (let i = 0, length = database.files.length; i < length; i++) {
const branch = database.files[i];
if (branch.fingerprint === this.fingerprint) {
index = i;
break;
if (branch.fingerprint === this.fingerprint) {
index = i;
break;
}
}

@@ -56,0 +55,0 @@ }

@@ -24,2 +24,6 @@ /**

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.viewerCompatibilityParams = void 0;
const compatibilityParams = Object.create(null);

@@ -31,4 +35,12 @@ {

const isAndroid = /Android/.test(userAgent);
const isIE = /Trident/.test(userAgent);
const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;
const isIOSChrome = /CriOS/.test(userAgent);
(function checkOnBlobSupport() {
if (isIE || isIOSChrome) {
compatibilityParams.disableCreateObjectURL = true;
}
})();
(function checkCanvasSizeLimitation() {

@@ -40,2 +52,3 @@ if (isIOS || isAndroid) {

}
exports.viewerCompatibilityParams = Object.freeze(compatibilityParams);
const viewerCompatibilityParams = Object.freeze(compatibilityParams);
exports.viewerCompatibilityParams = viewerCompatibilityParams;
{
"name": "pdfjs-dist",
"version": "2.4.456",
"version": "2.5.207",
"main": "build/pdf.js",

@@ -5,0 +5,0 @@ "description": "Generic build of Mozilla's PDF.js library.",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc