@ones-open/node-sdk 0.0.2 → 0.0.4-16596.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +10 -2948
  2. package/dist/index.js +7 -2945
  3. package/package.json +2 -2
package/dist/index.cjs CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const _defineProperty = require("@babel/runtime-corejs3/helpers/defineProperty");
4
+ const lodashEs = require("lodash-es");
5
+ const Fetch = require("axios");
4
6
  const _sortInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/sort");
5
7
  const getPlatformApiHost = () => {
6
8
  return "platformApiHost";
@@ -109,2946 +111,6 @@ const WhereConditions = {
109
111
  };
110
112
  }
111
113
  };
112
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
113
- const freeGlobal$1 = freeGlobal;
114
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
115
- var root = freeGlobal$1 || freeSelf || Function("return this")();
116
- const root$1 = root;
117
- var Symbol$1 = root$1.Symbol;
118
- const Symbol$2 = Symbol$1;
119
- var objectProto$5 = Object.prototype;
120
- var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
121
- var nativeObjectToString$1 = objectProto$5.toString;
122
- var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
123
- function getRawTag(value) {
124
- var isOwn = hasOwnProperty$5.call(value, symToStringTag$1), tag = value[symToStringTag$1];
125
- try {
126
- value[symToStringTag$1] = void 0;
127
- var unmasked = true;
128
- } catch (e) {
129
- }
130
- var result = nativeObjectToString$1.call(value);
131
- if (unmasked) {
132
- if (isOwn) {
133
- value[symToStringTag$1] = tag;
134
- } else {
135
- delete value[symToStringTag$1];
136
- }
137
- }
138
- return result;
139
- }
140
- var objectProto$4 = Object.prototype;
141
- var nativeObjectToString = objectProto$4.toString;
142
- function objectToString(value) {
143
- return nativeObjectToString.call(value);
144
- }
145
- var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
146
- var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
147
- function baseGetTag(value) {
148
- if (value == null) {
149
- return value === void 0 ? undefinedTag : nullTag;
150
- }
151
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
152
- }
153
- function isObjectLike(value) {
154
- return value != null && typeof value == "object";
155
- }
156
- var symbolTag = "[object Symbol]";
157
- function isSymbol(value) {
158
- return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
159
- }
160
- function arrayMap(array, iteratee) {
161
- var index2 = -1, length = array == null ? 0 : array.length, result = Array(length);
162
- while (++index2 < length) {
163
- result[index2] = iteratee(array[index2], index2, array);
164
- }
165
- return result;
166
- }
167
- var isArray$1 = Array.isArray;
168
- const isArray$2 = isArray$1;
169
- var INFINITY$1 = 1 / 0;
170
- var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
171
- function baseToString(value) {
172
- if (typeof value == "string") {
173
- return value;
174
- }
175
- if (isArray$2(value)) {
176
- return arrayMap(value, baseToString) + "";
177
- }
178
- if (isSymbol(value)) {
179
- return symbolToString ? symbolToString.call(value) : "";
180
- }
181
- var result = value + "";
182
- return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
183
- }
184
- function isObject$1(value) {
185
- var type = typeof value;
186
- return value != null && (type == "object" || type == "function");
187
- }
188
- var asyncTag = "[object AsyncFunction]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
189
- function isFunction$2(value) {
190
- if (!isObject$1(value)) {
191
- return false;
192
- }
193
- var tag = baseGetTag(value);
194
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
195
- }
196
- var coreJsData = root$1["__core-js_shared__"];
197
- const coreJsData$1 = coreJsData;
198
- var maskSrcKey = function() {
199
- var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
200
- return uid ? "Symbol(src)_1." + uid : "";
201
- }();
202
- function isMasked(func) {
203
- return !!maskSrcKey && maskSrcKey in func;
204
- }
205
- var funcProto$1 = Function.prototype;
206
- var funcToString$1 = funcProto$1.toString;
207
- function toSource(func) {
208
- if (func != null) {
209
- try {
210
- return funcToString$1.call(func);
211
- } catch (e) {
212
- }
213
- try {
214
- return func + "";
215
- } catch (e) {
216
- }
217
- }
218
- return "";
219
- }
220
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
221
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
222
- var funcProto = Function.prototype, objectProto$3 = Object.prototype;
223
- var funcToString = funcProto.toString;
224
- var hasOwnProperty$4 = objectProto$3.hasOwnProperty;
225
- var reIsNative = RegExp(
226
- "^" + funcToString.call(hasOwnProperty$4).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
227
- );
228
- function baseIsNative(value) {
229
- if (!isObject$1(value) || isMasked(value)) {
230
- return false;
231
- }
232
- var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
233
- return pattern.test(toSource(value));
234
- }
235
- function getValue(object2, key) {
236
- return object2 == null ? void 0 : object2[key];
237
- }
238
- function getNative(object2, key) {
239
- var value = getValue(object2, key);
240
- return baseIsNative(value) ? value : void 0;
241
- }
242
- var defineProperty = function() {
243
- try {
244
- var func = getNative(Object, "defineProperty");
245
- func({}, "", {});
246
- return func;
247
- } catch (e) {
248
- }
249
- }();
250
- const defineProperty$1 = defineProperty;
251
- var MAX_SAFE_INTEGER = 9007199254740991;
252
- var reIsUint = /^(?:0|[1-9]\d*)$/;
253
- function isIndex(value, length) {
254
- var type = typeof value;
255
- length = length == null ? MAX_SAFE_INTEGER : length;
256
- return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
257
- }
258
- function baseAssignValue(object2, key, value) {
259
- if (key == "__proto__" && defineProperty$1) {
260
- defineProperty$1(object2, key, {
261
- "configurable": true,
262
- "enumerable": true,
263
- "value": value,
264
- "writable": true
265
- });
266
- } else {
267
- object2[key] = value;
268
- }
269
- }
270
- function eq(value, other) {
271
- return value === other || value !== value && other !== other;
272
- }
273
- var objectProto$2 = Object.prototype;
274
- var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
275
- function assignValue(object2, key, value) {
276
- var objValue = object2[key];
277
- if (!(hasOwnProperty$3.call(object2, key) && eq(objValue, value)) || value === void 0 && !(key in object2)) {
278
- baseAssignValue(object2, key, value);
279
- }
280
- }
281
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
282
- function isKey(value, object2) {
283
- if (isArray$2(value)) {
284
- return false;
285
- }
286
- var type = typeof value;
287
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
288
- return true;
289
- }
290
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object2 != null && value in Object(object2);
291
- }
292
- var nativeCreate = getNative(Object, "create");
293
- const nativeCreate$1 = nativeCreate;
294
- function hashClear() {
295
- this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
296
- this.size = 0;
297
- }
298
- function hashDelete(key) {
299
- var result = this.has(key) && delete this.__data__[key];
300
- this.size -= result ? 1 : 0;
301
- return result;
302
- }
303
- var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
304
- var objectProto$1 = Object.prototype;
305
- var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
306
- function hashGet(key) {
307
- var data = this.__data__;
308
- if (nativeCreate$1) {
309
- var result = data[key];
310
- return result === HASH_UNDEFINED$1 ? void 0 : result;
311
- }
312
- return hasOwnProperty$2.call(data, key) ? data[key] : void 0;
313
- }
314
- var objectProto = Object.prototype;
315
- var hasOwnProperty$1 = objectProto.hasOwnProperty;
316
- function hashHas(key) {
317
- var data = this.__data__;
318
- return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$1.call(data, key);
319
- }
320
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
321
- function hashSet(key, value) {
322
- var data = this.__data__;
323
- this.size += this.has(key) ? 0 : 1;
324
- data[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED : value;
325
- return this;
326
- }
327
- function Hash(entries) {
328
- var index2 = -1, length = entries == null ? 0 : entries.length;
329
- this.clear();
330
- while (++index2 < length) {
331
- var entry = entries[index2];
332
- this.set(entry[0], entry[1]);
333
- }
334
- }
335
- Hash.prototype.clear = hashClear;
336
- Hash.prototype["delete"] = hashDelete;
337
- Hash.prototype.get = hashGet;
338
- Hash.prototype.has = hashHas;
339
- Hash.prototype.set = hashSet;
340
- function listCacheClear() {
341
- this.__data__ = [];
342
- this.size = 0;
343
- }
344
- function assocIndexOf(array, key) {
345
- var length = array.length;
346
- while (length--) {
347
- if (eq(array[length][0], key)) {
348
- return length;
349
- }
350
- }
351
- return -1;
352
- }
353
- var arrayProto = Array.prototype;
354
- var splice = arrayProto.splice;
355
- function listCacheDelete(key) {
356
- var data = this.__data__, index2 = assocIndexOf(data, key);
357
- if (index2 < 0) {
358
- return false;
359
- }
360
- var lastIndex = data.length - 1;
361
- if (index2 == lastIndex) {
362
- data.pop();
363
- } else {
364
- splice.call(data, index2, 1);
365
- }
366
- --this.size;
367
- return true;
368
- }
369
- function listCacheGet(key) {
370
- var data = this.__data__, index2 = assocIndexOf(data, key);
371
- return index2 < 0 ? void 0 : data[index2][1];
372
- }
373
- function listCacheHas(key) {
374
- return assocIndexOf(this.__data__, key) > -1;
375
- }
376
- function listCacheSet(key, value) {
377
- var data = this.__data__, index2 = assocIndexOf(data, key);
378
- if (index2 < 0) {
379
- ++this.size;
380
- data.push([key, value]);
381
- } else {
382
- data[index2][1] = value;
383
- }
384
- return this;
385
- }
386
- function ListCache(entries) {
387
- var index2 = -1, length = entries == null ? 0 : entries.length;
388
- this.clear();
389
- while (++index2 < length) {
390
- var entry = entries[index2];
391
- this.set(entry[0], entry[1]);
392
- }
393
- }
394
- ListCache.prototype.clear = listCacheClear;
395
- ListCache.prototype["delete"] = listCacheDelete;
396
- ListCache.prototype.get = listCacheGet;
397
- ListCache.prototype.has = listCacheHas;
398
- ListCache.prototype.set = listCacheSet;
399
- var Map$1 = getNative(root$1, "Map");
400
- const Map$2 = Map$1;
401
- function mapCacheClear() {
402
- this.size = 0;
403
- this.__data__ = {
404
- "hash": new Hash(),
405
- "map": new (Map$2 || ListCache)(),
406
- "string": new Hash()
407
- };
408
- }
409
- function isKeyable(value) {
410
- var type = typeof value;
411
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
412
- }
413
- function getMapData(map, key) {
414
- var data = map.__data__;
415
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
416
- }
417
- function mapCacheDelete(key) {
418
- var result = getMapData(this, key)["delete"](key);
419
- this.size -= result ? 1 : 0;
420
- return result;
421
- }
422
- function mapCacheGet(key) {
423
- return getMapData(this, key).get(key);
424
- }
425
- function mapCacheHas(key) {
426
- return getMapData(this, key).has(key);
427
- }
428
- function mapCacheSet(key, value) {
429
- var data = getMapData(this, key), size = data.size;
430
- data.set(key, value);
431
- this.size += data.size == size ? 0 : 1;
432
- return this;
433
- }
434
- function MapCache(entries) {
435
- var index2 = -1, length = entries == null ? 0 : entries.length;
436
- this.clear();
437
- while (++index2 < length) {
438
- var entry = entries[index2];
439
- this.set(entry[0], entry[1]);
440
- }
441
- }
442
- MapCache.prototype.clear = mapCacheClear;
443
- MapCache.prototype["delete"] = mapCacheDelete;
444
- MapCache.prototype.get = mapCacheGet;
445
- MapCache.prototype.has = mapCacheHas;
446
- MapCache.prototype.set = mapCacheSet;
447
- var FUNC_ERROR_TEXT = "Expected a function";
448
- function memoize(func, resolver) {
449
- if (typeof func != "function" || resolver != null && typeof resolver != "function") {
450
- throw new TypeError(FUNC_ERROR_TEXT);
451
- }
452
- var memoized = function() {
453
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
454
- if (cache.has(key)) {
455
- return cache.get(key);
456
- }
457
- var result = func.apply(this, args);
458
- memoized.cache = cache.set(key, result) || cache;
459
- return result;
460
- };
461
- memoized.cache = new (memoize.Cache || MapCache)();
462
- return memoized;
463
- }
464
- memoize.Cache = MapCache;
465
- var MAX_MEMOIZE_SIZE = 500;
466
- function memoizeCapped(func) {
467
- var result = memoize(func, function(key) {
468
- if (cache.size === MAX_MEMOIZE_SIZE) {
469
- cache.clear();
470
- }
471
- return key;
472
- });
473
- var cache = result.cache;
474
- return result;
475
- }
476
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
477
- var reEscapeChar = /\\(\\)?/g;
478
- var stringToPath = memoizeCapped(function(string) {
479
- var result = [];
480
- if (string.charCodeAt(0) === 46) {
481
- result.push("");
482
- }
483
- string.replace(rePropName, function(match, number, quote, subString) {
484
- result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
485
- });
486
- return result;
487
- });
488
- const stringToPath$1 = stringToPath;
489
- function toString$1(value) {
490
- return value == null ? "" : baseToString(value);
491
- }
492
- function castPath(value, object2) {
493
- if (isArray$2(value)) {
494
- return value;
495
- }
496
- return isKey(value, object2) ? [value] : stringToPath$1(toString$1(value));
497
- }
498
- var INFINITY = 1 / 0;
499
- function toKey(value) {
500
- if (typeof value == "string" || isSymbol(value)) {
501
- return value;
502
- }
503
- var result = value + "";
504
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
505
- }
506
- function isNull(value) {
507
- return value === null;
508
- }
509
- function isUndefined$1(value) {
510
- return value === void 0;
511
- }
512
- function baseSet(object2, path, value, customizer) {
513
- if (!isObject$1(object2)) {
514
- return object2;
515
- }
516
- path = castPath(path, object2);
517
- var index2 = -1, length = path.length, lastIndex = length - 1, nested = object2;
518
- while (nested != null && ++index2 < length) {
519
- var key = toKey(path[index2]), newValue = value;
520
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
521
- return object2;
522
- }
523
- if (index2 != lastIndex) {
524
- var objValue = nested[key];
525
- newValue = customizer ? customizer(objValue, key, nested) : void 0;
526
- if (newValue === void 0) {
527
- newValue = isObject$1(objValue) ? objValue : isIndex(path[index2 + 1]) ? [] : {};
528
- }
529
- }
530
- assignValue(nested, key, newValue);
531
- nested = nested[key];
532
- }
533
- return object2;
534
- }
535
- function set(object2, path, value) {
536
- return object2 == null ? object2 : baseSet(object2, path, value);
537
- }
538
- function bind(fn, thisArg) {
539
- return function wrap() {
540
- return fn.apply(thisArg, arguments);
541
- };
542
- }
543
- const { toString } = Object.prototype;
544
- const { getPrototypeOf } = Object;
545
- const { iterator, toStringTag } = Symbol;
546
- const kindOf = ((cache) => (thing) => {
547
- const str = toString.call(thing);
548
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
549
- })(/* @__PURE__ */ Object.create(null));
550
- const kindOfTest = (type) => {
551
- type = type.toLowerCase();
552
- return (thing) => kindOf(thing) === type;
553
- };
554
- const typeOfTest = (type) => (thing) => typeof thing === type;
555
- const { isArray } = Array;
556
- const isUndefined = typeOfTest("undefined");
557
- function isBuffer(val) {
558
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
559
- }
560
- const isArrayBuffer = kindOfTest("ArrayBuffer");
561
- function isArrayBufferView(val) {
562
- let result;
563
- if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
564
- result = ArrayBuffer.isView(val);
565
- } else {
566
- result = val && val.buffer && isArrayBuffer(val.buffer);
567
- }
568
- return result;
569
- }
570
- const isString = typeOfTest("string");
571
- const isFunction$1 = typeOfTest("function");
572
- const isNumber = typeOfTest("number");
573
- const isObject = (thing) => thing !== null && typeof thing === "object";
574
- const isBoolean = (thing) => thing === true || thing === false;
575
- const isPlainObject = (val) => {
576
- if (kindOf(val) !== "object") {
577
- return false;
578
- }
579
- const prototype2 = getPrototypeOf(val);
580
- return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
581
- };
582
- const isEmptyObject = (val) => {
583
- if (!isObject(val) || isBuffer(val)) {
584
- return false;
585
- }
586
- try {
587
- return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
588
- } catch (e) {
589
- return false;
590
- }
591
- };
592
- const isDate = kindOfTest("Date");
593
- const isFile = kindOfTest("File");
594
- const isBlob = kindOfTest("Blob");
595
- const isFileList = kindOfTest("FileList");
596
- const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
597
- const isFormData = (thing) => {
598
- let kind;
599
- return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
600
- kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
601
- };
602
- const isURLSearchParams = kindOfTest("URLSearchParams");
603
- const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
604
- const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
605
- function forEach(obj, fn, { allOwnKeys = false } = {}) {
606
- if (obj === null || typeof obj === "undefined") {
607
- return;
608
- }
609
- let i;
610
- let l;
611
- if (typeof obj !== "object") {
612
- obj = [obj];
613
- }
614
- if (isArray(obj)) {
615
- for (i = 0, l = obj.length; i < l; i++) {
616
- fn.call(null, obj[i], i, obj);
617
- }
618
- } else {
619
- if (isBuffer(obj)) {
620
- return;
621
- }
622
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
623
- const len = keys.length;
624
- let key;
625
- for (i = 0; i < len; i++) {
626
- key = keys[i];
627
- fn.call(null, obj[key], key, obj);
628
- }
629
- }
630
- }
631
- function findKey(obj, key) {
632
- if (isBuffer(obj)) {
633
- return null;
634
- }
635
- key = key.toLowerCase();
636
- const keys = Object.keys(obj);
637
- let i = keys.length;
638
- let _key;
639
- while (i-- > 0) {
640
- _key = keys[i];
641
- if (key === _key.toLowerCase()) {
642
- return _key;
643
- }
644
- }
645
- return null;
646
- }
647
- const _global = (() => {
648
- if (typeof globalThis !== "undefined")
649
- return globalThis;
650
- return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
651
- })();
652
- const isContextDefined = (context) => !isUndefined(context) && context !== _global;
653
- function merge() {
654
- const { caseless, skipUndefined } = isContextDefined(this) && this || {};
655
- const result = {};
656
- const assignValue2 = (val, key) => {
657
- const targetKey = caseless && findKey(result, key) || key;
658
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
659
- result[targetKey] = merge(result[targetKey], val);
660
- } else if (isPlainObject(val)) {
661
- result[targetKey] = merge({}, val);
662
- } else if (isArray(val)) {
663
- result[targetKey] = val.slice();
664
- } else if (!skipUndefined || !isUndefined(val)) {
665
- result[targetKey] = val;
666
- }
667
- };
668
- for (let i = 0, l = arguments.length; i < l; i++) {
669
- arguments[i] && forEach(arguments[i], assignValue2);
670
- }
671
- return result;
672
- }
673
- const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
674
- forEach(b, (val, key) => {
675
- if (thisArg && isFunction$1(val)) {
676
- a[key] = bind(val, thisArg);
677
- } else {
678
- a[key] = val;
679
- }
680
- }, { allOwnKeys });
681
- return a;
682
- };
683
- const stripBOM = (content) => {
684
- if (content.charCodeAt(0) === 65279) {
685
- content = content.slice(1);
686
- }
687
- return content;
688
- };
689
- const inherits = (constructor, superConstructor, props, descriptors2) => {
690
- constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
691
- constructor.prototype.constructor = constructor;
692
- Object.defineProperty(constructor, "super", {
693
- value: superConstructor.prototype
694
- });
695
- props && Object.assign(constructor.prototype, props);
696
- };
697
- const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
698
- let props;
699
- let i;
700
- let prop;
701
- const merged = {};
702
- destObj = destObj || {};
703
- if (sourceObj == null)
704
- return destObj;
705
- do {
706
- props = Object.getOwnPropertyNames(sourceObj);
707
- i = props.length;
708
- while (i-- > 0) {
709
- prop = props[i];
710
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
711
- destObj[prop] = sourceObj[prop];
712
- merged[prop] = true;
713
- }
714
- }
715
- sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
716
- } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
717
- return destObj;
718
- };
719
- const endsWith = (str, searchString, position) => {
720
- str = String(str);
721
- if (position === void 0 || position > str.length) {
722
- position = str.length;
723
- }
724
- position -= searchString.length;
725
- const lastIndex = str.indexOf(searchString, position);
726
- return lastIndex !== -1 && lastIndex === position;
727
- };
728
- const toArray = (thing) => {
729
- if (!thing)
730
- return null;
731
- if (isArray(thing))
732
- return thing;
733
- let i = thing.length;
734
- if (!isNumber(i))
735
- return null;
736
- const arr = new Array(i);
737
- while (i-- > 0) {
738
- arr[i] = thing[i];
739
- }
740
- return arr;
741
- };
742
- const isTypedArray = ((TypedArray) => {
743
- return (thing) => {
744
- return TypedArray && thing instanceof TypedArray;
745
- };
746
- })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
747
- const forEachEntry = (obj, fn) => {
748
- const generator = obj && obj[iterator];
749
- const _iterator = generator.call(obj);
750
- let result;
751
- while ((result = _iterator.next()) && !result.done) {
752
- const pair = result.value;
753
- fn.call(obj, pair[0], pair[1]);
754
- }
755
- };
756
- const matchAll = (regExp, str) => {
757
- let matches;
758
- const arr = [];
759
- while ((matches = regExp.exec(str)) !== null) {
760
- arr.push(matches);
761
- }
762
- return arr;
763
- };
764
- const isHTMLForm = kindOfTest("HTMLFormElement");
765
- const toCamelCase = (str) => {
766
- return str.toLowerCase().replace(
767
- /[-_\s]([a-z\d])(\w*)/g,
768
- function replacer(m, p1, p2) {
769
- return p1.toUpperCase() + p2;
770
- }
771
- );
772
- };
773
- const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
774
- const isRegExp = kindOfTest("RegExp");
775
- const reduceDescriptors = (obj, reducer) => {
776
- const descriptors2 = Object.getOwnPropertyDescriptors(obj);
777
- const reducedDescriptors = {};
778
- forEach(descriptors2, (descriptor, name) => {
779
- let ret;
780
- if ((ret = reducer(descriptor, name, obj)) !== false) {
781
- reducedDescriptors[name] = ret || descriptor;
782
- }
783
- });
784
- Object.defineProperties(obj, reducedDescriptors);
785
- };
786
- const freezeMethods = (obj) => {
787
- reduceDescriptors(obj, (descriptor, name) => {
788
- if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
789
- return false;
790
- }
791
- const value = obj[name];
792
- if (!isFunction$1(value))
793
- return;
794
- descriptor.enumerable = false;
795
- if ("writable" in descriptor) {
796
- descriptor.writable = false;
797
- return;
798
- }
799
- if (!descriptor.set) {
800
- descriptor.set = () => {
801
- throw Error("Can not rewrite read-only method '" + name + "'");
802
- };
803
- }
804
- });
805
- };
806
- const toObjectSet = (arrayOrString, delimiter) => {
807
- const obj = {};
808
- const define = (arr) => {
809
- arr.forEach((value) => {
810
- obj[value] = true;
811
- });
812
- };
813
- isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
814
- return obj;
815
- };
816
- const noop = () => {
817
- };
818
- const toFiniteNumber = (value, defaultValue) => {
819
- return value != null && Number.isFinite(value = +value) ? value : defaultValue;
820
- };
821
- function isSpecCompliantForm(thing) {
822
- return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
823
- }
824
- const toJSONObject = (obj) => {
825
- const stack = new Array(10);
826
- const visit = (source, i) => {
827
- if (isObject(source)) {
828
- if (stack.indexOf(source) >= 0) {
829
- return;
830
- }
831
- if (isBuffer(source)) {
832
- return source;
833
- }
834
- if (!("toJSON" in source)) {
835
- stack[i] = source;
836
- const target = isArray(source) ? [] : {};
837
- forEach(source, (value, key) => {
838
- const reducedValue = visit(value, i + 1);
839
- !isUndefined(reducedValue) && (target[key] = reducedValue);
840
- });
841
- stack[i] = void 0;
842
- return target;
843
- }
844
- }
845
- return source;
846
- };
847
- return visit(obj, 0);
848
- };
849
- const isAsyncFn = kindOfTest("AsyncFunction");
850
- const isThenable = (thing) => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
851
- const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
852
- if (setImmediateSupported) {
853
- return setImmediate;
854
- }
855
- return postMessageSupported ? ((token, callbacks) => {
856
- _global.addEventListener("message", ({ source, data }) => {
857
- if (source === _global && data === token) {
858
- callbacks.length && callbacks.shift()();
859
- }
860
- }, false);
861
- return (cb) => {
862
- callbacks.push(cb);
863
- _global.postMessage(token, "*");
864
- };
865
- })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
866
- })(
867
- typeof setImmediate === "function",
868
- isFunction$1(_global.postMessage)
869
- );
870
- const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
871
- const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
872
- const utils$1 = {
873
- isArray,
874
- isArrayBuffer,
875
- isBuffer,
876
- isFormData,
877
- isArrayBufferView,
878
- isString,
879
- isNumber,
880
- isBoolean,
881
- isObject,
882
- isPlainObject,
883
- isEmptyObject,
884
- isReadableStream,
885
- isRequest,
886
- isResponse,
887
- isHeaders,
888
- isUndefined,
889
- isDate,
890
- isFile,
891
- isBlob,
892
- isRegExp,
893
- isFunction: isFunction$1,
894
- isStream,
895
- isURLSearchParams,
896
- isTypedArray,
897
- isFileList,
898
- forEach,
899
- merge,
900
- extend,
901
- trim,
902
- stripBOM,
903
- inherits,
904
- toFlatObject,
905
- kindOf,
906
- kindOfTest,
907
- endsWith,
908
- toArray,
909
- forEachEntry,
910
- matchAll,
911
- isHTMLForm,
912
- hasOwnProperty,
913
- hasOwnProp: hasOwnProperty,
914
- // an alias to avoid ESLint no-prototype-builtins detection
915
- reduceDescriptors,
916
- freezeMethods,
917
- toObjectSet,
918
- toCamelCase,
919
- noop,
920
- toFiniteNumber,
921
- findKey,
922
- global: _global,
923
- isContextDefined,
924
- isSpecCompliantForm,
925
- toJSONObject,
926
- isAsyncFn,
927
- isThenable,
928
- setImmediate: _setImmediate,
929
- asap,
930
- isIterable
931
- };
932
- function AxiosError$1(message, code, config, request, response) {
933
- Error.call(this);
934
- if (Error.captureStackTrace) {
935
- Error.captureStackTrace(this, this.constructor);
936
- } else {
937
- this.stack = new Error().stack;
938
- }
939
- this.message = message;
940
- this.name = "AxiosError";
941
- code && (this.code = code);
942
- config && (this.config = config);
943
- request && (this.request = request);
944
- if (response) {
945
- this.response = response;
946
- this.status = response.status ? response.status : null;
947
- }
948
- }
949
- utils$1.inherits(AxiosError$1, Error, {
950
- toJSON: function toJSON() {
951
- return {
952
- // Standard
953
- message: this.message,
954
- name: this.name,
955
- // Microsoft
956
- description: this.description,
957
- number: this.number,
958
- // Mozilla
959
- fileName: this.fileName,
960
- lineNumber: this.lineNumber,
961
- columnNumber: this.columnNumber,
962
- stack: this.stack,
963
- // Axios
964
- config: utils$1.toJSONObject(this.config),
965
- code: this.code,
966
- status: this.status
967
- };
968
- }
969
- });
970
- const prototype$1 = AxiosError$1.prototype;
971
- const descriptors = {};
972
- [
973
- "ERR_BAD_OPTION_VALUE",
974
- "ERR_BAD_OPTION",
975
- "ECONNABORTED",
976
- "ETIMEDOUT",
977
- "ERR_NETWORK",
978
- "ERR_FR_TOO_MANY_REDIRECTS",
979
- "ERR_DEPRECATED",
980
- "ERR_BAD_RESPONSE",
981
- "ERR_BAD_REQUEST",
982
- "ERR_CANCELED",
983
- "ERR_NOT_SUPPORT",
984
- "ERR_INVALID_URL"
985
- // eslint-disable-next-line func-names
986
- ].forEach((code) => {
987
- descriptors[code] = { value: code };
988
- });
989
- Object.defineProperties(AxiosError$1, descriptors);
990
- Object.defineProperty(prototype$1, "isAxiosError", { value: true });
991
- AxiosError$1.from = (error, code, config, request, response, customProps) => {
992
- const axiosError = Object.create(prototype$1);
993
- utils$1.toFlatObject(error, axiosError, function filter2(obj) {
994
- return obj !== Error.prototype;
995
- }, (prop) => {
996
- return prop !== "isAxiosError";
997
- });
998
- const msg = error && error.message ? error.message : "Error";
999
- const errCode = code == null && error ? error.code : code;
1000
- AxiosError$1.call(axiosError, msg, errCode, config, request, response);
1001
- if (error && axiosError.cause == null) {
1002
- Object.defineProperty(axiosError, "cause", { value: error, configurable: true });
1003
- }
1004
- axiosError.name = error && error.name || "Error";
1005
- customProps && Object.assign(axiosError, customProps);
1006
- return axiosError;
1007
- };
1008
- const httpAdapter = null;
1009
- function isVisitable(thing) {
1010
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1011
- }
1012
- function removeBrackets(key) {
1013
- return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
1014
- }
1015
- function renderKey(path, key, dots) {
1016
- if (!path)
1017
- return key;
1018
- return path.concat(key).map(function each(token, i) {
1019
- token = removeBrackets(token);
1020
- return !dots && i ? "[" + token + "]" : token;
1021
- }).join(dots ? "." : "");
1022
- }
1023
- function isFlatArray(arr) {
1024
- return utils$1.isArray(arr) && !arr.some(isVisitable);
1025
- }
1026
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1027
- return /^is[A-Z]/.test(prop);
1028
- });
1029
- function toFormData$1(obj, formData, options) {
1030
- if (!utils$1.isObject(obj)) {
1031
- throw new TypeError("target must be an object");
1032
- }
1033
- formData = formData || new FormData();
1034
- options = utils$1.toFlatObject(options, {
1035
- metaTokens: true,
1036
- dots: false,
1037
- indexes: false
1038
- }, false, function defined(option, source) {
1039
- return !utils$1.isUndefined(source[option]);
1040
- });
1041
- const metaTokens = options.metaTokens;
1042
- const visitor = options.visitor || defaultVisitor;
1043
- const dots = options.dots;
1044
- const indexes = options.indexes;
1045
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
1046
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1047
- if (!utils$1.isFunction(visitor)) {
1048
- throw new TypeError("visitor must be a function");
1049
- }
1050
- function convertValue(value) {
1051
- if (value === null)
1052
- return "";
1053
- if (utils$1.isDate(value)) {
1054
- return value.toISOString();
1055
- }
1056
- if (utils$1.isBoolean(value)) {
1057
- return value.toString();
1058
- }
1059
- if (!useBlob && utils$1.isBlob(value)) {
1060
- throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
1061
- }
1062
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1063
- return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
1064
- }
1065
- return value;
1066
- }
1067
- function defaultVisitor(value, key, path) {
1068
- let arr = value;
1069
- if (value && !path && typeof value === "object") {
1070
- if (utils$1.endsWith(key, "{}")) {
1071
- key = metaTokens ? key : key.slice(0, -2);
1072
- value = JSON.stringify(value);
1073
- } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
1074
- key = removeBrackets(key);
1075
- arr.forEach(function each(el, index2) {
1076
- !(utils$1.isUndefined(el) || el === null) && formData.append(
1077
- // eslint-disable-next-line no-nested-ternary
1078
- indexes === true ? renderKey([key], index2, dots) : indexes === null ? key : key + "[]",
1079
- convertValue(el)
1080
- );
1081
- });
1082
- return false;
1083
- }
1084
- }
1085
- if (isVisitable(value)) {
1086
- return true;
1087
- }
1088
- formData.append(renderKey(path, key, dots), convertValue(value));
1089
- return false;
1090
- }
1091
- const stack = [];
1092
- const exposedHelpers = Object.assign(predicates, {
1093
- defaultVisitor,
1094
- convertValue,
1095
- isVisitable
1096
- });
1097
- function build(value, path) {
1098
- if (utils$1.isUndefined(value))
1099
- return;
1100
- if (stack.indexOf(value) !== -1) {
1101
- throw Error("Circular reference detected in " + path.join("."));
1102
- }
1103
- stack.push(value);
1104
- utils$1.forEach(value, function each(el, key) {
1105
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
1106
- formData,
1107
- el,
1108
- utils$1.isString(key) ? key.trim() : key,
1109
- path,
1110
- exposedHelpers
1111
- );
1112
- if (result === true) {
1113
- build(el, path ? path.concat(key) : [key]);
1114
- }
1115
- });
1116
- stack.pop();
1117
- }
1118
- if (!utils$1.isObject(obj)) {
1119
- throw new TypeError("data must be an object");
1120
- }
1121
- build(obj);
1122
- return formData;
1123
- }
1124
- function encode$1(str) {
1125
- const charMap = {
1126
- "!": "%21",
1127
- "'": "%27",
1128
- "(": "%28",
1129
- ")": "%29",
1130
- "~": "%7E",
1131
- "%20": "+",
1132
- "%00": "\0"
1133
- };
1134
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1135
- return charMap[match];
1136
- });
1137
- }
1138
- function AxiosURLSearchParams(params, options) {
1139
- this._pairs = [];
1140
- params && toFormData$1(params, this, options);
1141
- }
1142
- const prototype = AxiosURLSearchParams.prototype;
1143
- prototype.append = function append(name, value) {
1144
- this._pairs.push([name, value]);
1145
- };
1146
- prototype.toString = function toString2(encoder) {
1147
- const _encode = encoder ? function(value) {
1148
- return encoder.call(this, value, encode$1);
1149
- } : encode$1;
1150
- return this._pairs.map(function each(pair) {
1151
- return _encode(pair[0]) + "=" + _encode(pair[1]);
1152
- }, "").join("&");
1153
- };
1154
- function encode(val) {
1155
- return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
1156
- }
1157
- function buildURL(url, params, options) {
1158
- if (!params) {
1159
- return url;
1160
- }
1161
- const _encode = options && options.encode || encode;
1162
- if (utils$1.isFunction(options)) {
1163
- options = {
1164
- serialize: options
1165
- };
1166
- }
1167
- const serializeFn = options && options.serialize;
1168
- let serializedParams;
1169
- if (serializeFn) {
1170
- serializedParams = serializeFn(params, options);
1171
- } else {
1172
- serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
1173
- }
1174
- if (serializedParams) {
1175
- const hashmarkIndex = url.indexOf("#");
1176
- if (hashmarkIndex !== -1) {
1177
- url = url.slice(0, hashmarkIndex);
1178
- }
1179
- url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
1180
- }
1181
- return url;
1182
- }
1183
- class InterceptorManager {
1184
- constructor() {
1185
- this.handlers = [];
1186
- }
1187
- /**
1188
- * Add a new interceptor to the stack
1189
- *
1190
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1191
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1192
- *
1193
- * @return {Number} An ID used to remove interceptor later
1194
- */
1195
- use(fulfilled, rejected, options) {
1196
- this.handlers.push({
1197
- fulfilled,
1198
- rejected,
1199
- synchronous: options ? options.synchronous : false,
1200
- runWhen: options ? options.runWhen : null
1201
- });
1202
- return this.handlers.length - 1;
1203
- }
1204
- /**
1205
- * Remove an interceptor from the stack
1206
- *
1207
- * @param {Number} id The ID that was returned by `use`
1208
- *
1209
- * @returns {void}
1210
- */
1211
- eject(id) {
1212
- if (this.handlers[id]) {
1213
- this.handlers[id] = null;
1214
- }
1215
- }
1216
- /**
1217
- * Clear all interceptors from the stack
1218
- *
1219
- * @returns {void}
1220
- */
1221
- clear() {
1222
- if (this.handlers) {
1223
- this.handlers = [];
1224
- }
1225
- }
1226
- /**
1227
- * Iterate over all the registered interceptors
1228
- *
1229
- * This method is particularly useful for skipping over any
1230
- * interceptors that may have become `null` calling `eject`.
1231
- *
1232
- * @param {Function} fn The function to call for each interceptor
1233
- *
1234
- * @returns {void}
1235
- */
1236
- forEach(fn) {
1237
- utils$1.forEach(this.handlers, function forEachHandler(h) {
1238
- if (h !== null) {
1239
- fn(h);
1240
- }
1241
- });
1242
- }
1243
- }
1244
- const InterceptorManager$1 = InterceptorManager;
1245
- const transitionalDefaults = {
1246
- silentJSONParsing: true,
1247
- forcedJSONParsing: true,
1248
- clarifyTimeoutError: false
1249
- };
1250
- const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
1251
- const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
1252
- const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
1253
- const platform$1 = {
1254
- isBrowser: true,
1255
- classes: {
1256
- URLSearchParams: URLSearchParams$1,
1257
- FormData: FormData$1,
1258
- Blob: Blob$1
1259
- },
1260
- protocols: ["http", "https", "file", "blob", "url", "data"]
1261
- };
1262
- const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
1263
- const _navigator = typeof navigator === "object" && navigator || void 0;
1264
- const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
1265
- const hasStandardBrowserWebWorkerEnv = (() => {
1266
- return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
1267
- self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
1268
- })();
1269
- const origin = hasBrowserEnv && window.location.href || "http://localhost";
1270
- const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1271
- __proto__: null,
1272
- hasBrowserEnv,
1273
- hasStandardBrowserEnv,
1274
- hasStandardBrowserWebWorkerEnv,
1275
- navigator: _navigator,
1276
- origin
1277
- }, Symbol.toStringTag, { value: "Module" }));
1278
- const platform = {
1279
- ...utils,
1280
- ...platform$1
1281
- };
1282
- function toURLEncodedForm(data, options) {
1283
- return toFormData$1(data, new platform.classes.URLSearchParams(), {
1284
- visitor: function(value, key, path, helpers) {
1285
- if (platform.isNode && utils$1.isBuffer(value)) {
1286
- this.append(key, value.toString("base64"));
1287
- return false;
1288
- }
1289
- return helpers.defaultVisitor.apply(this, arguments);
1290
- },
1291
- ...options
1292
- });
1293
- }
1294
- function parsePropPath(name) {
1295
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
1296
- return match[0] === "[]" ? "" : match[1] || match[0];
1297
- });
1298
- }
1299
- function arrayToObject(arr) {
1300
- const obj = {};
1301
- const keys = Object.keys(arr);
1302
- let i;
1303
- const len = keys.length;
1304
- let key;
1305
- for (i = 0; i < len; i++) {
1306
- key = keys[i];
1307
- obj[key] = arr[key];
1308
- }
1309
- return obj;
1310
- }
1311
- function formDataToJSON(formData) {
1312
- function buildPath(path, value, target, index2) {
1313
- let name = path[index2++];
1314
- if (name === "__proto__")
1315
- return true;
1316
- const isNumericKey = Number.isFinite(+name);
1317
- const isLast = index2 >= path.length;
1318
- name = !name && utils$1.isArray(target) ? target.length : name;
1319
- if (isLast) {
1320
- if (utils$1.hasOwnProp(target, name)) {
1321
- target[name] = [target[name], value];
1322
- } else {
1323
- target[name] = value;
1324
- }
1325
- return !isNumericKey;
1326
- }
1327
- if (!target[name] || !utils$1.isObject(target[name])) {
1328
- target[name] = [];
1329
- }
1330
- const result = buildPath(path, value, target[name], index2);
1331
- if (result && utils$1.isArray(target[name])) {
1332
- target[name] = arrayToObject(target[name]);
1333
- }
1334
- return !isNumericKey;
1335
- }
1336
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1337
- const obj = {};
1338
- utils$1.forEachEntry(formData, (name, value) => {
1339
- buildPath(parsePropPath(name), value, obj, 0);
1340
- });
1341
- return obj;
1342
- }
1343
- return null;
1344
- }
1345
- function stringifySafely(rawValue, parser, encoder) {
1346
- if (utils$1.isString(rawValue)) {
1347
- try {
1348
- (parser || JSON.parse)(rawValue);
1349
- return utils$1.trim(rawValue);
1350
- } catch (e) {
1351
- if (e.name !== "SyntaxError") {
1352
- throw e;
1353
- }
1354
- }
1355
- }
1356
- return (encoder || JSON.stringify)(rawValue);
1357
- }
1358
- const defaults = {
1359
- transitional: transitionalDefaults,
1360
- adapter: ["xhr", "http", "fetch"],
1361
- transformRequest: [function transformRequest(data, headers) {
1362
- const contentType = headers.getContentType() || "";
1363
- const hasJSONContentType = contentType.indexOf("application/json") > -1;
1364
- const isObjectPayload = utils$1.isObject(data);
1365
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
1366
- data = new FormData(data);
1367
- }
1368
- const isFormData2 = utils$1.isFormData(data);
1369
- if (isFormData2) {
1370
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1371
- }
1372
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
1373
- return data;
1374
- }
1375
- if (utils$1.isArrayBufferView(data)) {
1376
- return data.buffer;
1377
- }
1378
- if (utils$1.isURLSearchParams(data)) {
1379
- headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
1380
- return data.toString();
1381
- }
1382
- let isFileList2;
1383
- if (isObjectPayload) {
1384
- if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
1385
- return toURLEncodedForm(data, this.formSerializer).toString();
1386
- }
1387
- if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
1388
- const _FormData = this.env && this.env.FormData;
1389
- return toFormData$1(
1390
- isFileList2 ? { "files[]": data } : data,
1391
- _FormData && new _FormData(),
1392
- this.formSerializer
1393
- );
1394
- }
1395
- }
1396
- if (isObjectPayload || hasJSONContentType) {
1397
- headers.setContentType("application/json", false);
1398
- return stringifySafely(data);
1399
- }
1400
- return data;
1401
- }],
1402
- transformResponse: [function transformResponse(data) {
1403
- const transitional2 = this.transitional || defaults.transitional;
1404
- const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
1405
- const JSONRequested = this.responseType === "json";
1406
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1407
- return data;
1408
- }
1409
- if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
1410
- const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
1411
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
1412
- try {
1413
- return JSON.parse(data, this.parseReviver);
1414
- } catch (e) {
1415
- if (strictJSONParsing) {
1416
- if (e.name === "SyntaxError") {
1417
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
1418
- }
1419
- throw e;
1420
- }
1421
- }
1422
- }
1423
- return data;
1424
- }],
1425
- /**
1426
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1427
- * timeout is not created.
1428
- */
1429
- timeout: 0,
1430
- xsrfCookieName: "XSRF-TOKEN",
1431
- xsrfHeaderName: "X-XSRF-TOKEN",
1432
- maxContentLength: -1,
1433
- maxBodyLength: -1,
1434
- env: {
1435
- FormData: platform.classes.FormData,
1436
- Blob: platform.classes.Blob
1437
- },
1438
- validateStatus: function validateStatus(status) {
1439
- return status >= 200 && status < 300;
1440
- },
1441
- headers: {
1442
- common: {
1443
- "Accept": "application/json, text/plain, */*",
1444
- "Content-Type": void 0
1445
- }
1446
- }
1447
- };
1448
- utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
1449
- defaults.headers[method] = {};
1450
- });
1451
- const defaults$1 = defaults;
1452
- const ignoreDuplicateOf = utils$1.toObjectSet([
1453
- "age",
1454
- "authorization",
1455
- "content-length",
1456
- "content-type",
1457
- "etag",
1458
- "expires",
1459
- "from",
1460
- "host",
1461
- "if-modified-since",
1462
- "if-unmodified-since",
1463
- "last-modified",
1464
- "location",
1465
- "max-forwards",
1466
- "proxy-authorization",
1467
- "referer",
1468
- "retry-after",
1469
- "user-agent"
1470
- ]);
1471
- const parseHeaders = (rawHeaders) => {
1472
- const parsed = {};
1473
- let key;
1474
- let val;
1475
- let i;
1476
- rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
1477
- i = line.indexOf(":");
1478
- key = line.substring(0, i).trim().toLowerCase();
1479
- val = line.substring(i + 1).trim();
1480
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1481
- return;
1482
- }
1483
- if (key === "set-cookie") {
1484
- if (parsed[key]) {
1485
- parsed[key].push(val);
1486
- } else {
1487
- parsed[key] = [val];
1488
- }
1489
- } else {
1490
- parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
1491
- }
1492
- });
1493
- return parsed;
1494
- };
1495
- const $internals = Symbol("internals");
1496
- function normalizeHeader(header) {
1497
- return header && String(header).trim().toLowerCase();
1498
- }
1499
- function normalizeValue(value) {
1500
- if (value === false || value == null) {
1501
- return value;
1502
- }
1503
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
1504
- }
1505
- function parseTokens(str) {
1506
- const tokens = /* @__PURE__ */ Object.create(null);
1507
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1508
- let match;
1509
- while (match = tokensRE.exec(str)) {
1510
- tokens[match[1]] = match[2];
1511
- }
1512
- return tokens;
1513
- }
1514
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1515
- function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
1516
- if (utils$1.isFunction(filter2)) {
1517
- return filter2.call(this, value, header);
1518
- }
1519
- if (isHeaderNameFilter) {
1520
- value = header;
1521
- }
1522
- if (!utils$1.isString(value))
1523
- return;
1524
- if (utils$1.isString(filter2)) {
1525
- return value.indexOf(filter2) !== -1;
1526
- }
1527
- if (utils$1.isRegExp(filter2)) {
1528
- return filter2.test(value);
1529
- }
1530
- }
1531
- function formatHeader(header) {
1532
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1533
- return char.toUpperCase() + str;
1534
- });
1535
- }
1536
- function buildAccessors(obj, header) {
1537
- const accessorName = utils$1.toCamelCase(" " + header);
1538
- ["get", "set", "has"].forEach((methodName) => {
1539
- Object.defineProperty(obj, methodName + accessorName, {
1540
- value: function(arg1, arg2, arg3) {
1541
- return this[methodName].call(this, header, arg1, arg2, arg3);
1542
- },
1543
- configurable: true
1544
- });
1545
- });
1546
- }
1547
- let AxiosHeaders$1 = class AxiosHeaders {
1548
- constructor(headers) {
1549
- headers && this.set(headers);
1550
- }
1551
- set(header, valueOrRewrite, rewrite) {
1552
- const self2 = this;
1553
- function setHeader(_value, _header, _rewrite) {
1554
- const lHeader = normalizeHeader(_header);
1555
- if (!lHeader) {
1556
- throw new Error("header name must be a non-empty string");
1557
- }
1558
- const key = utils$1.findKey(self2, lHeader);
1559
- if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
1560
- self2[key || _header] = normalizeValue(_value);
1561
- }
1562
- }
1563
- const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1564
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1565
- setHeaders(header, valueOrRewrite);
1566
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1567
- setHeaders(parseHeaders(header), valueOrRewrite);
1568
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1569
- let obj = {}, dest, key;
1570
- for (const entry of header) {
1571
- if (!utils$1.isArray(entry)) {
1572
- throw TypeError("Object iterator must return a key-value pair");
1573
- }
1574
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
1575
- }
1576
- setHeaders(obj, valueOrRewrite);
1577
- } else {
1578
- header != null && setHeader(valueOrRewrite, header, rewrite);
1579
- }
1580
- return this;
1581
- }
1582
- get(header, parser) {
1583
- header = normalizeHeader(header);
1584
- if (header) {
1585
- const key = utils$1.findKey(this, header);
1586
- if (key) {
1587
- const value = this[key];
1588
- if (!parser) {
1589
- return value;
1590
- }
1591
- if (parser === true) {
1592
- return parseTokens(value);
1593
- }
1594
- if (utils$1.isFunction(parser)) {
1595
- return parser.call(this, value, key);
1596
- }
1597
- if (utils$1.isRegExp(parser)) {
1598
- return parser.exec(value);
1599
- }
1600
- throw new TypeError("parser must be boolean|regexp|function");
1601
- }
1602
- }
1603
- }
1604
- has(header, matcher) {
1605
- header = normalizeHeader(header);
1606
- if (header) {
1607
- const key = utils$1.findKey(this, header);
1608
- return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1609
- }
1610
- return false;
1611
- }
1612
- delete(header, matcher) {
1613
- const self2 = this;
1614
- let deleted = false;
1615
- function deleteHeader(_header) {
1616
- _header = normalizeHeader(_header);
1617
- if (_header) {
1618
- const key = utils$1.findKey(self2, _header);
1619
- if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
1620
- delete self2[key];
1621
- deleted = true;
1622
- }
1623
- }
1624
- }
1625
- if (utils$1.isArray(header)) {
1626
- header.forEach(deleteHeader);
1627
- } else {
1628
- deleteHeader(header);
1629
- }
1630
- return deleted;
1631
- }
1632
- clear(matcher) {
1633
- const keys = Object.keys(this);
1634
- let i = keys.length;
1635
- let deleted = false;
1636
- while (i--) {
1637
- const key = keys[i];
1638
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1639
- delete this[key];
1640
- deleted = true;
1641
- }
1642
- }
1643
- return deleted;
1644
- }
1645
- normalize(format) {
1646
- const self2 = this;
1647
- const headers = {};
1648
- utils$1.forEach(this, (value, header) => {
1649
- const key = utils$1.findKey(headers, header);
1650
- if (key) {
1651
- self2[key] = normalizeValue(value);
1652
- delete self2[header];
1653
- return;
1654
- }
1655
- const normalized = format ? formatHeader(header) : String(header).trim();
1656
- if (normalized !== header) {
1657
- delete self2[header];
1658
- }
1659
- self2[normalized] = normalizeValue(value);
1660
- headers[normalized] = true;
1661
- });
1662
- return this;
1663
- }
1664
- concat(...targets) {
1665
- return this.constructor.concat(this, ...targets);
1666
- }
1667
- toJSON(asStrings) {
1668
- const obj = /* @__PURE__ */ Object.create(null);
1669
- utils$1.forEach(this, (value, header) => {
1670
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
1671
- });
1672
- return obj;
1673
- }
1674
- [Symbol.iterator]() {
1675
- return Object.entries(this.toJSON())[Symbol.iterator]();
1676
- }
1677
- toString() {
1678
- return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
1679
- }
1680
- getSetCookie() {
1681
- return this.get("set-cookie") || [];
1682
- }
1683
- get [Symbol.toStringTag]() {
1684
- return "AxiosHeaders";
1685
- }
1686
- static from(thing) {
1687
- return thing instanceof this ? thing : new this(thing);
1688
- }
1689
- static concat(first, ...targets) {
1690
- const computed = new this(first);
1691
- targets.forEach((target) => computed.set(target));
1692
- return computed;
1693
- }
1694
- static accessor(header) {
1695
- const internals = this[$internals] = this[$internals] = {
1696
- accessors: {}
1697
- };
1698
- const accessors = internals.accessors;
1699
- const prototype2 = this.prototype;
1700
- function defineAccessor(_header) {
1701
- const lHeader = normalizeHeader(_header);
1702
- if (!accessors[lHeader]) {
1703
- buildAccessors(prototype2, _header);
1704
- accessors[lHeader] = true;
1705
- }
1706
- }
1707
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1708
- return this;
1709
- }
1710
- };
1711
- AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
1712
- utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
1713
- let mapped = key[0].toUpperCase() + key.slice(1);
1714
- return {
1715
- get: () => value,
1716
- set(headerValue) {
1717
- this[mapped] = headerValue;
1718
- }
1719
- };
1720
- });
1721
- utils$1.freezeMethods(AxiosHeaders$1);
1722
- const AxiosHeaders$2 = AxiosHeaders$1;
1723
- function transformData(fns, response) {
1724
- const config = this || defaults$1;
1725
- const context = response || config;
1726
- const headers = AxiosHeaders$2.from(context.headers);
1727
- let data = context.data;
1728
- utils$1.forEach(fns, function transform(fn) {
1729
- data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
1730
- });
1731
- headers.normalize();
1732
- return data;
1733
- }
1734
- function isCancel$1(value) {
1735
- return !!(value && value.__CANCEL__);
1736
- }
1737
- function CanceledError$1(message, config, request) {
1738
- AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
1739
- this.name = "CanceledError";
1740
- }
1741
- utils$1.inherits(CanceledError$1, AxiosError$1, {
1742
- __CANCEL__: true
1743
- });
1744
- function settle(resolve, reject, response) {
1745
- const validateStatus2 = response.config.validateStatus;
1746
- if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
1747
- resolve(response);
1748
- } else {
1749
- reject(new AxiosError$1(
1750
- "Request failed with status code " + response.status,
1751
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1752
- response.config,
1753
- response.request,
1754
- response
1755
- ));
1756
- }
1757
- }
1758
- function parseProtocol(url) {
1759
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1760
- return match && match[1] || "";
1761
- }
1762
- function speedometer(samplesCount, min) {
1763
- samplesCount = samplesCount || 10;
1764
- const bytes = new Array(samplesCount);
1765
- const timestamps = new Array(samplesCount);
1766
- let head = 0;
1767
- let tail = 0;
1768
- let firstSampleTS;
1769
- min = min !== void 0 ? min : 1e3;
1770
- return function push(chunkLength) {
1771
- const now = Date.now();
1772
- const startedAt = timestamps[tail];
1773
- if (!firstSampleTS) {
1774
- firstSampleTS = now;
1775
- }
1776
- bytes[head] = chunkLength;
1777
- timestamps[head] = now;
1778
- let i = tail;
1779
- let bytesCount = 0;
1780
- while (i !== head) {
1781
- bytesCount += bytes[i++];
1782
- i = i % samplesCount;
1783
- }
1784
- head = (head + 1) % samplesCount;
1785
- if (head === tail) {
1786
- tail = (tail + 1) % samplesCount;
1787
- }
1788
- if (now - firstSampleTS < min) {
1789
- return;
1790
- }
1791
- const passed = startedAt && now - startedAt;
1792
- return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
1793
- };
1794
- }
1795
- function throttle(fn, freq) {
1796
- let timestamp = 0;
1797
- let threshold = 1e3 / freq;
1798
- let lastArgs;
1799
- let timer;
1800
- const invoke = (args, now = Date.now()) => {
1801
- timestamp = now;
1802
- lastArgs = null;
1803
- if (timer) {
1804
- clearTimeout(timer);
1805
- timer = null;
1806
- }
1807
- fn(...args);
1808
- };
1809
- const throttled = (...args) => {
1810
- const now = Date.now();
1811
- const passed = now - timestamp;
1812
- if (passed >= threshold) {
1813
- invoke(args, now);
1814
- } else {
1815
- lastArgs = args;
1816
- if (!timer) {
1817
- timer = setTimeout(() => {
1818
- timer = null;
1819
- invoke(lastArgs);
1820
- }, threshold - passed);
1821
- }
1822
- }
1823
- };
1824
- const flush = () => lastArgs && invoke(lastArgs);
1825
- return [throttled, flush];
1826
- }
1827
- const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
1828
- let bytesNotified = 0;
1829
- const _speedometer = speedometer(50, 250);
1830
- return throttle((e) => {
1831
- const loaded = e.loaded;
1832
- const total = e.lengthComputable ? e.total : void 0;
1833
- const progressBytes = loaded - bytesNotified;
1834
- const rate = _speedometer(progressBytes);
1835
- const inRange = loaded <= total;
1836
- bytesNotified = loaded;
1837
- const data = {
1838
- loaded,
1839
- total,
1840
- progress: total ? loaded / total : void 0,
1841
- bytes: progressBytes,
1842
- rate: rate ? rate : void 0,
1843
- estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
1844
- event: e,
1845
- lengthComputable: total != null,
1846
- [isDownloadStream ? "download" : "upload"]: true
1847
- };
1848
- listener(data);
1849
- }, freq);
1850
- };
1851
- const progressEventDecorator = (total, throttled) => {
1852
- const lengthComputable = total != null;
1853
- return [(loaded) => throttled[0]({
1854
- lengthComputable,
1855
- total,
1856
- loaded
1857
- }), throttled[1]];
1858
- };
1859
- const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
1860
- const isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin2, isMSIE) => (url) => {
1861
- url = new URL(url, platform.origin);
1862
- return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
1863
- })(
1864
- new URL(platform.origin),
1865
- platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
1866
- ) : () => true;
1867
- const cookies = platform.hasStandardBrowserEnv ? (
1868
- // Standard browser envs support document.cookie
1869
- {
1870
- write(name, value, expires, path, domain, secure, sameSite) {
1871
- if (typeof document === "undefined")
1872
- return;
1873
- const cookie = [`${name}=${encodeURIComponent(value)}`];
1874
- if (utils$1.isNumber(expires)) {
1875
- cookie.push(`expires=${new Date(expires).toUTCString()}`);
1876
- }
1877
- if (utils$1.isString(path)) {
1878
- cookie.push(`path=${path}`);
1879
- }
1880
- if (utils$1.isString(domain)) {
1881
- cookie.push(`domain=${domain}`);
1882
- }
1883
- if (secure === true) {
1884
- cookie.push("secure");
1885
- }
1886
- if (utils$1.isString(sameSite)) {
1887
- cookie.push(`SameSite=${sameSite}`);
1888
- }
1889
- document.cookie = cookie.join("; ");
1890
- },
1891
- read(name) {
1892
- if (typeof document === "undefined")
1893
- return null;
1894
- const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
1895
- return match ? decodeURIComponent(match[1]) : null;
1896
- },
1897
- remove(name) {
1898
- this.write(name, "", Date.now() - 864e5, "/");
1899
- }
1900
- }
1901
- ) : (
1902
- // Non-standard browser env (web workers, react-native) lack needed support.
1903
- {
1904
- write() {
1905
- },
1906
- read() {
1907
- return null;
1908
- },
1909
- remove() {
1910
- }
1911
- }
1912
- );
1913
- function isAbsoluteURL(url) {
1914
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1915
- }
1916
- function combineURLs(baseURL, relativeURL) {
1917
- return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
1918
- }
1919
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
1920
- let isRelativeUrl = !isAbsoluteURL(requestedURL);
1921
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
1922
- return combineURLs(baseURL, requestedURL);
1923
- }
1924
- return requestedURL;
1925
- }
1926
- const headersToObject = (thing) => thing instanceof AxiosHeaders$2 ? { ...thing } : thing;
1927
- function mergeConfig$1(config1, config2) {
1928
- config2 = config2 || {};
1929
- const config = {};
1930
- function getMergedValue(target, source, prop, caseless) {
1931
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
1932
- return utils$1.merge.call({ caseless }, target, source);
1933
- } else if (utils$1.isPlainObject(source)) {
1934
- return utils$1.merge({}, source);
1935
- } else if (utils$1.isArray(source)) {
1936
- return source.slice();
1937
- }
1938
- return source;
1939
- }
1940
- function mergeDeepProperties(a, b, prop, caseless) {
1941
- if (!utils$1.isUndefined(b)) {
1942
- return getMergedValue(a, b, prop, caseless);
1943
- } else if (!utils$1.isUndefined(a)) {
1944
- return getMergedValue(void 0, a, prop, caseless);
1945
- }
1946
- }
1947
- function valueFromConfig2(a, b) {
1948
- if (!utils$1.isUndefined(b)) {
1949
- return getMergedValue(void 0, b);
1950
- }
1951
- }
1952
- function defaultToConfig2(a, b) {
1953
- if (!utils$1.isUndefined(b)) {
1954
- return getMergedValue(void 0, b);
1955
- } else if (!utils$1.isUndefined(a)) {
1956
- return getMergedValue(void 0, a);
1957
- }
1958
- }
1959
- function mergeDirectKeys(a, b, prop) {
1960
- if (prop in config2) {
1961
- return getMergedValue(a, b);
1962
- } else if (prop in config1) {
1963
- return getMergedValue(void 0, a);
1964
- }
1965
- }
1966
- const mergeMap = {
1967
- url: valueFromConfig2,
1968
- method: valueFromConfig2,
1969
- data: valueFromConfig2,
1970
- baseURL: defaultToConfig2,
1971
- transformRequest: defaultToConfig2,
1972
- transformResponse: defaultToConfig2,
1973
- paramsSerializer: defaultToConfig2,
1974
- timeout: defaultToConfig2,
1975
- timeoutMessage: defaultToConfig2,
1976
- withCredentials: defaultToConfig2,
1977
- withXSRFToken: defaultToConfig2,
1978
- adapter: defaultToConfig2,
1979
- responseType: defaultToConfig2,
1980
- xsrfCookieName: defaultToConfig2,
1981
- xsrfHeaderName: defaultToConfig2,
1982
- onUploadProgress: defaultToConfig2,
1983
- onDownloadProgress: defaultToConfig2,
1984
- decompress: defaultToConfig2,
1985
- maxContentLength: defaultToConfig2,
1986
- maxBodyLength: defaultToConfig2,
1987
- beforeRedirect: defaultToConfig2,
1988
- transport: defaultToConfig2,
1989
- httpAgent: defaultToConfig2,
1990
- httpsAgent: defaultToConfig2,
1991
- cancelToken: defaultToConfig2,
1992
- socketPath: defaultToConfig2,
1993
- responseEncoding: defaultToConfig2,
1994
- validateStatus: mergeDirectKeys,
1995
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
1996
- };
1997
- utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
1998
- const merge2 = mergeMap[prop] || mergeDeepProperties;
1999
- const configValue = merge2(config1[prop], config2[prop], prop);
2000
- utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
2001
- });
2002
- return config;
2003
- }
2004
- const resolveConfig = (config) => {
2005
- const newConfig = mergeConfig$1({}, config);
2006
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
2007
- newConfig.headers = headers = AxiosHeaders$2.from(headers);
2008
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
2009
- if (auth) {
2010
- headers.set(
2011
- "Authorization",
2012
- "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
2013
- );
2014
- }
2015
- if (utils$1.isFormData(data)) {
2016
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2017
- headers.setContentType(void 0);
2018
- } else if (utils$1.isFunction(data.getHeaders)) {
2019
- const formHeaders = data.getHeaders();
2020
- const allowedHeaders = ["content-type", "content-length"];
2021
- Object.entries(formHeaders).forEach(([key, val]) => {
2022
- if (allowedHeaders.includes(key.toLowerCase())) {
2023
- headers.set(key, val);
2024
- }
2025
- });
2026
- }
2027
- }
2028
- if (platform.hasStandardBrowserEnv) {
2029
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2030
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
2031
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2032
- if (xsrfValue) {
2033
- headers.set(xsrfHeaderName, xsrfValue);
2034
- }
2035
- }
2036
- }
2037
- return newConfig;
2038
- };
2039
- const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
2040
- const xhrAdapter = isXHRAdapterSupported && function(config) {
2041
- return new Promise(function dispatchXhrRequest(resolve, reject) {
2042
- const _config = resolveConfig(config);
2043
- let requestData = _config.data;
2044
- const requestHeaders = AxiosHeaders$2.from(_config.headers).normalize();
2045
- let { responseType, onUploadProgress, onDownloadProgress } = _config;
2046
- let onCanceled;
2047
- let uploadThrottled, downloadThrottled;
2048
- let flushUpload, flushDownload;
2049
- function done() {
2050
- flushUpload && flushUpload();
2051
- flushDownload && flushDownload();
2052
- _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
2053
- _config.signal && _config.signal.removeEventListener("abort", onCanceled);
2054
- }
2055
- let request = new XMLHttpRequest();
2056
- request.open(_config.method.toUpperCase(), _config.url, true);
2057
- request.timeout = _config.timeout;
2058
- function onloadend() {
2059
- if (!request) {
2060
- return;
2061
- }
2062
- const responseHeaders = AxiosHeaders$2.from(
2063
- "getAllResponseHeaders" in request && request.getAllResponseHeaders()
2064
- );
2065
- const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
2066
- const response = {
2067
- data: responseData,
2068
- status: request.status,
2069
- statusText: request.statusText,
2070
- headers: responseHeaders,
2071
- config,
2072
- request
2073
- };
2074
- settle(function _resolve(value) {
2075
- resolve(value);
2076
- done();
2077
- }, function _reject(err) {
2078
- reject(err);
2079
- done();
2080
- }, response);
2081
- request = null;
2082
- }
2083
- if ("onloadend" in request) {
2084
- request.onloadend = onloadend;
2085
- } else {
2086
- request.onreadystatechange = function handleLoad() {
2087
- if (!request || request.readyState !== 4) {
2088
- return;
2089
- }
2090
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
2091
- return;
2092
- }
2093
- setTimeout(onloadend);
2094
- };
2095
- }
2096
- request.onabort = function handleAbort() {
2097
- if (!request) {
2098
- return;
2099
- }
2100
- reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
2101
- request = null;
2102
- };
2103
- request.onerror = function handleError(event) {
2104
- const msg = event && event.message ? event.message : "Network Error";
2105
- const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
2106
- err.event = event || null;
2107
- reject(err);
2108
- request = null;
2109
- };
2110
- request.ontimeout = function handleTimeout() {
2111
- let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
2112
- const transitional2 = _config.transitional || transitionalDefaults;
2113
- if (_config.timeoutErrorMessage) {
2114
- timeoutErrorMessage = _config.timeoutErrorMessage;
2115
- }
2116
- reject(new AxiosError$1(
2117
- timeoutErrorMessage,
2118
- transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
2119
- config,
2120
- request
2121
- ));
2122
- request = null;
2123
- };
2124
- requestData === void 0 && requestHeaders.setContentType(null);
2125
- if ("setRequestHeader" in request) {
2126
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2127
- request.setRequestHeader(key, val);
2128
- });
2129
- }
2130
- if (!utils$1.isUndefined(_config.withCredentials)) {
2131
- request.withCredentials = !!_config.withCredentials;
2132
- }
2133
- if (responseType && responseType !== "json") {
2134
- request.responseType = _config.responseType;
2135
- }
2136
- if (onDownloadProgress) {
2137
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
2138
- request.addEventListener("progress", downloadThrottled);
2139
- }
2140
- if (onUploadProgress && request.upload) {
2141
- [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
2142
- request.upload.addEventListener("progress", uploadThrottled);
2143
- request.upload.addEventListener("loadend", flushUpload);
2144
- }
2145
- if (_config.cancelToken || _config.signal) {
2146
- onCanceled = (cancel) => {
2147
- if (!request) {
2148
- return;
2149
- }
2150
- reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
2151
- request.abort();
2152
- request = null;
2153
- };
2154
- _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
2155
- if (_config.signal) {
2156
- _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
2157
- }
2158
- }
2159
- const protocol = parseProtocol(_config.url);
2160
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
2161
- reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
2162
- return;
2163
- }
2164
- request.send(requestData || null);
2165
- });
2166
- };
2167
- const composeSignals = (signals, timeout) => {
2168
- const { length } = signals = signals ? signals.filter(Boolean) : [];
2169
- if (timeout || length) {
2170
- let controller = new AbortController();
2171
- let aborted;
2172
- const onabort = function(reason) {
2173
- if (!aborted) {
2174
- aborted = true;
2175
- unsubscribe();
2176
- const err = reason instanceof Error ? reason : this.reason;
2177
- controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
2178
- }
2179
- };
2180
- let timer = timeout && setTimeout(() => {
2181
- timer = null;
2182
- onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
2183
- }, timeout);
2184
- const unsubscribe = () => {
2185
- if (signals) {
2186
- timer && clearTimeout(timer);
2187
- timer = null;
2188
- signals.forEach((signal2) => {
2189
- signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
2190
- });
2191
- signals = null;
2192
- }
2193
- };
2194
- signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
2195
- const { signal } = controller;
2196
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
2197
- return signal;
2198
- }
2199
- };
2200
- const composeSignals$1 = composeSignals;
2201
- const streamChunk = function* (chunk, chunkSize) {
2202
- let len = chunk.byteLength;
2203
- if (!chunkSize || len < chunkSize) {
2204
- yield chunk;
2205
- return;
2206
- }
2207
- let pos = 0;
2208
- let end;
2209
- while (pos < len) {
2210
- end = pos + chunkSize;
2211
- yield chunk.slice(pos, end);
2212
- pos = end;
2213
- }
2214
- };
2215
- const readBytes = async function* (iterable, chunkSize) {
2216
- for await (const chunk of readStream(iterable)) {
2217
- yield* streamChunk(chunk, chunkSize);
2218
- }
2219
- };
2220
- const readStream = async function* (stream) {
2221
- if (stream[Symbol.asyncIterator]) {
2222
- yield* stream;
2223
- return;
2224
- }
2225
- const reader = stream.getReader();
2226
- try {
2227
- for (; ; ) {
2228
- const { done, value } = await reader.read();
2229
- if (done) {
2230
- break;
2231
- }
2232
- yield value;
2233
- }
2234
- } finally {
2235
- await reader.cancel();
2236
- }
2237
- };
2238
- const trackStream = (stream, chunkSize, onProgress, onFinish) => {
2239
- const iterator2 = readBytes(stream, chunkSize);
2240
- let bytes = 0;
2241
- let done;
2242
- let _onFinish = (e) => {
2243
- if (!done) {
2244
- done = true;
2245
- onFinish && onFinish(e);
2246
- }
2247
- };
2248
- return new ReadableStream({
2249
- async pull(controller) {
2250
- try {
2251
- const { done: done2, value } = await iterator2.next();
2252
- if (done2) {
2253
- _onFinish();
2254
- controller.close();
2255
- return;
2256
- }
2257
- let len = value.byteLength;
2258
- if (onProgress) {
2259
- let loadedBytes = bytes += len;
2260
- onProgress(loadedBytes);
2261
- }
2262
- controller.enqueue(new Uint8Array(value));
2263
- } catch (err) {
2264
- _onFinish(err);
2265
- throw err;
2266
- }
2267
- },
2268
- cancel(reason) {
2269
- _onFinish(reason);
2270
- return iterator2.return();
2271
- }
2272
- }, {
2273
- highWaterMark: 2
2274
- });
2275
- };
2276
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
2277
- const { isFunction } = utils$1;
2278
- const globalFetchAPI = (({ Request, Response }) => ({
2279
- Request,
2280
- Response
2281
- }))(utils$1.global);
2282
- const {
2283
- ReadableStream: ReadableStream$1,
2284
- TextEncoder
2285
- } = utils$1.global;
2286
- const test = (fn, ...args) => {
2287
- try {
2288
- return !!fn(...args);
2289
- } catch (e) {
2290
- return false;
2291
- }
2292
- };
2293
- const factory$1 = (env) => {
2294
- env = utils$1.merge.call({
2295
- skipUndefined: true
2296
- }, globalFetchAPI, env);
2297
- const { fetch: envFetch, Request, Response } = env;
2298
- const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
2299
- const isRequestSupported = isFunction(Request);
2300
- const isResponseSupported = isFunction(Response);
2301
- if (!isFetchSupported) {
2302
- return false;
2303
- }
2304
- const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
2305
- const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
2306
- const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
2307
- let duplexAccessed = false;
2308
- const hasContentType = new Request(platform.origin, {
2309
- body: new ReadableStream$1(),
2310
- method: "POST",
2311
- get duplex() {
2312
- duplexAccessed = true;
2313
- return "half";
2314
- }
2315
- }).headers.has("Content-Type");
2316
- return duplexAccessed && !hasContentType;
2317
- });
2318
- const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
2319
- const resolvers = {
2320
- stream: supportsResponseStream && ((res) => res.body)
2321
- };
2322
- isFetchSupported && (() => {
2323
- ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
2324
- !resolvers[type] && (resolvers[type] = (res, config) => {
2325
- let method = res && res[type];
2326
- if (method) {
2327
- return method.call(res);
2328
- }
2329
- throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
2330
- });
2331
- });
2332
- })();
2333
- const getBodyLength = async (body) => {
2334
- if (body == null) {
2335
- return 0;
2336
- }
2337
- if (utils$1.isBlob(body)) {
2338
- return body.size;
2339
- }
2340
- if (utils$1.isSpecCompliantForm(body)) {
2341
- const _request = new Request(platform.origin, {
2342
- method: "POST",
2343
- body
2344
- });
2345
- return (await _request.arrayBuffer()).byteLength;
2346
- }
2347
- if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
2348
- return body.byteLength;
2349
- }
2350
- if (utils$1.isURLSearchParams(body)) {
2351
- body = body + "";
2352
- }
2353
- if (utils$1.isString(body)) {
2354
- return (await encodeText(body)).byteLength;
2355
- }
2356
- };
2357
- const resolveBodyLength = async (headers, body) => {
2358
- const length = utils$1.toFiniteNumber(headers.getContentLength());
2359
- return length == null ? getBodyLength(body) : length;
2360
- };
2361
- return async (config) => {
2362
- let {
2363
- url,
2364
- method,
2365
- data,
2366
- signal,
2367
- cancelToken,
2368
- timeout,
2369
- onDownloadProgress,
2370
- onUploadProgress,
2371
- responseType,
2372
- headers,
2373
- withCredentials = "same-origin",
2374
- fetchOptions
2375
- } = resolveConfig(config);
2376
- let _fetch = envFetch || fetch;
2377
- responseType = responseType ? (responseType + "").toLowerCase() : "text";
2378
- let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2379
- let request = null;
2380
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2381
- composedSignal.unsubscribe();
2382
- });
2383
- let requestContentLength;
2384
- try {
2385
- if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
2386
- let _request = new Request(url, {
2387
- method: "POST",
2388
- body: data,
2389
- duplex: "half"
2390
- });
2391
- let contentTypeHeader;
2392
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
2393
- headers.setContentType(contentTypeHeader);
2394
- }
2395
- if (_request.body) {
2396
- const [onProgress, flush] = progressEventDecorator(
2397
- requestContentLength,
2398
- progressEventReducer(asyncDecorator(onUploadProgress))
2399
- );
2400
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2401
- }
2402
- }
2403
- if (!utils$1.isString(withCredentials)) {
2404
- withCredentials = withCredentials ? "include" : "omit";
2405
- }
2406
- const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
2407
- const resolvedOptions = {
2408
- ...fetchOptions,
2409
- signal: composedSignal,
2410
- method: method.toUpperCase(),
2411
- headers: headers.normalize().toJSON(),
2412
- body: data,
2413
- duplex: "half",
2414
- credentials: isCredentialsSupported ? withCredentials : void 0
2415
- };
2416
- request = isRequestSupported && new Request(url, resolvedOptions);
2417
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
2418
- const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
2419
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
2420
- const options = {};
2421
- ["status", "statusText", "headers"].forEach((prop) => {
2422
- options[prop] = response[prop];
2423
- });
2424
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
2425
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
2426
- responseContentLength,
2427
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
2428
- ) || [];
2429
- response = new Response(
2430
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
2431
- flush && flush();
2432
- unsubscribe && unsubscribe();
2433
- }),
2434
- options
2435
- );
2436
- }
2437
- responseType = responseType || "text";
2438
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
2439
- !isStreamResponse && unsubscribe && unsubscribe();
2440
- return await new Promise((resolve, reject) => {
2441
- settle(resolve, reject, {
2442
- data: responseData,
2443
- headers: AxiosHeaders$2.from(response.headers),
2444
- status: response.status,
2445
- statusText: response.statusText,
2446
- config,
2447
- request
2448
- });
2449
- });
2450
- } catch (err) {
2451
- unsubscribe && unsubscribe();
2452
- if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
2453
- throw Object.assign(
2454
- new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request),
2455
- {
2456
- cause: err.cause || err
2457
- }
2458
- );
2459
- }
2460
- throw AxiosError$1.from(err, err && err.code, config, request);
2461
- }
2462
- };
2463
- };
2464
- const seedCache = /* @__PURE__ */ new Map();
2465
- const getFetch = (config) => {
2466
- let env = config && config.env || {};
2467
- const { fetch: fetch2, Request, Response } = env;
2468
- const seeds = [
2469
- Request,
2470
- Response,
2471
- fetch2
2472
- ];
2473
- let len = seeds.length, i = len, seed, target, map = seedCache;
2474
- while (i--) {
2475
- seed = seeds[i];
2476
- target = map.get(seed);
2477
- target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory$1(env));
2478
- map = target;
2479
- }
2480
- return target;
2481
- };
2482
- getFetch();
2483
- const knownAdapters = {
2484
- http: httpAdapter,
2485
- xhr: xhrAdapter,
2486
- fetch: {
2487
- get: getFetch
2488
- }
2489
- };
2490
- utils$1.forEach(knownAdapters, (fn, value) => {
2491
- if (fn) {
2492
- try {
2493
- Object.defineProperty(fn, "name", { value });
2494
- } catch (e) {
2495
- }
2496
- Object.defineProperty(fn, "adapterName", { value });
2497
- }
2498
- });
2499
- const renderReason = (reason) => `- ${reason}`;
2500
- const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
2501
- function getAdapter$1(adapters2, config) {
2502
- adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
2503
- const { length } = adapters2;
2504
- let nameOrAdapter;
2505
- let adapter;
2506
- const rejectedReasons = {};
2507
- for (let i = 0; i < length; i++) {
2508
- nameOrAdapter = adapters2[i];
2509
- let id;
2510
- adapter = nameOrAdapter;
2511
- if (!isResolvedHandle(nameOrAdapter)) {
2512
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
2513
- if (adapter === void 0) {
2514
- throw new AxiosError$1(`Unknown adapter '${id}'`);
2515
- }
2516
- }
2517
- if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
2518
- break;
2519
- }
2520
- rejectedReasons[id || "#" + i] = adapter;
2521
- }
2522
- if (!adapter) {
2523
- const reasons = Object.entries(rejectedReasons).map(
2524
- ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
2525
- );
2526
- let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
2527
- throw new AxiosError$1(
2528
- `There is no suitable adapter to dispatch the request ` + s,
2529
- "ERR_NOT_SUPPORT"
2530
- );
2531
- }
2532
- return adapter;
2533
- }
2534
- const adapters = {
2535
- /**
2536
- * Resolve an adapter from a list of adapter names or functions.
2537
- * @type {Function}
2538
- */
2539
- getAdapter: getAdapter$1,
2540
- /**
2541
- * Exposes all known adapters
2542
- * @type {Object<string, Function|Object>}
2543
- */
2544
- adapters: knownAdapters
2545
- };
2546
- function throwIfCancellationRequested(config) {
2547
- if (config.cancelToken) {
2548
- config.cancelToken.throwIfRequested();
2549
- }
2550
- if (config.signal && config.signal.aborted) {
2551
- throw new CanceledError$1(null, config);
2552
- }
2553
- }
2554
- function dispatchRequest(config) {
2555
- throwIfCancellationRequested(config);
2556
- config.headers = AxiosHeaders$2.from(config.headers);
2557
- config.data = transformData.call(
2558
- config,
2559
- config.transformRequest
2560
- );
2561
- if (["post", "put", "patch"].indexOf(config.method) !== -1) {
2562
- config.headers.setContentType("application/x-www-form-urlencoded", false);
2563
- }
2564
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
2565
- return adapter(config).then(function onAdapterResolution(response) {
2566
- throwIfCancellationRequested(config);
2567
- response.data = transformData.call(
2568
- config,
2569
- config.transformResponse,
2570
- response
2571
- );
2572
- response.headers = AxiosHeaders$2.from(response.headers);
2573
- return response;
2574
- }, function onAdapterRejection(reason) {
2575
- if (!isCancel$1(reason)) {
2576
- throwIfCancellationRequested(config);
2577
- if (reason && reason.response) {
2578
- reason.response.data = transformData.call(
2579
- config,
2580
- config.transformResponse,
2581
- reason.response
2582
- );
2583
- reason.response.headers = AxiosHeaders$2.from(reason.response.headers);
2584
- }
2585
- }
2586
- return Promise.reject(reason);
2587
- });
2588
- }
2589
- const VERSION$1 = "1.13.2";
2590
- const validators$1 = {};
2591
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
2592
- validators$1[type] = function validator2(thing) {
2593
- return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
2594
- };
2595
- });
2596
- const deprecatedWarnings = {};
2597
- validators$1.transitional = function transitional(validator2, version, message) {
2598
- function formatMessage(opt, desc) {
2599
- return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
2600
- }
2601
- return (value, opt, opts) => {
2602
- if (validator2 === false) {
2603
- throw new AxiosError$1(
2604
- formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
2605
- AxiosError$1.ERR_DEPRECATED
2606
- );
2607
- }
2608
- if (version && !deprecatedWarnings[opt]) {
2609
- deprecatedWarnings[opt] = true;
2610
- console.warn(
2611
- formatMessage(
2612
- opt,
2613
- " has been deprecated since v" + version + " and will be removed in the near future"
2614
- )
2615
- );
2616
- }
2617
- return validator2 ? validator2(value, opt, opts) : true;
2618
- };
2619
- };
2620
- validators$1.spelling = function spelling(correctSpelling) {
2621
- return (value, opt) => {
2622
- console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
2623
- return true;
2624
- };
2625
- };
2626
- function assertOptions(options, schema, allowUnknown) {
2627
- if (typeof options !== "object") {
2628
- throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
2629
- }
2630
- const keys = Object.keys(options);
2631
- let i = keys.length;
2632
- while (i-- > 0) {
2633
- const opt = keys[i];
2634
- const validator2 = schema[opt];
2635
- if (validator2) {
2636
- const value = options[opt];
2637
- const result = value === void 0 || validator2(value, opt, options);
2638
- if (result !== true) {
2639
- throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
2640
- }
2641
- continue;
2642
- }
2643
- if (allowUnknown !== true) {
2644
- throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
2645
- }
2646
- }
2647
- }
2648
- const validator = {
2649
- assertOptions,
2650
- validators: validators$1
2651
- };
2652
- const validators = validator.validators;
2653
- let Axios$1 = class Axios {
2654
- constructor(instanceConfig) {
2655
- this.defaults = instanceConfig || {};
2656
- this.interceptors = {
2657
- request: new InterceptorManager$1(),
2658
- response: new InterceptorManager$1()
2659
- };
2660
- }
2661
- /**
2662
- * Dispatch a request
2663
- *
2664
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
2665
- * @param {?Object} config
2666
- *
2667
- * @returns {Promise} The Promise to be fulfilled
2668
- */
2669
- async request(configOrUrl, config) {
2670
- try {
2671
- return await this._request(configOrUrl, config);
2672
- } catch (err) {
2673
- if (err instanceof Error) {
2674
- let dummy = {};
2675
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
2676
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
2677
- try {
2678
- if (!err.stack) {
2679
- err.stack = stack;
2680
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
2681
- err.stack += "\n" + stack;
2682
- }
2683
- } catch (e) {
2684
- }
2685
- }
2686
- throw err;
2687
- }
2688
- }
2689
- _request(configOrUrl, config) {
2690
- if (typeof configOrUrl === "string") {
2691
- config = config || {};
2692
- config.url = configOrUrl;
2693
- } else {
2694
- config = configOrUrl || {};
2695
- }
2696
- config = mergeConfig$1(this.defaults, config);
2697
- const { transitional: transitional2, paramsSerializer, headers } = config;
2698
- if (transitional2 !== void 0) {
2699
- validator.assertOptions(transitional2, {
2700
- silentJSONParsing: validators.transitional(validators.boolean),
2701
- forcedJSONParsing: validators.transitional(validators.boolean),
2702
- clarifyTimeoutError: validators.transitional(validators.boolean)
2703
- }, false);
2704
- }
2705
- if (paramsSerializer != null) {
2706
- if (utils$1.isFunction(paramsSerializer)) {
2707
- config.paramsSerializer = {
2708
- serialize: paramsSerializer
2709
- };
2710
- } else {
2711
- validator.assertOptions(paramsSerializer, {
2712
- encode: validators.function,
2713
- serialize: validators.function
2714
- }, true);
2715
- }
2716
- }
2717
- if (config.allowAbsoluteUrls !== void 0)
2718
- ;
2719
- else if (this.defaults.allowAbsoluteUrls !== void 0) {
2720
- config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
2721
- } else {
2722
- config.allowAbsoluteUrls = true;
2723
- }
2724
- validator.assertOptions(config, {
2725
- baseUrl: validators.spelling("baseURL"),
2726
- withXsrfToken: validators.spelling("withXSRFToken")
2727
- }, true);
2728
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
2729
- let contextHeaders = headers && utils$1.merge(
2730
- headers.common,
2731
- headers[config.method]
2732
- );
2733
- headers && utils$1.forEach(
2734
- ["delete", "get", "head", "post", "put", "patch", "common"],
2735
- (method) => {
2736
- delete headers[method];
2737
- }
2738
- );
2739
- config.headers = AxiosHeaders$2.concat(contextHeaders, headers);
2740
- const requestInterceptorChain = [];
2741
- let synchronousRequestInterceptors = true;
2742
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2743
- if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
2744
- return;
2745
- }
2746
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
2747
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2748
- });
2749
- const responseInterceptorChain = [];
2750
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2751
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
2752
- });
2753
- let promise;
2754
- let i = 0;
2755
- let len;
2756
- if (!synchronousRequestInterceptors) {
2757
- const chain = [dispatchRequest.bind(this), void 0];
2758
- chain.unshift(...requestInterceptorChain);
2759
- chain.push(...responseInterceptorChain);
2760
- len = chain.length;
2761
- promise = Promise.resolve(config);
2762
- while (i < len) {
2763
- promise = promise.then(chain[i++], chain[i++]);
2764
- }
2765
- return promise;
2766
- }
2767
- len = requestInterceptorChain.length;
2768
- let newConfig = config;
2769
- while (i < len) {
2770
- const onFulfilled = requestInterceptorChain[i++];
2771
- const onRejected = requestInterceptorChain[i++];
2772
- try {
2773
- newConfig = onFulfilled(newConfig);
2774
- } catch (error) {
2775
- onRejected.call(this, error);
2776
- break;
2777
- }
2778
- }
2779
- try {
2780
- promise = dispatchRequest.call(this, newConfig);
2781
- } catch (error) {
2782
- return Promise.reject(error);
2783
- }
2784
- i = 0;
2785
- len = responseInterceptorChain.length;
2786
- while (i < len) {
2787
- promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
2788
- }
2789
- return promise;
2790
- }
2791
- getUri(config) {
2792
- config = mergeConfig$1(this.defaults, config);
2793
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
2794
- return buildURL(fullPath, config.params, config.paramsSerializer);
2795
- }
2796
- };
2797
- utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
2798
- Axios$1.prototype[method] = function(url, config) {
2799
- return this.request(mergeConfig$1(config || {}, {
2800
- method,
2801
- url,
2802
- data: (config || {}).data
2803
- }));
2804
- };
2805
- });
2806
- utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
2807
- function generateHTTPMethod(isForm) {
2808
- return function httpMethod(url, data, config) {
2809
- return this.request(mergeConfig$1(config || {}, {
2810
- method,
2811
- headers: isForm ? {
2812
- "Content-Type": "multipart/form-data"
2813
- } : {},
2814
- url,
2815
- data
2816
- }));
2817
- };
2818
- }
2819
- Axios$1.prototype[method] = generateHTTPMethod();
2820
- Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
2821
- });
2822
- const Axios$2 = Axios$1;
2823
- let CancelToken$1 = class CancelToken {
2824
- constructor(executor) {
2825
- if (typeof executor !== "function") {
2826
- throw new TypeError("executor must be a function.");
2827
- }
2828
- let resolvePromise;
2829
- this.promise = new Promise(function promiseExecutor(resolve) {
2830
- resolvePromise = resolve;
2831
- });
2832
- const token = this;
2833
- this.promise.then((cancel) => {
2834
- if (!token._listeners)
2835
- return;
2836
- let i = token._listeners.length;
2837
- while (i-- > 0) {
2838
- token._listeners[i](cancel);
2839
- }
2840
- token._listeners = null;
2841
- });
2842
- this.promise.then = (onfulfilled) => {
2843
- let _resolve;
2844
- const promise = new Promise((resolve) => {
2845
- token.subscribe(resolve);
2846
- _resolve = resolve;
2847
- }).then(onfulfilled);
2848
- promise.cancel = function reject() {
2849
- token.unsubscribe(_resolve);
2850
- };
2851
- return promise;
2852
- };
2853
- executor(function cancel(message, config, request) {
2854
- if (token.reason) {
2855
- return;
2856
- }
2857
- token.reason = new CanceledError$1(message, config, request);
2858
- resolvePromise(token.reason);
2859
- });
2860
- }
2861
- /**
2862
- * Throws a `CanceledError` if cancellation has been requested.
2863
- */
2864
- throwIfRequested() {
2865
- if (this.reason) {
2866
- throw this.reason;
2867
- }
2868
- }
2869
- /**
2870
- * Subscribe to the cancel signal
2871
- */
2872
- subscribe(listener) {
2873
- if (this.reason) {
2874
- listener(this.reason);
2875
- return;
2876
- }
2877
- if (this._listeners) {
2878
- this._listeners.push(listener);
2879
- } else {
2880
- this._listeners = [listener];
2881
- }
2882
- }
2883
- /**
2884
- * Unsubscribe from the cancel signal
2885
- */
2886
- unsubscribe(listener) {
2887
- if (!this._listeners) {
2888
- return;
2889
- }
2890
- const index2 = this._listeners.indexOf(listener);
2891
- if (index2 !== -1) {
2892
- this._listeners.splice(index2, 1);
2893
- }
2894
- }
2895
- toAbortSignal() {
2896
- const controller = new AbortController();
2897
- const abort = (err) => {
2898
- controller.abort(err);
2899
- };
2900
- this.subscribe(abort);
2901
- controller.signal.unsubscribe = () => this.unsubscribe(abort);
2902
- return controller.signal;
2903
- }
2904
- /**
2905
- * Returns an object that contains a new `CancelToken` and a function that, when called,
2906
- * cancels the `CancelToken`.
2907
- */
2908
- static source() {
2909
- let cancel;
2910
- const token = new CancelToken(function executor(c) {
2911
- cancel = c;
2912
- });
2913
- return {
2914
- token,
2915
- cancel
2916
- };
2917
- }
2918
- };
2919
- const CancelToken$2 = CancelToken$1;
2920
- function spread$1(callback) {
2921
- return function wrap(arr) {
2922
- return callback.apply(null, arr);
2923
- };
2924
- }
2925
- function isAxiosError$1(payload) {
2926
- return utils$1.isObject(payload) && payload.isAxiosError === true;
2927
- }
2928
- const HttpStatusCode$1 = {
2929
- Continue: 100,
2930
- SwitchingProtocols: 101,
2931
- Processing: 102,
2932
- EarlyHints: 103,
2933
- Ok: 200,
2934
- Created: 201,
2935
- Accepted: 202,
2936
- NonAuthoritativeInformation: 203,
2937
- NoContent: 204,
2938
- ResetContent: 205,
2939
- PartialContent: 206,
2940
- MultiStatus: 207,
2941
- AlreadyReported: 208,
2942
- ImUsed: 226,
2943
- MultipleChoices: 300,
2944
- MovedPermanently: 301,
2945
- Found: 302,
2946
- SeeOther: 303,
2947
- NotModified: 304,
2948
- UseProxy: 305,
2949
- Unused: 306,
2950
- TemporaryRedirect: 307,
2951
- PermanentRedirect: 308,
2952
- BadRequest: 400,
2953
- Unauthorized: 401,
2954
- PaymentRequired: 402,
2955
- Forbidden: 403,
2956
- NotFound: 404,
2957
- MethodNotAllowed: 405,
2958
- NotAcceptable: 406,
2959
- ProxyAuthenticationRequired: 407,
2960
- RequestTimeout: 408,
2961
- Conflict: 409,
2962
- Gone: 410,
2963
- LengthRequired: 411,
2964
- PreconditionFailed: 412,
2965
- PayloadTooLarge: 413,
2966
- UriTooLong: 414,
2967
- UnsupportedMediaType: 415,
2968
- RangeNotSatisfiable: 416,
2969
- ExpectationFailed: 417,
2970
- ImATeapot: 418,
2971
- MisdirectedRequest: 421,
2972
- UnprocessableEntity: 422,
2973
- Locked: 423,
2974
- FailedDependency: 424,
2975
- TooEarly: 425,
2976
- UpgradeRequired: 426,
2977
- PreconditionRequired: 428,
2978
- TooManyRequests: 429,
2979
- RequestHeaderFieldsTooLarge: 431,
2980
- UnavailableForLegalReasons: 451,
2981
- InternalServerError: 500,
2982
- NotImplemented: 501,
2983
- BadGateway: 502,
2984
- ServiceUnavailable: 503,
2985
- GatewayTimeout: 504,
2986
- HttpVersionNotSupported: 505,
2987
- VariantAlsoNegotiates: 506,
2988
- InsufficientStorage: 507,
2989
- LoopDetected: 508,
2990
- NotExtended: 510,
2991
- NetworkAuthenticationRequired: 511,
2992
- WebServerIsDown: 521,
2993
- ConnectionTimedOut: 522,
2994
- OriginIsUnreachable: 523,
2995
- TimeoutOccurred: 524,
2996
- SslHandshakeFailed: 525,
2997
- InvalidSslCertificate: 526
2998
- };
2999
- Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
3000
- HttpStatusCode$1[value] = key;
3001
- });
3002
- const HttpStatusCode$2 = HttpStatusCode$1;
3003
- function createInstance(defaultConfig) {
3004
- const context = new Axios$2(defaultConfig);
3005
- const instance = bind(Axios$2.prototype.request, context);
3006
- utils$1.extend(instance, Axios$2.prototype, context, { allOwnKeys: true });
3007
- utils$1.extend(instance, context, null, { allOwnKeys: true });
3008
- instance.create = function create(instanceConfig) {
3009
- return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
3010
- };
3011
- return instance;
3012
- }
3013
- const axios = createInstance(defaults$1);
3014
- axios.Axios = Axios$2;
3015
- axios.CanceledError = CanceledError$1;
3016
- axios.CancelToken = CancelToken$2;
3017
- axios.isCancel = isCancel$1;
3018
- axios.VERSION = VERSION$1;
3019
- axios.toFormData = toFormData$1;
3020
- axios.AxiosError = AxiosError$1;
3021
- axios.Cancel = axios.CanceledError;
3022
- axios.all = function all(promises) {
3023
- return Promise.all(promises);
3024
- };
3025
- axios.spread = spread$1;
3026
- axios.isAxiosError = isAxiosError$1;
3027
- axios.mergeConfig = mergeConfig$1;
3028
- axios.AxiosHeaders = AxiosHeaders$2;
3029
- axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
3030
- axios.getAdapter = adapters.getAdapter;
3031
- axios.HttpStatusCode = HttpStatusCode$2;
3032
- axios.default = axios;
3033
- const Fetch = axios;
3034
- const {
3035
- Axios: Axios2,
3036
- AxiosError,
3037
- CanceledError,
3038
- isCancel,
3039
- CancelToken: CancelToken2,
3040
- VERSION,
3041
- all: all2,
3042
- Cancel,
3043
- isAxiosError,
3044
- spread,
3045
- toFormData,
3046
- AxiosHeaders: AxiosHeaders2,
3047
- HttpStatusCode,
3048
- formToJSON,
3049
- getAdapter,
3050
- mergeConfig
3051
- } = Fetch;
3052
114
  var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
