@m4l/core 0.1.18 → 0.1.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.
package/index.js CHANGED
@@ -21,5 +21,5 @@ export { E as EmitEvents } from "./types/index.js";
21
21
  export { a as getLocalStorage, g as getPropertyByString, s as setLocalStorage, v as voidFunction } from "./utils/index.js";
22
22
  export { a as axiosOperation } from "./utils/axiosOperation.js";
23
23
  import "react/jsx-runtime";
24
- import "./external/axios.js";
24
+ import "axios";
25
25
  import "qs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/core",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team",
6
6
  "dependencies": {
@@ -1,4 +1,4 @@
1
- import { a as axios } from "../external/axios.js";
1
+ import axios from "axios";
2
2
  import qs from "qs";
3
3
  import { E as EmitEvents } from "../types/index.js";
4
4
  function getResponse(endPoint, response, hostTools) {
@@ -25,10 +25,10 @@ function getError(error, hostTools, checkUnAuthorized = true) {
25
25
  status: 1,
26
26
  code: 0
27
27
  };
28
- console.log("getError", error);
29
28
  if (error?.code !== void 0 && err.status !== void 0 && error.message !== void 0) {
30
29
  err = { ...err, ...error };
31
- } else if (error?.response) {
30
+ }
31
+ if (error?.response) {
32
32
  if (error.response.data && typeof error.response.data === "object" && error.response.data.error && error.response.data.error?.code && error.response.data.error?.message !== void 0) {
33
33
  err = { ...error.response.data.error, status: error.response.status };
34
34
  } else {
@@ -36,9 +36,6 @@ function getError(error, hostTools, checkUnAuthorized = true) {
36
36
  err.status = error.response.status;
37
37
  err.code = 0;
38
38
  }
39
- if (checkUnAuthorized && error.response.status === 401) {
40
- hostTools.events_emit(EmitEvents.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, {});
41
- }
42
39
  } else if (error?.request) {
43
40
  err.message = `${error?.code} ${error.message}`;
44
41
  err.code = -1;
@@ -47,6 +44,9 @@ function getError(error, hostTools, checkUnAuthorized = true) {
47
44
  err.status = 0;
48
45
  err.code = -2;
49
46
  }
47
+ if (checkUnAuthorized && error?.response?.status === 401) {
48
+ hostTools.events_emit(EmitEvents.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, {});
49
+ }
50
50
  if (error?.response?.data?.error?.message) {
51
51
  err.message = error?.response?.data?.error.message;
52
52
  }
package/utils/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import "../external/axios.js";
1
+ import "axios";
2
2
  import "qs";
3
3
  function voidFunction() {
4
4
  }
package/external/axios.js DELETED
@@ -1,1261 +0,0 @@
1
- var axios$2 = { exports: {} };
2
- var bind$2 = function bind(fn, thisArg) {
3
- return function wrap() {
4
- var args = new Array(arguments.length);
5
- for (var i = 0; i < args.length; i++) {
6
- args[i] = arguments[i];
7
- }
8
- return fn.apply(thisArg, args);
9
- };
10
- };
11
- var bind$1 = bind$2;
12
- var toString = Object.prototype.toString;
13
- var kindOf = function(cache) {
14
- return function(thing) {
15
- var str = toString.call(thing);
16
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
17
- };
18
- }(/* @__PURE__ */ Object.create(null));
19
- function kindOfTest(type) {
20
- type = type.toLowerCase();
21
- return function isKindOf(thing) {
22
- return kindOf(thing) === type;
23
- };
24
- }
25
- function isArray(val) {
26
- return Array.isArray(val);
27
- }
28
- function isUndefined(val) {
29
- return typeof val === "undefined";
30
- }
31
- function isBuffer(val) {
32
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val);
33
- }
34
- var isArrayBuffer = kindOfTest("ArrayBuffer");
35
- function isArrayBufferView(val) {
36
- var result;
37
- if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
38
- result = ArrayBuffer.isView(val);
39
- } else {
40
- result = val && val.buffer && isArrayBuffer(val.buffer);
41
- }
42
- return result;
43
- }
44
- function isString(val) {
45
- return typeof val === "string";
46
- }
47
- function isNumber(val) {
48
- return typeof val === "number";
49
- }
50
- function isObject(val) {
51
- return val !== null && typeof val === "object";
52
- }
53
- function isPlainObject(val) {
54
- if (kindOf(val) !== "object") {
55
- return false;
56
- }
57
- var prototype2 = Object.getPrototypeOf(val);
58
- return prototype2 === null || prototype2 === Object.prototype;
59
- }
60
- var isDate = kindOfTest("Date");
61
- var isFile = kindOfTest("File");
62
- var isBlob = kindOfTest("Blob");
63
- var isFileList = kindOfTest("FileList");
64
- function isFunction(val) {
65
- return toString.call(val) === "[object Function]";
66
- }
67
- function isStream(val) {
68
- return isObject(val) && isFunction(val.pipe);
69
- }
70
- function isFormData(thing) {
71
- var pattern = "[object FormData]";
72
- return thing && (typeof FormData === "function" && thing instanceof FormData || toString.call(thing) === pattern || isFunction(thing.toString) && thing.toString() === pattern);
73
- }
74
- var isURLSearchParams = kindOfTest("URLSearchParams");
75
- function trim(str) {
76
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
77
- }
78
- function isStandardBrowserEnv() {
79
- if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) {
80
- return false;
81
- }
82
- return typeof window !== "undefined" && typeof document !== "undefined";
83
- }
84
- function forEach(obj, fn) {
85
- if (obj === null || typeof obj === "undefined") {
86
- return;
87
- }
88
- if (typeof obj !== "object") {
89
- obj = [obj];
90
- }
91
- if (isArray(obj)) {
92
- for (var i = 0, l = obj.length; i < l; i++) {
93
- fn.call(null, obj[i], i, obj);
94
- }
95
- } else {
96
- for (var key in obj) {
97
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
98
- fn.call(null, obj[key], key, obj);
99
- }
100
- }
101
- }
102
- }
103
- function merge() {
104
- var result = {};
105
- function assignValue(val, key) {
106
- if (isPlainObject(result[key]) && isPlainObject(val)) {
107
- result[key] = merge(result[key], val);
108
- } else if (isPlainObject(val)) {
109
- result[key] = merge({}, val);
110
- } else if (isArray(val)) {
111
- result[key] = val.slice();
112
- } else {
113
- result[key] = val;
114
- }
115
- }
116
- for (var i = 0, l = arguments.length; i < l; i++) {
117
- forEach(arguments[i], assignValue);
118
- }
119
- return result;
120
- }
121
- function extend(a, b, thisArg) {
122
- forEach(b, function assignValue(val, key) {
123
- if (thisArg && typeof val === "function") {
124
- a[key] = bind$1(val, thisArg);
125
- } else {
126
- a[key] = val;
127
- }
128
- });
129
- return a;
130
- }
131
- function stripBOM(content) {
132
- if (content.charCodeAt(0) === 65279) {
133
- content = content.slice(1);
134
- }
135
- return content;
136
- }
137
- function inherits(constructor, superConstructor, props, descriptors2) {
138
- constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
139
- constructor.prototype.constructor = constructor;
140
- props && Object.assign(constructor.prototype, props);
141
- }
142
- function toFlatObject(sourceObj, destObj, filter) {
143
- var props;
144
- var i;
145
- var prop;
146
- var merged = {};
147
- destObj = destObj || {};
148
- do {
149
- props = Object.getOwnPropertyNames(sourceObj);
150
- i = props.length;
151
- while (i-- > 0) {
152
- prop = props[i];
153
- if (!merged[prop]) {
154
- destObj[prop] = sourceObj[prop];
155
- merged[prop] = true;
156
- }
157
- }
158
- sourceObj = Object.getPrototypeOf(sourceObj);
159
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
160
- return destObj;
161
- }
162
- function endsWith(str, searchString, position) {
163
- str = String(str);
164
- if (position === void 0 || position > str.length) {
165
- position = str.length;
166
- }
167
- position -= searchString.length;
168
- var lastIndex = str.indexOf(searchString, position);
169
- return lastIndex !== -1 && lastIndex === position;
170
- }
171
- function toArray(thing) {
172
- if (!thing)
173
- return null;
174
- var i = thing.length;
175
- if (isUndefined(i))
176
- return null;
177
- var arr = new Array(i);
178
- while (i-- > 0) {
179
- arr[i] = thing[i];
180
- }
181
- return arr;
182
- }
183
- var isTypedArray = function(TypedArray) {
184
- return function(thing) {
185
- return TypedArray && thing instanceof TypedArray;
186
- };
187
- }(typeof Uint8Array !== "undefined" && Object.getPrototypeOf(Uint8Array));
188
- var utils$h = {
189
- isArray,
190
- isArrayBuffer,
191
- isBuffer,
192
- isFormData,
193
- isArrayBufferView,
194
- isString,
195
- isNumber,
196
- isObject,
197
- isPlainObject,
198
- isUndefined,
199
- isDate,
200
- isFile,
201
- isBlob,
202
- isFunction,
203
- isStream,
204
- isURLSearchParams,
205
- isStandardBrowserEnv,
206
- forEach,
207
- merge,
208
- extend,
209
- trim,
210
- stripBOM,
211
- inherits,
212
- toFlatObject,
213
- kindOf,
214
- kindOfTest,
215
- endsWith,
216
- toArray,
217
- isTypedArray,
218
- isFileList
219
- };
220
- var utils$g = utils$h;
221
- function encode(val) {
222
- return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
223
- }
224
- var buildURL$2 = function buildURL(url, params, paramsSerializer) {
225
- if (!params) {
226
- return url;
227
- }
228
- var serializedParams;
229
- if (paramsSerializer) {
230
- serializedParams = paramsSerializer(params);
231
- } else if (utils$g.isURLSearchParams(params)) {
232
- serializedParams = params.toString();
233
- } else {
234
- var parts = [];
235
- utils$g.forEach(params, function serialize(val, key) {
236
- if (val === null || typeof val === "undefined") {
237
- return;
238
- }
239
- if (utils$g.isArray(val)) {
240
- key = key + "[]";
241
- } else {
242
- val = [val];
243
- }
244
- utils$g.forEach(val, function parseValue(v) {
245
- if (utils$g.isDate(v)) {
246
- v = v.toISOString();
247
- } else if (utils$g.isObject(v)) {
248
- v = JSON.stringify(v);
249
- }
250
- parts.push(encode(key) + "=" + encode(v));
251
- });
252
- });
253
- serializedParams = parts.join("&");
254
- }
255
- if (serializedParams) {
256
- var hashmarkIndex = url.indexOf("#");
257
- if (hashmarkIndex !== -1) {
258
- url = url.slice(0, hashmarkIndex);
259
- }
260
- url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
261
- }
262
- return url;
263
- };
264
- var utils$f = utils$h;
265
- function InterceptorManager$1() {
266
- this.handlers = [];
267
- }
268
- InterceptorManager$1.prototype.use = function use(fulfilled, rejected, options) {
269
- this.handlers.push({
270
- fulfilled,
271
- rejected,
272
- synchronous: options ? options.synchronous : false,
273
- runWhen: options ? options.runWhen : null
274
- });
275
- return this.handlers.length - 1;
276
- };
277
- InterceptorManager$1.prototype.eject = function eject(id) {
278
- if (this.handlers[id]) {
279
- this.handlers[id] = null;
280
- }
281
- };
282
- InterceptorManager$1.prototype.forEach = function forEach2(fn) {
283
- utils$f.forEach(this.handlers, function forEachHandler(h) {
284
- if (h !== null) {
285
- fn(h);
286
- }
287
- });
288
- };
289
- var InterceptorManager_1 = InterceptorManager$1;
290
- var utils$e = utils$h;
291
- var normalizeHeaderName$1 = function normalizeHeaderName(headers, normalizedName) {
292
- utils$e.forEach(headers, function processHeader(value, name) {
293
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
294
- headers[normalizedName] = value;
295
- delete headers[name];
296
- }
297
- });
298
- };
299
- var utils$d = utils$h;
300
- function AxiosError$5(message, code, config, request2, response) {
301
- Error.call(this);
302
- this.message = message;
303
- this.name = "AxiosError";
304
- code && (this.code = code);
305
- config && (this.config = config);
306
- request2 && (this.request = request2);
307
- response && (this.response = response);
308
- }
309
- utils$d.inherits(AxiosError$5, Error, {
310
- toJSON: function toJSON() {
311
- return {
312
- message: this.message,
313
- name: this.name,
314
- description: this.description,
315
- number: this.number,
316
- fileName: this.fileName,
317
- lineNumber: this.lineNumber,
318
- columnNumber: this.columnNumber,
319
- stack: this.stack,
320
- config: this.config,
321
- code: this.code,
322
- status: this.response && this.response.status ? this.response.status : null
323
- };
324
- }
325
- });
326
- var prototype = AxiosError$5.prototype;
327
- var descriptors = {};
328
- [
329
- "ERR_BAD_OPTION_VALUE",
330
- "ERR_BAD_OPTION",
331
- "ECONNABORTED",
332
- "ETIMEDOUT",
333
- "ERR_NETWORK",
334
- "ERR_FR_TOO_MANY_REDIRECTS",
335
- "ERR_DEPRECATED",
336
- "ERR_BAD_RESPONSE",
337
- "ERR_BAD_REQUEST",
338
- "ERR_CANCELED"
339
- ].forEach(function(code) {
340
- descriptors[code] = { value: code };
341
- });
342
- Object.defineProperties(AxiosError$5, descriptors);
343
- Object.defineProperty(prototype, "isAxiosError", { value: true });
344
- AxiosError$5.from = function(error, code, config, request2, response, customProps) {
345
- var axiosError = Object.create(prototype);
346
- utils$d.toFlatObject(error, axiosError, function filter(obj) {
347
- return obj !== Error.prototype;
348
- });
349
- AxiosError$5.call(axiosError, error.message, code, config, request2, response);
350
- axiosError.name = error.name;
351
- customProps && Object.assign(axiosError, customProps);
352
- return axiosError;
353
- };
354
- var AxiosError_1 = AxiosError$5;
355
- var transitional = {
356
- silentJSONParsing: true,
357
- forcedJSONParsing: true,
358
- clarifyTimeoutError: false
359
- };
360
- var utils$c = utils$h;
361
- function toFormData$1(obj, formData) {
362
- formData = formData || new FormData();
363
- var stack = [];
364
- function convertValue(value) {
365
- if (value === null)
366
- return "";
367
- if (utils$c.isDate(value)) {
368
- return value.toISOString();
369
- }
370
- if (utils$c.isArrayBuffer(value) || utils$c.isTypedArray(value)) {
371
- return typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
372
- }
373
- return value;
374
- }
375
- function build(data2, parentKey) {
376
- if (utils$c.isPlainObject(data2) || utils$c.isArray(data2)) {
377
- if (stack.indexOf(data2) !== -1) {
378
- throw Error("Circular reference detected in " + parentKey);
379
- }
380
- stack.push(data2);
381
- utils$c.forEach(data2, function each(value, key) {
382
- if (utils$c.isUndefined(value))
383
- return;
384
- var fullKey = parentKey ? parentKey + "." + key : key;
385
- var arr;
386
- if (value && !parentKey && typeof value === "object") {
387
- if (utils$c.endsWith(key, "{}")) {
388
- value = JSON.stringify(value);
389
- } else if (utils$c.endsWith(key, "[]") && (arr = utils$c.toArray(value))) {
390
- arr.forEach(function(el) {
391
- !utils$c.isUndefined(el) && formData.append(fullKey, convertValue(el));
392
- });
393
- return;
394
- }
395
- }
396
- build(value, fullKey);
397
- });
398
- stack.pop();
399
- } else {
400
- formData.append(parentKey, convertValue(data2));
401
- }
402
- }
403
- build(obj);
404
- return formData;
405
- }
406
- var toFormData_1 = toFormData$1;
407
- var AxiosError$4 = AxiosError_1;
408
- var settle$1 = function settle(resolve, reject, response) {
409
- var validateStatus2 = response.config.validateStatus;
410
- if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
411
- resolve(response);
412
- } else {
413
- reject(new AxiosError$4(
414
- "Request failed with status code " + response.status,
415
- [AxiosError$4.ERR_BAD_REQUEST, AxiosError$4.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
416
- response.config,
417
- response.request,
418
- response
419
- ));
420
- }
421
- };
422
- var utils$b = utils$h;
423
- var cookies$1 = utils$b.isStandardBrowserEnv() ? function standardBrowserEnv() {
424
- return {
425
- write: function write(name, value, expires, path, domain, secure) {
426
- var cookie = [];
427
- cookie.push(name + "=" + encodeURIComponent(value));
428
- if (utils$b.isNumber(expires)) {
429
- cookie.push("expires=" + new Date(expires).toGMTString());
430
- }
431
- if (utils$b.isString(path)) {
432
- cookie.push("path=" + path);
433
- }
434
- if (utils$b.isString(domain)) {
435
- cookie.push("domain=" + domain);
436
- }
437
- if (secure === true) {
438
- cookie.push("secure");
439
- }
440
- document.cookie = cookie.join("; ");
441
- },
442
- read: function read(name) {
443
- var match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
444
- return match ? decodeURIComponent(match[3]) : null;
445
- },
446
- remove: function remove(name) {
447
- this.write(name, "", Date.now() - 864e5);
448
- }
449
- };
450
- }() : function nonStandardBrowserEnv() {
451
- return {
452
- write: function write() {
453
- },
454
- read: function read() {
455
- return null;
456
- },
457
- remove: function remove() {
458
- }
459
- };
460
- }();
461
- var isAbsoluteURL$1 = function isAbsoluteURL(url) {
462
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
463
- };
464
- var combineURLs$1 = function combineURLs(baseURL, relativeURL) {
465
- return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
466
- };
467
- var isAbsoluteURL2 = isAbsoluteURL$1;
468
- var combineURLs2 = combineURLs$1;
469
- var buildFullPath$2 = function buildFullPath(baseURL, requestedURL) {
470
- if (baseURL && !isAbsoluteURL2(requestedURL)) {
471
- return combineURLs2(baseURL, requestedURL);
472
- }
473
- return requestedURL;
474
- };
475
- var utils$a = utils$h;
476
- var ignoreDuplicateOf = [
477
- "age",
478
- "authorization",
479
- "content-length",
480
- "content-type",
481
- "etag",
482
- "expires",
483
- "from",
484
- "host",
485
- "if-modified-since",
486
- "if-unmodified-since",
487
- "last-modified",
488
- "location",
489
- "max-forwards",
490
- "proxy-authorization",
491
- "referer",
492
- "retry-after",
493
- "user-agent"
494
- ];
495
- var parseHeaders$1 = function parseHeaders(headers) {
496
- var parsed = {};
497
- var key;
498
- var val;
499
- var i;
500
- if (!headers) {
501
- return parsed;
502
- }
503
- utils$a.forEach(headers.split("\n"), function parser(line) {
504
- i = line.indexOf(":");
505
- key = utils$a.trim(line.substr(0, i)).toLowerCase();
506
- val = utils$a.trim(line.substr(i + 1));
507
- if (key) {
508
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
509
- return;
510
- }
511
- if (key === "set-cookie") {
512
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
513
- } else {
514
- parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
515
- }
516
- }
517
- });
518
- return parsed;
519
- };
520
- var utils$9 = utils$h;
521
- var isURLSameOrigin$1 = utils$9.isStandardBrowserEnv() ? function standardBrowserEnv2() {
522
- var msie = /(msie|trident)/i.test(navigator.userAgent);
523
- var urlParsingNode = document.createElement("a");
524
- var originURL;
525
- function resolveURL(url) {
526
- var href = url;
527
- if (msie) {
528
- urlParsingNode.setAttribute("href", href);
529
- href = urlParsingNode.href;
530
- }
531
- urlParsingNode.setAttribute("href", href);
532
- return {
533
- href: urlParsingNode.href,
534
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
535
- host: urlParsingNode.host,
536
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
537
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
538
- hostname: urlParsingNode.hostname,
539
- port: urlParsingNode.port,
540
- pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
541
- };
542
- }
543
- originURL = resolveURL(window.location.href);
544
- return function isURLSameOrigin2(requestURL) {
545
- var parsed = utils$9.isString(requestURL) ? resolveURL(requestURL) : requestURL;
546
- return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
547
- };
548
- }() : function nonStandardBrowserEnv2() {
549
- return function isURLSameOrigin2() {
550
- return true;
551
- };
552
- }();
553
- var AxiosError$3 = AxiosError_1;
554
- var utils$8 = utils$h;
555
- function CanceledError$3(message) {
556
- AxiosError$3.call(this, message == null ? "canceled" : message, AxiosError$3.ERR_CANCELED);
557
- this.name = "CanceledError";
558
- }
559
- utils$8.inherits(CanceledError$3, AxiosError$3, {
560
- __CANCEL__: true
561
- });
562
- var CanceledError_1 = CanceledError$3;
563
- var parseProtocol$1 = function parseProtocol(url) {
564
- var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
565
- return match && match[1] || "";
566
- };
567
- var utils$7 = utils$h;
568
- var settle2 = settle$1;
569
- var cookies = cookies$1;
570
- var buildURL$1 = buildURL$2;
571
- var buildFullPath$1 = buildFullPath$2;
572
- var parseHeaders2 = parseHeaders$1;
573
- var isURLSameOrigin = isURLSameOrigin$1;
574
- var transitionalDefaults$1 = transitional;
575
- var AxiosError$2 = AxiosError_1;
576
- var CanceledError$2 = CanceledError_1;
577
- var parseProtocol2 = parseProtocol$1;
578
- var xhr = function xhrAdapter(config) {
579
- return new Promise(function dispatchXhrRequest(resolve, reject) {
580
- var requestData = config.data;
581
- var requestHeaders = config.headers;
582
- var responseType = config.responseType;
583
- var onCanceled;
584
- function done() {
585
- if (config.cancelToken) {
586
- config.cancelToken.unsubscribe(onCanceled);
587
- }
588
- if (config.signal) {
589
- config.signal.removeEventListener("abort", onCanceled);
590
- }
591
- }
592
- if (utils$7.isFormData(requestData) && utils$7.isStandardBrowserEnv()) {
593
- delete requestHeaders["Content-Type"];
594
- }
595
- var request2 = new XMLHttpRequest();
596
- if (config.auth) {
597
- var username = config.auth.username || "";
598
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
599
- requestHeaders.Authorization = "Basic " + btoa(username + ":" + password);
600
- }
601
- var fullPath = buildFullPath$1(config.baseURL, config.url);
602
- request2.open(config.method.toUpperCase(), buildURL$1(fullPath, config.params, config.paramsSerializer), true);
603
- request2.timeout = config.timeout;
604
- function onloadend() {
605
- if (!request2) {
606
- return;
607
- }
608
- var responseHeaders = "getAllResponseHeaders" in request2 ? parseHeaders2(request2.getAllResponseHeaders()) : null;
609
- var responseData = !responseType || responseType === "text" || responseType === "json" ? request2.responseText : request2.response;
610
- var response = {
611
- data: responseData,
612
- status: request2.status,
613
- statusText: request2.statusText,
614
- headers: responseHeaders,
615
- config,
616
- request: request2
617
- };
618
- settle2(function _resolve(value) {
619
- resolve(value);
620
- done();
621
- }, function _reject(err) {
622
- reject(err);
623
- done();
624
- }, response);
625
- request2 = null;
626
- }
627
- if ("onloadend" in request2) {
628
- request2.onloadend = onloadend;
629
- } else {
630
- request2.onreadystatechange = function handleLoad() {
631
- if (!request2 || request2.readyState !== 4) {
632
- return;
633
- }
634
- if (request2.status === 0 && !(request2.responseURL && request2.responseURL.indexOf("file:") === 0)) {
635
- return;
636
- }
637
- setTimeout(onloadend);
638
- };
639
- }
640
- request2.onabort = function handleAbort() {
641
- if (!request2) {
642
- return;
643
- }
644
- reject(new AxiosError$2("Request aborted", AxiosError$2.ECONNABORTED, config, request2));
645
- request2 = null;
646
- };
647
- request2.onerror = function handleError() {
648
- reject(new AxiosError$2("Network Error", AxiosError$2.ERR_NETWORK, config, request2, request2));
649
- request2 = null;
650
- };
651
- request2.ontimeout = function handleTimeout() {
652
- var timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
653
- var transitional3 = config.transitional || transitionalDefaults$1;
654
- if (config.timeoutErrorMessage) {
655
- timeoutErrorMessage = config.timeoutErrorMessage;
656
- }
657
- reject(new AxiosError$2(
658
- timeoutErrorMessage,
659
- transitional3.clarifyTimeoutError ? AxiosError$2.ETIMEDOUT : AxiosError$2.ECONNABORTED,
660
- config,
661
- request2
662
- ));
663
- request2 = null;
664
- };
665
- if (utils$7.isStandardBrowserEnv()) {
666
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : void 0;
667
- if (xsrfValue) {
668
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
669
- }
670
- }
671
- if ("setRequestHeader" in request2) {
672
- utils$7.forEach(requestHeaders, function setRequestHeader(val, key) {
673
- if (typeof requestData === "undefined" && key.toLowerCase() === "content-type") {
674
- delete requestHeaders[key];
675
- } else {
676
- request2.setRequestHeader(key, val);
677
- }
678
- });
679
- }
680
- if (!utils$7.isUndefined(config.withCredentials)) {
681
- request2.withCredentials = !!config.withCredentials;
682
- }
683
- if (responseType && responseType !== "json") {
684
- request2.responseType = config.responseType;
685
- }
686
- if (typeof config.onDownloadProgress === "function") {
687
- request2.addEventListener("progress", config.onDownloadProgress);
688
- }
689
- if (typeof config.onUploadProgress === "function" && request2.upload) {
690
- request2.upload.addEventListener("progress", config.onUploadProgress);
691
- }
692
- if (config.cancelToken || config.signal) {
693
- onCanceled = function(cancel) {
694
- if (!request2) {
695
- return;
696
- }
697
- reject(!cancel || cancel && cancel.type ? new CanceledError$2() : cancel);
698
- request2.abort();
699
- request2 = null;
700
- };
701
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
702
- if (config.signal) {
703
- config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled);
704
- }
705
- }
706
- if (!requestData) {
707
- requestData = null;
708
- }
709
- var protocol = parseProtocol2(fullPath);
710
- if (protocol && ["http", "https", "file"].indexOf(protocol) === -1) {
711
- reject(new AxiosError$2("Unsupported protocol " + protocol + ":", AxiosError$2.ERR_BAD_REQUEST, config));
712
- return;
713
- }
714
- request2.send(requestData);
715
- });
716
- };
717
- var _null = null;
718
- var utils$6 = utils$h;
719
- var normalizeHeaderName2 = normalizeHeaderName$1;
720
- var AxiosError$1 = AxiosError_1;
721
- var transitionalDefaults = transitional;
722
- var toFormData = toFormData_1;
723
- var DEFAULT_CONTENT_TYPE = {
724
- "Content-Type": "application/x-www-form-urlencoded"
725
- };
726
- function setContentTypeIfUnset(headers, value) {
727
- if (!utils$6.isUndefined(headers) && utils$6.isUndefined(headers["Content-Type"])) {
728
- headers["Content-Type"] = value;
729
- }
730
- }
731
- function getDefaultAdapter() {
732
- var adapter;
733
- if (typeof XMLHttpRequest !== "undefined") {
734
- adapter = xhr;
735
- } else if (typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]") {
736
- adapter = xhr;
737
- }
738
- return adapter;
739
- }
740
- function stringifySafely(rawValue, parser, encoder) {
741
- if (utils$6.isString(rawValue)) {
742
- try {
743
- (parser || JSON.parse)(rawValue);
744
- return utils$6.trim(rawValue);
745
- } catch (e) {
746
- if (e.name !== "SyntaxError") {
747
- throw e;
748
- }
749
- }
750
- }
751
- return (encoder || JSON.stringify)(rawValue);
752
- }
753
- var defaults$3 = {
754
- transitional: transitionalDefaults,
755
- adapter: getDefaultAdapter(),
756
- transformRequest: [function transformRequest(data2, headers) {
757
- normalizeHeaderName2(headers, "Accept");
758
- normalizeHeaderName2(headers, "Content-Type");
759
- if (utils$6.isFormData(data2) || utils$6.isArrayBuffer(data2) || utils$6.isBuffer(data2) || utils$6.isStream(data2) || utils$6.isFile(data2) || utils$6.isBlob(data2)) {
760
- return data2;
761
- }
762
- if (utils$6.isArrayBufferView(data2)) {
763
- return data2.buffer;
764
- }
765
- if (utils$6.isURLSearchParams(data2)) {
766
- setContentTypeIfUnset(headers, "application/x-www-form-urlencoded;charset=utf-8");
767
- return data2.toString();
768
- }
769
- var isObjectPayload = utils$6.isObject(data2);
770
- var contentType = headers && headers["Content-Type"];
771
- var isFileList2;
772
- if ((isFileList2 = utils$6.isFileList(data2)) || isObjectPayload && contentType === "multipart/form-data") {
773
- var _FormData = this.env && this.env.FormData;
774
- return toFormData(isFileList2 ? { "files[]": data2 } : data2, _FormData && new _FormData());
775
- } else if (isObjectPayload || contentType === "application/json") {
776
- setContentTypeIfUnset(headers, "application/json");
777
- return stringifySafely(data2);
778
- }
779
- return data2;
780
- }],
781
- transformResponse: [function transformResponse(data2) {
782
- var transitional3 = this.transitional || defaults$3.transitional;
783
- var silentJSONParsing = transitional3 && transitional3.silentJSONParsing;
784
- var forcedJSONParsing = transitional3 && transitional3.forcedJSONParsing;
785
- var strictJSONParsing = !silentJSONParsing && this.responseType === "json";
786
- if (strictJSONParsing || forcedJSONParsing && utils$6.isString(data2) && data2.length) {
787
- try {
788
- return JSON.parse(data2);
789
- } catch (e) {
790
- if (strictJSONParsing) {
791
- if (e.name === "SyntaxError") {
792
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
793
- }
794
- throw e;
795
- }
796
- }
797
- }
798
- return data2;
799
- }],
800
- timeout: 0,
801
- xsrfCookieName: "XSRF-TOKEN",
802
- xsrfHeaderName: "X-XSRF-TOKEN",
803
- maxContentLength: -1,
804
- maxBodyLength: -1,
805
- env: {
806
- FormData: _null
807
- },
808
- validateStatus: function validateStatus(status) {
809
- return status >= 200 && status < 300;
810
- },
811
- headers: {
812
- common: {
813
- "Accept": "application/json, text/plain, */*"
814
- }
815
- }
816
- };
817
- utils$6.forEach(["delete", "get", "head"], function forEachMethodNoData(method) {
818
- defaults$3.headers[method] = {};
819
- });
820
- utils$6.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
821
- defaults$3.headers[method] = utils$6.merge(DEFAULT_CONTENT_TYPE);
822
- });
823
- var defaults_1 = defaults$3;
824
- var utils$5 = utils$h;
825
- var defaults$2 = defaults_1;
826
- var transformData$1 = function transformData(data2, headers, fns) {
827
- var context = this || defaults$2;
828
- utils$5.forEach(fns, function transform(fn) {
829
- data2 = fn.call(context, data2, headers);
830
- });
831
- return data2;
832
- };
833
- var isCancel$1 = function isCancel(value) {
834
- return !!(value && value.__CANCEL__);
835
- };
836
- var utils$4 = utils$h;
837
- var transformData2 = transformData$1;
838
- var isCancel2 = isCancel$1;
839
- var defaults$1 = defaults_1;
840
- var CanceledError$1 = CanceledError_1;
841
- function throwIfCancellationRequested(config) {
842
- if (config.cancelToken) {
843
- config.cancelToken.throwIfRequested();
844
- }
845
- if (config.signal && config.signal.aborted) {
846
- throw new CanceledError$1();
847
- }
848
- }
849
- var dispatchRequest$1 = function dispatchRequest(config) {
850
- throwIfCancellationRequested(config);
851
- config.headers = config.headers || {};
852
- config.data = transformData2.call(
853
- config,
854
- config.data,
855
- config.headers,
856
- config.transformRequest
857
- );
858
- config.headers = utils$4.merge(
859
- config.headers.common || {},
860
- config.headers[config.method] || {},
861
- config.headers
862
- );
863
- utils$4.forEach(
864
- ["delete", "get", "head", "post", "put", "patch", "common"],
865
- function cleanHeaderConfig(method) {
866
- delete config.headers[method];
867
- }
868
- );
869
- var adapter = config.adapter || defaults$1.adapter;
870
- return adapter(config).then(function onAdapterResolution(response) {
871
- throwIfCancellationRequested(config);
872
- response.data = transformData2.call(
873
- config,
874
- response.data,
875
- response.headers,
876
- config.transformResponse
877
- );
878
- return response;
879
- }, function onAdapterRejection(reason) {
880
- if (!isCancel2(reason)) {
881
- throwIfCancellationRequested(config);
882
- if (reason && reason.response) {
883
- reason.response.data = transformData2.call(
884
- config,
885
- reason.response.data,
886
- reason.response.headers,
887
- config.transformResponse
888
- );
889
- }
890
- }
891
- return Promise.reject(reason);
892
- });
893
- };
894
- var utils$3 = utils$h;
895
- var mergeConfig$2 = function mergeConfig(config1, config2) {
896
- config2 = config2 || {};
897
- var config = {};
898
- function getMergedValue(target, source2) {
899
- if (utils$3.isPlainObject(target) && utils$3.isPlainObject(source2)) {
900
- return utils$3.merge(target, source2);
901
- } else if (utils$3.isPlainObject(source2)) {
902
- return utils$3.merge({}, source2);
903
- } else if (utils$3.isArray(source2)) {
904
- return source2.slice();
905
- }
906
- return source2;
907
- }
908
- function mergeDeepProperties(prop) {
909
- if (!utils$3.isUndefined(config2[prop])) {
910
- return getMergedValue(config1[prop], config2[prop]);
911
- } else if (!utils$3.isUndefined(config1[prop])) {
912
- return getMergedValue(void 0, config1[prop]);
913
- }
914
- }
915
- function valueFromConfig2(prop) {
916
- if (!utils$3.isUndefined(config2[prop])) {
917
- return getMergedValue(void 0, config2[prop]);
918
- }
919
- }
920
- function defaultToConfig2(prop) {
921
- if (!utils$3.isUndefined(config2[prop])) {
922
- return getMergedValue(void 0, config2[prop]);
923
- } else if (!utils$3.isUndefined(config1[prop])) {
924
- return getMergedValue(void 0, config1[prop]);
925
- }
926
- }
927
- function mergeDirectKeys(prop) {
928
- if (prop in config2) {
929
- return getMergedValue(config1[prop], config2[prop]);
930
- } else if (prop in config1) {
931
- return getMergedValue(void 0, config1[prop]);
932
- }
933
- }
934
- var mergeMap = {
935
- "url": valueFromConfig2,
936
- "method": valueFromConfig2,
937
- "data": valueFromConfig2,
938
- "baseURL": defaultToConfig2,
939
- "transformRequest": defaultToConfig2,
940
- "transformResponse": defaultToConfig2,
941
- "paramsSerializer": defaultToConfig2,
942
- "timeout": defaultToConfig2,
943
- "timeoutMessage": defaultToConfig2,
944
- "withCredentials": defaultToConfig2,
945
- "adapter": defaultToConfig2,
946
- "responseType": defaultToConfig2,
947
- "xsrfCookieName": defaultToConfig2,
948
- "xsrfHeaderName": defaultToConfig2,
949
- "onUploadProgress": defaultToConfig2,
950
- "onDownloadProgress": defaultToConfig2,
951
- "decompress": defaultToConfig2,
952
- "maxContentLength": defaultToConfig2,
953
- "maxBodyLength": defaultToConfig2,
954
- "beforeRedirect": defaultToConfig2,
955
- "transport": defaultToConfig2,
956
- "httpAgent": defaultToConfig2,
957
- "httpsAgent": defaultToConfig2,
958
- "cancelToken": defaultToConfig2,
959
- "socketPath": defaultToConfig2,
960
- "responseEncoding": defaultToConfig2,
961
- "validateStatus": mergeDirectKeys
962
- };
963
- utils$3.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
964
- var merge2 = mergeMap[prop] || mergeDeepProperties;
965
- var configValue = merge2(prop);
966
- utils$3.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
967
- });
968
- return config;
969
- };
970
- var data = {
971
- "version": "0.27.2"
972
- };
973
- var VERSION = data.version;
974
- var AxiosError = AxiosError_1;
975
- var validators$1 = {};
976
- ["object", "boolean", "number", "function", "string", "symbol"].forEach(function(type, i) {
977
- validators$1[type] = function validator2(thing) {
978
- return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
979
- };
980
- });
981
- var deprecatedWarnings = {};
982
- validators$1.transitional = function transitional2(validator2, version, message) {
983
- function formatMessage(opt, desc) {
984
- return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
985
- }
986
- return function(value, opt, opts) {
987
- if (validator2 === false) {
988
- throw new AxiosError(
989
- formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
990
- AxiosError.ERR_DEPRECATED
991
- );
992
- }
993
- if (version && !deprecatedWarnings[opt]) {
994
- deprecatedWarnings[opt] = true;
995
- console.warn(
996
- formatMessage(
997
- opt,
998
- " has been deprecated since v" + version + " and will be removed in the near future"
999
- )
1000
- );
1001
- }
1002
- return validator2 ? validator2(value, opt, opts) : true;
1003
- };
1004
- };
1005
- function assertOptions(options, schema, allowUnknown) {
1006
- if (typeof options !== "object") {
1007
- throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
1008
- }
1009
- var keys = Object.keys(options);
1010
- var i = keys.length;
1011
- while (i-- > 0) {
1012
- var opt = keys[i];
1013
- var validator2 = schema[opt];
1014
- if (validator2) {
1015
- var value = options[opt];
1016
- var result = value === void 0 || validator2(value, opt, options);
1017
- if (result !== true) {
1018
- throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
1019
- }
1020
- continue;
1021
- }
1022
- if (allowUnknown !== true) {
1023
- throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
1024
- }
1025
- }
1026
- }
1027
- var validator$1 = {
1028
- assertOptions,
1029
- validators: validators$1
1030
- };
1031
- var utils$2 = utils$h;
1032
- var buildURL2 = buildURL$2;
1033
- var InterceptorManager = InterceptorManager_1;
1034
- var dispatchRequest2 = dispatchRequest$1;
1035
- var mergeConfig$1 = mergeConfig$2;
1036
- var buildFullPath2 = buildFullPath$2;
1037
- var validator = validator$1;
1038
- var validators = validator.validators;
1039
- function Axios$1(instanceConfig) {
1040
- this.defaults = instanceConfig;
1041
- this.interceptors = {
1042
- request: new InterceptorManager(),
1043
- response: new InterceptorManager()
1044
- };
1045
- }
1046
- Axios$1.prototype.request = function request(configOrUrl, config) {
1047
- if (typeof configOrUrl === "string") {
1048
- config = config || {};
1049
- config.url = configOrUrl;
1050
- } else {
1051
- config = configOrUrl || {};
1052
- }
1053
- config = mergeConfig$1(this.defaults, config);
1054
- if (config.method) {
1055
- config.method = config.method.toLowerCase();
1056
- } else if (this.defaults.method) {
1057
- config.method = this.defaults.method.toLowerCase();
1058
- } else {
1059
- config.method = "get";
1060
- }
1061
- var transitional3 = config.transitional;
1062
- if (transitional3 !== void 0) {
1063
- validator.assertOptions(transitional3, {
1064
- silentJSONParsing: validators.transitional(validators.boolean),
1065
- forcedJSONParsing: validators.transitional(validators.boolean),
1066
- clarifyTimeoutError: validators.transitional(validators.boolean)
1067
- }, false);
1068
- }
1069
- var requestInterceptorChain = [];
1070
- var synchronousRequestInterceptors = true;
1071
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
1072
- if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
1073
- return;
1074
- }
1075
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
1076
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
1077
- });
1078
- var responseInterceptorChain = [];
1079
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
1080
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
1081
- });
1082
- var promise;
1083
- if (!synchronousRequestInterceptors) {
1084
- var chain = [dispatchRequest2, void 0];
1085
- Array.prototype.unshift.apply(chain, requestInterceptorChain);
1086
- chain = chain.concat(responseInterceptorChain);
1087
- promise = Promise.resolve(config);
1088
- while (chain.length) {
1089
- promise = promise.then(chain.shift(), chain.shift());
1090
- }
1091
- return promise;
1092
- }
1093
- var newConfig = config;
1094
- while (requestInterceptorChain.length) {
1095
- var onFulfilled = requestInterceptorChain.shift();
1096
- var onRejected = requestInterceptorChain.shift();
1097
- try {
1098
- newConfig = onFulfilled(newConfig);
1099
- } catch (error) {
1100
- onRejected(error);
1101
- break;
1102
- }
1103
- }
1104
- try {
1105
- promise = dispatchRequest2(newConfig);
1106
- } catch (error) {
1107
- return Promise.reject(error);
1108
- }
1109
- while (responseInterceptorChain.length) {
1110
- promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
1111
- }
1112
- return promise;
1113
- };
1114
- Axios$1.prototype.getUri = function getUri(config) {
1115
- config = mergeConfig$1(this.defaults, config);
1116
- var fullPath = buildFullPath2(config.baseURL, config.url);
1117
- return buildURL2(fullPath, config.params, config.paramsSerializer);
1118
- };
1119
- utils$2.forEach(["delete", "get", "head", "options"], function forEachMethodNoData2(method) {
1120
- Axios$1.prototype[method] = function(url, config) {
1121
- return this.request(mergeConfig$1(config || {}, {
1122
- method,
1123
- url,
1124
- data: (config || {}).data
1125
- }));
1126
- };
1127
- });
1128
- utils$2.forEach(["post", "put", "patch"], function forEachMethodWithData2(method) {
1129
- function generateHTTPMethod(isForm) {
1130
- return function httpMethod(url, data2, config) {
1131
- return this.request(mergeConfig$1(config || {}, {
1132
- method,
1133
- headers: isForm ? {
1134
- "Content-Type": "multipart/form-data"
1135
- } : {},
1136
- url,
1137
- data: data2
1138
- }));
1139
- };
1140
- }
1141
- Axios$1.prototype[method] = generateHTTPMethod();
1142
- Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
1143
- });
1144
- var Axios_1 = Axios$1;
1145
- var CanceledError = CanceledError_1;
1146
- function CancelToken(executor) {
1147
- if (typeof executor !== "function") {
1148
- throw new TypeError("executor must be a function.");
1149
- }
1150
- var resolvePromise;
1151
- this.promise = new Promise(function promiseExecutor(resolve) {
1152
- resolvePromise = resolve;
1153
- });
1154
- var token = this;
1155
- this.promise.then(function(cancel) {
1156
- if (!token._listeners)
1157
- return;
1158
- var i;
1159
- var l = token._listeners.length;
1160
- for (i = 0; i < l; i++) {
1161
- token._listeners[i](cancel);
1162
- }
1163
- token._listeners = null;
1164
- });
1165
- this.promise.then = function(onfulfilled) {
1166
- var _resolve;
1167
- var promise = new Promise(function(resolve) {
1168
- token.subscribe(resolve);
1169
- _resolve = resolve;
1170
- }).then(onfulfilled);
1171
- promise.cancel = function reject() {
1172
- token.unsubscribe(_resolve);
1173
- };
1174
- return promise;
1175
- };
1176
- executor(function cancel(message) {
1177
- if (token.reason) {
1178
- return;
1179
- }
1180
- token.reason = new CanceledError(message);
1181
- resolvePromise(token.reason);
1182
- });
1183
- }
1184
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
1185
- if (this.reason) {
1186
- throw this.reason;
1187
- }
1188
- };
1189
- CancelToken.prototype.subscribe = function subscribe(listener) {
1190
- if (this.reason) {
1191
- listener(this.reason);
1192
- return;
1193
- }
1194
- if (this._listeners) {
1195
- this._listeners.push(listener);
1196
- } else {
1197
- this._listeners = [listener];
1198
- }
1199
- };
1200
- CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
1201
- if (!this._listeners) {
1202
- return;
1203
- }
1204
- var index = this._listeners.indexOf(listener);
1205
- if (index !== -1) {
1206
- this._listeners.splice(index, 1);
1207
- }
1208
- };
1209
- CancelToken.source = function source() {
1210
- var cancel;
1211
- var token = new CancelToken(function executor(c) {
1212
- cancel = c;
1213
- });
1214
- return {
1215
- token,
1216
- cancel
1217
- };
1218
- };
1219
- var CancelToken_1 = CancelToken;
1220
- var spread = function spread2(callback) {
1221
- return function wrap(arr) {
1222
- return callback.apply(null, arr);
1223
- };
1224
- };
1225
- var utils$1 = utils$h;
1226
- var isAxiosError = function isAxiosError2(payload) {
1227
- return utils$1.isObject(payload) && payload.isAxiosError === true;
1228
- };
1229
- var utils = utils$h;
1230
- var bind2 = bind$2;
1231
- var Axios = Axios_1;
1232
- var mergeConfig2 = mergeConfig$2;
1233
- var defaults = defaults_1;
1234
- function createInstance(defaultConfig) {
1235
- var context = new Axios(defaultConfig);
1236
- var instance = bind2(Axios.prototype.request, context);
1237
- utils.extend(instance, Axios.prototype, context);
1238
- utils.extend(instance, context);
1239
- instance.create = function create(instanceConfig) {
1240
- return createInstance(mergeConfig2(defaultConfig, instanceConfig));
1241
- };
1242
- return instance;
1243
- }
1244
- var axios$1 = createInstance(defaults);
1245
- axios$1.Axios = Axios;
1246
- axios$1.CanceledError = CanceledError_1;
1247
- axios$1.CancelToken = CancelToken_1;
1248
- axios$1.isCancel = isCancel$1;
1249
- axios$1.VERSION = data.version;
1250
- axios$1.toFormData = toFormData_1;
1251
- axios$1.AxiosError = AxiosError_1;
1252
- axios$1.Cancel = axios$1.CanceledError;
1253
- axios$1.all = function all(promises) {
1254
- return Promise.all(promises);
1255
- };
1256
- axios$1.spread = spread;
1257
- axios$1.isAxiosError = isAxiosError;
1258
- axios$2.exports = axios$1;
1259
- axios$2.exports.default = axios$1;
1260
- var axios = axios$2.exports;
1261
- export { axios as a };