pdfjs-dist 2.0.489 → 2.2.228

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 (169) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/bower.json +1 -1
  3. package/build/pdf.js +18515 -11402
  4. package/build/pdf.js.map +1 -1
  5. package/build/pdf.min.js +1 -1
  6. package/build/pdf.worker.js +48266 -37137
  7. package/build/pdf.worker.js.map +1 -1
  8. package/build/pdf.worker.min.js +1 -1
  9. package/external/url/url-lib.js +627 -0
  10. package/image_decoders/pdf.image_decoders.js +11350 -0
  11. package/image_decoders/pdf.image_decoders.js.map +1 -0
  12. package/image_decoders/pdf.image_decoders.min.js +1 -0
  13. package/lib/core/annotation.js +587 -242
  14. package/lib/core/arithmetic_decoder.js +275 -245
  15. package/lib/core/bidi.js +65 -6
  16. package/lib/core/ccitt.js +173 -18
  17. package/lib/core/ccitt_stream.js +15 -6
  18. package/lib/core/cff_parser.js +433 -61
  19. package/lib/core/charsets.js +5 -4
  20. package/lib/core/chunked_stream.js +400 -152
  21. package/lib/core/cmap.js +326 -87
  22. package/lib/core/colorspace.js +874 -594
  23. package/lib/core/core_utils.js +147 -0
  24. package/lib/core/crypto.js +290 -45
  25. package/lib/core/document.js +560 -268
  26. package/lib/core/encodings.js +19 -10
  27. package/lib/core/evaluator.js +1005 -360
  28. package/lib/core/font_renderer.js +331 -97
  29. package/lib/core/fonts.js +812 -195
  30. package/lib/core/function.js +284 -71
  31. package/lib/core/glyphlist.js +4 -3
  32. package/lib/core/image.js +169 -62
  33. package/lib/core/image_utils.js +111 -0
  34. package/lib/core/jbig2.js +479 -66
  35. package/lib/core/jbig2_stream.js +19 -8
  36. package/lib/core/jpeg_stream.js +38 -13
  37. package/lib/core/jpg.js +253 -29
  38. package/lib/core/jpx.js +396 -6
  39. package/lib/core/jpx_stream.js +18 -6
  40. package/lib/core/metrics.js +15 -15
  41. package/lib/core/murmurhash3.js +56 -34
  42. package/lib/core/obj.js +1354 -488
  43. package/lib/core/operator_list.js +144 -31
  44. package/lib/core/parser.js +539 -191
  45. package/lib/core/pattern.js +148 -14
  46. package/lib/core/pdf_manager.js +323 -133
  47. package/lib/core/primitives.js +111 -24
  48. package/lib/core/ps_parser.js +134 -45
  49. package/lib/core/standard_fonts.js +17 -17
  50. package/lib/core/stream.js +313 -34
  51. package/lib/core/type1_parser.js +143 -13
  52. package/lib/core/unicode.js +32 -5
  53. package/lib/core/worker.js +217 -190
  54. package/lib/core/worker_stream.js +277 -0
  55. package/lib/display/annotation_layer.js +450 -133
  56. package/lib/display/api.js +1597 -784
  57. package/lib/display/api_compatibility.js +11 -13
  58. package/lib/display/canvas.js +360 -44
  59. package/lib/display/content_disposition.js +83 -32
  60. package/lib/display/display_utils.js +747 -0
  61. package/lib/display/fetch_stream.js +221 -90
  62. package/lib/display/font_loader.js +468 -236
  63. package/lib/display/metadata.js +38 -16
  64. package/lib/display/network.js +635 -428
  65. package/lib/display/network_utils.js +32 -19
  66. package/lib/display/node_stream.js +367 -175
  67. package/lib/display/pattern_helper.js +81 -31
  68. package/lib/display/svg.js +1235 -519
  69. package/lib/display/text_layer.js +153 -29
  70. package/lib/display/transport_stream.js +345 -94
  71. package/lib/display/webgl.js +64 -18
  72. package/lib/display/worker_options.js +5 -4
  73. package/lib/display/xml_parser.js +166 -53
  74. package/lib/examples/node/domstubs.js +60 -4
  75. package/lib/pdf.js +36 -14
  76. package/lib/pdf.worker.js +5 -3
  77. package/lib/shared/compatibility.js +158 -564
  78. package/lib/shared/global_scope.js +2 -2
  79. package/lib/shared/is_node.js +4 -4
  80. package/lib/shared/message_handler.js +521 -0
  81. package/lib/shared/streams_polyfill.js +21 -17
  82. package/lib/shared/url_polyfill.js +56 -0
  83. package/lib/shared/util.js +243 -710
  84. package/lib/test/unit/annotation_spec.js +870 -401
  85. package/lib/test/unit/api_spec.js +657 -345
  86. package/lib/test/unit/bidi_spec.js +7 -7
  87. package/lib/test/unit/cff_parser_spec.js +54 -11
  88. package/lib/test/unit/clitests_helper.js +10 -8
  89. package/lib/test/unit/cmap_spec.js +95 -41
  90. package/lib/test/unit/colorspace_spec.js +115 -63
  91. package/lib/test/unit/core_utils_spec.js +191 -0
  92. package/lib/test/unit/crypto_spec.js +17 -5
  93. package/lib/test/unit/custom_spec.js +43 -55
  94. package/lib/test/unit/display_svg_spec.js +34 -18
  95. package/lib/test/unit/display_utils_spec.js +273 -0
  96. package/lib/test/unit/document_spec.js +8 -13
  97. package/lib/test/unit/encodings_spec.js +25 -45
  98. package/lib/test/unit/evaluator_spec.js +38 -15
  99. package/lib/test/unit/fetch_stream_spec.js +109 -0
  100. package/lib/test/unit/function_spec.js +17 -5
  101. package/lib/test/unit/jasmine-boot.js +33 -20
  102. package/lib/test/unit/{util_stream_spec.js → message_handler_spec.js} +41 -69
  103. package/lib/test/unit/metadata_spec.js +71 -11
  104. package/lib/test/unit/murmurhash3_spec.js +3 -3
  105. package/lib/test/unit/network_spec.js +19 -54
  106. package/lib/test/unit/network_utils_spec.js +91 -14
  107. package/lib/test/unit/node_stream_spec.js +56 -32
  108. package/lib/test/unit/parser_spec.js +162 -71
  109. package/lib/test/unit/pdf_find_controller_spec.js +230 -0
  110. package/lib/test/unit/pdf_find_utils_spec.js +63 -0
  111. package/lib/test/unit/pdf_history_spec.js +21 -9
  112. package/lib/test/unit/primitives_spec.js +53 -20
  113. package/lib/test/unit/stream_spec.js +12 -4
  114. package/lib/test/unit/test_utils.js +273 -56
  115. package/lib/test/unit/testreporter.js +21 -3
  116. package/lib/test/unit/type1_parser_spec.js +8 -6
  117. package/lib/test/unit/ui_utils_spec.js +454 -16
  118. package/lib/test/unit/unicode_spec.js +18 -15
  119. package/lib/test/unit/util_spec.js +87 -128
  120. package/lib/web/annotation_layer_builder.js +39 -22
  121. package/lib/web/app.js +1290 -588
  122. package/lib/web/app_options.js +100 -62
  123. package/lib/web/base_viewer.js +511 -182
  124. package/lib/web/chromecom.js +261 -117
  125. package/lib/web/debugger.js +166 -22
  126. package/lib/web/download_manager.js +32 -13
  127. package/lib/web/firefox_print_service.js +20 -10
  128. package/lib/web/firefoxcom.js +315 -80
  129. package/lib/web/genericcom.js +89 -30
  130. package/lib/web/genericl10n.js +142 -30
  131. package/lib/web/grab_to_pan.js +28 -4
  132. package/lib/web/interfaces.js +170 -47
  133. package/lib/web/overlay_manager.js +235 -85
  134. package/lib/web/password_prompt.js +22 -14
  135. package/lib/web/pdf_attachment_viewer.js +38 -18
  136. package/lib/web/pdf_cursor_tools.js +39 -16
  137. package/lib/web/pdf_document_properties.js +255 -136
  138. package/lib/web/pdf_find_bar.js +84 -40
  139. package/lib/web/pdf_find_controller.js +495 -184
  140. package/lib/web/pdf_find_utils.js +111 -0
  141. package/lib/web/pdf_history.js +190 -53
  142. package/lib/web/pdf_link_service.js +138 -77
  143. package/lib/web/pdf_outline_viewer.js +122 -46
  144. package/lib/web/pdf_page_view.js +191 -67
  145. package/lib/web/pdf_presentation_mode.js +99 -34
  146. package/lib/web/pdf_print_service.js +61 -13
  147. package/lib/web/pdf_rendering_queue.js +28 -9
  148. package/lib/web/pdf_sidebar.js +141 -81
  149. package/lib/web/pdf_sidebar_resizer.js +42 -16
  150. package/lib/web/pdf_single_page_viewer.js +74 -66
  151. package/lib/web/pdf_thumbnail_view.js +104 -33
  152. package/lib/web/pdf_thumbnail_viewer.js +66 -26
  153. package/lib/web/pdf_viewer.component.js +112 -32
  154. package/lib/web/pdf_viewer.js +91 -52
  155. package/lib/web/preferences.js +284 -89
  156. package/lib/web/secondary_toolbar.js +165 -40
  157. package/lib/web/text_layer_builder.js +134 -59
  158. package/lib/web/toolbar.js +78 -43
  159. package/lib/web/ui_utils.js +462 -136
  160. package/lib/web/view_history.js +215 -67
  161. package/lib/web/viewer_compatibility.js +4 -13
  162. package/package.json +5 -4
  163. package/web/pdf_viewer.css +79 -11
  164. package/web/pdf_viewer.js +6107 -3748
  165. package/web/pdf_viewer.js.map +1 -1
  166. package/lib/display/dom_utils.js +0 -309
  167. package/lib/test/unit/dom_utils_spec.js +0 -89
  168. package/lib/test/unit/fonts_spec.js +0 -81
  169. package/lib/web/dom_events.js +0 -137
