UNPKG

280 kBJavaScriptView Raw
1/******/ (function(modules) { // webpackBootstrap
2/******/ // The module cache
3/******/ var installedModules = {};
4/******/
5/******/ // The require function
6/******/ function __webpack_require__(moduleId) {
7/******/
8/******/ // Check if module is in cache
9/******/ if(installedModules[moduleId]) {
10/******/ return installedModules[moduleId].exports;
11/******/ }
12/******/ // Create a new module (and put it into the cache)
13/******/ var module = installedModules[moduleId] = {
14/******/ i: moduleId,
15/******/ l: false,
16/******/ exports: {}
17/******/ };
18/******/
19/******/ // Execute the module function
20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21/******/
22/******/ // Flag the module as loaded
23/******/ module.l = true;
24/******/
25/******/ // Return the exports of the module
26/******/ return module.exports;
27/******/ }
28/******/
29/******/
30/******/ // expose the modules object (__webpack_modules__)
31/******/ __webpack_require__.m = modules;
32/******/
33/******/ // expose the module cache
34/******/ __webpack_require__.c = installedModules;
35/******/
36/******/ // define getter function for harmony exports
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/******/ // Object.prototype.hasOwnProperty.call
57/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58/******/
59/******/ // __webpack_public_path__
60/******/ __webpack_require__.p = "";
61/******/
62/******/ // Load entry module and return exports
63/******/ return __webpack_require__(__webpack_require__.s = 21);
64/******/ })
65/************************************************************************/
66/******/ ([
67/* 0 */
68/***/ (function(module, exports) {
69
70var g;
71
72// This works in non-strict mode
73g = (function() {
74 return this;
75})();
76
77try {
78 // This works if eval is allowed (see CSP)
79 g = g || Function("return this")() || (1,eval)("this");
80} catch(e) {
81 // This works if the window reference is available
82 if(typeof window === "object")
83 g = window;
84}
85
86// g can still be undefined, but nothing to do about it...
87// We return undefined, instead of nothing here, so it's
88// easier to handle this case. if(!global) { ...}
89
90module.exports = g;
91
92
93/***/ }),
94/* 1 */
95/***/ (function(module, exports) {
96
97// shim for using process in browser
98var process = module.exports = {};
99
100// cached from whatever global is present so that test runners that stub it
101// don't break things. But we need to wrap it in a try catch in case it is
102// wrapped in strict mode code which doesn't define any globals. It's inside a
103// function because try/catches deoptimize in certain engines.
104
105var cachedSetTimeout;
106var cachedClearTimeout;
107
108function defaultSetTimout() {
109 throw new Error('setTimeout has not been defined');
110}
111function 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} ())
134function runTimeout(fun) {
135 if (cachedSetTimeout === setTimeout) {
136 //normal enviroments in sane situations
137 return setTimeout(fun, 0);
138 }
139 // if setTimeout wasn't available but was latter defined
140 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
141 cachedSetTimeout = setTimeout;
142 return setTimeout(fun, 0);
143 }
144 try {
145 // when when somebody has screwed with setTimeout but no I.E. maddness
146 return cachedSetTimeout(fun, 0);
147 } catch(e){
148 try {
149 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
150 return cachedSetTimeout.call(null, fun, 0);
151 } catch(e){
152 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
153 return cachedSetTimeout.call(this, fun, 0);
154 }
155 }
156
157
158}
159function runClearTimeout(marker) {
160 if (cachedClearTimeout === clearTimeout) {
161 //normal enviroments in sane situations
162 return clearTimeout(marker);
163 }
164 // if clearTimeout wasn't available but was latter defined
165 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
166 cachedClearTimeout = clearTimeout;
167 return clearTimeout(marker);
168 }
169 try {
170 // when when somebody has screwed with setTimeout but no I.E. maddness
171 return cachedClearTimeout(marker);
172 } catch (e){
173 try {
174 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
175 return cachedClearTimeout.call(null, marker);
176 } catch (e){
177 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
178 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
179 return cachedClearTimeout.call(this, marker);
180 }
181 }
182
183
184
185}
186var queue = [];
187var draining = false;
188var currentQueue;
189var queueIndex = -1;
190
191function 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
206function 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
230process.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// v8 likes predictible objects
244function Item(fun, array) {
245 this.fun = fun;
246 this.array = array;
247}
248Item.prototype.run = function () {
249 this.fun.apply(null, this.array);
250};
251process.title = 'browser';
252process.browser = true;
253process.env = {};
254process.argv = [];
255process.version = ''; // empty string to avoid regexp issues
256process.versions = {};
257
258function noop() {}
259
260process.on = noop;
261process.addListener = noop;
262process.once = noop;
263process.off = noop;
264process.removeListener = noop;
265process.removeAllListeners = noop;
266process.emit = noop;
267process.prependListener = noop;
268process.prependOnceListener = noop;
269
270process.listeners = function (name) { return [] }
271
272process.binding = function (name) {
273 throw new Error('process.binding is not supported');
274};
275
276process.cwd = function () { return '/' };
277process.chdir = function (dir) {
278 throw new Error('process.chdir is not supported');
279};
280process.umask = function() { return 0; };
281
282
283/***/ }),
284/* 2 */
285/***/ (function(module, exports) {
286
287if (typeof Object.create === 'function') {
288 // implementation from standard node.js 'util' module
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 // old school shim for old browsers
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/* 3 */
314/***/ (function(module, exports, __webpack_require__) {
315
316"use strict";
317/* WEBPACK VAR INJECTION */(function(global) {/*!
318 * The buffer module from node.js, for the browser.
319 *
320 * @author Feross Aboukhadijeh <http://feross.org>
321 * @license MIT
322 */
323/* eslint-disable no-proto */
324
325
326
327var base64 = __webpack_require__(23)
328var ieee754 = __webpack_require__(24)
329var isArray = __webpack_require__(10)
330
331exports.Buffer = Buffer
332exports.SlowBuffer = SlowBuffer
333exports.INSPECT_MAX_BYTES = 50
334
335/**
336 * If `Buffer.TYPED_ARRAY_SUPPORT`:
337 * === true Use Uint8Array implementation (fastest)
338 * === false Use Object implementation (most compatible, even IE6)
339 *
340 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
341 * Opera 11.6+, iOS 4.2+.
342 *
343 * Due to various browser bugs, sometimes the Object implementation will be used even
344 * when the browser supports typed arrays.
345 *
346 * Note:
347 *
348 * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
349 * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
350 *
351 * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
352 *
353 * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
354 * incorrect length in some situations.
355
356 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
357 * get the Object implementation, which is slower but behaves correctly.
358 */
359Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
360 ? global.TYPED_ARRAY_SUPPORT
361 : typedArraySupport()
362
363/*
364 * Export kMaxLength after typed array support is determined.
365 */
366exports.kMaxLength = kMaxLength()
367
368function typedArraySupport () {
369 try {
370 var arr = new Uint8Array(1)
371 arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
372 return arr.foo() === 42 && // typed array instances can be augmented
373 typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
374 arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
375 } catch (e) {
376 return false
377 }
378}
379
380function kMaxLength () {
381 return Buffer.TYPED_ARRAY_SUPPORT
382 ? 0x7fffffff
383 : 0x3fffffff
384}
385
386function createBuffer (that, length) {
387 if (kMaxLength() < length) {
388 throw new RangeError('Invalid typed array length')
389 }
390 if (Buffer.TYPED_ARRAY_SUPPORT) {
391 // Return an augmented `Uint8Array` instance, for best performance
392 that = new Uint8Array(length)
393 that.__proto__ = Buffer.prototype
394 } else {
395 // Fallback: Return an object instance of the Buffer class
396 if (that === null) {
397 that = new Buffer(length)
398 }
399 that.length = length
400 }
401
402 return that
403}
404
405/**
406 * The Buffer constructor returns instances of `Uint8Array` that have their
407 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
408 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
409 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
410 * returns a single octet.
411 *
412 * The `Uint8Array` prototype remains unmodified.
413 */
414
415function Buffer (arg, encodingOrOffset, length) {
416 if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
417 return new Buffer(arg, encodingOrOffset, length)
418 }
419
420 // Common case.
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
432Buffer.poolSize = 8192 // not used by this implementation
433
434// TODO: Legacy, not needed anymore. Remove in next major version.
435Buffer._augment = function (arr) {
436 arr.__proto__ = Buffer.prototype
437 return arr
438}
439
440function 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 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
458 * if value is a number.
459 * Buffer.from(str[, encoding])
460 * Buffer.from(array)
461 * Buffer.from(buffer)
462 * Buffer.from(arrayBuffer[, byteOffset[, length]])
463 **/
464Buffer.from = function (value, encodingOrOffset, length) {
465 return from(null, value, encodingOrOffset, length)
466}
467
468if (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 // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
474 Object.defineProperty(Buffer, Symbol.species, {
475 value: null,
476 configurable: true
477 })
478 }
479}
480
481function 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
489function alloc (that, size, fill, encoding) {
490 assertSize(size)
491 if (size <= 0) {
492 return createBuffer(that, size)
493 }
494 if (fill !== undefined) {
495 // Only pay attention to encoding if it's a string. This
496 // prevents accidentally sending in a number that would
497 // be interpretted as a start offset.
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 * Creates a new filled Buffer instance.
507 * alloc(size[, fill[, encoding]])
508 **/
509Buffer.alloc = function (size, fill, encoding) {
510 return alloc(null, size, fill, encoding)
511}
512
513function 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 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
526 * */
527Buffer.allocUnsafe = function (size) {
528 return allocUnsafe(null, size)
529}
530/**
531 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
532 */
533Buffer.allocUnsafeSlow = function (size) {
534 return allocUnsafe(null, size)
535}
536
537function 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 // Writing a hex string, for example, that contains invalid characters will
553 // cause everything after the first invalid character to be ignored. (e.g.
554 // 'abxxcd' will be treated as 'ab')
555 that = that.slice(0, actual)
556 }
557
558 return that
559}
560
561function 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
570function fromArrayBuffer (that, array, byteOffset, length) {
571 array.byteLength // this throws if `array` is not a valid ArrayBuffer
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 // Return an augmented `Uint8Array` instance, for best performance
591 that = array
592 that.__proto__ = Buffer.prototype
593 } else {
594 // Fallback: Return an object instance of the Buffer class
595 that = fromArrayLike(that, array)
596 }
597 return that
598}
599
600function 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
630function checked (length) {
631 // Note: cannot use `length < kMaxLength()` here because that fails when
632 // length is NaN (which is otherwise coerced to zero.)
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
640function SlowBuffer (length) {
641 if (+length != length) { // eslint-disable-line eqeqeq
642 length = 0
643 }
644 return Buffer.alloc(+length)
645}
646
647Buffer.isBuffer = function isBuffer (b) {
648 return !!(b != null && b._isBuffer)
649}
650
651Buffer.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
674Buffer.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
693Buffer.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
723function 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 // Use a for loop to avoid recursion
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 // assume utf8
761 encoding = ('' + encoding).toLowerCase()
762 loweredCase = true
763 }
764 }
765}
766Buffer.byteLength = byteLength
767
768function slowToString (encoding, start, end) {
769 var loweredCase = false
770
771 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
772 // property of a typed array.
773
774 // This behaves neither like String nor Uint8Array in that we set start/end
775 // to their upper/lower bounds if the value passed is out of range.
776 // undefined is handled specially as per ECMA-262 6th Edition,
777 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
778 if (start === undefined || start < 0) {
779 start = 0
780 }
781 // Return early if start > this.length. Done here to prevent potential uint32
782 // coercion fail below.
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 // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
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// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
839// Buffer instances.
840Buffer.prototype._isBuffer = true
841
842function swap (b, n, m) {
843 var i = b[n]
844 b[n] = b[m]
845 b[m] = i
846}
847
848Buffer.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
859Buffer.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
871Buffer.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
885Buffer.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
892Buffer.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
898Buffer.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
908Buffer.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// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
968// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
969//
970// Arguments:
971// - buffer - a Buffer to search
972// - val - a string, Buffer, or number
973// - byteOffset - an index into `buffer`; will be clamped to an int32
974// - encoding - an optional encoding, relevant is val is a string
975// - dir - true for indexOf, false for lastIndexOf
976function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
977 // Empty buffer means no match
978 if (buffer.length === 0) return -1
979
980 // Normalize byteOffset
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 // Coerce to Number.
990 if (isNaN(byteOffset)) {
991 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
992 byteOffset = dir ? 0 : (buffer.length - 1)
993 }
994
995 // Normalize byteOffset: negative offsets start from the end of the buffer
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 // Normalize val
1006 if (typeof val === 'string') {
1007 val = Buffer.from(val, encoding)
1008 }
1009
1010 // Finally, search either indexOf (if dir is true) or lastIndexOf
1011 if (Buffer.isBuffer(val)) {
1012 // Special case: looking for empty string/buffer always fails
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 // Search for a byte value [0-255]
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
1033function 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
1089Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
1090 return this.indexOf(val, byteOffset, encoding) !== -1
1091}
1092
1093Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
1094 return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
1095}
1096
1097Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
1098 return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
1099}
1100
1101function 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 // must be an even number of digits
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
1128function utf8Write (buf, string, offset, length) {
1129 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
1130}
1131
1132function asciiWrite (buf, string, offset, length) {
1133 return blitBuffer(asciiToBytes(string), buf, offset, length)
1134}
1135
1136function latin1Write (buf, string, offset, length) {
1137 return asciiWrite(buf, string, offset, length)
1138}
1139
1140function base64Write (buf, string, offset, length) {
1141 return blitBuffer(base64ToBytes(string), buf, offset, length)
1142}
1143
1144function ucs2Write (buf, string, offset, length) {
1145 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
1146}
1147
1148Buffer.prototype.write = function write (string, offset, length, encoding) {
1149 // Buffer#write(string)
1150 if (offset === undefined) {
1151 encoding = 'utf8'
1152 length = this.length
1153 offset = 0
1154 // Buffer#write(string, encoding)
1155 } else if (length === undefined && typeof offset === 'string') {
1156 encoding = offset
1157 length = this.length
1158 offset = 0
1159 // Buffer#write(string, offset[, length][, encoding])
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 // legacy write(string, encoding, offset, length) - remove in v0.13
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 // Warning: maxLength not taken into account in base64Write
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
1220Buffer.prototype.toJSON = function toJSON () {
1221 return {
1222 type: 'Buffer',
1223 data: Array.prototype.slice.call(this._arr || this, 0)
1224 }
1225}
1226
1227function 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
1235function 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 // we did not generate a valid codePoint so insert a
1291 // replacement char (U+FFFD) and advance only 1 byte
1292 codePoint = 0xFFFD
1293 bytesPerSequence = 1
1294 } else if (codePoint > 0xFFFF) {
1295 // encode to utf16 (surrogate pair dance)
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// Based on http://stackoverflow.com/a/22747272/680742, the browser with
1309// the lowest limit is Chrome, with 0x10000 args.
1310// We go 1 magnitude less, for safety
1311var MAX_ARGUMENTS_LENGTH = 0x1000
1312
1313function decodeCodePointsArray (codePoints) {
1314 var len = codePoints.length
1315 if (len <= MAX_ARGUMENTS_LENGTH) {
1316 return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1317 }
1318
1319 // Decode in chunks to avoid "call stack size exceeded".
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
1331function 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
1341function 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
1351function 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
1364function 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
1373Buffer.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 * Need to make sure that buffer isn't trying to write out of bounds.
1411 */
1412function 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
1417Buffer.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
1432Buffer.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
1448Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1449 if (!noAssert) checkOffset(offset, 1, this.length)
1450 return this[offset]
1451}
1452
1453Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1454 if (!noAssert) checkOffset(offset, 2, this.length)
1455 return this[offset] | (this[offset + 1] << 8)
1456}
1457
1458Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1459 if (!noAssert) checkOffset(offset, 2, this.length)
1460 return (this[offset] << 8) | this[offset + 1]
1461}
1462
1463Buffer.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
1472Buffer.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
1481Buffer.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
1499Buffer.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
1517Buffer.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
1523Buffer.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
1529Buffer.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
1535Buffer.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
1544Buffer.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
1553Buffer.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
1558Buffer.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
1563Buffer.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
1568Buffer.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
1573function 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
1579Buffer.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
1598Buffer.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
1617Buffer.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
1626function 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
1634Buffer.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
1647Buffer.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
1660function 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
1667Buffer.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
1682Buffer.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
1697Buffer.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
1720Buffer.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
1743Buffer.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
1753Buffer.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
1766Buffer.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
1779Buffer.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
1794Buffer.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
1810function 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
1815function 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
1823Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1824 return writeFloat(this, value, offset, true, noAssert)
1825}
1826
1827Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1828 return writeFloat(this, value, offset, false, noAssert)
1829}
1830
1831function 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
1839Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1840 return writeDouble(this, value, offset, true, noAssert)
1841}
1842
1843Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1844 return writeDouble(this, value, offset, false, noAssert)
1845}
1846
1847// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1848Buffer.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 // Copy 0 bytes; we're done
1856 if (end === start) return 0
1857 if (target.length === 0 || this.length === 0) return 0
1858
1859 // Fatal error conditions
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 // Are we oob?
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 // descending copy from end
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 // ascending copy from start
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// Usage:
1897// buffer.fill(number[, offset[, end]])
1898// buffer.fill(buffer[, offset[, end]])
1899// buffer.fill(string[, offset[, end]][, encoding])
1900Buffer.prototype.fill = function fill (val, start, end, encoding) {
1901 // Handle string cases:
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 // Invalid ranges are not set to a default, so can range check early.
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// HELPER FUNCTIONS
1960// ================
1961
1962var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
1963
1964function base64clean (str) {
1965 // Node strips out invalid characters like \n and \t from the string, base64-js does not
1966 str = stringtrim(str).replace(INVALID_BASE64_RE, '')
1967 // Node converts strings with length < 2 to ''
1968 if (str.length < 2) return ''
1969 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
1970 while (str.length % 4 !== 0) {
1971 str = str + '='
1972 }
1973 return str
1974}
1975
1976function stringtrim (str) {
1977 if (str.trim) return str.trim()
1978 return str.replace(/^\s+|\s+$/g, '')
1979}
1980
1981function toHex (n) {
1982 if (n < 16) return '0' + n.toString(16)
1983 return n.toString(16)
1984}
1985
1986function 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 // is surrogate component
1997 if (codePoint > 0xD7FF && codePoint < 0xE000) {
1998 // last char was a lead
1999 if (!leadSurrogate) {
2000 // no lead yet
2001 if (codePoint > 0xDBFF) {
2002 // unexpected trail
2003 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
2004 continue
2005 } else if (i + 1 === length) {
2006 // unpaired lead
2007 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
2008 continue
2009 }
2010
2011 // valid lead
2012 leadSurrogate = codePoint
2013
2014 continue
2015 }
2016
2017 // 2 leads in a row
2018 if (codePoint < 0xDC00) {
2019 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
2020 leadSurrogate = codePoint
2021 continue
2022 }
2023
2024 // valid surrogate pair
2025 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
2026 } else if (leadSurrogate) {
2027 // valid bmp char, but last char was a lead
2028 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
2029 }
2030
2031 leadSurrogate = null
2032
2033 // encode utf8
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
2066function asciiToBytes (str) {
2067 var byteArray = []
2068 for (var i = 0; i < str.length; ++i) {
2069 // Node's code seems to be doing this and not & 0x7F..
2070 byteArray.push(str.charCodeAt(i) & 0xFF)
2071 }
2072 return byteArray
2073}
2074
2075function 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
2091function base64ToBytes (str) {
2092 return base64.toByteArray(base64clean(str))
2093}
2094
2095function 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
2103function isnan (val) {
2104 return val !== val // eslint-disable-line no-self-compare
2105}
2106
2107/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
2108
2109/***/ }),
2110/* 4 */
2111/***/ (function(module, exports, __webpack_require__) {
2112
2113"use strict";
2114// Copyright Joyent, Inc. and other Node contributors.
2115//
2116// Permission is hereby granted, free of charge, to any person obtaining a
2117// copy of this software and associated documentation files (the
2118// "Software"), to deal in the Software without restriction, including
2119// without limitation the rights to use, copy, modify, merge, publish,
2120// distribute, sublicense, and/or sell copies of the Software, and to permit
2121// persons to whom the Software is furnished to do so, subject to the
2122// following conditions:
2123//
2124// The above copyright notice and this permission notice shall be included
2125// in all copies or substantial portions of the Software.
2126//
2127// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2128// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2129// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
2130// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
2131// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2132// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2133// USE OR OTHER DEALINGS IN THE SOFTWARE.
2134
2135// a duplex stream is just a stream that is both readable and writable.
2136// Since JS doesn't have multiple prototypal inheritance, this class
2137// prototypally inherits from Readable, and then parasitically from
2138// Writable.
2139
2140
2141
2142/*<replacement>*/
2143
2144var pna = __webpack_require__(6);
2145/*</replacement>*/
2146
2147/*<replacement>*/
2148var objectKeys = Object.keys || function (obj) {
2149 var keys = [];
2150 for (var key in obj) {
2151 keys.push(key);
2152 }return keys;
2153};
2154/*</replacement>*/
2155
2156module.exports = Duplex;
2157
2158/*<replacement>*/
2159var util = Object.create(__webpack_require__(5));
2160util.inherits = __webpack_require__(2);
2161/*</replacement>*/
2162
2163var Readable = __webpack_require__(15);
2164var Writable = __webpack_require__(18);
2165
2166util.inherits(Duplex, Readable);
2167
2168{
2169 // avoid scope creep, the keys array can then be collected
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
2177function 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
2193Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
2194 // making it explicit this property is not enumerable
2195 // because otherwise some prototype manipulation in
2196 // userland will fail
2197 enumerable: false,
2198 get: function () {
2199 return this._writableState.highWaterMark;
2200 }
2201});
2202
2203// the no-half-open enforcer
2204function onend() {
2205 // if we allow half-open state, or if the writable side ended,
2206 // then we're ok.
2207 if (this.allowHalfOpen || this._writableState.ended) return;
2208
2209 // no more data can be written.
2210 // But allow more writes to happen in this tick.
2211 pna.nextTick(onEndNT, this);
2212}
2213
2214function onEndNT(self) {
2215 self.end();
2216}
2217
2218Object.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 // we ignore the value if the stream
2227 // has not been initialized yet
2228 if (this._readableState === undefined || this._writableState === undefined) {
2229 return;
2230 }
2231
2232 // backward compatibility, the user is explicitly
2233 // managing destroyed
2234 this._readableState.destroyed = value;
2235 this._writableState.destroyed = value;
2236 }
2237});
2238
2239Duplex.prototype._destroy = function (err, cb) {
2240 this.push(null);
2241 this.end();
2242
2243 pna.nextTick(cb, err);
2244};
2245
2246/***/ }),
2247/* 5 */
2248/***/ (function(module, exports, __webpack_require__) {
2249
2250/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
2251//
2252// Permission is hereby granted, free of charge, to any person obtaining a
2253// copy of this software and associated documentation files (the
2254// "Software"), to deal in the Software without restriction, including
2255// without limitation the rights to use, copy, modify, merge, publish,
2256// distribute, sublicense, and/or sell copies of the Software, and to permit
2257// persons to whom the Software is furnished to do so, subject to the
2258// following conditions:
2259//
2260// The above copyright notice and this permission notice shall be included
2261// in all copies or substantial portions of the Software.
2262//
2263// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2264// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2265// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
2266// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
2267// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2268// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2269// USE OR OTHER DEALINGS IN THE SOFTWARE.
2270
2271// NOTE: These type checking functions intentionally don't use `instanceof`
2272// because it is fragile and can be easily faked with `Object.create()`.
2273
2274function isArray(arg) {
2275 if (Array.isArray) {
2276 return Array.isArray(arg);
2277 }
2278 return objectToString(arg) === '[object Array]';
2279}
2280exports.isArray = isArray;
2281
2282function isBoolean(arg) {
2283 return typeof arg === 'boolean';
2284}
2285exports.isBoolean = isBoolean;
2286
2287function isNull(arg) {
2288 return arg === null;
2289}
2290exports.isNull = isNull;
2291
2292function isNullOrUndefined(arg) {
2293 return arg == null;
2294}
2295exports.isNullOrUndefined = isNullOrUndefined;
2296
2297function isNumber(arg) {
2298 return typeof arg === 'number';
2299}
2300exports.isNumber = isNumber;
2301
2302function isString(arg) {
2303 return typeof arg === 'string';
2304}
2305exports.isString = isString;
2306
2307function isSymbol(arg) {
2308 return typeof arg === 'symbol';
2309}
2310exports.isSymbol = isSymbol;
2311
2312function isUndefined(arg) {
2313 return arg === void 0;
2314}
2315exports.isUndefined = isUndefined;
2316
2317function isRegExp(re) {
2318 return objectToString(re) === '[object RegExp]';
2319}
2320exports.isRegExp = isRegExp;
2321
2322function isObject(arg) {
2323 return typeof arg === 'object' && arg !== null;
2324}
2325exports.isObject = isObject;
2326
2327function isDate(d) {
2328 return objectToString(d) === '[object Date]';
2329}
2330exports.isDate = isDate;
2331
2332function isError(e) {
2333 return (objectToString(e) === '[object Error]' || e instanceof Error);
2334}
2335exports.isError = isError;
2336
2337function isFunction(arg) {
2338 return typeof arg === 'function';
2339}
2340exports.isFunction = isFunction;
2341
2342function isPrimitive(arg) {
2343 return arg === null ||
2344 typeof arg === 'boolean' ||
2345 typeof arg === 'number' ||
2346 typeof arg === 'string' ||
2347 typeof arg === 'symbol' || // ES6 symbol
2348 typeof arg === 'undefined';
2349}
2350exports.isPrimitive = isPrimitive;
2351
2352exports.isBuffer = Buffer.isBuffer;
2353
2354function objectToString(o) {
2355 return Object.prototype.toString.call(o);
2356}
2357
2358/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
2359
2360/***/ }),
2361/* 6 */
2362/***/ (function(module, exports, __webpack_require__) {
2363
2364"use strict";
2365/* WEBPACK VAR INJECTION */(function(process) {
2366
2367if (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
2376function 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/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
2412
2413/***/ }),
2414/* 7 */
2415/***/ (function(module, exports, __webpack_require__) {
2416
2417/* eslint-disable node/no-deprecated-api */
2418var buffer = __webpack_require__(3)
2419var Buffer = buffer.Buffer
2420
2421// alternative to using Object.keys for old browsers
2422function copyProps (src, dst) {
2423 for (var key in src) {
2424 dst[key] = src[key]
2425 }
2426}
2427if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
2428 module.exports = buffer
2429} else {
2430 // Copy properties from require('buffer')
2431 copyProps(buffer, exports)
2432 exports.Buffer = SafeBuffer
2433}
2434
2435function SafeBuffer (arg, encodingOrOffset, length) {
2436 return Buffer(arg, encodingOrOffset, length)
2437}
2438
2439// Copy static methods from Buffer
2440copyProps(Buffer, SafeBuffer)
2441
2442SafeBuffer.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
2449SafeBuffer.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
2466SafeBuffer.allocUnsafe = function (size) {
2467 if (typeof size !== 'number') {
2468 throw new TypeError('Argument must be a number')
2469 }
2470 return Buffer(size)
2471}
2472
2473SafeBuffer.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/* 8 */
2483/***/ (function(module, exports, __webpack_require__) {
2484
2485"use strict";
2486// Copyright Joyent, Inc. and other Node contributors.
2487//
2488// Permission is hereby granted, free of charge, to any person obtaining a
2489// copy of this software and associated documentation files (the
2490// "Software"), to deal in the Software without restriction, including
2491// without limitation the rights to use, copy, modify, merge, publish,
2492// distribute, sublicense, and/or sell copies of the Software, and to permit
2493// persons to whom the Software is furnished to do so, subject to the
2494// following conditions:
2495//
2496// The above copyright notice and this permission notice shall be included
2497// in all copies or substantial portions of the Software.
2498//
2499// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2500// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2501// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
2502// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
2503// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2504// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2505// USE OR OTHER DEALINGS IN THE SOFTWARE.
2506
2507
2508
2509var punycode = __webpack_require__(25);
2510var util = __webpack_require__(27);
2511
2512exports.parse = urlParse;
2513exports.resolve = urlResolve;
2514exports.resolveObject = urlResolveObject;
2515exports.format = urlFormat;
2516
2517exports.Url = Url;
2518
2519function 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// Reference: RFC 3986, RFC 1808, RFC 2396
2535
2536// define these here so at least they only have to be
2537// compiled once on the first module load.
2538var protocolPattern = /^([a-z0-9.+-]+:)/i,
2539 portPattern = /:[0-9]*$/,
2540
2541 // Special case for a simple path URL
2542 simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
2543
2544 // RFC 2396: characters reserved for delimiting URLs.
2545 // We actually just auto-escape these.
2546 delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
2547
2548 // RFC 2396: characters not allowed for various reasons.
2549 unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
2550
2551 // Allowed by RFCs, but cause of XSS attacks. Always escape these.
2552 autoEscape = ['\''].concat(unwise),
2553 // Characters that are never ever allowed in a hostname.
2554 // Note that any invalid chars are also handled, but these
2555 // are the ones that are *expected* to be seen, so we fast-path
2556 // them.
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 // protocols that can allow "unsafe" and "unwise" chars.
2563 unsafeProtocol = {
2564 'javascript': true,
2565 'javascript:': true
2566 },
2567 // protocols that never have a hostname.
2568 hostlessProtocol = {
2569 'javascript': true,
2570 'javascript:': true
2571 },
2572 // protocols that always contain a // bit.
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
2587function 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
2595Url.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 // Copy chrome, IE, opera backslash-handling behavior.
2601 // Back slashes before the query string get converted to forward slashes
2602 // See: https://code.google.com/p/chromium/issues/detail?id=25916
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 // trim before proceeding.
2614 // This is to support parse stuff like " http://foo.com \n"
2615 rest = rest.trim();
2616
2617 if (!slashesDenoteHost && url.split('#').length === 1) {
2618 // Try fast path regexp
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 // figure out if it's got a host
2648 // user@server is *always* interpreted as a hostname, and url
2649 // resolution will treat //foo/bar as host=foo,path=bar because that's
2650 // how the browser resolves relative URLs.
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 // there's a hostname.
2663 // the first instance of /, ?, ;, or # ends the host.
2664 //
2665 // If there is an @ in the hostname, then non-host chars *are* allowed
2666 // to the left of the last @ sign, unless some host-ending character
2667 // comes *before* the @-sign.
2668 // URLs are obnoxious.
2669 //
2670 // ex:
2671 // http://a@b@c/ => user:a@b host:c
2672 // http://a@b?@c => user:a host:c path:/?@c
2673
2674 // v0.12 TODO(isaacs): This is not quite how Chrome does things.
2675 // Review our test case against browsers more comprehensively.
2676
2677 // find the first instance of any hostEndingChars
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 // at this point, either we have an explicit point where the
2686 // auth portion cannot go past, or the last @ char is the decider.
2687 var auth, atSign;
2688 if (hostEnd === -1) {
2689 // atSign can be anywhere.
2690 atSign = rest.lastIndexOf('@');
2691 } else {
2692 // atSign must be in auth portion.
2693 // http://a@b/c@d => host:b auth:a path:/c@d
2694 atSign = rest.lastIndexOf('@', hostEnd);
2695 }
2696
2697 // Now we have a portion which is definitely the auth.
2698 // Pull that off.
2699 if (atSign !== -1) {
2700 auth = rest.slice(0, atSign);
2701 rest = rest.slice(atSign + 1);
2702 this.auth = decodeURIComponent(auth);
2703 }
2704
2705 // the host is the remaining to the left of the first non-host char
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 // if we still have not hit it, then the entire thing is a host.
2713 if (hostEnd === -1)
2714 hostEnd = rest.length;
2715
2716 this.host = rest.slice(0, hostEnd);
2717 rest = rest.slice(hostEnd);
2718
2719 // pull out port.
2720 this.parseHost();
2721
2722 // we've indicated that there is a hostname,
2723 // so even if it's empty, it has to be present.
2724 this.hostname = this.hostname || '';
2725
2726 // if hostname begins with [ and ends with ]
2727 // assume that it's an IPv6 address.
2728 var ipv6Hostname = this.hostname[0] === '[' &&
2729 this.hostname[this.hostname.length - 1] === ']';
2730
2731 // validate a little.
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 // we replace non-ASCII char with a temporary placeholder
2742 // we need this to make sure size of hostname is not
2743 // broken by replacing non-ASCII by nothing
2744 newpart += 'x';
2745 } else {
2746 newpart += part[j];
2747 }
2748 }
2749 // we test again with ASCII char only
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 // hostnames are always lower case.
2772 this.hostname = this.hostname.toLowerCase();
2773 }
2774
2775 if (!ipv6Hostname) {
2776 // IDNA Support: Returns a punycoded representation of "domain".
2777 // It only converts parts of the domain name that
2778 // have non-ASCII characters, i.e. it doesn't matter if
2779 // you call it with a domain that already is ASCII-only.
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 // strip [ and ] from the hostname
2789 // the host field still retains them, though
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 // now rest is set to the post-host stuff.
2799 // chop off any delim chars.
2800 if (!unsafeProtocol[lowerProto]) {
2801
2802 // First, make 100% sure that any "autoEscape" chars get
2803 // escaped, even if encodeURIComponent doesn't think they
2804 // need to be.
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 // chop off from the tail first.
2819 var hash = rest.indexOf('#');
2820 if (hash !== -1) {
2821 // got a fragment string.
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 // no query string, but parseQueryString still requested
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 //to support http.request
2845 if (this.pathname || this.search) {
2846 var p = this.pathname || '';
2847 var s = this.search || '';
2848 this.path = p + s;
2849 }
2850
2851 // finally, reconstruct the href based on what has been validated.
2852 this.href = this.format();
2853 return this;
2854};
2855
2856// format a parsed object into a url string
2857function urlFormat(obj) {
2858 // ensure it's an object, and not a string url.
2859 // If it's an obj, this is a no-op.
2860 // this way, you can call url_format() on strings
2861 // to clean up potentially wonky urls.
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
2867Url.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 // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
2903 // unless they had them to begin with.
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
2923function urlResolve(source, relative) {
2924 return urlParse(source, false, true).resolve(relative);
2925}
2926
2927Url.prototype.resolve = function(relative) {
2928 return this.resolveObject(urlParse(relative, false, true)).format();
2929};
2930
2931function urlResolveObject(source, relative) {
2932 if (!source) return relative;
2933 return urlParse(source, false, true).resolveObject(relative);
2934}
2935
2936Url.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 // hash is always overridden, no matter what.
2951 // even href="" will remove it.
2952 result.hash = relative.hash;
2953
2954 // if the relative url is empty, then there's nothing left to do here.
2955 if (relative.href === '') {
2956 result.href = result.format();
2957 return result;
2958 }
2959
2960 // hrefs like //foo/bar always cut to the protocol.
2961 if (relative.slashes && !relative.protocol) {
2962 // take everything except the protocol from relative
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 //urlParse appends trailing / to urls like http://www.example.com
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 // if it's a known url protocol, then changing
2982 // the protocol does weird things
2983 // first, if it's not file:, then we MUST have a host,
2984 // and if there was a path
2985 // to begin with, then we MUST have a path.
2986 // if it is file:, then the host is dropped,
2987 // because that's known to be hostless.
2988 // anything else is assumed to be absolute.
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 // to support http.request
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 // if the url is a non-slashed url, then relative
3041 // links like ../.. should be able
3042 // to crawl up to the hostname, as well. This is strange.
3043 // result.protocol has already been set by now.
3044 // Later on, put the first path part into the host field.
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 // it's absolute.
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 // fall through to the dot-handling below.
3075 } else if (relPath.length) {
3076 // it's relative
3077 // throw away the existing file, and take the new path instead.
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 // just pull out the search.
3085 // like href='?foo'.
3086 // Put this after the other two cases because it simplifies the booleans
3087 if (psychotic) {
3088 result.hostname = result.host = srcPath.shift();
3089 //occationaly the auth can get stuck only in host
3090 //this especially happens in cases like
3091 //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
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 //to support http.request
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 // no path at all. easy.
3112 // we've already handled the other stuff above.
3113 result.pathname = null;
3114 //to support http.request
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 // if a url ENDs in . or .., then it must get a trailing slash.
3125 // however, if it ends in anything else non-slashy,
3126 // then it must NOT get a trailing slash.
3127 var last = srcPath.slice(-1)[0];
3128 var hasTrailingSlash = (
3129 (result.host || relative.host || srcPath.length > 1) &&
3130 (last === '.' || last === '..') || last === '');
3131
3132 // strip single dots, resolve double dots to parent dir
3133 // if the path tries to go above the root, `up` ends up > 0
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 // if the path is allowed to go above the root, restore leading ..s
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 // put the host back
3168 if (psychotic) {
3169 result.hostname = result.host = isAbsolute ? '' :
3170 srcPath.length ? srcPath.shift() : '';
3171 //occationaly the auth can get stuck only in host
3172 //this especially happens in cases like
3173 //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
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 //to support request.http
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
3206Url.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/* 9 */
3222/***/ (function(module, exports, __webpack_require__) {
3223
3224"use strict";
3225// Copyright Joyent, Inc. and other Node contributors.
3226//
3227// Permission is hereby granted, free of charge, to any person obtaining a
3228// copy of this software and associated documentation files (the
3229// "Software"), to deal in the Software without restriction, including
3230// without limitation the rights to use, copy, modify, merge, publish,
3231// distribute, sublicense, and/or sell copies of the Software, and to permit
3232// persons to whom the Software is furnished to do so, subject to the
3233// following conditions:
3234//
3235// The above copyright notice and this permission notice shall be included
3236// in all copies or substantial portions of the Software.
3237//
3238// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3239// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3240// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
3241// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
3242// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
3243// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
3244// USE OR OTHER DEALINGS IN THE SOFTWARE.
3245
3246
3247
3248var R = typeof Reflect === 'object' ? Reflect : null
3249var 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
3255var ReflectOwnKeys
3256if (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
3269function ProcessEmitWarning(warning) {
3270 if (console && console.warn) console.warn(warning);
3271}
3272
3273var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
3274 return value !== value;
3275}
3276
3277function EventEmitter() {
3278 EventEmitter.init.call(this);
3279}
3280module.exports = EventEmitter;
3281module.exports.once = once;
3282
3283// Backwards-compat with node 0.10.x
3284EventEmitter.EventEmitter = EventEmitter;
3285
3286EventEmitter.prototype._events = undefined;
3287EventEmitter.prototype._eventsCount = 0;
3288EventEmitter.prototype._maxListeners = undefined;
3289
3290// By default EventEmitters will print a warning if more than 10 listeners are
3291// added to it. This is a useful default which helps finding memory leaks.
3292var defaultMaxListeners = 10;
3293
3294function 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
3300Object.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
3313EventEmitter.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// Obviously not all Emitters should be limited to 10. This function allows
3325// that to be increased. Set to zero for unlimited.
3326EventEmitter.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
3334function _getMaxListeners(that) {
3335 if (that._maxListeners === undefined)
3336 return EventEmitter.defaultMaxListeners;
3337 return that._maxListeners;
3338}
3339
3340EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
3341 return _getMaxListeners(this);
3342};
3343
3344EventEmitter.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 // If there is no 'error' event listener then throw.
3356 if (doError) {
3357 var er;
3358 if (args.length > 0)
3359 er = args[0];
3360 if (er instanceof Error) {
3361 // Note: The comments on the `throw` lines are intentional, they show
3362 // up in Node's output if this results in an unhandled exception.
3363 throw er; // Unhandled 'error' event
3364 }
3365 // At least give some kind of context to the user
3366 var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
3367 err.context = er;
3368 throw err; // Unhandled 'error' event
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
3388function _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 // To avoid recursion in the case that type === "newListener"! Before
3401 // adding it to the listeners, first emit "newListener".
3402 if (events.newListener !== undefined) {
3403 target.emit('newListener', type,
3404 listener.listener ? listener.listener : listener);
3405
3406 // Re-assign `events` because a newListener handler could have caused the
3407 // this._events to be assigned to a new object
3408 events = target._events;
3409 }
3410 existing = events[type];
3411 }
3412
3413 if (existing === undefined) {
3414 // Optimize the case of one listener. Don't need the extra array object.
3415 existing = events[type] = listener;
3416 ++target._eventsCount;
3417 } else {
3418 if (typeof existing === 'function') {
3419 // Adding the second element, need to change to array.
3420 existing = events[type] =
3421 prepend ? [listener, existing] : [existing, listener];
3422 // If we've already got an array, just append.
3423 } else if (prepend) {
3424 existing.unshift(listener);
3425 } else {
3426 existing.push(listener);
3427 }
3428
3429 // Check for listener leak
3430 m = _getMaxListeners(target);
3431 if (m > 0 && existing.length > m && !existing.warned) {
3432 existing.warned = true;
3433 // No error code for this since it is a Warning
3434 // eslint-disable-next-line no-restricted-syntax
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
3450EventEmitter.prototype.addListener = function addListener(type, listener) {
3451 return _addListener(this, type, listener, false);
3452};
3453
3454EventEmitter.prototype.on = EventEmitter.prototype.addListener;
3455
3456EventEmitter.prototype.prependListener =
3457 function prependListener(type, listener) {
3458 return _addListener(this, type, listener, true);
3459 };
3460
3461function 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
3471function _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
3479EventEmitter.prototype.once = function once(type, listener) {
3480 checkListener(listener);
3481 this.on(type, _onceWrap(this, type, listener));
3482 return this;
3483};
3484
3485EventEmitter.prototype.prependOnceListener =
3486 function prependOnceListener(type, listener) {
3487 checkListener(listener);
3488 this.prependListener(type, _onceWrap(this, type, listener));
3489 return this;
3490 };
3491
3492// Emits a 'removeListener' event if and only if the listener was removed.
3493EventEmitter.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
3545EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
3546
3547EventEmitter.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 // not listening for removeListener, no need to emit
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 // emit removeListener for all listeners on all events
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 // LIFO order
3590 for (i = listeners.length - 1; i >= 0; i--) {
3591 this.removeListener(type, listeners[i]);
3592 }
3593 }
3594
3595 return this;
3596 };
3597
3598function _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
3615EventEmitter.prototype.listeners = function listeners(type) {
3616 return _listeners(this, type, true);
3617};
3618
3619EventEmitter.prototype.rawListeners = function rawListeners(type) {
3620 return _listeners(this, type, false);
3621};
3622
3623EventEmitter.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
3631EventEmitter.prototype.listenerCount = listenerCount;
3632function 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
3648EventEmitter.prototype.eventNames = function eventNames() {
3649 return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
3650};
3651
3652function 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
3659function spliceOne(list, index) {
3660 for (; index + 1 < list.length; index++)
3661 list[index] = list[index + 1];
3662 list.pop();
3663}
3664
3665function 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
3673function 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
3694function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
3695 if (typeof emitter.on === 'function') {
3696 eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
3697 }
3698}
3699
3700function 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 // EventTarget does not have `error` event semantics like Node
3709 // EventEmitters, we do not listen for `error` events here.
3710 emitter.addEventListener(name, function wrapListener(arg) {
3711 // IE does not have builtin `{ once: true }` support so we
3712 // have to do it manually.
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/* 10 */
3726/***/ (function(module, exports) {
3727
3728var toString = {}.toString;
3729
3730module.exports = Array.isArray || function (arr) {
3731 return toString.call(arr) == '[object Array]';
3732};
3733
3734
3735/***/ }),
3736/* 11 */
3737/***/ (function(module, exports, __webpack_require__) {
3738
3739/* WEBPACK VAR INJECTION */(function(global) {var ClientRequest = __webpack_require__(32)
3740var response = __webpack_require__(13)
3741var extend = __webpack_require__(41)
3742var statusCodes = __webpack_require__(42)
3743var url = __webpack_require__(8)
3744
3745var http = exports
3746
3747http.request = function (opts, cb) {
3748 if (typeof opts === 'string')
3749 opts = url.parse(opts)
3750 else
3751 opts = extend(opts)
3752
3753 // Normally, the page is loaded from http or https, so not specifying a protocol
3754 // will result in a (valid) protocol-relative url. However, this won't work if
3755 // the protocol is something else, like 'file:'
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 // Necessary for IPv6 addresses
3764 if (host && host.indexOf(':') !== -1)
3765 host = '[' + host + ']'
3766
3767 // This may be a relative url. The browser should always be able to interpret it correctly.
3768 opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path
3769 opts.method = (opts.method || 'GET').toUpperCase()
3770 opts.headers = opts.headers || {}
3771
3772 // Also valid opts.auth, opts.mode
3773
3774 var req = new ClientRequest(opts)
3775 if (cb)
3776 req.on('response', cb)
3777 return req
3778}
3779
3780http.get = function get (opts, cb) {
3781 var req = http.request(opts, cb)
3782 req.end()
3783 return req
3784}
3785
3786http.ClientRequest = ClientRequest
3787http.IncomingMessage = response.IncomingMessage
3788
3789http.Agent = function () {}
3790http.Agent.defaultMaxSockets = 4
3791
3792http.globalAgent = new http.Agent()
3793
3794http.STATUS_CODES = statusCodes
3795
3796http.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/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
3825
3826/***/ }),
3827/* 12 */
3828/***/ (function(module, exports, __webpack_require__) {
3829
3830/* WEBPACK VAR INJECTION */(function(global) {exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream)
3831
3832exports.writableStream = isFunction(global.WritableStream)
3833
3834exports.abortController = isFunction(global.AbortController)
3835
3836exports.blobConstructor = false
3837try {
3838 new Blob([new ArrayBuffer(1)])
3839 exports.blobConstructor = true
3840} catch (e) {}
3841
3842// The xhr request to example.com may violate some restrictive CSP configurations,
3843// so if we're running in a browser that supports `fetch`, avoid calling getXHR()
3844// and assume support for certain features below.
3845var xhr
3846function getXHR () {
3847 // Cache the xhr value
3848 if (xhr !== undefined) return xhr
3849
3850 if (global.XMLHttpRequest) {
3851 xhr = new global.XMLHttpRequest()
3852 // If XDomainRequest is available (ie only, where xhr might not work
3853 // cross domain), use the page location. Otherwise use example.com
3854 // Note: this doesn't actually make an http request.
3855 try {
3856 xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com')
3857 } catch(e) {
3858 xhr = null
3859 }
3860 } else {
3861 // Service workers don't have XHR
3862 xhr = null
3863 }
3864 return xhr
3865}
3866
3867function 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// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'.
3878// Safari 7.1 appears to have fixed this bug.
3879var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined'
3880var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice)
3881
3882// If fetch is supported, then arraybuffer will be supported too. Skip calling
3883// checkTypeSupport(), since that calls getXHR().
3884exports.arraybuffer = exports.fetch || (haveArrayBuffer && checkTypeSupport('arraybuffer'))
3885
3886// These next two tests unavoidably show warnings in Chrome. Since fetch will always
3887// be used if it's available, just return false for these to avoid the warnings.
3888exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream')
3889exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer &&
3890 checkTypeSupport('moz-chunked-arraybuffer')
3891
3892// If fetch is supported, then overrideMimeType will be supported too. Skip calling
3893// getXHR().
3894exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false)
3895
3896exports.vbArray = isFunction(global.VBArray)
3897
3898function isFunction (value) {
3899 return typeof value === 'function'
3900}
3901
3902xhr = null // Help gc
3903
3904/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
3905
3906/***/ }),
3907/* 13 */
3908/***/ (function(module, exports, __webpack_require__) {
3909
3910/* WEBPACK VAR INJECTION */(function(process, Buffer, global) {var capability = __webpack_require__(12)
3911var inherits = __webpack_require__(2)
3912var stream = __webpack_require__(14)
3913
3914var rStates = exports.readyStates = {
3915 UNSENT: 0,
3916 OPENED: 1,
3917 HEADERS_RECEIVED: 2,
3918 LOADING: 3,
3919 DONE: 4
3920}
3921
3922var 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 // Fake the 'close' event, but only once 'end' fires
3933 self.on('end', function () {
3934 // The nextTick is necessary to prevent the 'request' module from causing an infinite loop
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) {} // pipeTo method isn't defined. Can't find a better way to feature test this
3984 }
3985 // fallback for when writableStream or pipeTo aren't available
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' // best guess
4042 }
4043 }
4044}
4045
4046inherits(IncomingMessage, stream.Readable)
4047
4048IncomingMessage.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
4058IncomingMessage.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': // For IE9
4066 if (xhr.readyState !== rStates.DONE)
4067 break
4068 try {
4069 // This fails in IE8
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 // Falls through in IE8
4077 case 'text':
4078 try { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4
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': // take whole
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 // reader.onerror = ??? // TODO: this
4125 reader.readAsArrayBuffer(response)
4126 break
4127 }
4128
4129 // The ms-stream case handles end separately in reader.onload()
4130 if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {
4131 self.push(null)
4132 }
4133}
4134
4135/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3).Buffer, __webpack_require__(0)))
4136
4137/***/ }),
4138/* 14 */
4139/***/ (function(module, exports, __webpack_require__) {
4140
4141exports = module.exports = __webpack_require__(15);
4142exports.Stream = exports;
4143exports.Readable = exports;
4144exports.Writable = __webpack_require__(18);
4145exports.Duplex = __webpack_require__(4);
4146exports.Transform = __webpack_require__(20);
4147exports.PassThrough = __webpack_require__(39);
4148
4149
4150/***/ }),
4151/* 15 */
4152/***/ (function(module, exports, __webpack_require__) {
4153
4154"use strict";
4155/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
4156//
4157// Permission is hereby granted, free of charge, to any person obtaining a
4158// copy of this software and associated documentation files (the
4159// "Software"), to deal in the Software without restriction, including
4160// without limitation the rights to use, copy, modify, merge, publish,
4161// distribute, sublicense, and/or sell copies of the Software, and to permit
4162// persons to whom the Software is furnished to do so, subject to the
4163// following conditions:
4164//
4165// The above copyright notice and this permission notice shall be included
4166// in all copies or substantial portions of the Software.
4167//
4168// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
4169// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4170// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
4171// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
4172// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4173// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4174// USE OR OTHER DEALINGS IN THE SOFTWARE.
4175
4176
4177
4178/*<replacement>*/
4179
4180var pna = __webpack_require__(6);
4181/*</replacement>*/
4182
4183module.exports = Readable;
4184
4185/*<replacement>*/
4186var isArray = __webpack_require__(10);
4187/*</replacement>*/
4188
4189/*<replacement>*/
4190var Duplex;
4191/*</replacement>*/
4192
4193Readable.ReadableState = ReadableState;
4194
4195/*<replacement>*/
4196var EE = __webpack_require__(9).EventEmitter;
4197
4198var EElistenerCount = function (emitter, type) {
4199 return emitter.listeners(type).length;
4200};
4201/*</replacement>*/
4202
4203/*<replacement>*/
4204var Stream = __webpack_require__(16);
4205/*</replacement>*/
4206
4207/*<replacement>*/
4208
4209var Buffer = __webpack_require__(7).Buffer;
4210var OurUint8Array = global.Uint8Array || function () {};
4211function _uint8ArrayToBuffer(chunk) {
4212 return Buffer.from(chunk);
4213}
4214function _isUint8Array(obj) {
4215 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
4216}
4217
4218/*</replacement>*/
4219
4220/*<replacement>*/
4221var util = Object.create(__webpack_require__(5));
4222util.inherits = __webpack_require__(2);
4223/*</replacement>*/
4224
4225/*<replacement>*/
4226var debugUtil = __webpack_require__(33);
4227var debug = void 0;
4228if (debugUtil && debugUtil.debuglog) {
4229 debug = debugUtil.debuglog('stream');
4230} else {
4231 debug = function () {};
4232}
4233/*</replacement>*/
4234
4235var BufferList = __webpack_require__(34);
4236var destroyImpl = __webpack_require__(17);
4237var StringDecoder;
4238
4239util.inherits(Readable, Stream);
4240
4241var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
4242
4243function prependListener(emitter, event, fn) {
4244 // Sadly this is not cacheable as some libraries bundle their own
4245 // event emitter implementation with them.
4246 if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
4247
4248 // This is a hack to make sure that our error handler is attached before any
4249 // userland ones. NEVER DO THIS. This is here only because this code needs
4250 // to continue to work with older versions of Node.js that do not include
4251 // the prependListener() method. The goal is to eventually remove this hack.
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
4255function ReadableState(options, stream) {
4256 Duplex = Duplex || __webpack_require__(4);
4257
4258 options = options || {};
4259
4260 // Duplex streams are both readable and writable, but share
4261 // the same options object.
4262 // However, some cases require setting options to different
4263 // values for the readable and the writable sides of the duplex stream.
4264 // These options can be provided separately as readableXXX and writableXXX.
4265 var isDuplex = stream instanceof Duplex;
4266
4267 // object stream flag. Used to make read(n) ignore n and to
4268 // make all the buffer merging and length checks go away
4269 this.objectMode = !!options.objectMode;
4270
4271 if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
4272
4273 // the point at which it stops calling _read() to fill the buffer
4274 // Note: 0 is a valid value, means "don't call _read preemptively ever"
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 // cast to ints.
4282 this.highWaterMark = Math.floor(this.highWaterMark);
4283
4284 // A linked list is used to store data chunks instead of an array because the
4285 // linked list can remove elements from the beginning faster than
4286 // array.shift()
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 // a flag to be able to tell if the event 'readable'/'data' is emitted
4297 // immediately, or on a later tick. We set this to true at first, because
4298 // any actions that shouldn't happen until "later" should generally also
4299 // not happen before the first read call.
4300 this.sync = true;
4301
4302 // whenever we return null, then we set a flag to say
4303 // that we're awaiting a 'readable' event emission.
4304 this.needReadable = false;
4305 this.emittedReadable = false;
4306 this.readableListening = false;
4307 this.resumeScheduled = false;
4308
4309 // has it been destroyed
4310 this.destroyed = false;
4311
4312 // Crypto is kind of old and crusty. Historically, its default string
4313 // encoding is 'binary' so we have to make this configurable.
4314 // Everything else in the universe uses 'utf8', though.
4315 this.defaultEncoding = options.defaultEncoding || 'utf8';
4316
4317 // the number of writers that are awaiting a drain event in .pipe()s
4318 this.awaitDrain = 0;
4319
4320 // if true, a maybeReadMore has been scheduled
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
4332function 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 // legacy
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
4351Object.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 // we ignore the value if the stream
4360 // has not been initialized yet
4361 if (!this._readableState) {
4362 return;
4363 }
4364
4365 // backward compatibility, the user is explicitly
4366 // managing destroyed
4367 this._readableState.destroyed = value;
4368 }
4369});
4370
4371Readable.prototype.destroy = destroyImpl.destroy;
4372Readable.prototype._undestroy = destroyImpl.undestroy;
4373Readable.prototype._destroy = function (err, cb) {
4374 this.push(null);
4375 cb(err);
4376};
4377
4378// Manually shove something into the read() buffer.
4379// This returns true if the highWaterMark has not been hit yet,
4380// similar to how Writable.write() returns true if you should
4381// write() some more.
4382Readable.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// Unshift should *always* be something directly out of read()
4403Readable.prototype.unshift = function (chunk) {
4404 return readableAddChunk(this, chunk, null, true, false);
4405};
4406
4407function 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
4443function 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 // update the buffer info.
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
4457function 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// if it's past the high water mark, we can push in some more.
4466// Also, if we have no data yet, we can stand some
4467// more bytes. This is to work around cases where hwm=0,
4468// such as the repl. Also, if the push() triggered a
4469// readable event, and the user called read(largeNumber) such that
4470// needReadable was set, then we ought to push more, so that another
4471// 'readable' event will be triggered.
4472function needMoreData(state) {
4473 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
4474}
4475
4476Readable.prototype.isPaused = function () {
4477 return this._readableState.flowing === false;
4478};
4479
4480// backwards compatibility.
4481Readable.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// Don't raise the hwm > 8MB
4489var MAX_HWM = 0x800000;
4490function computeNewHighWaterMark(n) {
4491 if (n >= MAX_HWM) {
4492 n = MAX_HWM;
4493 } else {
4494 // Get the next highest power of 2 to prevent increasing hwm excessively in
4495 // tiny amounts
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// This function is designed to be inlinable, so please take care when making
4508// changes to the function body.
4509function 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 // Only flow one buffer at a time
4514 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
4515 }
4516 // If we're asking for more than the current hwm, then raise the hwm.
4517 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
4518 if (n <= state.length) return n;
4519 // Don't have enough
4520 if (!state.ended) {
4521 state.needReadable = true;
4522 return 0;
4523 }
4524 return state.length;
4525}
4526
4527// you can override either this method, or the async _read(n) below.
4528Readable.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 // if we're doing read(0) to trigger a readable event, but we
4537 // already have a bunch of data in the buffer, then just trigger
4538 // the 'readable' event and move on.
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 // if we've ended, and we're now clear, then finish it up.
4548 if (n === 0 && state.ended) {
4549 if (state.length === 0) endReadable(this);
4550 return null;
4551 }
4552
4553 // All the actual chunk generation logic needs to be
4554 // *below* the call to _read. The reason is that in certain
4555 // synthetic stream cases, such as passthrough streams, _read
4556 // may be a completely synchronous operation which may change
4557 // the state of the read buffer, providing enough data when
4558 // before there was *not* enough.
4559 //
4560 // So, the steps are:
4561 // 1. Figure out what the state of things will be after we do
4562 // a read from the buffer.
4563 //
4564 // 2. If that resulting state will trigger a _read, then call _read.
4565 // Note that this may be asynchronous, or synchronous. Yes, it is
4566 // deeply ugly to write APIs this way, but that still doesn't mean
4567 // that the Readable class should behave improperly, as streams are
4568 // designed to be sync/async agnostic.
4569 // Take note if the _read call is sync or async (ie, if the read call
4570 // has returned yet), so that we know whether or not it's safe to emit
4571 // 'readable' etc.
4572 //
4573 // 3. Actually pull the requested chunks out of the buffer and return.
4574
4575 // if we need a readable event, then we need to do some reading.
4576 var doRead = state.needReadable;
4577 debug('need readable', doRead);
4578
4579 // if we currently have less than the highWaterMark, then also read some
4580 if (state.length === 0 || state.length - n < state.highWaterMark) {
4581 doRead = true;
4582 debug('length less than watermark', doRead);
4583 }
4584
4585 // however, if we've ended, then there's no point, and if we're already
4586 // reading, then it's unnecessary.
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 // if the length is currently zero, then we *need* a readable event.
4595 if (state.length === 0) state.needReadable = true;
4596 // call internal read method
4597 this._read(state.highWaterMark);
4598 state.sync = false;
4599 // If _read pushed data synchronously, then `reading` will be false,
4600 // and we need to re-evaluate how much data we can return to the user.
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 // If we have nothing in the buffer, then we want to know
4616 // as soon as we *do* get something into the buffer.
4617 if (!state.ended) state.needReadable = true;
4618
4619 // If we tried to read() past the EOF, then emit end on the next tick.
4620 if (nOrig !== n && state.ended) endReadable(this);
4621 }
4622
4623 if (ret !== null) this.emit('data', ret);
4624
4625 return ret;
4626};
4627
4628function 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 // emit 'readable' now to make sure it gets picked up.
4640 emitReadable(stream);
4641}
4642
4643// Don't emit readable right away in sync mode, because this can trigger
4644// another read() call => stack overflow. This way, it might trigger
4645// a nextTick recursion warning, but that's not so bad.
4646function 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
4656function emitReadable_(stream) {
4657 debug('emit readable');
4658 stream.emit('readable');
4659 flow(stream);
4660}
4661
4662// at this point, the user has presumably seen the 'readable' event,
4663// and called read() to consume some data. that may have triggered
4664// in turn another _read(n) call, in which case reading = true if
4665// it's in progress.
4666// However, if we're not ended, or reading, and the length < hwm,
4667// then go ahead and try to read some more preemptively.
4668function maybeReadMore(stream, state) {
4669 if (!state.readingMore) {
4670 state.readingMore = true;
4671 pna.nextTick(maybeReadMore_, stream, state);
4672 }
4673}
4674
4675function 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 // didn't get any data, stop spinning.
4682 break;else len = state.length;
4683 }
4684 state.readingMore = false;
4685}
4686
4687// abstract method. to be overridden in specific implementation classes.
4688// call cb(er, data) where data is <= n in length.
4689// for virtual (non-string, non-buffer) streams, "length" is somewhat
4690// arbitrary, and perhaps not very meaningful.
4691Readable.prototype._read = function (n) {
4692 this.emit('error', new Error('_read() is not implemented'));
4693};
4694
4695Readable.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 // when the dest drains, it reduces the awaitDrain counter
4735 // on the source. This would be more elegant with a .once()
4736 // handler in flow(), but adding and removing repeatedly is
4737 // too slow.
4738 var ondrain = pipeOnDrain(src);
4739 dest.on('drain', ondrain);
4740
4741 var cleanedUp = false;
4742 function cleanup() {
4743 debug('cleanup');
4744 // cleanup event handlers once the pipe is broken
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 // if the reader is waiting for a drain event from this
4757 // specific writer, then it would cause it to never start
4758 // flowing again.
4759 // So, if this is awaiting a drain, then we just call it now.
4760 // If we don't know, then assume that we are waiting for one.
4761 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
4762 }
4763
4764 // If the user pushes more data while we're writing to dest then we'll end up
4765 // in ondata again. However, we only want to increase awaitDrain once because
4766 // dest will only emit one 'drain' event for the multiple writes.
4767 // => Introduce a guard on increasing awaitDrain.
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 // If the user unpiped during `dest.write()`, it is possible
4776 // to get stuck in a permanently paused state if that write
4777 // also returned false.
4778 // => Check whether `dest` is still a piping destination.
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 // if the dest has an error, then stop piping into it.
4789 // however, don't suppress the throwing behavior for this.
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 // Make sure our error handler is attached before userland ones.
4798 prependListener(dest, 'error', onerror);
4799
4800 // Both close and finish should trigger unpipe, but only once.
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 // tell the dest that it's being piped to
4819 dest.emit('pipe', src);
4820
4821 // start the flow if it hasn't been started already.
4822 if (!state.flowing) {
4823 debug('pipe resume');
4824 src.resume();
4825 }
4826
4827 return dest;
4828};
4829
4830function 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
4842Readable.prototype.unpipe = function (dest) {
4843 var state = this._readableState;
4844 var unpipeInfo = { hasUnpiped: false };
4845
4846 // if we're not piping anywhere, then do nothing.
4847 if (state.pipesCount === 0) return this;
4848
4849 // just one destination. most common case.
4850 if (state.pipesCount === 1) {
4851 // passed in one, but it's not the right one.
4852 if (dest && dest !== state.pipes) return this;
4853
4854 if (!dest) dest = state.pipes;
4855
4856 // got a match.
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 // slow case. multiple pipe destinations.
4865
4866 if (!dest) {
4867 // remove all.
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 // try to find the right one.
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// set up data events if they are asked for
4893// Ensure readable listeners eventually get something
4894Readable.prototype.on = function (ev, fn) {
4895 var res = Stream.prototype.on.call(this, ev, fn);
4896
4897 if (ev === 'data') {
4898 // Start flowing on next tick if stream isn't explicitly paused
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};
4915Readable.prototype.addListener = Readable.prototype.on;
4916
4917function nReadingNextTick(self) {
4918 debug('readable nexttick read 0');
4919 self.read(0);
4920}
4921
4922// pause() and resume() are remnants of the legacy readable stream API
4923// If the user uses them, then switch into old mode.
4924Readable.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
4934function resume(stream, state) {
4935 if (!state.resumeScheduled) {
4936 state.resumeScheduled = true;
4937 pna.nextTick(resume_, stream, state);
4938 }
4939}
4940
4941function 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
4954Readable.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
4964function flow(stream) {
4965 var state = stream._readableState;
4966 debug('flow', state.flowing);
4967 while (state.flowing && stream.read() !== null) {}
4968}
4969
4970// wrap an old-style stream as the async data source.
4971// This is *not* part of the readable stream interface.
4972// It is an ugly unfortunate mess of history.
4973Readable.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 // don't skip over falsy values in objectMode
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 // proxy all the other methods.
5004 // important when wrapping filters and duplexes.
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 // proxy certain important events.
5016 for (var n = 0; n < kProxyEvents.length; n++) {
5017 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
5018 }
5019
5020 // when we try to consume some more bytes, simply unpause the
5021 // underlying stream.
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
5033Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
5034 // making it explicit this property is not enumerable
5035 // because otherwise some prototype manipulation in
5036 // userland will fail
5037 enumerable: false,
5038 get: function () {
5039 return this._readableState.highWaterMark;
5040 }
5041});
5042
5043// exposed for testing purposes only.
5044Readable._fromList = fromList;
5045
5046// Pluck off n bytes from an array of buffers.
5047// Length is the combined lengths of all the buffers in the list.
5048// This function is designed to be inlinable, so please take care when making
5049// changes to the function body.
5050function fromList(n, state) {
5051 // nothing buffered
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 // read it all, truncate the list
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 // read part of list
5061 ret = fromListPartial(n, state.buffer, state.decoder);
5062 }
5063
5064 return ret;
5065}
5066
5067// Extracts only enough buffered data to satisfy the amount requested.
5068// This function is designed to be inlinable, so please take care when making
5069// changes to the function body.
5070function fromListPartial(n, list, hasStrings) {
5071 var ret;
5072 if (n < list.head.data.length) {
5073 // slice is the same for buffers and strings
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 // first chunk is a perfect match
5078 ret = list.shift();
5079 } else {
5080 // result spans more than one buffer
5081 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
5082 }
5083 return ret;
5084}
5085
5086// Copies a specified amount of characters from the list of buffered data
5087// chunks.
5088// This function is designed to be inlinable, so please take care when making
5089// changes to the function body.
5090function 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// Copies a specified amount of bytes from the list of buffered data chunks.
5117// This function is designed to be inlinable, so please take care when making
5118// changes to the function body.
5119function 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
5146function endReadable(stream) {
5147 var state = stream._readableState;
5148
5149 // If we get here before consuming all the bytes, then that is a
5150 // bug in node. Should never happen.
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
5159function endReadableNT(state, stream) {
5160 // Check that we didn't get one last unshift.
5161 if (!state.endEmitted && state.length === 0) {
5162 state.endEmitted = true;
5163 stream.readable = false;
5164 stream.emit('end');
5165 }
5166}
5167
5168function 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/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1)))
5175
5176/***/ }),
5177/* 16 */
5178/***/ (function(module, exports, __webpack_require__) {
5179
5180module.exports = __webpack_require__(9).EventEmitter;
5181
5182
5183/***/ }),
5184/* 17 */
5185/***/ (function(module, exports, __webpack_require__) {
5186
5187"use strict";
5188
5189
5190/*<replacement>*/
5191
5192var pna = __webpack_require__(6);
5193/*</replacement>*/
5194
5195// undocumented cb() API, needed for core, not for public API
5196function 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 // we set destroyed to true before firing error callbacks in order
5212 // to make it re-entrance safe in case destroy() is called within callbacks
5213
5214 if (this._readableState) {
5215 this._readableState.destroyed = true;
5216 }
5217
5218 // if this is a duplex stream mark the writable part as destroyed as well
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
5237function 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
5254function emitErrorNT(self, err) {
5255 self.emit('error', err);
5256}
5257
5258module.exports = {
5259 destroy: destroy,
5260 undestroy: undestroy
5261};
5262
5263/***/ }),
5264/* 18 */
5265/***/ (function(module, exports, __webpack_require__) {
5266
5267"use strict";
5268/* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// Copyright Joyent, Inc. and other Node contributors.
5269//
5270// Permission is hereby granted, free of charge, to any person obtaining a
5271// copy of this software and associated documentation files (the
5272// "Software"), to deal in the Software without restriction, including
5273// without limitation the rights to use, copy, modify, merge, publish,
5274// distribute, sublicense, and/or sell copies of the Software, and to permit
5275// persons to whom the Software is furnished to do so, subject to the
5276// following conditions:
5277//
5278// The above copyright notice and this permission notice shall be included
5279// in all copies or substantial portions of the Software.
5280//
5281// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
5282// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
5283// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
5284// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
5285// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
5286// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
5287// USE OR OTHER DEALINGS IN THE SOFTWARE.
5288
5289// A bit simpler than readable streams.
5290// Implement an async ._write(chunk, encoding, cb), and it'll handle all
5291// the drain event emission and buffering.
5292
5293
5294
5295/*<replacement>*/
5296
5297var pna = __webpack_require__(6);
5298/*</replacement>*/
5299
5300module.exports = Writable;
5301
5302/* <replacement> */
5303function WriteReq(chunk, encoding, cb) {
5304 this.chunk = chunk;
5305 this.encoding = encoding;
5306 this.callback = cb;
5307 this.next = null;
5308}
5309
5310// It seems a linked list but it is not
5311// there will be only 2 of these for each stream
5312function 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/* </replacement> */
5322
5323/*<replacement>*/
5324var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
5325/*</replacement>*/
5326
5327/*<replacement>*/
5328var Duplex;
5329/*</replacement>*/
5330
5331Writable.WritableState = WritableState;
5332
5333/*<replacement>*/
5334var util = Object.create(__webpack_require__(5));
5335util.inherits = __webpack_require__(2);
5336/*</replacement>*/
5337
5338/*<replacement>*/
5339var internalUtil = {
5340 deprecate: __webpack_require__(38)
5341};
5342/*</replacement>*/
5343
5344/*<replacement>*/
5345var Stream = __webpack_require__(16);
5346/*</replacement>*/
5347
5348/*<replacement>*/
5349
5350var Buffer = __webpack_require__(7).Buffer;
5351var OurUint8Array = global.Uint8Array || function () {};
5352function _uint8ArrayToBuffer(chunk) {
5353 return Buffer.from(chunk);
5354}
5355function _isUint8Array(obj) {
5356 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
5357}
5358
5359/*</replacement>*/
5360
5361var destroyImpl = __webpack_require__(17);
5362
5363util.inherits(Writable, Stream);
5364
5365function nop() {}
5366
5367function WritableState(options, stream) {
5368 Duplex = Duplex || __webpack_require__(4);
5369
5370 options = options || {};
5371
5372 // Duplex streams are both readable and writable, but share
5373 // the same options object.
5374 // However, some cases require setting options to different
5375 // values for the readable and the writable sides of the duplex stream.
5376 // These options can be provided separately as readableXXX and writableXXX.
5377 var isDuplex = stream instanceof Duplex;
5378
5379 // object stream flag to indicate whether or not this stream
5380 // contains buffers or objects.
5381 this.objectMode = !!options.objectMode;
5382
5383 if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
5384
5385 // the point at which write() starts returning false
5386 // Note: 0 is a valid value, means that we always return false if
5387 // the entire buffer is not flushed immediately on write()
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 // cast to ints.
5395 this.highWaterMark = Math.floor(this.highWaterMark);
5396
5397 // if _final has been called
5398 this.finalCalled = false;
5399
5400 // drain event flag.
5401 this.needDrain = false;
5402 // at the start of calling end()
5403 this.ending = false;
5404 // when end() has been called, and returned
5405 this.ended = false;
5406 // when 'finish' is emitted
5407 this.finished = false;
5408
5409 // has it been destroyed
5410 this.destroyed = false;
5411
5412 // should we decode strings into buffers before passing to _write?
5413 // this is here so that some node-core streams can optimize string
5414 // handling at a lower level.
5415 var noDecode = options.decodeStrings === false;
5416 this.decodeStrings = !noDecode;
5417
5418 // Crypto is kind of old and crusty. Historically, its default string
5419 // encoding is 'binary' so we have to make this configurable.
5420 // Everything else in the universe uses 'utf8', though.
5421 this.defaultEncoding = options.defaultEncoding || 'utf8';
5422
5423 // not an actual buffer we keep track of, but a measurement
5424 // of how much we're waiting to get pushed to some underlying
5425 // socket or file.
5426 this.length = 0;
5427
5428 // a flag to see when we're in the middle of a write.
5429 this.writing = false;
5430
5431 // when true all writes will be buffered until .uncork() call
5432 this.corked = 0;
5433
5434 // a flag to be able to tell if the onwrite cb is called immediately,
5435 // or on a later tick. We set this to true at first, because any
5436 // actions that shouldn't happen until "later" should generally also
5437 // not happen before the first write call.
5438 this.sync = true;
5439
5440 // a flag to know if we're processing previously buffered items, which
5441 // may call the _write() callback in the same tick, so that we don't
5442 // end up in an overlapped onwrite situation.
5443 this.bufferProcessing = false;
5444
5445 // the callback that's passed to _write(chunk,cb)
5446 this.onwrite = function (er) {
5447 onwrite(stream, er);
5448 };
5449
5450 // the callback that the user supplies to write(chunk,encoding,cb)
5451 this.writecb = null;
5452
5453 // the amount that is being written when _write is called.
5454 this.writelen = 0;
5455
5456 this.bufferedRequest = null;
5457 this.lastBufferedRequest = null;
5458
5459 // number of pending user-supplied write callbacks
5460 // this must be 0 before 'finish' can be emitted
5461 this.pendingcb = 0;
5462
5463 // emit prefinish if the only thing we're waiting for is _write cbs
5464 // This is relevant for synchronous Transform streams
5465 this.prefinished = false;
5466
5467 // True if the error was already emitted and should not be thrown again
5468 this.errorEmitted = false;
5469
5470 // count buffered requests
5471 this.bufferedRequestCount = 0;
5472
5473 // allocate the first CorkedRequest, there is always
5474 // one allocated and free to use, and we maintain at most two
5475 this.corkedRequestsFree = new CorkedRequest(this);
5476}
5477
5478WritableState.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// Test _writableState for inheritance to account for Duplex streams,
5499// whose prototype chain only points to Readable.
5500var realHasInstance;
5501if (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
5517function Writable(options) {
5518 Duplex = Duplex || __webpack_require__(4);
5519
5520 // Writable ctor is applied to Duplexes, too.
5521 // `realHasInstance` is necessary because using plain `instanceof`
5522 // would return false, as no `_writableState` property is attached.
5523
5524 // Trying to use the custom `instanceof` for Writable here will also break the
5525 // Node.js LazyTransform implementation, which has a non-trivial getter for
5526 // `_writableState` that would lead to infinite recursion.
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 // legacy.
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// Otherwise people can pipe Writable streams, which is just wrong.
5550Writable.prototype.pipe = function () {
5551 this.emit('error', new Error('Cannot pipe, not readable'));
5552};
5553
5554function writeAfterEnd(stream, cb) {
5555 var er = new Error('write after end');
5556 // TODO: defer error events consistently everywhere, not just the cb
5557 stream.emit('error', er);
5558 pna.nextTick(cb, er);
5559}
5560
5561// Checks that a user-supplied chunk is valid, especially for the particular
5562// mode the stream is in. Currently this means that `null` is never accepted
5563// and undefined/non-string values are only allowed in object mode.
5564function 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
5581Writable.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
5607Writable.prototype.cork = function () {
5608 var state = this._writableState;
5609
5610 state.corked++;
5611};
5612
5613Writable.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
5623Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
5624 // node::ParseEncoding() requires lower case.
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
5631function 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
5638Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
5639 // making it explicit this property is not enumerable
5640 // because otherwise some prototype manipulation in
5641 // userland will fail
5642 enumerable: false,
5643 get: function () {
5644 return this._writableState.highWaterMark;
5645 }
5646});
5647
5648// if we're already writing something, then just put this
5649// in the queue, and wait our turn. Otherwise, call _write
5650// If we return false, then we need a drain event, so set that flag.
5651function 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 // we must ensure that previous needDrain will not be reset to false.
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
5690function 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
5699function onwriteError(stream, state, sync, er, cb) {
5700 --state.pendingcb;
5701
5702 if (sync) {
5703 // defer the callback if we are being called synchronously
5704 // to avoid piling up things on the stack
5705 pna.nextTick(cb, er);
5706 // this can emit finish, and it will always happen
5707 // after error
5708 pna.nextTick(finishMaybe, stream, state);
5709 stream._writableState.errorEmitted = true;
5710 stream.emit('error', er);
5711 } else {
5712 // the caller expect this to happen before if
5713 // it is async
5714 cb(er);
5715 stream._writableState.errorEmitted = true;
5716 stream.emit('error', er);
5717 // this can emit finish, but finish must
5718 // always follow error
5719 finishMaybe(stream, state);
5720 }
5721}
5722
5723function onwriteStateUpdate(state) {
5724 state.writing = false;
5725 state.writecb = null;
5726 state.length -= state.writelen;
5727 state.writelen = 0;
5728}
5729
5730function 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 // Check if we're actually ready to finish, but don't emit yet
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 /*<replacement>*/
5747 asyncWrite(afterWrite, stream, state, finished, cb);
5748 /*</replacement>*/
5749 } else {
5750 afterWrite(stream, state, finished, cb);
5751 }
5752 }
5753}
5754
5755function afterWrite(stream, state, finished, cb) {
5756 if (!finished) onwriteDrain(stream, state);
5757 state.pendingcb--;
5758 cb();
5759 finishMaybe(stream, state);
5760}
5761
5762// Must force callback to be called on nextTick, so that we don't
5763// emit 'drain' before the write() consumer gets the 'false' return
5764// value, and has a chance to attach a 'drain' listener.
5765function onwriteDrain(stream, state) {
5766 if (state.length === 0 && state.needDrain) {
5767 state.needDrain = false;
5768 stream.emit('drain');
5769 }
5770}
5771
5772// if there's something in the buffer waiting, then process it
5773function clearBuffer(stream, state) {
5774 state.bufferProcessing = true;
5775 var entry = state.bufferedRequest;
5776
5777 if (stream._writev && entry && entry.next) {
5778 // Fast case, write everything using _writev()
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 // doWrite is almost always async, defer these to save a bit of time
5797 // as the hot path ends with doWrite
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 // Slow case, write chunks one-by-one
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 // if we didn't call the onwrite immediately, then
5819 // it means that we need to wait until it does.
5820 // also, that means that the chunk and cb are currently
5821 // being processed, so move the buffer counter past them.
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
5834Writable.prototype._write = function (chunk, encoding, cb) {
5835 cb(new Error('_write() is not implemented'));
5836};
5837
5838Writable.prototype._writev = null;
5839
5840Writable.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 // .end() fully uncorks
5855 if (state.corked) {
5856 state.corked = 1;
5857 this.uncork();
5858 }
5859
5860 // ignore unnecessary end() calls.
5861 if (!state.ending && !state.finished) endWritable(this, state, cb);
5862};
5863
5864function needFinish(state) {
5865 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
5866}
5867function 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}
5878function 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
5891function 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
5903function 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
5913function 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
5929Object.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 // we ignore the value if the stream
5938 // has not been initialized yet
5939 if (!this._writableState) {
5940 return;
5941 }
5942
5943 // backward compatibility, the user is explicitly
5944 // managing destroyed
5945 this._writableState.destroyed = value;
5946 }
5947});
5948
5949Writable.prototype.destroy = destroyImpl.destroy;
5950Writable.prototype._undestroy = destroyImpl.undestroy;
5951Writable.prototype._destroy = function (err, cb) {
5952 this.end();
5953 cb(err);
5954};
5955/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(36).setImmediate, __webpack_require__(0)))
5956
5957/***/ }),
5958/* 19 */
5959/***/ (function(module, exports, __webpack_require__) {
5960
5961"use strict";
5962// Copyright Joyent, Inc. and other Node contributors.
5963//
5964// Permission is hereby granted, free of charge, to any person obtaining a
5965// copy of this software and associated documentation files (the
5966// "Software"), to deal in the Software without restriction, including
5967// without limitation the rights to use, copy, modify, merge, publish,
5968// distribute, sublicense, and/or sell copies of the Software, and to permit
5969// persons to whom the Software is furnished to do so, subject to the
5970// following conditions:
5971//
5972// The above copyright notice and this permission notice shall be included
5973// in all copies or substantial portions of the Software.
5974//
5975// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
5976// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
5977// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
5978// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
5979// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
5980// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
5981// USE OR OTHER DEALINGS IN THE SOFTWARE.
5982
5983
5984
5985/*<replacement>*/
5986
5987var Buffer = __webpack_require__(7).Buffer;
5988/*</replacement>*/
5989
5990var 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
6000function _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; // undefined
6022 enc = ('' + enc).toLowerCase();
6023 retried = true;
6024 }
6025 }
6026};
6027
6028// Do not cache `Buffer.isEncoding` when checking encoding names as some
6029// modules monkey-patch it to support additional encodings
6030function 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// StringDecoder provides an interface for efficiently splitting a series of
6037// buffers into a series of JS strings without breaking apart multi-byte
6038// characters.
6039exports.StringDecoder = StringDecoder;
6040function 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
6068StringDecoder.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
6084StringDecoder.prototype.end = utf8End;
6085
6086// Returns only complete characters in a Buffer
6087StringDecoder.prototype.text = utf8Text;
6088
6089// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
6090StringDecoder.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// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
6100// continuation byte. If an invalid byte is detected, -2 is returned.
6101function 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// Checks at most 3 bytes at the end of a Buffer in order to detect an
6107// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
6108// needed to complete the UTF-8 character (if applicable) are returned.
6109function 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// Validates as many continuation bytes for a multi-byte UTF-8 character as
6135// needed or are available. If we see a non-continuation byte where we expect
6136// one, we "replace" the validated continuation bytes we've seen so far with
6137// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
6138// behavior. The continuation byte check is included three times in the case
6139// where all of the continuation bytes for a character exist in the same buffer.
6140// It is also done this way as a slight performance increase instead of using a
6141// loop.
6142function 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// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
6162function 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// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
6175// partial character, the character's bytes are buffered until the required
6176// number of bytes are available.
6177function 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// For UTF-8, a replacement character is added when ending on a partial
6187// character.
6188function utf8End(buf) {
6189 var r = buf && buf.length ? this.write(buf) : '';
6190 if (this.lastNeed) return r + '\ufffd';
6191 return r;
6192}
6193
6194// UTF-16LE typically needs two bytes per character, but even if we have an even
6195// number of bytes available, we need to check if we end on a leading/high
6196// surrogate. In that case, we need to wait for the next two bytes in order to
6197// decode the last character properly.
6198function 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// For UTF-16LE we do not explicitly append special replacement characters if we
6220// end on a partial character, we simply let v8 handle that.
6221function 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
6230function 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
6244function 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// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
6251function simpleWrite(buf) {
6252 return buf.toString(this.encoding);
6253}
6254
6255function simpleEnd(buf) {
6256 return buf && buf.length ? this.write(buf) : '';
6257}
6258
6259/***/ }),
6260/* 20 */
6261/***/ (function(module, exports, __webpack_require__) {
6262
6263"use strict";
6264// Copyright Joyent, Inc. and other Node contributors.
6265//
6266// Permission is hereby granted, free of charge, to any person obtaining a
6267// copy of this software and associated documentation files (the
6268// "Software"), to deal in the Software without restriction, including
6269// without limitation the rights to use, copy, modify, merge, publish,
6270// distribute, sublicense, and/or sell copies of the Software, and to permit
6271// persons to whom the Software is furnished to do so, subject to the
6272// following conditions:
6273//
6274// The above copyright notice and this permission notice shall be included
6275// in all copies or substantial portions of the Software.
6276//
6277// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6278// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6279// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
6280// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
6281// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
6282// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
6283// USE OR OTHER DEALINGS IN THE SOFTWARE.
6284
6285// a transform stream is a readable/writable stream where you do
6286// something with the data. Sometimes it's called a "filter",
6287// but that's not a great name for it, since that implies a thing where
6288// some bits pass through, and others are simply ignored. (That would
6289// be a valid example of a transform, of course.)
6290//
6291// While the output is causally related to the input, it's not a
6292// necessarily symmetric or synchronous transformation. For example,
6293// a zlib stream might take multiple plain-text writes(), and then
6294// emit a single compressed chunk some time in the future.
6295//
6296// Here's how this works:
6297//
6298// The Transform stream has all the aspects of the readable and writable
6299// stream classes. When you write(chunk), that calls _write(chunk,cb)
6300// internally, and returns false if there's a lot of pending writes
6301// buffered up. When you call read(), that calls _read(n) until
6302// there's enough pending readable data buffered up.
6303//
6304// In a transform stream, the written data is placed in a buffer. When
6305// _read(n) is called, it transforms the queued up data, calling the
6306// buffered _write cb's as it consumes chunks. If consuming a single
6307// written chunk would result in multiple output chunks, then the first
6308// outputted bit calls the readcb, and subsequent chunks just go into
6309// the read buffer, and will cause it to emit 'readable' if necessary.
6310//
6311// This way, back-pressure is actually determined by the reading side,
6312// since _read has to be called to start processing a new chunk. However,
6313// a pathological inflate type of transform can cause excessive buffering
6314// here. For example, imagine a stream where every byte of input is
6315// interpreted as an integer from 0-255, and then results in that many
6316// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
6317// 1kb of data being output. In this case, you could write a very small
6318// amount of input, and end up with a very large amount of output. In
6319// such a pathological inflating mechanism, there'd be no way to tell
6320// the system to stop doing the transform. A single 4MB write could
6321// cause the system to run out of memory.
6322//
6323// However, even in such a pathological case, only a single written chunk
6324// would be consumed, and then the rest would wait (un-transformed) until
6325// the results of the previous transformed chunk were consumed.
6326
6327
6328
6329module.exports = Transform;
6330
6331var Duplex = __webpack_require__(4);
6332
6333/*<replacement>*/
6334var util = Object.create(__webpack_require__(5));
6335util.inherits = __webpack_require__(2);
6336/*</replacement>*/
6337
6338util.inherits(Transform, Duplex);
6339
6340function 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) // single equals check for both `null` and `undefined`
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
6365function 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 // start out asking for a readable event once data is transformed.
6380 this._readableState.needReadable = true;
6381
6382 // we have implemented the _read method, and done the other things
6383 // that Readable wants before the first _read call, so unset the
6384 // sync guard flag.
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 // When the writable side finishes, then flush out anything remaining.
6394 this.on('prefinish', prefinish);
6395}
6396
6397function 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
6409Transform.prototype.push = function (chunk, encoding) {
6410 this._transformState.needTransform = false;
6411 return Duplex.prototype.push.call(this, chunk, encoding);
6412};
6413
6414// This is the part where you do stuff!
6415// override this function in implementation classes.
6416// 'chunk' is an input chunk.
6417//
6418// Call `push(newChunk)` to pass along transformed output
6419// to the readable side. You may call 'push' zero or more times.
6420//
6421// Call `cb(err)` when you are done with this chunk. If you pass
6422// an error, then that'll put the hurt on the whole operation. If you
6423// never call cb(), then you'll never get another chunk.
6424Transform.prototype._transform = function (chunk, encoding, cb) {
6425 throw new Error('_transform() is not implemented');
6426};
6427
6428Transform.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// Doesn't matter what the args are here.
6440// _transform does all the work.
6441// That we got here means that the readable side wants more data.
6442Transform.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 // mark that we need a transform, so that any data that comes in
6450 // will get processed, now that we've asked for it.
6451 ts.needTransform = true;
6452 }
6453};
6454
6455Transform.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
6464function done(stream, er, data) {
6465 if (er) return stream.emit('error', er);
6466
6467 if (data != null) // single equals check for both `null` and `undefined`
6468 stream.push(data);
6469
6470 // if there's nothing in the write buffer, then that means
6471 // that nothing more will ever be provided
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/* 21 */
6481/***/ (function(module, exports, __webpack_require__) {
6482
6483var EventSource = __webpack_require__(22)
6484
6485if (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/* 22 */
6496/***/ (function(module, exports, __webpack_require__) {
6497
6498/* WEBPACK VAR INJECTION */(function(process, Buffer) {var parse = __webpack_require__(8).parse
6499var events = __webpack_require__(9)
6500var https = __webpack_require__(31)
6501var http = __webpack_require__(11)
6502var util = __webpack_require__(43)
6503
6504var httpsOptions = [
6505 'pfx', 'key', 'passphrase', 'cert', 'ca', 'ciphers',
6506 'rejectUnauthorized', 'secureProtocol', 'servername', 'checkServerIdentity'
6507]
6508
6509var bom = [239, 187, 191]
6510var colon = 58
6511var space = 32
6512var lineFeed = 10
6513var carriageReturn = 13
6514// Beyond 256KB we could not observe any gain in performance
6515var maxBufferAheadAllocation = 1024 * 256
6516// Headers matching the pattern should be removed when redirecting to different origin
6517var reUnsafeHeader = /^(cookie|authorization)$/i
6518
6519function hasBom (buf) {
6520 return bom.every(function (charCode, index) {
6521 return buf[index] === charCode
6522 })
6523}
6524
6525/**
6526 * Creates a new EventSource object
6527 *
6528 * @param {String} url the URL to which to connect
6529 * @param {Object} [eventSourceInitDict] extra init params. See README for details.
6530 * @api public
6531 **/
6532function 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 // The url may have been changed by a temporary redirect. If that's the case,
6558 // revert it now, and flag that we are no longer pointing to a new origin
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 // Legacy: this should be specified as `eventSourceInitDict.https.rejectUnauthorized`,
6602 // but for now exists as a backwards-compatibility layer
6603 options.rejectUnauthorized = !(eventSourceInitDict && !eventSourceInitDict.rejectUnauthorized)
6604
6605 if (eventSourceInitDict && eventSourceInitDict.createConnection !== undefined) {
6606 options.createConnection = eventSourceInitDict.createConnection
6607 }
6608
6609 // If specify http proxy, make the request to sent to the proxy server,
6610 // and include the original url in path and Host headers
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 // If https options are specified, merge them into the request options
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 // Pass this on to the XHR
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 // Handle HTTP errors
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 // Handle HTTP redirects
6653 if (res.statusCode === 301 || res.statusCode === 302 || res.statusCode === 307) {
6654 var location = res.headers.location
6655 if (!location) {
6656 // Server sent redirect response without Location header.
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 // text/event-stream parser adapted from webkit's
6689 // Source/WebCore/page/EventSource.cpp
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), // remove trailing newline
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
6840module.exports = EventSource
6841
6842util.inherits(EventSource, events.EventEmitter)
6843EventSource.prototype.constructor = EventSource; // make stacktraces readable
6844
6845['open', 'error', 'message'].forEach(function (method) {
6846 Object.defineProperty(EventSource.prototype, 'on' + method, {
6847 /**
6848 * Returns the current listener
6849 *
6850 * @return {Mixed} the set function or undefined
6851 * @api private
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 * Start listening for events
6860 *
6861 * @param {Function} listener the listener
6862 * @return {Mixed} the set function or undefined
6863 * @api private
6864 */
6865 set: function set (listener) {
6866 this.removeAllListeners(method)
6867 this.addEventListener(method, listener)
6868 }
6869 })
6870})
6871
6872/**
6873 * Ready states
6874 */
6875Object.defineProperty(EventSource, 'CONNECTING', {enumerable: true, value: 0})
6876Object.defineProperty(EventSource, 'OPEN', {enumerable: true, value: 1})
6877Object.defineProperty(EventSource, 'CLOSED', {enumerable: true, value: 2})
6878
6879EventSource.prototype.CONNECTING = 0
6880EventSource.prototype.OPEN = 1
6881EventSource.prototype.CLOSED = 2
6882
6883/**
6884 * Closes the connection, if one is made, and sets the readyState attribute to 2 (closed)
6885 *
6886 * @see https://developer.mozilla.org/en-US/docs/Web/API/EventSource/close
6887 * @api public
6888 */
6889EventSource.prototype.close = function () {
6890 this._close()
6891}
6892
6893/**
6894 * Emulates the W3C Browser based WebSocket interface using addEventListener.
6895 *
6896 * @param {String} type A string representing the event type to listen out for
6897 * @param {Function} listener callback
6898 * @see https://developer.mozilla.org/en/DOM/element.addEventListener
6899 * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
6900 * @api public
6901 */
6902EventSource.prototype.addEventListener = function addEventListener (type, listener) {
6903 if (typeof listener === 'function') {
6904 // store a reference so we can return the original function again
6905 listener._listener = listener
6906 this.on(type, listener)
6907 }
6908}
6909
6910/**
6911 * Emulates the W3C Browser based WebSocket interface using dispatchEvent.
6912 *
6913 * @param {Event} event An event to be dispatched
6914 * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent
6915 * @api public
6916 */
6917EventSource.prototype.dispatchEvent = function dispatchEvent (event) {
6918 if (!event.type) {
6919 throw new Error('UNSPECIFIED_EVENT_TYPE_ERR')
6920 }
6921 // if event is instance of an CustomEvent (or has 'details' property),
6922 // send the detail object as the payload for the event
6923 this.emit(event.type, event.detail)
6924}
6925
6926/**
6927 * Emulates the W3C Browser based WebSocket interface using removeEventListener.
6928 *
6929 * @param {String} type A string representing the event type to remove
6930 * @param {Function} listener callback
6931 * @see https://developer.mozilla.org/en/DOM/element.removeEventListener
6932 * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
6933 * @api public
6934 */
6935EventSource.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 * W3C Event
6944 *
6945 * @see http://www.w3.org/TR/DOM-Level-3-Events/#interface-Event
6946 * @api private
6947 */
6948function 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 * W3C MessageEvent
6961 *
6962 * @see http://www.w3.org/TR/webmessaging/#event-definitions
6963 * @api private
6964 */
6965function 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 * Returns a new object of headers that does not include any authorization and cookie headers
6976 *
6977 * @param {Object} headers An object of headers ({[headerName]: headerValue})
6978 * @return {Object} a new object of headers
6979 * @api private
6980 */
6981function 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/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3).Buffer))
6995
6996/***/ }),
6997/* 23 */
6998/***/ (function(module, exports, __webpack_require__) {
6999
7000"use strict";
7001
7002
7003exports.byteLength = byteLength
7004exports.toByteArray = toByteArray
7005exports.fromByteArray = fromByteArray
7006
7007var lookup = []
7008var revLookup = []
7009var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
7010
7011var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
7012for (var i = 0, len = code.length; i < len; ++i) {
7013 lookup[i] = code[i]
7014 revLookup[code.charCodeAt(i)] = i
7015}
7016
7017// Support decoding URL-safe base64 strings, as Node.js does.
7018// See: https://en.wikipedia.org/wiki/Base64#URL_applications
7019revLookup['-'.charCodeAt(0)] = 62
7020revLookup['_'.charCodeAt(0)] = 63
7021
7022function 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 // Trim off extra bytes after placeholder bytes are found
7030 // See: https://github.com/beatgammit/base64-js/issues/42
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// base64 is 4/3 + up to two characters of the original data
7042function 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
7049function _byteLength (b64, validLen, placeHoldersLen) {
7050 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
7051}
7052
7053function 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 // if there are placeholders, only get up to the last complete 4 chars
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
7099function tripletToBase64 (num) {
7100 return lookup[num >> 18 & 0x3F] +
7101 lookup[num >> 12 & 0x3F] +
7102 lookup[num >> 6 & 0x3F] +
7103 lookup[num & 0x3F]
7104}
7105
7106function 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
7119function fromByteArray (uint8) {
7120 var tmp
7121 var len = uint8.length
7122 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
7123 var parts = []
7124 var maxChunkLength = 16383 // must be multiple of 3
7125
7126 // go through the array every three bytes, we'll deal with trailing stuff later
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 // pad the end with zeros, but make sure to not forget the extra bytes
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/* 24 */
7155/***/ (function(module, exports) {
7156
7157/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
7158exports.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
7191exports.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/* 25 */
7246/***/ (function(module, exports, __webpack_require__) {
7247
7248/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */
7249;(function(root) {
7250
7251 /** Detect free variables */
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 * The `punycode` object.
7267 * @name punycode
7268 * @type Object
7269 */
7270 var punycode,
7271
7272 /** Highest positive signed 32-bit float value */
7273 maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
7274
7275 /** Bootstring parameters */
7276 base = 36,
7277 tMin = 1,
7278 tMax = 26,
7279 skew = 38,
7280 damp = 700,
7281 initialBias = 72,
7282 initialN = 128, // 0x80
7283 delimiter = '-', // '\x2D'
7284
7285 /** Regular expressions */
7286 regexPunycode = /^xn--/,
7287 regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
7288 regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
7289
7290 /** Error messages */
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 /** Convenience shortcuts */
7298 baseMinusTMin = base - tMin,
7299 floor = Math.floor,
7300 stringFromCharCode = String.fromCharCode,
7301
7302 /** Temporary variable */
7303 key;
7304
7305 /*--------------------------------------------------------------------------*/
7306
7307 /**
7308 * A generic error utility function.
7309 * @private
7310 * @param {String} type The error type.
7311 * @returns {Error} Throws a `RangeError` with the applicable error message.
7312 */
7313 function error(type) {
7314 throw new RangeError(errors[type]);
7315 }
7316
7317 /**
7318 * A generic `Array#map` utility function.
7319 * @private
7320 * @param {Array} array The array to iterate over.
7321 * @param {Function} callback The function that gets called for every array
7322 * item.
7323 * @returns {Array} A new array of values returned by the callback function.
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 * A simple `Array#map`-like wrapper to work with domain name strings or email
7336 * addresses.
7337 * @private
7338 * @param {String} domain The domain name or email address.
7339 * @param {Function} callback The function that gets called for every
7340 * character.
7341 * @returns {Array} A new string of characters returned by the callback
7342 * function.
7343 */
7344 function mapDomain(string, fn) {
7345 var parts = string.split('@');
7346 var result = '';
7347 if (parts.length > 1) {
7348 // In email addresses, only the domain name should be punycoded. Leave
7349 // the local part (i.e. everything up to `@`) intact.
7350 result = parts[0] + '@';
7351 string = parts[1];
7352 }
7353 // Avoid `split(regex)` for IE8 compatibility. See #17.
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 * Creates an array containing the numeric code points of each Unicode
7362 * character in the string. While JavaScript uses UCS-2 internally,
7363 * this function will convert a pair of surrogate halves (each of which
7364 * UCS-2 exposes as separate characters) into a single code point,
7365 * matching UTF-16.
7366 * @see `punycode.ucs2.encode`
7367 * @see <https://mathiasbynens.be/notes/javascript-encoding>
7368 * @memberOf punycode.ucs2
7369 * @name decode
7370 * @param {String} string The Unicode input string (UCS-2).
7371 * @returns {Array} The new array of code points.
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 // high surrogate, and there is a next character
7383 extra = string.charCodeAt(counter++);
7384 if ((extra & 0xFC00) == 0xDC00) { // low surrogate
7385 output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
7386 } else {
7387 // unmatched surrogate; only append this code unit, in case the next
7388 // code unit is the high surrogate of a surrogate pair
7389 output.push(value);
7390 counter--;
7391 }
7392 } else {
7393 output.push(value);
7394 }
7395 }
7396 return output;
7397 }
7398
7399 /**
7400 * Creates a string based on an array of numeric code points.
7401 * @see `punycode.ucs2.decode`
7402 * @memberOf punycode.ucs2
7403 * @name encode
7404 * @param {Array} codePoints The array of numeric code points.
7405 * @returns {String} The new Unicode string (UCS-2).
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 * Converts a basic code point into a digit/integer.
7422 * @see `digitToBasic()`
7423 * @private
7424 * @param {Number} codePoint The basic numeric code point value.
7425 * @returns {Number} The numeric value of a basic code point (for use in
7426 * representing integers) in the range `0` to `base - 1`, or `base` if
7427 * the code point does not represent a value.
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 * Converts a digit/integer into a basic code point.
7444 * @see `basicToDigit()`
7445 * @private
7446 * @param {Number} digit The numeric value of a basic code point.
7447 * @returns {Number} The basic code point whose value (when used for
7448 * representing integers) is `digit`, which needs to be in the range
7449 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
7450 * used; else, the lowercase form is used. The behavior is undefined
7451 * if `flag` is non-zero and `digit` has no uppercase form.
7452 */
7453 function digitToBasic(digit, flag) {
7454 // 0..25 map to ASCII a..z or A..Z
7455 // 26..35 map to ASCII 0..9
7456 return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
7457 }
7458
7459 /**
7460 * Bias adaptation function as per section 3.4 of RFC 3492.
7461 * https://tools.ietf.org/html/rfc3492#section-3.4
7462 * @private
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 (/* no initialization */; 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 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
7476 * symbols.
7477 * @memberOf punycode
7478 * @param {String} input The Punycode string of ASCII-only symbols.
7479 * @returns {String} The resulting string of Unicode symbols.
7480 */
7481 function decode(input) {
7482 // Don't use UCS-2
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 /** Cached calculation results */
7498 baseMinusT;
7499
7500 // Handle the basic code points: let `basic` be the number of input code
7501 // points before the last delimiter, or `0` if there is none, then copy
7502 // the first basic code points to the output.
7503
7504 basic = input.lastIndexOf(delimiter);
7505 if (basic < 0) {
7506 basic = 0;
7507 }
7508
7509 for (j = 0; j < basic; ++j) {
7510 // if it's not a basic code point
7511 if (input.charCodeAt(j) >= 0x80) {
7512 error('not-basic');
7513 }
7514 output.push(input.charCodeAt(j));
7515 }
7516
7517 // Main decoding loop: start just after the last delimiter if any basic code
7518 // points were copied; start at the beginning otherwise.
7519
7520 for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
7521
7522 // `index` is the index of the next character to be consumed.
7523 // Decode a generalized variable-length integer into `delta`,
7524 // which gets added to `i`. The overflow checking is easier
7525 // if we increase `i` as we go, then subtract off its starting
7526 // value at the end to obtain `delta`.
7527 for (oldi = i, w = 1, k = base; /* no condition */; 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 // `i` was supposed to wrap around from `out` to `0`,
7559 // incrementing `n` each time, so we'll fix that now:
7560 if (floor(i / out) > maxInt - n) {
7561 error('overflow');
7562 }
7563
7564 n += floor(i / out);
7565 i %= out;
7566
7567 // Insert `n` at position `i` of the output
7568 output.splice(i++, 0, n);
7569
7570 }
7571
7572 return ucs2encode(output);
7573 }
7574
7575 /**
7576 * Converts a string of Unicode symbols (e.g. a domain name label) to a
7577 * Punycode string of ASCII-only symbols.
7578 * @memberOf punycode
7579 * @param {String} input The string of Unicode symbols.
7580 * @returns {String} The resulting Punycode string of ASCII-only symbols.
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 /** `inputLength` will hold the number of code points in `input`. */
7596 inputLength,
7597 /** Cached calculation results */
7598 handledCPCountPlusOne,
7599 baseMinusT,
7600 qMinusT;
7601
7602 // Convert the input in UCS-2 to Unicode
7603 input = ucs2decode(input);
7604
7605 // Cache the length
7606 inputLength = input.length;
7607
7608 // Initialize the state
7609 n = initialN;
7610 delta = 0;
7611 bias = initialBias;
7612
7613 // Handle the basic code points
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 // `handledCPCount` is the number of code points that have been handled;
7624 // `basicLength` is the number of basic code points.
7625
7626 // Finish the basic string - if it is not empty - with a delimiter
7627 if (basicLength) {
7628 output.push(delimiter);
7629 }
7630
7631 // Main encoding loop:
7632 while (handledCPCount < inputLength) {
7633
7634 // All non-basic code points < n have been handled already. Find the next
7635 // larger one:
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 // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
7644 // but guard against overflow
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 // Represent delta as a generalized variable-length integer
7662 for (q = delta, k = base; /* no condition */; 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 * Converts a Punycode string representing a domain name or an email address
7691 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
7692 * it doesn't matter if you call it on a string that has already been
7693 * converted to Unicode.
7694 * @memberOf punycode
7695 * @param {String} input The Punycoded domain name or email address to
7696 * convert to Unicode.
7697 * @returns {String} The Unicode representation of the given Punycode
7698 * string.
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 * Converts a Unicode string representing a domain name or an email address to
7710 * Punycode. Only the non-ASCII parts of the domain name will be converted,
7711 * i.e. it doesn't matter if you call it with a domain that's already in
7712 * ASCII.
7713 * @memberOf punycode
7714 * @param {String} input The domain name or email address to convert, as a
7715 * Unicode string.
7716 * @returns {String} The Punycode representation of the given domain name or
7717 * email address.
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 /** Define the public API */
7730 punycode = {
7731 /**
7732 * A string representing the current Punycode.js version number.
7733 * @memberOf punycode
7734 * @type String
7735 */
7736 'version': '1.4.1',
7737 /**
7738 * An object of methods to convert from JavaScript's internal character
7739 * representation (UCS-2) to Unicode code points, and back.
7740 * @see <https://mathiasbynens.be/notes/javascript-encoding>
7741 * @memberOf punycode
7742 * @type Object
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 /** Expose `punycode` */
7755 // Some AMD build optimizers, like r.js, check for specific condition patterns
7756 // like the following:
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 // in Node.js, io.js, or RingoJS v0.8.0+
7767 freeModule.exports = punycode;
7768 } else {
7769 // in Narwhal or RingoJS v0.7.0-
7770 for (key in punycode) {
7771 punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
7772 }
7773 }
7774 } else {
7775 // in Rhino or a web browser
7776 root.punycode = punycode;
7777 }
7778
7779}(this));
7780
7781/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(26)(module), __webpack_require__(0)))
7782
7783/***/ }),
7784/* 26 */
7785/***/ (function(module, exports) {
7786
7787module.exports = function(module) {
7788 if(!module.webpackPolyfill) {
7789 module.deprecate = function() {};
7790 module.paths = [];
7791 // module.parent = undefined by default
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/* 27 */
7813/***/ (function(module, exports, __webpack_require__) {
7814
7815"use strict";
7816
7817
7818module.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/* 28 */
7836/***/ (function(module, exports, __webpack_require__) {
7837
7838"use strict";
7839
7840
7841exports.decode = exports.parse = __webpack_require__(29);
7842exports.encode = exports.stringify = __webpack_require__(30);
7843
7844
7845/***/ }),
7846/* 29 */
7847/***/ (function(module, exports, __webpack_require__) {
7848
7849"use strict";
7850// Copyright Joyent, Inc. and other Node contributors.
7851//
7852// Permission is hereby granted, free of charge, to any person obtaining a
7853// copy of this software and associated documentation files (the
7854// "Software"), to deal in the Software without restriction, including
7855// without limitation the rights to use, copy, modify, merge, publish,
7856// distribute, sublicense, and/or sell copies of the Software, and to permit
7857// persons to whom the Software is furnished to do so, subject to the
7858// following conditions:
7859//
7860// The above copyright notice and this permission notice shall be included
7861// in all copies or substantial portions of the Software.
7862//
7863// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7864// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7865// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7866// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7867// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7868// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7869// USE OR OTHER DEALINGS IN THE SOFTWARE.
7870
7871
7872
7873// If obj.hasOwnProperty has been overridden, then calling
7874// obj.hasOwnProperty(prop) will break.
7875// See: https://github.com/joyent/node/issues/1707
7876function hasOwnProperty(obj, prop) {
7877 return Object.prototype.hasOwnProperty.call(obj, prop);
7878}
7879
7880module.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 // maxKeys <= 0 means that we should not limit keys count
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
7931var isArray = Array.isArray || function (xs) {
7932 return Object.prototype.toString.call(xs) === '[object Array]';
7933};
7934
7935
7936/***/ }),
7937/* 30 */
7938/***/ (function(module, exports, __webpack_require__) {
7939
7940"use strict";
7941// Copyright Joyent, Inc. and other Node contributors.
7942//
7943// Permission is hereby granted, free of charge, to any person obtaining a
7944// copy of this software and associated documentation files (the
7945// "Software"), to deal in the Software without restriction, including
7946// without limitation the rights to use, copy, modify, merge, publish,
7947// distribute, sublicense, and/or sell copies of the Software, and to permit
7948// persons to whom the Software is furnished to do so, subject to the
7949// following conditions:
7950//
7951// The above copyright notice and this permission notice shall be included
7952// in all copies or substantial portions of the Software.
7953//
7954// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7955// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7956// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7957// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7958// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7959// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7960// USE OR OTHER DEALINGS IN THE SOFTWARE.
7961
7962
7963
7964var 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
7980module.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
8006var isArray = Array.isArray || function (xs) {
8007 return Object.prototype.toString.call(xs) === '[object Array]';
8008};
8009
8010function 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
8019var 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/* 31 */
8030/***/ (function(module, exports, __webpack_require__) {
8031
8032var http = __webpack_require__(11)
8033var url = __webpack_require__(8)
8034
8035var https = module.exports
8036
8037for (var key in http) {
8038 if (http.hasOwnProperty(key)) https[key] = http[key]
8039}
8040
8041https.request = function (params, cb) {
8042 params = validateParams(params)
8043 return http.request.call(this, params, cb)
8044}
8045
8046https.get = function (params, cb) {
8047 params = validateParams(params)
8048 return http.get.call(this, params, cb)
8049}
8050
8051function 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/* 32 */
8067/***/ (function(module, exports, __webpack_require__) {
8068
8069/* WEBPACK VAR INJECTION */(function(Buffer, global, process) {var capability = __webpack_require__(12)
8070var inherits = __webpack_require__(2)
8071var response = __webpack_require__(13)
8072var stream = __webpack_require__(14)
8073var toArrayBuffer = __webpack_require__(40)
8074
8075var IncomingMessage = response.IncomingMessage
8076var rStates = response.readyStates
8077
8078function 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
8094var 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 // If the use of XHR should be preferred. Not typically needed.
8111 useFetch = false
8112 preferBinary = true
8113 } else if (opts.mode === 'prefer-streaming') {
8114 // If streaming is a high priority but binary compatibility and
8115 // the accuracy of the 'content-type' header aren't
8116 preferBinary = false
8117 } else if (opts.mode === 'allow-wrong-content-type') {
8118 // If streaming is more important than preserving the 'content-type' header
8119 preferBinary = !capability.overrideMimeType
8120 } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') {
8121 // Use binary if text streaming may corrupt data or the content-type header, or for speed
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
8134inherits(ClientRequest, stream.Writable)
8135
8136ClientRequest.prototype.setHeader = function (name, value) {
8137 var self = this
8138 var lowerName = name.toLowerCase()
8139 // This check is not necessary, but it prevents warnings from browsers about setting unsafe
8140 // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but
8141 // http-browserify did it, so I will too.
8142 if (unsafeHeaders.indexOf(lowerName) !== -1)
8143 return
8144
8145 self._headers[lowerName] = {
8146 name: name,
8147 value: value
8148 }
8149}
8150
8151ClientRequest.prototype.getHeader = function (name) {
8152 var header = this._headers[name.toLowerCase()]
8153 if (header)
8154 return header.value
8155 return null
8156}
8157
8158ClientRequest.prototype.removeHeader = function (name) {
8159 var self = this
8160 delete self._headers[name.toLowerCase()]
8161}
8162
8163ClientRequest.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 // get utf8 string
8183 body = Buffer.concat(self._body).toString()
8184 }
8185 }
8186
8187 // create flattened list of headers
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 // Can't set responseType on really old browsers
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 // Necessary for streaming in Firefox, since xhr.response is ONLY defined
8275 // in onprogress, not in onreadystatechange with xhr.readyState = 3
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 * Checks if xhr.status is readable and non-zero, indicating no error.
8301 * Even though the spec says it should be available in readyState 3,
8302 * accessing it throws an exception in IE8
8303 */
8304function statusValid (xhr) {
8305 try {
8306 var status = xhr.status
8307 return (status !== null && status !== 0)
8308 } catch (e) {
8309 return false
8310 }
8311}
8312
8313ClientRequest.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
8325ClientRequest.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
8339ClientRequest.prototype._write = function (chunk, encoding, cb) {
8340 var self = this
8341
8342 self._body.push(chunk)
8343 cb()
8344}
8345
8346ClientRequest.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
8358ClientRequest.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
8368ClientRequest.prototype.flushHeaders = function () {}
8369ClientRequest.prototype.setTimeout = function () {}
8370ClientRequest.prototype.setNoDelay = function () {}
8371ClientRequest.prototype.setSocketKeepAlive = function () {}
8372
8373// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method
8374var 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/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer, __webpack_require__(0), __webpack_require__(1)))
8398
8399/***/ }),
8400/* 33 */
8401/***/ (function(module, exports) {
8402
8403/* (ignored) */
8404
8405/***/ }),
8406/* 34 */
8407/***/ (function(module, exports, __webpack_require__) {
8408
8409"use strict";
8410
8411
8412function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8413
8414var Buffer = __webpack_require__(7).Buffer;
8415var util = __webpack_require__(35);
8416
8417function copyBuffer(src, target, offset) {
8418 src.copy(target, offset);
8419}
8420
8421module.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
8483if (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/* 35 */
8492/***/ (function(module, exports) {
8493
8494/* (ignored) */
8495
8496/***/ }),
8497/* 36 */
8498/***/ (function(module, exports, __webpack_require__) {
8499
8500/* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
8501 (typeof self !== "undefined" && self) ||
8502 window;
8503var apply = Function.prototype.apply;
8504
8505// DOM APIs, for completeness
8506
8507exports.setTimeout = function() {
8508 return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
8509};
8510exports.setInterval = function() {
8511 return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
8512};
8513exports.clearTimeout =
8514exports.clearInterval = function(timeout) {
8515 if (timeout) {
8516 timeout.close();
8517 }
8518};
8519
8520function Timeout(id, clearFn) {
8521 this._id = id;
8522 this._clearFn = clearFn;
8523}
8524Timeout.prototype.unref = Timeout.prototype.ref = function() {};
8525Timeout.prototype.close = function() {
8526 this._clearFn.call(scope, this._id);
8527};
8528
8529// Does not start the time, just sets up the members needed.
8530exports.enroll = function(item, msecs) {
8531 clearTimeout(item._idleTimeoutId);
8532 item._idleTimeout = msecs;
8533};
8534
8535exports.unenroll = function(item) {
8536 clearTimeout(item._idleTimeoutId);
8537 item._idleTimeout = -1;
8538};
8539
8540exports._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// setimmediate attaches itself to the global object
8553__webpack_require__(37);
8554// On some exotic environments, it's not clear which object `setimmediate` was
8555// able to install onto. Search each possibility in the same order as the
8556// `setimmediate` library.
8557exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
8558 (typeof global !== "undefined" && global.setImmediate) ||
8559 (this && this.setImmediate);
8560exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
8561 (typeof global !== "undefined" && global.clearImmediate) ||
8562 (this && this.clearImmediate);
8563
8564/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
8565
8566/***/ }),
8567/* 37 */
8568/***/ (function(module, exports, __webpack_require__) {
8569
8570/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
8571 "use strict";
8572
8573 if (global.setImmediate) {
8574 return;
8575 }
8576
8577 var nextHandle = 1; // Spec says greater than zero
8578 var tasksByHandle = {};
8579 var currentlyRunningATask = false;
8580 var doc = global.document;
8581 var registerImmediate;
8582
8583 function setImmediate(callback) {
8584 // Callback can either be a function or a string
8585 if (typeof callback !== "function") {
8586 callback = new Function("" + callback);
8587 }
8588 // Copy function arguments
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 // Store and register the task
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 // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
8628 // So if we're currently running a task, we'll need to delay this invocation.
8629 if (currentlyRunningATask) {
8630 // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
8631 // "too much recursion" error.
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 // The test against `importScripts` prevents this implementation from being installed inside a web worker,
8655 // where `global.postMessage` means something completely different and can't be used for this purpose.
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 // Installs an event handler on `global` for the `message` event: see
8670 // * https://developer.mozilla.org/en/DOM/window.postMessage
8671 // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
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 // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
8709 // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
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 // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
8728 var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
8729 attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
8730
8731 // Don't get fooled by e.g. browserify environments.
8732 if ({}.toString.call(global.process) === "[object process]") {
8733 // For Node.js before 0.9
8734 installNextTickImplementation();
8735
8736 } else if (canUsePostMessage()) {
8737 // For non-IE10 modern browsers
8738 installPostMessageImplementation();
8739
8740 } else if (global.MessageChannel) {
8741 // For web workers, where supported
8742 installMessageChannelImplementation();
8743
8744 } else if (doc && "onreadystatechange" in doc.createElement("script")) {
8745 // For IE 6–8
8746 installReadyStateChangeImplementation();
8747
8748 } else {
8749 // For older browsers
8750 installSetTimeoutImplementation();
8751 }
8752
8753 attachTo.setImmediate = setImmediate;
8754 attachTo.clearImmediate = clearImmediate;
8755}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
8756
8757/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1)))
8758
8759/***/ }),
8760/* 38 */
8761/***/ (function(module, exports, __webpack_require__) {
8762
8763/* WEBPACK VAR INJECTION */(function(global) {
8764/**
8765 * Module exports.
8766 */
8767
8768module.exports = deprecate;
8769
8770/**
8771 * Mark that a method should not be used.
8772 * Returns a modified function which warns once by default.
8773 *
8774 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
8775 *
8776 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
8777 * will throw an Error when invoked.
8778 *
8779 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
8780 * will invoke `console.trace()` instead of `console.error()`.
8781 *
8782 * @param {Function} fn - the function to deprecate
8783 * @param {String} msg - the string to print to the console when `fn` is invoked
8784 * @returns {Function} a new "deprecated" version of `fn`
8785 * @api public
8786 */
8787
8788function 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 * Checks `localStorage` for boolean values for the given `name`.
8813 *
8814 * @param {String} name
8815 * @returns {Boolean}
8816 * @api private
8817 */
8818
8819function config (name) {
8820 // accessing global.localStorage can trigger a DOMException in sandboxed iframes
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/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
8832
8833/***/ }),
8834/* 39 */
8835/***/ (function(module, exports, __webpack_require__) {
8836
8837"use strict";
8838// Copyright Joyent, Inc. and other Node contributors.
8839//
8840// Permission is hereby granted, free of charge, to any person obtaining a
8841// copy of this software and associated documentation files (the
8842// "Software"), to deal in the Software without restriction, including
8843// without limitation the rights to use, copy, modify, merge, publish,
8844// distribute, sublicense, and/or sell copies of the Software, and to permit
8845// persons to whom the Software is furnished to do so, subject to the
8846// following conditions:
8847//
8848// The above copyright notice and this permission notice shall be included
8849// in all copies or substantial portions of the Software.
8850//
8851// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8852// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8853// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8854// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8855// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8856// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8857// USE OR OTHER DEALINGS IN THE SOFTWARE.
8858
8859// a passthrough stream.
8860// basically just the most minimal sort of Transform stream.
8861// Every written chunk gets output as-is.
8862
8863
8864
8865module.exports = PassThrough;
8866
8867var Transform = __webpack_require__(20);
8868
8869/*<replacement>*/
8870var util = Object.create(__webpack_require__(5));
8871util.inherits = __webpack_require__(2);
8872/*</replacement>*/
8873
8874util.inherits(PassThrough, Transform);
8875
8876function PassThrough(options) {
8877 if (!(this instanceof PassThrough)) return new PassThrough(options);
8878
8879 Transform.call(this, options);
8880}
8881
8882PassThrough.prototype._transform = function (chunk, encoding, cb) {
8883 cb(null, chunk);
8884};
8885
8886/***/ }),
8887/* 40 */
8888/***/ (function(module, exports, __webpack_require__) {
8889
8890var Buffer = __webpack_require__(3).Buffer
8891
8892module.exports = function (buf) {
8893 // If the buffer is backed by a Uint8Array, a faster version will work
8894 if (buf instanceof Uint8Array) {
8895 // If the buffer isn't a subarray, return the underlying ArrayBuffer
8896 if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
8897 return buf.buffer
8898 } else if (typeof buf.buffer.slice === 'function') {
8899 // Otherwise we need to get a proper copy
8900 return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)
8901 }
8902 }
8903
8904 if (Buffer.isBuffer(buf)) {
8905 // This is the slow version that will work with any Buffer
8906 // implementation (even in old browsers)
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/* 41 */
8921/***/ (function(module, exports) {
8922
8923module.exports = extend
8924
8925var hasOwnProperty = Object.prototype.hasOwnProperty;
8926
8927function 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/* 42 */
8946/***/ (function(module, exports) {
8947
8948module.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/* 43 */
9016/***/ (function(module, exports, __webpack_require__) {
9017
9018/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.
9019//
9020// Permission is hereby granted, free of charge, to any person obtaining a
9021// copy of this software and associated documentation files (the
9022// "Software"), to deal in the Software without restriction, including
9023// without limitation the rights to use, copy, modify, merge, publish,
9024// distribute, sublicense, and/or sell copies of the Software, and to permit
9025// persons to whom the Software is furnished to do so, subject to the
9026// following conditions:
9027//
9028// The above copyright notice and this permission notice shall be included
9029// in all copies or substantial portions of the Software.
9030//
9031// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
9032// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
9033// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
9034// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
9035// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
9036// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
9037// USE OR OTHER DEALINGS IN THE SOFTWARE.
9038
9039var 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
9049var formatRegExp = /%[sdj%]/g;
9050exports.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// Mark that a method should not be used.
9090// Returns a modified function which warns once by default.
9091// If --no-deprecation is set, then it is a no-op.
9092exports.deprecate = function(fn, msg) {
9093 if (typeof process !== 'undefined' && process.noDeprecation === true) {
9094 return fn;
9095 }
9096
9097 // Allow for deprecating things in the process of starting up.
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
9123var debugs = {};
9124var debugEnviron;
9125exports.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/* legacy: obj, showHidden, depth, colors*/
9152function inspect(obj, opts) {
9153 // default options
9154 var ctx = {
9155 seen: [],
9156 stylize: stylizeNoColor
9157 };
9158 // legacy...
9159 if (arguments.length >= 3) ctx.depth = arguments[2];
9160 if (arguments.length >= 4) ctx.colors = arguments[3];
9161 if (isBoolean(opts)) {
9162 // legacy...
9163 ctx.showHidden = opts;
9164 } else if (opts) {
9165 // got an "options" object
9166 exports._extend(ctx, opts);
9167 }
9168 // set default options
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}
9176exports.inspect = inspect;
9177
9178
9179// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
9180inspect.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// Don't use 'blue' not visible on cmd.exe
9197inspect.styles = {
9198 'special': 'cyan',
9199 'number': 'yellow',
9200 'boolean': 'yellow',
9201 'undefined': 'grey',
9202 'null': 'bold',
9203 'string': 'green',
9204 'date': 'magenta',
9205 // "name": intentionally not styling
9206 'regexp': 'red'
9207};
9208
9209
9210function 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
9222function stylizeNoColor(str, styleType) {
9223 return str;
9224}
9225
9226
9227function arrayToHash(array) {
9228 var hash = {};
9229
9230 array.forEach(function(val, idx) {
9231 hash[val] = true;
9232 });
9233
9234 return hash;
9235}
9236
9237
9238function formatValue(ctx, value, recurseTimes) {
9239 // Provide a hook for user-specified inspect functions.
9240 // Check that value is an object with an inspect function on it
9241 if (ctx.customInspect &&
9242 value &&
9243 isFunction(value.inspect) &&
9244 // Filter out the util module, it's inspect function is special
9245 value.inspect !== exports.inspect &&
9246 // Also filter out any prototype objects using the circular check.
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 // Primitive types cannot have properties
9256 var primitive = formatPrimitive(ctx, value);
9257 if (primitive) {
9258 return primitive;
9259 }
9260
9261 // Look up the keys of the object.
9262 var keys = Object.keys(value);
9263 var visibleKeys = arrayToHash(keys);
9264
9265 if (ctx.showHidden) {
9266 keys = Object.getOwnPropertyNames(value);
9267 }
9268
9269 // IE doesn't make error fields non-enumerable
9270 // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
9271 if (isError(value)
9272 && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
9273 return formatError(value);
9274 }
9275
9276 // Some type of object without properties can be shortcutted.
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 // Make Array say that they are Array
9296 if (isArray(value)) {
9297 array = true;
9298 braces = ['[', ']'];
9299 }
9300
9301 // Make functions say that they are functions
9302 if (isFunction(value)) {
9303 var n = value.name ? ': ' + value.name : '';
9304 base = ' [Function' + n + ']';
9305 }
9306
9307 // Make RegExps say that they are RegExps
9308 if (isRegExp(value)) {
9309 base = ' ' + RegExp.prototype.toString.call(value);
9310 }
9311
9312 // Make dates with properties first say the date
9313 if (isDate(value)) {
9314 base = ' ' + Date.prototype.toUTCString.call(value);
9315 }
9316
9317 // Make error with message first say the error
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
9351function 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 // For some reason typeof null is "object", so special case here.
9365 if (isNull(value))
9366 return ctx.stylize('null', 'null');
9367}
9368
9369
9370function formatError(value) {
9371 return '[' + Error.prototype.toString.call(value) + ']';
9372}
9373
9374
9375function 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
9395function 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
9454function 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// NOTE: These type checking functions intentionally don't use `instanceof`
9476// because it is fragile and can be easily faked with `Object.create()`.
9477function isArray(ar) {
9478 return Array.isArray(ar);
9479}
9480exports.isArray = isArray;
9481
9482function isBoolean(arg) {
9483 return typeof arg === 'boolean';
9484}
9485exports.isBoolean = isBoolean;
9486
9487function isNull(arg) {
9488 return arg === null;
9489}
9490exports.isNull = isNull;
9491
9492function isNullOrUndefined(arg) {
9493 return arg == null;
9494}
9495exports.isNullOrUndefined = isNullOrUndefined;
9496
9497function isNumber(arg) {
9498 return typeof arg === 'number';
9499}
9500exports.isNumber = isNumber;
9501
9502function isString(arg) {
9503 return typeof arg === 'string';
9504}
9505exports.isString = isString;
9506
9507function isSymbol(arg) {
9508 return typeof arg === 'symbol';
9509}
9510exports.isSymbol = isSymbol;
9511
9512function isUndefined(arg) {
9513 return arg === void 0;
9514}
9515exports.isUndefined = isUndefined;
9516
9517function isRegExp(re) {
9518 return isObject(re) && objectToString(re) === '[object RegExp]';
9519}
9520exports.isRegExp = isRegExp;
9521
9522function isObject(arg) {
9523 return typeof arg === 'object' && arg !== null;
9524}
9525exports.isObject = isObject;
9526
9527function isDate(d) {
9528 return isObject(d) && objectToString(d) === '[object Date]';
9529}
9530exports.isDate = isDate;
9531
9532function isError(e) {
9533 return isObject(e) &&
9534 (objectToString(e) === '[object Error]' || e instanceof Error);
9535}
9536exports.isError = isError;
9537
9538function isFunction(arg) {
9539 return typeof arg === 'function';
9540}
9541exports.isFunction = isFunction;
9542
9543function isPrimitive(arg) {
9544 return arg === null ||
9545 typeof arg === 'boolean' ||
9546 typeof arg === 'number' ||
9547 typeof arg === 'string' ||
9548 typeof arg === 'symbol' || // ES6 symbol
9549 typeof arg === 'undefined';
9550}
9551exports.isPrimitive = isPrimitive;
9552
9553exports.isBuffer = __webpack_require__(44);
9554
9555function objectToString(o) {
9556 return Object.prototype.toString.call(o);
9557}
9558
9559
9560function pad(n) {
9561 return n < 10 ? '0' + n.toString(10) : n.toString(10);
9562}
9563
9564
9565var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
9566 'Oct', 'Nov', 'Dec'];
9567
9568// 26 Feb 16:19:34
9569function 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// log is just a thin wrapper to console.log that prepends a timestamp
9579exports.log = function() {
9580 console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
9581};
9582
9583
9584/**
9585 * Inherit the prototype methods from one constructor into another.
9586 *
9587 * The Function.prototype.inherits from lang.js rewritten as a standalone
9588 * function (not on Function.prototype). NOTE: If this file is to be loaded
9589 * during bootstrapping this function needs to be rewritten using some native
9590 * functions as prototype setup using normal JavaScript does not work as
9591 * expected during bootstrapping (see mirror.js in r114903).
9592 *
9593 * @param {function} ctor Constructor function which needs to inherit the
9594 * prototype.
9595 * @param {function} superCtor Constructor function to inherit prototype from.
9596 */
9597exports.inherits = __webpack_require__(2);
9598
9599exports._extend = function(origin, add) {
9600 // Don't do anything if add isn't an object
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
9611function hasOwnProperty(obj, prop) {
9612 return Object.prototype.hasOwnProperty.call(obj, prop);
9613}
9614
9615var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
9616
9617exports.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
9671exports.promisify.custom = kCustomPromisifiedSymbol
9672
9673function callbackifyOnRejected(reason, cb) {
9674 // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
9675 // Because `null` is a special error value in callbacks which means "no error
9676 // occurred", we error-wrap so the callback consumer can distinguish between
9677 // "the promise rejected with null" or "the promise fulfilled with undefined".
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
9686function callbackify(original) {
9687 if (typeof original !== 'function') {
9688 throw new TypeError('The "original" argument must be of type Function');
9689 }
9690
9691 // We DO NOT return the promise as it gives the user a false sense that
9692 // the promise is actually somehow related to the callback's execution
9693 // and that the callback throwing will reject the promise.
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 // In true node style we process the callback on `nextTick` with all the
9709 // implications (stack, `uncaughtException`, `async_hooks`)
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}
9720exports.callbackify = callbackify;
9721
9722/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
9723
9724/***/ }),
9725/* 44 */
9726/***/ (function(module, exports) {
9727
9728module.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