groove-dev 0.27.143 → 0.27.145

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 (251) hide show
  1. package/CLAUDE.md +0 -7
  2. package/node_modules/@groove-dev/cli/package.json +1 -1
  3. package/node_modules/@groove-dev/daemon/package.json +1 -1
  4. package/node_modules/@groove-dev/daemon/src/api.js +1086 -6532
  5. package/node_modules/@groove-dev/daemon/src/conversations.js +18 -48
  6. package/node_modules/@groove-dev/daemon/src/gateways/manager.js +35 -1
  7. package/node_modules/@groove-dev/daemon/src/index.js +3 -0
  8. package/node_modules/@groove-dev/daemon/src/journalist.js +23 -13
  9. package/node_modules/@groove-dev/daemon/src/mlx-server.js +365 -0
  10. package/node_modules/@groove-dev/daemon/src/model-lab.js +308 -12
  11. package/node_modules/@groove-dev/daemon/src/pm.js +1 -1
  12. package/node_modules/@groove-dev/daemon/src/process.js +2 -2
  13. package/node_modules/@groove-dev/daemon/src/providers/local.js +36 -8
  14. package/node_modules/@groove-dev/daemon/src/registry.js +21 -5
  15. package/node_modules/@groove-dev/daemon/src/routes/agents.js +812 -0
  16. package/node_modules/@groove-dev/daemon/src/routes/coordination.js +318 -0
  17. package/node_modules/@groove-dev/daemon/src/routes/files.js +751 -0
  18. package/node_modules/@groove-dev/daemon/src/routes/integrations.js +485 -0
  19. package/node_modules/@groove-dev/daemon/src/routes/network.js +1784 -0
  20. package/node_modules/@groove-dev/daemon/src/routes/providers.js +755 -0
  21. package/node_modules/@groove-dev/daemon/src/routes/schedules.js +110 -0
  22. package/node_modules/@groove-dev/daemon/src/routes/teams.js +650 -0
  23. package/node_modules/@groove-dev/daemon/src/scheduler.js +456 -24
  24. package/node_modules/@groove-dev/daemon/src/teams.js +1 -1
  25. package/node_modules/@groove-dev/daemon/src/validate.js +38 -1
  26. package/node_modules/@groove-dev/daemon/templates/mlx-setup.json +12 -0
  27. package/node_modules/@groove-dev/daemon/templates/tgi-setup.json +1 -1
  28. package/node_modules/@groove-dev/daemon/templates/vllm-setup.json +1 -1
  29. package/node_modules/@groove-dev/daemon/test/introducer.test.js +3 -3
  30. package/node_modules/@groove-dev/daemon/test/journalist.test.js +7 -10
  31. package/node_modules/@groove-dev/daemon/test/registry.test.js +38 -0
  32. package/node_modules/@groove-dev/gui/dist/assets/index-Bxc0gU06.js +1006 -0
  33. package/node_modules/@groove-dev/gui/dist/assets/index-C0pztKBn.css +1 -0
  34. package/node_modules/@groove-dev/gui/dist/index.html +2 -2
  35. package/node_modules/@groove-dev/gui/package.json +1 -1
  36. package/node_modules/@groove-dev/gui/src/{app.jsx → App.jsx} +0 -2
  37. package/node_modules/@groove-dev/gui/src/app.css +35 -0
  38. package/node_modules/@groove-dev/gui/src/components/agents/agent-config.jsx +1 -128
  39. package/node_modules/@groove-dev/gui/src/components/agents/agent-feed.jsx +210 -112
  40. package/node_modules/@groove-dev/gui/src/components/agents/agent-node.jsx +8 -13
  41. package/node_modules/@groove-dev/gui/src/components/agents/agent-panel.jsx +2 -70
  42. package/node_modules/@groove-dev/gui/src/components/agents/code-review.jsx +159 -122
  43. package/node_modules/@groove-dev/gui/src/components/agents/diff-viewer.jsx +23 -23
  44. package/node_modules/@groove-dev/gui/src/components/agents/journalist-panel.jsx +1 -1
  45. package/node_modules/@groove-dev/gui/src/components/agents/spawn-wizard.jsx +2 -135
  46. package/node_modules/@groove-dev/gui/src/components/automations/automation-card.jsx +274 -0
  47. package/node_modules/@groove-dev/gui/src/components/automations/automation-wizard.jsx +1136 -0
  48. package/node_modules/@groove-dev/gui/src/components/chat/chat-header.jsx +2 -0
  49. package/node_modules/@groove-dev/gui/src/components/chat/chat-input.jsx +68 -66
  50. package/node_modules/@groove-dev/gui/src/components/chat/chat-view.jsx +4 -8
  51. package/node_modules/@groove-dev/gui/src/components/dashboard/activity-feed.jsx +3 -3
  52. package/node_modules/@groove-dev/gui/src/components/dashboard/cache-ring.jsx +5 -5
  53. package/node_modules/@groove-dev/gui/src/components/dashboard/context-gauges.jsx +6 -8
  54. package/node_modules/@groove-dev/gui/src/components/dashboard/fleet-panel.jsx +8 -14
  55. package/node_modules/@groove-dev/gui/src/components/dashboard/intel-panel.jsx +238 -656
  56. package/node_modules/@groove-dev/gui/src/components/dashboard/kpi-card.jsx +3 -3
  57. package/node_modules/@groove-dev/gui/src/components/dashboard/routing-chart.jsx +3 -3
  58. package/node_modules/@groove-dev/gui/src/components/dashboard/team-burn-panel.jsx +1 -1
  59. package/node_modules/@groove-dev/gui/src/components/dashboard/token-chart.jsx +4 -4
  60. package/node_modules/@groove-dev/gui/src/components/lab/chat-playground.jsx +39 -31
  61. package/node_modules/@groove-dev/gui/src/components/lab/lab-assistant.jsx +316 -82
  62. package/node_modules/@groove-dev/gui/src/components/lab/metrics-panel.jsx +187 -32
  63. package/node_modules/@groove-dev/gui/src/components/lab/parameter-panel.jsx +200 -18
  64. package/node_modules/@groove-dev/gui/src/components/lab/preset-manager.jsx +17 -14
  65. package/node_modules/@groove-dev/gui/src/components/lab/runtime-config.jsx +335 -152
  66. package/node_modules/@groove-dev/gui/src/components/lab/system-prompt-editor.jsx +10 -8
  67. package/node_modules/@groove-dev/gui/src/components/layout/activity-bar.jsx +2 -4
  68. package/node_modules/@groove-dev/gui/src/components/layout/terminal-panel.jsx +4 -2
  69. package/node_modules/@groove-dev/gui/src/components/layout/welcome-splash.jsx +137 -108
  70. package/node_modules/@groove-dev/gui/src/components/network/network-health.jsx +2 -2
  71. package/node_modules/@groove-dev/gui/src/components/network/performance-dashboard.jsx +4 -4
  72. package/node_modules/@groove-dev/gui/src/components/settings/ssh-wizard.jsx +81 -99
  73. package/node_modules/@groove-dev/gui/src/components/ui/sheet.jsx +5 -2
  74. package/node_modules/@groove-dev/gui/src/components/ui/slider.jsx +8 -8
  75. package/node_modules/@groove-dev/gui/src/lib/cron.js +64 -0
  76. package/node_modules/@groove-dev/gui/src/lib/status.js +25 -24
  77. package/node_modules/@groove-dev/gui/src/lib/theme-hex.js +1 -0
  78. package/node_modules/@groove-dev/gui/src/stores/groove.js +51 -3144
  79. package/node_modules/@groove-dev/gui/src/stores/helpers.js +10 -0
  80. package/node_modules/@groove-dev/gui/src/stores/slices/agents-slice.js +459 -0
  81. package/node_modules/@groove-dev/gui/src/stores/slices/automations-slice.js +96 -0
  82. package/node_modules/@groove-dev/gui/src/stores/slices/chat-slice.js +226 -0
  83. package/node_modules/@groove-dev/gui/src/stores/slices/editor-slice.js +285 -0
  84. package/node_modules/@groove-dev/gui/src/stores/slices/marketplace-slice.js +461 -0
  85. package/node_modules/@groove-dev/gui/src/stores/slices/network-slice.js +361 -0
  86. package/node_modules/@groove-dev/gui/src/stores/slices/preview-slice.js +109 -0
  87. package/node_modules/@groove-dev/gui/src/stores/slices/providers-slice.js +897 -0
  88. package/node_modules/@groove-dev/gui/src/stores/slices/teams-slice.js +413 -0
  89. package/node_modules/@groove-dev/gui/src/stores/slices/ui-slice.js +98 -0
  90. package/node_modules/@groove-dev/gui/src/views/agents.jsx +5 -5
  91. package/node_modules/@groove-dev/gui/src/views/dashboard.jsx +12 -13
  92. package/node_modules/@groove-dev/gui/src/views/marketplace.jsx +191 -3
  93. package/node_modules/@groove-dev/gui/src/views/model-lab.jsx +54 -12
  94. package/node_modules/@groove-dev/gui/src/views/models.jsx +419 -496
  95. package/node_modules/@groove-dev/gui/src/views/network.jsx +3 -3
  96. package/node_modules/@groove-dev/gui/src/views/settings.jsx +81 -94
  97. package/node_modules/@groove-dev/gui/src/views/teams.jsx +40 -483
  98. package/node_modules/axios/CHANGELOG.md +260 -0
  99. package/node_modules/axios/README.md +595 -223
  100. package/node_modules/axios/dist/axios.js +1460 -1090
  101. package/node_modules/axios/dist/axios.js.map +1 -1
  102. package/node_modules/axios/dist/axios.min.js +3 -3
  103. package/node_modules/axios/dist/axios.min.js.map +1 -1
  104. package/node_modules/axios/dist/browser/axios.cjs +1560 -1132
  105. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  106. package/node_modules/axios/dist/esm/axios.js +1557 -1128
  107. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  108. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  109. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  110. package/node_modules/axios/dist/node/axios.cjs +1594 -1057
  111. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  112. package/node_modules/axios/index.d.cts +40 -41
  113. package/node_modules/axios/index.d.ts +151 -227
  114. package/node_modules/axios/index.js +2 -0
  115. package/node_modules/axios/lib/adapters/adapters.js +4 -2
  116. package/node_modules/axios/lib/adapters/fetch.js +147 -16
  117. package/node_modules/axios/lib/adapters/http.js +306 -58
  118. package/node_modules/axios/lib/adapters/xhr.js +6 -2
  119. package/node_modules/axios/lib/core/Axios.js +7 -3
  120. package/node_modules/axios/lib/core/AxiosError.js +120 -34
  121. package/node_modules/axios/lib/core/AxiosHeaders.js +27 -25
  122. package/node_modules/axios/lib/core/buildFullPath.js +1 -1
  123. package/node_modules/axios/lib/core/dispatchRequest.js +19 -7
  124. package/node_modules/axios/lib/core/mergeConfig.js +21 -4
  125. package/node_modules/axios/lib/core/settle.js +7 -11
  126. package/node_modules/axios/lib/defaults/index.js +14 -9
  127. package/node_modules/axios/lib/env/data.js +1 -1
  128. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -2
  129. package/node_modules/axios/lib/helpers/buildURL.js +1 -1
  130. package/node_modules/axios/lib/helpers/cookies.js +14 -2
  131. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +28 -1
  132. package/node_modules/axios/lib/helpers/formDataToJSON.js +3 -1
  133. package/node_modules/axios/lib/helpers/formDataToStream.js +3 -2
  134. package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
  135. package/node_modules/axios/lib/helpers/progressEventReducer.js +5 -5
  136. package/node_modules/axios/lib/helpers/resolveConfig.js +54 -18
  137. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +74 -2
  138. package/node_modules/axios/lib/helpers/toFormData.js +10 -2
  139. package/node_modules/axios/lib/helpers/validator.js +3 -1
  140. package/node_modules/axios/lib/utils.js +33 -21
  141. package/node_modules/axios/package.json +17 -24
  142. package/node_modules/follow-redirects/README.md +7 -5
  143. package/node_modules/follow-redirects/index.js +24 -1
  144. package/node_modules/follow-redirects/package.json +1 -1
  145. package/package.json +1 -1
  146. package/packages/cli/package.json +1 -1
  147. package/packages/daemon/package.json +1 -1
  148. package/packages/daemon/src/api.js +1086 -6532
  149. package/packages/daemon/src/conversations.js +18 -48
  150. package/packages/daemon/src/gateways/manager.js +35 -1
  151. package/packages/daemon/src/index.js +3 -0
  152. package/packages/daemon/src/journalist.js +23 -13
  153. package/packages/daemon/src/mlx-server.js +365 -0
  154. package/packages/daemon/src/model-lab.js +308 -12
  155. package/packages/daemon/src/pm.js +1 -1
  156. package/packages/daemon/src/process.js +2 -2
  157. package/packages/daemon/src/providers/local.js +36 -8
  158. package/packages/daemon/src/registry.js +21 -5
  159. package/packages/daemon/src/routes/agents.js +812 -0
  160. package/packages/daemon/src/routes/coordination.js +318 -0
  161. package/packages/daemon/src/routes/files.js +751 -0
  162. package/packages/daemon/src/routes/integrations.js +485 -0
  163. package/packages/daemon/src/routes/network.js +1784 -0
  164. package/packages/daemon/src/routes/providers.js +755 -0
  165. package/packages/daemon/src/routes/schedules.js +110 -0
  166. package/packages/daemon/src/routes/teams.js +650 -0
  167. package/packages/daemon/src/scheduler.js +456 -24
  168. package/packages/daemon/src/teams.js +1 -1
  169. package/packages/daemon/src/validate.js +38 -1
  170. package/packages/daemon/templates/mlx-setup.json +12 -0
  171. package/packages/daemon/templates/tgi-setup.json +1 -1
  172. package/packages/daemon/templates/vllm-setup.json +1 -1
  173. package/packages/gui/dist/assets/index-Bxc0gU06.js +1006 -0
  174. package/packages/gui/dist/assets/index-C0pztKBn.css +1 -0
  175. package/packages/gui/dist/index.html +2 -2
  176. package/packages/gui/package.json +1 -1
  177. package/packages/gui/src/{app.jsx → App.jsx} +0 -2
  178. package/packages/gui/src/app.css +35 -0
  179. package/packages/gui/src/components/agents/agent-config.jsx +1 -128
  180. package/packages/gui/src/components/agents/agent-feed.jsx +210 -112
  181. package/packages/gui/src/components/agents/agent-node.jsx +8 -13
  182. package/packages/gui/src/components/agents/agent-panel.jsx +2 -70
  183. package/packages/gui/src/components/agents/code-review.jsx +159 -122
  184. package/packages/gui/src/components/agents/diff-viewer.jsx +23 -23
  185. package/packages/gui/src/components/agents/journalist-panel.jsx +1 -1
  186. package/packages/gui/src/components/agents/spawn-wizard.jsx +2 -135
  187. package/packages/gui/src/components/automations/automation-card.jsx +274 -0
  188. package/packages/gui/src/components/automations/automation-wizard.jsx +1136 -0
  189. package/packages/gui/src/components/chat/chat-header.jsx +2 -0
  190. package/packages/gui/src/components/chat/chat-input.jsx +68 -66
  191. package/packages/gui/src/components/chat/chat-view.jsx +4 -8
  192. package/packages/gui/src/components/dashboard/activity-feed.jsx +3 -3
  193. package/packages/gui/src/components/dashboard/cache-ring.jsx +5 -5
  194. package/packages/gui/src/components/dashboard/context-gauges.jsx +6 -8
  195. package/packages/gui/src/components/dashboard/fleet-panel.jsx +8 -14
  196. package/packages/gui/src/components/dashboard/intel-panel.jsx +238 -656
  197. package/packages/gui/src/components/dashboard/kpi-card.jsx +3 -3
  198. package/packages/gui/src/components/dashboard/routing-chart.jsx +3 -3
  199. package/packages/gui/src/components/dashboard/team-burn-panel.jsx +1 -1
  200. package/packages/gui/src/components/dashboard/token-chart.jsx +4 -4
  201. package/packages/gui/src/components/lab/chat-playground.jsx +39 -31
  202. package/packages/gui/src/components/lab/lab-assistant.jsx +316 -82
  203. package/packages/gui/src/components/lab/metrics-panel.jsx +187 -32
  204. package/packages/gui/src/components/lab/parameter-panel.jsx +200 -18
  205. package/packages/gui/src/components/lab/preset-manager.jsx +17 -14
  206. package/packages/gui/src/components/lab/runtime-config.jsx +335 -152
  207. package/packages/gui/src/components/lab/system-prompt-editor.jsx +10 -8
  208. package/packages/gui/src/components/layout/activity-bar.jsx +2 -4
  209. package/packages/gui/src/components/layout/terminal-panel.jsx +4 -2
  210. package/packages/gui/src/components/layout/welcome-splash.jsx +137 -108
  211. package/packages/gui/src/components/network/network-health.jsx +2 -2
  212. package/packages/gui/src/components/network/performance-dashboard.jsx +4 -4
  213. package/packages/gui/src/components/settings/ssh-wizard.jsx +81 -99
  214. package/packages/gui/src/components/ui/sheet.jsx +5 -2
  215. package/packages/gui/src/components/ui/slider.jsx +8 -8
  216. package/packages/gui/src/lib/cron.js +64 -0
  217. package/packages/gui/src/lib/status.js +25 -24
  218. package/packages/gui/src/lib/theme-hex.js +1 -0
  219. package/packages/gui/src/stores/groove.js +51 -3144
  220. package/packages/gui/src/stores/helpers.js +10 -0
  221. package/packages/gui/src/stores/slices/agents-slice.js +459 -0
  222. package/packages/gui/src/stores/slices/automations-slice.js +96 -0
  223. package/packages/gui/src/stores/slices/chat-slice.js +226 -0
  224. package/packages/gui/src/stores/slices/editor-slice.js +285 -0
  225. package/packages/gui/src/stores/slices/marketplace-slice.js +461 -0
  226. package/packages/gui/src/stores/slices/network-slice.js +361 -0
  227. package/packages/gui/src/stores/slices/preview-slice.js +109 -0
  228. package/packages/gui/src/stores/slices/providers-slice.js +897 -0
  229. package/packages/gui/src/stores/slices/teams-slice.js +413 -0
  230. package/packages/gui/src/stores/slices/ui-slice.js +98 -0
  231. package/packages/gui/src/views/agents.jsx +5 -5
  232. package/packages/gui/src/views/dashboard.jsx +12 -13
  233. package/packages/gui/src/views/marketplace.jsx +191 -3
  234. package/packages/gui/src/views/model-lab.jsx +54 -12
  235. package/packages/gui/src/views/models.jsx +419 -496
  236. package/packages/gui/src/views/network.jsx +3 -3
  237. package/packages/gui/src/views/settings.jsx +81 -94
  238. package/packages/gui/src/views/teams.jsx +40 -483
  239. package/SECURITY_SWEEP.md +0 -228
  240. package/TRAINING_DATA_v4.md +0 -6
  241. package/node_modules/@groove-dev/gui/dist/assets/index-CCVvAoQn.css +0 -1
  242. package/node_modules/@groove-dev/gui/dist/assets/index-DGIv_TRm.js +0 -984
  243. package/node_modules/@groove-dev/gui/src/components/agents/agent-chat.jsx +0 -379
  244. package/node_modules/@groove-dev/gui/src/views/preview.jsx +0 -6
  245. package/node_modules/@groove-dev/gui/src/views/subscription-panel.jsx +0 -327
  246. package/packages/gui/dist/assets/index-CCVvAoQn.css +0 -1
  247. package/packages/gui/dist/assets/index-DGIv_TRm.js +0 -984
  248. package/packages/gui/src/components/agents/agent-chat.jsx +0 -379
  249. package/packages/gui/src/views/preview.jsx +0 -6
  250. package/packages/gui/src/views/subscription-panel.jsx +0 -327
  251. package/test.py +0 -571
