@vaadin-component-factory/vcf-pdf-viewer 0.9.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -10
- package/src/vcf-pdf-viewer.js +20 -19
- package/theme/lumo/vcf-pdf-viewer-styles.js +3 -3
- package/theme/material/vcf-pdf-viewer-styles.js +4 -4
- package/pdfjs/dist/get.js +0 -1857
- package/pdfjs/dist/index.js +0 -767
- package/pdfjs/dist/typeof.js +0 -100
package/pdfjs/dist/get.js
DELETED
|
@@ -1,1857 +0,0 @@
|
|
|
1
|
-
import { _ as _asyncToGenerator, r as regenerator } from './index.js';
|
|
2
|
-
import { c as _typeof, d as _arrayLikeToArray$1, e as _unsupportedIterableToArray$1, a as _classCallCheck, _ as _createClass, b as _slicedToArray } from './typeof.js';
|
|
3
|
-
|
|
4
|
-
function _setPrototypeOf(o, p) {
|
|
5
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
6
|
-
o.__proto__ = p;
|
|
7
|
-
return o;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
return _setPrototypeOf(o, p);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function _inherits(subClass, superClass) {
|
|
14
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
15
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
19
|
-
constructor: {
|
|
20
|
-
value: subClass,
|
|
21
|
-
writable: true,
|
|
22
|
-
configurable: true
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _assertThisInitialized(self) {
|
|
29
|
-
if (self === void 0) {
|
|
30
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return self;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function _possibleConstructorReturn(self, call) {
|
|
37
|
-
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
38
|
-
return call;
|
|
39
|
-
} else if (call !== void 0) {
|
|
40
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return _assertThisInitialized(self);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function _getPrototypeOf(o) {
|
|
47
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
48
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
49
|
-
};
|
|
50
|
-
return _getPrototypeOf(o);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function _arrayWithoutHoles(arr) {
|
|
54
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function _iterableToArray(iter) {
|
|
58
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function _nonIterableSpread() {
|
|
62
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function _toConsumableArray(arr) {
|
|
66
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* Copyright 2018 Mozilla Foundation
|
|
70
|
-
*
|
|
71
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
72
|
-
* you may not use this file except in compliance with the License.
|
|
73
|
-
* You may obtain a copy of the License at
|
|
74
|
-
*
|
|
75
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
76
|
-
*
|
|
77
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
78
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
79
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
80
|
-
* See the License for the specific language governing permissions and
|
|
81
|
-
* limitations under the License.
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
/* globals process */
|
|
85
|
-
// NW.js / Electron is a browser context, but copies some Node.js objects; see
|
|
86
|
-
// http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context
|
|
87
|
-
// https://www.electronjs.org/docs/api/process#processversionselectron-readonly
|
|
88
|
-
// https://www.electronjs.org/docs/api/process#processtype-readonly
|
|
89
|
-
var isNodeJS = (typeof process === "undefined" ? "undefined" : _typeof(process)) === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
|
|
90
|
-
|
|
91
|
-
/* Copyright 2017 Mozilla Foundation
|
|
92
|
-
*
|
|
93
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
94
|
-
* you may not use this file except in compliance with the License.
|
|
95
|
-
* You may obtain a copy of the License at
|
|
96
|
-
*
|
|
97
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
98
|
-
*
|
|
99
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
100
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
101
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
102
|
-
* See the License for the specific language governing permissions and
|
|
103
|
-
* limitations under the License.
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
if ((typeof PDFJSDev === "undefined" || !PDFJSDev.test("SKIP_BABEL")) && (typeof globalThis === "undefined" || !globalThis._pdfjsCompatibilityChecked)) {
|
|
107
|
-
// Provides support for globalThis in legacy browsers.
|
|
108
|
-
// Support: Firefox<65, Chrome<71, Safari<12.1
|
|
109
|
-
if (typeof globalThis === "undefined" || globalThis.Math !== Math) {
|
|
110
|
-
// eslint-disable-next-line no-global-assign
|
|
111
|
-
globalThis = require("core-js/es/global-this");
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
globalThis._pdfjsCompatibilityChecked = true; // Support: Node.js
|
|
115
|
-
|
|
116
|
-
(function checkNodeBtoa() {
|
|
117
|
-
if (globalThis.btoa || !isNodeJS) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
globalThis.btoa = function (chars) {
|
|
122
|
-
// eslint-disable-next-line no-undef
|
|
123
|
-
return Buffer.from(chars, "binary").toString("base64");
|
|
124
|
-
};
|
|
125
|
-
})(); // Support: Node.js
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
(function checkNodeAtob() {
|
|
129
|
-
if (globalThis.atob || !isNodeJS) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
globalThis.atob = function (input) {
|
|
134
|
-
// eslint-disable-next-line no-undef
|
|
135
|
-
return Buffer.from(input, "base64").toString("binary");
|
|
136
|
-
};
|
|
137
|
-
})(); // Support: Node.js
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
(function checkDOMMatrix() {
|
|
141
|
-
if (globalThis.DOMMatrix || !isNodeJS) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
globalThis.DOMMatrix = require("dommatrix/dist/dommatrix.js");
|
|
146
|
-
})(); // Provides support for Object.fromEntries in legacy browsers.
|
|
147
|
-
// Support: Firefox<63, Chrome<73, Safari<12.1, Node.js<12.0.0
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
(function checkObjectFromEntries() {
|
|
151
|
-
if (Object.fromEntries) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
require("core-js/es/object/from-entries.js");
|
|
156
|
-
})(); // Provides support for *recent* additions to the Promise specification,
|
|
157
|
-
// however basic Promise support is assumed to be available natively.
|
|
158
|
-
// Support: Firefox<71, Chrome<76, Safari<13, Node.js<12.9.0
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
(function checkPromise() {
|
|
162
|
-
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
|
|
163
|
-
// The current image decoders are synchronous, hence `Promise` shouldn't
|
|
164
|
-
// need to be polyfilled for the IMAGE_DECODERS build target.
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (globalThis.Promise.allSettled) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
globalThis.Promise = require("core-js/es/promise/index.js");
|
|
173
|
-
})(); // Support: Node.js
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
(function checkReadableStream() {
|
|
177
|
-
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
|
|
178
|
-
// The current image decoders are synchronous, hence `ReadableStream`
|
|
179
|
-
// shouldn't need to be polyfilled for the IMAGE_DECODERS build target.
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
var isReadableStreamSupported = false;
|
|
184
|
-
|
|
185
|
-
if (typeof ReadableStream !== "undefined") {
|
|
186
|
-
// MS Edge may say it has ReadableStream but they are not up to spec yet.
|
|
187
|
-
try {
|
|
188
|
-
// eslint-disable-next-line no-new
|
|
189
|
-
new ReadableStream({
|
|
190
|
-
start: function start(controller) {
|
|
191
|
-
controller.close();
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
isReadableStreamSupported = true;
|
|
195
|
-
} catch (e) {// The ReadableStream constructor cannot be used.
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (isReadableStreamSupported) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
|
|
204
|
-
})();
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
208
|
-
|
|
209
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
210
|
-
|
|
211
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
212
|
-
|
|
213
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
214
|
-
|
|
215
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
216
|
-
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
|
217
|
-
var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; // Permission flags from Table 22, Section 7.6.3.2 of the PDF specification.
|
|
218
|
-
|
|
219
|
-
var PermissionFlag = {
|
|
220
|
-
PRINT: 0x04,
|
|
221
|
-
MODIFY_CONTENTS: 0x08,
|
|
222
|
-
COPY: 0x10,
|
|
223
|
-
MODIFY_ANNOTATIONS: 0x20,
|
|
224
|
-
FILL_INTERACTIVE_FORMS: 0x100,
|
|
225
|
-
COPY_FOR_ACCESSIBILITY: 0x200,
|
|
226
|
-
ASSEMBLE: 0x400,
|
|
227
|
-
PRINT_HIGH_QUALITY: 0x800
|
|
228
|
-
};
|
|
229
|
-
var TextRenderingMode = {
|
|
230
|
-
FILL: 0,
|
|
231
|
-
STROKE: 1,
|
|
232
|
-
FILL_STROKE: 2,
|
|
233
|
-
INVISIBLE: 3,
|
|
234
|
-
FILL_ADD_TO_PATH: 4,
|
|
235
|
-
STROKE_ADD_TO_PATH: 5,
|
|
236
|
-
FILL_STROKE_ADD_TO_PATH: 6,
|
|
237
|
-
ADD_TO_PATH: 7,
|
|
238
|
-
FILL_STROKE_MASK: 3,
|
|
239
|
-
ADD_TO_PATH_FLAG: 4
|
|
240
|
-
};
|
|
241
|
-
var ImageKind = {
|
|
242
|
-
GRAYSCALE_1BPP: 1,
|
|
243
|
-
RGB_24BPP: 2,
|
|
244
|
-
RGBA_32BPP: 3
|
|
245
|
-
};
|
|
246
|
-
var AnnotationType = {
|
|
247
|
-
TEXT: 1,
|
|
248
|
-
LINK: 2,
|
|
249
|
-
FREETEXT: 3,
|
|
250
|
-
LINE: 4,
|
|
251
|
-
SQUARE: 5,
|
|
252
|
-
CIRCLE: 6,
|
|
253
|
-
POLYGON: 7,
|
|
254
|
-
POLYLINE: 8,
|
|
255
|
-
HIGHLIGHT: 9,
|
|
256
|
-
UNDERLINE: 10,
|
|
257
|
-
SQUIGGLY: 11,
|
|
258
|
-
STRIKEOUT: 12,
|
|
259
|
-
STAMP: 13,
|
|
260
|
-
CARET: 14,
|
|
261
|
-
INK: 15,
|
|
262
|
-
POPUP: 16,
|
|
263
|
-
FILEATTACHMENT: 17,
|
|
264
|
-
SOUND: 18,
|
|
265
|
-
MOVIE: 19,
|
|
266
|
-
WIDGET: 20,
|
|
267
|
-
SCREEN: 21,
|
|
268
|
-
PRINTERMARK: 22,
|
|
269
|
-
TRAPNET: 23,
|
|
270
|
-
WATERMARK: 24,
|
|
271
|
-
THREED: 25,
|
|
272
|
-
REDACT: 26
|
|
273
|
-
};
|
|
274
|
-
var AnnotationReplyType = {
|
|
275
|
-
GROUP: "Group",
|
|
276
|
-
REPLY: "R"
|
|
277
|
-
};
|
|
278
|
-
var AnnotationFlag = {
|
|
279
|
-
INVISIBLE: 0x01,
|
|
280
|
-
HIDDEN: 0x02,
|
|
281
|
-
PRINT: 0x04,
|
|
282
|
-
NOZOOM: 0x08,
|
|
283
|
-
NOROTATE: 0x10,
|
|
284
|
-
NOVIEW: 0x20,
|
|
285
|
-
READONLY: 0x40,
|
|
286
|
-
LOCKED: 0x80,
|
|
287
|
-
TOGGLENOVIEW: 0x100,
|
|
288
|
-
LOCKEDCONTENTS: 0x200
|
|
289
|
-
};
|
|
290
|
-
var AnnotationFieldFlag = {
|
|
291
|
-
READONLY: 0x0000001,
|
|
292
|
-
REQUIRED: 0x0000002,
|
|
293
|
-
NOEXPORT: 0x0000004,
|
|
294
|
-
MULTILINE: 0x0001000,
|
|
295
|
-
PASSWORD: 0x0002000,
|
|
296
|
-
NOTOGGLETOOFF: 0x0004000,
|
|
297
|
-
RADIO: 0x0008000,
|
|
298
|
-
PUSHBUTTON: 0x0010000,
|
|
299
|
-
COMBO: 0x0020000,
|
|
300
|
-
EDIT: 0x0040000,
|
|
301
|
-
SORT: 0x0080000,
|
|
302
|
-
FILESELECT: 0x0100000,
|
|
303
|
-
MULTISELECT: 0x0200000,
|
|
304
|
-
DONOTSPELLCHECK: 0x0400000,
|
|
305
|
-
DONOTSCROLL: 0x0800000,
|
|
306
|
-
COMB: 0x1000000,
|
|
307
|
-
RICHTEXT: 0x2000000,
|
|
308
|
-
RADIOSINUNISON: 0x2000000,
|
|
309
|
-
COMMITONSELCHANGE: 0x4000000
|
|
310
|
-
};
|
|
311
|
-
var AnnotationBorderStyleType = {
|
|
312
|
-
SOLID: 1,
|
|
313
|
-
DASHED: 2,
|
|
314
|
-
BEVELED: 3,
|
|
315
|
-
INSET: 4,
|
|
316
|
-
UNDERLINE: 5
|
|
317
|
-
};
|
|
318
|
-
var AnnotationActionEventType = {
|
|
319
|
-
E: "Mouse Enter",
|
|
320
|
-
X: "Mouse Exit",
|
|
321
|
-
D: "Mouse Down",
|
|
322
|
-
U: "Mouse Up",
|
|
323
|
-
Fo: "Focus",
|
|
324
|
-
Bl: "Blur",
|
|
325
|
-
PO: "PageOpen",
|
|
326
|
-
PC: "PageClose",
|
|
327
|
-
PV: "PageVisible",
|
|
328
|
-
PI: "PageInvisible",
|
|
329
|
-
K: "Keystroke",
|
|
330
|
-
F: "Format",
|
|
331
|
-
V: "Validate",
|
|
332
|
-
C: "Calculate"
|
|
333
|
-
};
|
|
334
|
-
var DocumentActionEventType = {
|
|
335
|
-
WC: "WillClose",
|
|
336
|
-
WS: "WillSave",
|
|
337
|
-
DS: "DidSave",
|
|
338
|
-
WP: "WillPrint",
|
|
339
|
-
DP: "DidPrint"
|
|
340
|
-
};
|
|
341
|
-
var PageActionEventType = {
|
|
342
|
-
O: "PageOpen",
|
|
343
|
-
C: "PageClose"
|
|
344
|
-
};
|
|
345
|
-
var StreamType = {
|
|
346
|
-
UNKNOWN: "UNKNOWN",
|
|
347
|
-
FLATE: "FLATE",
|
|
348
|
-
LZW: "LZW",
|
|
349
|
-
DCT: "DCT",
|
|
350
|
-
JPX: "JPX",
|
|
351
|
-
JBIG: "JBIG",
|
|
352
|
-
A85: "A85",
|
|
353
|
-
AHX: "AHX",
|
|
354
|
-
CCF: "CCF",
|
|
355
|
-
RLX: "RLX" // PDF short name is 'RL', but telemetry requires three chars.
|
|
356
|
-
|
|
357
|
-
};
|
|
358
|
-
var FontType = {
|
|
359
|
-
UNKNOWN: "UNKNOWN",
|
|
360
|
-
TYPE1: "TYPE1",
|
|
361
|
-
TYPE1STANDARD: "TYPE1STANDARD",
|
|
362
|
-
TYPE1C: "TYPE1C",
|
|
363
|
-
CIDFONTTYPE0: "CIDFONTTYPE0",
|
|
364
|
-
CIDFONTTYPE0C: "CIDFONTTYPE0C",
|
|
365
|
-
TRUETYPE: "TRUETYPE",
|
|
366
|
-
CIDFONTTYPE2: "CIDFONTTYPE2",
|
|
367
|
-
TYPE3: "TYPE3",
|
|
368
|
-
OPENTYPE: "OPENTYPE",
|
|
369
|
-
TYPE0: "TYPE0",
|
|
370
|
-
MMTYPE1: "MMTYPE1"
|
|
371
|
-
};
|
|
372
|
-
var VerbosityLevel = {
|
|
373
|
-
ERRORS: 0,
|
|
374
|
-
WARNINGS: 1,
|
|
375
|
-
INFOS: 5
|
|
376
|
-
};
|
|
377
|
-
var CMapCompressionType = {
|
|
378
|
-
NONE: 0,
|
|
379
|
-
BINARY: 1,
|
|
380
|
-
STREAM: 2
|
|
381
|
-
}; // All the possible operations for an operator list.
|
|
382
|
-
|
|
383
|
-
var OPS = {
|
|
384
|
-
// Intentionally start from 1 so it is easy to spot bad operators that will be
|
|
385
|
-
// 0's.
|
|
386
|
-
dependency: 1,
|
|
387
|
-
setLineWidth: 2,
|
|
388
|
-
setLineCap: 3,
|
|
389
|
-
setLineJoin: 4,
|
|
390
|
-
setMiterLimit: 5,
|
|
391
|
-
setDash: 6,
|
|
392
|
-
setRenderingIntent: 7,
|
|
393
|
-
setFlatness: 8,
|
|
394
|
-
setGState: 9,
|
|
395
|
-
save: 10,
|
|
396
|
-
restore: 11,
|
|
397
|
-
transform: 12,
|
|
398
|
-
moveTo: 13,
|
|
399
|
-
lineTo: 14,
|
|
400
|
-
curveTo: 15,
|
|
401
|
-
curveTo2: 16,
|
|
402
|
-
curveTo3: 17,
|
|
403
|
-
closePath: 18,
|
|
404
|
-
rectangle: 19,
|
|
405
|
-
stroke: 20,
|
|
406
|
-
closeStroke: 21,
|
|
407
|
-
fill: 22,
|
|
408
|
-
eoFill: 23,
|
|
409
|
-
fillStroke: 24,
|
|
410
|
-
eoFillStroke: 25,
|
|
411
|
-
closeFillStroke: 26,
|
|
412
|
-
closeEOFillStroke: 27,
|
|
413
|
-
endPath: 28,
|
|
414
|
-
clip: 29,
|
|
415
|
-
eoClip: 30,
|
|
416
|
-
beginText: 31,
|
|
417
|
-
endText: 32,
|
|
418
|
-
setCharSpacing: 33,
|
|
419
|
-
setWordSpacing: 34,
|
|
420
|
-
setHScale: 35,
|
|
421
|
-
setLeading: 36,
|
|
422
|
-
setFont: 37,
|
|
423
|
-
setTextRenderingMode: 38,
|
|
424
|
-
setTextRise: 39,
|
|
425
|
-
moveText: 40,
|
|
426
|
-
setLeadingMoveText: 41,
|
|
427
|
-
setTextMatrix: 42,
|
|
428
|
-
nextLine: 43,
|
|
429
|
-
showText: 44,
|
|
430
|
-
showSpacedText: 45,
|
|
431
|
-
nextLineShowText: 46,
|
|
432
|
-
nextLineSetSpacingShowText: 47,
|
|
433
|
-
setCharWidth: 48,
|
|
434
|
-
setCharWidthAndBounds: 49,
|
|
435
|
-
setStrokeColorSpace: 50,
|
|
436
|
-
setFillColorSpace: 51,
|
|
437
|
-
setStrokeColor: 52,
|
|
438
|
-
setStrokeColorN: 53,
|
|
439
|
-
setFillColor: 54,
|
|
440
|
-
setFillColorN: 55,
|
|
441
|
-
setStrokeGray: 56,
|
|
442
|
-
setFillGray: 57,
|
|
443
|
-
setStrokeRGBColor: 58,
|
|
444
|
-
setFillRGBColor: 59,
|
|
445
|
-
setStrokeCMYKColor: 60,
|
|
446
|
-
setFillCMYKColor: 61,
|
|
447
|
-
shadingFill: 62,
|
|
448
|
-
beginInlineImage: 63,
|
|
449
|
-
beginImageData: 64,
|
|
450
|
-
endInlineImage: 65,
|
|
451
|
-
paintXObject: 66,
|
|
452
|
-
markPoint: 67,
|
|
453
|
-
markPointProps: 68,
|
|
454
|
-
beginMarkedContent: 69,
|
|
455
|
-
beginMarkedContentProps: 70,
|
|
456
|
-
endMarkedContent: 71,
|
|
457
|
-
beginCompat: 72,
|
|
458
|
-
endCompat: 73,
|
|
459
|
-
paintFormXObjectBegin: 74,
|
|
460
|
-
paintFormXObjectEnd: 75,
|
|
461
|
-
beginGroup: 76,
|
|
462
|
-
endGroup: 77,
|
|
463
|
-
beginAnnotations: 78,
|
|
464
|
-
endAnnotations: 79,
|
|
465
|
-
beginAnnotation: 80,
|
|
466
|
-
endAnnotation: 81,
|
|
467
|
-
paintJpegXObject: 82,
|
|
468
|
-
paintImageMaskXObject: 83,
|
|
469
|
-
paintImageMaskXObjectGroup: 84,
|
|
470
|
-
paintImageXObject: 85,
|
|
471
|
-
paintInlineImageXObject: 86,
|
|
472
|
-
paintInlineImageXObjectGroup: 87,
|
|
473
|
-
paintImageXObjectRepeat: 88,
|
|
474
|
-
paintImageMaskXObjectRepeat: 89,
|
|
475
|
-
paintSolidColorImageMask: 90,
|
|
476
|
-
constructPath: 91
|
|
477
|
-
};
|
|
478
|
-
var UNSUPPORTED_FEATURES = {
|
|
479
|
-
/** @deprecated unused */
|
|
480
|
-
unknown: "unknown",
|
|
481
|
-
forms: "forms",
|
|
482
|
-
javaScript: "javaScript",
|
|
483
|
-
signatures: "signatures",
|
|
484
|
-
smask: "smask",
|
|
485
|
-
shadingPattern: "shadingPattern",
|
|
486
|
-
|
|
487
|
-
/** @deprecated unused */
|
|
488
|
-
font: "font",
|
|
489
|
-
errorTilingPattern: "errorTilingPattern",
|
|
490
|
-
errorExtGState: "errorExtGState",
|
|
491
|
-
errorXObject: "errorXObject",
|
|
492
|
-
errorFontLoadType3: "errorFontLoadType3",
|
|
493
|
-
errorFontState: "errorFontState",
|
|
494
|
-
errorFontMissing: "errorFontMissing",
|
|
495
|
-
errorFontTranslate: "errorFontTranslate",
|
|
496
|
-
errorColorSpace: "errorColorSpace",
|
|
497
|
-
errorOperatorList: "errorOperatorList",
|
|
498
|
-
errorFontToUnicode: "errorFontToUnicode",
|
|
499
|
-
errorFontLoadNative: "errorFontLoadNative",
|
|
500
|
-
errorFontBuildPath: "errorFontBuildPath",
|
|
501
|
-
errorFontGetPath: "errorFontGetPath",
|
|
502
|
-
errorMarkedContent: "errorMarkedContent"
|
|
503
|
-
};
|
|
504
|
-
var PasswordResponses = {
|
|
505
|
-
NEED_PASSWORD: 1,
|
|
506
|
-
INCORRECT_PASSWORD: 2
|
|
507
|
-
};
|
|
508
|
-
var verbosity = VerbosityLevel.WARNINGS;
|
|
509
|
-
|
|
510
|
-
function setVerbosityLevel(level) {
|
|
511
|
-
if (Number.isInteger(level)) {
|
|
512
|
-
verbosity = level;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
function getVerbosityLevel() {
|
|
517
|
-
return verbosity;
|
|
518
|
-
} // A notice for devs. These are good for things that are helpful to devs, such
|
|
519
|
-
// as warning that Workers were disabled, which is important to devs but not
|
|
520
|
-
// end users.
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
function info(msg) {
|
|
524
|
-
if (verbosity >= VerbosityLevel.INFOS) {
|
|
525
|
-
console.log("Info: ".concat(msg));
|
|
526
|
-
}
|
|
527
|
-
} // Non-fatal warnings.
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
function warn(msg) {
|
|
531
|
-
if (verbosity >= VerbosityLevel.WARNINGS) {
|
|
532
|
-
console.log("Warning: ".concat(msg));
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
function unreachable(msg) {
|
|
537
|
-
throw new Error(msg);
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
function assert(cond, msg) {
|
|
541
|
-
if (!cond) {
|
|
542
|
-
unreachable(msg);
|
|
543
|
-
}
|
|
544
|
-
} // Checks if URLs have the same origin. For non-HTTP based URLs, returns false.
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
function isSameOrigin(baseUrl, otherUrl) {
|
|
548
|
-
var base;
|
|
549
|
-
|
|
550
|
-
try {
|
|
551
|
-
base = new URL(baseUrl);
|
|
552
|
-
|
|
553
|
-
if (!base.origin || base.origin === "null") {
|
|
554
|
-
return false; // non-HTTP url
|
|
555
|
-
}
|
|
556
|
-
} catch (e) {
|
|
557
|
-
return false;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
var other = new URL(otherUrl, base);
|
|
561
|
-
return base.origin === other.origin;
|
|
562
|
-
} // Checks if URLs use one of the allowed protocols, e.g. to avoid XSS.
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
function _isValidProtocol(url) {
|
|
566
|
-
if (!url) {
|
|
567
|
-
return false;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
switch (url.protocol) {
|
|
571
|
-
case "http:":
|
|
572
|
-
case "https:":
|
|
573
|
-
case "ftp:":
|
|
574
|
-
case "mailto:":
|
|
575
|
-
case "tel:":
|
|
576
|
-
return true;
|
|
577
|
-
|
|
578
|
-
default:
|
|
579
|
-
return false;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* Attempts to create a valid absolute URL.
|
|
584
|
-
*
|
|
585
|
-
* @param {URL|string} url - An absolute, or relative, URL.
|
|
586
|
-
* @param {URL|string} baseUrl - An absolute URL.
|
|
587
|
-
* @returns Either a valid {URL}, or `null` otherwise.
|
|
588
|
-
*/
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
function createValidAbsoluteUrl(url, baseUrl) {
|
|
592
|
-
if (!url) {
|
|
593
|
-
return null;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
try {
|
|
597
|
-
var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
|
|
598
|
-
|
|
599
|
-
if (_isValidProtocol(absoluteUrl)) {
|
|
600
|
-
return absoluteUrl;
|
|
601
|
-
}
|
|
602
|
-
} catch (ex) {
|
|
603
|
-
/* `new URL()` will throw on incorrect data. */
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
return null;
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
function shadow(obj, prop, value) {
|
|
610
|
-
Object.defineProperty(obj, prop, {
|
|
611
|
-
value: value,
|
|
612
|
-
enumerable: true,
|
|
613
|
-
configurable: true,
|
|
614
|
-
writable: false
|
|
615
|
-
});
|
|
616
|
-
return value;
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* @type {any}
|
|
620
|
-
*/
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
var BaseException = function BaseExceptionClosure() {
|
|
624
|
-
// eslint-disable-next-line no-shadow
|
|
625
|
-
function BaseException(message) {
|
|
626
|
-
if (this.constructor === BaseException) {
|
|
627
|
-
unreachable("Cannot initialize BaseException.");
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
this.message = message;
|
|
631
|
-
this.name = this.constructor.name;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
BaseException.prototype = new Error();
|
|
635
|
-
BaseException.constructor = BaseException;
|
|
636
|
-
return BaseException;
|
|
637
|
-
}();
|
|
638
|
-
|
|
639
|
-
var PasswordException = /*#__PURE__*/function (_BaseException) {
|
|
640
|
-
_inherits(PasswordException, _BaseException);
|
|
641
|
-
|
|
642
|
-
var _super = _createSuper(PasswordException);
|
|
643
|
-
|
|
644
|
-
function PasswordException(msg, code) {
|
|
645
|
-
var _this;
|
|
646
|
-
|
|
647
|
-
_classCallCheck(this, PasswordException);
|
|
648
|
-
|
|
649
|
-
_this = _super.call(this, msg);
|
|
650
|
-
_this.code = code;
|
|
651
|
-
return _this;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
return PasswordException;
|
|
655
|
-
}(BaseException);
|
|
656
|
-
|
|
657
|
-
var UnknownErrorException = /*#__PURE__*/function (_BaseException2) {
|
|
658
|
-
_inherits(UnknownErrorException, _BaseException2);
|
|
659
|
-
|
|
660
|
-
var _super2 = _createSuper(UnknownErrorException);
|
|
661
|
-
|
|
662
|
-
function UnknownErrorException(msg, details) {
|
|
663
|
-
var _this2;
|
|
664
|
-
|
|
665
|
-
_classCallCheck(this, UnknownErrorException);
|
|
666
|
-
|
|
667
|
-
_this2 = _super2.call(this, msg);
|
|
668
|
-
_this2.details = details;
|
|
669
|
-
return _this2;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
return UnknownErrorException;
|
|
673
|
-
}(BaseException);
|
|
674
|
-
|
|
675
|
-
var InvalidPDFException = /*#__PURE__*/function (_BaseException3) {
|
|
676
|
-
_inherits(InvalidPDFException, _BaseException3);
|
|
677
|
-
|
|
678
|
-
var _super3 = _createSuper(InvalidPDFException);
|
|
679
|
-
|
|
680
|
-
function InvalidPDFException() {
|
|
681
|
-
_classCallCheck(this, InvalidPDFException);
|
|
682
|
-
|
|
683
|
-
return _super3.apply(this, arguments);
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
return InvalidPDFException;
|
|
687
|
-
}(BaseException);
|
|
688
|
-
|
|
689
|
-
var MissingPDFException = /*#__PURE__*/function (_BaseException4) {
|
|
690
|
-
_inherits(MissingPDFException, _BaseException4);
|
|
691
|
-
|
|
692
|
-
var _super4 = _createSuper(MissingPDFException);
|
|
693
|
-
|
|
694
|
-
function MissingPDFException() {
|
|
695
|
-
_classCallCheck(this, MissingPDFException);
|
|
696
|
-
|
|
697
|
-
return _super4.apply(this, arguments);
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
return MissingPDFException;
|
|
701
|
-
}(BaseException);
|
|
702
|
-
|
|
703
|
-
var UnexpectedResponseException = /*#__PURE__*/function (_BaseException5) {
|
|
704
|
-
_inherits(UnexpectedResponseException, _BaseException5);
|
|
705
|
-
|
|
706
|
-
var _super5 = _createSuper(UnexpectedResponseException);
|
|
707
|
-
|
|
708
|
-
function UnexpectedResponseException(msg, status) {
|
|
709
|
-
var _this3;
|
|
710
|
-
|
|
711
|
-
_classCallCheck(this, UnexpectedResponseException);
|
|
712
|
-
|
|
713
|
-
_this3 = _super5.call(this, msg);
|
|
714
|
-
_this3.status = status;
|
|
715
|
-
return _this3;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
return UnexpectedResponseException;
|
|
719
|
-
}(BaseException);
|
|
720
|
-
/**
|
|
721
|
-
* Error caused during parsing PDF data.
|
|
722
|
-
*/
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
var FormatError = /*#__PURE__*/function (_BaseException6) {
|
|
726
|
-
_inherits(FormatError, _BaseException6);
|
|
727
|
-
|
|
728
|
-
var _super6 = _createSuper(FormatError);
|
|
729
|
-
|
|
730
|
-
function FormatError() {
|
|
731
|
-
_classCallCheck(this, FormatError);
|
|
732
|
-
|
|
733
|
-
return _super6.apply(this, arguments);
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
return FormatError;
|
|
737
|
-
}(BaseException);
|
|
738
|
-
/**
|
|
739
|
-
* Error used to indicate task cancellation.
|
|
740
|
-
*/
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
var AbortException = /*#__PURE__*/function (_BaseException7) {
|
|
744
|
-
_inherits(AbortException, _BaseException7);
|
|
745
|
-
|
|
746
|
-
var _super7 = _createSuper(AbortException);
|
|
747
|
-
|
|
748
|
-
function AbortException() {
|
|
749
|
-
_classCallCheck(this, AbortException);
|
|
750
|
-
|
|
751
|
-
return _super7.apply(this, arguments);
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
return AbortException;
|
|
755
|
-
}(BaseException);
|
|
756
|
-
|
|
757
|
-
var NullCharactersRegExp = /\x00/g;
|
|
758
|
-
/**
|
|
759
|
-
* @param {string} str
|
|
760
|
-
*/
|
|
761
|
-
|
|
762
|
-
function removeNullCharacters(str) {
|
|
763
|
-
if (typeof str !== "string") {
|
|
764
|
-
warn("The argument for removeNullCharacters must be a string.");
|
|
765
|
-
return str;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
return str.replace(NullCharactersRegExp, "");
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
function bytesToString(bytes) {
|
|
772
|
-
assert(bytes !== null && _typeof(bytes) === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
|
|
773
|
-
var length = bytes.length;
|
|
774
|
-
var MAX_ARGUMENT_COUNT = 8192;
|
|
775
|
-
|
|
776
|
-
if (length < MAX_ARGUMENT_COUNT) {
|
|
777
|
-
return String.fromCharCode.apply(null, bytes);
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
var strBuf = [];
|
|
781
|
-
|
|
782
|
-
for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
|
|
783
|
-
var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
|
|
784
|
-
var chunk = bytes.subarray(i, chunkEnd);
|
|
785
|
-
strBuf.push(String.fromCharCode.apply(null, chunk));
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
return strBuf.join("");
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
function stringToBytes(str) {
|
|
792
|
-
assert(typeof str === "string", "Invalid argument for stringToBytes");
|
|
793
|
-
var length = str.length;
|
|
794
|
-
var bytes = new Uint8Array(length);
|
|
795
|
-
|
|
796
|
-
for (var i = 0; i < length; ++i) {
|
|
797
|
-
bytes[i] = str.charCodeAt(i) & 0xff;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
return bytes;
|
|
801
|
-
}
|
|
802
|
-
/**
|
|
803
|
-
* Gets length of the array (Array, Uint8Array, or string) in bytes.
|
|
804
|
-
* @param {Array<any>|Uint8Array|string} arr
|
|
805
|
-
* @returns {number}
|
|
806
|
-
*/
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
function arrayByteLength(arr) {
|
|
810
|
-
if (arr.length !== undefined) {
|
|
811
|
-
return arr.length;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
|
|
815
|
-
return arr.byteLength;
|
|
816
|
-
}
|
|
817
|
-
/**
|
|
818
|
-
* Combines array items (arrays) into single Uint8Array object.
|
|
819
|
-
* @param {Array<Array<any>|Uint8Array|string>} arr - the array of the arrays
|
|
820
|
-
* (Array, Uint8Array, or string).
|
|
821
|
-
* @returns {Uint8Array}
|
|
822
|
-
*/
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
function arraysToBytes(arr) {
|
|
826
|
-
var length = arr.length; // Shortcut: if first and only item is Uint8Array, return it.
|
|
827
|
-
|
|
828
|
-
if (length === 1 && arr[0] instanceof Uint8Array) {
|
|
829
|
-
return arr[0];
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
var resultLength = 0;
|
|
833
|
-
|
|
834
|
-
for (var i = 0; i < length; i++) {
|
|
835
|
-
resultLength += arrayByteLength(arr[i]);
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
var pos = 0;
|
|
839
|
-
var data = new Uint8Array(resultLength);
|
|
840
|
-
|
|
841
|
-
for (var _i = 0; _i < length; _i++) {
|
|
842
|
-
var item = arr[_i];
|
|
843
|
-
|
|
844
|
-
if (!(item instanceof Uint8Array)) {
|
|
845
|
-
if (typeof item === "string") {
|
|
846
|
-
item = stringToBytes(item);
|
|
847
|
-
} else {
|
|
848
|
-
item = new Uint8Array(item);
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
var itemLength = item.byteLength;
|
|
853
|
-
data.set(item, pos);
|
|
854
|
-
pos += itemLength;
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
return data;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
function string32(value) {
|
|
861
|
-
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("!PRODUCTION || TESTING")) {
|
|
862
|
-
assert(typeof value === "number" && Math.abs(value) < Math.pow(2, 32), "string32: Unexpected input \"".concat(value, "\"."));
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
function objectSize(obj) {
|
|
869
|
-
return Object.keys(obj).length;
|
|
870
|
-
} // Ensure that the returned Object has a `null` prototype; hence why
|
|
871
|
-
// `Object.fromEntries(...)` is not used.
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
function objectFromMap(map) {
|
|
875
|
-
var obj = Object.create(null);
|
|
876
|
-
|
|
877
|
-
var _iterator = _createForOfIteratorHelper(map),
|
|
878
|
-
_step;
|
|
879
|
-
|
|
880
|
-
try {
|
|
881
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
882
|
-
var _step$value = _slicedToArray(_step.value, 2),
|
|
883
|
-
key = _step$value[0],
|
|
884
|
-
value = _step$value[1];
|
|
885
|
-
|
|
886
|
-
obj[key] = value;
|
|
887
|
-
}
|
|
888
|
-
} catch (err) {
|
|
889
|
-
_iterator.e(err);
|
|
890
|
-
} finally {
|
|
891
|
-
_iterator.f();
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
return obj;
|
|
895
|
-
} // Checks the endianness of the platform.
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
function isLittleEndian() {
|
|
899
|
-
var buffer8 = new Uint8Array(4);
|
|
900
|
-
buffer8[0] = 1;
|
|
901
|
-
var view32 = new Uint32Array(buffer8.buffer, 0, 1);
|
|
902
|
-
return view32[0] === 1;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
var IsLittleEndianCached = {
|
|
906
|
-
get value() {
|
|
907
|
-
return shadow(this, "value", isLittleEndian());
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
}; // Checks if it's possible to eval JS expressions.
|
|
911
|
-
|
|
912
|
-
function isEvalSupported() {
|
|
913
|
-
try {
|
|
914
|
-
new Function(""); // eslint-disable-line no-new, no-new-func
|
|
915
|
-
|
|
916
|
-
return true;
|
|
917
|
-
} catch (e) {
|
|
918
|
-
return false;
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
var IsEvalSupportedCached = {
|
|
923
|
-
get value() {
|
|
924
|
-
return shadow(this, "value", isEvalSupported());
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
};
|
|
928
|
-
|
|
929
|
-
var hexNumbers = _toConsumableArray(Array(256).keys()).map(function (n) {
|
|
930
|
-
return n.toString(16).padStart(2, "0");
|
|
931
|
-
});
|
|
932
|
-
|
|
933
|
-
var Util = /*#__PURE__*/function () {
|
|
934
|
-
function Util() {
|
|
935
|
-
_classCallCheck(this, Util);
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
_createClass(Util, null, [{
|
|
939
|
-
key: "makeHexColor",
|
|
940
|
-
value: function makeHexColor(r, g, b) {
|
|
941
|
-
return "#".concat(hexNumbers[r]).concat(hexNumbers[g]).concat(hexNumbers[b]);
|
|
942
|
-
} // Concatenates two transformation matrices together and returns the result.
|
|
943
|
-
|
|
944
|
-
}, {
|
|
945
|
-
key: "transform",
|
|
946
|
-
value: function transform(m1, m2) {
|
|
947
|
-
return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
|
|
948
|
-
} // For 2d affine transforms
|
|
949
|
-
|
|
950
|
-
}, {
|
|
951
|
-
key: "applyTransform",
|
|
952
|
-
value: function applyTransform(p, m) {
|
|
953
|
-
var xt = p[0] * m[0] + p[1] * m[2] + m[4];
|
|
954
|
-
var yt = p[0] * m[1] + p[1] * m[3] + m[5];
|
|
955
|
-
return [xt, yt];
|
|
956
|
-
}
|
|
957
|
-
}, {
|
|
958
|
-
key: "applyInverseTransform",
|
|
959
|
-
value: function applyInverseTransform(p, m) {
|
|
960
|
-
var d = m[0] * m[3] - m[1] * m[2];
|
|
961
|
-
var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
|
|
962
|
-
var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
|
|
963
|
-
return [xt, yt];
|
|
964
|
-
} // Applies the transform to the rectangle and finds the minimum axially
|
|
965
|
-
// aligned bounding box.
|
|
966
|
-
|
|
967
|
-
}, {
|
|
968
|
-
key: "getAxialAlignedBoundingBox",
|
|
969
|
-
value: function getAxialAlignedBoundingBox(r, m) {
|
|
970
|
-
var p1 = Util.applyTransform(r, m);
|
|
971
|
-
var p2 = Util.applyTransform(r.slice(2, 4), m);
|
|
972
|
-
var p3 = Util.applyTransform([r[0], r[3]], m);
|
|
973
|
-
var p4 = Util.applyTransform([r[2], r[1]], m);
|
|
974
|
-
return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
|
|
975
|
-
}
|
|
976
|
-
}, {
|
|
977
|
-
key: "inverseTransform",
|
|
978
|
-
value: function inverseTransform(m) {
|
|
979
|
-
var d = m[0] * m[3] - m[1] * m[2];
|
|
980
|
-
return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
|
|
981
|
-
} // Apply a generic 3d matrix M on a 3-vector v:
|
|
982
|
-
// | a b c | | X |
|
|
983
|
-
// | d e f | x | Y |
|
|
984
|
-
// | g h i | | Z |
|
|
985
|
-
// M is assumed to be serialized as [a,b,c,d,e,f,g,h,i],
|
|
986
|
-
// with v as [X,Y,Z]
|
|
987
|
-
|
|
988
|
-
}, {
|
|
989
|
-
key: "apply3dTransform",
|
|
990
|
-
value: function apply3dTransform(m, v) {
|
|
991
|
-
return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
|
|
992
|
-
} // This calculation uses Singular Value Decomposition.
|
|
993
|
-
// The SVD can be represented with formula A = USV. We are interested in the
|
|
994
|
-
// matrix S here because it represents the scale values.
|
|
995
|
-
|
|
996
|
-
}, {
|
|
997
|
-
key: "singularValueDecompose2dScale",
|
|
998
|
-
value: function singularValueDecompose2dScale(m) {
|
|
999
|
-
var transpose = [m[0], m[2], m[1], m[3]]; // Multiply matrix m with its transpose.
|
|
1000
|
-
|
|
1001
|
-
var a = m[0] * transpose[0] + m[1] * transpose[2];
|
|
1002
|
-
var b = m[0] * transpose[1] + m[1] * transpose[3];
|
|
1003
|
-
var c = m[2] * transpose[0] + m[3] * transpose[2];
|
|
1004
|
-
var d = m[2] * transpose[1] + m[3] * transpose[3]; // Solve the second degree polynomial to get roots.
|
|
1005
|
-
|
|
1006
|
-
var first = (a + d) / 2;
|
|
1007
|
-
var second = Math.sqrt(Math.pow(a + d, 2) - 4 * (a * d - c * b)) / 2;
|
|
1008
|
-
var sx = first + second || 1;
|
|
1009
|
-
var sy = first - second || 1; // Scale values are the square roots of the eigenvalues.
|
|
1010
|
-
|
|
1011
|
-
return [Math.sqrt(sx), Math.sqrt(sy)];
|
|
1012
|
-
} // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)
|
|
1013
|
-
// For coordinate systems whose origin lies in the bottom-left, this
|
|
1014
|
-
// means normalization to (BL,TR) ordering. For systems with origin in the
|
|
1015
|
-
// top-left, this means (TL,BR) ordering.
|
|
1016
|
-
|
|
1017
|
-
}, {
|
|
1018
|
-
key: "normalizeRect",
|
|
1019
|
-
value: function normalizeRect(rect) {
|
|
1020
|
-
var r = rect.slice(0); // clone rect
|
|
1021
|
-
|
|
1022
|
-
if (rect[0] > rect[2]) {
|
|
1023
|
-
r[0] = rect[2];
|
|
1024
|
-
r[2] = rect[0];
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
if (rect[1] > rect[3]) {
|
|
1028
|
-
r[1] = rect[3];
|
|
1029
|
-
r[3] = rect[1];
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
return r;
|
|
1033
|
-
} // Returns a rectangle [x1, y1, x2, y2] corresponding to the
|
|
1034
|
-
// intersection of rect1 and rect2. If no intersection, returns 'false'
|
|
1035
|
-
// The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]
|
|
1036
|
-
|
|
1037
|
-
}, {
|
|
1038
|
-
key: "intersect",
|
|
1039
|
-
value: function intersect(rect1, rect2) {
|
|
1040
|
-
function compare(a, b) {
|
|
1041
|
-
return a - b;
|
|
1042
|
-
} // Order points along the axes
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
|
|
1046
|
-
var orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
|
|
1047
|
-
var result = [];
|
|
1048
|
-
rect1 = Util.normalizeRect(rect1);
|
|
1049
|
-
rect2 = Util.normalizeRect(rect2); // X: first and second points belong to different rectangles?
|
|
1050
|
-
|
|
1051
|
-
if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
|
|
1052
|
-
// Intersection must be between second and third points
|
|
1053
|
-
result[0] = orderedX[1];
|
|
1054
|
-
result[2] = orderedX[2];
|
|
1055
|
-
} else {
|
|
1056
|
-
return null;
|
|
1057
|
-
} // Y: first and second points belong to different rectangles?
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
|
|
1061
|
-
// Intersection must be between second and third points
|
|
1062
|
-
result[1] = orderedY[1];
|
|
1063
|
-
result[3] = orderedY[2];
|
|
1064
|
-
} else {
|
|
1065
|
-
return null;
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
return result;
|
|
1069
|
-
}
|
|
1070
|
-
}]);
|
|
1071
|
-
|
|
1072
|
-
return Util;
|
|
1073
|
-
}();
|
|
1074
|
-
|
|
1075
|
-
var PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac];
|
|
1076
|
-
|
|
1077
|
-
function stringToPDFString(str) {
|
|
1078
|
-
var length = str.length,
|
|
1079
|
-
strBuf = [];
|
|
1080
|
-
|
|
1081
|
-
if (str[0] === "\xFE" && str[1] === "\xFF") {
|
|
1082
|
-
// UTF16BE BOM
|
|
1083
|
-
for (var i = 2; i < length; i += 2) {
|
|
1084
|
-
strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
|
|
1085
|
-
}
|
|
1086
|
-
} else if (str[0] === "\xFF" && str[1] === "\xFE") {
|
|
1087
|
-
// UTF16LE BOM
|
|
1088
|
-
for (var _i2 = 2; _i2 < length; _i2 += 2) {
|
|
1089
|
-
strBuf.push(String.fromCharCode(str.charCodeAt(_i2 + 1) << 8 | str.charCodeAt(_i2)));
|
|
1090
|
-
}
|
|
1091
|
-
} else {
|
|
1092
|
-
for (var _i3 = 0; _i3 < length; ++_i3) {
|
|
1093
|
-
var code = PDFStringTranslateTable[str.charCodeAt(_i3)];
|
|
1094
|
-
strBuf.push(code ? String.fromCharCode(code) : str.charAt(_i3));
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
return strBuf.join("");
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
function escapeString(str) {
|
|
1102
|
-
// replace "(", ")", "\n", "\r" and "\"
|
|
1103
|
-
// by "\(", "\)", "\\n", "\\r" and "\\"
|
|
1104
|
-
// in order to write it in a PDF file.
|
|
1105
|
-
return str.replace(/([()\\\n\r])/g, function (match) {
|
|
1106
|
-
if (match === "\n") {
|
|
1107
|
-
return "\\n";
|
|
1108
|
-
} else if (match === "\r") {
|
|
1109
|
-
return "\\r";
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
return "\\".concat(match);
|
|
1113
|
-
});
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
function isAscii(str) {
|
|
1117
|
-
return /^[\x00-\x7F]*$/.test(str);
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
function stringToUTF16BEString(str) {
|
|
1121
|
-
var buf = ["\xFE\xFF"];
|
|
1122
|
-
|
|
1123
|
-
for (var i = 0, ii = str.length; i < ii; i++) {
|
|
1124
|
-
var char = str.charCodeAt(i);
|
|
1125
|
-
buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
return buf.join("");
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
function stringToUTF8String(str) {
|
|
1132
|
-
return decodeURIComponent(escape(str));
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
function utf8StringToString(str) {
|
|
1136
|
-
return unescape(encodeURIComponent(str));
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
function isBool(v) {
|
|
1140
|
-
return typeof v === "boolean";
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
function isNum(v) {
|
|
1144
|
-
return typeof v === "number";
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
function isString(v) {
|
|
1148
|
-
return typeof v === "string";
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
function isArrayBuffer(v) {
|
|
1152
|
-
return _typeof(v) === "object" && v !== null && v.byteLength !== undefined;
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
function isArrayEqual(arr1, arr2) {
|
|
1156
|
-
if (arr1.length !== arr2.length) {
|
|
1157
|
-
return false;
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
for (var i = 0, ii = arr1.length; i < ii; i++) {
|
|
1161
|
-
if (arr1[i] !== arr2[i]) {
|
|
1162
|
-
return false;
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
return true;
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
function getModificationDate() {
|
|
1170
|
-
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
|
|
1171
|
-
var buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), date.getUTCDate().toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")];
|
|
1172
|
-
return buffer.join("");
|
|
1173
|
-
}
|
|
1174
|
-
/**
|
|
1175
|
-
* Promise Capability object.
|
|
1176
|
-
*
|
|
1177
|
-
* @typedef {Object} PromiseCapability
|
|
1178
|
-
* @property {Promise<any>} promise - A Promise object.
|
|
1179
|
-
* @property {boolean} settled - If the Promise has been fulfilled/rejected.
|
|
1180
|
-
* @property {function} resolve - Fulfills the Promise.
|
|
1181
|
-
* @property {function} reject - Rejects the Promise.
|
|
1182
|
-
*/
|
|
1183
|
-
|
|
1184
|
-
/**
|
|
1185
|
-
* Creates a promise capability object.
|
|
1186
|
-
* @alias createPromiseCapability
|
|
1187
|
-
*
|
|
1188
|
-
* @returns {PromiseCapability}
|
|
1189
|
-
*/
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
function createPromiseCapability() {
|
|
1193
|
-
var capability = Object.create(null);
|
|
1194
|
-
var isSettled = false;
|
|
1195
|
-
Object.defineProperty(capability, "settled", {
|
|
1196
|
-
get: function get() {
|
|
1197
|
-
return isSettled;
|
|
1198
|
-
}
|
|
1199
|
-
});
|
|
1200
|
-
capability.promise = new Promise(function (resolve, reject) {
|
|
1201
|
-
capability.resolve = function (data) {
|
|
1202
|
-
isSettled = true;
|
|
1203
|
-
resolve(data);
|
|
1204
|
-
};
|
|
1205
|
-
|
|
1206
|
-
capability.reject = function (reason) {
|
|
1207
|
-
isSettled = true;
|
|
1208
|
-
reject(reason);
|
|
1209
|
-
};
|
|
1210
|
-
});
|
|
1211
|
-
return capability;
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
function createObjectURL(data) {
|
|
1215
|
-
var contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
1216
|
-
var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1217
|
-
|
|
1218
|
-
if (URL.createObjectURL && !forceDataSchema) {
|
|
1219
|
-
return URL.createObjectURL(new Blob([data], {
|
|
1220
|
-
type: contentType
|
|
1221
|
-
}));
|
|
1222
|
-
} // Blob/createObjectURL is not available, falling back to data schema.
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
var digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
1226
|
-
var buffer = "data:".concat(contentType, ";base64,");
|
|
1227
|
-
|
|
1228
|
-
for (var i = 0, ii = data.length; i < ii; i += 3) {
|
|
1229
|
-
var b1 = data[i] & 0xff;
|
|
1230
|
-
var b2 = data[i + 1] & 0xff;
|
|
1231
|
-
var b3 = data[i + 2] & 0xff;
|
|
1232
|
-
var d1 = b1 >> 2,
|
|
1233
|
-
d2 = (b1 & 3) << 4 | b2 >> 4;
|
|
1234
|
-
var d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
|
|
1235
|
-
var d4 = i + 2 < ii ? b3 & 0x3f : 64;
|
|
1236
|
-
buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
return buffer;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
var CallbackKind = {
|
|
1243
|
-
UNKNOWN: 0,
|
|
1244
|
-
DATA: 1,
|
|
1245
|
-
ERROR: 2
|
|
1246
|
-
};
|
|
1247
|
-
var StreamKind = {
|
|
1248
|
-
UNKNOWN: 0,
|
|
1249
|
-
CANCEL: 1,
|
|
1250
|
-
CANCEL_COMPLETE: 2,
|
|
1251
|
-
CLOSE: 3,
|
|
1252
|
-
ENQUEUE: 4,
|
|
1253
|
-
ERROR: 5,
|
|
1254
|
-
PULL: 6,
|
|
1255
|
-
PULL_COMPLETE: 7,
|
|
1256
|
-
START_COMPLETE: 8
|
|
1257
|
-
};
|
|
1258
|
-
|
|
1259
|
-
function wrapReason(reason) {
|
|
1260
|
-
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("!PRODUCTION || TESTING")) {
|
|
1261
|
-
assert(reason instanceof Error || _typeof(reason) === "object" && reason !== null, 'wrapReason: Expected "reason" to be a (possibly cloned) Error.');
|
|
1262
|
-
} else {
|
|
1263
|
-
if (_typeof(reason) !== "object" || reason === null) {
|
|
1264
|
-
return reason;
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
switch (reason.name) {
|
|
1269
|
-
case "AbortException":
|
|
1270
|
-
return new AbortException(reason.message);
|
|
1271
|
-
|
|
1272
|
-
case "MissingPDFException":
|
|
1273
|
-
return new MissingPDFException(reason.message);
|
|
1274
|
-
|
|
1275
|
-
case "UnexpectedResponseException":
|
|
1276
|
-
return new UnexpectedResponseException(reason.message, reason.status);
|
|
1277
|
-
|
|
1278
|
-
case "UnknownErrorException":
|
|
1279
|
-
return new UnknownErrorException(reason.message, reason.details);
|
|
1280
|
-
|
|
1281
|
-
default:
|
|
1282
|
-
return new UnknownErrorException(reason.message, reason.toString());
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
var MessageHandler = /*#__PURE__*/function () {
|
|
1287
|
-
function MessageHandler(sourceName, targetName, comObj) {
|
|
1288
|
-
var _this = this;
|
|
1289
|
-
|
|
1290
|
-
_classCallCheck(this, MessageHandler);
|
|
1291
|
-
|
|
1292
|
-
this.sourceName = sourceName;
|
|
1293
|
-
this.targetName = targetName;
|
|
1294
|
-
this.comObj = comObj;
|
|
1295
|
-
this.callbackId = 1;
|
|
1296
|
-
this.streamId = 1;
|
|
1297
|
-
this.postMessageTransfers = true;
|
|
1298
|
-
this.streamSinks = Object.create(null);
|
|
1299
|
-
this.streamControllers = Object.create(null);
|
|
1300
|
-
this.callbackCapabilities = Object.create(null);
|
|
1301
|
-
this.actionHandler = Object.create(null);
|
|
1302
|
-
|
|
1303
|
-
this._onComObjOnMessage = function (event) {
|
|
1304
|
-
var data = event.data;
|
|
1305
|
-
|
|
1306
|
-
if (data.targetName !== _this.sourceName) {
|
|
1307
|
-
return;
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
if (data.stream) {
|
|
1311
|
-
_this._processStreamMessage(data);
|
|
1312
|
-
|
|
1313
|
-
return;
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
if (data.callback) {
|
|
1317
|
-
var callbackId = data.callbackId;
|
|
1318
|
-
var capability = _this.callbackCapabilities[callbackId];
|
|
1319
|
-
|
|
1320
|
-
if (!capability) {
|
|
1321
|
-
throw new Error("Cannot resolve callback ".concat(callbackId));
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
delete _this.callbackCapabilities[callbackId];
|
|
1325
|
-
|
|
1326
|
-
if (data.callback === CallbackKind.DATA) {
|
|
1327
|
-
capability.resolve(data.data);
|
|
1328
|
-
} else if (data.callback === CallbackKind.ERROR) {
|
|
1329
|
-
capability.reject(wrapReason(data.reason));
|
|
1330
|
-
} else {
|
|
1331
|
-
throw new Error("Unexpected callback case");
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
return;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
var action = _this.actionHandler[data.action];
|
|
1338
|
-
|
|
1339
|
-
if (!action) {
|
|
1340
|
-
throw new Error("Unknown action from worker: ".concat(data.action));
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
if (data.callbackId) {
|
|
1344
|
-
var cbSourceName = _this.sourceName;
|
|
1345
|
-
var cbTargetName = data.sourceName;
|
|
1346
|
-
new Promise(function (resolve) {
|
|
1347
|
-
resolve(action(data.data));
|
|
1348
|
-
}).then(function (result) {
|
|
1349
|
-
comObj.postMessage({
|
|
1350
|
-
sourceName: cbSourceName,
|
|
1351
|
-
targetName: cbTargetName,
|
|
1352
|
-
callback: CallbackKind.DATA,
|
|
1353
|
-
callbackId: data.callbackId,
|
|
1354
|
-
data: result
|
|
1355
|
-
});
|
|
1356
|
-
}, function (reason) {
|
|
1357
|
-
comObj.postMessage({
|
|
1358
|
-
sourceName: cbSourceName,
|
|
1359
|
-
targetName: cbTargetName,
|
|
1360
|
-
callback: CallbackKind.ERROR,
|
|
1361
|
-
callbackId: data.callbackId,
|
|
1362
|
-
reason: wrapReason(reason)
|
|
1363
|
-
});
|
|
1364
|
-
});
|
|
1365
|
-
return;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
if (data.streamId) {
|
|
1369
|
-
_this._createStreamSink(data);
|
|
1370
|
-
|
|
1371
|
-
return;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
action(data.data);
|
|
1375
|
-
};
|
|
1376
|
-
|
|
1377
|
-
comObj.addEventListener("message", this._onComObjOnMessage);
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
_createClass(MessageHandler, [{
|
|
1381
|
-
key: "on",
|
|
1382
|
-
value: function on(actionName, handler) {
|
|
1383
|
-
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("!PRODUCTION || TESTING")) {
|
|
1384
|
-
assert(typeof handler === "function", 'MessageHandler.on: Expected "handler" to be a function.');
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
var ah = this.actionHandler;
|
|
1388
|
-
|
|
1389
|
-
if (ah[actionName]) {
|
|
1390
|
-
throw new Error("There is already an actionName called \"".concat(actionName, "\""));
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
ah[actionName] = handler;
|
|
1394
|
-
}
|
|
1395
|
-
/**
|
|
1396
|
-
* Sends a message to the comObj to invoke the action with the supplied data.
|
|
1397
|
-
* @param {string} actionName - Action to call.
|
|
1398
|
-
* @param {JSON} data - JSON data to send.
|
|
1399
|
-
* @param {Array} [transfers] - List of transfers/ArrayBuffers.
|
|
1400
|
-
*/
|
|
1401
|
-
|
|
1402
|
-
}, {
|
|
1403
|
-
key: "send",
|
|
1404
|
-
value: function send(actionName, data, transfers) {
|
|
1405
|
-
this._postMessage({
|
|
1406
|
-
sourceName: this.sourceName,
|
|
1407
|
-
targetName: this.targetName,
|
|
1408
|
-
action: actionName,
|
|
1409
|
-
data: data
|
|
1410
|
-
}, transfers);
|
|
1411
|
-
}
|
|
1412
|
-
/**
|
|
1413
|
-
* Sends a message to the comObj to invoke the action with the supplied data.
|
|
1414
|
-
* Expects that the other side will callback with the response.
|
|
1415
|
-
* @param {string} actionName - Action to call.
|
|
1416
|
-
* @param {JSON} data - JSON data to send.
|
|
1417
|
-
* @param {Array} [transfers] - List of transfers/ArrayBuffers.
|
|
1418
|
-
* @returns {Promise} Promise to be resolved with response data.
|
|
1419
|
-
*/
|
|
1420
|
-
|
|
1421
|
-
}, {
|
|
1422
|
-
key: "sendWithPromise",
|
|
1423
|
-
value: function sendWithPromise(actionName, data, transfers) {
|
|
1424
|
-
var callbackId = this.callbackId++;
|
|
1425
|
-
var capability = createPromiseCapability();
|
|
1426
|
-
this.callbackCapabilities[callbackId] = capability;
|
|
1427
|
-
|
|
1428
|
-
try {
|
|
1429
|
-
this._postMessage({
|
|
1430
|
-
sourceName: this.sourceName,
|
|
1431
|
-
targetName: this.targetName,
|
|
1432
|
-
action: actionName,
|
|
1433
|
-
callbackId: callbackId,
|
|
1434
|
-
data: data
|
|
1435
|
-
}, transfers);
|
|
1436
|
-
} catch (ex) {
|
|
1437
|
-
capability.reject(ex);
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
return capability.promise;
|
|
1441
|
-
}
|
|
1442
|
-
/**
|
|
1443
|
-
* Sends a message to the comObj to invoke the action with the supplied data.
|
|
1444
|
-
* Expect that the other side will callback to signal 'start_complete'.
|
|
1445
|
-
* @param {string} actionName - Action to call.
|
|
1446
|
-
* @param {JSON} data - JSON data to send.
|
|
1447
|
-
* @param {Object} queueingStrategy - Strategy to signal backpressure based on
|
|
1448
|
-
* internal queue.
|
|
1449
|
-
* @param {Array} [transfers] - List of transfers/ArrayBuffers.
|
|
1450
|
-
* @returns {ReadableStream} ReadableStream to read data in chunks.
|
|
1451
|
-
*/
|
|
1452
|
-
|
|
1453
|
-
}, {
|
|
1454
|
-
key: "sendWithStream",
|
|
1455
|
-
value: function sendWithStream(actionName, data, queueingStrategy, transfers) {
|
|
1456
|
-
var _this2 = this;
|
|
1457
|
-
|
|
1458
|
-
var streamId = this.streamId++;
|
|
1459
|
-
var sourceName = this.sourceName;
|
|
1460
|
-
var targetName = this.targetName;
|
|
1461
|
-
var comObj = this.comObj;
|
|
1462
|
-
return new ReadableStream({
|
|
1463
|
-
start: function start(controller) {
|
|
1464
|
-
var startCapability = createPromiseCapability();
|
|
1465
|
-
_this2.streamControllers[streamId] = {
|
|
1466
|
-
controller: controller,
|
|
1467
|
-
startCall: startCapability,
|
|
1468
|
-
pullCall: null,
|
|
1469
|
-
cancelCall: null,
|
|
1470
|
-
isClosed: false
|
|
1471
|
-
};
|
|
1472
|
-
|
|
1473
|
-
_this2._postMessage({
|
|
1474
|
-
sourceName: sourceName,
|
|
1475
|
-
targetName: targetName,
|
|
1476
|
-
action: actionName,
|
|
1477
|
-
streamId: streamId,
|
|
1478
|
-
data: data,
|
|
1479
|
-
desiredSize: controller.desiredSize
|
|
1480
|
-
}, transfers); // Return Promise for Async process, to signal success/failure.
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
return startCapability.promise;
|
|
1484
|
-
},
|
|
1485
|
-
pull: function pull(controller) {
|
|
1486
|
-
var pullCapability = createPromiseCapability();
|
|
1487
|
-
_this2.streamControllers[streamId].pullCall = pullCapability;
|
|
1488
|
-
comObj.postMessage({
|
|
1489
|
-
sourceName: sourceName,
|
|
1490
|
-
targetName: targetName,
|
|
1491
|
-
stream: StreamKind.PULL,
|
|
1492
|
-
streamId: streamId,
|
|
1493
|
-
desiredSize: controller.desiredSize
|
|
1494
|
-
}); // Returning Promise will not call "pull"
|
|
1495
|
-
// again until current pull is resolved.
|
|
1496
|
-
|
|
1497
|
-
return pullCapability.promise;
|
|
1498
|
-
},
|
|
1499
|
-
cancel: function cancel(reason) {
|
|
1500
|
-
assert(reason instanceof Error, "cancel must have a valid reason");
|
|
1501
|
-
var cancelCapability = createPromiseCapability();
|
|
1502
|
-
_this2.streamControllers[streamId].cancelCall = cancelCapability;
|
|
1503
|
-
_this2.streamControllers[streamId].isClosed = true;
|
|
1504
|
-
comObj.postMessage({
|
|
1505
|
-
sourceName: sourceName,
|
|
1506
|
-
targetName: targetName,
|
|
1507
|
-
stream: StreamKind.CANCEL,
|
|
1508
|
-
streamId: streamId,
|
|
1509
|
-
reason: wrapReason(reason)
|
|
1510
|
-
}); // Return Promise to signal success or failure.
|
|
1511
|
-
|
|
1512
|
-
return cancelCapability.promise;
|
|
1513
|
-
}
|
|
1514
|
-
}, queueingStrategy);
|
|
1515
|
-
}
|
|
1516
|
-
/**
|
|
1517
|
-
* @private
|
|
1518
|
-
*/
|
|
1519
|
-
|
|
1520
|
-
}, {
|
|
1521
|
-
key: "_createStreamSink",
|
|
1522
|
-
value: function _createStreamSink(data) {
|
|
1523
|
-
var self = this;
|
|
1524
|
-
var action = this.actionHandler[data.action];
|
|
1525
|
-
var streamId = data.streamId;
|
|
1526
|
-
var sourceName = this.sourceName;
|
|
1527
|
-
var targetName = data.sourceName;
|
|
1528
|
-
var comObj = this.comObj;
|
|
1529
|
-
var streamSink = {
|
|
1530
|
-
enqueue: function enqueue(chunk) {
|
|
1531
|
-
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
1532
|
-
var transfers = arguments.length > 2 ? arguments[2] : undefined;
|
|
1533
|
-
|
|
1534
|
-
if (this.isCancelled) {
|
|
1535
|
-
return;
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
var lastDesiredSize = this.desiredSize;
|
|
1539
|
-
this.desiredSize -= size; // Enqueue decreases the desiredSize property of sink,
|
|
1540
|
-
// so when it changes from positive to negative,
|
|
1541
|
-
// set ready as unresolved promise.
|
|
1542
|
-
|
|
1543
|
-
if (lastDesiredSize > 0 && this.desiredSize <= 0) {
|
|
1544
|
-
this.sinkCapability = createPromiseCapability();
|
|
1545
|
-
this.ready = this.sinkCapability.promise;
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
self._postMessage({
|
|
1549
|
-
sourceName: sourceName,
|
|
1550
|
-
targetName: targetName,
|
|
1551
|
-
stream: StreamKind.ENQUEUE,
|
|
1552
|
-
streamId: streamId,
|
|
1553
|
-
chunk: chunk
|
|
1554
|
-
}, transfers);
|
|
1555
|
-
},
|
|
1556
|
-
close: function close() {
|
|
1557
|
-
if (this.isCancelled) {
|
|
1558
|
-
return;
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
this.isCancelled = true;
|
|
1562
|
-
comObj.postMessage({
|
|
1563
|
-
sourceName: sourceName,
|
|
1564
|
-
targetName: targetName,
|
|
1565
|
-
stream: StreamKind.CLOSE,
|
|
1566
|
-
streamId: streamId
|
|
1567
|
-
});
|
|
1568
|
-
delete self.streamSinks[streamId];
|
|
1569
|
-
},
|
|
1570
|
-
error: function error(reason) {
|
|
1571
|
-
assert(reason instanceof Error, "error must have a valid reason");
|
|
1572
|
-
|
|
1573
|
-
if (this.isCancelled) {
|
|
1574
|
-
return;
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
this.isCancelled = true;
|
|
1578
|
-
comObj.postMessage({
|
|
1579
|
-
sourceName: sourceName,
|
|
1580
|
-
targetName: targetName,
|
|
1581
|
-
stream: StreamKind.ERROR,
|
|
1582
|
-
streamId: streamId,
|
|
1583
|
-
reason: wrapReason(reason)
|
|
1584
|
-
});
|
|
1585
|
-
},
|
|
1586
|
-
sinkCapability: createPromiseCapability(),
|
|
1587
|
-
onPull: null,
|
|
1588
|
-
onCancel: null,
|
|
1589
|
-
isCancelled: false,
|
|
1590
|
-
desiredSize: data.desiredSize,
|
|
1591
|
-
ready: null
|
|
1592
|
-
};
|
|
1593
|
-
streamSink.sinkCapability.resolve();
|
|
1594
|
-
streamSink.ready = streamSink.sinkCapability.promise;
|
|
1595
|
-
this.streamSinks[streamId] = streamSink;
|
|
1596
|
-
new Promise(function (resolve) {
|
|
1597
|
-
resolve(action(data.data, streamSink));
|
|
1598
|
-
}).then(function () {
|
|
1599
|
-
comObj.postMessage({
|
|
1600
|
-
sourceName: sourceName,
|
|
1601
|
-
targetName: targetName,
|
|
1602
|
-
stream: StreamKind.START_COMPLETE,
|
|
1603
|
-
streamId: streamId,
|
|
1604
|
-
success: true
|
|
1605
|
-
});
|
|
1606
|
-
}, function (reason) {
|
|
1607
|
-
comObj.postMessage({
|
|
1608
|
-
sourceName: sourceName,
|
|
1609
|
-
targetName: targetName,
|
|
1610
|
-
stream: StreamKind.START_COMPLETE,
|
|
1611
|
-
streamId: streamId,
|
|
1612
|
-
reason: wrapReason(reason)
|
|
1613
|
-
});
|
|
1614
|
-
});
|
|
1615
|
-
}
|
|
1616
|
-
/**
|
|
1617
|
-
* @private
|
|
1618
|
-
*/
|
|
1619
|
-
|
|
1620
|
-
}, {
|
|
1621
|
-
key: "_processStreamMessage",
|
|
1622
|
-
value: function _processStreamMessage(data) {
|
|
1623
|
-
var streamId = data.streamId;
|
|
1624
|
-
var sourceName = this.sourceName;
|
|
1625
|
-
var targetName = data.sourceName;
|
|
1626
|
-
var comObj = this.comObj;
|
|
1627
|
-
|
|
1628
|
-
switch (data.stream) {
|
|
1629
|
-
case StreamKind.START_COMPLETE:
|
|
1630
|
-
if (data.success) {
|
|
1631
|
-
this.streamControllers[streamId].startCall.resolve();
|
|
1632
|
-
} else {
|
|
1633
|
-
this.streamControllers[streamId].startCall.reject(wrapReason(data.reason));
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
break;
|
|
1637
|
-
|
|
1638
|
-
case StreamKind.PULL_COMPLETE:
|
|
1639
|
-
if (data.success) {
|
|
1640
|
-
this.streamControllers[streamId].pullCall.resolve();
|
|
1641
|
-
} else {
|
|
1642
|
-
this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason));
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
break;
|
|
1646
|
-
|
|
1647
|
-
case StreamKind.PULL:
|
|
1648
|
-
// Ignore any pull after close is called.
|
|
1649
|
-
if (!this.streamSinks[streamId]) {
|
|
1650
|
-
comObj.postMessage({
|
|
1651
|
-
sourceName: sourceName,
|
|
1652
|
-
targetName: targetName,
|
|
1653
|
-
stream: StreamKind.PULL_COMPLETE,
|
|
1654
|
-
streamId: streamId,
|
|
1655
|
-
success: true
|
|
1656
|
-
});
|
|
1657
|
-
break;
|
|
1658
|
-
} // Pull increases the desiredSize property of sink,
|
|
1659
|
-
// so when it changes from negative to positive,
|
|
1660
|
-
// set ready property as resolved promise.
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) {
|
|
1664
|
-
this.streamSinks[streamId].sinkCapability.resolve();
|
|
1665
|
-
} // Reset desiredSize property of sink on every pull.
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
this.streamSinks[streamId].desiredSize = data.desiredSize;
|
|
1669
|
-
var onPull = this.streamSinks[data.streamId].onPull;
|
|
1670
|
-
new Promise(function (resolve) {
|
|
1671
|
-
resolve(onPull && onPull());
|
|
1672
|
-
}).then(function () {
|
|
1673
|
-
comObj.postMessage({
|
|
1674
|
-
sourceName: sourceName,
|
|
1675
|
-
targetName: targetName,
|
|
1676
|
-
stream: StreamKind.PULL_COMPLETE,
|
|
1677
|
-
streamId: streamId,
|
|
1678
|
-
success: true
|
|
1679
|
-
});
|
|
1680
|
-
}, function (reason) {
|
|
1681
|
-
comObj.postMessage({
|
|
1682
|
-
sourceName: sourceName,
|
|
1683
|
-
targetName: targetName,
|
|
1684
|
-
stream: StreamKind.PULL_COMPLETE,
|
|
1685
|
-
streamId: streamId,
|
|
1686
|
-
reason: wrapReason(reason)
|
|
1687
|
-
});
|
|
1688
|
-
});
|
|
1689
|
-
break;
|
|
1690
|
-
|
|
1691
|
-
case StreamKind.ENQUEUE:
|
|
1692
|
-
assert(this.streamControllers[streamId], "enqueue should have stream controller");
|
|
1693
|
-
|
|
1694
|
-
if (this.streamControllers[streamId].isClosed) {
|
|
1695
|
-
break;
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
this.streamControllers[streamId].controller.enqueue(data.chunk);
|
|
1699
|
-
break;
|
|
1700
|
-
|
|
1701
|
-
case StreamKind.CLOSE:
|
|
1702
|
-
assert(this.streamControllers[streamId], "close should have stream controller");
|
|
1703
|
-
|
|
1704
|
-
if (this.streamControllers[streamId].isClosed) {
|
|
1705
|
-
break;
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
this.streamControllers[streamId].isClosed = true;
|
|
1709
|
-
this.streamControllers[streamId].controller.close();
|
|
1710
|
-
|
|
1711
|
-
this._deleteStreamController(streamId);
|
|
1712
|
-
|
|
1713
|
-
break;
|
|
1714
|
-
|
|
1715
|
-
case StreamKind.ERROR:
|
|
1716
|
-
assert(this.streamControllers[streamId], "error should have stream controller");
|
|
1717
|
-
this.streamControllers[streamId].controller.error(wrapReason(data.reason));
|
|
1718
|
-
|
|
1719
|
-
this._deleteStreamController(streamId);
|
|
1720
|
-
|
|
1721
|
-
break;
|
|
1722
|
-
|
|
1723
|
-
case StreamKind.CANCEL_COMPLETE:
|
|
1724
|
-
if (data.success) {
|
|
1725
|
-
this.streamControllers[streamId].cancelCall.resolve();
|
|
1726
|
-
} else {
|
|
1727
|
-
this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
this._deleteStreamController(streamId);
|
|
1731
|
-
|
|
1732
|
-
break;
|
|
1733
|
-
|
|
1734
|
-
case StreamKind.CANCEL:
|
|
1735
|
-
if (!this.streamSinks[streamId]) {
|
|
1736
|
-
break;
|
|
1737
|
-
}
|
|
1738
|
-
|
|
1739
|
-
var onCancel = this.streamSinks[data.streamId].onCancel;
|
|
1740
|
-
new Promise(function (resolve) {
|
|
1741
|
-
resolve(onCancel && onCancel(wrapReason(data.reason)));
|
|
1742
|
-
}).then(function () {
|
|
1743
|
-
comObj.postMessage({
|
|
1744
|
-
sourceName: sourceName,
|
|
1745
|
-
targetName: targetName,
|
|
1746
|
-
stream: StreamKind.CANCEL_COMPLETE,
|
|
1747
|
-
streamId: streamId,
|
|
1748
|
-
success: true
|
|
1749
|
-
});
|
|
1750
|
-
}, function (reason) {
|
|
1751
|
-
comObj.postMessage({
|
|
1752
|
-
sourceName: sourceName,
|
|
1753
|
-
targetName: targetName,
|
|
1754
|
-
stream: StreamKind.CANCEL_COMPLETE,
|
|
1755
|
-
streamId: streamId,
|
|
1756
|
-
reason: wrapReason(reason)
|
|
1757
|
-
});
|
|
1758
|
-
});
|
|
1759
|
-
this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason));
|
|
1760
|
-
this.streamSinks[streamId].isCancelled = true;
|
|
1761
|
-
delete this.streamSinks[streamId];
|
|
1762
|
-
break;
|
|
1763
|
-
|
|
1764
|
-
default:
|
|
1765
|
-
throw new Error("Unexpected stream case");
|
|
1766
|
-
}
|
|
1767
|
-
}
|
|
1768
|
-
/**
|
|
1769
|
-
* @private
|
|
1770
|
-
*/
|
|
1771
|
-
|
|
1772
|
-
}, {
|
|
1773
|
-
key: "_deleteStreamController",
|
|
1774
|
-
value: function () {
|
|
1775
|
-
var _deleteStreamController2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(streamId) {
|
|
1776
|
-
return regenerator.wrap(function _callee$(_context) {
|
|
1777
|
-
while (1) {
|
|
1778
|
-
switch (_context.prev = _context.next) {
|
|
1779
|
-
case 0:
|
|
1780
|
-
_context.next = 2;
|
|
1781
|
-
return Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
|
|
1782
|
-
return capability && capability.promise;
|
|
1783
|
-
}));
|
|
1784
|
-
|
|
1785
|
-
case 2:
|
|
1786
|
-
delete this.streamControllers[streamId];
|
|
1787
|
-
|
|
1788
|
-
case 3:
|
|
1789
|
-
case "end":
|
|
1790
|
-
return _context.stop();
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
}, _callee, this);
|
|
1794
|
-
}));
|
|
1795
|
-
|
|
1796
|
-
function _deleteStreamController(_x) {
|
|
1797
|
-
return _deleteStreamController2.apply(this, arguments);
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
return _deleteStreamController;
|
|
1801
|
-
}()
|
|
1802
|
-
/**
|
|
1803
|
-
* Sends raw message to the comObj.
|
|
1804
|
-
* @param {Object} message - Raw message.
|
|
1805
|
-
* @param transfers List of transfers/ArrayBuffers, or undefined.
|
|
1806
|
-
* @private
|
|
1807
|
-
*/
|
|
1808
|
-
|
|
1809
|
-
}, {
|
|
1810
|
-
key: "_postMessage",
|
|
1811
|
-
value: function _postMessage(message, transfers) {
|
|
1812
|
-
if (transfers && this.postMessageTransfers) {
|
|
1813
|
-
this.comObj.postMessage(message, transfers);
|
|
1814
|
-
} else {
|
|
1815
|
-
this.comObj.postMessage(message);
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
}, {
|
|
1819
|
-
key: "destroy",
|
|
1820
|
-
value: function destroy() {
|
|
1821
|
-
this.comObj.removeEventListener("message", this._onComObjOnMessage);
|
|
1822
|
-
}
|
|
1823
|
-
}]);
|
|
1824
|
-
|
|
1825
|
-
return MessageHandler;
|
|
1826
|
-
}();
|
|
1827
|
-
|
|
1828
|
-
function _superPropBase(object, property) {
|
|
1829
|
-
while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
|
1830
|
-
object = _getPrototypeOf(object);
|
|
1831
|
-
if (object === null) break;
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
|
-
return object;
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
function _get() {
|
|
1838
|
-
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
1839
|
-
_get = Reflect.get;
|
|
1840
|
-
} else {
|
|
1841
|
-
_get = function _get(target, property, receiver) {
|
|
1842
|
-
var base = _superPropBase(target, property);
|
|
1843
|
-
if (!base) return;
|
|
1844
|
-
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
1845
|
-
|
|
1846
|
-
if (desc.get) {
|
|
1847
|
-
return desc.get.call(arguments.length < 3 ? target : receiver);
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
return desc.value;
|
|
1851
|
-
};
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
return _get.apply(this, arguments);
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
export { arrayByteLength as $, AbortException as A, BaseException as B, CMapCompressionType as C, MissingPDFException as D, InvalidPDFException as E, FormatError as F, _toConsumableArray as G, getVerbosityLevel as H, IsEvalSupportedCached as I, AnnotationType as J, AnnotationBorderStyleType as K, _get as L, MessageHandler as M, _assertThisInitialized as N, OPS as O, PasswordException as P, stringToPDFString as Q, createObjectURL as R, createValidAbsoluteUrl as S, TextRenderingMode as T, Util as U, PasswordResponses as V, PermissionFlag as W, VerbosityLevel as X, _iterableToArray as Y, objectSize as Z, _inherits as _, _getPrototypeOf as a, arraysToBytes as a0, StreamType as a1, FontType as a2, isBool as a3, isArrayEqual as a4, stringToUTF8String as a5, DocumentActionEventType as a6, utf8StringToString as a7, escapeString as a8, AnnotationFlag as a9, AnnotationFieldFlag as aa, AnnotationReplyType as ab, AnnotationActionEventType as ac, isAscii as ad, stringToUTF16BEString as ae, getModificationDate as af, PageActionEventType as ag, _possibleConstructorReturn as b, assert as c, bytesToString as d, UNSUPPORTED_FEATURES as e, shadow as f, string32 as g, isNodeJS as h, isString as i, info as j, IDENTITY_MATRIX as k, FONT_IDENTITY_MATRIX as l, isNum as m, ImageKind as n, objectFromMap as o, IsLittleEndianCached as p, createPromiseCapability as q, removeNullCharacters as r, stringToBytes as s, isArrayBuffer as t, unreachable as u, setVerbosityLevel as v, warn as w, isSameOrigin as x, UnknownErrorException as y, UnexpectedResponseException as z };
|