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
package/lib/core/cmap.js CHANGED
@@ -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.
@@ -26,283 +26,218 @@ Object.defineProperty(exports, "__esModule", {
26
26
  });
27
27
  exports.CMapFactory = exports.IdentityCMap = exports.CMap = void 0;
28
28
 
29
- var _util = require("../shared/util");
29
+ var _util = require("../shared/util.js");
30
30
 
31
- var _primitives = require("./primitives");
31
+ var _primitives = require("./primitives.js");
32
32
 
33
- var _parser = require("./parser");
33
+ var _parser = require("./parser.js");
34
34
 
35
- var _core_utils = require("./core_utils");
35
+ var _core_utils = require("./core_utils.js");
36
36
 
37
- var _stream = require("./stream");
37
+ var _stream = require("./stream.js");
38
38
 
39
- 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); }
39
+ var BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"];
40
40
 
41
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
42
-
43
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
44
-
45
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
41
+ class CMap {
42
+ constructor(builtInCMap = false) {
43
+ this.codespaceRanges = [[], [], [], []];
44
+ this.numCodespaceRanges = 0;
45
+ this._map = [];
46
+ this.name = "";
47
+ this.vertical = false;
48
+ this.useCMap = null;
49
+ this.builtInCMap = builtInCMap;
50
+ }
46
51
 
47
- 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); }
52
+ addCodespaceRange(n, low, high) {
53
+ this.codespaceRanges[n - 1].push(low, high);
54
+ this.numCodespaceRanges++;
55
+ }
48
56
 
49
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
57
+ mapCidRange(low, high, dstLow) {
58
+ while (low <= high) {
59
+ this._map[low++] = dstLow++;
60
+ }
61
+ }
50
62
 
51
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
63
+ mapBfRange(low, high, dstLow) {
64
+ var lastByte = dstLow.length - 1;
52
65
 
53
- 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); } }
66
+ while (low <= high) {
67
+ this._map[low++] = dstLow;
68
+ dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
69
+ }
70
+ }
54
71
 
