@fireberry/sdk 0.0.4 → 0.0.5

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