@vonage/client-sdk 1.5.0-alpha.3 → 1.5.0-alpha.4

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.
@@ -30609,6 +30609,15 @@
30609
30609
  setMetadataFor(Companion_130, 'Companion', objectMeta);
30610
30610
  setMetadataFor($serializer_149, '$serializer', objectMeta, VOID, [GeneratedSerializer]);
30611
30611
  setMetadataFor(SessionTerminatedEvent, 'SessionTerminatedEvent', classMeta, VOID, [SocketEvent], VOID, VOID, {0: $serializer_getInstance_149});
30612
+ function onAudioSay() {
30613
+ }
30614
+ function onAudioMuteUpdate(conversationId, legId, isMuted) {
30615
+ }
30616
+ function onAudioEarmuffUpdate(conversationId, legId, earmuffStatus) {
30617
+ }
30618
+ function onAudioDTMFUpdate(conversationId, legId, digits) {
30619
+ }
30620
+ setMetadataFor(AudioEventListener, 'AudioEventListener', interfaceMeta);
30612
30621
  function onRTCHangup(conversationId, legId, hangup) {
30613
30622
  }
30614
30623
  function onRTCTransfer(conversationId, legId) {
@@ -30619,16 +30628,7 @@
30619
30628
  function onConversationEvent(event) {
30620
30629
  }
30621
30630
  setMetadataFor(ConversationEventListener, 'ConversationEventListener', interfaceMeta);
30622
- function onAudioSay() {
30623
- }
30624
- function onAudioMuteUpdate(conversationId, legId, isMuted) {
30625
- }
30626
- function onAudioEarmuffUpdate(conversationId, legId, earmuffStatus) {
30627
- }
30628
- function onAudioDTMFUpdate(conversationId, legId, digits) {
30629
- }
30630
- setMetadataFor(AudioEventListener, 'AudioEventListener', interfaceMeta);
30631
- setMetadataFor(ChatAPIImpl$1, VOID, classMeta, VOID, [RTCEventListener, ConversationEventListener, AudioEventListener]);
30631
+ setMetadataFor(ChatAPIImpl$1, VOID, classMeta, VOID, [AudioEventListener, RTCEventListener, ConversationEventListener]);
30632
30632
  setMetadataFor(ChatAPIImpl, 'ChatAPIImpl', classMeta, VOID, [ChatAPI]);
30633
30633
  setMetadataFor(LoggingLevel, 'LoggingLevel', classMeta, Enum);
30634
30634
  setMetadataFor(ClientConfigRegion, 'ClientConfigRegion', classMeta, Enum);
@@ -30753,7 +30753,7 @@
30753
30753
  setMetadataFor(HangupReason, 'HangupReason', classMeta, Enum);
30754
30754
  setMetadataFor(LegStatus, 'LegStatus', classMeta, Enum);
30755
30755
  setMetadataFor(CallDisconnectReason, 'CallDisconnectReason', classMeta, Enum);
30756
- setMetadataFor(VoiceAPIImpl$1, VOID, classMeta, VOID, [RTCEventListener, ConversationEventListener, AudioEventListener]);
30756
+ setMetadataFor(VoiceAPIImpl$1, VOID, classMeta, VOID, [AudioEventListener, RTCEventListener, ConversationEventListener]);
30757
30757
  setMetadataFor(VoiceAPIImpl, 'VoiceAPIImpl', classMeta);
30758
30758
  setMetadataFor(CallEvent, 'CallEvent', interfaceMeta);
30759
30759
  setMetadataFor(SetupOutboundCall, 'SetupOutboundCall', classMeta, VOID, [CallEvent]);
@@ -30968,7 +30968,7 @@
30968
30968
  setMetadataFor(Failed, 'Failed', classMeta, StateTransition);
30969
30969
  //endregion
30970
30970
  function BuildKonfig() {
30971
- this.b19_1 = '1.5.0-alpha.3';
30971
+ this.b19_1 = '1.5.0-alpha.4';
30972
30972
  }
30973
30973
  var BuildKonfig_instance;
30974
30974
  function CoreClientWithMedia() {
@@ -77299,3277 +77299,30 @@
77299
77299
 
77300
77300
  } (clientsdkClientcore_js));
77301
77301
 
