bibot 1.0.14 → 1.0.19

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -2,11 +2,6 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
2
2
 
3
3
  var React = require('react');
4
4
  var React__default = _interopDefault(React);
5
- var core = require('@mantine/core');
6
- var iconsMaterial = require('@mui/icons-material');
7
- var ChatIcon = _interopDefault(require('@mui/icons-material/Chat'));
8
- var antd = require('antd');
9
- var axios = _interopDefault(require('axios'));
10
5
 
11
6
  function _extends() {
12
7
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -23,6 +18,3247 @@ function _extends() {
23
18
  return _extends.apply(this, arguments);
24
19
  }
25
20
 
21
+ function bind(fn, thisArg) {
22
+ return function wrap() {
23
+ return fn.apply(thisArg, arguments);
24
+ };
25
+ }
26
+
27
+ // utils is a library of generic helper functions non-specific to axios
28
+
29
+ const {toString} = Object.prototype;
30
+ const {getPrototypeOf} = Object;
31
+
32
+ const kindOf = (cache => thing => {
33
+ const str = toString.call(thing);
34
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
35
+ })(Object.create(null));
36
+
37
+ const kindOfTest = (type) => {
38
+ type = type.toLowerCase();
39
+ return (thing) => kindOf(thing) === type
40
+ };
41
+
42
+ const typeOfTest = type => thing => typeof thing === type;
43
+
44
+ /**
45
+ * Determine if a value is an Array
46
+ *
47
+ * @param {Object} val The value to test
48
+ *
49
+ * @returns {boolean} True if value is an Array, otherwise false
50
+ */
51
+ const {isArray} = Array;
52
+
53
+ /**
54
+ * Determine if a value is undefined
55
+ *
56
+ * @param {*} val The value to test
57
+ *
58
+ * @returns {boolean} True if the value is undefined, otherwise false
59
+ */
60
+ const isUndefined = typeOfTest('undefined');
61
+
62
+ /**
63
+ * Determine if a value is a Buffer
64
+ *
65
+ * @param {*} val The value to test
66
+ *
67
+ * @returns {boolean} True if value is a Buffer, otherwise false
68
+ */
69
+ function isBuffer(val) {
70
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
71
+ && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
72
+ }
73
+
74
+ /**
75
+ * Determine if a value is an ArrayBuffer
76
+ *
77
+ * @param {*} val The value to test
78
+ *
79
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
80
+ */
81
+ const isArrayBuffer = kindOfTest('ArrayBuffer');
82
+
83
+
84
+ /**
85
+ * Determine if a value is a view on an ArrayBuffer
86
+ *
87
+ * @param {*} val The value to test
88
+ *
89
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
90
+ */
91
+ function isArrayBufferView(val) {
92
+ let result;
93
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
94
+ result = ArrayBuffer.isView(val);
95
+ } else {
96
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
97
+ }
98
+ return result;
99
+ }
100
+
101
+ /**
102
+ * Determine if a value is a String
103
+ *
104
+ * @param {*} val The value to test
105
+ *
106
+ * @returns {boolean} True if value is a String, otherwise false
107
+ */
108
+ const isString = typeOfTest('string');
109
+
110
+ /**
111
+ * Determine if a value is a Function
112
+ *
113
+ * @param {*} val The value to test
114
+ * @returns {boolean} True if value is a Function, otherwise false
115
+ */
116
+ const isFunction = typeOfTest('function');
117
+
118
+ /**
119
+ * Determine if a value is a Number
120
+ *
121
+ * @param {*} val The value to test
122
+ *
123
+ * @returns {boolean} True if value is a Number, otherwise false
124
+ */
125
+ const isNumber = typeOfTest('number');
126
+
127
+ /**
128
+ * Determine if a value is an Object
129
+ *
130
+ * @param {*} thing The value to test
131
+ *
132
+ * @returns {boolean} True if value is an Object, otherwise false
133
+ */
134
+ const isObject = (thing) => thing !== null && typeof thing === 'object';
135
+
136
+ /**
137
+ * Determine if a value is a Boolean
138
+ *
139
+ * @param {*} thing The value to test
140
+ * @returns {boolean} True if value is a Boolean, otherwise false
141
+ */
142
+ const isBoolean = thing => thing === true || thing === false;
143
+
144
+ /**
145
+ * Determine if a value is a plain Object
146
+ *
147
+ * @param {*} val The value to test
148
+ *
149
+ * @returns {boolean} True if value is a plain Object, otherwise false
150
+ */
151
+ const isPlainObject = (val) => {
152
+ if (kindOf(val) !== 'object') {
153
+ return false;
154
+ }
155
+
156
+ const prototype = getPrototypeOf(val);
157
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
158
+ };
159
+
160
+ /**
161
+ * Determine if a value is a Date
162
+ *
163
+ * @param {*} val The value to test
164
+ *
165
+ * @returns {boolean} True if value is a Date, otherwise false
166
+ */
167
+ const isDate = kindOfTest('Date');
168
+
169
+ /**
170
+ * Determine if a value is a File
171
+ *
172
+ * @param {*} val The value to test
173
+ *
174
+ * @returns {boolean} True if value is a File, otherwise false
175
+ */
176
+ const isFile = kindOfTest('File');
177
+
178
+ /**
179
+ * Determine if a value is a Blob
180
+ *
181
+ * @param {*} val The value to test
182
+ *
183
+ * @returns {boolean} True if value is a Blob, otherwise false
184
+ */
185
+ const isBlob = kindOfTest('Blob');
186
+
187
+ /**
188
+ * Determine if a value is a FileList
189
+ *
190
+ * @param {*} val The value to test
191
+ *
192
+ * @returns {boolean} True if value is a File, otherwise false
193
+ */
194
+ const isFileList = kindOfTest('FileList');
195
+
196
+ /**
197
+ * Determine if a value is a Stream
198
+ *
199
+ * @param {*} val The value to test
200
+ *
201
+ * @returns {boolean} True if value is a Stream, otherwise false
202
+ */
203
+ const isStream = (val) => isObject(val) && isFunction(val.pipe);
204
+
205
+ /**
206
+ * Determine if a value is a FormData
207
+ *
208
+ * @param {*} thing The value to test
209
+ *
210
+ * @returns {boolean} True if value is an FormData, otherwise false
211
+ */
212
+ const isFormData = (thing) => {
213
+ let kind;
214
+ return thing && (
215
+ (typeof FormData === 'function' && thing instanceof FormData) || (
216
+ isFunction(thing.append) && (
217
+ (kind = kindOf(thing)) === 'formdata' ||
218
+ // detect form-data instance
219
+ (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
220
+ )
221
+ )
222
+ )
223
+ };
224
+
225
+ /**
226
+ * Determine if a value is a URLSearchParams object
227
+ *
228
+ * @param {*} val The value to test
229
+ *
230
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
231
+ */
232
+ const isURLSearchParams = kindOfTest('URLSearchParams');
233
+
234
+ /**
235
+ * Trim excess whitespace off the beginning and end of a string
236
+ *
237
+ * @param {String} str The String to trim
238
+ *
239
+ * @returns {String} The String freed of excess whitespace
240
+ */
241
+ const trim = (str) => str.trim ?
242
+ str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
243
+
244
+ /**
245
+ * Iterate over an Array or an Object invoking a function for each item.
246
+ *
247
+ * If `obj` is an Array callback will be called passing
248
+ * the value, index, and complete array for each item.
249
+ *
250
+ * If 'obj' is an Object callback will be called passing
251
+ * the value, key, and complete object for each property.
252
+ *
253
+ * @param {Object|Array} obj The object to iterate
254
+ * @param {Function} fn The callback to invoke for each item
255
+ *
256
+ * @param {Boolean} [allOwnKeys = false]
257
+ * @returns {any}
258
+ */
259
+ function forEach(obj, fn, {allOwnKeys = false} = {}) {
260
+ // Don't bother if no value provided
261
+ if (obj === null || typeof obj === 'undefined') {
262
+ return;
263
+ }
264
+
265
+ let i;
266
+ let l;
267
+
268
+ // Force an array if not already something iterable
269
+ if (typeof obj !== 'object') {
270
+ /*eslint no-param-reassign:0*/
271
+ obj = [obj];
272
+ }
273
+
274
+ if (isArray(obj)) {
275
+ // Iterate over array values
276
+ for (i = 0, l = obj.length; i < l; i++) {
277
+ fn.call(null, obj[i], i, obj);
278
+ }
279
+ } else {
280
+ // Iterate over object keys
281
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
282
+ const len = keys.length;
283
+ let key;
284
+
285
+ for (i = 0; i < len; i++) {
286
+ key = keys[i];
287
+ fn.call(null, obj[key], key, obj);
288
+ }
289
+ }
290
+ }
291
+
292
+ function findKey(obj, key) {
293
+ key = key.toLowerCase();
294
+ const keys = Object.keys(obj);
295
+ let i = keys.length;
296
+ let _key;
297
+ while (i-- > 0) {
298
+ _key = keys[i];
299
+ if (key === _key.toLowerCase()) {
300
+ return _key;
301
+ }
302
+ }
303
+ return null;
304
+ }
305
+
306
+ const _global = (() => {
307
+ /*eslint no-undef:0*/
308
+ if (typeof globalThis !== "undefined") return globalThis;
309
+ return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
310
+ })();
311
+
312
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
313
+
314
+ /**
315
+ * Accepts varargs expecting each argument to be an object, then
316
+ * immutably merges the properties of each object and returns result.
317
+ *
318
+ * When multiple objects contain the same key the later object in
319
+ * the arguments list will take precedence.
320
+ *
321
+ * Example:
322
+ *
323
+ * ```js
324
+ * var result = merge({foo: 123}, {foo: 456});
325
+ * console.log(result.foo); // outputs 456
326
+ * ```
327
+ *
328
+ * @param {Object} obj1 Object to merge
329
+ *
330
+ * @returns {Object} Result of all merge properties
331
+ */
332
+ function merge(/* obj1, obj2, obj3, ... */) {
333
+ const {caseless} = isContextDefined(this) && this || {};
334
+ const result = {};
335
+ const assignValue = (val, key) => {
336
+ const targetKey = caseless && findKey(result, key) || key;
337
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
338
+ result[targetKey] = merge(result[targetKey], val);
339
+ } else if (isPlainObject(val)) {
340
+ result[targetKey] = merge({}, val);
341
+ } else if (isArray(val)) {
342
+ result[targetKey] = val.slice();
343
+ } else {
344
+ result[targetKey] = val;
345
+ }
346
+ };
347
+
348
+ for (let i = 0, l = arguments.length; i < l; i++) {
349
+ arguments[i] && forEach(arguments[i], assignValue);
350
+ }
351
+ return result;
352
+ }
353
+
354
+ /**
355
+ * Extends object a by mutably adding to it the properties of object b.
356
+ *
357
+ * @param {Object} a The object to be extended
358
+ * @param {Object} b The object to copy properties from
359
+ * @param {Object} thisArg The object to bind function to
360
+ *
361
+ * @param {Boolean} [allOwnKeys]
362
+ * @returns {Object} The resulting value of object a
363
+ */
364
+ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
365
+ forEach(b, (val, key) => {
366
+ if (thisArg && isFunction(val)) {
367
+ a[key] = bind(val, thisArg);
368
+ } else {
369
+ a[key] = val;
370
+ }
371
+ }, {allOwnKeys});
372
+ return a;
373
+ };
374
+
375
+ /**
376
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
377
+ *
378
+ * @param {string} content with BOM
379
+ *
380
+ * @returns {string} content value without BOM
381
+ */
382
+ const stripBOM = (content) => {
383
+ if (content.charCodeAt(0) === 0xFEFF) {
384
+ content = content.slice(1);
385
+ }
386
+ return content;
387
+ };
388
+
389
+ /**
390
+ * Inherit the prototype methods from one constructor into another
391
+ * @param {function} constructor
392
+ * @param {function} superConstructor
393
+ * @param {object} [props]
394
+ * @param {object} [descriptors]
395
+ *
396
+ * @returns {void}
397
+ */
398
+ const inherits = (constructor, superConstructor, props, descriptors) => {
399
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
400
+ constructor.prototype.constructor = constructor;
401
+ Object.defineProperty(constructor, 'super', {
402
+ value: superConstructor.prototype
403
+ });
404
+ props && Object.assign(constructor.prototype, props);
405
+ };
406
+
407
+ /**
408
+ * Resolve object with deep prototype chain to a flat object
409
+ * @param {Object} sourceObj source object
410
+ * @param {Object} [destObj]
411
+ * @param {Function|Boolean} [filter]
412
+ * @param {Function} [propFilter]
413
+ *
414
+ * @returns {Object}
415
+ */
416
+ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
417
+ let props;
418
+ let i;
419
+ let prop;
420
+ const merged = {};
421
+
422
+ destObj = destObj || {};
423
+ // eslint-disable-next-line no-eq-null,eqeqeq
424
+ if (sourceObj == null) return destObj;
425
+
426
+ do {
427
+ props = Object.getOwnPropertyNames(sourceObj);
428
+ i = props.length;
429
+ while (i-- > 0) {
430
+ prop = props[i];
431
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
432
+ destObj[prop] = sourceObj[prop];
433
+ merged[prop] = true;
434
+ }
435
+ }
436
+ sourceObj = filter !== false && getPrototypeOf(sourceObj);
437
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
438
+
439
+ return destObj;
440
+ };
441
+
442
+ /**
443
+ * Determines whether a string ends with the characters of a specified string
444
+ *
445
+ * @param {String} str
446
+ * @param {String} searchString
447
+ * @param {Number} [position= 0]
448
+ *
449
+ * @returns {boolean}
450
+ */
451
+ const endsWith = (str, searchString, position) => {
452
+ str = String(str);
453
+ if (position === undefined || position > str.length) {
454
+ position = str.length;
455
+ }
456
+ position -= searchString.length;
457
+ const lastIndex = str.indexOf(searchString, position);
458
+ return lastIndex !== -1 && lastIndex === position;
459
+ };
460
+
461
+
462
+ /**
463
+ * Returns new array from array like object or null if failed
464
+ *
465
+ * @param {*} [thing]
466
+ *
467
+ * @returns {?Array}
468
+ */
469
+ const toArray = (thing) => {
470
+ if (!thing) return null;
471
+ if (isArray(thing)) return thing;
472
+ let i = thing.length;
473
+ if (!isNumber(i)) return null;
474
+ const arr = new Array(i);
475
+ while (i-- > 0) {
476
+ arr[i] = thing[i];
477
+ }
478
+ return arr;
479
+ };
480
+
481
+ /**
482
+ * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
483
+ * thing passed in is an instance of Uint8Array
484
+ *
485
+ * @param {TypedArray}
486
+ *
487
+ * @returns {Array}
488
+ */
489
+ // eslint-disable-next-line func-names
490
+ const isTypedArray = (TypedArray => {
491
+ // eslint-disable-next-line func-names
492
+ return thing => {
493
+ return TypedArray && thing instanceof TypedArray;
494
+ };
495
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
496
+
497
+ /**
498
+ * For each entry in the object, call the function with the key and value.
499
+ *
500
+ * @param {Object<any, any>} obj - The object to iterate over.
501
+ * @param {Function} fn - The function to call for each entry.
502
+ *
503
+ * @returns {void}
504
+ */
505
+ const forEachEntry = (obj, fn) => {
506
+ const generator = obj && obj[Symbol.iterator];
507
+
508
+ const iterator = generator.call(obj);
509
+
510
+ let result;
511
+
512
+ while ((result = iterator.next()) && !result.done) {
513
+ const pair = result.value;
514
+ fn.call(obj, pair[0], pair[1]);
515
+ }
516
+ };
517
+
518
+ /**
519
+ * It takes a regular expression and a string, and returns an array of all the matches
520
+ *
521
+ * @param {string} regExp - The regular expression to match against.
522
+ * @param {string} str - The string to search.
523
+ *
524
+ * @returns {Array<boolean>}
525
+ */
526
+ const matchAll = (regExp, str) => {
527
+ let matches;
528
+ const arr = [];
529
+
530
+ while ((matches = regExp.exec(str)) !== null) {
531
+ arr.push(matches);
532
+ }
533
+
534
+ return arr;
535
+ };
536
+
537
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
538
+ const isHTMLForm = kindOfTest('HTMLFormElement');
539
+
540
+ const toCamelCase = str => {
541
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
542
+ function replacer(m, p1, p2) {
543
+ return p1.toUpperCase() + p2;
544
+ }
545
+ );
546
+ };
547
+
548
+ /* Creating a function that will check if an object has a property. */
549
+ const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
550
+
551
+ /**
552
+ * Determine if a value is a RegExp object
553
+ *
554
+ * @param {*} val The value to test
555
+ *
556
+ * @returns {boolean} True if value is a RegExp object, otherwise false
557
+ */
558
+ const isRegExp = kindOfTest('RegExp');
559
+
560
+ const reduceDescriptors = (obj, reducer) => {
561
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
562
+ const reducedDescriptors = {};
563
+
564
+ forEach(descriptors, (descriptor, name) => {
565
+ let ret;
566
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
567
+ reducedDescriptors[name] = ret || descriptor;
568
+ }
569
+ });
570
+
571
+ Object.defineProperties(obj, reducedDescriptors);
572
+ };
573
+
574
+ /**
575
+ * Makes all methods read-only
576
+ * @param {Object} obj
577
+ */
578
+
579
+ const freezeMethods = (obj) => {
580
+ reduceDescriptors(obj, (descriptor, name) => {
581
+ // skip restricted props in strict mode
582
+ if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
583
+ return false;
584
+ }
585
+
586
+ const value = obj[name];
587
+
588
+ if (!isFunction(value)) return;
589
+
590
+ descriptor.enumerable = false;
591
+
592
+ if ('writable' in descriptor) {
593
+ descriptor.writable = false;
594
+ return;
595
+ }
596
+
597
+ if (!descriptor.set) {
598
+ descriptor.set = () => {
599
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
600
+ };
601
+ }
602
+ });
603
+ };
604
+
605
+ const toObjectSet = (arrayOrString, delimiter) => {
606
+ const obj = {};
607
+
608
+ const define = (arr) => {
609
+ arr.forEach(value => {
610
+ obj[value] = true;
611
+ });
612
+ };
613
+
614
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
615
+
616
+ return obj;
617
+ };
618
+
619
+ const noop = () => {};
620
+
621
+ const toFiniteNumber = (value, defaultValue) => {
622
+ value = +value;
623
+ return Number.isFinite(value) ? value : defaultValue;
624
+ };
625
+
626
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
627
+
628
+ const DIGIT = '0123456789';
629
+
630
+ const ALPHABET = {
631
+ DIGIT,
632
+ ALPHA,
633
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
634
+ };
635
+
636
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
637
+ let str = '';
638
+ const {length} = alphabet;
639
+ while (size--) {
640
+ str += alphabet[Math.random() * length|0];
641
+ }
642
+
643
+ return str;
644
+ };
645
+
646
+ /**
647
+ * If the thing is a FormData object, return true, otherwise return false.
648
+ *
649
+ * @param {unknown} thing - The thing to check.
650
+ *
651
+ * @returns {boolean}
652
+ */
653
+ function isSpecCompliantForm(thing) {
654
+ return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
655
+ }
656
+
657
+ const toJSONObject = (obj) => {
658
+ const stack = new Array(10);
659
+
660
+ const visit = (source, i) => {
661
+
662
+ if (isObject(source)) {
663
+ if (stack.indexOf(source) >= 0) {
664
+ return;
665
+ }
666
+
667
+ if(!('toJSON' in source)) {
668
+ stack[i] = source;
669
+ const target = isArray(source) ? [] : {};
670
+
671
+ forEach(source, (value, key) => {
672
+ const reducedValue = visit(value, i + 1);
673
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
674
+ });
675
+
676
+ stack[i] = undefined;
677
+
678
+ return target;
679
+ }
680
+ }
681
+
682
+ return source;
683
+ };
684
+
685
+ return visit(obj, 0);
686
+ };
687
+
688
+ const isAsyncFn = kindOfTest('AsyncFunction');
689
+
690
+ const isThenable = (thing) =>
691
+ thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
692
+
693
+ var utils = {
694
+ isArray,
695
+ isArrayBuffer,
696
+ isBuffer,
697
+ isFormData,
698
+ isArrayBufferView,
699
+ isString,
700
+ isNumber,
701
+ isBoolean,
702
+ isObject,
703
+ isPlainObject,
704
+ isUndefined,
705
+ isDate,
706
+ isFile,
707
+ isBlob,
708
+ isRegExp,
709
+ isFunction,
710
+ isStream,
711
+ isURLSearchParams,
712
+ isTypedArray,
713
+ isFileList,
714
+ forEach,
715
+ merge,
716
+ extend,
717
+ trim,
718
+ stripBOM,
719
+ inherits,
720
+ toFlatObject,
721
+ kindOf,
722
+ kindOfTest,
723
+ endsWith,
724
+ toArray,
725
+ forEachEntry,
726
+ matchAll,
727
+ isHTMLForm,
728
+ hasOwnProperty,
729
+ hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
730
+ reduceDescriptors,
731
+ freezeMethods,
732
+ toObjectSet,
733
+ toCamelCase,
734
+ noop,
735
+ toFiniteNumber,
736
+ findKey,
737
+ global: _global,
738
+ isContextDefined,
739
+ ALPHABET,
740
+ generateString,
741
+ isSpecCompliantForm,
742
+ toJSONObject,
743
+ isAsyncFn,
744
+ isThenable
745
+ };
746
+
747
+ /**
748
+ * Create an Error with the specified message, config, error code, request and response.
749
+ *
750
+ * @param {string} message The error message.
751
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
752
+ * @param {Object} [config] The config.
753
+ * @param {Object} [request] The request.
754
+ * @param {Object} [response] The response.
755
+ *
756
+ * @returns {Error} The created error.
757
+ */
758
+ function AxiosError(message, code, config, request, response) {
759
+ Error.call(this);
760
+
761
+ if (Error.captureStackTrace) {
762
+ Error.captureStackTrace(this, this.constructor);
763
+ } else {
764
+ this.stack = (new Error()).stack;
765
+ }
766
+
767
+ this.message = message;
768
+ this.name = 'AxiosError';
769
+ code && (this.code = code);
770
+ config && (this.config = config);
771
+ request && (this.request = request);
772
+ response && (this.response = response);
773
+ }
774
+
775
+ utils.inherits(AxiosError, Error, {
776
+ toJSON: function toJSON() {
777
+ return {
778
+ // Standard
779
+ message: this.message,
780
+ name: this.name,
781
+ // Microsoft
782
+ description: this.description,
783
+ number: this.number,
784
+ // Mozilla
785
+ fileName: this.fileName,
786
+ lineNumber: this.lineNumber,
787
+ columnNumber: this.columnNumber,
788
+ stack: this.stack,
789
+ // Axios
790
+ config: utils.toJSONObject(this.config),
791
+ code: this.code,
792
+ status: this.response && this.response.status ? this.response.status : null
793
+ };
794
+ }
795
+ });
796
+
797
+ const prototype = AxiosError.prototype;
798
+ const descriptors = {};
799
+
800
+ [
801
+ 'ERR_BAD_OPTION_VALUE',
802
+ 'ERR_BAD_OPTION',
803
+ 'ECONNABORTED',
804
+ 'ETIMEDOUT',
805
+ 'ERR_NETWORK',
806
+ 'ERR_FR_TOO_MANY_REDIRECTS',
807
+ 'ERR_DEPRECATED',
808
+ 'ERR_BAD_RESPONSE',
809
+ 'ERR_BAD_REQUEST',
810
+ 'ERR_CANCELED',
811
+ 'ERR_NOT_SUPPORT',
812
+ 'ERR_INVALID_URL'
813
+ // eslint-disable-next-line func-names
814
+ ].forEach(code => {
815
+ descriptors[code] = {value: code};
816
+ });
817
+
818
+ Object.defineProperties(AxiosError, descriptors);
819
+ Object.defineProperty(prototype, 'isAxiosError', {value: true});
820
+
821
+ // eslint-disable-next-line func-names
822
+ AxiosError.from = (error, code, config, request, response, customProps) => {
823
+ const axiosError = Object.create(prototype);
824
+
825
+ utils.toFlatObject(error, axiosError, function filter(obj) {
826
+ return obj !== Error.prototype;
827
+ }, prop => {
828
+ return prop !== 'isAxiosError';
829
+ });
830
+
831
+ AxiosError.call(axiosError, error.message, code, config, request, response);
832
+
833
+ axiosError.cause = error;
834
+
835
+ axiosError.name = error.name;
836
+
837
+ customProps && Object.assign(axiosError, customProps);
838
+
839
+ return axiosError;
840
+ };
841
+
842
+ // eslint-disable-next-line strict
843
+ var httpAdapter = null;
844
+
845
+ /**
846
+ * Determines if the given thing is a array or js object.
847
+ *
848
+ * @param {string} thing - The object or array to be visited.
849
+ *
850
+ * @returns {boolean}
851
+ */
852
+ function isVisitable(thing) {
853
+ return utils.isPlainObject(thing) || utils.isArray(thing);
854
+ }
855
+
856
+ /**
857
+ * It removes the brackets from the end of a string
858
+ *
859
+ * @param {string} key - The key of the parameter.
860
+ *
861
+ * @returns {string} the key without the brackets.
862
+ */
863
+ function removeBrackets(key) {
864
+ return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
865
+ }
866
+
867
+ /**
868
+ * It takes a path, a key, and a boolean, and returns a string
869
+ *
870
+ * @param {string} path - The path to the current key.
871
+ * @param {string} key - The key of the current object being iterated over.
872
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
873
+ *
874
+ * @returns {string} The path to the current key.
875
+ */
876
+ function renderKey(path, key, dots) {
877
+ if (!path) return key;
878
+ return path.concat(key).map(function each(token, i) {
879
+ // eslint-disable-next-line no-param-reassign
880
+ token = removeBrackets(token);
881
+ return !dots && i ? '[' + token + ']' : token;
882
+ }).join(dots ? '.' : '');
883
+ }
884
+
885
+ /**
886
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
887
+ *
888
+ * @param {Array<any>} arr - The array to check
889
+ *
890
+ * @returns {boolean}
891
+ */
892
+ function isFlatArray(arr) {
893
+ return utils.isArray(arr) && !arr.some(isVisitable);
894
+ }
895
+
896
+ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
897
+ return /^is[A-Z]/.test(prop);
898
+ });
899
+
900
+ /**
901
+ * Convert a data object to FormData
902
+ *
903
+ * @param {Object} obj
904
+ * @param {?Object} [formData]
905
+ * @param {?Object} [options]
906
+ * @param {Function} [options.visitor]
907
+ * @param {Boolean} [options.metaTokens = true]
908
+ * @param {Boolean} [options.dots = false]
909
+ * @param {?Boolean} [options.indexes = false]
910
+ *
911
+ * @returns {Object}
912
+ **/
913
+
914
+ /**
915
+ * It converts an object into a FormData object
916
+ *
917
+ * @param {Object<any, any>} obj - The object to convert to form data.
918
+ * @param {string} formData - The FormData object to append to.
919
+ * @param {Object<string, any>} options
920
+ *
921
+ * @returns
922
+ */
923
+ function toFormData(obj, formData, options) {
924
+ if (!utils.isObject(obj)) {
925
+ throw new TypeError('target must be an object');
926
+ }
927
+
928
+ // eslint-disable-next-line no-param-reassign
929
+ formData = formData || new ( FormData)();
930
+
931
+ // eslint-disable-next-line no-param-reassign
932
+ options = utils.toFlatObject(options, {
933
+ metaTokens: true,
934
+ dots: false,
935
+ indexes: false
936
+ }, false, function defined(option, source) {
937
+ // eslint-disable-next-line no-eq-null,eqeqeq
938
+ return !utils.isUndefined(source[option]);
939
+ });
940
+
941
+ const metaTokens = options.metaTokens;
942
+ // eslint-disable-next-line no-use-before-define
943
+ const visitor = options.visitor || defaultVisitor;
944
+ const dots = options.dots;
945
+ const indexes = options.indexes;
946
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
947
+ const useBlob = _Blob && utils.isSpecCompliantForm(formData);
948
+
949
+ if (!utils.isFunction(visitor)) {
950
+ throw new TypeError('visitor must be a function');
951
+ }
952
+
953
+ function convertValue(value) {
954
+ if (value === null) return '';
955
+
956
+ if (utils.isDate(value)) {
957
+ return value.toISOString();
958
+ }
959
+
960
+ if (!useBlob && utils.isBlob(value)) {
961
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
962
+ }
963
+
964
+ if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
965
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
966
+ }
967
+
968
+ return value;
969
+ }
970
+
971
+ /**
972
+ * Default visitor.
973
+ *
974
+ * @param {*} value
975
+ * @param {String|Number} key
976
+ * @param {Array<String|Number>} path
977
+ * @this {FormData}
978
+ *
979
+ * @returns {boolean} return true to visit the each prop of the value recursively
980
+ */
981
+ function defaultVisitor(value, key, path) {
982
+ let arr = value;
983
+
984
+ if (value && !path && typeof value === 'object') {
985
+ if (utils.endsWith(key, '{}')) {
986
+ // eslint-disable-next-line no-param-reassign
987
+ key = metaTokens ? key : key.slice(0, -2);
988
+ // eslint-disable-next-line no-param-reassign
989
+ value = JSON.stringify(value);
990
+ } else if (
991
+ (utils.isArray(value) && isFlatArray(value)) ||
992
+ ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
993
+ )) {
994
+ // eslint-disable-next-line no-param-reassign
995
+ key = removeBrackets(key);
996
+
997
+ arr.forEach(function each(el, index) {
998
+ !(utils.isUndefined(el) || el === null) && formData.append(
999
+ // eslint-disable-next-line no-nested-ternary
1000
+ indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
1001
+ convertValue(el)
1002
+ );
1003
+ });
1004
+ return false;
1005
+ }
1006
+ }
1007
+
1008
+ if (isVisitable(value)) {
1009
+ return true;
1010
+ }
1011
+
1012
+ formData.append(renderKey(path, key, dots), convertValue(value));
1013
+
1014
+ return false;
1015
+ }
1016
+
1017
+ const stack = [];
1018
+
1019
+ const exposedHelpers = Object.assign(predicates, {
1020
+ defaultVisitor,
1021
+ convertValue,
1022
+ isVisitable
1023
+ });
1024
+
1025
+ function build(value, path) {
1026
+ if (utils.isUndefined(value)) return;
1027
+
1028
+ if (stack.indexOf(value) !== -1) {
1029
+ throw Error('Circular reference detected in ' + path.join('.'));
1030
+ }
1031
+
1032
+ stack.push(value);
1033
+
1034
+ utils.forEach(value, function each(el, key) {
1035
+ const result = !(utils.isUndefined(el) || el === null) && visitor.call(
1036
+ formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
1037
+ );
1038
+
1039
+ if (result === true) {
1040
+ build(el, path ? path.concat(key) : [key]);
1041
+ }
1042
+ });
1043
+
1044
+ stack.pop();
1045
+ }
1046
+
1047
+ if (!utils.isObject(obj)) {
1048
+ throw new TypeError('data must be an object');
1049
+ }
1050
+
1051
+ build(obj);
1052
+
1053
+ return formData;
1054
+ }
1055
+
1056
+ /**
1057
+ * It encodes a string by replacing all characters that are not in the unreserved set with
1058
+ * their percent-encoded equivalents
1059
+ *
1060
+ * @param {string} str - The string to encode.
1061
+ *
1062
+ * @returns {string} The encoded string.
1063
+ */
1064
+ function encode(str) {
1065
+ const charMap = {
1066
+ '!': '%21',
1067
+ "'": '%27',
1068
+ '(': '%28',
1069
+ ')': '%29',
1070
+ '~': '%7E',
1071
+ '%20': '+',
1072
+ '%00': '\x00'
1073
+ };
1074
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1075
+ return charMap[match];
1076
+ });
1077
+ }
1078
+
1079
+ /**
1080
+ * It takes a params object and converts it to a FormData object
1081
+ *
1082
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1083
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1084
+ *
1085
+ * @returns {void}
1086
+ */
1087
+ function AxiosURLSearchParams(params, options) {
1088
+ this._pairs = [];
1089
+
1090
+ params && toFormData(params, this, options);
1091
+ }
1092
+
1093
+ const prototype$1 = AxiosURLSearchParams.prototype;
1094
+
1095
+ prototype$1.append = function append(name, value) {
1096
+ this._pairs.push([name, value]);
1097
+ };
1098
+
1099
+ prototype$1.toString = function toString(encoder) {
1100
+ const _encode = encoder ? function(value) {
1101
+ return encoder.call(this, value, encode);
1102
+ } : encode;
1103
+
1104
+ return this._pairs.map(function each(pair) {
1105
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
1106
+ }, '').join('&');
1107
+ };
1108
+
1109
+ /**
1110
+ * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1111
+ * URI encoded counterparts
1112
+ *
1113
+ * @param {string} val The value to be encoded.
1114
+ *
1115
+ * @returns {string} The encoded value.
1116
+ */
1117
+ function encode$1(val) {
1118
+ return encodeURIComponent(val).
1119
+ replace(/%3A/gi, ':').
1120
+ replace(/%24/g, '$').
1121
+ replace(/%2C/gi, ',').
1122
+ replace(/%20/g, '+').
1123
+ replace(/%5B/gi, '[').
1124
+ replace(/%5D/gi, ']');
1125
+ }
1126
+
1127
+ /**
1128
+ * Build a URL by appending params to the end
1129
+ *
1130
+ * @param {string} url The base of the url (e.g., http://www.google.com)
1131
+ * @param {object} [params] The params to be appended
1132
+ * @param {?object} options
1133
+ *
1134
+ * @returns {string} The formatted url
1135
+ */
1136
+ function buildURL(url, params, options) {
1137
+ /*eslint no-param-reassign:0*/
1138
+ if (!params) {
1139
+ return url;
1140
+ }
1141
+
1142
+ const _encode = options && options.encode || encode$1;
1143
+
1144
+ const serializeFn = options && options.serialize;
1145
+
1146
+ let serializedParams;
1147
+
1148
+ if (serializeFn) {
1149
+ serializedParams = serializeFn(params, options);
1150
+ } else {
1151
+ serializedParams = utils.isURLSearchParams(params) ?
1152
+ params.toString() :
1153
+ new AxiosURLSearchParams(params, options).toString(_encode);
1154
+ }
1155
+
1156
+ if (serializedParams) {
1157
+ const hashmarkIndex = url.indexOf("#");
1158
+
1159
+ if (hashmarkIndex !== -1) {
1160
+ url = url.slice(0, hashmarkIndex);
1161
+ }
1162
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1163
+ }
1164
+
1165
+ return url;
1166
+ }
1167
+
1168
+ class InterceptorManager {
1169
+ constructor() {
1170
+ this.handlers = [];
1171
+ }
1172
+
1173
+ /**
1174
+ * Add a new interceptor to the stack
1175
+ *
1176
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
1177
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
1178
+ *
1179
+ * @return {Number} An ID used to remove interceptor later
1180
+ */
1181
+ use(fulfilled, rejected, options) {
1182
+ this.handlers.push({
1183
+ fulfilled,
1184
+ rejected,
1185
+ synchronous: options ? options.synchronous : false,
1186
+ runWhen: options ? options.runWhen : null
1187
+ });
1188
+ return this.handlers.length - 1;
1189
+ }
1190
+
1191
+ /**
1192
+ * Remove an interceptor from the stack
1193
+ *
1194
+ * @param {Number} id The ID that was returned by `use`
1195
+ *
1196
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1197
+ */
1198
+ eject(id) {
1199
+ if (this.handlers[id]) {
1200
+ this.handlers[id] = null;
1201
+ }
1202
+ }
1203
+
1204
+ /**
1205
+ * Clear all interceptors from the stack
1206
+ *
1207
+ * @returns {void}
1208
+ */
1209
+ clear() {
1210
+ if (this.handlers) {
1211
+ this.handlers = [];
1212
+ }
1213
+ }
1214
+
1215
+ /**
1216
+ * Iterate over all the registered interceptors
1217
+ *
1218
+ * This method is particularly useful for skipping over any
1219
+ * interceptors that may have become `null` calling `eject`.
1220
+ *
1221
+ * @param {Function} fn The function to call for each interceptor
1222
+ *
1223
+ * @returns {void}
1224
+ */
1225
+ forEach(fn) {
1226
+ utils.forEach(this.handlers, function forEachHandler(h) {
1227
+ if (h !== null) {
1228
+ fn(h);
1229
+ }
1230
+ });
1231
+ }
1232
+ }
1233
+
1234
+ var transitionalDefaults = {
1235
+ silentJSONParsing: true,
1236
+ forcedJSONParsing: true,
1237
+ clarifyTimeoutError: false
1238
+ };
1239
+
1240
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1241
+
1242
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1243
+
1244
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1245
+
1246
+ var platform = {
1247
+ isBrowser: true,
1248
+ classes: {
1249
+ URLSearchParams: URLSearchParams$1,
1250
+ FormData: FormData$1,
1251
+ Blob: Blob$1
1252
+ },
1253
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1254
+ };
1255
+
1256
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1257
+
1258
+ /**
1259
+ * Determine if we're running in a standard browser environment
1260
+ *
1261
+ * This allows axios to run in a web worker, and react-native.
1262
+ * Both environments support XMLHttpRequest, but not fully standard globals.
1263
+ *
1264
+ * web workers:
1265
+ * typeof window -> undefined
1266
+ * typeof document -> undefined
1267
+ *
1268
+ * react-native:
1269
+ * navigator.product -> 'ReactNative'
1270
+ * nativescript
1271
+ * navigator.product -> 'NativeScript' or 'NS'
1272
+ *
1273
+ * @returns {boolean}
1274
+ */
1275
+ const hasStandardBrowserEnv = (
1276
+ (product) => {
1277
+ return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
1278
+ })(typeof navigator !== 'undefined' && navigator.product);
1279
+
1280
+ /**
1281
+ * Determine if we're running in a standard browser webWorker environment
1282
+ *
1283
+ * Although the `isStandardBrowserEnv` method indicates that
1284
+ * `allows axios to run in a web worker`, the WebWorker will still be
1285
+ * filtered out due to its judgment standard
1286
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1287
+ * This leads to a problem when axios post `FormData` in webWorker
1288
+ */
1289
+ const hasStandardBrowserWebWorkerEnv = (() => {
1290
+ return (
1291
+ typeof WorkerGlobalScope !== 'undefined' &&
1292
+ // eslint-disable-next-line no-undef
1293
+ self instanceof WorkerGlobalScope &&
1294
+ typeof self.importScripts === 'function'
1295
+ );
1296
+ })();
1297
+
1298
+ var utils$1 = {
1299
+ __proto__: null,
1300
+ hasBrowserEnv: hasBrowserEnv,
1301
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1302
+ hasStandardBrowserEnv: hasStandardBrowserEnv
1303
+ };
1304
+
1305
+ var platform$1 = {
1306
+ ...utils$1,
1307
+ ...platform
1308
+ };
1309
+
1310
+ function toURLEncodedForm(data, options) {
1311
+ return toFormData(data, new platform$1.classes.URLSearchParams(), Object.assign({
1312
+ visitor: function(value, key, path, helpers) {
1313
+ if (platform$1.isNode && utils.isBuffer(value)) {
1314
+ this.append(key, value.toString('base64'));
1315
+ return false;
1316
+ }
1317
+
1318
+ return helpers.defaultVisitor.apply(this, arguments);
1319
+ }
1320
+ }, options));
1321
+ }
1322
+
1323
+ /**
1324
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1325
+ *
1326
+ * @param {string} name - The name of the property to get.
1327
+ *
1328
+ * @returns An array of strings.
1329
+ */
1330
+ function parsePropPath(name) {
1331
+ // foo[x][y][z]
1332
+ // foo.x.y.z
1333
+ // foo-x-y-z
1334
+ // foo x y z
1335
+ return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1336
+ return match[0] === '[]' ? '' : match[1] || match[0];
1337
+ });
1338
+ }
1339
+
1340
+ /**
1341
+ * Convert an array to an object.
1342
+ *
1343
+ * @param {Array<any>} arr - The array to convert to an object.
1344
+ *
1345
+ * @returns An object with the same keys and values as the array.
1346
+ */
1347
+ function arrayToObject(arr) {
1348
+ const obj = {};
1349
+ const keys = Object.keys(arr);
1350
+ let i;
1351
+ const len = keys.length;
1352
+ let key;
1353
+ for (i = 0; i < len; i++) {
1354
+ key = keys[i];
1355
+ obj[key] = arr[key];
1356
+ }
1357
+ return obj;
1358
+ }
1359
+
1360
+ /**
1361
+ * It takes a FormData object and returns a JavaScript object
1362
+ *
1363
+ * @param {string} formData The FormData object to convert to JSON.
1364
+ *
1365
+ * @returns {Object<string, any> | null} The converted object.
1366
+ */
1367
+ function formDataToJSON(formData) {
1368
+ function buildPath(path, value, target, index) {
1369
+ let name = path[index++];
1370
+
1371
+ if (name === '__proto__') return true;
1372
+
1373
+ const isNumericKey = Number.isFinite(+name);
1374
+ const isLast = index >= path.length;
1375
+ name = !name && utils.isArray(target) ? target.length : name;
1376
+
1377
+ if (isLast) {
1378
+ if (utils.hasOwnProp(target, name)) {
1379
+ target[name] = [target[name], value];
1380
+ } else {
1381
+ target[name] = value;
1382
+ }
1383
+
1384
+ return !isNumericKey;
1385
+ }
1386
+
1387
+ if (!target[name] || !utils.isObject(target[name])) {
1388
+ target[name] = [];
1389
+ }
1390
+
1391
+ const result = buildPath(path, value, target[name], index);
1392
+
1393
+ if (result && utils.isArray(target[name])) {
1394
+ target[name] = arrayToObject(target[name]);
1395
+ }
1396
+
1397
+ return !isNumericKey;
1398
+ }
1399
+
1400
+ if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
1401
+ const obj = {};
1402
+
1403
+ utils.forEachEntry(formData, (name, value) => {
1404
+ buildPath(parsePropPath(name), value, obj, 0);
1405
+ });
1406
+
1407
+ return obj;
1408
+ }
1409
+
1410
+ return null;
1411
+ }
1412
+
1413
+ /**
1414
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1415
+ * of the input
1416
+ *
1417
+ * @param {any} rawValue - The value to be stringified.
1418
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
1419
+ * @param {Function} encoder - A function that takes a value and returns a string.
1420
+ *
1421
+ * @returns {string} A stringified version of the rawValue.
1422
+ */
1423
+ function stringifySafely(rawValue, parser, encoder) {
1424
+ if (utils.isString(rawValue)) {
1425
+ try {
1426
+ (parser || JSON.parse)(rawValue);
1427
+ return utils.trim(rawValue);
1428
+ } catch (e) {
1429
+ if (e.name !== 'SyntaxError') {
1430
+ throw e;
1431
+ }
1432
+ }
1433
+ }
1434
+
1435
+ return (encoder || JSON.stringify)(rawValue);
1436
+ }
1437
+
1438
+ const defaults = {
1439
+
1440
+ transitional: transitionalDefaults,
1441
+
1442
+ adapter: ['xhr', 'http'],
1443
+
1444
+ transformRequest: [function transformRequest(data, headers) {
1445
+ const contentType = headers.getContentType() || '';
1446
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
1447
+ const isObjectPayload = utils.isObject(data);
1448
+
1449
+ if (isObjectPayload && utils.isHTMLForm(data)) {
1450
+ data = new FormData(data);
1451
+ }
1452
+
1453
+ const isFormData = utils.isFormData(data);
1454
+
1455
+ if (isFormData) {
1456
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1457
+ }
1458
+
1459
+ if (utils.isArrayBuffer(data) ||
1460
+ utils.isBuffer(data) ||
1461
+ utils.isStream(data) ||
1462
+ utils.isFile(data) ||
1463
+ utils.isBlob(data)
1464
+ ) {
1465
+ return data;
1466
+ }
1467
+ if (utils.isArrayBufferView(data)) {
1468
+ return data.buffer;
1469
+ }
1470
+ if (utils.isURLSearchParams(data)) {
1471
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1472
+ return data.toString();
1473
+ }
1474
+
1475
+ let isFileList;
1476
+
1477
+ if (isObjectPayload) {
1478
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1479
+ return toURLEncodedForm(data, this.formSerializer).toString();
1480
+ }
1481
+
1482
+ if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1483
+ const _FormData = this.env && this.env.FormData;
1484
+
1485
+ return toFormData(
1486
+ isFileList ? {'files[]': data} : data,
1487
+ _FormData && new _FormData(),
1488
+ this.formSerializer
1489
+ );
1490
+ }
1491
+ }
1492
+
1493
+ if (isObjectPayload || hasJSONContentType ) {
1494
+ headers.setContentType('application/json', false);
1495
+ return stringifySafely(data);
1496
+ }
1497
+
1498
+ return data;
1499
+ }],
1500
+
1501
+ transformResponse: [function transformResponse(data) {
1502
+ const transitional = this.transitional || defaults.transitional;
1503
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1504
+ const JSONRequested = this.responseType === 'json';
1505
+
1506
+ if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1507
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
1508
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
1509
+
1510
+ try {
1511
+ return JSON.parse(data);
1512
+ } catch (e) {
1513
+ if (strictJSONParsing) {
1514
+ if (e.name === 'SyntaxError') {
1515
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1516
+ }
1517
+ throw e;
1518
+ }
1519
+ }
1520
+ }
1521
+
1522
+ return data;
1523
+ }],
1524
+
1525
+ /**
1526
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1527
+ * timeout is not created.
1528
+ */
1529
+ timeout: 0,
1530
+
1531
+ xsrfCookieName: 'XSRF-TOKEN',
1532
+ xsrfHeaderName: 'X-XSRF-TOKEN',
1533
+
1534
+ maxContentLength: -1,
1535
+ maxBodyLength: -1,
1536
+
1537
+ env: {
1538
+ FormData: platform$1.classes.FormData,
1539
+ Blob: platform$1.classes.Blob
1540
+ },
1541
+
1542
+ validateStatus: function validateStatus(status) {
1543
+ return status >= 200 && status < 300;
1544
+ },
1545
+
1546
+ headers: {
1547
+ common: {
1548
+ 'Accept': 'application/json, text/plain, */*',
1549
+ 'Content-Type': undefined
1550
+ }
1551
+ }
1552
+ };
1553
+
1554
+ utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
1555
+ defaults.headers[method] = {};
1556
+ });
1557
+
1558
+ // RawAxiosHeaders whose duplicates are ignored by node
1559
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1560
+ const ignoreDuplicateOf = utils.toObjectSet([
1561
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
1562
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1563
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1564
+ 'referer', 'retry-after', 'user-agent'
1565
+ ]);
1566
+
1567
+ /**
1568
+ * Parse headers into an object
1569
+ *
1570
+ * ```
1571
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
1572
+ * Content-Type: application/json
1573
+ * Connection: keep-alive
1574
+ * Transfer-Encoding: chunked
1575
+ * ```
1576
+ *
1577
+ * @param {String} rawHeaders Headers needing to be parsed
1578
+ *
1579
+ * @returns {Object} Headers parsed into an object
1580
+ */
1581
+ var parseHeaders = rawHeaders => {
1582
+ const parsed = {};
1583
+ let key;
1584
+ let val;
1585
+ let i;
1586
+
1587
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1588
+ i = line.indexOf(':');
1589
+ key = line.substring(0, i).trim().toLowerCase();
1590
+ val = line.substring(i + 1).trim();
1591
+
1592
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
1593
+ return;
1594
+ }
1595
+
1596
+ if (key === 'set-cookie') {
1597
+ if (parsed[key]) {
1598
+ parsed[key].push(val);
1599
+ } else {
1600
+ parsed[key] = [val];
1601
+ }
1602
+ } else {
1603
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1604
+ }
1605
+ });
1606
+
1607
+ return parsed;
1608
+ };
1609
+
1610
+ const $internals = Symbol('internals');
1611
+
1612
+ function normalizeHeader(header) {
1613
+ return header && String(header).trim().toLowerCase();
1614
+ }
1615
+
1616
+ function normalizeValue(value) {
1617
+ if (value === false || value == null) {
1618
+ return value;
1619
+ }
1620
+
1621
+ return utils.isArray(value) ? value.map(normalizeValue) : String(value);
1622
+ }
1623
+
1624
+ function parseTokens(str) {
1625
+ const tokens = Object.create(null);
1626
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1627
+ let match;
1628
+
1629
+ while ((match = tokensRE.exec(str))) {
1630
+ tokens[match[1]] = match[2];
1631
+ }
1632
+
1633
+ return tokens;
1634
+ }
1635
+
1636
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1637
+
1638
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1639
+ if (utils.isFunction(filter)) {
1640
+ return filter.call(this, value, header);
1641
+ }
1642
+
1643
+ if (isHeaderNameFilter) {
1644
+ value = header;
1645
+ }
1646
+
1647
+ if (!utils.isString(value)) return;
1648
+
1649
+ if (utils.isString(filter)) {
1650
+ return value.indexOf(filter) !== -1;
1651
+ }
1652
+
1653
+ if (utils.isRegExp(filter)) {
1654
+ return filter.test(value);
1655
+ }
1656
+ }
1657
+
1658
+ function formatHeader(header) {
1659
+ return header.trim()
1660
+ .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1661
+ return char.toUpperCase() + str;
1662
+ });
1663
+ }
1664
+
1665
+ function buildAccessors(obj, header) {
1666
+ const accessorName = utils.toCamelCase(' ' + header);
1667
+
1668
+ ['get', 'set', 'has'].forEach(methodName => {
1669
+ Object.defineProperty(obj, methodName + accessorName, {
1670
+ value: function(arg1, arg2, arg3) {
1671
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1672
+ },
1673
+ configurable: true
1674
+ });
1675
+ });
1676
+ }
1677
+
1678
+ class AxiosHeaders {
1679
+ constructor(headers) {
1680
+ headers && this.set(headers);
1681
+ }
1682
+
1683
+ set(header, valueOrRewrite, rewrite) {
1684
+ const self = this;
1685
+
1686
+ function setHeader(_value, _header, _rewrite) {
1687
+ const lHeader = normalizeHeader(_header);
1688
+
1689
+ if (!lHeader) {
1690
+ throw new Error('header name must be a non-empty string');
1691
+ }
1692
+
1693
+ const key = utils.findKey(self, lHeader);
1694
+
1695
+ if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
1696
+ self[key || _header] = normalizeValue(_value);
1697
+ }
1698
+ }
1699
+
1700
+ const setHeaders = (headers, _rewrite) =>
1701
+ utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1702
+
1703
+ if (utils.isPlainObject(header) || header instanceof this.constructor) {
1704
+ setHeaders(header, valueOrRewrite);
1705
+ } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1706
+ setHeaders(parseHeaders(header), valueOrRewrite);
1707
+ } else {
1708
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1709
+ }
1710
+
1711
+ return this;
1712
+ }
1713
+
1714
+ get(header, parser) {
1715
+ header = normalizeHeader(header);
1716
+
1717
+ if (header) {
1718
+ const key = utils.findKey(this, header);
1719
+
1720
+ if (key) {
1721
+ const value = this[key];
1722
+
1723
+ if (!parser) {
1724
+ return value;
1725
+ }
1726
+
1727
+ if (parser === true) {
1728
+ return parseTokens(value);
1729
+ }
1730
+
1731
+ if (utils.isFunction(parser)) {
1732
+ return parser.call(this, value, key);
1733
+ }
1734
+
1735
+ if (utils.isRegExp(parser)) {
1736
+ return parser.exec(value);
1737
+ }
1738
+
1739
+ throw new TypeError('parser must be boolean|regexp|function');
1740
+ }
1741
+ }
1742
+ }
1743
+
1744
+ has(header, matcher) {
1745
+ header = normalizeHeader(header);
1746
+
1747
+ if (header) {
1748
+ const key = utils.findKey(this, header);
1749
+
1750
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1751
+ }
1752
+
1753
+ return false;
1754
+ }
1755
+
1756
+ delete(header, matcher) {
1757
+ const self = this;
1758
+ let deleted = false;
1759
+
1760
+ function deleteHeader(_header) {
1761
+ _header = normalizeHeader(_header);
1762
+
1763
+ if (_header) {
1764
+ const key = utils.findKey(self, _header);
1765
+
1766
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1767
+ delete self[key];
1768
+
1769
+ deleted = true;
1770
+ }
1771
+ }
1772
+ }
1773
+
1774
+ if (utils.isArray(header)) {
1775
+ header.forEach(deleteHeader);
1776
+ } else {
1777
+ deleteHeader(header);
1778
+ }
1779
+
1780
+ return deleted;
1781
+ }
1782
+
1783
+ clear(matcher) {
1784
+ const keys = Object.keys(this);
1785
+ let i = keys.length;
1786
+ let deleted = false;
1787
+
1788
+ while (i--) {
1789
+ const key = keys[i];
1790
+ if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1791
+ delete this[key];
1792
+ deleted = true;
1793
+ }
1794
+ }
1795
+
1796
+ return deleted;
1797
+ }
1798
+
1799
+ normalize(format) {
1800
+ const self = this;
1801
+ const headers = {};
1802
+
1803
+ utils.forEach(this, (value, header) => {
1804
+ const key = utils.findKey(headers, header);
1805
+
1806
+ if (key) {
1807
+ self[key] = normalizeValue(value);
1808
+ delete self[header];
1809
+ return;
1810
+ }
1811
+
1812
+ const normalized = format ? formatHeader(header) : String(header).trim();
1813
+
1814
+ if (normalized !== header) {
1815
+ delete self[header];
1816
+ }
1817
+
1818
+ self[normalized] = normalizeValue(value);
1819
+
1820
+ headers[normalized] = true;
1821
+ });
1822
+
1823
+ return this;
1824
+ }
1825
+
1826
+ concat(...targets) {
1827
+ return this.constructor.concat(this, ...targets);
1828
+ }
1829
+
1830
+ toJSON(asStrings) {
1831
+ const obj = Object.create(null);
1832
+
1833
+ utils.forEach(this, (value, header) => {
1834
+ value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
1835
+ });
1836
+
1837
+ return obj;
1838
+ }
1839
+
1840
+ [Symbol.iterator]() {
1841
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1842
+ }
1843
+
1844
+ toString() {
1845
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1846
+ }
1847
+
1848
+ get [Symbol.toStringTag]() {
1849
+ return 'AxiosHeaders';
1850
+ }
1851
+
1852
+ static from(thing) {
1853
+ return thing instanceof this ? thing : new this(thing);
1854
+ }
1855
+
1856
+ static concat(first, ...targets) {
1857
+ const computed = new this(first);
1858
+
1859
+ targets.forEach((target) => computed.set(target));
1860
+
1861
+ return computed;
1862
+ }
1863
+
1864
+ static accessor(header) {
1865
+ const internals = this[$internals] = (this[$internals] = {
1866
+ accessors: {}
1867
+ });
1868
+
1869
+ const accessors = internals.accessors;
1870
+ const prototype = this.prototype;
1871
+
1872
+ function defineAccessor(_header) {
1873
+ const lHeader = normalizeHeader(_header);
1874
+
1875
+ if (!accessors[lHeader]) {
1876
+ buildAccessors(prototype, _header);
1877
+ accessors[lHeader] = true;
1878
+ }
1879
+ }
1880
+
1881
+ utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1882
+
1883
+ return this;
1884
+ }
1885
+ }
1886
+
1887
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1888
+
1889
+ // reserved names hotfix
1890
+ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
1891
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1892
+ return {
1893
+ get: () => value,
1894
+ set(headerValue) {
1895
+ this[mapped] = headerValue;
1896
+ }
1897
+ }
1898
+ });
1899
+
1900
+ utils.freezeMethods(AxiosHeaders);
1901
+
1902
+ /**
1903
+ * Transform the data for a request or a response
1904
+ *
1905
+ * @param {Array|Function} fns A single function or Array of functions
1906
+ * @param {?Object} response The response object
1907
+ *
1908
+ * @returns {*} The resulting transformed data
1909
+ */
1910
+ function transformData(fns, response) {
1911
+ const config = this || defaults;
1912
+ const context = response || config;
1913
+ const headers = AxiosHeaders.from(context.headers);
1914
+ let data = context.data;
1915
+
1916
+ utils.forEach(fns, function transform(fn) {
1917
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
1918
+ });
1919
+
1920
+ headers.normalize();
1921
+
1922
+ return data;
1923
+ }
1924
+
1925
+ function isCancel(value) {
1926
+ return !!(value && value.__CANCEL__);
1927
+ }
1928
+
1929
+ /**
1930
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
1931
+ *
1932
+ * @param {string=} message The message.
1933
+ * @param {Object=} config The config.
1934
+ * @param {Object=} request The request.
1935
+ *
1936
+ * @returns {CanceledError} The created error.
1937
+ */
1938
+ function CanceledError(message, config, request) {
1939
+ // eslint-disable-next-line no-eq-null,eqeqeq
1940
+ AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
1941
+ this.name = 'CanceledError';
1942
+ }
1943
+
1944
+ utils.inherits(CanceledError, AxiosError, {
1945
+ __CANCEL__: true
1946
+ });
1947
+
1948
+ /**
1949
+ * Resolve or reject a Promise based on response status.
1950
+ *
1951
+ * @param {Function} resolve A function that resolves the promise.
1952
+ * @param {Function} reject A function that rejects the promise.
1953
+ * @param {object} response The response.
1954
+ *
1955
+ * @returns {object} The response.
1956
+ */
1957
+ function settle(resolve, reject, response) {
1958
+ const validateStatus = response.config.validateStatus;
1959
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
1960
+ resolve(response);
1961
+ } else {
1962
+ reject(new AxiosError(
1963
+ 'Request failed with status code ' + response.status,
1964
+ [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1965
+ response.config,
1966
+ response.request,
1967
+ response
1968
+ ));
1969
+ }
1970
+ }
1971
+
1972
+ var cookies = platform$1.hasStandardBrowserEnv ?
1973
+
1974
+ // Standard browser envs support document.cookie
1975
+ {
1976
+ write(name, value, expires, path, domain, secure) {
1977
+ const cookie = [name + '=' + encodeURIComponent(value)];
1978
+
1979
+ utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
1980
+
1981
+ utils.isString(path) && cookie.push('path=' + path);
1982
+
1983
+ utils.isString(domain) && cookie.push('domain=' + domain);
1984
+
1985
+ secure === true && cookie.push('secure');
1986
+
1987
+ document.cookie = cookie.join('; ');
1988
+ },
1989
+
1990
+ read(name) {
1991
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1992
+ return (match ? decodeURIComponent(match[3]) : null);
1993
+ },
1994
+
1995
+ remove(name) {
1996
+ this.write(name, '', Date.now() - 86400000);
1997
+ }
1998
+ }
1999
+
2000
+ :
2001
+
2002
+ // Non-standard browser env (web workers, react-native) lack needed support.
2003
+ {
2004
+ write() {},
2005
+ read() {
2006
+ return null;
2007
+ },
2008
+ remove() {}
2009
+ };
2010
+
2011
+ /**
2012
+ * Determines whether the specified URL is absolute
2013
+ *
2014
+ * @param {string} url The URL to test
2015
+ *
2016
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
2017
+ */
2018
+ function isAbsoluteURL(url) {
2019
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2020
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2021
+ // by any combination of letters, digits, plus, period, or hyphen.
2022
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2023
+ }
2024
+
2025
+ /**
2026
+ * Creates a new URL by combining the specified URLs
2027
+ *
2028
+ * @param {string} baseURL The base URL
2029
+ * @param {string} relativeURL The relative URL
2030
+ *
2031
+ * @returns {string} The combined URL
2032
+ */
2033
+ function combineURLs(baseURL, relativeURL) {
2034
+ return relativeURL
2035
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
2036
+ : baseURL;
2037
+ }
2038
+
2039
+ /**
2040
+ * Creates a new URL by combining the baseURL with the requestedURL,
2041
+ * only when the requestedURL is not already an absolute URL.
2042
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
2043
+ *
2044
+ * @param {string} baseURL The base URL
2045
+ * @param {string} requestedURL Absolute or relative URL to combine
2046
+ *
2047
+ * @returns {string} The combined full path
2048
+ */
2049
+ function buildFullPath(baseURL, requestedURL) {
2050
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
2051
+ return combineURLs(baseURL, requestedURL);
2052
+ }
2053
+ return requestedURL;
2054
+ }
2055
+
2056
+ var isURLSameOrigin = platform$1.hasStandardBrowserEnv ?
2057
+
2058
+ // Standard browser envs have full support of the APIs needed to test
2059
+ // whether the request URL is of the same origin as current location.
2060
+ (function standardBrowserEnv() {
2061
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
2062
+ const urlParsingNode = document.createElement('a');
2063
+ let originURL;
2064
+
2065
+ /**
2066
+ * Parse a URL to discover its components
2067
+ *
2068
+ * @param {String} url The URL to be parsed
2069
+ * @returns {Object}
2070
+ */
2071
+ function resolveURL(url) {
2072
+ let href = url;
2073
+
2074
+ if (msie) {
2075
+ // IE needs attribute set twice to normalize properties
2076
+ urlParsingNode.setAttribute('href', href);
2077
+ href = urlParsingNode.href;
2078
+ }
2079
+
2080
+ urlParsingNode.setAttribute('href', href);
2081
+
2082
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2083
+ return {
2084
+ href: urlParsingNode.href,
2085
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2086
+ host: urlParsingNode.host,
2087
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2088
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2089
+ hostname: urlParsingNode.hostname,
2090
+ port: urlParsingNode.port,
2091
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
2092
+ urlParsingNode.pathname :
2093
+ '/' + urlParsingNode.pathname
2094
+ };
2095
+ }
2096
+
2097
+ originURL = resolveURL(window.location.href);
2098
+
2099
+ /**
2100
+ * Determine if a URL shares the same origin as the current location
2101
+ *
2102
+ * @param {String} requestURL The URL to test
2103
+ * @returns {boolean} True if URL shares the same origin, otherwise false
2104
+ */
2105
+ return function isURLSameOrigin(requestURL) {
2106
+ const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
2107
+ return (parsed.protocol === originURL.protocol &&
2108
+ parsed.host === originURL.host);
2109
+ };
2110
+ })() :
2111
+
2112
+ // Non standard browser envs (web workers, react-native) lack needed support.
2113
+ (function nonStandardBrowserEnv() {
2114
+ return function isURLSameOrigin() {
2115
+ return true;
2116
+ };
2117
+ })();
2118
+
2119
+ function parseProtocol(url) {
2120
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2121
+ return match && match[1] || '';
2122
+ }
2123
+
2124
+ /**
2125
+ * Calculate data maxRate
2126
+ * @param {Number} [samplesCount= 10]
2127
+ * @param {Number} [min= 1000]
2128
+ * @returns {Function}
2129
+ */
2130
+ function speedometer(samplesCount, min) {
2131
+ samplesCount = samplesCount || 10;
2132
+ const bytes = new Array(samplesCount);
2133
+ const timestamps = new Array(samplesCount);
2134
+ let head = 0;
2135
+ let tail = 0;
2136
+ let firstSampleTS;
2137
+
2138
+ min = min !== undefined ? min : 1000;
2139
+
2140
+ return function push(chunkLength) {
2141
+ const now = Date.now();
2142
+
2143
+ const startedAt = timestamps[tail];
2144
+
2145
+ if (!firstSampleTS) {
2146
+ firstSampleTS = now;
2147
+ }
2148
+
2149
+ bytes[head] = chunkLength;
2150
+ timestamps[head] = now;
2151
+
2152
+ let i = tail;
2153
+ let bytesCount = 0;
2154
+
2155
+ while (i !== head) {
2156
+ bytesCount += bytes[i++];
2157
+ i = i % samplesCount;
2158
+ }
2159
+
2160
+ head = (head + 1) % samplesCount;
2161
+
2162
+ if (head === tail) {
2163
+ tail = (tail + 1) % samplesCount;
2164
+ }
2165
+
2166
+ if (now - firstSampleTS < min) {
2167
+ return;
2168
+ }
2169
+
2170
+ const passed = startedAt && now - startedAt;
2171
+
2172
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2173
+ };
2174
+ }
2175
+
2176
+ function progressEventReducer(listener, isDownloadStream) {
2177
+ let bytesNotified = 0;
2178
+ const _speedometer = speedometer(50, 250);
2179
+
2180
+ return e => {
2181
+ const loaded = e.loaded;
2182
+ const total = e.lengthComputable ? e.total : undefined;
2183
+ const progressBytes = loaded - bytesNotified;
2184
+ const rate = _speedometer(progressBytes);
2185
+ const inRange = loaded <= total;
2186
+
2187
+ bytesNotified = loaded;
2188
+
2189
+ const data = {
2190
+ loaded,
2191
+ total,
2192
+ progress: total ? (loaded / total) : undefined,
2193
+ bytes: progressBytes,
2194
+ rate: rate ? rate : undefined,
2195
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2196
+ event: e
2197
+ };
2198
+
2199
+ data[isDownloadStream ? 'download' : 'upload'] = true;
2200
+
2201
+ listener(data);
2202
+ };
2203
+ }
2204
+
2205
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2206
+
2207
+ var xhrAdapter = isXHRAdapterSupported && function (config) {
2208
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
2209
+ let requestData = config.data;
2210
+ const requestHeaders = AxiosHeaders.from(config.headers).normalize();
2211
+ let {responseType, withXSRFToken} = config;
2212
+ let onCanceled;
2213
+ function done() {
2214
+ if (config.cancelToken) {
2215
+ config.cancelToken.unsubscribe(onCanceled);
2216
+ }
2217
+
2218
+ if (config.signal) {
2219
+ config.signal.removeEventListener('abort', onCanceled);
2220
+ }
2221
+ }
2222
+
2223
+ let contentType;
2224
+
2225
+ if (utils.isFormData(requestData)) {
2226
+ if (platform$1.hasStandardBrowserEnv || platform$1.hasStandardBrowserWebWorkerEnv) {
2227
+ requestHeaders.setContentType(false); // Let the browser set it
2228
+ } else if ((contentType = requestHeaders.getContentType()) !== false) {
2229
+ // fix semicolon duplication issue for ReactNative FormData implementation
2230
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
2231
+ requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
2232
+ }
2233
+ }
2234
+
2235
+ let request = new XMLHttpRequest();
2236
+
2237
+ // HTTP basic authentication
2238
+ if (config.auth) {
2239
+ const username = config.auth.username || '';
2240
+ const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
2241
+ requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
2242
+ }
2243
+
2244
+ const fullPath = buildFullPath(config.baseURL, config.url);
2245
+
2246
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
2247
+
2248
+ // Set the request timeout in MS
2249
+ request.timeout = config.timeout;
2250
+
2251
+ function onloadend() {
2252
+ if (!request) {
2253
+ return;
2254
+ }
2255
+ // Prepare the response
2256
+ const responseHeaders = AxiosHeaders.from(
2257
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2258
+ );
2259
+ const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
2260
+ request.responseText : request.response;
2261
+ const response = {
2262
+ data: responseData,
2263
+ status: request.status,
2264
+ statusText: request.statusText,
2265
+ headers: responseHeaders,
2266
+ config,
2267
+ request
2268
+ };
2269
+
2270
+ settle(function _resolve(value) {
2271
+ resolve(value);
2272
+ done();
2273
+ }, function _reject(err) {
2274
+ reject(err);
2275
+ done();
2276
+ }, response);
2277
+
2278
+ // Clean up request
2279
+ request = null;
2280
+ }
2281
+
2282
+ if ('onloadend' in request) {
2283
+ // Use onloadend if available
2284
+ request.onloadend = onloadend;
2285
+ } else {
2286
+ // Listen for ready state to emulate onloadend
2287
+ request.onreadystatechange = function handleLoad() {
2288
+ if (!request || request.readyState !== 4) {
2289
+ return;
2290
+ }
2291
+
2292
+ // The request errored out and we didn't get a response, this will be
2293
+ // handled by onerror instead
2294
+ // With one exception: request that using file: protocol, most browsers
2295
+ // will return status as 0 even though it's a successful request
2296
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2297
+ return;
2298
+ }
2299
+ // readystate handler is calling before onerror or ontimeout handlers,
2300
+ // so we should call onloadend on the next 'tick'
2301
+ setTimeout(onloadend);
2302
+ };
2303
+ }
2304
+
2305
+ // Handle browser request cancellation (as opposed to a manual cancellation)
2306
+ request.onabort = function handleAbort() {
2307
+ if (!request) {
2308
+ return;
2309
+ }
2310
+
2311
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
2312
+
2313
+ // Clean up request
2314
+ request = null;
2315
+ };
2316
+
2317
+ // Handle low level network errors
2318
+ request.onerror = function handleError() {
2319
+ // Real errors are hidden from us by the browser
2320
+ // onerror should only fire if it's a network error
2321
+ reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
2322
+
2323
+ // Clean up request
2324
+ request = null;
2325
+ };
2326
+
2327
+ // Handle timeout
2328
+ request.ontimeout = function handleTimeout() {
2329
+ let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
2330
+ const transitional = config.transitional || transitionalDefaults;
2331
+ if (config.timeoutErrorMessage) {
2332
+ timeoutErrorMessage = config.timeoutErrorMessage;
2333
+ }
2334
+ reject(new AxiosError(
2335
+ timeoutErrorMessage,
2336
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
2337
+ config,
2338
+ request));
2339
+
2340
+ // Clean up request
2341
+ request = null;
2342
+ };
2343
+
2344
+ // Add xsrf header
2345
+ // This is only done if running in a standard browser environment.
2346
+ // Specifically not if we're in a web worker, or react-native.
2347
+ if(platform$1.hasStandardBrowserEnv) {
2348
+ withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
2349
+
2350
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
2351
+ // Add xsrf header
2352
+ const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2353
+
2354
+ if (xsrfValue) {
2355
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2356
+ }
2357
+ }
2358
+ }
2359
+
2360
+ // Remove Content-Type if data is undefined
2361
+ requestData === undefined && requestHeaders.setContentType(null);
2362
+
2363
+ // Add headers to the request
2364
+ if ('setRequestHeader' in request) {
2365
+ utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2366
+ request.setRequestHeader(key, val);
2367
+ });
2368
+ }
2369
+
2370
+ // Add withCredentials to request if needed
2371
+ if (!utils.isUndefined(config.withCredentials)) {
2372
+ request.withCredentials = !!config.withCredentials;
2373
+ }
2374
+
2375
+ // Add responseType to request if needed
2376
+ if (responseType && responseType !== 'json') {
2377
+ request.responseType = config.responseType;
2378
+ }
2379
+
2380
+ // Handle progress if needed
2381
+ if (typeof config.onDownloadProgress === 'function') {
2382
+ request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
2383
+ }
2384
+
2385
+ // Not all browsers support upload events
2386
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
2387
+ request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
2388
+ }
2389
+
2390
+ if (config.cancelToken || config.signal) {
2391
+ // Handle cancellation
2392
+ // eslint-disable-next-line func-names
2393
+ onCanceled = cancel => {
2394
+ if (!request) {
2395
+ return;
2396
+ }
2397
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
2398
+ request.abort();
2399
+ request = null;
2400
+ };
2401
+
2402
+ config.cancelToken && config.cancelToken.subscribe(onCanceled);
2403
+ if (config.signal) {
2404
+ config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
2405
+ }
2406
+ }
2407
+
2408
+ const protocol = parseProtocol(fullPath);
2409
+
2410
+ if (protocol && platform$1.protocols.indexOf(protocol) === -1) {
2411
+ reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
2412
+ return;
2413
+ }
2414
+
2415
+
2416
+ // Send the request
2417
+ request.send(requestData || null);
2418
+ });
2419
+ };
2420
+
2421
+ const knownAdapters = {
2422
+ http: httpAdapter,
2423
+ xhr: xhrAdapter
2424
+ };
2425
+
2426
+ utils.forEach(knownAdapters, (fn, value) => {
2427
+ if (fn) {
2428
+ try {
2429
+ Object.defineProperty(fn, 'name', {value});
2430
+ } catch (e) {
2431
+ // eslint-disable-next-line no-empty
2432
+ }
2433
+ Object.defineProperty(fn, 'adapterName', {value});
2434
+ }
2435
+ });
2436
+
2437
+ const renderReason = (reason) => `- ${reason}`;
2438
+
2439
+ const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
2440
+
2441
+ var adapters = {
2442
+ getAdapter: (adapters) => {
2443
+ adapters = utils.isArray(adapters) ? adapters : [adapters];
2444
+
2445
+ const {length} = adapters;
2446
+ let nameOrAdapter;
2447
+ let adapter;
2448
+
2449
+ const rejectedReasons = {};
2450
+
2451
+ for (let i = 0; i < length; i++) {
2452
+ nameOrAdapter = adapters[i];
2453
+ let id;
2454
+
2455
+ adapter = nameOrAdapter;
2456
+
2457
+ if (!isResolvedHandle(nameOrAdapter)) {
2458
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
2459
+
2460
+ if (adapter === undefined) {
2461
+ throw new AxiosError(`Unknown adapter '${id}'`);
2462
+ }
2463
+ }
2464
+
2465
+ if (adapter) {
2466
+ break;
2467
+ }
2468
+
2469
+ rejectedReasons[id || '#' + i] = adapter;
2470
+ }
2471
+
2472
+ if (!adapter) {
2473
+
2474
+ const reasons = Object.entries(rejectedReasons)
2475
+ .map(([id, state]) => `adapter ${id} ` +
2476
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
2477
+ );
2478
+
2479
+ let s = length ?
2480
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
2481
+ 'as no adapter specified';
2482
+
2483
+ throw new AxiosError(
2484
+ `There is no suitable adapter to dispatch the request ` + s,
2485
+ 'ERR_NOT_SUPPORT'
2486
+ );
2487
+ }
2488
+
2489
+ return adapter;
2490
+ },
2491
+ adapters: knownAdapters
2492
+ };
2493
+
2494
+ /**
2495
+ * Throws a `CanceledError` if cancellation has been requested.
2496
+ *
2497
+ * @param {Object} config The config that is to be used for the request
2498
+ *
2499
+ * @returns {void}
2500
+ */
2501
+ function throwIfCancellationRequested(config) {
2502
+ if (config.cancelToken) {
2503
+ config.cancelToken.throwIfRequested();
2504
+ }
2505
+
2506
+ if (config.signal && config.signal.aborted) {
2507
+ throw new CanceledError(null, config);
2508
+ }
2509
+ }
2510
+
2511
+ /**
2512
+ * Dispatch a request to the server using the configured adapter.
2513
+ *
2514
+ * @param {object} config The config that is to be used for the request
2515
+ *
2516
+ * @returns {Promise} The Promise to be fulfilled
2517
+ */
2518
+ function dispatchRequest(config) {
2519
+ throwIfCancellationRequested(config);
2520
+
2521
+ config.headers = AxiosHeaders.from(config.headers);
2522
+
2523
+ // Transform request data
2524
+ config.data = transformData.call(
2525
+ config,
2526
+ config.transformRequest
2527
+ );
2528
+
2529
+ if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
2530
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
2531
+ }
2532
+
2533
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
2534
+
2535
+ return adapter(config).then(function onAdapterResolution(response) {
2536
+ throwIfCancellationRequested(config);
2537
+
2538
+ // Transform response data
2539
+ response.data = transformData.call(
2540
+ config,
2541
+ config.transformResponse,
2542
+ response
2543
+ );
2544
+
2545
+ response.headers = AxiosHeaders.from(response.headers);
2546
+
2547
+ return response;
2548
+ }, function onAdapterRejection(reason) {
2549
+ if (!isCancel(reason)) {
2550
+ throwIfCancellationRequested(config);
2551
+
2552
+ // Transform response data
2553
+ if (reason && reason.response) {
2554
+ reason.response.data = transformData.call(
2555
+ config,
2556
+ config.transformResponse,
2557
+ reason.response
2558
+ );
2559
+ reason.response.headers = AxiosHeaders.from(reason.response.headers);
2560
+ }
2561
+ }
2562
+
2563
+ return Promise.reject(reason);
2564
+ });
2565
+ }
2566
+
2567
+ const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
2568
+
2569
+ /**
2570
+ * Config-specific merge-function which creates a new config-object
2571
+ * by merging two configuration objects together.
2572
+ *
2573
+ * @param {Object} config1
2574
+ * @param {Object} config2
2575
+ *
2576
+ * @returns {Object} New object resulting from merging config2 to config1
2577
+ */
2578
+ function mergeConfig(config1, config2) {
2579
+ // eslint-disable-next-line no-param-reassign
2580
+ config2 = config2 || {};
2581
+ const config = {};
2582
+
2583
+ function getMergedValue(target, source, caseless) {
2584
+ if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
2585
+ return utils.merge.call({caseless}, target, source);
2586
+ } else if (utils.isPlainObject(source)) {
2587
+ return utils.merge({}, source);
2588
+ } else if (utils.isArray(source)) {
2589
+ return source.slice();
2590
+ }
2591
+ return source;
2592
+ }
2593
+
2594
+ // eslint-disable-next-line consistent-return
2595
+ function mergeDeepProperties(a, b, caseless) {
2596
+ if (!utils.isUndefined(b)) {
2597
+ return getMergedValue(a, b, caseless);
2598
+ } else if (!utils.isUndefined(a)) {
2599
+ return getMergedValue(undefined, a, caseless);
2600
+ }
2601
+ }
2602
+
2603
+ // eslint-disable-next-line consistent-return
2604
+ function valueFromConfig2(a, b) {
2605
+ if (!utils.isUndefined(b)) {
2606
+ return getMergedValue(undefined, b);
2607
+ }
2608
+ }
2609
+
2610
+ // eslint-disable-next-line consistent-return
2611
+ function defaultToConfig2(a, b) {
2612
+ if (!utils.isUndefined(b)) {
2613
+ return getMergedValue(undefined, b);
2614
+ } else if (!utils.isUndefined(a)) {
2615
+ return getMergedValue(undefined, a);
2616
+ }
2617
+ }
2618
+
2619
+ // eslint-disable-next-line consistent-return
2620
+ function mergeDirectKeys(a, b, prop) {
2621
+ if (prop in config2) {
2622
+ return getMergedValue(a, b);
2623
+ } else if (prop in config1) {
2624
+ return getMergedValue(undefined, a);
2625
+ }
2626
+ }
2627
+
2628
+ const mergeMap = {
2629
+ url: valueFromConfig2,
2630
+ method: valueFromConfig2,
2631
+ data: valueFromConfig2,
2632
+ baseURL: defaultToConfig2,
2633
+ transformRequest: defaultToConfig2,
2634
+ transformResponse: defaultToConfig2,
2635
+ paramsSerializer: defaultToConfig2,
2636
+ timeout: defaultToConfig2,
2637
+ timeoutMessage: defaultToConfig2,
2638
+ withCredentials: defaultToConfig2,
2639
+ withXSRFToken: defaultToConfig2,
2640
+ adapter: defaultToConfig2,
2641
+ responseType: defaultToConfig2,
2642
+ xsrfCookieName: defaultToConfig2,
2643
+ xsrfHeaderName: defaultToConfig2,
2644
+ onUploadProgress: defaultToConfig2,
2645
+ onDownloadProgress: defaultToConfig2,
2646
+ decompress: defaultToConfig2,
2647
+ maxContentLength: defaultToConfig2,
2648
+ maxBodyLength: defaultToConfig2,
2649
+ beforeRedirect: defaultToConfig2,
2650
+ transport: defaultToConfig2,
2651
+ httpAgent: defaultToConfig2,
2652
+ httpsAgent: defaultToConfig2,
2653
+ cancelToken: defaultToConfig2,
2654
+ socketPath: defaultToConfig2,
2655
+ responseEncoding: defaultToConfig2,
2656
+ validateStatus: mergeDirectKeys,
2657
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
2658
+ };
2659
+
2660
+ utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2661
+ const merge = mergeMap[prop] || mergeDeepProperties;
2662
+ const configValue = merge(config1[prop], config2[prop], prop);
2663
+ (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2664
+ });
2665
+
2666
+ return config;
2667
+ }
2668
+
2669
+ const VERSION = "1.6.8";
2670
+
2671
+ const validators = {};
2672
+
2673
+ // eslint-disable-next-line func-names
2674
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
2675
+ validators[type] = function validator(thing) {
2676
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
2677
+ };
2678
+ });
2679
+
2680
+ const deprecatedWarnings = {};
2681
+
2682
+ /**
2683
+ * Transitional option validator
2684
+ *
2685
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
2686
+ * @param {string?} version - deprecated version / removed since version
2687
+ * @param {string?} message - some message with additional info
2688
+ *
2689
+ * @returns {function}
2690
+ */
2691
+ validators.transitional = function transitional(validator, version, message) {
2692
+ function formatMessage(opt, desc) {
2693
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
2694
+ }
2695
+
2696
+ // eslint-disable-next-line func-names
2697
+ return (value, opt, opts) => {
2698
+ if (validator === false) {
2699
+ throw new AxiosError(
2700
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
2701
+ AxiosError.ERR_DEPRECATED
2702
+ );
2703
+ }
2704
+
2705
+ if (version && !deprecatedWarnings[opt]) {
2706
+ deprecatedWarnings[opt] = true;
2707
+ // eslint-disable-next-line no-console
2708
+ console.warn(
2709
+ formatMessage(
2710
+ opt,
2711
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
2712
+ )
2713
+ );
2714
+ }
2715
+
2716
+ return validator ? validator(value, opt, opts) : true;
2717
+ };
2718
+ };
2719
+
2720
+ /**
2721
+ * Assert object's properties type
2722
+ *
2723
+ * @param {object} options
2724
+ * @param {object} schema
2725
+ * @param {boolean?} allowUnknown
2726
+ *
2727
+ * @returns {object}
2728
+ */
2729
+
2730
+ function assertOptions(options, schema, allowUnknown) {
2731
+ if (typeof options !== 'object') {
2732
+ throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
2733
+ }
2734
+ const keys = Object.keys(options);
2735
+ let i = keys.length;
2736
+ while (i-- > 0) {
2737
+ const opt = keys[i];
2738
+ const validator = schema[opt];
2739
+ if (validator) {
2740
+ const value = options[opt];
2741
+ const result = value === undefined || validator(value, opt, options);
2742
+ if (result !== true) {
2743
+ throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
2744
+ }
2745
+ continue;
2746
+ }
2747
+ if (allowUnknown !== true) {
2748
+ throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
2749
+ }
2750
+ }
2751
+ }
2752
+
2753
+ var validator = {
2754
+ assertOptions,
2755
+ validators
2756
+ };
2757
+
2758
+ const validators$1 = validator.validators;
2759
+
2760
+ /**
2761
+ * Create a new instance of Axios
2762
+ *
2763
+ * @param {Object} instanceConfig The default config for the instance
2764
+ *
2765
+ * @return {Axios} A new instance of Axios
2766
+ */
2767
+ class Axios {
2768
+ constructor(instanceConfig) {
2769
+ this.defaults = instanceConfig;
2770
+ this.interceptors = {
2771
+ request: new InterceptorManager(),
2772
+ response: new InterceptorManager()
2773
+ };
2774
+ }
2775
+
2776
+ /**
2777
+ * Dispatch a request
2778
+ *
2779
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
2780
+ * @param {?Object} config
2781
+ *
2782
+ * @returns {Promise} The Promise to be fulfilled
2783
+ */
2784
+ async request(configOrUrl, config) {
2785
+ try {
2786
+ return await this._request(configOrUrl, config);
2787
+ } catch (err) {
2788
+ if (err instanceof Error) {
2789
+ let dummy;
2790
+
2791
+ Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
2792
+
2793
+ // slice off the Error: ... line
2794
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
2795
+
2796
+ if (!err.stack) {
2797
+ err.stack = stack;
2798
+ // match without the 2 top stack lines
2799
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
2800
+ err.stack += '\n' + stack;
2801
+ }
2802
+ }
2803
+
2804
+ throw err;
2805
+ }
2806
+ }
2807
+
2808
+ _request(configOrUrl, config) {
2809
+ /*eslint no-param-reassign:0*/
2810
+ // Allow for axios('example/url'[, config]) a la fetch API
2811
+ if (typeof configOrUrl === 'string') {
2812
+ config = config || {};
2813
+ config.url = configOrUrl;
2814
+ } else {
2815
+ config = configOrUrl || {};
2816
+ }
2817
+
2818
+ config = mergeConfig(this.defaults, config);
2819
+
2820
+ const {transitional, paramsSerializer, headers} = config;
2821
+
2822
+ if (transitional !== undefined) {
2823
+ validator.assertOptions(transitional, {
2824
+ silentJSONParsing: validators$1.transitional(validators$1.boolean),
2825
+ forcedJSONParsing: validators$1.transitional(validators$1.boolean),
2826
+ clarifyTimeoutError: validators$1.transitional(validators$1.boolean)
2827
+ }, false);
2828
+ }
2829
+
2830
+ if (paramsSerializer != null) {
2831
+ if (utils.isFunction(paramsSerializer)) {
2832
+ config.paramsSerializer = {
2833
+ serialize: paramsSerializer
2834
+ };
2835
+ } else {
2836
+ validator.assertOptions(paramsSerializer, {
2837
+ encode: validators$1.function,
2838
+ serialize: validators$1.function
2839
+ }, true);
2840
+ }
2841
+ }
2842
+
2843
+ // Set config.method
2844
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
2845
+
2846
+ // Flatten headers
2847
+ let contextHeaders = headers && utils.merge(
2848
+ headers.common,
2849
+ headers[config.method]
2850
+ );
2851
+
2852
+ headers && utils.forEach(
2853
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
2854
+ (method) => {
2855
+ delete headers[method];
2856
+ }
2857
+ );
2858
+
2859
+ config.headers = AxiosHeaders.concat(contextHeaders, headers);
2860
+
2861
+ // filter out skipped interceptors
2862
+ const requestInterceptorChain = [];
2863
+ let synchronousRequestInterceptors = true;
2864
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2865
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
2866
+ return;
2867
+ }
2868
+
2869
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
2870
+
2871
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2872
+ });
2873
+
2874
+ const responseInterceptorChain = [];
2875
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2876
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
2877
+ });
2878
+
2879
+ let promise;
2880
+ let i = 0;
2881
+ let len;
2882
+
2883
+ if (!synchronousRequestInterceptors) {
2884
+ const chain = [dispatchRequest.bind(this), undefined];
2885
+ chain.unshift.apply(chain, requestInterceptorChain);
2886
+ chain.push.apply(chain, responseInterceptorChain);
2887
+ len = chain.length;
2888
+
2889
+ promise = Promise.resolve(config);
2890
+
2891
+ while (i < len) {
2892
+ promise = promise.then(chain[i++], chain[i++]);
2893
+ }
2894
+
2895
+ return promise;
2896
+ }
2897
+
2898
+ len = requestInterceptorChain.length;
2899
+
2900
+ let newConfig = config;
2901
+
2902
+ i = 0;
2903
+
2904
+ while (i < len) {
2905
+ const onFulfilled = requestInterceptorChain[i++];
2906
+ const onRejected = requestInterceptorChain[i++];
2907
+ try {
2908
+ newConfig = onFulfilled(newConfig);
2909
+ } catch (error) {
2910
+ onRejected.call(this, error);
2911
+ break;
2912
+ }
2913
+ }
2914
+
2915
+ try {
2916
+ promise = dispatchRequest.call(this, newConfig);
2917
+ } catch (error) {
2918
+ return Promise.reject(error);
2919
+ }
2920
+
2921
+ i = 0;
2922
+ len = responseInterceptorChain.length;
2923
+
2924
+ while (i < len) {
2925
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
2926
+ }
2927
+
2928
+ return promise;
2929
+ }
2930
+
2931
+ getUri(config) {
2932
+ config = mergeConfig(this.defaults, config);
2933
+ const fullPath = buildFullPath(config.baseURL, config.url);
2934
+ return buildURL(fullPath, config.params, config.paramsSerializer);
2935
+ }
2936
+ }
2937
+
2938
+ // Provide aliases for supported request methods
2939
+ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2940
+ /*eslint func-names:0*/
2941
+ Axios.prototype[method] = function(url, config) {
2942
+ return this.request(mergeConfig(config || {}, {
2943
+ method,
2944
+ url,
2945
+ data: (config || {}).data
2946
+ }));
2947
+ };
2948
+ });
2949
+
2950
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2951
+ /*eslint func-names:0*/
2952
+
2953
+ function generateHTTPMethod(isForm) {
2954
+ return function httpMethod(url, data, config) {
2955
+ return this.request(mergeConfig(config || {}, {
2956
+ method,
2957
+ headers: isForm ? {
2958
+ 'Content-Type': 'multipart/form-data'
2959
+ } : {},
2960
+ url,
2961
+ data
2962
+ }));
2963
+ };
2964
+ }
2965
+
2966
+ Axios.prototype[method] = generateHTTPMethod();
2967
+
2968
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
2969
+ });
2970
+
2971
+ /**
2972
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
2973
+ *
2974
+ * @param {Function} executor The executor function.
2975
+ *
2976
+ * @returns {CancelToken}
2977
+ */
2978
+ class CancelToken {
2979
+ constructor(executor) {
2980
+ if (typeof executor !== 'function') {
2981
+ throw new TypeError('executor must be a function.');
2982
+ }
2983
+
2984
+ let resolvePromise;
2985
+
2986
+ this.promise = new Promise(function promiseExecutor(resolve) {
2987
+ resolvePromise = resolve;
2988
+ });
2989
+
2990
+ const token = this;
2991
+
2992
+ // eslint-disable-next-line func-names
2993
+ this.promise.then(cancel => {
2994
+ if (!token._listeners) return;
2995
+
2996
+ let i = token._listeners.length;
2997
+
2998
+ while (i-- > 0) {
2999
+ token._listeners[i](cancel);
3000
+ }
3001
+ token._listeners = null;
3002
+ });
3003
+
3004
+ // eslint-disable-next-line func-names
3005
+ this.promise.then = onfulfilled => {
3006
+ let _resolve;
3007
+ // eslint-disable-next-line func-names
3008
+ const promise = new Promise(resolve => {
3009
+ token.subscribe(resolve);
3010
+ _resolve = resolve;
3011
+ }).then(onfulfilled);
3012
+
3013
+ promise.cancel = function reject() {
3014
+ token.unsubscribe(_resolve);
3015
+ };
3016
+
3017
+ return promise;
3018
+ };
3019
+
3020
+ executor(function cancel(message, config, request) {
3021
+ if (token.reason) {
3022
+ // Cancellation has already been requested
3023
+ return;
3024
+ }
3025
+
3026
+ token.reason = new CanceledError(message, config, request);
3027
+ resolvePromise(token.reason);
3028
+ });
3029
+ }
3030
+
3031
+ /**
3032
+ * Throws a `CanceledError` if cancellation has been requested.
3033
+ */
3034
+ throwIfRequested() {
3035
+ if (this.reason) {
3036
+ throw this.reason;
3037
+ }
3038
+ }
3039
+
3040
+ /**
3041
+ * Subscribe to the cancel signal
3042
+ */
3043
+
3044
+ subscribe(listener) {
3045
+ if (this.reason) {
3046
+ listener(this.reason);
3047
+ return;
3048
+ }
3049
+
3050
+ if (this._listeners) {
3051
+ this._listeners.push(listener);
3052
+ } else {
3053
+ this._listeners = [listener];
3054
+ }
3055
+ }
3056
+
3057
+ /**
3058
+ * Unsubscribe from the cancel signal
3059
+ */
3060
+
3061
+ unsubscribe(listener) {
3062
+ if (!this._listeners) {
3063
+ return;
3064
+ }
3065
+ const index = this._listeners.indexOf(listener);
3066
+ if (index !== -1) {
3067
+ this._listeners.splice(index, 1);
3068
+ }
3069
+ }
3070
+
3071
+ /**
3072
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
3073
+ * cancels the `CancelToken`.
3074
+ */
3075
+ static source() {
3076
+ let cancel;
3077
+ const token = new CancelToken(function executor(c) {
3078
+ cancel = c;
3079
+ });
3080
+ return {
3081
+ token,
3082
+ cancel
3083
+ };
3084
+ }
3085
+ }
3086
+
3087
+ /**
3088
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
3089
+ *
3090
+ * Common use case would be to use `Function.prototype.apply`.
3091
+ *
3092
+ * ```js
3093
+ * function f(x, y, z) {}
3094
+ * var args = [1, 2, 3];
3095
+ * f.apply(null, args);
3096
+ * ```
3097
+ *
3098
+ * With `spread` this example can be re-written.
3099
+ *
3100
+ * ```js
3101
+ * spread(function(x, y, z) {})([1, 2, 3]);
3102
+ * ```
3103
+ *
3104
+ * @param {Function} callback
3105
+ *
3106
+ * @returns {Function}
3107
+ */
3108
+ function spread(callback) {
3109
+ return function wrap(arr) {
3110
+ return callback.apply(null, arr);
3111
+ };
3112
+ }
3113
+
3114
+ /**
3115
+ * Determines whether the payload is an error thrown by Axios
3116
+ *
3117
+ * @param {*} payload The value to test
3118
+ *
3119
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3120
+ */
3121
+ function isAxiosError(payload) {
3122
+ return utils.isObject(payload) && (payload.isAxiosError === true);
3123
+ }
3124
+
3125
+ const HttpStatusCode = {
3126
+ Continue: 100,
3127
+ SwitchingProtocols: 101,
3128
+ Processing: 102,
3129
+ EarlyHints: 103,
3130
+ Ok: 200,
3131
+ Created: 201,
3132
+ Accepted: 202,
3133
+ NonAuthoritativeInformation: 203,
3134
+ NoContent: 204,
3135
+ ResetContent: 205,
3136
+ PartialContent: 206,
3137
+ MultiStatus: 207,
3138
+ AlreadyReported: 208,
3139
+ ImUsed: 226,
3140
+ MultipleChoices: 300,
3141
+ MovedPermanently: 301,
3142
+ Found: 302,
3143
+ SeeOther: 303,
3144
+ NotModified: 304,
3145
+ UseProxy: 305,
3146
+ Unused: 306,
3147
+ TemporaryRedirect: 307,
3148
+ PermanentRedirect: 308,
3149
+ BadRequest: 400,
3150
+ Unauthorized: 401,
3151
+ PaymentRequired: 402,
3152
+ Forbidden: 403,
3153
+ NotFound: 404,
3154
+ MethodNotAllowed: 405,
3155
+ NotAcceptable: 406,
3156
+ ProxyAuthenticationRequired: 407,
3157
+ RequestTimeout: 408,
3158
+ Conflict: 409,
3159
+ Gone: 410,
3160
+ LengthRequired: 411,
3161
+ PreconditionFailed: 412,
3162
+ PayloadTooLarge: 413,
3163
+ UriTooLong: 414,
3164
+ UnsupportedMediaType: 415,
3165
+ RangeNotSatisfiable: 416,
3166
+ ExpectationFailed: 417,
3167
+ ImATeapot: 418,
3168
+ MisdirectedRequest: 421,
3169
+ UnprocessableEntity: 422,
3170
+ Locked: 423,
3171
+ FailedDependency: 424,
3172
+ TooEarly: 425,
3173
+ UpgradeRequired: 426,
3174
+ PreconditionRequired: 428,
3175
+ TooManyRequests: 429,
3176
+ RequestHeaderFieldsTooLarge: 431,
3177
+ UnavailableForLegalReasons: 451,
3178
+ InternalServerError: 500,
3179
+ NotImplemented: 501,
3180
+ BadGateway: 502,
3181
+ ServiceUnavailable: 503,
3182
+ GatewayTimeout: 504,
3183
+ HttpVersionNotSupported: 505,
3184
+ VariantAlsoNegotiates: 506,
3185
+ InsufficientStorage: 507,
3186
+ LoopDetected: 508,
3187
+ NotExtended: 510,
3188
+ NetworkAuthenticationRequired: 511,
3189
+ };
3190
+
3191
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
3192
+ HttpStatusCode[value] = key;
3193
+ });
3194
+
3195
+ /**
3196
+ * Create an instance of Axios
3197
+ *
3198
+ * @param {Object} defaultConfig The default config for the instance
3199
+ *
3200
+ * @returns {Axios} A new instance of Axios
3201
+ */
3202
+ function createInstance(defaultConfig) {
3203
+ const context = new Axios(defaultConfig);
3204
+ const instance = bind(Axios.prototype.request, context);
3205
+
3206
+ // Copy axios.prototype to instance
3207
+ utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
3208
+
3209
+ // Copy context to instance
3210
+ utils.extend(instance, context, null, {allOwnKeys: true});
3211
+
3212
+ // Factory for creating new instances
3213
+ instance.create = function create(instanceConfig) {
3214
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
3215
+ };
3216
+
3217
+ return instance;
3218
+ }
3219
+
3220
+ // Create the default instance to be exported
3221
+ const axios = createInstance(defaults);
3222
+
3223
+ // Expose Axios class to allow class inheritance
3224
+ axios.Axios = Axios;
3225
+
3226
+ // Expose Cancel & CancelToken
3227
+ axios.CanceledError = CanceledError;
3228
+ axios.CancelToken = CancelToken;
3229
+ axios.isCancel = isCancel;
3230
+ axios.VERSION = VERSION;
3231
+ axios.toFormData = toFormData;
3232
+
3233
+ // Expose AxiosError class
3234
+ axios.AxiosError = AxiosError;
3235
+
3236
+ // alias for CanceledError for backward compatibility
3237
+ axios.Cancel = axios.CanceledError;
3238
+
3239
+ // Expose all/spread
3240
+ axios.all = function all(promises) {
3241
+ return Promise.all(promises);
3242
+ };
3243
+
3244
+ axios.spread = spread;
3245
+
3246
+ // Expose isAxiosError
3247
+ axios.isAxiosError = isAxiosError;
3248
+
3249
+ // Expose mergeConfig
3250
+ axios.mergeConfig = mergeConfig;
3251
+
3252
+ axios.AxiosHeaders = AxiosHeaders;
3253
+
3254
+ axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
3255
+
3256
+ axios.getAdapter = adapters.getAdapter;
3257
+
3258
+ axios.HttpStatusCode = HttpStatusCode;
3259
+
3260
+ axios.default = axios;
3261
+
26
3262
  var baseUrls = {
27
3263
  inference: 'https://inference.dev.bibot.thespuka.com/v0'
28
3264
  };
