pdfjs-dist 2.0.550 → 2.3.200

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 (168) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/bower.json +1 -1
  3. package/build/pdf.js +21618 -14369
  4. package/build/pdf.js.map +1 -1
  5. package/build/pdf.min.js +1 -1
  6. package/build/pdf.worker.js +22758 -11399
  7. package/build/pdf.worker.js.map +1 -1
  8. package/build/pdf.worker.min.js +1 -1
  9. package/image_decoders/pdf.image_decoders.js +11500 -0
  10. package/image_decoders/pdf.image_decoders.js.map +1 -0
  11. package/image_decoders/pdf.image_decoders.min.js +1 -0
  12. package/lib/core/annotation.js +767 -258
  13. package/lib/core/arithmetic_decoder.js +275 -245
  14. package/lib/core/bidi.js +65 -6
  15. package/lib/core/ccitt.js +173 -18
  16. package/lib/core/ccitt_stream.js +15 -6
  17. package/lib/core/cff_parser.js +433 -61
  18. package/lib/core/charsets.js +5 -4
  19. package/lib/core/chunked_stream.js +428 -157
  20. package/lib/core/cmap.js +326 -87
  21. package/lib/core/colorspace.js +874 -594
  22. package/lib/core/core_utils.js +173 -0
  23. package/lib/core/crypto.js +290 -45
  24. package/lib/core/document.js +575 -272
  25. package/lib/core/encodings.js +19 -10
  26. package/lib/core/evaluator.js +1032 -351
  27. package/lib/core/font_renderer.js +331 -97
  28. package/lib/core/fonts.js +813 -196
  29. package/lib/core/function.js +253 -27
  30. package/lib/core/glyphlist.js +5 -3
  31. package/lib/core/image.js +169 -62
  32. package/lib/core/image_utils.js +111 -0
  33. package/lib/core/jbig2.js +502 -72
  34. package/lib/core/jbig2_stream.js +19 -8
  35. package/lib/core/jpeg_stream.js +38 -13
  36. package/lib/core/jpg.js +293 -52
  37. package/lib/core/jpx.js +419 -12
  38. package/lib/core/jpx_stream.js +18 -6
  39. package/lib/core/metrics.js +15 -15
  40. package/lib/core/murmurhash3.js +56 -34
  41. package/lib/core/obj.js +1368 -500
  42. package/lib/core/operator_list.js +159 -43
  43. package/lib/core/parser.js +544 -199
  44. package/lib/core/pattern.js +170 -21
  45. package/lib/core/pdf_manager.js +324 -134
  46. package/lib/core/primitives.js +169 -61
  47. package/lib/core/ps_parser.js +134 -45
  48. package/lib/core/standard_fonts.js +17 -17
  49. package/lib/core/stream.js +327 -34
  50. package/lib/core/type1_parser.js +148 -8
  51. package/lib/core/unicode.js +32 -5
  52. package/lib/core/worker.js +215 -229
  53. package/lib/core/worker_stream.js +277 -0
  54. package/lib/display/annotation_layer.js +618 -192
  55. package/lib/display/api.js +1798 -882
  56. package/lib/display/api_compatibility.js +5 -10
  57. package/lib/display/canvas.js +366 -45
  58. package/lib/display/content_disposition.js +71 -24
  59. package/lib/display/display_utils.js +777 -0
  60. package/lib/display/fetch_stream.js +205 -87
  61. package/lib/display/font_loader.js +468 -236
  62. package/lib/display/metadata.js +38 -16
  63. package/lib/display/network.js +635 -428
  64. package/lib/display/network_utils.js +38 -19
  65. package/lib/display/node_stream.js +367 -175
  66. package/lib/display/pattern_helper.js +103 -36
  67. package/lib/display/svg.js +1232 -519
  68. package/lib/display/text_layer.js +208 -75
  69. package/lib/display/transport_stream.js +345 -94
  70. package/lib/display/webgl.js +64 -18
  71. package/lib/display/worker_options.js +5 -4
  72. package/lib/display/xml_parser.js +166 -53
  73. package/lib/examples/node/domstubs.js +60 -4
  74. package/lib/pdf.js +35 -14
  75. package/lib/pdf.worker.js +5 -3
  76. package/lib/shared/compatibility.js +170 -572
  77. package/lib/shared/global_scope.js +2 -2
  78. package/lib/shared/is_node.js +4 -4
  79. package/lib/shared/message_handler.js +216 -163
  80. package/lib/shared/streams_polyfill.js +21 -17
  81. package/lib/shared/util.js +495 -385
  82. package/lib/test/unit/annotation_spec.js +1464 -401
  83. package/lib/test/unit/api_spec.js +718 -361
  84. package/lib/test/unit/bidi_spec.js +7 -7
  85. package/lib/test/unit/cff_parser_spec.js +54 -11
  86. package/lib/test/unit/clitests_helper.js +9 -10
  87. package/lib/test/unit/cmap_spec.js +95 -41
  88. package/lib/test/unit/colorspace_spec.js +115 -63
  89. package/lib/test/unit/core_utils_spec.js +191 -0
  90. package/lib/test/unit/crypto_spec.js +17 -5
  91. package/lib/test/unit/custom_spec.js +43 -55
  92. package/lib/test/unit/display_svg_spec.js +34 -18
  93. package/lib/test/unit/display_utils_spec.js +273 -0
  94. package/lib/test/unit/document_spec.js +8 -13
  95. package/lib/test/unit/encodings_spec.js +25 -45
  96. package/lib/test/unit/evaluator_spec.js +59 -20
  97. package/lib/test/unit/fetch_stream_spec.js +111 -0
  98. package/lib/test/unit/function_spec.js +17 -5
  99. package/lib/test/unit/jasmine-boot.js +33 -20
  100. package/lib/test/unit/message_handler_spec.js +30 -13
  101. package/lib/test/unit/metadata_spec.js +71 -11
  102. package/lib/test/unit/murmurhash3_spec.js +3 -3
  103. package/lib/test/unit/network_spec.js +22 -55
  104. package/lib/test/unit/network_utils_spec.js +105 -14
  105. package/lib/test/unit/node_stream_spec.js +58 -34
  106. package/lib/test/unit/parser_spec.js +162 -71
  107. package/lib/test/unit/pdf_find_controller_spec.js +230 -0
  108. package/lib/test/unit/pdf_find_utils_spec.js +63 -0
  109. package/lib/test/unit/pdf_history_spec.js +21 -9
  110. package/lib/test/unit/primitives_spec.js +55 -22
  111. package/lib/test/unit/stream_spec.js +12 -4
  112. package/lib/test/unit/test_utils.js +273 -56
  113. package/lib/test/unit/testreporter.js +21 -3
  114. package/lib/test/unit/type1_parser_spec.js +9 -7
  115. package/lib/test/unit/ui_utils_spec.js +236 -36
  116. package/lib/test/unit/unicode_spec.js +18 -15
  117. package/lib/test/unit/util_spec.js +87 -128
  118. package/lib/web/annotation_layer_builder.js +39 -22
  119. package/lib/web/app.js +1252 -609
  120. package/lib/web/app_options.js +103 -65
  121. package/lib/web/base_viewer.js +522 -242
  122. package/lib/web/chromecom.js +259 -117
  123. package/lib/web/debugger.js +166 -22
  124. package/lib/web/download_manager.js +31 -12
  125. package/lib/web/firefox_print_service.js +27 -14
  126. package/lib/web/firefoxcom.js +318 -78
  127. package/lib/web/genericcom.js +89 -30
  128. package/lib/web/genericl10n.js +142 -30
  129. package/lib/web/grab_to_pan.js +28 -4
  130. package/lib/web/interfaces.js +174 -47
  131. package/lib/web/overlay_manager.js +235 -85
  132. package/lib/web/password_prompt.js +22 -14
  133. package/lib/web/pdf_attachment_viewer.js +38 -18
  134. package/lib/web/pdf_cursor_tools.js +39 -16
  135. package/lib/web/pdf_document_properties.js +255 -136
  136. package/lib/web/pdf_find_bar.js +84 -40
  137. package/lib/web/pdf_find_controller.js +495 -184
  138. package/lib/web/pdf_find_utils.js +111 -0
  139. package/lib/web/pdf_history.js +190 -53
  140. package/lib/web/pdf_link_service.js +144 -79
  141. package/lib/web/pdf_outline_viewer.js +124 -47
  142. package/lib/web/pdf_page_view.js +194 -74
  143. package/lib/web/pdf_presentation_mode.js +99 -34
  144. package/lib/web/pdf_print_service.js +59 -13
  145. package/lib/web/pdf_rendering_queue.js +28 -9
  146. package/lib/web/pdf_sidebar.js +144 -81
  147. package/lib/web/pdf_sidebar_resizer.js +42 -16
  148. package/lib/web/pdf_single_page_viewer.js +74 -66
  149. package/lib/web/pdf_thumbnail_view.js +104 -33
  150. package/lib/web/pdf_thumbnail_viewer.js +66 -26
  151. package/lib/web/pdf_viewer.component.js +112 -32
  152. package/lib/web/pdf_viewer.js +82 -87
  153. package/lib/web/preferences.js +284 -91
  154. package/lib/web/secondary_toolbar.js +132 -59
  155. package/lib/web/text_layer_builder.js +134 -59
  156. package/lib/web/toolbar.js +80 -43
  157. package/lib/web/ui_utils.js +400 -134
  158. package/lib/web/view_history.js +215 -67
  159. package/lib/web/viewer_compatibility.js +3 -8
  160. package/package.json +3 -2
  161. package/web/pdf_viewer.css +23 -15
  162. package/web/pdf_viewer.js +3429 -1245
  163. package/web/pdf_viewer.js.map +1 -1
  164. package/external/streams/streams-lib.js +0 -3962
  165. package/lib/display/dom_utils.js +0 -429
  166. package/lib/test/unit/dom_utils_spec.js +0 -89
  167. package/lib/test/unit/fonts_spec.js +0 -81
  168. 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,657 +19,255 @@
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
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
24
+ 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); }
25
25
 