55
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
72
+ mapBfRangeToArray(low, high, array) {
73
+ const ii = array.length;
74
+ let i = 0;
56
75
 
57
- var BUILT_IN_CMAPS = ['Adobe-GB1-UCS2', 'Adobe-CNS1-UCS2', 'Adobe-Japan1-UCS2', 'Adobe-Korea1-UCS2', '78-EUC-H', '78-EUC-V', '78-H', '78-RKSJ-H', '78-RKSJ-V', '78-V', '78ms-RKSJ-H', '78ms-RKSJ-V', '83pv-RKSJ-H', '90ms-RKSJ-H', '90ms-RKSJ-V', '90msp-RKSJ-H', '90msp-RKSJ-V', '90pv-RKSJ-H', '90pv-RKSJ-V', 'Add-H', 'Add-RKSJ-H', 'Add-RKSJ-V', 'Add-V', 'Adobe-CNS1-0', 'Adobe-CNS1-1', 'Adobe-CNS1-2', 'Adobe-CNS1-3', 'Adobe-CNS1-4', 'Adobe-CNS1-5', 'Adobe-CNS1-6', 'Adobe-GB1-0', 'Adobe-GB1-1', 'Adobe-GB1-2', 'Adobe-GB1-3', 'Adobe-GB1-4', 'Adobe-GB1-5', 'Adobe-Japan1-0', 'Adobe-Japan1-1', 'Adobe-Japan1-2', 'Adobe-Japan1-3', 'Adobe-Japan1-4', 'Adobe-Japan1-5', 'Adobe-Japan1-6', 'Adobe-Korea1-0', 'Adobe-Korea1-1', 'Adobe-Korea1-2', 'B5-H', 'B5-V', 'B5pc-H', 'B5pc-V', 'CNS-EUC-H', 'CNS-EUC-V', 'CNS1-H', 'CNS1-V', 'CNS2-H', 'CNS2-V', 'ETHK-B5-H', 'ETHK-B5-V', 'ETen-B5-H', 'ETen-B5-V', 'ETenms-B5-H', 'ETenms-B5-V', 'EUC-H', 'EUC-V', 'Ext-H', 'Ext-RKSJ-H', 'Ext-RKSJ-V', 'Ext-V', 'GB-EUC-H', 'GB-EUC-V', 'GB-H', 'GB-V', 'GBK-EUC-H', 'GBK-EUC-V', 'GBK2K-H', 'GBK2K-V', 'GBKp-EUC-H', 'GBKp-EUC-V', 'GBT-EUC-H', 'GBT-EUC-V', 'GBT-H', 'GBT-V', 'GBTpc-EUC-H', 'GBTpc-EUC-V', 'GBpc-EUC-H', 'GBpc-EUC-V', 'H', 'HKdla-B5-H', 'HKdla-B5-V', 'HKdlb-B5-H', 'HKdlb-B5-V', 'HKgccs-B5-H', 'HKgccs-B5-V', 'HKm314-B5-H', 'HKm314-B5-V', 'HKm471-B5-H', 'HKm471-B5-V', 'HKscs-B5-H', 'HKscs-B5-V', 'Hankaku', 'Hiragana', 'KSC-EUC-H', 'KSC-EUC-V', 'KSC-H', 'KSC-Johab-H', 'KSC-Johab-V', 'KSC-V', 'KSCms-UHC-H', 'KSCms-UHC-HW-H', 'KSCms-UHC-HW-V', 'KSCms-UHC-V', 'KSCpc-EUC-H', 'KSCpc-EUC-V', 'Katakana', 'NWP-H', 'NWP-V', 'RKSJ-H', 'RKSJ-V', 'Roman', 'UniCNS-UCS2-H', 'UniCNS-UCS2-V', 'UniCNS-UTF16-H', 'UniCNS-UTF16-V', 'UniCNS-UTF32-H', 'UniCNS-UTF32-V', 'UniCNS-UTF8-H', 'UniCNS-UTF8-V', 'UniGB-UCS2-H', 'UniGB-UCS2-V', 'UniGB-UTF16-H', 'UniGB-UTF16-V', 'UniGB-UTF32-H', 'UniGB-UTF32-V', 'UniGB-UTF8-H', 'UniGB-UTF8-V', 'UniJIS-UCS2-H', 'UniJIS-UCS2-HW-H', 'UniJIS-UCS2-HW-V', 'UniJIS-UCS2-V', 'UniJIS-UTF16-H', 'UniJIS-UTF16-V', 'UniJIS-UTF32-H', 'UniJIS-UTF32-V', 'UniJIS-UTF8-H', 'UniJIS-UTF8-V', 'UniJIS2004-UTF16-H', 'UniJIS2004-UTF16-V', 'UniJIS2004-UTF32-H', 'UniJIS2004-UTF32-V', 'UniJIS2004-UTF8-H', 'UniJIS2004-UTF8-V', 'UniJISPro-UCS2-HW-V', 'UniJISPro-UCS2-V', 'UniJISPro-UTF8-V', 'UniJISX0213-UTF32-H', 'UniJISX0213-UTF32-V', 'UniJISX02132004-UTF32-H', 'UniJISX02132004-UTF32-V', 'UniKS-UCS2-H', 'UniKS-UCS2-V', 'UniKS-UTF16-H', 'UniKS-UTF16-V', 'UniKS-UTF32-H', 'UniKS-UTF32-V', 'UniKS-UTF8-H', 'UniKS-UTF8-V', 'V', 'WP-Symbol'];
76
+ while (low <= high && i < ii) {
77
+ this._map[low] = array[i++];
78
+ ++low;
79
+ }
80
+ }
58
81
 