@@ -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 2017 Mozilla Foundation
5
+ * Copyright 2019 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.
@@ -19,109 +19,161 @@
19
19
  * @licend The above is the entire license notice for the
20
20
  * Javascript code in this page
21
21
  */
22
- 'use strict';
22
+ "use strict";
23
23
 
24
24
  Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
- exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = undefined;
27
+ exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
28
28
 
29
- var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
29
+ var _util = require("../shared/util");
30
30
 
31
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
31
+ var _obj = require("./obj");
32
32
 
33
- var _util = require('../shared/util');
33
+ var _primitives = require("./primitives");
34
34
 
35
- var _obj = require('./obj');
35
+ var _colorspace = require("./colorspace");
36
36
 
37
- var _primitives = require('./primitives');
37
+ var _core_utils = require("./core_utils");
38
38
 
39
- var _colorspace = require('./colorspace');
39
+ var _operator_list = require("./operator_list");
40
40
 
41
- var _operator_list = require('./operator_list');
41
+ var _stream = require("./stream");
42
42
 
43
- var _stream = require('./stream');
43
+ function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
44
44
 
45
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
45
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
46
46
 
47
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
47
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
48
+
49
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
50
+
51
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
52
+
53
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
54
+
55
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
56
+
57
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
48
58
 
49
59
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
50
60
 