26
26
  var globalScope = require('./global_scope');
27
+
27
28
  if (!globalScope._pdfjsCompatibilityChecked) {
28
29
  globalScope._pdfjsCompatibilityChecked = true;
30
+
29
31
  var isNodeJS = require('./is_node');
30
- var hasDOM = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' && (typeof document === 'undefined' ? 'undefined' : _typeof(document)) === 'object';
32
+
33
+ var hasDOM = (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object';
34
+
31
35
  (function checkNodeBtoa() {
32
36
  if (globalScope.btoa || !isNodeJS()) {
33
37
  return;
34
38
  }
39
+
35
40
  globalScope.btoa = function (chars) {
36
41
  return Buffer.from(chars, 'binary').toString('base64');
37
42
  };
38
43
  })();
44
+
39
45
  (function checkNodeAtob() {
40
46
  if (globalScope.atob || !isNodeJS()) {
41
47
  return;
42
48
  }
49
+
43
50
  globalScope.atob = function (input) {
44
51
  return Buffer.from(input, 'base64').toString('binary');
45
52
  };
46
53
  })();
47
- (function checkCurrentScript() {
48
- if (!hasDOM) {
49
- return;
50
- }
51
- if ('currentScript' in document) {
52
- return;
53
- }
54
- Object.defineProperty(document, 'currentScript', {
55
- get: function get() {
56
- var scripts = document.getElementsByTagName('script');
57
- return scripts[scripts.length - 1];
58
- },
59
-
60
- enumerable: true,
61
- configurable: true
62
- });
63
- })();
54
+
64
55
  (function checkChildNodeRemove() {
65
56
  if (!hasDOM) {
66
57
  return;
67
58
  }
59
+
68
60
  if (typeof Element.prototype.remove !== 'undefined') {
69
61
  return;
70
62
  }
63
+
71
64
  Element.prototype.remove = function () {
72
65
  if (this.parentNode) {
73
66
  this.parentNode.removeChild(this);
74
67
  }
75
68
  };
76
69
  })();
70
+
71
+ (function checkDOMTokenListAddRemove() {
72
+ if (!hasDOM || isNodeJS()) {
73
+ return;
74
+ }
75
+
76
+ var div = document.createElement('div');
77
+ div.classList.add('testOne', 'testTwo');
78
+
79
+ if (div.classList.contains('testOne') === true && div.classList.contains('testTwo') === true) {
80
+ return;
81
+ }
82
+
83
+ var OriginalDOMTokenListAdd = DOMTokenList.prototype.add;
84
+ var OriginalDOMTokenListRemove = DOMTokenList.prototype.remove;
85
+
86
+ DOMTokenList.prototype.add = function () {
87
+ for (var _len = arguments.length, tokens = new Array(_len), _key = 0; _key < _len; _key++) {
88
+ tokens[_key] = arguments[_key];
89
+ }
90
+
91
+ for (var _i = 0, _tokens = tokens; _i < _tokens.length; _i++) {
92
+ var token = _tokens[_i];
93
+ OriginalDOMTokenListAdd.call(this, token);
94
+ }
95
+ };
96
+
97
+ DOMTokenList.prototype.remove = function () {
98
+ for (var _len2 = arguments.length, tokens = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
99
+ tokens[_key2] = arguments[_key2];
100
+ }
101
+
102
+ for (var _i2 = 0, _tokens2 = tokens; _i2 < _tokens2.length; _i2++) {
103
+ var token = _tokens2[_i2];
104
+ OriginalDOMTokenListRemove.call(this, token);
105
+ }
106
+ };
107
+ })();
108
+
109
+ (function checkDOMTokenListToggle() {
110
+ if (!hasDOM || isNodeJS()) {
111
+ return;
112
+ }
113
+
114
+ var div = document.createElement('div');
115
+
116
+ if (div.classList.toggle('test', 0) === false) {
117
+ return;
118
+ }
119
+
120
+ DOMTokenList.prototype.toggle = function (token) {
121
+ var force = arguments.length > 1 ? !!arguments[1] : !this.contains(token);
122
+ return this[force ? 'add' : 'remove'](token), force;
123
+ };
124
+ })();
125
+
126
+ (function checkStringStartsWith() {
127
+ if (String.prototype.startsWith) {
128
+ return;
129
+ }
130
+
131
+ require('core-js/es/string/starts-with');
132
+ })();
133
+
134
+ (function checkStringEndsWith() {
135
+ if (String.prototype.endsWith) {
136
+ return;
137
+ }
138
+
139
+ require('core-js/es/string/ends-with');
140
+ })();
141
+
77
142
  (function checkStringIncludes() {
78
143
  if (String.prototype.includes) {
79
144
  return;
80
145
  }
81
- require('core-js/fn/string/includes');
146
+
147
+ require('core-js/es/string/includes');
82
148
  })();
149
+
83
150
  (function checkArrayIncludes() {
84
151
  if (Array.prototype.includes) {
85
152
  return;
86
153
  }
87
- require('core-js/fn/array/includes');
154
+
155
+ require('core-js/es/array/includes');
156
+ })();
157
+
158
+ (function checkArrayFrom() {
159
+ if (Array.from) {
160
+ return;
161
+ }
162
+
163
+ require('core-js/es/array/from');
88
164
  })();
165
+
166
+ (function checkObjectAssign() {
167
+ if (Object.assign) {
168
+ return;
169
+ }
170
+
171
+ require('core-js/es/object/assign');
172
+ })();
173
+
89
174
  (function checkMathLog2() {
90
175
  if (Math.log2) {
91
176
  return;
92
177
  }
93
- Math.log2 = require('core-js/fn/math/log2');
178
+
179
+ Math.log2 = require('core-js/es/math/log2');
94
180
  })();
181
+
95
182
  (function checkNumberIsNaN() {
96
183
  if (Number.isNaN) {
97
184
  return;
98
185
  }
99
- Number.isNaN = require('core-js/fn/number/is-nan');
186
+
187
+ Number.isNaN = require('core-js/es/number/is-nan');
100
188
  })();
189
+
101
190
  (function checkNumberIsInteger() {
102
191
  if (Number.isInteger) {
103
192
  return;
104
193
  }
105
- Number.isInteger = require('core-js/fn/number/is-integer');
194
+
195
+ Number.isInteger = require('core-js/es/number/is-integer');
106
196
  })();
197
+
107
198
  (function checkPromise() {
108
- if (globalScope.Promise) {
199
+ if (globalScope.Promise && globalScope.Promise.prototype && globalScope.Promise.prototype["finally"]) {
109
200
  return;
110
201
  }
111
- globalScope.Promise = require('core-js/fn/promise');
202
+
203
+ globalScope.Promise = require('core-js/es/promise/index');
204
+ })();
205
+
206
+ (function checkURL() {
207
+ globalScope.URL = require('core-js/web/url');
112
208
  })();
209
+
113
210
  (function checkWeakMap() {
114
211
  if (globalScope.WeakMap) {
115
212
  return;
116
213
  }
117
- globalScope.WeakMap = require('core-js/fn/weak-map');
214
+
215
+ globalScope.WeakMap = require('core-js/es/weak-map/index');
118
216
  })();
119
- (function checkURLConstructor() {
120
- var hasWorkingUrl = false;
121
- try {
122
- if (typeof URL === 'function' && _typeof(URL.prototype) === 'object' && 'origin' in URL.prototype) {
123
- var u = new URL('b', 'http://a');
124
- u.pathname = 'c%20d';
125
- hasWorkingUrl = u.href === 'http://a/c%20d';
126
- }
127
- } catch (e) {}
128
- if (hasWorkingUrl) {
217
+
218
+ (function checkWeakSet() {
219
+ if (globalScope.WeakSet) {
129
220
  return;
130
221
  }
131
- var relative = Object.create(null);
132
- relative['ftp'] = 21;
133
- relative['file'] = 0;
134
- relative['gopher'] = 70;
135
- relative['http'] = 80;
136
- relative['https'] = 443;
137
- relative['ws'] = 80;
138
- relative['wss'] = 443;
139
- var relativePathDotMapping = Object.create(null);
140
- relativePathDotMapping['%2e'] = '.';
141
- relativePathDotMapping['.%2e'] = '..';
142
- relativePathDotMapping['%2e.'] = '..';
143
- relativePathDotMapping['%2e%2e'] = '..';
144
- function isRelativeScheme(scheme) {
145
- return relative[scheme] !== undefined;
146
- }
147
- function invalid() {
148
- clear.call(this);
149
- this._isInvalid = true;
150
- }
151
- function IDNAToASCII(h) {
152
- if (h === '') {
153
- invalid.call(this);
154
- }
155
- return h.toLowerCase();
156
- }
157
- function percentEscape(c) {
158
- var unicode = c.charCodeAt(0);
159
- if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1) {
160
- return c;
161
- }
162
- return encodeURIComponent(c);
163
- }
164
- function percentEscapeQuery(c) {
165
- var unicode = c.charCodeAt(0);
166
- if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1) {
167
- return c;
168
- }
169
- return encodeURIComponent(c);
222
+
223
+ globalScope.WeakSet = require('core-js/es/weak-set/index');
224
+ })();
225
+
226
+ (function checkStringCodePointAt() {
227
+ if (String.prototype.codePointAt) {
228
+ return;
170
229
  }
171
- var EOF,
172
- ALPHA = /[a-zA-Z]/,
173
- ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
174
- function parse(input, stateOverride, base) {
175
- function err(message) {
176
- errors.push(message);
177
- }
178
- var state = stateOverride || 'scheme start',
179
- cursor = 0,
180
- buffer = '',
181
- seenAt = false,
182
- seenBracket = false,
183
- errors = [];
184
- loop: while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
185
- var c = input[cursor];
186
- switch (state) {
187
- case 'scheme start':
188
- if (c && ALPHA.test(c)) {
189
- buffer += c.toLowerCase();
190
- state = 'scheme';
191
- } else if (!stateOverride) {
192
- buffer = '';
193
- state = 'no scheme';
194
- continue;
195
- } else {
196
- err('Invalid scheme.');
197
- break loop;
198
- }
199
- break;
200
- case 'scheme':
201
- if (c && ALPHANUMERIC.test(c)) {
202
- buffer += c.toLowerCase();
203
- } else if (c === ':') {
204
- this._scheme = buffer;
205
- buffer = '';
206
- if (stateOverride) {
207
- break loop;
208
- }
209
- if (isRelativeScheme(this._scheme)) {
210
- this._isRelative = true;
211
- }
212
- if (this._scheme === 'file') {
213
- state = 'relative';
214
- } else if (this._isRelative && base && base._scheme === this._scheme) {
215
- state = 'relative or authority';
216
- } else if (this._isRelative) {
217
- state = 'authority first slash';
218
- } else {
219
- state = 'scheme data';
220
- }
221
- } else if (!stateOverride) {
222
- buffer = '';
223
- cursor = 0;
224
- state = 'no scheme';
225
- continue;
226
- } else if (c === EOF) {
227
- break loop;
228
- } else {
229
- err('Code point not allowed in scheme: ' + c);
230
- break loop;
231
- }
232
- break;
233
- case 'scheme data':
234
- if (c === '?') {
235
- this._query = '?';
236
- state = 'query';
237
- } else if (c === '#') {
238
- this._fragment = '#';
239
- state = 'fragment';
240
- } else {
241
- if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
242
- this._schemeData += percentEscape(c);
243
- }
244
- }
245
- break;
246
- case 'no scheme':
247
- if (!base || !isRelativeScheme(base._scheme)) {
248
- err('Missing scheme.');
249
- invalid.call(this);
250
- } else {
251
- state = 'relative';
252
- continue;
253
- }
254
- break;
255
- case 'relative or authority':
256
- if (c === '/' && input[cursor + 1] === '/') {
257
- state = 'authority ignore slashes';
258
- } else {
259
- err('Expected /, got: ' + c);
260
- state = 'relative';
261
- continue;
262
- }
263
- break;
264
- case 'relative':
265
- this._isRelative = true;
266
- if (this._scheme !== 'file') {
267
- this._scheme = base._scheme;
268
- }
269
- if (c === EOF) {
270
- this._host = base._host;
271
- this._port = base._port;
272
- this._path = base._path.slice();
273
- this._query = base._query;
274
- this._username = base._username;
275
- this._password = base._password;
276
- break loop;
277
- } else if (c === '/' || c === '\\') {
278
- if (c === '\\') {
279
- err('\\ is an invalid code point.');
280
- }
281
- state = 'relative slash';
282
- } else if (c === '?') {
283
- this._host = base._host;
284
- this._port = base._port;
285
- this._path = base._path.slice();
286
- this._query = '?';
287
- this._username = base._username;
288
- this._password = base._password;
289
- state = 'query';
290
- } else if (c === '#') {
291
- this._host = base._host;
292
- this._port = base._port;
293
- this._path = base._path.slice();
294
- this._query = base._query;
295
- this._fragment = '#';
296
- this._username = base._username;
297
- this._password = base._password;
298
- state = 'fragment';
299
- } else {
300
- var nextC = input[cursor + 1];
301
- var nextNextC = input[cursor + 2];
302
- if (this._scheme !== 'file' || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || nextNextC !== EOF && nextNextC !== '/' && nextNextC !== '\\' && nextNextC !== '?' && nextNextC !== '#') {
303
- this._host = base._host;
304
- this._port = base._port;
305
- this._username = base._username;
306
- this._password = base._password;
307
- this._path = base._path.slice();
308
- this._path.pop();
309
- }
310
- state = 'relative path';
311
- continue;
312
- }
313
- break;
314
- case 'relative slash':
315
- if (c === '/' || c === '\\') {
316
- if (c === '\\') {
317
- err('\\ is an invalid code point.');
318
- }
319
- if (this._scheme === 'file') {
320
- state = 'file host';
321
- } else {
322
- state = 'authority ignore slashes';
323
- }
324
- } else {
325
- if (this._scheme !== 'file') {
326
- this._host = base._host;
327
- this._port = base._port;
328
- this._username = base._username;
329
- this._password = base._password;
330
- }
331
- state = 'relative path';
332
- continue;
333
- }
334
- break;
335
- case 'authority first slash':
336
- if (c === '/') {
337
- state = 'authority second slash';
338
- } else {
339
- err('Expected \'/\', got: ' + c);
340
- state = 'authority ignore slashes';
341
- continue;
342
- }
343
- break;
344
- case 'authority second slash':
345
- state = 'authority ignore slashes';
346
- if (c !== '/') {
347
- err('Expected \'/\', got: ' + c);
348
- continue;
349
- }
350
- break;
351
- case 'authority ignore slashes':
352
- if (c !== '/' && c !== '\\') {
353
- state = 'authority';
354
- continue;
355
- } else {
356
- err('Expected authority, got: ' + c);
357
- }
358
- break;
359
- case 'authority':
360
- if (c === '@') {
361
- if (seenAt) {
362
- err('@ already seen.');
363
- buffer += '%40';
364
- }
365
- seenAt = true;
366
- for (var i = 0; i < buffer.length; i++) {
367
- var cp = buffer[i];
368
- if (cp === '\t' || cp === '\n' || cp === '\r') {
369
- err('Invalid whitespace in authority.');
370
- continue;
371
- }
372
- if (cp === ':' && this._password === null) {
373
- this._password = '';
374
- continue;
375
- }
376
- var tempC = percentEscape(cp);
377
- if (this._password !== null) {
378
- this._password += tempC;
379
- } else {
380
- this._username += tempC;
381
- }
382
- }
383
- buffer = '';
384
- } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
385
- cursor -= buffer.length;
386
- buffer = '';
387
- state = 'host';
388
- continue;
389
- } else {
390
- buffer += c;
391
- }
392
- break;
393
- case 'file host':
394
- if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
395
- if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
396
- state = 'relative path';
397
- } else if (buffer.length === 0) {
398
- state = 'relative path start';
399
- } else {
400
- this._host = IDNAToASCII.call(this, buffer);
401
- buffer = '';
402
- state = 'relative path start';
403
- }
404
- continue;
405
- } else if (c === '\t' || c === '\n' || c === '\r') {
406
- err('Invalid whitespace in file host.');
407
- } else {
408
- buffer += c;
409
- }
410
- break;
411
- case 'host':
412
- case 'hostname':
413
- if (c === ':' && !seenBracket) {
414
- this._host = IDNAToASCII.call(this, buffer);
415
- buffer = '';
416
- state = 'port';
417
- if (stateOverride === 'hostname') {
418
- break loop;
419
- }
420
- } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
421
- this._host = IDNAToASCII.call(this, buffer);
422
- buffer = '';
423
- state = 'relative path start';
424
- if (stateOverride) {
425
- break loop;
426
- }
427
- continue;
428
- } else if (c !== '\t' && c !== '\n' && c !== '\r') {
429
- if (c === '[') {
430
- seenBracket = true;
431
- } else if (c === ']') {
432
- seenBracket = false;
433
- }
434
- buffer += c;
435
- } else {
436
- err('Invalid code point in host/hostname: ' + c);
437
- }
438
- break;
439
- case 'port':
440
- if (/[0-9]/.test(c)) {
441
- buffer += c;
442
- } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
443
- if (buffer !== '') {
444
- var temp = parseInt(buffer, 10);
445
- if (temp !== relative[this._scheme]) {
446
- this._port = temp + '';
447
- }
448
- buffer = '';
449
- }
450
- if (stateOverride) {
451
- break loop;
452
- }
453
- state = 'relative path start';
454
- continue;
455
- } else if (c === '\t' || c === '\n' || c === '\r') {
456
- err('Invalid code point in port: ' + c);
457
- } else {
458
- invalid.call(this);
459
- }
460
- break;
461
- case 'relative path start':
462
- if (c === '\\') {
463
- err('\'\\\' not allowed in path.');
464
- }
465
- state = 'relative path';
466
- if (c !== '/' && c !== '\\') {
467
- continue;
468
- }
469
- break;
470
- case 'relative path':
471
- if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
472
- if (c === '\\') {
473
- err('\\ not allowed in relative path.');
474
- }
475
- var tmp;
476
- if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
477
- buffer = tmp;
478
- }
479
- if (buffer === '..') {
480
- this._path.pop();
481
- if (c !== '/' && c !== '\\') {
482
- this._path.push('');
483
- }
484
- } else if (buffer === '.' && c !== '/' && c !== '\\') {
485
- this._path.push('');
486
- } else if (buffer !== '.') {
487
- if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
488
- buffer = buffer[0] + ':';
489
- }
490
- this._path.push(buffer);
491
- }
492
- buffer = '';
493
- if (c === '?') {
494
- this._query = '?';
495
- state = 'query';
496
- } else if (c === '#') {
497
- this._fragment = '#';
498
- state = 'fragment';
499
- }
500
- } else if (c !== '\t' && c !== '\n' && c !== '\r') {
501
- buffer += percentEscape(c);
502
- }
503
- break;
504
- case 'query':
505
- if (!stateOverride && c === '#') {
506
- this._fragment = '#';
507
- state = 'fragment';
508
- } else if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
509
- this._query += percentEscapeQuery(c);
510
- }
511
- break;
512
- case 'fragment':
513
- if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
514
- this._fragment += c;
515
- }
516
- break;
517
- }
518
- cursor++;
519
- }
230
+
231
+ require('core-js/es/string/code-point-at');
232
+ })();
233
+
234
+ (function checkStringFromCodePoint() {
235
+ if (String.fromCodePoint) {
236
+ return;
520
237
  }
521
- function clear() {
522
- this._scheme = '';
523
- this._schemeData = '';
524
- this._username = '';
525
- this._password = null;
526
- this._host = '';
527
- this._port = '';
528
- this._path = [];
529
- this._query = '';
530
- this._fragment = '';
531
- this._isInvalid = false;
532
- this._isRelative = false;
238
+
239
+ String.fromCodePoint = require('core-js/es/string/from-code-point');
240
+ })();
241
+
242
+ (function checkSymbol() {
243
+ if (globalScope.Symbol) {
244
+ return;
533
245
  }
534
- function JURL(url, base) {
535
- if (base !== undefined && !(base instanceof JURL)) {
536
- base = new JURL(String(base));
537
- }
538
- this._url = url;
539
- clear.call(this);
540
- var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
541
- parse.call(this, input, null, base);
246
+
247
+ require('core-js/es/symbol/index');
248
+ })();
249
+
250
+ (function checkStringPadStart() {
251
+ if (String.prototype.padStart) {
252
+ return;
542
253
  }
543
- JURL.prototype = {
544
- toString: function toString() {
545
- return this.href;
546
- },
547
-
548
- get href() {
549
- if (this._isInvalid) {
550
- return this._url;
551
- }
552
- var authority = '';
553
- if (this._username !== '' || this._password !== null) {
554
- authority = this._username + (this._password !== null ? ':' + this._password : '') + '@';
555
- }
556
- return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
557
- },
558
- set href(value) {
559
- clear.call(this);
560
- parse.call(this, value);
561
- },
562
- get protocol() {
563
- return this._scheme + ':';
564
- },
565
- set protocol(value) {
566
- if (this._isInvalid) {
567
- return;
568
- }
569
- parse.call(this, value + ':', 'scheme start');
570
- },
571
- get host() {
572
- return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
573
- },
574
- set host(value) {
575
- if (this._isInvalid || !this._isRelative) {
576
- return;
577
- }
578
- parse.call(this, value, 'host');
579
- },
580
- get hostname() {
581
- return this._host;
582
- },
583
- set hostname(value) {
584
- if (this._isInvalid || !this._isRelative) {
585
- return;
586
- }
587
- parse.call(this, value, 'hostname');
588
- },
589
- get port() {
590
- return this._port;
591
- },
592
- set port(value) {
593
- if (this._isInvalid || !this._isRelative) {
594
- return;
595
- }
596
- parse.call(this, value, 'port');
597
- },
598
- get pathname() {
599
- return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
600
- },
601
- set pathname(value) {
602
- if (this._isInvalid || !this._isRelative) {
603
- return;
604
- }
605
- this._path = [];
606
- parse.call(this, value, 'relative path start');
607
- },
608
- get search() {
609
- return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
610
- },
611
- set search(value) {
612
- if (this._isInvalid || !this._isRelative) {
613
- return;
614
- }
615
- this._query = '?';
616
- if (value[0] === '?') {
617
- value = value.slice(1);
618
- }
619
- parse.call(this, value, 'query');
620
- },
621
- get hash() {
622
- return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
623
- },
624
- set hash(value) {
625
- if (this._isInvalid) {
626
- return;
627
- }
628
- this._fragment = '#';
629
- if (value[0] === '#') {
630
- value = value.slice(1);
631
- }
632
- parse.call(this, value, 'fragment');
633
- },
634
- get origin() {
635
- var host;
636
- if (this._isInvalid || !this._scheme) {
637
- return '';
638
- }
639
- switch (this._scheme) {
640
- case 'data':
641
- case 'file':
642
- case 'javascript':
643
- case 'mailto':
644
- return 'null';
645
- case 'blob':
646
- try {
647
- return new JURL(this._schemeData).origin || 'null';
648
- } catch (_) {}
649
- return 'null';
650
- }
651
- host = this.host;
652
- if (!host) {
653
- return '';
654
- }
655
- return this._scheme + '://' + host;
656
- }
657
- };
658
- var OriginalURL = globalScope.URL;
659
- if (OriginalURL) {
660
- JURL.createObjectURL = function (blob) {
661
- return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
662
- };
663
- JURL.revokeObjectURL = function (url) {
664
- OriginalURL.revokeObjectURL(url);
665
- };
254
+
255
+ require('core-js/es/string/pad-start');
256
+ })();
257
+
258
+ (function checkStringPadEnd() {
259
+ if (String.prototype.padEnd) {
260
+ return;
666
261
  }
667
- globalScope.URL = JURL;
262
+
263
+ require('core-js/es/string/pad-end');
668
264
  })();
265
+
669
266
  (function checkObjectValues() {
670
267
  if (Object.values) {
671
268
  return;
672
269
  }
673
- Object.values = require('core-js/fn/object/values');
270
+
271
+ Object.values = require('core-js/es/object/values');
674
272
  })();
675
273
  }