@shipengine/js-api 0.15.0 → 0.16.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.
Files changed (3) hide show
  1. package/index.js +2 -1964
  2. package/index.mjs +2 -1964
  3. package/package.json +4 -1
package/index.js CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
+ const axios = require('axios');
6
+
5
7
  var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
6
8
  var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
7
9
  var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
@@ -124,10 +126,6 @@ const isCodedError = (err) => !!err.errorCode;
124
126
 
125
127
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
126
128
 
127
- function getDefaultExportFromCjs (x) {
128
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
129
- }
130
-
131
129
  function getAugmentedNamespace(n) {
132
130
  if (n.__esModule) return n;
133
131
  var f = n.default;
@@ -156,1966 +154,6 @@ function getAugmentedNamespace(n) {
156
154
  return a;
157
155
  }
158
156
 
159
- var axiosExports$1 = {};
160
- var axios$3 = {
161
- get exports(){ return axiosExports$1; },
162
- set exports(v){ axiosExports$1 = v; },
163
- };
164
-
165
- var axiosExports = {};
166
- var axios$2 = {
167
- get exports(){ return axiosExports; },
168
- set exports(v){ axiosExports = v; },
169
- };
170
-
171
- var bind$4 = function bind(fn, thisArg) {
172
- return function wrap() {
173
- var args = new Array(arguments.length);
174
- for (var i = 0; i < args.length; i++) {
175
- args[i] = arguments[i];
176
- }
177
- return fn.apply(thisArg, args);
178
- };
179
- };
180
-
181
- var bind$3 = bind$4;
182
-
183
- // utils is a library of generic helper functions non-specific to axios
184
-
185
- var toString = Object.prototype.toString;
186
-
187
- /**
188
- * Determine if a value is an Array
189
- *
190
- * @param {Object} val The value to test
191
- * @returns {boolean} True if value is an Array, otherwise false
192
- */
193
- function isArray$4(val) {
194
- return Array.isArray(val);
195
- }
196
-
197
- /**
198
- * Determine if a value is undefined
199
- *
200
- * @param {Object} val The value to test
201
- * @returns {boolean} True if the value is undefined, otherwise false
202
- */
203
- function isUndefined(val) {
204
- return typeof val === 'undefined';
205
- }
206
-
207
- /**
208
- * Determine if a value is a Buffer
209
- *
210
- * @param {Object} val The value to test
211
- * @returns {boolean} True if value is a Buffer, otherwise false
212
- */
213
- function isBuffer$1(val) {
214
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
215
- && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
216
- }
217
-
218
- /**
219
- * Determine if a value is an ArrayBuffer
220
- *
221
- * @param {Object} val The value to test
222
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
223
- */
224
- function isArrayBuffer(val) {
225
- return toString.call(val) === '[object ArrayBuffer]';
226
- }
227
-
228
- /**
229
- * Determine if a value is a FormData
230
- *
231
- * @param {Object} val The value to test
232
- * @returns {boolean} True if value is an FormData, otherwise false
233
- */
234
- function isFormData(val) {
235
- return toString.call(val) === '[object FormData]';
236
- }
237
-
238
- /**
239
- * Determine if a value is a view on an ArrayBuffer
240
- *
241
- * @param {Object} val The value to test
242
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
243
- */
244
- function isArrayBufferView(val) {
245
- var result;
246
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
247
- result = ArrayBuffer.isView(val);
248
- } else {
249
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
250
- }
251
- return result;
252
- }
253
-
254
- /**
255
- * Determine if a value is a String
256
- *
257
- * @param {Object} val The value to test
258
- * @returns {boolean} True if value is a String, otherwise false
259
- */
260
- function isString$1(val) {
261
- return typeof val === 'string';
262
- }
263
-
264
- /**
265
- * Determine if a value is a Number
266
- *
267
- * @param {Object} val The value to test
268
- * @returns {boolean} True if value is a Number, otherwise false
269
- */
270
- function isNumber$1(val) {
271
- return typeof val === 'number';
272
- }
273
-
274
- /**
275
- * Determine if a value is an Object
276
- *
277
- * @param {Object} val The value to test
278
- * @returns {boolean} True if value is an Object, otherwise false
279
- */
280
- function isObject(val) {
281
- return val !== null && typeof val === 'object';
282
- }
283
-
284
- /**
285
- * Determine if a value is a plain Object
286
- *
287
- * @param {Object} val The value to test
288
- * @return {boolean} True if value is a plain Object, otherwise false
289
- */
290
- function isPlainObject(val) {
291
- if (toString.call(val) !== '[object Object]') {
292
- return false;
293
- }
294
-
295
- var prototype = Object.getPrototypeOf(val);
296
- return prototype === null || prototype === Object.prototype;
297
- }
298
-
299
- /**
300
- * Determine if a value is a Date
301
- *
302
- * @param {Object} val The value to test
303
- * @returns {boolean} True if value is a Date, otherwise false
304
- */
305
- function isDate$1(val) {
306
- return toString.call(val) === '[object Date]';
307
- }
308
-
309
- /**
310
- * Determine if a value is a File
311
- *
312
- * @param {Object} val The value to test
313
- * @returns {boolean} True if value is a File, otherwise false
314
- */
315
- function isFile(val) {
316
- return toString.call(val) === '[object File]';
317
- }
318
-
319
- /**
320
- * Determine if a value is a Blob
321
- *
322
- * @param {Object} val The value to test
323
- * @returns {boolean} True if value is a Blob, otherwise false
324
- */
325
- function isBlob(val) {
326
- return toString.call(val) === '[object Blob]';
327
- }
328
-
329
- /**
330
- * Determine if a value is a Function
331
- *
332
- * @param {Object} val The value to test
333
- * @returns {boolean} True if value is a Function, otherwise false
334
- */
335
- function isFunction(val) {
336
- return toString.call(val) === '[object Function]';
337
- }
338
-
339
- /**
340
- * Determine if a value is a Stream
341
- *
342
- * @param {Object} val The value to test
343
- * @returns {boolean} True if value is a Stream, otherwise false
344
- */
345
- function isStream(val) {
346
- return isObject(val) && isFunction(val.pipe);
347
- }
348
-
349
- /**
350
- * Determine if a value is a URLSearchParams object
351
- *
352
- * @param {Object} val The value to test
353
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
354
- */
355
- function isURLSearchParams(val) {
356
- return toString.call(val) === '[object URLSearchParams]';
357
- }
358
-
359
- /**
360
- * Trim excess whitespace off the beginning and end of a string
361
- *
362
- * @param {String} str The String to trim
363
- * @returns {String} The String freed of excess whitespace
364
- */
365
- function trim(str) {
366
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
367
- }
368
-
369
- /**
370
- * Determine if we're running in a standard browser environment
371
- *
372
- * This allows axios to run in a web worker, and react-native.
373
- * Both environments support XMLHttpRequest, but not fully standard globals.
374
- *
375
- * web workers:
376
- * typeof window -> undefined
377
- * typeof document -> undefined
378
- *
379
- * react-native:
380
- * navigator.product -> 'ReactNative'
381
- * nativescript
382
- * navigator.product -> 'NativeScript' or 'NS'
383
- */
384
- function isStandardBrowserEnv() {
385
- if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
386
- navigator.product === 'NativeScript' ||
387
- navigator.product === 'NS')) {
388
- return false;
389
- }
390
- return (
391
- typeof window !== 'undefined' &&
392
- typeof document !== 'undefined'
393
- );
394
- }
395
-
396
- /**
397
- * Iterate over an Array or an Object invoking a function for each item.
398
- *
399
- * If `obj` is an Array callback will be called passing
400
- * the value, index, and complete array for each item.
401
- *
402
- * If 'obj' is an Object callback will be called passing
403
- * the value, key, and complete object for each property.
404
- *
405
- * @param {Object|Array} obj The object to iterate
406
- * @param {Function} fn The callback to invoke for each item
407
- */
408
- function forEach(obj, fn) {
409
- // Don't bother if no value provided
410
- if (obj === null || typeof obj === 'undefined') {
411
- return;
412
- }
413
-
414
- // Force an array if not already something iterable
415
- if (typeof obj !== 'object') {
416
- /*eslint no-param-reassign:0*/
417
- obj = [obj];
418
- }
419
-
420
- if (isArray$4(obj)) {
421
- // Iterate over array values
422
- for (var i = 0, l = obj.length; i < l; i++) {
423
- fn.call(null, obj[i], i, obj);
424
- }
425
- } else {
426
- // Iterate over object keys
427
- for (var key in obj) {
428
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
429
- fn.call(null, obj[key], key, obj);
430
- }
431
- }
432
- }
433
- }
434
-
435
- /**
436
- * Accepts varargs expecting each argument to be an object, then
437
- * immutably merges the properties of each object and returns result.
438
- *
439
- * When multiple objects contain the same key the later object in
440
- * the arguments list will take precedence.
441
- *
442
- * Example:
443
- *
444
- * ```js
445
- * var result = merge({foo: 123}, {foo: 456});
446
- * console.log(result.foo); // outputs 456
447
- * ```
448
- *
449
- * @param {Object} obj1 Object to merge
450
- * @returns {Object} Result of all merge properties
451
- */
452
- function merge$1(/* obj1, obj2, obj3, ... */) {
453
- var result = {};
454
- function assignValue(val, key) {
455
- if (isPlainObject(result[key]) && isPlainObject(val)) {
456
- result[key] = merge$1(result[key], val);
457
- } else if (isPlainObject(val)) {
458
- result[key] = merge$1({}, val);
459
- } else if (isArray$4(val)) {
460
- result[key] = val.slice();
461
- } else {
462
- result[key] = val;
463
- }
464
- }
465
-
466
- for (var i = 0, l = arguments.length; i < l; i++) {
467
- forEach(arguments[i], assignValue);
468
- }
469
- return result;
470
- }
471
-
472
- /**
473
- * Extends object a by mutably adding to it the properties of object b.
474
- *
475
- * @param {Object} a The object to be extended
476
- * @param {Object} b The object to copy properties from
477
- * @param {Object} thisArg The object to bind function to
478
- * @return {Object} The resulting value of object a
479
- */
480
- function extend(a, b, thisArg) {
481
- forEach(b, function assignValue(val, key) {
482
- if (thisArg && typeof val === 'function') {
483
- a[key] = bind$3(val, thisArg);
484
- } else {
485
- a[key] = val;
486
- }
487
- });
488
- return a;
489
- }
490
-
491
- /**
492
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
493
- *
494
- * @param {string} content with BOM
495
- * @return {string} content value without BOM
496
- */
497
- function stripBOM(content) {
498
- if (content.charCodeAt(0) === 0xFEFF) {
499
- content = content.slice(1);
500
- }
501
- return content;
502
- }
503
-
504
- var utils$c = {
505
- isArray: isArray$4,
506
- isArrayBuffer: isArrayBuffer,
507
- isBuffer: isBuffer$1,
508
- isFormData: isFormData,
509
- isArrayBufferView: isArrayBufferView,
510
- isString: isString$1,
511
- isNumber: isNumber$1,
512
- isObject: isObject,
513
- isPlainObject: isPlainObject,
514
- isUndefined: isUndefined,
515
- isDate: isDate$1,
516
- isFile: isFile,
517
- isBlob: isBlob,
518
- isFunction: isFunction,
519
- isStream: isStream,
520
- isURLSearchParams: isURLSearchParams,
521
- isStandardBrowserEnv: isStandardBrowserEnv,
522
- forEach: forEach,
523
- merge: merge$1,
524
- extend: extend,
525
- trim: trim,
526
- stripBOM: stripBOM
527
- };
528
-
529
- var utils$b = utils$c;
530
-
531
- function encode$1(val) {
532
- return encodeURIComponent(val).
533
- replace(/%3A/gi, ':').
534
- replace(/%24/g, '$').
535
- replace(/%2C/gi, ',').
536
- replace(/%20/g, '+').
537
- replace(/%5B/gi, '[').
538
- replace(/%5D/gi, ']');
539
- }
540
-
541
- /**
542
- * Build a URL by appending params to the end
543
- *
544
- * @param {string} url The base of the url (e.g., http://www.google.com)
545
- * @param {object} [params] The params to be appended
546
- * @returns {string} The formatted url
547
- */
548
- var buildURL$1 = function buildURL(url, params, paramsSerializer) {
549
- /*eslint no-param-reassign:0*/
550
- if (!params) {
551
- return url;
552
- }
553
-
554
- var serializedParams;
555
- if (paramsSerializer) {
556
- serializedParams = paramsSerializer(params);
557
- } else if (utils$b.isURLSearchParams(params)) {
558
- serializedParams = params.toString();
559
- } else {
560
- var parts = [];
561
-
562
- utils$b.forEach(params, function serialize(val, key) {
563
- if (val === null || typeof val === 'undefined') {
564
- return;
565
- }
566
-
567
- if (utils$b.isArray(val)) {
568
- key = key + '[]';
569
- } else {
570
- val = [val];
571
- }
572
-
573
- utils$b.forEach(val, function parseValue(v) {
574
- if (utils$b.isDate(v)) {
575
- v = v.toISOString();
576
- } else if (utils$b.isObject(v)) {
577
- v = JSON.stringify(v);
578
- }
579
- parts.push(encode$1(key) + '=' + encode$1(v));
580
- });
581
- });
582
-
583
- serializedParams = parts.join('&');
584
- }
585
-
586
- if (serializedParams) {
587
- var hashmarkIndex = url.indexOf('#');
588
- if (hashmarkIndex !== -1) {
589
- url = url.slice(0, hashmarkIndex);
590
- }
591
-
592
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
593
- }
594
-
595
- return url;
596
- };
597
-
598
- var utils$a = utils$c;
599
-
600
- function InterceptorManager$1() {
601
- this.handlers = [];
602
- }
603
-
604
- /**
605
- * Add a new interceptor to the stack
606
- *
607
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
608
- * @param {Function} rejected The function to handle `reject` for a `Promise`
609
- *
610
- * @return {Number} An ID used to remove interceptor later
611
- */
612
- InterceptorManager$1.prototype.use = function use(fulfilled, rejected, options) {
613
- this.handlers.push({
614
- fulfilled: fulfilled,
615
- rejected: rejected,
616
- synchronous: options ? options.synchronous : false,
617
- runWhen: options ? options.runWhen : null
618
- });
619
- return this.handlers.length - 1;
620
- };
621
-
622
- /**
623
- * Remove an interceptor from the stack
624
- *
625
- * @param {Number} id The ID that was returned by `use`
626
- */
627
- InterceptorManager$1.prototype.eject = function eject(id) {
628
- if (this.handlers[id]) {
629
- this.handlers[id] = null;
630
- }
631
- };
632
-
633
- /**
634
- * Iterate over all the registered interceptors
635
- *
636
- * This method is particularly useful for skipping over any
637
- * interceptors that may have become `null` calling `eject`.
638
- *
639
- * @param {Function} fn The function to call for each interceptor
640
- */
641
- InterceptorManager$1.prototype.forEach = function forEach(fn) {
642
- utils$a.forEach(this.handlers, function forEachHandler(h) {
643
- if (h !== null) {
644
- fn(h);
645
- }
646
- });
647
- };
648
-
649
- var InterceptorManager_1 = InterceptorManager$1;
650
-
651
- var utils$9 = utils$c;
652
-
653
- var normalizeHeaderName$1 = function normalizeHeaderName(headers, normalizedName) {
654
- utils$9.forEach(headers, function processHeader(value, name) {
655
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
656
- headers[normalizedName] = value;
657
- delete headers[name];
658
- }
659
- });
660
- };
661
-
662
- /**
663
- * Update an Error with the specified config, error code, and response.
664
- *
665
- * @param {Error} error The error to update.
666
- * @param {Object} config The config.
667
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
668
- * @param {Object} [request] The request.
669
- * @param {Object} [response] The response.
670
- * @returns {Error} The error.
671
- */
672
- var enhanceError$1 = function enhanceError(error, config, code, request, response) {
673
- error.config = config;
674
- if (code) {
675
- error.code = code;
676
- }
677
-
678
- error.request = request;
679
- error.response = response;
680
- error.isAxiosError = true;
681
-
682
- error.toJSON = function toJSON() {
683
- return {
684
- // Standard
685
- message: this.message,
686
- name: this.name,
687
- // Microsoft
688
- description: this.description,
689
- number: this.number,
690
- // Mozilla
691
- fileName: this.fileName,
692
- lineNumber: this.lineNumber,
693
- columnNumber: this.columnNumber,
694
- stack: this.stack,
695
- // Axios
696
- config: this.config,
697
- code: this.code,
698
- status: this.response && this.response.status ? this.response.status : null
699
- };
700
- };
701
- return error;
702
- };
703
-
704
- var transitional = {
705
- silentJSONParsing: true,
706
- forcedJSONParsing: true,
707
- clarifyTimeoutError: false
708
- };
709
-
710
- var createError;
711
- var hasRequiredCreateError;
712
-
713
- function requireCreateError () {
714
- if (hasRequiredCreateError) return createError;
715
- hasRequiredCreateError = 1;
716
-
717
- var enhanceError = enhanceError$1;
718
-
719
- /**
720
- * Create an Error with the specified message, config, error code, request and response.
721
- *
722
- * @param {string} message The error message.
723
- * @param {Object} config The config.
724
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
725
- * @param {Object} [request] The request.
726
- * @param {Object} [response] The response.
727
- * @returns {Error} The created error.
728
- */
729
- createError = function createError(message, config, code, request, response) {
730
- var error = new Error(message);
731
- return enhanceError(error, config, code, request, response);
732
- };
733
- return createError;
734
- }
735
-
736
- var settle;
737
- var hasRequiredSettle;
738
-
739
- function requireSettle () {
740
- if (hasRequiredSettle) return settle;
741
- hasRequiredSettle = 1;
742
-
743
- var createError = requireCreateError();
744
-
745
- /**
746
- * Resolve or reject a Promise based on response status.
747
- *
748
- * @param {Function} resolve A function that resolves the promise.
749
- * @param {Function} reject A function that rejects the promise.
750
- * @param {object} response The response.
751
- */
752
- settle = function settle(resolve, reject, response) {
753
- var validateStatus = response.config.validateStatus;
754
- if (!response.status || !validateStatus || validateStatus(response.status)) {
755
- resolve(response);
756
- } else {
757
- reject(createError(
758
- 'Request failed with status code ' + response.status,
759
- response.config,
760
- null,
761
- response.request,
762
- response
763
- ));
764
- }
765
- };
766
- return settle;
767
- }
768
-
769
- var cookies;
770
- var hasRequiredCookies;
771
-
772
- function requireCookies () {
773
- if (hasRequiredCookies) return cookies;
774
- hasRequiredCookies = 1;
775
-
776
- var utils = utils$c;
777
-
778
- cookies = (
779
- utils.isStandardBrowserEnv() ?
780
-
781
- // Standard browser envs support document.cookie
782
- (function standardBrowserEnv() {
783
- return {
784
- write: function write(name, value, expires, path, domain, secure) {
785
- var cookie = [];
786
- cookie.push(name + '=' + encodeURIComponent(value));
787
-
788
- if (utils.isNumber(expires)) {
789
- cookie.push('expires=' + new Date(expires).toGMTString());
790
- }
791
-
792
- if (utils.isString(path)) {
793
- cookie.push('path=' + path);
794
- }
795
-
796
- if (utils.isString(domain)) {
797
- cookie.push('domain=' + domain);
798
- }
799
-
800
- if (secure === true) {
801
- cookie.push('secure');
802
- }
803
-
804
- document.cookie = cookie.join('; ');
805
- },
806
-
807
- read: function read(name) {
808
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
809
- return (match ? decodeURIComponent(match[3]) : null);
810
- },
811
-
812
- remove: function remove(name) {
813
- this.write(name, '', Date.now() - 86400000);
814
- }
815
- };
816
- })() :
817
-
818
- // Non standard browser env (web workers, react-native) lack needed support.
819
- (function nonStandardBrowserEnv() {
820
- return {
821
- write: function write() {},
822
- read: function read() { return null; },
823
- remove: function remove() {}
824
- };
825
- })()
826
- );
827
- return cookies;
828
- }
829
-
830
- var isAbsoluteURL;
831
- var hasRequiredIsAbsoluteURL;
832
-
833
- function requireIsAbsoluteURL () {
834
- if (hasRequiredIsAbsoluteURL) return isAbsoluteURL;
835
- hasRequiredIsAbsoluteURL = 1;
836
-
837
- /**
838
- * Determines whether the specified URL is absolute
839
- *
840
- * @param {string} url The URL to test
841
- * @returns {boolean} True if the specified URL is absolute, otherwise false
842
- */
843
- isAbsoluteURL = function isAbsoluteURL(url) {
844
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
845
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
846
- // by any combination of letters, digits, plus, period, or hyphen.
847
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
848
- };
849
- return isAbsoluteURL;
850
- }
851
-
852
- var combineURLs;
853
- var hasRequiredCombineURLs;
854
-
855
- function requireCombineURLs () {
856
- if (hasRequiredCombineURLs) return combineURLs;
857
- hasRequiredCombineURLs = 1;
858
-
859
- /**
860
- * Creates a new URL by combining the specified URLs
861
- *
862
- * @param {string} baseURL The base URL
863
- * @param {string} relativeURL The relative URL
864
- * @returns {string} The combined URL
865
- */
866
- combineURLs = function combineURLs(baseURL, relativeURL) {
867
- return relativeURL
868
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
869
- : baseURL;
870
- };
871
- return combineURLs;
872
- }
873
-
874
- var buildFullPath;
875
- var hasRequiredBuildFullPath;
876
-
877
- function requireBuildFullPath () {
878
- if (hasRequiredBuildFullPath) return buildFullPath;
879
- hasRequiredBuildFullPath = 1;
880
-
881
- var isAbsoluteURL = requireIsAbsoluteURL();
882
- var combineURLs = requireCombineURLs();
883
-
884
- /**
885
- * Creates a new URL by combining the baseURL with the requestedURL,
886
- * only when the requestedURL is not already an absolute URL.
887
- * If the requestURL is absolute, this function returns the requestedURL untouched.
888
- *
889
- * @param {string} baseURL The base URL
890
- * @param {string} requestedURL Absolute or relative URL to combine
891
- * @returns {string} The combined full path
892
- */
893
- buildFullPath = function buildFullPath(baseURL, requestedURL) {
894
- if (baseURL && !isAbsoluteURL(requestedURL)) {
895
- return combineURLs(baseURL, requestedURL);
896
- }
897
- return requestedURL;
898
- };
899
- return buildFullPath;
900
- }
901
-
902
- var parseHeaders;
903
- var hasRequiredParseHeaders;
904
-
905
- function requireParseHeaders () {
906
- if (hasRequiredParseHeaders) return parseHeaders;
907
- hasRequiredParseHeaders = 1;
908
-
909
- var utils = utils$c;
910
-
911
- // Headers whose duplicates are ignored by node
912
- // c.f. https://nodejs.org/api/http.html#http_message_headers
913
- var ignoreDuplicateOf = [
914
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
915
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
916
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
917
- 'referer', 'retry-after', 'user-agent'
918
- ];
919
-
920
- /**
921
- * Parse headers into an object
922
- *
923
- * ```
924
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
925
- * Content-Type: application/json
926
- * Connection: keep-alive
927
- * Transfer-Encoding: chunked
928
- * ```
929
- *
930
- * @param {String} headers Headers needing to be parsed
931
- * @returns {Object} Headers parsed into an object
932
- */
933
- parseHeaders = function parseHeaders(headers) {
934
- var parsed = {};
935
- var key;
936
- var val;
937
- var i;
938
-
939
- if (!headers) { return parsed; }
940
-
941
- utils.forEach(headers.split('\n'), function parser(line) {
942
- i = line.indexOf(':');
943
- key = utils.trim(line.substr(0, i)).toLowerCase();
944
- val = utils.trim(line.substr(i + 1));
945
-
946
- if (key) {
947
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
948
- return;
949
- }
950
- if (key === 'set-cookie') {
951
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
952
- } else {
953
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
954
- }
955
- }
956
- });
957
-
958
- return parsed;
959
- };
960
- return parseHeaders;
961
- }
962
-
963
- var isURLSameOrigin;
964
- var hasRequiredIsURLSameOrigin;
965
-
966
- function requireIsURLSameOrigin () {
967
- if (hasRequiredIsURLSameOrigin) return isURLSameOrigin;
968
- hasRequiredIsURLSameOrigin = 1;
969
-
970
- var utils = utils$c;
971
-
972
- isURLSameOrigin = (
973
- utils.isStandardBrowserEnv() ?
974
-
975
- // Standard browser envs have full support of the APIs needed to test
976
- // whether the request URL is of the same origin as current location.
977
- (function standardBrowserEnv() {
978
- var msie = /(msie|trident)/i.test(navigator.userAgent);
979
- var urlParsingNode = document.createElement('a');
980
- var originURL;
981
-
982
- /**
983
- * Parse a URL to discover it's components
984
- *
985
- * @param {String} url The URL to be parsed
986
- * @returns {Object}
987
- */
988
- function resolveURL(url) {
989
- var href = url;
990
-
991
- if (msie) {
992
- // IE needs attribute set twice to normalize properties
993
- urlParsingNode.setAttribute('href', href);
994
- href = urlParsingNode.href;
995
- }
996
-
997
- urlParsingNode.setAttribute('href', href);
998
-
999
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1000
- return {
1001
- href: urlParsingNode.href,
1002
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1003
- host: urlParsingNode.host,
1004
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1005
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1006
- hostname: urlParsingNode.hostname,
1007
- port: urlParsingNode.port,
1008
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
1009
- urlParsingNode.pathname :
1010
- '/' + urlParsingNode.pathname
1011
- };
1012
- }
1013
-
1014
- originURL = resolveURL(window.location.href);
1015
-
1016
- /**
1017
- * Determine if a URL shares the same origin as the current location
1018
- *
1019
- * @param {String} requestURL The URL to test
1020
- * @returns {boolean} True if URL shares the same origin, otherwise false
1021
- */
1022
- return function isURLSameOrigin(requestURL) {
1023
- var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
1024
- return (parsed.protocol === originURL.protocol &&
1025
- parsed.host === originURL.host);
1026
- };
1027
- })() :
1028
-
1029
- // Non standard browser envs (web workers, react-native) lack needed support.
1030
- (function nonStandardBrowserEnv() {
1031
- return function isURLSameOrigin() {
1032
- return true;
1033
- };
1034
- })()
1035
- );
1036
- return isURLSameOrigin;
1037
- }
1038
-
1039
- var Cancel_1;
1040
- var hasRequiredCancel;
1041
-
1042
- function requireCancel () {
1043
- if (hasRequiredCancel) return Cancel_1;
1044
- hasRequiredCancel = 1;
1045
-
1046
- /**
1047
- * A `Cancel` is an object that is thrown when an operation is canceled.
1048
- *
1049
- * @class
1050
- * @param {string=} message The message.
1051
- */
1052
- function Cancel(message) {
1053
- this.message = message;
1054
- }
1055
-
1056
- Cancel.prototype.toString = function toString() {
1057
- return 'Cancel' + (this.message ? ': ' + this.message : '');
1058
- };
1059
-
1060
- Cancel.prototype.__CANCEL__ = true;
1061
-
1062
- Cancel_1 = Cancel;
1063
- return Cancel_1;
1064
- }
1065
-
1066
- var xhr;
1067
- var hasRequiredXhr;
1068
-
1069
- function requireXhr () {
1070
- if (hasRequiredXhr) return xhr;
1071
- hasRequiredXhr = 1;
1072
-
1073
- var utils = utils$c;
1074
- var settle = requireSettle();
1075
- var cookies = requireCookies();
1076
- var buildURL = buildURL$1;
1077
- var buildFullPath = requireBuildFullPath();
1078
- var parseHeaders = requireParseHeaders();
1079
- var isURLSameOrigin = requireIsURLSameOrigin();
1080
- var createError = requireCreateError();
1081
- var transitionalDefaults = transitional;
1082
- var Cancel = requireCancel();
1083
-
1084
- xhr = function xhrAdapter(config) {
1085
- return new Promise(function dispatchXhrRequest(resolve, reject) {
1086
- var requestData = config.data;
1087
- var requestHeaders = config.headers;
1088
- var responseType = config.responseType;
1089
- var onCanceled;
1090
- function done() {
1091
- if (config.cancelToken) {
1092
- config.cancelToken.unsubscribe(onCanceled);
1093
- }
1094
-
1095
- if (config.signal) {
1096
- config.signal.removeEventListener('abort', onCanceled);
1097
- }
1098
- }
1099
-
1100
- if (utils.isFormData(requestData)) {
1101
- delete requestHeaders['Content-Type']; // Let the browser set it
1102
- }
1103
-
1104
- var request = new XMLHttpRequest();
1105
-
1106
- // HTTP basic authentication
1107
- if (config.auth) {
1108
- var username = config.auth.username || '';
1109
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
1110
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
1111
- }
1112
-
1113
- var fullPath = buildFullPath(config.baseURL, config.url);
1114
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
1115
-
1116
- // Set the request timeout in MS
1117
- request.timeout = config.timeout;
1118
-
1119
- function onloadend() {
1120
- if (!request) {
1121
- return;
1122
- }
1123
- // Prepare the response
1124
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
1125
- var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
1126
- request.responseText : request.response;
1127
- var response = {
1128
- data: responseData,
1129
- status: request.status,
1130
- statusText: request.statusText,
1131
- headers: responseHeaders,
1132
- config: config,
1133
- request: request
1134
- };
1135
-
1136
- settle(function _resolve(value) {
1137
- resolve(value);
1138
- done();
1139
- }, function _reject(err) {
1140
- reject(err);
1141
- done();
1142
- }, response);
1143
-
1144
- // Clean up request
1145
- request = null;
1146
- }
1147
-
1148
- if ('onloadend' in request) {
1149
- // Use onloadend if available
1150
- request.onloadend = onloadend;
1151
- } else {
1152
- // Listen for ready state to emulate onloadend
1153
- request.onreadystatechange = function handleLoad() {
1154
- if (!request || request.readyState !== 4) {
1155
- return;
1156
- }
1157
-
1158
- // The request errored out and we didn't get a response, this will be
1159
- // handled by onerror instead
1160
- // With one exception: request that using file: protocol, most browsers
1161
- // will return status as 0 even though it's a successful request
1162
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
1163
- return;
1164
- }
1165
- // readystate handler is calling before onerror or ontimeout handlers,
1166
- // so we should call onloadend on the next 'tick'
1167
- setTimeout(onloadend);
1168
- };
1169
- }
1170
-
1171
- // Handle browser request cancellation (as opposed to a manual cancellation)
1172
- request.onabort = function handleAbort() {
1173
- if (!request) {
1174
- return;
1175
- }
1176
-
1177
- reject(createError('Request aborted', config, 'ECONNABORTED', request));
1178
-
1179
- // Clean up request
1180
- request = null;
1181
- };
1182
-
1183
- // Handle low level network errors
1184
- request.onerror = function handleError() {
1185
- // Real errors are hidden from us by the browser
1186
- // onerror should only fire if it's a network error
1187
- reject(createError('Network Error', config, null, request));
1188
-
1189
- // Clean up request
1190
- request = null;
1191
- };
1192
-
1193
- // Handle timeout
1194
- request.ontimeout = function handleTimeout() {
1195
- var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
1196
- var transitional = config.transitional || transitionalDefaults;
1197
- if (config.timeoutErrorMessage) {
1198
- timeoutErrorMessage = config.timeoutErrorMessage;
1199
- }
1200
- reject(createError(
1201
- timeoutErrorMessage,
1202
- config,
1203
- transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
1204
- request));
1205
-
1206
- // Clean up request
1207
- request = null;
1208
- };
1209
-
1210
- // Add xsrf header
1211
- // This is only done if running in a standard browser environment.
1212
- // Specifically not if we're in a web worker, or react-native.
1213
- if (utils.isStandardBrowserEnv()) {
1214
- // Add xsrf header
1215
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
1216
- cookies.read(config.xsrfCookieName) :
1217
- undefined;
1218
-
1219
- if (xsrfValue) {
1220
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
1221
- }
1222
- }
1223
-
1224
- // Add headers to the request
1225
- if ('setRequestHeader' in request) {
1226
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
1227
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
1228
- // Remove Content-Type if data is undefined
1229
- delete requestHeaders[key];
1230
- } else {
1231
- // Otherwise add header to the request
1232
- request.setRequestHeader(key, val);
1233
- }
1234
- });
1235
- }
1236
-
1237
- // Add withCredentials to request if needed
1238
- if (!utils.isUndefined(config.withCredentials)) {
1239
- request.withCredentials = !!config.withCredentials;
1240
- }
1241
-
1242
- // Add responseType to request if needed
1243
- if (responseType && responseType !== 'json') {
1244
- request.responseType = config.responseType;
1245
- }
1246
-
1247
- // Handle progress if needed
1248
- if (typeof config.onDownloadProgress === 'function') {
1249
- request.addEventListener('progress', config.onDownloadProgress);
1250
- }
1251
-
1252
- // Not all browsers support upload events
1253
- if (typeof config.onUploadProgress === 'function' && request.upload) {
1254
- request.upload.addEventListener('progress', config.onUploadProgress);
1255
- }
1256
-
1257
- if (config.cancelToken || config.signal) {
1258
- // Handle cancellation
1259
- // eslint-disable-next-line func-names
1260
- onCanceled = function(cancel) {
1261
- if (!request) {
1262
- return;
1263
- }
1264
- reject(!cancel || (cancel && cancel.type) ? new Cancel('canceled') : cancel);
1265
- request.abort();
1266
- request = null;
1267
- };
1268
-
1269
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
1270
- if (config.signal) {
1271
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
1272
- }
1273
- }
1274
-
1275
- if (!requestData) {
1276
- requestData = null;
1277
- }
1278
-
1279
- // Send the request
1280
- request.send(requestData);
1281
- });
1282
- };
1283
- return xhr;
1284
- }
1285
-
1286
- var utils$8 = utils$c;
1287
- var normalizeHeaderName = normalizeHeaderName$1;
1288
- var enhanceError = enhanceError$1;
1289
- var transitionalDefaults = transitional;
1290
-
1291
- var DEFAULT_CONTENT_TYPE = {
1292
- 'Content-Type': 'application/x-www-form-urlencoded'
1293
- };
1294
-
1295
- function setContentTypeIfUnset(headers, value) {
1296
- if (!utils$8.isUndefined(headers) && utils$8.isUndefined(headers['Content-Type'])) {
1297
- headers['Content-Type'] = value;
1298
- }
1299
- }
1300
-
1301
- function getDefaultAdapter() {
1302
- var adapter;
1303
- if (typeof XMLHttpRequest !== 'undefined') {
1304
- // For browsers use XHR adapter
1305
- adapter = requireXhr();
1306
- } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
1307
- // For node use HTTP adapter
1308
- adapter = requireXhr();
1309
- }
1310
- return adapter;
1311
- }
1312
-
1313
- function stringifySafely(rawValue, parser, encoder) {
1314
- if (utils$8.isString(rawValue)) {
1315
- try {
1316
- (parser || JSON.parse)(rawValue);
1317
- return utils$8.trim(rawValue);
1318
- } catch (e) {
1319
- if (e.name !== 'SyntaxError') {
1320
- throw e;
1321
- }
1322
- }
1323
- }
1324
-
1325
- return (encoder || JSON.stringify)(rawValue);
1326
- }
1327
-
1328
- var defaults$5 = {
1329
-
1330
- transitional: transitionalDefaults,
1331
-
1332
- adapter: getDefaultAdapter(),
1333
-
1334
- transformRequest: [function transformRequest(data, headers) {
1335
- normalizeHeaderName(headers, 'Accept');
1336
- normalizeHeaderName(headers, 'Content-Type');
1337
-
1338
- if (utils$8.isFormData(data) ||
1339
- utils$8.isArrayBuffer(data) ||
1340
- utils$8.isBuffer(data) ||
1341
- utils$8.isStream(data) ||
1342
- utils$8.isFile(data) ||
1343
- utils$8.isBlob(data)
1344
- ) {
1345
- return data;
1346
- }
1347
- if (utils$8.isArrayBufferView(data)) {
1348
- return data.buffer;
1349
- }
1350
- if (utils$8.isURLSearchParams(data)) {
1351
- setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
1352
- return data.toString();
1353
- }
1354
- if (utils$8.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
1355
- setContentTypeIfUnset(headers, 'application/json');
1356
- return stringifySafely(data);
1357
- }
1358
- return data;
1359
- }],
1360
-
1361
- transformResponse: [function transformResponse(data) {
1362
- var transitional = this.transitional || defaults$5.transitional;
1363
- var silentJSONParsing = transitional && transitional.silentJSONParsing;
1364
- var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1365
- var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
1366
-
1367
- if (strictJSONParsing || (forcedJSONParsing && utils$8.isString(data) && data.length)) {
1368
- try {
1369
- return JSON.parse(data);
1370
- } catch (e) {
1371
- if (strictJSONParsing) {
1372
- if (e.name === 'SyntaxError') {
1373
- throw enhanceError(e, this, 'E_JSON_PARSE');
1374
- }
1375
- throw e;
1376
- }
1377
- }
1378
- }
1379
-
1380
- return data;
1381
- }],
1382
-
1383
- /**
1384
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1385
- * timeout is not created.
1386
- */
1387
- timeout: 0,
1388
-
1389
- xsrfCookieName: 'XSRF-TOKEN',
1390
- xsrfHeaderName: 'X-XSRF-TOKEN',
1391
-
1392
- maxContentLength: -1,
1393
- maxBodyLength: -1,
1394
-
1395
- validateStatus: function validateStatus(status) {
1396
- return status >= 200 && status < 300;
1397
- },
1398
-
1399
- headers: {
1400
- common: {
1401
- 'Accept': 'application/json, text/plain, */*'
1402
- }
1403
- }
1404
- };
1405
-
1406
- utils$8.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
1407
- defaults$5.headers[method] = {};
1408
- });
1409
-
1410
- utils$8.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1411
- defaults$5.headers[method] = utils$8.merge(DEFAULT_CONTENT_TYPE);
1412
- });
1413
-
1414
- var defaults_1 = defaults$5;
1415
-
1416
- var utils$7 = utils$c;
1417
- var defaults$4 = defaults_1;
1418
-
1419
- /**
1420
- * Transform the data for a request or a response
1421
- *
1422
- * @param {Object|String} data The data to be transformed
1423
- * @param {Array} headers The headers for the request or response
1424
- * @param {Array|Function} fns A single function or Array of functions
1425
- * @returns {*} The resulting transformed data
1426
- */
1427
- var transformData$1 = function transformData(data, headers, fns) {
1428
- var context = this || defaults$4;
1429
- /*eslint no-param-reassign:0*/
1430
- utils$7.forEach(fns, function transform(fn) {
1431
- data = fn.call(context, data, headers);
1432
- });
1433
-
1434
- return data;
1435
- };
1436
-
1437
- var isCancel$1;
1438
- var hasRequiredIsCancel;
1439
-
1440
- function requireIsCancel () {
1441
- if (hasRequiredIsCancel) return isCancel$1;
1442
- hasRequiredIsCancel = 1;
1443
-
1444
- isCancel$1 = function isCancel(value) {
1445
- return !!(value && value.__CANCEL__);
1446
- };
1447
- return isCancel$1;
1448
- }
1449
-
1450
- var utils$6 = utils$c;
1451
- var transformData = transformData$1;
1452
- var isCancel = requireIsCancel();
1453
- var defaults$3 = defaults_1;
1454
- var Cancel = requireCancel();
1455
-
1456
- /**
1457
- * Throws a `Cancel` if cancellation has been requested.
1458
- */
1459
- function throwIfCancellationRequested(config) {
1460
- if (config.cancelToken) {
1461
- config.cancelToken.throwIfRequested();
1462
- }
1463
-
1464
- if (config.signal && config.signal.aborted) {
1465
- throw new Cancel('canceled');
1466
- }
1467
- }
1468
-
1469
- /**
1470
- * Dispatch a request to the server using the configured adapter.
1471
- *
1472
- * @param {object} config The config that is to be used for the request
1473
- * @returns {Promise} The Promise to be fulfilled
1474
- */
1475
- var dispatchRequest$1 = function dispatchRequest(config) {
1476
- throwIfCancellationRequested(config);
1477
-
1478
- // Ensure headers exist
1479
- config.headers = config.headers || {};
1480
-
1481
- // Transform request data
1482
- config.data = transformData.call(
1483
- config,
1484
- config.data,
1485
- config.headers,
1486
- config.transformRequest
1487
- );
1488
-
1489
- // Flatten headers
1490
- config.headers = utils$6.merge(
1491
- config.headers.common || {},
1492
- config.headers[config.method] || {},
1493
- config.headers
1494
- );
1495
-
1496
- utils$6.forEach(
1497
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
1498
- function cleanHeaderConfig(method) {
1499
- delete config.headers[method];
1500
- }
1501
- );
1502
-
1503
- var adapter = config.adapter || defaults$3.adapter;
1504
-
1505
- return adapter(config).then(function onAdapterResolution(response) {
1506
- throwIfCancellationRequested(config);
1507
-
1508
- // Transform response data
1509
- response.data = transformData.call(
1510
- config,
1511
- response.data,
1512
- response.headers,
1513
- config.transformResponse
1514
- );
1515
-
1516
- return response;
1517
- }, function onAdapterRejection(reason) {
1518
- if (!isCancel(reason)) {
1519
- throwIfCancellationRequested(config);
1520
-
1521
- // Transform response data
1522
- if (reason && reason.response) {
1523
- reason.response.data = transformData.call(
1524
- config,
1525
- reason.response.data,
1526
- reason.response.headers,
1527
- config.transformResponse
1528
- );
1529
- }
1530
- }
1531
-
1532
- return Promise.reject(reason);
1533
- });
1534
- };
1535
-
1536
- var utils$5 = utils$c;
1537
-
1538
- /**
1539
- * Config-specific merge-function which creates a new config-object
1540
- * by merging two configuration objects together.
1541
- *
1542
- * @param {Object} config1
1543
- * @param {Object} config2
1544
- * @returns {Object} New object resulting from merging config2 to config1
1545
- */
1546
- var mergeConfig$2 = function mergeConfig(config1, config2) {
1547
- // eslint-disable-next-line no-param-reassign
1548
- config2 = config2 || {};
1549
- var config = {};
1550
-
1551
- function getMergedValue(target, source) {
1552
- if (utils$5.isPlainObject(target) && utils$5.isPlainObject(source)) {
1553
- return utils$5.merge(target, source);
1554
- } else if (utils$5.isPlainObject(source)) {
1555
- return utils$5.merge({}, source);
1556
- } else if (utils$5.isArray(source)) {
1557
- return source.slice();
1558
- }
1559
- return source;
1560
- }
1561
-
1562
- // eslint-disable-next-line consistent-return
1563
- function mergeDeepProperties(prop) {
1564
- if (!utils$5.isUndefined(config2[prop])) {
1565
- return getMergedValue(config1[prop], config2[prop]);
1566
- } else if (!utils$5.isUndefined(config1[prop])) {
1567
- return getMergedValue(undefined, config1[prop]);
1568
- }
1569
- }
1570
-
1571
- // eslint-disable-next-line consistent-return
1572
- function valueFromConfig2(prop) {
1573
- if (!utils$5.isUndefined(config2[prop])) {
1574
- return getMergedValue(undefined, config2[prop]);
1575
- }
1576
- }
1577
-
1578
- // eslint-disable-next-line consistent-return
1579
- function defaultToConfig2(prop) {
1580
- if (!utils$5.isUndefined(config2[prop])) {
1581
- return getMergedValue(undefined, config2[prop]);
1582
- } else if (!utils$5.isUndefined(config1[prop])) {
1583
- return getMergedValue(undefined, config1[prop]);
1584
- }
1585
- }
1586
-
1587
- // eslint-disable-next-line consistent-return
1588
- function mergeDirectKeys(prop) {
1589
- if (prop in config2) {
1590
- return getMergedValue(config1[prop], config2[prop]);
1591
- } else if (prop in config1) {
1592
- return getMergedValue(undefined, config1[prop]);
1593
- }
1594
- }
1595
-
1596
- var mergeMap = {
1597
- 'url': valueFromConfig2,
1598
- 'method': valueFromConfig2,
1599
- 'data': valueFromConfig2,
1600
- 'baseURL': defaultToConfig2,
1601
- 'transformRequest': defaultToConfig2,
1602
- 'transformResponse': defaultToConfig2,
1603
- 'paramsSerializer': defaultToConfig2,
1604
- 'timeout': defaultToConfig2,
1605
- 'timeoutMessage': defaultToConfig2,
1606
- 'withCredentials': defaultToConfig2,
1607
- 'adapter': defaultToConfig2,
1608
- 'responseType': defaultToConfig2,
1609
- 'xsrfCookieName': defaultToConfig2,
1610
- 'xsrfHeaderName': defaultToConfig2,
1611
- 'onUploadProgress': defaultToConfig2,
1612
- 'onDownloadProgress': defaultToConfig2,
1613
- 'decompress': defaultToConfig2,
1614
- 'maxContentLength': defaultToConfig2,
1615
- 'maxBodyLength': defaultToConfig2,
1616
- 'transport': defaultToConfig2,
1617
- 'httpAgent': defaultToConfig2,
1618
- 'httpsAgent': defaultToConfig2,
1619
- 'cancelToken': defaultToConfig2,
1620
- 'socketPath': defaultToConfig2,
1621
- 'responseEncoding': defaultToConfig2,
1622
- 'validateStatus': mergeDirectKeys
1623
- };
1624
-
1625
- utils$5.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
1626
- var merge = mergeMap[prop] || mergeDeepProperties;
1627
- var configValue = merge(prop);
1628
- (utils$5.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
1629
- });
1630
-
1631
- return config;
1632
- };
1633
-
1634
- var data;
1635
- var hasRequiredData;
1636
-
1637
- function requireData () {
1638
- if (hasRequiredData) return data;
1639
- hasRequiredData = 1;
1640
- data = {
1641
- "version": "0.26.1"
1642
- };
1643
- return data;
1644
- }
1645
-
1646
- var VERSION = requireData().version;
1647
-
1648
- var validators$1 = {};
1649
-
1650
- // eslint-disable-next-line func-names
1651
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
1652
- validators$1[type] = function validator(thing) {
1653
- return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
1654
- };
1655
- });
1656
-
1657
- var deprecatedWarnings = {};
1658
-
1659
- /**
1660
- * Transitional option validator
1661
- * @param {function|boolean?} validator - set to false if the transitional option has been removed
1662
- * @param {string?} version - deprecated version / removed since version
1663
- * @param {string?} message - some message with additional info
1664
- * @returns {function}
1665
- */
1666
- validators$1.transitional = function transitional(validator, version, message) {
1667
- function formatMessage(opt, desc) {
1668
- return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
1669
- }
1670
-
1671
- // eslint-disable-next-line func-names
1672
- return function(value, opt, opts) {
1673
- if (validator === false) {
1674
- throw new Error(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')));
1675
- }
1676
-
1677
- if (version && !deprecatedWarnings[opt]) {
1678
- deprecatedWarnings[opt] = true;
1679
- // eslint-disable-next-line no-console
1680
- console.warn(
1681
- formatMessage(
1682
- opt,
1683
- ' has been deprecated since v' + version + ' and will be removed in the near future'
1684
- )
1685
- );
1686
- }
1687
-
1688
- return validator ? validator(value, opt, opts) : true;
1689
- };
1690
- };
1691
-
1692
- /**
1693
- * Assert object's properties type
1694
- * @param {object} options
1695
- * @param {object} schema
1696
- * @param {boolean?} allowUnknown
1697
- */
1698
-
1699
- function assertOptions(options, schema, allowUnknown) {
1700
- if (typeof options !== 'object') {
1701
- throw new TypeError('options must be an object');
1702
- }
1703
- var keys = Object.keys(options);
1704
- var i = keys.length;
1705
- while (i-- > 0) {
1706
- var opt = keys[i];
1707
- var validator = schema[opt];
1708
- if (validator) {
1709
- var value = options[opt];
1710
- var result = value === undefined || validator(value, opt, options);
1711
- if (result !== true) {
1712
- throw new TypeError('option ' + opt + ' must be ' + result);
1713
- }
1714
- continue;
1715
- }
1716
- if (allowUnknown !== true) {
1717
- throw Error('Unknown option ' + opt);
1718
- }
1719
- }
1720
- }
1721
-
1722
- var validator$1 = {
1723
- assertOptions: assertOptions,
1724
- validators: validators$1
1725
- };
1726
-
1727
- var utils$4 = utils$c;
1728
- var buildURL = buildURL$1;
1729
- var InterceptorManager = InterceptorManager_1;
1730
- var dispatchRequest = dispatchRequest$1;
1731
- var mergeConfig$1 = mergeConfig$2;
1732
- var validator = validator$1;
1733
-
1734
- var validators = validator.validators;
1735
- /**
1736
- * Create a new instance of Axios
1737
- *
1738
- * @param {Object} instanceConfig The default config for the instance
1739
- */
1740
- function Axios$1(instanceConfig) {
1741
- this.defaults = instanceConfig;
1742
- this.interceptors = {
1743
- request: new InterceptorManager(),
1744
- response: new InterceptorManager()
1745
- };
1746
- }
1747
-
1748
- /**
1749
- * Dispatch a request
1750
- *
1751
- * @param {Object} config The config specific for this request (merged with this.defaults)
1752
- */
1753
- Axios$1.prototype.request = function request(configOrUrl, config) {
1754
- /*eslint no-param-reassign:0*/
1755
- // Allow for axios('example/url'[, config]) a la fetch API
1756
- if (typeof configOrUrl === 'string') {
1757
- config = config || {};
1758
- config.url = configOrUrl;
1759
- } else {
1760
- config = configOrUrl || {};
1761
- }
1762
-
1763
- config = mergeConfig$1(this.defaults, config);
1764
-
1765
- // Set config.method
1766
- if (config.method) {
1767
- config.method = config.method.toLowerCase();
1768
- } else if (this.defaults.method) {
1769
- config.method = this.defaults.method.toLowerCase();
1770
- } else {
1771
- config.method = 'get';
1772
- }
1773
-
1774
- var transitional = config.transitional;
1775
-
1776
- if (transitional !== undefined) {
1777
- validator.assertOptions(transitional, {
1778
- silentJSONParsing: validators.transitional(validators.boolean),
1779
- forcedJSONParsing: validators.transitional(validators.boolean),
1780
- clarifyTimeoutError: validators.transitional(validators.boolean)
1781
- }, false);
1782
- }
1783
-
1784
- // filter out skipped interceptors
1785
- var requestInterceptorChain = [];
1786
- var synchronousRequestInterceptors = true;
1787
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
1788
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
1789
- return;
1790
- }
1791
-
1792
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
1793
-
1794
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
1795
- });
1796
-
1797
- var responseInterceptorChain = [];
1798
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
1799
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
1800
- });
1801
-
1802
- var promise;
1803
-
1804
- if (!synchronousRequestInterceptors) {
1805
- var chain = [dispatchRequest, undefined];
1806
-
1807
- Array.prototype.unshift.apply(chain, requestInterceptorChain);
1808
- chain = chain.concat(responseInterceptorChain);
1809
-
1810
- promise = Promise.resolve(config);
1811
- while (chain.length) {
1812
- promise = promise.then(chain.shift(), chain.shift());
1813
- }
1814
-
1815
- return promise;
1816
- }
1817
-
1818
-
1819
- var newConfig = config;
1820
- while (requestInterceptorChain.length) {
1821
- var onFulfilled = requestInterceptorChain.shift();
1822
- var onRejected = requestInterceptorChain.shift();
1823
- try {
1824
- newConfig = onFulfilled(newConfig);
1825
- } catch (error) {
1826
- onRejected(error);
1827
- break;
1828
- }
1829
- }
1830
-
1831
- try {
1832
- promise = dispatchRequest(newConfig);
1833
- } catch (error) {
1834
- return Promise.reject(error);
1835
- }
1836
-
1837
- while (responseInterceptorChain.length) {
1838
- promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
1839
- }
1840
-
1841
- return promise;
1842
- };
1843
-
1844
- Axios$1.prototype.getUri = function getUri(config) {
1845
- config = mergeConfig$1(this.defaults, config);
1846
- return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
1847
- };
1848
-
1849
- // Provide aliases for supported request methods
1850
- utils$4.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
1851
- /*eslint func-names:0*/
1852
- Axios$1.prototype[method] = function(url, config) {
1853
- return this.request(mergeConfig$1(config || {}, {
1854
- method: method,
1855
- url: url,
1856
- data: (config || {}).data
1857
- }));
1858
- };
1859
- });
1860
-
1861
- utils$4.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1862
- /*eslint func-names:0*/
1863
- Axios$1.prototype[method] = function(url, data, config) {
1864
- return this.request(mergeConfig$1(config || {}, {
1865
- method: method,
1866
- url: url,
1867
- data: data
1868
- }));
1869
- };
1870
- });
1871
-
1872
- var Axios_1 = Axios$1;
1873
-
1874
- var CancelToken_1;
1875
- var hasRequiredCancelToken;
1876
-
1877
- function requireCancelToken () {
1878
- if (hasRequiredCancelToken) return CancelToken_1;
1879
- hasRequiredCancelToken = 1;
1880
-
1881
- var Cancel = requireCancel();
1882
-
1883
- /**
1884
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
1885
- *
1886
- * @class
1887
- * @param {Function} executor The executor function.
1888
- */
1889
- function CancelToken(executor) {
1890
- if (typeof executor !== 'function') {
1891
- throw new TypeError('executor must be a function.');
1892
- }
1893
-
1894
- var resolvePromise;
1895
-
1896
- this.promise = new Promise(function promiseExecutor(resolve) {
1897
- resolvePromise = resolve;
1898
- });
1899
-
1900
- var token = this;
1901
-
1902
- // eslint-disable-next-line func-names
1903
- this.promise.then(function(cancel) {
1904
- if (!token._listeners) return;
1905
-
1906
- var i;
1907
- var l = token._listeners.length;
1908
-
1909
- for (i = 0; i < l; i++) {
1910
- token._listeners[i](cancel);
1911
- }
1912
- token._listeners = null;
1913
- });
1914
-
1915
- // eslint-disable-next-line func-names
1916
- this.promise.then = function(onfulfilled) {
1917
- var _resolve;
1918
- // eslint-disable-next-line func-names
1919
- var promise = new Promise(function(resolve) {
1920
- token.subscribe(resolve);
1921
- _resolve = resolve;
1922
- }).then(onfulfilled);
1923
-
1924
- promise.cancel = function reject() {
1925
- token.unsubscribe(_resolve);
1926
- };
1927
-
1928
- return promise;
1929
- };
1930
-
1931
- executor(function cancel(message) {
1932
- if (token.reason) {
1933
- // Cancellation has already been requested
1934
- return;
1935
- }
1936
-
1937
- token.reason = new Cancel(message);
1938
- resolvePromise(token.reason);
1939
- });
1940
- }
1941
-
1942
- /**
1943
- * Throws a `Cancel` if cancellation has been requested.
1944
- */
1945
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
1946
- if (this.reason) {
1947
- throw this.reason;
1948
- }
1949
- };
1950
-
1951
- /**
1952
- * Subscribe to the cancel signal
1953
- */
1954
-
1955
- CancelToken.prototype.subscribe = function subscribe(listener) {
1956
- if (this.reason) {
1957
- listener(this.reason);
1958
- return;
1959
- }
1960
-
1961
- if (this._listeners) {
1962
- this._listeners.push(listener);
1963
- } else {
1964
- this._listeners = [listener];
1965
- }
1966
- };
1967
-
1968
- /**
1969
- * Unsubscribe from the cancel signal
1970
- */
1971
-
1972
- CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
1973
- if (!this._listeners) {
1974
- return;
1975
- }
1976
- var index = this._listeners.indexOf(listener);
1977
- if (index !== -1) {
1978
- this._listeners.splice(index, 1);
1979
- }
1980
- };
1981
-
1982
- /**
1983
- * Returns an object that contains a new `CancelToken` and a function that, when called,
1984
- * cancels the `CancelToken`.
1985
- */
1986
- CancelToken.source = function source() {
1987
- var cancel;
1988
- var token = new CancelToken(function executor(c) {
1989
- cancel = c;
1990
- });
1991
- return {
1992
- token: token,
1993
- cancel: cancel
1994
- };
1995
- };
1996
-
1997
- CancelToken_1 = CancelToken;
1998
- return CancelToken_1;
1999
- }
2000
-
2001
- var spread;
2002
- var hasRequiredSpread;
2003
-
2004
- function requireSpread () {
2005
- if (hasRequiredSpread) return spread;
2006
- hasRequiredSpread = 1;
2007
-
2008
- /**
2009
- * Syntactic sugar for invoking a function and expanding an array for arguments.
2010
- *
2011
- * Common use case would be to use `Function.prototype.apply`.
2012
- *
2013
- * ```js
2014
- * function f(x, y, z) {}
2015
- * var args = [1, 2, 3];
2016
- * f.apply(null, args);
2017
- * ```
2018
- *
2019
- * With `spread` this example can be re-written.
2020
- *
2021
- * ```js
2022
- * spread(function(x, y, z) {})([1, 2, 3]);
2023
- * ```
2024
- *
2025
- * @param {Function} callback
2026
- * @returns {Function}
2027
- */
2028
- spread = function spread(callback) {
2029
- return function wrap(arr) {
2030
- return callback.apply(null, arr);
2031
- };
2032
- };
2033
- return spread;
2034
- }
2035
-
2036
- var isAxiosError;
2037
- var hasRequiredIsAxiosError;
2038
-
2039
- function requireIsAxiosError () {
2040
- if (hasRequiredIsAxiosError) return isAxiosError;
2041
- hasRequiredIsAxiosError = 1;
2042
-
2043
- var utils = utils$c;
2044
-
2045
- /**
2046
- * Determines whether the payload is an error thrown by Axios
2047
- *
2048
- * @param {*} payload The value to test
2049
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
2050
- */
2051
- isAxiosError = function isAxiosError(payload) {
2052
- return utils.isObject(payload) && (payload.isAxiosError === true);
2053
- };
2054
- return isAxiosError;
2055
- }
2056
-
2057
- var utils$3 = utils$c;
2058
- var bind$2 = bind$4;
2059
- var Axios = Axios_1;
2060
- var mergeConfig = mergeConfig$2;
2061
- var defaults$2 = defaults_1;
2062
-
2063
- /**
2064
- * Create an instance of Axios
2065
- *
2066
- * @param {Object} defaultConfig The default config for the instance
2067
- * @return {Axios} A new instance of Axios
2068
- */
2069
- function createInstance(defaultConfig) {
2070
- var context = new Axios(defaultConfig);
2071
- var instance = bind$2(Axios.prototype.request, context);
2072
-
2073
- // Copy axios.prototype to instance
2074
- utils$3.extend(instance, Axios.prototype, context);
2075
-
2076
- // Copy context to instance
2077
- utils$3.extend(instance, context);
2078
-
2079
- // Factory for creating new instances
2080
- instance.create = function create(instanceConfig) {
2081
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
2082
- };
2083
-
2084
- return instance;
2085
- }
2086
-
2087
- // Create the default instance to be exported
2088
- var axios$1 = createInstance(defaults$2);
2089
-
2090
- // Expose Axios class to allow class inheritance
2091
- axios$1.Axios = Axios;
2092
-
2093
- // Expose Cancel & CancelToken
2094
- axios$1.Cancel = requireCancel();
2095
- axios$1.CancelToken = requireCancelToken();
2096
- axios$1.isCancel = requireIsCancel();
2097
- axios$1.VERSION = requireData().version;
2098
-
2099
- // Expose all/spread
2100
- axios$1.all = function all(promises) {
2101
- return Promise.all(promises);
2102
- };
2103
- axios$1.spread = requireSpread();
2104
-
2105
- // Expose isAxiosError
2106
- axios$1.isAxiosError = requireIsAxiosError();
2107
-
2108
- axios$2.exports = axios$1;
2109
-
2110
- // Allow use of default import syntax in TypeScript
2111
- axiosExports.default = axios$1;
2112
-
2113
- (function (module) {
2114
- module.exports = axiosExports;
2115
- } (axios$3));
2116
-
2117
- const axios = /*@__PURE__*/getDefaultExportFromCjs(axiosExports$1);
2118
-
2119
157
  var ipaddrExports = {};
2120
158
  var ipaddr = {
2121
159
  get exports(){ return ipaddrExports; },