@@ -41,8 +3277,7 @@ var resources;
41
3277
  (function (resources) {
42
3278
  resources["chatBubble"] = "/chat-bubble-config";
43
3279
  resources["predefinedQ"] = "/predefined-q";
44
- resources["localQ"] = "/local-q";
45
- resources["timedOutLocalQ"] = "/t-local-q";
3280
+ resources["timeoutQ"] = "/timeout-q";
46
3281
  resources["q"] = "/q";
47
3282
  })(resources || (resources = {}));
48
3283
 
@@ -351,7 +3586,7 @@ var askBiBot = function askBiBot(data) {
351
3586
  var askTimedOutBiBot = function askTimedOutBiBot(data) {
352
3587
  try {
353
3588
  return Promise.resolve(_catch(function () {
354
- var path = "" + domain.bibot + resources.timedOutLocalQ;
3589
+ var path = "" + domain.inference + resources.timeoutQ;
355
3590
  return Promise.resolve(pluginAxiosInstance.post(path, data)).then(function (response) {
356
3591
  console.log(response);
357
3592
  return response.data.message;
@@ -400,7 +3635,7 @@ var useBiBotChatBot = function useBiBotChatBot(_ref) {
400
3635
  if (_temp2 && _temp2.then) return _temp2.then(function () {});
401
3636
  }, function (error) {
402
3637
  var _error$message;
403
- void antd.message.error((_error$message = error === null || error === void 0 ? void 0 : error.message) != null ? _error$message : 'Failed to get response from server');
3638
+ void error((_error$message = error === null || error === void 0 ? void 0 : error.message) != null ? _error$message : 'Failed to get response from server');
404
3639
  });
405
3640
  }, function (_wasThrown, _result) {
406
3641
  setIsLoading(false);
@@ -507,7 +3742,169 @@ var useBiBotChatBot = function useBiBotChatBot(_ref) {
507
3742
  };
508
3743
  };
509
3744
 
510
- var styles = {"chat-bubble":"_2jyN5","chat-toggle":"_tXNYe","chat-window":"_1P2y-","chat-header":"_2UNL5","message-list":"_2v5bZ","message":"_2RbY_","user":"_1efWC","bot":"_2idRy","loader":"_3qqrl","l5":"_3cq86","input-area":"_34vFI","loading-bubbles":"_1kl6z","bubble":"_3cleF","bounce":"_UNzJX"};
3745
+ var styles = {"chat-bubble":"_31at8","chat-toggle":"_1tkAI","chat-window":"_2vdWr","chat-header":"_1ngBE","message-list":"_27MrF","message":"_3XbXj","user":"_3l8QX","bot":"_1MqZg","loader":"_3mrL1","l5":"_25GkQ","input-area":"_6V_kl","loading-bubbles":"_1XTQS","bubble":"_32ZvK","bounce":"_V8DEW"};
3746
+
3747
+ function SendMessageIcon() {
3748
+ return React__default.createElement("svg", {
3749
+ xmlns: 'http://www.w3.org/2000/svg',
3750
+ className: 'icon icon-tabler icon-tabler-send-2',
3751
+ width: '24',
3752
+ height: '24',
3753
+ viewBox: '0 0 24 24',
3754
+ "stroke-width": '1.5',
3755
+ stroke: '#2c3e50',
3756
+ fill: 'none',
3757
+ "stroke-linecap": 'round',
3758
+ "stroke-linejoin": 'round'
3759
+ }, React__default.createElement("path", {
3760
+ stroke: 'none',
3761
+ d: 'M0 0h24v24H0z',
3762
+ fill: 'none'
3763
+ }), React__default.createElement("path", {
3764
+ d: 'M4.698 4.034l16.302 7.966l-16.302 7.966a.503 .503 0 0 1 -.546 -.124a.555 .555 0 0 1 -.12 -.568l2.468 -7.274l-2.468 -7.274a.555 .555 0 0 1 .12 -.568a.503 .503 0 0 1 .546 -.124z'
3765
+ }), React__default.createElement("path", {
3766
+ d: 'M6.5 12h14.5'
3767
+ }));
3768
+ }
3769
+ function DefaultBotProfile() {
3770
+ return React__default.createElement("svg", {
3771
+ xmlns: 'http://www.w3.org/2000/svg',
3772
+ className: 'icon icon-tabler icon-tabler-robot-face',
3773
+ width: '24',
3774
+ height: '24',
3775
+ viewBox: '0 0 24 24',
3776
+ "stroke-width": '1.5',
3777
+ stroke: '#fff',
3778
+ fill: 'none',
3779
+ "stroke-linecap": 'round',
3780
+ "stroke-linejoin": 'round'
3781
+ }, React__default.createElement("path", {
3782
+ stroke: 'none',
3783
+ d: 'M0 0h24v24H0z',
3784
+ fill: 'none'
3785
+ }), React__default.createElement("path", {
3786
+ d: 'M6 5h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2z'
3787
+ }), React__default.createElement("path", {
3788
+ d: 'M9 16c1 .667 2 1 3 1s2 -.333 3 -1'
3789
+ }), React__default.createElement("path", {
3790
+ d: 'M9 7l-1 -4'
3791
+ }), React__default.createElement("path", {
3792
+ d: 'M15 7l1 -4'
3793
+ }), React__default.createElement("path", {
3794
+ d: 'M9 12v-1'
3795
+ }), React__default.createElement("path", {
3796
+ d: 'M15 12v-1'
3797
+ }));
3798
+ }
3799
+ function ChatIcon() {
3800
+ return React__default.createElement("svg", {
3801
+ xmlns: 'http://www.w3.org/2000/svg',
3802
+ className: 'icon icon-tabler icon-tabler-message-dots',
3803
+ width: '40',
3804
+ height: '40',
3805
+ viewBox: '0 0 24 24',
3806
+ "stroke-width": '1.5',
3807
+ stroke: '#fff',
3808
+ fill: 'none',
3809
+ "stroke-linecap": 'round',
3810
+ "stroke-linejoin": 'round'
3811
+ }, React__default.createElement("path", {
3812
+ stroke: 'none',
3813
+ d: 'M0 0h24v24H0z',
3814
+ fill: 'none'
3815
+ }), React__default.createElement("path", {
3816
+ d: 'M4 21v-13a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v6a3 3 0 0 1 -3 3h-9l-4 4'
3817
+ }), React__default.createElement("path", {
3818
+ d: 'M12 11l0 .01'
3819
+ }), React__default.createElement("path", {
3820
+ d: 'M8 11l0 .01'
3821
+ }), React__default.createElement("path", {
3822
+ d: 'M16 11l0 .01'
3823
+ }));
3824
+ }
3825
+ function CloseIcon() {
3826
+ return React__default.createElement("svg", {
3827
+ xmlns: "http://www.w3.org/2000/svg",
3828
+ className: "icon icon-tabler icon-tabler-x",
3829
+ width: "40",
3830
+ height: "40",
3831
+ viewBox: "0 0 24 24",
3832
+ "stroke-width": "1.5",
3833
+ stroke: "#fff",
3834
+ fill: "none",
3835
+ "stroke-linecap": "round",
3836
+ "stroke-linejoin": "round"
3837
+ }, React__default.createElement("path", {
3838
+ stroke: "none",
3839
+ d: "M0 0h24v24H0z",
3840
+ fill: "none"
3841
+ }), React__default.createElement("path", {
3842
+ d: "M18 6l-12 12"
3843
+ }), React__default.createElement("path", {
3844
+ d: "M6 6l12 12"
3845
+ }));
3846
+ }
3847
+
3848
+ var Avatar = function Avatar(_ref) {
3849
+ var source = _ref.source,
3850
+ height = _ref.height,
3851
+ width = _ref.width,
3852
+ indicator = _ref.indicator;
3853
+ return React__default.createElement("div", {
3854
+ style: {
3855
+ width: width
3856
+ }
3857
+ }, React__default.createElement("div", {
3858
+ style: {
3859
+ backgroundColor: 'transparent',
3860
+ border: '1px solid #dedede',
3861
+ height: height,
3862
+ width: width,
3863
+ borderRadius: '50%',
3864
+ overflow: 'hidden',
3865
+ display: 'flex',
3866
+ justifyContent: 'flex-end',
3867
+ flexDirection: 'column',
3868
+ alignItems: 'flex-end'
3869
+ }
3870
+ }, source ? React__default.createElement("img", {
3871
+ style: {
3872
+ width: '100%',
3873
+ height: '100%',
3874
+ objectFit: 'cover'
3875
+ },
3876
+ src: source,
3877
+ alt: 'Profile'
3878
+ }) : React__default.createElement(DefaultBotProfile, null), React__default.createElement("div", {
3879
+ style: {
3880
+ width: 12,
3881
+ height: 12,
3882
+ backgroundColor: indicator,
3883
+ position: 'fixed',
3884
+ display: 'flex',
3885
+ flexDirection: 'column',
3886
+ borderRadius: '50%'
3887
+ }
3888
+ })));
3889
+ };
3890
+
3891
+ var useOnlineStatus = function useOnlineStatus() {
3892
+ var _useState = React.useState(navigator.onLine),
3893
+ isOnline = _useState[0],
3894
+ setIsOnline = _useState[1];
3895
+ var updateOnlineStatus = function updateOnlineStatus() {
3896
+ setIsOnline(navigator.onLine);
3897
+ };
3898
+ React.useEffect(function () {
3899
+ window.addEventListener('online', updateOnlineStatus);
3900
+ window.addEventListener('offline', updateOnlineStatus);
3901
+ return function () {
3902
+ window.removeEventListener('online', updateOnlineStatus);
3903
+ window.removeEventListener('offline', updateOnlineStatus);
3904
+ };
3905
+ }, []);
3906
+ return isOnline;
3907
+ };
511
3908
 
512
3909
  var PredefinedQuestions = function PredefinedQuestions(_ref) {
513
3910
  var questions = _ref.questions,
@@ -543,6 +3940,7 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
543
3940
  showPredefinedQuestions = _useBiBotChatBot.showPredefinedQuestions,
544
3941
  predefinedQuestions = _useBiBotChatBot.predefinedQuestions,
545
3942
  handlePredefinedQuestionSelect = _useBiBotChatBot.handlePredefinedQuestionSelect;
3943
+ var isOnline = useOnlineStatus();
546
3944
  return React.createElement("div", {
547
3945
  className: "chat-bubble " + (chatIsOpen ? 'open' : ''),
548
3946
  style: {
@@ -552,9 +3950,9 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
552
3950
  zIndex: 9999
553
3951
  }
554
3952
  }, chatIsOpen && React.createElement("div", {
555
- className: styles["chat-window"],
3953
+ className: styles['chat-window'],
556
3954
  style: {
557
- backgroundColor: '#fff',
3955
+ backgroundColor: '#dfdfdf',
558
3956
  position: 'absolute',
559
3957
  bottom: '50px',
560
3958
  right: '25px',
@@ -563,21 +3961,20 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
563
3961
  borderRadius: 10,
564
3962
  display: 'flex',
565
3963
  flexDirection: 'column',
566
- justifyContent: 'space-between',
567
- border: '2px solid #dedede'
3964
+ justifyContent: 'space-between'
568
3965
  }
569
3966
  }, React.createElement("div", {
570
- className: styles["chat-header"],
3967
+ className: styles['chat-header'],
571
3968
  style: {
572
3969
  backgroundColor: (_chatBubbleConfig$col = chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color) != null ? _chatBubbleConfig$col : '#dedede',
573
- height: '50px',
3970
+ height: 50,
574
3971
  borderTopLeftRadius: 8,
575
3972
  borderTopRightRadius: 8,
576
3973
  display: 'flex',
577
3974
  alignItems: 'center',
578
3975
  justifyContent: 'flex-start',
579
3976
  paddingInline: 15,
580
- paddingBlock: 30
3977
+ paddingBlock: 10
581
3978
  }
582
3979
  }, React.createElement("div", {
583
3980
  style: {
@@ -586,17 +3983,12 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
586
3983
  color: '#fff',
587
3984
  fontWeight: 'bold'
588
3985
  }
589
- }, React.createElement(core.Indicator, {
590
- inline: true,
591
- size: 12,
592
- offset: 7,
593
- position: "bottom-end",
594
- color: 'green'
595
- }, React.createElement(core.Avatar, {
596
- color: "white",
597
- src: chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.logo_url,
598
- alt: "profile"
599
- }))), React.createElement("div", {
3986
+ }, React.createElement(Avatar, {
3987
+ indicator: isOnline ? 'green' : '#dedede',
3988
+ width: '40px',
3989
+ height: '40px',
3990
+ source: chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.logo_url
3991
+ })), React.createElement("div", {
600
3992
  style: {
601
3993
  display: 'flex',
602
3994
  flexDirection: 'column',
@@ -607,20 +3999,21 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
607
3999
  }
608
4000
  }, React.createElement("span", {
609
4001
  style: {
610
- fontWeight: 'bold'
4002
+ fontWeight: 'bold',
4003
+ fontSize: 18
611
4004
  }
612
4005
  }, chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.title), isLoading ? React.createElement("span", {
613
4006
  style: {
614
4007
  fontSize: '12px',
615
- lineHeight: '0.5'
4008
+ lineHeight: '0.9'
616
4009
  }
617
4010
  }, "Typing...") : React.createElement("span", {
618
4011
  style: {
619
4012
  fontSize: '12px',
620
- lineHeight: '0.5'
4013
+ lineHeight: '0.9'
621
4014
  }
622
- }, 'Online'))), React.createElement("div", {
623
- className: styles["message-list"],
4015
+ }, isOnline ? 'Online' : 'Offline'))), React.createElement("div", {
4016
+ className: styles['message-list'],
624
4017
  style: {
625
4018
  height: 'calc(100% - 100px)',
626
4019
  overflowY: 'auto',
@@ -649,11 +4042,10 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
649
4042
  style: {
650
4043
  display: 'flex'
651
4044
  }
652
- }, React.createElement(core.Avatar, {
653
- color: "white",
654
- src: chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.logo_url,
655
- size: 25,
656
- alt: "profile"
4045
+ }, React.createElement(Avatar, {
4046
+ width: '20px',
4047
+ height: '20px',
4048
+ source: chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.logo_url
657
4049
  }), React.createElement("div", {
658
4050
  className: "message " + message.sender,
659
4051
  style: {
@@ -676,19 +4068,20 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
676
4068
  marginLeft: '20px'
677
4069
  },
678
4070
  className: 'message'
679
- }, " ", React.createElement("div", {
680
- className: "loader"
681
- }), " "), React.createElement("div", {
4071
+ }, ' ', React.createElement("div", {
4072
+ className: 'loader'
4073
+ }), ' '), React.createElement("div", {
682
4074
  ref: messageEndRef
683
4075
  })), React.createElement("div", {
684
- className: styles["input-area"],
4076
+ className: styles['input-area'],
685
4077
  style: {
686
4078
  display: 'flex',
687
4079
  alignItems: 'center',
688
- borderTop: '1px solid #ddd',
4080
+ borderTop: '1px solid #dedede',
689
4081
  padding: 10,
690
4082
  borderBottomLeftRadius: 8,
691
- borderBottomRightRadius: 8
4083
+ borderBottomRightRadius: 8,
4084
+ backgroundColor: '#fff'
692
4085
  }
693
4086
  }, React.createElement("input", {
694
4087
  style: {
@@ -697,57 +4090,47 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
697
4090
  border: 'none',
698
4091
  backgroundColor: 'transparent',
699
4092
  padding: '5px 10px',
700
- marginRight: 10
4093
+ marginRight: 10,
4094
+ fontSize: 16
701
4095
  },
702
4096
  autoFocus: true,
703
- type: "text",
4097
+ type: 'text',
704
4098
  value: userInput,
705
4099
  onChange: handleUserInput,
706
4100
  onKeyDown: handleKeyPress,
707
- placeholder: "Ask a question"
708
- }), React.createElement(antd.Button, {
4101
+ placeholder: 'Ask a question'
4102
+ }), React.createElement("button", {
709
4103
  disabled: isLoading != null ? isLoading : true,
710
4104
  style: {
711
4105
  backgroundColor: 'transparent',
712
- color: isLoading ? '#dedede' : chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color
4106
+ color: isLoading ? '#dedede' : chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color,
4107
+ border: 'none',
4108
+ cursor: 'pointer'
713
4109
  },
714
- size: 'middle',
715
- icon: React.createElement(iconsMaterial.SendRounded, null),
716
4110
  onClick: sendInputInquiry
717
- }))), React.createElement(antd.Button, {
718
- type: 'link',
4111
+ }, React.createElement(SendMessageIcon, null)))), React.createElement("button", {
719
4112
  onClick: toggleChat,
720
- className: styles["chat-toggle"],
4113
+ className: styles['chat-toggle'],
721
4114
  style: {
722
4115
  backgroundColor: (_chatBubbleConfig$col2 = chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color) != null ? _chatBubbleConfig$col2 : '#dedede',
723
4116
  color: '#fff',
724
4117
  borderRadius: '50%',
4118
+ cursor: 'pointer',
725
4119
  width: '60px',
726
4120
  height: '60px',
727
4121
  display: 'flex',
728
4122
  alignItems: 'center',
729
- justifyContent: 'center'
730
- }
731
- }, chatIsOpen ? React.createElement(iconsMaterial.Close, {
732
- style: {
733
- width: 30,
734
- height: 30,
735
- color: '#fff'
736
- }
737
- }) : React.createElement(ChatIcon, {
738
- style: {
739
- width: 30,
740
- height: 30,
741
- color: '#fff'
4123
+ justifyContent: 'center',
4124
+ border: 'none'
742
4125
  }
743
- })));
4126
+ }, chatIsOpen ? React.createElement(CloseIcon, null) : React.createElement(ChatIcon, null)));
744
4127
  };
745
4128
 
746
4129
  var BiBot = function BiBot(_ref) {
747
4130
  var clientId = _ref.clientId;
748
- return React.createElement(AppProvider, null, React.createElement(core.MantineProvider, null, React.createElement(ChatBubbleBiBot, {
4131
+ return React.createElement(AppProvider, null, React.createElement(ChatBubbleBiBot, {
749
4132
  clientId: clientId
750
- })));
4133
+ }));
751
4134
  };
752
4135
 
753
4136
  exports.BiBot = BiBot;