59
- var CMap =
60
- /*#__PURE__*/
61
- function () {
62
- function CMap() {
63
- var builtInCMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
82
+ mapOne(src, dst) {
83
+ this._map[src] = dst;
84
+ }
64
85
 
65
- _classCallCheck(this, CMap);
86
+ lookup(code) {
87
+ return this._map[code];
88
+ }
66
89
 
67
- this.codespaceRanges = [[], [], [], []];
68
- this.numCodespaceRanges = 0;
69
- this._map = [];
70
- this.name = '';
71
- this.vertical = false;
72
- this.useCMap = null;
73
- this.builtInCMap = builtInCMap;
90
+ contains(code) {
91
+ return this._map[code] !== undefined;
74
92
  }
75
93
 
76
- _createClass(CMap, [{
77
- key: "addCodespaceRange",
78
- value: function addCodespaceRange(n, low, high) {
79
- this.codespaceRanges[n - 1].push(low, high);
80
- this.numCodespaceRanges++;
81
- }
82
- }, {
83
- key: "mapCidRange",
84
- value: function mapCidRange(low, high, dstLow) {
85
- while (low <= high) {
86
- this._map[low++] = dstLow++;
87
- }
88
- }
89
- }, {
90
- key: "mapBfRange",
91
- value: function mapBfRange(low, high, dstLow) {
92
- var lastByte = dstLow.length - 1;
94
+ forEach(callback) {
95
+ const map = this._map;
96
+ const length = map.length;
93
97
 
94
- while (low <= high) {
95
- this._map[low++] = dstLow;
96
- dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
98
+ if (length <= 0x10000) {
99
+ for (let i = 0; i < length; i++) {
100
+ if (map[i] !== undefined) {
101
+ callback(i, map[i]);
102
+ }
103
+ }
104
+ } else {
105
+ for (const i in map) {
106
+ callback(i, map[i]);
97
107
  }
98
108
  }
99
- }, {
100
- key: "mapBfRangeToArray",
101
- value: function mapBfRangeToArray(low, high, array) {
102
- var i = 0,
103
- ii = array.length;
109
+ }
104
110
 
105
- while (low <= high && i < ii) {
106
- this._map[low] = array[i++];
107
- ++low;
108
- }
111
+ charCodeOf(value) {
112
+ const map = this._map;
113
+
114
+ if (map.length <= 0x10000) {
115
+ return map.indexOf(value);
109
116
  }
110
- }, {
111
- key: "mapOne",
112
- value: function mapOne(src, dst) {
113
- this._map[src] = dst;
114
- }
115
- }, {
116
- key: "lookup",
117
- value: function lookup(code) {
118
- return this._map[code];
119
- }
120
- }, {
121
- key: "contains",
122
- value: function contains(code) {
123
- return this._map[code] !== undefined;
124
- }
125
- }, {
126
- key: "forEach",
127
- value: function forEach(callback) {
128
- var map = this._map;
129
- var length = map.length;
130
-
131
- if (length <= 0x10000) {
132
- for (var i = 0; i < length; i++) {
133
- if (map[i] !== undefined) {
134
- callback(i, map[i]);
135
- }
136
- }
137
- } else {
138
- for (var _i in map) {
139
- callback(_i, map[_i]);
140
- }
117
+
118
+ for (const charCode in map) {
119
+ if (map[charCode] === value) {
120
+ return charCode | 0;
141
121
  }
142
122
  }
143
- }, {
144
- key: "charCodeOf",
145
- value: function charCodeOf(value) {
146
- var map = this._map;
147
123
 
148
- if (map.length <= 0x10000) {
149
- return map.indexOf(value);
150
- }
124
+ return -1;
125
+ }
151
126
 
152
- for (var charCode in map) {
153
- if (map[charCode] === value) {
154
- return charCode | 0;
155
- }
156
- }
127
+ getMap() {
128
+ return this._map;
129
+ }
157
130
 
158
- return -1;
159
- }
160
- }, {
161
- key: "getMap",
162
- value: function getMap() {
163
- return this._map;
164
- }
165
- }, {
166
- key: "readCharCode",
167
- value: function readCharCode(str, offset, out) {
168
- var c = 0;
169
- var codespaceRanges = this.codespaceRanges;
131
+ readCharCode(str, offset, out) {
132
+ let c = 0;
133
+ const codespaceRanges = this.codespaceRanges;
170
134
 
171
- for (var n = 0, nn = codespaceRanges.length; n < nn; n++) {
172
- c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
173
- var codespaceRange = codespaceRanges[n];
135
+ for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
136
+ c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
137
+ const codespaceRange = codespaceRanges[n];
174
138
 
175
- for (var k = 0, kk = codespaceRange.length; k < kk;) {
176
- var low = codespaceRange[k++];
177
- var high = codespaceRange[k++];
139
+ for (let k = 0, kk = codespaceRange.length; k < kk;) {
140
+ const low = codespaceRange[k++];
141
+ const high = codespaceRange[k++];
178
142
 
179
- if (c >= low && c <= high) {
180
- out.charcode = c;
181
- out.length = n + 1;
182
- return;
183
- }
143
+ if (c >= low && c <= high) {
144
+ out.charcode = c;
145
+ out.length = n + 1;
146
+ return;
184
147
  }
185
148
  }
149
+ }
150
+
151
+ out.charcode = 0;
152
+ out.length = 1;
153
+ }
186
154
 
187
- out.charcode = 0;
188
- out.length = 1;
155
+ get length() {
156
+ return this._map.length;
157
+ }
158
+
159
+ get isIdentityCMap() {
160
+ if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
161
+ return false;
189
162
  }
190
- }, {
191
- key: "length",
192
- get: function get() {
193
- return this._map.length;
163
+
164
+ if (this._map.length !== 0x10000) {
165
+ return false;
194
166
  }
195
- }, {
196
- key: "isIdentityCMap",
197
- get: function get() {
198
- if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
199
- return false;
200
- }
201
167
 
202
- if (this._map.length !== 0x10000) {
168
+ for (let i = 0; i < 0x10000; i++) {
169
+ if (this._map[i] !== i) {
203
170
  return false;
204
171
  }
205
-
206
- for (var i = 0; i < 0x10000; i++) {
207
- if (this._map[i] !== i) {
208
- return false;
209
- }
210
- }
211
-
212
- return true;
213
172
  }
214
- }]);
215
173
 
216
- return CMap;
217
- }();
174
+ return true;
175
+ }
176
+
177
+ }
218
178
 
219
179
  exports.CMap = CMap;
220
180
 
221
- var IdentityCMap =
222
- /*#__PURE__*/
223
- function (_CMap) {
224
- _inherits(IdentityCMap, _CMap);
181
+ class IdentityCMap extends CMap {
182
+ constructor(vertical, n) {
183
+ super();
184
+ this.vertical = vertical;
185
+ this.addCodespaceRange(n, 0, 0xffff);
186
+ }
225
187
 
226
- function IdentityCMap(vertical, n) {
227
- var _this;
188
+ mapCidRange(low, high, dstLow) {
189
+ (0, _util.unreachable)("should not call mapCidRange");
190
+ }
228
191
 
229
- _classCallCheck(this, IdentityCMap);
192
+ mapBfRange(low, high, dstLow) {
193
+ (0, _util.unreachable)("should not call mapBfRange");
194
+ }
230
195
 
231
- _this = _possibleConstructorReturn(this, _getPrototypeOf(IdentityCMap).call(this));
232
- _this.vertical = vertical;
196
+ mapBfRangeToArray(low, high, array) {
197
+ (0, _util.unreachable)("should not call mapBfRangeToArray");
198
+ }
233
199
 
234
- _this.addCodespaceRange(n, 0, 0xffff);
200
+ mapOne(src, dst) {
201
+ (0, _util.unreachable)("should not call mapCidOne");
202
+ }
235
203
 
236
- return _this;
204
+ lookup(code) {
205
+ return Number.isInteger(code) && code <= 0xffff ? code : undefined;
237
206
  }
238
207
 
239
- _createClass(IdentityCMap, [{
240
- key: "mapCidRange",
241
- value: function mapCidRange(low, high, dstLow) {
242
- (0, _util.unreachable)('should not call mapCidRange');
243
- }
244
- }, {
245
- key: "mapBfRange",
246
- value: function mapBfRange(low, high, dstLow) {
247
- (0, _util.unreachable)('should not call mapBfRange');
248
- }
249
- }, {
250
- key: "mapBfRangeToArray",
251
- value: function mapBfRangeToArray(low, high, array) {
252
- (0, _util.unreachable)('should not call mapBfRangeToArray');
253
- }
254
- }, {
255
- key: "mapOne",
256
- value: function mapOne(src, dst) {
257
- (0, _util.unreachable)('should not call mapCidOne');
258
- }
259
- }, {
260
- key: "lookup",
261
- value: function lookup(code) {
262
- return Number.isInteger(code) && code <= 0xffff ? code : undefined;
263
- }
264
- }, {
265
- key: "contains",
266
- value: function contains(code) {
267
- return Number.isInteger(code) && code <= 0xffff;
268
- }
269
- }, {
270
- key: "forEach",
271
- value: function forEach(callback) {
272
- for (var i = 0; i <= 0xffff; i++) {
273
- callback(i, i);
274
- }
275
- }
276
- }, {
277
- key: "charCodeOf",
278
- value: function charCodeOf(value) {
279
- return Number.isInteger(value) && value <= 0xffff ? value : -1;
208
+ contains(code) {
209
+ return Number.isInteger(code) && code <= 0xffff;
210
+ }
211
+
212
+ forEach(callback) {
213
+ for (let i = 0; i <= 0xffff; i++) {
214
+ callback(i, i);
280
215
  }
281
- }, {
282
- key: "getMap",
283
- value: function getMap() {
284
- var map = new Array(0x10000);
216
+ }
285
217
 
286
- for (var i = 0; i <= 0xffff; i++) {
287
- map[i] = i;
288
- }
218
+ charCodeOf(value) {
219
+ return Number.isInteger(value) && value <= 0xffff ? value : -1;
220
+ }
289
221
 
290
- return map;
291
- }
292
- }, {
293
- key: "length",
294
- get: function get() {
295
- return 0x10000;
296
- }
297
- }, {
298
- key: "isIdentityCMap",
299
- get: function get() {
300
- (0, _util.unreachable)('should not access .isIdentityCMap');
222
+ getMap() {
223
+ const map = new Array(0x10000);
224
+
225
+ for (let i = 0; i <= 0xffff; i++) {
226
+ map[i] = i;
301
227
  }
302
- }]);
303
228
 
304
- return IdentityCMap;
305
- }(CMap);
229
+ return map;
230
+ }
231
+
232
+ get length() {
233
+ return 0x10000;
234
+ }
235
+
236
+ get isIdentityCMap() {
237
+ (0, _util.unreachable)("should not access .isIdentityCMap");
238
+ }
239
+
240
+ }
306
241
 
307
242
  exports.IdentityCMap = IdentityCMap;
308
243
 
@@ -360,14 +295,15 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
360
295
  }
361
296
 
362
297
  BinaryCMapStream.prototype = {
363
- readByte: function readByte() {
298
+ readByte() {
364
299
  if (this.pos >= this.end) {
365
300
  return -1;
366
301
  }
367
302
 
368
303
  return this.buffer[this.pos++];
369
304
  },
370
- readNumber: function readNumber() {
305
+
306
+ readNumber() {
371
307
  var n = 0;
372
308
  var last;
373
309
 
@@ -375,24 +311,27 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
375
311
  var b = this.readByte();
376
312
 
377
313
  if (b < 0) {
378
- throw new _util.FormatError('unexpected EOF in bcmap');
314
+ throw new _util.FormatError("unexpected EOF in bcmap");
379
315
  }
380
316
 
381
317
  last = !(b & 0x80);
382
- n = n << 7 | b & 0x7F;
318
+ n = n << 7 | b & 0x7f;
383
319
  } while (!last);
384
320
 
385
321
  return n;
386
322
  },
387
- readSigned: function readSigned() {
323
+
324
+ readSigned() {
388
325
  var n = this.readNumber();
389
326
  return n & 1 ? ~(n >>> 1) : n >>> 1;
390
327
  },
391
- readHex: function readHex(num, size) {
328
+
329
+ readHex(num, size) {
392
330
  num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
393
331
  this.pos += size + 1;
394
332
  },
395
- readHexNumber: function readHexNumber(num, size) {
333
+
334
+ readHexNumber(num, size) {
396
335
  var last;
397
336
  var stack = this.tmpBuf,
398
337
  sp = 0;
@@ -401,11 +340,11 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
401
340
  var b = this.readByte();
402
341
 
403
342
  if (b < 0) {
404
- throw new _util.FormatError('unexpected EOF in bcmap');
343
+ throw new _util.FormatError("unexpected EOF in bcmap");
405
344
  }
406
345
 
407
346
  last = !(b & 0x80);
408
- stack[sp++] = b & 0x7F;
347
+ stack[sp++] = b & 0x7f;
409
348
  } while (!last);
410
349
 
411
350
  var i = size,
@@ -424,7 +363,8 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
424
363
  bufferSize -= 8;
425
364
  }
426
365
  },
427
- readHexSigned: function readHexSigned(num, size) {
366
+
367
+ readHexSigned(num, size) {
428
368
  this.readHexNumber(num, size);
429
369
  var sign = num[size] & 1 ? 255 : 0;
430
370
  var c = 0;
@@ -434,9 +374,10 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
434
374
  num[i] = c >> 1 ^ sign;
435
375
  }
436
376
  },
437
- readString: function readString() {
377
+
378
+ readString() {
438
379
  var len = this.readNumber();
439
- var s = '';
380
+ var s = "";
440
381
 
441
382
  for (var i = 0; i < len; i++) {
442
383
  s += String.fromCharCode(this.readNumber());
@@ -444,6 +385,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
444
385
 
445
386
  return s;
446
387
  }
388
+
447
389
  };
448
390
 
449
391
  function processBinaryCMap(data, cMap, extend) {
@@ -454,9 +396,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
454
396
  var useCMap = null;
455
397
  var start = new Uint8Array(MAX_NUM_SIZE);
456
398
  var end = new Uint8Array(MAX_NUM_SIZE);
457
-
458
- var _char = new Uint8Array(MAX_NUM_SIZE);
459
-
399
+ var char = new Uint8Array(MAX_NUM_SIZE);
460
400
  var charCode = new Uint8Array(MAX_NUM_SIZE);
461
401
  var tmp = new Uint8Array(MAX_NUM_SIZE);
462
402
  var code;
@@ -466,7 +406,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
466
406
  var type = b >> 5;
467
407
 
468
408
  if (type === 7) {
469
- switch (b & 0x1F) {
409
+ switch (b & 0x1f) {
470
410
  case 0:
471
411
  stream.readString();
472
412
  break;
@@ -483,7 +423,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
483
423
  var dataSize = b & 15;
484
424
 
485
425
  if (dataSize + 1 > MAX_NUM_SIZE) {
486
- throw new Error('processBinaryCMap: Invalid dataSize.');
426
+ throw new Error("processBinaryCMap: Invalid dataSize.");
487
427
  }
488
428
 
489
429
  var ucs2DataSize = 1;
@@ -526,20 +466,20 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
526
466
  break;
527
467
 
528
468
  case 2:
529
- stream.readHex(_char, dataSize);
469
+ stream.readHex(char, dataSize);
530
470
  code = stream.readNumber();
531
- cMap.mapOne(hexToInt(_char, dataSize), code);
471
+ cMap.mapOne(hexToInt(char, dataSize), code);
532
472
 
533
473
  for (i = 1; i < subitemsCount; i++) {
534
- incHex(_char, dataSize);
474
+ incHex(char, dataSize);
535
475
 
536
476
  if (!sequence) {
537
477
  stream.readHexNumber(tmp, dataSize);
538
- addHex(_char, tmp, dataSize);
478
+ addHex(char, tmp, dataSize);
539
479
  }
540
480
 
541
481
  code = stream.readSigned() + (code + 1);
542
- cMap.mapOne(hexToInt(_char, dataSize), code);
482
+ cMap.mapOne(hexToInt(char, dataSize), code);
543
483
  }
544
484
 
545
485
  break;
@@ -570,22 +510,22 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
570
510
  break;
571
511
 
572
512
  case 4:
573
- stream.readHex(_char, ucs2DataSize);
513
+ stream.readHex(char, ucs2DataSize);
574
514
  stream.readHex(charCode, dataSize);
575
- cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize));
515
+ cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
576
516
 
577
517
  for (i = 1; i < subitemsCount; i++) {
578
- incHex(_char, ucs2DataSize);
518
+ incHex(char, ucs2DataSize);
579
519
 
580
520
  if (!sequence) {
581
521
  stream.readHexNumber(tmp, ucs2DataSize);
582
- addHex(_char, tmp, ucs2DataSize);
522
+ addHex(char, tmp, ucs2DataSize);
583
523
  }
584
524
 
585
525
  incHex(charCode, dataSize);
586
526
  stream.readHexSigned(tmp, dataSize);
587
527
  addHex(charCode, tmp, dataSize);
588
- cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize));
528
+ cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
589
529
  }
590
530
 
591
531
  break;
@@ -616,7 +556,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
616
556
  break;
617
557
 
618
558
  default:
619
- reject(new Error('processBinaryCMap: Unknown type: ' + type));
559
+ reject(new Error("processBinaryCMap: Unknown type: " + type));
620
560
  return;
621
561
  }
622
562
  }
@@ -651,13 +591,13 @@ var CMapFactory = function CMapFactoryClosure() {
651
591
 
652
592
  function expectString(obj) {
653
593
  if (!(0, _util.isString)(obj)) {
654
- throw new _util.FormatError('Malformed CMap: expected string.');
594
+ throw new _util.FormatError("Malformed CMap: expected string.");
655
595
  }
656
596
  }
657
597
 
658
598
  function expectInt(obj) {
659
599
  if (!Number.isInteger(obj)) {
660
- throw new _util.FormatError('Malformed CMap: expected int.');
600
+ throw new _util.FormatError("Malformed CMap: expected int.");
661
601
  }
662
602
  }
663
603
 
@@ -669,7 +609,7 @@ var CMapFactory = function CMapFactoryClosure() {
669
609
  break;
670
610
  }
671
611
 
672
- if ((0, _primitives.isCmd)(obj, 'endbfchar')) {
612
+ if ((0, _primitives.isCmd)(obj, "endbfchar")) {
673
613
  return;
674
614
  }
675
615
 
@@ -690,7 +630,7 @@ var CMapFactory = function CMapFactoryClosure() {
690
630
  break;
691
631
  }
692
632
 
693
- if ((0, _primitives.isCmd)(obj, 'endbfrange')) {
633
+ if ((0, _primitives.isCmd)(obj, "endbfrange")) {
694
634
  return;
695
635
  }
696
636
 
@@ -704,11 +644,11 @@ var CMapFactory = function CMapFactoryClosure() {
704
644
  if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
705
645
  var dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
706
646
  cMap.mapBfRange(low, high, dstLow);
707
- } else if ((0, _primitives.isCmd)(obj, '[')) {
647
+ } else if ((0, _primitives.isCmd)(obj, "[")) {
708
648
  obj = lexer.getObj();
709
649
  var array = [];
710
650
 
711
- while (!(0, _primitives.isCmd)(obj, ']') && !(0, _primitives.isEOF)(obj)) {
651
+ while (!(0, _primitives.isCmd)(obj, "]") && !(0, _primitives.isEOF)(obj)) {
712
652
  array.push(obj);
713
653
  obj = lexer.getObj();
714
654
  }
@@ -719,7 +659,7 @@ var CMapFactory = function CMapFactoryClosure() {
719
659
  }
720
660
  }
721
661
 
722
- throw new _util.FormatError('Invalid bf range.');
662
+ throw new _util.FormatError("Invalid bf range.");
723
663
  }
724
664
 
725
665
  function parseCidChar(cMap, lexer) {
@@ -730,7 +670,7 @@ var CMapFactory = function CMapFactoryClosure() {
730
670
  break;
731
671
  }
732
672
 
733
- if ((0, _primitives.isCmd)(obj, 'endcidchar')) {
673
+ if ((0, _primitives.isCmd)(obj, "endcidchar")) {
734
674
  return;
735
675
  }
736
676
 
@@ -751,7 +691,7 @@ var CMapFactory = function CMapFactoryClosure() {
751
691
  break;
752
692
  }
753
693
 
754
- if ((0, _primitives.isCmd)(obj, 'endcidrange')) {
694
+ if ((0, _primitives.isCmd)(obj, "endcidrange")) {
755
695
  return;
756
696
  }
757
697
 
@@ -775,7 +715,7 @@ var CMapFactory = function CMapFactoryClosure() {
775
715
  break;
776
716
  }
777
717
 
778
- if ((0, _primitives.isCmd)(obj, 'endcodespacerange')) {
718
+ if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
779
719
  return;
780
720
  }
781
721
 
@@ -794,7 +734,7 @@ var CMapFactory = function CMapFactoryClosure() {
794
734
  cMap.addCodespaceRange(obj.length, low, high);
795
735
  }
796
736
 
797
- throw new _util.FormatError('Invalid codespace range.');
737
+ throw new _util.FormatError("Invalid codespace range.");
798
738
  }
799
739
 
800
740
  function parseWMode(cMap, lexer) {
@@ -824,42 +764,42 @@ var CMapFactory = function CMapFactoryClosure() {
824
764
  if ((0, _primitives.isEOF)(obj)) {
825
765
  break;
826
766
  } else if ((0, _primitives.isName)(obj)) {
827
- if (obj.name === 'WMode') {
767
+ if (obj.name === "WMode") {
828
768
  parseWMode(cMap, lexer);
829
- } else if (obj.name === 'CMapName') {
769
+ } else if (obj.name === "CMapName") {
830
770
  parseCMapName(cMap, lexer);
831
771
  }
832
772
 
833
773
  previous = obj;
834
774
  } else if ((0, _primitives.isCmd)(obj)) {
835
775
  switch (obj.cmd) {
836
- case 'endcmap':
776
+ case "endcmap":
837
777
  break objLoop;
838
778
 
839
- case 'usecmap':
779
+ case "usecmap":
840
780
  if ((0, _primitives.isName)(previous)) {
841
781
  embeddedUseCMap = previous.name;
842
782
  }
843
783
 
844
784
  break;
845
785
 
846
- case 'begincodespacerange':
786
+ case "begincodespacerange":
847
787
  parseCodespaceRange(cMap, lexer);
848
788
  break;
849
789
 
850
- case 'beginbfchar':
790
+ case "beginbfchar":
851
791
  parseBfChar(cMap, lexer);
852
792
  break;
853
793
 
854
- case 'begincidchar':
794
+ case "begincidchar":
855
795
  parseCidChar(cMap, lexer);
856
796
  break;
857
797
 
858
- case 'beginbfrange':
798
+ case "beginbfrange":
859
799
  parseBfRange(cMap, lexer);
860
800
  break;
861
801
 
862
- case 'begincidrange':
802
+ case "begincidrange":
863
803
  parseCidRange(cMap, lexer);
864
804
  break;
865
805
  }
@@ -869,7 +809,7 @@ var CMapFactory = function CMapFactoryClosure() {
869
809
  throw ex;
870
810
  }
871
811
 
872
- (0, _util.warn)('Invalid cMap data: ' + ex);
812
+ (0, _util.warn)("Invalid cMap data: " + ex);
873
813
  continue;
874
814
  }
875
815
  }
@@ -909,18 +849,18 @@ var CMapFactory = function CMapFactoryClosure() {
909
849
  }
910
850
 
911
851
  function createBuiltInCMap(name, fetchBuiltInCMap) {
912
- if (name === 'Identity-H') {
852
+ if (name === "Identity-H") {
913
853
  return Promise.resolve(new IdentityCMap(false, 2));
914
- } else if (name === 'Identity-V') {
854
+ } else if (name === "Identity-V") {
915
855
  return Promise.resolve(new IdentityCMap(true, 2));
916
856
  }
917
857
 
918
858
  if (!BUILT_IN_CMAPS.includes(name)) {
919
- return Promise.reject(new Error('Unknown CMap name: ' + name));
859
+ return Promise.reject(new Error("Unknown CMap name: " + name));
920
860
  }
921
861
 
922
862
  if (!fetchBuiltInCMap) {
923
- return Promise.reject(new Error('Built-in CMap parameters are not provided.'));
863
+ return Promise.reject(new Error("Built-in CMap parameters are not provided."));
924
864
  }
925
865
 
926
866
  return fetchBuiltInCMap(name).then(function (data) {
@@ -939,12 +879,12 @@ var CMapFactory = function CMapFactoryClosure() {
939
879
  return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
940
880
  }
941
881
 
942
- return Promise.reject(new Error('TODO: Only BINARY/NONE CMap compression is currently supported.'));
882
+ return Promise.reject(new Error("TODO: Only BINARY/NONE CMap compression is currently supported."));
943
883
  });
944
884
  }
945
885
 
946
886
  return {
947
- create: function create(params) {
887
+ async create(params) {
948
888
  var encoding = params.encoding;
949
889
  var fetchBuiltInCMap = params.fetchBuiltInCMap;
950
890
  var useCMap = params.useCMap;
@@ -963,8 +903,9 @@ var CMapFactory = function CMapFactoryClosure() {
963
903
  });
964
904
  }
965
905
 
966
- return Promise.reject(new Error('Encoding required.'));
906
+ throw new Error("Encoding required.");
967
907
  }
908
+
968
909
  };
969
910
  }();
970
911