3053
115
  ErrorCode2["ServerError"] = "ServerError";
3054
116
  ErrorCode2["UnknownError"] = "UnknownError";
@@ -3060,7 +122,7 @@ const createErrorResult = (code, message, error) => {
3060
122
  err_msg: `${message}`
3061
123
  }, error);
3062
124
  };
3063
- const fetch$2 = Fetch.create();
125
+ const fetch$1 = Fetch.create();
3064
126
  const fetchBase$1 = (path, params, config) => {
3065
127
  return Promise.all([getPlatformAPIHost(), getInstanceId()]).then((_ref) => {
3066
128
  let [base, instance_id] = _ref;
@@ -3070,7 +132,7 @@ const fetchBase$1 = (path, params, config) => {
3070
132
  ...params,
3071
133
  instance_id
3072
134
  };
3073
- return fetch$2({
135
+ return fetch$1({
3074
136
  ...config,
3075
137
  url,
3076
138
  data
@@ -3083,7 +145,7 @@ const fetchBase$1 = (path, params, config) => {
3083
145
  }).then((response) => {
3084
146
  return response.data;
3085
147
  }).catch((error) => {
3086
- if (error instanceof AxiosError) {
148
+ if (error instanceof Fetch.AxiosError) {
3087
149
  const $error = error;
3088
150
  const data = $error.response.data;
3089
151
  if (data.code) {
@@ -3169,10 +231,10 @@ class EntityQueryClass {
3169
231
  const array = [[this._cursor[0], "after_cursor"], [this._limit[0], "limit"], [this._sort[0], "sort"], [this._index[0], "index.name"], [this._index[1], "index.partition_values"], [this._where[0], "where"]];
3170
232
  array.forEach((item) => {
3171
233
  const [value, path] = item;
3172
- if (isNull(value) || isUndefined$1(value) || isSymbol(value))
234
+ if (lodashEs.isNull(value) || lodashEs.isUndefined(value) || lodashEs.isSymbol(value))
3173
235
  ;
3174
236
  else {
3175
- set(data, path, value);
237
+ lodashEs.set(data, path, value);
3176
238
  }
3177
239
  });
3178
240
  const result = {
@@ -3343,7 +405,7 @@ class ObjectError {
3343
405
  this.err_values = result.err_values;
3344
406
  }
3345
407
  }
3346
- const fetch$1 = Fetch.create();
408
+ const fetch = Fetch.create();
3347
409
  const fetchBase = (path, params) => {
3348
410
  return Promise.all([getPlatformAPIHost(), getInstanceId()]).then((_ref) => {
3349
411
  let [base, instance_id] = _ref;
@@ -3353,7 +415,7 @@ const fetchBase = (path, params) => {
3353
415
  ...params,
3354
416
  instance_id
3355
417
  };
3356
- return fetch$1.post(url, data);
418
+ return fetch.post(url, data);
3357
419
  }
3358
420
  throw new Error(JSON.stringify({
3359
421
  base,
@@ -3362,7 +424,7 @@ const fetchBase = (path, params) => {
3362
424
  }).then((response) => {
3363
425
  return response.data;
3364
426
  }).catch((error) => {
3365
- if (error instanceof AxiosError) {
427
+ if (error instanceof Fetch.AxiosError) {
3366
428
  const $error = error;
3367
429
  const data = $error.response.data;
3368
430
  if (data.code) {