@@ -1,4 +1,4 @@
1
- /*! Axios v1.15.0 Copyright (c) 2026 Matt Zabriskie and contributors */
1
+ /*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */
2
2
  'use strict';
3
3
 
4
4
  /**
@@ -204,9 +204,9 @@ const isFile = kindOfTest('File');
204
204
  * also have a `name` and `type` attribute to specify filename and content type
205
205
  *
206
206
  * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
207
- *
207
+ *
208
208
  * @param {*} value The value to test
209
- *
209
+ *
210
210
  * @returns {boolean} True if value is a React Native Blob, otherwise false
211
211
  */
212
212
  const isReactNativeBlob = (value) => {
@@ -216,9 +216,9 @@ const isReactNativeBlob = (value) => {
216
216
  /**
217
217
  * Determine if environment is React Native
218
218
  * ReactNative `FormData` has a non-standard `getParts()` method
219
- *
219
+ *
220
220
  * @param {*} formData The formData to test
221
- *
221
+ *
222
222
  * @returns {boolean} True if environment is React Native, otherwise false
223
223
  */
224
224
  const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
@@ -237,7 +237,7 @@ const isBlob = kindOfTest('Blob');
237
237
  *
238
238
  * @param {*} val The value to test
239
239
  *
240
- * @returns {boolean} True if value is a File, otherwise false
240
+ * @returns {boolean} True if value is a FileList, otherwise false
241
241
  */
242
242
  const isFileList = kindOfTest('FileList');
243
243
 
@@ -269,15 +269,17 @@ const G = getGlobal();
269
269
  const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
270
270
 
271
271
  const isFormData = (thing) => {
272
- let kind;
273
- return thing && (
274
- (FormDataCtor && thing instanceof FormDataCtor) || (
275
- isFunction$1(thing.append) && (
276
- (kind = kindOf(thing)) === 'formdata' ||
277
- // detect form-data instance
278
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
279
- )
280
- )
272
+ if (!thing) return false;
273
+ if (FormDataCtor && thing instanceof FormDataCtor) return true;
274
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
275
+ const proto = getPrototypeOf(thing);
276
+ if (!proto || proto === Object.prototype) return false;
277
+ if (!isFunction$1(thing.append)) return false;
278
+ const kind = kindOf(thing);
279
+ return (
280
+ kind === 'formdata' ||
281
+ // detect form-data instance
282
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
281
283
  );
282
284
  };
283
285
 
@@ -413,7 +415,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
413
415
  *
414
416
  * @returns {Object} Result of all merge properties
415
417
  */
416
- function merge(/* obj1, obj2, obj3, ... */) {
418
+ function merge(...objs) {
417
419
  const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
418
420
  const result = {};
419
421
  const assignValue = (val, key) => {
@@ -423,8 +425,12 @@ function merge(/* obj1, obj2, obj3, ... */) {
423
425
  }
424
426
 
425
427
  const targetKey = (caseless && findKey(result, key)) || key;
426
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
427
- result[targetKey] = merge(result[targetKey], val);
428
+ // Read via own-prop only — a bare `result[targetKey]` walks the prototype
429
+ // chain, so a polluted Object.prototype value could surface here and get
430
+ // copied into the merged result.
431
+ const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
432
+ if (isPlainObject(existing) && isPlainObject(val)) {
433
+ result[targetKey] = merge(existing, val);
428
434
  } else if (isPlainObject(val)) {
429
435
  result[targetKey] = merge({}, val);
430
436
  } else if (isArray(val)) {
@@ -434,8 +440,8 @@ function merge(/* obj1, obj2, obj3, ... */) {
434
440
  }
435
441
  };
436
442
 
437
- for (let i = 0, l = arguments.length; i < l; i++) {
438
- arguments[i] && forEach(arguments[i], assignValue);
443
+ for (let i = 0, l = objs.length; i < l; i++) {
444
+ objs[i] && forEach(objs[i], assignValue);
439
445
  }
440
446
  return result;
441
447
  }
@@ -457,6 +463,9 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
457
463
  (val, key) => {
458
464
  if (thisArg && isFunction$1(val)) {
459
465
  Object.defineProperty(a, key, {
466
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
467
+ // hijack defineProperty's accessor-vs-data resolution.
468
+ __proto__: null,
460
469
  value: bind(val, thisArg),
461
470
  writable: true,
462
471
  enumerable: true,
@@ -464,6 +473,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
464
473
  });
465
474
  } else {
466
475
  Object.defineProperty(a, key, {
476
+ __proto__: null,
467
477
  value: val,
468
478
  writable: true,
469
479
  enumerable: true,
@@ -502,12 +512,14 @@ const stripBOM = (content) => {
502
512
  const inherits = (constructor, superConstructor, props, descriptors) => {
503
513
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
504
514
  Object.defineProperty(constructor.prototype, 'constructor', {
515
+ __proto__: null,
505
516
  value: constructor,
506
517
  writable: true,
507
518
  enumerable: false,
508
519
  configurable: true,
509
520
  });
510
521
  Object.defineProperty(constructor, 'super', {
522
+ __proto__: null,
511
523
  value: superConstructor.prototype,
512
524
  });
513
525
  props && Object.assign(constructor.prototype, props);
@@ -689,7 +701,7 @@ const reduceDescriptors = (obj, reducer) => {
689
701
  const freezeMethods = (obj) => {
690
702
  reduceDescriptors(obj, (descriptor, name) => {
691
703
  // skip restricted props in strict mode
692
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
704
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
693
705
  return false;
694
706
  }
695
707
 
@@ -930,1297 +942,1398 @@ var utils$1 = {
930
942
  isIterable,
931
943
  };
932
944
 
933
- class AxiosError extends Error {
934
- static from(error, code, config, request, response, customProps) {
935
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
936
- axiosError.cause = error;
937
- axiosError.name = error.name;
945
+ // RawAxiosHeaders whose duplicates are ignored by node
946
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
947
+ const ignoreDuplicateOf = utils$1.toObjectSet([
948
+ 'age',
949
+ 'authorization',
950
+ 'content-length',
951
+ 'content-type',
952
+ 'etag',
953
+ 'expires',
954
+ 'from',
955
+ 'host',
956
+ 'if-modified-since',
957
+ 'if-unmodified-since',
958
+ 'last-modified',
959
+ 'location',
960
+ 'max-forwards',
961
+ 'proxy-authorization',
962
+ 'referer',
963
+ 'retry-after',
964
+ 'user-agent',
965
+ ]);
938
966
 
939
- // Preserve status from the original error if not already set from response
940
- if (error.status != null && axiosError.status == null) {
941
- axiosError.status = error.status;
942
- }
967
+ /**
968
+ * Parse headers into an object
969
+ *
970
+ * ```
971
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
972
+ * Content-Type: application/json
973
+ * Connection: keep-alive
974
+ * Transfer-Encoding: chunked
975
+ * ```
976
+ *
977
+ * @param {String} rawHeaders Headers needing to be parsed
978
+ *
979
+ * @returns {Object} Headers parsed into an object
980
+ */
981
+ var parseHeaders = (rawHeaders) => {
982
+ const parsed = {};
983
+ let key;
984
+ let val;
985
+ let i;
943
986
 
944
- customProps && Object.assign(axiosError, customProps);
945
- return axiosError;
946
- }
987
+ rawHeaders &&
988
+ rawHeaders.split('\n').forEach(function parser(line) {
989
+ i = line.indexOf(':');
990
+ key = line.substring(0, i).trim().toLowerCase();
991
+ val = line.substring(i + 1).trim();
947
992
 
948
- /**
949
- * Create an Error with the specified message, config, error code, request and response.
950
- *
951
- * @param {string} message The error message.
952
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
953
- * @param {Object} [config] The config.
954
- * @param {Object} [request] The request.
955
- * @param {Object} [response] The response.
956
- *
957
- * @returns {Error} The created error.
958
- */
959
- constructor(message, code, config, request, response) {
960
- super(message);
961
-
962
- // Make message enumerable to maintain backward compatibility
963
- // The native Error constructor sets message as non-enumerable,
964
- // but axios < v1.13.3 had it as enumerable
965
- Object.defineProperty(this, 'message', {
966
- value: message,
967
- enumerable: true,
968
- writable: true,
969
- configurable: true
970
- });
971
-
972
- this.name = 'AxiosError';
973
- this.isAxiosError = true;
974
- code && (this.code = code);
975
- config && (this.config = config);
976
- request && (this.request = request);
977
- if (response) {
978
- this.response = response;
979
- this.status = response.status;
993
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
994
+ return;
995
+ }
996
+
997
+ if (key === 'set-cookie') {
998
+ if (parsed[key]) {
999
+ parsed[key].push(val);
1000
+ } else {
1001
+ parsed[key] = [val];
1002
+ }
1003
+ } else {
1004
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
980
1005
  }
1006
+ });
1007
+
1008
+ return parsed;
1009
+ };
1010
+
1011
+ const $internals = Symbol('internals');
1012
+
1013
+ const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1014
+
1015
+ function trimSPorHTAB(str) {
1016
+ let start = 0;
1017
+ let end = str.length;
1018
+
1019
+ while (start < end) {
1020
+ const code = str.charCodeAt(start);
1021
+
1022
+ if (code !== 0x09 && code !== 0x20) {
1023
+ break;
981
1024
  }
982
1025
 
983
- toJSON() {
984
- return {
985
- // Standard
986
- message: this.message,
987
- name: this.name,
988
- // Microsoft
989
- description: this.description,
990
- number: this.number,
991
- // Mozilla
992
- fileName: this.fileName,
993
- lineNumber: this.lineNumber,
994
- columnNumber: this.columnNumber,
995
- stack: this.stack,
996
- // Axios
997
- config: utils$1.toJSONObject(this.config),
998
- code: this.code,
999
- status: this.status,
1000
- };
1026
+ start += 1;
1001
1027
  }
1002
- }
1003
1028
 
1004
- // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
1005
- AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
1006
- AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
1007
- AxiosError.ECONNABORTED = 'ECONNABORTED';
1008
- AxiosError.ETIMEDOUT = 'ETIMEDOUT';
1009
- AxiosError.ERR_NETWORK = 'ERR_NETWORK';
1010
- AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
1011
- AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
1012
- AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
1013
- AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1014
- AxiosError.ERR_CANCELED = 'ERR_CANCELED';
1015
- AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1016
- AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1029
+ while (end > start) {
1030
+ const code = str.charCodeAt(end - 1);
1017
1031
 
1018
- // eslint-disable-next-line strict
1019
- var httpAdapter = null;
1032
+ if (code !== 0x09 && code !== 0x20) {
1033
+ break;
1034
+ }
1020
1035
 
1021
- /**
1022
- * Determines if the given thing is a array or js object.
1023
- *
1024
- * @param {string} thing - The object or array to be visited.
1025
- *
1026
- * @returns {boolean}
1027
- */
1028
- function isVisitable(thing) {
1029
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1030
- }
1036
+ end -= 1;
1037
+ }
1031
1038
 
1032
- /**
1033
- * It removes the brackets from the end of a string
1034
- *
1035
- * @param {string} key - The key of the parameter.
1036
- *
1037
- * @returns {string} the key without the brackets.
1038
- */
1039
- function removeBrackets(key) {
1040
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
1039
+ return start === 0 && end === str.length ? str : str.slice(start, end);
1041
1040
  }
1042
1041
 
1043
- /**
1044
- * It takes a path, a key, and a boolean, and returns a string
1045
- *
1046
- * @param {string} path - The path to the current key.
1047
- * @param {string} key - The key of the current object being iterated over.
1048
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
1049
- *
1050
- * @returns {string} The path to the current key.
1051
- */
1052
- function renderKey(path, key, dots) {
1053
- if (!path) return key;
1054
- return path
1055
- .concat(key)
1056
- .map(function each(token, i) {
1057
- // eslint-disable-next-line no-param-reassign
1058
- token = removeBrackets(token);
1059
- return !dots && i ? '[' + token + ']' : token;
1060
- })
1061
- .join(dots ? '.' : '');
1042
+ function normalizeHeader(header) {
1043
+ return header && String(header).trim().toLowerCase();
1062
1044
  }
1063
1045
 
1064
- /**
1065
- * If the array is an array and none of its elements are visitable, then it's a flat array.
1066
- *
1067
- * @param {Array<any>} arr - The array to check
1068
- *
1069
- * @returns {boolean}
1070
- */
1071
- function isFlatArray(arr) {
1072
- return utils$1.isArray(arr) && !arr.some(isVisitable);
1046
+ function sanitizeHeaderValue(str) {
1047
+ return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
1073
1048
  }
1074
1049
 
1075
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1076
- return /^is[A-Z]/.test(prop);
1077
- });
1050
+ function normalizeValue(value) {
1051
+ if (value === false || value == null) {
1052
+ return value;
1053
+ }
1078
1054
 
1079
- /**
1080
- * Convert a data object to FormData
1081
- *
1082
- * @param {Object} obj
1083
- * @param {?Object} [formData]
1084
- * @param {?Object} [options]
1085
- * @param {Function} [options.visitor]
1086
- * @param {Boolean} [options.metaTokens = true]
1087
- * @param {Boolean} [options.dots = false]
1088
- * @param {?Boolean} [options.indexes = false]
1089
- *
1090
- * @returns {Object}
1091
- **/
1055
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
1056
+ }
1092
1057
 
1093
- /**
1094
- * It converts an object into a FormData object
1095
- *
1096
- * @param {Object<any, any>} obj - The object to convert to form data.
1097
- * @param {string} formData - The FormData object to append to.
1098
- * @param {Object<string, any>} options
1099
- *
1100
- * @returns
1101
- */
1102
- function toFormData(obj, formData, options) {
1103
- if (!utils$1.isObject(obj)) {
1104
- throw new TypeError('target must be an object');
1058
+ function parseTokens(str) {
1059
+ const tokens = Object.create(null);
1060
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1061
+ let match;
1062
+
1063
+ while ((match = tokensRE.exec(str))) {
1064
+ tokens[match[1]] = match[2];
1105
1065
  }
1106
1066
 
1107
- // eslint-disable-next-line no-param-reassign
1108
- formData = formData || new (FormData)();
1067
+ return tokens;
1068
+ }
1109
1069
 
1110
- // eslint-disable-next-line no-param-reassign
1111
- options = utils$1.toFlatObject(
1112
- options,
1113
- {
1114
- metaTokens: true,
1115
- dots: false,
1116
- indexes: false,
1117
- },
1118
- false,
1119
- function defined(option, source) {
1120
- // eslint-disable-next-line no-eq-null,eqeqeq
1121
- return !utils$1.isUndefined(source[option]);
1122
- }
1123
- );
1070
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1124
1071
 
1125
- const metaTokens = options.metaTokens;
1126
- // eslint-disable-next-line no-use-before-define
1127
- const visitor = options.visitor || defaultVisitor;
1128
- const dots = options.dots;
1129
- const indexes = options.indexes;
1130
- const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
1131
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1072
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1073
+ if (utils$1.isFunction(filter)) {
1074
+ return filter.call(this, value, header);
1075
+ }
1132
1076
 
1133
- if (!utils$1.isFunction(visitor)) {
1134
- throw new TypeError('visitor must be a function');
1077
+ if (isHeaderNameFilter) {
1078
+ value = header;
1135
1079
  }
1136
1080
 
1137
- function convertValue(value) {
1138
- if (value === null) return '';
1081
+ if (!utils$1.isString(value)) return;
1139
1082
 
1140
- if (utils$1.isDate(value)) {
1141
- return value.toISOString();
1142
- }
1083
+ if (utils$1.isString(filter)) {
1084
+ return value.indexOf(filter) !== -1;
1085
+ }
1143
1086
 
1144
- if (utils$1.isBoolean(value)) {
1145
- return value.toString();
1146
- }
1087
+ if (utils$1.isRegExp(filter)) {
1088
+ return filter.test(value);
1089
+ }
1090
+ }
1147
1091
 
1148
- if (!useBlob && utils$1.isBlob(value)) {
1149
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1150
- }
1092
+ function formatHeader(header) {
1093
+ return header
1094
+ .trim()
1095
+ .toLowerCase()
1096
+ .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1097
+ return char.toUpperCase() + str;
1098
+ });
1099
+ }
1151
1100
 
1152
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1153
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1154
- }
1101
+ function buildAccessors(obj, header) {
1102
+ const accessorName = utils$1.toCamelCase(' ' + header);
1155
1103
 
1156
- return value;
1104
+ ['get', 'set', 'has'].forEach((methodName) => {
1105
+ Object.defineProperty(obj, methodName + accessorName, {
1106
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1107
+ // this data descriptor into an accessor descriptor on the way in.
1108
+ __proto__: null,
1109
+ value: function (arg1, arg2, arg3) {
1110
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1111
+ },
1112
+ configurable: true,
1113
+ });
1114
+ });
1115
+ }
1116
+
1117
+ class AxiosHeaders {
1118
+ constructor(headers) {
1119
+ headers && this.set(headers);
1157
1120
  }
1158
1121
 
1159
- /**
1160
- * Default visitor.
1161
- *
1162
- * @param {*} value
1163
- * @param {String|Number} key
1164
- * @param {Array<String|Number>} path
1165
- * @this {FormData}
1166
- *
1167
- * @returns {boolean} return true to visit the each prop of the value recursively
1168
- */
1169
- function defaultVisitor(value, key, path) {
1170
- let arr = value;
1122
+ set(header, valueOrRewrite, rewrite) {
1123
+ const self = this;
1171
1124
 
1172
- if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1173
- formData.append(renderKey(path, key, dots), convertValue(value));
1174
- return false;
1175
- }
1125
+ function setHeader(_value, _header, _rewrite) {
1126
+ const lHeader = normalizeHeader(_header);
1176
1127
 
1177
- if (value && !path && typeof value === 'object') {
1178
- if (utils$1.endsWith(key, '{}')) {
1179
- // eslint-disable-next-line no-param-reassign
1180
- key = metaTokens ? key : key.slice(0, -2);
1181
- // eslint-disable-next-line no-param-reassign
1182
- value = JSON.stringify(value);
1183
- } else if (
1184
- (utils$1.isArray(value) && isFlatArray(value)) ||
1185
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
1186
- ) {
1187
- // eslint-disable-next-line no-param-reassign
1188
- key = removeBrackets(key);
1128
+ if (!lHeader) {
1129
+ throw new Error('header name must be a non-empty string');
1130
+ }
1189
1131
 
1190
- arr.forEach(function each(el, index) {
1191
- !(utils$1.isUndefined(el) || el === null) &&
1192
- formData.append(
1193
- // eslint-disable-next-line no-nested-ternary
1194
- indexes === true
1195
- ? renderKey([key], index, dots)
1196
- : indexes === null
1197
- ? key
1198
- : key + '[]',
1199
- convertValue(el)
1200
- );
1201
- });
1202
- return false;
1132
+ const key = utils$1.findKey(self, lHeader);
1133
+
1134
+ if (
1135
+ !key ||
1136
+ self[key] === undefined ||
1137
+ _rewrite === true ||
1138
+ (_rewrite === undefined && self[key] !== false)
1139
+ ) {
1140
+ self[key || _header] = normalizeValue(_value);
1203
1141
  }
1204
1142
  }
1205
1143
 
1206
- if (isVisitable(value)) {
1207
- return true;
1208
- }
1144
+ const setHeaders = (headers, _rewrite) =>
1145
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1209
1146
 
1210
- formData.append(renderKey(path, key, dots), convertValue(value));
1147
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1148
+ setHeaders(header, valueOrRewrite);
1149
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1150
+ setHeaders(parseHeaders(header), valueOrRewrite);
1151
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1152
+ let obj = {},
1153
+ dest,
1154
+ key;
1155
+ for (const entry of header) {
1156
+ if (!utils$1.isArray(entry)) {
1157
+ throw TypeError('Object iterator must return a key-value pair');
1158
+ }
1211
1159
 
1212
- return false;
1160
+ obj[(key = entry[0])] = (dest = obj[key])
1161
+ ? utils$1.isArray(dest)
1162
+ ? [...dest, entry[1]]
1163
+ : [dest, entry[1]]
1164
+ : entry[1];
1165
+ }
1166
+
1167
+ setHeaders(obj, valueOrRewrite);
1168
+ } else {
1169
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1170
+ }
1171
+
1172
+ return this;
1213
1173
  }
1214
1174
 
1215
- const stack = [];
1175
+ get(header, parser) {
1176
+ header = normalizeHeader(header);
1216
1177
 
1217
- const exposedHelpers = Object.assign(predicates, {
1218
- defaultVisitor,
1219
- convertValue,
1220
- isVisitable,
1221
- });
1178
+ if (header) {
1179
+ const key = utils$1.findKey(this, header);
1222
1180
 
1223
- function build(value, path) {
1224
- if (utils$1.isUndefined(value)) return;
1181
+ if (key) {
1182
+ const value = this[key];
1225
1183
 
1226
- if (stack.indexOf(value) !== -1) {
1227
- throw Error('Circular reference detected in ' + path.join('.'));
1228
- }
1184
+ if (!parser) {
1185
+ return value;
1186
+ }
1229
1187
 
1230
- stack.push(value);
1188
+ if (parser === true) {
1189
+ return parseTokens(value);
1190
+ }
1231
1191
 
1232
- utils$1.forEach(value, function each(el, key) {
1233
- const result =
1234
- !(utils$1.isUndefined(el) || el === null) &&
1235
- visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1192
+ if (utils$1.isFunction(parser)) {
1193
+ return parser.call(this, value, key);
1194
+ }
1236
1195
 
1237
- if (result === true) {
1238
- build(el, path ? path.concat(key) : [key]);
1239
- }
1240
- });
1196
+ if (utils$1.isRegExp(parser)) {
1197
+ return parser.exec(value);
1198
+ }
1241
1199
 
1242
- stack.pop();
1200
+ throw new TypeError('parser must be boolean|regexp|function');
1201
+ }
1202
+ }
1243
1203
  }
1244
1204
 
1245
- if (!utils$1.isObject(obj)) {
1246
- throw new TypeError('data must be an object');
1247
- }
1205
+ has(header, matcher) {
1206
+ header = normalizeHeader(header);
1248
1207
 
1249
- build(obj);
1208
+ if (header) {
1209
+ const key = utils$1.findKey(this, header);
1250
1210
 
1251
- return formData;
1252
- }
1211
+ return !!(
1212
+ key &&
1213
+ this[key] !== undefined &&
1214
+ (!matcher || matchHeaderValue(this, this[key], key, matcher))
1215
+ );
1216
+ }
1253
1217
 
1254
- /**
1255
- * It encodes a string by replacing all characters that are not in the unreserved set with
1256
- * their percent-encoded equivalents
1257
- *
1258
- * @param {string} str - The string to encode.
1259
- *
1260
- * @returns {string} The encoded string.
1261
- */
1262
- function encode$1(str) {
1263
- const charMap = {
1264
- '!': '%21',
1265
- "'": '%27',
1266
- '(': '%28',
1267
- ')': '%29',
1268
- '~': '%7E',
1269
- '%20': '+',
1270
- '%00': '\x00',
1271
- };
1272
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1273
- return charMap[match];
1274
- });
1275
- }
1218
+ return false;
1219
+ }
1276
1220
 
1277
- /**
1278
- * It takes a params object and converts it to a FormData object
1279
- *
1280
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1281
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1282
- *
1283
- * @returns {void}
1284
- */
1285
- function AxiosURLSearchParams(params, options) {
1286
- this._pairs = [];
1221
+ delete(header, matcher) {
1222
+ const self = this;
1223
+ let deleted = false;
1287
1224
 
1288
- params && toFormData(params, this, options);
1289
- }
1225
+ function deleteHeader(_header) {
1226
+ _header = normalizeHeader(_header);
1290
1227
 
1291
- const prototype = AxiosURLSearchParams.prototype;
1228
+ if (_header) {
1229
+ const key = utils$1.findKey(self, _header);
1292
1230
 
1293
- prototype.append = function append(name, value) {
1294
- this._pairs.push([name, value]);
1295
- };
1231
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1232
+ delete self[key];
1296
1233
 
1297
- prototype.toString = function toString(encoder) {
1298
- const _encode = encoder
1299
- ? function (value) {
1300
- return encoder.call(this, value, encode$1);
1234
+ deleted = true;
1235
+ }
1301
1236
  }
1302
- : encode$1;
1237
+ }
1303
1238
 
1304
- return this._pairs
1305
- .map(function each(pair) {
1306
- return _encode(pair[0]) + '=' + _encode(pair[1]);
1307
- }, '')
1308
- .join('&');
1309
- };
1239
+ if (utils$1.isArray(header)) {
1240
+ header.forEach(deleteHeader);
1241
+ } else {
1242
+ deleteHeader(header);
1243
+ }
1310
1244
 
1311
- /**
1312
- * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
1313
- * their plain counterparts (`:`, `$`, `,`, `+`).
1314
- *
1315
- * @param {string} val The value to be encoded.
1316
- *
1317
- * @returns {string} The encoded value.
1318
- */
1319
- function encode(val) {
1320
- return encodeURIComponent(val)
1321
- .replace(/%3A/gi, ':')
1322
- .replace(/%24/g, '$')
1323
- .replace(/%2C/gi, ',')
1324
- .replace(/%20/g, '+');
1325
- }
1245
+ return deleted;
1246
+ }
1326
1247
 
1327
- /**
1328
- * Build a URL by appending params to the end
1329
- *
1330
- * @param {string} url The base of the url (e.g., http://www.google.com)
1331
- * @param {object} [params] The params to be appended
1332
- * @param {?(object|Function)} options
1333
- *
1334
- * @returns {string} The formatted url
1335
- */
1336
- function buildURL(url, params, options) {
1337
- if (!params) {
1338
- return url;
1248
+ clear(matcher) {
1249
+ const keys = Object.keys(this);
1250
+ let i = keys.length;
1251
+ let deleted = false;
1252
+
1253
+ while (i--) {
1254
+ const key = keys[i];
1255
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1256
+ delete this[key];
1257
+ deleted = true;
1258
+ }
1259
+ }
1260
+
1261
+ return deleted;
1339
1262
  }
1340
1263
 
1341
- const _encode = (options && options.encode) || encode;
1264
+ normalize(format) {
1265
+ const self = this;
1266
+ const headers = {};
1342
1267
 
1343
- const _options = utils$1.isFunction(options)
1344
- ? {
1345
- serialize: options,
1268
+ utils$1.forEach(this, (value, header) => {
1269
+ const key = utils$1.findKey(headers, header);
1270
+
1271
+ if (key) {
1272
+ self[key] = normalizeValue(value);
1273
+ delete self[header];
1274
+ return;
1346
1275
  }
1347
- : options;
1348
1276
 
1349
- const serializeFn = _options && _options.serialize;
1277
+ const normalized = format ? formatHeader(header) : String(header).trim();
1350
1278
 
1351
- let serializedParams;
1279
+ if (normalized !== header) {
1280
+ delete self[header];
1281
+ }
1352
1282
 
1353
- if (serializeFn) {
1354
- serializedParams = serializeFn(params, _options);
1355
- } else {
1356
- serializedParams = utils$1.isURLSearchParams(params)
1357
- ? params.toString()
1358
- : new AxiosURLSearchParams(params, _options).toString(_encode);
1359
- }
1283
+ self[normalized] = normalizeValue(value);
1360
1284
 
1361
- if (serializedParams) {
1362
- const hashmarkIndex = url.indexOf('#');
1285
+ headers[normalized] = true;
1286
+ });
1363
1287
 
1364
- if (hashmarkIndex !== -1) {
1365
- url = url.slice(0, hashmarkIndex);
1366
- }
1367
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1288
+ return this;
1368
1289
  }
1369
1290
 
1370
- return url;
1371
- }
1372
-
1373
- class InterceptorManager {
1374
- constructor() {
1375
- this.handlers = [];
1291
+ concat(...targets) {
1292
+ return this.constructor.concat(this, ...targets);
1376
1293
  }
1377
1294
 
1378
- /**
1379
- * Add a new interceptor to the stack
1380
- *
1381
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1382
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1383
- * @param {Object} options The options for the interceptor, synchronous and runWhen
1384
- *
1385
- * @return {Number} An ID used to remove interceptor later
1386
- */
1387
- use(fulfilled, rejected, options) {
1388
- this.handlers.push({
1389
- fulfilled,
1390
- rejected,
1391
- synchronous: options ? options.synchronous : false,
1392
- runWhen: options ? options.runWhen : null,
1295
+ toJSON(asStrings) {
1296
+ const obj = Object.create(null);
1297
+
1298
+ utils$1.forEach(this, (value, header) => {
1299
+ value != null &&
1300
+ value !== false &&
1301
+ (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
1393
1302
  });
1394
- return this.handlers.length - 1;
1303
+
1304
+ return obj;
1395
1305
  }
1396
1306
 
1397
- /**
1398
- * Remove an interceptor from the stack
1399
- *
1400
- * @param {Number} id The ID that was returned by `use`
1401
- *
1402
- * @returns {void}
1403
- */
1404
- eject(id) {
1405
- if (this.handlers[id]) {
1406
- this.handlers[id] = null;
1407
- }
1307
+ [Symbol.iterator]() {
1308
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1408
1309
  }
1409
1310
 
1410
- /**
1411
- * Clear all interceptors from the stack
1412
- *
1413
- * @returns {void}
1414
- */
1415
- clear() {
1416
- if (this.handlers) {
1417
- this.handlers = [];
1418
- }
1311
+ toString() {
1312
+ return Object.entries(this.toJSON())
1313
+ .map(([header, value]) => header + ': ' + value)
1314
+ .join('\n');
1419
1315
  }
1420
1316
 
1421
- /**
1422
- * Iterate over all the registered interceptors
1423
- *
1424
- * This method is particularly useful for skipping over any
1425
- * interceptors that may have become `null` calling `eject`.
1426
- *
1427
- * @param {Function} fn The function to call for each interceptor
1428
- *
1429
- * @returns {void}
1430
- */
1431
- forEach(fn) {
1432
- utils$1.forEach(this.handlers, function forEachHandler(h) {
1433
- if (h !== null) {
1434
- fn(h);
1435
- }
1436
- });
1317
+ getSetCookie() {
1318
+ return this.get('set-cookie') || [];
1437
1319
  }
1438
- }
1439
1320
 
1440
- var transitionalDefaults = {
1441
- silentJSONParsing: true,
1442
- forcedJSONParsing: true,
1443
- clarifyTimeoutError: false,
1444
- legacyInterceptorReqResOrdering: true,
1445
- };
1321
+ get [Symbol.toStringTag]() {
1322
+ return 'AxiosHeaders';
1323
+ }
1446
1324
 
1447
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1325
+ static from(thing) {
1326
+ return thing instanceof this ? thing : new this(thing);
1327
+ }
1448
1328
 
1449
- var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1329
+ static concat(first, ...targets) {
1330
+ const computed = new this(first);
1450
1331
 
1451
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1332
+ targets.forEach((target) => computed.set(target));
1452
1333
 
1453
- var platform$1 = {
1454
- isBrowser: true,
1455
- classes: {
1456
- URLSearchParams: URLSearchParams$1,
1457
- FormData: FormData$1,
1458
- Blob: Blob$1,
1459
- },
1460
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
1461
- };
1334
+ return computed;
1335
+ }
1462
1336
 
1463
- const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1337
+ static accessor(header) {
1338
+ const internals =
1339
+ (this[$internals] =
1340
+ this[$internals] =
1341
+ {
1342
+ accessors: {},
1343
+ });
1464
1344
 
1465
- const _navigator = (typeof navigator === 'object' && navigator) || undefined;
1345
+ const accessors = internals.accessors;
1346
+ const prototype = this.prototype;
1466
1347
 
1467
- /**
1468
- * Determine if we're running in a standard browser environment
1469
- *
1470
- * This allows axios to run in a web worker, and react-native.
1471
- * Both environments support XMLHttpRequest, but not fully standard globals.
1472
- *
1473
- * web workers:
1474
- * typeof window -> undefined
1475
- * typeof document -> undefined
1476
- *
1477
- * react-native:
1478
- * navigator.product -> 'ReactNative'
1479
- * nativescript
1480
- * navigator.product -> 'NativeScript' or 'NS'
1481
- *
1482
- * @returns {boolean}
1483
- */
1484
- const hasStandardBrowserEnv =
1485
- hasBrowserEnv &&
1486
- (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
1348
+ function defineAccessor(_header) {
1349
+ const lHeader = normalizeHeader(_header);
1487
1350
 
1488
- /**
1489
- * Determine if we're running in a standard browser webWorker environment
1490
- *
1491
- * Although the `isStandardBrowserEnv` method indicates that
1492
- * `allows axios to run in a web worker`, the WebWorker will still be
1493
- * filtered out due to its judgment standard
1494
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1495
- * This leads to a problem when axios post `FormData` in webWorker
1496
- */
1497
- const hasStandardBrowserWebWorkerEnv = (() => {
1498
- return (
1499
- typeof WorkerGlobalScope !== 'undefined' &&
1500
- // eslint-disable-next-line no-undef
1501
- self instanceof WorkerGlobalScope &&
1502
- typeof self.importScripts === 'function'
1503
- );
1504
- })();
1351
+ if (!accessors[lHeader]) {
1352
+ buildAccessors(prototype, _header);
1353
+ accessors[lHeader] = true;
1354
+ }
1355
+ }
1505
1356
 
1506
- const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
1357
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1507
1358
 
1508
- var utils = /*#__PURE__*/Object.freeze({
1509
- __proto__: null,
1510
- hasBrowserEnv: hasBrowserEnv,
1511
- hasStandardBrowserEnv: hasStandardBrowserEnv,
1512
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1513
- navigator: _navigator,
1514
- origin: origin
1515
- });
1359
+ return this;
1360
+ }
1361
+ }
1516
1362
 
1517
- var platform = {
1518
- ...utils,
1519
- ...platform$1,
1520
- };
1521
-
1522
- function toURLEncodedForm(data, options) {
1523
- return toFormData(data, new platform.classes.URLSearchParams(), {
1524
- visitor: function (value, key, path, helpers) {
1525
- if (platform.isNode && utils$1.isBuffer(value)) {
1526
- this.append(key, value.toString('base64'));
1527
- return false;
1528
- }
1363
+ AxiosHeaders.accessor([
1364
+ 'Content-Type',
1365
+ 'Content-Length',
1366
+ 'Accept',
1367
+ 'Accept-Encoding',
1368
+ 'User-Agent',
1369
+ 'Authorization',
1370
+ ]);
1529
1371
 
1530
- return helpers.defaultVisitor.apply(this, arguments);
1372
+ // reserved names hotfix
1373
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
1374
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1375
+ return {
1376
+ get: () => value,
1377
+ set(headerValue) {
1378
+ this[mapped] = headerValue;
1531
1379
  },
1532
- ...options,
1533
- });
1534
- }
1380
+ };
1381
+ });
1535
1382
 
1536
- /**
1537
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1538
- *
1539
- * @param {string} name - The name of the property to get.
1540
- *
1541
- * @returns An array of strings.
1542
- */
1543
- function parsePropPath(name) {
1544
- // foo[x][y][z]
1545
- // foo.x.y.z
1546
- // foo-x-y-z
1547
- // foo x y z
1548
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
1549
- return match[0] === '[]' ? '' : match[1] || match[0];
1550
- });
1551
- }
1383
+ utils$1.freezeMethods(AxiosHeaders);
1552
1384
 
1553
- /**
1554
- * Convert an array to an object.
1555
- *
1556
- * @param {Array<any>} arr - The array to convert to an object.
1557
- *
1558
- * @returns An object with the same keys and values as the array.
1559
- */
1560
- function arrayToObject(arr) {
1561
- const obj = {};
1562
- const keys = Object.keys(arr);
1563
- let i;
1564
- const len = keys.length;
1565
- let key;
1566
- for (i = 0; i < len; i++) {
1567
- key = keys[i];
1568
- obj[key] = arr[key];
1385
+ const REDACTED = '[REDACTED ****]';
1386
+
1387
+ function hasOwnOrPrototypeToJSON(source) {
1388
+ if (utils$1.hasOwnProp(source, 'toJSON')) {
1389
+ return true;
1569
1390
  }
1570
- return obj;
1391
+
1392
+ let prototype = Object.getPrototypeOf(source);
1393
+
1394
+ while (prototype && prototype !== Object.prototype) {
1395
+ if (utils$1.hasOwnProp(prototype, 'toJSON')) {
1396
+ return true;
1397
+ }
1398
+
1399
+ prototype = Object.getPrototypeOf(prototype);
1400
+ }
1401
+
1402
+ return false;
1571
1403
  }
1572
1404
 
1573
- /**
1574
- * It takes a FormData object and returns a JavaScript object
1575
- *
1576
- * @param {string} formData The FormData object to convert to JSON.
1577
- *
1578
- * @returns {Object<string, any> | null} The converted object.
1579
- */
1580
- function formDataToJSON(formData) {
1581
- function buildPath(path, value, target, index) {
1582
- let name = path[index++];
1405
+ // Build a plain-object snapshot of `config` and replace the value of any key
1406
+ // (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
1407
+ // and AxiosHeaders, and short-circuits on circular references.
1408
+ function redactConfig(config, redactKeys) {
1409
+ const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
1410
+ const seen = [];
1583
1411
 
1584
- if (name === '__proto__') return true;
1412
+ const visit = (source) => {
1413
+ if (source === null || typeof source !== 'object') return source;
1414
+ if (utils$1.isBuffer(source)) return source;
1415
+ if (seen.indexOf(source) !== -1) return undefined;
1585
1416
 
1586
- const isNumericKey = Number.isFinite(+name);
1587
- const isLast = index >= path.length;
1588
- name = !name && utils$1.isArray(target) ? target.length : name;
1417
+ if (source instanceof AxiosHeaders) {
1418
+ source = source.toJSON();
1419
+ }
1589
1420
 
1590
- if (isLast) {
1591
- if (utils$1.hasOwnProp(target, name)) {
1592
- target[name] = [target[name], value];
1593
- } else {
1594
- target[name] = value;
1421
+ seen.push(source);
1422
+
1423
+ let result;
1424
+ if (utils$1.isArray(source)) {
1425
+ result = [];
1426
+ source.forEach((v, i) => {
1427
+ const reducedValue = visit(v);
1428
+ if (!utils$1.isUndefined(reducedValue)) {
1429
+ result[i] = reducedValue;
1430
+ }
1431
+ });
1432
+ } else {
1433
+ if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
1434
+ seen.pop();
1435
+ return source;
1595
1436
  }
1596
1437
 
1597
- return !isNumericKey;
1438
+ result = Object.create(null);
1439
+ for (const [key, value] of Object.entries(source)) {
1440
+ const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
1441
+ if (!utils$1.isUndefined(reducedValue)) {
1442
+ result[key] = reducedValue;
1443
+ }
1444
+ }
1598
1445
  }
1599
1446
 
1600
- if (!target[name] || !utils$1.isObject(target[name])) {
1601
- target[name] = [];
1602
- }
1447
+ seen.pop();
1448
+ return result;
1449
+ };
1603
1450
 
1604
- const result = buildPath(path, value, target[name], index);
1451
+ return visit(config);
1452
+ }
1605
1453
 
1606
- if (result && utils$1.isArray(target[name])) {
1607
- target[name] = arrayToObject(target[name]);
1454
+ class AxiosError extends Error {
1455
+ static from(error, code, config, request, response, customProps) {
1456
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1457
+ axiosError.cause = error;
1458
+ axiosError.name = error.name;
1459
+
1460
+ // Preserve status from the original error if not already set from response
1461
+ if (error.status != null && axiosError.status == null) {
1462
+ axiosError.status = error.status;
1608
1463
  }
1609
1464
 
1610
- return !isNumericKey;
1465
+ customProps && Object.assign(axiosError, customProps);
1466
+ return axiosError;
1611
1467
  }
1612
1468
 
1613
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1614
- const obj = {};
1615
-
1616
- utils$1.forEachEntry(formData, (name, value) => {
1617
- buildPath(parsePropPath(name), value, obj, 0);
1469
+ /**
1470
+ * Create an Error with the specified message, config, error code, request and response.
1471
+ *
1472
+ * @param {string} message The error message.
1473
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
1474
+ * @param {Object} [config] The config.
1475
+ * @param {Object} [request] The request.
1476
+ * @param {Object} [response] The response.
1477
+ *
1478
+ * @returns {Error} The created error.
1479
+ */
1480
+ constructor(message, code, config, request, response) {
1481
+ super(message);
1482
+
1483
+ // Make message enumerable to maintain backward compatibility
1484
+ // The native Error constructor sets message as non-enumerable,
1485
+ // but axios < v1.13.3 had it as enumerable
1486
+ Object.defineProperty(this, 'message', {
1487
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1488
+ // this data descriptor into an accessor descriptor on the way in.
1489
+ __proto__: null,
1490
+ value: message,
1491
+ enumerable: true,
1492
+ writable: true,
1493
+ configurable: true,
1618
1494
  });
1619
1495
 
1620
- return obj;
1496
+ this.name = 'AxiosError';
1497
+ this.isAxiosError = true;
1498
+ code && (this.code = code);
1499
+ config && (this.config = config);
1500
+ request && (this.request = request);
1501
+ if (response) {
1502
+ this.response = response;
1503
+ this.status = response.status;
1504
+ }
1621
1505
  }
1622
1506
 
1623
- return null;
1507
+ toJSON() {
1508
+ // Opt-in redaction: when the request config carries a `redact` array, the
1509
+ // value of any matching key (case-insensitive, at any depth) is replaced
1510
+ // with REDACTED in the serialized snapshot. Undefined or empty leaves the
1511
+ // existing serialization behavior unchanged.
1512
+ const config = this.config;
1513
+ const redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
1514
+ const serializedConfig =
1515
+ utils$1.isArray(redactKeys) && redactKeys.length > 0
1516
+ ? redactConfig(config, redactKeys)
1517
+ : utils$1.toJSONObject(config);
1518
+
1519
+ return {
1520
+ // Standard
1521
+ message: this.message,
1522
+ name: this.name,
1523
+ // Microsoft
1524
+ description: this.description,
1525
+ number: this.number,
1526
+ // Mozilla
1527
+ fileName: this.fileName,
1528
+ lineNumber: this.lineNumber,
1529
+ columnNumber: this.columnNumber,
1530
+ stack: this.stack,
1531
+ // Axios
1532
+ config: serializedConfig,
1533
+ code: this.code,
1534
+ status: this.status,
1535
+ };
1536
+ }
1624
1537
  }
1625
1538
 
1539
+ // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
1540
+ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
1541
+ AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
1542
+ AxiosError.ECONNABORTED = 'ECONNABORTED';
1543
+ AxiosError.ETIMEDOUT = 'ETIMEDOUT';
1544
+ AxiosError.ECONNREFUSED = 'ECONNREFUSED';
1545
+ AxiosError.ERR_NETWORK = 'ERR_NETWORK';
1546
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
1547
+ AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
1548
+ AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
1549
+ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1550
+ AxiosError.ERR_CANCELED = 'ERR_CANCELED';
1551
+ AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1552
+ AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1553
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1554
+
1555
+ // eslint-disable-next-line strict
1556
+ var httpAdapter = null;
1557
+
1626
1558
  /**
1627
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1628
- * of the input
1559
+ * Determines if the given thing is a array or js object.
1629
1560
  *
1630
- * @param {any} rawValue - The value to be stringified.
1631
- * @param {Function} parser - A function that parses a string into a JavaScript object.
1632
- * @param {Function} encoder - A function that takes a value and returns a string.
1561
+ * @param {string} thing - The object or array to be visited.
1633
1562
  *
1634
- * @returns {string} A stringified version of the rawValue.
1563
+ * @returns {boolean}
1635
1564
  */
1636
- function stringifySafely(rawValue, parser, encoder) {
1637
- if (utils$1.isString(rawValue)) {
1638
- try {
1639
- (parser || JSON.parse)(rawValue);
1640
- return utils$1.trim(rawValue);
1641
- } catch (e) {
1642
- if (e.name !== 'SyntaxError') {
1643
- throw e;
1644
- }
1645
- }
1646
- }
1647
-
1648
- return (encoder || JSON.stringify)(rawValue);
1565
+ function isVisitable(thing) {
1566
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1649
1567
  }
1650
1568
 
1651
- const defaults = {
1652
- transitional: transitionalDefaults,
1653
-
1654
- adapter: ['xhr', 'http', 'fetch'],
1655
-
1656
- transformRequest: [
1657
- function transformRequest(data, headers) {
1658
- const contentType = headers.getContentType() || '';
1659
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
1660
- const isObjectPayload = utils$1.isObject(data);
1569
+ /**
1570
+ * It removes the brackets from the end of a string
1571
+ *
1572
+ * @param {string} key - The key of the parameter.
1573
+ *
1574
+ * @returns {string} the key without the brackets.
1575
+ */
1576
+ function removeBrackets(key) {
1577
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
1578
+ }
1661
1579
 
1662
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
1663
- data = new FormData(data);
1664
- }
1580
+ /**
1581
+ * It takes a path, a key, and a boolean, and returns a string
1582
+ *
1583
+ * @param {string} path - The path to the current key.
1584
+ * @param {string} key - The key of the current object being iterated over.
1585
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
1586
+ *
1587
+ * @returns {string} The path to the current key.
1588
+ */
1589
+ function renderKey(path, key, dots) {
1590
+ if (!path) return key;
1591
+ return path
1592
+ .concat(key)
1593
+ .map(function each(token, i) {
1594
+ // eslint-disable-next-line no-param-reassign
1595
+ token = removeBrackets(token);
1596
+ return !dots && i ? '[' + token + ']' : token;
1597
+ })
1598
+ .join(dots ? '.' : '');
1599
+ }
1665
1600
 
1666
- const isFormData = utils$1.isFormData(data);
1601
+ /**
1602
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
1603
+ *
1604
+ * @param {Array<any>} arr - The array to check
1605
+ *
1606
+ * @returns {boolean}
1607
+ */
1608
+ function isFlatArray(arr) {
1609
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
1610
+ }
1667
1611
 
1668
- if (isFormData) {
1669
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1670
- }
1612
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1613
+ return /^is[A-Z]/.test(prop);
1614
+ });
1671
1615
 
1672
- if (
1673
- utils$1.isArrayBuffer(data) ||
1674
- utils$1.isBuffer(data) ||
1675
- utils$1.isStream(data) ||
1676
- utils$1.isFile(data) ||
1677
- utils$1.isBlob(data) ||
1678
- utils$1.isReadableStream(data)
1679
- ) {
1680
- return data;
1681
- }
1682
- if (utils$1.isArrayBufferView(data)) {
1683
- return data.buffer;
1684
- }
1685
- if (utils$1.isURLSearchParams(data)) {
1686
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1687
- return data.toString();
1688
- }
1616
+ /**
1617
+ * Convert a data object to FormData
1618
+ *
1619
+ * @param {Object} obj
1620
+ * @param {?Object} [formData]
1621
+ * @param {?Object} [options]
1622
+ * @param {Function} [options.visitor]
1623
+ * @param {Boolean} [options.metaTokens = true]
1624
+ * @param {Boolean} [options.dots = false]
1625
+ * @param {?Boolean} [options.indexes = false]
1626
+ *
1627
+ * @returns {Object}
1628
+ **/
1689
1629
 
1690
- let isFileList;
1630
+ /**
1631
+ * It converts an object into a FormData object
1632
+ *
1633
+ * @param {Object<any, any>} obj - The object to convert to form data.
1634
+ * @param {string} formData - The FormData object to append to.
1635
+ * @param {Object<string, any>} options
1636
+ *
1637
+ * @returns
1638
+ */
1639
+ function toFormData(obj, formData, options) {
1640
+ if (!utils$1.isObject(obj)) {
1641
+ throw new TypeError('target must be an object');
1642
+ }
1691
1643
 
1692
- if (isObjectPayload) {
1693
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1694
- return toURLEncodedForm(data, this.formSerializer).toString();
1695
- }
1644
+ // eslint-disable-next-line no-param-reassign
1645
+ formData = formData || new (FormData)();
1696
1646
 
1697
- if (
1698
- (isFileList = utils$1.isFileList(data)) ||
1699
- contentType.indexOf('multipart/form-data') > -1
1700
- ) {
1701
- const _FormData = this.env && this.env.FormData;
1647
+ // eslint-disable-next-line no-param-reassign
1648
+ options = utils$1.toFlatObject(
1649
+ options,
1650
+ {
1651
+ metaTokens: true,
1652
+ dots: false,
1653
+ indexes: false,
1654
+ },
1655
+ false,
1656
+ function defined(option, source) {
1657
+ // eslint-disable-next-line no-eq-null,eqeqeq
1658
+ return !utils$1.isUndefined(source[option]);
1659
+ }
1660
+ );
1702
1661
 
1703
- return toFormData(
1704
- isFileList ? { 'files[]': data } : data,
1705
- _FormData && new _FormData(),
1706
- this.formSerializer
1707
- );
1708
- }
1709
- }
1662
+ const metaTokens = options.metaTokens;
1663
+ // eslint-disable-next-line no-use-before-define
1664
+ const visitor = options.visitor || defaultVisitor;
1665
+ const dots = options.dots;
1666
+ const indexes = options.indexes;
1667
+ const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
1668
+ const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
1669
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1710
1670
 
1711
- if (isObjectPayload || hasJSONContentType) {
1712
- headers.setContentType('application/json', false);
1713
- return stringifySafely(data);
1714
- }
1671
+ if (!utils$1.isFunction(visitor)) {
1672
+ throw new TypeError('visitor must be a function');
1673
+ }
1715
1674
 
1716
- return data;
1717
- },
1718
- ],
1675
+ function convertValue(value) {
1676
+ if (value === null) return '';
1719
1677
 
1720
- transformResponse: [
1721
- function transformResponse(data) {
1722
- const transitional = this.transitional || defaults.transitional;
1723
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1724
- const JSONRequested = this.responseType === 'json';
1678
+ if (utils$1.isDate(value)) {
1679
+ return value.toISOString();
1680
+ }
1725
1681
 
1726
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1727
- return data;
1728
- }
1682
+ if (utils$1.isBoolean(value)) {
1683
+ return value.toString();
1684
+ }
1729
1685
 
1730
- if (
1731
- data &&
1732
- utils$1.isString(data) &&
1733
- ((forcedJSONParsing && !this.responseType) || JSONRequested)
1734
- ) {
1735
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
1736
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
1686
+ if (!useBlob && utils$1.isBlob(value)) {
1687
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1688
+ }
1737
1689
 
1738
- try {
1739
- return JSON.parse(data, this.parseReviver);
1740
- } catch (e) {
1741
- if (strictJSONParsing) {
1742
- if (e.name === 'SyntaxError') {
1743
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1744
- }
1745
- throw e;
1746
- }
1747
- }
1748
- }
1690
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1691
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1692
+ }
1749
1693
 
1750
- return data;
1751
- },
1752
- ],
1694
+ return value;
1695
+ }
1753
1696
 
1754
1697
  /**
1755
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1756
- * timeout is not created.
1698
+ * Default visitor.
1699
+ *
1700
+ * @param {*} value
1701
+ * @param {String|Number} key
1702
+ * @param {Array<String|Number>} path
1703
+ * @this {FormData}
1704
+ *
1705
+ * @returns {boolean} return true to visit the each prop of the value recursively
1757
1706
  */
1758
- timeout: 0,
1707
+ function defaultVisitor(value, key, path) {
1708
+ let arr = value;
1759
1709
 
1760
- xsrfCookieName: 'XSRF-TOKEN',
1761
- xsrfHeaderName: 'X-XSRF-TOKEN',
1710
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1711
+ formData.append(renderKey(path, key, dots), convertValue(value));
1712
+ return false;
1713
+ }
1762
1714
 
1763
- maxContentLength: -1,
1764
- maxBodyLength: -1,
1715
+ if (value && !path && typeof value === 'object') {
1716
+ if (utils$1.endsWith(key, '{}')) {
1717
+ // eslint-disable-next-line no-param-reassign
1718
+ key = metaTokens ? key : key.slice(0, -2);
1719
+ // eslint-disable-next-line no-param-reassign
1720
+ value = JSON.stringify(value);
1721
+ } else if (
1722
+ (utils$1.isArray(value) && isFlatArray(value)) ||
1723
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
1724
+ ) {
1725
+ // eslint-disable-next-line no-param-reassign
1726
+ key = removeBrackets(key);
1765
1727
 
1766
- env: {
1767
- FormData: platform.classes.FormData,
1768
- Blob: platform.classes.Blob,
1769
- },
1728
+ arr.forEach(function each(el, index) {
1729
+ !(utils$1.isUndefined(el) || el === null) &&
1730
+ formData.append(
1731
+ // eslint-disable-next-line no-nested-ternary
1732
+ indexes === true
1733
+ ? renderKey([key], index, dots)
1734
+ : indexes === null
1735
+ ? key
1736
+ : key + '[]',
1737
+ convertValue(el)
1738
+ );
1739
+ });
1740
+ return false;
1741
+ }
1742
+ }
1770
1743
 
1771
- validateStatus: function validateStatus(status) {
1772
- return status >= 200 && status < 300;
1773
- },
1744
+ if (isVisitable(value)) {
1745
+ return true;
1746
+ }
1774
1747
 
1775
- headers: {
1776
- common: {
1777
- Accept: 'application/json, text/plain, */*',
1778
- 'Content-Type': undefined,
1779
- },
1780
- },
1781
- };
1748
+ formData.append(renderKey(path, key, dots), convertValue(value));
1782
1749
 
1783
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
1784
- defaults.headers[method] = {};
1785
- });
1750
+ return false;
1751
+ }
1786
1752
 
1787
- // RawAxiosHeaders whose duplicates are ignored by node
1788
- // c.f. https://nodejs.org/api/http.html#http_message_headers
1789
- const ignoreDuplicateOf = utils$1.toObjectSet([
1790
- 'age',
1791
- 'authorization',
1792
- 'content-length',
1793
- 'content-type',
1794
- 'etag',
1795
- 'expires',
1796
- 'from',
1797
- 'host',
1798
- 'if-modified-since',
1799
- 'if-unmodified-since',
1800
- 'last-modified',
1801
- 'location',
1802
- 'max-forwards',
1803
- 'proxy-authorization',
1804
- 'referer',
1805
- 'retry-after',
1806
- 'user-agent',
1807
- ]);
1753
+ const stack = [];
1808
1754
 
1809
- /**
1810
- * Parse headers into an object
1811
- *
1812
- * ```
1813
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
1814
- * Content-Type: application/json
1815
- * Connection: keep-alive
1816
- * Transfer-Encoding: chunked
1817
- * ```
1818
- *
1819
- * @param {String} rawHeaders Headers needing to be parsed
1820
- *
1821
- * @returns {Object} Headers parsed into an object
1822
- */
1823
- var parseHeaders = (rawHeaders) => {
1824
- const parsed = {};
1825
- let key;
1826
- let val;
1827
- let i;
1755
+ const exposedHelpers = Object.assign(predicates, {
1756
+ defaultVisitor,
1757
+ convertValue,
1758
+ isVisitable,
1759
+ });
1828
1760
 
1829
- rawHeaders &&
1830
- rawHeaders.split('\n').forEach(function parser(line) {
1831
- i = line.indexOf(':');
1832
- key = line.substring(0, i).trim().toLowerCase();
1833
- val = line.substring(i + 1).trim();
1761
+ function build(value, path, depth = 0) {
1762
+ if (utils$1.isUndefined(value)) return;
1834
1763
 
1835
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
1836
- return;
1837
- }
1764
+ if (depth > maxDepth) {
1765
+ throw new AxiosError(
1766
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
1767
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
1768
+ );
1769
+ }
1838
1770
 
1839
- if (key === 'set-cookie') {
1840
- if (parsed[key]) {
1841
- parsed[key].push(val);
1842
- } else {
1843
- parsed[key] = [val];
1844
- }
1845
- } else {
1846
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1771
+ if (stack.indexOf(value) !== -1) {
1772
+ throw Error('Circular reference detected in ' + path.join('.'));
1773
+ }
1774
+
1775
+ stack.push(value);
1776
+
1777
+ utils$1.forEach(value, function each(el, key) {
1778
+ const result =
1779
+ !(utils$1.isUndefined(el) || el === null) &&
1780
+ visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1781
+
1782
+ if (result === true) {
1783
+ build(el, path ? path.concat(key) : [key], depth + 1);
1847
1784
  }
1848
1785
  });
1849
1786
 
1850
- return parsed;
1851
- };
1787
+ stack.pop();
1788
+ }
1852
1789
 
1853
- const $internals = Symbol('internals');
1790
+ if (!utils$1.isObject(obj)) {
1791
+ throw new TypeError('data must be an object');
1792
+ }
1854
1793
 
1855
- const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
1794
+ build(obj);
1856
1795
 
1857
- function assertValidHeaderValue(value, header) {
1858
- if (value === false || value == null) {
1859
- return;
1860
- }
1796
+ return formData;
1797
+ }
1798
+
1799
+ /**
1800
+ * It encodes a string by replacing all characters that are not in the unreserved set with
1801
+ * their percent-encoded equivalents
1802
+ *
1803
+ * @param {string} str - The string to encode.
1804
+ *
1805
+ * @returns {string} The encoded string.
1806
+ */
1807
+ function encode$1(str) {
1808
+ const charMap = {
1809
+ '!': '%21',
1810
+ "'": '%27',
1811
+ '(': '%28',
1812
+ ')': '%29',
1813
+ '~': '%7E',
1814
+ '%20': '+',
1815
+ };
1816
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
1817
+ return charMap[match];
1818
+ });
1819
+ }
1820
+
1821
+ /**
1822
+ * It takes a params object and converts it to a FormData object
1823
+ *
1824
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1825
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1826
+ *
1827
+ * @returns {void}
1828
+ */
1829
+ function AxiosURLSearchParams(params, options) {
1830
+ this._pairs = [];
1831
+
1832
+ params && toFormData(params, this, options);
1833
+ }
1834
+
1835
+ const prototype = AxiosURLSearchParams.prototype;
1836
+
1837
+ prototype.append = function append(name, value) {
1838
+ this._pairs.push([name, value]);
1839
+ };
1861
1840
 
1862
- if (utils$1.isArray(value)) {
1863
- value.forEach((v) => assertValidHeaderValue(v, header));
1864
- return;
1865
- }
1841
+ prototype.toString = function toString(encoder) {
1842
+ const _encode = encoder
1843
+ ? function (value) {
1844
+ return encoder.call(this, value, encode$1);
1845
+ }
1846
+ : encode$1;
1866
1847
 
1867
- if (!isValidHeaderValue(String(value))) {
1868
- throw new Error(`Invalid character in header content ["${header}"]`);
1869
- }
1870
- }
1848
+ return this._pairs
1849
+ .map(function each(pair) {
1850
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
1851
+ }, '')
1852
+ .join('&');
1853
+ };
1871
1854
 
1872
- function normalizeHeader(header) {
1873
- return header && String(header).trim().toLowerCase();
1855
+ /**
1856
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
1857
+ * their plain counterparts (`:`, `$`, `,`, `+`).
1858
+ *
1859
+ * @param {string} val The value to be encoded.
1860
+ *
1861
+ * @returns {string} The encoded value.
1862
+ */
1863
+ function encode(val) {
1864
+ return encodeURIComponent(val)
1865
+ .replace(/%3A/gi, ':')
1866
+ .replace(/%24/g, '$')
1867
+ .replace(/%2C/gi, ',')
1868
+ .replace(/%20/g, '+');
1874
1869
  }
1875
1870
 
1876
- function stripTrailingCRLF(str) {
1877
- let end = str.length;
1871
+ /**
1872
+ * Build a URL by appending params to the end
1873
+ *
1874
+ * @param {string} url The base of the url (e.g., http://www.google.com)
1875
+ * @param {object} [params] The params to be appended
1876
+ * @param {?(object|Function)} options
1877
+ *
1878
+ * @returns {string} The formatted url
1879
+ */
1880
+ function buildURL(url, params, options) {
1881
+ if (!params) {
1882
+ return url;
1883
+ }
1878
1884
 
1879
- while (end > 0) {
1880
- const charCode = str.charCodeAt(end - 1);
1885
+ const _encode = (options && options.encode) || encode;
1881
1886
 
1882
- if (charCode !== 10 && charCode !== 13) {
1883
- break;
1884
- }
1887
+ const _options = utils$1.isFunction(options)
1888
+ ? {
1889
+ serialize: options,
1890
+ }
1891
+ : options;
1885
1892
 
1886
- end -= 1;
1887
- }
1893
+ const serializeFn = _options && _options.serialize;
1888
1894
 
1889
- return end === str.length ? str : str.slice(0, end);
1890
- }
1895
+ let serializedParams;
1891
1896
 
1892
- function normalizeValue(value) {
1893
- if (value === false || value == null) {
1894
- return value;
1897
+ if (serializeFn) {
1898
+ serializedParams = serializeFn(params, _options);
1899
+ } else {
1900
+ serializedParams = utils$1.isURLSearchParams(params)
1901
+ ? params.toString()
1902
+ : new AxiosURLSearchParams(params, _options).toString(_encode);
1895
1903
  }
1896
1904
 
1897
- return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
1898
- }
1899
-
1900
- function parseTokens(str) {
1901
- const tokens = Object.create(null);
1902
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1903
- let match;
1905
+ if (serializedParams) {
1906
+ const hashmarkIndex = url.indexOf('#');
1904
1907
 
1905
- while ((match = tokensRE.exec(str))) {
1906
- tokens[match[1]] = match[2];
1908
+ if (hashmarkIndex !== -1) {
1909
+ url = url.slice(0, hashmarkIndex);
1910
+ }
1911
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1907
1912
  }
1908
1913
 
1909
- return tokens;
1914
+ return url;
1910
1915
  }
1911
1916
 
1912
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1913
-
1914
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1915
- if (utils$1.isFunction(filter)) {
1916
- return filter.call(this, value, header);
1917
+ class InterceptorManager {
1918
+ constructor() {
1919
+ this.handlers = [];
1917
1920
  }
1918
1921
 
1919
- if (isHeaderNameFilter) {
1920
- value = header;
1922
+ /**
1923
+ * Add a new interceptor to the stack
1924
+ *
1925
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
1926
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
1927
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
1928
+ *
1929
+ * @return {Number} An ID used to remove interceptor later
1930
+ */
1931
+ use(fulfilled, rejected, options) {
1932
+ this.handlers.push({
1933
+ fulfilled,
1934
+ rejected,
1935
+ synchronous: options ? options.synchronous : false,
1936
+ runWhen: options ? options.runWhen : null,
1937
+ });
1938
+ return this.handlers.length - 1;
1921
1939
  }
1922
1940
 
1923
- if (!utils$1.isString(value)) return;
1924
-
1925
- if (utils$1.isString(filter)) {
1926
- return value.indexOf(filter) !== -1;
1941
+ /**
1942
+ * Remove an interceptor from the stack
1943
+ *
1944
+ * @param {Number} id The ID that was returned by `use`
1945
+ *
1946
+ * @returns {void}
1947
+ */
1948
+ eject(id) {
1949
+ if (this.handlers[id]) {
1950
+ this.handlers[id] = null;
1951
+ }
1927
1952
  }
1928
1953
 
1929
- if (utils$1.isRegExp(filter)) {
1930
- return filter.test(value);
1954
+ /**
1955
+ * Clear all interceptors from the stack
1956
+ *
1957
+ * @returns {void}
1958
+ */
1959
+ clear() {
1960
+ if (this.handlers) {
1961
+ this.handlers = [];
1962
+ }
1931
1963
  }
1932
- }
1933
1964
 
1934
- function formatHeader(header) {
1935
- return header
1936
- .trim()
1937
- .toLowerCase()
1938
- .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1939
- return char.toUpperCase() + str;
1965
+ /**
1966
+ * Iterate over all the registered interceptors
1967
+ *
1968
+ * This method is particularly useful for skipping over any
1969
+ * interceptors that may have become `null` calling `eject`.
1970
+ *
1971
+ * @param {Function} fn The function to call for each interceptor
1972
+ *
1973
+ * @returns {void}
1974
+ */
1975
+ forEach(fn) {
1976
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
1977
+ if (h !== null) {
1978
+ fn(h);
1979
+ }
1940
1980
  });
1981
+ }
1941
1982
  }
1942
1983
 
1943
- function buildAccessors(obj, header) {
1944
- const accessorName = utils$1.toCamelCase(' ' + header);
1945
-
1946
- ['get', 'set', 'has'].forEach((methodName) => {
1947
- Object.defineProperty(obj, methodName + accessorName, {
1948
- value: function (arg1, arg2, arg3) {
1949
- return this[methodName].call(this, header, arg1, arg2, arg3);
1950
- },
1951
- configurable: true,
1952
- });
1953
- });
1954
- }
1984
+ var transitionalDefaults = {
1985
+ silentJSONParsing: true,
1986
+ forcedJSONParsing: true,
1987
+ clarifyTimeoutError: false,
1988
+ legacyInterceptorReqResOrdering: true,
1989
+ };
1955
1990
 
1956
- class AxiosHeaders {
1957
- constructor(headers) {
1958
- headers && this.set(headers);
1959
- }
1991
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1960
1992
 
1961
- set(header, valueOrRewrite, rewrite) {
1962
- const self = this;
1993
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1963
1994
 
1964
- function setHeader(_value, _header, _rewrite) {
1965
- const lHeader = normalizeHeader(_header);
1995
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1966
1996
 
1967
- if (!lHeader) {
1968
- throw new Error('header name must be a non-empty string');
1969
- }
1997
+ var platform$1 = {
1998
+ isBrowser: true,
1999
+ classes: {
2000
+ URLSearchParams: URLSearchParams$1,
2001
+ FormData: FormData$1,
2002
+ Blob: Blob$1,
2003
+ },
2004
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
2005
+ };
1970
2006
 
1971
- const key = utils$1.findKey(self, lHeader);
2007
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1972
2008
 
1973
- if (
1974
- !key ||
1975
- self[key] === undefined ||
1976
- _rewrite === true ||
1977
- (_rewrite === undefined && self[key] !== false)
1978
- ) {
1979
- assertValidHeaderValue(_value, _header);
1980
- self[key || _header] = normalizeValue(_value);
1981
- }
1982
- }
2009
+ const _navigator = (typeof navigator === 'object' && navigator) || undefined;
1983
2010
 
1984
- const setHeaders = (headers, _rewrite) =>
1985
- utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
2011
+ /**
2012
+ * Determine if we're running in a standard browser environment
2013
+ *
2014
+ * This allows axios to run in a web worker, and react-native.
2015
+ * Both environments support XMLHttpRequest, but not fully standard globals.
2016
+ *
2017
+ * web workers:
2018
+ * typeof window -> undefined
2019
+ * typeof document -> undefined
2020
+ *
2021
+ * react-native:
2022
+ * navigator.product -> 'ReactNative'
2023
+ * nativescript
2024
+ * navigator.product -> 'NativeScript' or 'NS'
2025
+ *
2026
+ * @returns {boolean}
2027
+ */
2028
+ const hasStandardBrowserEnv =
2029
+ hasBrowserEnv &&
2030
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
1986
2031
 
1987
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1988
- setHeaders(header, valueOrRewrite);
1989
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1990
- setHeaders(parseHeaders(header), valueOrRewrite);
1991
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1992
- let obj = {},
1993
- dest,
1994
- key;
1995
- for (const entry of header) {
1996
- if (!utils$1.isArray(entry)) {
1997
- throw TypeError('Object iterator must return a key-value pair');
1998
- }
2032
+ /**
2033
+ * Determine if we're running in a standard browser webWorker environment
2034
+ *
2035
+ * Although the `isStandardBrowserEnv` method indicates that
2036
+ * `allows axios to run in a web worker`, the WebWorker will still be
2037
+ * filtered out due to its judgment standard
2038
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
2039
+ * This leads to a problem when axios post `FormData` in webWorker
2040
+ */
2041
+ const hasStandardBrowserWebWorkerEnv = (() => {
2042
+ return (
2043
+ typeof WorkerGlobalScope !== 'undefined' &&
2044
+ // eslint-disable-next-line no-undef
2045
+ self instanceof WorkerGlobalScope &&
2046
+ typeof self.importScripts === 'function'
2047
+ );
2048
+ })();
1999
2049
 
2000
- obj[(key = entry[0])] = (dest = obj[key])
2001
- ? utils$1.isArray(dest)
2002
- ? [...dest, entry[1]]
2003
- : [dest, entry[1]]
2004
- : entry[1];
2005
- }
2050
+ const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
2006
2051
 
2007
- setHeaders(obj, valueOrRewrite);
2008
- } else {
2009
- header != null && setHeader(valueOrRewrite, header, rewrite);
2010
- }
2052
+ var utils = /*#__PURE__*/Object.freeze({
2053
+ __proto__: null,
2054
+ hasBrowserEnv: hasBrowserEnv,
2055
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
2056
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
2057
+ navigator: _navigator,
2058
+ origin: origin
2059
+ });
2011
2060
 
2012
- return this;
2013
- }
2061
+ var platform = {
2062
+ ...utils,
2063
+ ...platform$1,
2064
+ };
2014
2065
 
2015
- get(header, parser) {
2016
- header = normalizeHeader(header);
2066
+ function toURLEncodedForm(data, options) {
2067
+ return toFormData(data, new platform.classes.URLSearchParams(), {
2068
+ visitor: function (value, key, path, helpers) {
2069
+ if (platform.isNode && utils$1.isBuffer(value)) {
2070
+ this.append(key, value.toString('base64'));
2071
+ return false;
2072
+ }
2017
2073
 
2018
- if (header) {
2019
- const key = utils$1.findKey(this, header);
2074
+ return helpers.defaultVisitor.apply(this, arguments);
2075
+ },
2076
+ ...options,
2077
+ });
2078
+ }
2020
2079
 
2021
- if (key) {
2022
- const value = this[key];
2080
+ /**
2081
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2082
+ *
2083
+ * @param {string} name - The name of the property to get.
2084
+ *
2085
+ * @returns An array of strings.
2086
+ */
2087
+ function parsePropPath(name) {
2088
+ // foo[x][y][z]
2089
+ // foo.x.y.z
2090
+ // foo-x-y-z
2091
+ // foo x y z
2092
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
2093
+ return match[0] === '[]' ? '' : match[1] || match[0];
2094
+ });
2095
+ }
2023
2096
 
2024
- if (!parser) {
2025
- return value;
2026
- }
2097
+ /**
2098
+ * Convert an array to an object.
2099
+ *
2100
+ * @param {Array<any>} arr - The array to convert to an object.
2101
+ *
2102
+ * @returns An object with the same keys and values as the array.
2103
+ */
2104
+ function arrayToObject(arr) {
2105
+ const obj = {};
2106
+ const keys = Object.keys(arr);
2107
+ let i;
2108
+ const len = keys.length;
2109
+ let key;
2110
+ for (i = 0; i < len; i++) {
2111
+ key = keys[i];
2112
+ obj[key] = arr[key];
2113
+ }
2114
+ return obj;
2115
+ }
2027
2116
 
2028
- if (parser === true) {
2029
- return parseTokens(value);
2030
- }
2117
+ /**
2118
+ * It takes a FormData object and returns a JavaScript object
2119
+ *
2120
+ * @param {string} formData The FormData object to convert to JSON.
2121
+ *
2122
+ * @returns {Object<string, any> | null} The converted object.
2123
+ */
2124
+ function formDataToJSON(formData) {
2125
+ function buildPath(path, value, target, index) {
2126
+ let name = path[index++];
2031
2127
 
2032
- if (utils$1.isFunction(parser)) {
2033
- return parser.call(this, value, key);
2034
- }
2128
+ if (name === '__proto__') return true;
2035
2129
 
2036
- if (utils$1.isRegExp(parser)) {
2037
- return parser.exec(value);
2038
- }
2130
+ const isNumericKey = Number.isFinite(+name);
2131
+ const isLast = index >= path.length;
2132
+ name = !name && utils$1.isArray(target) ? target.length : name;
2039
2133
 
2040
- throw new TypeError('parser must be boolean|regexp|function');
2134
+ if (isLast) {
2135
+ if (utils$1.hasOwnProp(target, name)) {
2136
+ target[name] = utils$1.isArray(target[name])
2137
+ ? target[name].concat(value)
2138
+ : [target[name], value];
2139
+ } else {
2140
+ target[name] = value;
2041
2141
  }
2142
+
2143
+ return !isNumericKey;
2042
2144
  }
2043
- }
2044
2145
 
2045
- has(header, matcher) {
2046
- header = normalizeHeader(header);
2146
+ if (!target[name] || !utils$1.isObject(target[name])) {
2147
+ target[name] = [];
2148
+ }
2047
2149
 
2048
- if (header) {
2049
- const key = utils$1.findKey(this, header);
2150
+ const result = buildPath(path, value, target[name], index);
2050
2151
 
2051
- return !!(
2052
- key &&
2053
- this[key] !== undefined &&
2054
- (!matcher || matchHeaderValue(this, this[key], key, matcher))
2055
- );
2152
+ if (result && utils$1.isArray(target[name])) {
2153
+ target[name] = arrayToObject(target[name]);
2056
2154
  }
2057
2155
 
2058
- return false;
2156
+ return !isNumericKey;
2059
2157
  }
2060
2158
 
2061
- delete(header, matcher) {
2062
- const self = this;
2063
- let deleted = false;
2064
-
2065
- function deleteHeader(_header) {
2066
- _header = normalizeHeader(_header);
2067
-
2068
- if (_header) {
2069
- const key = utils$1.findKey(self, _header);
2070
-
2071
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
2072
- delete self[key];
2073
-
2074
- deleted = true;
2075
- }
2076
- }
2077
- }
2159
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
2160
+ const obj = {};
2078
2161
 
2079
- if (utils$1.isArray(header)) {
2080
- header.forEach(deleteHeader);
2081
- } else {
2082
- deleteHeader(header);
2083
- }
2162
+ utils$1.forEachEntry(formData, (name, value) => {
2163
+ buildPath(parsePropPath(name), value, obj, 0);
2164
+ });
2084
2165
 
2085
- return deleted;
2166
+ return obj;
2086
2167
  }
2087
2168
 
2088
- clear(matcher) {
2089
- const keys = Object.keys(this);
2090
- let i = keys.length;
2091
- let deleted = false;
2169
+ return null;
2170
+ }
2092
2171
 
2093
- while (i--) {
2094
- const key = keys[i];
2095
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2096
- delete this[key];
2097
- deleted = true;
2172
+ const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
2173
+
2174
+ /**
2175
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2176
+ * of the input
2177
+ *
2178
+ * @param {any} rawValue - The value to be stringified.
2179
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
2180
+ * @param {Function} encoder - A function that takes a value and returns a string.
2181
+ *
2182
+ * @returns {string} A stringified version of the rawValue.
2183
+ */
2184
+ function stringifySafely(rawValue, parser, encoder) {
2185
+ if (utils$1.isString(rawValue)) {
2186
+ try {
2187
+ (parser || JSON.parse)(rawValue);
2188
+ return utils$1.trim(rawValue);
2189
+ } catch (e) {
2190
+ if (e.name !== 'SyntaxError') {
2191
+ throw e;
2098
2192
  }
2099
2193
  }
2100
-
2101
- return deleted;
2102
2194
  }
2103
2195
 
2104
- normalize(format) {
2105
- const self = this;
2106
- const headers = {};
2196
+ return (encoder || JSON.stringify)(rawValue);
2197
+ }
2107
2198
 
2108
- utils$1.forEach(this, (value, header) => {
2109
- const key = utils$1.findKey(headers, header);
2199
+ const defaults = {
2200
+ transitional: transitionalDefaults,
2110
2201
 
2111
- if (key) {
2112
- self[key] = normalizeValue(value);
2113
- delete self[header];
2114
- return;
2115
- }
2202
+ adapter: ['xhr', 'http', 'fetch'],
2116
2203
 
2117
- const normalized = format ? formatHeader(header) : String(header).trim();
2204
+ transformRequest: [
2205
+ function transformRequest(data, headers) {
2206
+ const contentType = headers.getContentType() || '';
2207
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
2208
+ const isObjectPayload = utils$1.isObject(data);
2118
2209
 
2119
- if (normalized !== header) {
2120
- delete self[header];
2210
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
2211
+ data = new FormData(data);
2121
2212
  }
2122
2213
 
2123
- self[normalized] = normalizeValue(value);
2124
-
2125
- headers[normalized] = true;
2126
- });
2127
-
2128
- return this;
2129
- }
2130
-
2131
- concat(...targets) {
2132
- return this.constructor.concat(this, ...targets);
2133
- }
2214
+ const isFormData = utils$1.isFormData(data);
2134
2215
 
2135
- toJSON(asStrings) {
2136
- const obj = Object.create(null);
2216
+ if (isFormData) {
2217
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2218
+ }
2137
2219
 
2138
- utils$1.forEach(this, (value, header) => {
2139
- value != null &&
2140
- value !== false &&
2141
- (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
2142
- });
2220
+ if (
2221
+ utils$1.isArrayBuffer(data) ||
2222
+ utils$1.isBuffer(data) ||
2223
+ utils$1.isStream(data) ||
2224
+ utils$1.isFile(data) ||
2225
+ utils$1.isBlob(data) ||
2226
+ utils$1.isReadableStream(data)
2227
+ ) {
2228
+ return data;
2229
+ }
2230
+ if (utils$1.isArrayBufferView(data)) {
2231
+ return data.buffer;
2232
+ }
2233
+ if (utils$1.isURLSearchParams(data)) {
2234
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2235
+ return data.toString();
2236
+ }
2143
2237
 
2144
- return obj;
2145
- }
2238
+ let isFileList;
2146
2239
 
2147
- [Symbol.iterator]() {
2148
- return Object.entries(this.toJSON())[Symbol.iterator]();
2149
- }
2240
+ if (isObjectPayload) {
2241
+ const formSerializer = own(this, 'formSerializer');
2242
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2243
+ return toURLEncodedForm(data, formSerializer).toString();
2244
+ }
2150
2245
 
2151
- toString() {
2152
- return Object.entries(this.toJSON())
2153
- .map(([header, value]) => header + ': ' + value)
2154
- .join('\n');
2155
- }
2246
+ if (
2247
+ (isFileList = utils$1.isFileList(data)) ||
2248
+ contentType.indexOf('multipart/form-data') > -1
2249
+ ) {
2250
+ const env = own(this, 'env');
2251
+ const _FormData = env && env.FormData;
2156
2252
 
2157
- getSetCookie() {
2158
- return this.get('set-cookie') || [];
2159
- }
2253
+ return toFormData(
2254
+ isFileList ? { 'files[]': data } : data,
2255
+ _FormData && new _FormData(),
2256
+ formSerializer
2257
+ );
2258
+ }
2259
+ }
2160
2260
 
2161
- get [Symbol.toStringTag]() {
2162
- return 'AxiosHeaders';
2163
- }
2261
+ if (isObjectPayload || hasJSONContentType) {
2262
+ headers.setContentType('application/json', false);
2263
+ return stringifySafely(data);
2264
+ }
2164
2265
 
2165
- static from(thing) {
2166
- return thing instanceof this ? thing : new this(thing);
2167
- }
2266
+ return data;
2267
+ },
2268
+ ],
2168
2269
 
2169
- static concat(first, ...targets) {
2170
- const computed = new this(first);
2270
+ transformResponse: [
2271
+ function transformResponse(data) {
2272
+ const transitional = own(this, 'transitional') || defaults.transitional;
2273
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2274
+ const responseType = own(this, 'responseType');
2275
+ const JSONRequested = responseType === 'json';
2171
2276
 
2172
- targets.forEach((target) => computed.set(target));
2277
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
2278
+ return data;
2279
+ }
2173
2280
 
2174
- return computed;
2175
- }
2281
+ if (
2282
+ data &&
2283
+ utils$1.isString(data) &&
2284
+ ((forcedJSONParsing && !responseType) || JSONRequested)
2285
+ ) {
2286
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
2287
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
2176
2288
 
2177
- static accessor(header) {
2178
- const internals =
2179
- (this[$internals] =
2180
- this[$internals] =
2181
- {
2182
- accessors: {},
2183
- });
2289
+ try {
2290
+ return JSON.parse(data, own(this, 'parseReviver'));
2291
+ } catch (e) {
2292
+ if (strictJSONParsing) {
2293
+ if (e.name === 'SyntaxError') {
2294
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
2295
+ }
2296
+ throw e;
2297
+ }
2298
+ }
2299
+ }
2184
2300
 
2185
- const accessors = internals.accessors;
2186
- const prototype = this.prototype;
2301
+ return data;
2302
+ },
2303
+ ],
2187
2304
 
2188
- function defineAccessor(_header) {
2189
- const lHeader = normalizeHeader(_header);
2305
+ /**
2306
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
2307
+ * timeout is not created.
2308
+ */
2309
+ timeout: 0,
2190
2310
 
2191
- if (!accessors[lHeader]) {
2192
- buildAccessors(prototype, _header);
2193
- accessors[lHeader] = true;
2194
- }
2195
- }
2311
+ xsrfCookieName: 'XSRF-TOKEN',
2312
+ xsrfHeaderName: 'X-XSRF-TOKEN',
2196
2313
 
2197
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
2314
+ maxContentLength: -1,
2315
+ maxBodyLength: -1,
2198
2316
 
2199
- return this;
2200
- }
2201
- }
2317
+ env: {
2318
+ FormData: platform.classes.FormData,
2319
+ Blob: platform.classes.Blob,
2320
+ },
2202
2321
 
2203
- AxiosHeaders.accessor([
2204
- 'Content-Type',
2205
- 'Content-Length',
2206
- 'Accept',
2207
- 'Accept-Encoding',
2208
- 'User-Agent',
2209
- 'Authorization',
2210
- ]);
2322
+ validateStatus: function validateStatus(status) {
2323
+ return status >= 200 && status < 300;
2324
+ },
2211
2325
 
2212
- // reserved names hotfix
2213
- utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
2214
- let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
2215
- return {
2216
- get: () => value,
2217
- set(headerValue) {
2218
- this[mapped] = headerValue;
2326
+ headers: {
2327
+ common: {
2328
+ Accept: 'application/json, text/plain, */*',
2329
+ 'Content-Type': undefined,
2219
2330
  },
2220
- };
2221
- });
2331
+ },
2332
+ };
2222
2333
 
2223
- utils$1.freezeMethods(AxiosHeaders);
2334
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
2335
+ defaults.headers[method] = {};
2336
+ });
2224
2337
 
2225
2338
  /**
2226
2339
  * Transform the data for a request or a response
@@ -2280,22 +2393,18 @@ function settle(resolve, reject, response) {
2280
2393
  if (!response.status || !validateStatus || validateStatus(response.status)) {
2281
2394
  resolve(response);
2282
2395
  } else {
2283
- reject(
2284
- new AxiosError(
2285
- 'Request failed with status code ' + response.status,
2286
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][
2287
- Math.floor(response.status / 100) - 4
2288
- ],
2289
- response.config,
2290
- response.request,
2291
- response
2292
- )
2293
- );
2396
+ reject(new AxiosError(
2397
+ 'Request failed with status code ' + response.status,
2398
+ response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,
2399
+ response.config,
2400
+ response.request,
2401
+ response
2402
+ ));
2294
2403
  }
2295
2404
  }
2296
2405
 
2297
2406
  function parseProtocol(url) {
2298
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2407
+ const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
2299
2408
  return (match && match[1]) || '';
2300
2409
  }
2301
2410
 
@@ -2399,13 +2508,13 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2399
2508
  const _speedometer = speedometer(50, 250);
2400
2509
 
2401
2510
  return throttle((e) => {
2402
- const loaded = e.loaded;
2511
+ const rawLoaded = e.loaded;
2403
2512
  const total = e.lengthComputable ? e.total : undefined;
2404
- const progressBytes = loaded - bytesNotified;
2513
+ const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
2514
+ const progressBytes = Math.max(0, loaded - bytesNotified);
2405
2515
  const rate = _speedometer(progressBytes);
2406
- const inRange = loaded <= total;
2407
2516
 
2408
- bytesNotified = loaded;
2517
+ bytesNotified = Math.max(bytesNotified, loaded);
2409
2518
 
2410
2519
  const data = {
2411
2520
  loaded,
@@ -2413,7 +2522,7 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2413
2522
  progress: total ? loaded / total : undefined,
2414
2523
  bytes: progressBytes,
2415
2524
  rate: rate ? rate : undefined,
2416
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2525
+ estimated: rate && total ? (total - loaded) / rate : undefined,
2417
2526
  event: e,
2418
2527
  lengthComputable: total != null,
2419
2528
  [isDownloadStream ? 'download' : 'upload']: true,
@@ -2486,8 +2595,20 @@ var cookies = platform.hasStandardBrowserEnv
2486
2595
 
2487
2596
  read(name) {
2488
2597
  if (typeof document === 'undefined') return null;
2489
- const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
2490
- return match ? decodeURIComponent(match[1]) : null;
2598
+ // Match name=value by splitting on the semicolon separator instead of building a
2599
+ // RegExp from `name` interpolating an unescaped string into a RegExp would let
2600
+ // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
2601
+ // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
2602
+ // "; ", so ignore optional whitespace before each cookie name.
2603
+ const cookies = document.cookie.split(';');
2604
+ for (let i = 0; i < cookies.length; i++) {
2605
+ const cookie = cookies[i].replace(/^\s+/, '');
2606
+ const eq = cookie.indexOf('=');
2607
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
2608
+ return decodeURIComponent(cookie.slice(eq + 1));
2609
+ }
2610
+ }
2611
+ return null;
2491
2612
  },
2492
2613
 
2493
2614
  remove(name) {
@@ -2547,7 +2668,7 @@ function combineURLs(baseURL, relativeURL) {
2547
2668
  */
2548
2669
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2549
2670
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
2550
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
2671
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
2551
2672
  return combineURLs(baseURL, requestedURL);
2552
2673
  }
2553
2674
  return requestedURL;
@@ -2567,7 +2688,21 @@ const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing }
2567
2688
  function mergeConfig(config1, config2) {
2568
2689
  // eslint-disable-next-line no-param-reassign
2569
2690
  config2 = config2 || {};
2570
- const config = {};
2691
+
2692
+ // Use a null-prototype object so that downstream reads such as `config.auth`
2693
+ // or `config.baseURL` cannot inherit polluted values from Object.prototype.
2694
+ // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
2695
+ // ergonomics for user code that relies on it.
2696
+ const config = Object.create(null);
2697
+ Object.defineProperty(config, 'hasOwnProperty', {
2698
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
2699
+ // this data descriptor into an accessor descriptor on the way in.
2700
+ __proto__: null,
2701
+ value: Object.prototype.hasOwnProperty,
2702
+ enumerable: false,
2703
+ writable: true,
2704
+ configurable: true,
2705
+ });
2571
2706
 
2572
2707
  function getMergedValue(target, source, prop, caseless) {
2573
2708
  if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
@@ -2606,9 +2741,9 @@ function mergeConfig(config1, config2) {
2606
2741
 
2607
2742
  // eslint-disable-next-line consistent-return
2608
2743
  function mergeDirectKeys(a, b, prop) {
2609
- if (prop in config2) {
2744
+ if (utils$1.hasOwnProp(config2, prop)) {
2610
2745
  return getMergedValue(a, b);
2611
- } else if (prop in config1) {
2746
+ } else if (utils$1.hasOwnProp(config1, prop)) {
2612
2747
  return getMergedValue(undefined, a);
2613
2748
  }
2614
2749
  }
@@ -2640,6 +2775,7 @@ function mergeConfig(config1, config2) {
2640
2775
  httpsAgent: defaultToConfig2,
2641
2776
  cancelToken: defaultToConfig2,
2642
2777
  socketPath: defaultToConfig2,
2778
+ allowedSocketPaths: defaultToConfig2,
2643
2779
  responseEncoding: defaultToConfig2,
2644
2780
  validateStatus: mergeDirectKeys,
2645
2781
  headers: (a, b, prop) =>
@@ -2649,22 +2785,64 @@ function mergeConfig(config1, config2) {
2649
2785
  utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
2650
2786
  if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
2651
2787
  const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2652
- const configValue = merge(config1[prop], config2[prop], prop);
2788
+ const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
2789
+ const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
2790
+ const configValue = merge(a, b, prop);
2653
2791
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2654
2792
  });
2655
2793
 
2656
2794
  return config;
2657
2795
  }
2658
2796
 
2797
+ const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
2798
+
2799
+ function setFormDataHeaders(headers, formHeaders, policy) {
2800
+ if (policy !== 'content-only') {
2801
+ headers.set(formHeaders);
2802
+ return;
2803
+ }
2804
+
2805
+ Object.entries(formHeaders).forEach(([key, val]) => {
2806
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
2807
+ headers.set(key, val);
2808
+ }
2809
+ });
2810
+ }
2811
+
2812
+ /**
2813
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
2814
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
2815
+ *
2816
+ * @param {string} str The string to encode
2817
+ *
2818
+ * @returns {string} UTF-8 bytes as a Latin-1 string
2819
+ */
2820
+ const encodeUTF8 = (str) =>
2821
+ encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
2822
+ String.fromCharCode(parseInt(hex, 16))
2823
+ );
2824
+
2659
2825
  var resolveConfig = (config) => {
2660
2826
  const newConfig = mergeConfig({}, config);
2661
2827
 
2662
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
2828
+ // Read only own properties to prevent prototype pollution gadgets
2829
+ // (e.g. Object.prototype.baseURL = 'https://evil.com').
2830
+ const own = (key) => (utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
2831
+
2832
+ const data = own('data');
2833
+ let withXSRFToken = own('withXSRFToken');
2834
+ const xsrfHeaderName = own('xsrfHeaderName');
2835
+ const xsrfCookieName = own('xsrfCookieName');
2836
+ let headers = own('headers');
2837
+ const auth = own('auth');
2838
+ const baseURL = own('baseURL');
2839
+ const allowAbsoluteUrls = own('allowAbsoluteUrls');
2840
+ const url = own('url');
2663
2841
 
2664
2842
  newConfig.headers = headers = AxiosHeaders.from(headers);
2665
2843
 
2666
2844
  newConfig.url = buildURL(
2667
- buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
2845
+ buildFullPath(baseURL, url, allowAbsoluteUrls),
2668
2846
  config.params,
2669
2847
  config.paramsSerializer
2670
2848
  );
@@ -2674,11 +2852,7 @@ var resolveConfig = (config) => {
2674
2852
  headers.set(
2675
2853
  'Authorization',
2676
2854
  'Basic ' +
2677
- btoa(
2678
- (auth.username || '') +
2679
- ':' +
2680
- (auth.password ? unescape(encodeURIComponent(auth.password)) : '')
2681
- )
2855
+ btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
2682
2856
  );
2683
2857
  }
2684
2858
 
@@ -2687,14 +2861,7 @@ var resolveConfig = (config) => {
2687
2861
  headers.setContentType(undefined); // browser handles it
2688
2862
  } else if (utils$1.isFunction(data.getHeaders)) {
2689
2863
  // Node.js FormData (like form-data package)
2690
- const formHeaders = data.getHeaders();
2691
- // Only set safe headers to avoid overwriting security headers
2692
- const allowedHeaders = ['content-type', 'content-length'];
2693
- Object.entries(formHeaders).forEach(([key, val]) => {
2694
- if (allowedHeaders.includes(key.toLowerCase())) {
2695
- headers.set(key, val);
2696
- }
2697
- });
2864
+ setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
2698
2865
  }
2699
2866
  }
2700
2867
 
@@ -2703,10 +2870,17 @@ var resolveConfig = (config) => {
2703
2870
  // Specifically not if we're in a web worker, or react-native.
2704
2871
 
2705
2872
  if (platform.hasStandardBrowserEnv) {
2706
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2873
+ if (utils$1.isFunction(withXSRFToken)) {
2874
+ withXSRFToken = withXSRFToken(newConfig);
2875
+ }
2876
+
2877
+ // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
2878
+ // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
2879
+ // the XSRF token cross-origin.
2880
+ const shouldSendXSRF =
2881
+ withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
2707
2882
 
2708
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
2709
- // Add xsrf header
2883
+ if (shouldSendXSRF) {
2710
2884
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2711
2885
 
2712
2886
  if (xsrfValue) {
@@ -2800,7 +2974,7 @@ var xhrAdapter = isXHRAdapterSupported &&
2800
2974
  // will return status as 0 even though it's a successful request
2801
2975
  if (
2802
2976
  request.status === 0 &&
2803
- !(request.responseURL && request.responseURL.indexOf('file:') === 0)
2977
+ !(request.responseURL && request.responseURL.startsWith('file:'))
2804
2978
  ) {
2805
2979
  return;
2806
2980
  }
@@ -2817,6 +2991,7 @@ var xhrAdapter = isXHRAdapterSupported &&
2817
2991
  }
2818
2992
 
2819
2993
  reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
2994
+ done();
2820
2995
 
2821
2996
  // Clean up request
2822
2997
  request = null;
@@ -2832,6 +3007,7 @@ var xhrAdapter = isXHRAdapterSupported &&
2832
3007
  // attach the underlying event for consumers who want details
2833
3008
  err.event = event || null;
2834
3009
  reject(err);
3010
+ done();
2835
3011
  request = null;
2836
3012
  };
2837
3013
 
@@ -2852,6 +3028,7 @@ var xhrAdapter = isXHRAdapterSupported &&
2852
3028
  request
2853
3029
  )
2854
3030
  );
3031
+ done();
2855
3032
 
2856
3033
  // Clean up request
2857
3034
  request = null;
@@ -2901,6 +3078,7 @@ var xhrAdapter = isXHRAdapterSupported &&
2901
3078
  }
2902
3079
  reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
2903
3080
  request.abort();
3081
+ done();
2904
3082
  request = null;
2905
3083
  };
2906
3084
 
@@ -2914,7 +3092,7 @@ var xhrAdapter = isXHRAdapterSupported &&
2914
3092
 
2915
3093
  const protocol = parseProtocol(_config.url);
2916
3094
 
2917
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
3095
+ if (protocol && !platform.protocols.includes(protocol)) {
2918
3096
  reject(
2919
3097
  new AxiosError(
2920
3098
  'Unsupported protocol ' + protocol + ':',
@@ -3071,16 +3249,112 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3071
3249
  );
3072
3250
  };
3073
3251
 
3074
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
3252
+ /**
3253
+ * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
3254
+ * - For base64: compute exact decoded size using length and padding;
3255
+ * handle %XX at the character-count level (no string allocation).
3256
+ * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
3257
+ *
3258
+ * @param {string} url
3259
+ * @returns {number}
3260
+ */
3261
+ function estimateDataURLDecodedBytes(url) {
3262
+ if (!url || typeof url !== 'string') return 0;
3263
+ if (!url.startsWith('data:')) return 0;
3264
+
3265
+ const comma = url.indexOf(',');
3266
+ if (comma < 0) return 0;
3267
+
3268
+ const meta = url.slice(5, comma);
3269
+ const body = url.slice(comma + 1);
3270
+ const isBase64 = /;base64/i.test(meta);
3271
+
3272
+ if (isBase64) {
3273
+ let effectiveLen = body.length;
3274
+ const len = body.length; // cache length
3275
+
3276
+ for (let i = 0; i < len; i++) {
3277
+ if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
3278
+ const a = body.charCodeAt(i + 1);
3279
+ const b = body.charCodeAt(i + 2);
3280
+ const isHex =
3281
+ ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
3282
+ ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
3283
+
3284
+ if (isHex) {
3285
+ effectiveLen -= 2;
3286
+ i += 2;
3287
+ }
3288
+ }
3289
+ }
3075
3290
 
3076
- const { isFunction } = utils$1;
3291
+ let pad = 0;
3292
+ let idx = len - 1;
3293
+
3294
+ const tailIsPct3D = (j) =>
3295
+ j >= 2 &&
3296
+ body.charCodeAt(j - 2) === 37 && // '%'
3297
+ body.charCodeAt(j - 1) === 51 && // '3'
3298
+ (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
3299
+
3300
+ if (idx >= 0) {
3301
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
3302
+ pad++;
3303
+ idx--;
3304
+ } else if (tailIsPct3D(idx)) {
3305
+ pad++;
3306
+ idx -= 3;
3307
+ }
3308
+ }
3309
+
3310
+ if (pad === 1 && idx >= 0) {
3311
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
3312
+ pad++;
3313
+ } else if (tailIsPct3D(idx)) {
3314
+ pad++;
3315
+ }
3316
+ }
3317
+
3318
+ const groups = Math.floor(effectiveLen / 4);
3319
+ const bytes = groups * 3 - (pad || 0);
3320
+ return bytes > 0 ? bytes : 0;
3321
+ }
3322
+
3323
+ if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
3324
+ return Buffer.byteLength(body, 'utf8');
3325
+ }
3326
+
3327
+ // Compute UTF-8 byte length directly from UTF-16 code units without allocating
3328
+ // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
3329
+ // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
3330
+ // but 3 UTF-8 bytes).
3331
+ let bytes = 0;
3332
+ for (let i = 0, len = body.length; i < len; i++) {
3333
+ const c = body.charCodeAt(i);
3334
+ if (c < 0x80) {
3335
+ bytes += 1;
3336
+ } else if (c < 0x800) {
3337
+ bytes += 2;
3338
+ } else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
3339
+ const next = body.charCodeAt(i + 1);
3340
+ if (next >= 0xdc00 && next <= 0xdfff) {
3341
+ bytes += 4;
3342
+ i++;
3343
+ } else {
3344
+ bytes += 3;
3345
+ }
3346
+ } else {
3347
+ bytes += 3;
3348
+ }
3349
+ }
3350
+ return bytes;
3351
+ }
3352
+
3353
+ const VERSION = "1.16.0";
3077
3354
 
3078
- const globalFetchAPI = (({ Request, Response }) => ({
3079
- Request,
3080
- Response,
3081
- }))(utils$1.global);
3355
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
3082
3356
 
3083
- const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
3357
+ const { isFunction } = utils$1;
3084
3358
 
3085
3359
  const test = (fn, ...args) => {
3086
3360
  try {
@@ -3091,11 +3365,17 @@ const test = (fn, ...args) => {
3091
3365
  };
3092
3366
 
3093
3367
  const factory = (env) => {
3368
+ const globalObject = utils$1.global ?? globalThis;
3369
+ const { ReadableStream, TextEncoder } = globalObject;
3370
+
3094
3371
  env = utils$1.merge.call(
3095
3372
  {
3096
3373
  skipUndefined: true,
3097
3374
  },
3098
- globalFetchAPI,
3375
+ {
3376
+ Request: globalObject.Request,
3377
+ Response: globalObject.Response,
3378
+ },
3099
3379
  env
3100
3380
  );
3101
3381
 
@@ -3108,7 +3388,7 @@ const factory = (env) => {
3108
3388
  return false;
3109
3389
  }
3110
3390
 
3111
- const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
3391
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
3112
3392
 
3113
3393
  const encodeText =
3114
3394
  isFetchSupported &&
@@ -3125,18 +3405,20 @@ const factory = (env) => {
3125
3405
  test(() => {
3126
3406
  let duplexAccessed = false;
3127
3407
 
3128
- const body = new ReadableStream$1();
3129
-
3130
- const hasContentType = new Request(platform.origin, {
3131
- body,
3408
+ const request = new Request(platform.origin, {
3409
+ body: new ReadableStream(),
3132
3410
  method: 'POST',
3133
3411
  get duplex() {
3134
3412
  duplexAccessed = true;
3135
3413
  return 'half';
3136
3414
  },
3137
- }).headers.has('Content-Type');
3415
+ });
3138
3416
 
3139
- body.cancel();
3417
+ const hasContentType = request.headers.has('Content-Type');
3418
+
3419
+ if (request.body != null) {
3420
+ request.body.cancel();
3421
+ }
3140
3422
 
3141
3423
  return duplexAccessed && !hasContentType;
3142
3424
  });
@@ -3220,8 +3502,13 @@ const factory = (env) => {
3220
3502
  headers,
3221
3503
  withCredentials = 'same-origin',
3222
3504
  fetchOptions,
3505
+ maxContentLength,
3506
+ maxBodyLength,
3223
3507
  } = resolveConfig(config);
3224
3508
 
3509
+ const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
3510
+ const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
3511
+
3225
3512
  let _fetch = envFetch || fetch;
3226
3513
 
3227
3514
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
@@ -3243,6 +3530,41 @@ const factory = (env) => {
3243
3530
  let requestContentLength;
3244
3531
 
3245
3532
  try {
3533
+ // Enforce maxContentLength for data: URLs up-front so we never materialize
3534
+ // an oversized payload. The HTTP adapter applies the same check (see http.js
3535
+ // "if (protocol === 'data:')" branch).
3536
+ if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
3537
+ const estimated = estimateDataURLDecodedBytes(url);
3538
+ if (estimated > maxContentLength) {
3539
+ throw new AxiosError(
3540
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
3541
+ AxiosError.ERR_BAD_RESPONSE,
3542
+ config,
3543
+ request
3544
+ );
3545
+ }
3546
+ }
3547
+
3548
+ // Enforce maxBodyLength against the outbound request body before dispatch.
3549
+ // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
3550
+ // maxBodyLength limit'). Skip when the body length cannot be determined
3551
+ // (e.g. a live ReadableStream supplied by the caller).
3552
+ if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
3553
+ const outboundLength = await resolveBodyLength(headers, data);
3554
+ if (
3555
+ typeof outboundLength === 'number' &&
3556
+ isFinite(outboundLength) &&
3557
+ outboundLength > maxBodyLength
3558
+ ) {
3559
+ throw new AxiosError(
3560
+ 'Request body larger than maxBodyLength limit',
3561
+ AxiosError.ERR_BAD_REQUEST,
3562
+ config,
3563
+ request
3564
+ );
3565
+ }
3566
+ }
3567
+
3246
3568
  if (
3247
3569
  onUploadProgress &&
3248
3570
  supportsRequestStream &&
@@ -3280,6 +3602,22 @@ const factory = (env) => {
3280
3602
  // see https://github.com/cloudflare/workerd/issues/902
3281
3603
  const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
3282
3604
 
3605
+ // If data is FormData and Content-Type is multipart/form-data without boundary,
3606
+ // delete it so fetch can set it correctly with the boundary
3607
+ if (utils$1.isFormData(data)) {
3608
+ const contentType = headers.getContentType();
3609
+ if (
3610
+ contentType &&
3611
+ /^multipart\/form-data/i.test(contentType) &&
3612
+ !/boundary=/i.test(contentType)
3613
+ ) {
3614
+ headers.delete('content-type');
3615
+ }
3616
+ }
3617
+
3618
+ // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
3619
+ headers.set('User-Agent', 'axios/' + VERSION, false);
3620
+
3283
3621
  const resolvedOptions = {
3284
3622
  ...fetchOptions,
3285
3623
  signal: composedSignal,
@@ -3296,10 +3634,28 @@ const factory = (env) => {
3296
3634
  ? _fetch(request, fetchOptions)
3297
3635
  : _fetch(url, resolvedOptions));
3298
3636
 
3637
+ // Cheap pre-check: if the server honestly declares a content-length that
3638
+ // already exceeds the cap, reject before we start streaming.
3639
+ if (hasMaxContentLength) {
3640
+ const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3641
+ if (declaredLength != null && declaredLength > maxContentLength) {
3642
+ throw new AxiosError(
3643
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
3644
+ AxiosError.ERR_BAD_RESPONSE,
3645
+ config,
3646
+ request
3647
+ );
3648
+ }
3649
+ }
3650
+
3299
3651
  const isStreamResponse =
3300
3652
  supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3301
3653
 
3302
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
3654
+ if (
3655
+ supportsResponseStream &&
3656
+ response.body &&
3657
+ (onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))
3658
+ ) {
3303
3659
  const options = {};
3304
3660
 
3305
3661
  ['status', 'statusText', 'headers'].forEach((prop) => {
@@ -3316,8 +3672,24 @@ const factory = (env) => {
3316
3672
  )) ||
3317
3673
  [];
3318
3674
 
3675
+ let bytesRead = 0;
3676
+ const onChunkProgress = (loadedBytes) => {
3677
+ if (hasMaxContentLength) {
3678
+ bytesRead = loadedBytes;
3679
+ if (bytesRead > maxContentLength) {
3680
+ throw new AxiosError(
3681
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
3682
+ AxiosError.ERR_BAD_RESPONSE,
3683
+ config,
3684
+ request
3685
+ );
3686
+ }
3687
+ }
3688
+ onProgress && onProgress(loadedBytes);
3689
+ };
3690
+
3319
3691
  response = new Response(
3320
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
3692
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
3321
3693
  flush && flush();
3322
3694
  unsubscribe && unsubscribe();
3323
3695
  }),
@@ -3332,6 +3704,33 @@ const factory = (env) => {
3332
3704
  config
3333
3705
  );
3334
3706
 
3707
+ // Fallback enforcement for environments without ReadableStream support
3708
+ // (legacy runtimes). Detect materialized size from typed output; skip
3709
+ // streams/Response passthrough since the user will read those themselves.
3710
+ if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
3711
+ let materializedSize;
3712
+ if (responseData != null) {
3713
+ if (typeof responseData.byteLength === 'number') {
3714
+ materializedSize = responseData.byteLength;
3715
+ } else if (typeof responseData.size === 'number') {
3716
+ materializedSize = responseData.size;
3717
+ } else if (typeof responseData === 'string') {
3718
+ materializedSize =
3719
+ typeof TextEncoder === 'function'
3720
+ ? new TextEncoder().encode(responseData).byteLength
3721
+ : responseData.length;
3722
+ }
3723
+ }
3724
+ if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {
3725
+ throw new AxiosError(
3726
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
3727
+ AxiosError.ERR_BAD_RESPONSE,
3728
+ config,
3729
+ request
3730
+ );
3731
+ }
3732
+ }
3733
+
3335
3734
  !isStreamResponse && unsubscribe && unsubscribe();
3336
3735
 
3337
3736
  return await new Promise((resolve, reject) => {
@@ -3347,6 +3746,17 @@ const factory = (env) => {
3347
3746
  } catch (err) {
3348
3747
  unsubscribe && unsubscribe();
3349
3748
 
3749
+ // Safari can surface fetch aborts as a DOMException-like object whose
3750
+ // branded getters throw. Prefer our composed signal reason before reading
3751
+ // the caught error, preserving timeout vs cancellation semantics.
3752
+ if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError) {
3753
+ const canceledError = composedSignal.reason;
3754
+ canceledError.config = config;
3755
+ request && (canceledError.request = request);
3756
+ err !== canceledError && (canceledError.cause = err);
3757
+ throw canceledError;
3758
+ }
3759
+
3350
3760
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3351
3761
  throw Object.assign(
3352
3762
  new AxiosError(
@@ -3415,11 +3825,13 @@ const knownAdapters = {
3415
3825
  utils$1.forEach(knownAdapters, (fn, value) => {
3416
3826
  if (fn) {
3417
3827
  try {
3418
- Object.defineProperty(fn, 'name', { value });
3828
+ // Null-proto descriptors so a polluted Object.prototype.get cannot turn
3829
+ // these data descriptors into accessor descriptors on the way in.
3830
+ Object.defineProperty(fn, 'name', { __proto__: null, value });
3419
3831
  } catch (e) {
3420
3832
  // eslint-disable-next-line no-empty
3421
3833
  }
3422
- Object.defineProperty(fn, 'adapterName', { value });
3834
+ Object.defineProperty(fn, 'adapterName', { __proto__: null, value });
3423
3835
  }
3424
3836
  });
3425
3837
 
@@ -3561,8 +3973,15 @@ function dispatchRequest(config) {
3561
3973
  function onAdapterResolution(response) {
3562
3974
  throwIfCancellationRequested(config);
3563
3975
 
3564
- // Transform response data
3565
- response.data = transformData.call(config, config.transformResponse, response);
3976
+ // Expose the current response on config so that transformResponse can
3977
+ // attach it to any AxiosError it throws (e.g. on JSON parse failure).
3978
+ // We clean it up afterwards to avoid polluting the config object.
3979
+ config.response = response;
3980
+ try {
3981
+ response.data = transformData.call(config, config.transformResponse, response);
3982
+ } finally {
3983
+ delete config.response;
3984
+ }
3566
3985
 
3567
3986
  response.headers = AxiosHeaders.from(response.headers);
3568
3987
 
@@ -3574,11 +3993,16 @@ function dispatchRequest(config) {
3574
3993
 
3575
3994
  // Transform response data
3576
3995
  if (reason && reason.response) {
3577
- reason.response.data = transformData.call(
3578
- config,
3579
- config.transformResponse,
3580
- reason.response
3581
- );
3996
+ config.response = reason.response;
3997
+ try {
3998
+ reason.response.data = transformData.call(
3999
+ config,
4000
+ config.transformResponse,
4001
+ reason.response
4002
+ );
4003
+ } finally {
4004
+ delete config.response;
4005
+ }
3582
4006
  reason.response.headers = AxiosHeaders.from(reason.response.headers);
3583
4007
  }
3584
4008
  }
@@ -3588,8 +4012,6 @@ function dispatchRequest(config) {
3588
4012
  );
3589
4013
  }
3590
4014
 
3591
- const VERSION = "1.15.0";
3592
-
3593
4015
  const validators$1 = {};
3594
4016
 
3595
4017
  // eslint-disable-next-line func-names
@@ -3673,7 +4095,9 @@ function assertOptions(options, schema, allowUnknown) {
3673
4095
  let i = keys.length;
3674
4096
  while (i-- > 0) {
3675
4097
  const opt = keys[i];
3676
- const validator = schema[opt];
4098
+ // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
4099
+ // a non-function validator and cause a TypeError.
4100
+ const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
3677
4101
  if (validator) {
3678
4102
  const value = options[opt];
3679
4103
  const result = value === undefined || validator(value, opt, options);
@@ -3832,7 +4256,7 @@ class Axios {
3832
4256
  let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
3833
4257
 
3834
4258
  headers &&
3835
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
4259
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
3836
4260
  delete headers[method];
3837
4261
  });
3838
4262
 
@@ -3935,7 +4359,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
3935
4359
  };
3936
4360
  });
3937
4361
 
3938
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
4362
+ utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
3939
4363
  function generateHTTPMethod(isForm) {
3940
4364
  return function httpMethod(url, data, config) {
3941
4365
  return this.request(
@@ -3955,7 +4379,11 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
3955
4379
 
3956
4380
  Axios.prototype[method] = generateHTTPMethod();
3957
4381
 
3958
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
4382
+ // QUERY is a safe/idempotent read method; multipart form bodies don't fit
4383
+ // its semantics, so no queryForm shorthand is generated.
4384
+ if (method !== 'query') {
4385
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
4386
+ }
3959
4387
  });
3960
4388
 
3961
4389
  /**