pdfjs-dist 2.3.200 → 2.4.456

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.

Potentially problematic release.


This version of pdfjs-dist might be problematic. Click here for more details.

Files changed (185) hide show
  1. package/README.md +4 -0
  2. package/bower.json +1 -1
  3. package/build/pdf.js +6499 -17971
  4. package/build/pdf.js.map +1 -1
  5. package/build/pdf.min.js +22 -1
  6. package/build/pdf.worker.entry.js +5 -3
  7. package/build/pdf.worker.js +19303 -29896
  8. package/build/pdf.worker.js.map +1 -1
  9. package/build/pdf.worker.min.js +22 -1
  10. package/es5/build/pdf.js +25473 -0
  11. package/es5/build/pdf.js.map +1 -0
  12. package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
  13. package/es5/build/pdf.worker.js +57878 -0
  14. package/es5/build/pdf.worker.js.map +1 -0
  15. package/es5/web/images/annotation-check.svg +11 -0
  16. package/es5/web/images/annotation-comment.svg +16 -0
  17. package/es5/web/images/annotation-help.svg +26 -0
  18. package/es5/web/images/annotation-insert.svg +10 -0
  19. package/es5/web/images/annotation-key.svg +11 -0
  20. package/es5/web/images/annotation-newparagraph.svg +11 -0
  21. package/es5/web/images/annotation-noicon.svg +7 -0
  22. package/es5/web/images/annotation-note.svg +42 -0
  23. package/es5/web/images/annotation-paragraph.svg +16 -0
  24. package/es5/web/images/loading-icon.gif +0 -0
  25. package/es5/web/images/shadow.png +0 -0
  26. package/es5/web/images/texture.png +0 -0
  27. package/es5/web/pdf_viewer.css +407 -0
  28. package/es5/web/pdf_viewer.js +7757 -0
  29. package/es5/web/pdf_viewer.js.map +1 -0
  30. package/image_decoders/pdf.image_decoders.js +1333 -4839
  31. package/image_decoders/pdf.image_decoders.js.map +1 -1
  32. package/image_decoders/pdf.image_decoders.min.js +22 -1
  33. package/lib/README.md +7 -0
  34. package/lib/core/annotation.js +683 -1066
  35. package/lib/core/arithmetic_decoder.js +81 -97
  36. package/lib/core/bidi.js +54 -46
  37. package/lib/core/ccitt.js +88 -81
  38. package/lib/core/ccitt_stream.js +15 -14
  39. package/lib/core/cff_parser.js +196 -193
  40. package/lib/core/charsets.js +4 -4
  41. package/lib/core/chunked_stream.js +441 -569
  42. package/lib/core/cmap.js +220 -279
  43. package/lib/core/colorspace.js +699 -863
  44. package/lib/core/core_utils.js +59 -80
  45. package/lib/core/crypto.js +379 -437
  46. package/lib/core/document.js +564 -673
  47. package/lib/core/encodings.js +15 -15
  48. package/lib/core/evaluator.js +983 -889
  49. package/lib/core/font_renderer.js +128 -171
  50. package/lib/core/fonts.js +451 -400
  51. package/lib/core/function.js +289 -285
  52. package/lib/core/glyphlist.js +4527 -4527
  53. package/lib/core/image.js +138 -117
  54. package/lib/core/image_utils.js +46 -63
  55. package/lib/core/jbig2.js +324 -332
  56. package/lib/core/jbig2_stream.js +18 -17
  57. package/lib/core/jpeg_stream.js +133 -24
  58. package/lib/core/jpg.js +238 -210
  59. package/lib/core/jpx.js +158 -157
  60. package/lib/core/jpx_stream.js +28 -28
  61. package/lib/core/metrics.js +2928 -2928
  62. package/lib/core/murmurhash3.js +87 -102
  63. package/lib/core/obj.js +1111 -1302
  64. package/lib/core/operator_list.js +55 -42
  65. package/lib/core/parser.js +956 -987
  66. package/lib/core/pattern.js +69 -69
  67. package/lib/core/pdf_manager.js +149 -316
  68. package/lib/core/primitives.js +45 -77
  69. package/lib/core/ps_parser.js +175 -214
  70. package/lib/core/standard_fonts.js +237 -236
  71. package/lib/core/stream.js +83 -77
  72. package/lib/core/type1_parser.js +78 -68
  73. package/lib/core/unicode.js +1654 -1654
  74. package/lib/core/worker.js +148 -196
  75. package/lib/core/worker_stream.js +101 -210
  76. package/lib/display/annotation_layer.js +733 -1155
  77. package/lib/display/api.js +1539 -1928
  78. package/lib/display/api_compatibility.js +10 -8
  79. package/lib/display/canvas.js +159 -158
  80. package/lib/display/content_disposition.js +36 -55
  81. package/lib/display/display_utils.js +298 -551
  82. package/lib/display/fetch_stream.js +181 -305
  83. package/lib/display/font_loader.js +273 -416
  84. package/lib/display/metadata.js +86 -98
  85. package/lib/display/network.js +376 -511
  86. package/lib/display/network_utils.js +20 -19
  87. package/lib/display/node_stream.js +276 -460
  88. package/lib/display/pattern_helper.js +76 -44
  89. package/lib/display/svg.js +1137 -1405
  90. package/lib/display/text_layer.js +75 -82
  91. package/lib/display/transport_stream.js +236 -374
  92. package/lib/display/webgl.js +70 -83
  93. package/lib/display/worker_options.js +3 -3
  94. package/lib/display/xml_parser.js +303 -392
  95. package/lib/examples/node/domstubs.js +37 -37
  96. package/lib/pdf.js +22 -21
  97. package/lib/pdf.worker.js +5 -5
  98. package/lib/shared/compatibility.js +2 -251
  99. package/lib/shared/is_node.js +7 -6
  100. package/lib/shared/message_handler.js +222 -194
  101. package/lib/shared/util.js +269 -405
  102. package/lib/test/unit/annotation_spec.js +1089 -1014
  103. package/lib/test/unit/api_spec.js +617 -544
  104. package/lib/test/unit/bidi_spec.js +7 -7
  105. package/lib/test/unit/cff_parser_spec.js +63 -62
  106. package/lib/test/unit/clitests_helper.js +7 -9
  107. package/lib/test/unit/cmap_spec.js +84 -86
  108. package/lib/test/unit/colorspace_spec.js +154 -154
  109. package/lib/test/unit/core_utils_spec.js +125 -105
  110. package/lib/test/unit/crypto_spec.js +181 -181
  111. package/lib/test/unit/custom_spec.js +22 -24
  112. package/lib/test/unit/display_svg_spec.js +35 -36
  113. package/lib/test/unit/display_utils_spec.js +139 -149
  114. package/lib/test/unit/document_spec.js +16 -16
  115. package/lib/test/unit/encodings_spec.js +12 -34
  116. package/lib/test/unit/evaluator_spec.js +81 -95
  117. package/lib/test/unit/fetch_stream_spec.js +30 -30
  118. package/lib/test/unit/function_spec.js +206 -204
  119. package/lib/test/unit/jasmine-boot.js +48 -32
  120. package/lib/test/unit/message_handler_spec.js +172 -162
  121. package/lib/test/unit/metadata_spec.js +69 -69
  122. package/lib/test/unit/murmurhash3_spec.js +12 -12
  123. package/lib/test/unit/network_spec.js +12 -12
  124. package/lib/test/unit/network_utils_spec.js +152 -152
  125. package/lib/test/unit/node_stream_spec.js +74 -90
  126. package/lib/test/unit/parser_spec.js +107 -113
  127. package/lib/test/unit/pdf_find_controller_spec.js +55 -86
  128. package/lib/test/unit/pdf_find_utils_spec.js +32 -32
  129. package/lib/test/unit/pdf_history_spec.js +32 -32
  130. package/lib/test/unit/primitives_spec.js +117 -115
  131. package/lib/test/unit/stream_spec.js +16 -14
  132. package/lib/test/unit/test_utils.js +119 -285
  133. package/lib/test/unit/testreporter.js +19 -19
  134. package/lib/test/unit/type1_parser_spec.js +41 -41
  135. package/lib/test/unit/ui_utils_spec.js +318 -426
  136. package/lib/test/unit/unicode_spec.js +42 -42
  137. package/lib/test/unit/util_spec.js +122 -143
  138. package/lib/web/annotation_layer_builder.js +66 -103
  139. package/lib/web/app.js +1166 -1196
  140. package/lib/web/app_options.js +61 -77
  141. package/lib/web/base_viewer.js +804 -850
  142. package/lib/web/chromecom.js +164 -249
  143. package/lib/web/debugger.js +149 -205
  144. package/lib/web/download_manager.js +38 -57
  145. package/lib/web/firefox_print_service.js +35 -30
  146. package/lib/web/firefoxcom.js +175 -374
  147. package/lib/web/genericcom.js +26 -108
  148. package/lib/web/genericl10n.js +24 -153
  149. package/lib/web/grab_to_pan.js +30 -30
  150. package/lib/web/interfaces.js +80 -258
  151. package/lib/web/overlay_manager.js +70 -246
  152. package/lib/web/password_prompt.js +38 -64
  153. package/lib/web/pdf_attachment_viewer.js +105 -130
  154. package/lib/web/pdf_cursor_tools.js +75 -102
  155. package/lib/web/pdf_document_properties.js +227 -376
  156. package/lib/web/pdf_find_bar.js +137 -171
  157. package/lib/web/pdf_find_controller.js +492 -549
  158. package/lib/web/pdf_find_utils.js +13 -13
  159. package/lib/web/pdf_history.js +395 -406
  160. package/lib/web/pdf_link_service.js +302 -349
  161. package/lib/web/pdf_outline_viewer.js +148 -209
  162. package/lib/web/pdf_page_view.js +449 -507
  163. package/lib/web/pdf_presentation_mode.js +304 -357
  164. package/lib/web/pdf_print_service.js +90 -104
  165. package/lib/web/pdf_rendering_queue.js +87 -108
  166. package/lib/web/pdf_sidebar.js +264 -304
  167. package/lib/web/pdf_sidebar_resizer.js +92 -119
  168. package/lib/web/pdf_single_page_viewer.js +77 -126
  169. package/lib/web/pdf_thumbnail_view.js +276 -297
  170. package/lib/web/pdf_thumbnail_viewer.js +186 -206
  171. package/lib/web/pdf_viewer.component.js +20 -21
  172. package/lib/web/pdf_viewer.js +55 -115
  173. package/lib/web/preferences.js +66 -273
  174. package/lib/web/secondary_toolbar.js +164 -196
  175. package/lib/web/text_layer_builder.js +284 -317
  176. package/lib/web/toolbar.js +216 -211
  177. package/lib/web/ui_utils.js +303 -404
  178. package/lib/web/view_history.js +49 -222
  179. package/lib/web/viewer_compatibility.js +7 -5
  180. package/package.json +2 -9
  181. package/web/pdf_viewer.css +25 -18
  182. package/web/pdf_viewer.js +3481 -4764
  183. package/web/pdf_viewer.js.map +1 -1
  184. package/webpack.js +14 -5
  185. package/lib/shared/streams_polyfill.js +0 -43
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2019 Mozilla Foundation
5
+ * Copyright 2020 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -21,53 +21,39 @@
21
21
  */
22
22
  "use strict";
23
23
 
24
- var _annotation = require("../../core/annotation");
24
+ var _annotation = require("../../core/annotation.js");
25
25
 
26
- var _util = require("../../shared/util");
26
+ var _util = require("../../shared/util.js");
27
27
 
28
- var _test_utils = require("./test_utils");
28
+ var _test_utils = require("./test_utils.js");
29
29
 
30
- var _primitives = require("../../core/primitives");
30
+ var _primitives = require("../../core/primitives.js");
31
31
 
32
- var _parser = require("../../core/parser");
32
+ var _parser = require("../../core/parser.js");
33
33
 