51
- var AnnotationFactory = function () {
61
+ 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); } }
62
+
63
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
64
+
65
+ var AnnotationFactory =
66
+ /*#__PURE__*/
67
+ function () {
52
68
  function AnnotationFactory() {
53
69
  _classCallCheck(this, AnnotationFactory);
54
70
  }
55
71
 
56
72
  _createClass(AnnotationFactory, null, [{
57
- key: 'create',
73
+ key: "create",
58
74
  value: function create(xref, ref, pdfManager, idFactory) {
75
+ return pdfManager.ensure(this, '_create', [xref, ref, pdfManager, idFactory]);
76
+ }
77
+ }, {
78
+ key: "_create",
79
+ value: function _create(xref, ref, pdfManager, idFactory) {
59
80
  var dict = xref.fetchIfRef(ref);
81
+
60
82
  if (!(0, _primitives.isDict)(dict)) {
61
- return;
83
+ return undefined;
62
84
  }
63
- var id = (0, _primitives.isRef)(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
85
+
86
+ var id = (0, _primitives.isRef)(ref) ? ref.toString() : "annot_".concat(idFactory.createObjId());
64
87
  var subtype = dict.get('Subtype');
65
88
  subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
66
89
  var parameters = {
67
90
  xref: xref,
68
91
  dict: dict,
69
- ref: (0, _primitives.isRef)(ref) ? ref : null,
70
92
  subtype: subtype,
71
93
  id: id,
72
94
  pdfManager: pdfManager
73
95
  };
96
+
74
97
  switch (subtype) {
75
98
  case 'Link':
76
99
  return new LinkAnnotation(parameters);
100
+
77
101
  case 'Text':
78
102
  return new TextAnnotation(parameters);
103
+
79
104
  case 'Widget':
80
- var fieldType = (0, _util.getInheritableProperty)({
105
+ var fieldType = (0, _core_utils.getInheritableProperty)({
81
106
  dict: dict,
82
107
  key: 'FT'
83
108
  });
84
109
  fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
110
+
85
111
  switch (fieldType) {
86
112
  case 'Tx':
87
113
  return new TextWidgetAnnotation(parameters);
114
+
88
115
  case 'Btn':
89
116
  return new ButtonWidgetAnnotation(parameters);
117
+
90
118
  case 'Ch':
91
119
  return new ChoiceWidgetAnnotation(parameters);
92
120
  }
121
+
93
122
  (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
94
123
  return new WidgetAnnotation(parameters);
124
+
95
125
  case 'Popup':
96
126
  return new PopupAnnotation(parameters);
127
+
128
+ case 'FreeText':
129
+ return new FreeTextAnnotation(parameters);
130
+
97
131
  case 'Line':
98
132
  return new LineAnnotation(parameters);
133
+
99
134
  case 'Square':
100
135
  return new SquareAnnotation(parameters);
136
+
101
137
  case 'Circle':
102
138
  return new CircleAnnotation(parameters);
139
+
103
140
  case 'PolyLine':
104
141
  return new PolylineAnnotation(parameters);
142
+
105
143
  case 'Polygon':
106
144
  return new PolygonAnnotation(parameters);
145
+
146
+ case 'Caret':
147
+ return new CaretAnnotation(parameters);
148
+
149
+ case 'Ink':
150
+ return new InkAnnotation(parameters);
151
+
107
152
  case 'Highlight':
108
153
  return new HighlightAnnotation(parameters);
154
+
109
155
  case 'Underline':
110
156
  return new UnderlineAnnotation(parameters);
157
+
111
158
  case 'Squiggly':
112
159
  return new SquigglyAnnotation(parameters);
160
+
113
161
  case 'StrikeOut':
114
162
  return new StrikeOutAnnotation(parameters);
163
+
115
164
  case 'Stamp':
116
165
  return new StampAnnotation(parameters);
166
+
117
167
  case 'FileAttachment':
118
168
  return new FileAttachmentAnnotation(parameters);
169
+
119
170
  default:
120
171
  if (!subtype) {
121
172
  (0, _util.warn)('Annotation is missing the required /Subtype.');
122
173
  } else {
123
174
  (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
124
175
  }
176
+
125
177
  return new Annotation(parameters);
126
178
  }
127
179
  }
@@ -130,25 +182,34 @@ var AnnotationFactory = function () {
130
182
  return AnnotationFactory;
131
183
  }();
132
184
 
185
+ exports.AnnotationFactory = AnnotationFactory;
186
+
133
187
  function getTransformMatrix(rect, bbox, matrix) {
134
188
  var bounds = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
189
+
135
190
  var minX = bounds[0];
136
191
  var minY = bounds[1];
137
192
  var maxX = bounds[2];
138
193
  var maxY = bounds[3];
194
+
139
195
  if (minX === maxX || minY === maxY) {
140
196
  return [1, 0, 0, 1, rect[0], rect[1]];
141
197
  }
198
+
142
199
  var xRatio = (rect[2] - rect[0]) / (maxX - minX);
143
200
  var yRatio = (rect[3] - rect[1]) / (maxY - minY);
144
201
  return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
145
202
  }
146
203
 
147
- var Annotation = function () {
204
+ var Annotation =
205
+ /*#__PURE__*/
206
+ function () {
148
207
  function Annotation(params) {
149
208
  _classCallCheck(this, Annotation);
150
209
 
151
210
  var dict = params.dict;
211
+ this.setContents(dict.get('Contents'));
212
+ this.setModificationDate(dict.get('M'));
152
213
  this.setFlags(dict.get('F'));
153
214
  this.setRectangle(dict.getArray('Rect'));
154
215
  this.setColor(dict.getArray('C'));
@@ -158,40 +219,52 @@ var Annotation = function () {
158
219
  annotationFlags: this.flags,
159
220
  borderStyle: this.borderStyle,
160
221
  color: this.color,
222
+ contents: this.contents,
161
223
  hasAppearance: !!this.appearance,
162
224
  id: params.id,
225
+ modificationDate: this.modificationDate,
163
226
  rect: this.rectangle,
164
227
  subtype: params.subtype
165
228
  };
166
229
  }
167
230
 
168
231
  _createClass(Annotation, [{
169
- key: '_hasFlag',
232
+ key: "_hasFlag",
170
233
  value: function _hasFlag(flags, flag) {
171
234
  return !!(flags & flag);
172
235
  }
173
236
  }, {
174
- key: '_isViewable',
237
+ key: "_isViewable",
175
238
  value: function _isViewable(flags) {
176
239
  return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
177
240
  }
178
241
  }, {
179
- key: '_isPrintable',
242
+ key: "_isPrintable",
180
243
  value: function _isPrintable(flags) {
181
244
  return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN);
182
245
  }
183
246
  }, {
184
- key: 'setFlags',
247
+ key: "setContents",
248
+ value: function setContents(contents) {
249
+ this.contents = (0, _util.stringToPDFString)(contents || '');
250
+ }
251
+ }, {
252
+ key: "setModificationDate",
253
+ value: function setModificationDate(modificationDate) {
254
+ this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
255
+ }
256
+ }, {
257
+ key: "setFlags",
185
258
  value: function setFlags(flags) {
186
259
  this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
187
260
  }
188
261
  }, {
189
- key: 'hasFlag',
262
+ key: "hasFlag",
190
263
  value: function hasFlag(flag) {
191
264
  return this._hasFlag(this.flags, flag);
192
265
  }
193
266
  }, {
194
- key: 'setRectangle',
267
+ key: "setRectangle",
195
268
  value: function setRectangle(rectangle) {
196
269
  if (Array.isArray(rectangle) && rectangle.length === 4) {
197
270
  this.rectangle = _util.Util.normalizeRect(rectangle);
@@ -200,55 +273,69 @@ var Annotation = function () {
200
273
  }
201
274
  }
202
275
  }, {
203
- key: 'setColor',
276
+ key: "setColor",
204
277
  value: function setColor(color) {
205
- var rgbColor = new Uint8Array(3);
278
+ var rgbColor = new Uint8ClampedArray(3);
279
+
206
280
  if (!Array.isArray(color)) {
207
281
  this.color = rgbColor;
208
282
  return;
209
283
  }
284
+
210
285
  switch (color.length) {
211
286
  case 0:
212
287
  this.color = null;
213
288
  break;
289
+
214
290
  case 1:
215
291
  _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
292
+
216
293
  this.color = rgbColor;
217
294
  break;
295
+
218
296
  case 3:
219
297
  _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
298
+
220
299
  this.color = rgbColor;
221
300
  break;
301
+
222
302
  case 4:
223
303
  _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
304
+
224
305
  this.color = rgbColor;
225
306
  break;
307
+
226
308
  default:
227
309
  this.color = rgbColor;
228
310
  break;
229
311
  }
230
312
  }
231
313
  }, {
232
- key: 'setBorderStyle',
314
+ key: "setBorderStyle",
233
315
  value: function setBorderStyle(borderStyle) {
234
316
  this.borderStyle = new AnnotationBorderStyle();
317
+
235
318
  if (!(0, _primitives.isDict)(borderStyle)) {
236
319
  return;
237
320
  }
321
+
238
322
  if (borderStyle.has('BS')) {
239
323
  var dict = borderStyle.get('BS');
240
324
  var dictType = dict.get('Type');
325
+
241
326
  if (!dictType || (0, _primitives.isName)(dictType, 'Border')) {
242
- this.borderStyle.setWidth(dict.get('W'));
327
+ this.borderStyle.setWidth(dict.get('W'), this.rectangle);
243
328
  this.borderStyle.setStyle(dict.get('S'));
244
329
  this.borderStyle.setDashArray(dict.getArray('D'));
245
330
  }
246
331
  } else if (borderStyle.has('Border')) {
247
332
  var array = borderStyle.getArray('Border');
333
+
248
334
  if (Array.isArray(array) && array.length >= 3) {
249
335
  this.borderStyle.setHorizontalCornerRadius(array[0]);
250
336
  this.borderStyle.setVerticalCornerRadius(array[1]);
251
- this.borderStyle.setWidth(array[2]);
337
+ this.borderStyle.setWidth(array[2], this.rectangle);
338
+
252
339
  if (array.length === 4) {
253
340
  this.borderStyle.setDashArray(array[3]);
254
341
  }
@@ -258,44 +345,42 @@ var Annotation = function () {
258
345
  }
259
346
  }
260
347
  }, {
261
- key: 'setAppearance',
348
+ key: "setAppearance",
262
349
  value: function setAppearance(dict) {
263
350
  this.appearance = null;
264
351
  var appearanceStates = dict.get('AP');
352
+
265
353
  if (!(0, _primitives.isDict)(appearanceStates)) {
266
354
  return;
267
355
  }
356
+
268
357
  var normalAppearanceState = appearanceStates.get('N');
358
+
269
359
  if ((0, _primitives.isStream)(normalAppearanceState)) {
270
360
  this.appearance = normalAppearanceState;
271
361
  return;
272
362
  }
363
+
273
364
  if (!(0, _primitives.isDict)(normalAppearanceState)) {
274
365
  return;
275
366
  }
367
+
276
368
  var as = dict.get('AS');
369
+
277
370
  if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
278
371
  return;
279
372
  }
373
+
280
374
  this.appearance = normalAppearanceState.get(as.name);
281
375
  }
282
376
  }, {
283
- key: '_preparePopup',
284
- value: function _preparePopup(dict) {
285
- if (!dict.has('C')) {
286
- this.data.color = null;
287
- }
288
- this.data.hasPopup = dict.has('Popup');
289
- this.data.title = (0, _util.stringToPDFString)(dict.get('T') || '');
290
- this.data.contents = (0, _util.stringToPDFString)(dict.get('Contents') || '');
291
- }
292
- }, {
293
- key: 'loadResources',
377
+ key: "loadResources",
294
378
  value: function loadResources(keys) {
295
379
  return this.appearance.dict.getAsync('Resources').then(function (resources) {
296
380
  if (!resources) {
297
- return;
381
+ return undefined;
298
382
  }
383
+
299
384
  var objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);
300
385
  return objectLoader.load().then(function () {
301
386
  return resources;
@@ -303,13 +388,14 @@ var Annotation = function () {
303
388
  });
304
389
  }
305
390
  }, {
306
- key: 'getOperatorList',
391
+ key: "getOperatorList",
307
392
  value: function getOperatorList(evaluator, task, renderForms) {
308
393
  var _this = this;
309
394
 
310
395
  if (!this.appearance) {
311
396
  return Promise.resolve(new _operator_list.OperatorList());
312
397
  }
398
+
313
399
  var data = this.data;
314
400
  var appearanceDict = this.appearance.dict;
315
401
  var resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']);
@@ -326,25 +412,29 @@ var Annotation = function () {
326
412
  operatorList: opList
327
413
  }).then(function () {
328
414
  opList.addOp(_util.OPS.endAnnotation, []);
415
+
329
416
  _this.appearance.reset();
417
+
330
418
  return opList;
331
419
  });
332
420
  });
333
421
  }
334
422
  }, {
335
- key: 'viewable',
423
+ key: "viewable",
336
424
  get: function get() {
337
425
  if (this.flags === 0) {
338
426
  return true;
339
427
  }
428
+
340
429
  return this._isViewable(this.flags);
341
430
  }
342
431
  }, {
343
- key: 'printable',
432
+ key: "printable",
344
433
  get: function get() {
345
434
  if (this.flags === 0) {
346
435
  return false;
347
436
  }
437
+
348
438
  return this._isPrintable(this.flags);
349
439
  }
350
440
  }]);
@@ -352,7 +442,11 @@ var Annotation = function () {
352
442
  return Annotation;
353
443
  }();
354
444
 
355
- var AnnotationBorderStyle = function () {
445
+ exports.Annotation = Annotation;
446
+
447
+ var AnnotationBorderStyle =
448
+ /*#__PURE__*/
449
+ function () {
356
450
  function AnnotationBorderStyle() {
357
451
  _classCallCheck(this, AnnotationBorderStyle);
358
452
 
@@ -364,47 +458,72 @@ var AnnotationBorderStyle = function () {
364
458
  }
365
459
 
366
460
  _createClass(AnnotationBorderStyle, [{
367
- key: 'setWidth',
461
+ key: "setWidth",
368
462
  value: function setWidth(width) {
463
+ var rect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0];
464
+
465
+ if ((0, _primitives.isName)(width)) {
466
+ this.width = 0;
467
+ return;
468
+ }
469
+
369
470
  if (Number.isInteger(width)) {
471
+ if (width > 0) {
472
+ var maxWidth = (rect[2] - rect[0]) / 2;
473
+ var maxHeight = (rect[3] - rect[1]) / 2;
474
+
475
+ if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
476
+ (0, _util.warn)("AnnotationBorderStyle.setWidth - ignoring width: ".concat(width));
477
+ width = 1;
478
+ }
479
+ }
480
+
370
481
  this.width = width;
371
482
  }
372
483
  }
373
484
  }, {
374
- key: 'setStyle',
485
+ key: "setStyle",
375
486
  value: function setStyle(style) {
376
- if (!style) {
487
+ if (!(0, _primitives.isName)(style)) {
377
488
  return;
378
489
  }
490
+
379
491
  switch (style.name) {
380
492
  case 'S':
381
493
  this.style = _util.AnnotationBorderStyleType.SOLID;
382
494
  break;
495
+
383
496
  case 'D':
384
497
  this.style = _util.AnnotationBorderStyleType.DASHED;
385
498
  break;
499
+
386
500
  case 'B':
387
501
  this.style = _util.AnnotationBorderStyleType.BEVELED;
388
502
  break;
503
+
389
504
  case 'I':
390
505
  this.style = _util.AnnotationBorderStyleType.INSET;
391
506
  break;
507
+
392
508
  case 'U':
393
509
  this.style = _util.AnnotationBorderStyleType.UNDERLINE;
394
510
  break;
511
+
395
512
  default:
396
513
  break;
397
514
  }
398
515
  }
399
516
  }, {
400
- key: 'setDashArray',
517
+ key: "setDashArray",
401
518
  value: function setDashArray(dashArray) {
402
519
  if (Array.isArray(dashArray) && dashArray.length > 0) {
403
520
  var isValid = true;
404
521
  var allZeros = true;
522
+
405
523
  for (var i = 0, len = dashArray.length; i < len; i++) {
406
524
  var element = dashArray[i];
407
525
  var validNumber = +element >= 0;
526
+
408
527
  if (!validNumber) {
409
528
  isValid = false;
410
529
  break;
@@ -412,6 +531,7 @@ var AnnotationBorderStyle = function () {
412
531
  allZeros = false;
413
532
  }
414
533
  }
534
+
415
535
  if (isValid && !allZeros) {
416
536
  this.dashArray = dashArray;
417
537
  } else {
@@ -422,14 +542,14 @@ var AnnotationBorderStyle = function () {
422
542
  }
423
543
  }
424
544
  }, {
425
- key: 'setHorizontalCornerRadius',
545
+ key: "setHorizontalCornerRadius",
426
546
  value: function setHorizontalCornerRadius(radius) {
427
547
  if (Number.isInteger(radius)) {
428
548
  this.horizontalCornerRadius = radius;
429
549
  }
430
550
  }
431
551
  }, {
432
- key: 'setVerticalCornerRadius',
552
+ key: "setVerticalCornerRadius",
433
553
  value: function setVerticalCornerRadius(radius) {
434
554
  if (Number.isInteger(radius)) {
435
555
  this.verticalCornerRadius = radius;
@@ -440,136 +560,203 @@ var AnnotationBorderStyle = function () {
440
560
  return AnnotationBorderStyle;
441
561
  }();
442
562
 
443
- var WidgetAnnotation = function (_Annotation) {
444
- _inherits(WidgetAnnotation, _Annotation);
563
+ exports.AnnotationBorderStyle = AnnotationBorderStyle;
564
+
565
+ var MarkupAnnotation =
566
+ /*#__PURE__*/
567
+ function (_Annotation) {
568
+ _inherits(MarkupAnnotation, _Annotation);
569
+
570
+ function MarkupAnnotation(parameters) {
571
+ var _this2;
572
+
573
+ _classCallCheck(this, MarkupAnnotation);
574
+
575
+ _this2 = _possibleConstructorReturn(this, _getPrototypeOf(MarkupAnnotation).call(this, parameters));
576
+ var dict = parameters.dict;
577
+
578
+ if (!dict.has('C')) {
579
+ _this2.data.color = null;
580
+ }
581
+
582
+ _this2.setCreationDate(dict.get('CreationDate'));
583
+
584
+ _this2.data.creationDate = _this2.creationDate;
585
+ _this2.data.hasPopup = dict.has('Popup');
586
+ _this2.data.title = (0, _util.stringToPDFString)(dict.get('T') || '');
587
+ return _this2;
588
+ }
589
+
590
+ _createClass(MarkupAnnotation, [{
591
+ key: "setCreationDate",
592
+ value: function setCreationDate(creationDate) {
593
+ this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
594
+ }
595
+ }]);
596
+
597
+ return MarkupAnnotation;
598
+ }(Annotation);
599
+
600
+ exports.MarkupAnnotation = MarkupAnnotation;
601
+
602
+ var WidgetAnnotation =
603
+ /*#__PURE__*/
604
+ function (_Annotation2) {
605
+ _inherits(WidgetAnnotation, _Annotation2);
445
606
 
446
607
  function WidgetAnnotation(params) {
447
- _classCallCheck(this, WidgetAnnotation);
608
+ var _this3;
448
609
 
449
- var _this2 = _possibleConstructorReturn(this, (WidgetAnnotation.__proto__ || Object.getPrototypeOf(WidgetAnnotation)).call(this, params));
610
+ _classCallCheck(this, WidgetAnnotation);
450
611
 
612
+ _this3 = _possibleConstructorReturn(this, _getPrototypeOf(WidgetAnnotation).call(this, params));
451
613
  var dict = params.dict;
452
- var data = _this2.data;
614
+ var data = _this3.data;
453
615
  data.annotationType = _util.AnnotationType.WIDGET;
454
- data.fieldName = _this2._constructFieldName(dict);
455
- data.fieldValue = (0, _util.getInheritableProperty)({
616
+ data.fieldName = _this3._constructFieldName(dict);
617
+ data.fieldValue = (0, _core_utils.getInheritableProperty)({
456
618
  dict: dict,
457
619
  key: 'V',
458
620
  getArray: true
459
621
  });
460
622
  data.alternativeText = (0, _util.stringToPDFString)(dict.get('TU') || '');
461
- data.defaultAppearance = (0, _util.getInheritableProperty)({
623
+ data.defaultAppearance = (0, _core_utils.getInheritableProperty)({
462
624
  dict: dict,
463
625
  key: 'DA'
464
626
  }) || '';
465
- var fieldType = (0, _util.getInheritableProperty)({
627
+ var fieldType = (0, _core_utils.getInheritableProperty)({
466
628
  dict: dict,
467
629
  key: 'FT'
468
630
  });
469
631
  data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
470
- _this2.fieldResources = (0, _util.getInheritableProperty)({
632
+ _this3.fieldResources = (0, _core_utils.getInheritableProperty)({
471
633
  dict: dict,
472
634
  key: 'DR'
473
635
  }) || _primitives.Dict.empty;
474
- data.fieldFlags = (0, _util.getInheritableProperty)({
636
+ data.fieldFlags = (0, _core_utils.getInheritableProperty)({
475
637
  dict: dict,
476
638
  key: 'Ff'
477
639
  });
640
+
478
641
  if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
479
642
  data.fieldFlags = 0;
480
643
  }
481
- data.readOnly = _this2.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
644
+
645
+ data.readOnly = _this3.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
646
+
482
647
  if (data.fieldType === 'Sig') {
483
- _this2.setFlags(_util.AnnotationFlag.HIDDEN);
648
+ data.fieldValue = null;
649
+
650
+ _this3.setFlags(_util.AnnotationFlag.HIDDEN);
484
651
  }
485
- return _this2;
652
+
653
+ return _this3;
486
654
  }
487
655
 
488
656
  _createClass(WidgetAnnotation, [{
489
- key: '_constructFieldName',
657
+ key: "_constructFieldName",
490
658
  value: function _constructFieldName(dict) {
491
659
  if (!dict.has('T') && !dict.has('Parent')) {
492
660
  (0, _util.warn)('Unknown field name, falling back to empty field name.');
493
661
  return '';
494
662
  }
663
+
495
664
  if (!dict.has('Parent')) {
496
665
  return (0, _util.stringToPDFString)(dict.get('T'));
497
666
  }
667
+
498
668
  var fieldName = [];
669
+
499
670
  if (dict.has('T')) {
500
671
  fieldName.unshift((0, _util.stringToPDFString)(dict.get('T')));
501
672
  }
673
+
502
674
  var loopDict = dict;
675
+
503
676
  while (loopDict.has('Parent')) {
504
677
  loopDict = loopDict.get('Parent');
678
+
505
679
  if (!(0, _primitives.isDict)(loopDict)) {
506
680
  break;
507
681
  }
682
+
508
683
  if (loopDict.has('T')) {
509
684
  fieldName.unshift((0, _util.stringToPDFString)(loopDict.get('T')));
510
685
  }
511
686
  }
687
+
512
688
  return fieldName.join('.');
513
689
  }
514
690
  }, {
515
- key: 'hasFieldFlag',
691
+ key: "hasFieldFlag",
516
692
  value: function hasFieldFlag(flag) {
517
693
  return !!(this.data.fieldFlags & flag);
518
694
  }
519
695
  }, {
520
- key: 'getOperatorList',
696
+ key: "getOperatorList",
521
697
  value: function getOperatorList(evaluator, task, renderForms) {
522
698
  if (renderForms) {
523
699
  return Promise.resolve(new _operator_list.OperatorList());
524
700
  }
525
- return _get(WidgetAnnotation.prototype.__proto__ || Object.getPrototypeOf(WidgetAnnotation.prototype), 'getOperatorList', this).call(this, evaluator, task, renderForms);
701
+
702
+ return _get(_getPrototypeOf(WidgetAnnotation.prototype), "getOperatorList", this).call(this, evaluator, task, renderForms);
526
703
  }
527
704
  }]);
528
705
 
529
706
  return WidgetAnnotation;
530
707
  }(Annotation);
531
708
 
532
- var TextWidgetAnnotation = function (_WidgetAnnotation) {
709
+ var TextWidgetAnnotation =
710
+ /*#__PURE__*/
711
+ function (_WidgetAnnotation) {
533
712
  _inherits(TextWidgetAnnotation, _WidgetAnnotation);
534
713
 
535
714
  function TextWidgetAnnotation(params) {
536
- _classCallCheck(this, TextWidgetAnnotation);
715
+ var _this4;
537
716
 
538
- var _this3 = _possibleConstructorReturn(this, (TextWidgetAnnotation.__proto__ || Object.getPrototypeOf(TextWidgetAnnotation)).call(this, params));
717
+ _classCallCheck(this, TextWidgetAnnotation);
539
718
 
719
+ _this4 = _possibleConstructorReturn(this, _getPrototypeOf(TextWidgetAnnotation).call(this, params));
540
720
  var dict = params.dict;
541
- _this3.data.fieldValue = (0, _util.stringToPDFString)(_this3.data.fieldValue || '');
542
- var alignment = (0, _util.getInheritableProperty)({
721
+ _this4.data.fieldValue = (0, _util.stringToPDFString)(_this4.data.fieldValue || '');
722
+ var alignment = (0, _core_utils.getInheritableProperty)({
543
723
  dict: dict,
544
724
  key: 'Q'
545
725
  });
726
+
546
727
  if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
547
728
  alignment = null;
548
729
  }
549
- _this3.data.textAlignment = alignment;
550
- var maximumLength = (0, _util.getInheritableProperty)({
730
+
731
+ _this4.data.textAlignment = alignment;
732
+ var maximumLength = (0, _core_utils.getInheritableProperty)({
551
733
  dict: dict,
552
734
  key: 'MaxLen'
553
735
  });
736
+
554
737
  if (!Number.isInteger(maximumLength) || maximumLength < 0) {
555
738
  maximumLength = null;
556
739
  }
557
- _this3.data.maxLen = maximumLength;
558
- _this3.data.multiLine = _this3.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
559
- _this3.data.comb = _this3.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !_this3.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !_this3.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !_this3.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && _this3.data.maxLen !== null;
560
- return _this3;
740
+
741
+ _this4.data.maxLen = maximumLength;
742
+ _this4.data.multiLine = _this4.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
743
+ _this4.data.comb = _this4.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && _this4.data.maxLen !== null;
744
+ return _this4;
561
745
  }
562
746
 
563
747
  _createClass(TextWidgetAnnotation, [{
564
- key: 'getOperatorList',
748
+ key: "getOperatorList",
565
749
  value: function getOperatorList(evaluator, task, renderForms) {
566
750
  if (renderForms || this.appearance) {
567
- return _get(TextWidgetAnnotation.prototype.__proto__ || Object.getPrototypeOf(TextWidgetAnnotation.prototype), 'getOperatorList', this).call(this, evaluator, task, renderForms);
751
+ return _get(_getPrototypeOf(TextWidgetAnnotation.prototype), "getOperatorList", this).call(this, evaluator, task, renderForms);
568
752
  }
753
+
569
754
  var operatorList = new _operator_list.OperatorList();
755
+
570
756
  if (!this.data.defaultAppearance) {
571
757
  return Promise.resolve(operatorList);
572
758
  }
759
+
573
760
  var stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance));
574
761
  return evaluator.getOperatorList({
575
762
  stream: stream,
@@ -585,57 +772,90 @@ var TextWidgetAnnotation = function (_WidgetAnnotation) {
585
772
  return TextWidgetAnnotation;
586
773
  }(WidgetAnnotation);
587
774
 
588
- var ButtonWidgetAnnotation = function (_WidgetAnnotation2) {
775
+ var ButtonWidgetAnnotation =
776
+ /*#__PURE__*/
777
+ function (_WidgetAnnotation2) {
589
778
  _inherits(ButtonWidgetAnnotation, _WidgetAnnotation2);
590
779
 
591
780
  function ButtonWidgetAnnotation(params) {
781
+ var _this5;
782
+
592
783
  _classCallCheck(this, ButtonWidgetAnnotation);
593
784
 
594
- var _this4 = _possibleConstructorReturn(this, (ButtonWidgetAnnotation.__proto__ || Object.getPrototypeOf(ButtonWidgetAnnotation)).call(this, params));
595
-
596
- _this4.data.checkBox = !_this4.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
597
- _this4.data.radioButton = _this4.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
598
- _this4.data.pushButton = _this4.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
599
- if (_this4.data.checkBox) {
600
- _this4._processCheckBox();
601
- } else if (_this4.data.radioButton) {
602
- _this4._processRadioButton(params);
603
- } else if (_this4.data.pushButton) {
604
- _this4._processPushButton(params);
785
+ _this5 = _possibleConstructorReturn(this, _getPrototypeOf(ButtonWidgetAnnotation).call(this, params));
786
+ _this5.data.checkBox = !_this5.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
787
+ _this5.data.radioButton = _this5.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
788
+ _this5.data.pushButton = _this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
789
+
790
+ if (_this5.data.checkBox) {
791
+ _this5._processCheckBox(params);
792
+ } else if (_this5.data.radioButton) {
793
+ _this5._processRadioButton(params);
794
+ } else if (_this5.data.pushButton) {
795
+ _this5._processPushButton(params);
605
796
  } else {
606
797
  (0, _util.warn)('Invalid field flags for button widget annotation');
607
798
  }
608
- return _this4;
799
+
800
+ return _this5;
609
801
  }
610
802
 
611
803
  _createClass(ButtonWidgetAnnotation, [{
612
- key: '_processCheckBox',
613
- value: function _processCheckBox() {
614
- if (!(0, _primitives.isName)(this.data.fieldValue)) {
804
+ key: "_processCheckBox",
805
+ value: function _processCheckBox(params) {
806
+ if ((0, _primitives.isName)(this.data.fieldValue)) {
807
+ this.data.fieldValue = this.data.fieldValue.name;
808
+ }
809
+
810
+ var customAppearance = params.dict.get('AP');
811
+
812
+ if (!(0, _primitives.isDict)(customAppearance)) {
813
+ return;
814
+ }
815
+
816
+ var exportValueOptionsDict = customAppearance.get('D');
817
+
818
+ if (!(0, _primitives.isDict)(exportValueOptionsDict)) {
615
819
  return;
616
820
  }
617
- this.data.fieldValue = this.data.fieldValue.name;
821
+
822
+ var exportValues = exportValueOptionsDict.getKeys();
823
+ var hasCorrectOptionCount = exportValues.length === 2;
824
+
825
+ if (!hasCorrectOptionCount) {
826
+ return;
827
+ }
828
+
829
+ this.data.exportValue = exportValues[0] === 'Off' ? exportValues[1] : exportValues[0];
618
830
  }
619
831
  }, {
620
- key: '_processRadioButton',
832
+ key: "_processRadioButton",
621
833
  value: function _processRadioButton(params) {
622
834
  this.data.fieldValue = this.data.buttonValue = null;
623
835
  var fieldParent = params.dict.get('Parent');
836
+
624
837
  if ((0, _primitives.isDict)(fieldParent) && fieldParent.has('V')) {
625
838
  var fieldParentValue = fieldParent.get('V');
839
+
626
840
  if ((0, _primitives.isName)(fieldParentValue)) {
627
841
  this.data.fieldValue = fieldParentValue.name;
628
842
  }
629
843
  }
844
+
630
845
  var appearanceStates = params.dict.get('AP');
846
+
631
847
  if (!(0, _primitives.isDict)(appearanceStates)) {
632
848
  return;
633
849
  }
850
+
634
851
  var normalAppearanceState = appearanceStates.get('N');
852
+
635
853
  if (!(0, _primitives.isDict)(normalAppearanceState)) {
636
854
  return;
637
855
  }
856
+
638
857
  var keys = normalAppearanceState.getKeys();
858
+
639
859
  for (var i = 0, ii = keys.length; i < ii; i++) {
640
860
  if (keys[i] !== 'Off') {
641
861
  this.data.buttonValue = keys[i];
@@ -644,12 +864,13 @@ var ButtonWidgetAnnotation = function (_WidgetAnnotation2) {
644
864
  }
645
865
  }
646
866
  }, {
647
- key: '_processPushButton',
867
+ key: "_processPushButton",
648
868
  value: function _processPushButton(params) {
649
869
  if (!params.dict.has('A')) {
650
870
  (0, _util.warn)('Push buttons without action dictionaries are not supported');
651
871
  return;
652
872
  }
873
+
653
874
  _obj.Catalog.parseDestDictionary({
654
875
  destDict: params.dict,
655
876
  resultObj: this.data,
@@ -661,312 +882,436 @@ var ButtonWidgetAnnotation = function (_WidgetAnnotation2) {
661
882
  return ButtonWidgetAnnotation;
662
883
  }(WidgetAnnotation);
663
884
 
664
- var ChoiceWidgetAnnotation = function (_WidgetAnnotation3) {
885
+ var ChoiceWidgetAnnotation =
886
+ /*#__PURE__*/
887
+ function (_WidgetAnnotation3) {
665
888
  _inherits(ChoiceWidgetAnnotation, _WidgetAnnotation3);
666
889
 
667
890
  function ChoiceWidgetAnnotation(params) {
668
- _classCallCheck(this, ChoiceWidgetAnnotation);
891
+ var _this6;
669
892
 
670
- var _this5 = _possibleConstructorReturn(this, (ChoiceWidgetAnnotation.__proto__ || Object.getPrototypeOf(ChoiceWidgetAnnotation)).call(this, params));
893
+ _classCallCheck(this, ChoiceWidgetAnnotation);
671
894
 
672
- _this5.data.options = [];
673
- var options = (0, _util.getInheritableProperty)({
895
+ _this6 = _possibleConstructorReturn(this, _getPrototypeOf(ChoiceWidgetAnnotation).call(this, params));
896
+ _this6.data.options = [];
897
+ var options = (0, _core_utils.getInheritableProperty)({
674
898
  dict: params.dict,
675
899
  key: 'Opt'
676
900
  });
901
+
677
902
  if (Array.isArray(options)) {
678
903
  var xref = params.xref;
904
+
679
905
  for (var i = 0, ii = options.length; i < ii; i++) {
680
906
  var option = xref.fetchIfRef(options[i]);
681
907
  var isOptionArray = Array.isArray(option);
682
- _this5.data.options[i] = {
908
+ _this6.data.options[i] = {
683
909
  exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
684
910
  displayValue: (0, _util.stringToPDFString)(isOptionArray ? xref.fetchIfRef(option[1]) : option)
685
911
  };
686
912
  }
687
913
  }
688
- if (!Array.isArray(_this5.data.fieldValue)) {
689
- _this5.data.fieldValue = [_this5.data.fieldValue];
914
+
915
+ if (!Array.isArray(_this6.data.fieldValue)) {
916
+ _this6.data.fieldValue = [_this6.data.fieldValue];
690
917
  }
691
- _this5.data.combo = _this5.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
692
- _this5.data.multiSelect = _this5.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
693
- return _this5;
918
+
919
+ _this6.data.combo = _this6.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
920
+ _this6.data.multiSelect = _this6.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
921
+ return _this6;
694
922
  }
695
923
 
696
924
  return ChoiceWidgetAnnotation;
697
925
  }(WidgetAnnotation);
698
926
 
699
- var TextAnnotation = function (_Annotation2) {
700
- _inherits(TextAnnotation, _Annotation2);
927
+ var TextAnnotation =
928
+ /*#__PURE__*/
929
+ function (_MarkupAnnotation) {
930
+ _inherits(TextAnnotation, _MarkupAnnotation);
701
931
 
702
932
  function TextAnnotation(parameters) {
933
+ var _this7;
934
+
703
935
  _classCallCheck(this, TextAnnotation);
704
936
 
705
937
  var DEFAULT_ICON_SIZE = 22;
938
+ _this7 = _possibleConstructorReturn(this, _getPrototypeOf(TextAnnotation).call(this, parameters));
939
+ _this7.data.annotationType = _util.AnnotationType.TEXT;
706
940
 
707
- var _this6 = _possibleConstructorReturn(this, (TextAnnotation.__proto__ || Object.getPrototypeOf(TextAnnotation)).call(this, parameters));
708
-
709
- _this6.data.annotationType = _util.AnnotationType.TEXT;
710
- if (_this6.data.hasAppearance) {
711
- _this6.data.name = 'NoIcon';
941
+ if (_this7.data.hasAppearance) {
942
+ _this7.data.name = 'NoIcon';
712
943
  } else {
713
- _this6.data.rect[1] = _this6.data.rect[3] - DEFAULT_ICON_SIZE;
714
- _this6.data.rect[2] = _this6.data.rect[0] + DEFAULT_ICON_SIZE;
715
- _this6.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
944
+ _this7.data.rect[1] = _this7.data.rect[3] - DEFAULT_ICON_SIZE;
945
+ _this7.data.rect[2] = _this7.data.rect[0] + DEFAULT_ICON_SIZE;
946
+ _this7.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
716
947
  }
717
- _this6._preparePopup(parameters.dict);
718
- return _this6;
948
+
949
+ return _this7;
719
950
  }
720
951
 
721
952
  return TextAnnotation;
722
- }(Annotation);
953
+ }(MarkupAnnotation);
723
954
 
724
- var LinkAnnotation = function (_Annotation3) {
955
+ var LinkAnnotation =
956
+ /*#__PURE__*/
957
+ function (_Annotation3) {
725
958
  _inherits(LinkAnnotation, _Annotation3);
726
959
 
727
960
  function LinkAnnotation(params) {
961
+ var _this8;
962
+
728
963
  _classCallCheck(this, LinkAnnotation);
729
964
 
730
- var _this7 = _possibleConstructorReturn(this, (LinkAnnotation.__proto__ || Object.getPrototypeOf(LinkAnnotation)).call(this, params));
965
+ _this8 = _possibleConstructorReturn(this, _getPrototypeOf(LinkAnnotation).call(this, params));
966
+ _this8.data.annotationType = _util.AnnotationType.LINK;
731
967
 
732
- _this7.data.annotationType = _util.AnnotationType.LINK;
733
968
  _obj.Catalog.parseDestDictionary({
734
969
  destDict: params.dict,
735
- resultObj: _this7.data,
970
+ resultObj: _this8.data,
736
971
  docBaseUrl: params.pdfManager.docBaseUrl
737
972
  });
738
- return _this7;
973
+
974
+ return _this8;
739
975
  }
740
976
 
741
977
  return LinkAnnotation;
742
978
  }(Annotation);
743
979
 
744
- var PopupAnnotation = function (_Annotation4) {
980
+ var PopupAnnotation =
981
+ /*#__PURE__*/
982
+ function (_Annotation4) {
745
983
  _inherits(PopupAnnotation, _Annotation4);
746
984
 
747
985
  function PopupAnnotation(parameters) {
748
- _classCallCheck(this, PopupAnnotation);
986
+ var _this9;
749
987
 
750
- var _this8 = _possibleConstructorReturn(this, (PopupAnnotation.__proto__ || Object.getPrototypeOf(PopupAnnotation)).call(this, parameters));
988
+ _classCallCheck(this, PopupAnnotation);
751
989
 
752
- _this8.data.annotationType = _util.AnnotationType.POPUP;
990
+ _this9 = _possibleConstructorReturn(this, _getPrototypeOf(PopupAnnotation).call(this, parameters));
991
+ _this9.data.annotationType = _util.AnnotationType.POPUP;
753
992
  var dict = parameters.dict;
754
993
  var parentItem = dict.get('Parent');
994
+
755
995
  if (!parentItem) {
756
996
  (0, _util.warn)('Popup annotation has a missing or invalid parent annotation.');
757
- return _possibleConstructorReturn(_this8);
997
+ return _possibleConstructorReturn(_this9);
758
998
  }
999
+
759
1000
  var parentSubtype = parentItem.get('Subtype');
760
- _this8.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
761
- _this8.data.parentId = dict.getRaw('Parent').toString();
762
- _this8.data.title = (0, _util.stringToPDFString)(parentItem.get('T') || '');
763
- _this8.data.contents = (0, _util.stringToPDFString)(parentItem.get('Contents') || '');
1001
+ _this9.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
1002
+ _this9.data.parentId = dict.getRaw('Parent').toString();
1003
+ _this9.data.title = (0, _util.stringToPDFString)(parentItem.get('T') || '');
1004
+ _this9.data.contents = (0, _util.stringToPDFString)(parentItem.get('Contents') || '');
1005
+
1006
+ if (!parentItem.has('M')) {
1007
+ _this9.data.modificationDate = null;
1008
+ } else {
1009
+ _this9.setModificationDate(parentItem.get('M'));
1010
+
1011
+ _this9.data.modificationDate = _this9.modificationDate;
1012
+ }
1013
+
764
1014
  if (!parentItem.has('C')) {
765
- _this8.data.color = null;
1015
+ _this9.data.color = null;
766
1016
  } else {
767
- _this8.setColor(parentItem.getArray('C'));
768
- _this8.data.color = _this8.color;
1017
+ _this9.setColor(parentItem.getArray('C'));
1018
+
1019
+ _this9.data.color = _this9.color;
769
1020
  }
770
- if (!_this8.viewable) {
1021
+
1022
+ if (!_this9.viewable) {
771
1023
  var parentFlags = parentItem.get('F');
772
- if (_this8._isViewable(parentFlags)) {
773
- _this8.setFlags(parentFlags);
1024
+
1025
+ if (_this9._isViewable(parentFlags)) {
1026
+ _this9.setFlags(parentFlags);
774
1027
  }
775
1028
  }
776
- return _this8;
1029
+
1030
+ return _this9;
777
1031
  }
778
1032
 
779
1033
  return PopupAnnotation;
780
1034
  }(Annotation);
781
1035
 
782
- var LineAnnotation = function (_Annotation5) {
783
- _inherits(LineAnnotation, _Annotation5);
1036
+ var FreeTextAnnotation =
1037
+ /*#__PURE__*/
1038
+ function (_MarkupAnnotation2) {
1039
+ _inherits(FreeTextAnnotation, _MarkupAnnotation2);
1040
+
1041
+ function FreeTextAnnotation(parameters) {
1042
+ var _this10;
1043
+
1044
+ _classCallCheck(this, FreeTextAnnotation);
1045
+
1046
+ _this10 = _possibleConstructorReturn(this, _getPrototypeOf(FreeTextAnnotation).call(this, parameters));
1047
+ _this10.data.annotationType = _util.AnnotationType.FREETEXT;
1048
+ return _this10;
1049
+ }
1050
+
1051
+ return FreeTextAnnotation;
1052
+ }(MarkupAnnotation);
1053
+
1054
+ var LineAnnotation =
1055
+ /*#__PURE__*/
1056
+ function (_MarkupAnnotation3) {
1057
+ _inherits(LineAnnotation, _MarkupAnnotation3);
784
1058
 
785
1059
  function LineAnnotation(parameters) {
786
- _classCallCheck(this, LineAnnotation);
1060
+ var _this11;
787
1061
 
788
- var _this9 = _possibleConstructorReturn(this, (LineAnnotation.__proto__ || Object.getPrototypeOf(LineAnnotation)).call(this, parameters));
1062
+ _classCallCheck(this, LineAnnotation);
789
1063
 
790
- _this9.data.annotationType = _util.AnnotationType.LINE;
1064
+ _this11 = _possibleConstructorReturn(this, _getPrototypeOf(LineAnnotation).call(this, parameters));
1065
+ _this11.data.annotationType = _util.AnnotationType.LINE;
791
1066
  var dict = parameters.dict;
792
- _this9.data.lineCoordinates = _util.Util.normalizeRect(dict.getArray('L'));
793
- _this9._preparePopup(dict);
794
- return _this9;
1067
+ _this11.data.lineCoordinates = _util.Util.normalizeRect(dict.getArray('L'));
1068
+ return _this11;
795
1069
  }
796
1070
 
797
1071
  return LineAnnotation;
798
- }(Annotation);
1072
+ }(MarkupAnnotation);
799
1073
 
800
- var SquareAnnotation = function (_Annotation6) {
801
- _inherits(SquareAnnotation, _Annotation6);
1074
+ var SquareAnnotation =
1075
+ /*#__PURE__*/
1076
+ function (_MarkupAnnotation4) {
1077
+ _inherits(SquareAnnotation, _MarkupAnnotation4);
802
1078
 
803
1079
  function SquareAnnotation(parameters) {
804
- _classCallCheck(this, SquareAnnotation);
1080
+ var _this12;
805
1081
 
806
- var _this10 = _possibleConstructorReturn(this, (SquareAnnotation.__proto__ || Object.getPrototypeOf(SquareAnnotation)).call(this, parameters));
1082
+ _classCallCheck(this, SquareAnnotation);
807
1083
 
808
- _this10.data.annotationType = _util.AnnotationType.SQUARE;
809
- _this10._preparePopup(parameters.dict);
810
- return _this10;
1084
+ _this12 = _possibleConstructorReturn(this, _getPrototypeOf(SquareAnnotation).call(this, parameters));
1085
+ _this12.data.annotationType = _util.AnnotationType.SQUARE;
1086
+ return _this12;
811
1087
  }
812
1088
 
813
1089
  return SquareAnnotation;
814
- }(Annotation);
1090
+ }(MarkupAnnotation);
815
1091
 
816
- var CircleAnnotation = function (_Annotation7) {
817
- _inherits(CircleAnnotation, _Annotation7);
1092
+ var CircleAnnotation =
1093
+ /*#__PURE__*/
1094
+ function (_MarkupAnnotation5) {
1095
+ _inherits(CircleAnnotation, _MarkupAnnotation5);
818
1096
 
819
1097
  function CircleAnnotation(parameters) {
820
- _classCallCheck(this, CircleAnnotation);
1098
+ var _this13;
821
1099
 
822
- var _this11 = _possibleConstructorReturn(this, (CircleAnnotation.__proto__ || Object.getPrototypeOf(CircleAnnotation)).call(this, parameters));
1100
+ _classCallCheck(this, CircleAnnotation);
823
1101
 
824
- _this11.data.annotationType = _util.AnnotationType.CIRCLE;
825
- _this11._preparePopup(parameters.dict);
826
- return _this11;
1102
+ _this13 = _possibleConstructorReturn(this, _getPrototypeOf(CircleAnnotation).call(this, parameters));
1103
+ _this13.data.annotationType = _util.AnnotationType.CIRCLE;
1104
+ return _this13;
827
1105
  }
828
1106
 
829
1107
  return CircleAnnotation;
830
- }(Annotation);
1108
+ }(MarkupAnnotation);
831
1109
 
832
- var PolylineAnnotation = function (_Annotation8) {
833
- _inherits(PolylineAnnotation, _Annotation8);
1110
+ var PolylineAnnotation =
1111
+ /*#__PURE__*/
1112
+ function (_MarkupAnnotation6) {
1113
+ _inherits(PolylineAnnotation, _MarkupAnnotation6);
834
1114
 
835
1115
  function PolylineAnnotation(parameters) {
836
- _classCallCheck(this, PolylineAnnotation);
1116
+ var _this14;
837
1117
 
838
- var _this12 = _possibleConstructorReturn(this, (PolylineAnnotation.__proto__ || Object.getPrototypeOf(PolylineAnnotation)).call(this, parameters));
1118
+ _classCallCheck(this, PolylineAnnotation);
839
1119
 
840
- _this12.data.annotationType = _util.AnnotationType.POLYLINE;
1120
+ _this14 = _possibleConstructorReturn(this, _getPrototypeOf(PolylineAnnotation).call(this, parameters));
1121
+ _this14.data.annotationType = _util.AnnotationType.POLYLINE;
841
1122
  var dict = parameters.dict;
842
1123
  var rawVertices = dict.getArray('Vertices');
843
- _this12.data.vertices = [];
1124
+ _this14.data.vertices = [];
1125
+
844
1126
  for (var i = 0, ii = rawVertices.length; i < ii; i += 2) {
845
- _this12.data.vertices.push({
1127
+ _this14.data.vertices.push({
846
1128
  x: rawVertices[i],
847
1129
  y: rawVertices[i + 1]
848
1130
  });
849
1131
  }
850
- _this12._preparePopup(dict);
851
- return _this12;
1132
+
1133
+ return _this14;
852
1134
  }
853
1135
 
854
1136
  return PolylineAnnotation;
855
- }(Annotation);
1137
+ }(MarkupAnnotation);
856
1138
 
857
- var PolygonAnnotation = function (_PolylineAnnotation) {
1139
+ var PolygonAnnotation =
1140
+ /*#__PURE__*/
1141
+ function (_PolylineAnnotation) {
858
1142
  _inherits(PolygonAnnotation, _PolylineAnnotation);
859
1143
 
860
1144
  function PolygonAnnotation(parameters) {
861
- _classCallCheck(this, PolygonAnnotation);
1145
+ var _this15;
862
1146
 
863
- var _this13 = _possibleConstructorReturn(this, (PolygonAnnotation.__proto__ || Object.getPrototypeOf(PolygonAnnotation)).call(this, parameters));
1147
+ _classCallCheck(this, PolygonAnnotation);
864
1148
 
865
- _this13.data.annotationType = _util.AnnotationType.POLYGON;
866
- return _this13;
1149
+ _this15 = _possibleConstructorReturn(this, _getPrototypeOf(PolygonAnnotation).call(this, parameters));
1150
+ _this15.data.annotationType = _util.AnnotationType.POLYGON;
1151
+ return _this15;
867
1152
  }
868
1153
 
869
1154
  return PolygonAnnotation;
870
1155
  }(PolylineAnnotation);
871
1156
 
872
- var HighlightAnnotation = function (_Annotation9) {
873
- _inherits(HighlightAnnotation, _Annotation9);
1157
+ var CaretAnnotation =
1158
+ /*#__PURE__*/
1159
+ function (_MarkupAnnotation7) {
1160
+ _inherits(CaretAnnotation, _MarkupAnnotation7);
1161
+
1162
+ function CaretAnnotation(parameters) {
1163
+ var _this16;
1164
+
1165
+ _classCallCheck(this, CaretAnnotation);
1166
+
1167
+ _this16 = _possibleConstructorReturn(this, _getPrototypeOf(CaretAnnotation).call(this, parameters));
1168
+ _this16.data.annotationType = _util.AnnotationType.CARET;
1169
+ return _this16;
1170
+ }
1171
+
1172
+ return CaretAnnotation;
1173
+ }(MarkupAnnotation);
1174
+
1175
+ var InkAnnotation =
1176
+ /*#__PURE__*/
1177
+ function (_MarkupAnnotation8) {
1178
+ _inherits(InkAnnotation, _MarkupAnnotation8);
1179
+
1180
+ function InkAnnotation(parameters) {
1181
+ var _this17;
1182
+
1183
+ _classCallCheck(this, InkAnnotation);
1184
+
1185
+ _this17 = _possibleConstructorReturn(this, _getPrototypeOf(InkAnnotation).call(this, parameters));
1186
+ _this17.data.annotationType = _util.AnnotationType.INK;
1187
+ var dict = parameters.dict;
1188
+ var xref = parameters.xref;
1189
+ var originalInkLists = dict.getArray('InkList');
1190
+ _this17.data.inkLists = [];
1191
+
1192
+ for (var i = 0, ii = originalInkLists.length; i < ii; ++i) {
1193
+ _this17.data.inkLists.push([]);
1194
+
1195
+ for (var j = 0, jj = originalInkLists[i].length; j < jj; j += 2) {
1196
+ _this17.data.inkLists[i].push({
1197
+ x: xref.fetchIfRef(originalInkLists[i][j]),
1198
+ y: xref.fetchIfRef(originalInkLists[i][j + 1])
1199
+ });
1200
+ }
1201
+ }
1202
+
1203
+ return _this17;
1204
+ }
1205
+
1206
+ return InkAnnotation;
1207
+ }(MarkupAnnotation);
1208
+
1209
+ var HighlightAnnotation =
1210
+ /*#__PURE__*/
1211
+ function (_MarkupAnnotation9) {
1212
+ _inherits(HighlightAnnotation, _MarkupAnnotation9);
874
1213
 
875
1214
  function HighlightAnnotation(parameters) {
876
- _classCallCheck(this, HighlightAnnotation);
1215
+ var _this18;
877
1216
 
878
- var _this14 = _possibleConstructorReturn(this, (HighlightAnnotation.__proto__ || Object.getPrototypeOf(HighlightAnnotation)).call(this, parameters));
1217
+ _classCallCheck(this, HighlightAnnotation);
879
1218
 
880
- _this14.data.annotationType = _util.AnnotationType.HIGHLIGHT;
881
- _this14._preparePopup(parameters.dict);
882
- return _this14;
1219
+ _this18 = _possibleConstructorReturn(this, _getPrototypeOf(HighlightAnnotation).call(this, parameters));
1220
+ _this18.data.annotationType = _util.AnnotationType.HIGHLIGHT;
1221
+ return _this18;
883
1222
  }
884
1223
 
885
1224
  return HighlightAnnotation;
886
- }(Annotation);
1225
+ }(MarkupAnnotation);
887
1226
 
888
- var UnderlineAnnotation = function (_Annotation10) {
889
- _inherits(UnderlineAnnotation, _Annotation10);
1227
+ var UnderlineAnnotation =
1228
+ /*#__PURE__*/
1229
+ function (_MarkupAnnotation10) {
1230
+ _inherits(UnderlineAnnotation, _MarkupAnnotation10);
890
1231
 
891
1232
  function UnderlineAnnotation(parameters) {
892
- _classCallCheck(this, UnderlineAnnotation);
1233
+ var _this19;
893
1234
 
894
- var _this15 = _possibleConstructorReturn(this, (UnderlineAnnotation.__proto__ || Object.getPrototypeOf(UnderlineAnnotation)).call(this, parameters));
1235
+ _classCallCheck(this, UnderlineAnnotation);
895
1236
 
896
- _this15.data.annotationType = _util.AnnotationType.UNDERLINE;
897
- _this15._preparePopup(parameters.dict);
898
- return _this15;
1237
+ _this19 = _possibleConstructorReturn(this, _getPrototypeOf(UnderlineAnnotation).call(this, parameters));
1238
+ _this19.data.annotationType = _util.AnnotationType.UNDERLINE;
1239
+ return _this19;
899
1240
  }
900
1241
 
901
1242
  return UnderlineAnnotation;
902
- }(Annotation);
1243
+ }(MarkupAnnotation);
903
1244
 
904
- var SquigglyAnnotation = function (_Annotation11) {
905
- _inherits(SquigglyAnnotation, _Annotation11);
1245
+ var SquigglyAnnotation =
1246
+ /*#__PURE__*/
1247
+ function (_MarkupAnnotation11) {
1248
+ _inherits(SquigglyAnnotation, _MarkupAnnotation11);
906
1249
 
907
1250
  function SquigglyAnnotation(parameters) {
908
- _classCallCheck(this, SquigglyAnnotation);
1251
+ var _this20;
909
1252
 
910
- var _this16 = _possibleConstructorReturn(this, (SquigglyAnnotation.__proto__ || Object.getPrototypeOf(SquigglyAnnotation)).call(this, parameters));
1253
+ _classCallCheck(this, SquigglyAnnotation);
911
1254
 
912
- _this16.data.annotationType = _util.AnnotationType.SQUIGGLY;
913
- _this16._preparePopup(parameters.dict);
914
- return _this16;
1255
+ _this20 = _possibleConstructorReturn(this, _getPrototypeOf(SquigglyAnnotation).call(this, parameters));
1256
+ _this20.data.annotationType = _util.AnnotationType.SQUIGGLY;
1257
+ return _this20;
915
1258
  }
916
1259
 
917
1260
  return SquigglyAnnotation;
918
- }(Annotation);
1261
+ }(MarkupAnnotation);
919
1262
 
920
- var StrikeOutAnnotation = function (_Annotation12) {
921
- _inherits(StrikeOutAnnotation, _Annotation12);
1263
+ var StrikeOutAnnotation =
1264
+ /*#__PURE__*/
1265
+ function (_MarkupAnnotation12) {
1266
+ _inherits(StrikeOutAnnotation, _MarkupAnnotation12);
922
1267
 
923
1268
  function StrikeOutAnnotation(parameters) {
924
- _classCallCheck(this, StrikeOutAnnotation);
1269
+ var _this21;
925
1270
 
926
- var _this17 = _possibleConstructorReturn(this, (StrikeOutAnnotation.__proto__ || Object.getPrototypeOf(StrikeOutAnnotation)).call(this, parameters));
1271
+ _classCallCheck(this, StrikeOutAnnotation);
927
1272
 
928
- _this17.data.annotationType = _util.AnnotationType.STRIKEOUT;
929
- _this17._preparePopup(parameters.dict);
930
- return _this17;
1273
+ _this21 = _possibleConstructorReturn(this, _getPrototypeOf(StrikeOutAnnotation).call(this, parameters));
1274
+ _this21.data.annotationType = _util.AnnotationType.STRIKEOUT;
1275
+ return _this21;
931
1276
  }
932
1277
 
933
1278
  return StrikeOutAnnotation;
934
- }(Annotation);
1279
+ }(MarkupAnnotation);
935
1280
 
936
- var StampAnnotation = function (_Annotation13) {
937
- _inherits(StampAnnotation, _Annotation13);
1281
+ var StampAnnotation =
1282
+ /*#__PURE__*/
1283
+ function (_MarkupAnnotation13) {
1284
+ _inherits(StampAnnotation, _MarkupAnnotation13);
938
1285
 
939
1286
  function StampAnnotation(parameters) {
940
- _classCallCheck(this, StampAnnotation);
1287
+ var _this22;
941
1288
 
942
- var _this18 = _possibleConstructorReturn(this, (StampAnnotation.__proto__ || Object.getPrototypeOf(StampAnnotation)).call(this, parameters));
1289
+ _classCallCheck(this, StampAnnotation);
943
1290
 
944
- _this18.data.annotationType = _util.AnnotationType.STAMP;
945
- _this18._preparePopup(parameters.dict);
946
- return _this18;
1291
+ _this22 = _possibleConstructorReturn(this, _getPrototypeOf(StampAnnotation).call(this, parameters));
1292
+ _this22.data.annotationType = _util.AnnotationType.STAMP;
1293
+ return _this22;
947
1294
  }
948
1295
 
949
1296
  return StampAnnotation;
950
- }(Annotation);
1297
+ }(MarkupAnnotation);
951
1298
 
952
- var FileAttachmentAnnotation = function (_Annotation14) {
953
- _inherits(FileAttachmentAnnotation, _Annotation14);
1299
+ var FileAttachmentAnnotation =
1300
+ /*#__PURE__*/
1301
+ function (_MarkupAnnotation14) {
1302
+ _inherits(FileAttachmentAnnotation, _MarkupAnnotation14);
954
1303
 
955
1304
  function FileAttachmentAnnotation(parameters) {
956
- _classCallCheck(this, FileAttachmentAnnotation);
1305
+ var _this23;
957
1306
 
958
- var _this19 = _possibleConstructorReturn(this, (FileAttachmentAnnotation.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotation)).call(this, parameters));
1307
+ _classCallCheck(this, FileAttachmentAnnotation);
959
1308
 
1309
+ _this23 = _possibleConstructorReturn(this, _getPrototypeOf(FileAttachmentAnnotation).call(this, parameters));
960
1310
  var file = new _obj.FileSpec(parameters.dict.get('FS'), parameters.xref);
961
- _this19.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
962
- _this19.data.file = file.serializable;
963
- _this19._preparePopup(parameters.dict);
964
- return _this19;
1311
+ _this23.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
1312
+ _this23.data.file = file.serializable;
1313
+ return _this23;
965
1314
  }
966
1315
 
967
1316
  return FileAttachmentAnnotation;
968
- }(Annotation);
969
-
970
- exports.Annotation = Annotation;
971
- exports.AnnotationBorderStyle = AnnotationBorderStyle;
972
- exports.AnnotationFactory = AnnotationFactory;
1317
+ }(MarkupAnnotation);