pdfjs-dist 2.0.943 → 2.1.266

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 (159) hide show
  1. package/bower.json +1 -1
  2. package/build/pdf.js +15329 -11095
  3. package/build/pdf.js.map +1 -1
  4. package/build/pdf.min.js +1 -1
  5. package/build/pdf.worker.js +12497 -4184
  6. package/build/pdf.worker.js.map +1 -1
  7. package/build/pdf.worker.min.js +1 -1
  8. package/image_decoders/pdf.image_decoders.js +3438 -1209
  9. package/image_decoders/pdf.image_decoders.js.map +1 -1
  10. package/image_decoders/pdf.image_decoders.min.js +1 -1
  11. package/lib/core/annotation.js +335 -109
  12. package/lib/core/arithmetic_decoder.js +274 -244
  13. package/lib/core/bidi.js +64 -5
  14. package/lib/core/ccitt.js +172 -17
  15. package/lib/core/ccitt_stream.js +14 -5
  16. package/lib/core/cff_parser.js +304 -28
  17. package/lib/core/charsets.js +4 -3
  18. package/lib/core/chunked_stream.js +379 -149
  19. package/lib/core/cmap.js +210 -40
  20. package/lib/core/colorspace.js +332 -187
  21. package/lib/core/crypto.js +289 -44
  22. package/lib/core/document.js +508 -249
  23. package/lib/core/encodings.js +18 -9
  24. package/lib/core/evaluator.js +657 -119
  25. package/lib/core/font_renderer.js +217 -34
  26. package/lib/core/fonts.js +632 -41
  27. package/lib/core/function.js +252 -26
  28. package/lib/core/glyphlist.js +2 -1
  29. package/lib/core/image.js +124 -27
  30. package/lib/core/jbig2.js +425 -65
  31. package/lib/core/jbig2_stream.js +18 -7
  32. package/lib/core/jpeg_stream.js +24 -8
  33. package/lib/core/jpg.js +208 -16
  34. package/lib/core/jpx.js +395 -5
  35. package/lib/core/jpx_stream.js +17 -5
  36. package/lib/core/metrics.js +3 -3
  37. package/lib/core/murmurhash3.js +23 -5
  38. package/lib/core/obj.js +625 -132
  39. package/lib/core/operator_list.js +104 -3
  40. package/lib/core/parser.js +262 -25
  41. package/lib/core/pattern.js +144 -12
  42. package/lib/core/pdf_manager.js +104 -70
  43. package/lib/core/primitives.js +74 -21
  44. package/lib/core/ps_parser.js +133 -44
  45. package/lib/core/standard_fonts.js +9 -9
  46. package/lib/core/stream.js +283 -31
  47. package/lib/core/type1_parser.js +138 -6
  48. package/lib/core/unicode.js +28 -1
  49. package/lib/core/worker.js +192 -57
  50. package/lib/display/annotation_layer.js +303 -123
  51. package/lib/display/api.js +1073 -574
  52. package/lib/display/api_compatibility.js +4 -1
  53. package/lib/display/canvas.js +314 -18
  54. package/lib/display/content_disposition.js +70 -23
  55. package/lib/display/dom_utils.js +112 -59
  56. package/lib/display/fetch_stream.js +95 -50
  57. package/lib/display/font_loader.js +250 -132
  58. package/lib/display/metadata.js +37 -15
  59. package/lib/display/network.js +123 -34
  60. package/lib/display/network_utils.js +23 -10
  61. package/lib/display/node_stream.js +162 -65
  62. package/lib/display/pattern_helper.js +57 -6
  63. package/lib/display/svg.js +194 -18
  64. package/lib/display/text_layer.js +128 -14
  65. package/lib/display/transport_stream.js +83 -27
  66. package/lib/display/webgl.js +63 -17
  67. package/lib/display/worker_options.js +4 -3
  68. package/lib/display/xml_parser.js +162 -52
  69. package/lib/examples/node/domstubs.js +56 -3
  70. package/lib/pdf.js +15 -2
  71. package/lib/pdf.worker.js +4 -2
  72. package/lib/shared/compatibility.js +129 -26
  73. package/lib/shared/global_scope.js +1 -1
  74. package/lib/shared/is_node.js +3 -3
  75. package/lib/shared/message_handler.js +103 -45
  76. package/lib/shared/streams_polyfill.js +20 -16
  77. package/lib/shared/url_polyfill.js +8 -2
  78. package/lib/shared/util.js +246 -84
  79. package/lib/test/unit/annotation_spec.js +99 -73
  80. package/lib/test/unit/api_spec.js +347 -113
  81. package/lib/test/unit/bidi_spec.js +6 -6
  82. package/lib/test/unit/cff_parser_spec.js +17 -5
  83. package/lib/test/unit/clitests_helper.js +7 -8
  84. package/lib/test/unit/cmap_spec.js +79 -25
  85. package/lib/test/unit/colorspace_spec.js +65 -18
  86. package/lib/test/unit/crypto_spec.js +16 -4
  87. package/lib/test/unit/custom_spec.js +40 -52
  88. package/lib/test/unit/display_svg_spec.js +32 -16
  89. package/lib/test/unit/document_spec.js +2 -2
  90. package/lib/test/unit/dom_utils_spec.js +8 -8
  91. package/lib/test/unit/encodings_spec.js +24 -44
  92. package/lib/test/unit/evaluator_spec.js +15 -8
  93. package/lib/test/unit/function_spec.js +16 -4
  94. package/lib/test/unit/jasmine-boot.js +29 -16
  95. package/lib/test/unit/message_handler_spec.js +19 -6
  96. package/lib/test/unit/metadata_spec.js +64 -11
  97. package/lib/test/unit/murmurhash3_spec.js +2 -2
  98. package/lib/test/unit/network_spec.js +19 -4
  99. package/lib/test/unit/network_utils_spec.js +6 -4
  100. package/lib/test/unit/node_stream_spec.js +50 -26
  101. package/lib/test/unit/parser_spec.js +13 -29
  102. package/lib/test/unit/pdf_find_controller_spec.js +144 -32
  103. package/lib/test/unit/pdf_find_utils_spec.js +10 -9
  104. package/lib/test/unit/pdf_history_spec.js +20 -8
  105. package/lib/test/unit/primitives_spec.js +23 -3
  106. package/lib/test/unit/stream_spec.js +8 -3
  107. package/lib/test/unit/test_utils.js +89 -26
  108. package/lib/test/unit/testreporter.js +19 -1
  109. package/lib/test/unit/type1_parser_spec.js +7 -5
  110. package/lib/test/unit/ui_utils_spec.js +162 -38
  111. package/lib/test/unit/unicode_spec.js +13 -10
  112. package/lib/test/unit/util_spec.js +89 -9
  113. package/lib/web/annotation_layer_builder.js +38 -21
  114. package/lib/web/app.js +610 -245
  115. package/lib/web/app_options.js +54 -34
  116. package/lib/web/base_viewer.js +359 -162
  117. package/lib/web/chromecom.js +159 -80
  118. package/lib/web/debugger.js +161 -17
  119. package/lib/web/download_manager.js +29 -11
  120. package/lib/web/firefox_print_service.js +16 -8
  121. package/lib/web/firefoxcom.js +127 -91
  122. package/lib/web/genericcom.js +50 -31
  123. package/lib/web/genericl10n.js +46 -34
  124. package/lib/web/grab_to_pan.js +25 -3
  125. package/lib/web/interfaces.js +108 -61
  126. package/lib/web/overlay_manager.js +67 -45
  127. package/lib/web/password_prompt.js +20 -12
  128. package/lib/web/pdf_attachment_viewer.js +37 -17
  129. package/lib/web/pdf_cursor_tools.js +38 -15
  130. package/lib/web/pdf_document_properties.js +65 -24
  131. package/lib/web/pdf_find_bar.js +48 -20
  132. package/lib/web/pdf_find_controller.js +290 -89
  133. package/lib/web/pdf_find_utils.js +19 -3
  134. package/lib/web/pdf_history.js +186 -49
  135. package/lib/web/pdf_link_service.js +127 -52
  136. package/lib/web/pdf_outline_viewer.js +71 -21
  137. package/lib/web/pdf_page_view.js +188 -63
  138. package/lib/web/pdf_presentation_mode.js +98 -33
  139. package/lib/web/pdf_print_service.js +54 -10
  140. package/lib/web/pdf_rendering_queue.js +26 -4
  141. package/lib/web/pdf_sidebar.js +116 -62
  142. package/lib/web/pdf_sidebar_resizer.js +41 -15
  143. package/lib/web/pdf_single_page_viewer.js +65 -68
  144. package/lib/web/pdf_thumbnail_view.js +102 -31
  145. package/lib/web/pdf_thumbnail_viewer.js +62 -22
  146. package/lib/web/pdf_viewer.component.js +111 -31
  147. package/lib/web/pdf_viewer.js +80 -60
  148. package/lib/web/preferences.js +61 -39
  149. package/lib/web/secondary_toolbar.js +101 -82
  150. package/lib/web/text_layer_builder.js +124 -69
  151. package/lib/web/toolbar.js +67 -27
  152. package/lib/web/ui_utils.js +284 -128
  153. package/lib/web/view_history.js +75 -51
  154. package/lib/web/viewer_compatibility.js +2 -1
  155. package/package.json +1 -1
  156. package/web/pdf_viewer.css +1 -1
  157. package/web/pdf_viewer.js +2200 -973
  158. package/web/pdf_viewer.js.map +1 -1
  159. package/lib/web/dom_events.js +0 -140
