1 | (function(modules) {
|
2 |
|
3 | var installedModules = {};
|
4 |
|
5 |
|
6 | function __webpack_require__(moduleId) {
|
7 |
|
8 |
|
9 | if(installedModules[moduleId]) {
|
10 | return installedModules[moduleId].exports;
|
11 | }
|
12 |
|
13 | var module = installedModules[moduleId] = {
|
14 | i: moduleId,
|
15 | l: false,
|
16 | exports: {}
|
17 | };
|
18 |
|
19 |
|
20 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21 |
|
22 |
|
23 | module.l = true;
|
24 |
|
25 |
|
26 | return module.exports;
|
27 | }
|
28 |
|
29 |
|
30 |
|
31 | __webpack_require__.m = modules;
|
32 |
|
33 |
|
34 | __webpack_require__.c = installedModules;
|
35 |
|
36 |
|
37 | __webpack_require__.d = function(exports, name, getter) {
|
38 | if(!__webpack_require__.o(exports, name)) {
|
39 | Object.defineProperty(exports, name, {
|
40 | configurable: false,
|
41 | enumerable: true,
|
42 | get: getter
|
43 | /******/ });
|
44 | /******/ }
|
45 | /******/ };
|
46 | /******/
|
47 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
48 | /******/ __webpack_require__.n = function(module) {
|
49 | var getter = module && module.__esModule ?
|
50 | function getDefault() { return module['default']; } :
|
51 | function getModuleExports() { return module; };
|
52 | __webpack_require__.d(getter, 'a', getter);
|
53 | return getter;
|
54 | };
|
55 |
|
56 |
|
57 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
58 |
|
59 |
|
60 | __webpack_require__.p = "";
|
61 |
|
62 |
|
63 | return __webpack_require__(__webpack_require__.s = 21);
|
64 | })
|
65 |
|
66 | ([
|
67 |
|
68 | (function(module, exports) {
|
69 |
|
70 | var g;
|
71 |
|
72 |
|
73 | g = (function() {
|
74 | return this;
|
75 | })();
|
76 |
|
77 | try {
|
78 |
|
79 | g = g || Function("return this")() || (1,eval)("this");
|
80 | } catch(e) {
|
81 |
|
82 | if(typeof window === "object")
|
83 | g = window;
|
84 | }
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | module.exports = g;
|
91 |
|
92 |
|
93 | }),
|
94 |
|
95 | (function(module, exports) {
|
96 |
|
97 |
|
98 | var process = module.exports = {};
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 | var cachedSetTimeout;
|
106 | var cachedClearTimeout;
|
107 |
|
108 | function defaultSetTimout() {
|
109 | throw new Error('setTimeout has not been defined');
|
110 | }
|
111 | function defaultClearTimeout () {
|
112 | throw new Error('clearTimeout has not been defined');
|
113 | }
|
114 | (function () {
|
115 | try {
|
116 | if (typeof setTimeout === 'function') {
|
117 | cachedSetTimeout = setTimeout;
|
118 | } else {
|
119 | cachedSetTimeout = defaultSetTimout;
|
120 | }
|
121 | } catch (e) {
|
122 | cachedSetTimeout = defaultSetTimout;
|
123 | }
|
124 | try {
|
125 | if (typeof clearTimeout === 'function') {
|
126 | cachedClearTimeout = clearTimeout;
|
127 | } else {
|
128 | cachedClearTimeout = defaultClearTimeout;
|
129 | }
|
130 | } catch (e) {
|
131 | cachedClearTimeout = defaultClearTimeout;
|
132 | }
|
133 | } ())
|
134 | function runTimeout(fun) {
|
135 | if (cachedSetTimeout === setTimeout) {
|
136 |
|
137 | return setTimeout(fun, 0);
|
138 | }
|
139 |
|
140 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
141 | cachedSetTimeout = setTimeout;
|
142 | return setTimeout(fun, 0);
|
143 | }
|
144 | try {
|
145 |
|
146 | return cachedSetTimeout(fun, 0);
|
147 | } catch(e){
|
148 | try {
|
149 |
|
150 | return cachedSetTimeout.call(null, fun, 0);
|
151 | } catch(e){
|
152 |
|
153 | return cachedSetTimeout.call(this, fun, 0);
|
154 | }
|
155 | }
|
156 |
|
157 |
|
158 | }
|
159 | function runClearTimeout(marker) {
|
160 | if (cachedClearTimeout === clearTimeout) {
|
161 |
|
162 | return clearTimeout(marker);
|
163 | }
|
164 |
|
165 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
166 | cachedClearTimeout = clearTimeout;
|
167 | return clearTimeout(marker);
|
168 | }
|
169 | try {
|
170 |
|
171 | return cachedClearTimeout(marker);
|
172 | } catch (e){
|
173 | try {
|
174 |
|
175 | return cachedClearTimeout.call(null, marker);
|
176 | } catch (e){
|
177 |
|
178 |
|
179 | return cachedClearTimeout.call(this, marker);
|
180 | }
|
181 | }
|
182 |
|
183 |
|
184 |
|
185 | }
|
186 | var queue = [];
|
187 | var draining = false;
|
188 | var currentQueue;
|
189 | var queueIndex = -1;
|
190 |
|
191 | function cleanUpNextTick() {
|
192 | if (!draining || !currentQueue) {
|
193 | return;
|
194 | }
|
195 | draining = false;
|
196 | if (currentQueue.length) {
|
197 | queue = currentQueue.concat(queue);
|
198 | } else {
|
199 | queueIndex = -1;
|
200 | }
|
201 | if (queue.length) {
|
202 | drainQueue();
|
203 | }
|
204 | }
|
205 |
|
206 | function drainQueue() {
|
207 | if (draining) {
|
208 | return;
|
209 | }
|
210 | var timeout = runTimeout(cleanUpNextTick);
|
211 | draining = true;
|
212 |
|
213 | var len = queue.length;
|
214 | while(len) {
|
215 | currentQueue = queue;
|
216 | queue = [];
|
217 | while (++queueIndex < len) {
|
218 | if (currentQueue) {
|
219 | currentQueue[queueIndex].run();
|
220 | }
|
221 | }
|
222 | queueIndex = -1;
|
223 | len = queue.length;
|
224 | }
|
225 | currentQueue = null;
|
226 | draining = false;
|
227 | runClearTimeout(timeout);
|
228 | }
|
229 |
|
230 | process.nextTick = function (fun) {
|
231 | var args = new Array(arguments.length - 1);
|
232 | if (arguments.length > 1) {
|
233 | for (var i = 1; i < arguments.length; i++) {
|
234 | args[i - 1] = arguments[i];
|
235 | }
|
236 | }
|
237 | queue.push(new Item(fun, args));
|
238 | if (queue.length === 1 && !draining) {
|
239 | runTimeout(drainQueue);
|
240 | }
|
241 | };
|
242 |
|
243 |
|
244 | function Item(fun, array) {
|
245 | this.fun = fun;
|
246 | this.array = array;
|
247 | }
|
248 | Item.prototype.run = function () {
|
249 | this.fun.apply(null, this.array);
|
250 | };
|
251 | process.title = 'browser';
|
252 | process.browser = true;
|
253 | process.env = {};
|
254 | process.argv = [];
|
255 | process.version = '';
|
256 | process.versions = {};
|
257 |
|
258 | function noop() {}
|
259 |
|
260 | process.on = noop;
|
261 | process.addListener = noop;
|
262 | process.once = noop;
|
263 | process.off = noop;
|
264 | process.removeListener = noop;
|
265 | process.removeAllListeners = noop;
|
266 | process.emit = noop;
|
267 | process.prependListener = noop;
|
268 | process.prependOnceListener = noop;
|
269 |
|
270 | process.listeners = function (name) { return [] }
|
271 |
|
272 | process.binding = function (name) {
|
273 | throw new Error('process.binding is not supported');
|
274 | };
|
275 |
|
276 | process.cwd = function () { return '/' };
|
277 | process.chdir = function (dir) {
|
278 | throw new Error('process.chdir is not supported');
|
279 | };
|
280 | process.umask = function() { return 0; };
|
281 |
|
282 |
|
283 | }),
|
284 |
|
285 | (function(module, exports) {
|
286 |
|
287 | if (typeof Object.create === 'function') {
|
288 |
|
289 | module.exports = function inherits(ctor, superCtor) {
|
290 | ctor.super_ = superCtor
|
291 | ctor.prototype = Object.create(superCtor.prototype, {
|
292 | constructor: {
|
293 | value: ctor,
|
294 | enumerable: false,
|
295 | writable: true,
|
296 | configurable: true
|
297 | }
|
298 | });
|
299 | };
|
300 | } else {
|
301 |
|
302 | module.exports = function inherits(ctor, superCtor) {
|
303 | ctor.super_ = superCtor
|
304 | var TempCtor = function () {}
|
305 | TempCtor.prototype = superCtor.prototype
|
306 | ctor.prototype = new TempCtor()
|
307 | ctor.prototype.constructor = ctor
|
308 | }
|
309 | }
|
310 |
|
311 |
|
312 | }),
|
313 |
|
314 | (function(module, exports, __webpack_require__) {
|
315 |
|
316 | "use strict";
|
317 | (function(global) { |
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 | var base64 = __webpack_require__(23)
|
328 | var ieee754 = __webpack_require__(24)
|
329 | var isArray = __webpack_require__(10)
|
330 |
|
331 | exports.Buffer = Buffer
|
332 | exports.SlowBuffer = SlowBuffer
|
333 | exports.INSPECT_MAX_BYTES = 50
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 |
|
346 |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 | Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
|
360 | ? global.TYPED_ARRAY_SUPPORT
|
361 | : typedArraySupport()
|
362 |
|
363 |
|
364 |
|
365 |
|
366 | exports.kMaxLength = kMaxLength()
|
367 |
|
368 | function typedArraySupport () {
|
369 | try {
|
370 | var arr = new Uint8Array(1)
|
371 | arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
|
372 | return arr.foo() === 42 &&
|
373 | typeof arr.subarray === 'function' &&
|
374 | arr.subarray(1, 1).byteLength === 0
|
375 | } catch (e) {
|
376 | return false
|
377 | }
|
378 | }
|
379 |
|
380 | function kMaxLength () {
|
381 | return Buffer.TYPED_ARRAY_SUPPORT
|
382 | ? 0x7fffffff
|
383 | : 0x3fffffff
|
384 | }
|
385 |
|
386 | function createBuffer (that, length) {
|
387 | if (kMaxLength() < length) {
|
388 | throw new RangeError('Invalid typed array length')
|
389 | }
|
390 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
391 |
|
392 | that = new Uint8Array(length)
|
393 | that.__proto__ = Buffer.prototype
|
394 | } else {
|
395 |
|
396 | if (that === null) {
|
397 | that = new Buffer(length)
|
398 | }
|
399 | that.length = length
|
400 | }
|
401 |
|
402 | return that
|
403 | }
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 | function Buffer (arg, encodingOrOffset, length) {
|
416 | if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
|
417 | return new Buffer(arg, encodingOrOffset, length)
|
418 | }
|
419 |
|
420 |
|
421 | if (typeof arg === 'number') {
|
422 | if (typeof encodingOrOffset === 'string') {
|
423 | throw new Error(
|
424 | 'If encoding is specified then the first argument must be a string'
|
425 | )
|
426 | }
|
427 | return allocUnsafe(this, arg)
|
428 | }
|
429 | return from(this, arg, encodingOrOffset, length)
|
430 | }
|
431 |
|
432 | Buffer.poolSize = 8192
|
433 |
|
434 |
|
435 | Buffer._augment = function (arr) {
|
436 | arr.__proto__ = Buffer.prototype
|
437 | return arr
|
438 | }
|
439 |
|
440 | function from (that, value, encodingOrOffset, length) {
|
441 | if (typeof value === 'number') {
|
442 | throw new TypeError('"value" argument must not be a number')
|
443 | }
|
444 |
|
445 | if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
446 | return fromArrayBuffer(that, value, encodingOrOffset, length)
|
447 | }
|
448 |
|
449 | if (typeof value === 'string') {
|
450 | return fromString(that, value, encodingOrOffset)
|
451 | }
|
452 |
|
453 | return fromObject(that, value)
|
454 | }
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 | Buffer.from = function (value, encodingOrOffset, length) {
|
465 | return from(null, value, encodingOrOffset, length)
|
466 | }
|
467 |
|
468 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
469 | Buffer.prototype.__proto__ = Uint8Array.prototype
|
470 | Buffer.__proto__ = Uint8Array
|
471 | if (typeof Symbol !== 'undefined' && Symbol.species &&
|
472 | Buffer[Symbol.species] === Buffer) {
|
473 |
|
474 | Object.defineProperty(Buffer, Symbol.species, {
|
475 | value: null,
|
476 | configurable: true
|
477 | })
|
478 | }
|
479 | }
|
480 |
|
481 | function assertSize (size) {
|
482 | if (typeof size !== 'number') {
|
483 | throw new TypeError('"size" argument must be a number')
|
484 | } else if (size < 0) {
|
485 | throw new RangeError('"size" argument must not be negative')
|
486 | }
|
487 | }
|
488 |
|
489 | function alloc (that, size, fill, encoding) {
|
490 | assertSize(size)
|
491 | if (size <= 0) {
|
492 | return createBuffer(that, size)
|
493 | }
|
494 | if (fill !== undefined) {
|
495 |
|
496 |
|
497 |
|
498 | return typeof encoding === 'string'
|
499 | ? createBuffer(that, size).fill(fill, encoding)
|
500 | : createBuffer(that, size).fill(fill)
|
501 | }
|
502 | return createBuffer(that, size)
|
503 | }
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 | Buffer.alloc = function (size, fill, encoding) {
|
510 | return alloc(null, size, fill, encoding)
|
511 | }
|
512 |
|
513 | function allocUnsafe (that, size) {
|
514 | assertSize(size)
|
515 | that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
|
516 | if (!Buffer.TYPED_ARRAY_SUPPORT) {
|
517 | for (var i = 0; i < size; ++i) {
|
518 | that[i] = 0
|
519 | }
|
520 | }
|
521 | return that
|
522 | }
|
523 |
|
524 |
|
525 |
|
526 |
|
527 | Buffer.allocUnsafe = function (size) {
|
528 | return allocUnsafe(null, size)
|
529 | }
|
530 |
|
531 |
|
532 |
|
533 | Buffer.allocUnsafeSlow = function (size) {
|
534 | return allocUnsafe(null, size)
|
535 | }
|
536 |
|
537 | function fromString (that, string, encoding) {
|
538 | if (typeof encoding !== 'string' || encoding === '') {
|
539 | encoding = 'utf8'
|
540 | }
|
541 |
|
542 | if (!Buffer.isEncoding(encoding)) {
|
543 | throw new TypeError('"encoding" must be a valid string encoding')
|
544 | }
|
545 |
|
546 | var length = byteLength(string, encoding) | 0
|
547 | that = createBuffer(that, length)
|
548 |
|
549 | var actual = that.write(string, encoding)
|
550 |
|
551 | if (actual !== length) {
|
552 |
|
553 |
|
554 |
|
555 | that = that.slice(0, actual)
|
556 | }
|
557 |
|
558 | return that
|
559 | }
|
560 |
|
561 | function fromArrayLike (that, array) {
|
562 | var length = array.length < 0 ? 0 : checked(array.length) | 0
|
563 | that = createBuffer(that, length)
|
564 | for (var i = 0; i < length; i += 1) {
|
565 | that[i] = array[i] & 255
|
566 | }
|
567 | return that
|
568 | }
|
569 |
|
570 | function fromArrayBuffer (that, array, byteOffset, length) {
|
571 | array.byteLength
|
572 |
|
573 | if (byteOffset < 0 || array.byteLength < byteOffset) {
|
574 | throw new RangeError('\'offset\' is out of bounds')
|
575 | }
|
576 |
|
577 | if (array.byteLength < byteOffset + (length || 0)) {
|
578 | throw new RangeError('\'length\' is out of bounds')
|
579 | }
|
580 |
|
581 | if (byteOffset === undefined && length === undefined) {
|
582 | array = new Uint8Array(array)
|
583 | } else if (length === undefined) {
|
584 | array = new Uint8Array(array, byteOffset)
|
585 | } else {
|
586 | array = new Uint8Array(array, byteOffset, length)
|
587 | }
|
588 |
|
589 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
590 |
|
591 | that = array
|
592 | that.__proto__ = Buffer.prototype
|
593 | } else {
|
594 |
|
595 | that = fromArrayLike(that, array)
|
596 | }
|
597 | return that
|
598 | }
|
599 |
|
600 | function fromObject (that, obj) {
|
601 | if (Buffer.isBuffer(obj)) {
|
602 | var len = checked(obj.length) | 0
|
603 | that = createBuffer(that, len)
|
604 |
|
605 | if (that.length === 0) {
|
606 | return that
|
607 | }
|
608 |
|
609 | obj.copy(that, 0, 0, len)
|
610 | return that
|
611 | }
|
612 |
|
613 | if (obj) {
|
614 | if ((typeof ArrayBuffer !== 'undefined' &&
|
615 | obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
|
616 | if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
617 | return createBuffer(that, 0)
|
618 | }
|
619 | return fromArrayLike(that, obj)
|
620 | }
|
621 |
|
622 | if (obj.type === 'Buffer' && isArray(obj.data)) {
|
623 | return fromArrayLike(that, obj.data)
|
624 | }
|
625 | }
|
626 |
|
627 | throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
|
628 | }
|
629 |
|
630 | function checked (length) {
|
631 |
|
632 |
|
633 | if (length >= kMaxLength()) {
|
634 | throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
635 | 'size: 0x' + kMaxLength().toString(16) + ' bytes')
|
636 | }
|
637 | return length | 0
|
638 | }
|
639 |
|
640 | function SlowBuffer (length) {
|
641 | if (+length != length) {
|
642 | length = 0
|
643 | }
|
644 | return Buffer.alloc(+length)
|
645 | }
|
646 |
|
647 | Buffer.isBuffer = function isBuffer (b) {
|
648 | return !!(b != null && b._isBuffer)
|
649 | }
|
650 |
|
651 | Buffer.compare = function compare (a, b) {
|
652 | if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
653 | throw new TypeError('Arguments must be Buffers')
|
654 | }
|
655 |
|
656 | if (a === b) return 0
|
657 |
|
658 | var x = a.length
|
659 | var y = b.length
|
660 |
|
661 | for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
662 | if (a[i] !== b[i]) {
|
663 | x = a[i]
|
664 | y = b[i]
|
665 | break
|
666 | }
|
667 | }
|
668 |
|
669 | if (x < y) return -1
|
670 | if (y < x) return 1
|
671 | return 0
|
672 | }
|
673 |
|
674 | Buffer.isEncoding = function isEncoding (encoding) {
|
675 | switch (String(encoding).toLowerCase()) {
|
676 | case 'hex':
|
677 | case 'utf8':
|
678 | case 'utf-8':
|
679 | case 'ascii':
|
680 | case 'latin1':
|
681 | case 'binary':
|
682 | case 'base64':
|
683 | case 'ucs2':
|
684 | case 'ucs-2':
|
685 | case 'utf16le':
|
686 | case 'utf-16le':
|
687 | return true
|
688 | default:
|
689 | return false
|
690 | }
|
691 | }
|
692 |
|
693 | Buffer.concat = function concat (list, length) {
|
694 | if (!isArray(list)) {
|
695 | throw new TypeError('"list" argument must be an Array of Buffers')
|
696 | }
|
697 |
|
698 | if (list.length === 0) {
|
699 | return Buffer.alloc(0)
|
700 | }
|
701 |
|
702 | var i
|
703 | if (length === undefined) {
|
704 | length = 0
|
705 | for (i = 0; i < list.length; ++i) {
|
706 | length += list[i].length
|
707 | }
|
708 | }
|
709 |
|
710 | var buffer = Buffer.allocUnsafe(length)
|
711 | var pos = 0
|
712 | for (i = 0; i < list.length; ++i) {
|
713 | var buf = list[i]
|
714 | if (!Buffer.isBuffer(buf)) {
|
715 | throw new TypeError('"list" argument must be an Array of Buffers')
|
716 | }
|
717 | buf.copy(buffer, pos)
|
718 | pos += buf.length
|
719 | }
|
720 | return buffer
|
721 | }
|
722 |
|
723 | function byteLength (string, encoding) {
|
724 | if (Buffer.isBuffer(string)) {
|
725 | return string.length
|
726 | }
|
727 | if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
|
728 | (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
729 | return string.byteLength
|
730 | }
|
731 | if (typeof string !== 'string') {
|
732 | string = '' + string
|
733 | }
|
734 |
|
735 | var len = string.length
|
736 | if (len === 0) return 0
|
737 |
|
738 |
|
739 | var loweredCase = false
|
740 | for (;;) {
|
741 | switch (encoding) {
|
742 | case 'ascii':
|
743 | case 'latin1':
|
744 | case 'binary':
|
745 | return len
|
746 | case 'utf8':
|
747 | case 'utf-8':
|
748 | case undefined:
|
749 | return utf8ToBytes(string).length
|
750 | case 'ucs2':
|
751 | case 'ucs-2':
|
752 | case 'utf16le':
|
753 | case 'utf-16le':
|
754 | return len * 2
|
755 | case 'hex':
|
756 | return len >>> 1
|
757 | case 'base64':
|
758 | return base64ToBytes(string).length
|
759 | default:
|
760 | if (loweredCase) return utf8ToBytes(string).length
|
761 | encoding = ('' + encoding).toLowerCase()
|
762 | loweredCase = true
|
763 | }
|
764 | }
|
765 | }
|
766 | Buffer.byteLength = byteLength
|
767 |
|
768 | function slowToString (encoding, start, end) {
|
769 | var loweredCase = false
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 | if (start === undefined || start < 0) {
|
779 | start = 0
|
780 | }
|
781 |
|
782 |
|
783 | if (start > this.length) {
|
784 | return ''
|
785 | }
|
786 |
|
787 | if (end === undefined || end > this.length) {
|
788 | end = this.length
|
789 | }
|
790 |
|
791 | if (end <= 0) {
|
792 | return ''
|
793 | }
|
794 |
|
795 |
|
796 | end >>>= 0
|
797 | start >>>= 0
|
798 |
|
799 | if (end <= start) {
|
800 | return ''
|
801 | }
|
802 |
|
803 | if (!encoding) encoding = 'utf8'
|
804 |
|
805 | while (true) {
|
806 | switch (encoding) {
|
807 | case 'hex':
|
808 | return hexSlice(this, start, end)
|
809 |
|
810 | case 'utf8':
|
811 | case 'utf-8':
|
812 | return utf8Slice(this, start, end)
|
813 |
|
814 | case 'ascii':
|
815 | return asciiSlice(this, start, end)
|
816 |
|
817 | case 'latin1':
|
818 | case 'binary':
|
819 | return latin1Slice(this, start, end)
|
820 |
|
821 | case 'base64':
|
822 | return base64Slice(this, start, end)
|
823 |
|
824 | case 'ucs2':
|
825 | case 'ucs-2':
|
826 | case 'utf16le':
|
827 | case 'utf-16le':
|
828 | return utf16leSlice(this, start, end)
|
829 |
|
830 | default:
|
831 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
832 | encoding = (encoding + '').toLowerCase()
|
833 | loweredCase = true
|
834 | }
|
835 | }
|
836 | }
|
837 |
|
838 |
|
839 |
|
840 | Buffer.prototype._isBuffer = true
|
841 |
|
842 | function swap (b, n, m) {
|
843 | var i = b[n]
|
844 | b[n] = b[m]
|
845 | b[m] = i
|
846 | }
|
847 |
|
848 | Buffer.prototype.swap16 = function swap16 () {
|
849 | var len = this.length
|
850 | if (len % 2 !== 0) {
|
851 | throw new RangeError('Buffer size must be a multiple of 16-bits')
|
852 | }
|
853 | for (var i = 0; i < len; i += 2) {
|
854 | swap(this, i, i + 1)
|
855 | }
|
856 | return this
|
857 | }
|
858 |
|
859 | Buffer.prototype.swap32 = function swap32 () {
|
860 | var len = this.length
|
861 | if (len % 4 !== 0) {
|
862 | throw new RangeError('Buffer size must be a multiple of 32-bits')
|
863 | }
|
864 | for (var i = 0; i < len; i += 4) {
|
865 | swap(this, i, i + 3)
|
866 | swap(this, i + 1, i + 2)
|
867 | }
|
868 | return this
|
869 | }
|
870 |
|
871 | Buffer.prototype.swap64 = function swap64 () {
|
872 | var len = this.length
|
873 | if (len % 8 !== 0) {
|
874 | throw new RangeError('Buffer size must be a multiple of 64-bits')
|
875 | }
|
876 | for (var i = 0; i < len; i += 8) {
|
877 | swap(this, i, i + 7)
|
878 | swap(this, i + 1, i + 6)
|
879 | swap(this, i + 2, i + 5)
|
880 | swap(this, i + 3, i + 4)
|
881 | }
|
882 | return this
|
883 | }
|
884 |
|
885 | Buffer.prototype.toString = function toString () {
|
886 | var length = this.length | 0
|
887 | if (length === 0) return ''
|
888 | if (arguments.length === 0) return utf8Slice(this, 0, length)
|
889 | return slowToString.apply(this, arguments)
|
890 | }
|
891 |
|
892 | Buffer.prototype.equals = function equals (b) {
|
893 | if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
894 | if (this === b) return true
|
895 | return Buffer.compare(this, b) === 0
|
896 | }
|
897 |
|
898 | Buffer.prototype.inspect = function inspect () {
|
899 | var str = ''
|
900 | var max = exports.INSPECT_MAX_BYTES
|
901 | if (this.length > 0) {
|
902 | str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
|
903 | if (this.length > max) str += ' ... '
|
904 | }
|
905 | return '<Buffer ' + str + '>'
|
906 | }
|
907 |
|
908 | Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
909 | if (!Buffer.isBuffer(target)) {
|
910 | throw new TypeError('Argument must be a Buffer')
|
911 | }
|
912 |
|
913 | if (start === undefined) {
|
914 | start = 0
|
915 | }
|
916 | if (end === undefined) {
|
917 | end = target ? target.length : 0
|
918 | }
|
919 | if (thisStart === undefined) {
|
920 | thisStart = 0
|
921 | }
|
922 | if (thisEnd === undefined) {
|
923 | thisEnd = this.length
|
924 | }
|
925 |
|
926 | if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
927 | throw new RangeError('out of range index')
|
928 | }
|
929 |
|
930 | if (thisStart >= thisEnd && start >= end) {
|
931 | return 0
|
932 | }
|
933 | if (thisStart >= thisEnd) {
|
934 | return -1
|
935 | }
|
936 | if (start >= end) {
|
937 | return 1
|
938 | }
|
939 |
|
940 | start >>>= 0
|
941 | end >>>= 0
|
942 | thisStart >>>= 0
|
943 | thisEnd >>>= 0
|
944 |
|
945 | if (this === target) return 0
|
946 |
|
947 | var x = thisEnd - thisStart
|
948 | var y = end - start
|
949 | var len = Math.min(x, y)
|
950 |
|
951 | var thisCopy = this.slice(thisStart, thisEnd)
|
952 | var targetCopy = target.slice(start, end)
|
953 |
|
954 | for (var i = 0; i < len; ++i) {
|
955 | if (thisCopy[i] !== targetCopy[i]) {
|
956 | x = thisCopy[i]
|
957 | y = targetCopy[i]
|
958 | break
|
959 | }
|
960 | }
|
961 |
|
962 | if (x < y) return -1
|
963 | if (y < x) return 1
|
964 | return 0
|
965 | }
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 | function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
977 |
|
978 | if (buffer.length === 0) return -1
|
979 |
|
980 |
|
981 | if (typeof byteOffset === 'string') {
|
982 | encoding = byteOffset
|
983 | byteOffset = 0
|
984 | } else if (byteOffset > 0x7fffffff) {
|
985 | byteOffset = 0x7fffffff
|
986 | } else if (byteOffset < -0x80000000) {
|
987 | byteOffset = -0x80000000
|
988 | }
|
989 | byteOffset = +byteOffset
|
990 | if (isNaN(byteOffset)) {
|
991 |
|
992 | byteOffset = dir ? 0 : (buffer.length - 1)
|
993 | }
|
994 |
|
995 |
|
996 | if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
997 | if (byteOffset >= buffer.length) {
|
998 | if (dir) return -1
|
999 | else byteOffset = buffer.length - 1
|
1000 | } else if (byteOffset < 0) {
|
1001 | if (dir) byteOffset = 0
|
1002 | else return -1
|
1003 | }
|
1004 |
|
1005 |
|
1006 | if (typeof val === 'string') {
|
1007 | val = Buffer.from(val, encoding)
|
1008 | }
|
1009 |
|
1010 |
|
1011 | if (Buffer.isBuffer(val)) {
|
1012 |
|
1013 | if (val.length === 0) {
|
1014 | return -1
|
1015 | }
|
1016 | return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
1017 | } else if (typeof val === 'number') {
|
1018 | val = val & 0xFF
|
1019 | if (Buffer.TYPED_ARRAY_SUPPORT &&
|
1020 | typeof Uint8Array.prototype.indexOf === 'function') {
|
1021 | if (dir) {
|
1022 | return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
1023 | } else {
|
1024 | return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
1025 | }
|
1026 | }
|
1027 | return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
1028 | }
|
1029 |
|
1030 | throw new TypeError('val must be string, number or Buffer')
|
1031 | }
|
1032 |
|
1033 | function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
1034 | var indexSize = 1
|
1035 | var arrLength = arr.length
|
1036 | var valLength = val.length
|
1037 |
|
1038 | if (encoding !== undefined) {
|
1039 | encoding = String(encoding).toLowerCase()
|
1040 | if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
1041 | encoding === 'utf16le' || encoding === 'utf-16le') {
|
1042 | if (arr.length < 2 || val.length < 2) {
|
1043 | return -1
|
1044 | }
|
1045 | indexSize = 2
|
1046 | arrLength /= 2
|
1047 | valLength /= 2
|
1048 | byteOffset /= 2
|
1049 | }
|
1050 | }
|
1051 |
|
1052 | function read (buf, i) {
|
1053 | if (indexSize === 1) {
|
1054 | return buf[i]
|
1055 | } else {
|
1056 | return buf.readUInt16BE(i * indexSize)
|
1057 | }
|
1058 | }
|
1059 |
|
1060 | var i
|
1061 | if (dir) {
|
1062 | var foundIndex = -1
|
1063 | for (i = byteOffset; i < arrLength; i++) {
|
1064 | if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
1065 | if (foundIndex === -1) foundIndex = i
|
1066 | if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
1067 | } else {
|
1068 | if (foundIndex !== -1) i -= i - foundIndex
|
1069 | foundIndex = -1
|
1070 | }
|
1071 | }
|
1072 | } else {
|
1073 | if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
1074 | for (i = byteOffset; i >= 0; i--) {
|
1075 | var found = true
|
1076 | for (var j = 0; j < valLength; j++) {
|
1077 | if (read(arr, i + j) !== read(val, j)) {
|
1078 | found = false
|
1079 | break
|
1080 | }
|
1081 | }
|
1082 | if (found) return i
|
1083 | }
|
1084 | }
|
1085 |
|
1086 | return -1
|
1087 | }
|
1088 |
|
1089 | Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
1090 | return this.indexOf(val, byteOffset, encoding) !== -1
|
1091 | }
|
1092 |
|
1093 | Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
1094 | return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
1095 | }
|
1096 |
|
1097 | Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
1098 | return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
1099 | }
|
1100 |
|
1101 | function hexWrite (buf, string, offset, length) {
|
1102 | offset = Number(offset) || 0
|
1103 | var remaining = buf.length - offset
|
1104 | if (!length) {
|
1105 | length = remaining
|
1106 | } else {
|
1107 | length = Number(length)
|
1108 | if (length > remaining) {
|
1109 | length = remaining
|
1110 | }
|
1111 | }
|
1112 |
|
1113 |
|
1114 | var strLen = string.length
|
1115 | if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
|
1116 |
|
1117 | if (length > strLen / 2) {
|
1118 | length = strLen / 2
|
1119 | }
|
1120 | for (var i = 0; i < length; ++i) {
|
1121 | var parsed = parseInt(string.substr(i * 2, 2), 16)
|
1122 | if (isNaN(parsed)) return i
|
1123 | buf[offset + i] = parsed
|
1124 | }
|
1125 | return i
|
1126 | }
|
1127 |
|
1128 | function utf8Write (buf, string, offset, length) {
|
1129 | return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
1130 | }
|
1131 |
|
1132 | function asciiWrite (buf, string, offset, length) {
|
1133 | return blitBuffer(asciiToBytes(string), buf, offset, length)
|
1134 | }
|
1135 |
|
1136 | function latin1Write (buf, string, offset, length) {
|
1137 | return asciiWrite(buf, string, offset, length)
|
1138 | }
|
1139 |
|
1140 | function base64Write (buf, string, offset, length) {
|
1141 | return blitBuffer(base64ToBytes(string), buf, offset, length)
|
1142 | }
|
1143 |
|
1144 | function ucs2Write (buf, string, offset, length) {
|
1145 | return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
1146 | }
|
1147 |
|
1148 | Buffer.prototype.write = function write (string, offset, length, encoding) {
|
1149 |
|
1150 | if (offset === undefined) {
|
1151 | encoding = 'utf8'
|
1152 | length = this.length
|
1153 | offset = 0
|
1154 |
|
1155 | } else if (length === undefined && typeof offset === 'string') {
|
1156 | encoding = offset
|
1157 | length = this.length
|
1158 | offset = 0
|
1159 |
|
1160 | } else if (isFinite(offset)) {
|
1161 | offset = offset | 0
|
1162 | if (isFinite(length)) {
|
1163 | length = length | 0
|
1164 | if (encoding === undefined) encoding = 'utf8'
|
1165 | } else {
|
1166 | encoding = length
|
1167 | length = undefined
|
1168 | }
|
1169 |
|
1170 | } else {
|
1171 | throw new Error(
|
1172 | 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
1173 | )
|
1174 | }
|
1175 |
|
1176 | var remaining = this.length - offset
|
1177 | if (length === undefined || length > remaining) length = remaining
|
1178 |
|
1179 | if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
1180 | throw new RangeError('Attempt to write outside buffer bounds')
|
1181 | }
|
1182 |
|
1183 | if (!encoding) encoding = 'utf8'
|
1184 |
|
1185 | var loweredCase = false
|
1186 | for (;;) {
|
1187 | switch (encoding) {
|
1188 | case 'hex':
|
1189 | return hexWrite(this, string, offset, length)
|
1190 |
|
1191 | case 'utf8':
|
1192 | case 'utf-8':
|
1193 | return utf8Write(this, string, offset, length)
|
1194 |
|
1195 | case 'ascii':
|
1196 | return asciiWrite(this, string, offset, length)
|
1197 |
|
1198 | case 'latin1':
|
1199 | case 'binary':
|
1200 | return latin1Write(this, string, offset, length)
|
1201 |
|
1202 | case 'base64':
|
1203 |
|
1204 | return base64Write(this, string, offset, length)
|
1205 |
|
1206 | case 'ucs2':
|
1207 | case 'ucs-2':
|
1208 | case 'utf16le':
|
1209 | case 'utf-16le':
|
1210 | return ucs2Write(this, string, offset, length)
|
1211 |
|
1212 | default:
|
1213 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
1214 | encoding = ('' + encoding).toLowerCase()
|
1215 | loweredCase = true
|
1216 | }
|
1217 | }
|
1218 | }
|
1219 |
|
1220 | Buffer.prototype.toJSON = function toJSON () {
|
1221 | return {
|
1222 | type: 'Buffer',
|
1223 | data: Array.prototype.slice.call(this._arr || this, 0)
|
1224 | }
|
1225 | }
|
1226 |
|
1227 | function base64Slice (buf, start, end) {
|
1228 | if (start === 0 && end === buf.length) {
|
1229 | return base64.fromByteArray(buf)
|
1230 | } else {
|
1231 | return base64.fromByteArray(buf.slice(start, end))
|
1232 | }
|
1233 | }
|
1234 |
|
1235 | function utf8Slice (buf, start, end) {
|
1236 | end = Math.min(buf.length, end)
|
1237 | var res = []
|
1238 |
|
1239 | var i = start
|
1240 | while (i < end) {
|
1241 | var firstByte = buf[i]
|
1242 | var codePoint = null
|
1243 | var bytesPerSequence = (firstByte > 0xEF) ? 4
|
1244 | : (firstByte > 0xDF) ? 3
|
1245 | : (firstByte > 0xBF) ? 2
|
1246 | : 1
|
1247 |
|
1248 | if (i + bytesPerSequence <= end) {
|
1249 | var secondByte, thirdByte, fourthByte, tempCodePoint
|
1250 |
|
1251 | switch (bytesPerSequence) {
|
1252 | case 1:
|
1253 | if (firstByte < 0x80) {
|
1254 | codePoint = firstByte
|
1255 | }
|
1256 | break
|
1257 | case 2:
|
1258 | secondByte = buf[i + 1]
|
1259 | if ((secondByte & 0xC0) === 0x80) {
|
1260 | tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
1261 | if (tempCodePoint > 0x7F) {
|
1262 | codePoint = tempCodePoint
|
1263 | }
|
1264 | }
|
1265 | break
|
1266 | case 3:
|
1267 | secondByte = buf[i + 1]
|
1268 | thirdByte = buf[i + 2]
|
1269 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
1270 | tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
1271 | if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
1272 | codePoint = tempCodePoint
|
1273 | }
|
1274 | }
|
1275 | break
|
1276 | case 4:
|
1277 | secondByte = buf[i + 1]
|
1278 | thirdByte = buf[i + 2]
|
1279 | fourthByte = buf[i + 3]
|
1280 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
1281 | tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
1282 | if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
1283 | codePoint = tempCodePoint
|
1284 | }
|
1285 | }
|
1286 | }
|
1287 | }
|
1288 |
|
1289 | if (codePoint === null) {
|
1290 |
|
1291 |
|
1292 | codePoint = 0xFFFD
|
1293 | bytesPerSequence = 1
|
1294 | } else if (codePoint > 0xFFFF) {
|
1295 |
|
1296 | codePoint -= 0x10000
|
1297 | res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
1298 | codePoint = 0xDC00 | codePoint & 0x3FF
|
1299 | }
|
1300 |
|
1301 | res.push(codePoint)
|
1302 | i += bytesPerSequence
|
1303 | }
|
1304 |
|
1305 | return decodeCodePointsArray(res)
|
1306 | }
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 | var MAX_ARGUMENTS_LENGTH = 0x1000
|
1312 |
|
1313 | function decodeCodePointsArray (codePoints) {
|
1314 | var len = codePoints.length
|
1315 | if (len <= MAX_ARGUMENTS_LENGTH) {
|
1316 | return String.fromCharCode.apply(String, codePoints)
|
1317 | }
|
1318 |
|
1319 |
|
1320 | var res = ''
|
1321 | var i = 0
|
1322 | while (i < len) {
|
1323 | res += String.fromCharCode.apply(
|
1324 | String,
|
1325 | codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
1326 | )
|
1327 | }
|
1328 | return res
|
1329 | }
|
1330 |
|
1331 | function asciiSlice (buf, start, end) {
|
1332 | var ret = ''
|
1333 | end = Math.min(buf.length, end)
|
1334 |
|
1335 | for (var i = start; i < end; ++i) {
|
1336 | ret += String.fromCharCode(buf[i] & 0x7F)
|
1337 | }
|
1338 | return ret
|
1339 | }
|
1340 |
|
1341 | function latin1Slice (buf, start, end) {
|
1342 | var ret = ''
|
1343 | end = Math.min(buf.length, end)
|
1344 |
|
1345 | for (var i = start; i < end; ++i) {
|
1346 | ret += String.fromCharCode(buf[i])
|
1347 | }
|
1348 | return ret
|
1349 | }
|
1350 |
|
1351 | function hexSlice (buf, start, end) {
|
1352 | var len = buf.length
|
1353 |
|
1354 | if (!start || start < 0) start = 0
|
1355 | if (!end || end < 0 || end > len) end = len
|
1356 |
|
1357 | var out = ''
|
1358 | for (var i = start; i < end; ++i) {
|
1359 | out += toHex(buf[i])
|
1360 | }
|
1361 | return out
|
1362 | }
|
1363 |
|
1364 | function utf16leSlice (buf, start, end) {
|
1365 | var bytes = buf.slice(start, end)
|
1366 | var res = ''
|
1367 | for (var i = 0; i < bytes.length; i += 2) {
|
1368 | res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
|
1369 | }
|
1370 | return res
|
1371 | }
|
1372 |
|
1373 | Buffer.prototype.slice = function slice (start, end) {
|
1374 | var len = this.length
|
1375 | start = ~~start
|
1376 | end = end === undefined ? len : ~~end
|
1377 |
|
1378 | if (start < 0) {
|
1379 | start += len
|
1380 | if (start < 0) start = 0
|
1381 | } else if (start > len) {
|
1382 | start = len
|
1383 | }
|
1384 |
|
1385 | if (end < 0) {
|
1386 | end += len
|
1387 | if (end < 0) end = 0
|
1388 | } else if (end > len) {
|
1389 | end = len
|
1390 | }
|
1391 |
|
1392 | if (end < start) end = start
|
1393 |
|
1394 | var newBuf
|
1395 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
1396 | newBuf = this.subarray(start, end)
|
1397 | newBuf.__proto__ = Buffer.prototype
|
1398 | } else {
|
1399 | var sliceLen = end - start
|
1400 | newBuf = new Buffer(sliceLen, undefined)
|
1401 | for (var i = 0; i < sliceLen; ++i) {
|
1402 | newBuf[i] = this[i + start]
|
1403 | }
|
1404 | }
|
1405 |
|
1406 | return newBuf
|
1407 | }
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 | function checkOffset (offset, ext, length) {
|
1413 | if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
1414 | if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
1415 | }
|
1416 |
|
1417 | Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
1418 | offset = offset | 0
|
1419 | byteLength = byteLength | 0
|
1420 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
1421 |
|
1422 | var val = this[offset]
|
1423 | var mul = 1
|
1424 | var i = 0
|
1425 | while (++i < byteLength && (mul *= 0x100)) {
|
1426 | val += this[offset + i] * mul
|
1427 | }
|
1428 |
|
1429 | return val
|
1430 | }
|
1431 |
|
1432 | Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
1433 | offset = offset | 0
|
1434 | byteLength = byteLength | 0
|
1435 | if (!noAssert) {
|
1436 | checkOffset(offset, byteLength, this.length)
|
1437 | }
|
1438 |
|
1439 | var val = this[offset + --byteLength]
|
1440 | var mul = 1
|
1441 | while (byteLength > 0 && (mul *= 0x100)) {
|
1442 | val += this[offset + --byteLength] * mul
|
1443 | }
|
1444 |
|
1445 | return val
|
1446 | }
|
1447 |
|
1448 | Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
1449 | if (!noAssert) checkOffset(offset, 1, this.length)
|
1450 | return this[offset]
|
1451 | }
|
1452 |
|
1453 | Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
1454 | if (!noAssert) checkOffset(offset, 2, this.length)
|
1455 | return this[offset] | (this[offset + 1] << 8)
|
1456 | }
|
1457 |
|
1458 | Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
1459 | if (!noAssert) checkOffset(offset, 2, this.length)
|
1460 | return (this[offset] << 8) | this[offset + 1]
|
1461 | }
|
1462 |
|
1463 | Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
1464 | if (!noAssert) checkOffset(offset, 4, this.length)
|
1465 |
|
1466 | return ((this[offset]) |
|
1467 | (this[offset + 1] << 8) |
|
1468 | (this[offset + 2] << 16)) +
|
1469 | (this[offset + 3] * 0x1000000)
|
1470 | }
|
1471 |
|
1472 | Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
1473 | if (!noAssert) checkOffset(offset, 4, this.length)
|
1474 |
|
1475 | return (this[offset] * 0x1000000) +
|
1476 | ((this[offset + 1] << 16) |
|
1477 | (this[offset + 2] << 8) |
|
1478 | this[offset + 3])
|
1479 | }
|
1480 |
|
1481 | Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
1482 | offset = offset | 0
|
1483 | byteLength = byteLength | 0
|
1484 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
1485 |
|
1486 | var val = this[offset]
|
1487 | var mul = 1
|
1488 | var i = 0
|
1489 | while (++i < byteLength && (mul *= 0x100)) {
|
1490 | val += this[offset + i] * mul
|
1491 | }
|
1492 | mul *= 0x80
|
1493 |
|
1494 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
1495 |
|
1496 | return val
|
1497 | }
|
1498 |
|
1499 | Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
1500 | offset = offset | 0
|
1501 | byteLength = byteLength | 0
|
1502 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
1503 |
|
1504 | var i = byteLength
|
1505 | var mul = 1
|
1506 | var val = this[offset + --i]
|
1507 | while (i > 0 && (mul *= 0x100)) {
|
1508 | val += this[offset + --i] * mul
|
1509 | }
|
1510 | mul *= 0x80
|
1511 |
|
1512 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
1513 |
|
1514 | return val
|
1515 | }
|
1516 |
|
1517 | Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
1518 | if (!noAssert) checkOffset(offset, 1, this.length)
|
1519 | if (!(this[offset] & 0x80)) return (this[offset])
|
1520 | return ((0xff - this[offset] + 1) * -1)
|
1521 | }
|
1522 |
|
1523 | Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
1524 | if (!noAssert) checkOffset(offset, 2, this.length)
|
1525 | var val = this[offset] | (this[offset + 1] << 8)
|
1526 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
1527 | }
|
1528 |
|
1529 | Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
1530 | if (!noAssert) checkOffset(offset, 2, this.length)
|
1531 | var val = this[offset + 1] | (this[offset] << 8)
|
1532 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
1533 | }
|
1534 |
|
1535 | Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
1536 | if (!noAssert) checkOffset(offset, 4, this.length)
|
1537 |
|
1538 | return (this[offset]) |
|
1539 | (this[offset + 1] << 8) |
|
1540 | (this[offset + 2] << 16) |
|
1541 | (this[offset + 3] << 24)
|
1542 | }
|
1543 |
|
1544 | Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
1545 | if (!noAssert) checkOffset(offset, 4, this.length)
|
1546 |
|
1547 | return (this[offset] << 24) |
|
1548 | (this[offset + 1] << 16) |
|
1549 | (this[offset + 2] << 8) |
|
1550 | (this[offset + 3])
|
1551 | }
|
1552 |
|
1553 | Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
1554 | if (!noAssert) checkOffset(offset, 4, this.length)
|
1555 | return ieee754.read(this, offset, true, 23, 4)
|
1556 | }
|
1557 |
|
1558 | Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
1559 | if (!noAssert) checkOffset(offset, 4, this.length)
|
1560 | return ieee754.read(this, offset, false, 23, 4)
|
1561 | }
|
1562 |
|
1563 | Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
1564 | if (!noAssert) checkOffset(offset, 8, this.length)
|
1565 | return ieee754.read(this, offset, true, 52, 8)
|
1566 | }
|
1567 |
|
1568 | Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
1569 | if (!noAssert) checkOffset(offset, 8, this.length)
|
1570 | return ieee754.read(this, offset, false, 52, 8)
|
1571 | }
|
1572 |
|
1573 | function checkInt (buf, value, offset, ext, max, min) {
|
1574 | if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
1575 | if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
1576 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
1577 | }
|
1578 |
|
1579 | Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
1580 | value = +value
|
1581 | offset = offset | 0
|
1582 | byteLength = byteLength | 0
|
1583 | if (!noAssert) {
|
1584 | var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
1585 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
1586 | }
|
1587 |
|
1588 | var mul = 1
|
1589 | var i = 0
|
1590 | this[offset] = value & 0xFF
|
1591 | while (++i < byteLength && (mul *= 0x100)) {
|
1592 | this[offset + i] = (value / mul) & 0xFF
|
1593 | }
|
1594 |
|
1595 | return offset + byteLength
|
1596 | }
|
1597 |
|
1598 | Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
1599 | value = +value
|
1600 | offset = offset | 0
|
1601 | byteLength = byteLength | 0
|
1602 | if (!noAssert) {
|
1603 | var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
1604 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
1605 | }
|
1606 |
|
1607 | var i = byteLength - 1
|
1608 | var mul = 1
|
1609 | this[offset + i] = value & 0xFF
|
1610 | while (--i >= 0 && (mul *= 0x100)) {
|
1611 | this[offset + i] = (value / mul) & 0xFF
|
1612 | }
|
1613 |
|
1614 | return offset + byteLength
|
1615 | }
|
1616 |
|
1617 | Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
1618 | value = +value
|
1619 | offset = offset | 0
|
1620 | if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
1621 | if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
1622 | this[offset] = (value & 0xff)
|
1623 | return offset + 1
|
1624 | }
|
1625 |
|
1626 | function objectWriteUInt16 (buf, value, offset, littleEndian) {
|
1627 | if (value < 0) value = 0xffff + value + 1
|
1628 | for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
1629 | buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
|
1630 | (littleEndian ? i : 1 - i) * 8
|
1631 | }
|
1632 | }
|
1633 |
|
1634 | Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
1635 | value = +value
|
1636 | offset = offset | 0
|
1637 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
1638 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
1639 | this[offset] = (value & 0xff)
|
1640 | this[offset + 1] = (value >>> 8)
|
1641 | } else {
|
1642 | objectWriteUInt16(this, value, offset, true)
|
1643 | }
|
1644 | return offset + 2
|
1645 | }
|
1646 |
|
1647 | Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
1648 | value = +value
|
1649 | offset = offset | 0
|
1650 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
1651 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
1652 | this[offset] = (value >>> 8)
|
1653 | this[offset + 1] = (value & 0xff)
|
1654 | } else {
|
1655 | objectWriteUInt16(this, value, offset, false)
|
1656 | }
|
1657 | return offset + 2
|
1658 | }
|
1659 |
|
1660 | function objectWriteUInt32 (buf, value, offset, littleEndian) {
|
1661 | if (value < 0) value = 0xffffffff + value + 1
|
1662 | for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
1663 | buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
|
1664 | }
|
1665 | }
|
1666 |
|
1667 | Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
1668 | value = +value
|
1669 | offset = offset | 0
|
1670 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
1671 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
1672 | this[offset + 3] = (value >>> 24)
|
1673 | this[offset + 2] = (value >>> 16)
|
1674 | this[offset + 1] = (value >>> 8)
|
1675 | this[offset] = (value & 0xff)
|
1676 | } else {
|
1677 | objectWriteUInt32(this, value, offset, true)
|
1678 | }
|
1679 | return offset + 4
|
1680 | }
|
1681 |
|
1682 | Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
1683 | value = +value
|
1684 | offset = offset | 0
|
1685 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
1686 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
1687 | this[offset] = (value >>> 24)
|
1688 | this[offset + 1] = (value >>> 16)
|
1689 | this[offset + 2] = (value >>> 8)
|
1690 | this[offset + 3] = (value & 0xff)
|
1691 | } else {
|
1692 | objectWriteUInt32(this, value, offset, false)
|
1693 | }
|
1694 | return offset + 4
|
1695 | }
|
1696 |
|
1697 | Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
1698 | value = +value
|
1699 | offset = offset | 0
|
1700 | if (!noAssert) {
|
1701 | var limit = Math.pow(2, 8 * byteLength - 1)
|
1702 |
|
1703 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
1704 | }
|
1705 |
|
1706 | var i = 0
|
1707 | var mul = 1
|
1708 | var sub = 0
|
1709 | this[offset] = value & 0xFF
|
1710 | while (++i < byteLength && (mul *= 0x100)) {
|
1711 | if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
1712 | sub = 1
|
1713 | }
|
1714 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
1715 | }
|
1716 |
|
1717 | return offset + byteLength
|
1718 | }
|
1719 |
|
1720 | Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
1721 | value = +value
|
1722 | offset = offset | 0
|
1723 | if (!noAssert) {
|
1724 | var limit = Math.pow(2, 8 * byteLength - 1)
|
1725 |
|
1726 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
1727 | }
|
1728 |
|
1729 | var i = byteLength - 1
|
1730 | var mul = 1
|
1731 | var sub = 0
|
1732 | this[offset + i] = value & 0xFF
|
1733 | while (--i >= 0 && (mul *= 0x100)) {
|
1734 | if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
1735 | sub = 1
|
1736 | }
|
1737 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
1738 | }
|
1739 |
|
1740 | return offset + byteLength
|
1741 | }
|
1742 |
|
1743 | Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
1744 | value = +value
|
1745 | offset = offset | 0
|
1746 | if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
1747 | if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
1748 | if (value < 0) value = 0xff + value + 1
|
1749 | this[offset] = (value & 0xff)
|
1750 | return offset + 1
|
1751 | }
|
1752 |
|
1753 | Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
1754 | value = +value
|
1755 | offset = offset | 0
|
1756 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
1757 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
1758 | this[offset] = (value & 0xff)
|
1759 | this[offset + 1] = (value >>> 8)
|
1760 | } else {
|
1761 | objectWriteUInt16(this, value, offset, true)
|
1762 | }
|
1763 | return offset + 2
|
1764 | }
|
1765 |
|
1766 | Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
1767 | value = +value
|
1768 | offset = offset | 0
|
1769 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
1770 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
1771 | this[offset] = (value >>> 8)
|
1772 | this[offset + 1] = (value & 0xff)
|
1773 | } else {
|
1774 | objectWriteUInt16(this, value, offset, false)
|
1775 | }
|
1776 | return offset + 2
|
1777 | }
|
1778 |
|
1779 | Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
1780 | value = +value
|
1781 | offset = offset | 0
|
1782 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
1783 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
1784 | this[offset] = (value & 0xff)
|
1785 | this[offset + 1] = (value >>> 8)
|
1786 | this[offset + 2] = (value >>> 16)
|
1787 | this[offset + 3] = (value >>> 24)
|
1788 | } else {
|
1789 | objectWriteUInt32(this, value, offset, true)
|
1790 | }
|
1791 | return offset + 4
|
1792 | }
|
1793 |
|
1794 | Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
1795 | value = +value
|
1796 | offset = offset | 0
|
1797 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
1798 | if (value < 0) value = 0xffffffff + value + 1
|
1799 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
1800 | this[offset] = (value >>> 24)
|
1801 | this[offset + 1] = (value >>> 16)
|
1802 | this[offset + 2] = (value >>> 8)
|
1803 | this[offset + 3] = (value & 0xff)
|
1804 | } else {
|
1805 | objectWriteUInt32(this, value, offset, false)
|
1806 | }
|
1807 | return offset + 4
|
1808 | }
|
1809 |
|
1810 | function checkIEEE754 (buf, value, offset, ext, max, min) {
|
1811 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
1812 | if (offset < 0) throw new RangeError('Index out of range')
|
1813 | }
|
1814 |
|
1815 | function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
1816 | if (!noAssert) {
|
1817 | checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
1818 | }
|
1819 | ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
1820 | return offset + 4
|
1821 | }
|
1822 |
|
1823 | Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
1824 | return writeFloat(this, value, offset, true, noAssert)
|
1825 | }
|
1826 |
|
1827 | Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
1828 | return writeFloat(this, value, offset, false, noAssert)
|
1829 | }
|
1830 |
|
1831 | function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
1832 | if (!noAssert) {
|
1833 | checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
1834 | }
|
1835 | ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
1836 | return offset + 8
|
1837 | }
|
1838 |
|
1839 | Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
1840 | return writeDouble(this, value, offset, true, noAssert)
|
1841 | }
|
1842 |
|
1843 | Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
1844 | return writeDouble(this, value, offset, false, noAssert)
|
1845 | }
|
1846 |
|
1847 |
|
1848 | Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
1849 | if (!start) start = 0
|
1850 | if (!end && end !== 0) end = this.length
|
1851 | if (targetStart >= target.length) targetStart = target.length
|
1852 | if (!targetStart) targetStart = 0
|
1853 | if (end > 0 && end < start) end = start
|
1854 |
|
1855 |
|
1856 | if (end === start) return 0
|
1857 | if (target.length === 0 || this.length === 0) return 0
|
1858 |
|
1859 |
|
1860 | if (targetStart < 0) {
|
1861 | throw new RangeError('targetStart out of bounds')
|
1862 | }
|
1863 | if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
|
1864 | if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
1865 |
|
1866 |
|
1867 | if (end > this.length) end = this.length
|
1868 | if (target.length - targetStart < end - start) {
|
1869 | end = target.length - targetStart + start
|
1870 | }
|
1871 |
|
1872 | var len = end - start
|
1873 | var i
|
1874 |
|
1875 | if (this === target && start < targetStart && targetStart < end) {
|
1876 |
|
1877 | for (i = len - 1; i >= 0; --i) {
|
1878 | target[i + targetStart] = this[i + start]
|
1879 | }
|
1880 | } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
|
1881 |
|
1882 | for (i = 0; i < len; ++i) {
|
1883 | target[i + targetStart] = this[i + start]
|
1884 | }
|
1885 | } else {
|
1886 | Uint8Array.prototype.set.call(
|
1887 | target,
|
1888 | this.subarray(start, start + len),
|
1889 | targetStart
|
1890 | )
|
1891 | }
|
1892 |
|
1893 | return len
|
1894 | }
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 | Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
1901 |
|
1902 | if (typeof val === 'string') {
|
1903 | if (typeof start === 'string') {
|
1904 | encoding = start
|
1905 | start = 0
|
1906 | end = this.length
|
1907 | } else if (typeof end === 'string') {
|
1908 | encoding = end
|
1909 | end = this.length
|
1910 | }
|
1911 | if (val.length === 1) {
|
1912 | var code = val.charCodeAt(0)
|
1913 | if (code < 256) {
|
1914 | val = code
|
1915 | }
|
1916 | }
|
1917 | if (encoding !== undefined && typeof encoding !== 'string') {
|
1918 | throw new TypeError('encoding must be a string')
|
1919 | }
|
1920 | if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
1921 | throw new TypeError('Unknown encoding: ' + encoding)
|
1922 | }
|
1923 | } else if (typeof val === 'number') {
|
1924 | val = val & 255
|
1925 | }
|
1926 |
|
1927 |
|
1928 | if (start < 0 || this.length < start || this.length < end) {
|
1929 | throw new RangeError('Out of range index')
|
1930 | }
|
1931 |
|
1932 | if (end <= start) {
|
1933 | return this
|
1934 | }
|
1935 |
|
1936 | start = start >>> 0
|
1937 | end = end === undefined ? this.length : end >>> 0
|
1938 |
|
1939 | if (!val) val = 0
|
1940 |
|
1941 | var i
|
1942 | if (typeof val === 'number') {
|
1943 | for (i = start; i < end; ++i) {
|
1944 | this[i] = val
|
1945 | }
|
1946 | } else {
|
1947 | var bytes = Buffer.isBuffer(val)
|
1948 | ? val
|
1949 | : utf8ToBytes(new Buffer(val, encoding).toString())
|
1950 | var len = bytes.length
|
1951 | for (i = 0; i < end - start; ++i) {
|
1952 | this[i + start] = bytes[i % len]
|
1953 | }
|
1954 | }
|
1955 |
|
1956 | return this
|
1957 | }
|
1958 |
|
1959 |
|
1960 |
|
1961 |
|
1962 | var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
|
1963 |
|
1964 | function base64clean (str) {
|
1965 |
|
1966 | str = stringtrim(str).replace(INVALID_BASE64_RE, '')
|
1967 |
|
1968 | if (str.length < 2) return ''
|
1969 |
|
1970 | while (str.length % 4 !== 0) {
|
1971 | str = str + '='
|
1972 | }
|
1973 | return str
|
1974 | }
|
1975 |
|
1976 | function stringtrim (str) {
|
1977 | if (str.trim) return str.trim()
|
1978 | return str.replace(/^\s+|\s+$/g, '')
|
1979 | }
|
1980 |
|
1981 | function toHex (n) {
|
1982 | if (n < 16) return '0' + n.toString(16)
|
1983 | return n.toString(16)
|
1984 | }
|
1985 |
|
1986 | function utf8ToBytes (string, units) {
|
1987 | units = units || Infinity
|
1988 | var codePoint
|
1989 | var length = string.length
|
1990 | var leadSurrogate = null
|
1991 | var bytes = []
|
1992 |
|
1993 | for (var i = 0; i < length; ++i) {
|
1994 | codePoint = string.charCodeAt(i)
|
1995 |
|
1996 |
|
1997 | if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
1998 |
|
1999 | if (!leadSurrogate) {
|
2000 |
|
2001 | if (codePoint > 0xDBFF) {
|
2002 |
|
2003 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
2004 | continue
|
2005 | } else if (i + 1 === length) {
|
2006 |
|
2007 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
2008 | continue
|
2009 | }
|
2010 |
|
2011 |
|
2012 | leadSurrogate = codePoint
|
2013 |
|
2014 | continue
|
2015 | }
|
2016 |
|
2017 |
|
2018 | if (codePoint < 0xDC00) {
|
2019 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
2020 | leadSurrogate = codePoint
|
2021 | continue
|
2022 | }
|
2023 |
|
2024 |
|
2025 | codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
2026 | } else if (leadSurrogate) {
|
2027 |
|
2028 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
2029 | }
|
2030 |
|
2031 | leadSurrogate = null
|
2032 |
|
2033 |
|
2034 | if (codePoint < 0x80) {
|
2035 | if ((units -= 1) < 0) break
|
2036 | bytes.push(codePoint)
|
2037 | } else if (codePoint < 0x800) {
|
2038 | if ((units -= 2) < 0) break
|
2039 | bytes.push(
|
2040 | codePoint >> 0x6 | 0xC0,
|
2041 | codePoint & 0x3F | 0x80
|
2042 | )
|
2043 | } else if (codePoint < 0x10000) {
|
2044 | if ((units -= 3) < 0) break
|
2045 | bytes.push(
|
2046 | codePoint >> 0xC | 0xE0,
|
2047 | codePoint >> 0x6 & 0x3F | 0x80,
|
2048 | codePoint & 0x3F | 0x80
|
2049 | )
|
2050 | } else if (codePoint < 0x110000) {
|
2051 | if ((units -= 4) < 0) break
|
2052 | bytes.push(
|
2053 | codePoint >> 0x12 | 0xF0,
|
2054 | codePoint >> 0xC & 0x3F | 0x80,
|
2055 | codePoint >> 0x6 & 0x3F | 0x80,
|
2056 | codePoint & 0x3F | 0x80
|
2057 | )
|
2058 | } else {
|
2059 | throw new Error('Invalid code point')
|
2060 | }
|
2061 | }
|
2062 |
|
2063 | return bytes
|
2064 | }
|
2065 |
|
2066 | function asciiToBytes (str) {
|
2067 | var byteArray = []
|
2068 | for (var i = 0; i < str.length; ++i) {
|
2069 |
|
2070 | byteArray.push(str.charCodeAt(i) & 0xFF)
|
2071 | }
|
2072 | return byteArray
|
2073 | }
|
2074 |
|
2075 | function utf16leToBytes (str, units) {
|
2076 | var c, hi, lo
|
2077 | var byteArray = []
|
2078 | for (var i = 0; i < str.length; ++i) {
|
2079 | if ((units -= 2) < 0) break
|
2080 |
|
2081 | c = str.charCodeAt(i)
|
2082 | hi = c >> 8
|
2083 | lo = c % 256
|
2084 | byteArray.push(lo)
|
2085 | byteArray.push(hi)
|
2086 | }
|
2087 |
|
2088 | return byteArray
|
2089 | }
|
2090 |
|
2091 | function base64ToBytes (str) {
|
2092 | return base64.toByteArray(base64clean(str))
|
2093 | }
|
2094 |
|
2095 | function blitBuffer (src, dst, offset, length) {
|
2096 | for (var i = 0; i < length; ++i) {
|
2097 | if ((i + offset >= dst.length) || (i >= src.length)) break
|
2098 | dst[i + offset] = src[i]
|
2099 | }
|
2100 | return i
|
2101 | }
|
2102 |
|
2103 | function isnan (val) {
|
2104 | return val !== val
|
2105 | }
|
2106 |
|
2107 | }.call(exports, __webpack_require__(0)))
|
2108 |
|
2109 | }),
|
2110 |
|
2111 | (function(module, exports, __webpack_require__) {
|
2112 |
|
2113 | "use strict";
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 |
|
2133 |
|
2134 |
|
2135 |
|
2136 |
|
2137 |
|
2138 |
|
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 | var pna = __webpack_require__(6);
|
2145 |
|
2146 |
|
2147 |
|
2148 | var objectKeys = Object.keys || function (obj) {
|
2149 | var keys = [];
|
2150 | for (var key in obj) {
|
2151 | keys.push(key);
|
2152 | }return keys;
|
2153 | };
|
2154 |
|
2155 |
|
2156 | module.exports = Duplex;
|
2157 |
|
2158 |
|
2159 | var util = Object.create(__webpack_require__(5));
|
2160 | util.inherits = __webpack_require__(2);
|
2161 |
|
2162 |
|
2163 | var Readable = __webpack_require__(15);
|
2164 | var Writable = __webpack_require__(18);
|
2165 |
|
2166 | util.inherits(Duplex, Readable);
|
2167 |
|
2168 | {
|
2169 |
|
2170 | var keys = objectKeys(Writable.prototype);
|
2171 | for (var v = 0; v < keys.length; v++) {
|
2172 | var method = keys[v];
|
2173 | if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
2174 | }
|
2175 | }
|
2176 |
|
2177 | function Duplex(options) {
|
2178 | if (!(this instanceof Duplex)) return new Duplex(options);
|
2179 |
|
2180 | Readable.call(this, options);
|
2181 | Writable.call(this, options);
|
2182 |
|
2183 | if (options && options.readable === false) this.readable = false;
|
2184 |
|
2185 | if (options && options.writable === false) this.writable = false;
|
2186 |
|
2187 | this.allowHalfOpen = true;
|
2188 | if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
|
2189 |
|
2190 | this.once('end', onend);
|
2191 | }
|
2192 |
|
2193 | Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
|
2194 |
|
2195 |
|
2196 |
|
2197 | enumerable: false,
|
2198 | get: function () {
|
2199 | return this._writableState.highWaterMark;
|
2200 | }
|
2201 | });
|
2202 |
|
2203 |
|
2204 | function onend() {
|
2205 |
|
2206 |
|
2207 | if (this.allowHalfOpen || this._writableState.ended) return;
|
2208 |
|
2209 |
|
2210 |
|
2211 | pna.nextTick(onEndNT, this);
|
2212 | }
|
2213 |
|
2214 | function onEndNT(self) {
|
2215 | self.end();
|
2216 | }
|
2217 |
|
2218 | Object.defineProperty(Duplex.prototype, 'destroyed', {
|
2219 | get: function () {
|
2220 | if (this._readableState === undefined || this._writableState === undefined) {
|
2221 | return false;
|
2222 | }
|
2223 | return this._readableState.destroyed && this._writableState.destroyed;
|
2224 | },
|
2225 | set: function (value) {
|
2226 |
|
2227 |
|
2228 | if (this._readableState === undefined || this._writableState === undefined) {
|
2229 | return;
|
2230 | }
|
2231 |
|
2232 |
|
2233 |
|
2234 | this._readableState.destroyed = value;
|
2235 | this._writableState.destroyed = value;
|
2236 | }
|
2237 | });
|
2238 |
|
2239 | Duplex.prototype._destroy = function (err, cb) {
|
2240 | this.push(null);
|
2241 | this.end();
|
2242 |
|
2243 | pna.nextTick(cb, err);
|
2244 | };
|
2245 |
|
2246 | }),
|
2247 |
|
2248 | (function(module, exports, __webpack_require__) {
|
2249 |
|
2250 | (function(Buffer) {
|
2251 |
|
2252 |
|
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 | function isArray(arg) {
|
2275 | if (Array.isArray) {
|
2276 | return Array.isArray(arg);
|
2277 | }
|
2278 | return objectToString(arg) === '[object Array]';
|
2279 | }
|
2280 | exports.isArray = isArray;
|
2281 |
|
2282 | function isBoolean(arg) {
|
2283 | return typeof arg === 'boolean';
|
2284 | }
|
2285 | exports.isBoolean = isBoolean;
|
2286 |
|
2287 | function isNull(arg) {
|
2288 | return arg === null;
|
2289 | }
|
2290 | exports.isNull = isNull;
|
2291 |
|
2292 | function isNullOrUndefined(arg) {
|
2293 | return arg == null;
|
2294 | }
|
2295 | exports.isNullOrUndefined = isNullOrUndefined;
|
2296 |
|
2297 | function isNumber(arg) {
|
2298 | return typeof arg === 'number';
|
2299 | }
|
2300 | exports.isNumber = isNumber;
|
2301 |
|
2302 | function isString(arg) {
|
2303 | return typeof arg === 'string';
|
2304 | }
|
2305 | exports.isString = isString;
|
2306 |
|
2307 | function isSymbol(arg) {
|
2308 | return typeof arg === 'symbol';
|
2309 | }
|
2310 | exports.isSymbol = isSymbol;
|
2311 |
|
2312 | function isUndefined(arg) {
|
2313 | return arg === void 0;
|
2314 | }
|
2315 | exports.isUndefined = isUndefined;
|
2316 |
|
2317 | function isRegExp(re) {
|
2318 | return objectToString(re) === '[object RegExp]';
|
2319 | }
|
2320 | exports.isRegExp = isRegExp;
|
2321 |
|
2322 | function isObject(arg) {
|
2323 | return typeof arg === 'object' && arg !== null;
|
2324 | }
|
2325 | exports.isObject = isObject;
|
2326 |
|
2327 | function isDate(d) {
|
2328 | return objectToString(d) === '[object Date]';
|
2329 | }
|
2330 | exports.isDate = isDate;
|
2331 |
|
2332 | function isError(e) {
|
2333 | return (objectToString(e) === '[object Error]' || e instanceof Error);
|
2334 | }
|
2335 | exports.isError = isError;
|
2336 |
|
2337 | function isFunction(arg) {
|
2338 | return typeof arg === 'function';
|
2339 | }
|
2340 | exports.isFunction = isFunction;
|
2341 |
|
2342 | function isPrimitive(arg) {
|
2343 | return arg === null ||
|
2344 | typeof arg === 'boolean' ||
|
2345 | typeof arg === 'number' ||
|
2346 | typeof arg === 'string' ||
|
2347 | typeof arg === 'symbol' ||
|
2348 | typeof arg === 'undefined';
|
2349 | }
|
2350 | exports.isPrimitive = isPrimitive;
|
2351 |
|
2352 | exports.isBuffer = Buffer.isBuffer;
|
2353 |
|
2354 | function objectToString(o) {
|
2355 | return Object.prototype.toString.call(o);
|
2356 | }
|
2357 |
|
2358 | }.call(exports, __webpack_require__(3).Buffer))
|
2359 |
|
2360 | }),
|
2361 |
|
2362 | (function(module, exports, __webpack_require__) {
|
2363 |
|
2364 | "use strict";
|
2365 | (function(process) {
|
2366 |
|
2367 | if (typeof process === 'undefined' ||
|
2368 | !process.version ||
|
2369 | process.version.indexOf('v0.') === 0 ||
|
2370 | process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
|
2371 | module.exports = { nextTick: nextTick };
|
2372 | } else {
|
2373 | module.exports = process
|
2374 | }
|
2375 |
|
2376 | function nextTick(fn, arg1, arg2, arg3) {
|
2377 | if (typeof fn !== 'function') {
|
2378 | throw new TypeError('"callback" argument must be a function');
|
2379 | }
|
2380 | var len = arguments.length;
|
2381 | var args, i;
|
2382 | switch (len) {
|
2383 | case 0:
|
2384 | case 1:
|
2385 | return process.nextTick(fn);
|
2386 | case 2:
|
2387 | return process.nextTick(function afterTickOne() {
|
2388 | fn.call(null, arg1);
|
2389 | });
|
2390 | case 3:
|
2391 | return process.nextTick(function afterTickTwo() {
|
2392 | fn.call(null, arg1, arg2);
|
2393 | });
|
2394 | case 4:
|
2395 | return process.nextTick(function afterTickThree() {
|
2396 | fn.call(null, arg1, arg2, arg3);
|
2397 | });
|
2398 | default:
|
2399 | args = new Array(len - 1);
|
2400 | i = 0;
|
2401 | while (i < args.length) {
|
2402 | args[i++] = arguments[i];
|
2403 | }
|
2404 | return process.nextTick(function afterTick() {
|
2405 | fn.apply(null, args);
|
2406 | });
|
2407 | }
|
2408 | }
|
2409 |
|
2410 |
|
2411 | }.call(exports, __webpack_require__(1)))
|
2412 |
|
2413 | }),
|
2414 |
|
2415 | (function(module, exports, __webpack_require__) {
|
2416 |
|
2417 |
|
2418 | var buffer = __webpack_require__(3)
|
2419 | var Buffer = buffer.Buffer
|
2420 |
|
2421 |
|
2422 | function copyProps (src, dst) {
|
2423 | for (var key in src) {
|
2424 | dst[key] = src[key]
|
2425 | }
|
2426 | }
|
2427 | if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
2428 | module.exports = buffer
|
2429 | } else {
|
2430 |
|
2431 | copyProps(buffer, exports)
|
2432 | exports.Buffer = SafeBuffer
|
2433 | }
|
2434 |
|
2435 | function SafeBuffer (arg, encodingOrOffset, length) {
|
2436 | return Buffer(arg, encodingOrOffset, length)
|
2437 | }
|
2438 |
|
2439 |
|
2440 | copyProps(Buffer, SafeBuffer)
|
2441 |
|
2442 | SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
2443 | if (typeof arg === 'number') {
|
2444 | throw new TypeError('Argument must not be a number')
|
2445 | }
|
2446 | return Buffer(arg, encodingOrOffset, length)
|
2447 | }
|
2448 |
|
2449 | SafeBuffer.alloc = function (size, fill, encoding) {
|
2450 | if (typeof size !== 'number') {
|
2451 | throw new TypeError('Argument must be a number')
|
2452 | }
|
2453 | var buf = Buffer(size)
|
2454 | if (fill !== undefined) {
|
2455 | if (typeof encoding === 'string') {
|
2456 | buf.fill(fill, encoding)
|
2457 | } else {
|
2458 | buf.fill(fill)
|
2459 | }
|
2460 | } else {
|
2461 | buf.fill(0)
|
2462 | }
|
2463 | return buf
|
2464 | }
|
2465 |
|
2466 | SafeBuffer.allocUnsafe = function (size) {
|
2467 | if (typeof size !== 'number') {
|
2468 | throw new TypeError('Argument must be a number')
|
2469 | }
|
2470 | return Buffer(size)
|
2471 | }
|
2472 |
|
2473 | SafeBuffer.allocUnsafeSlow = function (size) {
|
2474 | if (typeof size !== 'number') {
|
2475 | throw new TypeError('Argument must be a number')
|
2476 | }
|
2477 | return buffer.SlowBuffer(size)
|
2478 | }
|
2479 |
|
2480 |
|
2481 | }),
|
2482 |
|
2483 | (function(module, exports, __webpack_require__) {
|
2484 |
|
2485 | "use strict";
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 | var punycode = __webpack_require__(25);
|
2510 | var util = __webpack_require__(27);
|
2511 |
|
2512 | exports.parse = urlParse;
|
2513 | exports.resolve = urlResolve;
|
2514 | exports.resolveObject = urlResolveObject;
|
2515 | exports.format = urlFormat;
|
2516 |
|
2517 | exports.Url = Url;
|
2518 |
|
2519 | function Url() {
|
2520 | this.protocol = null;
|
2521 | this.slashes = null;
|
2522 | this.auth = null;
|
2523 | this.host = null;
|
2524 | this.port = null;
|
2525 | this.hostname = null;
|
2526 | this.hash = null;
|
2527 | this.search = null;
|
2528 | this.query = null;
|
2529 | this.pathname = null;
|
2530 | this.path = null;
|
2531 | this.href = null;
|
2532 | }
|
2533 |
|
2534 |
|
2535 |
|
2536 |
|
2537 |
|
2538 | var protocolPattern = /^([a-z0-9.+-]+:)/i,
|
2539 | portPattern = /:[0-9]*$/,
|
2540 |
|
2541 |
|
2542 | simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
2543 |
|
2544 |
|
2545 |
|
2546 | delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
|
2547 |
|
2548 |
|
2549 | unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
|
2550 |
|
2551 |
|
2552 | autoEscape = ['\''].concat(unwise),
|
2553 |
|
2554 |
|
2555 |
|
2556 |
|
2557 | nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
|
2558 | hostEndingChars = ['/', '?', '#'],
|
2559 | hostnameMaxLen = 255,
|
2560 | hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
|
2561 | hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
2562 |
|
2563 | unsafeProtocol = {
|
2564 | 'javascript': true,
|
2565 | 'javascript:': true
|
2566 | },
|
2567 |
|
2568 | hostlessProtocol = {
|
2569 | 'javascript': true,
|
2570 | 'javascript:': true
|
2571 | },
|
2572 |
|
2573 | slashedProtocol = {
|
2574 | 'http': true,
|
2575 | 'https': true,
|
2576 | 'ftp': true,
|
2577 | 'gopher': true,
|
2578 | 'file': true,
|
2579 | 'http:': true,
|
2580 | 'https:': true,
|
2581 | 'ftp:': true,
|
2582 | 'gopher:': true,
|
2583 | 'file:': true
|
2584 | },
|
2585 | querystring = __webpack_require__(28);
|
2586 |
|
2587 | function urlParse(url, parseQueryString, slashesDenoteHost) {
|
2588 | if (url && util.isObject(url) && url instanceof Url) return url;
|
2589 |
|
2590 | var u = new Url;
|
2591 | u.parse(url, parseQueryString, slashesDenoteHost);
|
2592 | return u;
|
2593 | }
|
2594 |
|
2595 | Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
2596 | if (!util.isString(url)) {
|
2597 | throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
|
2598 | }
|
2599 |
|
2600 |
|
2601 |
|
2602 |
|
2603 | var queryIndex = url.indexOf('?'),
|
2604 | splitter =
|
2605 | (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
|
2606 | uSplit = url.split(splitter),
|
2607 | slashRegex = /\\/g;
|
2608 | uSplit[0] = uSplit[0].replace(slashRegex, '/');
|
2609 | url = uSplit.join(splitter);
|
2610 |
|
2611 | var rest = url;
|
2612 |
|
2613 |
|
2614 |
|
2615 | rest = rest.trim();
|
2616 |
|
2617 | if (!slashesDenoteHost && url.split('#').length === 1) {
|
2618 |
|
2619 | var simplePath = simplePathPattern.exec(rest);
|
2620 | if (simplePath) {
|
2621 | this.path = rest;
|
2622 | this.href = rest;
|
2623 | this.pathname = simplePath[1];
|
2624 | if (simplePath[2]) {
|
2625 | this.search = simplePath[2];
|
2626 | if (parseQueryString) {
|
2627 | this.query = querystring.parse(this.search.substr(1));
|
2628 | } else {
|
2629 | this.query = this.search.substr(1);
|
2630 | }
|
2631 | } else if (parseQueryString) {
|
2632 | this.search = '';
|
2633 | this.query = {};
|
2634 | }
|
2635 | return this;
|
2636 | }
|
2637 | }
|
2638 |
|
2639 | var proto = protocolPattern.exec(rest);
|
2640 | if (proto) {
|
2641 | proto = proto[0];
|
2642 | var lowerProto = proto.toLowerCase();
|
2643 | this.protocol = lowerProto;
|
2644 | rest = rest.substr(proto.length);
|
2645 | }
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 | if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
2652 | var slashes = rest.substr(0, 2) === '//';
|
2653 | if (slashes && !(proto && hostlessProtocol[proto])) {
|
2654 | rest = rest.substr(2);
|
2655 | this.slashes = true;
|
2656 | }
|
2657 | }
|
2658 |
|
2659 | if (!hostlessProtocol[proto] &&
|
2660 | (slashes || (proto && !slashedProtocol[proto]))) {
|
2661 |
|
2662 |
|
2663 |
|
2664 |
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 |
|
2677 |
|
2678 | var hostEnd = -1;
|
2679 | for (var i = 0; i < hostEndingChars.length; i++) {
|
2680 | var hec = rest.indexOf(hostEndingChars[i]);
|
2681 | if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
2682 | hostEnd = hec;
|
2683 | }
|
2684 |
|
2685 |
|
2686 |
|
2687 | var auth, atSign;
|
2688 | if (hostEnd === -1) {
|
2689 |
|
2690 | atSign = rest.lastIndexOf('@');
|
2691 | } else {
|
2692 |
|
2693 |
|
2694 | atSign = rest.lastIndexOf('@', hostEnd);
|
2695 | }
|
2696 |
|
2697 |
|
2698 |
|
2699 | if (atSign !== -1) {
|
2700 | auth = rest.slice(0, atSign);
|
2701 | rest = rest.slice(atSign + 1);
|
2702 | this.auth = decodeURIComponent(auth);
|
2703 | }
|
2704 |
|
2705 |
|
2706 | hostEnd = -1;
|
2707 | for (var i = 0; i < nonHostChars.length; i++) {
|
2708 | var hec = rest.indexOf(nonHostChars[i]);
|
2709 | if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
2710 | hostEnd = hec;
|
2711 | }
|
2712 |
|
2713 | if (hostEnd === -1)
|
2714 | hostEnd = rest.length;
|
2715 |
|
2716 | this.host = rest.slice(0, hostEnd);
|
2717 | rest = rest.slice(hostEnd);
|
2718 |
|
2719 |
|
2720 | this.parseHost();
|
2721 |
|
2722 |
|
2723 |
|
2724 | this.hostname = this.hostname || '';
|
2725 |
|
2726 |
|
2727 |
|
2728 | var ipv6Hostname = this.hostname[0] === '[' &&
|
2729 | this.hostname[this.hostname.length - 1] === ']';
|
2730 |
|
2731 |
|
2732 | if (!ipv6Hostname) {
|
2733 | var hostparts = this.hostname.split(/\./);
|
2734 | for (var i = 0, l = hostparts.length; i < l; i++) {
|
2735 | var part = hostparts[i];
|
2736 | if (!part) continue;
|
2737 | if (!part.match(hostnamePartPattern)) {
|
2738 | var newpart = '';
|
2739 | for (var j = 0, k = part.length; j < k; j++) {
|
2740 | if (part.charCodeAt(j) > 127) {
|
2741 |
|
2742 |
|
2743 |
|
2744 | newpart += 'x';
|
2745 | } else {
|
2746 | newpart += part[j];
|
2747 | }
|
2748 | }
|
2749 |
|
2750 | if (!newpart.match(hostnamePartPattern)) {
|
2751 | var validParts = hostparts.slice(0, i);
|
2752 | var notHost = hostparts.slice(i + 1);
|
2753 | var bit = part.match(hostnamePartStart);
|
2754 | if (bit) {
|
2755 | validParts.push(bit[1]);
|
2756 | notHost.unshift(bit[2]);
|
2757 | }
|
2758 | if (notHost.length) {
|
2759 | rest = '/' + notHost.join('.') + rest;
|
2760 | }
|
2761 | this.hostname = validParts.join('.');
|
2762 | break;
|
2763 | }
|
2764 | }
|
2765 | }
|
2766 | }
|
2767 |
|
2768 | if (this.hostname.length > hostnameMaxLen) {
|
2769 | this.hostname = '';
|
2770 | } else {
|
2771 |
|
2772 | this.hostname = this.hostname.toLowerCase();
|
2773 | }
|
2774 |
|
2775 | if (!ipv6Hostname) {
|
2776 |
|
2777 |
|
2778 |
|
2779 |
|
2780 | this.hostname = punycode.toASCII(this.hostname);
|
2781 | }
|
2782 |
|
2783 | var p = this.port ? ':' + this.port : '';
|
2784 | var h = this.hostname || '';
|
2785 | this.host = h + p;
|
2786 | this.href += this.host;
|
2787 |
|
2788 |
|
2789 |
|
2790 | if (ipv6Hostname) {
|
2791 | this.hostname = this.hostname.substr(1, this.hostname.length - 2);
|
2792 | if (rest[0] !== '/') {
|
2793 | rest = '/' + rest;
|
2794 | }
|
2795 | }
|
2796 | }
|
2797 |
|
2798 |
|
2799 |
|
2800 | if (!unsafeProtocol[lowerProto]) {
|
2801 |
|
2802 |
|
2803 |
|
2804 |
|
2805 | for (var i = 0, l = autoEscape.length; i < l; i++) {
|
2806 | var ae = autoEscape[i];
|
2807 | if (rest.indexOf(ae) === -1)
|
2808 | continue;
|
2809 | var esc = encodeURIComponent(ae);
|
2810 | if (esc === ae) {
|
2811 | esc = escape(ae);
|
2812 | }
|
2813 | rest = rest.split(ae).join(esc);
|
2814 | }
|
2815 | }
|
2816 |
|
2817 |
|
2818 |
|
2819 | var hash = rest.indexOf('#');
|
2820 | if (hash !== -1) {
|
2821 |
|
2822 | this.hash = rest.substr(hash);
|
2823 | rest = rest.slice(0, hash);
|
2824 | }
|
2825 | var qm = rest.indexOf('?');
|
2826 | if (qm !== -1) {
|
2827 | this.search = rest.substr(qm);
|
2828 | this.query = rest.substr(qm + 1);
|
2829 | if (parseQueryString) {
|
2830 | this.query = querystring.parse(this.query);
|
2831 | }
|
2832 | rest = rest.slice(0, qm);
|
2833 | } else if (parseQueryString) {
|
2834 |
|
2835 | this.search = '';
|
2836 | this.query = {};
|
2837 | }
|
2838 | if (rest) this.pathname = rest;
|
2839 | if (slashedProtocol[lowerProto] &&
|
2840 | this.hostname && !this.pathname) {
|
2841 | this.pathname = '/';
|
2842 | }
|
2843 |
|
2844 |
|
2845 | if (this.pathname || this.search) {
|
2846 | var p = this.pathname || '';
|
2847 | var s = this.search || '';
|
2848 | this.path = p + s;
|
2849 | }
|
2850 |
|
2851 |
|
2852 | this.href = this.format();
|
2853 | return this;
|
2854 | };
|
2855 |
|
2856 |
|
2857 | function urlFormat(obj) {
|
2858 |
|
2859 |
|
2860 |
|
2861 |
|
2862 | if (util.isString(obj)) obj = urlParse(obj);
|
2863 | if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
|
2864 | return obj.format();
|
2865 | }
|
2866 |
|
2867 | Url.prototype.format = function() {
|
2868 | var auth = this.auth || '';
|
2869 | if (auth) {
|
2870 | auth = encodeURIComponent(auth);
|
2871 | auth = auth.replace(/%3A/i, ':');
|
2872 | auth += '@';
|
2873 | }
|
2874 |
|
2875 | var protocol = this.protocol || '',
|
2876 | pathname = this.pathname || '',
|
2877 | hash = this.hash || '',
|
2878 | host = false,
|
2879 | query = '';
|
2880 |
|
2881 | if (this.host) {
|
2882 | host = auth + this.host;
|
2883 | } else if (this.hostname) {
|
2884 | host = auth + (this.hostname.indexOf(':') === -1 ?
|
2885 | this.hostname :
|
2886 | '[' + this.hostname + ']');
|
2887 | if (this.port) {
|
2888 | host += ':' + this.port;
|
2889 | }
|
2890 | }
|
2891 |
|
2892 | if (this.query &&
|
2893 | util.isObject(this.query) &&
|
2894 | Object.keys(this.query).length) {
|
2895 | query = querystring.stringify(this.query);
|
2896 | }
|
2897 |
|
2898 | var search = this.search || (query && ('?' + query)) || '';
|
2899 |
|
2900 | if (protocol && protocol.substr(-1) !== ':') protocol += ':';
|
2901 |
|
2902 |
|
2903 |
|
2904 | if (this.slashes ||
|
2905 | (!protocol || slashedProtocol[protocol]) && host !== false) {
|
2906 | host = '//' + (host || '');
|
2907 | if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
|
2908 | } else if (!host) {
|
2909 | host = '';
|
2910 | }
|
2911 |
|
2912 | if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
|
2913 | if (search && search.charAt(0) !== '?') search = '?' + search;
|
2914 |
|
2915 | pathname = pathname.replace(/[?#]/g, function(match) {
|
2916 | return encodeURIComponent(match);
|
2917 | });
|
2918 | search = search.replace('#', '%23');
|
2919 |
|
2920 | return protocol + host + pathname + search + hash;
|
2921 | };
|
2922 |
|
2923 | function urlResolve(source, relative) {
|
2924 | return urlParse(source, false, true).resolve(relative);
|
2925 | }
|
2926 |
|
2927 | Url.prototype.resolve = function(relative) {
|
2928 | return this.resolveObject(urlParse(relative, false, true)).format();
|
2929 | };
|
2930 |
|
2931 | function urlResolveObject(source, relative) {
|
2932 | if (!source) return relative;
|
2933 | return urlParse(source, false, true).resolveObject(relative);
|
2934 | }
|
2935 |
|
2936 | Url.prototype.resolveObject = function(relative) {
|
2937 | if (util.isString(relative)) {
|
2938 | var rel = new Url();
|
2939 | rel.parse(relative, false, true);
|
2940 | relative = rel;
|
2941 | }
|
2942 |
|
2943 | var result = new Url();
|
2944 | var tkeys = Object.keys(this);
|
2945 | for (var tk = 0; tk < tkeys.length; tk++) {
|
2946 | var tkey = tkeys[tk];
|
2947 | result[tkey] = this[tkey];
|
2948 | }
|
2949 |
|
2950 |
|
2951 |
|
2952 | result.hash = relative.hash;
|
2953 |
|
2954 |
|
2955 | if (relative.href === '') {
|
2956 | result.href = result.format();
|
2957 | return result;
|
2958 | }
|
2959 |
|
2960 |
|
2961 | if (relative.slashes && !relative.protocol) {
|
2962 |
|
2963 | var rkeys = Object.keys(relative);
|
2964 | for (var rk = 0; rk < rkeys.length; rk++) {
|
2965 | var rkey = rkeys[rk];
|
2966 | if (rkey !== 'protocol')
|
2967 | result[rkey] = relative[rkey];
|
2968 | }
|
2969 |
|
2970 |
|
2971 | if (slashedProtocol[result.protocol] &&
|
2972 | result.hostname && !result.pathname) {
|
2973 | result.path = result.pathname = '/';
|
2974 | }
|
2975 |
|
2976 | result.href = result.format();
|
2977 | return result;
|
2978 | }
|
2979 |
|
2980 | if (relative.protocol && relative.protocol !== result.protocol) {
|
2981 |
|
2982 |
|
2983 |
|
2984 |
|
2985 |
|
2986 |
|
2987 |
|
2988 |
|
2989 | if (!slashedProtocol[relative.protocol]) {
|
2990 | var keys = Object.keys(relative);
|
2991 | for (var v = 0; v < keys.length; v++) {
|
2992 | var k = keys[v];
|
2993 | result[k] = relative[k];
|
2994 | }
|
2995 | result.href = result.format();
|
2996 | return result;
|
2997 | }
|
2998 |
|
2999 | result.protocol = relative.protocol;
|
3000 | if (!relative.host && !hostlessProtocol[relative.protocol]) {
|
3001 | var relPath = (relative.pathname || '').split('/');
|
3002 | while (relPath.length && !(relative.host = relPath.shift()));
|
3003 | if (!relative.host) relative.host = '';
|
3004 | if (!relative.hostname) relative.hostname = '';
|
3005 | if (relPath[0] !== '') relPath.unshift('');
|
3006 | if (relPath.length < 2) relPath.unshift('');
|
3007 | result.pathname = relPath.join('/');
|
3008 | } else {
|
3009 | result.pathname = relative.pathname;
|
3010 | }
|
3011 | result.search = relative.search;
|
3012 | result.query = relative.query;
|
3013 | result.host = relative.host || '';
|
3014 | result.auth = relative.auth;
|
3015 | result.hostname = relative.hostname || relative.host;
|
3016 | result.port = relative.port;
|
3017 |
|
3018 | if (result.pathname || result.search) {
|
3019 | var p = result.pathname || '';
|
3020 | var s = result.search || '';
|
3021 | result.path = p + s;
|
3022 | }
|
3023 | result.slashes = result.slashes || relative.slashes;
|
3024 | result.href = result.format();
|
3025 | return result;
|
3026 | }
|
3027 |
|
3028 | var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
|
3029 | isRelAbs = (
|
3030 | relative.host ||
|
3031 | relative.pathname && relative.pathname.charAt(0) === '/'
|
3032 | ),
|
3033 | mustEndAbs = (isRelAbs || isSourceAbs ||
|
3034 | (result.host && relative.pathname)),
|
3035 | removeAllDots = mustEndAbs,
|
3036 | srcPath = result.pathname && result.pathname.split('/') || [],
|
3037 | relPath = relative.pathname && relative.pathname.split('/') || [],
|
3038 | psychotic = result.protocol && !slashedProtocol[result.protocol];
|
3039 |
|
3040 |
|
3041 |
|
3042 |
|
3043 |
|
3044 |
|
3045 | if (psychotic) {
|
3046 | result.hostname = '';
|
3047 | result.port = null;
|
3048 | if (result.host) {
|
3049 | if (srcPath[0] === '') srcPath[0] = result.host;
|
3050 | else srcPath.unshift(result.host);
|
3051 | }
|
3052 | result.host = '';
|
3053 | if (relative.protocol) {
|
3054 | relative.hostname = null;
|
3055 | relative.port = null;
|
3056 | if (relative.host) {
|
3057 | if (relPath[0] === '') relPath[0] = relative.host;
|
3058 | else relPath.unshift(relative.host);
|
3059 | }
|
3060 | relative.host = null;
|
3061 | }
|
3062 | mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
|
3063 | }
|
3064 |
|
3065 | if (isRelAbs) {
|
3066 |
|
3067 | result.host = (relative.host || relative.host === '') ?
|
3068 | relative.host : result.host;
|
3069 | result.hostname = (relative.hostname || relative.hostname === '') ?
|
3070 | relative.hostname : result.hostname;
|
3071 | result.search = relative.search;
|
3072 | result.query = relative.query;
|
3073 | srcPath = relPath;
|
3074 |
|
3075 | } else if (relPath.length) {
|
3076 |
|
3077 |
|
3078 | if (!srcPath) srcPath = [];
|
3079 | srcPath.pop();
|
3080 | srcPath = srcPath.concat(relPath);
|
3081 | result.search = relative.search;
|
3082 | result.query = relative.query;
|
3083 | } else if (!util.isNullOrUndefined(relative.search)) {
|
3084 |
|
3085 |
|
3086 |
|
3087 | if (psychotic) {
|
3088 | result.hostname = result.host = srcPath.shift();
|
3089 |
|
3090 |
|
3091 |
|
3092 | var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
3093 | result.host.split('@') : false;
|
3094 | if (authInHost) {
|
3095 | result.auth = authInHost.shift();
|
3096 | result.host = result.hostname = authInHost.shift();
|
3097 | }
|
3098 | }
|
3099 | result.search = relative.search;
|
3100 | result.query = relative.query;
|
3101 |
|
3102 | if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
3103 | result.path = (result.pathname ? result.pathname : '') +
|
3104 | (result.search ? result.search : '');
|
3105 | }
|
3106 | result.href = result.format();
|
3107 | return result;
|
3108 | }
|
3109 |
|
3110 | if (!srcPath.length) {
|
3111 |
|
3112 |
|
3113 | result.pathname = null;
|
3114 |
|
3115 | if (result.search) {
|
3116 | result.path = '/' + result.search;
|
3117 | } else {
|
3118 | result.path = null;
|
3119 | }
|
3120 | result.href = result.format();
|
3121 | return result;
|
3122 | }
|
3123 |
|
3124 |
|
3125 |
|
3126 |
|
3127 | var last = srcPath.slice(-1)[0];
|
3128 | var hasTrailingSlash = (
|
3129 | (result.host || relative.host || srcPath.length > 1) &&
|
3130 | (last === '.' || last === '..') || last === '');
|
3131 |
|
3132 |
|
3133 |
|
3134 | var up = 0;
|
3135 | for (var i = srcPath.length; i >= 0; i--) {
|
3136 | last = srcPath[i];
|
3137 | if (last === '.') {
|
3138 | srcPath.splice(i, 1);
|
3139 | } else if (last === '..') {
|
3140 | srcPath.splice(i, 1);
|
3141 | up++;
|
3142 | } else if (up) {
|
3143 | srcPath.splice(i, 1);
|
3144 | up--;
|
3145 | }
|
3146 | }
|
3147 |
|
3148 |
|
3149 | if (!mustEndAbs && !removeAllDots) {
|
3150 | for (; up--; up) {
|
3151 | srcPath.unshift('..');
|
3152 | }
|
3153 | }
|
3154 |
|
3155 | if (mustEndAbs && srcPath[0] !== '' &&
|
3156 | (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
|
3157 | srcPath.unshift('');
|
3158 | }
|
3159 |
|
3160 | if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
|
3161 | srcPath.push('');
|
3162 | }
|
3163 |
|
3164 | var isAbsolute = srcPath[0] === '' ||
|
3165 | (srcPath[0] && srcPath[0].charAt(0) === '/');
|
3166 |
|
3167 |
|
3168 | if (psychotic) {
|
3169 | result.hostname = result.host = isAbsolute ? '' :
|
3170 | srcPath.length ? srcPath.shift() : '';
|
3171 |
|
3172 |
|
3173 |
|
3174 | var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
3175 | result.host.split('@') : false;
|
3176 | if (authInHost) {
|
3177 | result.auth = authInHost.shift();
|
3178 | result.host = result.hostname = authInHost.shift();
|
3179 | }
|
3180 | }
|
3181 |
|
3182 | mustEndAbs = mustEndAbs || (result.host && srcPath.length);
|
3183 |
|
3184 | if (mustEndAbs && !isAbsolute) {
|
3185 | srcPath.unshift('');
|
3186 | }
|
3187 |
|
3188 | if (!srcPath.length) {
|
3189 | result.pathname = null;
|
3190 | result.path = null;
|
3191 | } else {
|
3192 | result.pathname = srcPath.join('/');
|
3193 | }
|
3194 |
|
3195 |
|
3196 | if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
3197 | result.path = (result.pathname ? result.pathname : '') +
|
3198 | (result.search ? result.search : '');
|
3199 | }
|
3200 | result.auth = relative.auth || result.auth;
|
3201 | result.slashes = result.slashes || relative.slashes;
|
3202 | result.href = result.format();
|
3203 | return result;
|
3204 | };
|
3205 |
|
3206 | Url.prototype.parseHost = function() {
|
3207 | var host = this.host;
|
3208 | var port = portPattern.exec(host);
|
3209 | if (port) {
|
3210 | port = port[0];
|
3211 | if (port !== ':') {
|
3212 | this.port = port.substr(1);
|
3213 | }
|
3214 | host = host.substr(0, host.length - port.length);
|
3215 | }
|
3216 | if (host) this.hostname = host;
|
3217 | };
|
3218 |
|
3219 |
|
3220 | }),
|
3221 |
|
3222 | (function(module, exports, __webpack_require__) {
|
3223 |
|
3224 | "use strict";
|
3225 |
|
3226 |
|
3227 |
|
3228 |
|
3229 |
|
3230 |
|
3231 |
|
3232 |
|
3233 |
|
3234 |
|
3235 |
|
3236 |
|
3237 |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 |
|
3243 |
|
3244 |
|
3245 |
|
3246 |
|
3247 |
|
3248 | var R = typeof Reflect === 'object' ? Reflect : null
|
3249 | var ReflectApply = R && typeof R.apply === 'function'
|
3250 | ? R.apply
|
3251 | : function ReflectApply(target, receiver, args) {
|
3252 | return Function.prototype.apply.call(target, receiver, args);
|
3253 | }
|
3254 |
|
3255 | var ReflectOwnKeys
|
3256 | if (R && typeof R.ownKeys === 'function') {
|
3257 | ReflectOwnKeys = R.ownKeys
|
3258 | } else if (Object.getOwnPropertySymbols) {
|
3259 | ReflectOwnKeys = function ReflectOwnKeys(target) {
|
3260 | return Object.getOwnPropertyNames(target)
|
3261 | .concat(Object.getOwnPropertySymbols(target));
|
3262 | };
|
3263 | } else {
|
3264 | ReflectOwnKeys = function ReflectOwnKeys(target) {
|
3265 | return Object.getOwnPropertyNames(target);
|
3266 | };
|
3267 | }
|
3268 |
|
3269 | function ProcessEmitWarning(warning) {
|
3270 | if (console && console.warn) console.warn(warning);
|
3271 | }
|
3272 |
|
3273 | var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
|
3274 | return value !== value;
|
3275 | }
|
3276 |
|
3277 | function EventEmitter() {
|
3278 | EventEmitter.init.call(this);
|
3279 | }
|
3280 | module.exports = EventEmitter;
|
3281 | module.exports.once = once;
|
3282 |
|
3283 |
|
3284 | EventEmitter.EventEmitter = EventEmitter;
|
3285 |
|
3286 | EventEmitter.prototype._events = undefined;
|
3287 | EventEmitter.prototype._eventsCount = 0;
|
3288 | EventEmitter.prototype._maxListeners = undefined;
|
3289 |
|
3290 |
|
3291 |
|
3292 | var defaultMaxListeners = 10;
|
3293 |
|
3294 | function checkListener(listener) {
|
3295 | if (typeof listener !== 'function') {
|
3296 | throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
3297 | }
|
3298 | }
|
3299 |
|
3300 | Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
|
3301 | enumerable: true,
|
3302 | get: function() {
|
3303 | return defaultMaxListeners;
|
3304 | },
|
3305 | set: function(arg) {
|
3306 | if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
|
3307 | throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
|
3308 | }
|
3309 | defaultMaxListeners = arg;
|
3310 | }
|
3311 | });
|
3312 |
|
3313 | EventEmitter.init = function() {
|
3314 |
|
3315 | if (this._events === undefined ||
|
3316 | this._events === Object.getPrototypeOf(this)._events) {
|
3317 | this._events = Object.create(null);
|
3318 | this._eventsCount = 0;
|
3319 | }
|
3320 |
|
3321 | this._maxListeners = this._maxListeners || undefined;
|
3322 | };
|
3323 |
|
3324 |
|
3325 |
|
3326 | EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
3327 | if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
|
3328 | throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
|
3329 | }
|
3330 | this._maxListeners = n;
|
3331 | return this;
|
3332 | };
|
3333 |
|
3334 | function _getMaxListeners(that) {
|
3335 | if (that._maxListeners === undefined)
|
3336 | return EventEmitter.defaultMaxListeners;
|
3337 | return that._maxListeners;
|
3338 | }
|
3339 |
|
3340 | EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
3341 | return _getMaxListeners(this);
|
3342 | };
|
3343 |
|
3344 | EventEmitter.prototype.emit = function emit(type) {
|
3345 | var args = [];
|
3346 | for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
|
3347 | var doError = (type === 'error');
|
3348 |
|
3349 | var events = this._events;
|
3350 | if (events !== undefined)
|
3351 | doError = (doError && events.error === undefined);
|
3352 | else if (!doError)
|
3353 | return false;
|
3354 |
|
3355 |
|
3356 | if (doError) {
|
3357 | var er;
|
3358 | if (args.length > 0)
|
3359 | er = args[0];
|
3360 | if (er instanceof Error) {
|
3361 |
|
3362 |
|
3363 | throw er;
|
3364 | }
|
3365 |
|
3366 | var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
|
3367 | err.context = er;
|
3368 | throw err;
|
3369 | }
|
3370 |
|
3371 | var handler = events[type];
|
3372 |
|
3373 | if (handler === undefined)
|
3374 | return false;
|
3375 |
|
3376 | if (typeof handler === 'function') {
|
3377 | ReflectApply(handler, this, args);
|
3378 | } else {
|
3379 | var len = handler.length;
|
3380 | var listeners = arrayClone(handler, len);
|
3381 | for (var i = 0; i < len; ++i)
|
3382 | ReflectApply(listeners[i], this, args);
|
3383 | }
|
3384 |
|
3385 | return true;
|
3386 | };
|
3387 |
|
3388 | function _addListener(target, type, listener, prepend) {
|
3389 | var m;
|
3390 | var events;
|
3391 | var existing;
|
3392 |
|
3393 | checkListener(listener);
|
3394 |
|
3395 | events = target._events;
|
3396 | if (events === undefined) {
|
3397 | events = target._events = Object.create(null);
|
3398 | target._eventsCount = 0;
|
3399 | } else {
|
3400 |
|
3401 |
|
3402 | if (events.newListener !== undefined) {
|
3403 | target.emit('newListener', type,
|
3404 | listener.listener ? listener.listener : listener);
|
3405 |
|
3406 |
|
3407 |
|
3408 | events = target._events;
|
3409 | }
|
3410 | existing = events[type];
|
3411 | }
|
3412 |
|
3413 | if (existing === undefined) {
|
3414 |
|
3415 | existing = events[type] = listener;
|
3416 | ++target._eventsCount;
|
3417 | } else {
|
3418 | if (typeof existing === 'function') {
|
3419 |
|
3420 | existing = events[type] =
|
3421 | prepend ? [listener, existing] : [existing, listener];
|
3422 |
|
3423 | } else if (prepend) {
|
3424 | existing.unshift(listener);
|
3425 | } else {
|
3426 | existing.push(listener);
|
3427 | }
|
3428 |
|
3429 |
|
3430 | m = _getMaxListeners(target);
|
3431 | if (m > 0 && existing.length > m && !existing.warned) {
|
3432 | existing.warned = true;
|
3433 |
|
3434 |
|
3435 | var w = new Error('Possible EventEmitter memory leak detected. ' +
|
3436 | existing.length + ' ' + String(type) + ' listeners ' +
|
3437 | 'added. Use emitter.setMaxListeners() to ' +
|
3438 | 'increase limit');
|
3439 | w.name = 'MaxListenersExceededWarning';
|
3440 | w.emitter = target;
|
3441 | w.type = type;
|
3442 | w.count = existing.length;
|
3443 | ProcessEmitWarning(w);
|
3444 | }
|
3445 | }
|
3446 |
|
3447 | return target;
|
3448 | }
|
3449 |
|
3450 | EventEmitter.prototype.addListener = function addListener(type, listener) {
|
3451 | return _addListener(this, type, listener, false);
|
3452 | };
|
3453 |
|
3454 | EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
3455 |
|
3456 | EventEmitter.prototype.prependListener =
|
3457 | function prependListener(type, listener) {
|
3458 | return _addListener(this, type, listener, true);
|
3459 | };
|
3460 |
|
3461 | function onceWrapper() {
|
3462 | if (!this.fired) {
|
3463 | this.target.removeListener(this.type, this.wrapFn);
|
3464 | this.fired = true;
|
3465 | if (arguments.length === 0)
|
3466 | return this.listener.call(this.target);
|
3467 | return this.listener.apply(this.target, arguments);
|
3468 | }
|
3469 | }
|
3470 |
|
3471 | function _onceWrap(target, type, listener) {
|
3472 | var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
|
3473 | var wrapped = onceWrapper.bind(state);
|
3474 | wrapped.listener = listener;
|
3475 | state.wrapFn = wrapped;
|
3476 | return wrapped;
|
3477 | }
|
3478 |
|
3479 | EventEmitter.prototype.once = function once(type, listener) {
|
3480 | checkListener(listener);
|
3481 | this.on(type, _onceWrap(this, type, listener));
|
3482 | return this;
|
3483 | };
|
3484 |
|
3485 | EventEmitter.prototype.prependOnceListener =
|
3486 | function prependOnceListener(type, listener) {
|
3487 | checkListener(listener);
|
3488 | this.prependListener(type, _onceWrap(this, type, listener));
|
3489 | return this;
|
3490 | };
|
3491 |
|
3492 |
|
3493 | EventEmitter.prototype.removeListener =
|
3494 | function removeListener(type, listener) {
|
3495 | var list, events, position, i, originalListener;
|
3496 |
|
3497 | checkListener(listener);
|
3498 |
|
3499 | events = this._events;
|
3500 | if (events === undefined)
|
3501 | return this;
|
3502 |
|
3503 | list = events[type];
|
3504 | if (list === undefined)
|
3505 | return this;
|
3506 |
|
3507 | if (list === listener || list.listener === listener) {
|
3508 | if (--this._eventsCount === 0)
|
3509 | this._events = Object.create(null);
|
3510 | else {
|
3511 | delete events[type];
|
3512 | if (events.removeListener)
|
3513 | this.emit('removeListener', type, list.listener || listener);
|
3514 | }
|
3515 | } else if (typeof list !== 'function') {
|
3516 | position = -1;
|
3517 |
|
3518 | for (i = list.length - 1; i >= 0; i--) {
|
3519 | if (list[i] === listener || list[i].listener === listener) {
|
3520 | originalListener = list[i].listener;
|
3521 | position = i;
|
3522 | break;
|
3523 | }
|
3524 | }
|
3525 |
|
3526 | if (position < 0)
|
3527 | return this;
|
3528 |
|
3529 | if (position === 0)
|
3530 | list.shift();
|
3531 | else {
|
3532 | spliceOne(list, position);
|
3533 | }
|
3534 |
|
3535 | if (list.length === 1)
|
3536 | events[type] = list[0];
|
3537 |
|
3538 | if (events.removeListener !== undefined)
|
3539 | this.emit('removeListener', type, originalListener || listener);
|
3540 | }
|
3541 |
|
3542 | return this;
|
3543 | };
|
3544 |
|
3545 | EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
3546 |
|
3547 | EventEmitter.prototype.removeAllListeners =
|
3548 | function removeAllListeners(type) {
|
3549 | var listeners, events, i;
|
3550 |
|
3551 | events = this._events;
|
3552 | if (events === undefined)
|
3553 | return this;
|
3554 |
|
3555 |
|
3556 | if (events.removeListener === undefined) {
|
3557 | if (arguments.length === 0) {
|
3558 | this._events = Object.create(null);
|
3559 | this._eventsCount = 0;
|
3560 | } else if (events[type] !== undefined) {
|
3561 | if (--this._eventsCount === 0)
|
3562 | this._events = Object.create(null);
|
3563 | else
|
3564 | delete events[type];
|
3565 | }
|
3566 | return this;
|
3567 | }
|
3568 |
|
3569 |
|
3570 | if (arguments.length === 0) {
|
3571 | var keys = Object.keys(events);
|
3572 | var key;
|
3573 | for (i = 0; i < keys.length; ++i) {
|
3574 | key = keys[i];
|
3575 | if (key === 'removeListener') continue;
|
3576 | this.removeAllListeners(key);
|
3577 | }
|
3578 | this.removeAllListeners('removeListener');
|
3579 | this._events = Object.create(null);
|
3580 | this._eventsCount = 0;
|
3581 | return this;
|
3582 | }
|
3583 |
|
3584 | listeners = events[type];
|
3585 |
|
3586 | if (typeof listeners === 'function') {
|
3587 | this.removeListener(type, listeners);
|
3588 | } else if (listeners !== undefined) {
|
3589 |
|
3590 | for (i = listeners.length - 1; i >= 0; i--) {
|
3591 | this.removeListener(type, listeners[i]);
|
3592 | }
|
3593 | }
|
3594 |
|
3595 | return this;
|
3596 | };
|
3597 |
|
3598 | function _listeners(target, type, unwrap) {
|
3599 | var events = target._events;
|
3600 |
|
3601 | if (events === undefined)
|
3602 | return [];
|
3603 |
|
3604 | var evlistener = events[type];
|
3605 | if (evlistener === undefined)
|
3606 | return [];
|
3607 |
|
3608 | if (typeof evlistener === 'function')
|
3609 | return unwrap ? [evlistener.listener || evlistener] : [evlistener];
|
3610 |
|
3611 | return unwrap ?
|
3612 | unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
3613 | }
|
3614 |
|
3615 | EventEmitter.prototype.listeners = function listeners(type) {
|
3616 | return _listeners(this, type, true);
|
3617 | };
|
3618 |
|
3619 | EventEmitter.prototype.rawListeners = function rawListeners(type) {
|
3620 | return _listeners(this, type, false);
|
3621 | };
|
3622 |
|
3623 | EventEmitter.listenerCount = function(emitter, type) {
|
3624 | if (typeof emitter.listenerCount === 'function') {
|
3625 | return emitter.listenerCount(type);
|
3626 | } else {
|
3627 | return listenerCount.call(emitter, type);
|
3628 | }
|
3629 | };
|
3630 |
|
3631 | EventEmitter.prototype.listenerCount = listenerCount;
|
3632 | function listenerCount(type) {
|
3633 | var events = this._events;
|
3634 |
|
3635 | if (events !== undefined) {
|
3636 | var evlistener = events[type];
|
3637 |
|
3638 | if (typeof evlistener === 'function') {
|
3639 | return 1;
|
3640 | } else if (evlistener !== undefined) {
|
3641 | return evlistener.length;
|
3642 | }
|
3643 | }
|
3644 |
|
3645 | return 0;
|
3646 | }
|
3647 |
|
3648 | EventEmitter.prototype.eventNames = function eventNames() {
|
3649 | return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
|
3650 | };
|
3651 |
|
3652 | function arrayClone(arr, n) {
|
3653 | var copy = new Array(n);
|
3654 | for (var i = 0; i < n; ++i)
|
3655 | copy[i] = arr[i];
|
3656 | return copy;
|
3657 | }
|
3658 |
|
3659 | function spliceOne(list, index) {
|
3660 | for (; index + 1 < list.length; index++)
|
3661 | list[index] = list[index + 1];
|
3662 | list.pop();
|
3663 | }
|
3664 |
|
3665 | function unwrapListeners(arr) {
|
3666 | var ret = new Array(arr.length);
|
3667 | for (var i = 0; i < ret.length; ++i) {
|
3668 | ret[i] = arr[i].listener || arr[i];
|
3669 | }
|
3670 | return ret;
|
3671 | }
|
3672 |
|
3673 | function once(emitter, name) {
|
3674 | return new Promise(function (resolve, reject) {
|
3675 | function errorListener(err) {
|
3676 | emitter.removeListener(name, resolver);
|
3677 | reject(err);
|
3678 | }
|
3679 |
|
3680 | function resolver() {
|
3681 | if (typeof emitter.removeListener === 'function') {
|
3682 | emitter.removeListener('error', errorListener);
|
3683 | }
|
3684 | resolve([].slice.call(arguments));
|
3685 | };
|
3686 |
|
3687 | eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
|
3688 | if (name !== 'error') {
|
3689 | addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
|
3690 | }
|
3691 | });
|
3692 | }
|
3693 |
|
3694 | function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
|
3695 | if (typeof emitter.on === 'function') {
|
3696 | eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
|
3697 | }
|
3698 | }
|
3699 |
|
3700 | function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
3701 | if (typeof emitter.on === 'function') {
|
3702 | if (flags.once) {
|
3703 | emitter.once(name, listener);
|
3704 | } else {
|
3705 | emitter.on(name, listener);
|
3706 | }
|
3707 | } else if (typeof emitter.addEventListener === 'function') {
|
3708 |
|
3709 |
|
3710 | emitter.addEventListener(name, function wrapListener(arg) {
|
3711 |
|
3712 |
|
3713 | if (flags.once) {
|
3714 | emitter.removeEventListener(name, wrapListener);
|
3715 | }
|
3716 | listener(arg);
|
3717 | });
|
3718 | } else {
|
3719 | throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
|
3720 | }
|
3721 | }
|
3722 |
|
3723 |
|
3724 | }),
|
3725 |
|
3726 | (function(module, exports) {
|
3727 |
|
3728 | var toString = {}.toString;
|
3729 |
|
3730 | module.exports = Array.isArray || function (arr) {
|
3731 | return toString.call(arr) == '[object Array]';
|
3732 | };
|
3733 |
|
3734 |
|
3735 | }),
|
3736 |
|
3737 | (function(module, exports, __webpack_require__) {
|
3738 |
|
3739 | (function(global) {var ClientRequest = __webpack_require__(32)
|
3740 | var response = __webpack_require__(13)
|
3741 | var extend = __webpack_require__(41)
|
3742 | var statusCodes = __webpack_require__(42)
|
3743 | var url = __webpack_require__(8)
|
3744 |
|
3745 | var http = exports
|
3746 |
|
3747 | http.request = function (opts, cb) {
|
3748 | if (typeof opts === 'string')
|
3749 | opts = url.parse(opts)
|
3750 | else
|
3751 | opts = extend(opts)
|
3752 |
|
3753 |
|
3754 |
|
3755 |
|
3756 | var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : ''
|
3757 |
|
3758 | var protocol = opts.protocol || defaultProtocol
|
3759 | var host = opts.hostname || opts.host
|
3760 | var port = opts.port
|
3761 | var path = opts.path || '/'
|
3762 |
|
3763 |
|
3764 | if (host && host.indexOf(':') !== -1)
|
3765 | host = '[' + host + ']'
|
3766 |
|
3767 |
|
3768 | opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path
|
3769 | opts.method = (opts.method || 'GET').toUpperCase()
|
3770 | opts.headers = opts.headers || {}
|
3771 |
|
3772 |
|
3773 |
|
3774 | var req = new ClientRequest(opts)
|
3775 | if (cb)
|
3776 | req.on('response', cb)
|
3777 | return req
|
3778 | }
|
3779 |
|
3780 | http.get = function get (opts, cb) {
|
3781 | var req = http.request(opts, cb)
|
3782 | req.end()
|
3783 | return req
|
3784 | }
|
3785 |
|
3786 | http.ClientRequest = ClientRequest
|
3787 | http.IncomingMessage = response.IncomingMessage
|
3788 |
|
3789 | http.Agent = function () {}
|
3790 | http.Agent.defaultMaxSockets = 4
|
3791 |
|
3792 | http.globalAgent = new http.Agent()
|
3793 |
|
3794 | http.STATUS_CODES = statusCodes
|
3795 |
|
3796 | http.METHODS = [
|
3797 | 'CHECKOUT',
|
3798 | 'CONNECT',
|
3799 | 'COPY',
|
3800 | 'DELETE',
|
3801 | 'GET',
|
3802 | 'HEAD',
|
3803 | 'LOCK',
|
3804 | 'M-SEARCH',
|
3805 | 'MERGE',
|
3806 | 'MKACTIVITY',
|
3807 | 'MKCOL',
|
3808 | 'MOVE',
|
3809 | 'NOTIFY',
|
3810 | 'OPTIONS',
|
3811 | 'PATCH',
|
3812 | 'POST',
|
3813 | 'PROPFIND',
|
3814 | 'PROPPATCH',
|
3815 | 'PURGE',
|
3816 | 'PUT',
|
3817 | 'REPORT',
|
3818 | 'SEARCH',
|
3819 | 'SUBSCRIBE',
|
3820 | 'TRACE',
|
3821 | 'UNLOCK',
|
3822 | 'UNSUBSCRIBE'
|
3823 | ]
|
3824 | }.call(exports, __webpack_require__(0)))
|
3825 |
|
3826 | }),
|
3827 |
|
3828 | (function(module, exports, __webpack_require__) {
|
3829 |
|
3830 | (function(global) {exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream)
|
3831 |
|
3832 | exports.writableStream = isFunction(global.WritableStream)
|
3833 |
|
3834 | exports.abortController = isFunction(global.AbortController)
|
3835 |
|
3836 | exports.blobConstructor = false
|
3837 | try {
|
3838 | new Blob([new ArrayBuffer(1)])
|
3839 | exports.blobConstructor = true
|
3840 | } catch (e) {}
|
3841 |
|
3842 |
|
3843 |
|
3844 |
|
3845 | var xhr
|
3846 | function getXHR () {
|
3847 |
|
3848 | if (xhr !== undefined) return xhr
|
3849 |
|
3850 | if (global.XMLHttpRequest) {
|
3851 | xhr = new global.XMLHttpRequest()
|
3852 |
|
3853 |
|
3854 |
|
3855 | try {
|
3856 | xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com')
|
3857 | } catch(e) {
|
3858 | xhr = null
|
3859 | }
|
3860 | } else {
|
3861 |
|
3862 | xhr = null
|
3863 | }
|
3864 | return xhr
|
3865 | }
|
3866 |
|
3867 | function checkTypeSupport (type) {
|
3868 | var xhr = getXHR()
|
3869 | if (!xhr) return false
|
3870 | try {
|
3871 | xhr.responseType = type
|
3872 | return xhr.responseType === type
|
3873 | } catch (e) {}
|
3874 | return false
|
3875 | }
|
3876 |
|
3877 |
|
3878 |
|
3879 | var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined'
|
3880 | var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice)
|
3881 |
|
3882 |
|
3883 |
|
3884 | exports.arraybuffer = exports.fetch || (haveArrayBuffer && checkTypeSupport('arraybuffer'))
|
3885 |
|
3886 |
|
3887 |
|
3888 | exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream')
|
3889 | exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer &&
|
3890 | checkTypeSupport('moz-chunked-arraybuffer')
|
3891 |
|
3892 |
|
3893 |
|
3894 | exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false)
|
3895 |
|
3896 | exports.vbArray = isFunction(global.VBArray)
|
3897 |
|
3898 | function isFunction (value) {
|
3899 | return typeof value === 'function'
|
3900 | }
|
3901 |
|
3902 | xhr = null
|
3903 |
|
3904 | }.call(exports, __webpack_require__(0)))
|
3905 |
|
3906 | }),
|
3907 |
|
3908 | (function(module, exports, __webpack_require__) {
|
3909 |
|
3910 | (function(process, Buffer, global) {var capability = __webpack_require__(12)
|
3911 | var inherits = __webpack_require__(2)
|
3912 | var stream = __webpack_require__(14)
|
3913 |
|
3914 | var rStates = exports.readyStates = {
|
3915 | UNSENT: 0,
|
3916 | OPENED: 1,
|
3917 | HEADERS_RECEIVED: 2,
|
3918 | LOADING: 3,
|
3919 | DONE: 4
|
3920 | }
|
3921 |
|
3922 | var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) {
|
3923 | var self = this
|
3924 | stream.Readable.call(self)
|
3925 |
|
3926 | self._mode = mode
|
3927 | self.headers = {}
|
3928 | self.rawHeaders = []
|
3929 | self.trailers = {}
|
3930 | self.rawTrailers = []
|
3931 |
|
3932 |
|
3933 | self.on('end', function () {
|
3934 |
|
3935 | process.nextTick(function () {
|
3936 | self.emit('close')
|
3937 | })
|
3938 | })
|
3939 |
|
3940 | if (mode === 'fetch') {
|
3941 | self._fetchResponse = response
|
3942 |
|
3943 | self.url = response.url
|
3944 | self.statusCode = response.status
|
3945 | self.statusMessage = response.statusText
|
3946 |
|
3947 | response.headers.forEach(function (header, key){
|
3948 | self.headers[key.toLowerCase()] = header
|
3949 | self.rawHeaders.push(key, header)
|
3950 | })
|
3951 |
|
3952 | if (capability.writableStream) {
|
3953 | var writable = new WritableStream({
|
3954 | write: function (chunk) {
|
3955 | return new Promise(function (resolve, reject) {
|
3956 | if (self._destroyed) {
|
3957 | reject()
|
3958 | } else if(self.push(new Buffer(chunk))) {
|
3959 | resolve()
|
3960 | } else {
|
3961 | self._resumeFetch = resolve
|
3962 | }
|
3963 | })
|
3964 | },
|
3965 | close: function () {
|
3966 | global.clearTimeout(fetchTimer)
|
3967 | if (!self._destroyed)
|
3968 | self.push(null)
|
3969 | },
|
3970 | abort: function (err) {
|
3971 | if (!self._destroyed)
|
3972 | self.emit('error', err)
|
3973 | }
|
3974 | })
|
3975 |
|
3976 | try {
|
3977 | response.body.pipeTo(writable).catch(function (err) {
|
3978 | global.clearTimeout(fetchTimer)
|
3979 | if (!self._destroyed)
|
3980 | self.emit('error', err)
|
3981 | })
|
3982 | return
|
3983 | } catch (e) {}
|
3984 | }
|
3985 |
|
3986 | var reader = response.body.getReader()
|
3987 | function read () {
|
3988 | reader.read().then(function (result) {
|
3989 | if (self._destroyed)
|
3990 | return
|
3991 | if (result.done) {
|
3992 | global.clearTimeout(fetchTimer)
|
3993 | self.push(null)
|
3994 | return
|
3995 | }
|
3996 | self.push(new Buffer(result.value))
|
3997 | read()
|
3998 | }).catch(function (err) {
|
3999 | global.clearTimeout(fetchTimer)
|
4000 | if (!self._destroyed)
|
4001 | self.emit('error', err)
|
4002 | })
|
4003 | }
|
4004 | read()
|
4005 | } else {
|
4006 | self._xhr = xhr
|
4007 | self._pos = 0
|
4008 |
|
4009 | self.url = xhr.responseURL
|
4010 | self.statusCode = xhr.status
|
4011 | self.statusMessage = xhr.statusText
|
4012 | var headers = xhr.getAllResponseHeaders().split(/\r?\n/)
|
4013 | headers.forEach(function (header) {
|
4014 | var matches = header.match(/^([^:]+):\s*(.*)/)
|
4015 | if (matches) {
|
4016 | var key = matches[1].toLowerCase()
|
4017 | if (key === 'set-cookie') {
|
4018 | if (self.headers[key] === undefined) {
|
4019 | self.headers[key] = []
|
4020 | }
|
4021 | self.headers[key].push(matches[2])
|
4022 | } else if (self.headers[key] !== undefined) {
|
4023 | self.headers[key] += ', ' + matches[2]
|
4024 | } else {
|
4025 | self.headers[key] = matches[2]
|
4026 | }
|
4027 | self.rawHeaders.push(matches[1], matches[2])
|
4028 | }
|
4029 | })
|
4030 |
|
4031 | self._charset = 'x-user-defined'
|
4032 | if (!capability.overrideMimeType) {
|
4033 | var mimeType = self.rawHeaders['mime-type']
|
4034 | if (mimeType) {
|
4035 | var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/)
|
4036 | if (charsetMatch) {
|
4037 | self._charset = charsetMatch[1].toLowerCase()
|
4038 | }
|
4039 | }
|
4040 | if (!self._charset)
|
4041 | self._charset = 'utf-8'
|
4042 | }
|
4043 | }
|
4044 | }
|
4045 |
|
4046 | inherits(IncomingMessage, stream.Readable)
|
4047 |
|
4048 | IncomingMessage.prototype._read = function () {
|
4049 | var self = this
|
4050 |
|
4051 | var resolve = self._resumeFetch
|
4052 | if (resolve) {
|
4053 | self._resumeFetch = null
|
4054 | resolve()
|
4055 | }
|
4056 | }
|
4057 |
|
4058 | IncomingMessage.prototype._onXHRProgress = function () {
|
4059 | var self = this
|
4060 |
|
4061 | var xhr = self._xhr
|
4062 |
|
4063 | var response = null
|
4064 | switch (self._mode) {
|
4065 | case 'text:vbarray':
|
4066 | if (xhr.readyState !== rStates.DONE)
|
4067 | break
|
4068 | try {
|
4069 |
|
4070 | response = new global.VBArray(xhr.responseBody).toArray()
|
4071 | } catch (e) {}
|
4072 | if (response !== null) {
|
4073 | self.push(new Buffer(response))
|
4074 | break
|
4075 | }
|
4076 |
|
4077 | case 'text':
|
4078 | try {
|
4079 | response = xhr.responseText
|
4080 | } catch (e) {
|
4081 | self._mode = 'text:vbarray'
|
4082 | break
|
4083 | }
|
4084 | if (response.length > self._pos) {
|
4085 | var newData = response.substr(self._pos)
|
4086 | if (self._charset === 'x-user-defined') {
|
4087 | var buffer = new Buffer(newData.length)
|
4088 | for (var i = 0; i < newData.length; i++)
|
4089 | buffer[i] = newData.charCodeAt(i) & 0xff
|
4090 |
|
4091 | self.push(buffer)
|
4092 | } else {
|
4093 | self.push(newData, self._charset)
|
4094 | }
|
4095 | self._pos = response.length
|
4096 | }
|
4097 | break
|
4098 | case 'arraybuffer':
|
4099 | if (xhr.readyState !== rStates.DONE || !xhr.response)
|
4100 | break
|
4101 | response = xhr.response
|
4102 | self.push(new Buffer(new Uint8Array(response)))
|
4103 | break
|
4104 | case 'moz-chunked-arraybuffer':
|
4105 | response = xhr.response
|
4106 | if (xhr.readyState !== rStates.LOADING || !response)
|
4107 | break
|
4108 | self.push(new Buffer(new Uint8Array(response)))
|
4109 | break
|
4110 | case 'ms-stream':
|
4111 | response = xhr.response
|
4112 | if (xhr.readyState !== rStates.LOADING)
|
4113 | break
|
4114 | var reader = new global.MSStreamReader()
|
4115 | reader.onprogress = function () {
|
4116 | if (reader.result.byteLength > self._pos) {
|
4117 | self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))))
|
4118 | self._pos = reader.result.byteLength
|
4119 | }
|
4120 | }
|
4121 | reader.onload = function () {
|
4122 | self.push(null)
|
4123 | }
|
4124 |
|
4125 | reader.readAsArrayBuffer(response)
|
4126 | break
|
4127 | }
|
4128 |
|
4129 |
|
4130 | if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {
|
4131 | self.push(null)
|
4132 | }
|
4133 | }
|
4134 |
|
4135 | }.call(exports, __webpack_require__(1), __webpack_require__(3).Buffer, __webpack_require__(0)))
|
4136 |
|
4137 | }),
|
4138 |
|
4139 | (function(module, exports, __webpack_require__) {
|
4140 |
|
4141 | exports = module.exports = __webpack_require__(15);
|
4142 | exports.Stream = exports;
|
4143 | exports.Readable = exports;
|
4144 | exports.Writable = __webpack_require__(18);
|
4145 | exports.Duplex = __webpack_require__(4);
|
4146 | exports.Transform = __webpack_require__(20);
|
4147 | exports.PassThrough = __webpack_require__(39);
|
4148 |
|
4149 |
|
4150 | }),
|
4151 |
|
4152 | (function(module, exports, __webpack_require__) {
|
4153 |
|
4154 | "use strict";
|
4155 | (function(global, process) {
|
4156 |
|
4157 |
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 |
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 |
|
4171 |
|
4172 |
|
4173 |
|
4174 |
|
4175 |
|
4176 |
|
4177 |
|
4178 |
|
4179 |
|
4180 | var pna = __webpack_require__(6);
|
4181 |
|
4182 |
|
4183 | module.exports = Readable;
|
4184 |
|
4185 |
|
4186 | var isArray = __webpack_require__(10);
|
4187 |
|
4188 |
|
4189 |
|
4190 | var Duplex;
|
4191 |
|
4192 |
|
4193 | Readable.ReadableState = ReadableState;
|
4194 |
|
4195 |
|
4196 | var EE = __webpack_require__(9).EventEmitter;
|
4197 |
|
4198 | var EElistenerCount = function (emitter, type) {
|
4199 | return emitter.listeners(type).length;
|
4200 | };
|
4201 |
|
4202 |
|
4203 |
|
4204 | var Stream = __webpack_require__(16);
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 | var Buffer = __webpack_require__(7).Buffer;
|
4210 | var OurUint8Array = global.Uint8Array || function () {};
|
4211 | function _uint8ArrayToBuffer(chunk) {
|
4212 | return Buffer.from(chunk);
|
4213 | }
|
4214 | function _isUint8Array(obj) {
|
4215 | return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
4216 | }
|
4217 |
|
4218 |
|
4219 |
|
4220 |
|
4221 | var util = Object.create(__webpack_require__(5));
|
4222 | util.inherits = __webpack_require__(2);
|
4223 |
|
4224 |
|
4225 |
|
4226 | var debugUtil = __webpack_require__(33);
|
4227 | var debug = void 0;
|
4228 | if (debugUtil && debugUtil.debuglog) {
|
4229 | debug = debugUtil.debuglog('stream');
|
4230 | } else {
|
4231 | debug = function () {};
|
4232 | }
|
4233 |
|
4234 |
|
4235 | var BufferList = __webpack_require__(34);
|
4236 | var destroyImpl = __webpack_require__(17);
|
4237 | var StringDecoder;
|
4238 |
|
4239 | util.inherits(Readable, Stream);
|
4240 |
|
4241 | var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
|
4242 |
|
4243 | function prependListener(emitter, event, fn) {
|
4244 |
|
4245 |
|
4246 | if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 | if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
|
4253 | }
|
4254 |
|
4255 | function ReadableState(options, stream) {
|
4256 | Duplex = Duplex || __webpack_require__(4);
|
4257 |
|
4258 | options = options || {};
|
4259 |
|
4260 |
|
4261 |
|
4262 |
|
4263 |
|
4264 |
|
4265 | var isDuplex = stream instanceof Duplex;
|
4266 |
|
4267 |
|
4268 |
|
4269 | this.objectMode = !!options.objectMode;
|
4270 |
|
4271 | if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
|
4272 |
|
4273 |
|
4274 |
|
4275 | var hwm = options.highWaterMark;
|
4276 | var readableHwm = options.readableHighWaterMark;
|
4277 | var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
4278 |
|
4279 | if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
|
4280 |
|
4281 |
|
4282 | this.highWaterMark = Math.floor(this.highWaterMark);
|
4283 |
|
4284 |
|
4285 |
|
4286 |
|
4287 | this.buffer = new BufferList();
|
4288 | this.length = 0;
|
4289 | this.pipes = null;
|
4290 | this.pipesCount = 0;
|
4291 | this.flowing = null;
|
4292 | this.ended = false;
|
4293 | this.endEmitted = false;
|
4294 | this.reading = false;
|
4295 |
|
4296 |
|
4297 |
|
4298 |
|
4299 |
|
4300 | this.sync = true;
|
4301 |
|
4302 |
|
4303 |
|
4304 | this.needReadable = false;
|
4305 | this.emittedReadable = false;
|
4306 | this.readableListening = false;
|
4307 | this.resumeScheduled = false;
|
4308 |
|
4309 |
|
4310 | this.destroyed = false;
|
4311 |
|
4312 |
|
4313 |
|
4314 |
|
4315 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
4316 |
|
4317 |
|
4318 | this.awaitDrain = 0;
|
4319 |
|
4320 |
|
4321 | this.readingMore = false;
|
4322 |
|
4323 | this.decoder = null;
|
4324 | this.encoding = null;
|
4325 | if (options.encoding) {
|
4326 | if (!StringDecoder) StringDecoder = __webpack_require__(19).StringDecoder;
|
4327 | this.decoder = new StringDecoder(options.encoding);
|
4328 | this.encoding = options.encoding;
|
4329 | }
|
4330 | }
|
4331 |
|
4332 | function Readable(options) {
|
4333 | Duplex = Duplex || __webpack_require__(4);
|
4334 |
|
4335 | if (!(this instanceof Readable)) return new Readable(options);
|
4336 |
|
4337 | this._readableState = new ReadableState(options, this);
|
4338 |
|
4339 |
|
4340 | this.readable = true;
|
4341 |
|
4342 | if (options) {
|
4343 | if (typeof options.read === 'function') this._read = options.read;
|
4344 |
|
4345 | if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
4346 | }
|
4347 |
|
4348 | Stream.call(this);
|
4349 | }
|
4350 |
|
4351 | Object.defineProperty(Readable.prototype, 'destroyed', {
|
4352 | get: function () {
|
4353 | if (this._readableState === undefined) {
|
4354 | return false;
|
4355 | }
|
4356 | return this._readableState.destroyed;
|
4357 | },
|
4358 | set: function (value) {
|
4359 |
|
4360 |
|
4361 | if (!this._readableState) {
|
4362 | return;
|
4363 | }
|
4364 |
|
4365 |
|
4366 |
|
4367 | this._readableState.destroyed = value;
|
4368 | }
|
4369 | });
|
4370 |
|
4371 | Readable.prototype.destroy = destroyImpl.destroy;
|
4372 | Readable.prototype._undestroy = destroyImpl.undestroy;
|
4373 | Readable.prototype._destroy = function (err, cb) {
|
4374 | this.push(null);
|
4375 | cb(err);
|
4376 | };
|
4377 |
|
4378 |
|
4379 |
|
4380 |
|
4381 |
|
4382 | Readable.prototype.push = function (chunk, encoding) {
|
4383 | var state = this._readableState;
|
4384 | var skipChunkCheck;
|
4385 |
|
4386 | if (!state.objectMode) {
|
4387 | if (typeof chunk === 'string') {
|
4388 | encoding = encoding || state.defaultEncoding;
|
4389 | if (encoding !== state.encoding) {
|
4390 | chunk = Buffer.from(chunk, encoding);
|
4391 | encoding = '';
|
4392 | }
|
4393 | skipChunkCheck = true;
|
4394 | }
|
4395 | } else {
|
4396 | skipChunkCheck = true;
|
4397 | }
|
4398 |
|
4399 | return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
|
4400 | };
|
4401 |
|
4402 |
|
4403 | Readable.prototype.unshift = function (chunk) {
|
4404 | return readableAddChunk(this, chunk, null, true, false);
|
4405 | };
|
4406 |
|
4407 | function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
|
4408 | var state = stream._readableState;
|
4409 | if (chunk === null) {
|
4410 | state.reading = false;
|
4411 | onEofChunk(stream, state);
|
4412 | } else {
|
4413 | var er;
|
4414 | if (!skipChunkCheck) er = chunkInvalid(state, chunk);
|
4415 | if (er) {
|
4416 | stream.emit('error', er);
|
4417 | } else if (state.objectMode || chunk && chunk.length > 0) {
|
4418 | if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
|
4419 | chunk = _uint8ArrayToBuffer(chunk);
|
4420 | }
|
4421 |
|
4422 | if (addToFront) {
|
4423 | if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
|
4424 | } else if (state.ended) {
|
4425 | stream.emit('error', new Error('stream.push() after EOF'));
|
4426 | } else {
|
4427 | state.reading = false;
|
4428 | if (state.decoder && !encoding) {
|
4429 | chunk = state.decoder.write(chunk);
|
4430 | if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
|
4431 | } else {
|
4432 | addChunk(stream, state, chunk, false);
|
4433 | }
|
4434 | }
|
4435 | } else if (!addToFront) {
|
4436 | state.reading = false;
|
4437 | }
|
4438 | }
|
4439 |
|
4440 | return needMoreData(state);
|
4441 | }
|
4442 |
|
4443 | function addChunk(stream, state, chunk, addToFront) {
|
4444 | if (state.flowing && state.length === 0 && !state.sync) {
|
4445 | stream.emit('data', chunk);
|
4446 | stream.read(0);
|
4447 | } else {
|
4448 |
|
4449 | state.length += state.objectMode ? 1 : chunk.length;
|
4450 | if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
|
4451 |
|
4452 | if (state.needReadable) emitReadable(stream);
|
4453 | }
|
4454 | maybeReadMore(stream, state);
|
4455 | }
|
4456 |
|
4457 | function chunkInvalid(state, chunk) {
|
4458 | var er;
|
4459 | if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
4460 | er = new TypeError('Invalid non-string/buffer chunk');
|
4461 | }
|
4462 | return er;
|
4463 | }
|
4464 |
|
4465 |
|
4466 |
|
4467 |
|
4468 |
|
4469 |
|
4470 |
|
4471 |
|
4472 | function needMoreData(state) {
|
4473 | return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
|
4474 | }
|
4475 |
|
4476 | Readable.prototype.isPaused = function () {
|
4477 | return this._readableState.flowing === false;
|
4478 | };
|
4479 |
|
4480 |
|
4481 | Readable.prototype.setEncoding = function (enc) {
|
4482 | if (!StringDecoder) StringDecoder = __webpack_require__(19).StringDecoder;
|
4483 | this._readableState.decoder = new StringDecoder(enc);
|
4484 | this._readableState.encoding = enc;
|
4485 | return this;
|
4486 | };
|
4487 |
|
4488 |
|
4489 | var MAX_HWM = 0x800000;
|
4490 | function computeNewHighWaterMark(n) {
|
4491 | if (n >= MAX_HWM) {
|
4492 | n = MAX_HWM;
|
4493 | } else {
|
4494 |
|
4495 |
|
4496 | n--;
|
4497 | n |= n >>> 1;
|
4498 | n |= n >>> 2;
|
4499 | n |= n >>> 4;
|
4500 | n |= n >>> 8;
|
4501 | n |= n >>> 16;
|
4502 | n++;
|
4503 | }
|
4504 | return n;
|
4505 | }
|
4506 |
|
4507 |
|
4508 |
|
4509 | function howMuchToRead(n, state) {
|
4510 | if (n <= 0 || state.length === 0 && state.ended) return 0;
|
4511 | if (state.objectMode) return 1;
|
4512 | if (n !== n) {
|
4513 |
|
4514 | if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
|
4515 | }
|
4516 |
|
4517 | if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
|
4518 | if (n <= state.length) return n;
|
4519 |
|
4520 | if (!state.ended) {
|
4521 | state.needReadable = true;
|
4522 | return 0;
|
4523 | }
|
4524 | return state.length;
|
4525 | }
|
4526 |
|
4527 |
|
4528 | Readable.prototype.read = function (n) {
|
4529 | debug('read', n);
|
4530 | n = parseInt(n, 10);
|
4531 | var state = this._readableState;
|
4532 | var nOrig = n;
|
4533 |
|
4534 | if (n !== 0) state.emittedReadable = false;
|
4535 |
|
4536 |
|
4537 |
|
4538 |
|
4539 | if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
|
4540 | debug('read: emitReadable', state.length, state.ended);
|
4541 | if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
|
4542 | return null;
|
4543 | }
|
4544 |
|
4545 | n = howMuchToRead(n, state);
|
4546 |
|
4547 |
|
4548 | if (n === 0 && state.ended) {
|
4549 | if (state.length === 0) endReadable(this);
|
4550 | return null;
|
4551 | }
|
4552 |
|
4553 |
|
4554 |
|
4555 |
|
4556 |
|
4557 |
|
4558 |
|
4559 |
|
4560 |
|
4561 |
|
4562 |
|
4563 |
|
4564 |
|
4565 |
|
4566 |
|
4567 |
|
4568 |
|
4569 |
|
4570 |
|
4571 |
|
4572 |
|
4573 |
|
4574 |
|
4575 |
|
4576 | var doRead = state.needReadable;
|
4577 | debug('need readable', doRead);
|
4578 |
|
4579 |
|
4580 | if (state.length === 0 || state.length - n < state.highWaterMark) {
|
4581 | doRead = true;
|
4582 | debug('length less than watermark', doRead);
|
4583 | }
|
4584 |
|
4585 |
|
4586 |
|
4587 | if (state.ended || state.reading) {
|
4588 | doRead = false;
|
4589 | debug('reading or ended', doRead);
|
4590 | } else if (doRead) {
|
4591 | debug('do read');
|
4592 | state.reading = true;
|
4593 | state.sync = true;
|
4594 |
|
4595 | if (state.length === 0) state.needReadable = true;
|
4596 |
|
4597 | this._read(state.highWaterMark);
|
4598 | state.sync = false;
|
4599 |
|
4600 |
|
4601 | if (!state.reading) n = howMuchToRead(nOrig, state);
|
4602 | }
|
4603 |
|
4604 | var ret;
|
4605 | if (n > 0) ret = fromList(n, state);else ret = null;
|
4606 |
|
4607 | if (ret === null) {
|
4608 | state.needReadable = true;
|
4609 | n = 0;
|
4610 | } else {
|
4611 | state.length -= n;
|
4612 | }
|
4613 |
|
4614 | if (state.length === 0) {
|
4615 |
|
4616 |
|
4617 | if (!state.ended) state.needReadable = true;
|
4618 |
|
4619 |
|
4620 | if (nOrig !== n && state.ended) endReadable(this);
|
4621 | }
|
4622 |
|
4623 | if (ret !== null) this.emit('data', ret);
|
4624 |
|
4625 | return ret;
|
4626 | };
|
4627 |
|
4628 | function onEofChunk(stream, state) {
|
4629 | if (state.ended) return;
|
4630 | if (state.decoder) {
|
4631 | var chunk = state.decoder.end();
|
4632 | if (chunk && chunk.length) {
|
4633 | state.buffer.push(chunk);
|
4634 | state.length += state.objectMode ? 1 : chunk.length;
|
4635 | }
|
4636 | }
|
4637 | state.ended = true;
|
4638 |
|
4639 |
|
4640 | emitReadable(stream);
|
4641 | }
|
4642 |
|
4643 |
|
4644 |
|
4645 |
|
4646 | function emitReadable(stream) {
|
4647 | var state = stream._readableState;
|
4648 | state.needReadable = false;
|
4649 | if (!state.emittedReadable) {
|
4650 | debug('emitReadable', state.flowing);
|
4651 | state.emittedReadable = true;
|
4652 | if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
|
4653 | }
|
4654 | }
|
4655 |
|
4656 | function emitReadable_(stream) {
|
4657 | debug('emit readable');
|
4658 | stream.emit('readable');
|
4659 | flow(stream);
|
4660 | }
|
4661 |
|
4662 |
|
4663 |
|
4664 |
|
4665 |
|
4666 |
|
4667 |
|
4668 | function maybeReadMore(stream, state) {
|
4669 | if (!state.readingMore) {
|
4670 | state.readingMore = true;
|
4671 | pna.nextTick(maybeReadMore_, stream, state);
|
4672 | }
|
4673 | }
|
4674 |
|
4675 | function maybeReadMore_(stream, state) {
|
4676 | var len = state.length;
|
4677 | while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
|
4678 | debug('maybeReadMore read 0');
|
4679 | stream.read(0);
|
4680 | if (len === state.length)
|
4681 |
|
4682 | break;else len = state.length;
|
4683 | }
|
4684 | state.readingMore = false;
|
4685 | }
|
4686 |
|
4687 |
|
4688 |
|
4689 |
|
4690 |
|
4691 | Readable.prototype._read = function (n) {
|
4692 | this.emit('error', new Error('_read() is not implemented'));
|
4693 | };
|
4694 |
|
4695 | Readable.prototype.pipe = function (dest, pipeOpts) {
|
4696 | var src = this;
|
4697 | var state = this._readableState;
|
4698 |
|
4699 | switch (state.pipesCount) {
|
4700 | case 0:
|
4701 | state.pipes = dest;
|
4702 | break;
|
4703 | case 1:
|
4704 | state.pipes = [state.pipes, dest];
|
4705 | break;
|
4706 | default:
|
4707 | state.pipes.push(dest);
|
4708 | break;
|
4709 | }
|
4710 | state.pipesCount += 1;
|
4711 | debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
|
4712 |
|
4713 | var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
|
4714 |
|
4715 | var endFn = doEnd ? onend : unpipe;
|
4716 | if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
|
4717 |
|
4718 | dest.on('unpipe', onunpipe);
|
4719 | function onunpipe(readable, unpipeInfo) {
|
4720 | debug('onunpipe');
|
4721 | if (readable === src) {
|
4722 | if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
|
4723 | unpipeInfo.hasUnpiped = true;
|
4724 | cleanup();
|
4725 | }
|
4726 | }
|
4727 | }
|
4728 |
|
4729 | function onend() {
|
4730 | debug('onend');
|
4731 | dest.end();
|
4732 | }
|
4733 |
|
4734 |
|
4735 |
|
4736 |
|
4737 |
|
4738 | var ondrain = pipeOnDrain(src);
|
4739 | dest.on('drain', ondrain);
|
4740 |
|
4741 | var cleanedUp = false;
|
4742 | function cleanup() {
|
4743 | debug('cleanup');
|
4744 |
|
4745 | dest.removeListener('close', onclose);
|
4746 | dest.removeListener('finish', onfinish);
|
4747 | dest.removeListener('drain', ondrain);
|
4748 | dest.removeListener('error', onerror);
|
4749 | dest.removeListener('unpipe', onunpipe);
|
4750 | src.removeListener('end', onend);
|
4751 | src.removeListener('end', unpipe);
|
4752 | src.removeListener('data', ondata);
|
4753 |
|
4754 | cleanedUp = true;
|
4755 |
|
4756 |
|
4757 |
|
4758 |
|
4759 |
|
4760 |
|
4761 | if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
4762 | }
|
4763 |
|
4764 |
|
4765 |
|
4766 |
|
4767 |
|
4768 | var increasedAwaitDrain = false;
|
4769 | src.on('data', ondata);
|
4770 | function ondata(chunk) {
|
4771 | debug('ondata');
|
4772 | increasedAwaitDrain = false;
|
4773 | var ret = dest.write(chunk);
|
4774 | if (false === ret && !increasedAwaitDrain) {
|
4775 |
|
4776 |
|
4777 |
|
4778 |
|
4779 | if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
4780 | debug('false write response, pause', src._readableState.awaitDrain);
|
4781 | src._readableState.awaitDrain++;
|
4782 | increasedAwaitDrain = true;
|
4783 | }
|
4784 | src.pause();
|
4785 | }
|
4786 | }
|
4787 |
|
4788 |
|
4789 |
|
4790 | function onerror(er) {
|
4791 | debug('onerror', er);
|
4792 | unpipe();
|
4793 | dest.removeListener('error', onerror);
|
4794 | if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
|
4795 | }
|
4796 |
|
4797 |
|
4798 | prependListener(dest, 'error', onerror);
|
4799 |
|
4800 |
|
4801 | function onclose() {
|
4802 | dest.removeListener('finish', onfinish);
|
4803 | unpipe();
|
4804 | }
|
4805 | dest.once('close', onclose);
|
4806 | function onfinish() {
|
4807 | debug('onfinish');
|
4808 | dest.removeListener('close', onclose);
|
4809 | unpipe();
|
4810 | }
|
4811 | dest.once('finish', onfinish);
|
4812 |
|
4813 | function unpipe() {
|
4814 | debug('unpipe');
|
4815 | src.unpipe(dest);
|
4816 | }
|
4817 |
|
4818 |
|
4819 | dest.emit('pipe', src);
|
4820 |
|
4821 |
|
4822 | if (!state.flowing) {
|
4823 | debug('pipe resume');
|
4824 | src.resume();
|
4825 | }
|
4826 |
|
4827 | return dest;
|
4828 | };
|
4829 |
|
4830 | function pipeOnDrain(src) {
|
4831 | return function () {
|
4832 | var state = src._readableState;
|
4833 | debug('pipeOnDrain', state.awaitDrain);
|
4834 | if (state.awaitDrain) state.awaitDrain--;
|
4835 | if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
|
4836 | state.flowing = true;
|
4837 | flow(src);
|
4838 | }
|
4839 | };
|
4840 | }
|
4841 |
|
4842 | Readable.prototype.unpipe = function (dest) {
|
4843 | var state = this._readableState;
|
4844 | var unpipeInfo = { hasUnpiped: false };
|
4845 |
|
4846 |
|
4847 | if (state.pipesCount === 0) return this;
|
4848 |
|
4849 |
|
4850 | if (state.pipesCount === 1) {
|
4851 |
|
4852 | if (dest && dest !== state.pipes) return this;
|
4853 |
|
4854 | if (!dest) dest = state.pipes;
|
4855 |
|
4856 |
|
4857 | state.pipes = null;
|
4858 | state.pipesCount = 0;
|
4859 | state.flowing = false;
|
4860 | if (dest) dest.emit('unpipe', this, unpipeInfo);
|
4861 | return this;
|
4862 | }
|
4863 |
|
4864 |
|
4865 |
|
4866 | if (!dest) {
|
4867 |
|
4868 | var dests = state.pipes;
|
4869 | var len = state.pipesCount;
|
4870 | state.pipes = null;
|
4871 | state.pipesCount = 0;
|
4872 | state.flowing = false;
|
4873 |
|
4874 | for (var i = 0; i < len; i++) {
|
4875 | dests[i].emit('unpipe', this, unpipeInfo);
|
4876 | }return this;
|
4877 | }
|
4878 |
|
4879 |
|
4880 | var index = indexOf(state.pipes, dest);
|
4881 | if (index === -1) return this;
|
4882 |
|
4883 | state.pipes.splice(index, 1);
|
4884 | state.pipesCount -= 1;
|
4885 | if (state.pipesCount === 1) state.pipes = state.pipes[0];
|
4886 |
|
4887 | dest.emit('unpipe', this, unpipeInfo);
|
4888 |
|
4889 | return this;
|
4890 | };
|
4891 |
|
4892 |
|
4893 |
|
4894 | Readable.prototype.on = function (ev, fn) {
|
4895 | var res = Stream.prototype.on.call(this, ev, fn);
|
4896 |
|
4897 | if (ev === 'data') {
|
4898 |
|
4899 | if (this._readableState.flowing !== false) this.resume();
|
4900 | } else if (ev === 'readable') {
|
4901 | var state = this._readableState;
|
4902 | if (!state.endEmitted && !state.readableListening) {
|
4903 | state.readableListening = state.needReadable = true;
|
4904 | state.emittedReadable = false;
|
4905 | if (!state.reading) {
|
4906 | pna.nextTick(nReadingNextTick, this);
|
4907 | } else if (state.length) {
|
4908 | emitReadable(this);
|
4909 | }
|
4910 | }
|
4911 | }
|
4912 |
|
4913 | return res;
|
4914 | };
|
4915 | Readable.prototype.addListener = Readable.prototype.on;
|
4916 |
|
4917 | function nReadingNextTick(self) {
|
4918 | debug('readable nexttick read 0');
|
4919 | self.read(0);
|
4920 | }
|
4921 |
|
4922 |
|
4923 |
|
4924 | Readable.prototype.resume = function () {
|
4925 | var state = this._readableState;
|
4926 | if (!state.flowing) {
|
4927 | debug('resume');
|
4928 | state.flowing = true;
|
4929 | resume(this, state);
|
4930 | }
|
4931 | return this;
|
4932 | };
|
4933 |
|
4934 | function resume(stream, state) {
|
4935 | if (!state.resumeScheduled) {
|
4936 | state.resumeScheduled = true;
|
4937 | pna.nextTick(resume_, stream, state);
|
4938 | }
|
4939 | }
|
4940 |
|
4941 | function resume_(stream, state) {
|
4942 | if (!state.reading) {
|
4943 | debug('resume read 0');
|
4944 | stream.read(0);
|
4945 | }
|
4946 |
|
4947 | state.resumeScheduled = false;
|
4948 | state.awaitDrain = 0;
|
4949 | stream.emit('resume');
|
4950 | flow(stream);
|
4951 | if (state.flowing && !state.reading) stream.read(0);
|
4952 | }
|
4953 |
|
4954 | Readable.prototype.pause = function () {
|
4955 | debug('call pause flowing=%j', this._readableState.flowing);
|
4956 | if (false !== this._readableState.flowing) {
|
4957 | debug('pause');
|
4958 | this._readableState.flowing = false;
|
4959 | this.emit('pause');
|
4960 | }
|
4961 | return this;
|
4962 | };
|
4963 |
|
4964 | function flow(stream) {
|
4965 | var state = stream._readableState;
|
4966 | debug('flow', state.flowing);
|
4967 | while (state.flowing && stream.read() !== null) {}
|
4968 | }
|
4969 |
|
4970 |
|
4971 |
|
4972 |
|
4973 | Readable.prototype.wrap = function (stream) {
|
4974 | var _this = this;
|
4975 |
|
4976 | var state = this._readableState;
|
4977 | var paused = false;
|
4978 |
|
4979 | stream.on('end', function () {
|
4980 | debug('wrapped end');
|
4981 | if (state.decoder && !state.ended) {
|
4982 | var chunk = state.decoder.end();
|
4983 | if (chunk && chunk.length) _this.push(chunk);
|
4984 | }
|
4985 |
|
4986 | _this.push(null);
|
4987 | });
|
4988 |
|
4989 | stream.on('data', function (chunk) {
|
4990 | debug('wrapped data');
|
4991 | if (state.decoder) chunk = state.decoder.write(chunk);
|
4992 |
|
4993 |
|
4994 | if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
|
4995 |
|
4996 | var ret = _this.push(chunk);
|
4997 | if (!ret) {
|
4998 | paused = true;
|
4999 | stream.pause();
|
5000 | }
|
5001 | });
|
5002 |
|
5003 |
|
5004 |
|
5005 | for (var i in stream) {
|
5006 | if (this[i] === undefined && typeof stream[i] === 'function') {
|
5007 | this[i] = function (method) {
|
5008 | return function () {
|
5009 | return stream[method].apply(stream, arguments);
|
5010 | };
|
5011 | }(i);
|
5012 | }
|
5013 | }
|
5014 |
|
5015 |
|
5016 | for (var n = 0; n < kProxyEvents.length; n++) {
|
5017 | stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
|
5018 | }
|
5019 |
|
5020 |
|
5021 |
|
5022 | this._read = function (n) {
|
5023 | debug('wrapped _read', n);
|
5024 | if (paused) {
|
5025 | paused = false;
|
5026 | stream.resume();
|
5027 | }
|
5028 | };
|
5029 |
|
5030 | return this;
|
5031 | };
|
5032 |
|
5033 | Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
|
5034 |
|
5035 |
|
5036 |
|
5037 | enumerable: false,
|
5038 | get: function () {
|
5039 | return this._readableState.highWaterMark;
|
5040 | }
|
5041 | });
|
5042 |
|
5043 |
|
5044 | Readable._fromList = fromList;
|
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 |
|
5050 | function fromList(n, state) {
|
5051 |
|
5052 | if (state.length === 0) return null;
|
5053 |
|
5054 | var ret;
|
5055 | if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
|
5056 |
|
5057 | if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
|
5058 | state.buffer.clear();
|
5059 | } else {
|
5060 |
|
5061 | ret = fromListPartial(n, state.buffer, state.decoder);
|
5062 | }
|
5063 |
|
5064 | return ret;
|
5065 | }
|
5066 |
|
5067 |
|
5068 |
|
5069 |
|
5070 | function fromListPartial(n, list, hasStrings) {
|
5071 | var ret;
|
5072 | if (n < list.head.data.length) {
|
5073 |
|
5074 | ret = list.head.data.slice(0, n);
|
5075 | list.head.data = list.head.data.slice(n);
|
5076 | } else if (n === list.head.data.length) {
|
5077 |
|
5078 | ret = list.shift();
|
5079 | } else {
|
5080 |
|
5081 | ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
|
5082 | }
|
5083 | return ret;
|
5084 | }
|
5085 |
|
5086 |
|
5087 |
|
5088 |
|
5089 |
|
5090 | function copyFromBufferString(n, list) {
|
5091 | var p = list.head;
|
5092 | var c = 1;
|
5093 | var ret = p.data;
|
5094 | n -= ret.length;
|
5095 | while (p = p.next) {
|
5096 | var str = p.data;
|
5097 | var nb = n > str.length ? str.length : n;
|
5098 | if (nb === str.length) ret += str;else ret += str.slice(0, n);
|
5099 | n -= nb;
|
5100 | if (n === 0) {
|
5101 | if (nb === str.length) {
|
5102 | ++c;
|
5103 | if (p.next) list.head = p.next;else list.head = list.tail = null;
|
5104 | } else {
|
5105 | list.head = p;
|
5106 | p.data = str.slice(nb);
|
5107 | }
|
5108 | break;
|
5109 | }
|
5110 | ++c;
|
5111 | }
|
5112 | list.length -= c;
|
5113 | return ret;
|
5114 | }
|
5115 |
|
5116 |
|
5117 |
|
5118 |
|
5119 | function copyFromBuffer(n, list) {
|
5120 | var ret = Buffer.allocUnsafe(n);
|
5121 | var p = list.head;
|
5122 | var c = 1;
|
5123 | p.data.copy(ret);
|
5124 | n -= p.data.length;
|
5125 | while (p = p.next) {
|
5126 | var buf = p.data;
|
5127 | var nb = n > buf.length ? buf.length : n;
|
5128 | buf.copy(ret, ret.length - n, 0, nb);
|
5129 | n -= nb;
|
5130 | if (n === 0) {
|
5131 | if (nb === buf.length) {
|
5132 | ++c;
|
5133 | if (p.next) list.head = p.next;else list.head = list.tail = null;
|
5134 | } else {
|
5135 | list.head = p;
|
5136 | p.data = buf.slice(nb);
|
5137 | }
|
5138 | break;
|
5139 | }
|
5140 | ++c;
|
5141 | }
|
5142 | list.length -= c;
|
5143 | return ret;
|
5144 | }
|
5145 |
|
5146 | function endReadable(stream) {
|
5147 | var state = stream._readableState;
|
5148 |
|
5149 |
|
5150 |
|
5151 | if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
|
5152 |
|
5153 | if (!state.endEmitted) {
|
5154 | state.ended = true;
|
5155 | pna.nextTick(endReadableNT, state, stream);
|
5156 | }
|
5157 | }
|
5158 |
|
5159 | function endReadableNT(state, stream) {
|
5160 |
|
5161 | if (!state.endEmitted && state.length === 0) {
|
5162 | state.endEmitted = true;
|
5163 | stream.readable = false;
|
5164 | stream.emit('end');
|
5165 | }
|
5166 | }
|
5167 |
|
5168 | function indexOf(xs, x) {
|
5169 | for (var i = 0, l = xs.length; i < l; i++) {
|
5170 | if (xs[i] === x) return i;
|
5171 | }
|
5172 | return -1;
|
5173 | }
|
5174 | }.call(exports, __webpack_require__(0), __webpack_require__(1)))
|
5175 |
|
5176 | }),
|
5177 |
|
5178 | (function(module, exports, __webpack_require__) {
|
5179 |
|
5180 | module.exports = __webpack_require__(9).EventEmitter;
|
5181 |
|
5182 |
|
5183 | }),
|
5184 |
|
5185 | (function(module, exports, __webpack_require__) {
|
5186 |
|
5187 | "use strict";
|
5188 |
|
5189 |
|
5190 |
|
5191 |
|
5192 | var pna = __webpack_require__(6);
|
5193 |
|
5194 |
|
5195 |
|
5196 | function destroy(err, cb) {
|
5197 | var _this = this;
|
5198 |
|
5199 | var readableDestroyed = this._readableState && this._readableState.destroyed;
|
5200 | var writableDestroyed = this._writableState && this._writableState.destroyed;
|
5201 |
|
5202 | if (readableDestroyed || writableDestroyed) {
|
5203 | if (cb) {
|
5204 | cb(err);
|
5205 | } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
|
5206 | pna.nextTick(emitErrorNT, this, err);
|
5207 | }
|
5208 | return this;
|
5209 | }
|
5210 |
|
5211 |
|
5212 |
|
5213 |
|
5214 | if (this._readableState) {
|
5215 | this._readableState.destroyed = true;
|
5216 | }
|
5217 |
|
5218 |
|
5219 | if (this._writableState) {
|
5220 | this._writableState.destroyed = true;
|
5221 | }
|
5222 |
|
5223 | this._destroy(err || null, function (err) {
|
5224 | if (!cb && err) {
|
5225 | pna.nextTick(emitErrorNT, _this, err);
|
5226 | if (_this._writableState) {
|
5227 | _this._writableState.errorEmitted = true;
|
5228 | }
|
5229 | } else if (cb) {
|
5230 | cb(err);
|
5231 | }
|
5232 | });
|
5233 |
|
5234 | return this;
|
5235 | }
|
5236 |
|
5237 | function undestroy() {
|
5238 | if (this._readableState) {
|
5239 | this._readableState.destroyed = false;
|
5240 | this._readableState.reading = false;
|
5241 | this._readableState.ended = false;
|
5242 | this._readableState.endEmitted = false;
|
5243 | }
|
5244 |
|
5245 | if (this._writableState) {
|
5246 | this._writableState.destroyed = false;
|
5247 | this._writableState.ended = false;
|
5248 | this._writableState.ending = false;
|
5249 | this._writableState.finished = false;
|
5250 | this._writableState.errorEmitted = false;
|
5251 | }
|
5252 | }
|
5253 |
|
5254 | function emitErrorNT(self, err) {
|
5255 | self.emit('error', err);
|
5256 | }
|
5257 |
|
5258 | module.exports = {
|
5259 | destroy: destroy,
|
5260 | undestroy: undestroy
|
5261 | };
|
5262 |
|
5263 | }),
|
5264 |
|
5265 | (function(module, exports, __webpack_require__) {
|
5266 |
|
5267 | "use strict";
|
5268 | (function(process, setImmediate, global) {
|
5269 |
|
5270 |
|
5271 |
|
5272 |
|
5273 |
|
5274 |
|
5275 |
|
5276 |
|
5277 |
|
5278 |
|
5279 |
|
5280 |
|
5281 |
|
5282 |
|
5283 |
|
5284 |
|
5285 |
|
5286 |
|
5287 |
|
5288 |
|
5289 |
|
5290 |
|
5291 |
|
5292 |
|
5293 |
|
5294 |
|
5295 |
|
5296 |
|
5297 | var pna = __webpack_require__(6);
|
5298 |
|
5299 |
|
5300 | module.exports = Writable;
|
5301 |
|
5302 |
|
5303 | function WriteReq(chunk, encoding, cb) {
|
5304 | this.chunk = chunk;
|
5305 | this.encoding = encoding;
|
5306 | this.callback = cb;
|
5307 | this.next = null;
|
5308 | }
|
5309 |
|
5310 |
|
5311 |
|
5312 | function CorkedRequest(state) {
|
5313 | var _this = this;
|
5314 |
|
5315 | this.next = null;
|
5316 | this.entry = null;
|
5317 | this.finish = function () {
|
5318 | onCorkedFinish(_this, state);
|
5319 | };
|
5320 | }
|
5321 |
|
5322 |
|
5323 |
|
5324 | var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
|
5325 |
|
5326 |
|
5327 |
|
5328 | var Duplex;
|
5329 |
|
5330 |
|
5331 | Writable.WritableState = WritableState;
|
5332 |
|
5333 |
|
5334 | var util = Object.create(__webpack_require__(5));
|
5335 | util.inherits = __webpack_require__(2);
|
5336 |
|
5337 |
|
5338 |
|
5339 | var internalUtil = {
|
5340 | deprecate: __webpack_require__(38)
|
5341 | };
|
5342 |
|
5343 |
|
5344 |
|
5345 | var Stream = __webpack_require__(16);
|
5346 |
|
5347 |
|
5348 |
|
5349 |
|
5350 | var Buffer = __webpack_require__(7).Buffer;
|
5351 | var OurUint8Array = global.Uint8Array || function () {};
|
5352 | function _uint8ArrayToBuffer(chunk) {
|
5353 | return Buffer.from(chunk);
|
5354 | }
|
5355 | function _isUint8Array(obj) {
|
5356 | return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
5357 | }
|
5358 |
|
5359 |
|
5360 |
|
5361 | var destroyImpl = __webpack_require__(17);
|
5362 |
|
5363 | util.inherits(Writable, Stream);
|
5364 |
|
5365 | function nop() {}
|
5366 |
|
5367 | function WritableState(options, stream) {
|
5368 | Duplex = Duplex || __webpack_require__(4);
|
5369 |
|
5370 | options = options || {};
|
5371 |
|
5372 |
|
5373 |
|
5374 |
|
5375 |
|
5376 |
|
5377 | var isDuplex = stream instanceof Duplex;
|
5378 |
|
5379 |
|
5380 |
|
5381 | this.objectMode = !!options.objectMode;
|
5382 |
|
5383 | if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
|
5384 |
|
5385 |
|
5386 |
|
5387 |
|
5388 | var hwm = options.highWaterMark;
|
5389 | var writableHwm = options.writableHighWaterMark;
|
5390 | var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
5391 |
|
5392 | if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
|
5393 |
|
5394 |
|
5395 | this.highWaterMark = Math.floor(this.highWaterMark);
|
5396 |
|
5397 |
|
5398 | this.finalCalled = false;
|
5399 |
|
5400 |
|
5401 | this.needDrain = false;
|
5402 |
|
5403 | this.ending = false;
|
5404 |
|
5405 | this.ended = false;
|
5406 |
|
5407 | this.finished = false;
|
5408 |
|
5409 |
|
5410 | this.destroyed = false;
|
5411 |
|
5412 |
|
5413 |
|
5414 |
|
5415 | var noDecode = options.decodeStrings === false;
|
5416 | this.decodeStrings = !noDecode;
|
5417 |
|
5418 |
|
5419 |
|
5420 |
|
5421 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
5422 |
|
5423 |
|
5424 |
|
5425 |
|
5426 | this.length = 0;
|
5427 |
|
5428 |
|
5429 | this.writing = false;
|
5430 |
|
5431 |
|
5432 | this.corked = 0;
|
5433 |
|
5434 |
|
5435 |
|
5436 |
|
5437 |
|
5438 | this.sync = true;
|
5439 |
|
5440 |
|
5441 |
|
5442 |
|
5443 | this.bufferProcessing = false;
|
5444 |
|
5445 |
|
5446 | this.onwrite = function (er) {
|
5447 | onwrite(stream, er);
|
5448 | };
|
5449 |
|
5450 |
|
5451 | this.writecb = null;
|
5452 |
|
5453 |
|
5454 | this.writelen = 0;
|
5455 |
|
5456 | this.bufferedRequest = null;
|
5457 | this.lastBufferedRequest = null;
|
5458 |
|
5459 |
|
5460 |
|
5461 | this.pendingcb = 0;
|
5462 |
|
5463 |
|
5464 |
|
5465 | this.prefinished = false;
|
5466 |
|
5467 |
|
5468 | this.errorEmitted = false;
|
5469 |
|
5470 |
|
5471 | this.bufferedRequestCount = 0;
|
5472 |
|
5473 |
|
5474 |
|
5475 | this.corkedRequestsFree = new CorkedRequest(this);
|
5476 | }
|
5477 |
|
5478 | WritableState.prototype.getBuffer = function getBuffer() {
|
5479 | var current = this.bufferedRequest;
|
5480 | var out = [];
|
5481 | while (current) {
|
5482 | out.push(current);
|
5483 | current = current.next;
|
5484 | }
|
5485 | return out;
|
5486 | };
|
5487 |
|
5488 | (function () {
|
5489 | try {
|
5490 | Object.defineProperty(WritableState.prototype, 'buffer', {
|
5491 | get: internalUtil.deprecate(function () {
|
5492 | return this.getBuffer();
|
5493 | }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
|
5494 | });
|
5495 | } catch (_) {}
|
5496 | })();
|
5497 |
|
5498 |
|
5499 |
|
5500 | var realHasInstance;
|
5501 | if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
|
5502 | realHasInstance = Function.prototype[Symbol.hasInstance];
|
5503 | Object.defineProperty(Writable, Symbol.hasInstance, {
|
5504 | value: function (object) {
|
5505 | if (realHasInstance.call(this, object)) return true;
|
5506 | if (this !== Writable) return false;
|
5507 |
|
5508 | return object && object._writableState instanceof WritableState;
|
5509 | }
|
5510 | });
|
5511 | } else {
|
5512 | realHasInstance = function (object) {
|
5513 | return object instanceof this;
|
5514 | };
|
5515 | }
|
5516 |
|
5517 | function Writable(options) {
|
5518 | Duplex = Duplex || __webpack_require__(4);
|
5519 |
|
5520 |
|
5521 |
|
5522 |
|
5523 |
|
5524 |
|
5525 |
|
5526 |
|
5527 | if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
|
5528 | return new Writable(options);
|
5529 | }
|
5530 |
|
5531 | this._writableState = new WritableState(options, this);
|
5532 |
|
5533 |
|
5534 | this.writable = true;
|
5535 |
|
5536 | if (options) {
|
5537 | if (typeof options.write === 'function') this._write = options.write;
|
5538 |
|
5539 | if (typeof options.writev === 'function') this._writev = options.writev;
|
5540 |
|
5541 | if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
5542 |
|
5543 | if (typeof options.final === 'function') this._final = options.final;
|
5544 | }
|
5545 |
|
5546 | Stream.call(this);
|
5547 | }
|
5548 |
|
5549 |
|
5550 | Writable.prototype.pipe = function () {
|
5551 | this.emit('error', new Error('Cannot pipe, not readable'));
|
5552 | };
|
5553 |
|
5554 | function writeAfterEnd(stream, cb) {
|
5555 | var er = new Error('write after end');
|
5556 |
|
5557 | stream.emit('error', er);
|
5558 | pna.nextTick(cb, er);
|
5559 | }
|
5560 |
|
5561 |
|
5562 |
|
5563 |
|
5564 | function validChunk(stream, state, chunk, cb) {
|
5565 | var valid = true;
|
5566 | var er = false;
|
5567 |
|
5568 | if (chunk === null) {
|
5569 | er = new TypeError('May not write null values to stream');
|
5570 | } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
5571 | er = new TypeError('Invalid non-string/buffer chunk');
|
5572 | }
|
5573 | if (er) {
|
5574 | stream.emit('error', er);
|
5575 | pna.nextTick(cb, er);
|
5576 | valid = false;
|
5577 | }
|
5578 | return valid;
|
5579 | }
|
5580 |
|
5581 | Writable.prototype.write = function (chunk, encoding, cb) {
|
5582 | var state = this._writableState;
|
5583 | var ret = false;
|
5584 | var isBuf = !state.objectMode && _isUint8Array(chunk);
|
5585 |
|
5586 | if (isBuf && !Buffer.isBuffer(chunk)) {
|
5587 | chunk = _uint8ArrayToBuffer(chunk);
|
5588 | }
|
5589 |
|
5590 | if (typeof encoding === 'function') {
|
5591 | cb = encoding;
|
5592 | encoding = null;
|
5593 | }
|
5594 |
|
5595 | if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
5596 |
|
5597 | if (typeof cb !== 'function') cb = nop;
|
5598 |
|
5599 | if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
|
5600 | state.pendingcb++;
|
5601 | ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
|
5602 | }
|
5603 |
|
5604 | return ret;
|
5605 | };
|
5606 |
|
5607 | Writable.prototype.cork = function () {
|
5608 | var state = this._writableState;
|
5609 |
|
5610 | state.corked++;
|
5611 | };
|
5612 |
|
5613 | Writable.prototype.uncork = function () {
|
5614 | var state = this._writableState;
|
5615 |
|
5616 | if (state.corked) {
|
5617 | state.corked--;
|
5618 |
|
5619 | if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
5620 | }
|
5621 | };
|
5622 |
|
5623 | Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
5624 |
|
5625 | if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
5626 | if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
|
5627 | this._writableState.defaultEncoding = encoding;
|
5628 | return this;
|
5629 | };
|
5630 |
|
5631 | function decodeChunk(state, chunk, encoding) {
|
5632 | if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
5633 | chunk = Buffer.from(chunk, encoding);
|
5634 | }
|
5635 | return chunk;
|
5636 | }
|
5637 |
|
5638 | Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
|
5639 |
|
5640 |
|
5641 |
|
5642 | enumerable: false,
|
5643 | get: function () {
|
5644 | return this._writableState.highWaterMark;
|
5645 | }
|
5646 | });
|
5647 |
|
5648 |
|
5649 |
|
5650 |
|
5651 | function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
|
5652 | if (!isBuf) {
|
5653 | var newChunk = decodeChunk(state, chunk, encoding);
|
5654 | if (chunk !== newChunk) {
|
5655 | isBuf = true;
|
5656 | encoding = 'buffer';
|
5657 | chunk = newChunk;
|
5658 | }
|
5659 | }
|
5660 | var len = state.objectMode ? 1 : chunk.length;
|
5661 |
|
5662 | state.length += len;
|
5663 |
|
5664 | var ret = state.length < state.highWaterMark;
|
5665 |
|
5666 | if (!ret) state.needDrain = true;
|
5667 |
|
5668 | if (state.writing || state.corked) {
|
5669 | var last = state.lastBufferedRequest;
|
5670 | state.lastBufferedRequest = {
|
5671 | chunk: chunk,
|
5672 | encoding: encoding,
|
5673 | isBuf: isBuf,
|
5674 | callback: cb,
|
5675 | next: null
|
5676 | };
|
5677 | if (last) {
|
5678 | last.next = state.lastBufferedRequest;
|
5679 | } else {
|
5680 | state.bufferedRequest = state.lastBufferedRequest;
|
5681 | }
|
5682 | state.bufferedRequestCount += 1;
|
5683 | } else {
|
5684 | doWrite(stream, state, false, len, chunk, encoding, cb);
|
5685 | }
|
5686 |
|
5687 | return ret;
|
5688 | }
|
5689 |
|
5690 | function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
5691 | state.writelen = len;
|
5692 | state.writecb = cb;
|
5693 | state.writing = true;
|
5694 | state.sync = true;
|
5695 | if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
5696 | state.sync = false;
|
5697 | }
|
5698 |
|
5699 | function onwriteError(stream, state, sync, er, cb) {
|
5700 | --state.pendingcb;
|
5701 |
|
5702 | if (sync) {
|
5703 |
|
5704 |
|
5705 | pna.nextTick(cb, er);
|
5706 |
|
5707 |
|
5708 | pna.nextTick(finishMaybe, stream, state);
|
5709 | stream._writableState.errorEmitted = true;
|
5710 | stream.emit('error', er);
|
5711 | } else {
|
5712 |
|
5713 |
|
5714 | cb(er);
|
5715 | stream._writableState.errorEmitted = true;
|
5716 | stream.emit('error', er);
|
5717 |
|
5718 |
|
5719 | finishMaybe(stream, state);
|
5720 | }
|
5721 | }
|
5722 |
|
5723 | function onwriteStateUpdate(state) {
|
5724 | state.writing = false;
|
5725 | state.writecb = null;
|
5726 | state.length -= state.writelen;
|
5727 | state.writelen = 0;
|
5728 | }
|
5729 |
|
5730 | function onwrite(stream, er) {
|
5731 | var state = stream._writableState;
|
5732 | var sync = state.sync;
|
5733 | var cb = state.writecb;
|
5734 |
|
5735 | onwriteStateUpdate(state);
|
5736 |
|
5737 | if (er) onwriteError(stream, state, sync, er, cb);else {
|
5738 |
|
5739 | var finished = needFinish(state);
|
5740 |
|
5741 | if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
5742 | clearBuffer(stream, state);
|
5743 | }
|
5744 |
|
5745 | if (sync) {
|
5746 |
|
5747 | asyncWrite(afterWrite, stream, state, finished, cb);
|
5748 |
|
5749 | } else {
|
5750 | afterWrite(stream, state, finished, cb);
|
5751 | }
|
5752 | }
|
5753 | }
|
5754 |
|
5755 | function afterWrite(stream, state, finished, cb) {
|
5756 | if (!finished) onwriteDrain(stream, state);
|
5757 | state.pendingcb--;
|
5758 | cb();
|
5759 | finishMaybe(stream, state);
|
5760 | }
|
5761 |
|
5762 |
|
5763 |
|
5764 |
|
5765 | function onwriteDrain(stream, state) {
|
5766 | if (state.length === 0 && state.needDrain) {
|
5767 | state.needDrain = false;
|
5768 | stream.emit('drain');
|
5769 | }
|
5770 | }
|
5771 |
|
5772 |
|
5773 | function clearBuffer(stream, state) {
|
5774 | state.bufferProcessing = true;
|
5775 | var entry = state.bufferedRequest;
|
5776 |
|
5777 | if (stream._writev && entry && entry.next) {
|
5778 |
|
5779 | var l = state.bufferedRequestCount;
|
5780 | var buffer = new Array(l);
|
5781 | var holder = state.corkedRequestsFree;
|
5782 | holder.entry = entry;
|
5783 |
|
5784 | var count = 0;
|
5785 | var allBuffers = true;
|
5786 | while (entry) {
|
5787 | buffer[count] = entry;
|
5788 | if (!entry.isBuf) allBuffers = false;
|
5789 | entry = entry.next;
|
5790 | count += 1;
|
5791 | }
|
5792 | buffer.allBuffers = allBuffers;
|
5793 |
|
5794 | doWrite(stream, state, true, state.length, buffer, '', holder.finish);
|
5795 |
|
5796 |
|
5797 |
|
5798 | state.pendingcb++;
|
5799 | state.lastBufferedRequest = null;
|
5800 | if (holder.next) {
|
5801 | state.corkedRequestsFree = holder.next;
|
5802 | holder.next = null;
|
5803 | } else {
|
5804 | state.corkedRequestsFree = new CorkedRequest(state);
|
5805 | }
|
5806 | state.bufferedRequestCount = 0;
|
5807 | } else {
|
5808 |
|
5809 | while (entry) {
|
5810 | var chunk = entry.chunk;
|
5811 | var encoding = entry.encoding;
|
5812 | var cb = entry.callback;
|
5813 | var len = state.objectMode ? 1 : chunk.length;
|
5814 |
|
5815 | doWrite(stream, state, false, len, chunk, encoding, cb);
|
5816 | entry = entry.next;
|
5817 | state.bufferedRequestCount--;
|
5818 |
|
5819 |
|
5820 |
|
5821 |
|
5822 | if (state.writing) {
|
5823 | break;
|
5824 | }
|
5825 | }
|
5826 |
|
5827 | if (entry === null) state.lastBufferedRequest = null;
|
5828 | }
|
5829 |
|
5830 | state.bufferedRequest = entry;
|
5831 | state.bufferProcessing = false;
|
5832 | }
|
5833 |
|
5834 | Writable.prototype._write = function (chunk, encoding, cb) {
|
5835 | cb(new Error('_write() is not implemented'));
|
5836 | };
|
5837 |
|
5838 | Writable.prototype._writev = null;
|
5839 |
|
5840 | Writable.prototype.end = function (chunk, encoding, cb) {
|
5841 | var state = this._writableState;
|
5842 |
|
5843 | if (typeof chunk === 'function') {
|
5844 | cb = chunk;
|
5845 | chunk = null;
|
5846 | encoding = null;
|
5847 | } else if (typeof encoding === 'function') {
|
5848 | cb = encoding;
|
5849 | encoding = null;
|
5850 | }
|
5851 |
|
5852 | if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
|
5853 |
|
5854 |
|
5855 | if (state.corked) {
|
5856 | state.corked = 1;
|
5857 | this.uncork();
|
5858 | }
|
5859 |
|
5860 |
|
5861 | if (!state.ending && !state.finished) endWritable(this, state, cb);
|
5862 | };
|
5863 |
|
5864 | function needFinish(state) {
|
5865 | return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
5866 | }
|
5867 | function callFinal(stream, state) {
|
5868 | stream._final(function (err) {
|
5869 | state.pendingcb--;
|
5870 | if (err) {
|
5871 | stream.emit('error', err);
|
5872 | }
|
5873 | state.prefinished = true;
|
5874 | stream.emit('prefinish');
|
5875 | finishMaybe(stream, state);
|
5876 | });
|
5877 | }
|
5878 | function prefinish(stream, state) {
|
5879 | if (!state.prefinished && !state.finalCalled) {
|
5880 | if (typeof stream._final === 'function') {
|
5881 | state.pendingcb++;
|
5882 | state.finalCalled = true;
|
5883 | pna.nextTick(callFinal, stream, state);
|
5884 | } else {
|
5885 | state.prefinished = true;
|
5886 | stream.emit('prefinish');
|
5887 | }
|
5888 | }
|
5889 | }
|
5890 |
|
5891 | function finishMaybe(stream, state) {
|
5892 | var need = needFinish(state);
|
5893 | if (need) {
|
5894 | prefinish(stream, state);
|
5895 | if (state.pendingcb === 0) {
|
5896 | state.finished = true;
|
5897 | stream.emit('finish');
|
5898 | }
|
5899 | }
|
5900 | return need;
|
5901 | }
|
5902 |
|
5903 | function endWritable(stream, state, cb) {
|
5904 | state.ending = true;
|
5905 | finishMaybe(stream, state);
|
5906 | if (cb) {
|
5907 | if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
|
5908 | }
|
5909 | state.ended = true;
|
5910 | stream.writable = false;
|
5911 | }
|
5912 |
|
5913 | function onCorkedFinish(corkReq, state, err) {
|
5914 | var entry = corkReq.entry;
|
5915 | corkReq.entry = null;
|
5916 | while (entry) {
|
5917 | var cb = entry.callback;
|
5918 | state.pendingcb--;
|
5919 | cb(err);
|
5920 | entry = entry.next;
|
5921 | }
|
5922 | if (state.corkedRequestsFree) {
|
5923 | state.corkedRequestsFree.next = corkReq;
|
5924 | } else {
|
5925 | state.corkedRequestsFree = corkReq;
|
5926 | }
|
5927 | }
|
5928 |
|
5929 | Object.defineProperty(Writable.prototype, 'destroyed', {
|
5930 | get: function () {
|
5931 | if (this._writableState === undefined) {
|
5932 | return false;
|
5933 | }
|
5934 | return this._writableState.destroyed;
|
5935 | },
|
5936 | set: function (value) {
|
5937 |
|
5938 |
|
5939 | if (!this._writableState) {
|
5940 | return;
|
5941 | }
|
5942 |
|
5943 |
|
5944 |
|
5945 | this._writableState.destroyed = value;
|
5946 | }
|
5947 | });
|
5948 |
|
5949 | Writable.prototype.destroy = destroyImpl.destroy;
|
5950 | Writable.prototype._undestroy = destroyImpl.undestroy;
|
5951 | Writable.prototype._destroy = function (err, cb) {
|
5952 | this.end();
|
5953 | cb(err);
|
5954 | };
|
5955 | }.call(exports, __webpack_require__(1), __webpack_require__(36).setImmediate, __webpack_require__(0)))
|
5956 |
|
5957 | }),
|
5958 |
|
5959 | (function(module, exports, __webpack_require__) {
|
5960 |
|
5961 | "use strict";
|
5962 |
|
5963 |
|
5964 |
|
5965 |
|
5966 |
|
5967 |
|
5968 |
|
5969 |
|
5970 |
|
5971 |
|
5972 |
|
5973 |
|
5974 |
|
5975 |
|
5976 |
|
5977 |
|
5978 |
|
5979 |
|
5980 |
|
5981 |
|
5982 |
|
5983 |
|
5984 |
|
5985 |
|
5986 |
|
5987 | var Buffer = __webpack_require__(7).Buffer;
|
5988 |
|
5989 |
|
5990 | var isEncoding = Buffer.isEncoding || function (encoding) {
|
5991 | encoding = '' + encoding;
|
5992 | switch (encoding && encoding.toLowerCase()) {
|
5993 | case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
|
5994 | return true;
|
5995 | default:
|
5996 | return false;
|
5997 | }
|
5998 | };
|
5999 |
|
6000 | function _normalizeEncoding(enc) {
|
6001 | if (!enc) return 'utf8';
|
6002 | var retried;
|
6003 | while (true) {
|
6004 | switch (enc) {
|
6005 | case 'utf8':
|
6006 | case 'utf-8':
|
6007 | return 'utf8';
|
6008 | case 'ucs2':
|
6009 | case 'ucs-2':
|
6010 | case 'utf16le':
|
6011 | case 'utf-16le':
|
6012 | return 'utf16le';
|
6013 | case 'latin1':
|
6014 | case 'binary':
|
6015 | return 'latin1';
|
6016 | case 'base64':
|
6017 | case 'ascii':
|
6018 | case 'hex':
|
6019 | return enc;
|
6020 | default:
|
6021 | if (retried) return;
|
6022 | enc = ('' + enc).toLowerCase();
|
6023 | retried = true;
|
6024 | }
|
6025 | }
|
6026 | };
|
6027 |
|
6028 |
|
6029 |
|
6030 | function normalizeEncoding(enc) {
|
6031 | var nenc = _normalizeEncoding(enc);
|
6032 | if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
|
6033 | return nenc || enc;
|
6034 | }
|
6035 |
|
6036 |
|
6037 |
|
6038 |
|
6039 | exports.StringDecoder = StringDecoder;
|
6040 | function StringDecoder(encoding) {
|
6041 | this.encoding = normalizeEncoding(encoding);
|
6042 | var nb;
|
6043 | switch (this.encoding) {
|
6044 | case 'utf16le':
|
6045 | this.text = utf16Text;
|
6046 | this.end = utf16End;
|
6047 | nb = 4;
|
6048 | break;
|
6049 | case 'utf8':
|
6050 | this.fillLast = utf8FillLast;
|
6051 | nb = 4;
|
6052 | break;
|
6053 | case 'base64':
|
6054 | this.text = base64Text;
|
6055 | this.end = base64End;
|
6056 | nb = 3;
|
6057 | break;
|
6058 | default:
|
6059 | this.write = simpleWrite;
|
6060 | this.end = simpleEnd;
|
6061 | return;
|
6062 | }
|
6063 | this.lastNeed = 0;
|
6064 | this.lastTotal = 0;
|
6065 | this.lastChar = Buffer.allocUnsafe(nb);
|
6066 | }
|
6067 |
|
6068 | StringDecoder.prototype.write = function (buf) {
|
6069 | if (buf.length === 0) return '';
|
6070 | var r;
|
6071 | var i;
|
6072 | if (this.lastNeed) {
|
6073 | r = this.fillLast(buf);
|
6074 | if (r === undefined) return '';
|
6075 | i = this.lastNeed;
|
6076 | this.lastNeed = 0;
|
6077 | } else {
|
6078 | i = 0;
|
6079 | }
|
6080 | if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
|
6081 | return r || '';
|
6082 | };
|
6083 |
|
6084 | StringDecoder.prototype.end = utf8End;
|
6085 |
|
6086 |
|
6087 | StringDecoder.prototype.text = utf8Text;
|
6088 |
|
6089 |
|
6090 | StringDecoder.prototype.fillLast = function (buf) {
|
6091 | if (this.lastNeed <= buf.length) {
|
6092 | buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
|
6093 | return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
6094 | }
|
6095 | buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
|
6096 | this.lastNeed -= buf.length;
|
6097 | };
|
6098 |
|
6099 |
|
6100 |
|
6101 | function utf8CheckByte(byte) {
|
6102 | if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
|
6103 | return byte >> 6 === 0x02 ? -1 : -2;
|
6104 | }
|
6105 |
|
6106 |
|
6107 |
|
6108 |
|
6109 | function utf8CheckIncomplete(self, buf, i) {
|
6110 | var j = buf.length - 1;
|
6111 | if (j < i) return 0;
|
6112 | var nb = utf8CheckByte(buf[j]);
|
6113 | if (nb >= 0) {
|
6114 | if (nb > 0) self.lastNeed = nb - 1;
|
6115 | return nb;
|
6116 | }
|
6117 | if (--j < i || nb === -2) return 0;
|
6118 | nb = utf8CheckByte(buf[j]);
|
6119 | if (nb >= 0) {
|
6120 | if (nb > 0) self.lastNeed = nb - 2;
|
6121 | return nb;
|
6122 | }
|
6123 | if (--j < i || nb === -2) return 0;
|
6124 | nb = utf8CheckByte(buf[j]);
|
6125 | if (nb >= 0) {
|
6126 | if (nb > 0) {
|
6127 | if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
|
6128 | }
|
6129 | return nb;
|
6130 | }
|
6131 | return 0;
|
6132 | }
|
6133 |
|
6134 |
|
6135 |
|
6136 |
|
6137 |
|
6138 |
|
6139 |
|
6140 |
|
6141 |
|
6142 | function utf8CheckExtraBytes(self, buf, p) {
|
6143 | if ((buf[0] & 0xC0) !== 0x80) {
|
6144 | self.lastNeed = 0;
|
6145 | return '\ufffd';
|
6146 | }
|
6147 | if (self.lastNeed > 1 && buf.length > 1) {
|
6148 | if ((buf[1] & 0xC0) !== 0x80) {
|
6149 | self.lastNeed = 1;
|
6150 | return '\ufffd';
|
6151 | }
|
6152 | if (self.lastNeed > 2 && buf.length > 2) {
|
6153 | if ((buf[2] & 0xC0) !== 0x80) {
|
6154 | self.lastNeed = 2;
|
6155 | return '\ufffd';
|
6156 | }
|
6157 | }
|
6158 | }
|
6159 | }
|
6160 |
|
6161 |
|
6162 | function utf8FillLast(buf) {
|
6163 | var p = this.lastTotal - this.lastNeed;
|
6164 | var r = utf8CheckExtraBytes(this, buf, p);
|
6165 | if (r !== undefined) return r;
|
6166 | if (this.lastNeed <= buf.length) {
|
6167 | buf.copy(this.lastChar, p, 0, this.lastNeed);
|
6168 | return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
6169 | }
|
6170 | buf.copy(this.lastChar, p, 0, buf.length);
|
6171 | this.lastNeed -= buf.length;
|
6172 | }
|
6173 |
|
6174 |
|
6175 |
|
6176 |
|
6177 | function utf8Text(buf, i) {
|
6178 | var total = utf8CheckIncomplete(this, buf, i);
|
6179 | if (!this.lastNeed) return buf.toString('utf8', i);
|
6180 | this.lastTotal = total;
|
6181 | var end = buf.length - (total - this.lastNeed);
|
6182 | buf.copy(this.lastChar, 0, end);
|
6183 | return buf.toString('utf8', i, end);
|
6184 | }
|
6185 |
|
6186 |
|
6187 |
|
6188 | function utf8End(buf) {
|
6189 | var r = buf && buf.length ? this.write(buf) : '';
|
6190 | if (this.lastNeed) return r + '\ufffd';
|
6191 | return r;
|
6192 | }
|
6193 |
|
6194 |
|
6195 |
|
6196 |
|
6197 |
|
6198 | function utf16Text(buf, i) {
|
6199 | if ((buf.length - i) % 2 === 0) {
|
6200 | var r = buf.toString('utf16le', i);
|
6201 | if (r) {
|
6202 | var c = r.charCodeAt(r.length - 1);
|
6203 | if (c >= 0xD800 && c <= 0xDBFF) {
|
6204 | this.lastNeed = 2;
|
6205 | this.lastTotal = 4;
|
6206 | this.lastChar[0] = buf[buf.length - 2];
|
6207 | this.lastChar[1] = buf[buf.length - 1];
|
6208 | return r.slice(0, -1);
|
6209 | }
|
6210 | }
|
6211 | return r;
|
6212 | }
|
6213 | this.lastNeed = 1;
|
6214 | this.lastTotal = 2;
|
6215 | this.lastChar[0] = buf[buf.length - 1];
|
6216 | return buf.toString('utf16le', i, buf.length - 1);
|
6217 | }
|
6218 |
|
6219 |
|
6220 |
|
6221 | function utf16End(buf) {
|
6222 | var r = buf && buf.length ? this.write(buf) : '';
|
6223 | if (this.lastNeed) {
|
6224 | var end = this.lastTotal - this.lastNeed;
|
6225 | return r + this.lastChar.toString('utf16le', 0, end);
|
6226 | }
|
6227 | return r;
|
6228 | }
|
6229 |
|
6230 | function base64Text(buf, i) {
|
6231 | var n = (buf.length - i) % 3;
|
6232 | if (n === 0) return buf.toString('base64', i);
|
6233 | this.lastNeed = 3 - n;
|
6234 | this.lastTotal = 3;
|
6235 | if (n === 1) {
|
6236 | this.lastChar[0] = buf[buf.length - 1];
|
6237 | } else {
|
6238 | this.lastChar[0] = buf[buf.length - 2];
|
6239 | this.lastChar[1] = buf[buf.length - 1];
|
6240 | }
|
6241 | return buf.toString('base64', i, buf.length - n);
|
6242 | }
|
6243 |
|
6244 | function base64End(buf) {
|
6245 | var r = buf && buf.length ? this.write(buf) : '';
|
6246 | if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
|
6247 | return r;
|
6248 | }
|
6249 |
|
6250 |
|
6251 | function simpleWrite(buf) {
|
6252 | return buf.toString(this.encoding);
|
6253 | }
|
6254 |
|
6255 | function simpleEnd(buf) {
|
6256 | return buf && buf.length ? this.write(buf) : '';
|
6257 | }
|
6258 |
|
6259 | }),
|
6260 |
|
6261 | (function(module, exports, __webpack_require__) {
|
6262 |
|
6263 | "use strict";
|
6264 |
|
6265 |
|
6266 |
|
6267 |
|
6268 |
|
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 |
|
6274 |
|
6275 |
|
6276 |
|
6277 |
|
6278 |
|
6279 |
|
6280 |
|
6281 |
|
6282 |
|
6283 |
|
6284 |
|
6285 |
|
6286 |
|
6287 |
|
6288 |
|
6289 |
|
6290 |
|
6291 |
|
6292 |
|
6293 |
|
6294 |
|
6295 |
|
6296 |
|
6297 |
|
6298 |
|
6299 |
|
6300 |
|
6301 |
|
6302 |
|
6303 |
|
6304 |
|
6305 |
|
6306 |
|
6307 |
|
6308 |
|
6309 |
|
6310 |
|
6311 |
|
6312 |
|
6313 |
|
6314 |
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 |
|
6321 |
|
6322 |
|
6323 |
|
6324 |
|
6325 |
|
6326 |
|
6327 |
|
6328 |
|
6329 | module.exports = Transform;
|
6330 |
|
6331 | var Duplex = __webpack_require__(4);
|
6332 |
|
6333 |
|
6334 | var util = Object.create(__webpack_require__(5));
|
6335 | util.inherits = __webpack_require__(2);
|
6336 |
|
6337 |
|
6338 | util.inherits(Transform, Duplex);
|
6339 |
|
6340 | function afterTransform(er, data) {
|
6341 | var ts = this._transformState;
|
6342 | ts.transforming = false;
|
6343 |
|
6344 | var cb = ts.writecb;
|
6345 |
|
6346 | if (!cb) {
|
6347 | return this.emit('error', new Error('write callback called multiple times'));
|
6348 | }
|
6349 |
|
6350 | ts.writechunk = null;
|
6351 | ts.writecb = null;
|
6352 |
|
6353 | if (data != null)
|
6354 | this.push(data);
|
6355 |
|
6356 | cb(er);
|
6357 |
|
6358 | var rs = this._readableState;
|
6359 | rs.reading = false;
|
6360 | if (rs.needReadable || rs.length < rs.highWaterMark) {
|
6361 | this._read(rs.highWaterMark);
|
6362 | }
|
6363 | }
|
6364 |
|
6365 | function Transform(options) {
|
6366 | if (!(this instanceof Transform)) return new Transform(options);
|
6367 |
|
6368 | Duplex.call(this, options);
|
6369 |
|
6370 | this._transformState = {
|
6371 | afterTransform: afterTransform.bind(this),
|
6372 | needTransform: false,
|
6373 | transforming: false,
|
6374 | writecb: null,
|
6375 | writechunk: null,
|
6376 | writeencoding: null
|
6377 | };
|
6378 |
|
6379 |
|
6380 | this._readableState.needReadable = true;
|
6381 |
|
6382 |
|
6383 |
|
6384 |
|
6385 | this._readableState.sync = false;
|
6386 |
|
6387 | if (options) {
|
6388 | if (typeof options.transform === 'function') this._transform = options.transform;
|
6389 |
|
6390 | if (typeof options.flush === 'function') this._flush = options.flush;
|
6391 | }
|
6392 |
|
6393 |
|
6394 | this.on('prefinish', prefinish);
|
6395 | }
|
6396 |
|
6397 | function prefinish() {
|
6398 | var _this = this;
|
6399 |
|
6400 | if (typeof this._flush === 'function') {
|
6401 | this._flush(function (er, data) {
|
6402 | done(_this, er, data);
|
6403 | });
|
6404 | } else {
|
6405 | done(this, null, null);
|
6406 | }
|
6407 | }
|
6408 |
|
6409 | Transform.prototype.push = function (chunk, encoding) {
|
6410 | this._transformState.needTransform = false;
|
6411 | return Duplex.prototype.push.call(this, chunk, encoding);
|
6412 | };
|
6413 |
|
6414 |
|
6415 |
|
6416 |
|
6417 |
|
6418 |
|
6419 |
|
6420 |
|
6421 |
|
6422 |
|
6423 |
|
6424 | Transform.prototype._transform = function (chunk, encoding, cb) {
|
6425 | throw new Error('_transform() is not implemented');
|
6426 | };
|
6427 |
|
6428 | Transform.prototype._write = function (chunk, encoding, cb) {
|
6429 | var ts = this._transformState;
|
6430 | ts.writecb = cb;
|
6431 | ts.writechunk = chunk;
|
6432 | ts.writeencoding = encoding;
|
6433 | if (!ts.transforming) {
|
6434 | var rs = this._readableState;
|
6435 | if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
6436 | }
|
6437 | };
|
6438 |
|
6439 |
|
6440 |
|
6441 |
|
6442 | Transform.prototype._read = function (n) {
|
6443 | var ts = this._transformState;
|
6444 |
|
6445 | if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
|
6446 | ts.transforming = true;
|
6447 | this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
6448 | } else {
|
6449 |
|
6450 |
|
6451 | ts.needTransform = true;
|
6452 | }
|
6453 | };
|
6454 |
|
6455 | Transform.prototype._destroy = function (err, cb) {
|
6456 | var _this2 = this;
|
6457 |
|
6458 | Duplex.prototype._destroy.call(this, err, function (err2) {
|
6459 | cb(err2);
|
6460 | _this2.emit('close');
|
6461 | });
|
6462 | };
|
6463 |
|
6464 | function done(stream, er, data) {
|
6465 | if (er) return stream.emit('error', er);
|
6466 |
|
6467 | if (data != null)
|
6468 | stream.push(data);
|
6469 |
|
6470 |
|
6471 |
|
6472 | if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
|
6473 |
|
6474 | if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
|
6475 |
|
6476 | return stream.push(null);
|
6477 | }
|
6478 |
|
6479 | }),
|
6480 |
|
6481 | (function(module, exports, __webpack_require__) {
|
6482 |
|
6483 | var EventSource = __webpack_require__(22)
|
6484 |
|
6485 | if (typeof window === 'object') {
|
6486 | window.EventSourcePolyfill = EventSource
|
6487 | if (!window.EventSource) window.EventSource = EventSource
|
6488 | module.exports = window.EventSource
|
6489 | } else {
|
6490 | module.exports = EventSource
|
6491 | }
|
6492 |
|
6493 |
|
6494 | }),
|
6495 |
|
6496 | (function(module, exports, __webpack_require__) {
|
6497 |
|
6498 | (function(process, Buffer) {var parse = __webpack_require__(8).parse
|
6499 | var events = __webpack_require__(9)
|
6500 | var https = __webpack_require__(31)
|
6501 | var http = __webpack_require__(11)
|
6502 | var util = __webpack_require__(43)
|
6503 |
|
6504 | var httpsOptions = [
|
6505 | 'pfx', 'key', 'passphrase', 'cert', 'ca', 'ciphers',
|
6506 | 'rejectUnauthorized', 'secureProtocol', 'servername', 'checkServerIdentity'
|
6507 | ]
|
6508 |
|
6509 | var bom = [239, 187, 191]
|
6510 | var colon = 58
|
6511 | var space = 32
|
6512 | var lineFeed = 10
|
6513 | var carriageReturn = 13
|
6514 |
|
6515 | var maxBufferAheadAllocation = 1024 * 256
|
6516 |
|
6517 | var reUnsafeHeader = /^(cookie|authorization)$/i
|
6518 |
|
6519 | function hasBom (buf) {
|
6520 | return bom.every(function (charCode, index) {
|
6521 | return buf[index] === charCode
|
6522 | })
|
6523 | }
|
6524 |
|
6525 |
|
6526 |
|
6527 |
|
6528 |
|
6529 |
|
6530 |
|
6531 |
|
6532 | function EventSource (url, eventSourceInitDict) {
|
6533 | var readyState = EventSource.CONNECTING
|
6534 | var headers = eventSourceInitDict && eventSourceInitDict.headers
|
6535 | var hasNewOrigin = false
|
6536 | Object.defineProperty(this, 'readyState', {
|
6537 | get: function () {
|
6538 | return readyState
|
6539 | }
|
6540 | })
|
6541 |
|
6542 | Object.defineProperty(this, 'url', {
|
6543 | get: function () {
|
6544 | return url
|
6545 | }
|
6546 | })
|
6547 |
|
6548 | var self = this
|
6549 | self.reconnectInterval = 1000
|
6550 | self.connectionInProgress = false
|
6551 |
|
6552 | function onConnectionClosed (message) {
|
6553 | if (readyState === EventSource.CLOSED) return
|
6554 | readyState = EventSource.CONNECTING
|
6555 | _emit('error', new Event('error', {message: message}))
|
6556 |
|
6557 |
|
6558 |
|
6559 | if (reconnectUrl) {
|
6560 | url = reconnectUrl
|
6561 | reconnectUrl = null
|
6562 | hasNewOrigin = false
|
6563 | }
|
6564 | setTimeout(function () {
|
6565 | if (readyState !== EventSource.CONNECTING || self.connectionInProgress) {
|
6566 | return
|
6567 | }
|
6568 | self.connectionInProgress = true
|
6569 | connect()
|
6570 | }, self.reconnectInterval)
|
6571 | }
|
6572 |
|
6573 | var req
|
6574 | var lastEventId = ''
|
6575 | if (headers && headers['Last-Event-ID']) {
|
6576 | lastEventId = headers['Last-Event-ID']
|
6577 | delete headers['Last-Event-ID']
|
6578 | }
|
6579 |
|
6580 | var discardTrailingNewline = false
|
6581 | var data = ''
|
6582 | var eventName = ''
|
6583 |
|
6584 | var reconnectUrl = null
|
6585 |
|
6586 | function connect () {
|
6587 | var options = parse(url)
|
6588 | var isSecure = options.protocol === 'https:'
|
6589 | options.headers = { 'Cache-Control': 'no-cache', 'Accept': 'text/event-stream' }
|
6590 | if (lastEventId) options.headers['Last-Event-ID'] = lastEventId
|
6591 | if (headers) {
|
6592 | var reqHeaders = hasNewOrigin ? removeUnsafeHeaders(headers) : headers
|
6593 | for (var i in reqHeaders) {
|
6594 | var header = reqHeaders[i]
|
6595 | if (header) {
|
6596 | options.headers[i] = header
|
6597 | }
|
6598 | }
|
6599 | }
|
6600 |
|
6601 |
|
6602 |
|
6603 | options.rejectUnauthorized = !(eventSourceInitDict && !eventSourceInitDict.rejectUnauthorized)
|
6604 |
|
6605 | if (eventSourceInitDict && eventSourceInitDict.createConnection !== undefined) {
|
6606 | options.createConnection = eventSourceInitDict.createConnection
|
6607 | }
|
6608 |
|
6609 |
|
6610 |
|
6611 | var useProxy = eventSourceInitDict && eventSourceInitDict.proxy
|
6612 | if (useProxy) {
|
6613 | var proxy = parse(eventSourceInitDict.proxy)
|
6614 | isSecure = proxy.protocol === 'https:'
|
6615 |
|
6616 | options.protocol = isSecure ? 'https:' : 'http:'
|
6617 | options.path = url
|
6618 | options.headers.Host = options.host
|
6619 | options.hostname = proxy.hostname
|
6620 | options.host = proxy.host
|
6621 | options.port = proxy.port
|
6622 | }
|
6623 |
|
6624 |
|
6625 | if (eventSourceInitDict && eventSourceInitDict.https) {
|
6626 | for (var optName in eventSourceInitDict.https) {
|
6627 | if (httpsOptions.indexOf(optName) === -1) {
|
6628 | continue
|
6629 | }
|
6630 |
|
6631 | var option = eventSourceInitDict.https[optName]
|
6632 | if (option !== undefined) {
|
6633 | options[optName] = option
|
6634 | }
|
6635 | }
|
6636 | }
|
6637 |
|
6638 |
|
6639 | if (eventSourceInitDict && eventSourceInitDict.withCredentials !== undefined) {
|
6640 | options.withCredentials = eventSourceInitDict.withCredentials
|
6641 | }
|
6642 |
|
6643 | req = (isSecure ? https : http).request(options, function (res) {
|
6644 | self.connectionInProgress = false
|
6645 |
|
6646 | if (res.statusCode === 500 || res.statusCode === 502 || res.statusCode === 503 || res.statusCode === 504) {
|
6647 | _emit('error', new Event('error', {status: res.statusCode, message: res.statusMessage}))
|
6648 | onConnectionClosed()
|
6649 | return
|
6650 | }
|
6651 |
|
6652 |
|
6653 | if (res.statusCode === 301 || res.statusCode === 302 || res.statusCode === 307) {
|
6654 | var location = res.headers.location
|
6655 | if (!location) {
|
6656 |
|
6657 | _emit('error', new Event('error', {status: res.statusCode, message: res.statusMessage}))
|
6658 | return
|
6659 | }
|
6660 | var prevOrigin = new URL(url).origin
|
6661 | var nextOrigin = new URL(location).origin
|
6662 | hasNewOrigin = prevOrigin !== nextOrigin
|
6663 | if (res.statusCode === 307) reconnectUrl = url
|
6664 | url = location
|
6665 | process.nextTick(connect)
|
6666 | return
|
6667 | }
|
6668 |
|
6669 | if (res.statusCode !== 200) {
|
6670 | _emit('error', new Event('error', {status: res.statusCode, message: res.statusMessage}))
|
6671 | return self.close()
|
6672 | }
|
6673 |
|
6674 | readyState = EventSource.OPEN
|
6675 | res.on('close', function () {
|
6676 | res.removeAllListeners('close')
|
6677 | res.removeAllListeners('end')
|
6678 | onConnectionClosed()
|
6679 | })
|
6680 |
|
6681 | res.on('end', function () {
|
6682 | res.removeAllListeners('close')
|
6683 | res.removeAllListeners('end')
|
6684 | onConnectionClosed()
|
6685 | })
|
6686 | _emit('open', new Event('open'))
|
6687 |
|
6688 |
|
6689 |
|
6690 | var buf
|
6691 | var newBuffer
|
6692 | var startingPos = 0
|
6693 | var startingFieldLength = -1
|
6694 | var newBufferSize = 0
|
6695 | var bytesUsed = 0
|
6696 |
|
6697 | res.on('data', function (chunk) {
|
6698 | if (!buf) {
|
6699 | buf = chunk
|
6700 | if (hasBom(buf)) {
|
6701 | buf = buf.slice(bom.length)
|
6702 | }
|
6703 | bytesUsed = buf.length
|
6704 | } else {
|
6705 | if (chunk.length > buf.length - bytesUsed) {
|
6706 | newBufferSize = (buf.length * 2) + chunk.length
|
6707 | if (newBufferSize > maxBufferAheadAllocation) {
|
6708 | newBufferSize = buf.length + chunk.length + maxBufferAheadAllocation
|
6709 | }
|
6710 | newBuffer = Buffer.alloc(newBufferSize)
|
6711 | buf.copy(newBuffer, 0, 0, bytesUsed)
|
6712 | buf = newBuffer
|
6713 | }
|
6714 | chunk.copy(buf, bytesUsed)
|
6715 | bytesUsed += chunk.length
|
6716 | }
|
6717 |
|
6718 | var pos = 0
|
6719 | var length = bytesUsed
|
6720 |
|
6721 | while (pos < length) {
|
6722 | if (discardTrailingNewline) {
|
6723 | if (buf[pos] === lineFeed) {
|
6724 | ++pos
|
6725 | }
|
6726 | discardTrailingNewline = false
|
6727 | }
|
6728 |
|
6729 | var lineLength = -1
|
6730 | var fieldLength = startingFieldLength
|
6731 | var c
|
6732 |
|
6733 | for (var i = startingPos; lineLength < 0 && i < length; ++i) {
|
6734 | c = buf[i]
|
6735 | if (c === colon) {
|
6736 | if (fieldLength < 0) {
|
6737 | fieldLength = i - pos
|
6738 | }
|
6739 | } else if (c === carriageReturn) {
|
6740 | discardTrailingNewline = true
|
6741 | lineLength = i - pos
|
6742 | } else if (c === lineFeed) {
|
6743 | lineLength = i - pos
|
6744 | }
|
6745 | }
|
6746 |
|
6747 | if (lineLength < 0) {
|
6748 | startingPos = length - pos
|
6749 | startingFieldLength = fieldLength
|
6750 | break
|
6751 | } else {
|
6752 | startingPos = 0
|
6753 | startingFieldLength = -1
|
6754 | }
|
6755 |
|
6756 | parseEventStreamLine(buf, pos, fieldLength, lineLength)
|
6757 |
|
6758 | pos += lineLength + 1
|
6759 | }
|
6760 |
|
6761 | if (pos === length) {
|
6762 | buf = void 0
|
6763 | bytesUsed = 0
|
6764 | } else if (pos > 0) {
|
6765 | buf = buf.slice(pos, bytesUsed)
|
6766 | bytesUsed = buf.length
|
6767 | }
|
6768 | })
|
6769 | })
|
6770 |
|
6771 | req.on('error', function (err) {
|
6772 | self.connectionInProgress = false
|
6773 | onConnectionClosed(err.message)
|
6774 | })
|
6775 |
|
6776 | if (req.setNoDelay) req.setNoDelay(true)
|
6777 | req.end()
|
6778 | }
|
6779 |
|
6780 | connect()
|
6781 |
|
6782 | function _emit () {
|
6783 | if (self.listeners(arguments[0]).length > 0) {
|
6784 | self.emit.apply(self, arguments)
|
6785 | }
|
6786 | }
|
6787 |
|
6788 | this._close = function () {
|
6789 | if (readyState === EventSource.CLOSED) return
|
6790 | readyState = EventSource.CLOSED
|
6791 | if (req.abort) req.abort()
|
6792 | if (req.xhr && req.xhr.abort) req.xhr.abort()
|
6793 | }
|
6794 |
|
6795 | function parseEventStreamLine (buf, pos, fieldLength, lineLength) {
|
6796 | if (lineLength === 0) {
|
6797 | if (data.length > 0) {
|
6798 | var type = eventName || 'message'
|
6799 | _emit(type, new MessageEvent(type, {
|
6800 | data: data.slice(0, -1),
|
6801 | lastEventId: lastEventId,
|
6802 | origin: new URL(url).origin
|
6803 | }))
|
6804 | data = ''
|
6805 | }
|
6806 | eventName = void 0
|
6807 | } else if (fieldLength > 0) {
|
6808 | var noValue = fieldLength < 0
|
6809 | var step = 0
|
6810 | var field = buf.slice(pos, pos + (noValue ? lineLength : fieldLength)).toString()
|
6811 |
|
6812 | if (noValue) {
|
6813 | step = lineLength
|
6814 | } else if (buf[pos + fieldLength + 1] !== space) {
|
6815 | step = fieldLength + 1
|
6816 | } else {
|
6817 | step = fieldLength + 2
|
6818 | }
|
6819 | pos += step
|
6820 |
|
6821 | var valueLength = lineLength - step
|
6822 | var value = buf.slice(pos, pos + valueLength).toString()
|
6823 |
|
6824 | if (field === 'data') {
|
6825 | data += value + '\n'
|
6826 | } else if (field === 'event') {
|
6827 | eventName = value
|
6828 | } else if (field === 'id') {
|
6829 | lastEventId = value
|
6830 | } else if (field === 'retry') {
|
6831 | var retry = parseInt(value, 10)
|
6832 | if (!Number.isNaN(retry)) {
|
6833 | self.reconnectInterval = retry
|
6834 | }
|
6835 | }
|
6836 | }
|
6837 | }
|
6838 | }
|
6839 |
|
6840 | module.exports = EventSource
|
6841 |
|
6842 | util.inherits(EventSource, events.EventEmitter)
|
6843 | EventSource.prototype.constructor = EventSource;
|
6844 |
|
6845 | ['open', 'error', 'message'].forEach(function (method) {
|
6846 | Object.defineProperty(EventSource.prototype, 'on' + method, {
|
6847 | |
6848 |
|
6849 |
|
6850 |
|
6851 |
|
6852 |
|
6853 | get: function get () {
|
6854 | var listener = this.listeners(method)[0]
|
6855 | return listener ? (listener._listener ? listener._listener : listener) : undefined
|
6856 | },
|
6857 |
|
6858 | |
6859 |
|
6860 |
|
6861 |
|
6862 |
|
6863 |
|
6864 |
|
6865 | set: function set (listener) {
|
6866 | this.removeAllListeners(method)
|
6867 | this.addEventListener(method, listener)
|
6868 | }
|
6869 | })
|
6870 | })
|
6871 |
|
6872 |
|
6873 |
|
6874 |
|
6875 | Object.defineProperty(EventSource, 'CONNECTING', {enumerable: true, value: 0})
|
6876 | Object.defineProperty(EventSource, 'OPEN', {enumerable: true, value: 1})
|
6877 | Object.defineProperty(EventSource, 'CLOSED', {enumerable: true, value: 2})
|
6878 |
|
6879 | EventSource.prototype.CONNECTING = 0
|
6880 | EventSource.prototype.OPEN = 1
|
6881 | EventSource.prototype.CLOSED = 2
|
6882 |
|
6883 |
|
6884 |
|
6885 |
|
6886 |
|
6887 |
|
6888 |
|
6889 | EventSource.prototype.close = function () {
|
6890 | this._close()
|
6891 | }
|
6892 |
|
6893 |
|
6894 |
|
6895 |
|
6896 |
|
6897 |
|
6898 |
|
6899 |
|
6900 |
|
6901 |
|
6902 | EventSource.prototype.addEventListener = function addEventListener (type, listener) {
|
6903 | if (typeof listener === 'function') {
|
6904 |
|
6905 | listener._listener = listener
|
6906 | this.on(type, listener)
|
6907 | }
|
6908 | }
|
6909 |
|
6910 |
|
6911 |
|
6912 |
|
6913 |
|
6914 |
|
6915 |
|
6916 |
|
6917 | EventSource.prototype.dispatchEvent = function dispatchEvent (event) {
|
6918 | if (!event.type) {
|
6919 | throw new Error('UNSPECIFIED_EVENT_TYPE_ERR')
|
6920 | }
|
6921 |
|
6922 |
|
6923 | this.emit(event.type, event.detail)
|
6924 | }
|
6925 |
|
6926 |
|
6927 |
|
6928 |
|
6929 |
|
6930 |
|
6931 |
|
6932 |
|
6933 |
|
6934 |
|
6935 | EventSource.prototype.removeEventListener = function removeEventListener (type, listener) {
|
6936 | if (typeof listener === 'function') {
|
6937 | listener._listener = undefined
|
6938 | this.removeListener(type, listener)
|
6939 | }
|
6940 | }
|
6941 |
|
6942 |
|
6943 |
|
6944 |
|
6945 |
|
6946 |
|
6947 |
|
6948 | function Event (type, optionalProperties) {
|
6949 | Object.defineProperty(this, 'type', { writable: false, value: type, enumerable: true })
|
6950 | if (optionalProperties) {
|
6951 | for (var f in optionalProperties) {
|
6952 | if (optionalProperties.hasOwnProperty(f)) {
|
6953 | Object.defineProperty(this, f, { writable: false, value: optionalProperties[f], enumerable: true })
|
6954 | }
|
6955 | }
|
6956 | }
|
6957 | }
|
6958 |
|
6959 |
|
6960 |
|
6961 |
|
6962 |
|
6963 |
|
6964 |
|
6965 | function MessageEvent (type, eventInitDict) {
|
6966 | Object.defineProperty(this, 'type', { writable: false, value: type, enumerable: true })
|
6967 | for (var f in eventInitDict) {
|
6968 | if (eventInitDict.hasOwnProperty(f)) {
|
6969 | Object.defineProperty(this, f, { writable: false, value: eventInitDict[f], enumerable: true })
|
6970 | }
|
6971 | }
|
6972 | }
|
6973 |
|
6974 |
|
6975 |
|
6976 |
|
6977 |
|
6978 |
|
6979 |
|
6980 |
|
6981 | function removeUnsafeHeaders (headers) {
|
6982 | var safe = {}
|
6983 | for (var key in headers) {
|
6984 | if (reUnsafeHeader.test(key)) {
|
6985 | continue
|
6986 | }
|
6987 |
|
6988 | safe[key] = headers[key]
|
6989 | }
|
6990 |
|
6991 | return safe
|
6992 | }
|
6993 |
|
6994 | }.call(exports, __webpack_require__(1), __webpack_require__(3).Buffer))
|
6995 |
|
6996 | }),
|
6997 |
|
6998 | (function(module, exports, __webpack_require__) {
|
6999 |
|
7000 | "use strict";
|
7001 |
|
7002 |
|
7003 | exports.byteLength = byteLength
|
7004 | exports.toByteArray = toByteArray
|
7005 | exports.fromByteArray = fromByteArray
|
7006 |
|
7007 | var lookup = []
|
7008 | var revLookup = []
|
7009 | var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
7010 |
|
7011 | var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
7012 | for (var i = 0, len = code.length; i < len; ++i) {
|
7013 | lookup[i] = code[i]
|
7014 | revLookup[code.charCodeAt(i)] = i
|
7015 | }
|
7016 |
|
7017 |
|
7018 |
|
7019 | revLookup['-'.charCodeAt(0)] = 62
|
7020 | revLookup['_'.charCodeAt(0)] = 63
|
7021 |
|
7022 | function getLens (b64) {
|
7023 | var len = b64.length
|
7024 |
|
7025 | if (len % 4 > 0) {
|
7026 | throw new Error('Invalid string. Length must be a multiple of 4')
|
7027 | }
|
7028 |
|
7029 |
|
7030 |
|
7031 | var validLen = b64.indexOf('=')
|
7032 | if (validLen === -1) validLen = len
|
7033 |
|
7034 | var placeHoldersLen = validLen === len
|
7035 | ? 0
|
7036 | : 4 - (validLen % 4)
|
7037 |
|
7038 | return [validLen, placeHoldersLen]
|
7039 | }
|
7040 |
|
7041 |
|
7042 | function byteLength (b64) {
|
7043 | var lens = getLens(b64)
|
7044 | var validLen = lens[0]
|
7045 | var placeHoldersLen = lens[1]
|
7046 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
7047 | }
|
7048 |
|
7049 | function _byteLength (b64, validLen, placeHoldersLen) {
|
7050 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
7051 | }
|
7052 |
|
7053 | function toByteArray (b64) {
|
7054 | var tmp
|
7055 | var lens = getLens(b64)
|
7056 | var validLen = lens[0]
|
7057 | var placeHoldersLen = lens[1]
|
7058 |
|
7059 | var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
7060 |
|
7061 | var curByte = 0
|
7062 |
|
7063 |
|
7064 | var len = placeHoldersLen > 0
|
7065 | ? validLen - 4
|
7066 | : validLen
|
7067 |
|
7068 | var i
|
7069 | for (i = 0; i < len; i += 4) {
|
7070 | tmp =
|
7071 | (revLookup[b64.charCodeAt(i)] << 18) |
|
7072 | (revLookup[b64.charCodeAt(i + 1)] << 12) |
|
7073 | (revLookup[b64.charCodeAt(i + 2)] << 6) |
|
7074 | revLookup[b64.charCodeAt(i + 3)]
|
7075 | arr[curByte++] = (tmp >> 16) & 0xFF
|
7076 | arr[curByte++] = (tmp >> 8) & 0xFF
|
7077 | arr[curByte++] = tmp & 0xFF
|
7078 | }
|
7079 |
|
7080 | if (placeHoldersLen === 2) {
|
7081 | tmp =
|
7082 | (revLookup[b64.charCodeAt(i)] << 2) |
|
7083 | (revLookup[b64.charCodeAt(i + 1)] >> 4)
|
7084 | arr[curByte++] = tmp & 0xFF
|
7085 | }
|
7086 |
|
7087 | if (placeHoldersLen === 1) {
|
7088 | tmp =
|
7089 | (revLookup[b64.charCodeAt(i)] << 10) |
|
7090 | (revLookup[b64.charCodeAt(i + 1)] << 4) |
|
7091 | (revLookup[b64.charCodeAt(i + 2)] >> 2)
|
7092 | arr[curByte++] = (tmp >> 8) & 0xFF
|
7093 | arr[curByte++] = tmp & 0xFF
|
7094 | }
|
7095 |
|
7096 | return arr
|
7097 | }
|
7098 |
|
7099 | function tripletToBase64 (num) {
|
7100 | return lookup[num >> 18 & 0x3F] +
|
7101 | lookup[num >> 12 & 0x3F] +
|
7102 | lookup[num >> 6 & 0x3F] +
|
7103 | lookup[num & 0x3F]
|
7104 | }
|
7105 |
|
7106 | function encodeChunk (uint8, start, end) {
|
7107 | var tmp
|
7108 | var output = []
|
7109 | for (var i = start; i < end; i += 3) {
|
7110 | tmp =
|
7111 | ((uint8[i] << 16) & 0xFF0000) +
|
7112 | ((uint8[i + 1] << 8) & 0xFF00) +
|
7113 | (uint8[i + 2] & 0xFF)
|
7114 | output.push(tripletToBase64(tmp))
|
7115 | }
|
7116 | return output.join('')
|
7117 | }
|
7118 |
|
7119 | function fromByteArray (uint8) {
|
7120 | var tmp
|
7121 | var len = uint8.length
|
7122 | var extraBytes = len % 3
|
7123 | var parts = []
|
7124 | var maxChunkLength = 16383
|
7125 |
|
7126 |
|
7127 | for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
7128 | parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
7129 | }
|
7130 |
|
7131 |
|
7132 | if (extraBytes === 1) {
|
7133 | tmp = uint8[len - 1]
|
7134 | parts.push(
|
7135 | lookup[tmp >> 2] +
|
7136 | lookup[(tmp << 4) & 0x3F] +
|
7137 | '=='
|
7138 | )
|
7139 | } else if (extraBytes === 2) {
|
7140 | tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
7141 | parts.push(
|
7142 | lookup[tmp >> 10] +
|
7143 | lookup[(tmp >> 4) & 0x3F] +
|
7144 | lookup[(tmp << 2) & 0x3F] +
|
7145 | '='
|
7146 | )
|
7147 | }
|
7148 |
|
7149 | return parts.join('')
|
7150 | }
|
7151 |
|
7152 |
|
7153 | }),
|
7154 |
|
7155 | (function(module, exports) {
|
7156 |
|
7157 |
|
7158 | exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
7159 | var e, m
|
7160 | var eLen = (nBytes * 8) - mLen - 1
|
7161 | var eMax = (1 << eLen) - 1
|
7162 | var eBias = eMax >> 1
|
7163 | var nBits = -7
|
7164 | var i = isLE ? (nBytes - 1) : 0
|
7165 | var d = isLE ? -1 : 1
|
7166 | var s = buffer[offset + i]
|
7167 |
|
7168 | i += d
|
7169 |
|
7170 | e = s & ((1 << (-nBits)) - 1)
|
7171 | s >>= (-nBits)
|
7172 | nBits += eLen
|
7173 | for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
7174 |
|
7175 | m = e & ((1 << (-nBits)) - 1)
|
7176 | e >>= (-nBits)
|
7177 | nBits += mLen
|
7178 | for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
7179 |
|
7180 | if (e === 0) {
|
7181 | e = 1 - eBias
|
7182 | } else if (e === eMax) {
|
7183 | return m ? NaN : ((s ? -1 : 1) * Infinity)
|
7184 | } else {
|
7185 | m = m + Math.pow(2, mLen)
|
7186 | e = e - eBias
|
7187 | }
|
7188 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
7189 | }
|
7190 |
|
7191 | exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
7192 | var e, m, c
|
7193 | var eLen = (nBytes * 8) - mLen - 1
|
7194 | var eMax = (1 << eLen) - 1
|
7195 | var eBias = eMax >> 1
|
7196 | var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
7197 | var i = isLE ? 0 : (nBytes - 1)
|
7198 | var d = isLE ? 1 : -1
|
7199 | var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
7200 |
|
7201 | value = Math.abs(value)
|
7202 |
|
7203 | if (isNaN(value) || value === Infinity) {
|
7204 | m = isNaN(value) ? 1 : 0
|
7205 | e = eMax
|
7206 | } else {
|
7207 | e = Math.floor(Math.log(value) / Math.LN2)
|
7208 | if (value * (c = Math.pow(2, -e)) < 1) {
|
7209 | e--
|
7210 | c *= 2
|
7211 | }
|
7212 | if (e + eBias >= 1) {
|
7213 | value += rt / c
|
7214 | } else {
|
7215 | value += rt * Math.pow(2, 1 - eBias)
|
7216 | }
|
7217 | if (value * c >= 2) {
|
7218 | e++
|
7219 | c /= 2
|
7220 | }
|
7221 |
|
7222 | if (e + eBias >= eMax) {
|
7223 | m = 0
|
7224 | e = eMax
|
7225 | } else if (e + eBias >= 1) {
|
7226 | m = ((value * c) - 1) * Math.pow(2, mLen)
|
7227 | e = e + eBias
|
7228 | } else {
|
7229 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
7230 | e = 0
|
7231 | }
|
7232 | }
|
7233 |
|
7234 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
7235 |
|
7236 | e = (e << mLen) | m
|
7237 | eLen += mLen
|
7238 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
7239 |
|
7240 | buffer[offset + i - d] |= s * 128
|
7241 | }
|
7242 |
|
7243 |
|
7244 | }),
|
7245 |
|
7246 | (function(module, exports, __webpack_require__) {
|
7247 |
|
7248 | (function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;
|
7249 | ;(function(root) {
|
7250 |
|
7251 |
|
7252 | var freeExports = typeof exports == 'object' && exports &&
|
7253 | !exports.nodeType && exports;
|
7254 | var freeModule = typeof module == 'object' && module &&
|
7255 | !module.nodeType && module;
|
7256 | var freeGlobal = typeof global == 'object' && global;
|
7257 | if (
|
7258 | freeGlobal.global === freeGlobal ||
|
7259 | freeGlobal.window === freeGlobal ||
|
7260 | freeGlobal.self === freeGlobal
|
7261 | ) {
|
7262 | root = freeGlobal;
|
7263 | }
|
7264 |
|
7265 | |
7266 |
|
7267 |
|
7268 |
|
7269 |
|
7270 | var punycode,
|
7271 |
|
7272 |
|
7273 | maxInt = 2147483647,
|
7274 |
|
7275 |
|
7276 | base = 36,
|
7277 | tMin = 1,
|
7278 | tMax = 26,
|
7279 | skew = 38,
|
7280 | damp = 700,
|
7281 | initialBias = 72,
|
7282 | initialN = 128,
|
7283 | delimiter = '-',
|
7284 |
|
7285 |
|
7286 | regexPunycode = /^xn--/,
|
7287 | regexNonASCII = /[^\x20-\x7E]/,
|
7288 | regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g,
|
7289 |
|
7290 |
|
7291 | errors = {
|
7292 | 'overflow': 'Overflow: input needs wider integers to process',
|
7293 | 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
7294 | 'invalid-input': 'Invalid input'
|
7295 | },
|
7296 |
|
7297 |
|
7298 | baseMinusTMin = base - tMin,
|
7299 | floor = Math.floor,
|
7300 | stringFromCharCode = String.fromCharCode,
|
7301 |
|
7302 |
|
7303 | key;
|
7304 |
|
7305 |
|
7306 |
|
7307 | |
7308 |
|
7309 |
|
7310 |
|
7311 |
|
7312 |
|
7313 | function error(type) {
|
7314 | throw new RangeError(errors[type]);
|
7315 | }
|
7316 |
|
7317 | |
7318 |
|
7319 |
|
7320 |
|
7321 |
|
7322 |
|
7323 |
|
7324 |
|
7325 | function map(array, fn) {
|
7326 | var length = array.length;
|
7327 | var result = [];
|
7328 | while (length--) {
|
7329 | result[length] = fn(array[length]);
|
7330 | }
|
7331 | return result;
|
7332 | }
|
7333 |
|
7334 | |
7335 |
|
7336 |
|
7337 |
|
7338 |
|
7339 |
|
7340 |
|
7341 |
|
7342 |
|
7343 |
|
7344 | function mapDomain(string, fn) {
|
7345 | var parts = string.split('@');
|
7346 | var result = '';
|
7347 | if (parts.length > 1) {
|
7348 |
|
7349 |
|
7350 | result = parts[0] + '@';
|
7351 | string = parts[1];
|
7352 | }
|
7353 |
|
7354 | string = string.replace(regexSeparators, '\x2E');
|
7355 | var labels = string.split('.');
|
7356 | var encoded = map(labels, fn).join('.');
|
7357 | return result + encoded;
|
7358 | }
|
7359 |
|
7360 | |
7361 |
|
7362 |
|
7363 |
|
7364 |
|
7365 |
|
7366 |
|
7367 |
|
7368 |
|
7369 |
|
7370 |
|
7371 |
|
7372 |
|
7373 | function ucs2decode(string) {
|
7374 | var output = [],
|
7375 | counter = 0,
|
7376 | length = string.length,
|
7377 | value,
|
7378 | extra;
|
7379 | while (counter < length) {
|
7380 | value = string.charCodeAt(counter++);
|
7381 | if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
7382 |
|
7383 | extra = string.charCodeAt(counter++);
|
7384 | if ((extra & 0xFC00) == 0xDC00) {
|
7385 | output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
7386 | } else {
|
7387 |
|
7388 |
|
7389 | output.push(value);
|
7390 | counter--;
|
7391 | }
|
7392 | } else {
|
7393 | output.push(value);
|
7394 | }
|
7395 | }
|
7396 | return output;
|
7397 | }
|
7398 |
|
7399 | |
7400 |
|
7401 |
|
7402 |
|
7403 |
|
7404 |
|
7405 |
|
7406 |
|
7407 | function ucs2encode(array) {
|
7408 | return map(array, function(value) {
|
7409 | var output = '';
|
7410 | if (value > 0xFFFF) {
|
7411 | value -= 0x10000;
|
7412 | output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
7413 | value = 0xDC00 | value & 0x3FF;
|
7414 | }
|
7415 | output += stringFromCharCode(value);
|
7416 | return output;
|
7417 | }).join('');
|
7418 | }
|
7419 |
|
7420 | |
7421 |
|
7422 |
|
7423 |
|
7424 |
|
7425 |
|
7426 |
|
7427 |
|
7428 |
|
7429 | function basicToDigit(codePoint) {
|
7430 | if (codePoint - 48 < 10) {
|
7431 | return codePoint - 22;
|
7432 | }
|
7433 | if (codePoint - 65 < 26) {
|
7434 | return codePoint - 65;
|
7435 | }
|
7436 | if (codePoint - 97 < 26) {
|
7437 | return codePoint - 97;
|
7438 | }
|
7439 | return base;
|
7440 | }
|
7441 |
|
7442 | |
7443 |
|
7444 |
|
7445 |
|
7446 |
|
7447 |
|
7448 |
|
7449 |
|
7450 |
|
7451 |
|
7452 |
|
7453 | function digitToBasic(digit, flag) {
|
7454 |
|
7455 |
|
7456 | return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
7457 | }
|
7458 |
|
7459 | |
7460 |
|
7461 |
|
7462 |
|
7463 |
|
7464 | function adapt(delta, numPoints, firstTime) {
|
7465 | var k = 0;
|
7466 | delta = firstTime ? floor(delta / damp) : delta >> 1;
|
7467 | delta += floor(delta / numPoints);
|
7468 | for (; delta > baseMinusTMin * tMax >> 1; k += base) {
|
7469 | delta = floor(delta / baseMinusTMin);
|
7470 | }
|
7471 | return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
7472 | }
|
7473 |
|
7474 | |
7475 |
|
7476 |
|
7477 |
|
7478 |
|
7479 |
|
7480 |
|
7481 | function decode(input) {
|
7482 |
|
7483 | var output = [],
|
7484 | inputLength = input.length,
|
7485 | out,
|
7486 | i = 0,
|
7487 | n = initialN,
|
7488 | bias = initialBias,
|
7489 | basic,
|
7490 | j,
|
7491 | index,
|
7492 | oldi,
|
7493 | w,
|
7494 | k,
|
7495 | digit,
|
7496 | t,
|
7497 |
|
7498 | baseMinusT;
|
7499 |
|
7500 |
|
7501 |
|
7502 |
|
7503 |
|
7504 | basic = input.lastIndexOf(delimiter);
|
7505 | if (basic < 0) {
|
7506 | basic = 0;
|
7507 | }
|
7508 |
|
7509 | for (j = 0; j < basic; ++j) {
|
7510 |
|
7511 | if (input.charCodeAt(j) >= 0x80) {
|
7512 | error('not-basic');
|
7513 | }
|
7514 | output.push(input.charCodeAt(j));
|
7515 | }
|
7516 |
|
7517 |
|
7518 |
|
7519 |
|
7520 | for (index = basic > 0 ? basic + 1 : 0; index < inputLength; ) {
|
7521 |
|
7522 |
|
7523 |
|
7524 |
|
7525 |
|
7526 |
|
7527 | for (oldi = i, w = 1, k = base; ; k += base) {
|
7528 |
|
7529 | if (index >= inputLength) {
|
7530 | error('invalid-input');
|
7531 | }
|
7532 |
|
7533 | digit = basicToDigit(input.charCodeAt(index++));
|
7534 |
|
7535 | if (digit >= base || digit > floor((maxInt - i) / w)) {
|
7536 | error('overflow');
|
7537 | }
|
7538 |
|
7539 | i += digit * w;
|
7540 | t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
7541 |
|
7542 | if (digit < t) {
|
7543 | break;
|
7544 | }
|
7545 |
|
7546 | baseMinusT = base - t;
|
7547 | if (w > floor(maxInt / baseMinusT)) {
|
7548 | error('overflow');
|
7549 | }
|
7550 |
|
7551 | w *= baseMinusT;
|
7552 |
|
7553 | }
|
7554 |
|
7555 | out = output.length + 1;
|
7556 | bias = adapt(i - oldi, out, oldi == 0);
|
7557 |
|
7558 |
|
7559 |
|
7560 | if (floor(i / out) > maxInt - n) {
|
7561 | error('overflow');
|
7562 | }
|
7563 |
|
7564 | n += floor(i / out);
|
7565 | i %= out;
|
7566 |
|
7567 |
|
7568 | output.splice(i++, 0, n);
|
7569 |
|
7570 | }
|
7571 |
|
7572 | return ucs2encode(output);
|
7573 | }
|
7574 |
|
7575 | |
7576 |
|
7577 |
|
7578 |
|
7579 |
|
7580 |
|
7581 |
|
7582 | function encode(input) {
|
7583 | var n,
|
7584 | delta,
|
7585 | handledCPCount,
|
7586 | basicLength,
|
7587 | bias,
|
7588 | j,
|
7589 | m,
|
7590 | q,
|
7591 | k,
|
7592 | t,
|
7593 | currentValue,
|
7594 | output = [],
|
7595 |
|
7596 | inputLength,
|
7597 |
|
7598 | handledCPCountPlusOne,
|
7599 | baseMinusT,
|
7600 | qMinusT;
|
7601 |
|
7602 |
|
7603 | input = ucs2decode(input);
|
7604 |
|
7605 |
|
7606 | inputLength = input.length;
|
7607 |
|
7608 |
|
7609 | n = initialN;
|
7610 | delta = 0;
|
7611 | bias = initialBias;
|
7612 |
|
7613 |
|
7614 | for (j = 0; j < inputLength; ++j) {
|
7615 | currentValue = input[j];
|
7616 | if (currentValue < 0x80) {
|
7617 | output.push(stringFromCharCode(currentValue));
|
7618 | }
|
7619 | }
|
7620 |
|
7621 | handledCPCount = basicLength = output.length;
|
7622 |
|
7623 |
|
7624 |
|
7625 |
|
7626 |
|
7627 | if (basicLength) {
|
7628 | output.push(delimiter);
|
7629 | }
|
7630 |
|
7631 |
|
7632 | while (handledCPCount < inputLength) {
|
7633 |
|
7634 |
|
7635 |
|
7636 | for (m = maxInt, j = 0; j < inputLength; ++j) {
|
7637 | currentValue = input[j];
|
7638 | if (currentValue >= n && currentValue < m) {
|
7639 | m = currentValue;
|
7640 | }
|
7641 | }
|
7642 |
|
7643 |
|
7644 |
|
7645 | handledCPCountPlusOne = handledCPCount + 1;
|
7646 | if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
7647 | error('overflow');
|
7648 | }
|
7649 |
|
7650 | delta += (m - n) * handledCPCountPlusOne;
|
7651 | n = m;
|
7652 |
|
7653 | for (j = 0; j < inputLength; ++j) {
|
7654 | currentValue = input[j];
|
7655 |
|
7656 | if (currentValue < n && ++delta > maxInt) {
|
7657 | error('overflow');
|
7658 | }
|
7659 |
|
7660 | if (currentValue == n) {
|
7661 |
|
7662 | for (q = delta, k = base; ; k += base) {
|
7663 | t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
7664 | if (q < t) {
|
7665 | break;
|
7666 | }
|
7667 | qMinusT = q - t;
|
7668 | baseMinusT = base - t;
|
7669 | output.push(
|
7670 | stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
7671 | );
|
7672 | q = floor(qMinusT / baseMinusT);
|
7673 | }
|
7674 |
|
7675 | output.push(stringFromCharCode(digitToBasic(q, 0)));
|
7676 | bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
7677 | delta = 0;
|
7678 | ++handledCPCount;
|
7679 | }
|
7680 | }
|
7681 |
|
7682 | ++delta;
|
7683 | ++n;
|
7684 |
|
7685 | }
|
7686 | return output.join('');
|
7687 | }
|
7688 |
|
7689 | |
7690 |
|
7691 |
|
7692 |
|
7693 |
|
7694 |
|
7695 |
|
7696 |
|
7697 |
|
7698 |
|
7699 |
|
7700 | function toUnicode(input) {
|
7701 | return mapDomain(input, function(string) {
|
7702 | return regexPunycode.test(string)
|
7703 | ? decode(string.slice(4).toLowerCase())
|
7704 | : string;
|
7705 | });
|
7706 | }
|
7707 |
|
7708 | |
7709 |
|
7710 |
|
7711 |
|
7712 |
|
7713 |
|
7714 |
|
7715 |
|
7716 |
|
7717 |
|
7718 |
|
7719 | function toASCII(input) {
|
7720 | return mapDomain(input, function(string) {
|
7721 | return regexNonASCII.test(string)
|
7722 | ? 'xn--' + encode(string)
|
7723 | : string;
|
7724 | });
|
7725 | }
|
7726 |
|
7727 |
|
7728 |
|
7729 |
|
7730 | punycode = {
|
7731 | |
7732 |
|
7733 |
|
7734 |
|
7735 |
|
7736 | 'version': '1.4.1',
|
7737 | |
7738 |
|
7739 |
|
7740 |
|
7741 |
|
7742 |
|
7743 |
|
7744 | 'ucs2': {
|
7745 | 'decode': ucs2decode,
|
7746 | 'encode': ucs2encode
|
7747 | },
|
7748 | 'decode': decode,
|
7749 | 'encode': encode,
|
7750 | 'toASCII': toASCII,
|
7751 | 'toUnicode': toUnicode
|
7752 | };
|
7753 |
|
7754 |
|
7755 |
|
7756 |
|
7757 | if (
|
7758 | true
|
7759 | ) {
|
7760 | !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
|
7761 | return punycode;
|
7762 | }).call(exports, __webpack_require__, exports, module),
|
7763 | __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
7764 | } else if (freeExports && freeModule) {
|
7765 | if (module.exports == freeExports) {
|
7766 |
|
7767 | freeModule.exports = punycode;
|
7768 | } else {
|
7769 |
|
7770 | for (key in punycode) {
|
7771 | punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
|
7772 | }
|
7773 | }
|
7774 | } else {
|
7775 |
|
7776 | root.punycode = punycode;
|
7777 | }
|
7778 |
|
7779 | }(this));
|
7780 |
|
7781 | }.call(exports, __webpack_require__(26)(module), __webpack_require__(0)))
|
7782 |
|
7783 | }),
|
7784 |
|
7785 | (function(module, exports) {
|
7786 |
|
7787 | module.exports = function(module) {
|
7788 | if(!module.webpackPolyfill) {
|
7789 | module.deprecate = function() {};
|
7790 | module.paths = [];
|
7791 |
|
7792 | if(!module.children) module.children = [];
|
7793 | Object.defineProperty(module, "loaded", {
|
7794 | enumerable: true,
|
7795 | get: function() {
|
7796 | return module.l;
|
7797 | }
|
7798 | });
|
7799 | Object.defineProperty(module, "id", {
|
7800 | enumerable: true,
|
7801 | get: function() {
|
7802 | return module.i;
|
7803 | }
|
7804 | });
|
7805 | module.webpackPolyfill = 1;
|
7806 | }
|
7807 | return module;
|
7808 | };
|
7809 |
|
7810 |
|
7811 | }),
|
7812 |
|
7813 | (function(module, exports, __webpack_require__) {
|
7814 |
|
7815 | "use strict";
|
7816 |
|
7817 |
|
7818 | module.exports = {
|
7819 | isString: function(arg) {
|
7820 | return typeof(arg) === 'string';
|
7821 | },
|
7822 | isObject: function(arg) {
|
7823 | return typeof(arg) === 'object' && arg !== null;
|
7824 | },
|
7825 | isNull: function(arg) {
|
7826 | return arg === null;
|
7827 | },
|
7828 | isNullOrUndefined: function(arg) {
|
7829 | return arg == null;
|
7830 | }
|
7831 | };
|
7832 |
|
7833 |
|
7834 | }),
|
7835 |
|
7836 | (function(module, exports, __webpack_require__) {
|
7837 |
|
7838 | "use strict";
|
7839 |
|
7840 |
|
7841 | exports.decode = exports.parse = __webpack_require__(29);
|
7842 | exports.encode = exports.stringify = __webpack_require__(30);
|
7843 |
|
7844 |
|
7845 | }),
|
7846 |
|
7847 | (function(module, exports, __webpack_require__) {
|
7848 |
|
7849 | "use strict";
|
7850 |
|
7851 |
|
7852 |
|
7853 |
|
7854 |
|
7855 |
|
7856 |
|
7857 |
|
7858 |
|
7859 |
|
7860 |
|
7861 |
|
7862 |
|
7863 |
|
7864 |
|
7865 |
|
7866 |
|
7867 |
|
7868 |
|
7869 |
|
7870 |
|
7871 |
|
7872 |
|
7873 |
|
7874 |
|
7875 |
|
7876 | function hasOwnProperty(obj, prop) {
|
7877 | return Object.prototype.hasOwnProperty.call(obj, prop);
|
7878 | }
|
7879 |
|
7880 | module.exports = function(qs, sep, eq, options) {
|
7881 | sep = sep || '&';
|
7882 | eq = eq || '=';
|
7883 | var obj = {};
|
7884 |
|
7885 | if (typeof qs !== 'string' || qs.length === 0) {
|
7886 | return obj;
|
7887 | }
|
7888 |
|
7889 | var regexp = /\+/g;
|
7890 | qs = qs.split(sep);
|
7891 |
|
7892 | var maxKeys = 1000;
|
7893 | if (options && typeof options.maxKeys === 'number') {
|
7894 | maxKeys = options.maxKeys;
|
7895 | }
|
7896 |
|
7897 | var len = qs.length;
|
7898 |
|
7899 | if (maxKeys > 0 && len > maxKeys) {
|
7900 | len = maxKeys;
|
7901 | }
|
7902 |
|
7903 | for (var i = 0; i < len; ++i) {
|
7904 | var x = qs[i].replace(regexp, '%20'),
|
7905 | idx = x.indexOf(eq),
|
7906 | kstr, vstr, k, v;
|
7907 |
|
7908 | if (idx >= 0) {
|
7909 | kstr = x.substr(0, idx);
|
7910 | vstr = x.substr(idx + 1);
|
7911 | } else {
|
7912 | kstr = x;
|
7913 | vstr = '';
|
7914 | }
|
7915 |
|
7916 | k = decodeURIComponent(kstr);
|
7917 | v = decodeURIComponent(vstr);
|
7918 |
|
7919 | if (!hasOwnProperty(obj, k)) {
|
7920 | obj[k] = v;
|
7921 | } else if (isArray(obj[k])) {
|
7922 | obj[k].push(v);
|
7923 | } else {
|
7924 | obj[k] = [obj[k], v];
|
7925 | }
|
7926 | }
|
7927 |
|
7928 | return obj;
|
7929 | };
|
7930 |
|
7931 | var isArray = Array.isArray || function (xs) {
|
7932 | return Object.prototype.toString.call(xs) === '[object Array]';
|
7933 | };
|
7934 |
|
7935 |
|
7936 | }),
|
7937 |
|
7938 | (function(module, exports, __webpack_require__) {
|
7939 |
|
7940 | "use strict";
|
7941 |
|
7942 |
|
7943 |
|
7944 |
|
7945 |
|
7946 |
|
7947 |
|
7948 |
|
7949 |
|
7950 |
|
7951 |
|
7952 |
|
7953 |
|
7954 |
|
7955 |
|
7956 |
|
7957 |
|
7958 |
|
7959 |
|
7960 |
|
7961 |
|
7962 |
|
7963 |
|
7964 | var stringifyPrimitive = function(v) {
|
7965 | switch (typeof v) {
|
7966 | case 'string':
|
7967 | return v;
|
7968 |
|
7969 | case 'boolean':
|
7970 | return v ? 'true' : 'false';
|
7971 |
|
7972 | case 'number':
|
7973 | return isFinite(v) ? v : '';
|
7974 |
|
7975 | default:
|
7976 | return '';
|
7977 | }
|
7978 | };
|
7979 |
|
7980 | module.exports = function(obj, sep, eq, name) {
|
7981 | sep = sep || '&';
|
7982 | eq = eq || '=';
|
7983 | if (obj === null) {
|
7984 | obj = undefined;
|
7985 | }
|
7986 |
|
7987 | if (typeof obj === 'object') {
|
7988 | return map(objectKeys(obj), function(k) {
|
7989 | var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
7990 | if (isArray(obj[k])) {
|
7991 | return map(obj[k], function(v) {
|
7992 | return ks + encodeURIComponent(stringifyPrimitive(v));
|
7993 | }).join(sep);
|
7994 | } else {
|
7995 | return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
7996 | }
|
7997 | }).join(sep);
|
7998 |
|
7999 | }
|
8000 |
|
8001 | if (!name) return '';
|
8002 | return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
8003 | encodeURIComponent(stringifyPrimitive(obj));
|
8004 | };
|
8005 |
|
8006 | var isArray = Array.isArray || function (xs) {
|
8007 | return Object.prototype.toString.call(xs) === '[object Array]';
|
8008 | };
|
8009 |
|
8010 | function map (xs, f) {
|
8011 | if (xs.map) return xs.map(f);
|
8012 | var res = [];
|
8013 | for (var i = 0; i < xs.length; i++) {
|
8014 | res.push(f(xs[i], i));
|
8015 | }
|
8016 | return res;
|
8017 | }
|
8018 |
|
8019 | var objectKeys = Object.keys || function (obj) {
|
8020 | var res = [];
|
8021 | for (var key in obj) {
|
8022 | if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
|
8023 | }
|
8024 | return res;
|
8025 | };
|
8026 |
|
8027 |
|
8028 | }),
|
8029 |
|
8030 | (function(module, exports, __webpack_require__) {
|
8031 |
|
8032 | var http = __webpack_require__(11)
|
8033 | var url = __webpack_require__(8)
|
8034 |
|
8035 | var https = module.exports
|
8036 |
|
8037 | for (var key in http) {
|
8038 | if (http.hasOwnProperty(key)) https[key] = http[key]
|
8039 | }
|
8040 |
|
8041 | https.request = function (params, cb) {
|
8042 | params = validateParams(params)
|
8043 | return http.request.call(this, params, cb)
|
8044 | }
|
8045 |
|
8046 | https.get = function (params, cb) {
|
8047 | params = validateParams(params)
|
8048 | return http.get.call(this, params, cb)
|
8049 | }
|
8050 |
|
8051 | function validateParams (params) {
|
8052 | if (typeof params === 'string') {
|
8053 | params = url.parse(params)
|
8054 | }
|
8055 | if (!params.protocol) {
|
8056 | params.protocol = 'https:'
|
8057 | }
|
8058 | if (params.protocol !== 'https:') {
|
8059 | throw new Error('Protocol "' + params.protocol + '" not supported. Expected "https:"')
|
8060 | }
|
8061 | return params
|
8062 | }
|
8063 |
|
8064 |
|
8065 | }),
|
8066 |
|
8067 | (function(module, exports, __webpack_require__) {
|
8068 |
|
8069 | (function(Buffer, global, process) {var capability = __webpack_require__(12)
|
8070 | var inherits = __webpack_require__(2)
|
8071 | var response = __webpack_require__(13)
|
8072 | var stream = __webpack_require__(14)
|
8073 | var toArrayBuffer = __webpack_require__(40)
|
8074 |
|
8075 | var IncomingMessage = response.IncomingMessage
|
8076 | var rStates = response.readyStates
|
8077 |
|
8078 | function decideMode (preferBinary, useFetch) {
|
8079 | if (capability.fetch && useFetch) {
|
8080 | return 'fetch'
|
8081 | } else if (capability.mozchunkedarraybuffer) {
|
8082 | return 'moz-chunked-arraybuffer'
|
8083 | } else if (capability.msstream) {
|
8084 | return 'ms-stream'
|
8085 | } else if (capability.arraybuffer && preferBinary) {
|
8086 | return 'arraybuffer'
|
8087 | } else if (capability.vbArray && preferBinary) {
|
8088 | return 'text:vbarray'
|
8089 | } else {
|
8090 | return 'text'
|
8091 | }
|
8092 | }
|
8093 |
|
8094 | var ClientRequest = module.exports = function (opts) {
|
8095 | var self = this
|
8096 | stream.Writable.call(self)
|
8097 |
|
8098 | self._opts = opts
|
8099 | self._body = []
|
8100 | self._headers = {}
|
8101 | if (opts.auth)
|
8102 | self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64'))
|
8103 | Object.keys(opts.headers).forEach(function (name) {
|
8104 | self.setHeader(name, opts.headers[name])
|
8105 | })
|
8106 |
|
8107 | var preferBinary
|
8108 | var useFetch = true
|
8109 | if (opts.mode === 'disable-fetch' || ('requestTimeout' in opts && !capability.abortController)) {
|
8110 |
|
8111 | useFetch = false
|
8112 | preferBinary = true
|
8113 | } else if (opts.mode === 'prefer-streaming') {
|
8114 |
|
8115 |
|
8116 | preferBinary = false
|
8117 | } else if (opts.mode === 'allow-wrong-content-type') {
|
8118 |
|
8119 | preferBinary = !capability.overrideMimeType
|
8120 | } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') {
|
8121 |
|
8122 | preferBinary = true
|
8123 | } else {
|
8124 | throw new Error('Invalid value for opts.mode')
|
8125 | }
|
8126 | self._mode = decideMode(preferBinary, useFetch)
|
8127 | self._fetchTimer = null
|
8128 |
|
8129 | self.on('finish', function () {
|
8130 | self._onFinish()
|
8131 | })
|
8132 | }
|
8133 |
|
8134 | inherits(ClientRequest, stream.Writable)
|
8135 |
|
8136 | ClientRequest.prototype.setHeader = function (name, value) {
|
8137 | var self = this
|
8138 | var lowerName = name.toLowerCase()
|
8139 |
|
8140 |
|
8141 |
|
8142 | if (unsafeHeaders.indexOf(lowerName) !== -1)
|
8143 | return
|
8144 |
|
8145 | self._headers[lowerName] = {
|
8146 | name: name,
|
8147 | value: value
|
8148 | }
|
8149 | }
|
8150 |
|
8151 | ClientRequest.prototype.getHeader = function (name) {
|
8152 | var header = this._headers[name.toLowerCase()]
|
8153 | if (header)
|
8154 | return header.value
|
8155 | return null
|
8156 | }
|
8157 |
|
8158 | ClientRequest.prototype.removeHeader = function (name) {
|
8159 | var self = this
|
8160 | delete self._headers[name.toLowerCase()]
|
8161 | }
|
8162 |
|
8163 | ClientRequest.prototype._onFinish = function () {
|
8164 | var self = this
|
8165 |
|
8166 | if (self._destroyed)
|
8167 | return
|
8168 | var opts = self._opts
|
8169 |
|
8170 | var headersObj = self._headers
|
8171 | var body = null
|
8172 | if (opts.method !== 'GET' && opts.method !== 'HEAD') {
|
8173 | if (capability.arraybuffer) {
|
8174 | body = toArrayBuffer(Buffer.concat(self._body))
|
8175 | } else if (capability.blobConstructor) {
|
8176 | body = new global.Blob(self._body.map(function (buffer) {
|
8177 | return toArrayBuffer(buffer)
|
8178 | }), {
|
8179 | type: (headersObj['content-type'] || {}).value || ''
|
8180 | })
|
8181 | } else {
|
8182 |
|
8183 | body = Buffer.concat(self._body).toString()
|
8184 | }
|
8185 | }
|
8186 |
|
8187 |
|
8188 | var headersList = []
|
8189 | Object.keys(headersObj).forEach(function (keyName) {
|
8190 | var name = headersObj[keyName].name
|
8191 | var value = headersObj[keyName].value
|
8192 | if (Array.isArray(value)) {
|
8193 | value.forEach(function (v) {
|
8194 | headersList.push([name, v])
|
8195 | })
|
8196 | } else {
|
8197 | headersList.push([name, value])
|
8198 | }
|
8199 | })
|
8200 |
|
8201 | if (self._mode === 'fetch') {
|
8202 | var signal = null
|
8203 | var fetchTimer = null
|
8204 | if (capability.abortController) {
|
8205 | var controller = new AbortController()
|
8206 | signal = controller.signal
|
8207 | self._fetchAbortController = controller
|
8208 |
|
8209 | if ('requestTimeout' in opts && opts.requestTimeout !== 0) {
|
8210 | self._fetchTimer = global.setTimeout(function () {
|
8211 | self.emit('requestTimeout')
|
8212 | if (self._fetchAbortController)
|
8213 | self._fetchAbortController.abort()
|
8214 | }, opts.requestTimeout)
|
8215 | }
|
8216 | }
|
8217 |
|
8218 | global.fetch(self._opts.url, {
|
8219 | method: self._opts.method,
|
8220 | headers: headersList,
|
8221 | body: body || undefined,
|
8222 | mode: 'cors',
|
8223 | credentials: opts.withCredentials ? 'include' : 'same-origin',
|
8224 | signal: signal
|
8225 | }).then(function (response) {
|
8226 | self._fetchResponse = response
|
8227 | self._connect()
|
8228 | }, function (reason) {
|
8229 | global.clearTimeout(self._fetchTimer)
|
8230 | if (!self._destroyed)
|
8231 | self.emit('error', reason)
|
8232 | })
|
8233 | } else {
|
8234 | var xhr = self._xhr = new global.XMLHttpRequest()
|
8235 | try {
|
8236 | xhr.open(self._opts.method, self._opts.url, true)
|
8237 | } catch (err) {
|
8238 | process.nextTick(function () {
|
8239 | self.emit('error', err)
|
8240 | })
|
8241 | return
|
8242 | }
|
8243 |
|
8244 |
|
8245 | if ('responseType' in xhr)
|
8246 | xhr.responseType = self._mode.split(':')[0]
|
8247 |
|
8248 | if ('withCredentials' in xhr)
|
8249 | xhr.withCredentials = !!opts.withCredentials
|
8250 |
|
8251 | if (self._mode === 'text' && 'overrideMimeType' in xhr)
|
8252 | xhr.overrideMimeType('text/plain; charset=x-user-defined')
|
8253 |
|
8254 | if ('requestTimeout' in opts) {
|
8255 | xhr.timeout = opts.requestTimeout
|
8256 | xhr.ontimeout = function () {
|
8257 | self.emit('requestTimeout')
|
8258 | }
|
8259 | }
|
8260 |
|
8261 | headersList.forEach(function (header) {
|
8262 | xhr.setRequestHeader(header[0], header[1])
|
8263 | })
|
8264 |
|
8265 | self._response = null
|
8266 | xhr.onreadystatechange = function () {
|
8267 | switch (xhr.readyState) {
|
8268 | case rStates.LOADING:
|
8269 | case rStates.DONE:
|
8270 | self._onXHRProgress()
|
8271 | break
|
8272 | }
|
8273 | }
|
8274 |
|
8275 |
|
8276 | if (self._mode === 'moz-chunked-arraybuffer') {
|
8277 | xhr.onprogress = function () {
|
8278 | self._onXHRProgress()
|
8279 | }
|
8280 | }
|
8281 |
|
8282 | xhr.onerror = function () {
|
8283 | if (self._destroyed)
|
8284 | return
|
8285 | self.emit('error', new Error('XHR error'))
|
8286 | }
|
8287 |
|
8288 | try {
|
8289 | xhr.send(body)
|
8290 | } catch (err) {
|
8291 | process.nextTick(function () {
|
8292 | self.emit('error', err)
|
8293 | })
|
8294 | return
|
8295 | }
|
8296 | }
|
8297 | }
|
8298 |
|
8299 |
|
8300 |
|
8301 |
|
8302 |
|
8303 |
|
8304 | function statusValid (xhr) {
|
8305 | try {
|
8306 | var status = xhr.status
|
8307 | return (status !== null && status !== 0)
|
8308 | } catch (e) {
|
8309 | return false
|
8310 | }
|
8311 | }
|
8312 |
|
8313 | ClientRequest.prototype._onXHRProgress = function () {
|
8314 | var self = this
|
8315 |
|
8316 | if (!statusValid(self._xhr) || self._destroyed)
|
8317 | return
|
8318 |
|
8319 | if (!self._response)
|
8320 | self._connect()
|
8321 |
|
8322 | self._response._onXHRProgress()
|
8323 | }
|
8324 |
|
8325 | ClientRequest.prototype._connect = function () {
|
8326 | var self = this
|
8327 |
|
8328 | if (self._destroyed)
|
8329 | return
|
8330 |
|
8331 | self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer)
|
8332 | self._response.on('error', function(err) {
|
8333 | self.emit('error', err)
|
8334 | })
|
8335 |
|
8336 | self.emit('response', self._response)
|
8337 | }
|
8338 |
|
8339 | ClientRequest.prototype._write = function (chunk, encoding, cb) {
|
8340 | var self = this
|
8341 |
|
8342 | self._body.push(chunk)
|
8343 | cb()
|
8344 | }
|
8345 |
|
8346 | ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () {
|
8347 | var self = this
|
8348 | self._destroyed = true
|
8349 | global.clearTimeout(self._fetchTimer)
|
8350 | if (self._response)
|
8351 | self._response._destroyed = true
|
8352 | if (self._xhr)
|
8353 | self._xhr.abort()
|
8354 | else if (self._fetchAbortController)
|
8355 | self._fetchAbortController.abort()
|
8356 | }
|
8357 |
|
8358 | ClientRequest.prototype.end = function (data, encoding, cb) {
|
8359 | var self = this
|
8360 | if (typeof data === 'function') {
|
8361 | cb = data
|
8362 | data = undefined
|
8363 | }
|
8364 |
|
8365 | stream.Writable.prototype.end.call(self, data, encoding, cb)
|
8366 | }
|
8367 |
|
8368 | ClientRequest.prototype.flushHeaders = function () {}
|
8369 | ClientRequest.prototype.setTimeout = function () {}
|
8370 | ClientRequest.prototype.setNoDelay = function () {}
|
8371 | ClientRequest.prototype.setSocketKeepAlive = function () {}
|
8372 |
|
8373 |
|
8374 | var unsafeHeaders = [
|
8375 | 'accept-charset',
|
8376 | 'accept-encoding',
|
8377 | 'access-control-request-headers',
|
8378 | 'access-control-request-method',
|
8379 | 'connection',
|
8380 | 'content-length',
|
8381 | 'cookie',
|
8382 | 'cookie2',
|
8383 | 'date',
|
8384 | 'dnt',
|
8385 | 'expect',
|
8386 | 'host',
|
8387 | 'keep-alive',
|
8388 | 'origin',
|
8389 | 'referer',
|
8390 | 'te',
|
8391 | 'trailer',
|
8392 | 'transfer-encoding',
|
8393 | 'upgrade',
|
8394 | 'via'
|
8395 | ]
|
8396 |
|
8397 | }.call(exports, __webpack_require__(3).Buffer, __webpack_require__(0), __webpack_require__(1)))
|
8398 |
|
8399 | }),
|
8400 |
|
8401 | (function(module, exports) {
|
8402 |
|
8403 |
|
8404 |
|
8405 | }),
|
8406 |
|
8407 | (function(module, exports, __webpack_require__) {
|
8408 |
|
8409 | "use strict";
|
8410 |
|
8411 |
|
8412 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8413 |
|
8414 | var Buffer = __webpack_require__(7).Buffer;
|
8415 | var util = __webpack_require__(35);
|
8416 |
|
8417 | function copyBuffer(src, target, offset) {
|
8418 | src.copy(target, offset);
|
8419 | }
|
8420 |
|
8421 | module.exports = function () {
|
8422 | function BufferList() {
|
8423 | _classCallCheck(this, BufferList);
|
8424 |
|
8425 | this.head = null;
|
8426 | this.tail = null;
|
8427 | this.length = 0;
|
8428 | }
|
8429 |
|
8430 | BufferList.prototype.push = function push(v) {
|
8431 | var entry = { data: v, next: null };
|
8432 | if (this.length > 0) this.tail.next = entry;else this.head = entry;
|
8433 | this.tail = entry;
|
8434 | ++this.length;
|
8435 | };
|
8436 |
|
8437 | BufferList.prototype.unshift = function unshift(v) {
|
8438 | var entry = { data: v, next: this.head };
|
8439 | if (this.length === 0) this.tail = entry;
|
8440 | this.head = entry;
|
8441 | ++this.length;
|
8442 | };
|
8443 |
|
8444 | BufferList.prototype.shift = function shift() {
|
8445 | if (this.length === 0) return;
|
8446 | var ret = this.head.data;
|
8447 | if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
|
8448 | --this.length;
|
8449 | return ret;
|
8450 | };
|
8451 |
|
8452 | BufferList.prototype.clear = function clear() {
|
8453 | this.head = this.tail = null;
|
8454 | this.length = 0;
|
8455 | };
|
8456 |
|
8457 | BufferList.prototype.join = function join(s) {
|
8458 | if (this.length === 0) return '';
|
8459 | var p = this.head;
|
8460 | var ret = '' + p.data;
|
8461 | while (p = p.next) {
|
8462 | ret += s + p.data;
|
8463 | }return ret;
|
8464 | };
|
8465 |
|
8466 | BufferList.prototype.concat = function concat(n) {
|
8467 | if (this.length === 0) return Buffer.alloc(0);
|
8468 | if (this.length === 1) return this.head.data;
|
8469 | var ret = Buffer.allocUnsafe(n >>> 0);
|
8470 | var p = this.head;
|
8471 | var i = 0;
|
8472 | while (p) {
|
8473 | copyBuffer(p.data, ret, i);
|
8474 | i += p.data.length;
|
8475 | p = p.next;
|
8476 | }
|
8477 | return ret;
|
8478 | };
|
8479 |
|
8480 | return BufferList;
|
8481 | }();
|
8482 |
|
8483 | if (util && util.inspect && util.inspect.custom) {
|
8484 | module.exports.prototype[util.inspect.custom] = function () {
|
8485 | var obj = util.inspect({ length: this.length });
|
8486 | return this.constructor.name + ' ' + obj;
|
8487 | };
|
8488 | }
|
8489 |
|
8490 | }),
|
8491 |
|
8492 | (function(module, exports) {
|
8493 |
|
8494 |
|
8495 |
|
8496 | }),
|
8497 |
|
8498 | (function(module, exports, __webpack_require__) {
|
8499 |
|
8500 | (function(global) {var scope = (typeof global !== "undefined" && global) ||
|
8501 | (typeof self !== "undefined" && self) ||
|
8502 | window;
|
8503 | var apply = Function.prototype.apply;
|
8504 |
|
8505 |
|
8506 |
|
8507 | exports.setTimeout = function() {
|
8508 | return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
|
8509 | };
|
8510 | exports.setInterval = function() {
|
8511 | return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
|
8512 | };
|
8513 | exports.clearTimeout =
|
8514 | exports.clearInterval = function(timeout) {
|
8515 | if (timeout) {
|
8516 | timeout.close();
|
8517 | }
|
8518 | };
|
8519 |
|
8520 | function Timeout(id, clearFn) {
|
8521 | this._id = id;
|
8522 | this._clearFn = clearFn;
|
8523 | }
|
8524 | Timeout.prototype.unref = Timeout.prototype.ref = function() {};
|
8525 | Timeout.prototype.close = function() {
|
8526 | this._clearFn.call(scope, this._id);
|
8527 | };
|
8528 |
|
8529 |
|
8530 | exports.enroll = function(item, msecs) {
|
8531 | clearTimeout(item._idleTimeoutId);
|
8532 | item._idleTimeout = msecs;
|
8533 | };
|
8534 |
|
8535 | exports.unenroll = function(item) {
|
8536 | clearTimeout(item._idleTimeoutId);
|
8537 | item._idleTimeout = -1;
|
8538 | };
|
8539 |
|
8540 | exports._unrefActive = exports.active = function(item) {
|
8541 | clearTimeout(item._idleTimeoutId);
|
8542 |
|
8543 | var msecs = item._idleTimeout;
|
8544 | if (msecs >= 0) {
|
8545 | item._idleTimeoutId = setTimeout(function onTimeout() {
|
8546 | if (item._onTimeout)
|
8547 | item._onTimeout();
|
8548 | }, msecs);
|
8549 | }
|
8550 | };
|
8551 |
|
8552 |
|
8553 | __webpack_require__(37);
|
8554 |
|
8555 |
|
8556 |
|
8557 | exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
|
8558 | (typeof global !== "undefined" && global.setImmediate) ||
|
8559 | (this && this.setImmediate);
|
8560 | exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
|
8561 | (typeof global !== "undefined" && global.clearImmediate) ||
|
8562 | (this && this.clearImmediate);
|
8563 |
|
8564 | }.call(exports, __webpack_require__(0)))
|
8565 |
|
8566 | }),
|
8567 |
|
8568 | (function(module, exports, __webpack_require__) {
|
8569 |
|
8570 | (function(global, process) {(function (global, undefined) {
|
8571 | "use strict";
|
8572 |
|
8573 | if (global.setImmediate) {
|
8574 | return;
|
8575 | }
|
8576 |
|
8577 | var nextHandle = 1;
|
8578 | var tasksByHandle = {};
|
8579 | var currentlyRunningATask = false;
|
8580 | var doc = global.document;
|
8581 | var registerImmediate;
|
8582 |
|
8583 | function setImmediate(callback) {
|
8584 |
|
8585 | if (typeof callback !== "function") {
|
8586 | callback = new Function("" + callback);
|
8587 | }
|
8588 |
|
8589 | var args = new Array(arguments.length - 1);
|
8590 | for (var i = 0; i < args.length; i++) {
|
8591 | args[i] = arguments[i + 1];
|
8592 | }
|
8593 |
|
8594 | var task = { callback: callback, args: args };
|
8595 | tasksByHandle[nextHandle] = task;
|
8596 | registerImmediate(nextHandle);
|
8597 | return nextHandle++;
|
8598 | }
|
8599 |
|
8600 | function clearImmediate(handle) {
|
8601 | delete tasksByHandle[handle];
|
8602 | }
|
8603 |
|
8604 | function run(task) {
|
8605 | var callback = task.callback;
|
8606 | var args = task.args;
|
8607 | switch (args.length) {
|
8608 | case 0:
|
8609 | callback();
|
8610 | break;
|
8611 | case 1:
|
8612 | callback(args[0]);
|
8613 | break;
|
8614 | case 2:
|
8615 | callback(args[0], args[1]);
|
8616 | break;
|
8617 | case 3:
|
8618 | callback(args[0], args[1], args[2]);
|
8619 | break;
|
8620 | default:
|
8621 | callback.apply(undefined, args);
|
8622 | break;
|
8623 | }
|
8624 | }
|
8625 |
|
8626 | function runIfPresent(handle) {
|
8627 |
|
8628 |
|
8629 | if (currentlyRunningATask) {
|
8630 |
|
8631 |
|
8632 | setTimeout(runIfPresent, 0, handle);
|
8633 | } else {
|
8634 | var task = tasksByHandle[handle];
|
8635 | if (task) {
|
8636 | currentlyRunningATask = true;
|
8637 | try {
|
8638 | run(task);
|
8639 | } finally {
|
8640 | clearImmediate(handle);
|
8641 | currentlyRunningATask = false;
|
8642 | }
|
8643 | }
|
8644 | }
|
8645 | }
|
8646 |
|
8647 | function installNextTickImplementation() {
|
8648 | registerImmediate = function(handle) {
|
8649 | process.nextTick(function () { runIfPresent(handle); });
|
8650 | };
|
8651 | }
|
8652 |
|
8653 | function canUsePostMessage() {
|
8654 |
|
8655 |
|
8656 | if (global.postMessage && !global.importScripts) {
|
8657 | var postMessageIsAsynchronous = true;
|
8658 | var oldOnMessage = global.onmessage;
|
8659 | global.onmessage = function() {
|
8660 | postMessageIsAsynchronous = false;
|
8661 | };
|
8662 | global.postMessage("", "*");
|
8663 | global.onmessage = oldOnMessage;
|
8664 | return postMessageIsAsynchronous;
|
8665 | }
|
8666 | }
|
8667 |
|
8668 | function installPostMessageImplementation() {
|
8669 |
|
8670 |
|
8671 |
|
8672 |
|
8673 | var messagePrefix = "setImmediate$" + Math.random() + "$";
|
8674 | var onGlobalMessage = function(event) {
|
8675 | if (event.source === global &&
|
8676 | typeof event.data === "string" &&
|
8677 | event.data.indexOf(messagePrefix) === 0) {
|
8678 | runIfPresent(+event.data.slice(messagePrefix.length));
|
8679 | }
|
8680 | };
|
8681 |
|
8682 | if (global.addEventListener) {
|
8683 | global.addEventListener("message", onGlobalMessage, false);
|
8684 | } else {
|
8685 | global.attachEvent("onmessage", onGlobalMessage);
|
8686 | }
|
8687 |
|
8688 | registerImmediate = function(handle) {
|
8689 | global.postMessage(messagePrefix + handle, "*");
|
8690 | };
|
8691 | }
|
8692 |
|
8693 | function installMessageChannelImplementation() {
|
8694 | var channel = new MessageChannel();
|
8695 | channel.port1.onmessage = function(event) {
|
8696 | var handle = event.data;
|
8697 | runIfPresent(handle);
|
8698 | };
|
8699 |
|
8700 | registerImmediate = function(handle) {
|
8701 | channel.port2.postMessage(handle);
|
8702 | };
|
8703 | }
|
8704 |
|
8705 | function installReadyStateChangeImplementation() {
|
8706 | var html = doc.documentElement;
|
8707 | registerImmediate = function(handle) {
|
8708 |
|
8709 |
|
8710 | var script = doc.createElement("script");
|
8711 | script.onreadystatechange = function () {
|
8712 | runIfPresent(handle);
|
8713 | script.onreadystatechange = null;
|
8714 | html.removeChild(script);
|
8715 | script = null;
|
8716 | };
|
8717 | html.appendChild(script);
|
8718 | };
|
8719 | }
|
8720 |
|
8721 | function installSetTimeoutImplementation() {
|
8722 | registerImmediate = function(handle) {
|
8723 | setTimeout(runIfPresent, 0, handle);
|
8724 | };
|
8725 | }
|
8726 |
|
8727 |
|
8728 | var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
|
8729 | attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
|
8730 |
|
8731 |
|
8732 | if ({}.toString.call(global.process) === "[object process]") {
|
8733 |
|
8734 | installNextTickImplementation();
|
8735 |
|
8736 | } else if (canUsePostMessage()) {
|
8737 |
|
8738 | installPostMessageImplementation();
|
8739 |
|
8740 | } else if (global.MessageChannel) {
|
8741 |
|
8742 | installMessageChannelImplementation();
|
8743 |
|
8744 | } else if (doc && "onreadystatechange" in doc.createElement("script")) {
|
8745 |
|
8746 | installReadyStateChangeImplementation();
|
8747 |
|
8748 | } else {
|
8749 |
|
8750 | installSetTimeoutImplementation();
|
8751 | }
|
8752 |
|
8753 | attachTo.setImmediate = setImmediate;
|
8754 | attachTo.clearImmediate = clearImmediate;
|
8755 | }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
|
8756 |
|
8757 | }.call(exports, __webpack_require__(0), __webpack_require__(1)))
|
8758 |
|
8759 | }),
|
8760 |
|
8761 | (function(module, exports, __webpack_require__) {
|
8762 |
|
8763 | (function(global) {
|
8764 |
|
8765 |
|
8766 |
|
8767 |
|
8768 | module.exports = deprecate;
|
8769 |
|
8770 |
|
8771 |
|
8772 |
|
8773 |
|
8774 |
|
8775 |
|
8776 |
|
8777 |
|
8778 |
|
8779 |
|
8780 |
|
8781 |
|
8782 |
|
8783 |
|
8784 |
|
8785 |
|
8786 |
|
8787 |
|
8788 | function deprecate (fn, msg) {
|
8789 | if (config('noDeprecation')) {
|
8790 | return fn;
|
8791 | }
|
8792 |
|
8793 | var warned = false;
|
8794 | function deprecated() {
|
8795 | if (!warned) {
|
8796 | if (config('throwDeprecation')) {
|
8797 | throw new Error(msg);
|
8798 | } else if (config('traceDeprecation')) {
|
8799 | console.trace(msg);
|
8800 | } else {
|
8801 | console.warn(msg);
|
8802 | }
|
8803 | warned = true;
|
8804 | }
|
8805 | return fn.apply(this, arguments);
|
8806 | }
|
8807 |
|
8808 | return deprecated;
|
8809 | }
|
8810 |
|
8811 |
|
8812 |
|
8813 |
|
8814 |
|
8815 |
|
8816 |
|
8817 |
|
8818 |
|
8819 | function config (name) {
|
8820 |
|
8821 | try {
|
8822 | if (!global.localStorage) return false;
|
8823 | } catch (_) {
|
8824 | return false;
|
8825 | }
|
8826 | var val = global.localStorage[name];
|
8827 | if (null == val) return false;
|
8828 | return String(val).toLowerCase() === 'true';
|
8829 | }
|
8830 |
|
8831 | }.call(exports, __webpack_require__(0)))
|
8832 |
|
8833 | }),
|
8834 |
|
8835 | (function(module, exports, __webpack_require__) {
|
8836 |
|
8837 | "use strict";
|
8838 |
|
8839 |
|
8840 |
|
8841 |
|
8842 |
|
8843 |
|
8844 |
|
8845 |
|
8846 |
|
8847 |
|
8848 |
|
8849 |
|
8850 |
|
8851 |
|
8852 |
|
8853 |
|
8854 |
|
8855 |
|
8856 |
|
8857 |
|
8858 |
|
8859 |
|
8860 |
|
8861 |
|
8862 |
|
8863 |
|
8864 |
|
8865 | module.exports = PassThrough;
|
8866 |
|
8867 | var Transform = __webpack_require__(20);
|
8868 |
|
8869 |
|
8870 | var util = Object.create(__webpack_require__(5));
|
8871 | util.inherits = __webpack_require__(2);
|
8872 |
|
8873 |
|
8874 | util.inherits(PassThrough, Transform);
|
8875 |
|
8876 | function PassThrough(options) {
|
8877 | if (!(this instanceof PassThrough)) return new PassThrough(options);
|
8878 |
|
8879 | Transform.call(this, options);
|
8880 | }
|
8881 |
|
8882 | PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
8883 | cb(null, chunk);
|
8884 | };
|
8885 |
|
8886 | }),
|
8887 |
|
8888 | (function(module, exports, __webpack_require__) {
|
8889 |
|
8890 | var Buffer = __webpack_require__(3).Buffer
|
8891 |
|
8892 | module.exports = function (buf) {
|
8893 |
|
8894 | if (buf instanceof Uint8Array) {
|
8895 |
|
8896 | if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
8897 | return buf.buffer
|
8898 | } else if (typeof buf.buffer.slice === 'function') {
|
8899 |
|
8900 | return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)
|
8901 | }
|
8902 | }
|
8903 |
|
8904 | if (Buffer.isBuffer(buf)) {
|
8905 |
|
8906 |
|
8907 | var arrayCopy = new Uint8Array(buf.length)
|
8908 | var len = buf.length
|
8909 | for (var i = 0; i < len; i++) {
|
8910 | arrayCopy[i] = buf[i]
|
8911 | }
|
8912 | return arrayCopy.buffer
|
8913 | } else {
|
8914 | throw new Error('Argument must be a Buffer')
|
8915 | }
|
8916 | }
|
8917 |
|
8918 |
|
8919 | }),
|
8920 |
|
8921 | (function(module, exports) {
|
8922 |
|
8923 | module.exports = extend
|
8924 |
|
8925 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
8926 |
|
8927 | function extend() {
|
8928 | var target = {}
|
8929 |
|
8930 | for (var i = 0; i < arguments.length; i++) {
|
8931 | var source = arguments[i]
|
8932 |
|
8933 | for (var key in source) {
|
8934 | if (hasOwnProperty.call(source, key)) {
|
8935 | target[key] = source[key]
|
8936 | }
|
8937 | }
|
8938 | }
|
8939 |
|
8940 | return target
|
8941 | }
|
8942 |
|
8943 |
|
8944 | }),
|
8945 |
|
8946 | (function(module, exports) {
|
8947 |
|
8948 | module.exports = {
|
8949 | "100": "Continue",
|
8950 | "101": "Switching Protocols",
|
8951 | "102": "Processing",
|
8952 | "200": "OK",
|
8953 | "201": "Created",
|
8954 | "202": "Accepted",
|
8955 | "203": "Non-Authoritative Information",
|
8956 | "204": "No Content",
|
8957 | "205": "Reset Content",
|
8958 | "206": "Partial Content",
|
8959 | "207": "Multi-Status",
|
8960 | "208": "Already Reported",
|
8961 | "226": "IM Used",
|
8962 | "300": "Multiple Choices",
|
8963 | "301": "Moved Permanently",
|
8964 | "302": "Found",
|
8965 | "303": "See Other",
|
8966 | "304": "Not Modified",
|
8967 | "305": "Use Proxy",
|
8968 | "307": "Temporary Redirect",
|
8969 | "308": "Permanent Redirect",
|
8970 | "400": "Bad Request",
|
8971 | "401": "Unauthorized",
|
8972 | "402": "Payment Required",
|
8973 | "403": "Forbidden",
|
8974 | "404": "Not Found",
|
8975 | "405": "Method Not Allowed",
|
8976 | "406": "Not Acceptable",
|
8977 | "407": "Proxy Authentication Required",
|
8978 | "408": "Request Timeout",
|
8979 | "409": "Conflict",
|
8980 | "410": "Gone",
|
8981 | "411": "Length Required",
|
8982 | "412": "Precondition Failed",
|
8983 | "413": "Payload Too Large",
|
8984 | "414": "URI Too Long",
|
8985 | "415": "Unsupported Media Type",
|
8986 | "416": "Range Not Satisfiable",
|
8987 | "417": "Expectation Failed",
|
8988 | "418": "I'm a teapot",
|
8989 | "421": "Misdirected Request",
|
8990 | "422": "Unprocessable Entity",
|
8991 | "423": "Locked",
|
8992 | "424": "Failed Dependency",
|
8993 | "425": "Unordered Collection",
|
8994 | "426": "Upgrade Required",
|
8995 | "428": "Precondition Required",
|
8996 | "429": "Too Many Requests",
|
8997 | "431": "Request Header Fields Too Large",
|
8998 | "451": "Unavailable For Legal Reasons",
|
8999 | "500": "Internal Server Error",
|
9000 | "501": "Not Implemented",
|
9001 | "502": "Bad Gateway",
|
9002 | "503": "Service Unavailable",
|
9003 | "504": "Gateway Timeout",
|
9004 | "505": "HTTP Version Not Supported",
|
9005 | "506": "Variant Also Negotiates",
|
9006 | "507": "Insufficient Storage",
|
9007 | "508": "Loop Detected",
|
9008 | "509": "Bandwidth Limit Exceeded",
|
9009 | "510": "Not Extended",
|
9010 | "511": "Network Authentication Required"
|
9011 | }
|
9012 |
|
9013 |
|
9014 | }),
|
9015 |
|
9016 | (function(module, exports, __webpack_require__) {
|
9017 |
|
9018 | (function(process) {
|
9019 |
|
9020 |
|
9021 |
|
9022 |
|
9023 |
|
9024 |
|
9025 |
|
9026 |
|
9027 |
|
9028 |
|
9029 |
|
9030 |
|
9031 |
|
9032 |
|
9033 |
|
9034 |
|
9035 |
|
9036 |
|
9037 |
|
9038 |
|
9039 | var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
|
9040 | function getOwnPropertyDescriptors(obj) {
|
9041 | var keys = Object.keys(obj);
|
9042 | var descriptors = {};
|
9043 | for (var i = 0; i < keys.length; i++) {
|
9044 | descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
|
9045 | }
|
9046 | return descriptors;
|
9047 | };
|
9048 |
|
9049 | var formatRegExp = /%[sdj%]/g;
|
9050 | exports.format = function(f) {
|
9051 | if (!isString(f)) {
|
9052 | var objects = [];
|
9053 | for (var i = 0; i < arguments.length; i++) {
|
9054 | objects.push(inspect(arguments[i]));
|
9055 | }
|
9056 | return objects.join(' ');
|
9057 | }
|
9058 |
|
9059 | var i = 1;
|
9060 | var args = arguments;
|
9061 | var len = args.length;
|
9062 | var str = String(f).replace(formatRegExp, function(x) {
|
9063 | if (x === '%%') return '%';
|
9064 | if (i >= len) return x;
|
9065 | switch (x) {
|
9066 | case '%s': return String(args[i++]);
|
9067 | case '%d': return Number(args[i++]);
|
9068 | case '%j':
|
9069 | try {
|
9070 | return JSON.stringify(args[i++]);
|
9071 | } catch (_) {
|
9072 | return '[Circular]';
|
9073 | }
|
9074 | default:
|
9075 | return x;
|
9076 | }
|
9077 | });
|
9078 | for (var x = args[i]; i < len; x = args[++i]) {
|
9079 | if (isNull(x) || !isObject(x)) {
|
9080 | str += ' ' + x;
|
9081 | } else {
|
9082 | str += ' ' + inspect(x);
|
9083 | }
|
9084 | }
|
9085 | return str;
|
9086 | };
|
9087 |
|
9088 |
|
9089 |
|
9090 |
|
9091 |
|
9092 | exports.deprecate = function(fn, msg) {
|
9093 | if (typeof process !== 'undefined' && process.noDeprecation === true) {
|
9094 | return fn;
|
9095 | }
|
9096 |
|
9097 |
|
9098 | if (typeof process === 'undefined') {
|
9099 | return function() {
|
9100 | return exports.deprecate(fn, msg).apply(this, arguments);
|
9101 | };
|
9102 | }
|
9103 |
|
9104 | var warned = false;
|
9105 | function deprecated() {
|
9106 | if (!warned) {
|
9107 | if (process.throwDeprecation) {
|
9108 | throw new Error(msg);
|
9109 | } else if (process.traceDeprecation) {
|
9110 | console.trace(msg);
|
9111 | } else {
|
9112 | console.error(msg);
|
9113 | }
|
9114 | warned = true;
|
9115 | }
|
9116 | return fn.apply(this, arguments);
|
9117 | }
|
9118 |
|
9119 | return deprecated;
|
9120 | };
|
9121 |
|
9122 |
|
9123 | var debugs = {};
|
9124 | var debugEnviron;
|
9125 | exports.debuglog = function(set) {
|
9126 | if (isUndefined(debugEnviron))
|
9127 | debugEnviron = process.env.NODE_DEBUG || '';
|
9128 | set = set.toUpperCase();
|
9129 | if (!debugs[set]) {
|
9130 | if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
9131 | var pid = process.pid;
|
9132 | debugs[set] = function() {
|
9133 | var msg = exports.format.apply(exports, arguments);
|
9134 | console.error('%s %d: %s', set, pid, msg);
|
9135 | };
|
9136 | } else {
|
9137 | debugs[set] = function() {};
|
9138 | }
|
9139 | }
|
9140 | return debugs[set];
|
9141 | };
|
9142 |
|
9143 |
|
9144 | /**
|
9145 | * Echos the value of a value. Trys to print the value out
|
9146 | * in the best way possible given the different types.
|
9147 | *
|
9148 | * @param {Object} obj The object to print out.
|
9149 | * @param {Object} opts Optional options object that alters the output.
|
9150 | */
|
9151 |
|
9152 | function inspect(obj, opts) {
|
9153 |
|
9154 | var ctx = {
|
9155 | seen: [],
|
9156 | stylize: stylizeNoColor
|
9157 | };
|
9158 |
|
9159 | if (arguments.length >= 3) ctx.depth = arguments[2];
|
9160 | if (arguments.length >= 4) ctx.colors = arguments[3];
|
9161 | if (isBoolean(opts)) {
|
9162 |
|
9163 | ctx.showHidden = opts;
|
9164 | } else if (opts) {
|
9165 |
|
9166 | exports._extend(ctx, opts);
|
9167 | }
|
9168 |
|
9169 | if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
9170 | if (isUndefined(ctx.depth)) ctx.depth = 2;
|
9171 | if (isUndefined(ctx.colors)) ctx.colors = false;
|
9172 | if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
9173 | if (ctx.colors) ctx.stylize = stylizeWithColor;
|
9174 | return formatValue(ctx, obj, ctx.depth);
|
9175 | }
|
9176 | exports.inspect = inspect;
|
9177 |
|
9178 |
|
9179 |
|
9180 | inspect.colors = {
|
9181 | 'bold' : [1, 22],
|
9182 | 'italic' : [3, 23],
|
9183 | 'underline' : [4, 24],
|
9184 | 'inverse' : [7, 27],
|
9185 | 'white' : [37, 39],
|
9186 | 'grey' : [90, 39],
|
9187 | 'black' : [30, 39],
|
9188 | 'blue' : [34, 39],
|
9189 | 'cyan' : [36, 39],
|
9190 | 'green' : [32, 39],
|
9191 | 'magenta' : [35, 39],
|
9192 | 'red' : [31, 39],
|
9193 | 'yellow' : [33, 39]
|
9194 | };
|
9195 |
|
9196 |
|
9197 | inspect.styles = {
|
9198 | 'special': 'cyan',
|
9199 | 'number': 'yellow',
|
9200 | 'boolean': 'yellow',
|
9201 | 'undefined': 'grey',
|
9202 | 'null': 'bold',
|
9203 | 'string': 'green',
|
9204 | 'date': 'magenta',
|
9205 |
|
9206 | 'regexp': 'red'
|
9207 | };
|
9208 |
|
9209 |
|
9210 | function stylizeWithColor(str, styleType) {
|
9211 | var style = inspect.styles[styleType];
|
9212 |
|
9213 | if (style) {
|
9214 | return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
9215 | '\u001b[' + inspect.colors[style][1] + 'm';
|
9216 | } else {
|
9217 | return str;
|
9218 | }
|
9219 | }
|
9220 |
|
9221 |
|
9222 | function stylizeNoColor(str, styleType) {
|
9223 | return str;
|
9224 | }
|
9225 |
|
9226 |
|
9227 | function arrayToHash(array) {
|
9228 | var hash = {};
|
9229 |
|
9230 | array.forEach(function(val, idx) {
|
9231 | hash[val] = true;
|
9232 | });
|
9233 |
|
9234 | return hash;
|
9235 | }
|
9236 |
|
9237 |
|
9238 | function formatValue(ctx, value, recurseTimes) {
|
9239 |
|
9240 |
|
9241 | if (ctx.customInspect &&
|
9242 | value &&
|
9243 | isFunction(value.inspect) &&
|
9244 |
|
9245 | value.inspect !== exports.inspect &&
|
9246 |
|
9247 | !(value.constructor && value.constructor.prototype === value)) {
|
9248 | var ret = value.inspect(recurseTimes, ctx);
|
9249 | if (!isString(ret)) {
|
9250 | ret = formatValue(ctx, ret, recurseTimes);
|
9251 | }
|
9252 | return ret;
|
9253 | }
|
9254 |
|
9255 |
|
9256 | var primitive = formatPrimitive(ctx, value);
|
9257 | if (primitive) {
|
9258 | return primitive;
|
9259 | }
|
9260 |
|
9261 |
|
9262 | var keys = Object.keys(value);
|
9263 | var visibleKeys = arrayToHash(keys);
|
9264 |
|
9265 | if (ctx.showHidden) {
|
9266 | keys = Object.getOwnPropertyNames(value);
|
9267 | }
|
9268 |
|
9269 |
|
9270 |
|
9271 | if (isError(value)
|
9272 | && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
9273 | return formatError(value);
|
9274 | }
|
9275 |
|
9276 |
|
9277 | if (keys.length === 0) {
|
9278 | if (isFunction(value)) {
|
9279 | var name = value.name ? ': ' + value.name : '';
|
9280 | return ctx.stylize('[Function' + name + ']', 'special');
|
9281 | }
|
9282 | if (isRegExp(value)) {
|
9283 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
9284 | }
|
9285 | if (isDate(value)) {
|
9286 | return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
9287 | }
|
9288 | if (isError(value)) {
|
9289 | return formatError(value);
|
9290 | }
|
9291 | }
|
9292 |
|
9293 | var base = '', array = false, braces = ['{', '}'];
|
9294 |
|
9295 |
|
9296 | if (isArray(value)) {
|
9297 | array = true;
|
9298 | braces = ['[', ']'];
|
9299 | }
|
9300 |
|
9301 |
|
9302 | if (isFunction(value)) {
|
9303 | var n = value.name ? ': ' + value.name : '';
|
9304 | base = ' [Function' + n + ']';
|
9305 | }
|
9306 |
|
9307 |
|
9308 | if (isRegExp(value)) {
|
9309 | base = ' ' + RegExp.prototype.toString.call(value);
|
9310 | }
|
9311 |
|
9312 |
|
9313 | if (isDate(value)) {
|
9314 | base = ' ' + Date.prototype.toUTCString.call(value);
|
9315 | }
|
9316 |
|
9317 |
|
9318 | if (isError(value)) {
|
9319 | base = ' ' + formatError(value);
|
9320 | }
|
9321 |
|
9322 | if (keys.length === 0 && (!array || value.length == 0)) {
|
9323 | return braces[0] + base + braces[1];
|
9324 | }
|
9325 |
|
9326 | if (recurseTimes < 0) {
|
9327 | if (isRegExp(value)) {
|
9328 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
9329 | } else {
|
9330 | return ctx.stylize('[Object]', 'special');
|
9331 | }
|
9332 | }
|
9333 |
|
9334 | ctx.seen.push(value);
|
9335 |
|
9336 | var output;
|
9337 | if (array) {
|
9338 | output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
9339 | } else {
|
9340 | output = keys.map(function(key) {
|
9341 | return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
9342 | });
|
9343 | }
|
9344 |
|
9345 | ctx.seen.pop();
|
9346 |
|
9347 | return reduceToSingleString(output, base, braces);
|
9348 | }
|
9349 |
|
9350 |
|
9351 | function formatPrimitive(ctx, value) {
|
9352 | if (isUndefined(value))
|
9353 | return ctx.stylize('undefined', 'undefined');
|
9354 | if (isString(value)) {
|
9355 | var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
9356 | .replace(/'/g, "\\'")
|
9357 | .replace(/\\"/g, '"') + '\'';
|
9358 | return ctx.stylize(simple, 'string');
|
9359 | }
|
9360 | if (isNumber(value))
|
9361 | return ctx.stylize('' + value, 'number');
|
9362 | if (isBoolean(value))
|
9363 | return ctx.stylize('' + value, 'boolean');
|
9364 |
|
9365 | if (isNull(value))
|
9366 | return ctx.stylize('null', 'null');
|
9367 | }
|
9368 |
|
9369 |
|
9370 | function formatError(value) {
|
9371 | return '[' + Error.prototype.toString.call(value) + ']';
|
9372 | }
|
9373 |
|
9374 |
|
9375 | function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
9376 | var output = [];
|
9377 | for (var i = 0, l = value.length; i < l; ++i) {
|
9378 | if (hasOwnProperty(value, String(i))) {
|
9379 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
9380 | String(i), true));
|
9381 | } else {
|
9382 | output.push('');
|
9383 | }
|
9384 | }
|
9385 | keys.forEach(function(key) {
|
9386 | if (!key.match(/^\d+$/)) {
|
9387 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
9388 | key, true));
|
9389 | }
|
9390 | });
|
9391 | return output;
|
9392 | }
|
9393 |
|
9394 |
|
9395 | function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
9396 | var name, str, desc;
|
9397 | desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
9398 | if (desc.get) {
|
9399 | if (desc.set) {
|
9400 | str = ctx.stylize('[Getter/Setter]', 'special');
|
9401 | } else {
|
9402 | str = ctx.stylize('[Getter]', 'special');
|
9403 | }
|
9404 | } else {
|
9405 | if (desc.set) {
|
9406 | str = ctx.stylize('[Setter]', 'special');
|
9407 | }
|
9408 | }
|
9409 | if (!hasOwnProperty(visibleKeys, key)) {
|
9410 | name = '[' + key + ']';
|
9411 | }
|
9412 | if (!str) {
|
9413 | if (ctx.seen.indexOf(desc.value) < 0) {
|
9414 | if (isNull(recurseTimes)) {
|
9415 | str = formatValue(ctx, desc.value, null);
|
9416 | } else {
|
9417 | str = formatValue(ctx, desc.value, recurseTimes - 1);
|
9418 | }
|
9419 | if (str.indexOf('\n') > -1) {
|
9420 | if (array) {
|
9421 | str = str.split('\n').map(function(line) {
|
9422 | return ' ' + line;
|
9423 | }).join('\n').substr(2);
|
9424 | } else {
|
9425 | str = '\n' + str.split('\n').map(function(line) {
|
9426 | return ' ' + line;
|
9427 | }).join('\n');
|
9428 | }
|
9429 | }
|
9430 | } else {
|
9431 | str = ctx.stylize('[Circular]', 'special');
|
9432 | }
|
9433 | }
|
9434 | if (isUndefined(name)) {
|
9435 | if (array && key.match(/^\d+$/)) {
|
9436 | return str;
|
9437 | }
|
9438 | name = JSON.stringify('' + key);
|
9439 | if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
9440 | name = name.substr(1, name.length - 2);
|
9441 | name = ctx.stylize(name, 'name');
|
9442 | } else {
|
9443 | name = name.replace(/'/g, "\\'")
|
9444 | .replace(/\\"/g, '"')
|
9445 | .replace(/(^"|"$)/g, "'");
|
9446 | name = ctx.stylize(name, 'string');
|
9447 | }
|
9448 | }
|
9449 |
|
9450 | return name + ': ' + str;
|
9451 | }
|
9452 |
|
9453 |
|
9454 | function reduceToSingleString(output, base, braces) {
|
9455 | var numLinesEst = 0;
|
9456 | var length = output.reduce(function(prev, cur) {
|
9457 | numLinesEst++;
|
9458 | if (cur.indexOf('\n') >= 0) numLinesEst++;
|
9459 | return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
9460 | }, 0);
|
9461 |
|
9462 | if (length > 60) {
|
9463 | return braces[0] +
|
9464 | (base === '' ? '' : base + '\n ') +
|
9465 | ' ' +
|
9466 | output.join(',\n ') +
|
9467 | ' ' +
|
9468 | braces[1];
|
9469 | }
|
9470 |
|
9471 | return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
9472 | }
|
9473 |
|
9474 |
|
9475 |
|
9476 |
|
9477 | function isArray(ar) {
|
9478 | return Array.isArray(ar);
|
9479 | }
|
9480 | exports.isArray = isArray;
|
9481 |
|
9482 | function isBoolean(arg) {
|
9483 | return typeof arg === 'boolean';
|
9484 | }
|
9485 | exports.isBoolean = isBoolean;
|
9486 |
|
9487 | function isNull(arg) {
|
9488 | return arg === null;
|
9489 | }
|
9490 | exports.isNull = isNull;
|
9491 |
|
9492 | function isNullOrUndefined(arg) {
|
9493 | return arg == null;
|
9494 | }
|
9495 | exports.isNullOrUndefined = isNullOrUndefined;
|
9496 |
|
9497 | function isNumber(arg) {
|
9498 | return typeof arg === 'number';
|
9499 | }
|
9500 | exports.isNumber = isNumber;
|
9501 |
|
9502 | function isString(arg) {
|
9503 | return typeof arg === 'string';
|
9504 | }
|
9505 | exports.isString = isString;
|
9506 |
|
9507 | function isSymbol(arg) {
|
9508 | return typeof arg === 'symbol';
|
9509 | }
|
9510 | exports.isSymbol = isSymbol;
|
9511 |
|
9512 | function isUndefined(arg) {
|
9513 | return arg === void 0;
|
9514 | }
|
9515 | exports.isUndefined = isUndefined;
|
9516 |
|
9517 | function isRegExp(re) {
|
9518 | return isObject(re) && objectToString(re) === '[object RegExp]';
|
9519 | }
|
9520 | exports.isRegExp = isRegExp;
|
9521 |
|
9522 | function isObject(arg) {
|
9523 | return typeof arg === 'object' && arg !== null;
|
9524 | }
|
9525 | exports.isObject = isObject;
|
9526 |
|
9527 | function isDate(d) {
|
9528 | return isObject(d) && objectToString(d) === '[object Date]';
|
9529 | }
|
9530 | exports.isDate = isDate;
|
9531 |
|
9532 | function isError(e) {
|
9533 | return isObject(e) &&
|
9534 | (objectToString(e) === '[object Error]' || e instanceof Error);
|
9535 | }
|
9536 | exports.isError = isError;
|
9537 |
|
9538 | function isFunction(arg) {
|
9539 | return typeof arg === 'function';
|
9540 | }
|
9541 | exports.isFunction = isFunction;
|
9542 |
|
9543 | function isPrimitive(arg) {
|
9544 | return arg === null ||
|
9545 | typeof arg === 'boolean' ||
|
9546 | typeof arg === 'number' ||
|
9547 | typeof arg === 'string' ||
|
9548 | typeof arg === 'symbol' ||
|
9549 | typeof arg === 'undefined';
|
9550 | }
|
9551 | exports.isPrimitive = isPrimitive;
|
9552 |
|
9553 | exports.isBuffer = __webpack_require__(44);
|
9554 |
|
9555 | function objectToString(o) {
|
9556 | return Object.prototype.toString.call(o);
|
9557 | }
|
9558 |
|
9559 |
|
9560 | function pad(n) {
|
9561 | return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
9562 | }
|
9563 |
|
9564 |
|
9565 | var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
9566 | 'Oct', 'Nov', 'Dec'];
|
9567 |
|
9568 |
|
9569 | function timestamp() {
|
9570 | var d = new Date();
|
9571 | var time = [pad(d.getHours()),
|
9572 | pad(d.getMinutes()),
|
9573 | pad(d.getSeconds())].join(':');
|
9574 | return [d.getDate(), months[d.getMonth()], time].join(' ');
|
9575 | }
|
9576 |
|
9577 |
|
9578 |
|
9579 | exports.log = function() {
|
9580 | console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
9581 | };
|
9582 |
|
9583 |
|
9584 |
|
9585 |
|
9586 |
|
9587 |
|
9588 |
|
9589 |
|
9590 |
|
9591 |
|
9592 |
|
9593 |
|
9594 |
|
9595 |
|
9596 |
|
9597 | exports.inherits = __webpack_require__(2);
|
9598 |
|
9599 | exports._extend = function(origin, add) {
|
9600 |
|
9601 | if (!add || !isObject(add)) return origin;
|
9602 |
|
9603 | var keys = Object.keys(add);
|
9604 | var i = keys.length;
|
9605 | while (i--) {
|
9606 | origin[keys[i]] = add[keys[i]];
|
9607 | }
|
9608 | return origin;
|
9609 | };
|
9610 |
|
9611 | function hasOwnProperty(obj, prop) {
|
9612 | return Object.prototype.hasOwnProperty.call(obj, prop);
|
9613 | }
|
9614 |
|
9615 | var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
|
9616 |
|
9617 | exports.promisify = function promisify(original) {
|
9618 | if (typeof original !== 'function')
|
9619 | throw new TypeError('The "original" argument must be of type Function');
|
9620 |
|
9621 | if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
|
9622 | var fn = original[kCustomPromisifiedSymbol];
|
9623 | if (typeof fn !== 'function') {
|
9624 | throw new TypeError('The "util.promisify.custom" argument must be of type Function');
|
9625 | }
|
9626 | Object.defineProperty(fn, kCustomPromisifiedSymbol, {
|
9627 | value: fn, enumerable: false, writable: false, configurable: true
|
9628 | });
|
9629 | return fn;
|
9630 | }
|
9631 |
|
9632 | function fn() {
|
9633 | var promiseResolve, promiseReject;
|
9634 | var promise = new Promise(function (resolve, reject) {
|
9635 | promiseResolve = resolve;
|
9636 | promiseReject = reject;
|
9637 | });
|
9638 |
|
9639 | var args = [];
|
9640 | for (var i = 0; i < arguments.length; i++) {
|
9641 | args.push(arguments[i]);
|
9642 | }
|
9643 | args.push(function (err, value) {
|
9644 | if (err) {
|
9645 | promiseReject(err);
|
9646 | } else {
|
9647 | promiseResolve(value);
|
9648 | }
|
9649 | });
|
9650 |
|
9651 | try {
|
9652 | original.apply(this, args);
|
9653 | } catch (err) {
|
9654 | promiseReject(err);
|
9655 | }
|
9656 |
|
9657 | return promise;
|
9658 | }
|
9659 |
|
9660 | Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
|
9661 |
|
9662 | if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
|
9663 | value: fn, enumerable: false, writable: false, configurable: true
|
9664 | });
|
9665 | return Object.defineProperties(
|
9666 | fn,
|
9667 | getOwnPropertyDescriptors(original)
|
9668 | );
|
9669 | }
|
9670 |
|
9671 | exports.promisify.custom = kCustomPromisifiedSymbol
|
9672 |
|
9673 | function callbackifyOnRejected(reason, cb) {
|
9674 |
|
9675 |
|
9676 |
|
9677 |
|
9678 | if (!reason) {
|
9679 | var newReason = new Error('Promise was rejected with a falsy value');
|
9680 | newReason.reason = reason;
|
9681 | reason = newReason;
|
9682 | }
|
9683 | return cb(reason);
|
9684 | }
|
9685 |
|
9686 | function callbackify(original) {
|
9687 | if (typeof original !== 'function') {
|
9688 | throw new TypeError('The "original" argument must be of type Function');
|
9689 | }
|
9690 |
|
9691 |
|
9692 |
|
9693 |
|
9694 | function callbackified() {
|
9695 | var args = [];
|
9696 | for (var i = 0; i < arguments.length; i++) {
|
9697 | args.push(arguments[i]);
|
9698 | }
|
9699 |
|
9700 | var maybeCb = args.pop();
|
9701 | if (typeof maybeCb !== 'function') {
|
9702 | throw new TypeError('The last argument must be of type Function');
|
9703 | }
|
9704 | var self = this;
|
9705 | var cb = function() {
|
9706 | return maybeCb.apply(self, arguments);
|
9707 | };
|
9708 |
|
9709 |
|
9710 | original.apply(this, args)
|
9711 | .then(function(ret) { process.nextTick(cb, null, ret) },
|
9712 | function(rej) { process.nextTick(callbackifyOnRejected, rej, cb) });
|
9713 | }
|
9714 |
|
9715 | Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
|
9716 | Object.defineProperties(callbackified,
|
9717 | getOwnPropertyDescriptors(original));
|
9718 | return callbackified;
|
9719 | }
|
9720 | exports.callbackify = callbackify;
|
9721 |
|
9722 | }.call(exports, __webpack_require__(1)))
|
9723 |
|
9724 | }),
|
9725 |
|
9726 | (function(module, exports) {
|
9727 |
|
9728 | module.exports = function isBuffer(arg) {
|
9729 | return arg && typeof arg === 'object'
|
9730 | && typeof arg.copy === 'function'
|
9731 | && typeof arg.fill === 'function'
|
9732 | && typeof arg.readUInt8 === 'function';
|
9733 | }
|
9734 |
|
9735 | })
|
9736 | ]); |
\ | No newline at end of file |