@vaadin-component-factory/vcf-pdf-viewer 0.9.4 → 1.0.2

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.
@@ -11,15 +11,15 @@
11
11
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  * See the License for the specific language governing permissions and
13
13
  * limitations under the License.
14
- */
15
-
16
- /* globals process */
17
- // NW.js / Electron is a browser context, but copies some Node.js objects; see
18
- // http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context
19
- // https://www.electronjs.org/docs/api/process#processversionselectron-readonly
20
- // https://www.electronjs.org/docs/api/process#processtype-readonly
21
- const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
22
-
14
+ */
15
+
16
+ /* globals process */
17
+ // NW.js / Electron is a browser context, but copies some Node.js objects; see
18
+ // http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context
19
+ // https://www.electronjs.org/docs/api/process#processversionselectron-readonly
20
+ // https://www.electronjs.org/docs/api/process#processtype-readonly
21
+ const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
22
+
23
23
  /* Copyright 2017 Mozilla Foundation
24
24
  *
25
25
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,110 +33,110 @@ const isNodeJS = typeof process === "object" && process + "" === "[object proces
33
33
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
34
  * See the License for the specific language governing permissions and
35
35
  * limitations under the License.
36
- */
37
-
38
- if ((typeof PDFJSDev === "undefined" || !PDFJSDev.test("SKIP_BABEL")) && (typeof globalThis === "undefined" || !globalThis._pdfjsCompatibilityChecked)) {
39
- // Provides support for globalThis in legacy browsers.
40
- // Support: Firefox<65, Chrome<71, Safari<12.1
41
- if (typeof globalThis === "undefined" || globalThis.Math !== Math) {
42
- // eslint-disable-next-line no-global-assign
43
- globalThis = require("core-js/es/global-this");
44
- }
45
-
46
- globalThis._pdfjsCompatibilityChecked = true; // Support: Node.js
47
-
48
- (function checkNodeBtoa() {
49
- if (globalThis.btoa || !isNodeJS) {
50
- return;
51
- }
52
-
53
- globalThis.btoa = function (chars) {
54
- // eslint-disable-next-line no-undef
55
- return Buffer.from(chars, "binary").toString("base64");
56
- };
57
- })(); // Support: Node.js
58
-
59
-
60
- (function checkNodeAtob() {
61
- if (globalThis.atob || !isNodeJS) {
62
- return;
63
- }
64
-
65
- globalThis.atob = function (input) {
66
- // eslint-disable-next-line no-undef
67
- return Buffer.from(input, "base64").toString("binary");
68
- };
69
- })(); // Support: Node.js
70
-
71
-
72
- (function checkDOMMatrix() {
73
- if (globalThis.DOMMatrix || !isNodeJS) {
74
- return;
75
- }
76
-
77
- globalThis.DOMMatrix = require("dommatrix/dist/dommatrix.js");
78
- })(); // Provides support for Object.fromEntries in legacy browsers.
79
- // Support: Firefox<63, Chrome<73, Safari<12.1, Node.js<12.0.0
80
-
81
-
82
- (function checkObjectFromEntries() {
83
- if (Object.fromEntries) {
84
- return;
85
- }
86
-
87
- require("core-js/es/object/from-entries.js");
88
- })(); // Provides support for *recent* additions to the Promise specification,
89
- // however basic Promise support is assumed to be available natively.
90
- // Support: Firefox<71, Chrome<76, Safari<13, Node.js<12.9.0
91
-
92
-
93
- (function checkPromise() {
94
- if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
95
- // The current image decoders are synchronous, hence `Promise` shouldn't
96
- // need to be polyfilled for the IMAGE_DECODERS build target.
97
- return;
98
- }
99
-
100
- if (globalThis.Promise.allSettled) {
101
- return;
102
- }
103
-
104
- globalThis.Promise = require("core-js/es/promise/index.js");
105
- })(); // Support: Node.js
106
-
107
-
108
- (function checkReadableStream() {
109
- if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
110
- // The current image decoders are synchronous, hence `ReadableStream`
111
- // shouldn't need to be polyfilled for the IMAGE_DECODERS build target.
112
- return;
113
- }
114
-
115
- let isReadableStreamSupported = false;
116
-
117
- if (typeof ReadableStream !== "undefined") {
118
- // MS Edge may say it has ReadableStream but they are not up to spec yet.
119
- try {
120
- // eslint-disable-next-line no-new
121
- new ReadableStream({
122
- start(controller) {
123
- controller.close();
124
- }
125
-
126
- });
127
- isReadableStreamSupported = true;
128
- } catch (e) {// The ReadableStream constructor cannot be used.
129
- }
130
- }
131
-
132
- if (isReadableStreamSupported) {
133
- return;
134
- }
135
-
136
- globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
137
- })();
138
- }
139
-
36
+ */
37
+
38
+ if ((typeof PDFJSDev === "undefined" || !PDFJSDev.test("SKIP_BABEL")) && (typeof globalThis === "undefined" || !globalThis._pdfjsCompatibilityChecked)) {
39
+ // Provides support for globalThis in legacy browsers.
40
+ // Support: Firefox<65, Chrome<71, Safari<12.1
41
+ if (typeof globalThis === "undefined" || globalThis.Math !== Math) {
42
+ // eslint-disable-next-line no-global-assign
43
+ globalThis = require("core-js/es/global-this");
44
+ }
45
+
46
+ globalThis._pdfjsCompatibilityChecked = true; // Support: Node.js
47
+
48
+ (function checkNodeBtoa() {
49
+ if (globalThis.btoa || !isNodeJS) {
50
+ return;
51
+ }
52
+
53
+ globalThis.btoa = function (chars) {
54
+ // eslint-disable-next-line no-undef
55
+ return Buffer.from(chars, "binary").toString("base64");
56
+ };
57
+ })(); // Support: Node.js
58
+
59
+
60
+ (function checkNodeAtob() {
61
+ if (globalThis.atob || !isNodeJS) {
62
+ return;
63
+ }
64
+
65
+ globalThis.atob = function (input) {
66
+ // eslint-disable-next-line no-undef
67
+ return Buffer.from(input, "base64").toString("binary");
68
+ };
69
+ })(); // Support: Node.js
70
+
71
+
72
+ (function checkDOMMatrix() {
73
+ if (globalThis.DOMMatrix || !isNodeJS) {
74
+ return;
75
+ }
76
+
77
+ globalThis.DOMMatrix = require("dommatrix/dist/dommatrix.js");
78
+ })(); // Provides support for Object.fromEntries in legacy browsers.
79
+ // Support: Firefox<63, Chrome<73, Safari<12.1, Node.js<12.0.0
80
+
81
+
82
+ (function checkObjectFromEntries() {
83
+ if (Object.fromEntries) {
84
+ return;
85
+ }
86
+
87
+ require("core-js/es/object/from-entries.js");
88
+ })(); // Provides support for *recent* additions to the Promise specification,
89
+ // however basic Promise support is assumed to be available natively.
90
+ // Support: Firefox<71, Chrome<76, Safari<13, Node.js<12.9.0
91
+
92
+
93
+ (function checkPromise() {
94
+ if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
95
+ // The current image decoders are synchronous, hence `Promise` shouldn't
96
+ // need to be polyfilled for the IMAGE_DECODERS build target.
97
+ return;
98
+ }
99
+
100
+ if (globalThis.Promise.allSettled) {
101
+ return;
102
+ }
103
+
104
+ globalThis.Promise = require("core-js/es/promise/index.js");
105
+ })(); // Support: Node.js
106
+
107
+
108
+ (function checkReadableStream() {
109
+ if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
110
+ // The current image decoders are synchronous, hence `ReadableStream`
111
+ // shouldn't need to be polyfilled for the IMAGE_DECODERS build target.
112
+ return;
113
+ }
114
+
115
+ let isReadableStreamSupported = false;
116
+
117
+ if (typeof ReadableStream !== "undefined") {
118
+ // MS Edge may say it has ReadableStream but they are not up to spec yet.
119
+ try {
120
+ // eslint-disable-next-line no-new
121
+ new ReadableStream({
122
+ start(controller) {
123
+ controller.close();
124
+ }
125
+
126
+ });
127
+ isReadableStreamSupported = true;
128
+ } catch (e) {// The ReadableStream constructor cannot be used.
129
+ }
130
+ }
131
+
132
+ if (isReadableStreamSupported) {
133
+ return;
134
+ }
135
+
136
+ globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
137
+ })();
138
+ }
139
+
140
140
  /* Copyright 2012 Mozilla Foundation
141
141
  *
142
142
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -150,853 +150,853 @@ if ((typeof PDFJSDev === "undefined" || !PDFJSDev.test("SKIP_BABEL")) && (typeof
150
150
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
151
151
  * See the License for the specific language governing permissions and
152
152
  * limitations under the License.
153
- */
154
- const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
155
- const 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.
156
-
157
- const PermissionFlag = {
158
- PRINT: 0x04,
159
- MODIFY_CONTENTS: 0x08,
160
- COPY: 0x10,
161
- MODIFY_ANNOTATIONS: 0x20,
162
- FILL_INTERACTIVE_FORMS: 0x100,
163
- COPY_FOR_ACCESSIBILITY: 0x200,
164
- ASSEMBLE: 0x400,
165
- PRINT_HIGH_QUALITY: 0x800
166
- };
167
- const TextRenderingMode = {
168
- FILL: 0,
169
- STROKE: 1,
170
- FILL_STROKE: 2,
171
- INVISIBLE: 3,
172
- FILL_ADD_TO_PATH: 4,
173
- STROKE_ADD_TO_PATH: 5,
174
- FILL_STROKE_ADD_TO_PATH: 6,
175
- ADD_TO_PATH: 7,
176
- FILL_STROKE_MASK: 3,
177
- ADD_TO_PATH_FLAG: 4
178
- };
179
- const ImageKind = {
180
- GRAYSCALE_1BPP: 1,
181
- RGB_24BPP: 2,
182
- RGBA_32BPP: 3
183
- };
184
- const AnnotationType = {
185
- TEXT: 1,
186
- LINK: 2,
187
- FREETEXT: 3,
188
- LINE: 4,
189
- SQUARE: 5,
190
- CIRCLE: 6,
191
- POLYGON: 7,
192
- POLYLINE: 8,
193
- HIGHLIGHT: 9,
194
- UNDERLINE: 10,
195
- SQUIGGLY: 11,
196
- STRIKEOUT: 12,
197
- STAMP: 13,
198
- CARET: 14,
199
- INK: 15,
200
- POPUP: 16,
201
- FILEATTACHMENT: 17,
202
- SOUND: 18,
203
- MOVIE: 19,
204
- WIDGET: 20,
205
- SCREEN: 21,
206
- PRINTERMARK: 22,
207
- TRAPNET: 23,
208
- WATERMARK: 24,
209
- THREED: 25,
210
- REDACT: 26
211
- };
212
- const AnnotationReplyType = {
213
- GROUP: "Group",
214
- REPLY: "R"
215
- };
216
- const AnnotationFlag = {
217
- INVISIBLE: 0x01,
218
- HIDDEN: 0x02,
219
- PRINT: 0x04,
220
- NOZOOM: 0x08,
221
- NOROTATE: 0x10,
222
- NOVIEW: 0x20,
223
- READONLY: 0x40,
224
- LOCKED: 0x80,
225
- TOGGLENOVIEW: 0x100,
226
- LOCKEDCONTENTS: 0x200
227
- };
228
- const AnnotationFieldFlag = {
229
- READONLY: 0x0000001,
230
- REQUIRED: 0x0000002,
231
- NOEXPORT: 0x0000004,
232
- MULTILINE: 0x0001000,
233
- PASSWORD: 0x0002000,
234
- NOTOGGLETOOFF: 0x0004000,
235
- RADIO: 0x0008000,
236
- PUSHBUTTON: 0x0010000,
237
- COMBO: 0x0020000,
238
- EDIT: 0x0040000,
239
- SORT: 0x0080000,
240
- FILESELECT: 0x0100000,
241
- MULTISELECT: 0x0200000,
242
- DONOTSPELLCHECK: 0x0400000,
243
- DONOTSCROLL: 0x0800000,
244
- COMB: 0x1000000,
245
- RICHTEXT: 0x2000000,
246
- RADIOSINUNISON: 0x2000000,
247
- COMMITONSELCHANGE: 0x4000000
248
- };
249
- const AnnotationBorderStyleType = {
250
- SOLID: 1,
251
- DASHED: 2,
252
- BEVELED: 3,
253
- INSET: 4,
254
- UNDERLINE: 5
255
- };
256
- const AnnotationActionEventType = {
257
- E: "Mouse Enter",
258
- X: "Mouse Exit",
259
- D: "Mouse Down",
260
- U: "Mouse Up",
261
- Fo: "Focus",
262
- Bl: "Blur",
263
- PO: "PageOpen",
264
- PC: "PageClose",
265
- PV: "PageVisible",
266
- PI: "PageInvisible",
267
- K: "Keystroke",
268
- F: "Format",
269
- V: "Validate",
270
- C: "Calculate"
271
- };
272
- const DocumentActionEventType = {
273
- WC: "WillClose",
274
- WS: "WillSave",
275
- DS: "DidSave",
276
- WP: "WillPrint",
277
- DP: "DidPrint"
278
- };
279
- const PageActionEventType = {
280
- O: "PageOpen",
281
- C: "PageClose"
282
- };
283
- const StreamType = {
284
- UNKNOWN: "UNKNOWN",
285
- FLATE: "FLATE",
286
- LZW: "LZW",
287
- DCT: "DCT",
288
- JPX: "JPX",
289
- JBIG: "JBIG",
290
- A85: "A85",
291
- AHX: "AHX",
292
- CCF: "CCF",
293
- RLX: "RLX" // PDF short name is 'RL', but telemetry requires three chars.
294
-
295
- };
296
- const FontType = {
297
- UNKNOWN: "UNKNOWN",
298
- TYPE1: "TYPE1",
299
- TYPE1STANDARD: "TYPE1STANDARD",
300
- TYPE1C: "TYPE1C",
301
- CIDFONTTYPE0: "CIDFONTTYPE0",
302
- CIDFONTTYPE0C: "CIDFONTTYPE0C",
303
- TRUETYPE: "TRUETYPE",
304
- CIDFONTTYPE2: "CIDFONTTYPE2",
305
- TYPE3: "TYPE3",
306
- OPENTYPE: "OPENTYPE",
307
- TYPE0: "TYPE0",
308
- MMTYPE1: "MMTYPE1"
309
- };
310
- const VerbosityLevel = {
311
- ERRORS: 0,
312
- WARNINGS: 1,
313
- INFOS: 5
314
- };
315
- const CMapCompressionType = {
316
- NONE: 0,
317
- BINARY: 1,
318
- STREAM: 2
319
- }; // All the possible operations for an operator list.
320
-
321
- const OPS = {
322
- // Intentionally start from 1 so it is easy to spot bad operators that will be
323
- // 0's.
324
- dependency: 1,
325
- setLineWidth: 2,
326
- setLineCap: 3,
327
- setLineJoin: 4,
328
- setMiterLimit: 5,
329
- setDash: 6,
330
- setRenderingIntent: 7,
331
- setFlatness: 8,
332
- setGState: 9,
333
- save: 10,
334
- restore: 11,
335
- transform: 12,
336
- moveTo: 13,
337
- lineTo: 14,
338
- curveTo: 15,
339
- curveTo2: 16,
340
- curveTo3: 17,
341
- closePath: 18,
342
- rectangle: 19,
343
- stroke: 20,
344
- closeStroke: 21,
345
- fill: 22,
346
- eoFill: 23,
347
- fillStroke: 24,
348
- eoFillStroke: 25,
349
- closeFillStroke: 26,
350
- closeEOFillStroke: 27,
351
- endPath: 28,
352
- clip: 29,
353
- eoClip: 30,
354
- beginText: 31,
355
- endText: 32,
356
- setCharSpacing: 33,
357
- setWordSpacing: 34,
358
- setHScale: 35,
359
- setLeading: 36,
360
- setFont: 37,
361
- setTextRenderingMode: 38,
362
- setTextRise: 39,
363
- moveText: 40,
364
- setLeadingMoveText: 41,
365
- setTextMatrix: 42,
366
- nextLine: 43,
367
- showText: 44,
368
- showSpacedText: 45,
369
- nextLineShowText: 46,
370
- nextLineSetSpacingShowText: 47,
371
- setCharWidth: 48,
372
- setCharWidthAndBounds: 49,
373
- setStrokeColorSpace: 50,
374
- setFillColorSpace: 51,
375
- setStrokeColor: 52,
376
- setStrokeColorN: 53,
377
- setFillColor: 54,
378
- setFillColorN: 55,
379
- setStrokeGray: 56,
380
- setFillGray: 57,
381
- setStrokeRGBColor: 58,
382
- setFillRGBColor: 59,
383
- setStrokeCMYKColor: 60,
384
- setFillCMYKColor: 61,
385
- shadingFill: 62,
386
- beginInlineImage: 63,
387
- beginImageData: 64,
388
- endInlineImage: 65,
389
- paintXObject: 66,
390
- markPoint: 67,
391
- markPointProps: 68,
392
- beginMarkedContent: 69,
393
- beginMarkedContentProps: 70,
394
- endMarkedContent: 71,
395
- beginCompat: 72,
396
- endCompat: 73,
397
- paintFormXObjectBegin: 74,
398
- paintFormXObjectEnd: 75,
399
- beginGroup: 76,
400
- endGroup: 77,
401
- beginAnnotations: 78,
402
- endAnnotations: 79,
403
- beginAnnotation: 80,
404
- endAnnotation: 81,
405
- paintJpegXObject: 82,
406
- paintImageMaskXObject: 83,
407
- paintImageMaskXObjectGroup: 84,
408
- paintImageXObject: 85,
409
- paintInlineImageXObject: 86,
410
- paintInlineImageXObjectGroup: 87,
411
- paintImageXObjectRepeat: 88,
412
- paintImageMaskXObjectRepeat: 89,
413
- paintSolidColorImageMask: 90,
414
- constructPath: 91
415
- };
416
- const UNSUPPORTED_FEATURES = {
417
- /** @deprecated unused */
418
- unknown: "unknown",
419
- forms: "forms",
420
- javaScript: "javaScript",
421
- signatures: "signatures",
422
- smask: "smask",
423
- shadingPattern: "shadingPattern",
424
-
425
- /** @deprecated unused */
426
- font: "font",
427
- errorTilingPattern: "errorTilingPattern",
428
- errorExtGState: "errorExtGState",
429
- errorXObject: "errorXObject",
430
- errorFontLoadType3: "errorFontLoadType3",
431
- errorFontState: "errorFontState",
432
- errorFontMissing: "errorFontMissing",
433
- errorFontTranslate: "errorFontTranslate",
434
- errorColorSpace: "errorColorSpace",
435
- errorOperatorList: "errorOperatorList",
436
- errorFontToUnicode: "errorFontToUnicode",
437
- errorFontLoadNative: "errorFontLoadNative",
438
- errorFontBuildPath: "errorFontBuildPath",
439
- errorFontGetPath: "errorFontGetPath",
440
- errorMarkedContent: "errorMarkedContent"
441
- };
442
- const PasswordResponses = {
443
- NEED_PASSWORD: 1,
444
- INCORRECT_PASSWORD: 2
445
- };
446
- let verbosity = VerbosityLevel.WARNINGS;
447
-
448
- function setVerbosityLevel(level) {
449
- if (Number.isInteger(level)) {
450
- verbosity = level;
451
- }
452
- }
453
-
454
- function getVerbosityLevel() {
455
- return verbosity;
456
- } // A notice for devs. These are good for things that are helpful to devs, such
457
- // as warning that Workers were disabled, which is important to devs but not
458
- // end users.
459
-
460
-
461
- function info(msg) {
462
- if (verbosity >= VerbosityLevel.INFOS) {
463
- console.log(`Info: ${msg}`);
464
- }
465
- } // Non-fatal warnings.
466
-
467
-
468
- function warn(msg) {
469
- if (verbosity >= VerbosityLevel.WARNINGS) {
470
- console.log(`Warning: ${msg}`);
471
- }
472
- }
473
-
474
- function unreachable(msg) {
475
- throw new Error(msg);
476
- }
477
-
478
- function assert(cond, msg) {
479
- if (!cond) {
480
- unreachable(msg);
481
- }
482
- } // Checks if URLs have the same origin. For non-HTTP based URLs, returns false.
483
-
484
-
485
- function isSameOrigin(baseUrl, otherUrl) {
486
- let base;
487
-
488
- try {
489
- base = new URL(baseUrl);
490
-
491
- if (!base.origin || base.origin === "null") {
492
- return false; // non-HTTP url
493
- }
494
- } catch (e) {
495
- return false;
496
- }
497
-
498
- const other = new URL(otherUrl, base);
499
- return base.origin === other.origin;
500
- } // Checks if URLs use one of the allowed protocols, e.g. to avoid XSS.
501
-
502
-
503
- function _isValidProtocol(url) {
504
- if (!url) {
505
- return false;
506
- }
507
-
508
- switch (url.protocol) {
509
- case "http:":
510
- case "https:":
511
- case "ftp:":
512
- case "mailto:":
513
- case "tel:":
514
- return true;
515
-
516
- default:
517
- return false;
518
- }
519
- }
153
+ */
154
+ const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
155
+ const 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.
156
+
157
+ const PermissionFlag = {
158
+ PRINT: 0x04,
159
+ MODIFY_CONTENTS: 0x08,
160
+ COPY: 0x10,
161
+ MODIFY_ANNOTATIONS: 0x20,
162
+ FILL_INTERACTIVE_FORMS: 0x100,
163
+ COPY_FOR_ACCESSIBILITY: 0x200,
164
+ ASSEMBLE: 0x400,
165
+ PRINT_HIGH_QUALITY: 0x800
166
+ };
167
+ const TextRenderingMode = {
168
+ FILL: 0,
169
+ STROKE: 1,
170
+ FILL_STROKE: 2,
171
+ INVISIBLE: 3,
172
+ FILL_ADD_TO_PATH: 4,
173
+ STROKE_ADD_TO_PATH: 5,
174
+ FILL_STROKE_ADD_TO_PATH: 6,
175
+ ADD_TO_PATH: 7,
176
+ FILL_STROKE_MASK: 3,
177
+ ADD_TO_PATH_FLAG: 4
178
+ };
179
+ const ImageKind = {
180
+ GRAYSCALE_1BPP: 1,
181
+ RGB_24BPP: 2,
182
+ RGBA_32BPP: 3
183
+ };
184
+ const AnnotationType = {
185
+ TEXT: 1,
186
+ LINK: 2,
187
+ FREETEXT: 3,
188
+ LINE: 4,
189
+ SQUARE: 5,
190
+ CIRCLE: 6,
191
+ POLYGON: 7,
192
+ POLYLINE: 8,
193
+ HIGHLIGHT: 9,
194
+ UNDERLINE: 10,
195
+ SQUIGGLY: 11,
196
+ STRIKEOUT: 12,
197
+ STAMP: 13,
198
+ CARET: 14,
199
+ INK: 15,
200
+ POPUP: 16,
201
+ FILEATTACHMENT: 17,
202
+ SOUND: 18,
203
+ MOVIE: 19,
204
+ WIDGET: 20,
205
+ SCREEN: 21,
206
+ PRINTERMARK: 22,
207
+ TRAPNET: 23,
208
+ WATERMARK: 24,
209
+ THREED: 25,
210
+ REDACT: 26
211
+ };
212
+ const AnnotationReplyType = {
213
+ GROUP: "Group",
214
+ REPLY: "R"
215
+ };
216
+ const AnnotationFlag = {
217
+ INVISIBLE: 0x01,
218
+ HIDDEN: 0x02,
219
+ PRINT: 0x04,
220
+ NOZOOM: 0x08,
221
+ NOROTATE: 0x10,
222
+ NOVIEW: 0x20,
223
+ READONLY: 0x40,
224
+ LOCKED: 0x80,
225
+ TOGGLENOVIEW: 0x100,
226
+ LOCKEDCONTENTS: 0x200
227
+ };
228
+ const AnnotationFieldFlag = {
229
+ READONLY: 0x0000001,
230
+ REQUIRED: 0x0000002,
231
+ NOEXPORT: 0x0000004,
232
+ MULTILINE: 0x0001000,
233
+ PASSWORD: 0x0002000,
234
+ NOTOGGLETOOFF: 0x0004000,
235
+ RADIO: 0x0008000,
236
+ PUSHBUTTON: 0x0010000,
237
+ COMBO: 0x0020000,
238
+ EDIT: 0x0040000,
239
+ SORT: 0x0080000,
240
+ FILESELECT: 0x0100000,
241
+ MULTISELECT: 0x0200000,
242
+ DONOTSPELLCHECK: 0x0400000,
243
+ DONOTSCROLL: 0x0800000,
244
+ COMB: 0x1000000,
245
+ RICHTEXT: 0x2000000,
246
+ RADIOSINUNISON: 0x2000000,
247
+ COMMITONSELCHANGE: 0x4000000
248
+ };
249
+ const AnnotationBorderStyleType = {
250
+ SOLID: 1,
251
+ DASHED: 2,
252
+ BEVELED: 3,
253
+ INSET: 4,
254
+ UNDERLINE: 5
255
+ };
256
+ const AnnotationActionEventType = {
257
+ E: "Mouse Enter",
258
+ X: "Mouse Exit",
259
+ D: "Mouse Down",
260
+ U: "Mouse Up",
261
+ Fo: "Focus",
262
+ Bl: "Blur",
263
+ PO: "PageOpen",
264
+ PC: "PageClose",
265
+ PV: "PageVisible",
266
+ PI: "PageInvisible",
267
+ K: "Keystroke",
268
+ F: "Format",
269
+ V: "Validate",
270
+ C: "Calculate"
271
+ };
272
+ const DocumentActionEventType = {
273
+ WC: "WillClose",
274
+ WS: "WillSave",
275
+ DS: "DidSave",
276
+ WP: "WillPrint",
277
+ DP: "DidPrint"
278
+ };
279
+ const PageActionEventType = {
280
+ O: "PageOpen",
281
+ C: "PageClose"
282
+ };
283
+ const StreamType = {
284
+ UNKNOWN: "UNKNOWN",
285
+ FLATE: "FLATE",
286
+ LZW: "LZW",
287
+ DCT: "DCT",
288
+ JPX: "JPX",
289
+ JBIG: "JBIG",
290
+ A85: "A85",
291
+ AHX: "AHX",
292
+ CCF: "CCF",
293
+ RLX: "RLX" // PDF short name is 'RL', but telemetry requires three chars.
294
+
295
+ };
296
+ const FontType = {
297
+ UNKNOWN: "UNKNOWN",
298
+ TYPE1: "TYPE1",
299
+ TYPE1STANDARD: "TYPE1STANDARD",
300
+ TYPE1C: "TYPE1C",
301
+ CIDFONTTYPE0: "CIDFONTTYPE0",
302
+ CIDFONTTYPE0C: "CIDFONTTYPE0C",
303
+ TRUETYPE: "TRUETYPE",
304
+ CIDFONTTYPE2: "CIDFONTTYPE2",
305
+ TYPE3: "TYPE3",
306
+ OPENTYPE: "OPENTYPE",
307
+ TYPE0: "TYPE0",
308
+ MMTYPE1: "MMTYPE1"
309
+ };
310
+ const VerbosityLevel = {
311
+ ERRORS: 0,
312
+ WARNINGS: 1,
313
+ INFOS: 5
314
+ };
315
+ const CMapCompressionType = {
316
+ NONE: 0,
317
+ BINARY: 1,
318
+ STREAM: 2
319
+ }; // All the possible operations for an operator list.
320
+
321
+ const OPS = {
322
+ // Intentionally start from 1 so it is easy to spot bad operators that will be
323
+ // 0's.
324
+ dependency: 1,
325
+ setLineWidth: 2,
326
+ setLineCap: 3,
327
+ setLineJoin: 4,
328
+ setMiterLimit: 5,
329
+ setDash: 6,
330
+ setRenderingIntent: 7,
331
+ setFlatness: 8,
332
+ setGState: 9,
333
+ save: 10,
334
+ restore: 11,
335
+ transform: 12,
336
+ moveTo: 13,
337
+ lineTo: 14,
338
+ curveTo: 15,
339
+ curveTo2: 16,
340
+ curveTo3: 17,
341
+ closePath: 18,
342
+ rectangle: 19,
343
+ stroke: 20,
344
+ closeStroke: 21,
345
+ fill: 22,
346
+ eoFill: 23,
347
+ fillStroke: 24,
348
+ eoFillStroke: 25,
349
+ closeFillStroke: 26,
350
+ closeEOFillStroke: 27,
351
+ endPath: 28,
352
+ clip: 29,
353
+ eoClip: 30,
354
+ beginText: 31,
355
+ endText: 32,
356
+ setCharSpacing: 33,
357
+ setWordSpacing: 34,
358
+ setHScale: 35,
359
+ setLeading: 36,
360
+ setFont: 37,
361
+ setTextRenderingMode: 38,
362
+ setTextRise: 39,
363
+ moveText: 40,
364
+ setLeadingMoveText: 41,
365
+ setTextMatrix: 42,
366
+ nextLine: 43,
367
+ showText: 44,
368
+ showSpacedText: 45,
369
+ nextLineShowText: 46,
370
+ nextLineSetSpacingShowText: 47,
371
+ setCharWidth: 48,
372
+ setCharWidthAndBounds: 49,
373
+ setStrokeColorSpace: 50,
374
+ setFillColorSpace: 51,
375
+ setStrokeColor: 52,
376
+ setStrokeColorN: 53,
377
+ setFillColor: 54,
378
+ setFillColorN: 55,
379
+ setStrokeGray: 56,
380
+ setFillGray: 57,
381
+ setStrokeRGBColor: 58,
382
+ setFillRGBColor: 59,
383
+ setStrokeCMYKColor: 60,
384
+ setFillCMYKColor: 61,
385
+ shadingFill: 62,
386
+ beginInlineImage: 63,
387
+ beginImageData: 64,
388
+ endInlineImage: 65,
389
+ paintXObject: 66,
390
+ markPoint: 67,
391
+ markPointProps: 68,
392
+ beginMarkedContent: 69,
393
+ beginMarkedContentProps: 70,
394
+ endMarkedContent: 71,
395
+ beginCompat: 72,
396
+ endCompat: 73,
397
+ paintFormXObjectBegin: 74,
398
+ paintFormXObjectEnd: 75,
399
+ beginGroup: 76,
400
+ endGroup: 77,
401
+ beginAnnotations: 78,
402
+ endAnnotations: 79,
403
+ beginAnnotation: 80,
404
+ endAnnotation: 81,
405
+ paintJpegXObject: 82,
406
+ paintImageMaskXObject: 83,
407
+ paintImageMaskXObjectGroup: 84,
408
+ paintImageXObject: 85,
409
+ paintInlineImageXObject: 86,
410
+ paintInlineImageXObjectGroup: 87,
411
+ paintImageXObjectRepeat: 88,
412
+ paintImageMaskXObjectRepeat: 89,
413
+ paintSolidColorImageMask: 90,
414
+ constructPath: 91
415
+ };
416
+ const UNSUPPORTED_FEATURES = {
417
+ /** @deprecated unused */
418
+ unknown: "unknown",
419
+ forms: "forms",
420
+ javaScript: "javaScript",
421
+ signatures: "signatures",
422
+ smask: "smask",
423
+ shadingPattern: "shadingPattern",
424
+
425
+ /** @deprecated unused */
426
+ font: "font",
427
+ errorTilingPattern: "errorTilingPattern",
428
+ errorExtGState: "errorExtGState",
429
+ errorXObject: "errorXObject",
430
+ errorFontLoadType3: "errorFontLoadType3",
431
+ errorFontState: "errorFontState",
432
+ errorFontMissing: "errorFontMissing",
433
+ errorFontTranslate: "errorFontTranslate",
434
+ errorColorSpace: "errorColorSpace",
435
+ errorOperatorList: "errorOperatorList",
436
+ errorFontToUnicode: "errorFontToUnicode",
437
+ errorFontLoadNative: "errorFontLoadNative",
438
+ errorFontBuildPath: "errorFontBuildPath",
439
+ errorFontGetPath: "errorFontGetPath",
440
+ errorMarkedContent: "errorMarkedContent"
441
+ };
442
+ const PasswordResponses = {
443
+ NEED_PASSWORD: 1,
444
+ INCORRECT_PASSWORD: 2
445
+ };
446
+ let verbosity = VerbosityLevel.WARNINGS;
447
+
448
+ function setVerbosityLevel(level) {
449
+ if (Number.isInteger(level)) {
450
+ verbosity = level;
451
+ }
452
+ }
453
+
454
+ function getVerbosityLevel() {
455
+ return verbosity;
456
+ } // A notice for devs. These are good for things that are helpful to devs, such
457
+ // as warning that Workers were disabled, which is important to devs but not
458
+ // end users.
459
+
460
+
461
+ function info(msg) {
462
+ if (verbosity >= VerbosityLevel.INFOS) {
463
+ console.log(`Info: ${msg}`);
464
+ }
465
+ } // Non-fatal warnings.
466
+
467
+
468
+ function warn(msg) {
469
+ if (verbosity >= VerbosityLevel.WARNINGS) {
470
+ console.log(`Warning: ${msg}`);
471
+ }
472
+ }
473
+
474
+ function unreachable(msg) {
475
+ throw new Error(msg);
476
+ }
477
+
478
+ function assert(cond, msg) {
479
+ if (!cond) {
480
+ unreachable(msg);
481
+ }
482
+ } // Checks if URLs have the same origin. For non-HTTP based URLs, returns false.
483
+
484
+
485
+ function isSameOrigin(baseUrl, otherUrl) {
486
+ let base;
487
+
488
+ try {
489
+ base = new URL(baseUrl);
490
+
491
+ if (!base.origin || base.origin === "null") {
492
+ return false; // non-HTTP url
493
+ }
494
+ } catch (e) {
495
+ return false;
496
+ }
497
+
498
+ const other = new URL(otherUrl, base);
499
+ return base.origin === other.origin;
500
+ } // Checks if URLs use one of the allowed protocols, e.g. to avoid XSS.
501
+
502
+
503
+ function _isValidProtocol(url) {
504
+ if (!url) {
505
+ return false;
506
+ }
507
+
508
+ switch (url.protocol) {
509
+ case "http:":
510
+ case "https:":
511
+ case "ftp:":
512
+ case "mailto:":
513
+ case "tel:":
514
+ return true;
515
+
516
+ default:
517
+ return false;
518
+ }
519
+ }
520
520
  /**
521
521
  * Attempts to create a valid absolute URL.
522
522
  *
523
523
  * @param {URL|string} url - An absolute, or relative, URL.
524
524
  * @param {URL|string} baseUrl - An absolute URL.
525
525
  * @returns Either a valid {URL}, or `null` otherwise.
526
- */
527
-
528
-
529
- function createValidAbsoluteUrl(url, baseUrl) {
530
- if (!url) {
531
- return null;
532
- }
533
-
534
- try {
535
- const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
536
-
537
- if (_isValidProtocol(absoluteUrl)) {
538
- return absoluteUrl;
539
- }
540
- } catch (ex) {
541
- /* `new URL()` will throw on incorrect data. */
542
- }
543
-
544
- return null;
545
- }
546
-
547
- function shadow(obj, prop, value) {
548
- Object.defineProperty(obj, prop, {
549
- value,
550
- enumerable: true,
551
- configurable: true,
552
- writable: false
553
- });
554
- return value;
555
- }
526
+ */
527
+
528
+
529
+ function createValidAbsoluteUrl(url, baseUrl) {
530
+ if (!url) {
531
+ return null;
532
+ }
533
+
534
+ try {
535
+ const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
536
+
537
+ if (_isValidProtocol(absoluteUrl)) {
538
+ return absoluteUrl;
539
+ }
540
+ } catch (ex) {
541
+ /* `new URL()` will throw on incorrect data. */
542
+ }
543
+
544
+ return null;
545
+ }
546
+
547
+ function shadow(obj, prop, value) {
548
+ Object.defineProperty(obj, prop, {
549
+ value,
550
+ enumerable: true,
551
+ configurable: true,
552
+ writable: false
553
+ });
554
+ return value;
555
+ }
556
556
  /**
557
557
  * @type {any}
558
- */
559
-
560
-
561
- const BaseException = function BaseExceptionClosure() {
562
- // eslint-disable-next-line no-shadow
563
- function BaseException(message) {
564
- if (this.constructor === BaseException) {
565
- unreachable("Cannot initialize BaseException.");
566
- }
567
-
568
- this.message = message;
569
- this.name = this.constructor.name;
570
- }
571
-
572
- BaseException.prototype = new Error();
573
- BaseException.constructor = BaseException;
574
- return BaseException;
575
- }();
576
-
577
- class PasswordException extends BaseException {
578
- constructor(msg, code) {
579
- super(msg);
580
- this.code = code;
581
- }
582
-
583
- }
584
-
585
- class UnknownErrorException extends BaseException {
586
- constructor(msg, details) {
587
- super(msg);
588
- this.details = details;
589
- }
590
-
591
- }
592
-
593
- class InvalidPDFException extends BaseException {}
594
-
595
- class MissingPDFException extends BaseException {}
596
-
597
- class UnexpectedResponseException extends BaseException {
598
- constructor(msg, status) {
599
- super(msg);
600
- this.status = status;
601
- }
602
-
603
- }
558
+ */
559
+
560
+
561
+ const BaseException = function BaseExceptionClosure() {
562
+ // eslint-disable-next-line no-shadow
563
+ function BaseException(message) {
564
+ if (this.constructor === BaseException) {
565
+ unreachable("Cannot initialize BaseException.");
566
+ }
567
+
568
+ this.message = message;
569
+ this.name = this.constructor.name;
570
+ }
571
+
572
+ BaseException.prototype = new Error();
573
+ BaseException.constructor = BaseException;
574
+ return BaseException;
575
+ }();
576
+
577
+ class PasswordException extends BaseException {
578
+ constructor(msg, code) {
579
+ super(msg);
580
+ this.code = code;
581
+ }
582
+
583
+ }
584
+
585
+ class UnknownErrorException extends BaseException {
586
+ constructor(msg, details) {
587
+ super(msg);
588
+ this.details = details;
589
+ }
590
+
591
+ }
592
+
593
+ class InvalidPDFException extends BaseException {}
594
+
595
+ class MissingPDFException extends BaseException {}
596
+
597
+ class UnexpectedResponseException extends BaseException {
598
+ constructor(msg, status) {
599
+ super(msg);
600
+ this.status = status;
601
+ }
602
+
603
+ }
604
604
  /**
605
605
  * Error caused during parsing PDF data.
606
- */
607
-
608
-
609
- class FormatError extends BaseException {}
606
+ */
607
+
608
+
609
+ class FormatError extends BaseException {}
610
610
  /**
611
611
  * Error used to indicate task cancellation.
612
- */
613
-
614
-
615
- class AbortException extends BaseException {}
616
-
617
- const NullCharactersRegExp = /\x00/g;
612
+ */
613
+
614
+
615
+ class AbortException extends BaseException {}
616
+
617
+ const NullCharactersRegExp = /\x00/g;
618
618
  /**
619
619
  * @param {string} str
620
- */
621
-
622
- function removeNullCharacters(str) {
623
- if (typeof str !== "string") {
624
- warn("The argument for removeNullCharacters must be a string.");
625
- return str;
626
- }
627
-
628
- return str.replace(NullCharactersRegExp, "");
629
- }
630
-
631
- function bytesToString(bytes) {
632
- assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
633
- const length = bytes.length;
634
- const MAX_ARGUMENT_COUNT = 8192;
635
-
636
- if (length < MAX_ARGUMENT_COUNT) {
637
- return String.fromCharCode.apply(null, bytes);
638
- }
639
-
640
- const strBuf = [];
641
-
642
- for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
643
- const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
644
- const chunk = bytes.subarray(i, chunkEnd);
645
- strBuf.push(String.fromCharCode.apply(null, chunk));
646
- }
647
-
648
- return strBuf.join("");
649
- }
650
-
651
- function stringToBytes(str) {
652
- assert(typeof str === "string", "Invalid argument for stringToBytes");
653
- const length = str.length;
654
- const bytes = new Uint8Array(length);
655
-
656
- for (let i = 0; i < length; ++i) {
657
- bytes[i] = str.charCodeAt(i) & 0xff;
658
- }
659
-
660
- return bytes;
661
- }
620
+ */
621
+
622
+ function removeNullCharacters(str) {
623
+ if (typeof str !== "string") {
624
+ warn("The argument for removeNullCharacters must be a string.");
625
+ return str;
626
+ }
627
+
628
+ return str.replace(NullCharactersRegExp, "");
629
+ }
630
+
631
+ function bytesToString(bytes) {
632
+ assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
633
+ const length = bytes.length;
634
+ const MAX_ARGUMENT_COUNT = 8192;
635
+
636
+ if (length < MAX_ARGUMENT_COUNT) {
637
+ return String.fromCharCode.apply(null, bytes);
638
+ }
639
+
640
+ const strBuf = [];
641
+
642
+ for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
643
+ const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
644
+ const chunk = bytes.subarray(i, chunkEnd);
645
+ strBuf.push(String.fromCharCode.apply(null, chunk));
646
+ }
647
+
648
+ return strBuf.join("");
649
+ }
650
+
651
+ function stringToBytes(str) {
652
+ assert(typeof str === "string", "Invalid argument for stringToBytes");
653
+ const length = str.length;
654
+ const bytes = new Uint8Array(length);
655
+
656
+ for (let i = 0; i < length; ++i) {
657
+ bytes[i] = str.charCodeAt(i) & 0xff;
658
+ }
659
+
660
+ return bytes;
661
+ }
662
662
  /**
663
663
  * Gets length of the array (Array, Uint8Array, or string) in bytes.
664
664
  * @param {Array<any>|Uint8Array|string} arr
665
665
  * @returns {number}
666
- */
667
-
668
-
669
- function arrayByteLength(arr) {
670
- if (arr.length !== undefined) {
671
- return arr.length;
672
- }
673
-
674
- assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
675
- return arr.byteLength;
676
- }
666
+ */
667
+
668
+
669
+ function arrayByteLength(arr) {
670
+ if (arr.length !== undefined) {
671
+ return arr.length;
672
+ }
673
+
674
+ assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
675
+ return arr.byteLength;
676
+ }
677
677
  /**
678
678
  * Combines array items (arrays) into single Uint8Array object.
679
679
  * @param {Array<Array<any>|Uint8Array|string>} arr - the array of the arrays
680
680
  * (Array, Uint8Array, or string).
681
681
  * @returns {Uint8Array}
682
- */
683
-
684
-
685
- function arraysToBytes(arr) {
686
- const length = arr.length; // Shortcut: if first and only item is Uint8Array, return it.
687
-
688
- if (length === 1 && arr[0] instanceof Uint8Array) {
689
- return arr[0];
690
- }
691
-
692
- let resultLength = 0;
693
-
694
- for (let i = 0; i < length; i++) {
695
- resultLength += arrayByteLength(arr[i]);
696
- }
697
-
698
- let pos = 0;
699
- const data = new Uint8Array(resultLength);
700
-
701
- for (let i = 0; i < length; i++) {
702
- let item = arr[i];
703
-
704
- if (!(item instanceof Uint8Array)) {
705
- if (typeof item === "string") {
706
- item = stringToBytes(item);
707
- } else {
708
- item = new Uint8Array(item);
709
- }
710
- }
711
-
712
- const itemLength = item.byteLength;
713
- data.set(item, pos);
714
- pos += itemLength;
715
- }
716
-
717
- return data;
718
- }
719
-
720
- function string32(value) {
721
- if (typeof PDFJSDev === "undefined" || PDFJSDev.test("!PRODUCTION || TESTING")) {
722
- assert(typeof value === "number" && Math.abs(value) < 2 ** 32, `string32: Unexpected input "${value}".`);
723
- }
724
-
725
- return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
726
- }
727
-
728
- function objectSize(obj) {
729
- return Object.keys(obj).length;
730
- } // Ensure that the returned Object has a `null` prototype; hence why
731
- // `Object.fromEntries(...)` is not used.
732
-
733
-
734
- function objectFromMap(map) {
735
- const obj = Object.create(null);
736
-
737
- for (const [key, value] of map) {
738
- obj[key] = value;
739
- }
740
-
741
- return obj;
742
- } // Checks the endianness of the platform.
743
-
744
-
745
- function isLittleEndian() {
746
- const buffer8 = new Uint8Array(4);
747
- buffer8[0] = 1;
748
- const view32 = new Uint32Array(buffer8.buffer, 0, 1);
749
- return view32[0] === 1;
750
- }
751
-
752
- const IsLittleEndianCached = {
753
- get value() {
754
- return shadow(this, "value", isLittleEndian());
755
- }
756
-
757
- }; // Checks if it's possible to eval JS expressions.
758
-
759
- function isEvalSupported() {
760
- try {
761
- new Function(""); // eslint-disable-line no-new, no-new-func
762
-
763
- return true;
764
- } catch (e) {
765
- return false;
766
- }
767
- }
768
-
769
- const IsEvalSupportedCached = {
770
- get value() {
771
- return shadow(this, "value", isEvalSupported());
772
- }
773
-
774
- };
775
- const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
776
-
777
- class Util {
778
- static makeHexColor(r, g, b) {
779
- return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
780
- } // Concatenates two transformation matrices together and returns the result.
781
-
782
-
783
- static transform(m1, m2) {
784
- 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]];
785
- } // For 2d affine transforms
786
-
787
-
788
- static applyTransform(p, m) {
789
- const xt = p[0] * m[0] + p[1] * m[2] + m[4];
790
- const yt = p[0] * m[1] + p[1] * m[3] + m[5];
791
- return [xt, yt];
792
- }
793
-
794
- static applyInverseTransform(p, m) {
795
- const d = m[0] * m[3] - m[1] * m[2];
796
- const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
797
- const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
798
- return [xt, yt];
799
- } // Applies the transform to the rectangle and finds the minimum axially
800
- // aligned bounding box.
801
-
802
-
803
- static getAxialAlignedBoundingBox(r, m) {
804
- const p1 = Util.applyTransform(r, m);
805
- const p2 = Util.applyTransform(r.slice(2, 4), m);
806
- const p3 = Util.applyTransform([r[0], r[3]], m);
807
- const p4 = Util.applyTransform([r[2], r[1]], m);
808
- 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])];
809
- }
810
-
811
- static inverseTransform(m) {
812
- const d = m[0] * m[3] - m[1] * m[2];
813
- 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];
814
- } // Apply a generic 3d matrix M on a 3-vector v:
815
- // | a b c | | X |
816
- // | d e f | x | Y |
817
- // | g h i | | Z |
818
- // M is assumed to be serialized as [a,b,c,d,e,f,g,h,i],
819
- // with v as [X,Y,Z]
820
-
821
-
822
- static apply3dTransform(m, v) {
823
- 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]];
824
- } // This calculation uses Singular Value Decomposition.
825
- // The SVD can be represented with formula A = USV. We are interested in the
826
- // matrix S here because it represents the scale values.
827
-
828
-
829
- static singularValueDecompose2dScale(m) {
830
- const transpose = [m[0], m[2], m[1], m[3]]; // Multiply matrix m with its transpose.
831
-
832
- const a = m[0] * transpose[0] + m[1] * transpose[2];
833
- const b = m[0] * transpose[1] + m[1] * transpose[3];
834
- const c = m[2] * transpose[0] + m[3] * transpose[2];
835
- const d = m[2] * transpose[1] + m[3] * transpose[3]; // Solve the second degree polynomial to get roots.
836
-
837
- const first = (a + d) / 2;
838
- const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
839
- const sx = first + second || 1;
840
- const sy = first - second || 1; // Scale values are the square roots of the eigenvalues.
841
-
842
- return [Math.sqrt(sx), Math.sqrt(sy)];
843
- } // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)
844
- // For coordinate systems whose origin lies in the bottom-left, this
845
- // means normalization to (BL,TR) ordering. For systems with origin in the
846
- // top-left, this means (TL,BR) ordering.
847
-
848
-
849
- static normalizeRect(rect) {
850
- const r = rect.slice(0); // clone rect
851
-
852
- if (rect[0] > rect[2]) {
853
- r[0] = rect[2];
854
- r[2] = rect[0];
855
- }
856
-
857
- if (rect[1] > rect[3]) {
858
- r[1] = rect[3];
859
- r[3] = rect[1];
860
- }
861
-
862
- return r;
863
- } // Returns a rectangle [x1, y1, x2, y2] corresponding to the
864
- // intersection of rect1 and rect2. If no intersection, returns 'false'
865
- // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]
866
-
867
-
868
- static intersect(rect1, rect2) {
869
- function compare(a, b) {
870
- return a - b;
871
- } // Order points along the axes
872
-
873
-
874
- const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
875
- const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
876
- const result = [];
877
- rect1 = Util.normalizeRect(rect1);
878
- rect2 = Util.normalizeRect(rect2); // X: first and second points belong to different rectangles?
879
-
880
- if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
881
- // Intersection must be between second and third points
882
- result[0] = orderedX[1];
883
- result[2] = orderedX[2];
884
- } else {
885
- return null;
886
- } // Y: first and second points belong to different rectangles?
887
-
888
-
889
- if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
890
- // Intersection must be between second and third points
891
- result[1] = orderedY[1];
892
- result[3] = orderedY[2];
893
- } else {
894
- return null;
895
- }
896
-
897
- return result;
898
- }
899
-
900
- }
901
-
902
- const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac];
903
-
904
- function stringToPDFString(str) {
905
- const length = str.length,
906
- strBuf = [];
907
-
908
- if (str[0] === "\xFE" && str[1] === "\xFF") {
909
- // UTF16BE BOM
910
- for (let i = 2; i < length; i += 2) {
911
- strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
912
- }
913
- } else if (str[0] === "\xFF" && str[1] === "\xFE") {
914
- // UTF16LE BOM
915
- for (let i = 2; i < length; i += 2) {
916
- strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
917
- }
918
- } else {
919
- for (let i = 0; i < length; ++i) {
920
- const code = PDFStringTranslateTable[str.charCodeAt(i)];
921
- strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
922
- }
923
- }
924
-
925
- return strBuf.join("");
926
- }
927
-
928
- function escapeString(str) {
929
- // replace "(", ")", "\n", "\r" and "\"
930
- // by "\(", "\)", "\\n", "\\r" and "\\"
931
- // in order to write it in a PDF file.
932
- return str.replace(/([()\\\n\r])/g, match => {
933
- if (match === "\n") {
934
- return "\\n";
935
- } else if (match === "\r") {
936
- return "\\r";
937
- }
938
-
939
- return `\\${match}`;
940
- });
941
- }
942
-
943
- function isAscii(str) {
944
- return /^[\x00-\x7F]*$/.test(str);
945
- }
946
-
947
- function stringToUTF16BEString(str) {
948
- const buf = ["\xFE\xFF"];
949
-
950
- for (let i = 0, ii = str.length; i < ii; i++) {
951
- const char = str.charCodeAt(i);
952
- buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
953
- }
954
-
955
- return buf.join("");
956
- }
957
-
958
- function stringToUTF8String(str) {
959
- return decodeURIComponent(escape(str));
960
- }
961
-
962
- function utf8StringToString(str) {
963
- return unescape(encodeURIComponent(str));
964
- }
965
-
966
- function isBool(v) {
967
- return typeof v === "boolean";
968
- }
969
-
970
- function isNum(v) {
971
- return typeof v === "number";
972
- }
973
-
974
- function isString(v) {
975
- return typeof v === "string";
976
- }
977
-
978
- function isArrayBuffer(v) {
979
- return typeof v === "object" && v !== null && v.byteLength !== undefined;
980
- }
981
-
982
- function isArrayEqual(arr1, arr2) {
983
- if (arr1.length !== arr2.length) {
984
- return false;
985
- }
986
-
987
- for (let i = 0, ii = arr1.length; i < ii; i++) {
988
- if (arr1[i] !== arr2[i]) {
989
- return false;
990
- }
991
- }
992
-
993
- return true;
994
- }
995
-
996
- function getModificationDate(date = new Date()) {
997
- const 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")];
998
- return buffer.join("");
999
- }
682
+ */
683
+
684
+
685
+ function arraysToBytes(arr) {
686
+ const length = arr.length; // Shortcut: if first and only item is Uint8Array, return it.
687
+
688
+ if (length === 1 && arr[0] instanceof Uint8Array) {
689
+ return arr[0];
690
+ }
691
+
692
+ let resultLength = 0;
693
+
694
+ for (let i = 0; i < length; i++) {
695
+ resultLength += arrayByteLength(arr[i]);
696
+ }
697
+
698
+ let pos = 0;
699
+ const data = new Uint8Array(resultLength);
700
+
701
+ for (let i = 0; i < length; i++) {
702
+ let item = arr[i];
703
+
704
+ if (!(item instanceof Uint8Array)) {
705
+ if (typeof item === "string") {
706
+ item = stringToBytes(item);
707
+ } else {
708
+ item = new Uint8Array(item);
709
+ }
710
+ }
711
+
712
+ const itemLength = item.byteLength;
713
+ data.set(item, pos);
714
+ pos += itemLength;
715
+ }
716
+
717
+ return data;
718
+ }
719
+
720
+ function string32(value) {
721
+ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("!PRODUCTION || TESTING")) {
722
+ assert(typeof value === "number" && Math.abs(value) < 2 ** 32, `string32: Unexpected input "${value}".`);
723
+ }
724
+
725
+ return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
726
+ }
727
+
728
+ function objectSize(obj) {
729
+ return Object.keys(obj).length;
730
+ } // Ensure that the returned Object has a `null` prototype; hence why
731
+ // `Object.fromEntries(...)` is not used.
732
+
733
+
734
+ function objectFromMap(map) {
735
+ const obj = Object.create(null);
736
+
737
+ for (const [key, value] of map) {
738
+ obj[key] = value;
739
+ }
740
+
741
+ return obj;
742
+ } // Checks the endianness of the platform.
743
+
744
+
745
+ function isLittleEndian() {
746
+ const buffer8 = new Uint8Array(4);
747
+ buffer8[0] = 1;
748
+ const view32 = new Uint32Array(buffer8.buffer, 0, 1);
749
+ return view32[0] === 1;
750
+ }
751
+
752
+ const IsLittleEndianCached = {
753
+ get value() {
754
+ return shadow(this, "value", isLittleEndian());
755
+ }
756
+
757
+ }; // Checks if it's possible to eval JS expressions.
758
+
759
+ function isEvalSupported() {
760
+ try {
761
+ new Function(""); // eslint-disable-line no-new, no-new-func
762
+
763
+ return true;
764
+ } catch (e) {
765
+ return false;
766
+ }
767
+ }
768
+
769
+ const IsEvalSupportedCached = {
770
+ get value() {
771
+ return shadow(this, "value", isEvalSupported());
772
+ }
773
+
774
+ };
775
+ const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
776
+
777
+ class Util {
778
+ static makeHexColor(r, g, b) {
779
+ return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
780
+ } // Concatenates two transformation matrices together and returns the result.
781
+
782
+
783
+ static transform(m1, m2) {
784
+ 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]];
785
+ } // For 2d affine transforms
786
+
787
+
788
+ static applyTransform(p, m) {
789
+ const xt = p[0] * m[0] + p[1] * m[2] + m[4];
790
+ const yt = p[0] * m[1] + p[1] * m[3] + m[5];
791
+ return [xt, yt];
792
+ }
793
+
794
+ static applyInverseTransform(p, m) {
795
+ const d = m[0] * m[3] - m[1] * m[2];
796
+ const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
797
+ const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
798
+ return [xt, yt];
799
+ } // Applies the transform to the rectangle and finds the minimum axially
800
+ // aligned bounding box.
801
+
802
+
803
+ static getAxialAlignedBoundingBox(r, m) {
804
+ const p1 = Util.applyTransform(r, m);
805
+ const p2 = Util.applyTransform(r.slice(2, 4), m);
806
+ const p3 = Util.applyTransform([r[0], r[3]], m);
807
+ const p4 = Util.applyTransform([r[2], r[1]], m);
808
+ 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])];
809
+ }
810
+
811
+ static inverseTransform(m) {
812
+ const d = m[0] * m[3] - m[1] * m[2];
813
+ 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];
814
+ } // Apply a generic 3d matrix M on a 3-vector v:
815
+ // | a b c | | X |
816
+ // | d e f | x | Y |
817
+ // | g h i | | Z |
818
+ // M is assumed to be serialized as [a,b,c,d,e,f,g,h,i],
819
+ // with v as [X,Y,Z]
820
+
821
+
822
+ static apply3dTransform(m, v) {
823
+ 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]];
824
+ } // This calculation uses Singular Value Decomposition.
825
+ // The SVD can be represented with formula A = USV. We are interested in the
826
+ // matrix S here because it represents the scale values.
827
+
828
+
829
+ static singularValueDecompose2dScale(m) {
830
+ const transpose = [m[0], m[2], m[1], m[3]]; // Multiply matrix m with its transpose.
831
+
832
+ const a = m[0] * transpose[0] + m[1] * transpose[2];
833
+ const b = m[0] * transpose[1] + m[1] * transpose[3];
834
+ const c = m[2] * transpose[0] + m[3] * transpose[2];
835
+ const d = m[2] * transpose[1] + m[3] * transpose[3]; // Solve the second degree polynomial to get roots.
836
+
837
+ const first = (a + d) / 2;
838
+ const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
839
+ const sx = first + second || 1;
840
+ const sy = first - second || 1; // Scale values are the square roots of the eigenvalues.
841
+
842
+ return [Math.sqrt(sx), Math.sqrt(sy)];
843
+ } // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)
844
+ // For coordinate systems whose origin lies in the bottom-left, this
845
+ // means normalization to (BL,TR) ordering. For systems with origin in the
846
+ // top-left, this means (TL,BR) ordering.
847
+
848
+
849
+ static normalizeRect(rect) {
850
+ const r = rect.slice(0); // clone rect
851
+
852
+ if (rect[0] > rect[2]) {
853
+ r[0] = rect[2];
854
+ r[2] = rect[0];
855
+ }
856
+
857
+ if (rect[1] > rect[3]) {
858
+ r[1] = rect[3];
859
+ r[3] = rect[1];
860
+ }
861
+
862
+ return r;
863
+ } // Returns a rectangle [x1, y1, x2, y2] corresponding to the
864
+ // intersection of rect1 and rect2. If no intersection, returns 'false'
865
+ // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]
866
+
867
+
868
+ static intersect(rect1, rect2) {
869
+ function compare(a, b) {
870
+ return a - b;
871
+ } // Order points along the axes
872
+
873
+
874
+ const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
875
+ const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
876
+ const result = [];
877
+ rect1 = Util.normalizeRect(rect1);
878
+ rect2 = Util.normalizeRect(rect2); // X: first and second points belong to different rectangles?
879
+
880
+ if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
881
+ // Intersection must be between second and third points
882
+ result[0] = orderedX[1];
883
+ result[2] = orderedX[2];
884
+ } else {
885
+ return null;
886
+ } // Y: first and second points belong to different rectangles?
887
+
888
+
889
+ if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
890
+ // Intersection must be between second and third points
891
+ result[1] = orderedY[1];
892
+ result[3] = orderedY[2];
893
+ } else {
894
+ return null;
895
+ }
896
+
897
+ return result;
898
+ }
899
+
900
+ }
901
+
902
+ const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac];
903
+
904
+ function stringToPDFString(str) {
905
+ const length = str.length,
906
+ strBuf = [];
907
+
908
+ if (str[0] === "\xFE" && str[1] === "\xFF") {
909
+ // UTF16BE BOM
910
+ for (let i = 2; i < length; i += 2) {
911
+ strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
912
+ }
913
+ } else if (str[0] === "\xFF" && str[1] === "\xFE") {
914
+ // UTF16LE BOM
915
+ for (let i = 2; i < length; i += 2) {
916
+ strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
917
+ }
918
+ } else {
919
+ for (let i = 0; i < length; ++i) {
920
+ const code = PDFStringTranslateTable[str.charCodeAt(i)];
921
+ strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
922
+ }
923
+ }
924
+
925
+ return strBuf.join("");
926
+ }
927
+
928
+ function escapeString(str) {
929
+ // replace "(", ")", "\n", "\r" and "\"
930
+ // by "\(", "\)", "\\n", "\\r" and "\\"
931
+ // in order to write it in a PDF file.
932
+ return str.replace(/([()\\\n\r])/g, match => {
933
+ if (match === "\n") {
934
+ return "\\n";
935
+ } else if (match === "\r") {
936
+ return "\\r";
937
+ }
938
+
939
+ return `\\${match}`;
940
+ });
941
+ }
942
+
943
+ function isAscii(str) {
944
+ return /^[\x00-\x7F]*$/.test(str);
945
+ }
946
+
947
+ function stringToUTF16BEString(str) {
948
+ const buf = ["\xFE\xFF"];
949
+
950
+ for (let i = 0, ii = str.length; i < ii; i++) {
951
+ const char = str.charCodeAt(i);
952
+ buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
953
+ }
954
+
955
+ return buf.join("");
956
+ }
957
+
958
+ function stringToUTF8String(str) {
959
+ return decodeURIComponent(escape(str));
960
+ }
961
+
962
+ function utf8StringToString(str) {
963
+ return unescape(encodeURIComponent(str));
964
+ }
965
+
966
+ function isBool(v) {
967
+ return typeof v === "boolean";
968
+ }
969
+
970
+ function isNum(v) {
971
+ return typeof v === "number";
972
+ }
973
+
974
+ function isString(v) {
975
+ return typeof v === "string";
976
+ }
977
+
978
+ function isArrayBuffer(v) {
979
+ return typeof v === "object" && v !== null && v.byteLength !== undefined;
980
+ }
981
+
982
+ function isArrayEqual(arr1, arr2) {
983
+ if (arr1.length !== arr2.length) {
984
+ return false;
985
+ }
986
+
987
+ for (let i = 0, ii = arr1.length; i < ii; i++) {
988
+ if (arr1[i] !== arr2[i]) {
989
+ return false;
990
+ }
991
+ }
992
+
993
+ return true;
994
+ }
995
+
996
+ function getModificationDate(date = new Date()) {
997
+ const 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")];
998
+ return buffer.join("");
999
+ }
1000
1000
  /**
1001
1001
  * Promise Capability object.
1002
1002
  *
@@ -1005,62 +1005,62 @@ function getModificationDate(date = new Date()) {
1005
1005
  * @property {boolean} settled - If the Promise has been fulfilled/rejected.
1006
1006
  * @property {function} resolve - Fulfills the Promise.
1007
1007
  * @property {function} reject - Rejects the Promise.
1008
- */
1009
-
1008
+ */
1009
+
1010
1010
  /**
1011
1011
  * Creates a promise capability object.
1012
1012
  * @alias createPromiseCapability
1013
1013
  *
1014
1014
  * @returns {PromiseCapability}
1015
- */
1016
-
1017
-
1018
- function createPromiseCapability() {
1019
- const capability = Object.create(null);
1020
- let isSettled = false;
1021
- Object.defineProperty(capability, "settled", {
1022
- get() {
1023
- return isSettled;
1024
- }
1025
-
1026
- });
1027
- capability.promise = new Promise(function (resolve, reject) {
1028
- capability.resolve = function (data) {
1029
- isSettled = true;
1030
- resolve(data);
1031
- };
1032
-
1033
- capability.reject = function (reason) {
1034
- isSettled = true;
1035
- reject(reason);
1036
- };
1037
- });
1038
- return capability;
1039
- }
1040
-
1041
- function createObjectURL(data, contentType = "", forceDataSchema = false) {
1042
- if (URL.createObjectURL && !forceDataSchema) {
1043
- return URL.createObjectURL(new Blob([data], {
1044
- type: contentType
1045
- }));
1046
- } // Blob/createObjectURL is not available, falling back to data schema.
1047
-
1048
-
1049
- const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
1050
- let buffer = `data:${contentType};base64,`;
1051
-
1052
- for (let i = 0, ii = data.length; i < ii; i += 3) {
1053
- const b1 = data[i] & 0xff;
1054
- const b2 = data[i + 1] & 0xff;
1055
- const b3 = data[i + 2] & 0xff;
1056
- const d1 = b1 >> 2,
1057
- d2 = (b1 & 3) << 4 | b2 >> 4;
1058
- const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
1059
- const d4 = i + 2 < ii ? b3 & 0x3f : 64;
1060
- buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
1061
- }
1062
-
1063
- return buffer;
1064
- }
1065
-
1066
- export { utf8StringToString as $, AbortException as A, stringToPDFString as B, createObjectURL as C, CMapCompressionType as D, createValidAbsoluteUrl as E, FormatError as F, PasswordResponses as G, PermissionFlag as H, IsEvalSupportedCached as I, removeNullCharacters as J, BaseException as K, isString as L, MissingPDFException as M, objectSize as N, OPS as O, PasswordException as P, arrayByteLength as Q, arraysToBytes as R, StreamType as S, TextRenderingMode as T, UNSUPPORTED_FEATURES as U, VerbosityLevel as V, FontType as W, isBool as X, isArrayEqual as Y, stringToUTF8String as Z, DocumentActionEventType as _, string32 as a, escapeString as a0, AnnotationFlag as a1, AnnotationFieldFlag as a2, isAscii as a3, stringToUTF16BEString as a4, getModificationDate as a5, AnnotationReplyType as a6, AnnotationActionEventType as a7, PageActionEventType as a8, bytesToString as b, assert as c, info as d, Util as e, IDENTITY_MATRIX as f, FONT_IDENTITY_MATRIX as g, isNum as h, isNodeJS as i, ImageKind as j, IsLittleEndianCached as k, createPromiseCapability as l, isArrayBuffer as m, stringToBytes as n, objectFromMap as o, setVerbosityLevel as p, getVerbosityLevel as q, isSameOrigin as r, shadow as s, UnknownErrorException as t, unreachable as u, UnexpectedResponseException as v, warn as w, InvalidPDFException as x, AnnotationType as y, AnnotationBorderStyleType as z };
1015
+ */
1016
+
1017
+
1018
+ function createPromiseCapability() {
1019
+ const capability = Object.create(null);
1020
+ let isSettled = false;
1021
+ Object.defineProperty(capability, "settled", {
1022
+ get() {
1023
+ return isSettled;
1024
+ }
1025
+
1026
+ });
1027
+ capability.promise = new Promise(function (resolve, reject) {
1028
+ capability.resolve = function (data) {
1029
+ isSettled = true;
1030
+ resolve(data);
1031
+ };
1032
+
1033
+ capability.reject = function (reason) {
1034
+ isSettled = true;
1035
+ reject(reason);
1036
+ };
1037
+ });
1038
+ return capability;
1039
+ }
1040
+
1041
+ function createObjectURL(data, contentType = "", forceDataSchema = false) {
1042
+ if (URL.createObjectURL && !forceDataSchema) {
1043
+ return URL.createObjectURL(new Blob([data], {
1044
+ type: contentType
1045
+ }));
1046
+ } // Blob/createObjectURL is not available, falling back to data schema.
1047
+
1048
+
1049
+ const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
1050
+ let buffer = `data:${contentType};base64,`;
1051
+
1052
+ for (let i = 0, ii = data.length; i < ii; i += 3) {
1053
+ const b1 = data[i] & 0xff;
1054
+ const b2 = data[i + 1] & 0xff;
1055
+ const b3 = data[i + 2] & 0xff;
1056
+ const d1 = b1 >> 2,
1057
+ d2 = (b1 & 3) << 4 | b2 >> 4;
1058
+ const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
1059
+ const d4 = i + 2 < ii ? b3 & 0x3f : 64;
1060
+ buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
1061
+ }
1062
+
1063
+ return buffer;
1064
+ }
1065
+
1066
+ export { utf8StringToString as $, AbortException as A, stringToPDFString as B, createObjectURL as C, CMapCompressionType as D, createValidAbsoluteUrl as E, FormatError as F, PasswordResponses as G, PermissionFlag as H, IsEvalSupportedCached as I, removeNullCharacters as J, BaseException as K, isString as L, MissingPDFException as M, objectSize as N, OPS as O, PasswordException as P, arrayByteLength as Q, arraysToBytes as R, StreamType as S, TextRenderingMode as T, UNSUPPORTED_FEATURES as U, VerbosityLevel as V, FontType as W, isBool as X, isArrayEqual as Y, stringToUTF8String as Z, DocumentActionEventType as _, string32 as a, escapeString as a0, AnnotationFlag as a1, AnnotationFieldFlag as a2, isAscii as a3, stringToUTF16BEString as a4, getModificationDate as a5, AnnotationReplyType as a6, AnnotationActionEventType as a7, PageActionEventType as a8, bytesToString as b, assert as c, info as d, Util as e, IDENTITY_MATRIX as f, FONT_IDENTITY_MATRIX as g, isNum as h, isNodeJS as i, ImageKind as j, IsLittleEndianCached as k, createPromiseCapability as l, isArrayBuffer as m, stringToBytes as n, objectFromMap as o, setVerbosityLevel as p, getVerbosityLevel as q, isSameOrigin as r, shadow as s, UnknownErrorException as t, unreachable as u, UnexpectedResponseException as v, warn as w, InvalidPDFException as x, AnnotationType as y, AnnotationBorderStyleType as z };