@@ -19,22 +19,26 @@
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.PasswordPrompt = undefined;
27
+ exports.PasswordPrompt = void 0;
28
28
 
29
- 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; }; }();
29
+ var _ui_utils = require("./ui_utils");
30
30
 
31
- var _ui_utils = require('./ui_utils');
32
-
33
- var _pdf = require('../pdf');
31
+ var _pdf = require("../pdf");
34
32
 
35
33
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36
34
 
37
- var PasswordPrompt = function () {
35
+ 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); } }
36
+
37
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
38
+
39
+ var PasswordPrompt =
40
+ /*#__PURE__*/
41
+ function () {
38
42
  function PasswordPrompt(options, overlayManager) {
39
43
  var _this = this;
40
44
 
@@ -63,25 +67,28 @@ var PasswordPrompt = function () {
63
67
  }
64
68
 
65
69
  _createClass(PasswordPrompt, [{
66
- key: 'open',
70
+ key: "open",
67
71
  value: function open() {
68
72
  var _this2 = this;
69
73
 
70
74
  this.overlayManager.open(this.overlayName).then(function () {
71
75
  _this2.input.focus();
72
- var promptString = void 0;
76
+
77
+ var promptString;
78
+
73
79
  if (_this2.reason === _pdf.PasswordResponses.INCORRECT_PASSWORD) {
74
80
  promptString = _this2.l10n.get('password_invalid', null, 'Invalid password. Please try again.');
75
81
  } else {
76
82
  promptString = _this2.l10n.get('password_label', null, 'Enter the password to open this PDF file.');
77
83
  }
84
+
78
85
  promptString.then(function (msg) {
79
86
  _this2.label.textContent = msg;
80
87
  });
81
88
  });
82
89
  }
83
90
  }, {
84
- key: 'close',
91
+ key: "close",
85
92
  value: function close() {
86
93
  var _this3 = this;
87
94
 
@@ -90,16 +97,17 @@ var PasswordPrompt = function () {
90
97
  });
91
98
  }
92
99
  }, {
93
- key: 'verify',
100
+ key: "verify",
94
101
  value: function verify() {
95
102
  var password = this.input.value;
103
+
96
104
  if (password && password.length > 0) {
97
105
  this.close();
98
106
  return this.updateCallback(password);
99
107
  }
100
108
  }
101
109
  }, {
102
- key: 'setUpdateCallback',
110
+ key: "setUpdateCallback",
103
111
  value: function setUpdateCallback(updateCallback, reason) {
104
112
  this.updateCallback = updateCallback;
105
113
  this.reason = reason;
@@ -19,20 +19,24 @@
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.PDFAttachmentViewer = undefined;
27
+ exports.PDFAttachmentViewer = void 0;
28
28
 
29
- 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; }; }();
30
-
31
- var _pdf = require('../pdf');
29
+ var _pdf = require("../pdf");
32
30
 
33
31
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
34
32
 
35
- var PDFAttachmentViewer = function () {
33
+ 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); } }
34
+
35
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
36
+
37
+ var PDFAttachmentViewer =
38
+ /*#__PURE__*/
39
+ function () {
36
40
  function PDFAttachmentViewer(_ref) {
37
41
  var container = _ref.container,
38
42
  eventBus = _ref.eventBus,
@@ -48,72 +52,82 @@ var PDFAttachmentViewer = function () {
48
52
  }
49
53
 
50
54
  _createClass(PDFAttachmentViewer, [{
51
- key: 'reset',
55
+ key: "reset",
52
56
  value: function reset() {
53
57
  var keepRenderedCapability = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
54
-
55
58
  this.attachments = null;
56
59
  this.container.textContent = '';
60
+
57
61
  if (!keepRenderedCapability) {
58
62
  this._renderedCapability = (0, _pdf.createPromiseCapability)();
59
63
  }
60
64
  }
61
65
  }, {
62
- key: '_dispatchEvent',
66
+ key: "_dispatchEvent",
63
67
  value: function _dispatchEvent(attachmentsCount) {
64
68
  this._renderedCapability.resolve();
69
+
65
70
  this.eventBus.dispatch('attachmentsloaded', {
66
71
  source: this,
67
72
  attachmentsCount: attachmentsCount
68
73
  });
69
74
  }
70
75
  }, {
71
- key: '_bindPdfLink',
76
+ key: "_bindPdfLink",
72
77
  value: function _bindPdfLink(button, content, filename) {
73
78
  if (this.downloadManager.disableCreateObjectURL) {
74
79
  throw new Error('bindPdfLink: Unsupported "disableCreateObjectURL" value.');
75
80
  }
76
- var blobUrl = void 0;
81
+
82
+ var blobUrl;
83
+
77
84
  button.onclick = function () {
78
85
  if (!blobUrl) {
79
86
  blobUrl = (0, _pdf.createObjectURL)(content, 'application/pdf');
80
87
  }
81
- var viewerUrl = void 0;
88
+
89
+ var viewerUrl;
82
90
  viewerUrl = '?file=' + encodeURIComponent(blobUrl + '#' + filename);
83
91
  window.open(viewerUrl);
84
92
  return false;
85
93
  };
86
94
  }
87
95
  }, {
88
- key: '_bindLink',
96
+ key: "_bindLink",
89
97
  value: function _bindLink(button, content, filename) {
90
98
  var _this = this;
91
99
 
92
100
  button.onclick = function () {
93
101
  _this.downloadManager.downloadData(content, filename, '');
102
+
94
103
  return false;
95
104
  };
96
105
  }
97
106
  }, {
98
- key: 'render',
107
+ key: "render",
99
108
  value: function render(_ref2) {
100
109
  var attachments = _ref2.attachments,
101
110
  _ref2$keepRenderedCap = _ref2.keepRenderedCapability,
102
- keepRenderedCapability = _ref2$keepRenderedCap === undefined ? false : _ref2$keepRenderedCap;
103
-
111
+ keepRenderedCapability = _ref2$keepRenderedCap === void 0 ? false : _ref2$keepRenderedCap;
104
112
  var attachmentsCount = 0;
113
+
105
114
  if (this.attachments) {
106
115
  this.reset(keepRenderedCapability === true);
107
116
  }
117
+
108
118
  this.attachments = attachments || null;
119
+
109
120
  if (!attachments) {
110
121
  this._dispatchEvent(attachmentsCount);
122
+
111
123
  return;
112
124
  }
125
+
113
126
  var names = Object.keys(attachments).sort(function (a, b) {
114
127
  return a.toLowerCase().localeCompare(b.toLowerCase());
115
128
  });
116
129
  attachmentsCount = names.length;
130
+
117
131
  for (var i = 0; i < attachmentsCount; i++) {
118
132
  var item = attachments[names[i]];
119
133
  var filename = (0, _pdf.removeNullCharacters)((0, _pdf.getFilenameFromUrl)(item.filename));
@@ -121,18 +135,21 @@ var PDFAttachmentViewer = function () {
121
135
  div.className = 'attachmentsItem';
122
136
  var button = document.createElement('button');
123
137
  button.textContent = filename;
138
+
124
139
  if (/\.pdf$/i.test(filename) && !this.downloadManager.disableCreateObjectURL) {
125
140
  this._bindPdfLink(button, item.content, filename);
126
141
  } else {
127
142
  this._bindLink(button, item.content, filename);
128
143
  }
144
+
129
145
  div.appendChild(button);
130
146
  this.container.appendChild(div);
131
147
  }
148
+
132
149
  this._dispatchEvent(attachmentsCount);
133
150
  }
134
151
  }, {
135
- key: '_appendAttachment',
152
+ key: "_appendAttachment",
136
153
  value: function _appendAttachment(_ref3) {
137
154
  var _this2 = this;
138
155
 
@@ -142,6 +159,7 @@ var PDFAttachmentViewer = function () {
142
159
 
143
160
  this._renderedCapability.promise.then(function () {
144
161
  var attachments = _this2.attachments;
162
+
145
163
  if (!attachments) {
146
164
  attachments = Object.create(null);
147
165
  } else {
@@ -151,10 +169,12 @@ var PDFAttachmentViewer = function () {
151
169
  }
152
170
  }
153
171
  }
172
+
154
173
  attachments[id] = {
155
174
  filename: filename,
156
175
  content: content
157
176
  };
177
+
158
178
  _this2.render({
159
179
  attachments: attachments,
160
180
  keepRenderedCapability: true
@@ -19,33 +19,38 @@
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.PDFCursorTools = exports.CursorTool = undefined;
27
+ exports.PDFCursorTools = exports.CursorTool = void 0;
28
28
 
29
- 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; }; }();
30
-
31
- var _grab_to_pan = require('./grab_to_pan');
29
+ var _grab_to_pan = require("./grab_to_pan");
32
30
 
33
31
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
34
32
 
33
+ 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); } }
34
+
35
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
36
+
35
37
  var CursorTool = {
36
38
  SELECT: 0,
37
39
  HAND: 1,
38
40
  ZOOM: 2
39
41
  };
42
+ exports.CursorTool = CursorTool;
40
43
 
41
- var PDFCursorTools = function () {
44
+ var PDFCursorTools =
45
+ /*#__PURE__*/
46
+ function () {
42
47
  function PDFCursorTools(_ref) {
43
48
  var _this = this;
44
49
 
45
50
  var container = _ref.container,
46
51
  eventBus = _ref.eventBus,
47
52
  _ref$cursorToolOnLoad = _ref.cursorToolOnLoad,
48
- cursorToolOnLoad = _ref$cursorToolOnLoad === undefined ? CursorTool.SELECT : _ref$cursorToolOnLoad;
53
+ cursorToolOnLoad = _ref$cursorToolOnLoad === void 0 ? CursorTool.SELECT : _ref$cursorToolOnLoad;
49
54
 
50
55
  _classCallCheck(this, PDFCursorTools);
51
56
 
@@ -53,52 +58,66 @@ var PDFCursorTools = function () {
53
58
  this.eventBus = eventBus;
54
59
  this.active = CursorTool.SELECT;
55
60
  this.activeBeforePresentationMode = null;
56
- this.handTool = new _grab_to_pan.GrabToPan({ element: this.container });
61
+ this.handTool = new _grab_to_pan.GrabToPan({
62
+ element: this.container
63
+ });
64
+
57
65
  this._addEventListeners();
66
+
58
67
  Promise.resolve().then(function () {
59
68
  _this.switchTool(cursorToolOnLoad);
60
69
  });
61
70
  }
62
71
 
63
72
  _createClass(PDFCursorTools, [{
64
- key: 'switchTool',
73
+ key: "switchTool",
65
74
  value: function switchTool(tool) {
66
75
  var _this2 = this;
67
76
 
68
77
  if (this.activeBeforePresentationMode !== null) {
69
78
  return;
70
79
  }
80
+
71
81
  if (tool === this.active) {
72
82
  return;
73
83
  }
84
+
74
85
  var disableActiveTool = function disableActiveTool() {
75
86
  switch (_this2.active) {
76
87
  case CursorTool.SELECT:
77
88
  break;
89
+
78
90
  case CursorTool.HAND:
79
91
  _this2.handTool.deactivate();
92
+
80
93
  break;
94
+
81
95
  case CursorTool.ZOOM:
82
96
  }
83
97
  };
98
+
84
99
  switch (tool) {
85
100
  case CursorTool.SELECT:
86
101
  disableActiveTool();
87
102
  break;
103
+
88
104
  case CursorTool.HAND:
89
105
  disableActiveTool();
90
106
  this.handTool.activate();
91
107
  break;
108
+
92
109
  case CursorTool.ZOOM:
93
110
  default:
94
- console.error('switchTool: "' + tool + '" is an unsupported value.');
111
+ console.error("switchTool: \"".concat(tool, "\" is an unsupported value."));
95
112
  return;
96
113
  }
114
+
97
115
  this.active = tool;
116
+
98
117
  this._dispatchEvent();
99
118
  }
100
119
  }, {
101
- key: '_dispatchEvent',
120
+ key: "_dispatchEvent",
102
121
  value: function _dispatchEvent() {
103
122
  this.eventBus.dispatch('cursortoolchanged', {
104
123
  source: this,
@@ -106,7 +125,7 @@ var PDFCursorTools = function () {
106
125
  });
107
126
  }
108
127
  }, {
109
- key: '_addEventListeners',
128
+ key: "_addEventListeners",
110
129
  value: function _addEventListeners() {
111
130
  var _this3 = this;
112
131
 
@@ -117,20 +136,25 @@ var PDFCursorTools = function () {
117
136
  if (evt.switchInProgress) {
118
137
  return;
119
138
  }
120
- var previouslyActive = void 0;
139
+
140
+ var previouslyActive;
141
+
121
142
  if (evt.active) {
122
143
  previouslyActive = _this3.active;
144
+
123
145
  _this3.switchTool(CursorTool.SELECT);
146
+
124
147
  _this3.activeBeforePresentationMode = previouslyActive;
125
148
  } else {
126
149
  previouslyActive = _this3.activeBeforePresentationMode;
127
150
  _this3.activeBeforePresentationMode = null;
151
+
128
152
  _this3.switchTool(previouslyActive);
129
153
  }
130
154
  });
131
155
  }
132
156
  }, {
133
- key: 'activeTool',
157
+ key: "activeTool",
134
158
  get: function get() {
135
159
  return this.active;
136
160
  }
@@ -139,5 +163,4 @@ var PDFCursorTools = function () {
139
163
  return PDFCursorTools;
140
164
  }();
141
165
 
142
- exports.CursorTool = CursorTool;
143
166
  exports.PDFCursorTools = PDFCursorTools;