77302
- function bind(fn, thisArg) {
77303
- return function wrap() {
77304
- return fn.apply(thisArg, arguments);
77305
- };
77306
- }
77307
-
77308
- // utils is a library of generic helper functions non-specific to axios
77309
-
77310
- const {toString: toString$1} = Object.prototype;
77311
- const {getPrototypeOf} = Object;
77312
-
77313
- const kindOf = (cache => thing => {
77314
- const str = toString$1.call(thing);
77315
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
77316
- })(Object.create(null));
77317
-
77318
- const kindOfTest = (type) => {
77319
- type = type.toLowerCase();
77320
- return (thing) => kindOf(thing) === type
77321
- };
77322
-
77323
- const typeOfTest = type => thing => typeof thing === type;
77324
-
77325
- /**
77326
- * Determine if a value is an Array
77327
- *
77328
- * @param {Object} val The value to test
77329
- *
77330
- * @returns {boolean} True if value is an Array, otherwise false
77331
- */
77332
- const {isArray} = Array;
77333
-
77334
- /**
77335
- * Determine if a value is undefined
77336
- *
77337
- * @param {*} val The value to test
77338
- *
77339
- * @returns {boolean} True if the value is undefined, otherwise false
77340
- */
77341
- const isUndefined = typeOfTest('undefined');
77342
-
77343
- /**
77344
- * Determine if a value is a Buffer
77345
- *
77346
- * @param {*} val The value to test
77347
- *
77348
- * @returns {boolean} True if value is a Buffer, otherwise false
77349
- */
77350
- function isBuffer(val) {
77351
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
77352
- && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
77353
- }
77354
-
77355
- /**
77356
- * Determine if a value is an ArrayBuffer
77357
- *
77358
- * @param {*} val The value to test
77359
- *
77360
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
77361
- */
77362
- const isArrayBuffer = kindOfTest('ArrayBuffer');
77363
-
77364
-
77365
- /**
77366
- * Determine if a value is a view on an ArrayBuffer
77367
- *
77368
- * @param {*} val The value to test
77369
- *
77370
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
77371
- */
77372
- function isArrayBufferView(val) {
77373
- let result;
77374
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
77375
- result = ArrayBuffer.isView(val);
77376
- } else {
77377
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
77378
- }
77379
- return result;
77380
- }
77381
-
77382
- /**
77383
- * Determine if a value is a String
77384
- *
77385
- * @param {*} val The value to test
77386
- *
77387
- * @returns {boolean} True if value is a String, otherwise false
77388
- */
77389
- const isString = typeOfTest('string');
77390
-
77391
- /**
77392
- * Determine if a value is a Function
77393
- *
77394
- * @param {*} val The value to test
77395
- * @returns {boolean} True if value is a Function, otherwise false
77396
- */
77397
- const isFunction = typeOfTest('function');
77398
-
77399
- /**
77400
- * Determine if a value is a Number
77401
- *
77402
- * @param {*} val The value to test
77403
- *
77404
- * @returns {boolean} True if value is a Number, otherwise false
77405
- */
77406
- const isNumber = typeOfTest('number');
77407
-
77408
- /**
77409
- * Determine if a value is an Object
77410
- *
77411
- * @param {*} thing The value to test
77412
- *
77413
- * @returns {boolean} True if value is an Object, otherwise false
77414
- */
77415
- const isObject$2 = (thing) => thing !== null && typeof thing === 'object';
77416
-
77417
- /**
77418
- * Determine if a value is a Boolean
77419
- *
77420
- * @param {*} thing The value to test
77421
- * @returns {boolean} True if value is a Boolean, otherwise false
77422
- */
77423
- const isBoolean = thing => thing === true || thing === false;
77424
-
77425
- /**
77426
- * Determine if a value is a plain Object
77427
- *
77428
- * @param {*} val The value to test
77429
- *
77430
- * @returns {boolean} True if value is a plain Object, otherwise false
77431
- */
77432
- const isPlainObject = (val) => {
77433
- if (kindOf(val) !== 'object') {
77434
- return false;
77435
- }
77436
-
77437
- const prototype = getPrototypeOf(val);
77438
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
77439
- };
77440
-
77441
- /**
77442
- * Determine if a value is a Date
77443
- *
77444
- * @param {*} val The value to test
77445
- *
77446
- * @returns {boolean} True if value is a Date, otherwise false
77447
- */
77448
- const isDate = kindOfTest('Date');
77449
-
77450
- /**
77451
- * Determine if a value is a File
77452
- *
77453
- * @param {*} val The value to test
77454
- *
77455
- * @returns {boolean} True if value is a File, otherwise false
77456
- */
77457
- const isFile = kindOfTest('File');
77458
-
77459
- /**
77460
- * Determine if a value is a Blob
77461
- *
77462
- * @param {*} val The value to test
77463
- *
77464
- * @returns {boolean} True if value is a Blob, otherwise false
77465
- */
77466
- const isBlob = kindOfTest('Blob');
77467
-
77468
- /**
77469
- * Determine if a value is a FileList
77470
- *
77471
- * @param {*} val The value to test
77472
- *
77473
- * @returns {boolean} True if value is a File, otherwise false
77474
- */
77475
- const isFileList = kindOfTest('FileList');
77476
-
77477
- /**
77478
- * Determine if a value is a Stream
77479
- *
77480
- * @param {*} val The value to test
77481
- *
77482
- * @returns {boolean} True if value is a Stream, otherwise false
77483
- */
77484
- const isStream = (val) => isObject$2(val) && isFunction(val.pipe);
77485
-
77486
- /**
77487
- * Determine if a value is a FormData
77488
- *
77489
- * @param {*} thing The value to test
77490
- *
77491
- * @returns {boolean} True if value is an FormData, otherwise false
77492
- */
77493
- const isFormData = (thing) => {
77494
- let kind;
77495
- return thing && (
77496
- (typeof FormData === 'function' && thing instanceof FormData) || (
77497
- isFunction(thing.append) && (
77498
- (kind = kindOf(thing)) === 'formdata' ||
77499
- // detect form-data instance
77500
- (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
77501
- )
77502
- )
77503
- )
77504
- };
77505
-
77506
- /**
77507
- * Determine if a value is a URLSearchParams object
77508
- *
77509
- * @param {*} val The value to test
77510
- *
77511
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
77512
- */
77513
- const isURLSearchParams = kindOfTest('URLSearchParams');
77514
-
77515
- /**
77516
- * Trim excess whitespace off the beginning and end of a string
77517
- *
77518
- * @param {String} str The String to trim
77519
- *
77520
- * @returns {String} The String freed of excess whitespace
77521
- */
77522
- const trim = (str) => str.trim ?
77523
- str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
77524
-
77525
- /**
77526
- * Iterate over an Array or an Object invoking a function for each item.
77527
- *
77528
- * If `obj` is an Array callback will be called passing
77529
- * the value, index, and complete array for each item.
77530
- *
77531
- * If 'obj' is an Object callback will be called passing
77532
- * the value, key, and complete object for each property.
77533
- *
77534
- * @param {Object|Array} obj The object to iterate
77535
- * @param {Function} fn The callback to invoke for each item
77536
- *
77537
- * @param {Boolean} [allOwnKeys = false]
77538
- * @returns {any}
77539
- */
77540
- function forEach(obj, fn, {allOwnKeys = false} = {}) {
77541
- // Don't bother if no value provided
77542
- if (obj === null || typeof obj === 'undefined') {
77543
- return;
77544
- }
77545
-
77546
- let i;
77547
- let l;
77548
-
77549
- // Force an array if not already something iterable
77550
- if (typeof obj !== 'object') {
77551
- /*eslint no-param-reassign:0*/
77552
- obj = [obj];
77553
- }
77554
-
77555
- if (isArray(obj)) {
77556
- // Iterate over array values
77557
- for (i = 0, l = obj.length; i < l; i++) {
77558
- fn.call(null, obj[i], i, obj);
77559
- }
77560
- } else {
77561
- // Iterate over object keys
77562
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
77563
- const len = keys.length;
77564
- let key;
77565
-
77566
- for (i = 0; i < len; i++) {
77567
- key = keys[i];
77568
- fn.call(null, obj[key], key, obj);
77569
- }
77570
- }
77571
- }
77572
-
77573
- function findKey(obj, key) {
77574
- key = key.toLowerCase();
77575
- const keys = Object.keys(obj);
77576
- let i = keys.length;
77577
- let _key;
77578
- while (i-- > 0) {
77579
- _key = keys[i];
77580
- if (key === _key.toLowerCase()) {
77581
- return _key;
77582
- }
77583
- }
77584
- return null;
77585
- }
77586
-
77587
- const _global = (() => {
77588
- /*eslint no-undef:0*/
77589
- if (typeof globalThis !== "undefined") return globalThis;
77590
- return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
77591
- })();
77592
-
77593
- const isContextDefined = (context) => !isUndefined(context) && context !== _global;
77594
-
77595
- /**
77596
- * Accepts varargs expecting each argument to be an object, then
77597
- * immutably merges the properties of each object and returns result.
77598
- *
77599
- * When multiple objects contain the same key the later object in
77600
- * the arguments list will take precedence.
77601
- *
77602
- * Example:
77603
- *
77604
- * ```js
77605
- * var result = merge({foo: 123}, {foo: 456});
77606
- * console.log(result.foo); // outputs 456
77607
- * ```
77608
- *
77609
- * @param {Object} obj1 Object to merge
77610
- *
77611
- * @returns {Object} Result of all merge properties
77612
- */
77613
- function merge(/* obj1, obj2, obj3, ... */) {
77614
- const {caseless} = isContextDefined(this) && this || {};
77615
- const result = {};
77616
- const assignValue = (val, key) => {
77617
- const targetKey = caseless && findKey(result, key) || key;
77618
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
77619
- result[targetKey] = merge(result[targetKey], val);
77620
- } else if (isPlainObject(val)) {
77621
- result[targetKey] = merge({}, val);
77622
- } else if (isArray(val)) {
77623
- result[targetKey] = val.slice();
77624
- } else {
77625
- result[targetKey] = val;
77626
- }
77627
- };
77628
-
77629
- for (let i = 0, l = arguments.length; i < l; i++) {
77630
- arguments[i] && forEach(arguments[i], assignValue);
77631
- }
77632
- return result;
77633
- }
77634
-
77635
- /**
77636
- * Extends object a by mutably adding to it the properties of object b.
77637
- *
77638
- * @param {Object} a The object to be extended
77639
- * @param {Object} b The object to copy properties from
77640
- * @param {Object} thisArg The object to bind function to
77641
- *
77642
- * @param {Boolean} [allOwnKeys]
77643
- * @returns {Object} The resulting value of object a
77644
- */
77645
- const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
77646
- forEach(b, (val, key) => {
77647
- if (thisArg && isFunction(val)) {
77648
- a[key] = bind(val, thisArg);
77649
- } else {
77650
- a[key] = val;
77651
- }
77652
- }, {allOwnKeys});
77653
- return a;
77654
- };
77655
-
77656
- /**
77657
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
77658
- *
77659
- * @param {string} content with BOM
77660
- *
77661
- * @returns {string} content value without BOM
77662
- */
77663
- const stripBOM = (content) => {
77664
- if (content.charCodeAt(0) === 0xFEFF) {
77665
- content = content.slice(1);
77666
- }
77667
- return content;
77668
- };
77669
-
77670
- /**
77671
- * Inherit the prototype methods from one constructor into another
77672
- * @param {function} constructor
77673
- * @param {function} superConstructor
77674
- * @param {object} [props]
77675
- * @param {object} [descriptors]
77676
- *
77677
- * @returns {void}
77678
- */
77679
- const inherits = (constructor, superConstructor, props, descriptors) => {
77680
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
77681
- constructor.prototype.constructor = constructor;
77682
- Object.defineProperty(constructor, 'super', {
77683
- value: superConstructor.prototype
77684
- });
77685
- props && Object.assign(constructor.prototype, props);
77686
- };
77687
-
77688
- /**
77689
- * Resolve object with deep prototype chain to a flat object
77690
- * @param {Object} sourceObj source object
77691
- * @param {Object} [destObj]
77692
- * @param {Function|Boolean} [filter]
77693
- * @param {Function} [propFilter]
77694
- *
77695
- * @returns {Object}
77696
- */
77697
- const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
77698
- let props;
77699
- let i;
77700
- let prop;
77701
- const merged = {};
77702
-
77703
- destObj = destObj || {};
77704
- // eslint-disable-next-line no-eq-null,eqeqeq
77705
- if (sourceObj == null) return destObj;
77706
-
77707
- do {
77708
- props = Object.getOwnPropertyNames(sourceObj);
77709
- i = props.length;
77710
- while (i-- > 0) {
77711
- prop = props[i];
77712
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
77713
- destObj[prop] = sourceObj[prop];
77714
- merged[prop] = true;
77715
- }
77716
- }
77717
- sourceObj = filter !== false && getPrototypeOf(sourceObj);
77718
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
77719
-
77720
- return destObj;
77721
- };
77722
-
77723
- /**
77724
- * Determines whether a string ends with the characters of a specified string
77725
- *
77726
- * @param {String} str
77727
- * @param {String} searchString
77728
- * @param {Number} [position= 0]
77729
- *
77730
- * @returns {boolean}
77731
- */
77732
- const endsWith = (str, searchString, position) => {
77733
- str = String(str);
77734
- if (position === undefined || position > str.length) {
77735
- position = str.length;
77736
- }
77737
- position -= searchString.length;
77738
- const lastIndex = str.indexOf(searchString, position);
77739
- return lastIndex !== -1 && lastIndex === position;
77740
- };
77741
-
77742
-
77743
- /**
77744
- * Returns new array from array like object or null if failed
77745
- *
77746
- * @param {*} [thing]
77747
- *
77748
- * @returns {?Array}
77749
- */
77750
- const toArray$1 = (thing) => {
77751
- if (!thing) return null;
77752
- if (isArray(thing)) return thing;
77753
- let i = thing.length;
77754
- if (!isNumber(i)) return null;
77755
- const arr = new Array(i);
77756
- while (i-- > 0) {
77757
- arr[i] = thing[i];
77758
- }
77759
- return arr;
77760
- };
77761
-
77762
- /**
77763
- * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
77764
- * thing passed in is an instance of Uint8Array
77765
- *
77766
- * @param {TypedArray}
77767
- *
77768
- * @returns {Array}
77769
- */
77770
- // eslint-disable-next-line func-names
77771
- const isTypedArray = (TypedArray => {
77772
- // eslint-disable-next-line func-names
77773
- return thing => {
77774
- return TypedArray && thing instanceof TypedArray;
77775
- };
77776
- })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
77777
-
77778
- /**
77779
- * For each entry in the object, call the function with the key and value.
77780
- *
77781
- * @param {Object<any, any>} obj - The object to iterate over.
77782
- * @param {Function} fn - The function to call for each entry.
77783
- *
77784
- * @returns {void}
77785
- */
77786
- const forEachEntry = (obj, fn) => {
77787
- const generator = obj && obj[Symbol.iterator];
77788
-
77789
- const iterator = generator.call(obj);
77790
-
77791
- let result;
77792
-
77793
- while ((result = iterator.next()) && !result.done) {
77794
- const pair = result.value;
77795
- fn.call(obj, pair[0], pair[1]);
77796
- }
77797
- };
77798
-
77799
- /**
77800
- * It takes a regular expression and a string, and returns an array of all the matches
77801
- *
77802
- * @param {string} regExp - The regular expression to match against.
77803
- * @param {string} str - The string to search.
77804
- *
77805
- * @returns {Array<boolean>}
77806
- */
77807
- const matchAll = (regExp, str) => {
77808
- let matches;
77809
- const arr = [];
77810
-
77811
- while ((matches = regExp.exec(str)) !== null) {
77812
- arr.push(matches);
77813
- }
77814
-
77815
- return arr;
77816
- };
77817
-
77818
- /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
77819
- const isHTMLForm = kindOfTest('HTMLFormElement');
77820
-
77821
- const toCamelCase = str => {
77822
- return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
77823
- function replacer(m, p1, p2) {
77824
- return p1.toUpperCase() + p2;
77825
- }
77826
- );
77827
- };
77828
-
77829
- /* Creating a function that will check if an object has a property. */
77830
- const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
77831
-
77832
- /**
77833
- * Determine if a value is a RegExp object
77834
- *
77835
- * @param {*} val The value to test
77836
- *
77837
- * @returns {boolean} True if value is a RegExp object, otherwise false
77838
- */
77839
- const isRegExp = kindOfTest('RegExp');
77840
-
77841
- const reduceDescriptors = (obj, reducer) => {
77842
- const descriptors = Object.getOwnPropertyDescriptors(obj);
77843
- const reducedDescriptors = {};
77844
-
77845
- forEach(descriptors, (descriptor, name) => {
77846
- let ret;
77847
- if ((ret = reducer(descriptor, name, obj)) !== false) {
77848
- reducedDescriptors[name] = ret || descriptor;
77849
- }
77850
- });
77851
-
77852
- Object.defineProperties(obj, reducedDescriptors);
77853
- };
77854
-
77855
- /**
77856
- * Makes all methods read-only
77857
- * @param {Object} obj
77858
- */
77859
-
77860
- const freezeMethods = (obj) => {
77861
- reduceDescriptors(obj, (descriptor, name) => {
77862
- // skip restricted props in strict mode
77863
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
77864
- return false;
77865
- }
77866
-
77867
- const value = obj[name];
77868
-
77869
- if (!isFunction(value)) return;
77870
-
77871
- descriptor.enumerable = false;
77872
-
77873
- if ('writable' in descriptor) {
77874
- descriptor.writable = false;
77875
- return;
77876
- }
77877
-
77878
- if (!descriptor.set) {
77879
- descriptor.set = () => {
77880
- throw Error('Can not rewrite read-only method \'' + name + '\'');
77881
- };
77882
- }
77883
- });
77884
- };
77885
-
77886
- const toObjectSet = (arrayOrString, delimiter) => {
77887
- const obj = {};
77888
-
77889
- const define = (arr) => {
77890
- arr.forEach(value => {
77891
- obj[value] = true;
77892
- });
77893
- };
77894
-
77895
- isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
77896
-
77897
- return obj;
77898
- };
77899
-
77900
- const noop = () => {};
77901
-
77902
- const toFiniteNumber = (value, defaultValue) => {
77903
- value = +value;
77904
- return Number.isFinite(value) ? value : defaultValue;
77905
- };
77906
-
77907
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
77908
-
77909
- const DIGIT = '0123456789';
77910
-
77911
- const ALPHABET = {
77912
- DIGIT,
77913
- ALPHA,
77914
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
77915
- };
77916
-
77917
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
77918
- let str = '';
77919
- const {length} = alphabet;
77920
- while (size--) {
77921
- str += alphabet[Math.random() * length|0];
77922
- }
77923
-
77924
- return str;
77925
- };
77926
-
77927
- /**
77928
- * If the thing is a FormData object, return true, otherwise return false.
77929
- *
77930
- * @param {unknown} thing - The thing to check.
77931
- *
77932
- * @returns {boolean}
77933
- */
77934
- function isSpecCompliantForm(thing) {
77935
- return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
77936
- }
77937
-
77938
- const toJSONObject = (obj) => {
77939
- const stack = new Array(10);
77940
-
77941
- const visit = (source, i) => {
77942
-
77943
- if (isObject$2(source)) {
77944
- if (stack.indexOf(source) >= 0) {
77945
- return;
77946
- }
77947
-
77948
- if(!('toJSON' in source)) {
77949
- stack[i] = source;
77950
- const target = isArray(source) ? [] : {};
77951
-
77952
- forEach(source, (value, key) => {
77953
- const reducedValue = visit(value, i + 1);
77954
- !isUndefined(reducedValue) && (target[key] = reducedValue);
77955
- });
77956
-
77957
- stack[i] = undefined;
77958
-
77959
- return target;
77960
- }
77961
- }
77962
-
77963
- return source;
77964
- };
77965
-
77966
- return visit(obj, 0);
77967
- };
77968
-
77969
- const isAsyncFn = kindOfTest('AsyncFunction');
77970
-
77971
- const isThenable = (thing) =>
77972
- thing && (isObject$2(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
77973
-
77974
- var utils$2 = {
77975
- isArray,
77976
- isArrayBuffer,
77977
- isBuffer,
77978
- isFormData,
77979
- isArrayBufferView,
77980
- isString,
77981
- isNumber,
77982
- isBoolean,
77983
- isObject: isObject$2,
77984
- isPlainObject,
77985
- isUndefined,
77986
- isDate,
77987
- isFile,
77988
- isBlob,
77989
- isRegExp,
77990
- isFunction,
77991
- isStream,
77992
- isURLSearchParams,
77993
- isTypedArray,
77994
- isFileList,
77995
- forEach,
77996
- merge,
77997
- extend,
77998
- trim,
77999
- stripBOM,
78000
- inherits,
78001
- toFlatObject,
78002
- kindOf,
78003
- kindOfTest,
78004
- endsWith,
78005
- toArray: toArray$1,
78006
- forEachEntry,
78007
- matchAll,
78008
- isHTMLForm,
78009
- hasOwnProperty,
78010
- hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
78011
- reduceDescriptors,
78012
- freezeMethods,
78013
- toObjectSet,
78014
- toCamelCase,
78015
- noop,
78016
- toFiniteNumber,
78017
- findKey,
78018
- global: _global,
78019
- isContextDefined,
78020
- ALPHABET,
78021
- generateString,
78022
- isSpecCompliantForm,
78023
- toJSONObject,
78024
- isAsyncFn,
78025
- isThenable
78026
- };
78027
-
78028
- /**
78029
- * Create an Error with the specified message, config, error code, request and response.
78030
- *
78031
- * @param {string} message The error message.
78032
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
78033
- * @param {Object} [config] The config.
78034
- * @param {Object} [request] The request.
78035
- * @param {Object} [response] The response.
78036
- *
78037
- * @returns {Error} The created error.
78038
- */
78039
- function AxiosError(message, code, config, request, response) {
78040
- Error.call(this);
78041
-
78042
- if (Error.captureStackTrace) {
78043
- Error.captureStackTrace(this, this.constructor);
78044
- } else {
78045
- this.stack = (new Error()).stack;
78046
- }
78047
-
78048
- this.message = message;
78049
- this.name = 'AxiosError';
78050
- code && (this.code = code);
78051
- config && (this.config = config);
78052
- request && (this.request = request);
78053
- response && (this.response = response);
78054
- }
78055
-
78056
- utils$2.inherits(AxiosError, Error, {
78057
- toJSON: function toJSON() {
78058
- return {
78059
- // Standard
78060
- message: this.message,
78061
- name: this.name,
78062
- // Microsoft
78063
- description: this.description,
78064
- number: this.number,
78065
- // Mozilla
78066
- fileName: this.fileName,
78067
- lineNumber: this.lineNumber,
78068
- columnNumber: this.columnNumber,
78069
- stack: this.stack,
78070
- // Axios
78071
- config: utils$2.toJSONObject(this.config),
78072
- code: this.code,
78073
- status: this.response && this.response.status ? this.response.status : null
78074
- };
78075
- }
78076
- });
78077
-
78078
- const prototype$1 = AxiosError.prototype;
78079
- const descriptors = {};
78080
-
78081
- [
78082
- 'ERR_BAD_OPTION_VALUE',
78083
- 'ERR_BAD_OPTION',
78084
- 'ECONNABORTED',
78085
- 'ETIMEDOUT',
78086
- 'ERR_NETWORK',
78087
- 'ERR_FR_TOO_MANY_REDIRECTS',
78088
- 'ERR_DEPRECATED',
78089
- 'ERR_BAD_RESPONSE',
78090
- 'ERR_BAD_REQUEST',
78091
- 'ERR_CANCELED',
78092
- 'ERR_NOT_SUPPORT',
78093
- 'ERR_INVALID_URL'
78094
- // eslint-disable-next-line func-names
78095
- ].forEach(code => {
78096
- descriptors[code] = {value: code};
78097
- });
78098
-
78099
- Object.defineProperties(AxiosError, descriptors);
78100
- Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
78101
-
78102
- // eslint-disable-next-line func-names
78103
- AxiosError.from = (error, code, config, request, response, customProps) => {
78104
- const axiosError = Object.create(prototype$1);
78105
-
78106
- utils$2.toFlatObject(error, axiosError, function filter(obj) {
78107
- return obj !== Error.prototype;
78108
- }, prop => {
78109
- return prop !== 'isAxiosError';
78110
- });
78111
-
78112
- AxiosError.call(axiosError, error.message, code, config, request, response);
78113
-
78114
- axiosError.cause = error;
78115
-
78116
- axiosError.name = error.name;
78117
-
78118
- customProps && Object.assign(axiosError, customProps);
78119
-
78120
- return axiosError;
78121
- };
78122
-
78123
- // eslint-disable-next-line strict
78124
- var httpAdapter = null;
78125
-
78126
- /**
78127
- * Determines if the given thing is a array or js object.
78128
- *
78129
- * @param {string} thing - The object or array to be visited.
78130
- *
78131
- * @returns {boolean}
78132
- */
78133
- function isVisitable(thing) {
78134
- return utils$2.isPlainObject(thing) || utils$2.isArray(thing);
78135
- }
78136
-
78137
- /**
78138
- * It removes the brackets from the end of a string
78139
- *
78140
- * @param {string} key - The key of the parameter.
78141
- *
78142
- * @returns {string} the key without the brackets.
78143
- */
78144
- function removeBrackets(key) {
78145
- return utils$2.endsWith(key, '[]') ? key.slice(0, -2) : key;
78146
- }
78147
-
78148
- /**
78149
- * It takes a path, a key, and a boolean, and returns a string
78150
- *
78151
- * @param {string} path - The path to the current key.
78152
- * @param {string} key - The key of the current object being iterated over.
78153
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
78154
- *
78155
- * @returns {string} The path to the current key.
78156
- */
78157
- function renderKey(path, key, dots) {
78158
- if (!path) return key;
78159
- return path.concat(key).map(function each(token, i) {
78160
- // eslint-disable-next-line no-param-reassign
78161
- token = removeBrackets(token);
78162
- return !dots && i ? '[' + token + ']' : token;
78163
- }).join(dots ? '.' : '');
78164
- }
78165
-
78166
- /**
78167
- * If the array is an array and none of its elements are visitable, then it's a flat array.
78168
- *
78169
- * @param {Array<any>} arr - The array to check
78170
- *
78171
- * @returns {boolean}
78172
- */
78173
- function isFlatArray(arr) {
78174
- return utils$2.isArray(arr) && !arr.some(isVisitable);
78175
- }
78176
-
78177
- const predicates = utils$2.toFlatObject(utils$2, {}, null, function filter(prop) {
78178
- return /^is[A-Z]/.test(prop);
78179
- });
78180
-
78181
- /**
78182
- * Convert a data object to FormData
78183
- *
78184
- * @param {Object} obj
78185
- * @param {?Object} [formData]
78186
- * @param {?Object} [options]
78187
- * @param {Function} [options.visitor]
78188
- * @param {Boolean} [options.metaTokens = true]
78189
- * @param {Boolean} [options.dots = false]
78190
- * @param {?Boolean} [options.indexes = false]
78191
- *
78192
- * @returns {Object}
78193
- **/
78194
-
78195
- /**
78196
- * It converts an object into a FormData object
78197
- *
78198
- * @param {Object<any, any>} obj - The object to convert to form data.
78199
- * @param {string} formData - The FormData object to append to.
78200
- * @param {Object<string, any>} options
78201
- *
78202
- * @returns
78203
- */
78204
- function toFormData(obj, formData, options) {
78205
- if (!utils$2.isObject(obj)) {
78206
- throw new TypeError('target must be an object');
78207
- }
78208
-
78209
- // eslint-disable-next-line no-param-reassign
78210
- formData = formData || new (FormData)();
78211
-
78212
- // eslint-disable-next-line no-param-reassign
78213
- options = utils$2.toFlatObject(options, {
78214
- metaTokens: true,
78215
- dots: false,
78216
- indexes: false
78217
- }, false, function defined(option, source) {
78218
- // eslint-disable-next-line no-eq-null,eqeqeq
78219
- return !utils$2.isUndefined(source[option]);
78220
- });
78221
-
78222
- const metaTokens = options.metaTokens;
78223
- // eslint-disable-next-line no-use-before-define
78224
- const visitor = options.visitor || defaultVisitor;
78225
- const dots = options.dots;
78226
- const indexes = options.indexes;
78227
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
78228
- const useBlob = _Blob && utils$2.isSpecCompliantForm(formData);
78229
-
78230
- if (!utils$2.isFunction(visitor)) {
78231
- throw new TypeError('visitor must be a function');
78232
- }
78233
-
78234
- function convertValue(value) {
78235
- if (value === null) return '';
78236
-
78237
- if (utils$2.isDate(value)) {
78238
- return value.toISOString();
78239
- }
78240
-
78241
- if (!useBlob && utils$2.isBlob(value)) {
78242
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
78243
- }
78244
-
78245
- if (utils$2.isArrayBuffer(value) || utils$2.isTypedArray(value)) {
78246
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
78247
- }
78248
-
78249
- return value;
78250
- }
78251
-
78252
- /**
78253
- * Default visitor.
78254
- *
78255
- * @param {*} value
78256
- * @param {String|Number} key
78257
- * @param {Array<String|Number>} path
78258
- * @this {FormData}
78259
- *
78260
- * @returns {boolean} return true to visit the each prop of the value recursively
78261
- */
78262
- function defaultVisitor(value, key, path) {
78263
- let arr = value;
78264
-
78265
- if (value && !path && typeof value === 'object') {
78266
- if (utils$2.endsWith(key, '{}')) {
78267
- // eslint-disable-next-line no-param-reassign
78268
- key = metaTokens ? key : key.slice(0, -2);
78269
- // eslint-disable-next-line no-param-reassign
78270
- value = JSON.stringify(value);
78271
- } else if (
78272
- (utils$2.isArray(value) && isFlatArray(value)) ||
78273
- ((utils$2.isFileList(value) || utils$2.endsWith(key, '[]')) && (arr = utils$2.toArray(value))
78274
- )) {
78275
- // eslint-disable-next-line no-param-reassign
78276
- key = removeBrackets(key);
78277
-
78278
- arr.forEach(function each(el, index) {
78279
- !(utils$2.isUndefined(el) || el === null) && formData.append(
78280
- // eslint-disable-next-line no-nested-ternary
78281
- indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
78282
- convertValue(el)
78283
- );
78284
- });
78285
- return false;
78286
- }
78287
- }
78288
-
78289
- if (isVisitable(value)) {
78290
- return true;
78291
- }
78292
-
78293
- formData.append(renderKey(path, key, dots), convertValue(value));
78294
-
78295
- return false;
78296
- }
78297
-
78298
- const stack = [];
78299
-
78300
- const exposedHelpers = Object.assign(predicates, {
78301
- defaultVisitor,
78302
- convertValue,
78303
- isVisitable
78304
- });
78305
-
78306
- function build(value, path) {
78307
- if (utils$2.isUndefined(value)) return;
78308
-
78309
- if (stack.indexOf(value) !== -1) {
78310
- throw Error('Circular reference detected in ' + path.join('.'));
78311
- }
78312
-
78313
- stack.push(value);
78314
-
78315
- utils$2.forEach(value, function each(el, key) {
78316
- const result = !(utils$2.isUndefined(el) || el === null) && visitor.call(
78317
- formData, el, utils$2.isString(key) ? key.trim() : key, path, exposedHelpers
78318
- );
78319
-
78320
- if (result === true) {
78321
- build(el, path ? path.concat(key) : [key]);
78322
- }
78323
- });
78324
-
78325
- stack.pop();
78326
- }
78327
-
78328
- if (!utils$2.isObject(obj)) {
78329
- throw new TypeError('data must be an object');
78330
- }
78331
-
78332
- build(obj);
78333
-
78334
- return formData;
78335
- }
78336
-
78337
- /**
78338
- * It encodes a string by replacing all characters that are not in the unreserved set with
78339
- * their percent-encoded equivalents
78340
- *
78341
- * @param {string} str - The string to encode.
78342
- *
78343
- * @returns {string} The encoded string.
78344
- */
78345
- function encode$3(str) {
78346
- const charMap = {
78347
- '!': '%21',
78348
- "'": '%27',
78349
- '(': '%28',
78350
- ')': '%29',
78351
- '~': '%7E',
78352
- '%20': '+',
78353
- '%00': '\x00'
78354
- };
78355
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
78356
- return charMap[match];
78357
- });
78358
- }
78359
-
78360
- /**
78361
- * It takes a params object and converts it to a FormData object
78362
- *
78363
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
78364
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
78365
- *
78366
- * @returns {void}
78367
- */
78368
- function AxiosURLSearchParams(params, options) {
78369
- this._pairs = [];
78370
-
78371
- params && toFormData(params, this, options);
78372
- }
78373
-
78374
- const prototype = AxiosURLSearchParams.prototype;
78375
-
78376
- prototype.append = function append(name, value) {
78377
- this._pairs.push([name, value]);
78378
- };
78379
-
78380
- prototype.toString = function toString(encoder) {
78381
- const _encode = encoder ? function(value) {
78382
- return encoder.call(this, value, encode$3);
78383
- } : encode$3;
78384
-
78385
- return this._pairs.map(function each(pair) {
78386
- return _encode(pair[0]) + '=' + _encode(pair[1]);
78387
- }, '').join('&');
78388
- };
78389
-
78390
- /**
78391
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
78392
- * URI encoded counterparts
78393
- *
78394
- * @param {string} val The value to be encoded.
78395
- *
78396
- * @returns {string} The encoded value.
78397
- */
78398
- function encode$2(val) {
78399
- return encodeURIComponent(val).
78400
- replace(/%3A/gi, ':').
78401
- replace(/%24/g, '$').
78402
- replace(/%2C/gi, ',').
78403
- replace(/%20/g, '+').
78404
- replace(/%5B/gi, '[').
78405
- replace(/%5D/gi, ']');
78406
- }
78407
-
78408
- /**
78409
- * Build a URL by appending params to the end
78410
- *
78411
- * @param {string} url The base of the url (e.g., http://www.google.com)
78412
- * @param {object} [params] The params to be appended
78413
- * @param {?object} options
78414
- *
78415
- * @returns {string} The formatted url
78416
- */
78417
- function buildURL(url, params, options) {
78418
- /*eslint no-param-reassign:0*/
78419
- if (!params) {
78420
- return url;
78421
- }
78422
-
78423
- const _encode = options && options.encode || encode$2;
78424
-
78425
- const serializeFn = options && options.serialize;
78426
-
78427
- let serializedParams;
78428
-
78429
- if (serializeFn) {
78430
- serializedParams = serializeFn(params, options);
78431
- } else {
78432
- serializedParams = utils$2.isURLSearchParams(params) ?
78433
- params.toString() :
78434
- new AxiosURLSearchParams(params, options).toString(_encode);
78435
- }
78436
-
78437
- if (serializedParams) {
78438
- const hashmarkIndex = url.indexOf("#");
78439
-
78440
- if (hashmarkIndex !== -1) {
78441
- url = url.slice(0, hashmarkIndex);
78442
- }
78443
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
78444
- }
78445
-
78446
- return url;
78447
- }
78448
-
78449
- class InterceptorManager {
78450
- constructor() {
78451
- this.handlers = [];
78452
- }
78453
-
78454
- /**
78455
- * Add a new interceptor to the stack
78456
- *
78457
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
78458
- * @param {Function} rejected The function to handle `reject` for a `Promise`
78459
- *
78460
- * @return {Number} An ID used to remove interceptor later
78461
- */
78462
- use(fulfilled, rejected, options) {
78463
- this.handlers.push({
78464
- fulfilled,
78465
- rejected,
78466
- synchronous: options ? options.synchronous : false,
78467
- runWhen: options ? options.runWhen : null
78468
- });
78469
- return this.handlers.length - 1;
78470
- }
78471
-
78472
- /**
78473
- * Remove an interceptor from the stack
78474
- *
78475
- * @param {Number} id The ID that was returned by `use`
78476
- *
78477
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
78478
- */
78479
- eject(id) {
78480
- if (this.handlers[id]) {
78481
- this.handlers[id] = null;
78482
- }
78483
- }
78484
-
78485
- /**
78486
- * Clear all interceptors from the stack
78487
- *
78488
- * @returns {void}
78489
- */
78490
- clear() {
78491
- if (this.handlers) {
78492
- this.handlers = [];
78493
- }
78494
- }
78495
-
78496
- /**
78497
- * Iterate over all the registered interceptors
78498
- *
78499
- * This method is particularly useful for skipping over any
78500
- * interceptors that may have become `null` calling `eject`.
78501
- *
78502
- * @param {Function} fn The function to call for each interceptor
78503
- *
78504
- * @returns {void}
78505
- */
78506
- forEach(fn) {
78507
- utils$2.forEach(this.handlers, function forEachHandler(h) {
78508
- if (h !== null) {
78509
- fn(h);
78510
- }
78511
- });
78512
- }
78513
- }
78514
-
78515
- var InterceptorManager$1 = InterceptorManager;
78516
-
78517
- var transitionalDefaults = {
78518
- silentJSONParsing: true,
78519
- forcedJSONParsing: true,
78520
- clarifyTimeoutError: false
78521
- };
78522
-
78523
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
78524
-
78525
- var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
78526
-
78527
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
78528
-
78529
- var platform$1 = {
78530
- isBrowser: true,
78531
- classes: {
78532
- URLSearchParams: URLSearchParams$1,
78533
- FormData: FormData$1,
78534
- Blob: Blob$1
78535
- },
78536
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
78537
- };
78538
-
78539
- const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
78540
-
78541
- /**
78542
- * Determine if we're running in a standard browser environment
78543
- *
78544
- * This allows axios to run in a web worker, and react-native.
78545
- * Both environments support XMLHttpRequest, but not fully standard globals.
78546
- *
78547
- * web workers:
78548
- * typeof window -> undefined
78549
- * typeof document -> undefined
78550
- *
78551
- * react-native:
78552
- * navigator.product -> 'ReactNative'
78553
- * nativescript
78554
- * navigator.product -> 'NativeScript' or 'NS'
78555
- *
78556
- * @returns {boolean}
78557
- */
78558
- const hasStandardBrowserEnv = (
78559
- (product) => {
78560
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
78561
- })(typeof navigator !== 'undefined' && navigator.product);
78562
-
78563
- /**
78564
- * Determine if we're running in a standard browser webWorker environment
78565
- *
78566
- * Although the `isStandardBrowserEnv` method indicates that
78567
- * `allows axios to run in a web worker`, the WebWorker will still be
78568
- * filtered out due to its judgment standard
78569
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
78570
- * This leads to a problem when axios post `FormData` in webWorker
78571
- */
78572
- const hasStandardBrowserWebWorkerEnv = (() => {
78573
- return (
78574
- typeof WorkerGlobalScope !== 'undefined' &&
78575
- // eslint-disable-next-line no-undef
78576
- self instanceof WorkerGlobalScope &&
78577
- typeof self.importScripts === 'function'
78578
- );
78579
- })();
78580
-
78581
- var utils$1 = /*#__PURE__*/Object.freeze({
78582
- __proto__: null,
78583
- hasBrowserEnv: hasBrowserEnv,
78584
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
78585
- hasStandardBrowserEnv: hasStandardBrowserEnv
78586
- });
78587
-
78588
- var platform = {
78589
- ...utils$1,
78590
- ...platform$1
78591
- };
78592
-
78593
- function toURLEncodedForm(data, options) {
78594
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
78595
- visitor: function(value, key, path, helpers) {
78596
- if (platform.isNode && utils$2.isBuffer(value)) {
78597
- this.append(key, value.toString('base64'));
78598
- return false;
78599
- }
78600
-
78601
- return helpers.defaultVisitor.apply(this, arguments);
78602
- }
78603
- }, options));
78604
- }
78605
-
78606
- /**
78607
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
78608
- *
78609
- * @param {string} name - The name of the property to get.
78610
- *
78611
- * @returns An array of strings.
78612
- */
78613
- function parsePropPath(name) {
78614
- // foo[x][y][z]
78615
- // foo.x.y.z
78616
- // foo-x-y-z
78617
- // foo x y z
78618
- return utils$2.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
78619
- return match[0] === '[]' ? '' : match[1] || match[0];
78620
- });
78621
- }
78622
-
78623
- /**
78624
- * Convert an array to an object.
78625
- *
78626
- * @param {Array<any>} arr - The array to convert to an object.
78627
- *
78628
- * @returns An object with the same keys and values as the array.
78629
- */
78630
- function arrayToObject(arr) {
78631
- const obj = {};
78632
- const keys = Object.keys(arr);
78633
- let i;
78634
- const len = keys.length;
78635
- let key;
78636
- for (i = 0; i < len; i++) {
78637
- key = keys[i];
78638
- obj[key] = arr[key];
78639
- }
78640
- return obj;
78641
- }
78642
-
78643
- /**
78644
- * It takes a FormData object and returns a JavaScript object
78645
- *
78646
- * @param {string} formData The FormData object to convert to JSON.
78647
- *
78648
- * @returns {Object<string, any> | null} The converted object.
78649
- */
78650
- function formDataToJSON(formData) {
78651
- function buildPath(path, value, target, index) {
78652
- let name = path[index++];
78653
-
78654
- if (name === '__proto__') return true;
78655
-
78656
- const isNumericKey = Number.isFinite(+name);
78657
- const isLast = index >= path.length;
78658
- name = !name && utils$2.isArray(target) ? target.length : name;
78659
-
78660
- if (isLast) {
78661
- if (utils$2.hasOwnProp(target, name)) {
78662
- target[name] = [target[name], value];
78663
- } else {
78664
- target[name] = value;
78665
- }
78666
-
78667
- return !isNumericKey;
78668
- }
78669
-
78670
- if (!target[name] || !utils$2.isObject(target[name])) {
78671
- target[name] = [];
78672
- }
78673
-
78674
- const result = buildPath(path, value, target[name], index);
78675
-
78676
- if (result && utils$2.isArray(target[name])) {
78677
- target[name] = arrayToObject(target[name]);
78678
- }
78679
-
78680
- return !isNumericKey;
78681
- }
78682
-
78683
- if (utils$2.isFormData(formData) && utils$2.isFunction(formData.entries)) {
78684
- const obj = {};
78685
-
78686
- utils$2.forEachEntry(formData, (name, value) => {
78687
- buildPath(parsePropPath(name), value, obj, 0);
78688
- });
78689
-
78690
- return obj;
78691
- }
78692
-
78693
- return null;
78694
- }
78695
-
78696
- /**
78697
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
78698
- * of the input
78699
- *
78700
- * @param {any} rawValue - The value to be stringified.
78701
- * @param {Function} parser - A function that parses a string into a JavaScript object.
78702
- * @param {Function} encoder - A function that takes a value and returns a string.
78703
- *
78704
- * @returns {string} A stringified version of the rawValue.
78705
- */
78706
- function stringifySafely(rawValue, parser, encoder) {
78707
- if (utils$2.isString(rawValue)) {
78708
- try {
78709
- (parser || JSON.parse)(rawValue);
78710
- return utils$2.trim(rawValue);
78711
- } catch (e) {
78712
- if (e.name !== 'SyntaxError') {
78713
- throw e;
78714
- }
78715
- }
78716
- }
78717
-
78718
- return (encoder || JSON.stringify)(rawValue);
78719
- }
78720
-
78721
- const defaults = {
78722
-
78723
- transitional: transitionalDefaults,
78724
-
78725
- adapter: ['xhr', 'http'],
78726
-
78727
- transformRequest: [function transformRequest(data, headers) {
78728
- const contentType = headers.getContentType() || '';
78729
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
78730
- const isObjectPayload = utils$2.isObject(data);
78731
-
78732
- if (isObjectPayload && utils$2.isHTMLForm(data)) {
78733
- data = new FormData(data);
78734
- }
78735
-
78736
- const isFormData = utils$2.isFormData(data);
78737
-
78738
- if (isFormData) {
78739
- if (!hasJSONContentType) {
78740
- return data;
78741
- }
78742
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
78743
- }
78744
-
78745
- if (utils$2.isArrayBuffer(data) ||
78746
- utils$2.isBuffer(data) ||
78747
- utils$2.isStream(data) ||
78748
- utils$2.isFile(data) ||
78749
- utils$2.isBlob(data)
78750
- ) {
78751
- return data;
78752
- }
78753
- if (utils$2.isArrayBufferView(data)) {
78754
- return data.buffer;
78755
- }
78756
- if (utils$2.isURLSearchParams(data)) {
78757
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
78758
- return data.toString();
78759
- }
78760
-
78761
- let isFileList;
78762
-
78763
- if (isObjectPayload) {
78764
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
78765
- return toURLEncodedForm(data, this.formSerializer).toString();
78766
- }
78767
-
78768
- if ((isFileList = utils$2.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
78769
- const _FormData = this.env && this.env.FormData;
78770
-
78771
- return toFormData(
78772
- isFileList ? {'files[]': data} : data,
78773
- _FormData && new _FormData(),
78774
- this.formSerializer
78775
- );
78776
- }
78777
- }
78778
-
78779
- if (isObjectPayload || hasJSONContentType ) {
78780
- headers.setContentType('application/json', false);
78781
- return stringifySafely(data);
78782
- }
78783
-
78784
- return data;
78785
- }],
78786
-
78787
- transformResponse: [function transformResponse(data) {
78788
- const transitional = this.transitional || defaults.transitional;
78789
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
78790
- const JSONRequested = this.responseType === 'json';
78791
-
78792
- if (data && utils$2.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
78793
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
78794
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
78795
-
78796
- try {
78797
- return JSON.parse(data);
78798
- } catch (e) {
78799
- if (strictJSONParsing) {
78800
- if (e.name === 'SyntaxError') {
78801
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
78802
- }
78803
- throw e;
78804
- }
78805
- }
78806
- }
78807
-
78808
- return data;
78809
- }],
78810
-
78811
- /**
78812
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
78813
- * timeout is not created.
78814
- */
78815
- timeout: 0,
78816
-
78817
- xsrfCookieName: 'XSRF-TOKEN',
78818
- xsrfHeaderName: 'X-XSRF-TOKEN',
78819
-
78820
- maxContentLength: -1,
78821
- maxBodyLength: -1,
78822
-
78823
- env: {
78824
- FormData: platform.classes.FormData,
78825
- Blob: platform.classes.Blob
78826
- },
78827
-
78828
- validateStatus: function validateStatus(status) {
78829
- return status >= 200 && status < 300;
78830
- },
78831
-
78832
- headers: {
78833
- common: {
78834
- 'Accept': 'application/json, text/plain, */*',
78835
- 'Content-Type': undefined
78836
- }
78837
- }
78838
- };
78839
-
78840
- utils$2.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
78841
- defaults.headers[method] = {};
78842
- });
78843
-
78844
- var defaults$1 = defaults;
78845
-
78846
- // RawAxiosHeaders whose duplicates are ignored by node
78847
- // c.f. https://nodejs.org/api/http.html#http_message_headers
78848
- const ignoreDuplicateOf = utils$2.toObjectSet([
78849
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
78850
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
78851
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
78852
- 'referer', 'retry-after', 'user-agent'
78853
- ]);
78854
-
78855
- /**
78856
- * Parse headers into an object
78857
- *
78858
- * ```
78859
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
78860
- * Content-Type: application/json
78861
- * Connection: keep-alive
78862
- * Transfer-Encoding: chunked
78863
- * ```
78864
- *
78865
- * @param {String} rawHeaders Headers needing to be parsed
78866
- *
78867
- * @returns {Object} Headers parsed into an object
78868
- */
78869
- var parseHeaders = rawHeaders => {
78870
- const parsed = {};
78871
- let key;
78872
- let val;
78873
- let i;
78874
-
78875
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
78876
- i = line.indexOf(':');
78877
- key = line.substring(0, i).trim().toLowerCase();
78878
- val = line.substring(i + 1).trim();
78879
-
78880
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
78881
- return;
78882
- }
78883
-
78884
- if (key === 'set-cookie') {
78885
- if (parsed[key]) {
78886
- parsed[key].push(val);
78887
- } else {
78888
- parsed[key] = [val];
78889
- }
78890
- } else {
78891
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
78892
- }
78893
- });
78894
-
78895
- return parsed;
78896
- };
78897
-
78898
- const $internals = Symbol('internals');
78899
-
78900
- function normalizeHeader(header) {
78901
- return header && String(header).trim().toLowerCase();
78902
- }
78903
-
78904
- function normalizeValue(value) {
78905
- if (value === false || value == null) {
78906
- return value;
78907
- }
78908
-
78909
- return utils$2.isArray(value) ? value.map(normalizeValue) : String(value);
78910
- }
78911
-
78912
- function parseTokens(str) {
78913
- const tokens = Object.create(null);
78914
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
78915
- let match;
78916
-
78917
- while ((match = tokensRE.exec(str))) {
78918
- tokens[match[1]] = match[2];
78919
- }
78920
-
78921
- return tokens;
78922
- }
78923
-
78924
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
78925
-
78926
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
78927
- if (utils$2.isFunction(filter)) {
78928
- return filter.call(this, value, header);
78929
- }
78930
-
78931
- if (isHeaderNameFilter) {
78932
- value = header;
78933
- }
78934
-
78935
- if (!utils$2.isString(value)) return;
78936
-
78937
- if (utils$2.isString(filter)) {
78938
- return value.indexOf(filter) !== -1;
78939
- }
78940
-
78941
- if (utils$2.isRegExp(filter)) {
78942
- return filter.test(value);
78943
- }
78944
- }
78945
-
78946
- function formatHeader(header) {
78947
- return header.trim()
78948
- .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
78949
- return char.toUpperCase() + str;
78950
- });
78951
- }
78952
-
78953
- function buildAccessors(obj, header) {
78954
- const accessorName = utils$2.toCamelCase(' ' + header);
78955
-
78956
- ['get', 'set', 'has'].forEach(methodName => {
78957
- Object.defineProperty(obj, methodName + accessorName, {
78958
- value: function(arg1, arg2, arg3) {
78959
- return this[methodName].call(this, header, arg1, arg2, arg3);
78960
- },
78961
- configurable: true
78962
- });
78963
- });
78964
- }
78965
-
78966
- class AxiosHeaders {
78967
- constructor(headers) {
78968
- headers && this.set(headers);
78969
- }
78970
-
78971
- set(header, valueOrRewrite, rewrite) {
78972
- const self = this;
78973
-
78974
- function setHeader(_value, _header, _rewrite) {
78975
- const lHeader = normalizeHeader(_header);
78976
-
78977
- if (!lHeader) {
78978
- throw new Error('header name must be a non-empty string');
78979
- }
78980
-
78981
- const key = utils$2.findKey(self, lHeader);
78982
-
78983
- if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
78984
- self[key || _header] = normalizeValue(_value);
78985
- }
78986
- }
78987
-
78988
- const setHeaders = (headers, _rewrite) =>
78989
- utils$2.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
78990
-
78991
- if (utils$2.isPlainObject(header) || header instanceof this.constructor) {
78992
- setHeaders(header, valueOrRewrite);
78993
- } else if(utils$2.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
78994
- setHeaders(parseHeaders(header), valueOrRewrite);
78995
- } else {
78996
- header != null && setHeader(valueOrRewrite, header, rewrite);
78997
- }
78998
-
78999
- return this;
79000
- }
79001
-
79002
- get(header, parser) {
79003
- header = normalizeHeader(header);
79004
-
79005
- if (header) {
79006
- const key = utils$2.findKey(this, header);
79007
-
79008
- if (key) {
79009
- const value = this[key];
79010
-
79011
- if (!parser) {
79012
- return value;
79013
- }
79014
-
79015
- if (parser === true) {
79016
- return parseTokens(value);
79017
- }
79018
-
79019
- if (utils$2.isFunction(parser)) {
79020
- return parser.call(this, value, key);
79021
- }
79022
-
79023
- if (utils$2.isRegExp(parser)) {
79024
- return parser.exec(value);
79025
- }
79026
-
79027
- throw new TypeError('parser must be boolean|regexp|function');
79028
- }
79029
- }
79030
- }
79031
-
79032
- has(header, matcher) {
79033
- header = normalizeHeader(header);
79034
-
79035
- if (header) {
79036
- const key = utils$2.findKey(this, header);
79037
-
79038
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
79039
- }
79040
-
79041
- return false;
79042
- }
79043
-
79044
- delete(header, matcher) {
79045
- const self = this;
79046
- let deleted = false;
79047
-
79048
- function deleteHeader(_header) {
79049
- _header = normalizeHeader(_header);
79050
-
79051
- if (_header) {
79052
- const key = utils$2.findKey(self, _header);
79053
-
79054
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
79055
- delete self[key];
79056
-
79057
- deleted = true;
79058
- }
79059
- }
79060
- }
79061
-
79062
- if (utils$2.isArray(header)) {
79063
- header.forEach(deleteHeader);
79064
- } else {
79065
- deleteHeader(header);
79066
- }
79067
-
79068
- return deleted;
79069
- }
79070
-
79071
- clear(matcher) {
79072
- const keys = Object.keys(this);
79073
- let i = keys.length;
79074
- let deleted = false;
79075
-
79076
- while (i--) {
79077
- const key = keys[i];
79078
- if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
79079
- delete this[key];
79080
- deleted = true;
79081
- }
79082
- }
79083
-
79084
- return deleted;
79085
- }
79086
-
79087
- normalize(format) {
79088
- const self = this;
79089
- const headers = {};
79090
-
79091
- utils$2.forEach(this, (value, header) => {
79092
- const key = utils$2.findKey(headers, header);
79093
-
79094
- if (key) {
79095
- self[key] = normalizeValue(value);
79096
- delete self[header];
79097
- return;
79098
- }
79099
-
79100
- const normalized = format ? formatHeader(header) : String(header).trim();
79101
-
79102
- if (normalized !== header) {
79103
- delete self[header];
79104
- }
79105
-
79106
- self[normalized] = normalizeValue(value);
79107
-
79108
- headers[normalized] = true;
79109
- });
79110
-
79111
- return this;
79112
- }
79113
-
79114
- concat(...targets) {
79115
- return this.constructor.concat(this, ...targets);
79116
- }
79117
-
79118
- toJSON(asStrings) {
79119
- const obj = Object.create(null);
79120
-
79121
- utils$2.forEach(this, (value, header) => {
79122
- value != null && value !== false && (obj[header] = asStrings && utils$2.isArray(value) ? value.join(', ') : value);
79123
- });
79124
-
79125
- return obj;
79126
- }
79127
-
79128
- [Symbol.iterator]() {
79129
- return Object.entries(this.toJSON())[Symbol.iterator]();
79130
- }
79131
-
79132
- toString() {
79133
- return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
79134
- }
79135
-
79136
- get [Symbol.toStringTag]() {
79137
- return 'AxiosHeaders';
79138
- }
79139
-
79140
- static from(thing) {
79141
- return thing instanceof this ? thing : new this(thing);
79142
- }
79143
-
79144
- static concat(first, ...targets) {
79145
- const computed = new this(first);
79146
-
79147
- targets.forEach((target) => computed.set(target));
79148
-
79149
- return computed;
79150
- }
79151
-
79152
- static accessor(header) {
79153
- const internals = this[$internals] = (this[$internals] = {
79154
- accessors: {}
79155
- });
79156
-
79157
- const accessors = internals.accessors;
79158
- const prototype = this.prototype;
79159
-
79160
- function defineAccessor(_header) {
79161
- const lHeader = normalizeHeader(_header);
79162
-
79163
- if (!accessors[lHeader]) {
79164
- buildAccessors(prototype, _header);
79165
- accessors[lHeader] = true;
79166
- }
79167
- }
79168
-
79169
- utils$2.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
79170
-
79171
- return this;
79172
- }
79173
- }
79174
-
79175
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
79176
-
79177
- // reserved names hotfix
79178
- utils$2.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
79179
- let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
79180
- return {
79181
- get: () => value,
79182
- set(headerValue) {
79183
- this[mapped] = headerValue;
79184
- }
79185
- }
79186
- });
79187
-
79188
- utils$2.freezeMethods(AxiosHeaders);
79189
-
79190
- var AxiosHeaders$1 = AxiosHeaders;
79191
-
79192
- /**
79193
- * Transform the data for a request or a response
79194
- *
79195
- * @param {Array|Function} fns A single function or Array of functions
79196
- * @param {?Object} response The response object
79197
- *
79198
- * @returns {*} The resulting transformed data
79199
- */
79200
- function transformData(fns, response) {
79201
- const config = this || defaults$1;
79202
- const context = response || config;
79203
- const headers = AxiosHeaders$1.from(context.headers);
79204
- let data = context.data;
79205
-
79206
- utils$2.forEach(fns, function transform(fn) {
79207
- data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
79208
- });
79209
-
79210
- headers.normalize();
79211
-
79212
- return data;
79213
- }
79214
-
79215
- function isCancel(value) {
79216
- return !!(value && value.__CANCEL__);
79217
- }
79218
-
79219
- /**
79220
- * A `CanceledError` is an object that is thrown when an operation is canceled.
79221
- *
79222
- * @param {string=} message The message.
79223
- * @param {Object=} config The config.
79224
- * @param {Object=} request The request.
79225
- *
79226
- * @returns {CanceledError} The created error.
79227
- */
79228
- function CanceledError(message, config, request) {
79229
- // eslint-disable-next-line no-eq-null,eqeqeq
79230
- AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
79231
- this.name = 'CanceledError';
79232
- }
79233
-
79234
- utils$2.inherits(CanceledError, AxiosError, {
79235
- __CANCEL__: true
79236
- });
79237
-
79238
- /**
79239
- * Resolve or reject a Promise based on response status.
79240
- *
79241
- * @param {Function} resolve A function that resolves the promise.
79242
- * @param {Function} reject A function that rejects the promise.
79243
- * @param {object} response The response.
79244
- *
79245
- * @returns {object} The response.
79246
- */
79247
- function settle(resolve, reject, response) {
79248
- const validateStatus = response.config.validateStatus;
79249
- if (!response.status || !validateStatus || validateStatus(response.status)) {
79250
- resolve(response);
79251
- } else {
79252
- reject(new AxiosError(
79253
- 'Request failed with status code ' + response.status,
79254
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
79255
- response.config,
79256
- response.request,
79257
- response
79258
- ));
79259
- }
79260
- }
79261
-
79262
- var cookies = platform.hasStandardBrowserEnv ?
79263
-
79264
- // Standard browser envs support document.cookie
79265
- {
79266
- write(name, value, expires, path, domain, secure) {
79267
- const cookie = [name + '=' + encodeURIComponent(value)];
79268
-
79269
- utils$2.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
79270
-
79271
- utils$2.isString(path) && cookie.push('path=' + path);
79272
-
79273
- utils$2.isString(domain) && cookie.push('domain=' + domain);
79274
-
79275
- secure === true && cookie.push('secure');
79276
-
79277
- document.cookie = cookie.join('; ');
79278
- },
79279
-
79280
- read(name) {
79281
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
79282
- return (match ? decodeURIComponent(match[3]) : null);
79283
- },
79284
-
79285
- remove(name) {
79286
- this.write(name, '', Date.now() - 86400000);
79287
- }
79288
- }
79289
-
79290
- :
79291
-
79292
- // Non-standard browser env (web workers, react-native) lack needed support.
79293
- {
79294
- write() {},
79295
- read() {
79296
- return null;
79297
- },
79298
- remove() {}
79299
- };
79300
-
79301
- /**
79302
- * Determines whether the specified URL is absolute
79303
- *
79304
- * @param {string} url The URL to test
79305
- *
79306
- * @returns {boolean} True if the specified URL is absolute, otherwise false
79307
- */
79308
- function isAbsoluteURL(url) {
79309
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
79310
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
79311
- // by any combination of letters, digits, plus, period, or hyphen.
79312
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
79313
- }
79314
-
79315
- /**
79316
- * Creates a new URL by combining the specified URLs
79317
- *
79318
- * @param {string} baseURL The base URL
79319
- * @param {string} relativeURL The relative URL
79320
- *
79321
- * @returns {string} The combined URL
79322
- */
79323
- function combineURLs(baseURL, relativeURL) {
79324
- return relativeURL
79325
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
79326
- : baseURL;
79327
- }
79328
-
79329
- /**
79330
- * Creates a new URL by combining the baseURL with the requestedURL,
79331
- * only when the requestedURL is not already an absolute URL.
79332
- * If the requestURL is absolute, this function returns the requestedURL untouched.
79333
- *
79334
- * @param {string} baseURL The base URL
79335
- * @param {string} requestedURL Absolute or relative URL to combine
79336
- *
79337
- * @returns {string} The combined full path
79338
- */
79339
- function buildFullPath(baseURL, requestedURL) {
79340
- if (baseURL && !isAbsoluteURL(requestedURL)) {
79341
- return combineURLs(baseURL, requestedURL);
79342
- }
79343
- return requestedURL;
79344
- }
79345
-
79346
- var isURLSameOrigin = platform.hasStandardBrowserEnv ?
79347
-
79348
- // Standard browser envs have full support of the APIs needed to test
79349
- // whether the request URL is of the same origin as current location.
79350
- (function standardBrowserEnv() {
79351
- const msie = /(msie|trident)/i.test(navigator.userAgent);
79352
- const urlParsingNode = document.createElement('a');
79353
- let originURL;
79354
-
79355
- /**
79356
- * Parse a URL to discover its components
79357
- *
79358
- * @param {String} url The URL to be parsed
79359
- * @returns {Object}
79360
- */
79361
- function resolveURL(url) {
79362
- let href = url;
79363
-
79364
- if (msie) {
79365
- // IE needs attribute set twice to normalize properties
79366
- urlParsingNode.setAttribute('href', href);
79367
- href = urlParsingNode.href;
79368
- }
79369
-
79370
- urlParsingNode.setAttribute('href', href);
79371
-
79372
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
79373
- return {
79374
- href: urlParsingNode.href,
79375
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
79376
- host: urlParsingNode.host,
79377
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
79378
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
79379
- hostname: urlParsingNode.hostname,
79380
- port: urlParsingNode.port,
79381
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
79382
- urlParsingNode.pathname :
79383
- '/' + urlParsingNode.pathname
79384
- };
79385
- }
79386
-
79387
- originURL = resolveURL(window.location.href);
79388
-
79389
- /**
79390
- * Determine if a URL shares the same origin as the current location
79391
- *
79392
- * @param {String} requestURL The URL to test
79393
- * @returns {boolean} True if URL shares the same origin, otherwise false
79394
- */
79395
- return function isURLSameOrigin(requestURL) {
79396
- const parsed = (utils$2.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
79397
- return (parsed.protocol === originURL.protocol &&
79398
- parsed.host === originURL.host);
79399
- };
79400
- })() :
79401
-
79402
- // Non standard browser envs (web workers, react-native) lack needed support.
79403
- (function nonStandardBrowserEnv() {
79404
- return function isURLSameOrigin() {
79405
- return true;
79406
- };
79407
- })();
79408
-
79409
- function parseProtocol(url) {
79410
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
79411
- return match && match[1] || '';
79412
- }
79413
-
79414
- /**
79415
- * Calculate data maxRate
79416
- * @param {Number} [samplesCount= 10]
79417
- * @param {Number} [min= 1000]
79418
- * @returns {Function}
79419
- */
79420
- function speedometer(samplesCount, min) {
79421
- samplesCount = samplesCount || 10;
79422
- const bytes = new Array(samplesCount);
79423
- const timestamps = new Array(samplesCount);
79424
- let head = 0;
79425
- let tail = 0;
79426
- let firstSampleTS;
79427
-
79428
- min = min !== undefined ? min : 1000;
79429
-
79430
- return function push(chunkLength) {
79431
- const now = Date.now();
79432
-
79433
- const startedAt = timestamps[tail];
79434
-
79435
- if (!firstSampleTS) {
79436
- firstSampleTS = now;
79437
- }
79438
-
79439
- bytes[head] = chunkLength;
79440
- timestamps[head] = now;
79441
-
79442
- let i = tail;
79443
- let bytesCount = 0;
79444
-
79445
- while (i !== head) {
79446
- bytesCount += bytes[i++];
79447
- i = i % samplesCount;
79448
- }
79449
-
79450
- head = (head + 1) % samplesCount;
79451
-
79452
- if (head === tail) {
79453
- tail = (tail + 1) % samplesCount;
79454
- }
79455
-
79456
- if (now - firstSampleTS < min) {
79457
- return;
79458
- }
79459
-
79460
- const passed = startedAt && now - startedAt;
79461
-
79462
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
79463
- };
79464
- }
79465
-
79466
- function progressEventReducer(listener, isDownloadStream) {
79467
- let bytesNotified = 0;
79468
- const _speedometer = speedometer(50, 250);
79469
-
79470
- return e => {
79471
- const loaded = e.loaded;
79472
- const total = e.lengthComputable ? e.total : undefined;
79473
- const progressBytes = loaded - bytesNotified;
79474
- const rate = _speedometer(progressBytes);
79475
- const inRange = loaded <= total;
79476
-
79477
- bytesNotified = loaded;
79478
-
79479
- const data = {
79480
- loaded,
79481
- total,
79482
- progress: total ? (loaded / total) : undefined,
79483
- bytes: progressBytes,
79484
- rate: rate ? rate : undefined,
79485
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
79486
- event: e
79487
- };
79488
-
79489
- data[isDownloadStream ? 'download' : 'upload'] = true;
79490
-
79491
- listener(data);
79492
- };
79493
- }
79494
-
79495
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
79496
-
79497
- var xhrAdapter = isXHRAdapterSupported && function (config) {
79498
- return new Promise(function dispatchXhrRequest(resolve, reject) {
79499
- let requestData = config.data;
79500
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
79501
- let {responseType, withXSRFToken} = config;
79502
- let onCanceled;
79503
- function done() {
79504
- if (config.cancelToken) {
79505
- config.cancelToken.unsubscribe(onCanceled);
79506
- }
79507
-
79508
- if (config.signal) {
79509
- config.signal.removeEventListener('abort', onCanceled);
79510
- }
79511
- }
79512
-
79513
- let contentType;
79514
-
79515
- if (utils$2.isFormData(requestData)) {
79516
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
79517
- requestHeaders.setContentType(false); // Let the browser set it
79518
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
79519
- // fix semicolon duplication issue for ReactNative FormData implementation
79520
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
79521
- requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
79522
- }
79523
- }
79524
-
79525
- let request = new XMLHttpRequest();
79526
-
79527
- // HTTP basic authentication
79528
- if (config.auth) {
79529
- const username = config.auth.username || '';
79530
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
79531
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
79532
- }
79533
-
79534
- const fullPath = buildFullPath(config.baseURL, config.url);
79535
-
79536
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
79537
-
79538
- // Set the request timeout in MS
79539
- request.timeout = config.timeout;
79540
-
79541
- function onloadend() {
79542
- if (!request) {
79543
- return;
79544
- }
79545
- // Prepare the response
79546
- const responseHeaders = AxiosHeaders$1.from(
79547
- 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
79548
- );
79549
- const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
79550
- request.responseText : request.response;
79551
- const response = {
79552
- data: responseData,
79553
- status: request.status,
79554
- statusText: request.statusText,
79555
- headers: responseHeaders,
79556
- config,
79557
- request
79558
- };
79559
-
79560
- settle(function _resolve(value) {
79561
- resolve(value);
79562
- done();
79563
- }, function _reject(err) {
79564
- reject(err);
79565
- done();
79566
- }, response);
79567
-
79568
- // Clean up request
79569
- request = null;
79570
- }
79571
-
79572
- if ('onloadend' in request) {
79573
- // Use onloadend if available
79574
- request.onloadend = onloadend;
79575
- } else {
79576
- // Listen for ready state to emulate onloadend
79577
- request.onreadystatechange = function handleLoad() {
79578
- if (!request || request.readyState !== 4) {
79579
- return;
79580
- }
79581
-
79582
- // The request errored out and we didn't get a response, this will be
79583
- // handled by onerror instead
79584
- // With one exception: request that using file: protocol, most browsers
79585
- // will return status as 0 even though it's a successful request
79586
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
79587
- return;
79588
- }
79589
- // readystate handler is calling before onerror or ontimeout handlers,
79590
- // so we should call onloadend on the next 'tick'
79591
- setTimeout(onloadend);
79592
- };
79593
- }
79594
-
79595
- // Handle browser request cancellation (as opposed to a manual cancellation)
79596
- request.onabort = function handleAbort() {
79597
- if (!request) {
79598
- return;
79599
- }
79600
-
79601
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
79602
-
79603
- // Clean up request
79604
- request = null;
79605
- };
79606
-
79607
- // Handle low level network errors
79608
- request.onerror = function handleError() {
79609
- // Real errors are hidden from us by the browser
79610
- // onerror should only fire if it's a network error
79611
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
79612
-
79613
- // Clean up request
79614
- request = null;
79615
- };
79616
-
79617
- // Handle timeout
79618
- request.ontimeout = function handleTimeout() {
79619
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
79620
- const transitional = config.transitional || transitionalDefaults;
79621
- if (config.timeoutErrorMessage) {
79622
- timeoutErrorMessage = config.timeoutErrorMessage;
79623
- }
79624
- reject(new AxiosError(
79625
- timeoutErrorMessage,
79626
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
79627
- config,
79628
- request));
79629
-
79630
- // Clean up request
79631
- request = null;
79632
- };
79633
-
79634
- // Add xsrf header
79635
- // This is only done if running in a standard browser environment.
79636
- // Specifically not if we're in a web worker, or react-native.
79637
- if(platform.hasStandardBrowserEnv) {
79638
- withXSRFToken && utils$2.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
79639
-
79640
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
79641
- // Add xsrf header
79642
- const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
79643
-
79644
- if (xsrfValue) {
79645
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
79646
- }
79647
- }
79648
- }
79649
-
79650
- // Remove Content-Type if data is undefined
79651
- requestData === undefined && requestHeaders.setContentType(null);
79652
-
79653
- // Add headers to the request
79654
- if ('setRequestHeader' in request) {
79655
- utils$2.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
79656
- request.setRequestHeader(key, val);
79657
- });
79658
- }
79659
-
79660
- // Add withCredentials to request if needed
79661
- if (!utils$2.isUndefined(config.withCredentials)) {
79662
- request.withCredentials = !!config.withCredentials;
79663
- }
79664
-
79665
- // Add responseType to request if needed
79666
- if (responseType && responseType !== 'json') {
79667
- request.responseType = config.responseType;
79668
- }
79669
-
79670
- // Handle progress if needed
79671
- if (typeof config.onDownloadProgress === 'function') {
79672
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
79673
- }
79674
-
79675
- // Not all browsers support upload events
79676
- if (typeof config.onUploadProgress === 'function' && request.upload) {
79677
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
79678
- }
79679
-
79680
- if (config.cancelToken || config.signal) {
79681
- // Handle cancellation
79682
- // eslint-disable-next-line func-names
79683
- onCanceled = cancel => {
79684
- if (!request) {
79685
- return;
79686
- }
79687
- reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
79688
- request.abort();
79689
- request = null;
79690
- };
79691
-
79692
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
79693
- if (config.signal) {
79694
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
79695
- }
79696
- }
79697
-
79698
- const protocol = parseProtocol(fullPath);
79699
-
79700
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
79701
- reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
79702
- return;
79703
- }
79704
-
79705
-
79706
- // Send the request
79707
- request.send(requestData || null);
79708
- });
79709
- };
79710
-
79711
- const knownAdapters = {
79712
- http: httpAdapter,
79713
- xhr: xhrAdapter
79714
- };
79715
-
79716
- utils$2.forEach(knownAdapters, (fn, value) => {
79717
- if (fn) {
79718
- try {
79719
- Object.defineProperty(fn, 'name', {value});
79720
- } catch (e) {
79721
- // eslint-disable-next-line no-empty
79722
- }
79723
- Object.defineProperty(fn, 'adapterName', {value});
79724
- }
79725
- });
79726
-
79727
- const renderReason = (reason) => `- ${reason}`;
79728
-
79729
- const isResolvedHandle = (adapter) => utils$2.isFunction(adapter) || adapter === null || adapter === false;
79730
-
79731
- var adapters = {
79732
- getAdapter: (adapters) => {
79733
- adapters = utils$2.isArray(adapters) ? adapters : [adapters];
79734
-
79735
- const {length} = adapters;
79736
- let nameOrAdapter;
79737
- let adapter;
79738
-
79739
- const rejectedReasons = {};
79740
-
79741
- for (let i = 0; i < length; i++) {
79742
- nameOrAdapter = adapters[i];
79743
- let id;
79744
-
79745
- adapter = nameOrAdapter;
79746
-
79747
- if (!isResolvedHandle(nameOrAdapter)) {
79748
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
79749
-
79750
- if (adapter === undefined) {
79751
- throw new AxiosError(`Unknown adapter '${id}'`);
79752
- }
79753
- }
79754
-
79755
- if (adapter) {
79756
- break;
79757
- }
79758
-
79759
- rejectedReasons[id || '#' + i] = adapter;
79760
- }
79761
-
79762
- if (!adapter) {
79763
-
79764
- const reasons = Object.entries(rejectedReasons)
79765
- .map(([id, state]) => `adapter ${id} ` +
79766
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
79767
- );
79768
-
79769
- let s = length ?
79770
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
79771
- 'as no adapter specified';
79772
-
79773
- throw new AxiosError(
79774
- `There is no suitable adapter to dispatch the request ` + s,
79775
- 'ERR_NOT_SUPPORT'
79776
- );
79777
- }
79778
-
79779
- return adapter;
79780
- },
79781
- adapters: knownAdapters
79782
- };
79783
-
79784
- /**
79785
- * Throws a `CanceledError` if cancellation has been requested.
79786
- *
79787
- * @param {Object} config The config that is to be used for the request
79788
- *
79789
- * @returns {void}
79790
- */
79791
- function throwIfCancellationRequested(config) {
79792
- if (config.cancelToken) {
79793
- config.cancelToken.throwIfRequested();
79794
- }
79795
-
79796
- if (config.signal && config.signal.aborted) {
79797
- throw new CanceledError(null, config);
79798
- }
79799
- }
79800
-
79801
- /**
79802
- * Dispatch a request to the server using the configured adapter.
79803
- *
79804
- * @param {object} config The config that is to be used for the request
79805
- *
79806
- * @returns {Promise} The Promise to be fulfilled
79807
- */
79808
- function dispatchRequest(config) {
79809
- throwIfCancellationRequested(config);
79810
-
79811
- config.headers = AxiosHeaders$1.from(config.headers);
79812
-
79813
- // Transform request data
79814
- config.data = transformData.call(
79815
- config,
79816
- config.transformRequest
79817
- );
79818
-
79819
- if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
79820
- config.headers.setContentType('application/x-www-form-urlencoded', false);
79821
- }
79822
-
79823
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
79824
-
79825
- return adapter(config).then(function onAdapterResolution(response) {
79826
- throwIfCancellationRequested(config);
79827
-
79828
- // Transform response data
79829
- response.data = transformData.call(
79830
- config,
79831
- config.transformResponse,
79832
- response
79833
- );
79834
-
79835
- response.headers = AxiosHeaders$1.from(response.headers);
79836
-
79837
- return response;
79838
- }, function onAdapterRejection(reason) {
79839
- if (!isCancel(reason)) {
79840
- throwIfCancellationRequested(config);
79841
-
79842
- // Transform response data
79843
- if (reason && reason.response) {
79844
- reason.response.data = transformData.call(
79845
- config,
79846
- config.transformResponse,
79847
- reason.response
79848
- );
79849
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
79850
- }
79851
- }
79852
-
79853
- return Promise.reject(reason);
79854
- });
79855
- }
79856
-
79857
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
79858
-
79859
- /**
79860
- * Config-specific merge-function which creates a new config-object
79861
- * by merging two configuration objects together.
79862
- *
79863
- * @param {Object} config1
79864
- * @param {Object} config2
79865
- *
79866
- * @returns {Object} New object resulting from merging config2 to config1
79867
- */
79868
- function mergeConfig(config1, config2) {
79869
- // eslint-disable-next-line no-param-reassign
79870
- config2 = config2 || {};
79871
- const config = {};
79872
-
79873
- function getMergedValue(target, source, caseless) {
79874
- if (utils$2.isPlainObject(target) && utils$2.isPlainObject(source)) {
79875
- return utils$2.merge.call({caseless}, target, source);
79876
- } else if (utils$2.isPlainObject(source)) {
79877
- return utils$2.merge({}, source);
79878
- } else if (utils$2.isArray(source)) {
79879
- return source.slice();
79880
- }
79881
- return source;
79882
- }
79883
-
79884
- // eslint-disable-next-line consistent-return
79885
- function mergeDeepProperties(a, b, caseless) {
79886
- if (!utils$2.isUndefined(b)) {
79887
- return getMergedValue(a, b, caseless);
79888
- } else if (!utils$2.isUndefined(a)) {
79889
- return getMergedValue(undefined, a, caseless);
79890
- }
79891
- }
79892
-
79893
- // eslint-disable-next-line consistent-return
79894
- function valueFromConfig2(a, b) {
79895
- if (!utils$2.isUndefined(b)) {
79896
- return getMergedValue(undefined, b);
79897
- }
79898
- }
79899
-
79900
- // eslint-disable-next-line consistent-return
79901
- function defaultToConfig2(a, b) {
79902
- if (!utils$2.isUndefined(b)) {
79903
- return getMergedValue(undefined, b);
79904
- } else if (!utils$2.isUndefined(a)) {
79905
- return getMergedValue(undefined, a);
79906
- }
79907
- }
79908
-
79909
- // eslint-disable-next-line consistent-return
79910
- function mergeDirectKeys(a, b, prop) {
79911
- if (prop in config2) {
79912
- return getMergedValue(a, b);
79913
- } else if (prop in config1) {
79914
- return getMergedValue(undefined, a);
79915
- }
79916
- }
79917
-
79918
- const mergeMap = {
79919
- url: valueFromConfig2,
79920
- method: valueFromConfig2,
79921
- data: valueFromConfig2,
79922
- baseURL: defaultToConfig2,
79923
- transformRequest: defaultToConfig2,
79924
- transformResponse: defaultToConfig2,
79925
- paramsSerializer: defaultToConfig2,
79926
- timeout: defaultToConfig2,
79927
- timeoutMessage: defaultToConfig2,
79928
- withCredentials: defaultToConfig2,
79929
- withXSRFToken: defaultToConfig2,
79930
- adapter: defaultToConfig2,
79931
- responseType: defaultToConfig2,
79932
- xsrfCookieName: defaultToConfig2,
79933
- xsrfHeaderName: defaultToConfig2,
79934
- onUploadProgress: defaultToConfig2,
79935
- onDownloadProgress: defaultToConfig2,
79936
- decompress: defaultToConfig2,
79937
- maxContentLength: defaultToConfig2,
79938
- maxBodyLength: defaultToConfig2,
79939
- beforeRedirect: defaultToConfig2,
79940
- transport: defaultToConfig2,
79941
- httpAgent: defaultToConfig2,
79942
- httpsAgent: defaultToConfig2,
79943
- cancelToken: defaultToConfig2,
79944
- socketPath: defaultToConfig2,
79945
- responseEncoding: defaultToConfig2,
79946
- validateStatus: mergeDirectKeys,
79947
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
79948
- };
79949
-
79950
- utils$2.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
79951
- const merge = mergeMap[prop] || mergeDeepProperties;
79952
- const configValue = merge(config1[prop], config2[prop], prop);
79953
- (utils$2.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
79954
- });
79955
-
79956
- return config;
79957
- }
79958
-
79959
- const VERSION = "1.6.5";
79960
-
79961
- const validators$1 = {};
79962
-
79963
- // eslint-disable-next-line func-names
79964
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
79965
- validators$1[type] = function validator(thing) {
79966
- return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
79967
- };
79968
- });
79969
-
79970
- const deprecatedWarnings = {};
79971
-
79972
- /**
79973
- * Transitional option validator
79974
- *
79975
- * @param {function|boolean?} validator - set to false if the transitional option has been removed
79976
- * @param {string?} version - deprecated version / removed since version
79977
- * @param {string?} message - some message with additional info
79978
- *
79979
- * @returns {function}
79980
- */
79981
- validators$1.transitional = function transitional(validator, version, message) {
79982
- function formatMessage(opt, desc) {
79983
- return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
79984
- }
79985
-
79986
- // eslint-disable-next-line func-names
79987
- return (value, opt, opts) => {
79988
- if (validator === false) {
79989
- throw new AxiosError(
79990
- formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
79991
- AxiosError.ERR_DEPRECATED
79992
- );
79993
- }
79994
-
79995
- if (version && !deprecatedWarnings[opt]) {
79996
- deprecatedWarnings[opt] = true;
79997
- // eslint-disable-next-line no-console
79998
- console.warn(
79999
- formatMessage(
80000
- opt,
80001
- ' has been deprecated since v' + version + ' and will be removed in the near future'
80002
- )
80003
- );
80004
- }
80005
-
80006
- return validator ? validator(value, opt, opts) : true;
80007
- };
80008
- };
80009
-
80010
- /**
80011
- * Assert object's properties type
80012
- *
80013
- * @param {object} options
80014
- * @param {object} schema
80015
- * @param {boolean?} allowUnknown
80016
- *
80017
- * @returns {object}
80018
- */
80019
-
80020
- function assertOptions(options, schema, allowUnknown) {
80021
- if (typeof options !== 'object') {
80022
- throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
80023
- }
80024
- const keys = Object.keys(options);
80025
- let i = keys.length;
80026
- while (i-- > 0) {
80027
- const opt = keys[i];
80028
- const validator = schema[opt];
80029
- if (validator) {
80030
- const value = options[opt];
80031
- const result = value === undefined || validator(value, opt, options);
80032
- if (result !== true) {
80033
- throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
80034
- }
80035
- continue;
80036
- }
80037
- if (allowUnknown !== true) {
80038
- throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
80039
- }
80040
- }
80041
- }
80042
-
80043
- var validator = {
80044
- assertOptions,
80045
- validators: validators$1
80046
- };
80047
-
80048
- const validators = validator.validators;
80049
-
80050
- /**
80051
- * Create a new instance of Axios
80052
- *
80053
- * @param {Object} instanceConfig The default config for the instance
80054
- *
80055
- * @return {Axios} A new instance of Axios
80056
- */
80057
- class Axios {
80058
- constructor(instanceConfig) {
80059
- this.defaults = instanceConfig;
80060
- this.interceptors = {
80061
- request: new InterceptorManager$1(),
80062
- response: new InterceptorManager$1()
80063
- };
80064
- }
80065
-
80066
- /**
80067
- * Dispatch a request
80068
- *
80069
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
80070
- * @param {?Object} config
80071
- *
80072
- * @returns {Promise} The Promise to be fulfilled
80073
- */
80074
- request(configOrUrl, config) {
80075
- /*eslint no-param-reassign:0*/
80076
- // Allow for axios('example/url'[, config]) a la fetch API
80077
- if (typeof configOrUrl === 'string') {
80078
- config = config || {};
80079
- config.url = configOrUrl;
80080
- } else {
80081
- config = configOrUrl || {};
80082
- }
80083
-
80084
- config = mergeConfig(this.defaults, config);
80085
-
80086
- const {transitional, paramsSerializer, headers} = config;
80087
-
80088
- if (transitional !== undefined) {
80089
- validator.assertOptions(transitional, {
80090
- silentJSONParsing: validators.transitional(validators.boolean),
80091
- forcedJSONParsing: validators.transitional(validators.boolean),
80092
- clarifyTimeoutError: validators.transitional(validators.boolean)
80093
- }, false);
80094
- }
80095
-
80096
- if (paramsSerializer != null) {
80097
- if (utils$2.isFunction(paramsSerializer)) {
80098
- config.paramsSerializer = {
80099
- serialize: paramsSerializer
80100
- };
80101
- } else {
80102
- validator.assertOptions(paramsSerializer, {
80103
- encode: validators.function,
80104
- serialize: validators.function
80105
- }, true);
80106
- }
80107
- }
80108
-
80109
- // Set config.method
80110
- config.method = (config.method || this.defaults.method || 'get').toLowerCase();
80111
-
80112
- // Flatten headers
80113
- let contextHeaders = headers && utils$2.merge(
80114
- headers.common,
80115
- headers[config.method]
80116
- );
80117
-
80118
- headers && utils$2.forEach(
80119
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
80120
- (method) => {
80121
- delete headers[method];
80122
- }
80123
- );
80124
-
80125
- config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
80126
-
80127
- // filter out skipped interceptors
80128
- const requestInterceptorChain = [];
80129
- let synchronousRequestInterceptors = true;
80130
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
80131
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
80132
- return;
80133
- }
80134
-
80135
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
80136
-
80137
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
80138
- });
80139
-
80140
- const responseInterceptorChain = [];
80141
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
80142
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
80143
- });
80144
-
80145
- let promise;
80146
- let i = 0;
80147
- let len;
80148
-
80149
- if (!synchronousRequestInterceptors) {
80150
- const chain = [dispatchRequest.bind(this), undefined];
80151
- chain.unshift.apply(chain, requestInterceptorChain);
80152
- chain.push.apply(chain, responseInterceptorChain);
80153
- len = chain.length;
80154
-
80155
- promise = Promise.resolve(config);
80156
-
80157
- while (i < len) {
80158
- promise = promise.then(chain[i++], chain[i++]);
80159
- }
80160
-
80161
- return promise;
80162
- }
80163
-
80164
- len = requestInterceptorChain.length;
80165
-
80166
- let newConfig = config;
80167
-
80168
- i = 0;
80169
-
80170
- while (i < len) {
80171
- const onFulfilled = requestInterceptorChain[i++];
80172
- const onRejected = requestInterceptorChain[i++];
80173
- try {
80174
- newConfig = onFulfilled(newConfig);
80175
- } catch (error) {
80176
- onRejected.call(this, error);
80177
- break;
80178
- }
80179
- }
80180
-
80181
- try {
80182
- promise = dispatchRequest.call(this, newConfig);
80183
- } catch (error) {
80184
- return Promise.reject(error);
80185
- }
80186
-
80187
- i = 0;
80188
- len = responseInterceptorChain.length;
80189
-
80190
- while (i < len) {
80191
- promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
80192
- }
80193
-
80194
- return promise;
80195
- }
80196
-
80197
- getUri(config) {
80198
- config = mergeConfig(this.defaults, config);
80199
- const fullPath = buildFullPath(config.baseURL, config.url);
80200
- return buildURL(fullPath, config.params, config.paramsSerializer);
80201
- }
80202
- }
80203
-
80204
- // Provide aliases for supported request methods
80205
- utils$2.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
80206
- /*eslint func-names:0*/
80207
- Axios.prototype[method] = function(url, config) {
80208
- return this.request(mergeConfig(config || {}, {
80209
- method,
80210
- url,
80211
- data: (config || {}).data
80212
- }));
80213
- };
80214
- });
80215
-
80216
- utils$2.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
80217
- /*eslint func-names:0*/
80218
-
80219
- function generateHTTPMethod(isForm) {
80220
- return function httpMethod(url, data, config) {
80221
- return this.request(mergeConfig(config || {}, {
80222
- method,
80223
- headers: isForm ? {
80224
- 'Content-Type': 'multipart/form-data'
80225
- } : {},
80226
- url,
80227
- data
80228
- }));
80229
- };
80230
- }
80231
-
80232
- Axios.prototype[method] = generateHTTPMethod();
80233
-
80234
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
80235
- });
80236
-
80237
- var Axios$1 = Axios;
80238
-
80239
- /**
80240
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
80241
- *
80242
- * @param {Function} executor The executor function.
80243
- *
80244
- * @returns {CancelToken}
80245
- */
80246
- class CancelToken {
80247
- constructor(executor) {
80248
- if (typeof executor !== 'function') {
80249
- throw new TypeError('executor must be a function.');
80250
- }
80251
-
80252
- let resolvePromise;
80253
-
80254
- this.promise = new Promise(function promiseExecutor(resolve) {
80255
- resolvePromise = resolve;
80256
- });
80257
-
80258
- const token = this;
80259
-
80260
- // eslint-disable-next-line func-names
80261
- this.promise.then(cancel => {
80262
- if (!token._listeners) return;
80263
-
80264
- let i = token._listeners.length;
80265
-
80266
- while (i-- > 0) {
80267
- token._listeners[i](cancel);
80268
- }
80269
- token._listeners = null;
80270
- });
80271
-
80272
- // eslint-disable-next-line func-names
80273
- this.promise.then = onfulfilled => {
80274
- let _resolve;
80275
- // eslint-disable-next-line func-names
80276
- const promise = new Promise(resolve => {
80277
- token.subscribe(resolve);
80278
- _resolve = resolve;
80279
- }).then(onfulfilled);
80280
-
80281
- promise.cancel = function reject() {
80282
- token.unsubscribe(_resolve);
80283
- };
80284
-
80285
- return promise;
80286
- };
80287
-
80288
- executor(function cancel(message, config, request) {
80289
- if (token.reason) {
80290
- // Cancellation has already been requested
80291
- return;
80292
- }
80293
-
80294
- token.reason = new CanceledError(message, config, request);
80295
- resolvePromise(token.reason);
80296
- });
80297
- }
80298
-
80299
- /**
80300
- * Throws a `CanceledError` if cancellation has been requested.
80301
- */
80302
- throwIfRequested() {
80303
- if (this.reason) {
80304
- throw this.reason;
80305
- }
80306
- }
80307
-
80308
- /**
80309
- * Subscribe to the cancel signal
80310
- */
80311
-
80312
- subscribe(listener) {
80313
- if (this.reason) {
80314
- listener(this.reason);
80315
- return;
80316
- }
80317
-
80318
- if (this._listeners) {
80319
- this._listeners.push(listener);
80320
- } else {
80321
- this._listeners = [listener];
80322
- }
80323
- }
80324
-
80325
- /**
80326
- * Unsubscribe from the cancel signal
80327
- */
80328
-
80329
- unsubscribe(listener) {
80330
- if (!this._listeners) {
80331
- return;
80332
- }
80333
- const index = this._listeners.indexOf(listener);
80334
- if (index !== -1) {
80335
- this._listeners.splice(index, 1);
80336
- }
80337
- }
80338
-
80339
- /**
80340
- * Returns an object that contains a new `CancelToken` and a function that, when called,
80341
- * cancels the `CancelToken`.
80342
- */
80343
- static source() {
80344
- let cancel;
80345
- const token = new CancelToken(function executor(c) {
80346
- cancel = c;
80347
- });
80348
- return {
80349
- token,
80350
- cancel
80351
- };
80352
- }
80353
- }
80354
-
80355
- var CancelToken$1 = CancelToken;
80356
-
80357
- /**
80358
- * Syntactic sugar for invoking a function and expanding an array for arguments.
80359
- *
80360
- * Common use case would be to use `Function.prototype.apply`.
80361
- *
80362
- * ```js
80363
- * function f(x, y, z) {}
80364
- * var args = [1, 2, 3];
80365
- * f.apply(null, args);
80366
- * ```
80367
- *
80368
- * With `spread` this example can be re-written.
80369
- *
80370
- * ```js
80371
- * spread(function(x, y, z) {})([1, 2, 3]);
80372
- * ```
80373
- *
80374
- * @param {Function} callback
80375
- *
80376
- * @returns {Function}
80377
- */
80378
- function spread(callback) {
80379
- return function wrap(arr) {
80380
- return callback.apply(null, arr);
80381
- };
80382
- }
80383
-
80384
- /**
80385
- * Determines whether the payload is an error thrown by Axios
80386
- *
80387
- * @param {*} payload The value to test
80388
- *
80389
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
80390
- */
80391
- function isAxiosError(payload) {
80392
- return utils$2.isObject(payload) && (payload.isAxiosError === true);
80393
- }
80394
-
80395
- const HttpStatusCode = {
80396
- Continue: 100,
80397
- SwitchingProtocols: 101,
80398
- Processing: 102,
80399
- EarlyHints: 103,
80400
- Ok: 200,
80401
- Created: 201,
80402
- Accepted: 202,
80403
- NonAuthoritativeInformation: 203,
80404
- NoContent: 204,
80405
- ResetContent: 205,
80406
- PartialContent: 206,
80407
- MultiStatus: 207,
80408
- AlreadyReported: 208,
80409
- ImUsed: 226,
80410
- MultipleChoices: 300,
80411
- MovedPermanently: 301,
80412
- Found: 302,
80413
- SeeOther: 303,
80414
- NotModified: 304,
80415
- UseProxy: 305,
80416
- Unused: 306,
80417
- TemporaryRedirect: 307,
80418
- PermanentRedirect: 308,
80419
- BadRequest: 400,
80420
- Unauthorized: 401,
80421
- PaymentRequired: 402,
80422
- Forbidden: 403,
80423
- NotFound: 404,
80424
- MethodNotAllowed: 405,
80425
- NotAcceptable: 406,
80426
- ProxyAuthenticationRequired: 407,
80427
- RequestTimeout: 408,
80428
- Conflict: 409,
80429
- Gone: 410,
80430
- LengthRequired: 411,
80431
- PreconditionFailed: 412,
80432
- PayloadTooLarge: 413,
80433
- UriTooLong: 414,
80434
- UnsupportedMediaType: 415,
80435
- RangeNotSatisfiable: 416,
80436
- ExpectationFailed: 417,
80437
- ImATeapot: 418,
80438
- MisdirectedRequest: 421,
80439
- UnprocessableEntity: 422,
80440
- Locked: 423,
80441
- FailedDependency: 424,
80442
- TooEarly: 425,
80443
- UpgradeRequired: 426,
80444
- PreconditionRequired: 428,
80445
- TooManyRequests: 429,
80446
- RequestHeaderFieldsTooLarge: 431,
80447
- UnavailableForLegalReasons: 451,
80448
- InternalServerError: 500,
80449
- NotImplemented: 501,
80450
- BadGateway: 502,
80451
- ServiceUnavailable: 503,
80452
- GatewayTimeout: 504,
80453
- HttpVersionNotSupported: 505,
80454
- VariantAlsoNegotiates: 506,
80455
- InsufficientStorage: 507,
80456
- LoopDetected: 508,
80457
- NotExtended: 510,
80458
- NetworkAuthenticationRequired: 511,
80459
- };
80460
-
80461
- Object.entries(HttpStatusCode).forEach(([key, value]) => {
80462
- HttpStatusCode[value] = key;
80463
- });
80464
-
80465
- var HttpStatusCode$1 = HttpStatusCode;
80466
-
80467
- /**
80468
- * Create an instance of Axios
80469
- *
80470
- * @param {Object} defaultConfig The default config for the instance
80471
- *
80472
- * @returns {Axios} A new instance of Axios
80473
- */
80474
- function createInstance(defaultConfig) {
80475
- const context = new Axios$1(defaultConfig);
80476
- const instance = bind(Axios$1.prototype.request, context);
80477
-
80478
- // Copy axios.prototype to instance
80479
- utils$2.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
80480
-
80481
- // Copy context to instance
80482
- utils$2.extend(instance, context, null, {allOwnKeys: true});
80483
-
80484
- // Factory for creating new instances
80485
- instance.create = function create(instanceConfig) {
80486
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
80487
- };
80488
-
80489
- return instance;
80490
- }
80491
-
80492
- // Create the default instance to be exported
80493
- const axios = createInstance(defaults$1);
80494
-
80495
- // Expose Axios class to allow class inheritance
80496
- axios.Axios = Axios$1;
80497
-
80498
- // Expose Cancel & CancelToken
80499
- axios.CanceledError = CanceledError;
80500
- axios.CancelToken = CancelToken$1;
80501
- axios.isCancel = isCancel;
80502
- axios.VERSION = VERSION;
80503
- axios.toFormData = toFormData;
80504
-
80505
- // Expose AxiosError class
80506
- axios.AxiosError = AxiosError;
80507
-
80508
- // alias for CanceledError for backward compatibility
80509
- axios.Cancel = axios.CanceledError;
80510
-
80511
- // Expose all/spread
80512
- axios.all = function all(promises) {
80513
- return Promise.all(promises);
80514
- };
80515
-
80516
- axios.spread = spread;
80517
-
80518
- // Expose isAxiosError
80519
- axios.isAxiosError = isAxiosError;
80520
-
80521
- // Expose mergeConfig
80522
- axios.mergeConfig = mergeConfig;
80523
-
80524
- axios.AxiosHeaders = AxiosHeaders$1;
80525
-
80526
- axios.formToJSON = thing => formDataToJSON(utils$2.isHTMLForm(thing) ? new FormData(thing) : thing);
80527
-
80528
- axios.getAdapter = adapters.getAdapter;
80529
-
80530
- axios.HttpStatusCode = HttpStatusCode$1;
80531
-
80532
- axios.default = axios;
80533
-
80534
- // this module should only have a default export
80535
- var axios$1 = axios;
80536
-
80537
77302
  class HttpClient {
80538
- stringToVerb(m) {
80539
- if (m.toLowerCase() === 'get')
80540
- return 'GET';
80541
- else if (m.toLowerCase() === 'post')
80542
- return 'POST';
80543
- else if (m.toLowerCase() === 'patch')
80544
- return 'PATCH';
80545
- else if (m.toLowerCase() === 'put')
80546
- return 'PUT';
80547
- else if (m.toLowerCase() === 'options')
80548
- return 'OPTIONS';
80549
- else if (m.toLowerCase() === 'delete')
80550
- return 'DELETE';
80551
- else
80552
- return 'GET';
80553
- }
80554
77303
  request(verb, url, headers, body, callback) {
80555
77304
  return __awaiter(this, void 0, void 0, function* () {
80556
- const method = this.stringToVerb(verb);
80557
- const data = body !== null && body.length > 0 ? JSON.parse(body) : '';
80558
- const axiosReq = {
80559
- url,
80560
- method,
80561
- headers,
80562
- data,
80563
- // Pipe all successful HTTP response through to core
80564
- validateStatus: () => true
77305
+ const options = {
77306
+ method: verb.toUpperCase(),
77307
+ headers: Object.entries(headers).reduce((acc, [key, value]) => {
77308
+ acc.append(key, value.toString());
77309
+ return acc;
77310
+ }, new Headers()),
77311
+ body: body == '' || body == null ? undefined : body
80565
77312
  };
80566
77313
  try {
80567
- const response = yield axios$1(axiosReq);
80568
- const coreResponse = new clientsdkClientcore_jsExports.vonage.HttpClientResponseJS(response.status, JSON.stringify(response.data));
77314
+ const response = yield fetch(url, options);
77315
+ const coreResponse = new clientsdkClientcore_jsExports.vonage.HttpClientResponseJS(response.status, yield response.text());
77316
+ // no need to check for status ok, as we pipe all responses through to core
80569
77317
  callback(null, coreResponse);
80570
77318
  }
80571
77319
  catch (error) {
80572
- const httpClientError = new clientsdkClientcore_jsExports.vonage.HttpClientErrorJS(error instanceof Error ? error.message : 'Unknown Error', error instanceof Error ? error : null);
77320
+ if (error instanceof Error) {
77321
+ const httpClientError = new clientsdkClientcore_jsExports.vonage.HttpClientErrorJS(error.message, error);
77322
+ callback(httpClientError, null);
77323
+ return;
77324
+ }
77325
+ const httpClientError = new clientsdkClientcore_jsExports.vonage.HttpClientErrorJS('Unknown Error', null);
80573
77326
  callback(httpClientError, null);
80574
77327
  }
80575
77328
  });