34
- var _stream = require("../../core/stream");
35
-
36
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37
-
38
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
39
-
40
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
41
-
42
- describe('annotation', function () {
43
- var PDFManagerMock =
44
- /*#__PURE__*/
45
- function () {
46
- function PDFManagerMock(params) {
47
- _classCallCheck(this, PDFManagerMock);
34
+ var _stream = require("../../core/stream.js");
48
35
 
36
+ describe("annotation", function () {
37
+ class PDFManagerMock {
38
+ constructor(params) {
49
39
  this.docBaseUrl = params.docBaseUrl || null;
50
40
  }
51
41
 
52
- _createClass(PDFManagerMock, [{
53
- key: "ensure",
54
- value: function ensure(obj, prop, args) {
55
- return new Promise(function (resolve) {
56
- var value = obj[prop];
57
-
58
- if (typeof value === 'function') {
59
- resolve(value.apply(obj, args));
60
- } else {
61
- resolve(value);
62
- }
63
- });
64
- }
65
- }]);
42
+ ensure(obj, prop, args) {
43
+ return new Promise(function (resolve) {
44
+ const value = obj[prop];
66
45
 
67
- return PDFManagerMock;
68
- }();
46
+ if (typeof value === "function") {
47
+ resolve(value.apply(obj, args));
48
+ } else {
49
+ resolve(value);
50
+ }
51
+ });
52
+ }
69
53
 
70
- var pdfManagerMock, idFactoryMock;
54
+ }
55
+
56
+ let pdfManagerMock, idFactoryMock;
71
57
  beforeAll(function (done) {
72
58
  pdfManagerMock = new PDFManagerMock({
73
59
  docBaseUrl: null
@@ -79,67 +65,71 @@ describe('annotation', function () {
79
65
  pdfManagerMock = null;
80
66
  idFactoryMock = null;
81
67
  });
82
- describe('AnnotationFactory', function () {
83
- it('should get id for annotation', function (done) {
84
- var annotationDict = new _primitives.Dict();
85
- annotationDict.set('Type', _primitives.Name.get('Annot'));
86
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
68
+ describe("AnnotationFactory", function () {
69
+ it("should get id for annotation", function (done) {
70
+ const annotationDict = new _primitives.Dict();
71
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
72
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
87
73
 
88
- var annotationRef = _primitives.Ref.get(10, 0);
74
+ const annotationRef = _primitives.Ref.get(10, 0);
89
75
 
90
- var xref = new _test_utils.XRefMock([{
76
+ const xref = new _test_utils.XRefMock([{
91
77
  ref: annotationRef,
92
78
  data: annotationDict
93
79
  }]);
94
80
 
95
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref) {
96
- var data = _ref.data;
81
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
82
+ data
83
+ }) => {
97
84
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
98
- expect(data.id).toEqual('10R');
85
+ expect(data.id).toEqual("10R");
99
86
  done();
100
87
  }, done.fail);
101
88
  });
102
- it('should handle, and get fallback IDs for, annotations that are not ' + 'indirect objects (issue 7569)', function (done) {
103
- var annotationDict = new _primitives.Dict();
104
- annotationDict.set('Type', _primitives.Name.get('Annot'));
105
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
106
- var xref = new _test_utils.XRefMock();
107
- var idFactory = (0, _test_utils.createIdFactory)(0);
89
+ it("should handle, and get fallback IDs for, annotations that are not " + "indirect objects (issue 7569)", function (done) {
90
+ const annotationDict = new _primitives.Dict();
91
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
92
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
93
+ const xref = new _test_utils.XRefMock();
94
+ const idFactory = (0, _test_utils.createIdFactory)(0);
108
95
 
109
- var annotation1 = _annotation.AnnotationFactory.create(xref, annotationDict, pdfManagerMock, idFactory).then(function (_ref2) {
110
- var data = _ref2.data;
96
+ const annotation1 = _annotation.AnnotationFactory.create(xref, annotationDict, pdfManagerMock, idFactory).then(({
97
+ data
98
+ }) => {
111
99
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
112
- expect(data.id).toEqual('annot_p0_1');
100
+ expect(data.id).toEqual("annot_p0_1");
113
101
  });
114
102
 
115
- var annotation2 = _annotation.AnnotationFactory.create(xref, annotationDict, pdfManagerMock, idFactory).then(function (_ref3) {
116
- var data = _ref3.data;
103
+ const annotation2 = _annotation.AnnotationFactory.create(xref, annotationDict, pdfManagerMock, idFactory).then(({
104
+ data
105
+ }) => {
117
106
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
118
- expect(data.id).toEqual('annot_p0_2');
107
+ expect(data.id).toEqual("annot_p0_2");
119
108
  });
120
109
 
121
110
  Promise.all([annotation1, annotation2]).then(done, done.fail);
122
111
  });
123
- it('should handle missing /Subtype', function (done) {
124
- var annotationDict = new _primitives.Dict();
125
- annotationDict.set('Type', _primitives.Name.get('Annot'));
112
+ it("should handle missing /Subtype", function (done) {
113
+ const annotationDict = new _primitives.Dict();
114
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
126
115
 
127
- var annotationRef = _primitives.Ref.get(1, 0);
116
+ const annotationRef = _primitives.Ref.get(1, 0);
128
117
 
129
- var xref = new _test_utils.XRefMock([{
118
+ const xref = new _test_utils.XRefMock([{
130
119
  ref: annotationRef,
131
120
  data: annotationDict
132
121
  }]);
133
122
 
134
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref4) {
135
- var data = _ref4.data;
123
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
124
+ data
125
+ }) => {
136
126
  expect(data.annotationType).toBeUndefined();
137
127
  done();
138
128
  }, done.fail);
139
129
  });
140
130
  });
141
- describe('getQuadPoints', function () {
142
- var dict, rect;
131
+ describe("getQuadPoints", function () {
132
+ let dict, rect;
143
133
  beforeEach(function (done) {
144
134
  dict = new _primitives.Dict();
145
135
  rect = [];
@@ -149,30 +139,29 @@ describe('annotation', function () {
149
139
  dict = null;
150
140
  rect = null;
151
141
  });
152
- it('should ignore missing quadpoints', function () {
142
+ it("should ignore missing quadpoints", function () {
153
143
  expect((0, _annotation.getQuadPoints)(dict, rect)).toEqual(null);
154
144
  });
155
- it('should ignore non-array values', function () {
156
- dict.set('QuadPoints', 'foo');
145
+ it("should ignore non-array values", function () {
146
+ dict.set("QuadPoints", "foo");
157
147
  expect((0, _annotation.getQuadPoints)(dict, rect)).toEqual(null);
158
148
  });
159
- it('should ignore arrays where the length is not a multiple of eight', function () {
160
- dict.set('QuadPoints', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
149
+ it("should ignore arrays where the length is not a multiple of eight", function () {
150
+ dict.set("QuadPoints", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
161
151
  expect((0, _annotation.getQuadPoints)(dict, rect)).toEqual(null);
162
152
  });
163
- it('should ignore quadpoints if one coordinate lies outside the rectangle', function () {
153
+ it("should ignore quadpoints if one coordinate lies outside the rectangle", function () {
164
154
  rect = [10, 10, 20, 20];
165
- var inputs = [[11, 11, 12, 12, 9, 13, 14, 14], [11, 11, 12, 12, 13, 9, 14, 14], [11, 11, 12, 12, 21, 13, 14, 14], [11, 11, 12, 12, 13, 21, 14, 14]];
155
+ const inputs = [[11, 11, 12, 12, 9, 13, 14, 14], [11, 11, 12, 12, 13, 9, 14, 14], [11, 11, 12, 12, 21, 13, 14, 14], [11, 11, 12, 12, 13, 21, 14, 14]];
166
156
 
167
- for (var _i = 0, _inputs = inputs; _i < _inputs.length; _i++) {
168
- var input = _inputs[_i];
169
- dict.set('QuadPoints', input);
157
+ for (const input of inputs) {
158
+ dict.set("QuadPoints", input);
170
159
  expect((0, _annotation.getQuadPoints)(dict, rect)).toEqual(null);
171
160
  }
172
161
  });
173
- it('should process valid quadpoints arrays', function () {
162
+ it("should process valid quadpoints arrays", function () {
174
163
  rect = [10, 10, 20, 20];
175
- dict.set('QuadPoints', [11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18]);
164
+ dict.set("QuadPoints", [11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18]);
176
165
  expect((0, _annotation.getQuadPoints)(dict, rect)).toEqual([[{
177
166
  x: 11,
178
167
  y: 11
@@ -200,8 +189,8 @@ describe('annotation', function () {
200
189
  }]]);
201
190
  });
202
191
  });
203
- describe('Annotation', function () {
204
- var dict, ref;
192
+ describe("Annotation", function () {
193
+ let dict, ref;
205
194
  beforeAll(function (done) {
206
195
  dict = new _primitives.Dict();
207
196
  ref = _primitives.Ref.get(1, 0);
@@ -210,42 +199,42 @@ describe('annotation', function () {
210
199
  afterAll(function () {
211
200
  dict = ref = null;
212
201
  });
213
- it('should set and get valid contents', function () {
214
- var annotation = new _annotation.Annotation({
215
- dict: dict,
216
- ref: ref
202
+ it("should set and get valid contents", function () {
203
+ const annotation = new _annotation.Annotation({
204
+ dict,
205
+ ref
217
206
  });
218
- annotation.setContents('Foo bar baz');
219
- expect(annotation.contents).toEqual('Foo bar baz');
207
+ annotation.setContents("Foo bar baz");
208
+ expect(annotation.contents).toEqual("Foo bar baz");
220
209
  });
221
- it('should not set and get invalid contents', function () {
222
- var annotation = new _annotation.Annotation({
223
- dict: dict,
224
- ref: ref
210
+ it("should not set and get invalid contents", function () {
211
+ const annotation = new _annotation.Annotation({
212
+ dict,
213
+ ref
225
214
  });
226
215
  annotation.setContents(undefined);
227
- expect(annotation.contents).toEqual('');
216
+ expect(annotation.contents).toEqual("");
228
217
  });
229
- it('should set and get a valid modification date', function () {
230
- var annotation = new _annotation.Annotation({
231
- dict: dict,
232
- ref: ref
218
+ it("should set and get a valid modification date", function () {
219
+ const annotation = new _annotation.Annotation({
220
+ dict,
221
+ ref
233
222
  });
234
- annotation.setModificationDate('D:20190422');
235
- expect(annotation.modificationDate).toEqual('D:20190422');
223
+ annotation.setModificationDate("D:20190422");
224
+ expect(annotation.modificationDate).toEqual("D:20190422");
236
225
  });
237
- it('should not set and get an invalid modification date', function () {
238
- var annotation = new _annotation.Annotation({
239
- dict: dict,
240
- ref: ref
226
+ it("should not set and get an invalid modification date", function () {
227
+ const annotation = new _annotation.Annotation({
228
+ dict,
229
+ ref
241
230
  });
242
231
  annotation.setModificationDate(undefined);
243
232
  expect(annotation.modificationDate).toEqual(null);
244
233
  });
245
- it('should set and get flags', function () {
246
- var annotation = new _annotation.Annotation({
247
- dict: dict,
248
- ref: ref
234
+ it("should set and get flags", function () {
235
+ const annotation = new _annotation.Annotation({
236
+ dict,
237
+ ref
249
238
  });
250
239
  annotation.setFlags(13);
251
240
  expect(annotation.hasFlag(_util.AnnotationFlag.INVISIBLE)).toEqual(true);
@@ -253,141 +242,141 @@ describe('annotation', function () {
253
242
  expect(annotation.hasFlag(_util.AnnotationFlag.PRINT)).toEqual(true);
254
243
  expect(annotation.hasFlag(_util.AnnotationFlag.READONLY)).toEqual(false);
255
244
  });
256
- it('should be viewable and not printable by default', function () {
257
- var annotation = new _annotation.Annotation({
258
- dict: dict,
259
- ref: ref
245
+ it("should be viewable and not printable by default", function () {
246
+ const annotation = new _annotation.Annotation({
247
+ dict,
248
+ ref
260
249
  });
261
250
  expect(annotation.viewable).toEqual(true);
262
251
  expect(annotation.printable).toEqual(false);
263
252
  });
264
- it('should set and get a valid rectangle', function () {
265
- var annotation = new _annotation.Annotation({
266
- dict: dict,
267
- ref: ref
253
+ it("should set and get a valid rectangle", function () {
254
+ const annotation = new _annotation.Annotation({
255
+ dict,
256
+ ref
268
257
  });
269
258
  annotation.setRectangle([117, 694, 164.298, 720]);
270
259
  expect(annotation.rectangle).toEqual([117, 694, 164.298, 720]);
271
260
  });
272
- it('should not set and get an invalid rectangle', function () {
273
- var annotation = new _annotation.Annotation({
274
- dict: dict,
275
- ref: ref
261
+ it("should not set and get an invalid rectangle", function () {
262
+ const annotation = new _annotation.Annotation({
263
+ dict,
264
+ ref
276
265
  });
277
266
  annotation.setRectangle([117, 694, 164.298]);
278
267
  expect(annotation.rectangle).toEqual([0, 0, 0, 0]);
279
268
  });
280
- it('should reject a color if it is not an array', function () {
281
- var annotation = new _annotation.Annotation({
282
- dict: dict,
283
- ref: ref
269
+ it("should reject a color if it is not an array", function () {
270
+ const annotation = new _annotation.Annotation({
271
+ dict,
272
+ ref
284
273
  });
285
- annotation.setColor('red');
274
+ annotation.setColor("red");
286
275
  expect(annotation.color).toEqual(new Uint8ClampedArray([0, 0, 0]));
287
276
  });
288
- it('should set and get a transparent color', function () {
289
- var annotation = new _annotation.Annotation({
290
- dict: dict,
291
- ref: ref
277
+ it("should set and get a transparent color", function () {
278
+ const annotation = new _annotation.Annotation({
279
+ dict,
280
+ ref
292
281
  });
293
282
  annotation.setColor([]);
294
283
  expect(annotation.color).toEqual(null);
295
284
  });
296
- it('should set and get a grayscale color', function () {
297
- var annotation = new _annotation.Annotation({
298
- dict: dict,
299
- ref: ref
285
+ it("should set and get a grayscale color", function () {
286
+ const annotation = new _annotation.Annotation({
287
+ dict,
288
+ ref
300
289
  });
301
290
  annotation.setColor([0.4]);
302
291
  expect(annotation.color).toEqual(new Uint8ClampedArray([102, 102, 102]));
303
292
  });
304
- it('should set and get an RGB color', function () {
305
- var annotation = new _annotation.Annotation({
306
- dict: dict,
307
- ref: ref
293
+ it("should set and get an RGB color", function () {
294
+ const annotation = new _annotation.Annotation({
295
+ dict,
296
+ ref
308
297
  });
309
298
  annotation.setColor([0, 0, 1]);
310
299
  expect(annotation.color).toEqual(new Uint8ClampedArray([0, 0, 255]));
311
300
  });
312
- it('should set and get a CMYK color', function () {
313
- var annotation = new _annotation.Annotation({
314
- dict: dict,
315
- ref: ref
301
+ it("should set and get a CMYK color", function () {
302
+ const annotation = new _annotation.Annotation({
303
+ dict,
304
+ ref
316
305
  });
317
306
  annotation.setColor([0.1, 0.92, 0.84, 0.02]);
318
307
  expect(annotation.color).toEqual(new Uint8ClampedArray([234, 59, 48]));
319
308
  });
320
- it('should not set and get an invalid color', function () {
321
- var annotation = new _annotation.Annotation({
322
- dict: dict,
323
- ref: ref
309
+ it("should not set and get an invalid color", function () {
310
+ const annotation = new _annotation.Annotation({
311
+ dict,
312
+ ref
324
313
  });
325
314
  annotation.setColor([0.4, 0.6]);
326
315
  expect(annotation.color).toEqual(new Uint8ClampedArray([0, 0, 0]));
327
316
  });
328
317
  });
329
- describe('AnnotationBorderStyle', function () {
330
- it('should set and get a valid width', function () {
331
- var borderStyle = new _annotation.AnnotationBorderStyle();
318
+ describe("AnnotationBorderStyle", function () {
319
+ it("should set and get a valid width", function () {
320
+ const borderStyle = new _annotation.AnnotationBorderStyle();
332
321
  borderStyle.setWidth(3);
333
322
  expect(borderStyle.width).toEqual(3);
334
323
  });
335
- it('should not set and get an invalid width', function () {
336
- var borderStyle = new _annotation.AnnotationBorderStyle();
337
- borderStyle.setWidth('three');
324
+ it("should not set and get an invalid width", function () {
325
+ const borderStyle = new _annotation.AnnotationBorderStyle();
326
+ borderStyle.setWidth("three");
338
327
  expect(borderStyle.width).toEqual(1);
339
328
  });
340
- it('should set the width to zero, when the input is a `Name` (issue 10385)', function () {
341
- var borderStyleZero = new _annotation.AnnotationBorderStyle();
342
- borderStyleZero.setWidth(_primitives.Name.get('0'));
343
- var borderStyleFive = new _annotation.AnnotationBorderStyle();
344
- borderStyleFive.setWidth(_primitives.Name.get('5'));
329
+ it("should set the width to zero, when the input is a `Name` (issue 10385)", function () {
330
+ const borderStyleZero = new _annotation.AnnotationBorderStyle();
331
+ borderStyleZero.setWidth(_primitives.Name.get("0"));
332
+ const borderStyleFive = new _annotation.AnnotationBorderStyle();
333
+ borderStyleFive.setWidth(_primitives.Name.get("5"));
345
334
  expect(borderStyleZero.width).toEqual(0);
346
335
  expect(borderStyleFive.width).toEqual(0);
347
336
  });
348
- it('should set and get a valid style', function () {
349
- var borderStyle = new _annotation.AnnotationBorderStyle();
350
- borderStyle.setStyle(_primitives.Name.get('D'));
337
+ it("should set and get a valid style", function () {
338
+ const borderStyle = new _annotation.AnnotationBorderStyle();
339
+ borderStyle.setStyle(_primitives.Name.get("D"));
351
340
  expect(borderStyle.style).toEqual(_util.AnnotationBorderStyleType.DASHED);
352
341
  });
353
- it('should not set and get an invalid style', function () {
354
- var borderStyle = new _annotation.AnnotationBorderStyle();
355
- borderStyle.setStyle('Dashed');
342
+ it("should not set and get an invalid style", function () {
343
+ const borderStyle = new _annotation.AnnotationBorderStyle();
344
+ borderStyle.setStyle("Dashed");
356
345
  expect(borderStyle.style).toEqual(_util.AnnotationBorderStyleType.SOLID);
357
346
  });
358
- it('should set and get a valid dash array', function () {
359
- var borderStyle = new _annotation.AnnotationBorderStyle();
347
+ it("should set and get a valid dash array", function () {
348
+ const borderStyle = new _annotation.AnnotationBorderStyle();
360
349
  borderStyle.setDashArray([1, 2, 3]);
361
350
  expect(borderStyle.dashArray).toEqual([1, 2, 3]);
362
351
  });
363
- it('should not set and get an invalid dash array', function () {
364
- var borderStyle = new _annotation.AnnotationBorderStyle();
352
+ it("should not set and get an invalid dash array", function () {
353
+ const borderStyle = new _annotation.AnnotationBorderStyle();
365
354
  borderStyle.setDashArray([0, 0]);
366
355
  expect(borderStyle.dashArray).toEqual([3]);
367
356
  });
368
- it('should set and get a valid horizontal corner radius', function () {
369
- var borderStyle = new _annotation.AnnotationBorderStyle();
357
+ it("should set and get a valid horizontal corner radius", function () {
358
+ const borderStyle = new _annotation.AnnotationBorderStyle();
370
359
  borderStyle.setHorizontalCornerRadius(3);
371
360
  expect(borderStyle.horizontalCornerRadius).toEqual(3);
372
361
  });
373
- it('should not set and get an invalid horizontal corner radius', function () {
374
- var borderStyle = new _annotation.AnnotationBorderStyle();
375
- borderStyle.setHorizontalCornerRadius('three');
362
+ it("should not set and get an invalid horizontal corner radius", function () {
363
+ const borderStyle = new _annotation.AnnotationBorderStyle();
364
+ borderStyle.setHorizontalCornerRadius("three");
376
365
  expect(borderStyle.horizontalCornerRadius).toEqual(0);
377
366
  });
378
- it('should set and get a valid vertical corner radius', function () {
379
- var borderStyle = new _annotation.AnnotationBorderStyle();
367
+ it("should set and get a valid vertical corner radius", function () {
368
+ const borderStyle = new _annotation.AnnotationBorderStyle();
380
369
  borderStyle.setVerticalCornerRadius(3);
381
370
  expect(borderStyle.verticalCornerRadius).toEqual(3);
382
371
  });
383
- it('should not set and get an invalid vertical corner radius', function () {
384
- var borderStyle = new _annotation.AnnotationBorderStyle();
385
- borderStyle.setVerticalCornerRadius('three');
372
+ it("should not set and get an invalid vertical corner radius", function () {
373
+ const borderStyle = new _annotation.AnnotationBorderStyle();
374
+ borderStyle.setVerticalCornerRadius("three");
386
375
  expect(borderStyle.verticalCornerRadius).toEqual(0);
387
376
  });
388
377
  });
389
- describe('MarkupAnnotation', function () {
390
- var dict, ref;
378
+ describe("MarkupAnnotation", function () {
379
+ let dict, ref;
391
380
  beforeAll(function (done) {
392
381
  dict = new _primitives.Dict();
393
382
  ref = _primitives.Ref.get(1, 0);
@@ -396,48 +385,52 @@ describe('annotation', function () {
396
385
  afterAll(function () {
397
386
  dict = ref = null;
398
387
  });
399
- it('should set and get a valid creation date', function () {
400
- var markupAnnotation = new _annotation.MarkupAnnotation({
401
- dict: dict,
402
- ref: ref
388
+ it("should set and get a valid creation date", function () {
389
+ const markupAnnotation = new _annotation.MarkupAnnotation({
390
+ dict,
391
+ ref
403
392
  });
404
- markupAnnotation.setCreationDate('D:20190422');
405
- expect(markupAnnotation.creationDate).toEqual('D:20190422');
393
+ markupAnnotation.setCreationDate("D:20190422");
394
+ expect(markupAnnotation.creationDate).toEqual("D:20190422");
406
395
  });
407
- it('should not set and get an invalid creation date', function () {
408
- var markupAnnotation = new _annotation.MarkupAnnotation({
409
- dict: dict,
410
- ref: ref
396
+ it("should not set and get an invalid creation date", function () {
397
+ const markupAnnotation = new _annotation.MarkupAnnotation({
398
+ dict,
399
+ ref
411
400
  });
412
401
  markupAnnotation.setCreationDate(undefined);
413
402
  expect(markupAnnotation.creationDate).toEqual(null);
414
403
  });
415
- it('should not parse IRT/RT when not defined', function (done) {
416
- dict.set('Type', _primitives.Name.get('Annot'));
417
- dict.set('Subtype', _primitives.Name.get('Text'));
418
- var xref = new _test_utils.XRefMock([{
419
- ref: ref,
404
+ it("should not parse IRT/RT when not defined", function (done) {
405
+ dict.set("Type", _primitives.Name.get("Annot"));
406
+ dict.set("Subtype", _primitives.Name.get("Text"));
407
+ const xref = new _test_utils.XRefMock([{
408
+ ref,
420
409
  data: dict
421
410
  }]);
422
411
 
423
- _annotation.AnnotationFactory.create(xref, ref, pdfManagerMock, idFactoryMock).then(function (_ref5) {
424
- var data = _ref5.data;
412
+ _annotation.AnnotationFactory.create(xref, ref, pdfManagerMock, idFactoryMock).then(({
413
+ data
414
+ }) => {
425
415
  expect(data.inReplyTo).toBeUndefined();
426
416
  expect(data.replyType).toBeUndefined();
427
417
  done();
428
418
  }, done.fail);
429
419
  });
430
- it('should parse IRT and set default RT when not defined.', function (done) {
431
- var annotationRef = new _primitives.Ref(819, 0);
432
- var annotationDict = new _primitives.Dict();
433
- annotationDict.set('Type', _primitives.Name.get('Annot'));
434
- annotationDict.set('Subtype', _primitives.Name.get('Text'));
435
- var replyRef = new _primitives.Ref(820, 0);
436
- var replyDict = new _primitives.Dict();
437
- replyDict.set('Type', _primitives.Name.get('Annot'));
438
- replyDict.set('Subtype', _primitives.Name.get('Text'));
439
- replyDict.set('IRT', annotationRef);
440
- var xref = new _test_utils.XRefMock([{
420
+ it("should parse IRT and set default RT when not defined.", function (done) {
421
+ const annotationRef = _primitives.Ref.get(819, 0);
422
+
423
+ const annotationDict = new _primitives.Dict();
424
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
425
+ annotationDict.set("Subtype", _primitives.Name.get("Text"));
426
+
427
+ const replyRef = _primitives.Ref.get(820, 0);
428
+
429
+ const replyDict = new _primitives.Dict();
430
+ replyDict.set("Type", _primitives.Name.get("Annot"));
431
+ replyDict.set("Subtype", _primitives.Name.get("Text"));
432
+ replyDict.set("IRT", annotationRef);
433
+ const xref = new _test_utils.XRefMock([{
441
434
  ref: annotationRef,
442
435
  data: annotationDict
443
436
  }, {
@@ -447,41 +440,47 @@ describe('annotation', function () {
447
440
  annotationDict.assignXref(xref);
448
441
  replyDict.assignXref(xref);
449
442
 
450
- _annotation.AnnotationFactory.create(xref, replyRef, pdfManagerMock, idFactoryMock).then(function (_ref6) {
451
- var data = _ref6.data;
443
+ _annotation.AnnotationFactory.create(xref, replyRef, pdfManagerMock, idFactoryMock).then(({
444
+ data
445
+ }) => {
452
446
  expect(data.inReplyTo).toEqual(annotationRef.toString());
453
- expect(data.replyType).toEqual('R');
447
+ expect(data.replyType).toEqual("R");
454
448
  done();
455
449
  }, done.fail);
456
450
  });
457
- it('should parse IRT/RT for a group type', function (done) {
458
- var annotationRef = new _primitives.Ref(819, 0);
459
- var annotationDict = new _primitives.Dict();
460
- annotationDict.set('Type', _primitives.Name.get('Annot'));
461
- annotationDict.set('Subtype', _primitives.Name.get('Text'));
462
- annotationDict.set('T', 'ParentTitle');
463
- annotationDict.set('Contents', 'ParentText');
464
- annotationDict.set('CreationDate', 'D:20180423');
465
- annotationDict.set('M', 'D:20190423');
466
- annotationDict.set('C', [0, 0, 1]);
467
- var popupRef = new _primitives.Ref(820, 0);
468
- var popupDict = new _primitives.Dict();
469
- popupDict.set('Type', _primitives.Name.get('Annot'));
470
- popupDict.set('Subtype', _primitives.Name.get('Popup'));
471
- popupDict.set('Parent', annotationRef);
472
- annotationDict.set('Popup', popupRef);
473
- var replyRef = new _primitives.Ref(821, 0);
474
- var replyDict = new _primitives.Dict();
475
- replyDict.set('Type', _primitives.Name.get('Annot'));
476
- replyDict.set('Subtype', _primitives.Name.get('Text'));
477
- replyDict.set('IRT', annotationRef);
478
- replyDict.set('RT', _primitives.Name.get('Group'));
479
- replyDict.set('T', 'ReplyTitle');
480
- replyDict.set('Contents', 'ReplyText');
481
- replyDict.set('CreationDate', 'D:20180523');
482
- replyDict.set('M', 'D:20190523');
483
- replyDict.set('C', [0.4]);
484
- var xref = new _test_utils.XRefMock([{
451
+ it("should parse IRT/RT for a group type", function (done) {
452
+ const annotationRef = _primitives.Ref.get(819, 0);
453
+
454
+ const annotationDict = new _primitives.Dict();
455
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
456
+ annotationDict.set("Subtype", _primitives.Name.get("Text"));
457
+ annotationDict.set("T", "ParentTitle");
458
+ annotationDict.set("Contents", "ParentText");
459
+ annotationDict.set("CreationDate", "D:20180423");
460
+ annotationDict.set("M", "D:20190423");
461
+ annotationDict.set("C", [0, 0, 1]);
462
+
463
+ const popupRef = _primitives.Ref.get(820, 0);
464
+
465
+ const popupDict = new _primitives.Dict();
466
+ popupDict.set("Type", _primitives.Name.get("Annot"));
467
+ popupDict.set("Subtype", _primitives.Name.get("Popup"));
468
+ popupDict.set("Parent", annotationRef);
469
+ annotationDict.set("Popup", popupRef);
470
+
471
+ const replyRef = _primitives.Ref.get(821, 0);
472
+
473
+ const replyDict = new _primitives.Dict();
474
+ replyDict.set("Type", _primitives.Name.get("Annot"));
475
+ replyDict.set("Subtype", _primitives.Name.get("Text"));
476
+ replyDict.set("IRT", annotationRef);
477
+ replyDict.set("RT", _primitives.Name.get("Group"));
478
+ replyDict.set("T", "ReplyTitle");
479
+ replyDict.set("Contents", "ReplyText");
480
+ replyDict.set("CreationDate", "D:20180523");
481
+ replyDict.set("M", "D:20190523");
482
+ replyDict.set("C", [0.4]);
483
+ const xref = new _test_utils.XRefMock([{
485
484
  ref: annotationRef,
486
485
  data: annotationDict
487
486
  }, {
@@ -495,47 +494,53 @@ describe('annotation', function () {
495
494
  popupDict.assignXref(xref);
496
495
  replyDict.assignXref(xref);
497
496
 
498
- _annotation.AnnotationFactory.create(xref, replyRef, pdfManagerMock, idFactoryMock).then(function (_ref7) {
499
- var data = _ref7.data;
497
+ _annotation.AnnotationFactory.create(xref, replyRef, pdfManagerMock, idFactoryMock).then(({
498
+ data
499
+ }) => {
500
500
  expect(data.inReplyTo).toEqual(annotationRef.toString());
501
- expect(data.replyType).toEqual('Group');
502
- expect(data.title).toEqual('ParentTitle');
503
- expect(data.contents).toEqual('ParentText');
504
- expect(data.creationDate).toEqual('D:20180423');
505
- expect(data.modificationDate).toEqual('D:20190423');
501
+ expect(data.replyType).toEqual("Group");
502
+ expect(data.title).toEqual("ParentTitle");
503
+ expect(data.contents).toEqual("ParentText");
504
+ expect(data.creationDate).toEqual("D:20180423");
505
+ expect(data.modificationDate).toEqual("D:20190423");
506
506
  expect(data.color).toEqual(new Uint8ClampedArray([0, 0, 255]));
507
507
  expect(data.hasPopup).toEqual(true);
508
508
  done();
509
509
  }, done.fail);
510
510
  });
511
- it('should parse IRT/RT for a reply type', function (done) {
512
- var annotationRef = new _primitives.Ref(819, 0);
513
- var annotationDict = new _primitives.Dict();
514
- annotationDict.set('Type', _primitives.Name.get('Annot'));
515
- annotationDict.set('Subtype', _primitives.Name.get('Text'));
516
- annotationDict.set('T', 'ParentTitle');
517
- annotationDict.set('Contents', 'ParentText');
518
- annotationDict.set('CreationDate', 'D:20180423');
519
- annotationDict.set('M', 'D:20190423');
520
- annotationDict.set('C', [0, 0, 1]);
521
- var popupRef = new _primitives.Ref(820, 0);
522
- var popupDict = new _primitives.Dict();
523
- popupDict.set('Type', _primitives.Name.get('Annot'));
524
- popupDict.set('Subtype', _primitives.Name.get('Popup'));
525
- popupDict.set('Parent', annotationRef);
526
- annotationDict.set('Popup', popupRef);
527
- var replyRef = new _primitives.Ref(821, 0);
528
- var replyDict = new _primitives.Dict();
529
- replyDict.set('Type', _primitives.Name.get('Annot'));
530
- replyDict.set('Subtype', _primitives.Name.get('Text'));
531
- replyDict.set('IRT', annotationRef);
532
- replyDict.set('RT', _primitives.Name.get('R'));
533
- replyDict.set('T', 'ReplyTitle');
534
- replyDict.set('Contents', 'ReplyText');
535
- replyDict.set('CreationDate', 'D:20180523');
536
- replyDict.set('M', 'D:20190523');
537
- replyDict.set('C', [0.4]);
538
- var xref = new _test_utils.XRefMock([{
511
+ it("should parse IRT/RT for a reply type", function (done) {
512
+ const annotationRef = _primitives.Ref.get(819, 0);
513
+
514
+ const annotationDict = new _primitives.Dict();
515
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
516
+ annotationDict.set("Subtype", _primitives.Name.get("Text"));
517
+ annotationDict.set("T", "ParentTitle");
518
+ annotationDict.set("Contents", "ParentText");
519
+ annotationDict.set("CreationDate", "D:20180423");
520
+ annotationDict.set("M", "D:20190423");
521
+ annotationDict.set("C", [0, 0, 1]);
522
+
523
+ const popupRef = _primitives.Ref.get(820, 0);
524
+
525
+ const popupDict = new _primitives.Dict();
526
+ popupDict.set("Type", _primitives.Name.get("Annot"));
527
+ popupDict.set("Subtype", _primitives.Name.get("Popup"));
528
+ popupDict.set("Parent", annotationRef);
529
+ annotationDict.set("Popup", popupRef);
530
+
531
+ const replyRef = _primitives.Ref.get(821, 0);
532
+
533
+ const replyDict = new _primitives.Dict();
534
+ replyDict.set("Type", _primitives.Name.get("Annot"));
535
+ replyDict.set("Subtype", _primitives.Name.get("Text"));
536
+ replyDict.set("IRT", annotationRef);
537
+ replyDict.set("RT", _primitives.Name.get("R"));
538
+ replyDict.set("T", "ReplyTitle");
539
+ replyDict.set("Contents", "ReplyText");
540
+ replyDict.set("CreationDate", "D:20180523");
541
+ replyDict.set("M", "D:20190523");
542
+ replyDict.set("C", [0.4]);
543
+ const xref = new _test_utils.XRefMock([{
539
544
  ref: annotationRef,
540
545
  data: annotationDict
541
546
  }, {
@@ -549,35 +554,39 @@ describe('annotation', function () {
549
554
  popupDict.assignXref(xref);
550
555
  replyDict.assignXref(xref);
551
556
 
552
- _annotation.AnnotationFactory.create(xref, replyRef, pdfManagerMock, idFactoryMock).then(function (_ref8) {
553
- var data = _ref8.data;
557
+ _annotation.AnnotationFactory.create(xref, replyRef, pdfManagerMock, idFactoryMock).then(({
558
+ data
559
+ }) => {
554
560
  expect(data.inReplyTo).toEqual(annotationRef.toString());
555
- expect(data.replyType).toEqual('R');
556
- expect(data.title).toEqual('ReplyTitle');
557
- expect(data.contents).toEqual('ReplyText');
558
- expect(data.creationDate).toEqual('D:20180523');
559
- expect(data.modificationDate).toEqual('D:20190523');
561
+ expect(data.replyType).toEqual("R");
562
+ expect(data.title).toEqual("ReplyTitle");
563
+ expect(data.contents).toEqual("ReplyText");
564
+ expect(data.creationDate).toEqual("D:20180523");
565
+ expect(data.modificationDate).toEqual("D:20190523");
560
566
  expect(data.color).toEqual(new Uint8ClampedArray([102, 102, 102]));
561
567
  expect(data.hasPopup).toEqual(false);
562
568
  done();
563
569
  }, done.fail);
564
570
  });
565
571
  });
566
- describe('TextAnnotation', function () {
567
- it('should not parse state model and state when not defined', function (done) {
568
- var annotationRef = new _primitives.Ref(819, 0);
569
- var annotationDict = new _primitives.Dict();
570
- annotationDict.set('Type', _primitives.Name.get('Annot'));
571
- annotationDict.set('Subtype', _primitives.Name.get('Text'));
572
- annotationDict.set('Contents', 'TestText');
573
- var replyRef = new _primitives.Ref(820, 0);
574
- var replyDict = new _primitives.Dict();
575
- replyDict.set('Type', _primitives.Name.get('Annot'));
576
- replyDict.set('Subtype', _primitives.Name.get('Text'));
577
- replyDict.set('IRT', annotationRef);
578
- replyDict.set('RT', _primitives.Name.get('R'));
579
- replyDict.set('Contents', 'ReplyText');
580
- var xref = new _test_utils.XRefMock([{
572
+ describe("TextAnnotation", function () {
573
+ it("should not parse state model and state when not defined", function (done) {
574
+ const annotationRef = _primitives.Ref.get(819, 0);
575
+
576
+ const annotationDict = new _primitives.Dict();
577
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
578
+ annotationDict.set("Subtype", _primitives.Name.get("Text"));
579
+ annotationDict.set("Contents", "TestText");
580
+
581
+ const replyRef = _primitives.Ref.get(820, 0);
582
+
583
+ const replyDict = new _primitives.Dict();
584
+ replyDict.set("Type", _primitives.Name.get("Annot"));
585
+ replyDict.set("Subtype", _primitives.Name.get("Text"));
586
+ replyDict.set("IRT", annotationRef);
587
+ replyDict.set("RT", _primitives.Name.get("R"));
588
+ replyDict.set("Contents", "ReplyText");
589
+ const xref = new _test_utils.XRefMock([{
581
590
  ref: annotationRef,
582
591
  data: annotationDict
583
592
  }, {
@@ -587,27 +596,31 @@ describe('annotation', function () {
587
596
  annotationDict.assignXref(xref);
588
597
  replyDict.assignXref(xref);
589
598
 
590
- _annotation.AnnotationFactory.create(xref, replyRef, pdfManagerMock, idFactoryMock).then(function (_ref9) {
591
- var data = _ref9.data;
599
+ _annotation.AnnotationFactory.create(xref, replyRef, pdfManagerMock, idFactoryMock).then(({
600
+ data
601
+ }) => {
592
602
  expect(data.stateModel).toBeNull();
593
603
  expect(data.state).toBeNull();
594
604
  done();
595
605
  }, done.fail);
596
606
  });
597
- it('should correctly parse state model and state when defined', function (done) {
598
- var annotationRef = new _primitives.Ref(819, 0);
599
- var annotationDict = new _primitives.Dict();
600
- annotationDict.set('Type', _primitives.Name.get('Annot'));
601
- annotationDict.set('Subtype', _primitives.Name.get('Text'));
602
- var replyRef = new _primitives.Ref(820, 0);
603
- var replyDict = new _primitives.Dict();
604
- replyDict.set('Type', _primitives.Name.get('Annot'));
605
- replyDict.set('Subtype', _primitives.Name.get('Text'));
606
- replyDict.set('IRT', annotationRef);
607
- replyDict.set('RT', _primitives.Name.get('R'));
608
- replyDict.set('StateModel', 'Review');
609
- replyDict.set('State', 'Rejected');
610
- var xref = new _test_utils.XRefMock([{
607
+ it("should correctly parse state model and state when defined", function (done) {
608
+ const annotationRef = _primitives.Ref.get(819, 0);
609
+
610
+ const annotationDict = new _primitives.Dict();
611
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
612
+ annotationDict.set("Subtype", _primitives.Name.get("Text"));
613
+
614
+ const replyRef = _primitives.Ref.get(820, 0);
615
+
616
+ const replyDict = new _primitives.Dict();
617
+ replyDict.set("Type", _primitives.Name.get("Annot"));
618
+ replyDict.set("Subtype", _primitives.Name.get("Text"));
619
+ replyDict.set("IRT", annotationRef);
620
+ replyDict.set("RT", _primitives.Name.get("R"));
621
+ replyDict.set("StateModel", "Review");
622
+ replyDict.set("State", "Rejected");
623
+ const xref = new _test_utils.XRefMock([{
611
624
  ref: annotationRef,
612
625
  data: annotationDict
613
626
  }, {
@@ -617,294 +630,305 @@ describe('annotation', function () {
617
630
  annotationDict.assignXref(xref);
618
631
  replyDict.assignXref(xref);
619
632
 
620
- _annotation.AnnotationFactory.create(xref, replyRef, pdfManagerMock, idFactoryMock).then(function (_ref10) {
621
- var data = _ref10.data;
622
- expect(data.stateModel).toEqual('Review');
623
- expect(data.state).toEqual('Rejected');
633
+ _annotation.AnnotationFactory.create(xref, replyRef, pdfManagerMock, idFactoryMock).then(({
634
+ data
635
+ }) => {
636
+ expect(data.stateModel).toEqual("Review");
637
+ expect(data.state).toEqual("Rejected");
624
638
  done();
625
639
  }, done.fail);
626
640
  });
627
641
  });
628
- describe('LinkAnnotation', function () {
629
- it('should correctly parse a URI action', function (done) {
630
- var actionDict = new _primitives.Dict();
631
- actionDict.set('Type', _primitives.Name.get('Action'));
632
- actionDict.set('S', _primitives.Name.get('URI'));
633
- actionDict.set('URI', 'http://www.ctan.org/tex-archive/info/lshort');
634
- var annotationDict = new _primitives.Dict();
635
- annotationDict.set('Type', _primitives.Name.get('Annot'));
636
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
637
- annotationDict.set('A', actionDict);
638
-
639
- var annotationRef = _primitives.Ref.get(820, 0);
640
-
641
- var xref = new _test_utils.XRefMock([{
642
+ describe("LinkAnnotation", function () {
643
+ it("should correctly parse a URI action", function (done) {
644
+ const actionDict = new _primitives.Dict();
645
+ actionDict.set("Type", _primitives.Name.get("Action"));
646
+ actionDict.set("S", _primitives.Name.get("URI"));
647
+ actionDict.set("URI", "http://www.ctan.org/tex-archive/info/lshort");
648
+ const annotationDict = new _primitives.Dict();
649
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
650
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
651
+ annotationDict.set("A", actionDict);
652
+
653
+ const annotationRef = _primitives.Ref.get(820, 0);
654
+
655
+ const xref = new _test_utils.XRefMock([{
642
656
  ref: annotationRef,
643
657
  data: annotationDict
644
658
  }]);
645
659
 
646
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref11) {
647
- var data = _ref11.data;
660
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
661
+ data
662
+ }) => {
648
663
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
649
- expect(data.url).toEqual('http://www.ctan.org/tex-archive/info/lshort');
650
- expect(data.unsafeUrl).toEqual('http://www.ctan.org/tex-archive/info/lshort');
664
+ expect(data.url).toEqual("http://www.ctan.org/tex-archive/info/lshort");
665
+ expect(data.unsafeUrl).toEqual("http://www.ctan.org/tex-archive/info/lshort");
651
666
  expect(data.dest).toBeUndefined();
652
667
  done();
653
668
  }, done.fail);
654
669
  });
655
- it('should correctly parse a URI action, where the URI entry ' + 'is missing a protocol', function (done) {
656
- var actionDict = new _primitives.Dict();
657
- actionDict.set('Type', _primitives.Name.get('Action'));
658
- actionDict.set('S', _primitives.Name.get('URI'));
659
- actionDict.set('URI', 'www.hmrc.gov.uk');
660
- var annotationDict = new _primitives.Dict();
661
- annotationDict.set('Type', _primitives.Name.get('Annot'));
662
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
663
- annotationDict.set('A', actionDict);
670
+ it("should correctly parse a URI action, where the URI entry " + "is missing a protocol", function (done) {
671
+ const actionDict = new _primitives.Dict();
672
+ actionDict.set("Type", _primitives.Name.get("Action"));
673
+ actionDict.set("S", _primitives.Name.get("URI"));
674
+ actionDict.set("URI", "www.hmrc.gov.uk");
675
+ const annotationDict = new _primitives.Dict();
676
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
677
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
678
+ annotationDict.set("A", actionDict);
664
679
 
665
- var annotationRef = _primitives.Ref.get(353, 0);
680
+ const annotationRef = _primitives.Ref.get(353, 0);
666
681
 
667
- var xref = new _test_utils.XRefMock([{
682
+ const xref = new _test_utils.XRefMock([{
668
683
  ref: annotationRef,
669
684
  data: annotationDict
670
685
  }]);
671
686
 
672
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref12) {
673
- var data = _ref12.data;
687
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
688
+ data
689
+ }) => {
674
690
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
675
- expect(data.url).toEqual('http://www.hmrc.gov.uk/');
676
- expect(data.unsafeUrl).toEqual('http://www.hmrc.gov.uk');
691
+ expect(data.url).toEqual("http://www.hmrc.gov.uk/");
692
+ expect(data.unsafeUrl).toEqual("http://www.hmrc.gov.uk");
677
693
  expect(data.dest).toBeUndefined();
678
694
  done();
679
695
  }, done.fail);
680
696
  });
681
- it('should correctly parse a URI action, where the URI entry ' + 'has an incorrect encoding (bug 1122280)', function (done) {
682
- var actionStream = new _stream.StringStream('<<\n' + '/Type /Action\n' + '/S /URI\n' + '/URI (http://www.example.com/\\303\\274\\303\\266\\303\\244)\n' + '>>\n');
683
- var parser = new _parser.Parser({
697
+ it("should correctly parse a URI action, where the URI entry " + "has an incorrect encoding (bug 1122280)", function (done) {
698
+ const actionStream = new _stream.StringStream("<<\n" + "/Type /Action\n" + "/S /URI\n" + "/URI (http://www.example.com/\\303\\274\\303\\266\\303\\244)\n" + ">>\n");
699
+ const parser = new _parser.Parser({
684
700
  lexer: new _parser.Lexer(actionStream),
685
701
  xref: null
686
702
  });
687
- var actionDict = parser.getObj();
688
- var annotationDict = new _primitives.Dict();
689
- annotationDict.set('Type', _primitives.Name.get('Annot'));
690
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
691
- annotationDict.set('A', actionDict);
703
+ const actionDict = parser.getObj();
704
+ const annotationDict = new _primitives.Dict();
705
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
706
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
707
+ annotationDict.set("A", actionDict);
692
708
 
693
- var annotationRef = _primitives.Ref.get(8, 0);
709
+ const annotationRef = _primitives.Ref.get(8, 0);
694
710
 
695
- var xref = new _test_utils.XRefMock([{
711
+ const xref = new _test_utils.XRefMock([{
696
712
  ref: annotationRef,
697
713
  data: annotationDict
698
714
  }]);
699
715
 
700
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref13) {
701
- var data = _ref13.data;
716
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
717
+ data
718
+ }) => {
702
719
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
703
- expect(data.url).toEqual(new URL((0, _util.stringToUTF8String)('http://www.example.com/\xC3\xBC\xC3\xB6\xC3\xA4')).href);
704
- expect(data.unsafeUrl).toEqual((0, _util.stringToUTF8String)('http://www.example.com/\xC3\xBC\xC3\xB6\xC3\xA4'));
720
+ expect(data.url).toEqual(new URL((0, _util.stringToUTF8String)("http://www.example.com/\xC3\xBC\xC3\xB6\xC3\xA4")).href);
721
+ expect(data.unsafeUrl).toEqual((0, _util.stringToUTF8String)("http://www.example.com/\xC3\xBC\xC3\xB6\xC3\xA4"));
705
722
  expect(data.dest).toBeUndefined();
706
723
  done();
707
724
  }, done.fail);
708
725
  });
709
- it('should correctly parse a GoTo action', function (done) {
710
- var actionDict = new _primitives.Dict();
711
- actionDict.set('Type', _primitives.Name.get('Action'));
712
- actionDict.set('S', _primitives.Name.get('GoTo'));
713
- actionDict.set('D', 'page.157');
714
- var annotationDict = new _primitives.Dict();
715
- annotationDict.set('Type', _primitives.Name.get('Annot'));
716
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
717
- annotationDict.set('A', actionDict);
726
+ it("should correctly parse a GoTo action", function (done) {
727
+ const actionDict = new _primitives.Dict();
728
+ actionDict.set("Type", _primitives.Name.get("Action"));
729
+ actionDict.set("S", _primitives.Name.get("GoTo"));
730
+ actionDict.set("D", "page.157");
731
+ const annotationDict = new _primitives.Dict();
732
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
733
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
734
+ annotationDict.set("A", actionDict);
718
735
 
719
- var annotationRef = _primitives.Ref.get(798, 0);
736
+ const annotationRef = _primitives.Ref.get(798, 0);
720
737
 
721
- var xref = new _test_utils.XRefMock([{
738
+ const xref = new _test_utils.XRefMock([{
722
739
  ref: annotationRef,
723
740
  data: annotationDict
724
741
  }]);
725
742
 
726
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref14) {
727
- var data = _ref14.data;
743
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
744
+ data
745
+ }) => {
728
746
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
729
747
  expect(data.url).toBeUndefined();
730
748
  expect(data.unsafeUrl).toBeUndefined();
731
- expect(data.dest).toEqual('page.157');
749
+ expect(data.dest).toEqual("page.157");
732
750
  done();
733
751
  }, done.fail);
734
752
  });
735
- it('should correctly parse a GoToR action, where the FileSpec entry ' + 'is a string containing a relative URL', function (done) {
736
- var actionDict = new _primitives.Dict();
737
- actionDict.set('Type', _primitives.Name.get('Action'));
738
- actionDict.set('S', _primitives.Name.get('GoToR'));
739
- actionDict.set('F', '../../0013/001346/134685E.pdf');
740
- actionDict.set('D', '4.3');
741
- actionDict.set('NewWindow', true);
742
- var annotationDict = new _primitives.Dict();
743
- annotationDict.set('Type', _primitives.Name.get('Annot'));
744
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
745
- annotationDict.set('A', actionDict);
746
-
747
- var annotationRef = _primitives.Ref.get(489, 0);
748
-
749
- var xref = new _test_utils.XRefMock([{
753
+ it("should correctly parse a GoToR action, where the FileSpec entry " + "is a string containing a relative URL", function (done) {
754
+ const actionDict = new _primitives.Dict();
755
+ actionDict.set("Type", _primitives.Name.get("Action"));
756
+ actionDict.set("S", _primitives.Name.get("GoToR"));
757
+ actionDict.set("F", "../../0013/001346/134685E.pdf");
758
+ actionDict.set("D", "4.3");
759
+ actionDict.set("NewWindow", true);
760
+ const annotationDict = new _primitives.Dict();
761
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
762
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
763
+ annotationDict.set("A", actionDict);
764
+
765
+ const annotationRef = _primitives.Ref.get(489, 0);
766
+
767
+ const xref = new _test_utils.XRefMock([{
750
768
  ref: annotationRef,
751
769
  data: annotationDict
752
770
  }]);
753
771
 
754
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref15) {
755
- var data = _ref15.data;
772
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
773
+ data
774
+ }) => {
756
775
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
757
776
  expect(data.url).toBeUndefined();
758
- expect(data.unsafeUrl).toEqual('../../0013/001346/134685E.pdf#4.3');
777
+ expect(data.unsafeUrl).toEqual("../../0013/001346/134685E.pdf#4.3");
759
778
  expect(data.dest).toBeUndefined();
760
779
  expect(data.newWindow).toEqual(true);
761
780
  done();
762
781
  }, done.fail);
763
782
  });
764
- it('should correctly parse a GoToR action, containing a relative URL, ' + 'with the "docBaseUrl" parameter specified', function (done) {
765
- var actionDict = new _primitives.Dict();
766
- actionDict.set('Type', _primitives.Name.get('Action'));
767
- actionDict.set('S', _primitives.Name.get('GoToR'));
768
- actionDict.set('F', '../../0013/001346/134685E.pdf');
769
- actionDict.set('D', '4.3');
770
- var annotationDict = new _primitives.Dict();
771
- annotationDict.set('Type', _primitives.Name.get('Annot'));
772
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
773
- annotationDict.set('A', actionDict);
783
+ it("should correctly parse a GoToR action, containing a relative URL, " + 'with the "docBaseUrl" parameter specified', function (done) {
784
+ const actionDict = new _primitives.Dict();
785
+ actionDict.set("Type", _primitives.Name.get("Action"));
786
+ actionDict.set("S", _primitives.Name.get("GoToR"));
787
+ actionDict.set("F", "../../0013/001346/134685E.pdf");
788
+ actionDict.set("D", "4.3");
789
+ const annotationDict = new _primitives.Dict();
790
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
791
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
792
+ annotationDict.set("A", actionDict);
774
793
 
775
- var annotationRef = _primitives.Ref.get(489, 0);
794
+ const annotationRef = _primitives.Ref.get(489, 0);
776
795
 
777
- var xref = new _test_utils.XRefMock([{
796
+ const xref = new _test_utils.XRefMock([{
778
797
  ref: annotationRef,
779
798
  data: annotationDict
780
799
  }]);
781
- var pdfManager = new PDFManagerMock({
782
- docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf'
800
+ const pdfManager = new PDFManagerMock({
801
+ docBaseUrl: "http://www.example.com/test/pdfs/qwerty.pdf"
783
802
  });
784
803
 
785
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManager, idFactoryMock).then(function (_ref16) {
786
- var data = _ref16.data;
804
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManager, idFactoryMock).then(({
805
+ data
806
+ }) => {
787
807
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
788
- expect(data.url).toEqual('http://www.example.com/0013/001346/134685E.pdf#4.3');
789
- expect(data.unsafeUrl).toEqual('../../0013/001346/134685E.pdf#4.3');
808
+ expect(data.url).toEqual("http://www.example.com/0013/001346/134685E.pdf#4.3");
809
+ expect(data.unsafeUrl).toEqual("../../0013/001346/134685E.pdf#4.3");
790
810
  expect(data.dest).toBeUndefined();
791
811
  done();
792
812
  }, done.fail);
793
813
  });
794
- it('should correctly parse a GoToR action, with named destination', function (done) {
795
- var actionDict = new _primitives.Dict();
796
- actionDict.set('Type', _primitives.Name.get('Action'));
797
- actionDict.set('S', _primitives.Name.get('GoToR'));
798
- actionDict.set('F', 'http://www.example.com/test.pdf');
799
- actionDict.set('D', '15');
800
- var annotationDict = new _primitives.Dict();
801
- annotationDict.set('Type', _primitives.Name.get('Annot'));
802
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
803
- annotationDict.set('A', actionDict);
814
+ it("should correctly parse a GoToR action, with named destination", function (done) {
815
+ const actionDict = new _primitives.Dict();
816
+ actionDict.set("Type", _primitives.Name.get("Action"));
817
+ actionDict.set("S", _primitives.Name.get("GoToR"));
818
+ actionDict.set("F", "http://www.example.com/test.pdf");
819
+ actionDict.set("D", "15");
820
+ const annotationDict = new _primitives.Dict();
821
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
822
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
823
+ annotationDict.set("A", actionDict);
804
824
 
805
- var annotationRef = _primitives.Ref.get(495, 0);
825
+ const annotationRef = _primitives.Ref.get(495, 0);
806
826
 
807
- var xref = new _test_utils.XRefMock([{
827
+ const xref = new _test_utils.XRefMock([{
808
828
  ref: annotationRef,
809
829
  data: annotationDict
810
830
  }]);
811
831
 
812
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref17) {
813
- var data = _ref17.data;
832
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
833
+ data
834
+ }) => {
814
835
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
815
- expect(data.url).toEqual('http://www.example.com/test.pdf#15');
816
- expect(data.unsafeUrl).toEqual('http://www.example.com/test.pdf#15');
836
+ expect(data.url).toEqual("http://www.example.com/test.pdf#15");
837
+ expect(data.unsafeUrl).toEqual("http://www.example.com/test.pdf#15");
817
838
  expect(data.dest).toBeUndefined();
818
839
  expect(data.newWindow).toBeFalsy();
819
840
  done();
820
841
  }, done.fail);
821
842
  });
822
- it('should correctly parse a GoToR action, with explicit destination array', function (done) {
823
- var actionDict = new _primitives.Dict();
824
- actionDict.set('Type', _primitives.Name.get('Action'));
825
- actionDict.set('S', _primitives.Name.get('GoToR'));
826
- actionDict.set('F', 'http://www.example.com/test.pdf');
827
- actionDict.set('D', [14, _primitives.Name.get('XYZ'), null, 298.043, null]);
828
- var annotationDict = new _primitives.Dict();
829
- annotationDict.set('Type', _primitives.Name.get('Annot'));
830
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
831
- annotationDict.set('A', actionDict);
843
+ it("should correctly parse a GoToR action, with explicit destination array", function (done) {
844
+ const actionDict = new _primitives.Dict();
845
+ actionDict.set("Type", _primitives.Name.get("Action"));
846
+ actionDict.set("S", _primitives.Name.get("GoToR"));
847
+ actionDict.set("F", "http://www.example.com/test.pdf");
848
+ actionDict.set("D", [14, _primitives.Name.get("XYZ"), null, 298.043, null]);
849
+ const annotationDict = new _primitives.Dict();
850
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
851
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
852
+ annotationDict.set("A", actionDict);
832
853
 
833
- var annotationRef = _primitives.Ref.get(489, 0);
854
+ const annotationRef = _primitives.Ref.get(489, 0);
834
855
 
835
- var xref = new _test_utils.XRefMock([{
856
+ const xref = new _test_utils.XRefMock([{
836
857
  ref: annotationRef,
837
858
  data: annotationDict
838
859
  }]);
839
860
 
840
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref18) {
841
- var data = _ref18.data;
861
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
862
+ data
863
+ }) => {
842
864
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
843
- expect(data.url).toEqual(new URL('http://www.example.com/test.pdf#' + '[14,{"name":"XYZ"},null,298.043,null]').href);
844
- expect(data.unsafeUrl).toEqual('http://www.example.com/test.pdf#' + '[14,{"name":"XYZ"},null,298.043,null]');
865
+ expect(data.url).toEqual(new URL("http://www.example.com/test.pdf#" + '[14,{"name":"XYZ"},null,298.043,null]').href);
866
+ expect(data.unsafeUrl).toEqual("http://www.example.com/test.pdf#" + '[14,{"name":"XYZ"},null,298.043,null]');
845
867
  expect(data.dest).toBeUndefined();
846
868
  expect(data.newWindow).toBeFalsy();
847
869
  done();
848
870
  }, done.fail);
849
871
  });
850
- it('should correctly parse a Launch action, where the FileSpec dict ' + 'contains a relative URL, with the "docBaseUrl" parameter specified', function (done) {
851
- var fileSpecDict = new _primitives.Dict();
852
- fileSpecDict.set('Type', _primitives.Name.get('FileSpec'));
853
- fileSpecDict.set('F', 'Part II/Part II.pdf');
854
- fileSpecDict.set('UF', 'Part II/Part II.pdf');
855
- var actionDict = new _primitives.Dict();
856
- actionDict.set('Type', _primitives.Name.get('Action'));
857
- actionDict.set('S', _primitives.Name.get('Launch'));
858
- actionDict.set('F', fileSpecDict);
859
- actionDict.set('NewWindow', true);
860
- var annotationDict = new _primitives.Dict();
861
- annotationDict.set('Type', _primitives.Name.get('Annot'));
862
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
863
- annotationDict.set('A', actionDict);
864
-
865
- var annotationRef = _primitives.Ref.get(88, 0);
866
-
867
- var xref = new _test_utils.XRefMock([{
872
+ it("should correctly parse a Launch action, where the FileSpec dict " + 'contains a relative URL, with the "docBaseUrl" parameter specified', function (done) {
873
+ const fileSpecDict = new _primitives.Dict();
874
+ fileSpecDict.set("Type", _primitives.Name.get("FileSpec"));
875
+ fileSpecDict.set("F", "Part II/Part II.pdf");
876
+ fileSpecDict.set("UF", "Part II/Part II.pdf");
877
+ const actionDict = new _primitives.Dict();
878
+ actionDict.set("Type", _primitives.Name.get("Action"));
879
+ actionDict.set("S", _primitives.Name.get("Launch"));
880
+ actionDict.set("F", fileSpecDict);
881
+ actionDict.set("NewWindow", true);
882
+ const annotationDict = new _primitives.Dict();
883
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
884
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
885
+ annotationDict.set("A", actionDict);
886
+
887
+ const annotationRef = _primitives.Ref.get(88, 0);
888
+
889
+ const xref = new _test_utils.XRefMock([{
868
890
  ref: annotationRef,
869
891
  data: annotationDict
870
892
  }]);
871
- var pdfManager = new PDFManagerMock({
872
- docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf'
893
+ const pdfManager = new PDFManagerMock({
894
+ docBaseUrl: "http://www.example.com/test/pdfs/qwerty.pdf"
873
895
  });
874
896
 
875
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManager, idFactoryMock).then(function (_ref19) {
876
- var data = _ref19.data;
897
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManager, idFactoryMock).then(({
898
+ data
899
+ }) => {
877
900
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
878
- expect(data.url).toEqual(new URL('http://www.example.com/test/pdfs/Part II/Part II.pdf').href);
879
- expect(data.unsafeUrl).toEqual('Part II/Part II.pdf');
901
+ expect(data.url).toEqual(new URL("http://www.example.com/test/pdfs/Part II/Part II.pdf").href);
902
+ expect(data.unsafeUrl).toEqual("Part II/Part II.pdf");
880
903
  expect(data.dest).toBeUndefined();
881
904
  expect(data.newWindow).toEqual(true);
882
905
  done();
883
906
  }, done.fail);
884
907
  });
885
- it('should recover valid URLs from JavaScript actions having certain ' + 'white-listed formats', function (done) {
908
+ it("should recover valid URLs from JavaScript actions having certain " + "white-listed formats", function (done) {
886
909
  function checkJsAction(params) {
887
- var jsEntry = params.jsEntry;
888
- var expectedUrl = params.expectedUrl;
889
- var expectedUnsafeUrl = params.expectedUnsafeUrl;
890
- var expectedNewWindow = params.expectedNewWindow;
891
- var actionDict = new _primitives.Dict();
892
- actionDict.set('Type', _primitives.Name.get('Action'));
893
- actionDict.set('S', _primitives.Name.get('JavaScript'));
894
- actionDict.set('JS', jsEntry);
895
- var annotationDict = new _primitives.Dict();
896
- annotationDict.set('Type', _primitives.Name.get('Annot'));
897
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
898
- annotationDict.set('A', actionDict);
899
-
900
- var annotationRef = _primitives.Ref.get(46, 0);
901
-
902
- var xref = new _test_utils.XRefMock([{
910
+ const jsEntry = params.jsEntry;
911
+ const expectedUrl = params.expectedUrl;
912
+ const expectedUnsafeUrl = params.expectedUnsafeUrl;
913
+ const expectedNewWindow = params.expectedNewWindow;
914
+ const actionDict = new _primitives.Dict();
915
+ actionDict.set("Type", _primitives.Name.get("Action"));
916
+ actionDict.set("S", _primitives.Name.get("JavaScript"));
917
+ actionDict.set("JS", jsEntry);
918
+ const annotationDict = new _primitives.Dict();
919
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
920
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
921
+ annotationDict.set("A", actionDict);
922
+
923
+ const annotationRef = _primitives.Ref.get(46, 0);
924
+
925
+ const xref = new _test_utils.XRefMock([{
903
926
  ref: annotationRef,
904
927
  data: annotationDict
905
928
  }]);
906
- return _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref20) {
907
- var data = _ref20.data;
929
+ return _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
930
+ data
931
+ }) => {
908
932
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
909
933
  expect(data.url).toEqual(expectedUrl);
910
934
  expect(data.unsafeUrl).toEqual(expectedUnsafeUrl);
@@ -913,89 +937,92 @@ describe('annotation', function () {
913
937
  });
914
938
  }
915
939
 
916
- var annotation1 = checkJsAction({
940
+ const annotation1 = checkJsAction({
917
941
  jsEntry: 'function someFun() { return "qwerty"; } someFun();',
918
942
  expectedUrl: undefined,
919
943
  expectedUnsafeUrl: undefined,
920
944
  expectedNewWindow: undefined
921
945
  });
922
- var annotation2 = checkJsAction({
923
- jsEntry: 'window.open(\'http://www.example.com/test.pdf\')',
924
- expectedUrl: new URL('http://www.example.com/test.pdf').href,
925
- expectedUnsafeUrl: 'http://www.example.com/test.pdf',
946
+ const annotation2 = checkJsAction({
947
+ jsEntry: "window.open('http://www.example.com/test.pdf')",
948
+ expectedUrl: new URL("http://www.example.com/test.pdf").href,
949
+ expectedUnsafeUrl: "http://www.example.com/test.pdf",
926
950
  expectedNewWindow: undefined
927
951
  });
928
- var annotation3 = checkJsAction({
952
+ const annotation3 = checkJsAction({
929
953
  jsEntry: new _stream.StringStream('app.launchURL("http://www.example.com/test.pdf", true)'),
930
- expectedUrl: new URL('http://www.example.com/test.pdf').href,
931
- expectedUnsafeUrl: 'http://www.example.com/test.pdf',
954
+ expectedUrl: new URL("http://www.example.com/test.pdf").href,
955
+ expectedUnsafeUrl: "http://www.example.com/test.pdf",
932
956
  expectedNewWindow: true
933
957
  });
934
958
  Promise.all([annotation1, annotation2, annotation3]).then(done, done.fail);
935
959
  });
936
- it('should correctly parse a Named action', function (done) {
937
- var actionDict = new _primitives.Dict();
938
- actionDict.set('Type', _primitives.Name.get('Action'));
939
- actionDict.set('S', _primitives.Name.get('Named'));
940
- actionDict.set('N', _primitives.Name.get('GoToPage'));
941
- var annotationDict = new _primitives.Dict();
942
- annotationDict.set('Type', _primitives.Name.get('Annot'));
943
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
944
- annotationDict.set('A', actionDict);
960
+ it("should correctly parse a Named action", function (done) {
961
+ const actionDict = new _primitives.Dict();
962
+ actionDict.set("Type", _primitives.Name.get("Action"));
963
+ actionDict.set("S", _primitives.Name.get("Named"));
964
+ actionDict.set("N", _primitives.Name.get("GoToPage"));
965
+ const annotationDict = new _primitives.Dict();
966
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
967
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
968
+ annotationDict.set("A", actionDict);
945
969
 
946
- var annotationRef = _primitives.Ref.get(12, 0);
970
+ const annotationRef = _primitives.Ref.get(12, 0);
947
971
 
948
- var xref = new _test_utils.XRefMock([{
972
+ const xref = new _test_utils.XRefMock([{
949
973
  ref: annotationRef,
950
974
  data: annotationDict
951
975
  }]);
952
976
 
953
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref21) {
954
- var data = _ref21.data;
977
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
978
+ data
979
+ }) => {
955
980
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
956
981
  expect(data.url).toBeUndefined();
957
982
  expect(data.unsafeUrl).toBeUndefined();
958
- expect(data.action).toEqual('GoToPage');
983
+ expect(data.action).toEqual("GoToPage");
959
984
  done();
960
985
  }, done.fail);
961
986
  });
962
- it('should correctly parse a simple Dest', function (done) {
963
- var annotationDict = new _primitives.Dict();
964
- annotationDict.set('Type', _primitives.Name.get('Annot'));
965
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
966
- annotationDict.set('Dest', _primitives.Name.get('LI0'));
987
+ it("should correctly parse a simple Dest", function (done) {
988
+ const annotationDict = new _primitives.Dict();
989
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
990
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
991
+ annotationDict.set("Dest", _primitives.Name.get("LI0"));
967
992
 
968
- var annotationRef = _primitives.Ref.get(583, 0);
993
+ const annotationRef = _primitives.Ref.get(583, 0);
969
994
 
970
- var xref = new _test_utils.XRefMock([{
995
+ const xref = new _test_utils.XRefMock([{
971
996
  ref: annotationRef,
972
997
  data: annotationDict
973
998
  }]);
974
999
 
975
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref22) {
976
- var data = _ref22.data;
1000
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
1001
+ data
1002
+ }) => {
977
1003
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
978
1004
  expect(data.url).toBeUndefined();
979
1005
  expect(data.unsafeUrl).toBeUndefined();
980
- expect(data.dest).toEqual('LI0');
1006
+ expect(data.dest).toEqual("LI0");
981
1007
  done();
982
1008
  }, done.fail);
983
1009
  });
984
- it('should correctly parse a simple Dest, with explicit destination array', function (done) {
985
- var annotationDict = new _primitives.Dict();
986
- annotationDict.set('Type', _primitives.Name.get('Annot'));
987
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
988
- annotationDict.set('Dest', [_primitives.Ref.get(17, 0), _primitives.Name.get('XYZ'), 0, 841.89, null]);
1010
+ it("should correctly parse a simple Dest, with explicit destination array", function (done) {
1011
+ const annotationDict = new _primitives.Dict();
1012
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
1013
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
1014
+ annotationDict.set("Dest", [_primitives.Ref.get(17, 0), _primitives.Name.get("XYZ"), 0, 841.89, null]);
989
1015
 
990
- var annotationRef = _primitives.Ref.get(10, 0);
1016
+ const annotationRef = _primitives.Ref.get(10, 0);
991
1017
 
992
- var xref = new _test_utils.XRefMock([{
1018
+ const xref = new _test_utils.XRefMock([{
993
1019
  ref: annotationRef,
994
1020
  data: annotationDict
995
1021
  }]);
996
1022
 
997
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref23) {
998
- var data = _ref23.data;
1023
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
1024
+ data
1025
+ }) => {
999
1026
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
1000
1027
  expect(data.url).toBeUndefined();
1001
1028
  expect(data.unsafeUrl).toBeUndefined();
@@ -1003,72 +1030,75 @@ describe('annotation', function () {
1003
1030
  num: 17,
1004
1031
  gen: 0
1005
1032
  }, {
1006
- name: 'XYZ'
1033
+ name: "XYZ"
1007
1034
  }, 0, 841.89, null]);
1008
1035
  done();
1009
1036
  }, done.fail);
1010
1037
  });
1011
- it('should correctly parse a Dest, which violates the specification ' + 'by containing a dictionary', function (done) {
1012
- var destDict = new _primitives.Dict();
1013
- destDict.set('Type', _primitives.Name.get('Action'));
1014
- destDict.set('S', _primitives.Name.get('GoTo'));
1015
- destDict.set('D', 'page.157');
1016
- var annotationDict = new _primitives.Dict();
1017
- annotationDict.set('Type', _primitives.Name.get('Annot'));
1018
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
1019
- annotationDict.set('Dest', destDict);
1038
+ it("should correctly parse a Dest, which violates the specification " + "by containing a dictionary", function (done) {
1039
+ const destDict = new _primitives.Dict();
1040
+ destDict.set("Type", _primitives.Name.get("Action"));
1041
+ destDict.set("S", _primitives.Name.get("GoTo"));
1042
+ destDict.set("D", "page.157");
1043
+ const annotationDict = new _primitives.Dict();
1044
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
1045
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
1046
+ annotationDict.set("Dest", destDict);
1020
1047
 
1021
- var annotationRef = _primitives.Ref.get(798, 0);
1048
+ const annotationRef = _primitives.Ref.get(798, 0);
1022
1049
 
1023
- var xref = new _test_utils.XRefMock([{
1050
+ const xref = new _test_utils.XRefMock([{
1024
1051
  ref: annotationRef,
1025
1052
  data: annotationDict
1026
1053
  }]);
1027
1054
 
1028
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref24) {
1029
- var data = _ref24.data;
1055
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
1056
+ data
1057
+ }) => {
1030
1058
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
1031
1059
  expect(data.url).toBeUndefined();
1032
1060
  expect(data.unsafeUrl).toBeUndefined();
1033
- expect(data.dest).toEqual('page.157');
1061
+ expect(data.dest).toEqual("page.157");
1034
1062
  done();
1035
1063
  }, done.fail);
1036
1064
  });
1037
- it('should not set quadpoints if not defined', function (done) {
1038
- var annotationDict = new _primitives.Dict();
1039
- annotationDict.set('Type', _primitives.Name.get('Annot'));
1040
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
1065
+ it("should not set quadpoints if not defined", function (done) {
1066
+ const annotationDict = new _primitives.Dict();
1067
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
1068
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
1041
1069
 
1042
- var annotationRef = _primitives.Ref.get(121, 0);
1070
+ const annotationRef = _primitives.Ref.get(121, 0);
1043
1071
 
1044
- var xref = new _test_utils.XRefMock([{
1072
+ const xref = new _test_utils.XRefMock([{
1045
1073
  ref: annotationRef,
1046
1074
  data: annotationDict
1047
1075
  }]);
1048
1076
 
1049
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref25) {
1050
- var data = _ref25.data;
1077
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
1078
+ data
1079
+ }) => {
1051
1080
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
1052
1081
  expect(data.quadPoints).toBeUndefined();
1053
1082
  done();
1054
1083
  }, done.fail);
1055
1084
  });
1056
- it('should set quadpoints if defined', function (done) {
1057
- var annotationDict = new _primitives.Dict();
1058
- annotationDict.set('Type', _primitives.Name.get('Annot'));
1059
- annotationDict.set('Subtype', _primitives.Name.get('Link'));
1060
- annotationDict.set('Rect', [10, 10, 20, 20]);
1061
- annotationDict.set('QuadPoints', [11, 11, 12, 12, 13, 13, 14, 14]);
1085
+ it("should set quadpoints if defined", function (done) {
1086
+ const annotationDict = new _primitives.Dict();
1087
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
1088
+ annotationDict.set("Subtype", _primitives.Name.get("Link"));
1089
+ annotationDict.set("Rect", [10, 10, 20, 20]);
1090
+ annotationDict.set("QuadPoints", [11, 11, 12, 12, 13, 13, 14, 14]);
1062
1091
 
1063
- var annotationRef = _primitives.Ref.get(121, 0);
1092
+ const annotationRef = _primitives.Ref.get(121, 0);
1064
1093
 
1065
- var xref = new _test_utils.XRefMock([{
1094
+ const xref = new _test_utils.XRefMock([{
1066
1095
  ref: annotationRef,
1067
1096
  data: annotationDict
1068
1097
  }]);
1069
1098
 
1070
- _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref26) {
1071
- var data = _ref26.data;
1099
+ _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(({
1100
+ data
1101
+ }) => {
1072
1102
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
1073
1103
  expect(data.quadPoints).toEqual([[{
1074
1104
  x: 11,
@@ -1087,116 +1117,121 @@ describe('annotation', function () {
1087
1117
  }, done.fail);
1088
1118
  });
1089
1119
  });
1090
- describe('WidgetAnnotation', function () {
1091
- var widgetDict;
1120
+ describe("WidgetAnnotation", function () {
1121
+ let widgetDict;
1092
1122
  beforeEach(function (done) {
1093
1123
  widgetDict = new _primitives.Dict();
1094
- widgetDict.set('Type', _primitives.Name.get('Annot'));
1095
- widgetDict.set('Subtype', _primitives.Name.get('Widget'));
1124
+ widgetDict.set("Type", _primitives.Name.get("Annot"));
1125
+ widgetDict.set("Subtype", _primitives.Name.get("Widget"));
1096
1126
  done();
1097
1127
  });
1098
1128
  afterEach(function () {
1099
1129
  widgetDict = null;
1100
1130
  });
1101
- it('should handle unknown field names', function (done) {
1102
- var widgetRef = _primitives.Ref.get(20, 0);
1131
+ it("should handle unknown field names", function (done) {
1132
+ const widgetRef = _primitives.Ref.get(20, 0);
1103
1133
 
1104
- var xref = new _test_utils.XRefMock([{
1134
+ const xref = new _test_utils.XRefMock([{
1105
1135
  ref: widgetRef,
1106
1136
  data: widgetDict
1107
1137
  }]);
1108
1138
 
1109
- _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(function (_ref27) {
1110
- var data = _ref27.data;
1139
+ _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(({
1140
+ data
1141
+ }) => {
1111
1142
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1112
- expect(data.fieldName).toEqual('');
1143
+ expect(data.fieldName).toEqual("");
1113
1144
  done();
1114
1145
  }, done.fail);
1115
1146
  });
1116
- it('should construct the field name when there are no ancestors', function (done) {
1117
- widgetDict.set('T', 'foo');
1147
+ it("should construct the field name when there are no ancestors", function (done) {
1148
+ widgetDict.set("T", "foo");
1118
1149
 
1119
- var widgetRef = _primitives.Ref.get(21, 0);
1150
+ const widgetRef = _primitives.Ref.get(21, 0);
1120
1151
 
1121
- var xref = new _test_utils.XRefMock([{
1152
+ const xref = new _test_utils.XRefMock([{
1122
1153
  ref: widgetRef,
1123
1154
  data: widgetDict
1124
1155
  }]);
1125
1156
 
1126
- _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(function (_ref28) {
1127
- var data = _ref28.data;
1157
+ _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(({
1158
+ data
1159
+ }) => {
1128
1160
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1129
- expect(data.fieldName).toEqual('foo');
1161
+ expect(data.fieldName).toEqual("foo");
1130
1162
  done();
1131
1163
  }, done.fail);
1132
1164
  });
1133
- it('should construct the field name when there are ancestors', function (done) {
1134
- var firstParent = new _primitives.Dict();
1135
- firstParent.set('T', 'foo');
1136
- var secondParent = new _primitives.Dict();
1137
- secondParent.set('Parent', firstParent);
1138
- secondParent.set('T', 'bar');
1139
- widgetDict.set('Parent', secondParent);
1140
- widgetDict.set('T', 'baz');
1165
+ it("should construct the field name when there are ancestors", function (done) {
1166
+ const firstParent = new _primitives.Dict();
1167
+ firstParent.set("T", "foo");
1168
+ const secondParent = new _primitives.Dict();
1169
+ secondParent.set("Parent", firstParent);
1170
+ secondParent.set("T", "bar");
1171
+ widgetDict.set("Parent", secondParent);
1172
+ widgetDict.set("T", "baz");
1141
1173
 
1142
- var widgetRef = _primitives.Ref.get(22, 0);
1174
+ const widgetRef = _primitives.Ref.get(22, 0);
1143
1175
 
1144
- var xref = new _test_utils.XRefMock([{
1176
+ const xref = new _test_utils.XRefMock([{
1145
1177
  ref: widgetRef,
1146
1178
  data: widgetDict
1147
1179
  }]);
1148
1180
 
1149
- _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(function (_ref29) {
1150
- var data = _ref29.data;
1181
+ _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(({
1182
+ data
1183
+ }) => {
1151
1184
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1152
- expect(data.fieldName).toEqual('foo.bar.baz');
1185
+ expect(data.fieldName).toEqual("foo.bar.baz");
1153
1186
  done();
1154
1187
  }, done.fail);
1155
1188
  });
1156
- it('should construct the field name if a parent is not a dictionary ' + '(issue 8143)', function (done) {
1157
- var parentDict = new _primitives.Dict();
1158
- parentDict.set('Parent', null);
1159
- parentDict.set('T', 'foo');
1160
- widgetDict.set('Parent', parentDict);
1161
- widgetDict.set('T', 'bar');
1189
+ it("should construct the field name if a parent is not a dictionary " + "(issue 8143)", function (done) {
1190
+ const parentDict = new _primitives.Dict();
1191
+ parentDict.set("Parent", null);
1192
+ parentDict.set("T", "foo");
1193
+ widgetDict.set("Parent", parentDict);
1194
+ widgetDict.set("T", "bar");
1162
1195
 
1163
- var widgetRef = _primitives.Ref.get(22, 0);
1196
+ const widgetRef = _primitives.Ref.get(22, 0);
1164
1197
 
1165
- var xref = new _test_utils.XRefMock([{
1198
+ const xref = new _test_utils.XRefMock([{
1166
1199
  ref: widgetRef,
1167
1200
  data: widgetDict
1168
1201
  }]);
1169
1202
 
1170
- _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(function (_ref30) {
1171
- var data = _ref30.data;
1203
+ _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(({
1204
+ data
1205
+ }) => {
1172
1206
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1173
- expect(data.fieldName).toEqual('foo.bar');
1207
+ expect(data.fieldName).toEqual("foo.bar");
1174
1208
  done();
1175
1209
  }, done.fail);
1176
1210
  });
1177
1211
  });
1178
- describe('TextWidgetAnnotation', function () {
1179
- var textWidgetDict;
1212
+ describe("TextWidgetAnnotation", function () {
1213
+ let textWidgetDict;
1180
1214
  beforeEach(function (done) {
1181
1215
  textWidgetDict = new _primitives.Dict();
1182
- textWidgetDict.set('Type', _primitives.Name.get('Annot'));
1183
- textWidgetDict.set('Subtype', _primitives.Name.get('Widget'));
1184
- textWidgetDict.set('FT', _primitives.Name.get('Tx'));
1216
+ textWidgetDict.set("Type", _primitives.Name.get("Annot"));
1217
+ textWidgetDict.set("Subtype", _primitives.Name.get("Widget"));
1218
+ textWidgetDict.set("FT", _primitives.Name.get("Tx"));
1185
1219
  done();
1186
1220
  });
1187
1221
  afterEach(function () {
1188
1222
  textWidgetDict = null;
1189
1223
  });
1190
- it('should handle unknown text alignment, maximum length and flags', function (done) {
1191
- var textWidgetRef = _primitives.Ref.get(124, 0);
1224
+ it("should handle unknown text alignment, maximum length and flags", function (done) {
1225
+ const textWidgetRef = _primitives.Ref.get(124, 0);
1192
1226
 
1193
- var xref = new _test_utils.XRefMock([{
1227
+ const xref = new _test_utils.XRefMock([{
1194
1228
  ref: textWidgetRef,
1195
1229
  data: textWidgetDict
1196
1230
  }]);
1197
1231
 
1198
- _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref31) {
1199
- var data = _ref31.data;
1232
+ _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(({
1233
+ data
1234
+ }) => {
1200
1235
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1201
1236
  expect(data.textAlignment).toEqual(null);
1202
1237
  expect(data.maxLen).toEqual(null);
@@ -1206,20 +1241,21 @@ describe('annotation', function () {
1206
1241
  done();
1207
1242
  }, done.fail);
1208
1243
  });
1209
- it('should not set invalid text alignment, maximum length and flags', function (done) {
1210
- textWidgetDict.set('Q', 'center');
1211
- textWidgetDict.set('MaxLen', 'five');
1212
- textWidgetDict.set('Ff', 'readonly');
1244
+ it("should not set invalid text alignment, maximum length and flags", function (done) {
1245
+ textWidgetDict.set("Q", "center");
1246
+ textWidgetDict.set("MaxLen", "five");
1247
+ textWidgetDict.set("Ff", "readonly");
1213
1248
 
1214
- var textWidgetRef = _primitives.Ref.get(43, 0);
1249
+ const textWidgetRef = _primitives.Ref.get(43, 0);
1215
1250
 
1216
- var xref = new _test_utils.XRefMock([{
1251
+ const xref = new _test_utils.XRefMock([{
1217
1252
  ref: textWidgetRef,
1218
1253
  data: textWidgetDict
1219
1254
  }]);
1220
1255
 
1221
- _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref32) {
1222
- var data = _ref32.data;
1256
+ _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(({
1257
+ data
1258
+ }) => {
1223
1259
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1224
1260
  expect(data.textAlignment).toEqual(null);
1225
1261
  expect(data.maxLen).toEqual(null);
@@ -1229,20 +1265,21 @@ describe('annotation', function () {
1229
1265
  done();
1230
1266
  }, done.fail);
1231
1267
  });
1232
- it('should set valid text alignment, maximum length and flags', function (done) {
1233
- textWidgetDict.set('Q', 1);
1234
- textWidgetDict.set('MaxLen', 20);
1235
- textWidgetDict.set('Ff', _util.AnnotationFieldFlag.READONLY + _util.AnnotationFieldFlag.MULTILINE);
1268
+ it("should set valid text alignment, maximum length and flags", function (done) {
1269
+ textWidgetDict.set("Q", 1);
1270
+ textWidgetDict.set("MaxLen", 20);
1271
+ textWidgetDict.set("Ff", _util.AnnotationFieldFlag.READONLY + _util.AnnotationFieldFlag.MULTILINE);
1236
1272
 
1237
- var textWidgetRef = _primitives.Ref.get(84, 0);
1273
+ const textWidgetRef = _primitives.Ref.get(84, 0);
1238
1274
 
1239
- var xref = new _test_utils.XRefMock([{
1275
+ const xref = new _test_utils.XRefMock([{
1240
1276
  ref: textWidgetRef,
1241
1277
  data: textWidgetDict
1242
1278
  }]);
1243
1279
 
1244
- _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref33) {
1245
- var data = _ref33.data;
1280
+ _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(({
1281
+ data
1282
+ }) => {
1246
1283
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1247
1284
  expect(data.textAlignment).toEqual(1);
1248
1285
  expect(data.maxLen).toEqual(20);
@@ -1251,61 +1288,64 @@ describe('annotation', function () {
1251
1288
  done();
1252
1289
  }, done.fail);
1253
1290
  });
1254
- it('should reject comb fields without a maximum length', function (done) {
1255
- textWidgetDict.set('Ff', _util.AnnotationFieldFlag.COMB);
1291
+ it("should reject comb fields without a maximum length", function (done) {
1292
+ textWidgetDict.set("Ff", _util.AnnotationFieldFlag.COMB);
1256
1293
 
1257
- var textWidgetRef = _primitives.Ref.get(46, 0);
1294
+ const textWidgetRef = _primitives.Ref.get(46, 0);
1258
1295
 
1259
- var xref = new _test_utils.XRefMock([{
1296
+ const xref = new _test_utils.XRefMock([{
1260
1297
  ref: textWidgetRef,
1261
1298
  data: textWidgetDict
1262
1299
  }]);
1263
1300
 
1264
- _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref34) {
1265
- var data = _ref34.data;
1301
+ _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(({
1302
+ data
1303
+ }) => {
1266
1304
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1267
1305
  expect(data.comb).toEqual(false);
1268
1306
  done();
1269
1307
  }, done.fail);
1270
1308
  });
1271
- it('should accept comb fields with a maximum length', function (done) {
1272
- textWidgetDict.set('MaxLen', 20);
1273
- textWidgetDict.set('Ff', _util.AnnotationFieldFlag.COMB);
1309
+ it("should accept comb fields with a maximum length", function (done) {
1310
+ textWidgetDict.set("MaxLen", 20);
1311
+ textWidgetDict.set("Ff", _util.AnnotationFieldFlag.COMB);
1274
1312
 
1275
- var textWidgetRef = _primitives.Ref.get(46, 0);
1313
+ const textWidgetRef = _primitives.Ref.get(46, 0);
1276
1314
 
1277
- var xref = new _test_utils.XRefMock([{
1315
+ const xref = new _test_utils.XRefMock([{
1278
1316
  ref: textWidgetRef,
1279
1317
  data: textWidgetDict
1280
1318
  }]);
1281
1319
 
1282
- _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref35) {
1283
- var data = _ref35.data;
1320
+ _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(({
1321
+ data
1322
+ }) => {
1284
1323
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1285
1324
  expect(data.comb).toEqual(true);
1286
1325
  done();
1287
1326
  }, done.fail);
1288
1327
  });
1289
- it('should only accept comb fields when the flags are valid', function (done) {
1290
- var invalidFieldFlags = [_util.AnnotationFieldFlag.MULTILINE, _util.AnnotationFieldFlag.PASSWORD, _util.AnnotationFieldFlag.FILESELECT];
1291
- var flags = _util.AnnotationFieldFlag.COMB + _util.AnnotationFieldFlag.MULTILINE + _util.AnnotationFieldFlag.PASSWORD + _util.AnnotationFieldFlag.FILESELECT;
1292
- var promise = Promise.resolve();
1328
+ it("should only accept comb fields when the flags are valid", function (done) {
1329
+ const invalidFieldFlags = [_util.AnnotationFieldFlag.MULTILINE, _util.AnnotationFieldFlag.PASSWORD, _util.AnnotationFieldFlag.FILESELECT];
1330
+ let flags = _util.AnnotationFieldFlag.COMB + _util.AnnotationFieldFlag.MULTILINE + _util.AnnotationFieldFlag.PASSWORD + _util.AnnotationFieldFlag.FILESELECT;
1331
+ let promise = Promise.resolve();
1293
1332
 
1294
- for (var i = 0, ii = invalidFieldFlags.length; i <= ii; i++) {
1295
- promise = promise.then(function () {
1296
- textWidgetDict.set('MaxLen', 20);
1297
- textWidgetDict.set('Ff', flags);
1333
+ for (let i = 0, ii = invalidFieldFlags.length; i <= ii; i++) {
1334
+ promise = promise.then(() => {
1335
+ textWidgetDict.set("MaxLen", 20);
1336
+ textWidgetDict.set("Ff", flags);
1298
1337
 
1299
- var textWidgetRef = _primitives.Ref.get(93, 0);
1338
+ const textWidgetRef = _primitives.Ref.get(93, 0);
1300
1339
 
1301
- var xref = new _test_utils.XRefMock([{
1340
+ const xref = new _test_utils.XRefMock([{
1302
1341
  ref: textWidgetRef,
1303
1342
  data: textWidgetDict
1304
1343
  }]);
1305
- return _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref36) {
1306
- var data = _ref36.data;
1344
+ return _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(({
1345
+ data
1346
+ }) => {
1307
1347
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1308
- var valid = invalidFieldFlags.length === 0;
1348
+ const valid = invalidFieldFlags.length === 0;
1309
1349
  expect(data.comb).toEqual(valid);
1310
1350
 
1311
1351
  if (!valid) {
@@ -1318,165 +1358,170 @@ describe('annotation', function () {
1318
1358
  promise.then(done, done.fail);
1319
1359
  });
1320
1360
  });
1321
- describe('ButtonWidgetAnnotation', function () {
1322
- var buttonWidgetDict;
1361
+ describe("ButtonWidgetAnnotation", function () {
1362
+ let buttonWidgetDict;
1323
1363
  beforeEach(function (done) {
1324
1364
  buttonWidgetDict = new _primitives.Dict();
1325
- buttonWidgetDict.set('Type', _primitives.Name.get('Annot'));
1326
- buttonWidgetDict.set('Subtype', _primitives.Name.get('Widget'));
1327
- buttonWidgetDict.set('FT', _primitives.Name.get('Btn'));
1365
+ buttonWidgetDict.set("Type", _primitives.Name.get("Annot"));
1366
+ buttonWidgetDict.set("Subtype", _primitives.Name.get("Widget"));
1367
+ buttonWidgetDict.set("FT", _primitives.Name.get("Btn"));
1328
1368
  done();
1329
1369
  });
1330
1370
  afterEach(function () {
1331
1371
  buttonWidgetDict = null;
1332
1372
  });
1333
- it('should handle checkboxes with export value', function (done) {
1334
- buttonWidgetDict.set('V', _primitives.Name.get('1'));
1335
- var appearanceStatesDict = new _primitives.Dict();
1336
- var exportValueOptionsDict = new _primitives.Dict();
1337
- exportValueOptionsDict.set('Off', 0);
1338
- exportValueOptionsDict.set('Checked', 1);
1339
- appearanceStatesDict.set('D', exportValueOptionsDict);
1340
- buttonWidgetDict.set('AP', appearanceStatesDict);
1373
+ it("should handle checkboxes with export value", function (done) {
1374
+ buttonWidgetDict.set("V", _primitives.Name.get("1"));
1375
+ const appearanceStatesDict = new _primitives.Dict();
1376
+ const exportValueOptionsDict = new _primitives.Dict();
1377
+ exportValueOptionsDict.set("Off", 0);
1378
+ exportValueOptionsDict.set("Checked", 1);
1379
+ appearanceStatesDict.set("D", exportValueOptionsDict);
1380
+ buttonWidgetDict.set("AP", appearanceStatesDict);
1341
1381
 
1342
- var buttonWidgetRef = _primitives.Ref.get(124, 0);
1382
+ const buttonWidgetRef = _primitives.Ref.get(124, 0);
1343
1383
 
1344
- var xref = new _test_utils.XRefMock([{
1384
+ const xref = new _test_utils.XRefMock([{
1345
1385
  ref: buttonWidgetRef,
1346
1386
  data: buttonWidgetDict
1347
1387
  }]);
1348
1388
 
1349
- _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref37) {
1350
- var data = _ref37.data;
1389
+ _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(({
1390
+ data
1391
+ }) => {
1351
1392
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1352
1393
  expect(data.checkBox).toEqual(true);
1353
- expect(data.fieldValue).toEqual('1');
1394
+ expect(data.fieldValue).toEqual("1");
1354
1395
  expect(data.radioButton).toEqual(false);
1355
- expect(data.exportValue).toEqual('Checked');
1396
+ expect(data.exportValue).toEqual("Checked");
1356
1397
  done();
1357
1398
  }, done.fail);
1358
1399
  });
1359
- it('should handle checkboxes without export value', function (done) {
1360
- buttonWidgetDict.set('V', _primitives.Name.get('1'));
1400
+ it("should handle checkboxes without export value", function (done) {
1401
+ buttonWidgetDict.set("V", _primitives.Name.get("1"));
1361
1402
 
1362
- var buttonWidgetRef = _primitives.Ref.get(124, 0);
1403
+ const buttonWidgetRef = _primitives.Ref.get(124, 0);
1363
1404
 
1364
- var xref = new _test_utils.XRefMock([{
1405
+ const xref = new _test_utils.XRefMock([{
1365
1406
  ref: buttonWidgetRef,
1366
1407
  data: buttonWidgetDict
1367
1408
  }]);
1368
1409
 
1369
- _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref38) {
1370
- var data = _ref38.data;
1410
+ _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(({
1411
+ data
1412
+ }) => {
1371
1413
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1372
1414
  expect(data.checkBox).toEqual(true);
1373
- expect(data.fieldValue).toEqual('1');
1415
+ expect(data.fieldValue).toEqual("1");
1374
1416
  expect(data.radioButton).toEqual(false);
1375
1417
  done();
1376
1418
  }, done.fail);
1377
1419
  });
1378
- it('should handle radio buttons with a field value', function (done) {
1379
- var parentDict = new _primitives.Dict();
1380
- parentDict.set('V', _primitives.Name.get('1'));
1381
- var normalAppearanceStateDict = new _primitives.Dict();
1382
- normalAppearanceStateDict.set('2', null);
1383
- var appearanceStatesDict = new _primitives.Dict();
1384
- appearanceStatesDict.set('N', normalAppearanceStateDict);
1385
- buttonWidgetDict.set('Ff', _util.AnnotationFieldFlag.RADIO);
1386
- buttonWidgetDict.set('Parent', parentDict);
1387
- buttonWidgetDict.set('AP', appearanceStatesDict);
1420
+ it("should handle radio buttons with a field value", function (done) {
1421
+ const parentDict = new _primitives.Dict();
1422
+ parentDict.set("V", _primitives.Name.get("1"));
1423
+ const normalAppearanceStateDict = new _primitives.Dict();
1424
+ normalAppearanceStateDict.set("2", null);
1425
+ const appearanceStatesDict = new _primitives.Dict();
1426
+ appearanceStatesDict.set("N", normalAppearanceStateDict);
1427
+ buttonWidgetDict.set("Ff", _util.AnnotationFieldFlag.RADIO);
1428
+ buttonWidgetDict.set("Parent", parentDict);
1429
+ buttonWidgetDict.set("AP", appearanceStatesDict);
1388
1430
 
1389
- var buttonWidgetRef = _primitives.Ref.get(124, 0);
1431
+ const buttonWidgetRef = _primitives.Ref.get(124, 0);
1390
1432
 
1391
- var xref = new _test_utils.XRefMock([{
1433
+ const xref = new _test_utils.XRefMock([{
1392
1434
  ref: buttonWidgetRef,
1393
1435
  data: buttonWidgetDict
1394
1436
  }]);
1395
1437
 
1396
- _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref39) {
1397
- var data = _ref39.data;
1438
+ _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(({
1439
+ data
1440
+ }) => {
1398
1441
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1399
1442
  expect(data.checkBox).toEqual(false);
1400
1443
  expect(data.radioButton).toEqual(true);
1401
- expect(data.fieldValue).toEqual('1');
1402
- expect(data.buttonValue).toEqual('2');
1444
+ expect(data.fieldValue).toEqual("1");
1445
+ expect(data.buttonValue).toEqual("2");
1403
1446
  done();
1404
1447
  }, done.fail);
1405
1448
  });
1406
- it('should handle radio buttons without a field value', function (done) {
1407
- var normalAppearanceStateDict = new _primitives.Dict();
1408
- normalAppearanceStateDict.set('2', null);
1409
- var appearanceStatesDict = new _primitives.Dict();
1410
- appearanceStatesDict.set('N', normalAppearanceStateDict);
1411
- buttonWidgetDict.set('Ff', _util.AnnotationFieldFlag.RADIO);
1412
- buttonWidgetDict.set('AP', appearanceStatesDict);
1449
+ it("should handle radio buttons without a field value", function (done) {
1450
+ const normalAppearanceStateDict = new _primitives.Dict();
1451
+ normalAppearanceStateDict.set("2", null);
1452
+ const appearanceStatesDict = new _primitives.Dict();
1453
+ appearanceStatesDict.set("N", normalAppearanceStateDict);
1454
+ buttonWidgetDict.set("Ff", _util.AnnotationFieldFlag.RADIO);
1455
+ buttonWidgetDict.set("AP", appearanceStatesDict);
1413
1456
 
1414
- var buttonWidgetRef = _primitives.Ref.get(124, 0);
1457
+ const buttonWidgetRef = _primitives.Ref.get(124, 0);
1415
1458
 
1416
- var xref = new _test_utils.XRefMock([{
1459
+ const xref = new _test_utils.XRefMock([{
1417
1460
  ref: buttonWidgetRef,
1418
1461
  data: buttonWidgetDict
1419
1462
  }]);
1420
1463
 
1421
- _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref40) {
1422
- var data = _ref40.data;
1464
+ _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(({
1465
+ data
1466
+ }) => {
1423
1467
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1424
1468
  expect(data.checkBox).toEqual(false);
1425
1469
  expect(data.radioButton).toEqual(true);
1426
1470
  expect(data.fieldValue).toEqual(null);
1427
- expect(data.buttonValue).toEqual('2');
1471
+ expect(data.buttonValue).toEqual("2");
1428
1472
  done();
1429
1473
  }, done.fail);
1430
1474
  });
1431
1475
  });
1432
- describe('ChoiceWidgetAnnotation', function () {
1433
- var choiceWidgetDict;
1476
+ describe("ChoiceWidgetAnnotation", function () {
1477
+ let choiceWidgetDict;
1434
1478
  beforeEach(function (done) {
1435
1479
  choiceWidgetDict = new _primitives.Dict();
1436
- choiceWidgetDict.set('Type', _primitives.Name.get('Annot'));
1437
- choiceWidgetDict.set('Subtype', _primitives.Name.get('Widget'));
1438
- choiceWidgetDict.set('FT', _primitives.Name.get('Ch'));
1480
+ choiceWidgetDict.set("Type", _primitives.Name.get("Annot"));
1481
+ choiceWidgetDict.set("Subtype", _primitives.Name.get("Widget"));
1482
+ choiceWidgetDict.set("FT", _primitives.Name.get("Ch"));
1439
1483
  done();
1440
1484
  });
1441
1485
  afterEach(function () {
1442
1486
  choiceWidgetDict = null;
1443
1487
  });
1444
- it('should handle missing option arrays', function (done) {
1445
- var choiceWidgetRef = _primitives.Ref.get(122, 0);
1488
+ it("should handle missing option arrays", function (done) {
1489
+ const choiceWidgetRef = _primitives.Ref.get(122, 0);
1446
1490
 
1447
- var xref = new _test_utils.XRefMock([{
1491
+ const xref = new _test_utils.XRefMock([{
1448
1492
  ref: choiceWidgetRef,
1449
1493
  data: choiceWidgetDict
1450
1494
  }]);
1451
1495
 
1452
- _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref41) {
1453
- var data = _ref41.data;
1496
+ _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(({
1497
+ data
1498
+ }) => {
1454
1499
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1455
1500
  expect(data.options).toEqual([]);
1456
1501
  done();
1457
1502
  }, done.fail);
1458
1503
  });
1459
- it('should handle option arrays with array elements', function (done) {
1460
- var optionBarRef = _primitives.Ref.get(20, 0);
1504
+ it("should handle option arrays with array elements", function (done) {
1505
+ const optionBarRef = _primitives.Ref.get(20, 0);
1461
1506
 
1462
- var optionBarStr = 'Bar';
1507
+ const optionBarStr = "Bar";
1463
1508
 
1464
- var optionOneRef = _primitives.Ref.get(10, 0);
1509
+ const optionOneRef = _primitives.Ref.get(10, 0);
1465
1510
 
1466
- var optionOneArr = ['bar_export', optionBarRef];
1467
- var options = [['foo_export', 'Foo'], optionOneRef];
1468
- var expected = [{
1469
- exportValue: 'foo_export',
1470
- displayValue: 'Foo'
1511
+ const optionOneArr = ["bar_export", optionBarRef];
1512
+ const options = [["foo_export", "Foo"], optionOneRef];
1513
+ const expected = [{
1514
+ exportValue: "foo_export",
1515
+ displayValue: "Foo"
1471
1516
  }, {
1472
- exportValue: 'bar_export',
1473
- displayValue: 'Bar'
1517
+ exportValue: "bar_export",
1518
+ displayValue: "Bar"
1474
1519
  }];
1475
- choiceWidgetDict.set('Opt', options);
1520
+ choiceWidgetDict.set("Opt", options);
1476
1521
 
1477
- var choiceWidgetRef = _primitives.Ref.get(123, 0);
1522
+ const choiceWidgetRef = _primitives.Ref.get(123, 0);
1478
1523
 
1479
- var xref = new _test_utils.XRefMock([{
1524
+ const xref = new _test_utils.XRefMock([{
1480
1525
  ref: choiceWidgetRef,
1481
1526
  data: choiceWidgetDict
1482
1527
  }, {
@@ -1487,30 +1532,31 @@ describe('annotation', function () {
1487
1532
  data: optionOneArr
1488
1533
  }]);
1489
1534
 
1490
- _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref42) {
1491
- var data = _ref42.data;
1535
+ _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(({
1536
+ data
1537
+ }) => {
1492
1538
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1493
1539
  expect(data.options).toEqual(expected);
1494
1540
  done();
1495
1541
  }, done.fail);
1496
1542
  });
1497
- it('should handle option arrays with string elements', function (done) {
1498
- var optionBarRef = _primitives.Ref.get(10, 0);
1543
+ it("should handle option arrays with string elements", function (done) {
1544
+ const optionBarRef = _primitives.Ref.get(10, 0);
1499
1545
 
1500
- var optionBarStr = 'Bar';
1501
- var options = ['Foo', optionBarRef];
1502
- var expected = [{
1503
- exportValue: 'Foo',
1504
- displayValue: 'Foo'
1546
+ const optionBarStr = "Bar";
1547
+ const options = ["Foo", optionBarRef];
1548
+ const expected = [{
1549
+ exportValue: "Foo",
1550
+ displayValue: "Foo"
1505
1551
  }, {
1506
- exportValue: 'Bar',
1507
- displayValue: 'Bar'
1552
+ exportValue: "Bar",
1553
+ displayValue: "Bar"
1508
1554
  }];
1509
- choiceWidgetDict.set('Opt', options);
1555
+ choiceWidgetDict.set("Opt", options);
1510
1556
 
1511
- var choiceWidgetRef = _primitives.Ref.get(981, 0);
1557
+ const choiceWidgetRef = _primitives.Ref.get(981, 0);
1512
1558
 
1513
- var xref = new _test_utils.XRefMock([{
1559
+ const xref = new _test_utils.XRefMock([{
1514
1560
  ref: choiceWidgetRef,
1515
1561
  data: choiceWidgetDict
1516
1562
  }, {
@@ -1518,108 +1564,114 @@ describe('annotation', function () {
1518
1564
  data: optionBarStr
1519
1565
  }]);
1520
1566
 
1521
- _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref43) {
1522
- var data = _ref43.data;
1567
+ _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(({
1568
+ data
1569
+ }) => {
1523
1570
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1524
1571
  expect(data.options).toEqual(expected);
1525
1572
  done();
1526
1573
  }, done.fail);
1527
1574
  });
1528
- it('should handle inherited option arrays (issue 8094)', function (done) {
1529
- var options = [['Value1', 'Description1'], ['Value2', 'Description2']];
1530
- var expected = [{
1531
- exportValue: 'Value1',
1532
- displayValue: 'Description1'
1575
+ it("should handle inherited option arrays (issue 8094)", function (done) {
1576
+ const options = [["Value1", "Description1"], ["Value2", "Description2"]];
1577
+ const expected = [{
1578
+ exportValue: "Value1",
1579
+ displayValue: "Description1"
1533
1580
  }, {
1534
- exportValue: 'Value2',
1535
- displayValue: 'Description2'
1581
+ exportValue: "Value2",
1582
+ displayValue: "Description2"
1536
1583
  }];
1537
- var parentDict = new _primitives.Dict();
1538
- parentDict.set('Opt', options);
1539
- choiceWidgetDict.set('Parent', parentDict);
1584
+ const parentDict = new _primitives.Dict();
1585
+ parentDict.set("Opt", options);
1586
+ choiceWidgetDict.set("Parent", parentDict);
1540
1587
 
1541
- var choiceWidgetRef = _primitives.Ref.get(123, 0);
1588
+ const choiceWidgetRef = _primitives.Ref.get(123, 0);
1542
1589
 
1543
- var xref = new _test_utils.XRefMock([{
1590
+ const xref = new _test_utils.XRefMock([{
1544
1591
  ref: choiceWidgetRef,
1545
1592
  data: choiceWidgetDict
1546
1593
  }]);
1547
1594
 
1548
- _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref44) {
1549
- var data = _ref44.data;
1595
+ _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(({
1596
+ data
1597
+ }) => {
1550
1598
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1551
1599
  expect(data.options).toEqual(expected);
1552
1600
  done();
1553
1601
  }, done.fail);
1554
1602
  });
1555
- it('should sanitize display values in option arrays (issue 8947)', function (done) {
1556
- var options = ['\xFE\xFF\x00F\x00o\x00o'];
1557
- var expected = [{
1558
- exportValue: '\xFE\xFF\x00F\x00o\x00o',
1559
- displayValue: 'Foo'
1603
+ it("should sanitize display values in option arrays (issue 8947)", function (done) {
1604
+ const options = ["\xFE\xFF\x00F\x00o\x00o"];
1605
+ const expected = [{
1606
+ exportValue: "\xFE\xFF\x00F\x00o\x00o",
1607
+ displayValue: "Foo"
1560
1608
  }];
1561
- choiceWidgetDict.set('Opt', options);
1609
+ choiceWidgetDict.set("Opt", options);
1562
1610
 
1563
- var choiceWidgetRef = _primitives.Ref.get(984, 0);
1611
+ const choiceWidgetRef = _primitives.Ref.get(984, 0);
1564
1612
 
1565
- var xref = new _test_utils.XRefMock([{
1613
+ const xref = new _test_utils.XRefMock([{
1566
1614
  ref: choiceWidgetRef,
1567
1615
  data: choiceWidgetDict
1568
1616
  }]);
1569
1617
 
1570
- _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref45) {
1571
- var data = _ref45.data;
1618
+ _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(({
1619
+ data
1620
+ }) => {
1572
1621
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1573
1622
  expect(data.options).toEqual(expected);
1574
1623
  done();
1575
1624
  }, done.fail);
1576
1625
  });
1577
- it('should handle array field values', function (done) {
1578
- var fieldValue = ['Foo', 'Bar'];
1579
- choiceWidgetDict.set('V', fieldValue);
1626
+ it("should handle array field values", function (done) {
1627
+ const fieldValue = ["Foo", "Bar"];
1628
+ choiceWidgetDict.set("V", fieldValue);
1580
1629
 
1581
- var choiceWidgetRef = _primitives.Ref.get(968, 0);
1630
+ const choiceWidgetRef = _primitives.Ref.get(968, 0);
1582
1631
 
1583
- var xref = new _test_utils.XRefMock([{
1632
+ const xref = new _test_utils.XRefMock([{
1584
1633
  ref: choiceWidgetRef,
1585
1634
  data: choiceWidgetDict
1586
1635
  }]);
1587
1636
 
1588
- _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref46) {
1589
- var data = _ref46.data;
1637
+ _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(({
1638
+ data
1639
+ }) => {
1590
1640
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1591
1641
  expect(data.fieldValue).toEqual(fieldValue);
1592
1642
  done();
1593
1643
  }, done.fail);
1594
1644
  });
1595
- it('should handle string field values', function (done) {
1596
- var fieldValue = 'Foo';
1597
- choiceWidgetDict.set('V', fieldValue);
1645
+ it("should handle string field values", function (done) {
1646
+ const fieldValue = "Foo";
1647
+ choiceWidgetDict.set("V", fieldValue);
1598
1648
 
1599
- var choiceWidgetRef = _primitives.Ref.get(978, 0);
1649
+ const choiceWidgetRef = _primitives.Ref.get(978, 0);
1600
1650
 
1601
- var xref = new _test_utils.XRefMock([{
1651
+ const xref = new _test_utils.XRefMock([{
1602
1652
  ref: choiceWidgetRef,
1603
1653
  data: choiceWidgetDict
1604
1654
  }]);
1605
1655
 
1606
- _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref47) {
1607
- var data = _ref47.data;
1656
+ _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(({
1657
+ data
1658
+ }) => {
1608
1659
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1609
1660
  expect(data.fieldValue).toEqual([fieldValue]);
1610
1661
  done();
1611
1662
  }, done.fail);
1612
1663
  });
1613
- it('should handle unknown flags', function (done) {
1614
- var choiceWidgetRef = _primitives.Ref.get(166, 0);
1664
+ it("should handle unknown flags", function (done) {
1665
+ const choiceWidgetRef = _primitives.Ref.get(166, 0);
1615
1666
 
1616
- var xref = new _test_utils.XRefMock([{
1667
+ const xref = new _test_utils.XRefMock([{
1617
1668
  ref: choiceWidgetRef,
1618
1669
  data: choiceWidgetDict
1619
1670
  }]);
1620
1671
 
1621
- _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref48) {
1622
- var data = _ref48.data;
1672
+ _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(({
1673
+ data
1674
+ }) => {
1623
1675
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1624
1676
  expect(data.readOnly).toEqual(false);
1625
1677
  expect(data.combo).toEqual(false);
@@ -1627,18 +1679,19 @@ describe('annotation', function () {
1627
1679
  done();
1628
1680
  }, done.fail);
1629
1681
  });
1630
- it('should not set invalid flags', function (done) {
1631
- choiceWidgetDict.set('Ff', 'readonly');
1682
+ it("should not set invalid flags", function (done) {
1683
+ choiceWidgetDict.set("Ff", "readonly");
1632
1684
 
1633
- var choiceWidgetRef = _primitives.Ref.get(165, 0);
1685
+ const choiceWidgetRef = _primitives.Ref.get(165, 0);
1634
1686
 
1635
- var xref = new _test_utils.XRefMock([{
1687
+ const xref = new _test_utils.XRefMock([{
1636
1688
  ref: choiceWidgetRef,
1637
1689
  data: choiceWidgetDict
1638
1690
  }]);
1639
1691
 
1640
- _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref49) {
1641
- var data = _ref49.data;
1692
+ _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(({
1693
+ data
1694
+ }) => {
1642
1695
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1643
1696
  expect(data.readOnly).toEqual(false);
1644
1697
  expect(data.combo).toEqual(false);
@@ -1646,18 +1699,19 @@ describe('annotation', function () {
1646
1699
  done();
1647
1700
  }, done.fail);
1648
1701
  });
1649
- it('should set valid flags', function (done) {
1650
- choiceWidgetDict.set('Ff', _util.AnnotationFieldFlag.READONLY + _util.AnnotationFieldFlag.COMBO + _util.AnnotationFieldFlag.MULTISELECT);
1702
+ it("should set valid flags", function (done) {
1703
+ choiceWidgetDict.set("Ff", _util.AnnotationFieldFlag.READONLY + _util.AnnotationFieldFlag.COMBO + _util.AnnotationFieldFlag.MULTISELECT);
1651
1704
 
1652
- var choiceWidgetRef = _primitives.Ref.get(512, 0);
1705
+ const choiceWidgetRef = _primitives.Ref.get(512, 0);
1653
1706
 
1654
- var xref = new _test_utils.XRefMock([{
1707
+ const xref = new _test_utils.XRefMock([{
1655
1708
  ref: choiceWidgetRef,
1656
1709
  data: choiceWidgetDict
1657
1710
  }]);
1658
1711
 
1659
- _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref50) {
1660
- var data = _ref50.data;
1712
+ _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(({
1713
+ data
1714
+ }) => {
1661
1715
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1662
1716
  expect(data.readOnly).toEqual(true);
1663
1717
  expect(data.combo).toEqual(true);
@@ -1666,60 +1720,61 @@ describe('annotation', function () {
1666
1720
  }, done.fail);
1667
1721
  });
1668
1722
  });
1669
- describe('LineAnnotation', function () {
1670
- it('should set the line coordinates', function (done) {
1671
- var lineDict = new _primitives.Dict();
1672
- lineDict.set('Type', _primitives.Name.get('Annot'));
1673
- lineDict.set('Subtype', _primitives.Name.get('Line'));
1674
- lineDict.set('L', [1, 2, 3, 4]);
1723
+ describe("LineAnnotation", function () {
1724
+ it("should set the line coordinates", function (done) {
1725
+ const lineDict = new _primitives.Dict();
1726
+ lineDict.set("Type", _primitives.Name.get("Annot"));
1727
+ lineDict.set("Subtype", _primitives.Name.get("Line"));
1728
+ lineDict.set("L", [1, 2, 3, 4]);
1675
1729
 
1676
- var lineRef = _primitives.Ref.get(122, 0);
1730
+ const lineRef = _primitives.Ref.get(122, 0);
1677
1731
 
1678
- var xref = new _test_utils.XRefMock([{
1732
+ const xref = new _test_utils.XRefMock([{
1679
1733
  ref: lineRef,
1680
1734
  data: lineDict
1681
1735
  }]);
1682
1736
 
1683
- _annotation.AnnotationFactory.create(xref, lineRef, pdfManagerMock, idFactoryMock).then(function (_ref51) {
1684
- var data = _ref51.data;
1737
+ _annotation.AnnotationFactory.create(xref, lineRef, pdfManagerMock, idFactoryMock).then(({
1738
+ data
1739
+ }) => {
1685
1740
  expect(data.annotationType).toEqual(_util.AnnotationType.LINE);
1686
1741
  expect(data.lineCoordinates).toEqual([1, 2, 3, 4]);
1687
1742
  done();
1688
1743
  }, done.fail);
1689
1744
  });
1690
1745
  });
1691
- describe('FileAttachmentAnnotation', function () {
1692
- it('should correctly parse a file attachment', function (done) {
1693
- var fileStream = new _stream.StringStream('<<\n' + '/Type /EmbeddedFile\n' + '/Subtype /text#2Fplain\n' + '>>\n' + 'stream\n' + 'Test attachment' + 'endstream\n');
1694
- var parser = new _parser.Parser({
1746
+ describe("FileAttachmentAnnotation", function () {
1747
+ it("should correctly parse a file attachment", function (done) {
1748
+ const fileStream = new _stream.StringStream("<<\n" + "/Type /EmbeddedFile\n" + "/Subtype /text#2Fplain\n" + ">>\n" + "stream\n" + "Test attachment" + "endstream\n");
1749
+ const parser = new _parser.Parser({
1695
1750
  lexer: new _parser.Lexer(fileStream),
1696
1751
  xref: null,
1697
1752
  allowStreams: true
1698
1753
  });
1699
1754
 
1700
- var fileStreamRef = _primitives.Ref.get(18, 0);
1755
+ const fileStreamRef = _primitives.Ref.get(18, 0);
1701
1756
 
1702
- var fileStreamDict = parser.getObj();
1703
- var embeddedFileDict = new _primitives.Dict();
1704
- embeddedFileDict.set('F', fileStreamRef);
1757
+ const fileStreamDict = parser.getObj();
1758
+ const embeddedFileDict = new _primitives.Dict();
1759
+ embeddedFileDict.set("F", fileStreamRef);
1705
1760
 
1706
- var fileSpecRef = _primitives.Ref.get(19, 0);
1761
+ const fileSpecRef = _primitives.Ref.get(19, 0);
1707
1762
 
1708
- var fileSpecDict = new _primitives.Dict();
1709
- fileSpecDict.set('Type', _primitives.Name.get('Filespec'));
1710
- fileSpecDict.set('Desc', '');
1711
- fileSpecDict.set('EF', embeddedFileDict);
1712
- fileSpecDict.set('UF', 'Test.txt');
1763
+ const fileSpecDict = new _primitives.Dict();
1764
+ fileSpecDict.set("Type", _primitives.Name.get("Filespec"));
1765
+ fileSpecDict.set("Desc", "");
1766
+ fileSpecDict.set("EF", embeddedFileDict);
1767
+ fileSpecDict.set("UF", "Test.txt");
1713
1768
 
1714
- var fileAttachmentRef = _primitives.Ref.get(20, 0);
1769
+ const fileAttachmentRef = _primitives.Ref.get(20, 0);
1715
1770
 
1716
- var fileAttachmentDict = new _primitives.Dict();
1717
- fileAttachmentDict.set('Type', _primitives.Name.get('Annot'));
1718
- fileAttachmentDict.set('Subtype', _primitives.Name.get('FileAttachment'));
1719
- fileAttachmentDict.set('FS', fileSpecRef);
1720
- fileAttachmentDict.set('T', 'Topic');
1721
- fileAttachmentDict.set('Contents', 'Test.txt');
1722
- var xref = new _test_utils.XRefMock([{
1771
+ const fileAttachmentDict = new _primitives.Dict();
1772
+ fileAttachmentDict.set("Type", _primitives.Name.get("Annot"));
1773
+ fileAttachmentDict.set("Subtype", _primitives.Name.get("FileAttachment"));
1774
+ fileAttachmentDict.set("FS", fileSpecRef);
1775
+ fileAttachmentDict.set("T", "Topic");
1776
+ fileAttachmentDict.set("Contents", "Test.txt");
1777
+ const xref = new _test_utils.XRefMock([{
1723
1778
  ref: fileStreamRef,
1724
1779
  data: fileStreamDict
1725
1780
  }, {
@@ -1733,125 +1788,134 @@ describe('annotation', function () {
1733
1788
  fileSpecDict.assignXref(xref);
1734
1789
  fileAttachmentDict.assignXref(xref);
1735
1790
 
1736
- _annotation.AnnotationFactory.create(xref, fileAttachmentRef, pdfManagerMock, idFactoryMock).then(function (_ref52) {
1737
- var data = _ref52.data;
1791
+ _annotation.AnnotationFactory.create(xref, fileAttachmentRef, pdfManagerMock, idFactoryMock).then(({
1792
+ data
1793
+ }) => {
1738
1794
  expect(data.annotationType).toEqual(_util.AnnotationType.FILEATTACHMENT);
1739
- expect(data.file.filename).toEqual('Test.txt');
1740
- expect(data.file.content).toEqual((0, _util.stringToBytes)('Test attachment'));
1795
+ expect(data.file.filename).toEqual("Test.txt");
1796
+ expect(data.file.content).toEqual((0, _util.stringToBytes)("Test attachment"));
1741
1797
  done();
1742
1798
  }, done.fail);
1743
1799
  });
1744
1800
  });
1745
- describe('PopupAnnotation', function () {
1746
- it('should inherit properties from its parent', function (done) {
1747
- var parentDict = new _primitives.Dict();
1748
- parentDict.set('Type', _primitives.Name.get('Annot'));
1749
- parentDict.set('Subtype', _primitives.Name.get('Text'));
1750
- parentDict.set('M', 'D:20190423');
1751
- parentDict.set('C', [0, 0, 1]);
1752
- var popupDict = new _primitives.Dict();
1753
- popupDict.set('Type', _primitives.Name.get('Annot'));
1754
- popupDict.set('Subtype', _primitives.Name.get('Popup'));
1755
- popupDict.set('Parent', parentDict);
1756
-
1757
- var popupRef = _primitives.Ref.get(13, 0);
1758
-
1759
- var xref = new _test_utils.XRefMock([{
1801
+ describe("PopupAnnotation", function () {
1802
+ it("should inherit properties from its parent", function (done) {
1803
+ const parentDict = new _primitives.Dict();
1804
+ parentDict.set("Type", _primitives.Name.get("Annot"));
1805
+ parentDict.set("Subtype", _primitives.Name.get("Text"));
1806
+ parentDict.set("M", "D:20190423");
1807
+ parentDict.set("C", [0, 0, 1]);
1808
+ const popupDict = new _primitives.Dict();
1809
+ popupDict.set("Type", _primitives.Name.get("Annot"));
1810
+ popupDict.set("Subtype", _primitives.Name.get("Popup"));
1811
+ popupDict.set("Parent", parentDict);
1812
+
1813
+ const popupRef = _primitives.Ref.get(13, 0);
1814
+
1815
+ const xref = new _test_utils.XRefMock([{
1760
1816
  ref: popupRef,
1761
1817
  data: popupDict
1762
1818
  }]);
1763
1819
 
1764
- _annotation.AnnotationFactory.create(xref, popupRef, pdfManagerMock, idFactoryMock).then(function (_ref53) {
1765
- var data = _ref53.data,
1766
- viewable = _ref53.viewable;
1820
+ _annotation.AnnotationFactory.create(xref, popupRef, pdfManagerMock, idFactoryMock).then(({
1821
+ data,
1822
+ viewable
1823
+ }) => {
1767
1824
  expect(data.annotationType).toEqual(_util.AnnotationType.POPUP);
1768
- expect(data.modificationDate).toEqual('D:20190423');
1825
+ expect(data.modificationDate).toEqual("D:20190423");
1769
1826
  expect(data.color).toEqual(new Uint8ClampedArray([0, 0, 255]));
1770
1827
  done();
1771
1828
  }, done.fail);
1772
1829
  });
1773
- it('should handle missing parent properties', function (done) {
1774
- var parentDict = new _primitives.Dict();
1775
- parentDict.set('Type', _primitives.Name.get('Annot'));
1776
- parentDict.set('Subtype', _primitives.Name.get('Text'));
1777
- var popupDict = new _primitives.Dict();
1778
- popupDict.set('Type', _primitives.Name.get('Annot'));
1779
- popupDict.set('Subtype', _primitives.Name.get('Popup'));
1780
- popupDict.set('Parent', parentDict);
1830
+ it("should handle missing parent properties", function (done) {
1831
+ const parentDict = new _primitives.Dict();
1832
+ parentDict.set("Type", _primitives.Name.get("Annot"));
1833
+ parentDict.set("Subtype", _primitives.Name.get("Text"));
1834
+ const popupDict = new _primitives.Dict();
1835
+ popupDict.set("Type", _primitives.Name.get("Annot"));
1836
+ popupDict.set("Subtype", _primitives.Name.get("Popup"));
1837
+ popupDict.set("Parent", parentDict);
1781
1838
 
1782
- var popupRef = _primitives.Ref.get(13, 0);
1839
+ const popupRef = _primitives.Ref.get(13, 0);
1783
1840
 
1784
- var xref = new _test_utils.XRefMock([{
1841
+ const xref = new _test_utils.XRefMock([{
1785
1842
  ref: popupRef,
1786
1843
  data: popupDict
1787
1844
  }]);
1788
1845
 
1789
- _annotation.AnnotationFactory.create(xref, popupRef, pdfManagerMock, idFactoryMock).then(function (_ref54) {
1790
- var data = _ref54.data,
1791
- viewable = _ref54.viewable;
1846
+ _annotation.AnnotationFactory.create(xref, popupRef, pdfManagerMock, idFactoryMock).then(({
1847
+ data,
1848
+ viewable
1849
+ }) => {
1792
1850
  expect(data.annotationType).toEqual(_util.AnnotationType.POPUP);
1793
1851
  expect(data.modificationDate).toEqual(null);
1794
1852
  expect(data.color).toEqual(null);
1795
1853
  done();
1796
1854
  }, done.fail);
1797
1855
  });
1798
- it('should inherit the parent flags when the Popup is not viewable, ' + 'but the parent is (PR 7352)', function (done) {
1799
- var parentDict = new _primitives.Dict();
1800
- parentDict.set('Type', _primitives.Name.get('Annot'));
1801
- parentDict.set('Subtype', _primitives.Name.get('Text'));
1802
- parentDict.set('F', 28);
1803
- var popupDict = new _primitives.Dict();
1804
- popupDict.set('Type', _primitives.Name.get('Annot'));
1805
- popupDict.set('Subtype', _primitives.Name.get('Popup'));
1806
- popupDict.set('F', 25);
1807
- popupDict.set('Parent', parentDict);
1856
+ it("should inherit the parent flags when the Popup is not viewable, " + "but the parent is (PR 7352)", function (done) {
1857
+ const parentDict = new _primitives.Dict();
1858
+ parentDict.set("Type", _primitives.Name.get("Annot"));
1859
+ parentDict.set("Subtype", _primitives.Name.get("Text"));
1860
+ parentDict.set("F", 28);
1861
+ const popupDict = new _primitives.Dict();
1862
+ popupDict.set("Type", _primitives.Name.get("Annot"));
1863
+ popupDict.set("Subtype", _primitives.Name.get("Popup"));
1864
+ popupDict.set("F", 25);
1865
+ popupDict.set("Parent", parentDict);
1808
1866
 
1809
- var popupRef = _primitives.Ref.get(13, 0);
1867
+ const popupRef = _primitives.Ref.get(13, 0);
1810
1868
 
1811
- var xref = new _test_utils.XRefMock([{
1869
+ const xref = new _test_utils.XRefMock([{
1812
1870
  ref: popupRef,
1813
1871
  data: popupDict
1814
1872
  }]);
1815
1873
 
1816
- _annotation.AnnotationFactory.create(xref, popupRef, pdfManagerMock, idFactoryMock).then(function (_ref55) {
1817
- var data = _ref55.data,
1818
- viewable = _ref55.viewable;
1874
+ _annotation.AnnotationFactory.create(xref, popupRef, pdfManagerMock, idFactoryMock).then(({
1875
+ data,
1876
+ viewable
1877
+ }) => {
1819
1878
  expect(data.annotationType).toEqual(_util.AnnotationType.POPUP);
1820
1879
  expect(data.annotationFlags).toEqual(25);
1821
1880
  expect(viewable).toEqual(true);
1822
1881
  done();
1823
1882
  }, done.fail);
1824
1883
  });
1825
- it('should correctly inherit Contents from group-master annotation ' + 'if parent has ReplyType == Group', function (done) {
1826
- var annotationRef = new _primitives.Ref(819, 0);
1827
- var annotationDict = new _primitives.Dict();
1828
- annotationDict.set('Type', _primitives.Name.get('Annot'));
1829
- annotationDict.set('Subtype', _primitives.Name.get('Text'));
1830
- annotationDict.set('T', 'Correct Title');
1831
- annotationDict.set('Contents', 'Correct Text');
1832
- annotationDict.set('M', 'D:20190423');
1833
- annotationDict.set('C', [0, 0, 1]);
1834
- var replyRef = new _primitives.Ref(820, 0);
1835
- var replyDict = new _primitives.Dict();
1836
- replyDict.set('Type', _primitives.Name.get('Annot'));
1837
- replyDict.set('Subtype', _primitives.Name.get('Text'));
1838
- replyDict.set('IRT', annotationRef);
1839
- replyDict.set('RT', _primitives.Name.get('Group'));
1840
- replyDict.set('T', 'Reply Title');
1841
- replyDict.set('Contents', 'Reply Text');
1842
- replyDict.set('M', 'D:20190523');
1843
- replyDict.set('C', [0.4]);
1844
- var popupRef = new _primitives.Ref(821, 0);
1845
- var popupDict = new _primitives.Dict();
1846
- popupDict.set('Type', _primitives.Name.get('Annot'));
1847
- popupDict.set('Subtype', _primitives.Name.get('Popup'));
1848
- popupDict.set('T', 'Wrong Title');
1849
- popupDict.set('Contents', 'Wrong Text');
1850
- popupDict.set('Parent', replyRef);
1851
- popupDict.set('M', 'D:20190623');
1852
- popupDict.set('C', [0.8]);
1853
- replyDict.set('Popup', popupRef);
1854
- var xref = new _test_utils.XRefMock([{
1884
+ it("should correctly inherit Contents from group-master annotation " + "if parent has ReplyType == Group", function (done) {
1885
+ const annotationRef = _primitives.Ref.get(819, 0);
1886
+
1887
+ const annotationDict = new _primitives.Dict();
1888
+ annotationDict.set("Type", _primitives.Name.get("Annot"));
1889
+ annotationDict.set("Subtype", _primitives.Name.get("Text"));
1890
+ annotationDict.set("T", "Correct Title");
1891
+ annotationDict.set("Contents", "Correct Text");
1892
+ annotationDict.set("M", "D:20190423");
1893
+ annotationDict.set("C", [0, 0, 1]);
1894
+
1895
+ const replyRef = _primitives.Ref.get(820, 0);
1896
+
1897
+ const replyDict = new _primitives.Dict();
1898
+ replyDict.set("Type", _primitives.Name.get("Annot"));
1899
+ replyDict.set("Subtype", _primitives.Name.get("Text"));
1900
+ replyDict.set("IRT", annotationRef);
1901
+ replyDict.set("RT", _primitives.Name.get("Group"));
1902
+ replyDict.set("T", "Reply Title");
1903
+ replyDict.set("Contents", "Reply Text");
1904
+ replyDict.set("M", "D:20190523");
1905
+ replyDict.set("C", [0.4]);
1906
+
1907
+ const popupRef = _primitives.Ref.get(821, 0);
1908
+
1909
+ const popupDict = new _primitives.Dict();
1910
+ popupDict.set("Type", _primitives.Name.get("Annot"));
1911
+ popupDict.set("Subtype", _primitives.Name.get("Popup"));
1912
+ popupDict.set("T", "Wrong Title");
1913
+ popupDict.set("Contents", "Wrong Text");
1914
+ popupDict.set("Parent", replyRef);
1915
+ popupDict.set("M", "D:20190623");
1916
+ popupDict.set("C", [0.8]);
1917
+ replyDict.set("Popup", popupRef);
1918
+ const xref = new _test_utils.XRefMock([{
1855
1919
  ref: annotationRef,
1856
1920
  data: annotationDict
1857
1921
  }, {
@@ -1865,32 +1929,34 @@ describe('annotation', function () {
1865
1929
  popupDict.assignXref(xref);
1866
1930
  replyDict.assignXref(xref);
1867
1931
 
1868
- _annotation.AnnotationFactory.create(xref, popupRef, pdfManagerMock, idFactoryMock).then(function (_ref56) {
1869
- var data = _ref56.data;
1870
- expect(data.title).toEqual('Correct Title');
1871
- expect(data.contents).toEqual('Correct Text');
1872
- expect(data.modificationDate).toEqual('D:20190423');
1932
+ _annotation.AnnotationFactory.create(xref, popupRef, pdfManagerMock, idFactoryMock).then(({
1933
+ data
1934
+ }) => {
1935
+ expect(data.title).toEqual("Correct Title");
1936
+ expect(data.contents).toEqual("Correct Text");
1937
+ expect(data.modificationDate).toEqual("D:20190423");
1873
1938
  expect(data.color).toEqual(new Uint8ClampedArray([0, 0, 255]));
1874
1939
  done();
1875
1940
  }, done.fail);
1876
1941
  });
1877
1942
  });
1878
- describe('InkAnnotation', function () {
1879
- it('should handle a single ink list', function (done) {
1880
- var inkDict = new _primitives.Dict();
1881
- inkDict.set('Type', _primitives.Name.get('Annot'));
1882
- inkDict.set('Subtype', _primitives.Name.get('Ink'));
1883
- inkDict.set('InkList', [[1, 1, 1, 2, 2, 2, 3, 3]]);
1943
+ describe("InkAnnotation", function () {
1944
+ it("should handle a single ink list", function (done) {
1945
+ const inkDict = new _primitives.Dict();
1946
+ inkDict.set("Type", _primitives.Name.get("Annot"));
1947
+ inkDict.set("Subtype", _primitives.Name.get("Ink"));
1948
+ inkDict.set("InkList", [[1, 1, 1, 2, 2, 2, 3, 3]]);
1884
1949
 
1885
- var inkRef = _primitives.Ref.get(142, 0);
1950
+ const inkRef = _primitives.Ref.get(142, 0);
1886
1951
 
1887
- var xref = new _test_utils.XRefMock([{
1952
+ const xref = new _test_utils.XRefMock([{
1888
1953
  ref: inkRef,
1889
1954
  data: inkDict
1890
1955
  }]);
1891
1956
 
1892
- _annotation.AnnotationFactory.create(xref, inkRef, pdfManagerMock, idFactoryMock).then(function (_ref57) {
1893
- var data = _ref57.data;
1957
+ _annotation.AnnotationFactory.create(xref, inkRef, pdfManagerMock, idFactoryMock).then(({
1958
+ data
1959
+ }) => {
1894
1960
  expect(data.annotationType).toEqual(_util.AnnotationType.INK);
1895
1961
  expect(data.inkLists.length).toEqual(1);
1896
1962
  expect(data.inkLists[0]).toEqual([{
@@ -1909,21 +1975,22 @@ describe('annotation', function () {
1909
1975
  done();
1910
1976
  }, done.fail);
1911
1977
  });
1912
- it('should handle multiple ink lists', function (done) {
1913
- var inkDict = new _primitives.Dict();
1914
- inkDict.set('Type', _primitives.Name.get('Annot'));
1915
- inkDict.set('Subtype', _primitives.Name.get('Ink'));
1916
- inkDict.set('InkList', [[1, 1, 1, 2], [3, 3, 4, 5]]);
1978
+ it("should handle multiple ink lists", function (done) {
1979
+ const inkDict = new _primitives.Dict();
1980
+ inkDict.set("Type", _primitives.Name.get("Annot"));
1981
+ inkDict.set("Subtype", _primitives.Name.get("Ink"));
1982
+ inkDict.set("InkList", [[1, 1, 1, 2], [3, 3, 4, 5]]);
1917
1983
 
1918
- var inkRef = _primitives.Ref.get(143, 0);
1984
+ const inkRef = _primitives.Ref.get(143, 0);
1919
1985
 
1920
- var xref = new _test_utils.XRefMock([{
1986
+ const xref = new _test_utils.XRefMock([{
1921
1987
  ref: inkRef,
1922
1988
  data: inkDict
1923
1989
  }]);
1924
1990
 
1925
- _annotation.AnnotationFactory.create(xref, inkRef, pdfManagerMock, idFactoryMock).then(function (_ref58) {
1926
- var data = _ref58.data;
1991
+ _annotation.AnnotationFactory.create(xref, inkRef, pdfManagerMock, idFactoryMock).then(({
1992
+ data
1993
+ }) => {
1927
1994
  expect(data.annotationType).toEqual(_util.AnnotationType.INK);
1928
1995
  expect(data.inkLists.length).toEqual(2);
1929
1996
  expect(data.inkLists[0]).toEqual([{
@@ -1944,42 +2011,44 @@ describe('annotation', function () {
1944
2011
  }, done.fail);
1945
2012
  });
1946
2013
  });
1947
- describe('HightlightAnnotation', function () {
1948
- it('should not set quadpoints if not defined', function (done) {
1949
- var highlightDict = new _primitives.Dict();
1950
- highlightDict.set('Type', _primitives.Name.get('Annot'));
1951
- highlightDict.set('Subtype', _primitives.Name.get('Highlight'));
2014
+ describe("HightlightAnnotation", function () {
2015
+ it("should not set quadpoints if not defined", function (done) {
2016
+ const highlightDict = new _primitives.Dict();
2017
+ highlightDict.set("Type", _primitives.Name.get("Annot"));
2018
+ highlightDict.set("Subtype", _primitives.Name.get("Highlight"));
1952
2019
 
1953
- var highlightRef = _primitives.Ref.get(121, 0);
2020
+ const highlightRef = _primitives.Ref.get(121, 0);
1954
2021
 
1955
- var xref = new _test_utils.XRefMock([{
2022
+ const xref = new _test_utils.XRefMock([{
1956
2023
  ref: highlightRef,
1957
2024
  data: highlightDict
1958
2025
  }]);
1959
2026
 
1960
- _annotation.AnnotationFactory.create(xref, highlightRef, pdfManagerMock, idFactoryMock).then(function (_ref59) {
1961
- var data = _ref59.data;
2027
+ _annotation.AnnotationFactory.create(xref, highlightRef, pdfManagerMock, idFactoryMock).then(({
2028
+ data
2029
+ }) => {
1962
2030
  expect(data.annotationType).toEqual(_util.AnnotationType.HIGHLIGHT);
1963
2031
  expect(data.quadPoints).toBeUndefined();
1964
2032
  done();
1965
2033
  }, done.fail);
1966
2034
  });
1967
- it('should set quadpoints if defined', function (done) {
1968
- var highlightDict = new _primitives.Dict();
1969
- highlightDict.set('Type', _primitives.Name.get('Annot'));
1970
- highlightDict.set('Subtype', _primitives.Name.get('Highlight'));
1971
- highlightDict.set('Rect', [10, 10, 20, 20]);
1972
- highlightDict.set('QuadPoints', [11, 11, 12, 12, 13, 13, 14, 14]);
2035
+ it("should set quadpoints if defined", function (done) {
2036
+ const highlightDict = new _primitives.Dict();
2037
+ highlightDict.set("Type", _primitives.Name.get("Annot"));
2038
+ highlightDict.set("Subtype", _primitives.Name.get("Highlight"));
2039
+ highlightDict.set("Rect", [10, 10, 20, 20]);
2040
+ highlightDict.set("QuadPoints", [11, 11, 12, 12, 13, 13, 14, 14]);
1973
2041
 
1974
- var highlightRef = _primitives.Ref.get(121, 0);
2042
+ const highlightRef = _primitives.Ref.get(121, 0);
1975
2043
 
1976
- var xref = new _test_utils.XRefMock([{
2044
+ const xref = new _test_utils.XRefMock([{
1977
2045
  ref: highlightRef,
1978
2046
  data: highlightDict
1979
2047
  }]);
1980
2048
 
1981
- _annotation.AnnotationFactory.create(xref, highlightRef, pdfManagerMock, idFactoryMock).then(function (_ref60) {
1982
- var data = _ref60.data;
2049
+ _annotation.AnnotationFactory.create(xref, highlightRef, pdfManagerMock, idFactoryMock).then(({
2050
+ data
2051
+ }) => {
1983
2052
  expect(data.annotationType).toEqual(_util.AnnotationType.HIGHLIGHT);
1984
2053
  expect(data.quadPoints).toEqual([[{
1985
2054
  x: 11,
@@ -1998,42 +2067,44 @@ describe('annotation', function () {
1998
2067
  }, done.fail);
1999
2068
  });
2000
2069
  });
2001
- describe('UnderlineAnnotation', function () {
2002
- it('should not set quadpoints if not defined', function (done) {
2003
- var underlineDict = new _primitives.Dict();
2004
- underlineDict.set('Type', _primitives.Name.get('Annot'));
2005
- underlineDict.set('Subtype', _primitives.Name.get('Underline'));
2070
+ describe("UnderlineAnnotation", function () {
2071
+ it("should not set quadpoints if not defined", function (done) {
2072
+ const underlineDict = new _primitives.Dict();
2073
+ underlineDict.set("Type", _primitives.Name.get("Annot"));
2074
+ underlineDict.set("Subtype", _primitives.Name.get("Underline"));
2006
2075
 
2007
- var underlineRef = _primitives.Ref.get(121, 0);
2076
+ const underlineRef = _primitives.Ref.get(121, 0);
2008
2077
 
2009
- var xref = new _test_utils.XRefMock([{
2078
+ const xref = new _test_utils.XRefMock([{
2010
2079
  ref: underlineRef,
2011
2080
  data: underlineDict
2012
2081
  }]);
2013
2082
 
2014
- _annotation.AnnotationFactory.create(xref, underlineRef, pdfManagerMock, idFactoryMock).then(function (_ref61) {
2015
- var data = _ref61.data;
2083
+ _annotation.AnnotationFactory.create(xref, underlineRef, pdfManagerMock, idFactoryMock).then(({
2084
+ data
2085
+ }) => {
2016
2086
  expect(data.annotationType).toEqual(_util.AnnotationType.UNDERLINE);
2017
2087
  expect(data.quadPoints).toBeUndefined();
2018
2088
  done();
2019
2089
  }, done.fail);
2020
2090
  });
2021
- it('should set quadpoints if defined', function (done) {
2022
- var underlineDict = new _primitives.Dict();
2023
- underlineDict.set('Type', _primitives.Name.get('Annot'));
2024
- underlineDict.set('Subtype', _primitives.Name.get('Underline'));
2025
- underlineDict.set('Rect', [10, 10, 20, 20]);
2026
- underlineDict.set('QuadPoints', [11, 11, 12, 12, 13, 13, 14, 14]);
2091
+ it("should set quadpoints if defined", function (done) {
2092
+ const underlineDict = new _primitives.Dict();
2093
+ underlineDict.set("Type", _primitives.Name.get("Annot"));
2094
+ underlineDict.set("Subtype", _primitives.Name.get("Underline"));
2095
+ underlineDict.set("Rect", [10, 10, 20, 20]);
2096
+ underlineDict.set("QuadPoints", [11, 11, 12, 12, 13, 13, 14, 14]);
2027
2097
 
2028
- var underlineRef = _primitives.Ref.get(121, 0);
2098
+ const underlineRef = _primitives.Ref.get(121, 0);
2029
2099
 
2030
- var xref = new _test_utils.XRefMock([{
2100
+ const xref = new _test_utils.XRefMock([{
2031
2101
  ref: underlineRef,
2032
2102
  data: underlineDict
2033
2103
  }]);
2034
2104
 
2035
- _annotation.AnnotationFactory.create(xref, underlineRef, pdfManagerMock, idFactoryMock).then(function (_ref62) {
2036
- var data = _ref62.data;
2105
+ _annotation.AnnotationFactory.create(xref, underlineRef, pdfManagerMock, idFactoryMock).then(({
2106
+ data
2107
+ }) => {
2037
2108
  expect(data.annotationType).toEqual(_util.AnnotationType.UNDERLINE);
2038
2109
  expect(data.quadPoints).toEqual([[{
2039
2110
  x: 11,
@@ -2052,42 +2123,44 @@ describe('annotation', function () {
2052
2123
  }, done.fail);
2053
2124
  });
2054
2125
  });
2055
- describe('SquigglyAnnotation', function () {
2056
- it('should not set quadpoints if not defined', function (done) {
2057
- var squigglyDict = new _primitives.Dict();
2058
- squigglyDict.set('Type', _primitives.Name.get('Annot'));
2059
- squigglyDict.set('Subtype', _primitives.Name.get('Squiggly'));
2126
+ describe("SquigglyAnnotation", function () {
2127
+ it("should not set quadpoints if not defined", function (done) {
2128
+ const squigglyDict = new _primitives.Dict();
2129
+ squigglyDict.set("Type", _primitives.Name.get("Annot"));
2130
+ squigglyDict.set("Subtype", _primitives.Name.get("Squiggly"));
2060
2131
 
2061
- var squigglyRef = _primitives.Ref.get(121, 0);
2132
+ const squigglyRef = _primitives.Ref.get(121, 0);
2062
2133
 
2063
- var xref = new _test_utils.XRefMock([{
2134
+ const xref = new _test_utils.XRefMock([{
2064
2135
  ref: squigglyRef,
2065
2136
  data: squigglyDict
2066
2137
  }]);
2067
2138
 
2068
- _annotation.AnnotationFactory.create(xref, squigglyRef, pdfManagerMock, idFactoryMock).then(function (_ref63) {
2069
- var data = _ref63.data;
2139
+ _annotation.AnnotationFactory.create(xref, squigglyRef, pdfManagerMock, idFactoryMock).then(({
2140
+ data
2141
+ }) => {
2070
2142
  expect(data.annotationType).toEqual(_util.AnnotationType.SQUIGGLY);
2071
2143
  expect(data.quadPoints).toBeUndefined();
2072
2144
  done();
2073
2145
  }, done.fail);
2074
2146
  });
2075
- it('should set quadpoints if defined', function (done) {
2076
- var squigglyDict = new _primitives.Dict();
2077
- squigglyDict.set('Type', _primitives.Name.get('Annot'));
2078
- squigglyDict.set('Subtype', _primitives.Name.get('Squiggly'));
2079
- squigglyDict.set('Rect', [10, 10, 20, 20]);
2080
- squigglyDict.set('QuadPoints', [11, 11, 12, 12, 13, 13, 14, 14]);
2147
+ it("should set quadpoints if defined", function (done) {
2148
+ const squigglyDict = new _primitives.Dict();
2149
+ squigglyDict.set("Type", _primitives.Name.get("Annot"));
2150
+ squigglyDict.set("Subtype", _primitives.Name.get("Squiggly"));
2151
+ squigglyDict.set("Rect", [10, 10, 20, 20]);
2152
+ squigglyDict.set("QuadPoints", [11, 11, 12, 12, 13, 13, 14, 14]);
2081
2153
 
2082
- var squigglyRef = _primitives.Ref.get(121, 0);
2154
+ const squigglyRef = _primitives.Ref.get(121, 0);
2083
2155
 
2084
- var xref = new _test_utils.XRefMock([{
2156
+ const xref = new _test_utils.XRefMock([{
2085
2157
  ref: squigglyRef,
2086
2158
  data: squigglyDict
2087
2159
  }]);
2088
2160
 
2089
- _annotation.AnnotationFactory.create(xref, squigglyRef, pdfManagerMock, idFactoryMock).then(function (_ref64) {
2090
- var data = _ref64.data;
2161
+ _annotation.AnnotationFactory.create(xref, squigglyRef, pdfManagerMock, idFactoryMock).then(({
2162
+ data
2163
+ }) => {
2091
2164
  expect(data.annotationType).toEqual(_util.AnnotationType.SQUIGGLY);
2092
2165
  expect(data.quadPoints).toEqual([[{
2093
2166
  x: 11,
@@ -2106,42 +2179,44 @@ describe('annotation', function () {
2106
2179
  }, done.fail);
2107
2180
  });
2108
2181
  });
2109
- describe('StrikeOutAnnotation', function () {
2110
- it('should not set quadpoints if not defined', function (done) {
2111
- var strikeOutDict = new _primitives.Dict();
2112
- strikeOutDict.set('Type', _primitives.Name.get('Annot'));
2113
- strikeOutDict.set('Subtype', _primitives.Name.get('StrikeOut'));
2182
+ describe("StrikeOutAnnotation", function () {
2183
+ it("should not set quadpoints if not defined", function (done) {
2184
+ const strikeOutDict = new _primitives.Dict();
2185
+ strikeOutDict.set("Type", _primitives.Name.get("Annot"));
2186
+ strikeOutDict.set("Subtype", _primitives.Name.get("StrikeOut"));
2114
2187
 
2115
- var strikeOutRef = _primitives.Ref.get(121, 0);
2188
+ const strikeOutRef = _primitives.Ref.get(121, 0);
2116
2189
 
2117
- var xref = new _test_utils.XRefMock([{
2190
+ const xref = new _test_utils.XRefMock([{
2118
2191
  ref: strikeOutRef,
2119
2192
  data: strikeOutDict
2120
2193
  }]);
2121
2194
 
2122
- _annotation.AnnotationFactory.create(xref, strikeOutRef, pdfManagerMock, idFactoryMock).then(function (_ref65) {
2123
- var data = _ref65.data;
2195
+ _annotation.AnnotationFactory.create(xref, strikeOutRef, pdfManagerMock, idFactoryMock).then(({
2196
+ data
2197
+ }) => {
2124
2198
  expect(data.annotationType).toEqual(_util.AnnotationType.STRIKEOUT);
2125
2199
  expect(data.quadPoints).toBeUndefined();
2126
2200
  done();
2127
2201
  }, done.fail);
2128
2202
  });
2129
- it('should set quadpoints if defined', function (done) {
2130
- var strikeOutDict = new _primitives.Dict();
2131
- strikeOutDict.set('Type', _primitives.Name.get('Annot'));
2132
- strikeOutDict.set('Subtype', _primitives.Name.get('StrikeOut'));
2133
- strikeOutDict.set('Rect', [10, 10, 20, 20]);
2134
- strikeOutDict.set('QuadPoints', [11, 11, 12, 12, 13, 13, 14, 14]);
2203
+ it("should set quadpoints if defined", function (done) {
2204
+ const strikeOutDict = new _primitives.Dict();
2205
+ strikeOutDict.set("Type", _primitives.Name.get("Annot"));
2206
+ strikeOutDict.set("Subtype", _primitives.Name.get("StrikeOut"));
2207
+ strikeOutDict.set("Rect", [10, 10, 20, 20]);
2208
+ strikeOutDict.set("QuadPoints", [11, 11, 12, 12, 13, 13, 14, 14]);
2135
2209
 
2136
- var strikeOutRef = _primitives.Ref.get(121, 0);
2210
+ const strikeOutRef = _primitives.Ref.get(121, 0);
2137
2211
 
2138
- var xref = new _test_utils.XRefMock([{
2212
+ const xref = new _test_utils.XRefMock([{
2139
2213
  ref: strikeOutRef,
2140
2214
  data: strikeOutDict
2141
2215
  }]);
2142
2216
 
2143
- _annotation.AnnotationFactory.create(xref, strikeOutRef, pdfManagerMock, idFactoryMock).then(function (_ref66) {
2144
- var data = _ref66.data;
2217
+ _annotation.AnnotationFactory.create(xref, strikeOutRef, pdfManagerMock, idFactoryMock).then(({
2218
+ data
2219
+ }) => {
2145
2220
  expect(data.annotationType).toEqual(_util.AnnotationType.STRIKEOUT);
2146
2221
  expect(data.quadPoints).toEqual([[{
2147
2222
  x: 11,