axios 0.16.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

package/dist/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- /* axios v0.16.1 | (c) 2017 by Matt Zabriskie */
1
+ /* axios v0.18.0 | (c) 2018 by Matt Zabriskie */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory();
@@ -53,20 +53,20 @@ return /******/ (function(modules) { // webpackBootstrap
53
53
  /************************************************************************/
54
54
  /******/ ([
55
55
  /* 0 */
56
- /***/ function(module, exports, __webpack_require__) {
56
+ /***/ (function(module, exports, __webpack_require__) {
57
57
 
58
58
  module.exports = __webpack_require__(1);
59
59
 
60
- /***/ },
60
+ /***/ }),
61
61
  /* 1 */
62
- /***/ function(module, exports, __webpack_require__) {
62
+ /***/ (function(module, exports, __webpack_require__) {
63
63
 
64
64
  'use strict';
65
65
 
66
66
  var utils = __webpack_require__(2);
67
- var bind = __webpack_require__(7);
68
- var Axios = __webpack_require__(8);
69
- var defaults = __webpack_require__(9);
67
+ var bind = __webpack_require__(3);
68
+ var Axios = __webpack_require__(5);
69
+ var defaults = __webpack_require__(6);
70
70
 
71
71
  /**
72
72
  * Create an instance of Axios
@@ -99,15 +99,15 @@ return /******/ (function(modules) { // webpackBootstrap
99
99
  };
100
100
 
101
101
  // Expose Cancel & CancelToken
102
- axios.Cancel = __webpack_require__(26);
103
- axios.CancelToken = __webpack_require__(27);
104
- axios.isCancel = __webpack_require__(23);
102
+ axios.Cancel = __webpack_require__(23);
103
+ axios.CancelToken = __webpack_require__(24);
104
+ axios.isCancel = __webpack_require__(20);
105
105
 
106
106
  // Expose all/spread
107
107
  axios.all = function all(promises) {
108
108
  return Promise.all(promises);
109
109
  };
110
- axios.spread = __webpack_require__(28);
110
+ axios.spread = __webpack_require__(25);
111
111
 
112
112
  module.exports = axios;
113
113
 
@@ -115,13 +115,14 @@ return /******/ (function(modules) { // webpackBootstrap
115
115
  module.exports.default = axios;
116
116
 
117
117
 
118
- /***/ },
118
+ /***/ }),
119
119
  /* 2 */
120
- /***/ function(module, exports, __webpack_require__) {
120
+ /***/ (function(module, exports, __webpack_require__) {
121
121
 
122
- /* WEBPACK VAR INJECTION */(function(Buffer) {'use strict';
122
+ 'use strict';
123
123
 
124
- var bind = __webpack_require__(7);
124
+ var bind = __webpack_require__(3);
125
+ var isBuffer = __webpack_require__(4);
125
126
 
126
127
  /*global toString:true*/
127
128
 
@@ -139,16 +140,6 @@ return /******/ (function(modules) { // webpackBootstrap
139
140
  return toString.call(val) === '[object Array]';
140
141
  }
141
142
 
142
- /**
143
- * Determine if a value is a Node Buffer
144
- *
145
- * @param {Object} val The value to test
146
- * @returns {boolean} True if value is a Node Buffer, otherwise false
147
- */
148
- function isBuffer(val) {
149
- return ((typeof Buffer !== 'undefined') && (Buffer.isBuffer) && (Buffer.isBuffer(val)));
150
- }
151
-
152
143
  /**
153
144
  * Determine if a value is an ArrayBuffer
154
145
  *
@@ -242,2218 +233,200 @@ return /******/ (function(modules) { // webpackBootstrap
242
233
  * @returns {boolean} True if value is a File, otherwise false
243
234
  */
244
235
  function isFile(val) {
245
- return toString.call(val) === '[object File]';
246
- }
247
-
248
- /**
249
- * Determine if a value is a Blob
250
- *
251
- * @param {Object} val The value to test
252
- * @returns {boolean} True if value is a Blob, otherwise false
253
- */
254
- function isBlob(val) {
255
- return toString.call(val) === '[object Blob]';
256
- }
257
-
258
- /**
259
- * Determine if a value is a Function
260
- *
261
- * @param {Object} val The value to test
262
- * @returns {boolean} True if value is a Function, otherwise false
263
- */
264
- function isFunction(val) {
265
- return toString.call(val) === '[object Function]';
266
- }
267
-
268
- /**
269
- * Determine if a value is a Stream
270
- *
271
- * @param {Object} val The value to test
272
- * @returns {boolean} True if value is a Stream, otherwise false
273
- */
274
- function isStream(val) {
275
- return isObject(val) && isFunction(val.pipe);
276
- }
277
-
278
- /**
279
- * Determine if a value is a URLSearchParams object
280
- *
281
- * @param {Object} val The value to test
282
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
283
- */
284
- function isURLSearchParams(val) {
285
- return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
286
- }
287
-
288
- /**
289
- * Trim excess whitespace off the beginning and end of a string
290
- *
291
- * @param {String} str The String to trim
292
- * @returns {String} The String freed of excess whitespace
293
- */
294
- function trim(str) {
295
- return str.replace(/^\s*/, '').replace(/\s*$/, '');
296
- }
297
-
298
- /**
299
- * Determine if we're running in a standard browser environment
300
- *
301
- * This allows axios to run in a web worker, and react-native.
302
- * Both environments support XMLHttpRequest, but not fully standard globals.
303
- *
304
- * web workers:
305
- * typeof window -> undefined
306
- * typeof document -> undefined
307
- *
308
- * react-native:
309
- * navigator.product -> 'ReactNative'
310
- */
311
- function isStandardBrowserEnv() {
312
- if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
313
- return false;
314
- }
315
- return (
316
- typeof window !== 'undefined' &&
317
- typeof document !== 'undefined'
318
- );
319
- }
320
-
321
- /**
322
- * Iterate over an Array or an Object invoking a function for each item.
323
- *
324
- * If `obj` is an Array callback will be called passing
325
- * the value, index, and complete array for each item.
326
- *
327
- * If 'obj' is an Object callback will be called passing
328
- * the value, key, and complete object for each property.
329
- *
330
- * @param {Object|Array} obj The object to iterate
331
- * @param {Function} fn The callback to invoke for each item
332
- */
333
- function forEach(obj, fn) {
334
- // Don't bother if no value provided
335
- if (obj === null || typeof obj === 'undefined') {
336
- return;
337
- }
338
-
339
- // Force an array if not already something iterable
340
- if (typeof obj !== 'object' && !isArray(obj)) {
341
- /*eslint no-param-reassign:0*/
342
- obj = [obj];
343
- }
344
-
345
- if (isArray(obj)) {
346
- // Iterate over array values
347
- for (var i = 0, l = obj.length; i < l; i++) {
348
- fn.call(null, obj[i], i, obj);
349
- }
350
- } else {
351
- // Iterate over object keys
352
- for (var key in obj) {
353
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
354
- fn.call(null, obj[key], key, obj);
355
- }
356
- }
357
- }
358
- }
359
-
360
- /**
361
- * Accepts varargs expecting each argument to be an object, then
362
- * immutably merges the properties of each object and returns result.
363
- *
364
- * When multiple objects contain the same key the later object in
365
- * the arguments list will take precedence.
366
- *
367
- * Example:
368
- *
369
- * ```js
370
- * var result = merge({foo: 123}, {foo: 456});
371
- * console.log(result.foo); // outputs 456
372
- * ```
373
- *
374
- * @param {Object} obj1 Object to merge
375
- * @returns {Object} Result of all merge properties
376
- */
377
- function merge(/* obj1, obj2, obj3, ... */) {
378
- var result = {};
379
- function assignValue(val, key) {
380
- if (typeof result[key] === 'object' && typeof val === 'object') {
381
- result[key] = merge(result[key], val);
382
- } else {
383
- result[key] = val;
384
- }
385
- }
386
-
387
- for (var i = 0, l = arguments.length; i < l; i++) {
388
- forEach(arguments[i], assignValue);
389
- }
390
- return result;
391
- }
392
-
393
- /**
394
- * Extends object a by mutably adding to it the properties of object b.
395
- *
396
- * @param {Object} a The object to be extended
397
- * @param {Object} b The object to copy properties from
398
- * @param {Object} thisArg The object to bind function to
399
- * @return {Object} The resulting value of object a
400
- */
401
- function extend(a, b, thisArg) {
402
- forEach(b, function assignValue(val, key) {
403
- if (thisArg && typeof val === 'function') {
404
- a[key] = bind(val, thisArg);
405
- } else {
406
- a[key] = val;
407
- }
408
- });
409
- return a;
410
- }
411
-
412
- module.exports = {
413
- isArray: isArray,
414
- isArrayBuffer: isArrayBuffer,
415
- isBuffer: isBuffer,
416
- isFormData: isFormData,
417
- isArrayBufferView: isArrayBufferView,
418
- isString: isString,
419
- isNumber: isNumber,
420
- isObject: isObject,
421
- isUndefined: isUndefined,
422
- isDate: isDate,
423
- isFile: isFile,
424
- isBlob: isBlob,
425
- isFunction: isFunction,
426
- isStream: isStream,
427
- isURLSearchParams: isURLSearchParams,
428
- isStandardBrowserEnv: isStandardBrowserEnv,
429
- forEach: forEach,
430
- merge: merge,
431
- extend: extend,
432
- trim: trim
433
- };
434
-
435
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3).Buffer))
436
-
437
- /***/ },
438
- /* 3 */
439
- /***/ function(module, exports, __webpack_require__) {
440
-
441
- /* WEBPACK VAR INJECTION */(function(global) {/*!
442
- * The buffer module from node.js, for the browser.
443
- *
444
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
445
- * @license MIT
446
- */
447
- /* eslint-disable no-proto */
448
-
449
- 'use strict'
450
-
451
- var base64 = __webpack_require__(4)
452
- var ieee754 = __webpack_require__(5)
453
- var isArray = __webpack_require__(6)
454
-
455
- exports.Buffer = Buffer
456
- exports.SlowBuffer = SlowBuffer
457
- exports.INSPECT_MAX_BYTES = 50
458
-
459
- /**
460
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
461
- * === true Use Uint8Array implementation (fastest)
462
- * === false Use Object implementation (most compatible, even IE6)
463
- *
464
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
465
- * Opera 11.6+, iOS 4.2+.
466
- *
467
- * Due to various browser bugs, sometimes the Object implementation will be used even
468
- * when the browser supports typed arrays.
469
- *
470
- * Note:
471
- *
472
- * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
473
- * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
474
- *
475
- * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
476
- *
477
- * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
478
- * incorrect length in some situations.
479
-
480
- * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
481
- * get the Object implementation, which is slower but behaves correctly.
482
- */
483
- Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
484
- ? global.TYPED_ARRAY_SUPPORT
485
- : typedArraySupport()
486
-
487
- /*
488
- * Export kMaxLength after typed array support is determined.
489
- */
490
- exports.kMaxLength = kMaxLength()
491
-
492
- function typedArraySupport () {
493
- try {
494
- var arr = new Uint8Array(1)
495
- arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
496
- return arr.foo() === 42 && // typed array instances can be augmented
497
- typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
498
- arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
499
- } catch (e) {
500
- return false
501
- }
502
- }
503
-
504
- function kMaxLength () {
505
- return Buffer.TYPED_ARRAY_SUPPORT
506
- ? 0x7fffffff
507
- : 0x3fffffff
508
- }
509
-
510
- function createBuffer (that, length) {
511
- if (kMaxLength() < length) {
512
- throw new RangeError('Invalid typed array length')
513
- }
514
- if (Buffer.TYPED_ARRAY_SUPPORT) {
515
- // Return an augmented `Uint8Array` instance, for best performance
516
- that = new Uint8Array(length)
517
- that.__proto__ = Buffer.prototype
518
- } else {
519
- // Fallback: Return an object instance of the Buffer class
520
- if (that === null) {
521
- that = new Buffer(length)
522
- }
523
- that.length = length
524
- }
525
-
526
- return that
527
- }
528
-
529
- /**
530
- * The Buffer constructor returns instances of `Uint8Array` that have their
531
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
532
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
533
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
534
- * returns a single octet.
535
- *
536
- * The `Uint8Array` prototype remains unmodified.
537
- */
538
-
539
- function Buffer (arg, encodingOrOffset, length) {
540
- if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
541
- return new Buffer(arg, encodingOrOffset, length)
542
- }
543
-
544
- // Common case.
545
- if (typeof arg === 'number') {
546
- if (typeof encodingOrOffset === 'string') {
547
- throw new Error(
548
- 'If encoding is specified then the first argument must be a string'
549
- )
550
- }
551
- return allocUnsafe(this, arg)
552
- }
553
- return from(this, arg, encodingOrOffset, length)
554
- }
555
-
556
- Buffer.poolSize = 8192 // not used by this implementation
557
-
558
- // TODO: Legacy, not needed anymore. Remove in next major version.
559
- Buffer._augment = function (arr) {
560
- arr.__proto__ = Buffer.prototype
561
- return arr
562
- }
563
-
564
- function from (that, value, encodingOrOffset, length) {
565
- if (typeof value === 'number') {
566
- throw new TypeError('"value" argument must not be a number')
567
- }
568
-
569
- if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
570
- return fromArrayBuffer(that, value, encodingOrOffset, length)
571
- }
572
-
573
- if (typeof value === 'string') {
574
- return fromString(that, value, encodingOrOffset)
575
- }
576
-
577
- return fromObject(that, value)
578
- }
579
-
580
- /**
581
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
582
- * if value is a number.
583
- * Buffer.from(str[, encoding])
584
- * Buffer.from(array)
585
- * Buffer.from(buffer)
586
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
587
- **/
588
- Buffer.from = function (value, encodingOrOffset, length) {
589
- return from(null, value, encodingOrOffset, length)
590
- }
591
-
592
- if (Buffer.TYPED_ARRAY_SUPPORT) {
593
- Buffer.prototype.__proto__ = Uint8Array.prototype
594
- Buffer.__proto__ = Uint8Array
595
- if (typeof Symbol !== 'undefined' && Symbol.species &&
596
- Buffer[Symbol.species] === Buffer) {
597
- // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
598
- Object.defineProperty(Buffer, Symbol.species, {
599
- value: null,
600
- configurable: true
601
- })
602
- }
603
- }
604
-
605
- function assertSize (size) {
606
- if (typeof size !== 'number') {
607
- throw new TypeError('"size" argument must be a number')
608
- } else if (size < 0) {
609
- throw new RangeError('"size" argument must not be negative')
610
- }
611
- }
612
-
613
- function alloc (that, size, fill, encoding) {
614
- assertSize(size)
615
- if (size <= 0) {
616
- return createBuffer(that, size)
617
- }
618
- if (fill !== undefined) {
619
- // Only pay attention to encoding if it's a string. This
620
- // prevents accidentally sending in a number that would
621
- // be interpretted as a start offset.
622
- return typeof encoding === 'string'
623
- ? createBuffer(that, size).fill(fill, encoding)
624
- : createBuffer(that, size).fill(fill)
625
- }
626
- return createBuffer(that, size)
627
- }
628
-
629
- /**
630
- * Creates a new filled Buffer instance.
631
- * alloc(size[, fill[, encoding]])
632
- **/
633
- Buffer.alloc = function (size, fill, encoding) {
634
- return alloc(null, size, fill, encoding)
635
- }
636
-
637
- function allocUnsafe (that, size) {
638
- assertSize(size)
639
- that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
640
- if (!Buffer.TYPED_ARRAY_SUPPORT) {
641
- for (var i = 0; i < size; ++i) {
642
- that[i] = 0
643
- }
644
- }
645
- return that
646
- }
647
-
648
- /**
649
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
650
- * */
651
- Buffer.allocUnsafe = function (size) {
652
- return allocUnsafe(null, size)
653
- }
654
- /**
655
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
656
- */
657
- Buffer.allocUnsafeSlow = function (size) {
658
- return allocUnsafe(null, size)
659
- }
660
-
661
- function fromString (that, string, encoding) {
662
- if (typeof encoding !== 'string' || encoding === '') {
663
- encoding = 'utf8'
664
- }
665
-
666
- if (!Buffer.isEncoding(encoding)) {
667
- throw new TypeError('"encoding" must be a valid string encoding')
668
- }
669
-
670
- var length = byteLength(string, encoding) | 0
671
- that = createBuffer(that, length)
672
-
673
- var actual = that.write(string, encoding)
674
-
675
- if (actual !== length) {
676
- // Writing a hex string, for example, that contains invalid characters will
677
- // cause everything after the first invalid character to be ignored. (e.g.
678
- // 'abxxcd' will be treated as 'ab')
679
- that = that.slice(0, actual)
680
- }
681
-
682
- return that
683
- }
684
-
685
- function fromArrayLike (that, array) {
686
- var length = array.length < 0 ? 0 : checked(array.length) | 0
687
- that = createBuffer(that, length)
688
- for (var i = 0; i < length; i += 1) {
689
- that[i] = array[i] & 255
690
- }
691
- return that
692
- }
693
-
694
- function fromArrayBuffer (that, array, byteOffset, length) {
695
- array.byteLength // this throws if `array` is not a valid ArrayBuffer
696
-
697
- if (byteOffset < 0 || array.byteLength < byteOffset) {
698
- throw new RangeError('\'offset\' is out of bounds')
699
- }
700
-
701
- if (array.byteLength < byteOffset + (length || 0)) {
702
- throw new RangeError('\'length\' is out of bounds')
703
- }
704
-
705
- if (byteOffset === undefined && length === undefined) {
706
- array = new Uint8Array(array)
707
- } else if (length === undefined) {
708
- array = new Uint8Array(array, byteOffset)
709
- } else {
710
- array = new Uint8Array(array, byteOffset, length)
711
- }
712
-
713
- if (Buffer.TYPED_ARRAY_SUPPORT) {
714
- // Return an augmented `Uint8Array` instance, for best performance
715
- that = array
716
- that.__proto__ = Buffer.prototype
717
- } else {
718
- // Fallback: Return an object instance of the Buffer class
719
- that = fromArrayLike(that, array)
720
- }
721
- return that
722
- }
723
-
724
- function fromObject (that, obj) {
725
- if (Buffer.isBuffer(obj)) {
726
- var len = checked(obj.length) | 0
727
- that = createBuffer(that, len)
728
-
729
- if (that.length === 0) {
730
- return that
731
- }
732
-
733
- obj.copy(that, 0, 0, len)
734
- return that
735
- }
736
-
737
- if (obj) {
738
- if ((typeof ArrayBuffer !== 'undefined' &&
739
- obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
740
- if (typeof obj.length !== 'number' || isnan(obj.length)) {
741
- return createBuffer(that, 0)
742
- }
743
- return fromArrayLike(that, obj)
744
- }
745
-
746
- if (obj.type === 'Buffer' && isArray(obj.data)) {
747
- return fromArrayLike(that, obj.data)
748
- }
749
- }
750
-
751
- throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
752
- }
753
-
754
- function checked (length) {
755
- // Note: cannot use `length < kMaxLength()` here because that fails when
756
- // length is NaN (which is otherwise coerced to zero.)
757
- if (length >= kMaxLength()) {
758
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
759
- 'size: 0x' + kMaxLength().toString(16) + ' bytes')
760
- }
761
- return length | 0
762
- }
763
-
764
- function SlowBuffer (length) {
765
- if (+length != length) { // eslint-disable-line eqeqeq
766
- length = 0
767
- }
768
- return Buffer.alloc(+length)
769
- }
770
-
771
- Buffer.isBuffer = function isBuffer (b) {
772
- return !!(b != null && b._isBuffer)
773
- }
774
-
775
- Buffer.compare = function compare (a, b) {
776
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
777
- throw new TypeError('Arguments must be Buffers')
778
- }
779
-
780
- if (a === b) return 0
781
-
782
- var x = a.length
783
- var y = b.length
784
-
785
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
786
- if (a[i] !== b[i]) {
787
- x = a[i]
788
- y = b[i]
789
- break
790
- }
791
- }
792
-
793
- if (x < y) return -1
794
- if (y < x) return 1
795
- return 0
796
- }
797
-
798
- Buffer.isEncoding = function isEncoding (encoding) {
799
- switch (String(encoding).toLowerCase()) {
800
- case 'hex':
801
- case 'utf8':
802
- case 'utf-8':
803
- case 'ascii':
804
- case 'latin1':
805
- case 'binary':
806
- case 'base64':
807
- case 'ucs2':
808
- case 'ucs-2':
809
- case 'utf16le':
810
- case 'utf-16le':
811
- return true
812
- default:
813
- return false
814
- }
815
- }
816
-
817
- Buffer.concat = function concat (list, length) {
818
- if (!isArray(list)) {
819
- throw new TypeError('"list" argument must be an Array of Buffers')
820
- }
821
-
822
- if (list.length === 0) {
823
- return Buffer.alloc(0)
824
- }
825
-
826
- var i
827
- if (length === undefined) {
828
- length = 0
829
- for (i = 0; i < list.length; ++i) {
830
- length += list[i].length
831
- }
832
- }
833
-
834
- var buffer = Buffer.allocUnsafe(length)
835
- var pos = 0
836
- for (i = 0; i < list.length; ++i) {
837
- var buf = list[i]
838
- if (!Buffer.isBuffer(buf)) {
839
- throw new TypeError('"list" argument must be an Array of Buffers')
840
- }
841
- buf.copy(buffer, pos)
842
- pos += buf.length
843
- }
844
- return buffer
845
- }
846
-
847
- function byteLength (string, encoding) {
848
- if (Buffer.isBuffer(string)) {
849
- return string.length
850
- }
851
- if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
852
- (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
853
- return string.byteLength
854
- }
855
- if (typeof string !== 'string') {
856
- string = '' + string
857
- }
858
-
859
- var len = string.length
860
- if (len === 0) return 0
861
-
862
- // Use a for loop to avoid recursion
863
- var loweredCase = false
864
- for (;;) {
865
- switch (encoding) {
866
- case 'ascii':
867
- case 'latin1':
868
- case 'binary':
869
- return len
870
- case 'utf8':
871
- case 'utf-8':
872
- case undefined:
873
- return utf8ToBytes(string).length
874
- case 'ucs2':
875
- case 'ucs-2':
876
- case 'utf16le':
877
- case 'utf-16le':
878
- return len * 2
879
- case 'hex':
880
- return len >>> 1
881
- case 'base64':
882
- return base64ToBytes(string).length
883
- default:
884
- if (loweredCase) return utf8ToBytes(string).length // assume utf8
885
- encoding = ('' + encoding).toLowerCase()
886
- loweredCase = true
887
- }
888
- }
889
- }
890
- Buffer.byteLength = byteLength
891
-
892
- function slowToString (encoding, start, end) {
893
- var loweredCase = false
894
-
895
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
896
- // property of a typed array.
897
-
898
- // This behaves neither like String nor Uint8Array in that we set start/end
899
- // to their upper/lower bounds if the value passed is out of range.
900
- // undefined is handled specially as per ECMA-262 6th Edition,
901
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
902
- if (start === undefined || start < 0) {
903
- start = 0
904
- }
905
- // Return early if start > this.length. Done here to prevent potential uint32
906
- // coercion fail below.
907
- if (start > this.length) {
908
- return ''
909
- }
910
-
911
- if (end === undefined || end > this.length) {
912
- end = this.length
913
- }
914
-
915
- if (end <= 0) {
916
- return ''
917
- }
918
-
919
- // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
920
- end >>>= 0
921
- start >>>= 0
922
-
923
- if (end <= start) {
924
- return ''
925
- }
926
-
927
- if (!encoding) encoding = 'utf8'
928
-
929
- while (true) {
930
- switch (encoding) {
931
- case 'hex':
932
- return hexSlice(this, start, end)
933
-
934
- case 'utf8':
935
- case 'utf-8':
936
- return utf8Slice(this, start, end)
937
-
938
- case 'ascii':
939
- return asciiSlice(this, start, end)
940
-
941
- case 'latin1':
942
- case 'binary':
943
- return latin1Slice(this, start, end)
944
-
945
- case 'base64':
946
- return base64Slice(this, start, end)
947
-
948
- case 'ucs2':
949
- case 'ucs-2':
950
- case 'utf16le':
951
- case 'utf-16le':
952
- return utf16leSlice(this, start, end)
953
-
954
- default:
955
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
956
- encoding = (encoding + '').toLowerCase()
957
- loweredCase = true
958
- }
959
- }
960
- }
961
-
962
- // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
963
- // Buffer instances.
964
- Buffer.prototype._isBuffer = true
965
-
966
- function swap (b, n, m) {
967
- var i = b[n]
968
- b[n] = b[m]
969
- b[m] = i
970
- }
971
-
972
- Buffer.prototype.swap16 = function swap16 () {
973
- var len = this.length
974
- if (len % 2 !== 0) {
975
- throw new RangeError('Buffer size must be a multiple of 16-bits')
976
- }
977
- for (var i = 0; i < len; i += 2) {
978
- swap(this, i, i + 1)
979
- }
980
- return this
981
- }
982
-
983
- Buffer.prototype.swap32 = function swap32 () {
984
- var len = this.length
985
- if (len % 4 !== 0) {
986
- throw new RangeError('Buffer size must be a multiple of 32-bits')
987
- }
988
- for (var i = 0; i < len; i += 4) {
989
- swap(this, i, i + 3)
990
- swap(this, i + 1, i + 2)
991
- }
992
- return this
993
- }
994
-
995
- Buffer.prototype.swap64 = function swap64 () {
996
- var len = this.length
997
- if (len % 8 !== 0) {
998
- throw new RangeError('Buffer size must be a multiple of 64-bits')
999
- }
1000
- for (var i = 0; i < len; i += 8) {
1001
- swap(this, i, i + 7)
1002
- swap(this, i + 1, i + 6)
1003
- swap(this, i + 2, i + 5)
1004
- swap(this, i + 3, i + 4)
1005
- }
1006
- return this
1007
- }
1008
-
1009
- Buffer.prototype.toString = function toString () {
1010
- var length = this.length | 0
1011
- if (length === 0) return ''
1012
- if (arguments.length === 0) return utf8Slice(this, 0, length)
1013
- return slowToString.apply(this, arguments)
1014
- }
1015
-
1016
- Buffer.prototype.equals = function equals (b) {
1017
- if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
1018
- if (this === b) return true
1019
- return Buffer.compare(this, b) === 0
1020
- }
1021
-
1022
- Buffer.prototype.inspect = function inspect () {
1023
- var str = ''
1024
- var max = exports.INSPECT_MAX_BYTES
1025
- if (this.length > 0) {
1026
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
1027
- if (this.length > max) str += ' ... '
1028
- }
1029
- return '<Buffer ' + str + '>'
1030
- }
1031
-
1032
- Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
1033
- if (!Buffer.isBuffer(target)) {
1034
- throw new TypeError('Argument must be a Buffer')
1035
- }
1036
-
1037
- if (start === undefined) {
1038
- start = 0
1039
- }
1040
- if (end === undefined) {
1041
- end = target ? target.length : 0
1042
- }
1043
- if (thisStart === undefined) {
1044
- thisStart = 0
1045
- }
1046
- if (thisEnd === undefined) {
1047
- thisEnd = this.length
1048
- }
1049
-
1050
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
1051
- throw new RangeError('out of range index')
1052
- }
1053
-
1054
- if (thisStart >= thisEnd && start >= end) {
1055
- return 0
1056
- }
1057
- if (thisStart >= thisEnd) {
1058
- return -1
1059
- }
1060
- if (start >= end) {
1061
- return 1
1062
- }
1063
-
1064
- start >>>= 0
1065
- end >>>= 0
1066
- thisStart >>>= 0
1067
- thisEnd >>>= 0
1068
-
1069
- if (this === target) return 0
1070
-
1071
- var x = thisEnd - thisStart
1072
- var y = end - start
1073
- var len = Math.min(x, y)
1074
-
1075
- var thisCopy = this.slice(thisStart, thisEnd)
1076
- var targetCopy = target.slice(start, end)
1077
-
1078
- for (var i = 0; i < len; ++i) {
1079
- if (thisCopy[i] !== targetCopy[i]) {
1080
- x = thisCopy[i]
1081
- y = targetCopy[i]
1082
- break
1083
- }
1084
- }
1085
-
1086
- if (x < y) return -1
1087
- if (y < x) return 1
1088
- return 0
1089
- }
1090
-
1091
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
1092
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
1093
- //
1094
- // Arguments:
1095
- // - buffer - a Buffer to search
1096
- // - val - a string, Buffer, or number
1097
- // - byteOffset - an index into `buffer`; will be clamped to an int32
1098
- // - encoding - an optional encoding, relevant is val is a string
1099
- // - dir - true for indexOf, false for lastIndexOf
1100
- function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
1101
- // Empty buffer means no match
1102
- if (buffer.length === 0) return -1
1103
-
1104
- // Normalize byteOffset
1105
- if (typeof byteOffset === 'string') {
1106
- encoding = byteOffset
1107
- byteOffset = 0
1108
- } else if (byteOffset > 0x7fffffff) {
1109
- byteOffset = 0x7fffffff
1110
- } else if (byteOffset < -0x80000000) {
1111
- byteOffset = -0x80000000
1112
- }
1113
- byteOffset = +byteOffset // Coerce to Number.
1114
- if (isNaN(byteOffset)) {
1115
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
1116
- byteOffset = dir ? 0 : (buffer.length - 1)
1117
- }
1118
-
1119
- // Normalize byteOffset: negative offsets start from the end of the buffer
1120
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset
1121
- if (byteOffset >= buffer.length) {
1122
- if (dir) return -1
1123
- else byteOffset = buffer.length - 1
1124
- } else if (byteOffset < 0) {
1125
- if (dir) byteOffset = 0
1126
- else return -1
1127
- }
1128
-
1129
- // Normalize val
1130
- if (typeof val === 'string') {
1131
- val = Buffer.from(val, encoding)
1132
- }
1133
-
1134
- // Finally, search either indexOf (if dir is true) or lastIndexOf
1135
- if (Buffer.isBuffer(val)) {
1136
- // Special case: looking for empty string/buffer always fails
1137
- if (val.length === 0) {
1138
- return -1
1139
- }
1140
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
1141
- } else if (typeof val === 'number') {
1142
- val = val & 0xFF // Search for a byte value [0-255]
1143
- if (Buffer.TYPED_ARRAY_SUPPORT &&
1144
- typeof Uint8Array.prototype.indexOf === 'function') {
1145
- if (dir) {
1146
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
1147
- } else {
1148
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
1149
- }
1150
- }
1151
- return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
1152
- }
1153
-
1154
- throw new TypeError('val must be string, number or Buffer')
1155
- }
1156
-
1157
- function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
1158
- var indexSize = 1
1159
- var arrLength = arr.length
1160
- var valLength = val.length
1161
-
1162
- if (encoding !== undefined) {
1163
- encoding = String(encoding).toLowerCase()
1164
- if (encoding === 'ucs2' || encoding === 'ucs-2' ||
1165
- encoding === 'utf16le' || encoding === 'utf-16le') {
1166
- if (arr.length < 2 || val.length < 2) {
1167
- return -1
1168
- }
1169
- indexSize = 2
1170
- arrLength /= 2
1171
- valLength /= 2
1172
- byteOffset /= 2
1173
- }
1174
- }
1175
-
1176
- function read (buf, i) {
1177
- if (indexSize === 1) {
1178
- return buf[i]
1179
- } else {
1180
- return buf.readUInt16BE(i * indexSize)
1181
- }
1182
- }
1183
-
1184
- var i
1185
- if (dir) {
1186
- var foundIndex = -1
1187
- for (i = byteOffset; i < arrLength; i++) {
1188
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
1189
- if (foundIndex === -1) foundIndex = i
1190
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
1191
- } else {
1192
- if (foundIndex !== -1) i -= i - foundIndex
1193
- foundIndex = -1
1194
- }
1195
- }
1196
- } else {
1197
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
1198
- for (i = byteOffset; i >= 0; i--) {
1199
- var found = true
1200
- for (var j = 0; j < valLength; j++) {
1201
- if (read(arr, i + j) !== read(val, j)) {
1202
- found = false
1203
- break
1204
- }
1205
- }
1206
- if (found) return i
1207
- }
1208
- }
1209
-
1210
- return -1
1211
- }
1212
-
1213
- Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
1214
- return this.indexOf(val, byteOffset, encoding) !== -1
1215
- }
1216
-
1217
- Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
1218
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
1219
- }
1220
-
1221
- Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
1222
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
1223
- }
1224
-
1225
- function hexWrite (buf, string, offset, length) {
1226
- offset = Number(offset) || 0
1227
- var remaining = buf.length - offset
1228
- if (!length) {
1229
- length = remaining
1230
- } else {
1231
- length = Number(length)
1232
- if (length > remaining) {
1233
- length = remaining
1234
- }
1235
- }
1236
-
1237
- // must be an even number of digits
1238
- var strLen = string.length
1239
- if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
1240
-
1241
- if (length > strLen / 2) {
1242
- length = strLen / 2
1243
- }
1244
- for (var i = 0; i < length; ++i) {
1245
- var parsed = parseInt(string.substr(i * 2, 2), 16)
1246
- if (isNaN(parsed)) return i
1247
- buf[offset + i] = parsed
1248
- }
1249
- return i
1250
- }
1251
-
1252
- function utf8Write (buf, string, offset, length) {
1253
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
1254
- }
1255
-
1256
- function asciiWrite (buf, string, offset, length) {
1257
- return blitBuffer(asciiToBytes(string), buf, offset, length)
1258
- }
1259
-
1260
- function latin1Write (buf, string, offset, length) {
1261
- return asciiWrite(buf, string, offset, length)
1262
- }
1263
-
1264
- function base64Write (buf, string, offset, length) {
1265
- return blitBuffer(base64ToBytes(string), buf, offset, length)
1266
- }
1267
-
1268
- function ucs2Write (buf, string, offset, length) {
1269
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
1270
- }
1271
-
1272
- Buffer.prototype.write = function write (string, offset, length, encoding) {
1273
- // Buffer#write(string)
1274
- if (offset === undefined) {
1275
- encoding = 'utf8'
1276
- length = this.length
1277
- offset = 0
1278
- // Buffer#write(string, encoding)
1279
- } else if (length === undefined && typeof offset === 'string') {
1280
- encoding = offset
1281
- length = this.length
1282
- offset = 0
1283
- // Buffer#write(string, offset[, length][, encoding])
1284
- } else if (isFinite(offset)) {
1285
- offset = offset | 0
1286
- if (isFinite(length)) {
1287
- length = length | 0
1288
- if (encoding === undefined) encoding = 'utf8'
1289
- } else {
1290
- encoding = length
1291
- length = undefined
1292
- }
1293
- // legacy write(string, encoding, offset, length) - remove in v0.13
1294
- } else {
1295
- throw new Error(
1296
- 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
1297
- )
1298
- }
1299
-
1300
- var remaining = this.length - offset
1301
- if (length === undefined || length > remaining) length = remaining
1302
-
1303
- if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
1304
- throw new RangeError('Attempt to write outside buffer bounds')
1305
- }
1306
-
1307
- if (!encoding) encoding = 'utf8'
1308
-
1309
- var loweredCase = false
1310
- for (;;) {
1311
- switch (encoding) {
1312
- case 'hex':
1313
- return hexWrite(this, string, offset, length)
1314
-
1315
- case 'utf8':
1316
- case 'utf-8':
1317
- return utf8Write(this, string, offset, length)
1318
-
1319
- case 'ascii':
1320
- return asciiWrite(this, string, offset, length)
1321
-
1322
- case 'latin1':
1323
- case 'binary':
1324
- return latin1Write(this, string, offset, length)
1325
-
1326
- case 'base64':
1327
- // Warning: maxLength not taken into account in base64Write
1328
- return base64Write(this, string, offset, length)
1329
-
1330
- case 'ucs2':
1331
- case 'ucs-2':
1332
- case 'utf16le':
1333
- case 'utf-16le':
1334
- return ucs2Write(this, string, offset, length)
1335
-
1336
- default:
1337
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
1338
- encoding = ('' + encoding).toLowerCase()
1339
- loweredCase = true
1340
- }
1341
- }
1342
- }
1343
-
1344
- Buffer.prototype.toJSON = function toJSON () {
1345
- return {
1346
- type: 'Buffer',
1347
- data: Array.prototype.slice.call(this._arr || this, 0)
1348
- }
1349
- }
1350
-
1351
- function base64Slice (buf, start, end) {
1352
- if (start === 0 && end === buf.length) {
1353
- return base64.fromByteArray(buf)
1354
- } else {
1355
- return base64.fromByteArray(buf.slice(start, end))
1356
- }
1357
- }
1358
-
1359
- function utf8Slice (buf, start, end) {
1360
- end = Math.min(buf.length, end)
1361
- var res = []
1362
-
1363
- var i = start
1364
- while (i < end) {
1365
- var firstByte = buf[i]
1366
- var codePoint = null
1367
- var bytesPerSequence = (firstByte > 0xEF) ? 4
1368
- : (firstByte > 0xDF) ? 3
1369
- : (firstByte > 0xBF) ? 2
1370
- : 1
1371
-
1372
- if (i + bytesPerSequence <= end) {
1373
- var secondByte, thirdByte, fourthByte, tempCodePoint
1374
-
1375
- switch (bytesPerSequence) {
1376
- case 1:
1377
- if (firstByte < 0x80) {
1378
- codePoint = firstByte
1379
- }
1380
- break
1381
- case 2:
1382
- secondByte = buf[i + 1]
1383
- if ((secondByte & 0xC0) === 0x80) {
1384
- tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
1385
- if (tempCodePoint > 0x7F) {
1386
- codePoint = tempCodePoint
1387
- }
1388
- }
1389
- break
1390
- case 3:
1391
- secondByte = buf[i + 1]
1392
- thirdByte = buf[i + 2]
1393
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
1394
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
1395
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
1396
- codePoint = tempCodePoint
1397
- }
1398
- }
1399
- break
1400
- case 4:
1401
- secondByte = buf[i + 1]
1402
- thirdByte = buf[i + 2]
1403
- fourthByte = buf[i + 3]
1404
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
1405
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
1406
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
1407
- codePoint = tempCodePoint
1408
- }
1409
- }
1410
- }
1411
- }
1412
-
1413
- if (codePoint === null) {
1414
- // we did not generate a valid codePoint so insert a
1415
- // replacement char (U+FFFD) and advance only 1 byte
1416
- codePoint = 0xFFFD
1417
- bytesPerSequence = 1
1418
- } else if (codePoint > 0xFFFF) {
1419
- // encode to utf16 (surrogate pair dance)
1420
- codePoint -= 0x10000
1421
- res.push(codePoint >>> 10 & 0x3FF | 0xD800)
1422
- codePoint = 0xDC00 | codePoint & 0x3FF
1423
- }
1424
-
1425
- res.push(codePoint)
1426
- i += bytesPerSequence
1427
- }
1428
-
1429
- return decodeCodePointsArray(res)
1430
- }
1431
-
1432
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
1433
- // the lowest limit is Chrome, with 0x10000 args.
1434
- // We go 1 magnitude less, for safety
1435
- var MAX_ARGUMENTS_LENGTH = 0x1000
1436
-
1437
- function decodeCodePointsArray (codePoints) {
1438
- var len = codePoints.length
1439
- if (len <= MAX_ARGUMENTS_LENGTH) {
1440
- return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1441
- }
1442
-
1443
- // Decode in chunks to avoid "call stack size exceeded".
1444
- var res = ''
1445
- var i = 0
1446
- while (i < len) {
1447
- res += String.fromCharCode.apply(
1448
- String,
1449
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1450
- )
1451
- }
1452
- return res
1453
- }
1454
-
1455
- function asciiSlice (buf, start, end) {
1456
- var ret = ''
1457
- end = Math.min(buf.length, end)
1458
-
1459
- for (var i = start; i < end; ++i) {
1460
- ret += String.fromCharCode(buf[i] & 0x7F)
1461
- }
1462
- return ret
1463
- }
1464
-
1465
- function latin1Slice (buf, start, end) {
1466
- var ret = ''
1467
- end = Math.min(buf.length, end)
1468
-
1469
- for (var i = start; i < end; ++i) {
1470
- ret += String.fromCharCode(buf[i])
1471
- }
1472
- return ret
1473
- }
1474
-
1475
- function hexSlice (buf, start, end) {
1476
- var len = buf.length
1477
-
1478
- if (!start || start < 0) start = 0
1479
- if (!end || end < 0 || end > len) end = len
1480
-
1481
- var out = ''
1482
- for (var i = start; i < end; ++i) {
1483
- out += toHex(buf[i])
1484
- }
1485
- return out
1486
- }
1487
-
1488
- function utf16leSlice (buf, start, end) {
1489
- var bytes = buf.slice(start, end)
1490
- var res = ''
1491
- for (var i = 0; i < bytes.length; i += 2) {
1492
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
1493
- }
1494
- return res
1495
- }
1496
-
1497
- Buffer.prototype.slice = function slice (start, end) {
1498
- var len = this.length
1499
- start = ~~start
1500
- end = end === undefined ? len : ~~end
1501
-
1502
- if (start < 0) {
1503
- start += len
1504
- if (start < 0) start = 0
1505
- } else if (start > len) {
1506
- start = len
1507
- }
1508
-
1509
- if (end < 0) {
1510
- end += len
1511
- if (end < 0) end = 0
1512
- } else if (end > len) {
1513
- end = len
1514
- }
1515
-
1516
- if (end < start) end = start
1517
-
1518
- var newBuf
1519
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1520
- newBuf = this.subarray(start, end)
1521
- newBuf.__proto__ = Buffer.prototype
1522
- } else {
1523
- var sliceLen = end - start
1524
- newBuf = new Buffer(sliceLen, undefined)
1525
- for (var i = 0; i < sliceLen; ++i) {
1526
- newBuf[i] = this[i + start]
1527
- }
1528
- }
1529
-
1530
- return newBuf
1531
- }
1532
-
1533
- /*
1534
- * Need to make sure that buffer isn't trying to write out of bounds.
1535
- */
1536
- function checkOffset (offset, ext, length) {
1537
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1538
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1539
- }
1540
-
1541
- Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1542
- offset = offset | 0
1543
- byteLength = byteLength | 0
1544
- if (!noAssert) checkOffset(offset, byteLength, this.length)
1545
-
1546
- var val = this[offset]
1547
- var mul = 1
1548
- var i = 0
1549
- while (++i < byteLength && (mul *= 0x100)) {
1550
- val += this[offset + i] * mul
1551
- }
1552
-
1553
- return val
1554
- }
1555
-
1556
- Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1557
- offset = offset | 0
1558
- byteLength = byteLength | 0
1559
- if (!noAssert) {
1560
- checkOffset(offset, byteLength, this.length)
1561
- }
1562
-
1563
- var val = this[offset + --byteLength]
1564
- var mul = 1
1565
- while (byteLength > 0 && (mul *= 0x100)) {
1566
- val += this[offset + --byteLength] * mul
1567
- }
1568
-
1569
- return val
1570
- }
1571
-
1572
- Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1573
- if (!noAssert) checkOffset(offset, 1, this.length)
1574
- return this[offset]
1575
- }
1576
-
1577
- Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1578
- if (!noAssert) checkOffset(offset, 2, this.length)
1579
- return this[offset] | (this[offset + 1] << 8)
1580
- }
1581
-
1582
- Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1583
- if (!noAssert) checkOffset(offset, 2, this.length)
1584
- return (this[offset] << 8) | this[offset + 1]
1585
- }
1586
-
1587
- Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1588
- if (!noAssert) checkOffset(offset, 4, this.length)
1589
-
1590
- return ((this[offset]) |
1591
- (this[offset + 1] << 8) |
1592
- (this[offset + 2] << 16)) +
1593
- (this[offset + 3] * 0x1000000)
1594
- }
1595
-
1596
- Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1597
- if (!noAssert) checkOffset(offset, 4, this.length)
1598
-
1599
- return (this[offset] * 0x1000000) +
1600
- ((this[offset + 1] << 16) |
1601
- (this[offset + 2] << 8) |
1602
- this[offset + 3])
1603
- }
1604
-
1605
- Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1606
- offset = offset | 0
1607
- byteLength = byteLength | 0
1608
- if (!noAssert) checkOffset(offset, byteLength, this.length)
1609
-
1610
- var val = this[offset]
1611
- var mul = 1
1612
- var i = 0
1613
- while (++i < byteLength && (mul *= 0x100)) {
1614
- val += this[offset + i] * mul
1615
- }
1616
- mul *= 0x80
1617
-
1618
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
1619
-
1620
- return val
1621
- }
1622
-
1623
- Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1624
- offset = offset | 0
1625
- byteLength = byteLength | 0
1626
- if (!noAssert) checkOffset(offset, byteLength, this.length)
1627
-
1628
- var i = byteLength
1629
- var mul = 1
1630
- var val = this[offset + --i]
1631
- while (i > 0 && (mul *= 0x100)) {
1632
- val += this[offset + --i] * mul
1633
- }
1634
- mul *= 0x80
1635
-
1636
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
1637
-
1638
- return val
1639
- }
1640
-
1641
- Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1642
- if (!noAssert) checkOffset(offset, 1, this.length)
1643
- if (!(this[offset] & 0x80)) return (this[offset])
1644
- return ((0xff - this[offset] + 1) * -1)
1645
- }
1646
-
1647
- Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1648
- if (!noAssert) checkOffset(offset, 2, this.length)
1649
- var val = this[offset] | (this[offset + 1] << 8)
1650
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1651
- }
1652
-
1653
- Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1654
- if (!noAssert) checkOffset(offset, 2, this.length)
1655
- var val = this[offset + 1] | (this[offset] << 8)
1656
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1657
- }
1658
-
1659
- Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1660
- if (!noAssert) checkOffset(offset, 4, this.length)
1661
-
1662
- return (this[offset]) |
1663
- (this[offset + 1] << 8) |
1664
- (this[offset + 2] << 16) |
1665
- (this[offset + 3] << 24)
1666
- }
1667
-
1668
- Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1669
- if (!noAssert) checkOffset(offset, 4, this.length)
1670
-
1671
- return (this[offset] << 24) |
1672
- (this[offset + 1] << 16) |
1673
- (this[offset + 2] << 8) |
1674
- (this[offset + 3])
1675
- }
1676
-
1677
- Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1678
- if (!noAssert) checkOffset(offset, 4, this.length)
1679
- return ieee754.read(this, offset, true, 23, 4)
1680
- }
1681
-
1682
- Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1683
- if (!noAssert) checkOffset(offset, 4, this.length)
1684
- return ieee754.read(this, offset, false, 23, 4)
1685
- }
1686
-
1687
- Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1688
- if (!noAssert) checkOffset(offset, 8, this.length)
1689
- return ieee754.read(this, offset, true, 52, 8)
1690
- }
1691
-
1692
- Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1693
- if (!noAssert) checkOffset(offset, 8, this.length)
1694
- return ieee754.read(this, offset, false, 52, 8)
1695
- }
1696
-
1697
- function checkInt (buf, value, offset, ext, max, min) {
1698
- if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
1699
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
1700
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1701
- }
1702
-
1703
- Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1704
- value = +value
1705
- offset = offset | 0
1706
- byteLength = byteLength | 0
1707
- if (!noAssert) {
1708
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
1709
- checkInt(this, value, offset, byteLength, maxBytes, 0)
1710
- }
1711
-
1712
- var mul = 1
1713
- var i = 0
1714
- this[offset] = value & 0xFF
1715
- while (++i < byteLength && (mul *= 0x100)) {
1716
- this[offset + i] = (value / mul) & 0xFF
1717
- }
1718
-
1719
- return offset + byteLength
1720
- }
1721
-
1722
- Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1723
- value = +value
1724
- offset = offset | 0
1725
- byteLength = byteLength | 0
1726
- if (!noAssert) {
1727
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
1728
- checkInt(this, value, offset, byteLength, maxBytes, 0)
1729
- }
1730
-
1731
- var i = byteLength - 1
1732
- var mul = 1
1733
- this[offset + i] = value & 0xFF
1734
- while (--i >= 0 && (mul *= 0x100)) {
1735
- this[offset + i] = (value / mul) & 0xFF
1736
- }
1737
-
1738
- return offset + byteLength
1739
- }
1740
-
1741
- Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1742
- value = +value
1743
- offset = offset | 0
1744
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
1745
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
1746
- this[offset] = (value & 0xff)
1747
- return offset + 1
1748
- }
1749
-
1750
- function objectWriteUInt16 (buf, value, offset, littleEndian) {
1751
- if (value < 0) value = 0xffff + value + 1
1752
- for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
1753
- buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
1754
- (littleEndian ? i : 1 - i) * 8
1755
- }
1756
- }
1757
-
1758
- Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1759
- value = +value
1760
- offset = offset | 0
1761
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1762
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1763
- this[offset] = (value & 0xff)
1764
- this[offset + 1] = (value >>> 8)
1765
- } else {
1766
- objectWriteUInt16(this, value, offset, true)
1767
- }
1768
- return offset + 2
1769
- }
1770
-
1771
- Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1772
- value = +value
1773
- offset = offset | 0
1774
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1775
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1776
- this[offset] = (value >>> 8)
1777
- this[offset + 1] = (value & 0xff)
1778
- } else {
1779
- objectWriteUInt16(this, value, offset, false)
1780
- }
1781
- return offset + 2
1782
- }
1783
-
1784
- function objectWriteUInt32 (buf, value, offset, littleEndian) {
1785
- if (value < 0) value = 0xffffffff + value + 1
1786
- for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
1787
- buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
1788
- }
1789
- }
1790
-
1791
- Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1792
- value = +value
1793
- offset = offset | 0
1794
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1795
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1796
- this[offset + 3] = (value >>> 24)
1797
- this[offset + 2] = (value >>> 16)
1798
- this[offset + 1] = (value >>> 8)
1799
- this[offset] = (value & 0xff)
1800
- } else {
1801
- objectWriteUInt32(this, value, offset, true)
1802
- }
1803
- return offset + 4
1804
- }
1805
-
1806
- Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1807
- value = +value
1808
- offset = offset | 0
1809
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1810
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1811
- this[offset] = (value >>> 24)
1812
- this[offset + 1] = (value >>> 16)
1813
- this[offset + 2] = (value >>> 8)
1814
- this[offset + 3] = (value & 0xff)
1815
- } else {
1816
- objectWriteUInt32(this, value, offset, false)
1817
- }
1818
- return offset + 4
1819
- }
1820
-
1821
- Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1822
- value = +value
1823
- offset = offset | 0
1824
- if (!noAssert) {
1825
- var limit = Math.pow(2, 8 * byteLength - 1)
1826
-
1827
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
1828
- }
1829
-
1830
- var i = 0
1831
- var mul = 1
1832
- var sub = 0
1833
- this[offset] = value & 0xFF
1834
- while (++i < byteLength && (mul *= 0x100)) {
1835
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1836
- sub = 1
1837
- }
1838
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1839
- }
1840
-
1841
- return offset + byteLength
1842
- }
1843
-
1844
- Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1845
- value = +value
1846
- offset = offset | 0
1847
- if (!noAssert) {
1848
- var limit = Math.pow(2, 8 * byteLength - 1)
1849
-
1850
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
1851
- }
1852
-
1853
- var i = byteLength - 1
1854
- var mul = 1
1855
- var sub = 0
1856
- this[offset + i] = value & 0xFF
1857
- while (--i >= 0 && (mul *= 0x100)) {
1858
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1859
- sub = 1
1860
- }
1861
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1862
- }
1863
-
1864
- return offset + byteLength
1865
- }
1866
-
1867
- Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1868
- value = +value
1869
- offset = offset | 0
1870
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
1871
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
1872
- if (value < 0) value = 0xff + value + 1
1873
- this[offset] = (value & 0xff)
1874
- return offset + 1
1875
- }
1876
-
1877
- Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1878
- value = +value
1879
- offset = offset | 0
1880
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1881
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1882
- this[offset] = (value & 0xff)
1883
- this[offset + 1] = (value >>> 8)
1884
- } else {
1885
- objectWriteUInt16(this, value, offset, true)
1886
- }
1887
- return offset + 2
1888
- }
1889
-
1890
- Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1891
- value = +value
1892
- offset = offset | 0
1893
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1894
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1895
- this[offset] = (value >>> 8)
1896
- this[offset + 1] = (value & 0xff)
1897
- } else {
1898
- objectWriteUInt16(this, value, offset, false)
1899
- }
1900
- return offset + 2
1901
- }
1902
-
1903
- Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1904
- value = +value
1905
- offset = offset | 0
1906
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1907
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1908
- this[offset] = (value & 0xff)
1909
- this[offset + 1] = (value >>> 8)
1910
- this[offset + 2] = (value >>> 16)
1911
- this[offset + 3] = (value >>> 24)
1912
- } else {
1913
- objectWriteUInt32(this, value, offset, true)
1914
- }
1915
- return offset + 4
1916
- }
1917
-
1918
- Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1919
- value = +value
1920
- offset = offset | 0
1921
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1922
- if (value < 0) value = 0xffffffff + value + 1
1923
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1924
- this[offset] = (value >>> 24)
1925
- this[offset + 1] = (value >>> 16)
1926
- this[offset + 2] = (value >>> 8)
1927
- this[offset + 3] = (value & 0xff)
1928
- } else {
1929
- objectWriteUInt32(this, value, offset, false)
1930
- }
1931
- return offset + 4
1932
- }
1933
-
1934
- function checkIEEE754 (buf, value, offset, ext, max, min) {
1935
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1936
- if (offset < 0) throw new RangeError('Index out of range')
1937
- }
1938
-
1939
- function writeFloat (buf, value, offset, littleEndian, noAssert) {
1940
- if (!noAssert) {
1941
- checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
1942
- }
1943
- ieee754.write(buf, value, offset, littleEndian, 23, 4)
1944
- return offset + 4
1945
- }
1946
-
1947
- Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1948
- return writeFloat(this, value, offset, true, noAssert)
1949
- }
1950
-
1951
- Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1952
- return writeFloat(this, value, offset, false, noAssert)
1953
- }
1954
-
1955
- function writeDouble (buf, value, offset, littleEndian, noAssert) {
1956
- if (!noAssert) {
1957
- checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
1958
- }
1959
- ieee754.write(buf, value, offset, littleEndian, 52, 8)
1960
- return offset + 8
1961
- }
1962
-
1963
- Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1964
- return writeDouble(this, value, offset, true, noAssert)
1965
- }
1966
-
1967
- Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1968
- return writeDouble(this, value, offset, false, noAssert)
1969
- }
1970
-
1971
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1972
- Buffer.prototype.copy = function copy (target, targetStart, start, end) {
1973
- if (!start) start = 0
1974
- if (!end && end !== 0) end = this.length
1975
- if (targetStart >= target.length) targetStart = target.length
1976
- if (!targetStart) targetStart = 0
1977
- if (end > 0 && end < start) end = start
1978
-
1979
- // Copy 0 bytes; we're done
1980
- if (end === start) return 0
1981
- if (target.length === 0 || this.length === 0) return 0
1982
-
1983
- // Fatal error conditions
1984
- if (targetStart < 0) {
1985
- throw new RangeError('targetStart out of bounds')
1986
- }
1987
- if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
1988
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
1989
-
1990
- // Are we oob?
1991
- if (end > this.length) end = this.length
1992
- if (target.length - targetStart < end - start) {
1993
- end = target.length - targetStart + start
1994
- }
1995
-
1996
- var len = end - start
1997
- var i
1998
-
1999
- if (this === target && start < targetStart && targetStart < end) {
2000
- // descending copy from end
2001
- for (i = len - 1; i >= 0; --i) {
2002
- target[i + targetStart] = this[i + start]
2003
- }
2004
- } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
2005
- // ascending copy from start
2006
- for (i = 0; i < len; ++i) {
2007
- target[i + targetStart] = this[i + start]
2008
- }
2009
- } else {
2010
- Uint8Array.prototype.set.call(
2011
- target,
2012
- this.subarray(start, start + len),
2013
- targetStart
2014
- )
2015
- }
2016
-
2017
- return len
2018
- }
2019
-
2020
- // Usage:
2021
- // buffer.fill(number[, offset[, end]])
2022
- // buffer.fill(buffer[, offset[, end]])
2023
- // buffer.fill(string[, offset[, end]][, encoding])
2024
- Buffer.prototype.fill = function fill (val, start, end, encoding) {
2025
- // Handle string cases:
2026
- if (typeof val === 'string') {
2027
- if (typeof start === 'string') {
2028
- encoding = start
2029
- start = 0
2030
- end = this.length
2031
- } else if (typeof end === 'string') {
2032
- encoding = end
2033
- end = this.length
2034
- }
2035
- if (val.length === 1) {
2036
- var code = val.charCodeAt(0)
2037
- if (code < 256) {
2038
- val = code
2039
- }
2040
- }
2041
- if (encoding !== undefined && typeof encoding !== 'string') {
2042
- throw new TypeError('encoding must be a string')
2043
- }
2044
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
2045
- throw new TypeError('Unknown encoding: ' + encoding)
2046
- }
2047
- } else if (typeof val === 'number') {
2048
- val = val & 255
2049
- }
2050
-
2051
- // Invalid ranges are not set to a default, so can range check early.
2052
- if (start < 0 || this.length < start || this.length < end) {
2053
- throw new RangeError('Out of range index')
2054
- }
2055
-
2056
- if (end <= start) {
2057
- return this
2058
- }
2059
-
2060
- start = start >>> 0
2061
- end = end === undefined ? this.length : end >>> 0
2062
-
2063
- if (!val) val = 0
2064
-
2065
- var i
2066
- if (typeof val === 'number') {
2067
- for (i = start; i < end; ++i) {
2068
- this[i] = val
2069
- }
2070
- } else {
2071
- var bytes = Buffer.isBuffer(val)
2072
- ? val
2073
- : utf8ToBytes(new Buffer(val, encoding).toString())
2074
- var len = bytes.length
2075
- for (i = 0; i < end - start; ++i) {
2076
- this[i + start] = bytes[i % len]
2077
- }
2078
- }
2079
-
2080
- return this
2081
- }
2082
-
2083
- // HELPER FUNCTIONS
2084
- // ================
2085
-
2086
- var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
2087
-
2088
- function base64clean (str) {
2089
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
2090
- str = stringtrim(str).replace(INVALID_BASE64_RE, '')
2091
- // Node converts strings with length < 2 to ''
2092
- if (str.length < 2) return ''
2093
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
2094
- while (str.length % 4 !== 0) {
2095
- str = str + '='
2096
- }
2097
- return str
2098
- }
2099
-
2100
- function stringtrim (str) {
2101
- if (str.trim) return str.trim()
2102
- return str.replace(/^\s+|\s+$/g, '')
2103
- }
2104
-
2105
- function toHex (n) {
2106
- if (n < 16) return '0' + n.toString(16)
2107
- return n.toString(16)
2108
- }
2109
-
2110
- function utf8ToBytes (string, units) {
2111
- units = units || Infinity
2112
- var codePoint
2113
- var length = string.length
2114
- var leadSurrogate = null
2115
- var bytes = []
2116
-
2117
- for (var i = 0; i < length; ++i) {
2118
- codePoint = string.charCodeAt(i)
2119
-
2120
- // is surrogate component
2121
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
2122
- // last char was a lead
2123
- if (!leadSurrogate) {
2124
- // no lead yet
2125
- if (codePoint > 0xDBFF) {
2126
- // unexpected trail
2127
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
2128
- continue
2129
- } else if (i + 1 === length) {
2130
- // unpaired lead
2131
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
2132
- continue
2133
- }
2134
-
2135
- // valid lead
2136
- leadSurrogate = codePoint
2137
-
2138
- continue
2139
- }
2140
-
2141
- // 2 leads in a row
2142
- if (codePoint < 0xDC00) {
2143
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
2144
- leadSurrogate = codePoint
2145
- continue
2146
- }
2147
-
2148
- // valid surrogate pair
2149
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
2150
- } else if (leadSurrogate) {
2151
- // valid bmp char, but last char was a lead
2152
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
2153
- }
2154
-
2155
- leadSurrogate = null
2156
-
2157
- // encode utf8
2158
- if (codePoint < 0x80) {
2159
- if ((units -= 1) < 0) break
2160
- bytes.push(codePoint)
2161
- } else if (codePoint < 0x800) {
2162
- if ((units -= 2) < 0) break
2163
- bytes.push(
2164
- codePoint >> 0x6 | 0xC0,
2165
- codePoint & 0x3F | 0x80
2166
- )
2167
- } else if (codePoint < 0x10000) {
2168
- if ((units -= 3) < 0) break
2169
- bytes.push(
2170
- codePoint >> 0xC | 0xE0,
2171
- codePoint >> 0x6 & 0x3F | 0x80,
2172
- codePoint & 0x3F | 0x80
2173
- )
2174
- } else if (codePoint < 0x110000) {
2175
- if ((units -= 4) < 0) break
2176
- bytes.push(
2177
- codePoint >> 0x12 | 0xF0,
2178
- codePoint >> 0xC & 0x3F | 0x80,
2179
- codePoint >> 0x6 & 0x3F | 0x80,
2180
- codePoint & 0x3F | 0x80
2181
- )
2182
- } else {
2183
- throw new Error('Invalid code point')
2184
- }
2185
- }
2186
-
2187
- return bytes
2188
- }
2189
-
2190
- function asciiToBytes (str) {
2191
- var byteArray = []
2192
- for (var i = 0; i < str.length; ++i) {
2193
- // Node's code seems to be doing this and not & 0x7F..
2194
- byteArray.push(str.charCodeAt(i) & 0xFF)
2195
- }
2196
- return byteArray
2197
- }
2198
-
2199
- function utf16leToBytes (str, units) {
2200
- var c, hi, lo
2201
- var byteArray = []
2202
- for (var i = 0; i < str.length; ++i) {
2203
- if ((units -= 2) < 0) break
2204
-
2205
- c = str.charCodeAt(i)
2206
- hi = c >> 8
2207
- lo = c % 256
2208
- byteArray.push(lo)
2209
- byteArray.push(hi)
2210
- }
2211
-
2212
- return byteArray
2213
- }
2214
-
2215
- function base64ToBytes (str) {
2216
- return base64.toByteArray(base64clean(str))
2217
- }
2218
-
2219
- function blitBuffer (src, dst, offset, length) {
2220
- for (var i = 0; i < length; ++i) {
2221
- if ((i + offset >= dst.length) || (i >= src.length)) break
2222
- dst[i + offset] = src[i]
2223
- }
2224
- return i
2225
- }
2226
-
2227
- function isnan (val) {
2228
- return val !== val // eslint-disable-line no-self-compare
2229
- }
2230
-
2231
- /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
2232
-
2233
- /***/ },
2234
- /* 4 */
2235
- /***/ function(module, exports) {
2236
-
2237
- 'use strict'
2238
-
2239
- exports.byteLength = byteLength
2240
- exports.toByteArray = toByteArray
2241
- exports.fromByteArray = fromByteArray
2242
-
2243
- var lookup = []
2244
- var revLookup = []
2245
- var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
2246
-
2247
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
2248
- for (var i = 0, len = code.length; i < len; ++i) {
2249
- lookup[i] = code[i]
2250
- revLookup[code.charCodeAt(i)] = i
236
+ return toString.call(val) === '[object File]';
2251
237
  }
2252
238
 
2253
- revLookup['-'.charCodeAt(0)] = 62
2254
- revLookup['_'.charCodeAt(0)] = 63
2255
-
2256
- function placeHoldersCount (b64) {
2257
- var len = b64.length
2258
- if (len % 4 > 0) {
2259
- throw new Error('Invalid string. Length must be a multiple of 4')
2260
- }
2261
-
2262
- // the number of equal signs (place holders)
2263
- // if there are two placeholders, than the two characters before it
2264
- // represent one byte
2265
- // if there is only one, then the three characters before it represent 2 bytes
2266
- // this is just a cheap hack to not do indexOf twice
2267
- return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
239
+ /**
240
+ * Determine if a value is a Blob
241
+ *
242
+ * @param {Object} val The value to test
243
+ * @returns {boolean} True if value is a Blob, otherwise false
244
+ */
245
+ function isBlob(val) {
246
+ return toString.call(val) === '[object Blob]';
2268
247
  }
2269
248
 
2270
- function byteLength (b64) {
2271
- // base64 is 4/3 + up to two characters of the original data
2272
- return b64.length * 3 / 4 - placeHoldersCount(b64)
249
+ /**
250
+ * Determine if a value is a Function
251
+ *
252
+ * @param {Object} val The value to test
253
+ * @returns {boolean} True if value is a Function, otherwise false
254
+ */
255
+ function isFunction(val) {
256
+ return toString.call(val) === '[object Function]';
2273
257
  }
2274
258
 
2275
- function toByteArray (b64) {
2276
- var i, j, l, tmp, placeHolders, arr
2277
- var len = b64.length
2278
- placeHolders = placeHoldersCount(b64)
2279
-
2280
- arr = new Arr(len * 3 / 4 - placeHolders)
2281
-
2282
- // if there are placeholders, only get up to the last complete 4 chars
2283
- l = placeHolders > 0 ? len - 4 : len
2284
-
2285
- var L = 0
2286
-
2287
- for (i = 0, j = 0; i < l; i += 4, j += 3) {
2288
- tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
2289
- arr[L++] = (tmp >> 16) & 0xFF
2290
- arr[L++] = (tmp >> 8) & 0xFF
2291
- arr[L++] = tmp & 0xFF
2292
- }
2293
-
2294
- if (placeHolders === 2) {
2295
- tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
2296
- arr[L++] = tmp & 0xFF
2297
- } else if (placeHolders === 1) {
2298
- tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
2299
- arr[L++] = (tmp >> 8) & 0xFF
2300
- arr[L++] = tmp & 0xFF
2301
- }
259
+ /**
260
+ * Determine if a value is a Stream
261
+ *
262
+ * @param {Object} val The value to test
263
+ * @returns {boolean} True if value is a Stream, otherwise false
264
+ */
265
+ function isStream(val) {
266
+ return isObject(val) && isFunction(val.pipe);
267
+ }
2302
268
 
2303
- return arr
269
+ /**
270
+ * Determine if a value is a URLSearchParams object
271
+ *
272
+ * @param {Object} val The value to test
273
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
274
+ */
275
+ function isURLSearchParams(val) {
276
+ return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
2304
277
  }
2305
278
 
2306
- function tripletToBase64 (num) {
2307
- return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
279
+ /**
280
+ * Trim excess whitespace off the beginning and end of a string
281
+ *
282
+ * @param {String} str The String to trim
283
+ * @returns {String} The String freed of excess whitespace
284
+ */
285
+ function trim(str) {
286
+ return str.replace(/^\s*/, '').replace(/\s*$/, '');
2308
287
  }
2309
288
 
2310
- function encodeChunk (uint8, start, end) {
2311
- var tmp
2312
- var output = []
2313
- for (var i = start; i < end; i += 3) {
2314
- tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
2315
- output.push(tripletToBase64(tmp))
289
+ /**
290
+ * Determine if we're running in a standard browser environment
291
+ *
292
+ * This allows axios to run in a web worker, and react-native.
293
+ * Both environments support XMLHttpRequest, but not fully standard globals.
294
+ *
295
+ * web workers:
296
+ * typeof window -> undefined
297
+ * typeof document -> undefined
298
+ *
299
+ * react-native:
300
+ * navigator.product -> 'ReactNative'
301
+ */
302
+ function isStandardBrowserEnv() {
303
+ if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
304
+ return false;
2316
305
  }
2317
- return output.join('')
306
+ return (
307
+ typeof window !== 'undefined' &&
308
+ typeof document !== 'undefined'
309
+ );
2318
310
  }
2319
311
 
2320
- function fromByteArray (uint8) {
2321
- var tmp
2322
- var len = uint8.length
2323
- var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
2324
- var output = ''
2325
- var parts = []
2326
- var maxChunkLength = 16383 // must be multiple of 3
2327
-
2328
- // go through the array every three bytes, we'll deal with trailing stuff later
2329
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
2330
- parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
312
+ /**
313
+ * Iterate over an Array or an Object invoking a function for each item.
314
+ *
315
+ * If `obj` is an Array callback will be called passing
316
+ * the value, index, and complete array for each item.
317
+ *
318
+ * If 'obj' is an Object callback will be called passing
319
+ * the value, key, and complete object for each property.
320
+ *
321
+ * @param {Object|Array} obj The object to iterate
322
+ * @param {Function} fn The callback to invoke for each item
323
+ */
324
+ function forEach(obj, fn) {
325
+ // Don't bother if no value provided
326
+ if (obj === null || typeof obj === 'undefined') {
327
+ return;
2331
328
  }
2332
329
 
2333
- // pad the end with zeros, but make sure to not forget the extra bytes
2334
- if (extraBytes === 1) {
2335
- tmp = uint8[len - 1]
2336
- output += lookup[tmp >> 2]
2337
- output += lookup[(tmp << 4) & 0x3F]
2338
- output += '=='
2339
- } else if (extraBytes === 2) {
2340
- tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
2341
- output += lookup[tmp >> 10]
2342
- output += lookup[(tmp >> 4) & 0x3F]
2343
- output += lookup[(tmp << 2) & 0x3F]
2344
- output += '='
330
+ // Force an array if not already something iterable
331
+ if (typeof obj !== 'object') {
332
+ /*eslint no-param-reassign:0*/
333
+ obj = [obj];
2345
334
  }
2346
335
 
2347
- parts.push(output)
2348
-
2349
- return parts.join('')
2350
- }
2351
-
2352
-
2353
- /***/ },
2354
- /* 5 */
2355
- /***/ function(module, exports) {
2356
-
2357
- exports.read = function (buffer, offset, isLE, mLen, nBytes) {
2358
- var e, m
2359
- var eLen = nBytes * 8 - mLen - 1
2360
- var eMax = (1 << eLen) - 1
2361
- var eBias = eMax >> 1
2362
- var nBits = -7
2363
- var i = isLE ? (nBytes - 1) : 0
2364
- var d = isLE ? -1 : 1
2365
- var s = buffer[offset + i]
2366
-
2367
- i += d
2368
-
2369
- e = s & ((1 << (-nBits)) - 1)
2370
- s >>= (-nBits)
2371
- nBits += eLen
2372
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
2373
-
2374
- m = e & ((1 << (-nBits)) - 1)
2375
- e >>= (-nBits)
2376
- nBits += mLen
2377
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
2378
-
2379
- if (e === 0) {
2380
- e = 1 - eBias
2381
- } else if (e === eMax) {
2382
- return m ? NaN : ((s ? -1 : 1) * Infinity)
336
+ if (isArray(obj)) {
337
+ // Iterate over array values
338
+ for (var i = 0, l = obj.length; i < l; i++) {
339
+ fn.call(null, obj[i], i, obj);
340
+ }
2383
341
  } else {
2384
- m = m + Math.pow(2, mLen)
2385
- e = e - eBias
342
+ // Iterate over object keys
343
+ for (var key in obj) {
344
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
345
+ fn.call(null, obj[key], key, obj);
346
+ }
347
+ }
2386
348
  }
2387
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
2388
349
  }
2389
350
 
2390
- exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
2391
- var e, m, c
2392
- var eLen = nBytes * 8 - mLen - 1
2393
- var eMax = (1 << eLen) - 1
2394
- var eBias = eMax >> 1
2395
- var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
2396
- var i = isLE ? 0 : (nBytes - 1)
2397
- var d = isLE ? 1 : -1
2398
- var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
2399
-
2400
- value = Math.abs(value)
2401
-
2402
- if (isNaN(value) || value === Infinity) {
2403
- m = isNaN(value) ? 1 : 0
2404
- e = eMax
2405
- } else {
2406
- e = Math.floor(Math.log(value) / Math.LN2)
2407
- if (value * (c = Math.pow(2, -e)) < 1) {
2408
- e--
2409
- c *= 2
2410
- }
2411
- if (e + eBias >= 1) {
2412
- value += rt / c
2413
- } else {
2414
- value += rt * Math.pow(2, 1 - eBias)
2415
- }
2416
- if (value * c >= 2) {
2417
- e++
2418
- c /= 2
2419
- }
2420
-
2421
- if (e + eBias >= eMax) {
2422
- m = 0
2423
- e = eMax
2424
- } else if (e + eBias >= 1) {
2425
- m = (value * c - 1) * Math.pow(2, mLen)
2426
- e = e + eBias
351
+ /**
352
+ * Accepts varargs expecting each argument to be an object, then
353
+ * immutably merges the properties of each object and returns result.
354
+ *
355
+ * When multiple objects contain the same key the later object in
356
+ * the arguments list will take precedence.
357
+ *
358
+ * Example:
359
+ *
360
+ * ```js
361
+ * var result = merge({foo: 123}, {foo: 456});
362
+ * console.log(result.foo); // outputs 456
363
+ * ```
364
+ *
365
+ * @param {Object} obj1 Object to merge
366
+ * @returns {Object} Result of all merge properties
367
+ */
368
+ function merge(/* obj1, obj2, obj3, ... */) {
369
+ var result = {};
370
+ function assignValue(val, key) {
371
+ if (typeof result[key] === 'object' && typeof val === 'object') {
372
+ result[key] = merge(result[key], val);
2427
373
  } else {
2428
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
2429
- e = 0
374
+ result[key] = val;
2430
375
  }
2431
376
  }
2432
377
 
2433
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
2434
-
2435
- e = (e << mLen) | m
2436
- eLen += mLen
2437
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
378
+ for (var i = 0, l = arguments.length; i < l; i++) {
379
+ forEach(arguments[i], assignValue);
380
+ }
381
+ return result;
382
+ }
2438
383
 
2439
- buffer[offset + i - d] |= s * 128
384
+ /**
385
+ * Extends object a by mutably adding to it the properties of object b.
386
+ *
387
+ * @param {Object} a The object to be extended
388
+ * @param {Object} b The object to copy properties from
389
+ * @param {Object} thisArg The object to bind function to
390
+ * @return {Object} The resulting value of object a
391
+ */
392
+ function extend(a, b, thisArg) {
393
+ forEach(b, function assignValue(val, key) {
394
+ if (thisArg && typeof val === 'function') {
395
+ a[key] = bind(val, thisArg);
396
+ } else {
397
+ a[key] = val;
398
+ }
399
+ });
400
+ return a;
2440
401
  }
2441
-
2442
-
2443
- /***/ },
2444
- /* 6 */
2445
- /***/ function(module, exports) {
2446
-
2447
- var toString = {}.toString;
2448
402
 
2449
- module.exports = Array.isArray || function (arr) {
2450
- return toString.call(arr) == '[object Array]';
403
+ module.exports = {
404
+ isArray: isArray,
405
+ isArrayBuffer: isArrayBuffer,
406
+ isBuffer: isBuffer,
407
+ isFormData: isFormData,
408
+ isArrayBufferView: isArrayBufferView,
409
+ isString: isString,
410
+ isNumber: isNumber,
411
+ isObject: isObject,
412
+ isUndefined: isUndefined,
413
+ isDate: isDate,
414
+ isFile: isFile,
415
+ isBlob: isBlob,
416
+ isFunction: isFunction,
417
+ isStream: isStream,
418
+ isURLSearchParams: isURLSearchParams,
419
+ isStandardBrowserEnv: isStandardBrowserEnv,
420
+ forEach: forEach,
421
+ merge: merge,
422
+ extend: extend,
423
+ trim: trim
2451
424
  };
2452
425
 
2453
426
 
2454
- /***/ },
2455
- /* 7 */
2456
- /***/ function(module, exports) {
427
+ /***/ }),
428
+ /* 3 */
429
+ /***/ (function(module, exports) {
2457
430
 
2458
431
  'use strict';
2459
432
 
@@ -2468,18 +441,43 @@ return /******/ (function(modules) { // webpackBootstrap
2468
441
  };
2469
442
 
2470
443
 
2471
- /***/ },
2472
- /* 8 */
2473
- /***/ function(module, exports, __webpack_require__) {
444
+ /***/ }),
445
+ /* 4 */
446
+ /***/ (function(module, exports) {
447
+
448
+ /*!
449
+ * Determine if an object is a Buffer
450
+ *
451
+ * @author Feross Aboukhadijeh <https://feross.org>
452
+ * @license MIT
453
+ */
454
+
455
+ // The _isBuffer check is for Safari 5-7 support, because it's missing
456
+ // Object.prototype.constructor. Remove this eventually
457
+ module.exports = function (obj) {
458
+ return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
459
+ }
460
+
461
+ function isBuffer (obj) {
462
+ return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
463
+ }
464
+
465
+ // For Node v0.10 support. Remove this eventually.
466
+ function isSlowBuffer (obj) {
467
+ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
468
+ }
469
+
470
+
471
+ /***/ }),
472
+ /* 5 */
473
+ /***/ (function(module, exports, __webpack_require__) {
2474
474
 
2475
475
  'use strict';
2476
476
 
2477
- var defaults = __webpack_require__(9);
477
+ var defaults = __webpack_require__(6);
2478
478
  var utils = __webpack_require__(2);
2479
- var InterceptorManager = __webpack_require__(20);
2480
- var dispatchRequest = __webpack_require__(21);
2481
- var isAbsoluteURL = __webpack_require__(24);
2482
- var combineURLs = __webpack_require__(25);
479
+ var InterceptorManager = __webpack_require__(17);
480
+ var dispatchRequest = __webpack_require__(18);
2483
481
 
2484
482
  /**
2485
483
  * Create a new instance of Axios
@@ -2508,12 +506,8 @@ return /******/ (function(modules) { // webpackBootstrap
2508
506
  }, arguments[1]);
2509
507
  }
2510
508
 
2511
- config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
2512
-
2513
- // Support baseURL config
2514
- if (config.baseURL && !isAbsoluteURL(config.url)) {
2515
- config.url = combineURLs(config.baseURL, config.url);
2516
- }
509
+ config = utils.merge(defaults, {method: 'get'}, this.defaults, config);
510
+ config.method = config.method.toLowerCase();
2517
511
 
2518
512
  // Hook up interceptors middleware
2519
513
  var chain = [dispatchRequest, undefined];
@@ -2559,14 +553,14 @@ return /******/ (function(modules) { // webpackBootstrap
2559
553
  module.exports = Axios;
2560
554
 
2561
555
 
2562
- /***/ },
2563
- /* 9 */
2564
- /***/ function(module, exports, __webpack_require__) {
556
+ /***/ }),
557
+ /* 6 */
558
+ /***/ (function(module, exports, __webpack_require__) {
2565
559
 
2566
560
  'use strict';
2567
561
 
2568
562
  var utils = __webpack_require__(2);
2569
- var normalizeHeaderName = __webpack_require__(10);
563
+ var normalizeHeaderName = __webpack_require__(7);
2570
564
 
2571
565
  var DEFAULT_CONTENT_TYPE = {
2572
566
  'Content-Type': 'application/x-www-form-urlencoded'
@@ -2582,10 +576,10 @@ return /******/ (function(modules) { // webpackBootstrap
2582
576
  var adapter;
2583
577
  if (typeof XMLHttpRequest !== 'undefined') {
2584
578
  // For browsers use XHR adapter
2585
- adapter = __webpack_require__(11);
579
+ adapter = __webpack_require__(8);
2586
580
  } else if (typeof process !== 'undefined') {
2587
581
  // For node use HTTP adapter
2588
- adapter = __webpack_require__(11);
582
+ adapter = __webpack_require__(8);
2589
583
  }
2590
584
  return adapter;
2591
585
  }
@@ -2628,6 +622,10 @@ return /******/ (function(modules) { // webpackBootstrap
2628
622
  return data;
2629
623
  }],
2630
624
 
625
+ /**
626
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
627
+ * timeout is not created.
628
+ */
2631
629
  timeout: 0,
2632
630
 
2633
631
  xsrfCookieName: 'XSRF-TOKEN',
@@ -2657,9 +655,9 @@ return /******/ (function(modules) { // webpackBootstrap
2657
655
  module.exports = defaults;
2658
656
 
2659
657
 
2660
- /***/ },
2661
- /* 10 */
2662
- /***/ function(module, exports, __webpack_require__) {
658
+ /***/ }),
659
+ /* 7 */
660
+ /***/ (function(module, exports, __webpack_require__) {
2663
661
 
2664
662
  'use strict';
2665
663
 
@@ -2675,19 +673,19 @@ return /******/ (function(modules) { // webpackBootstrap
2675
673
  };
2676
674
 
2677
675
 
2678
- /***/ },
2679
- /* 11 */
2680
- /***/ function(module, exports, __webpack_require__) {
676
+ /***/ }),
677
+ /* 8 */
678
+ /***/ (function(module, exports, __webpack_require__) {
2681
679
 
2682
680
  'use strict';
2683
681
 
2684
682
  var utils = __webpack_require__(2);
2685
- var settle = __webpack_require__(12);
2686
- var buildURL = __webpack_require__(15);
2687
- var parseHeaders = __webpack_require__(16);
2688
- var isURLSameOrigin = __webpack_require__(17);
2689
- var createError = __webpack_require__(13);
2690
- var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(18);
683
+ var settle = __webpack_require__(9);
684
+ var buildURL = __webpack_require__(12);
685
+ var parseHeaders = __webpack_require__(13);
686
+ var isURLSameOrigin = __webpack_require__(14);
687
+ var createError = __webpack_require__(10);
688
+ var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(15);
2691
689
 
2692
690
  module.exports = function xhrAdapter(config) {
2693
691
  return new Promise(function dispatchXhrRequest(resolve, reject) {
@@ -2747,7 +745,7 @@ return /******/ (function(modules) { // webpackBootstrap
2747
745
  var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
2748
746
  var response = {
2749
747
  data: responseData,
2750
- // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
748
+ // IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201)
2751
749
  status: request.status === 1223 ? 204 : request.status,
2752
750
  statusText: request.status === 1223 ? 'No Content' : request.statusText,
2753
751
  headers: responseHeaders,
@@ -2765,7 +763,7 @@ return /******/ (function(modules) { // webpackBootstrap
2765
763
  request.onerror = function handleError() {
2766
764
  // Real errors are hidden from us by the browser
2767
765
  // onerror should only fire if it's a network error
2768
- reject(createError('Network Error', config));
766
+ reject(createError('Network Error', config, null, request));
2769
767
 
2770
768
  // Clean up request
2771
769
  request = null;
@@ -2773,7 +771,8 @@ return /******/ (function(modules) { // webpackBootstrap
2773
771
 
2774
772
  // Handle timeout
2775
773
  request.ontimeout = function handleTimeout() {
2776
- reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED'));
774
+ reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
775
+ request));
2777
776
 
2778
777
  // Clean up request
2779
778
  request = null;
@@ -2783,7 +782,7 @@ return /******/ (function(modules) { // webpackBootstrap
2783
782
  // This is only done if running in a standard browser environment.
2784
783
  // Specifically not if we're in a web worker, or react-native.
2785
784
  if (utils.isStandardBrowserEnv()) {
2786
- var cookies = __webpack_require__(19);
785
+ var cookies = __webpack_require__(16);
2787
786
 
2788
787
  // Add xsrf header
2789
788
  var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
@@ -2860,13 +859,13 @@ return /******/ (function(modules) { // webpackBootstrap
2860
859
  };
2861
860
 
2862
861
 
2863
- /***/ },
2864
- /* 12 */
2865
- /***/ function(module, exports, __webpack_require__) {
862
+ /***/ }),
863
+ /* 9 */
864
+ /***/ (function(module, exports, __webpack_require__) {
2866
865
 
2867
866
  'use strict';
2868
867
 
2869
- var createError = __webpack_require__(13);
868
+ var createError = __webpack_require__(10);
2870
869
 
2871
870
  /**
2872
871
  * Resolve or reject a Promise based on response status.
@@ -2885,38 +884,40 @@ return /******/ (function(modules) { // webpackBootstrap
2885
884
  'Request failed with status code ' + response.status,
2886
885
  response.config,
2887
886
  null,
887
+ response.request,
2888
888
  response
2889
889
  ));
2890
890
  }
2891
891
  };
2892
892
 
2893
893
 
2894
- /***/ },
2895
- /* 13 */
2896
- /***/ function(module, exports, __webpack_require__) {
894
+ /***/ }),
895
+ /* 10 */
896
+ /***/ (function(module, exports, __webpack_require__) {
2897
897
 
2898
898
  'use strict';
2899
899
 
2900
- var enhanceError = __webpack_require__(14);
900
+ var enhanceError = __webpack_require__(11);
2901
901
 
2902
902
  /**
2903
- * Create an Error with the specified message, config, error code, and response.
903
+ * Create an Error with the specified message, config, error code, request and response.
2904
904
  *
2905
905
  * @param {string} message The error message.
2906
906
  * @param {Object} config The config.
2907
907
  * @param {string} [code] The error code (for example, 'ECONNABORTED').
2908
- @ @param {Object} [response] The response.
908
+ * @param {Object} [request] The request.
909
+ * @param {Object} [response] The response.
2909
910
  * @returns {Error} The created error.
2910
911
  */
2911
- module.exports = function createError(message, config, code, response) {
912
+ module.exports = function createError(message, config, code, request, response) {
2912
913
  var error = new Error(message);
2913
- return enhanceError(error, config, code, response);
914
+ return enhanceError(error, config, code, request, response);
2914
915
  };
2915
916
 
2916
917
 
2917
- /***/ },
2918
- /* 14 */
2919
- /***/ function(module, exports) {
918
+ /***/ }),
919
+ /* 11 */
920
+ /***/ (function(module, exports) {
2920
921
 
2921
922
  'use strict';
2922
923
 
@@ -2926,22 +927,24 @@ return /******/ (function(modules) { // webpackBootstrap
2926
927
  * @param {Error} error The error to update.
2927
928
  * @param {Object} config The config.
2928
929
  * @param {string} [code] The error code (for example, 'ECONNABORTED').
2929
- @ @param {Object} [response] The response.
930
+ * @param {Object} [request] The request.
931
+ * @param {Object} [response] The response.
2930
932
  * @returns {Error} The error.
2931
933
  */
2932
- module.exports = function enhanceError(error, config, code, response) {
934
+ module.exports = function enhanceError(error, config, code, request, response) {
2933
935
  error.config = config;
2934
936
  if (code) {
2935
937
  error.code = code;
2936
938
  }
939
+ error.request = request;
2937
940
  error.response = response;
2938
941
  return error;
2939
942
  };
2940
943
 
2941
944
 
2942
- /***/ },
2943
- /* 15 */
2944
- /***/ function(module, exports, __webpack_require__) {
945
+ /***/ }),
946
+ /* 12 */
947
+ /***/ (function(module, exports, __webpack_require__) {
2945
948
 
2946
949
  'use strict';
2947
950
 
@@ -2986,9 +989,7 @@ return /******/ (function(modules) { // webpackBootstrap
2986
989
 
2987
990
  if (utils.isArray(val)) {
2988
991
  key = key + '[]';
2989
- }
2990
-
2991
- if (!utils.isArray(val)) {
992
+ } else {
2992
993
  val = [val];
2993
994
  }
2994
995
 
@@ -3013,14 +1014,23 @@ return /******/ (function(modules) { // webpackBootstrap
3013
1014
  };
3014
1015
 
3015
1016
 
3016
- /***/ },
3017
- /* 16 */
3018
- /***/ function(module, exports, __webpack_require__) {
1017
+ /***/ }),
1018
+ /* 13 */
1019
+ /***/ (function(module, exports, __webpack_require__) {
3019
1020
 
3020
1021
  'use strict';
3021
1022
 
3022
1023
  var utils = __webpack_require__(2);
3023
1024
 
1025
+ // Headers whose duplicates are ignored by node
1026
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1027
+ var ignoreDuplicateOf = [
1028
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
1029
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1030
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1031
+ 'referer', 'retry-after', 'user-agent'
1032
+ ];
1033
+
3024
1034
  /**
3025
1035
  * Parse headers into an object
3026
1036
  *
@@ -3048,7 +1058,14 @@ return /******/ (function(modules) { // webpackBootstrap
3048
1058
  val = utils.trim(line.substr(i + 1));
3049
1059
 
3050
1060
  if (key) {
3051
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1061
+ if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
1062
+ return;
1063
+ }
1064
+ if (key === 'set-cookie') {
1065
+ parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
1066
+ } else {
1067
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1068
+ }
3052
1069
  }
3053
1070
  });
3054
1071
 
@@ -3056,9 +1073,9 @@ return /******/ (function(modules) { // webpackBootstrap
3056
1073
  };
3057
1074
 
3058
1075
 
3059
- /***/ },
3060
- /* 17 */
3061
- /***/ function(module, exports, __webpack_require__) {
1076
+ /***/ }),
1077
+ /* 14 */
1078
+ /***/ (function(module, exports, __webpack_require__) {
3062
1079
 
3063
1080
  'use strict';
3064
1081
 
@@ -3130,9 +1147,9 @@ return /******/ (function(modules) { // webpackBootstrap
3130
1147
  );
3131
1148
 
3132
1149
 
3133
- /***/ },
3134
- /* 18 */
3135
- /***/ function(module, exports) {
1150
+ /***/ }),
1151
+ /* 15 */
1152
+ /***/ (function(module, exports) {
3136
1153
 
3137
1154
  'use strict';
3138
1155
 
@@ -3172,9 +1189,9 @@ return /******/ (function(modules) { // webpackBootstrap
3172
1189
  module.exports = btoa;
3173
1190
 
3174
1191
 
3175
- /***/ },
3176
- /* 19 */
3177
- /***/ function(module, exports, __webpack_require__) {
1192
+ /***/ }),
1193
+ /* 16 */
1194
+ /***/ (function(module, exports, __webpack_require__) {
3178
1195
 
3179
1196
  'use strict';
3180
1197
 
@@ -3231,9 +1248,9 @@ return /******/ (function(modules) { // webpackBootstrap
3231
1248
  );
3232
1249
 
3233
1250
 
3234
- /***/ },
3235
- /* 20 */
3236
- /***/ function(module, exports, __webpack_require__) {
1251
+ /***/ }),
1252
+ /* 17 */
1253
+ /***/ (function(module, exports, __webpack_require__) {
3237
1254
 
3238
1255
  'use strict';
3239
1256
 
@@ -3289,16 +1306,18 @@ return /******/ (function(modules) { // webpackBootstrap
3289
1306
  module.exports = InterceptorManager;
3290
1307
 
3291
1308
 
3292
- /***/ },
3293
- /* 21 */
3294
- /***/ function(module, exports, __webpack_require__) {
1309
+ /***/ }),
1310
+ /* 18 */
1311
+ /***/ (function(module, exports, __webpack_require__) {
3295
1312
 
3296
1313
  'use strict';
3297
1314
 
3298
1315
  var utils = __webpack_require__(2);
3299
- var transformData = __webpack_require__(22);
3300
- var isCancel = __webpack_require__(23);
3301
- var defaults = __webpack_require__(9);
1316
+ var transformData = __webpack_require__(19);
1317
+ var isCancel = __webpack_require__(20);
1318
+ var defaults = __webpack_require__(6);
1319
+ var isAbsoluteURL = __webpack_require__(21);
1320
+ var combineURLs = __webpack_require__(22);
3302
1321
 
3303
1322
  /**
3304
1323
  * Throws a `Cancel` if cancellation has been requested.
@@ -3318,6 +1337,11 @@ return /******/ (function(modules) { // webpackBootstrap
3318
1337
  module.exports = function dispatchRequest(config) {
3319
1338
  throwIfCancellationRequested(config);
3320
1339
 
1340
+ // Support baseURL config
1341
+ if (config.baseURL && !isAbsoluteURL(config.url)) {
1342
+ config.url = combineURLs(config.baseURL, config.url);
1343
+ }
1344
+
3321
1345
  // Ensure headers exist
3322
1346
  config.headers = config.headers || {};
3323
1347
 
@@ -3374,9 +1398,9 @@ return /******/ (function(modules) { // webpackBootstrap
3374
1398
  };
3375
1399
 
3376
1400
 
3377
- /***/ },
3378
- /* 22 */
3379
- /***/ function(module, exports, __webpack_require__) {
1401
+ /***/ }),
1402
+ /* 19 */
1403
+ /***/ (function(module, exports, __webpack_require__) {
3380
1404
 
3381
1405
  'use strict';
3382
1406
 
@@ -3400,9 +1424,9 @@ return /******/ (function(modules) { // webpackBootstrap
3400
1424
  };
3401
1425
 
3402
1426
 
3403
- /***/ },
3404
- /* 23 */
3405
- /***/ function(module, exports) {
1427
+ /***/ }),
1428
+ /* 20 */
1429
+ /***/ (function(module, exports) {
3406
1430
 
3407
1431
  'use strict';
3408
1432
 
@@ -3411,9 +1435,9 @@ return /******/ (function(modules) { // webpackBootstrap
3411
1435
  };
3412
1436
 
3413
1437
 
3414
- /***/ },
3415
- /* 24 */
3416
- /***/ function(module, exports) {
1438
+ /***/ }),
1439
+ /* 21 */
1440
+ /***/ (function(module, exports) {
3417
1441
 
3418
1442
  'use strict';
3419
1443
 
@@ -3431,9 +1455,9 @@ return /******/ (function(modules) { // webpackBootstrap
3431
1455
  };
3432
1456
 
3433
1457
 
3434
- /***/ },
3435
- /* 25 */
3436
- /***/ function(module, exports) {
1458
+ /***/ }),
1459
+ /* 22 */
1460
+ /***/ (function(module, exports) {
3437
1461
 
3438
1462
  'use strict';
3439
1463
 
@@ -3451,9 +1475,9 @@ return /******/ (function(modules) { // webpackBootstrap
3451
1475
  };
3452
1476
 
3453
1477
 
3454
- /***/ },
3455
- /* 26 */
3456
- /***/ function(module, exports) {
1478
+ /***/ }),
1479
+ /* 23 */
1480
+ /***/ (function(module, exports) {
3457
1481
 
3458
1482
  'use strict';
3459
1483
 
@@ -3476,13 +1500,13 @@ return /******/ (function(modules) { // webpackBootstrap
3476
1500
  module.exports = Cancel;
3477
1501
 
3478
1502
 
3479
- /***/ },
3480
- /* 27 */
3481
- /***/ function(module, exports, __webpack_require__) {
1503
+ /***/ }),
1504
+ /* 24 */
1505
+ /***/ (function(module, exports, __webpack_require__) {
3482
1506
 
3483
1507
  'use strict';
3484
1508
 
3485
- var Cancel = __webpack_require__(26);
1509
+ var Cancel = __webpack_require__(23);
3486
1510
 
3487
1511
  /**
3488
1512
  * A `CancelToken` is an object that can be used to request cancellation of an operation.
@@ -3539,9 +1563,9 @@ return /******/ (function(modules) { // webpackBootstrap
3539
1563
  module.exports = CancelToken;
3540
1564
 
3541
1565
 
3542
- /***/ },
3543
- /* 28 */
3544
- /***/ function(module, exports) {
1566
+ /***/ }),
1567
+ /* 25 */
1568
+ /***/ (function(module, exports) {
3545
1569
 
3546
1570
  'use strict';
3547
1571
 
@@ -3572,7 +1596,7 @@ return /******/ (function(modules) { // webpackBootstrap
3572
1596
  };
3573
1597
 
3574
1598
 
3575
- /***/ }
1599
+ /***/ })
3576
1600
  /******/ ])
3577
1601
  });
3578
1602
  ;